From 60df00be4f3b26959b3436299dfeba0814817ed8 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 1 Aug 2012 14:35:37 -0500 Subject: [PATCH] Transition classes override getSerializationType() --- .../Java/src/org/antlr/v4/runtime/atn/ActionTransition.java | 5 +++++ .../Java/src/org/antlr/v4/runtime/atn/AtomTransition.java | 5 +++++ .../Java/src/org/antlr/v4/runtime/atn/EpsilonTransition.java | 5 +++++ .../Java/src/org/antlr/v4/runtime/atn/NotSetTransition.java | 5 +++++ .../src/org/antlr/v4/runtime/atn/PredicateTransition.java | 5 +++++ .../Java/src/org/antlr/v4/runtime/atn/RangeTransition.java | 5 +++++ .../Java/src/org/antlr/v4/runtime/atn/RuleTransition.java | 5 +++++ runtime/Java/src/org/antlr/v4/runtime/atn/SetTransition.java | 5 +++++ runtime/Java/src/org/antlr/v4/runtime/atn/Transition.java | 2 +- .../src/org/antlr/v4/runtime/atn/WildcardTransition.java | 5 +++++ 10 files changed, 46 insertions(+), 1 deletion(-) diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/ActionTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/ActionTransition.java index 9cd99ad52..546fdea35 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/ActionTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/ActionTransition.java @@ -47,6 +47,11 @@ public class ActionTransition extends Transition { this.isCtxDependent = isCtxDependent; } + @Override + public int getSerializationType() { + return ACTION; + } + @Override public boolean isEpsilon() { return true; // we are to be ignored by analysis 'cept for predicates diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/AtomTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/AtomTransition.java index 34cc3c7f8..8adb833f3 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/AtomTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/AtomTransition.java @@ -42,6 +42,11 @@ public class AtomTransition extends Transition { this.label = label; } + @Override + public int getSerializationType() { + return ATOM; + } + @Override @NotNull public IntervalSet label() { return IntervalSet.of(label); } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/EpsilonTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/EpsilonTransition.java index 9357c58b2..8678ecf1a 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/EpsilonTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/EpsilonTransition.java @@ -34,6 +34,11 @@ import org.antlr.v4.runtime.misc.NotNull; public class EpsilonTransition extends Transition { public EpsilonTransition(@NotNull ATNState target) { super(target); } + @Override + public int getSerializationType() { + return EPSILON; + } + @Override public boolean isEpsilon() { return true; } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/NotSetTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/NotSetTransition.java index f4640f6c6..11e060283 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/NotSetTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/NotSetTransition.java @@ -38,6 +38,11 @@ public class NotSetTransition extends SetTransition { super(target, set); } + @Override + public int getSerializationType() { + return NOT_SET; + } + @Override public String toString() { return '~'+super.toString(); diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/PredicateTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/PredicateTransition.java index 9cc54d4c7..32b389b2f 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/PredicateTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/PredicateTransition.java @@ -49,6 +49,11 @@ public class PredicateTransition extends Transition { this.isCtxDependent = isCtxDependent; } + @Override + public int getSerializationType() { + return PREDICATE; + } + @Override public boolean isEpsilon() { return true; } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/RangeTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/RangeTransition.java index 53e9ae1b7..b2212c3f7 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/RangeTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/RangeTransition.java @@ -42,6 +42,11 @@ public class RangeTransition extends Transition { this.to = to; } + @Override + public int getSerializationType() { + return RANGE; + } + @Override @NotNull public IntervalSet label() { return IntervalSet.of(from, to); } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/RuleTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/RuleTransition.java index d52d1837f..4c1128083 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/RuleTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/RuleTransition.java @@ -49,6 +49,11 @@ public class RuleTransition extends Transition { this.followState = followState; } + @Override + public int getSerializationType() { + return RULE; + } + @Override public boolean isEpsilon() { return true; } } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/SetTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/SetTransition.java index f061c3b88..f9dd9883c 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/SetTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/SetTransition.java @@ -46,6 +46,11 @@ public class SetTransition extends Transition { this.set = set; } + @Override + public int getSerializationType() { + return SET; + } + @Override @NotNull public IntervalSet label() { return set; } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/Transition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/Transition.java index 4cc711ba8..bf48bd69a 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/Transition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/Transition.java @@ -99,7 +99,7 @@ public abstract class Transition { this.target = target; } - public int getSerializationType() { return 0; } + public abstract int getSerializationType(); /** Are we epsilon, action, sempred? */ public boolean isEpsilon() { return false; } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/WildcardTransition.java b/runtime/Java/src/org/antlr/v4/runtime/atn/WildcardTransition.java index e888e9caa..f5b175ef7 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/WildcardTransition.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/WildcardTransition.java @@ -34,6 +34,11 @@ import org.antlr.v4.runtime.misc.NotNull; public class WildcardTransition extends Transition { public WildcardTransition(@NotNull ATNState target) { super(target); } + @Override + public int getSerializationType() { + return WILDCARD; + } + @Override @NotNull public String toString() {