[antlr-interest] [LEXER] Unwanted behaviour ?
Gavin Lambert
antlr at mirality.co.nz
Mon Oct 12 10:28:47 PDT 2009
At 01:28 13/10/2009, Martin Potier wrote:
>LO : '[['; // Link opening
>LE : ']]'; // Link ending
>
>PURETEXT
> : ( ESC_SEQ |
>~('\\'|TM1|TM2|TM3|TM4|ULM|LO|LE|OLM|BM|IM|UM|'|'|'\n') )+
> ;
~ is a set operation; at the lexer level, you can only use single
characters (or rules that result in simple alternatives of single
characters).
Thus if you want to exclude '[['/']]' from the rule while keeping
'['/']', you'll need to use this instead (assuming all the others
are single characters):
PURETEXT
: ( ESC_SEQ
| '[' ~'['
| ']' ~']'
| ~('\\'|TM1|TM2|TM3|TM4|ULM|'['|']'|OLM|BM|IM|UM|'|'|'\n')
)+
;
More information about the antlr-interest
mailing list