| Summary: | ANTLR3-based ATL compiler does not correctly handle dot after integer | ||
|---|---|---|---|
| Product: | [Modeling] MMT.ATL | Reporter: | Frédéric Jouault <frederic.jouault> |
| Component: | Engine | Assignee: | 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: | |||
The proposed solution has been committed to CVS HEAD. This was released for ATL 3.1 or earlier - closing. |
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.