[antlr-interest] Problem with AntlrWorks 1.3.1 Interpreter

shmuel siegel antlr at shmuelhome.mine.nu
Tue Feb 2 22:24:31 PST 2010


Sorry, left out HEX_DIGIT in the posted grammar, but it doesn't change 
the results.
fragment
HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;

On 2/3/2010 1:06 AM, shmuel siegel wrote:
> I am having inconsistent results with the antlrworks interpreter. The
> following grammar gives a mismatched token exception while processing
> the string part of
>
> #include "abc"
>
>
> The debugger works fine with this grammar. If I remove ESC_SEQ from the
> definition of STRING, the interpreter works fine. FWIW STRING was
> auto-generated from the antlrworks new grammar wizard.
>
>
> grammar test;
>
> prog:     INCLUDE STRING;
> INCLUDE     :     '#include';
>
> STRING
>       :  '"' ( ESC_SEQ | ~('\\'|'"') )* '"'
>       ;
>
> fragment
> ESC_SEQ
>       :   '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
>       |   UNICODE_ESC
>       |   OCTAL_ESC
>       ;
>
> fragment
> OCTAL_ESC
>       :   '\\' ('0'..'3') ('0'..'7') ('0'..'7')
>       |   '\\' ('0'..'7') ('0'..'7')
>       |   '\\' ('0'..'7')
>       ;
>
> fragment
> UNICODE_ESC
>       :   '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
>       ;
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>    




More information about the antlr-interest mailing list