Hello,

Following is a lexer rule to match quoted string that allows backslash
escape sequence.


STRING
        :        '"' ( options {greedy=false;} : ( ~ '\\' | '\\' . ) )* '"'
        ;


It seems to work.  But if you put the '*' operator inside the subrule
like this:


STRING
        :        '"' ( options {greedy=false;} : ( ~ '\\' | '\\' . )* ) '"'
        ;


It eats up everything to EOF.

It's as if the greedy option applies to the ((subrule)*) instead of the
subrule itself, and only if the subrule is suffixed with '*' operator
(or with '+') externally (as in (subrule)*).

To my eyes, the second version seems the "correct" one.

Thoughts?

J











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-inter...@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