Hello,
I am trying to implement a small DSL. it shall be possible to specify a enumeration with a name and elements
I want to cross reference them like this: enumerationName.element.
I managed that the cross reference works but i have the following problem:
In the AST is only the EnumerationElement and not the enumeration type. But i need both.
Here the grammar
Root:
(elements+=Element)*
;
Element
: Enum
| Expression
;
Enum:
'enum' name=ID '{'
(element+=EnumElement)*
'}'
;
EnumElement:
name = ID
;
Expression:
a=[Attribute| ENUMTERMINALRULE]
;
Attribute:
Enum | EnumElement
;
ENUMTERMINALRULE: ID"."ID;
And here an Example
enum greeting{
hello
goodMorning
}
enum who {
you
me
i
}
greeting.goodMorning
who.me
who.hello //error
Everything is working as i want it to. But a contains only the EnumerationElement and not the Enum name. Is there a possibility to get both values?