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