Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Decision can match input such as "RULE_INT" using multiple alternatives: 2, 3
Decision can match input such as "RULE_INT" using multiple alternatives: 2, 3 [message #741443] Wed, 19 October 2011 14:37 Go to next message
Steffen Schuette is currently offline Steffen SchuetteFriend
Messages: 26
Registered: August 2010
Junior Member
Hi, folks!

I got a seemlingly simple problem but am unable to solve it.
What I want to achieve is to have the possibility in my DSL to define variables and assign them constant values, e.g.:

----
varA:int
varB:float

varA = 1 //an int value
varB = 0.3//a float value
----

Therefore I added the following structure:

Parameter:
	name=ID':'valueType=DataTypeEnum; //DataTypeEnum

Constant:
	FloatValue|
	IntValue;

FloatValue:
	value=FLOAT;

IntValue:
	value=INT;

ParameterInstance:
	instanceOf=[Parameter] '='
	value = Constant; //Later other expressions will follow, i.e. Constant will be a subclass of Expression


However, this gives me the following error when creating the DSL:

16920 [main] INFO or.validation.JavaValidatorFragment - generating Java-based EValidator API
warning(200): ../aik.mosl.ui/src-gen/de/aik/mosl/ui/contentassist/antlr/internal/InternalMoSL.g:1850:1: Decision can match input such as "RULE_INT" using multiple alternatives: 2, 3
As a result, alternative(s) 3 were disabled for that input
error(201): ../aik.mosl.ui/src-gen/de/aik/mosl/ui/contentassist/antlr/internal/InternalMoSL.g:1850:1: The following alternatives can never be matched: 3


I understand that this message occurs but the problem seems so usual. I mean how do you model such things. They occur in every regular programming language.

Can you help me?

Thanks

Steffen
Re: Decision can match input such as "RULE_INT" using multiple alternatives: 2, 3 [message #741478 is a reply to message #741443] Wed, 19 October 2011 15:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14677
Registered: July 2009
Senior Member
Hi,

how does your float rule look like?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Decision can match input such as "RULE_INT" using multiple alternatives: 2, 3 [message #741502 is a reply to message #741478] Wed, 19 October 2011 15:39 Go to previous messageGo to next message
Steffen Schuette is currently offline Steffen SchuetteFriend
Messages: 26
Registered: August 2010
Junior Member
Sorry, its:

FLOAT:
	INT ('.' INT)?;


Thanks

Steffen
Re: Decision can match input such as "RULE_INT" using multiple alternatives: 2, 3 [message #741511 is a reply to message #741502] Wed, 19 October 2011 15:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14677
Registered: July 2009
Senior Member
Hi,

then the problem is clear

if you have a model like 1 is this the IntValue 1 or the FloatValue 1
so you may change the Float to
FLOAT: INT '.' INT;



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Decision can match input such as "RULE_INT" using multiple alternatives: 2, 3 [message #741547 is a reply to message #741511] Wed, 19 October 2011 16:28 Go to previous message
Steffen Schuette is currently offline Steffen SchuetteFriend
Messages: 26
Registered: August 2010
Junior Member
Oh, of course!

Sorry for wasting your time Smile

Thanks

Steffen
Previous Topic:Block scope, validation, linking and content assist
Next Topic:[Xtext] Open source projects using Xtext
Goto Forum:
  


Current Time: Fri May 10 22:54:55 GMT 2024

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

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

Back to the top