Skip to main content


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 17:53 Go to next message
Robert Brown III is currently offline Robert Brown IIIFriend
Messages: 36
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 18:31 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Scoping of references in my DSL
Next Topic:Automatic Validation ( NoViableAltException)
Goto Forum:
  


Current Time: Mon Sep 23 07:08:44 GMT 2024

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

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

Back to the top