/// <summary>
 /// Validates the expression with the given context.
 /// </summary>
 /// <param name="context">The validator to report errors to.</param>
 public virtual void Validate(IValidationContext context)
 {
     if (_value is EmptyExpression)
     {
         var error = new ParseError(ErrorCode.OperandRequired, _value);
         context.Report(error);
     }
 }
 public override void Validate(IValidationContext context)
 {
     if (Value is AssignableExpression == false)
     {
         var error = new ParseError(ErrorCode.DecrementOperand, Value);
         context.Report(error);
     }
 }
Example #3
0
            public override void Validate(IValidationContext context)
            {
                base.Validate(context);

                foreach (var error in _errors)
                {
                    context.Report(error);
                }
            }
Example #4
0
 /// <summary>
 /// Validates the expression with the given context.
 /// </summary>
 /// <param name="context">The validator to report errors to.</param>
 public void Validate(IValidationContext context)
 {
     foreach (var parameter in _parameters)
     {
         if (parameter is VariableExpression == false)
         {
             var error = new ParseError(ErrorCode.IdentifierExpected, parameter);
             context.Report(error);
         }
     }
 }
Example #5
0
        /// <summary>
        /// Validates the expression with the given context.
        /// </summary>
        /// <param name="context">The validator to report errors to.</param>
        public void Validate(IValidationContext context)
        {
            var columns = _values.Length > 0 ? _values[0].Length : 0;

            foreach (var row in _values)
            {
                if (row.Length != columns)
                {
                    var error = new ParseError(ErrorCode.MatrixColumnsDiscrepency, this);
                    context.Report(error);
                    break;
                }
            }
        }
        /// <summary>
        /// Validates the expression with the given context.
        /// </summary>
        /// <param name="context">The validator to report errors to.</param>
        public void Validate(IValidationContext context)
        {
            var containsOptional = false;

            foreach (var parameter in _parameters)
            {
                if (parameter is VariableExpression)
                {
                    if (containsOptional)
                    {
                        var error = new ParseError(ErrorCode.OptionalArgumentRequired, parameter);
                        context.Report(error);
                    }
                }
                else if (parameter is AssignmentExpression)
                {
                    var assignment = (AssignmentExpression)parameter;

                    if (assignment.VariableName == null)
                    {
                        var error = new ParseError(ErrorCode.OptionalArgumentRequired, parameter);
                        context.Report(error);
                    }
                    else
                    {
                        containsOptional = true;
                        parameter.Validate(context);
                    }
                }
                else
                {
                    var error = new ParseError(ErrorCode.IdentifierExpected, parameter);
                    context.Report(error);
                }
            }
        }
Example #7
0
        /// <summary>
        /// Validates the expression with the given context.
        /// </summary>
        /// <param name="context">The validator to report errors to.</param>
        public void Validate(IValidationContext context)
        {
            var expression   = _payload;
            var member       = _payload as MemberExpression;
            var isIdentifier = _payload is VariableExpression;

            if (member != null)
            {
                expression   = member.Member;
                isIdentifier = expression is IdentifierExpression;
            }

            if (!isIdentifier)
            {
                var error = new ParseError(ErrorCode.IdentifierExpected, expression);
                context.Report(error);
            }
        }
Example #8
0
 /// <summary>
 /// Validates the expression with the given context.
 /// </summary>
 /// <param name="context">The validator to report errors to.</param>
 public void Validate(IValidationContext context)
 {
     context.Report(new ParseError(_error, _payload));
 }