[antlr-interest] Help: What does this mean?
Jim Idle
jimi at temporal-wave.com
Sat Nov 17 09:34:09 PST 2007
I would suggest that you replace your uses of 'literal' with LEXER
specified tokens, then analyze this grammar with ANTLRWorks. This will
give you a visual representation of your issue.
However it looks like this is part of an expression tree and that you
have mis-constructed it. Take a look at any of the expression trees in
the example grammars such as Java and this may help you get your
expression tree in order. This rule looks likely to be not quite what
you think it is ;-)
Jim
-----Original Message-----
From: Austin Hastings [mailto:Austin_Hastings at Yahoo.com]
Sent: Friday, November 16, 2007 10:26 PM
To: antlr-interest
Subject: [antlr-interest] Help: What does this mean?
I get this warning:
[antlr3] warning(200):
/home/austin/gunit/sources/org/antlr/gunit/TestSuite.g:504:51: Decision
can match input such as "'&&'" using multiple alternatives: 1, 2
[antlr3] As a result, alternative(s) 2 were disabled for that input
For this code:
outputExpr_and returns [Assertion assertion]
: op1=outputExpr_primary ('&&' op2=outputExpr_and)*
{
if (op2 == null)
{
$assertion = $op1.assertion;
}
else
{
$assertion = new Conjunction($op1.start, $op2.stop);
$assertion.addClauses($op1.assertion, $op2.assertion);
}
}
;
I don't see two alternatives, unless the * is considered an alternative
somehow. The 'outputExpr_primary' production is always something
concrete, either a parenthesized subexpression or a list of keywords -
never empty. So (1) what are "alternatives 1,2" for this case; and (2)
how could I display them - is there a "painfully verbose" antlr switch I
don't know about?
Thanks,
=Austin
More information about the antlr-interest
mailing list