private void GuardNotSet() { if (_node != null) { throw ExpressionParseException.NestedNodeAlreadySet().Decorate(Token); } }
private void GuardPartOfPropertyAccess(ExpressionParserHelper helper) { if (helper.Top as Property == null) { throw ExpressionParseException.SquareBracketsAreNotUsedInPropertyAccess().Decorate(helper.Current); } }
private void GuardNotPartOfFunction(string method) { if (_arguments == 0) { throw ExpressionParseException.BracketsAreUsedInFunction(method).Decorate(Token);; } }
public Expression Yield() { Reduce(-1); Expression result = Pop(); if (Count > 0) { throw ExpressionParseException.ExpressionStackNotEmptyOnYield(Top).Decorate(_current); } return(result); }
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)); }
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)); }
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)); }