[XText] Grouping parser rule assignment into a reusable block in grouping pattern [message #1711873] |
Tue, 20 October 2015 08:29 |
Ronan B Messages: 273 Registered: July 2009 |
Senior Member |
|
|
Hi,
I'm refactoring an XText grammar to not use un-ordered groups as it causes XText to run out of memory even after assigning 3GB. Reading the article, from the bottom, https://www.eclipse.org/forums/index.php/t/164906/ Sebastian Zarnekow suggests an elegent way of refactoring the groups. However, I have many single value properties I wish to intersperse amongst my groups. This means I must restate my grouping grammars many times which is a pain. Is there a handy way of defining them once and reusing?
For example:
MyRule returns myMM::MyRule:
'mykeyword' name=(ID) (';' |
'{'
(group1+=Group1|group2+=Group2|group3+=Group3)*
('description' description=(ConcenatedString|QuotedConcenatedString) ';'
(group1+=Group1|group2+=Group2|group3+=Group3)*?
('reference' reference=(ConcenatedString|QuotedConcenatedString) ';'
(group1+=Group1|group2+=Group2|group3+=Group3)*?
('status' status=StatusKind ';'
(group1+=Group1|group2+=Group2|group3+=Group3)*?
'}')
;
Obviously the (group1+=Group1|group2+=Group2|group3+=Group3)* part is not very maintainable if I have to repeat it 10->20 times.
Thanks!
Ronan
[Updated on: Tue, 20 October 2015 08:32] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03374 seconds