コード例 #1
0
        private Node HandlePositiveFactor()
        {
            double numberValue;

            if (_tokenizer.MatchDouble(out numberValue))
            {
                return(new ConstantNode(numberValue));
            }
            string identifier;

            if (_tokenizer.MatchIdentifier(out identifier))
            {
                return(new VariableNode(identifier));
            }
            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)."));
        }