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     /**
17      * @uml
18      * @read
19      * @write
20      */
21     private int actionIndex_;
22 
23     /**
24      * @uml
25      * e.g., $i ref in action
26      */
27     public bool isCtxDependent;
28 
29     public this(ATNState target, int ruleIndex)
30     {
31         this(target, ruleIndex, -1, false);
32     }
33 
34     public this(ATNState target, int ruleIndex, int actionIndex, bool isCtxDependent)
35     {
36         super(target);
37         this.ruleIndex = ruleIndex;
38         this.actionIndex = actionIndex;
39         this.isCtxDependent = isCtxDependent;
40     }
41 
42     /**
43      * @uml
44      * @override
45      */
46     public override int getSerializationType()
47     {
48         return TransitionStates.ACTION;
49     }
50 
51     /**
52      * @uml
53      * @override
54      */
55     public override bool isEpsilon()
56     {
57         return true; // we are to be ignored by analysis 'cept for predicates
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     /**
70      * @uml
71      * @override
72      */
73     public override string toString()
74     {
75         return "action_" ~ to!string(ruleIndex) ~ ":" ~ to!string(actionIndex);
76     }
77 
78     public final int actionIndex()
79     {
80         return this.actionIndex_;
81     }
82 
83     public final void actionIndex(int actionIndex)
84     {
85         this.actionIndex_ = actionIndex;
86     }
87 
88 }