[antlr-interest] Lexer consumes input but doesn't emit all tokens

Андрей Асеев andron-eiu at mail.ru
Tue Aug 7 15:05:10 PDT 2012


It would be, at example, if you choose incorrect rule in ANTLRWorks 
interpreter rule box. :)

Or show there your gramar rule you use to parse test input.

> Given the partial grammar from a much larger...
>
>
> tokens { COLON = ':' }
>
> fragment
> ALPHA_NUM
>       :    'A'..'Z' | 'a'..'z' | '0'..'9';
>
> NAME_LITERAL
>       :    '\\'? ALPHA_NUM ( ( ':' | '_' | '-' | ALPHA_NUM )* ALPHA_NUM )? ;
>
> ANY    :    . ;
>
>
>
> I would like the input
>
> test:ack:
>
> to arrive as two tokens, a NAME_LITERAL of 'test:ack', and a COLON.
>
> Instead, this input disappears entirely, but parses successfully.
>
> Any suggestions?
>
> Glenn McGregor
-- 
С уважением, Асеев Андрей.
Начинающий Предприниматель, магистр прикладной математики, студент ИЮМ
http://1c.krasnodar.su




More information about the antlr-interest mailing list