Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Has Xtext a limited depth for grammars?
Has Xtext a limited depth for grammars? [message #897133] Sun, 22 July 2012 08:17 Go to next message
Martin Girschick is currently offline Martin GirschickFriend
Messages: 10
Registered: July 2009
Junior Member
I've found a strange effect in the following grammar:

grammar org.xtext.bug.BuggyDsl with org.eclipse.xtext.common.Terminals

generate buggyDsl "..."

Model:
	(types+=Type)*;
	
Type:
	BaseType | EntityType | Reference;
	
BaseType:
	PrimitiveType | StructuredType;

PrimitiveType:
	StringType | NumberType;
	
StringType:
	"string" name=ID length=INT;

NumberType:
	"number" name=ID scale=INT precision=INT;

StructuredType:
	"structure" name=ID "{"
		(attributes+=Attribute)*
	"}";
	
EntityType:
	"entity" name=ID "{"
		(properties+=Property)*
	"}";

Property:
	Attribute | UnaryReference | MultipleReference;
	
Attribute:
	baseType=[BaseType|ID] name=ID;

Reference:
	UnaryReference | MultipleReference;

UnaryReference:
	"unary-ref" targetEntity=[EntityType|ID] name=ID; 

MultipleReference:
	"multi-ref" targetEntity=[EntityType|ID] name=ID; 
	


When I change the rule for "Property" to the more obvious...

Property:
	Attribute | Reference;


...the Xtext editor complains that "There may not be two features named 'name'". This grammar worked with Xtext1 in oAW as far as I know.

Any ideas?

Martin
Re: Has Xtext a limited depth for grammars? [message #897135 is a reply to message #897133] Sun, 22 July 2012 09:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13359
Registered: July 2009
Senior Member
Hi

your grammar works for me with Xtext 230

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Has Xtext a limited depth for grammars? [message #897137 is a reply to message #897135] Sun, 22 July 2012 09:50 Go to previous messageGo to next message
Martin Girschick is currently offline Martin GirschickFriend
Messages: 10
Registered: July 2009
Junior Member
Strange. I just once more unpacked Eclipse Juno+Xtext ("eclipse-SDK-4.2-Xtext-2.3.0-win32.zip"), started it, created an Xtext project and pasted the grammar above (with the changed rule listed at the end of my initial posting). I immediatly get the syntax error mentioned above - strange :-/.
Re: Has Xtext a limited depth for grammars? [message #897138 is a reply to message #897137] Sun, 22 July 2012 10:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13359
Registered: July 2009
Senior Member
Sorry i missread your posing. please file a bugzilla

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Has Xtext a limited depth for grammars? [message #897151 is a reply to message #897138] Sun, 22 July 2012 16:05 Go to previous messageGo to next message
Martin Girschick is currently offline Martin GirschickFriend
Messages: 10
Registered: July 2009
Junior Member
Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=385675
Re: Has Xtext a limited depth for grammars? [message #897190 is a reply to message #897151] Mon, 23 July 2012 06:14 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3107
Registered: July 2009
Senior Member
Am 22.07.12 18:05, schrieb Martin Girschick:
> Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=385675

Taken from the ticket:

What your grammar describes is bascially that a Reference is a Type and
Property. Both, Type and Property define an attribute called 'name' which is
illegal in EMF since reference may not inherit the a field called 'name'
from
both super classes. By changing the rule 'Property' you implicitly
change the
inheritance relationship of Reference. Therefore the modified grammar works.
You may want to switch to an imported ecore model to get rid of that.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:MWE2 workflow with xpand2.Generator and Beautifier fails
Next Topic:XText Developer Documentation
Goto Forum:
  


Current Time: Sun Feb 23 14:54:28 GMT 2020

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

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

Back to the top