Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Linking XCastExpression to a "toX" function
Linking XCastExpression to a "toX" function [message #1774571] Tue, 17 October 2017 12:54 Go to next message
Stephane Galland is currently offline Stephane GallandFriend
Messages: 110
Registered: July 2014
Location: Belfort, France
Senior Member
Dear all.

In my DSL, I would like to enable operator overriding for the cast expressions.
My idea is:

Let the following code:
var x = ...
var y = x as String
var z = x as Y


"x as String" should be map to the Java code "x.toString()".

"x as Y" should be be map to the Java code:
* "x.toY()" if this instance function is defined and accessible,
* "toY(x)" if this class function is defined and accessible,
* "(Y) x" otherwise

My question is: what are the typical classes within Xbase to be extended for enabling this behavior?

I think about:
* XbaseCompiler for generating the Java code,
* DSLValidator for changing the validation test.

What else?

Thank in advance.
Stéphane.


Dr.habil Stéphane Galland.
Belfort-Montbéliard University of Technologie, France.

http://www.multiagent.fr/People:Galland_stephane
http://www.sarl.io
http://www.arakhne.org
Re: Linking XCastExpression to a "toX" function [message #1774572 is a reply to message #1774571] Tue, 17 October 2017 12:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11605
Registered: July 2009
Senior Member
XbaseCompiler. Possibly Validator. Possibly FeatureScopes
Xbase Type Computer. Maybe XExpressionHelper


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Linking XCastExpression to a "toX" function [message #1774574 is a reply to message #1774572] Tue, 17 October 2017 13:02 Go to previous message
Stephane Galland is currently offline Stephane GallandFriend
Messages: 110
Registered: July 2014
Location: Belfort, France
Senior Member
Thank you, I will start to work based on this list of classes.

Stéphane.


Dr.habil Stéphane Galland.
Belfort-Montbéliard University of Technologie, France.

http://www.multiagent.fr/People:Galland_stephane
http://www.sarl.io
http://www.arakhne.org
Previous Topic:Expression Language: Using ".*" in combination with Decimal Numbers
Next Topic:Xtext Standalone: Add/Remove/Modify resources
Goto Forum:
  


Current Time: Sat Jan 20 22:34:47 GMT 2018

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

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