[antlr-interest] Need help with lexer rules

Sven Efftinge sven at efftinge.de
Mon Aug 15 09:21:49 PDT 2005


Hi,

I've the following lexer rules :

// terminals (guillemots '<<' & '>>')
LG            : '\u00ab';
RG            : '\u00bb';

// any char but not antlr special, LG and RG
protected VOCAB :
    ('\3'..'\u00aa'|'\u00ac'..'\u00ba'|'\u00bc'..'\u00ff')
;

// template text '>> Bla text here <<'
TEXT :
  RG (VOCAB)* LG
;

It scans

'>> Bla text <<' => TEXT , EOF
'>>'                   => RG, EOF

but cannot scan
'>>    '            
I want the scanner to evaluate to RG, WS (which is skipped), EOF
But it stucks in the TEXT rule : "line 1:5: expecting '«', found '<EOF>'"

Can someone give me a hint?

regards,
Sven



More information about the antlr-interest mailing list