use of org.vertexium.cypher.exceptions.VertexiumCypherSyntaxErrorException in project vertexium by visallo.
the class CypherAstParser method parse.
public CypherStatement parse(CypherCompilerContext ctx, String code) {
CodePointCharStream input = CharStreams.fromString(code);
CypherLexer lexer = new CypherLexer(input);
CypherParser parser = new CypherParser(new CommonTokenStream(lexer));
parser.setErrorHandler(new ParserErrorHandler(code));
CypherParser.CypherContext tree = parser.cypher();
if (!tree.getText().equals(code)) {
throw new VertexiumCypherSyntaxErrorException("Parsing error, \"" + code.substring(tree.getText().length()) + "\"");
}
return new CypherCstToAstVisitor(ctx).visitCypher(tree);
}
use of org.vertexium.cypher.exceptions.VertexiumCypherSyntaxErrorException 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);
}
Aggregations