use of com.cinchapi.ccl.SyntaxException in project concourse by cinchapi.
the class Criteria method parse.
/**
* Return a {@link Criteria} object that expresses the same as the
* {@code ccl} statement.
*
* @param ccl the CCL statement to parse
* @return an equivalent {@link Criteria} object
*/
public static Criteria parse(String ccl) {
try {
AbstractSyntaxTree ast = ConcourseCompiler.get().parse(ccl);
BuiltCriteria criteria = new BuiltCriteria();
criteria.symbols = Lists.newArrayList(ConcourseCompiler.get().tokenize(ast));
return criteria;
} catch (Exception e) {
if (e instanceof SyntaxException || e instanceof IllegalStateException || e.getCause() != null && e.getCause() instanceof com.cinchapi.ccl.generated.ParseException) {
throw new ParseException(new com.cinchapi.concourse.thrift.ParseException(e.getMessage()));
} else {
throw CheckedExceptions.throwAsRuntimeException(e);
}
}
}
Aggregations