that is very strange. there is no way that that template can generate
the 3. logic demands that another template is being used. check the
class path.
more worryingly, I don't see a single failed predicate generated from
the Java version:
~/antlr/code/examples-v3/java/composite-java $ a Java.g
warning(200): JavaLexerRules.g:22:5: Decision can match input such as
"'0'..'9'{'E', 'e'}{'+', '-'}'0'..'9'{'D', 'F', 'd', 'f'}" using
multiple alternatives: 3, 4
As a result, alternative(s) 4 were disabled for that input
~/antlr/code/examples-v3/java/composite-java $ ls
Java.g JavaStat.g
Java.tokens JavaStat.tokens
JavaAnnotations.g Java_JavaAnnotations.java
JavaAnnotations.tokens Java_JavaDecl.java
JavaDecl.g Java_JavaExpr.java
JavaDecl.tokens Java_JavaLexerRules.java
JavaExpr.g Java_JavaStat.java
JavaExpr.tokens Main.java
JavaLexer.java antlr
JavaLexerRules.g files
JavaLexerRules.tokens input
JavaParser.java output
~/antlr/code/examples-v3/java/composite-java $ grep FailedPred *.java
~/antlr/code/examples-v3/java/composite-java $
in my grammar, I do not see a single semantic predicate. something
very strange is going on.
Ter
On Feb 21, 2009, at 3:24 AM, Johannes Luber wrote:
> Terence Parr schrieb:
>>
>> On Feb 20, 2009, at 10:58 AM, Johannes Luber wrote:
>>> I've forgot to run the example build script and noticed a strange
>>> problem for the Java composite-grammar. The code for Java_Expr.cs
>>> appends FailedPredicateException with numbers, e.g.
>>> FailedPredicateException3. Considering that the class doesn't
>>> change the
>>> name, the compilation fails. I've thought at first that my change to
>>> append <decisionNumber> to some exception variable names went too
>>> far,
>>> but the only place referring to FailedPredicateException doesn't
>>> seem to
>>> be wrong.
>>>
>>> I've tried to add debug information but using Jim's little bash
>>> script
>>> with
>>>
>>>
>>> a3 -XdbgSt Java.g
>>>
>>> doesn't seem to work. Now I don't know where the error actually
>>> comes
>>> from and can't find it out... :(
>>
>> -XdbgST not St
>
> Damn - and I did specifically copy the option into my notes so I don't
> make that mistake again. Which doesn't work if you save the wrong
> spelling. :( In any case, I'm still no further to solve the problem.
> The
> generated code is as follows (some extranous code removed):
>
> <CSharp2.validateSemanticPredicate>if ( !(...) )
> {
> ...
> throw new FailedPredicateException3(...);
> }</CSharp2.validateSemanticPredicate>
>
> As one can clearly see, the template validateSemanticPredicate() is
> called. The definition is as follows:
>
> validateSemanticPredicate(pred,description) ::= <<
> if ( !(<evalPredicate(...)>) )
> {
> <ruleBacktrackFailure()>
> throw new FailedPredicateException(input, "<ruleName>",
> "<description>");
> }
>>>
>
> Where does the "3" come from? I did even regenerate my snapshot, but
> it
> didn't change a thing.
>
> Johannes
>>
>> Ter
>>
>
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev