Hi,

I've a problem with the lexer. Given that grammar:


TEXT    :       (~'$' | '$' ~'{')+;
OTHER   :        .;
program :       (TEXT|OTHER)+;

If I try with input     'Hola ${ ' it does'nt works. And I can't understand why.
If I look at generated code of rule TEXT it doesn't use a lookahead of
 2. In fact when it finds a '$' it enters in the subrule '$' ~'{
without using LA(2) to see that the next caracter is a { and that then
it can't enter the subrule.
In fact as it only compares LA(1)='$' it enters the subrule but then
when it founds the{ it fails with a lexical error.

And I can't understand why the lexer isn't capable to generate code to
compare with LA(1)='$' and LA(2)!='{' to enter the subrule.

Is that the correct behaivour? Why de lexer can aproximate the K=2?
Someone can explain why?

A lot of thanks in advance,




-- 
Joan Jesús Pujol Espinar
http://www.joanpujol.cat
http://lujop.deviantart.com

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to