Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Terminal rules driving me nuts(Noob)
Terminal rules driving me nuts [message #1145742] Sat, 19 October 2013 19:09 Go to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
I have some parts of syntax where I need the following flexibility:

equ kfactor 1.3

rdax reg0, 1
rdax 32, -1
rdax reg1, 1.9
rdax reg3, -2.0
rdax reg3, kfactor
rdax reg3, -kfactor


So, arg1 can be an INT or an ID, while arg2 (ultimately resolving to a double) needs to be able to be represented as a +/- INT, +/- REAL, or +/- ID. "+" is never explicitly represented so I just need to accommodate the possibility of "-".

Trying to represent these possibilities as mutually exclusive terminal rules without unintended side effects is making my brain hurt. It seems like I should just explicitly declare terminal rules which could loosely handle what I just stated, and figure out the details in the data validator itself.

Just wondering what the general consensus is, since I read one of the tutorials which recommended against trying to be too clever with terminal rules.

Thanks,

GW

[Updated on: Sat, 19 October 2013 19:30]

Report message to a moderator

Re: Terminal rules driving me nuts [message #1145802 is a reply to message #1145742] Sat, 19 October 2013 20:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13488
Registered: July 2009
Senior Member
Hi

Did. you have a look at Datatype Rules?

MyStuff '-'? (ID | (INT ( "." ID)?));


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Terminal rules driving me nuts [message #1147014 is a reply to message #1145802] Sun, 20 October 2013 15:28 Go to previous message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Thanks Christian! That was just the hint I needed.
Previous Topic:xtext - formatting with new lines in the language
Next Topic:Problems with scoping after migrating to xtext 2.0
Goto Forum:
  


Current Time: Mon Jul 06 20:43:25 GMT 2020

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

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

Back to the top