Xtext Grammar - usage of 'returns' [message #1046691] |
Mon, 22 April 2013 08:39 |
rohit ahuja 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 |
|
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>
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.01977 seconds