Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext grammar which do not generate an EMF java interface(Build a generator based on the pared EMF metamodel)
Xtext grammar which do not generate an EMF java interface [message #1784472] Wed, 28 March 2018 11:17 Go to next message
Thanh Huynh is currently offline Thanh HuynhFriend
Messages: 3
Registered: March 2018
Junior Member
I had a given grammar in Xtext, the rules is defined as following:

TExpression:
PARENTHESIS_OPEN TypeE PARENTHESIS_CLOSE | EXCLAMATION TExpression| TypeA| TypeB | TypeC |
TypeD;
PARENTHESIS_OPEN:
'(';

PARENTHESIS_CLOSE:
')';
EXCLAMATION:
'!';


When I generate the EMF metamodel for this grammar specification, I only have the java interface for TExpression rule.

So how can I make the distinction in my generator that I am working with 'TExpression' object or ' EXCLAMATION TExpression' object?
Re: Xtext grammar which do not generate an EMF java interface [message #1784479 is a reply to message #1784472] Wed, 28 March 2018 13:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12390
Registered: July 2009
Senior Member
EXCLAMATION:
{EXCLAMATION}'!';


p.s: please use assignments in your grammar.


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 28 March 2018 13:37]

Report message to a moderator

Re: Xtext grammar which do not generate an EMF java interface [message #1784537 is a reply to message #1784479] Thu, 29 March 2018 07:31 Go to previous messageGo to next message
Thanh Huynh is currently offline Thanh HuynhFriend
Messages: 3
Registered: March 2018
Junior Member
Hi Christian,

It's not work in the way you mentioned. I got this following error at the definition of TExpression

Quote:
Multiple markers at this line
- An unassigned rule call is not allowed, when the 'current'
was already created.
- Cannot change type twice within a rule


Do you have any idea on how to fix it?
Re: Xtext grammar which do not generate an EMF java interface [message #1784539 is a reply to message #1784537] Thu, 29 March 2018 07:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12390
Registered: July 2009
Senior Member
can you please share a actualy minimal but complete grammar example

TExpression:
PARENTHESIS_OPEN TypeE PARENTHESIS_CLOSE | EXCLAMATION TExpression| TypeA| TypeB | TypeC |
TypeD;

makes no sense as i said


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext grammar which do not generate an EMF java interface [message #1784540 is a reply to message #1784539] Thu, 29 March 2018 07:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12390
Registered: July 2009
Senior Member
TExpression:
"(" TypeE ")" | ({NotExpression}"!" expr=TExpression)| TypeA| TypeB | TypeC |
TypeD;

might


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext grammar which do not generate an EMF java interface [message #1784548 is a reply to message #1784540] Thu, 29 March 2018 08:49 Go to previous message
Thanh Huynh is currently offline Thanh HuynhFriend
Messages: 3
Registered: March 2018
Junior Member
Your suggestion worked for the '{Not Expression}'.....
Thank you so much!
Previous Topic:Auto edit DSL file on compile
Next Topic:Load external metamodel for LSP using gradle
Goto Forum:
  


Current Time: Mon Nov 19 21:48:23 GMT 2018

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

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

Back to the top