[antlr-interest] ANTLR Lexer Contexts
Steve Bennett
stevagewp at gmail.com
Sun Nov 25 15:40:41 PST 2007
On 11/26/07, Keith Whittingham <kwhittingham at gmail.com> wrote:
> fragment
> NORMAL_TOKEN_SET
> : ('a'..'z'|'A'..'Z'|'.'|'_') ('0'..'9'|'A'..'Z'|'a'..'z'|'.'|'_')*
> { tokenType = NAME; }
> | '[' { tokenType = OSB; context = BRACKETS; }
Thanks for posting. Is it the "fragment" here that prevents this token
always matching ahead of the other one?
Also, did you consider using return values? Might be slightly more
elegant than the quasi-global tokenType member?
Steve
More information about the antlr-interest
mailing list