[antlr-interest] Lexer grammar question
Mauro Pellicioli
nightwolf at email.it
Sat Sep 15 12:28:00 PDT 2007
I have this lexer grammar with option filter=true set:
LINK: '<a href="' STRING_LINK '">' STRING_LOCATION
{System.out.print($STRING_LOCATION.text);} '</a><br>';
fragment
STRING_LINK: (~'"')+;
fragment
STRING_LOCATION: (STRING | '<b>'STRING_LOCATION'</b>' |
'<i>'STRING_LOCATION'</i>')+;
fragment
STRING: (~('<'|'>'))+;
I don't understand why it matches not only tokens like:
'<a href="/test.html">Test</a><br>'
but also:
'<a href="/test.html">Test</a>.<br>'
(Note the "." added between </a> and <br>)
Is there any method to force ANTLR matching EXACTLY tokens described by
LINK?It seems that the print (and action in general) is executed before
reaching token '</a><br>' or '</a>.<br>'
Thanks for help.
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Dai la ricarica al tuo conto!
Fino a 5.000 con nuove rate più basse per tutto il periodo del
finanziamento
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7023&d=20070915
More information about the antlr-interest
mailing list