Someone
public text v1 · immutable/**
* Test if a string is a valid expression of the query language.
* @param expression The expression to test
* @return Whether the string validates or not
*/
public boolean validate(String expression) {
try {
new query(new StringReader(expression));
query.Start();
//No errors; the string is valid.
return true;
} catch (Throwable e) {
//An error indicates failure. Not that exception cannot be used here as TokenMgrError is an /error/, not an exception.
return false;
}
}