Search in sources :

Example 1 with GraqlTemplateParser

use of ai.grakn.graql.internal.antlr.GraqlTemplateParser in project grakn by graknlabs.

the class TemplateParser method parseGraqlTemplate.

private ParseTree parseGraqlTemplate(CommonTokenStream tokens, GraqlErrorListener errorListener) {
    GraqlTemplateParser parser = new GraqlTemplateParser(tokens);
    parser.setBuildParseTree(true);
    parser.removeErrorListeners();
    parser.addErrorListener(errorListener);
    ParseTree tree = parser.template();
    if (errorListener.hasErrors()) {
        throw GraqlSyntaxException.create(errorListener.toString());
    }
    return tree;
}
Also used : GraqlTemplateParser(ai.grakn.graql.internal.antlr.GraqlTemplateParser) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Aggregations

GraqlTemplateParser (ai.grakn.graql.internal.antlr.GraqlTemplateParser)1 ParseTree (org.antlr.v4.runtime.tree.ParseTree)1