Antlr4.Runtime.Atn.ParserATNSimulator.AddDFAEdge C# (CSharp) Method

AddDFAEdge() protected method

protected AddDFAEdge ( DFA dfa, DFAState from, int t, DFAState to ) : DFAState
dfa Antlr4.Runtime.Dfa.DFA
from Antlr4.Runtime.Dfa.DFAState
t int
to Antlr4.Runtime.Dfa.DFAState
return Antlr4.Runtime.Dfa.DFAState
        protected DFAState AddDFAEdge(DFA dfa,
									  DFAState from,
									  int t,
									  DFAState to)
        {
            if (debug)
            {
                Console.WriteLine("EDGE " + from + " -> " + to + " upon " + GetTokenName(t));
            }

            if (to == null)
            {
                return null;
            }

            to = AddDFAState(dfa, to); // used existing if possible not incoming
            if (from == null || t < -1 || t > atn.maxTokenType)
            {
                return to;
            }

            lock (from)
            {
                if (from.edges == null)
                {
                    from.edges = new DFAState[atn.maxTokenType + 1 + 1];
                }

                from.edges[t + 1] = to; // connect
            }

            if (debug)
            {
                Console.WriteLine("DFA=\n" + dfa.ToString(parser != null ? parser.Vocabulary : Vocabulary.EmptyVocabulary));
            }

            return to;
        }