1 module antlr.v4.runtime.atn.ActionTransition; 2 3 import std.conv; 4 import antlr.v4.runtime.atn.Transition; 5 import antlr.v4.runtime.atn.TransitionStates; 6 import antlr.v4.runtime.atn.ATNState; 7 8 /** 9 * TODO add class description 10 */ 11 class ActionTransition : Transition 12 { 13 14 public int ruleIndex; 15 16 public int actionIndex; 17 18 /** 19 * @uml 20 * e.g., $i ref in action 21 */ 22 public bool isCtxDependent; 23 24 public this(ATNState target, int ruleIndex) 25 { 26 this(target, ruleIndex, -1, false); 27 } 28 29 public this(ATNState target, int ruleIndex, int actionIndex, bool isCtxDependent) 30 { 31 super(target); 32 this.ruleIndex = ruleIndex; 33 this.actionIndex = actionIndex; 34 this.isCtxDependent = isCtxDependent; 35 } 36 37 /** 38 * @uml 39 * @override 40 */ 41 public override int getSerializationType() 42 { 43 return TransitionStates.ACTION; 44 } 45 46 /** 47 * @uml 48 * @override 49 */ 50 public override bool isEpsilon() 51 { 52 return true; // we are to be ignored by analysis 'cept for predicates 53 } 54 55 /** 56 * @uml 57 * @override 58 */ 59 public override bool matches(int symbol, int minVocabSymbol, int maxVocabSymbol) 60 { 61 return false; 62 } 63 64 /** 65 * @uml 66 * @override 67 */ 68 public override string toString() 69 { 70 return "action_" ~ to!string(ruleIndex) ~ ":" ~ to!string(actionIndex); 71 } 72 73 }