[antlr-interest] Gated semantic predicates behaving like validating predicates

Steve Bennett stevagewp at gmail.com
Sun Feb 3 06:27:24 PST 2008


On 2/3/08, Steve Bennett <stevagewp at gmail.com> wrote:
> Obviously I have inadvertently changed something to cause this, but
> what? Any ideas welcome.

Ok, with some investigation, I have narrowed it down to a change I
made - but I don't see why the change is bad. In the following code,
the LEFT_BRACKET is the older (functional) method whereas
RIGHT_BRACKET is using my improved (non-functional) method:

LEFT_BRACKET    : {!this.in_noparse}? => '[';
RIGHT_BRACKET   : {!this.in_noparse}? => ']';

ESCAPED_PUNC     : ESCAPED__LEFT_BRACKET  | ']';

fragment
ESCAPED_LEFT_BRACKET:
                  {this.in_noparse}? =>  '[';

So apparently there is a problem when two rules refer to the same
string literal, with just a gated semantic predicate distinguishing
them? Does that sound right?

Steve


More information about the antlr-interest mailing list