Antlr4.Tool.Grammar.CreateLexerInterpreter C# (CSharp) Method

CreateLexerInterpreter() public method

public CreateLexerInterpreter ( Antlr4.Runtime.ICharStream input ) : Antlr4.Runtime.LexerInterpreter
input Antlr4.Runtime.ICharStream
return Antlr4.Runtime.LexerInterpreter
        public virtual LexerInterpreter CreateLexerInterpreter(ICharStream input)
        {
            if (this.IsParser())
            {
                throw new InvalidOperationException("A lexer interpreter can only be created for a lexer or combined grammar.");
            }

            if (this.IsCombined())
            {
                return implicitLexer.CreateLexerInterpreter(input);
            }

            char[] serializedAtn = ATNSerializer.GetSerializedAsChars(atn, GetRuleNames());
            ATN deserialized = new ATNDeserializer().Deserialize(serializedAtn);
            return new LexerInterpreter(fileName, GetVocabulary(), GetRuleNames(), ((LexerGrammar)this).modes.Keys, deserialized, input);
        }