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 package org.antlr.v4.runtime.atn; 8 9 public final class EpsilonTransition extends Transition { 10 11 private final int outermostPrecedenceReturn; 12 EpsilonTransition(ATNState target)13 public EpsilonTransition(ATNState target) { 14 this(target, -1); 15 } 16 EpsilonTransition(ATNState target, int outermostPrecedenceReturn)17 public EpsilonTransition(ATNState target, int outermostPrecedenceReturn) { 18 super(target); 19 this.outermostPrecedenceReturn = outermostPrecedenceReturn; 20 } 21 22 /** 23 * @return the rule index of a precedence rule for which this transition is 24 * returning from, where the precedence value is 0; otherwise, -1. 25 * 26 * @see ATNConfig#isPrecedenceFilterSuppressed() 27 * @see ParserATNSimulator#applyPrecedenceFilter(ATNConfigSet) 28 * @since 4.4.1 29 */ outermostPrecedenceReturn()30 public int outermostPrecedenceReturn() { 31 return outermostPrecedenceReturn; 32 } 33 34 @Override getSerializationType()35 public int getSerializationType() { 36 return EPSILON; 37 } 38 39 @Override isEpsilon()40 public boolean isEpsilon() { return true; } 41 42 @Override matches(int symbol, int minVocabSymbol, int maxVocabSymbol)43 public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 44 return false; 45 } 46 47 @Override 48 toString()49 public String toString() { 50 return "epsilon"; 51 } 52 } 53