public FunctionExpression(String functionName, ParametersExpression parametersExpression)
 {
     _functionName = functionName;
     Parameters    = parametersExpression;
     //criteria = FunctionBuilder.parseCriteria(this);
     //log.debug("Add " + criteria);
 }
Esempio n. 2
0
        // func_op -> OPEN_BRACKET parameter CLOSE_BRACKET
        private ParametersExpression funcOp()
        {
            if (_lookahead.TokenType == TokenTypes.OpenBracket)
            {
                // func_op -> OPEN_BRACKET parameter CLOSE_BRACKET
                nextToken();
                var parametersExpression = new ParametersExpression();
                parameter(parametersExpression);
                if (_lookahead.TokenType != TokenTypes.CloseBracket)
                {
                    throw new ParserException("Closing bracket expected and " + _lookahead.Sequence + " found instead");
                }
                nextToken();
                return(parametersExpression);
            }

            throw new ParserException("Open bracket expected and " + _lookahead.Sequence + " found instead");
        }
Esempio n. 3
0
 // parameter -> FUNCTION func_op param_op
 // parameter -> value param_op
 private void parameter(ParametersExpression parametersExpression)
 {
     if (_lookahead.TokenType == TokenTypes.Function)
     {
         // parameter -> FUNCTION func_op param_op
         String function = _lookahead.Sequence;
         nextToken();
         ParametersExpression nestedParameters = funcOp();
         var functionExpression = new FunctionExpression(function, nestedParameters);
         parametersExpression.NestedExpression = functionExpression.NestedExpression;
         paramOp(parametersExpression);
     }
     else
     {
         // parameter -> value param_op
         FieldOperatorNode fieldOperatorNode = paramOp(parametersExpression);
         fieldOperatorNode.Value = value();
         parametersExpression.AddParameter(fieldOperatorNode);
     }
 }
Esempio n. 4
0
        // param_op -> SEPARATOR FIELD_OPERATOR param_op
        // param_op -> SEPARATOR parameter
        // param_op -> EPSILON
        private FieldOperatorNode paramOp(ParametersExpression parametersExpression)
        {
            if (_lookahead.TokenType == TokenTypes.Separator)
            {
                nextToken();
                if (_lookahead.TokenType == TokenTypes.FieldOperator)
                {
                    // param_op -> SEPARATOR FIELD_OPERATOR param_op
                    String fieldOperator = _lookahead.Sequence;
                    nextToken();
                    paramOp(parametersExpression);
                    return(new FieldOperatorNode(fieldOperator, null));
                }

                // param_op -> SEPARATOR parameter
                parameter(parametersExpression);
            }

            // param_op -> EPSILON
            return(new FieldOperatorNode("eq", null));
        }
Esempio n. 5
0
        // and_term -> CRITERIA field_op
        // and_term -> FUNCTION func_op
        // and_term -> argument
        private IExpression andTerm()
        {
            if (_lookahead.TokenType == TokenTypes.Criteria)
            {
                // and_term -> CRITERIA field_op
                String criteria = _lookahead.Sequence;
                nextToken();
                FieldOperatorNode fieldOperator = fieldOp();
                return(new CriteriaExpression(criteria, fieldOperator));
            }

            if (_lookahead.TokenType == TokenTypes.Function)
            {
                // and_term -> FUNCTION func_op
                String function = _lookahead.Sequence;
                nextToken();
                ParametersExpression parametersExpression = funcOp();
                return(new FunctionExpression(function, parametersExpression));
            }

            // and_term -> argument
            return(argument());
        }