use of com.yahoo.vespa.indexinglanguage.parser.IndexingParser in project vespa by vespa-engine.
the class ScriptParser method parse.
private static <T extends Expression> T parse(ScriptParserContext config, ParserMethod<T> method) throws ParseException {
CharStream input = config.getInputStream();
IndexingParser parser = new IndexingParser(input);
parser.setAnnotatorConfig(config.getAnnotatorConfig());
parser.setDefaultFieldName(config.getDefaultFieldName());
parser.setLinguistics(config.getLinguistcs());
try {
return method.call(parser);
} catch (ParseException e) {
if (!(input instanceof FastCharStream)) {
throw e;
}
throw new ParseException(((FastCharStream) input).formatException(e.getMessage()));
} finally {
if (parser.token != null && parser.token.next != null) {
input.backup(parser.token.next.image.length());
}
}
}
Aggregations