[antlr-interest] How to subtract/and two lexer rules in ANTLR v3.0

Martin Probst mail at martin-probst.com
Tue Aug 8 12:14:33 PDT 2006


Hi,

> definition  :    '<?' (options {greedy=false;} : Char)* '?>'    ;

This should really be a lexer rule, e.g.
DEFINITION: ...;

If it throws a MismatchedTokenException, try writing it as a lexer  
rule, maybe some of the character end up as a wrong token otherwise.

Btw., shouldn't the PI rule be rather something like:
<? NCName ( WS ( Char )* )? ?>
?

HTH,
Martin



More information about the antlr-interest mailing list