예제 #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;
        }
예제 #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;
        }
예제 #3
0
 protected virtual void Visit(ComparisonParamExpression exp)
 {
 }
예제 #4
0
 void IExpressionVisitor.Visit(ComparisonParamExpression exp)
 {
     Visit(exp);
 }
예제 #5
0
 void IExpressionVisitor.Visit(ComparisonParamExpression exp)
 {
     Visit(exp);
 }
예제 #6
0
 protected virtual void Visit(ComparisonParamExpression exp)
 {
 }
예제 #7
0
파일: Parser.cs 프로젝트: Kooboo/Ecommerce
        // 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);
            }
        }