Search in sources :

Example 1 with CypherFunction

use of org.vertexium.cypher.functions.CypherFunction in project vertexium by visallo.

the class CypherCstToAstVisitor method visitFunctionInvocation.

@Override
public CypherAstBase visitFunctionInvocation(CypherParser.FunctionInvocationContext ctx) {
    String functionName = visitFunctionName(ctx.functionName()).getValue();
    CypherFunction fn = compilerContext.getFunction(functionName);
    if (fn == null) {
        throw new VertexiumCypherSyntaxErrorException("UnknownFunction: Could not find function with name \"" + functionName + "\"");
    }
    boolean distinct = ctx.DISTINCT() != null;
    CypherListLiteral<CypherAstBase> argumentsList = visitExpressions(ctx.expression());
    CypherAstBase[] arguments = argumentsList.toArray(new CypherAstBase[argumentsList.size()]);
    fn.compile(compilerContext, arguments);
    return new CypherFunctionInvocation(functionName, distinct, arguments);
}
Also used : CypherFunction(org.vertexium.cypher.functions.CypherFunction) VertexiumCypherSyntaxErrorException(org.vertexium.cypher.exceptions.VertexiumCypherSyntaxErrorException)

Aggregations

VertexiumCypherSyntaxErrorException (org.vertexium.cypher.exceptions.VertexiumCypherSyntaxErrorException)1 CypherFunction (org.vertexium.cypher.functions.CypherFunction)1