History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ANTLR-89
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Terence Parr
Reporter: Terence Parr
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ANTLR v3

labelExpr attribute doesn't exist for dfaEdgeSwitch

Created: 19/Feb/07 11:01 AM   Updated: 30/Mar/07 05:41 PM
Component/s: ANTLR Core
Affects Version/s: 3.0b6
Fix Version/s: 3.0b7


 Description  « Hide
Benjamin found this:

ANTLR Parser Generator Version 3.0b7 (??, 2007) 1989-2007
error(10): internal error: tests/t028labelExpr.g :
java.util.NoSuchElementException: no such attribute: labelExpr in template
context [dfaEdgeSwitch]
org.antlr.stringtemplate.StringTemplate.rawSetAttribute(StringTemplate.java:739)
org.antlr.stringtemplate.StringTemplate.setAttribute(StringTemplate.java:600)
org.antlr.codegen.ACyclicDFACodeGenerator.walkFixedDFAGeneratingStateMachine(ACyclicDFACodeGenerator.java:172)
org.antlr.codegen.ACyclicDFACodeGenerator.walkFixedDFAGeneratingStateMachine(ACyclicDFACodeGenerator.java:142)
org.antlr.codegen.ACyclicDFACodeGenerator.genFixedLookaheadDecision(ACyclicDFACodeGenerator.java:47)
org.antlr.codegen.CodeGenerator.genLookaheadDecision(CodeGenerator.java:610)
org.antlr.codegen.CodeGenTreeWalker.block(CodeGenTreeWalker.java:950)
org.antlr.codegen.CodeGenTreeWalker.rule(CodeGenTreeWalker.java:725)
org.antlr.codegen.CodeGenTreeWalker.rules(CodeGenTreeWalker.java:516)
org.antlr.codegen.CodeGenTreeWalker.grammarSpec(CodeGenTreeWalker.java:458)
org.antlr.codegen.CodeGenTreeWalker.grammar(CodeGenTreeWalker.java:269)
org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:415)
org.antlr.Tool.processGrammar(Tool.java:344)
org.antlr.Tool.process(Tool.java:265)
org.antlr.Tool.main(Tool.java:70)

Using the following minimized grammar:

lexer grammar T;
ETAGO: ('</a')=> '</';
MDO: {True}? ('<!a')=> '<!';
STAGO: {True}? ('<a')=> '<';
CDATA: '<';


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Terence Parr - 30/Mar/07 05:41 PM
Fixed. CodeGenerator.canGenerateSwitch wasn't taking EOT target predicate transitions into account. New unit test in TestSemanticPredicateEvaluation:

public void testPredicatesOnEOTTarget() throws Exception {
String grammar =
"grammar foo; \n" +
"@lexer::members {boolean p=true, q=false;}" +
"a : B ;\n" +
"A: '</'; \n" +
"B: {p}? '<!' {System.out.println(\"B\");};\n" +
"C: {q}? '<' {System.out.println(\"C\");}; \n" +
"D: '<';\n" ;
String found = execParser("foo.g", grammar, "fooParser", "fooLexer",
"a", "<!", false);
assertEquals("B\n", found);
}