Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312062

Summary: ANTLR3-based ATL compiler does not correctly handle dot after integer
Product: [Modeling] MMT.ATL Reporter: Frédéric Jouault <frederic.jouault>
Component: EngineAssignee: mmt-atl.toolkit-inbox <mmt-atl.toolkit-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dwagelaar
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frédéric Jouault CLA 2010-05-07 09:47:52 EDT
Integers followed by dots are not correctly handled by the ATL parser.

For instance, when 1.toString() is parsed, number 1 is considered as a RealExp because of the dot. However, no error is reported. The correct behaviour is to consider number 1 as an IntExp.

To correct this issue, the lexer needs to be modified from this:

INT
        :	(DIGIT)+
        ;

FLOAT	:	DIGIT+ (('.' DIGIT)=>'.' DIGIT+)?	;


to this:

INT
        : (DIGIT)+
        (|{ ((input.LA(2) >= '0') && (input.LA(2) <= '9')) }? => '.' DIGIT+ {$type
= FLOAT;})
        ;

because it seems that the syntactical predicate of the ealier version is not sufficient (or maybe incorrect), whereas the semantic predicate of the later version works.
Comment 1 Frédéric Jouault CLA 2010-05-07 09:49:38 EDT
The proposed solution has been committed to CVS HEAD.
Comment 2 Dennis Wagelaar CLA 2017-06-05 09:23:54 EDT
This was released for ATL 3.1 or earlier - closing.