[antlr-interest] Look-ahead problem parsing phrase?

Sean O'Dell sean at celsoft.com
Sun Jun 28 14:21:54 PDT 2009


I gave it a shot at your suggestion, with the same results.

Why should lexer rules not refer to other lexer rules without being
fragments?  I've read that doing so only prevented token creation.  It
affects logic, as well?

Sean

On Sun, Jun 28, 2009 at 2:05 PM, Gavin Lambert <antlr at mirality.co.nz> wrote:

> At 05:54 29/06/2009, Sean O'Dell wrote:
>
>>    WS : (' '|'\t')+;
>>    DIGIT : ('0'..'9');
>>    LETTER : ('a'..'z'|'A'..'Z');
>>    NEWLINE : '\r'? '\n';
>>
>>    WORD : (LETTER|DIGIT)+;
>>
>>    EOL : WS? NEWLINE?;
>>
>>    PHRASE : WORD (WS WORD)*;
>>
>>    line : WS? PHRASE EOL?;
>>
>
> Turn DIGIT and LETTER into fragment rules.
> Turn EOL and PHRASE into parser rules.
>
> (In general, a lexer rule should not refer to any other lexer rule, unless
> that rule is a fragment.)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090628/59a15589/attachment.html 


More information about the antlr-interest mailing list