From 4bc615d72ff72756f8fcbf284911b9dbcb79a2cc Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 19 Mar 2012 08:32:34 -0500 Subject: [PATCH] Ensure that serialized transitions only point to states which weren't removed. Add unit test for a current failure case (will be a regression test once fixed). --- .../org/antlr/v4/automata/ATNSerializer.java | 5 ++++ .../org/antlr/v4/test/TestParseErrors.java | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/tool/src/org/antlr/v4/automata/ATNSerializer.java b/tool/src/org/antlr/v4/automata/ATNSerializer.java index 70d1a953f..64e7a0f71 100644 --- a/tool/src/org/antlr/v4/automata/ATNSerializer.java +++ b/tool/src/org/antlr/v4/automata/ATNSerializer.java @@ -133,6 +133,11 @@ public class ATNSerializer { if ( s==null ) continue; // might be optimized away for (int i=0; i' ID;\n" + + "primary : ID;\n" + + "ID : [a-z]+;\n" + + "\n"; + String result = execParser("T.g", grammar, "TParser", "TLexer", "start", "x:x", true); + String expecting = ""; + assertEquals(expecting, result); + assertNull(this.stderrDuringParse); + } + }