Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Grammar question
icon5.gif  Grammar question [message #759990] Wed, 30 November 2011 14:30 Go to next message
Eclipse UserFriend
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.
Re: Grammar question [message #759992 is a reply to message #759990] Wed, 30 November 2011 15:03 Go to previous message
Eclipse UserFriend
Solved :

http://www.eclipse.org/forums/index.php/m/759997/#msg_759997

[Updated on: Wed, 30 November 2011 15:36] by Moderator

Previous Topic:Problems with generated grammar from existing ecore model
Next Topic:Handwritten formatter?
Goto Forum:
  


Current Time: Fri Jul 04 15:47:09 EDT 2025

Powered by FUDForum. Page generated in 0.02522 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top