Esempio n. 1
0
 private void GuardNotSet()
 {
     if (_node != null)
     {
         throw ExpressionParseException.NestedNodeAlreadySet().Decorate(Token);
     }
 }
Esempio n. 2
0
 private void GuardPartOfPropertyAccess(ExpressionParserHelper helper)
 {
     if (helper.Top as Property == null)
     {
         throw ExpressionParseException.SquareBracketsAreNotUsedInPropertyAccess().Decorate(helper.Current);
     }
 }
Esempio n. 3
0
 private void GuardNotPartOfFunction(string method)
 {
     if (_arguments == 0)
     {
         throw ExpressionParseException.BracketsAreUsedInFunction(method).Decorate(Token);;
     }
 }
Esempio n. 4
0
        public Expression Yield()
        {
            Reduce(-1);
            Expression result = Pop();

            if (Count > 0)
            {
                throw ExpressionParseException.ExpressionStackNotEmptyOnYield(Top).Decorate(_current);
            }
            return(result);
        }
Esempio n. 5
0
 internal void FillNext(Expression exp)
 {
     if (!PartOfFunction && _nodes.Count > 1)
     {
         throw ExpressionParseException.BracketsAreNotUsedInFunction("Adding second parameter").Decorate(Token);
     }
     if (!_paramsArgument && AllFilled)
     {
         throw ExpressionParseException.UnExpectedParameter(exp).Decorate(Token);
     }
     _nodes.Add(exp);
 }
 public override object Evaluate(IModel model)
 {
     if (_first == null)
     {
         throw ExpressionParseException.MissingExpression("first").Decorate(Token);
     }
     if (_second == null)
     {
         throw ExpressionParseException.MissingExpression("second").Decorate(Token);
     }
     return(InternalEvaluate(model));
 }
Esempio n. 7
0
 public override object Evaluate(IModel model)
 {
     if (_lhs == null)
     {
         throw ExpressionParseException.MissingExpression("lhs").Decorate(Token);
     }
     if (_rhs == null)
     {
         throw ExpressionParseException.MissingExpression("rhs").Decorate(Token);
     }
     return(InternalEvaluate(model));
 }
Esempio n. 8
0
        public static void FillArguments(ExpressionParserHelper parseHelper)
        {
            var brackets = (Brackets)parseHelper.Pop();
            var function = (Function)parseHelper.Top;

            if (brackets.Nodes.Count < function.Arguments.Where(a => !a.Params).Count())
            {
                throw ExpressionParseException.ExpectedMoreParameter(function, brackets.Nodes.Count,
                                                                     function.Arguments.Length).Decorate(
                          parseHelper.Lookahead ?? parseHelper.Current);
            }
            function.FillNested(brackets);
        }
        public decimal RhsTyped(IModel model)
        {
            if (Rhs == null)
            {
                throw ExpressionParseException.MissingExpression("rhs").Decorate(Token);
            }
            var raw = Rhs.Evaluate(model);

            if (raw == null)
            {
                throw ExpressionParseException.UnexpectedNullValue("rhs").Decorate(Token);
            }
            return((decimal)TypeConverter.To(raw, ParameterType));
        }