Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Grammar - usage of 'returns'
Xtext Grammar - usage of 'returns' [message #1046691] Mon, 22 April 2013 08:39 Go to next message
rohit ahuja is currently offline rohit ahujaFriend
Messages: 27
Registered: February 2013
Junior Member
Hi All,
Below is a part of my grammar in which i am getting some error.


Instance:
'STRUCT' name=ID';'
;

Assignment returns Parameter:
name=AssignmentName '=' defaultValue=INT ';'
;


// The Parameter rule, is actually part of an existing ecore model, which is defined as
//name - EString
//defaultValue - INT

AssignmentName returns EString :
var=[Instance]'.'param=ID

// i need something like [Instance].[Parameter] and the concatenated thing to go to name, but if use
//var=[Instance]'.'param=[Parameter], it doesnt work, so i have put in a validator to check it,
is there any direct way?

;

I have two queries:

1) is stated above
2)I am getting an error as
"Cannot find compatible feature name in sealed EClass Parameter
from imported package http.........:
The existing feature 'name' has an incompatible type 'EString'
[java.lang.String]. The expected type is 'EString'."

I am confused as to why this message is, even though the message says both are EString.

I think i am missing something. Can anyone please help?

Thanks in Advance,
Rohit
Re: Xtext Grammar - usage of 'returns' [message #1047034 is a reply to message #1046691] Mon, 22 April 2013 17:50 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6550
Registered: July 2009
Senior Member
Hi,

this makes no sense to me a EString is for datatypes/terminals only and not for EObjects
from your post i am not quite sure what you actually want to do.

Maybe you want todo something like

Assignment:
param=[Parameter|PName] '=' defaultValue=INT ';'
;

PName: ID "." ID;

with propery naming or adoptions to scoping/nameing it will work out of the box

(giving the params the name <instancename>.<paramname>
Previous Topic:Can I use Xtext for a DSL containing javascript?
Next Topic:Exporting Xtext plugin with Scala classes
Goto Forum:
  


Current Time: Sun Dec 21 17:58:47 GMT 2014

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

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