I try to define some XText for specifiying variables according to following syntax
variables
MyVar1 : Bool at 0x020 value=true;
MyVar2, MyVar3 : Int at 0x030 value 200;
end-variables
So each definition is syntactically
VarName ["," VarName]* ":" Type ["at" HEX]? ["value" VALUE]? ";"
All variables shall be accessible by their reference and the result in the outline shall be someting like this:
variables
+-MyVar1 : Bool
+-MyVar2 : Int
+-MyVar3 : Int
Edit: As requested here my actual grammar, which is equivalent to the syntactical definition some lines above.
Variable:
name=ID
;
Declaration_Var:
'variables'
vars+=Declaration_Var_Body+
'end-variables' ';'
;
Declaration_Var_Body:
varDecl+=Variable(',' varDecl +=Variable)*
':' type=[TR_Any]
('at' address=HEX)?
;
TR_Any:
...
;
terminal HEX:
...
;
With this, following sequence of characters
variables
Test1, Test2, Test3 : DWORD at 0x20;
end_var;
results in an outline like this:
<unnamed>
+-- 0x20
| +-- Test1
| +-- Test2
| +-- Test3
which is almost the opposite of what I expected. What I expected and what I want to generate in the outline is something similar to this (the datatype and address must not show up there, but at least they must be accessible as properties of the generated class for variable declarations)
Test1
+-- DWORD
+-- 0x20
Test2
+-- DWORD
+-- 0x20
Test3
+-- DWORD
+-- 0x20