|Best practice [message #1027781]
||Wed, 27 March 2013 12:03
| Stefano Cottafavi
Registered: July 2009
this is very basic question about best practice developing a DSL editor.
I've to create an editor for a given "properties file"; its content could be resumed with this scheme
valA keyA -optionalcomment
valB keyB -optionalcomment
valZ keyZ -optionalcomment
the file has a fixed structure:
- "keys" must appear in specific row, no key-row can be left out
- "values" can be bool,num(int or float),string, or array of them (again I know exactly which will be bools and where strings due to the fixed structure)
- "spaces" are important in this case (as in CSV files). space (or tab) separates key from value and value from optional comment
My xtext looks like this
pair1 = VarBOOL
pair2 = VarNUM
pair3 = VarNUM
pair4 = VarSTRING
pair5 = VarSTRING
value=BOOL WS key=NAME WS;
value=NUMBER WS key=NAME WS;
value=STRING WS key=NAME WS;
in the terminals I've separated WS from NEWLINE.
the grammar compiles fine, the scheme adopted allow to keep the grammar quite conscise (except for the fact that the property files has more that 50 rows)
the editor generated is used in a MPE along with a form editor.
so I'm asking here if this is good to go or if, looking forward (contentproposal, quickfix, outline), could be better to make the key actual "keywords" as they really are for example like "key1"|"key2"|...
how this will affect the resulting model?
thank you for your time
Powered by FUDForum
. Page generated in 0.02377 seconds