Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Grammar question
icon5.gif  Grammar question [message #759990] Wed, 30 November 2011 19:30 Go to next message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
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 20:03 Go to previous message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
Solved :

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

[Updated on: Wed, 30 November 2011 20:36]

Report message to a moderator

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


Current Time: Fri Feb 26 22:38:12 GMT 2021

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

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

Back to the top