[antlr-interest] Match last string in Lexer

Kreso Tkalec kreso.tkalec at gmail.com
Thu Feb 10 02:15:08 PST 2005


Hi!
My problem is to match last string. I have code writen in lex, and
would like to translate it to antlr.
Lex code:
B [a-zA-Z_]
C [0-9a-zA-Z\'^\.:_`]
{B}{C}*(" "*{C}+)*" "*DA {some code...}

So far I wrote this:
protected B : 'a'..'z'|'A'..'Z'|'_';
protected C : '0'..'9'|'a'..'z'|'A'..'Z'|'\''|'^'|'.'|':'|'_'|'`';
MyToken: (B)(C)*((" ")*(C)+)*(" ")*"DA";

The problem is that definition of C allows to math string "DA" , so
lexer never comes to last string. Any sugestions?


More information about the antlr-interest mailing list