[antlr-interest] Lexer parsing problem and Documentation
Gavin Lambert
antlr at mirality.co.nz
Wed Jun 6 12:40:57 PDT 2007
At 02:42 7/06/2007, Wigg, J D wrote:
>I'm using a predicate in the lexer as follows,
>
>("__asm"|"_asm"|"asm") LPAREN)=>
>
>but this will only match "asm(" provided there is no space
>between "asm" and "(".
>
>What's the problem here and how could I get over it?
Whitespace is only removed as a consequence of another lexer rule
-- which means that if you want to match whitespace within a token
(or predicate) in any lexer rule then you have to explicitly
mention it, since it's still there at that point. If you add
something like WS? or WS* (depending on your WS token definition)
before LPAREN then it should sort it out.
More information about the antlr-interest
mailing list