1 module antlr.v4.runtime.atn.PrecedencePredicateTransition; 2 3 import std.conv; 4 import antlr.v4.runtime.atn.AbstractPredicateTransition; 5 import antlr.v4.runtime.atn.ATNState; 6 import antlr.v4.runtime.atn.TransitionStates; 7 import antlr.v4.runtime.atn.SemanticContext; 8 9 // Class PrecedencePredicateTransition 10 /** 11 * TODO add class description 12 */ 13 class PrecedencePredicateTransition : AbstractPredicateTransition 14 { 15 16 /** 17 * @uml 18 * @final 19 */ 20 public int precedence; 21 22 public this(ATNState target, int precedence) 23 { 24 super(target); 25 this.precedence = precedence; 26 } 27 28 /** 29 * @uml 30 * @override 31 */ 32 public override int getSerializationType() 33 { 34 return TransitionStates.PRECEDENCE; 35 } 36 37 /** 38 * @uml 39 * @override 40 */ 41 public override bool isEpsilon() 42 { 43 return true; 44 } 45 46 /** 47 * @uml 48 * @override 49 */ 50 public override bool matches(int symbol, int minVocabSymbol, int maxVocabSymbol) 51 { 52 return false; 53 } 54 55 public SemanticContext.PrecedencePredicate getPredicate() 56 { 57 auto sc = new SemanticContext; 58 return sc..new PrecedencePredicate(precedence); 59 } 60 61 /** 62 * @uml 63 * @override 64 */ 65 public override string toString() 66 { 67 return to!string(precedence) ~ " >= _p"; 68 } 69 70 }