Пример #1
0
        private Node HandlePositiveFactor()
        {
            double numberValue;
            string stringValue;

            if (_tokenizer.MatchDouble(out numberValue))
            {
                return(new ConstantNode(numberValue));
            }
            if (_tokenizer.MatchString(out stringValue))
            {
                return(new VariableNode(stringValue));
            }
            if (_tokenizer.Match(TokenType.OpenPar))
            {
                var e = HandleSuperExpression();
                if (!_tokenizer.Match(TokenType.ClosePar))
                {
                    return(new ErrorNode("Expected )."));
                }
                return(e);
            }
            return(new ErrorNode("Expected number or (expression)."));
        }