[Xtext] Multiple objects in one line [message #482335] |
Wed, 26 August 2009 05:56  |
Eclipse User |
|
|
|
Hi there,
I have to parse multiple objects in one line like e.g. variable
declarations in Java or C:
int a,b,c;
float d,e,f;
This should be parsed into 6 objects of class Variable and the first
three have a type attribute "int" and the last three a type attribute
"float".
How could I do this?
Variable:
type=Type name=ID;
this only parses a single variable.
Variable:
type=Type name=ID
(',' {Variable.left=current} name=ID)*;
this correctly creates new Variable objects, but they have no type.
Additionally the objects have a strange parent relationship.
Adding the type=Type also to the comma separated part would expect
another "int" token after each comma.
Any other idea?
Cheers,
Hauke
|
|
|
|
|
|
|
Re: [Xtext] Multiple objects in one line [message #700100 is a reply to message #700099] |
Fri, 22 July 2011 16:48  |
Eclipse User |
|
|
|
Hi,
I found the second link myself but failed to realize how I could adapt it to suit my requirement (like I said, I've just gotten started with Xtext)
Thanks a lot for the first link, it looks like something I can grasp.
Amey
|
|
|
Powered by
FUDForum. Page generated in 0.15332 seconds