SmaCCRefactoring / SmaCC

Smalltalk Compiler Compiler : a parser generator
Other
32 stars 15 forks source link

Incorrect matching of { ^ '1'} #19

Closed ThierryGoubier closed 7 years ago

ThierryGoubier commented 7 years ago

When writing { ^ '1' } instead of { '1'}, type inference for Ast node variables is unable to determine proper type.

Example:

<number> : \d+; <whitespace> : \s+; 
%root Parse ; %prefix Tuto; %suffix Node;
%left "+" "-" ;
Expression : Expression 'left' "+" 'operator' Expression 'right' {{Binary}}
    | Expression 'left' "-" 'operator' Expression 'right' {{Binary}}
    | Number {^'1'}
    | "(" 'leftParen' Expression ")" 'rightParen' {{Expression}} ;
Number : <number> 'number' {{Number}} ;
ThierryGoubier commented 7 years ago

Closed by 7a53c96