Exemplo n.º 1
0
        public ComparisonExpression(ComparisonParamExpression param, ComparisonValueExpression value, string @operator)
        {
            Require.NotNull(param, "param");
            Require.NotNull(value, "value");
            Require.NotNullOrEmpty(@operator, "operator");

            Param = param;
            Value = value;
            Operator = @operator;
        }
Exemplo n.º 2
0
        public ComparisonExpression(ComparisonParamExpression param, ComparisonValueExpression value, string @operator)
        {
            Require.NotNull(param, "param");
            Require.NotNull(value, "value");
            Require.NotNullOrEmpty(@operator, "operator");

            Param    = param;
            Value    = value;
            Operator = @operator;
        }
Exemplo n.º 3
0
 protected virtual void Visit(ComparisonParamExpression exp)
 {
 }
Exemplo n.º 4
0
 void IExpressionVisitor.Visit(ComparisonParamExpression exp)
 {
     Visit(exp);
 }
Exemplo n.º 5
0
 void IExpressionVisitor.Visit(ComparisonParamExpression exp)
 {
     Visit(exp);
 }
Exemplo n.º 6
0
 protected virtual void Visit(ComparisonParamExpression exp)
 {
 }
Exemplo n.º 7
0
        // comparison : identifier comparison_op param_value
        private Expression Comparison()
        {
            using (var lookahead = _tokenzier.BeginLookahead())
            {
                var sourceLocation = _tokenzier.CurrentLocation;

                var paramName = _tokenzier.NextToken();
                if (paramName == null)
                {
                    return null;
                }

                if (paramName.Kind != TokenKind.Identifier)
                {
                    _context.AddError("Expected identifier.", sourceLocation);
                    return null;
                }

                sourceLocation = _tokenzier.CurrentLocation;

                var op = _tokenzier.NextToken();
                if (op == null || (op.Kind != TokenKind.ComparisonOperator && op.Kind != TokenKind.Identifier) || !_context.RegisteredComparisonOperators.Contains(op.Value))
                {
                    _context.AddError("Missing comparison operator after the parameter name.", sourceLocation);
                    return null;
                }

                sourceLocation = _tokenzier.CurrentLocation;

                var value = ComparisonValue();

                if (value == null)
                {
                    _context.AddError("Missing parameter value.", sourceLocation);
                    return null;
                }

                lookahead.Accept();

                var param = new ComparisonParamExpression(paramName.Value);

                return new ComparisonExpression(param, value, op.Value);
            }
        }