Rules which produce just terminals

74 Views Asked by At

I am wondering if this is a bug in version 4:

grammar EntitySQL;

SELECT: 'SELECT' ;

WS: (' ' | '\t' | '\n' | '\r')+ -> skip;

ID: NameStartChar NameChar* ;

NameStartChar: 'a'..'z'|'A'..'Z'|'_';
NameChar: NameStartChar | '0'..'9';

ALIAS: ID ;

r: SELECT ALIAS ;

If I test with SELECT PIPPO it claims mismatch for ALIAS. If I replace the rule with:

r: SELECT ID ;

it works. Apparently I cannot have rules where the non-terminal just translate to a terminal node?

0

There are 0 best solutions below