Antlr4.Automata.LexerATNFactory.GetModeConstantValue C# (CSharp) Метод

GetModeConstantValue() приватный Метод

private GetModeConstantValue ( [ modeName, [ token ) : int?
modeName [
token [
Результат int?
        private int? GetModeConstantValue([Nullable] string modeName, [Nullable] IToken token)
        {
            if (modeName == null)
            {
                return null;
            }

            if (modeName.Equals("DEFAULT_MODE"))
            {
                return Lexer.DefaultMode;
            }
            if (COMMON_CONSTANTS.ContainsKey(modeName))
            {
                g.tool.errMgr.GrammarError(ErrorType.MODE_CONFLICTS_WITH_COMMON_CONSTANTS, g.fileName, token, token.Text);
                return null;
            }

            IList<string> modeNames = new List<string>(((LexerGrammar)g).modes.Keys);
            int mode = modeNames.IndexOf(modeName);
            if (mode >= 0)
            {
                return mode;
            }

            int result;
            if (int.TryParse(modeName, out result))
                return result;

            g.tool.errMgr.GrammarError(ErrorType.CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_MODE_NAME, g.fileName, token, token.Text);
            return null;
        }