Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Strange behavior of INT(I am finding that there are certain numbers that cause failure in the generated DSL)
Strange behavior of INT [message #1016513] Wed, 06 March 2013 12:53 Go to next message
Robert Brown III is currently offline Robert Brown III
Messages: 35
Registered: July 2009
Member
Greetings:

Using the set of rules provided below:

Date : 'Date' ':' d=Day m=Month y=Year ;

Day : INT ;
Month : 'Jan'|'Feb'|'Mar'|'Apr' ;
Year : INT ;

I am seeing some very strange behavior in Day's input. I am noticing that single numbers (like 1 through 9) cause errors in the generated DSL. In other words, the line:

Date: 1 Mar 1912

causes "mismatched input" errors in the DSL.

Another thing that causes "mismatched input" errors is the use of the numbers 11 and 12. No lines can use these numbers at all. This includes lines like:

Date: 12 Mar 1999
or
Date: 11 Jan 2013

Curiously, the numbers 10 and 13 on up are accepted as INTs.

Something is clearly not kosher here. Could someone please explain how I can make INT take single-digit numbers and the numbers 11 and 12???

Thanks in advance for any insights and/or fixes...
Re: Strange behavior of INT [message #1016520 is a reply to message #1016513] Wed, 06 March 2013 13:31 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6213
Registered: July 2009
Senior Member
Hi,

the grammar

MOdel:
dates+=Date*
;

Date : 'Date' ':' d=Day m=Month y=Year ;

Day : INT ;
Month : 'Jan'|'Feb'|'Mar'|'Apr' ;
Year : INT ;

works fine for me so there must be some other terminals/keywords in your grammar that collide with INT
Previous Topic:Scoping of references in my DSL
Next Topic:Automatic Validation ( NoViableAltException)
Goto Forum:
  


Current Time: Fri Aug 22 13:49:26 EDT 2014

Powered by FUDForum. Page generated in 0.01696 seconds