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