[antlr-interest] Re: Syntactic predicates question
Xue Yong Zhi
seclib at seclib.com
Mon Jan 30 11:40:30 PST 2006
Artem Dmytrenko wrote:
>
> line 1:94: expecting ID, found 'A'
>
> It appears that the match is stuck in the middle - e.g. ActionToken rule
> rejected the string but ID did not match it. Is that the expected
> behavior for syntactic predicates? Are there any workarounds for this
> problem?
>
Your parser is thinking this way when parsing "A12345":
1. Try ActionToken, and match the first 'A'.
2. Try ActionToken again with the rest of the input "123456", do not match.
3. Then try ID, still no match.
4. Give you the warning.
Most of the time Antlr does not follow "the longest one that matches
wins" rules.
--
Xue Yong Zhi
http://seclib.blogspot.com
More information about the antlr-interest
mailing list