AjTalk.Compiler.Lexer.NextString C# (CSharp) Method

NextString() private method

private NextString ( ) : Token
return Token
        private Token NextString()
        {
            string value = string.Empty;

            int ch;

            while (true)
            {
                ch = this.NextChar();

                while (ch >= 0 && ch != StringDelimiter)
                {
                    value += (char)ch;
                    ch = this.NextChar();
                }

                if (ch < 0)
                    break;

                int ch2 = this.PeekChar();

                if (ch2 < 0)
                    break;

                if (ch2 != StringDelimiter)
                    break;

                this.NextChar();

                value += (char)ch;
            }

            if (ch < 0)
                throw new LexerException("Unclosed string");

            Token token = new Token();

            token.Type = TokenType.String;
            token.Value = value;

            return token;
        }