1 module antlr.v4.runtime.atn.PredicateTransition;
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.SemanticContext;
7 import antlr.v4.runtime.atn.TransitionStates;
8 
9 /**
10  * TODO add class description
11  */
12 class PredicateTransition : AbstractPredicateTransition
13 {
14 
15     /**
16      * @uml
17      * @final
18      */
19     public int ruleIndex;
20 
21     /**
22      * @uml
23      * @final
24      */
25     public int predIndex;
26 
27     /**
28      * @uml
29      * e.g., $i ref in pred
30      * @final
31      */
32     public bool isCtxDependent;
33 
34     public this(ATNState target, int ruleIndex, int predIndex, bool isCtxDependent)
35     {
36         super(target);
37         this.ruleIndex = ruleIndex;
38         this.predIndex = predIndex;
39         this.isCtxDependent = isCtxDependent;
40     }
41 
42     /**
43      * @uml
44      * @override
45      */
46     public override int getSerializationType()
47     {
48         return TransitionStates.PREDICATE;
49     }
50 
51     /**
52      * @uml
53      * @override
54      */
55     public override bool isEpsilon()
56     {
57         return true;
58     }
59 
60     /**
61      * @uml
62      * @override
63      */
64     public override bool matches(int symbol, int minVocabSymbol, int maxVocabSymbol)
65     {
66         return false;
67     }
68 
69     public SemanticContext.Predicate getPredicate()
70     {
71         auto sp = new SemanticContext;
72         return sp..new Predicate(ruleIndex, predIndex, isCtxDependent);
73     }
74 
75     /**
76      * @uml
77      * @override
78      */
79     public override string toString()
80     {
81         return "pred_" ~ to!string(ruleIndex) ~ ":" ~ to!string(predIndex);
82     }
83 
84 }