[Gambas-user] Spawned From: Need help with TextEditor (LONG VERSION)
bb
adamnt42 at gmail.com
Mon Sep 20 00:56:10 CEST 2021
On Mon, 2021-09-20 at 06:23 +0930, bb wrote:
> By sheer co-incidence (damn you Universe!) I need to parse a .form
> file
> for purposes of some standard code generators. The goals being to
> output a tree of some kind of objects representing all the controls
> in
> a form or a container in a form.
> Did those involved in that thread have such a beast that they could
> share?
>
> tia
> bruce
>
> [Long version will follow, you can ignore it if uninterested]
>
>
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
Here is the project "spec" thanks to our "new" BA.
getCtls dev notes
Created 18 September 2021
Goals
The goals of this project are to implement a tool that will ease
development of Gambas form code by providing generated code for:
* loading the form from an persisted object ("Unmarshalling"),
* loading the form data back into the persisted object
("Marshalling"),
* detecting user changes to the form data (and setting an "isDirty"
property on the control)
Basic Use Case
* The user invokes the tool providing the project path, form name,
code type and [Optionally] a specific container in the form.
* The system parses the project ".form" file and places the specified
code type on the system clipboard1.
* The user pastes the clipboard item in the IDE code editor where
required.
Parameters
project path
The full path to the Gambas project directory, not terminated with "/".
form name
The base name of the form file, i.e. without the ".form" suffix.
code type
The type of generated code to produce and copy to the clipboard. Valid
values, as per the goals above, are "unmarshall", "marshall",
"changed".
container
If a "container" CLI parameter is specified, then only the controls
within that container will be parsed and processed. If the container
does not exist in the form then the system will output a null ("")
string to the clipboard.
Note: At this juncture no fancy error handling will be implemented for
the CLI parameters.
Issues
* How to parse the {} delimited .form file syntax?
* At the moment only one code type at a time can be obtained. So the
tool must be run several times to get all the code blocks.
So, I have given Issue 1. a bit of a try and it appears to be harder
than it seemed (or I am looking at it the wrong way). How can I get a
"token" that is all the stuff between a {} pair? In other words, where
is the "}" that matches an initial "{" and then how do I get all the
included text without having to reparse all the file?
There must be a widely known way to do this.
regardsbruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210920/db641f92/attachment-0001.htm>
More information about the User
mailing list