All Downloads are FREE. Search and download functionalities are using the official Maven repository.

CSharp.src.Atn.Transition.cs Maven / Gradle / Ivy

There is a newer version: 4.13.2
Show newest version
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
 * Use of this file is governed by the BSD 3-clause license that
 * can be found in the LICENSE.txt file in the project root.
 */
using System;
using System.Collections.ObjectModel;
using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Sharpen;

namespace Antlr4.Runtime.Atn
{
    /// An ATN transition between any two ATN states.
    /// 
    /// An ATN transition between any two ATN states.  Subclasses define
    /// atom, set, epsilon, action, predicate, rule transitions.
    /// 

This is a one way link. It emanates from a state (usually via a list of /// transitions) and has a target state.

///

Since we never have to change the ATN transitions once we construct it, /// we can fix these transitions as specific classes. The DFA transitions /// on the other hand need to update the labels as it adds transitions to /// the states. We'll use the term Edge for the DFA to distinguish them from /// ATN transitions.

///
public abstract class Transition { public static readonly ReadOnlyCollection serializationNames = new ReadOnlyCollection(Arrays.AsList("INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE")); /// The target of this transition. /// The target of this transition. [NotNull] public ATNState target; protected internal Transition(ATNState target) { if (target == null) { throw new ArgumentNullException("target cannot be null."); } this.target = target; } public abstract TransitionType TransitionType { get; } /// Determines if the transition is an "epsilon" transition. /// /// Determines if the transition is an "epsilon" transition. ///

The default implementation returns /// /// .

///
/// /// /// /// if traversing this transition in the ATN does not /// consume an input symbol; otherwise, /// /// if traversing this /// transition consumes (matches) an input symbol. /// public virtual bool IsEpsilon { get { return false; } } public virtual IntervalSet Label { get { return null; } } public abstract bool Matches(int symbol, int minVocabSymbol, int maxVocabSymbol); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy