1 | svoid dm_gazelle_matchStep_condition(GazelleTree t, O... _) { |
2 | if (t.rule() == null) ret; |
3 | bool debug = boolPar debug(_) || boolPar debugConditions(_); |
4 | GRuleLine next = get(t.rule().insWithType, t.mr.iCond); |
5 | if (debug) print("matchStep_condition: " + getString type(next)); |
6 | if (next == null || !eq(next.type, "condition")) ret; |
7 | |
8 | bool satisfied = false; |
9 | |
10 | //S cond = next.text; |
11 | S cond = t.mr.applyMappingTo(next); |
12 | |
13 | if (gazelle_isEmbeddedEval(cond)) { |
14 | if (debug) print("Embedded eval: " + cond); |
15 | satisfied = eqic(dm_processEmbeddedSafeEvals(cond), "true"); |
16 | } else { |
17 | GazelleEvalContext subCtx = cast callF(requiredPar contextMaker(_)); |
18 | subCtx.engine.dropRulesWhere(r -> neq(r.purpose, "condition to eval")); |
19 | L<GazelleTree> l = dm_gazelle_reasonAboutChatInput_v2(null, cond, paramsPlus(paramsMinus(_, 'acceptablePurposes), ctx := subCtx)); |
20 | gazelle_processSafeEvalsInTree(l); |
21 | if (debug) { |
22 | print("Sub-Tree for condition " + cond + ":"); |
23 | printIndentLines(l); |
24 | } |
25 | |
26 | for (GazelleTree tree : l) |
27 | if (eqic(tree.line, "true")) |
28 | break with satisfied = true; |
29 | else if (eqic(tree.line, "false")) |
30 | break; |
31 | } |
32 | |
33 | if (debug) print("satisfied=" + satisfied); |
34 | if (!satisfied) ret; |
35 | |
36 | t.mr.iCond++; |
37 | gazelle_addPredictionToTreeNode(t); |
38 | t.mr.remainingConditions = dropFirst(t.mr.remainingConditions); |
39 | t.mr.remainingConditionsWithType = dropFirst(t.mr.remainingConditionsWithType); |
40 | } |
Began life as a copy of #1022400
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1022407 |
Snippet name: | dm_gazelle_matchStep_condition |
Eternal ID of this version: | #1022407/14 |
Text MD5: | fded3dc288f675e3052db4faa38daf37 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-17 16:42:26 |
Source code size: | 1508 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 331 / 365 |
Version history: | 13 change(s) |
Referenced in: | [show references] |