1 /*
2  * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
3  * Use of this file is governed by the BSD 3-clause license that
4  * can be found in the LICENSE.txt file in the project root.
5  */
6 
7 module antlr.v4.runtime.atn.EpsilonTransition;
8 
9 import antlr.v4.runtime.atn.ATNState;
10 import antlr.v4.runtime.atn.Transition;
11 import antlr.v4.runtime.atn.TransitionStates;
12 
13 // Class EpsilonTransition
14 /**
15  * Special Transistion
16  */
17 class EpsilonTransition : Transition
18 {
19 
20     /**
21      *  @return the rule index of a precedence rule for which this transition is
22      *  returning from, where the precedence value is 0; otherwise, -1.
23      *
24      *  @see ATNConfig#isPrecedenceFilterSuppressed()
25      *  @see ParserATNSimulator#applyPrecedenceFilter(ATNConfigSet)
26      *  @since 4.4.1
27      * @uml
28      * @read
29      * @final
30      */
31     private int outermostPrecedenceReturn_;
32 
33     public this(ATNState target)
34     {
35         this(target, -1);
36     }
37 
38     public this(ATNState target, int outermostPrecedenceReturn)
39     {
40         super(target);
41         this.outermostPrecedenceReturn_ = outermostPrecedenceReturn;
42     }
43 
44     /**
45      * Only for unittest required.
46      */
47     public this()
48     {
49     }
50 
51     /**
52      * @uml
53      * @override
54      */
55     public override int getSerializationType()
56     {
57         return TransitionStates.EPSILON;
58     }
59 
60     /**
61      * @uml
62      * @override
63      */
64     public override bool isEpsilon()
65     {
66         return true;
67     }
68 
69     /**
70      * @uml
71      * @override
72      */
73     public override bool matches(int symbol, int minVocabSymbol, int maxVocabSymbol)
74     {
75         return false;
76     }
77 
78     /**
79      * @uml
80      * @override
81      */
82     public override string toString()
83     {
84         return "epsilon";
85     }
86 
87     public final int outermostPrecedenceReturn()
88     {
89         return this.outermostPrecedenceReturn_;
90     }
91 
92 }