Skip to main content


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 07:39 Go to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
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 07:40]

Report message to a moderator

Re: [Xtext2] Extending Xbase expressions [message #663699 is a reply to message #663678] Wed, 06 April 2011 09:02 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
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
Previous Topic:[Acceleo3] Meta model in separate project
Next Topic:[xtend] HowTo: Enum as a parameter in switch-case
Goto Forum:
  


Current Time: Thu Mar 28 09:53:55 GMT 2024

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

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

Back to the top