Antlr4.Runtime.Atn.LexerATNSimulator.AddDFAState C# (CSharp) Метод

AddDFAState() защищенный Метод

protected AddDFAState ( ATNConfigSet configSet ) : DFAState
configSet ATNConfigSet
Результат Antlr4.Runtime.Dfa.DFAState
        protected DFAState AddDFAState(ATNConfigSet configSet)
        {
            /* the lexer evaluates predicates on-the-fly; by this point configs
             * should not contain any configurations with unevaluated predicates.
             */
            DFAState proposed = new DFAState(configSet);
            ATNConfig firstConfigWithRuleStopState = null;
            foreach (ATNConfig c in configSet.configs)
            {
                if (c.state is RuleStopState)
                {
                    firstConfigWithRuleStopState = c;
                    break;
                }
            }

            if (firstConfigWithRuleStopState != null)
            {
                proposed.isAcceptState = true;
                proposed.lexerActionExecutor = ((LexerATNConfig)firstConfigWithRuleStopState).getLexerActionExecutor();
                proposed.prediction = atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
            }

            DFA dfa = decisionToDFA[mode];
            lock (dfa.states)
            {
                DFAState existing;
                if(dfa.states.TryGetValue(proposed, out existing))
                    return existing;

                DFAState newState = proposed;

                newState.stateNumber = dfa.states.Count;
                configSet.IsReadOnly = true;
                newState.configSet = configSet;
                dfa.states[newState] = newState;
                return newState;
            }
        }