forked from jasder/antlr
Transition classes override getSerializationType()
This commit is contained in:
parent
170a8347bb
commit
60df00be4f
|
@ -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
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -49,6 +49,11 @@ public class PredicateTransition extends Transition {
|
|||
this.isCtxDependent = isCtxDependent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSerializationType() {
|
||||
return PREDICATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEpsilon() { return true; }
|
||||
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -49,6 +49,11 @@ public class RuleTransition extends Transition {
|
|||
this.followState = followState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSerializationType() {
|
||||
return RULE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEpsilon() { return true; }
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue