Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

37
LINES

< > BotCompany Repo | #1022416 // gazelle_getChildren_withContinuations

JavaX fragment (include)

1  
static L<GazelleTree> gazelle_getChildren_withContinuations(GazelleTree tree, O... _) {
2  
  L<GazelleTree> l = gazelle_getChildren(tree, _);
3  
  bool debug = boolPar debug(_) || boolPar debugContinuations(_);
4  
  
5  
  new Matches m;
6  
  bool changes = false;
7  
  for i over l: {
8  
    GazelleTree t = l.get(i);
9  
    continue unless eq(t.lineType, 'instruction)
10  
      && match("continue with line * of rule * without variables", t.line, m);
11  
      
12  
    if (debug) print("Processing continuation: " + sfu(m));
13  
14  
    S ruleID = $2;
15  
    RuleEngine2.Rule rule = t.ctx.engine.getRule(ruleID);
16  
    if (rule == null) {
17  
      print("Follow-up rule not found: " + ruleID);
18  
      continue with l.remove(i--);
19  
    }
20  
    
21  
    set changes;
22  
    t.mr.rule = rule;
23  
    t.mr.iCond = parseInt($1)-1;
24  
    t.mr.map = ciMap();
25  
    // TODO: remainingConditions?
26  
    
27  
    if (!t.mr.moreConditions()) {
28  
      t.line = rule.out;
29  
      t.lineType = rule.outType();
30  
    }
31  
32  
    gazelle_addPredictionToTreeNode(t);
33  
  }
34  
35  
  if (changes) gazelle_sortChildren(l);
36  
  ret l;
37  
}

Author comment

Began life as a copy of #1021556

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: #1022416
Snippet name: gazelle_getChildren_withContinuations
Eternal ID of this version: #1022416/9
Text MD5: 0e893cf40b661d5cb94c396b39a7e373
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-22 15:51:40
Source code size: 1059 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 251
Version history: 8 change(s)
Referenced in: [show references]