Grammar for nested units [message #1791644] |
Tue, 03 July 2018 05:45  |
Eclipse User |
|
|
|
Hello,
I need to write grammar for nested units.
I am writing an example below.
Grammar:
grammar org.xtext.example.mydsl1.AnimalDsl with org.eclipse.xtext.common.Terminals
generate animalDsl "http://www.xtext.org/example/mydsl1/AnimalDsl"
Model:
animals+=Animals*;
Animals:
{Animals}(name = Name animal+= Animal* end+=End*);
Animal:
(name = Name e=End?);
Name:
name=ID;
End:
'END' pName=[Name|ID];
Model:
Pet
Dog
Cat
Mouse
END Mouse
End Cat
END Dog
Duck
END Duck
END Pet
Problem is "Duck", does not come in "Pet". In Outline view also, it shows at the same level as "Pet".
It should come under Pet as Pet is ending after Duck.
Could you please help with this.
Thanks and regards,
Virag Purnam
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05151 seconds