[antlr-interest] gated semantic predicate usage

Mark Volkmann r.mark.volkmann at gmail.com
Tue Jan 22 06:52:03 PST 2008


In the book in section 13.2 there is an example of using a gated
semantic predicate to conditionally disable assert statements. When
using this pattern in a parser grammar the result seems to be an error
message like "mismatched input 'assert' expecting EOF" followed by a
stack trace for a NullPointerException from the tree parser. I tried
adding a catch at the end of the parser rule that contains the gated
semantic predicate, but no exception is thrown. I'm confused about how
to use this mechanism to disable certain statements and output a
reasonable error message when they appear in input.

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list