Warning: session_start(): open(/var/lib/php/sessions/sess_p335s9io9u96g3gqsubluu6q9m, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sbool nlLogic_evalExp_verbose = true;
static O nlLogic_evalExp(final NLLogicChecker_v2 c, Exp e, NLLogicChecker_v2.Matching m) {
// prepare context
final SS vars = m.matches;
temp tempSetThreadLocal(ai_context_tl(), new O {
LS getList(S var) {
int i = 1;
S s;
new LS l;
while ((s = vars.get(var + i++)) != null)
l.add(s);
ret l;
}
IfThen getRule(S id) {
ret findByField(c.rules, globalID := id);
}
});
S code = nlLogic_text(e);
if (nlLogic_evalExp_verbose) print("Eval'ing: " + code);
temp tempAdd(hotwire_copyOver_after, voidfunc(Class c) {
copyFields(mc(), c, ai_staticVars())
});
O result = null;
pcall {
temp tempSetThreadLocal(evalJava_prep2_useCacheInThread, true);
Pair p = prepareEvalWithDollarVars_assertAllVarsSet(code, m.matches);
// Accomodate ai_isTrue
if (hasField(p.b, 'ai_isTrue_f))
set(p.b, 'ai_isTrue_f := func(S s) -> bool { nlLogic_matchAnyFact(c, s, new NLLogicChecker_v2.Matching()) });
// Accomodate ai_input
if (c.input != null) {
ThreadLocal tl_vars = cast getOpt(p.b, 'ai_getVar_map);
if (tl_vars != null)
tl_vars.set(litmap("#input" := c.input));
}
result = evalWithDollarVars_step2(p, m.matches);
}
if (nlLogic_evalExp_verbose) print(" eval => " + shorten(str(result), 100));
ret result;
}