Package com.google.refine.grel.ast

Examples of com.google.refine.grel.ast.FunctionCallExpr


                    if (errorMessage != null) {
                        throw makeException(errorMessage);
                    }
                    eval = new ControlCallExpr(argsA, c);
                } else {
                    eval = new FunctionCallExpr(makeArray(args), f);
                }
            }
        } else if (_token.type == TokenType.Delimiter && _token.text.equals("(")) {
            next(true);

            eval = parseExpression();

            if (_token != null && _token.type == TokenType.Delimiter && _token.text.equals(")")) {
                next(false);
            } else {
                throw makeException("Missing )");
            }
        } else if (_token.type == TokenType.Delimiter && _token.text.equals("[")) { // [ ... ] array
            next(true); // swallow [

            List<Evaluable> args = parseExpressionList("]");

            eval = new FunctionCallExpr(makeArray(args), new ArgsToArray());
        } else {
            throw makeException("Missing number, string, identifier, regex, or parenthesized expression");
        }

        while (_token != null) {
            if (_token.type == TokenType.Operator && _token.text.equals(".")) {
                next(false); // swallow .

                if (_token == null || _token.type != TokenType.Identifier) {
                    throw makeException("Missing function name");
                }

                String identifier = _token.text;
                next(false);

                if (_token != null && _token.type == TokenType.Delimiter && _token.text.equals("(")) {
                    next(true); // swallow (

                    Function f = ControlFunctionRegistry.getFunction(identifier);
                    if (f == null) {
                        throw makeException("Unknown function " + identifier);
                    }

                    List<Evaluable> args = parseExpressionList(")");
                    args.add(0, eval);

                    eval = new FunctionCallExpr(makeArray(args), f);
                } else {
                    eval = new FieldAccessorExpr(eval, identifier);
                }
            } else if (_token.type == TokenType.Delimiter && _token.text.equals("[")) {
                next(true); // swallow [

                List<Evaluable> args = parseExpressionList("]");
                args.add(0, eval);

                eval = new FunctionCallExpr(makeArray(args), ControlFunctionRegistry.getFunction("get"));
            } else {
                break;
            }
        }
View Full Code Here

TOP

Related Classes of com.google.refine.grel.ast.FunctionCallExpr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.