Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312062 - ANTLR3-based ATL compiler does not correctly handle dot after integer
Summary: ANTLR3-based ATL compiler does not correctly handle dot after integer
Status: CLOSED FIXED
Alias: None
Product: MMT.ATL
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: mmt-atl.toolkit-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-07 09:47 EDT by Frédéric Jouault CLA
Modified: 2017-06-05 09:23 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.