Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [solved] [Xbase] java like variable declaration
[solved] [Xbase] java like variable declaration [message #1421470] Thu, 11 September 2014 12:11 Go to next message
Simon Hofer is currently offline Simon HoferFriend
Messages: 4
Registered: September 2014
Junior Member
Hi,

I want to use XBase as expression language and shrank it to fit my needs. Now I have a problem and can't find a way to fix it. For variable declaration XBase has the rule
VariableDeclaration returns Expression:
	{VariableDeclaration}
	'def' (=>  (type=JvmTypeReference name=ValidID) | name=ValidID) ('=' right=Expression)?
;


But I don't want to use def as keyword. I'd like to write things like
int value = 15
value = 13


Atm the code above is interpreted as "int" is a FeatureCall and "value=15" is an Assignment, but "int value = 15" as whole should be an Assignment. When I delete "def" in the rule I get an error message while running the generator. I didn't touch anything, just shrank the XBase code.

[Updated on: Thu, 11 September 2014 13:09]

Report message to a moderator

Re: [Xbas] java like variable declaration [message #1421474 is a reply to message #1421470] Thu, 11 September 2014 12:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13278
Registered: July 2009
Senior Member
Hi,

the problem is that without the var keyword the grammar is amgibous i think


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xbas] java like variable declaration [message #1421475 is a reply to message #1421474] Thu, 11 September 2014 12:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13278
Registered: July 2009
Senior Member
https://www.eclipse.org/forums/index.php/m/1367389/?srch=xvariabledeclaration#msg_1367389

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xbas] java like variable declaration [message #1421509 is a reply to message #1421475] Thu, 11 September 2014 13:09 Go to previous message
Simon Hofer is currently offline Simon HoferFriend
Messages: 4
Registered: September 2014
Junior Member
Danke.

EDIT: I mean thank you Smile

[Updated on: Thu, 11 September 2014 13:10]

Report message to a moderator

Previous Topic:xcore, ecore, emf, xtext and maven
Next Topic:XText - Cannot load model in standalone setup
Goto Forum:
  


Current Time: Sat Dec 14 01:50:01 GMT 2019

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

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

Back to the top