[antlr-interest] Why does syntactic predicate not take effect?
Gavin Lambert
antlr at mirality.co.nz
Mon Nov 10 11:39:20 PST 2008
At 23:32 10/11/2008, Britta Kiera wrote:
>The lexer was supposed to generate a NAMES token for the feature
>name sequence. The definition below shows an approach that I
tried
>to accomplish this. This approach didn't work. The lexer never
>generated a NAMES token although I tried
>to enforce this using a syntactic predicate. I solved this
problem
>in the parser but I'd like to understand why the
>syntactic predicate does not take effect. Can somebody explain
this
>to me?
Are you using the interpreter or the debugger (or a "real"
compiled program)? Because the interpreter doesn't evaluate
predicates.
>NAMES:
> ;
You need to make this a fragment rule. Otherwise you've got a
top-level lexer rule which can successfully match nothing at all,
which is Bad. (Since that way lies infinite loops.)
More information about the antlr-interest
mailing list