From 9b42acbf4dd56b27a289f302813f478fc26a8dbe Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sun, 12 Aug 2012 11:52:05 -0500 Subject: [PATCH] ATNSimulator.deserialize computes values for PlusBlockStartState.loopBackState and StarLoopEntryState.loopBackState --- .../antlr/v4/runtime/atn/ATNSimulator.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/ATNSimulator.java b/runtime/Java/src/org/antlr/v4/runtime/atn/ATNSimulator.java index d6c253d8b..553353041 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/ATNSimulator.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/ATNSimulator.java @@ -179,6 +179,27 @@ public abstract class ATNSimulator { } } + for (ATNState state : atn.states) { + if (state instanceof PlusLoopbackState) { + PlusLoopbackState loopbackState = (PlusLoopbackState)state; + for (int i = 0; i < loopbackState.getNumberOfTransitions(); i++) { + ATNState target = loopbackState.transition(i).target; + if (target instanceof PlusBlockStartState) { + ((PlusBlockStartState)target).loopBackState = loopbackState; + } + } + } + else if (state instanceof StarLoopbackState) { + StarLoopbackState loopbackState = (StarLoopbackState)state; + for (int i = 0; i < loopbackState.getNumberOfTransitions(); i++) { + ATNState target = loopbackState.transition(i).target; + if (target instanceof StarLoopEntryState) { + ((StarLoopEntryState)target).loopBackState = loopbackState; + } + } + } + } + // // DECISIONS //