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

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

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

            while (char.IsLetterOrDigit(p) || p.Equals('_') || p.Equals('@'))
            {
                _buffer.Append((char)_expressionReader.Read());
                p = (char)_expressionReader.Peek();
            }

            if (_variables.Contains(_buffer.ToString()))
            {
                object           value      = GetVariableValue(_buffer.ToString());
                NumberExpression expression = new NumberExpression(value);
                _expressionQueue.Enqueue(expression);

                return(true);
            }

            if (FunctionExpression.IsFunction(_buffer.ToString()))
            {
                _symbolStack.Push(_buffer.ToString());
                return(true);
            }

            throw new ParseException("Invalid variable: " + _buffer);
        }
        //public void Parse(string expr)
        //{
        //    expr = expr.Trim();
        //    _expressionReader = new StringReader(expr);
        //    while (_expressionReader.Peek() >= 0)
        //    {
        //        char c = (char)_expressionReader.Read();

        //        if (Char.IsWhiteSpace(c))
        //            continue;

        //        if (TryNumber(c))
        //            continue;

        //        if (TryString(c))
        //            continue;

        //        if (TryStartGroup(c))
        //            continue;

        //        if (TryOperator(c))
        //            continue;

        //        if (TryEndGroup(c))
        //            continue;

        //        throw new ParseException("Invalid character encountered: " + c);
        //    }
        //}

        private bool TryNumber(char c)
        {
            bool isNumber   = NumberExpression.IsNumber(c);
            bool isNegative = false;

            if (NumberExpression.IsNegativeSign(c))
            {
                if (_expressionQueue.Count == 0)
                {
                    isNegative = true;
                }
                else if (_expressionQueue.Count > 0 && _symbolStack.Count > 0)
                {
                    if ((string)_symbolStack.Peek() == "(")
                    {
                        isNegative = true;
                    }
                }
            }

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

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

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

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

            double value;

            if (!(double.TryParse(_buffer.ToString(), out value)))
            {
                throw new ParseException("Invalid number format: " + _buffer);
            }

            NumberExpression expression = new NumberExpression(value);

            _expressionQueue.Enqueue(expression);

            return(true);
        }