use of org.vertexium.cypher.CypherLexer in project vertexium by visallo.
the class CypherAstParser method parseExpression.
public CypherAstBase parseExpression(String expressionString) {
CypherLexer lexer = new CypherLexer(CharStreams.fromString(expressionString));
CypherParser parser = new CypherParser(new CommonTokenStream(lexer));
parser.setErrorHandler(new ParserErrorHandler(expressionString));
CypherParser.ExpressionContext expressionContext = parser.expression();
return new CypherCstToAstVisitor().visitExpression(expressionContext);
}
use of org.vertexium.cypher.CypherLexer 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);
}
Aggregations