Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » New symbols for literals
New symbols for literals [message #1722577] Sat, 06 February 2016 02:45 Go to next message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
I have 100% succeeded in creating a new "Measure" Literal in my DSL.
The ~ "keyword" is a bit weird however.

I started exploring alternatives, like
Re: New symbols for literals [message #1722578 is a reply to message #1722577] Sat, 06 February 2016 02:51 Go to previous messageGo to next message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
Well, it seems the forum does not like certain unicode characters Wink
I have tried using a character to "mark" my Measure Literal. It's currently the tilde ~ but I don't like it very much.
The new unicode character works perfectly, but there is no proposal in XBlockExpression... it's odd, considering my assignement: (set a.b.c = expression) works and proposes 'set' automatically.
Both rules are constructed exactly the same.

Can you think of a reason why certain expressions would have their initial keyword proposed in xbase and others not?

Assignment returns xbase::XExpression:
	{Assignment} 'set' address=DotExpression ('@' attribute=[Attribute] ('.' key=ID)?)? op=('='|':=') expression=(XExpression|XBlockExpression|Measure) 
;

Measure returns xbase::XExpression:
	{Measure} '~' measure=XNumberLiteral unit=ID
;

XPrimaryExpression returns xbase::XExpression:
	XConstructorCall |
	XBlockExpression |
	XSwitchExpression |
	XSynchronizedExpression |
	XFeatureCall |
	XLiteral |
	XIfExpression |
	XForLoopExpression |
	XBasicForLoopExpression |
	XWhileExpression |
	XDoWhileExpression |
	XThrowExpression |
	XReturnExpression |
	XTryCatchFinallyExpression |
	XParenthesizedExpression |
	Assignment | 
	Measure;
Re: New symbols for literals [message #1722589 is a reply to message #1722578] Sat, 06 February 2016 09:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
Hi first you can have a look at

XxxpropsalProvider. It should inherit a isKeyworthWorthyToPropose or
something like this method

And if you override rules you can do

Xxx:
super|MyAdditionalStuff


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: New symbols for literals [message #1722603 is a reply to message #1722589] Sat, 06 February 2016 13:48 Go to previous message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
So many ways to extend!
Thanks, it was the right answer, of course!
Previous Topic:How to implement generalization in XText ?
Next Topic:Exception in Intellij
Goto Forum:
  


Current Time: Fri Sep 24 13:14:35 GMT 2021

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

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

Back to the top