Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Xtext Grammar - usage of 'returns'
Xtext Grammar - usage of 'returns' [message #1046691] Mon, 22 April 2013 04:39 Go to next message
Eclipse UserFriend
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 13:50 Go to previous message
Eclipse UserFriend
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: Tue Jul 01 13:59:28 EDT 2025

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

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

Back to the top