I have a little and maybe noob grammar question.
My code :
Greeting :
'module' name=ID '{'
innerElements += ModuleInnerElements*
'}'
;
ModuleInnerElements:
EntitieStatement
| InterceptorStatement
;
EntityStatement:
'entity' name=ID '{'
attributes += attributeStatement ((',' attributes += attributeStatement)?)*
'}'
;
InterceptorStatement:
'interceptor' name=ID '{'
//Not interesting things
'}'
In this case i cant have an interceptor and an entity with the same name
module {
entitie customer {
// Attributtes
}
interceptor customer {
// Not interesting things
}
}
i have an error, obviously, "Duplicate InnerElement", and i dont know the right way for acomplish this.
if i do this in this manner :
My code :
Greeting :
'module' name=ID '{'
Entities += EntityStatement*
Interceptors += InterceptorStatement*
'}'
;
EntityStatement:
'entity' name=ID '{'
attributes += attributeStatement ((',' attributes += attributeStatement)?)*
'}'
;
InterceptorStatement:
'interceptor' name=ID '{'
//Not interesting things
'}'
I avoid the "name" problem but, there is no the correct sintaxis because i cant make an interceptor and after and entity or an entity,interceptor,entity...
Any suggest?
Thanks, in advance.