static new ThreadLocal je_checkRule_debug; static bool je_checkRule(L rule) { try { ret je_checkRule_impl(rule); } catch e { printShortOrLongException(e, isTrue(je_checkRule_debug!)); } false; } static bool je_checkRule_impl(L rule) { bool debug = isTrue(je_checkRule_debug!); for (JE_CascadeEntry e : rule) { if (eqicOneOf(e.op, "if", "and")) { if (e.java) { // direct match on input with: if "bla" if (l(e.tok) == 3 && isQuoted(get(e.tok, 1))) { S input = (S) ai_getVar("#input"); S pat = unquote(get(e.tok, 1)); if (!eqic(input, pat)) { debug print "Rule fail on input: " + pat + " / " + input; false; } } else { O result = safeInterpretedJavaEval(e.tok); if (!isTrue_able(result)) fail("Weird result type of function " + join(e.tok) + ": " + (result instanceof S ? quote((S) result) : className(result))); if (!isTrue(result)) { debug print "Rule fail on Java: " + join(e.tok); false; } } } else { L tok = tok_withoutOuterBrackets(e.tok); T3 t = ai_tripelizeOrParseTriple(join(tok)); if (!has(t)) { debug print "Rule fail on triple: " + ai_renderTriple(t); false; } } } else if (eqic(e.op, "then")) break; else fail("Unsupported operator: " + e.op); } debug print "Rule hit"; true; }