|
|
Re: Splitting grammar in multiple files, not projects [message #1870953 is a reply to message #1870950] |
Wed, 11 September 2024 19:22 |
Ralph Hummeling Messages: 7 Registered: July 2024 |
Junior Member |
|
|
Alright, so in essence we define grammar B to extend grammar A and then import grammar A
grammar B with A
import A as a
Furthermore, in the workflow we define all the grammars and references per grammar:
referencedResource="platform:/resource/<...>/A.xtext"
Are there any limitations to this setup? I believe I've encountered a 'Sealed' exception when trying to extend a production rule.
[Updated on: Wed, 11 September 2024 19:23] Report message to a moderator
|
|
|
|
Re: Splitting grammar in multiple files, not projects [message #1870968 is a reply to message #1870959] |
Thu, 12 September 2024 08:15 |
Ralph Hummeling Messages: 7 Registered: July 2024 |
Junior Member |
|
|
Say in grammar A we have a production rule:
RuleX: 'Hello' name=ID '!';
In grammar B we have a rule which refers this rule:
grammar B with A
import A
RuleY: RuleX | 'Goodbye';
This gives the error: "Cannot add supertype 'RuleY' to sealed type 'RuleX', but can be resolved by assigning RuleX to a feature:
grammar B with A
import A
RuleY: x=RuleX | y='Goodbye';
However, I'd prefer to extend RuleX instead of encapsulating it in a feature.
I made this construct with actions to resolve:
RuleY: {RuleX} f=RuleX | {RuleZ} f='Goodbye';
but perhaps there are better ways...
[Updated on: Thu, 12 September 2024 10:16] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04249 seconds