Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtext2] Extending Xbase expressions
[Xtext2] Extending Xbase expressions [message #663678] Wed, 06 April 2011 03:39 Go to next message
Ingo Meyer is currently offline Ingo Meyer
Messages: 115
Registered: July 2009
Senior Member
Hello,

today I started to "play" with Xtext 2.
Seems to be very very good.

My first try is to extend xBase by adding own literals and functions.
But I absolutely have no idea cause I immediately get

"Cannot add supertype 'xxx' to sealed type 'XExpression'."

whenever I try to override something.

Can somebody please give me a hint how to start.

I tried something like:

XDecimalLiteral returns XExpression :
	{XDecimalLiteral} value=DECIMAL;


and I want to integrate that:

XLiteral:
	XClosure |
	XBooleanLiteral |
	XIntLiteral |
	XDecimalLiteral |
	XNullLiteral |
	XStringLiteral |
	XTypeLiteral
;


but got "Cannot add supertype 'XLiteral' to sealed type 'XExpression'."

[Updated on: Wed, 06 April 2011 03:40]

Report message to a moderator

Re: [Xtext2] Extending Xbase expressions [message #663699 is a reply to message #663678] Wed, 06 April 2011 05:02 Go to previous message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1759
Registered: July 2009
Senior Member
Please note, that the Xtext newsgroup is eclipse.modeling.tmf.

Am 4/6/11 9:39 AM, schrieb Ingo Meyer:
>
> XLiteral:
> XClosure |
> XBooleanLiteral |
> XIntLiteral |
> XDecimalLiteral |
> XNullLiteral |
> XStringLiteral |
> XTypeLiteral
> ;
>
>
> but got "Cannot add supertype 'XLiteral' to sealed type 'XExpression'."

You need to explicitly declare the return type:

XLiteral returns XExpression :
...
;

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Previous Topic:[Acceleo3] Meta model in separate project
Next Topic:[xtend] HowTo: Enum as a parameter in switch-case
Goto Forum:
  


Current Time: Fri Jul 25 09:03:47 EDT 2014

Powered by FUDForum. Page generated in 0.01469 seconds