private bool TryNumber(char lastChar)
        {
            bool isNumber = NumberExpression.IsNumber(_currentChar);
            // only negative when last char is group start or symbol
            bool isNegative = NumberExpression.IsNegativeSign(_currentChar) &&
                              (lastChar == '\0' || OperatorExpression.IsSymbol(lastChar));

            if (!isNumber && !isNegative)
            {
                return(false);
            }

            _buffer.Length = 0;
            _buffer.Append(_currentChar);

            char p = (char)_expressionReader.Peek();

            while (NumberExpression.IsNumber(p))
            {
                _currentChar = (char)_expressionReader.Read();
                _buffer.Append(_currentChar);
                p = (char)_expressionReader.Peek();
            }

            if (!(double.TryParse(_buffer.ToString(), out double value)))
            {
                throw new ParseException(Resources.InvalidNumberFormat + _buffer);
            }

            NumberExpression expression = new NumberExpression(value);

            _expressionQueue.Enqueue(expression);

            return(true);
        }
        private bool TryString()
        {
            if (!char.IsLetter(_currentChar))
            {
                return(false);
            }

            _buffer.Length = 0;
            _buffer.Append(_currentChar);

            char p = (char)_expressionReader.Peek();

            while (char.IsLetter(p) || char.IsNumber(p))
            {
                _buffer.Append((char)_expressionReader.Read());
                p = (char)_expressionReader.Peek();
            }

            if (_variables.ContainsKey(_buffer.ToString()))
            {
                double           value      = _variables[_buffer.ToString()];
                NumberExpression expression = new NumberExpression(value);
                _expressionQueue.Enqueue(expression);

                return(true);
            }

            throw new ParseException(Resources.InvalidVariableEncountered + _buffer);
        }