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)

static L<GazelleTree> gazelle_getChildren_withContinuations(GazelleTree tree, O... _) {
  L<GazelleTree> l = gazelle_getChildren(tree, _);
  bool debug = boolPar debug(_) || boolPar debugContinuations(_);
  
  new Matches m;
  bool changes = false;
  for i over l: {
    GazelleTree t = l.get(i);
    continue unless eq(t.lineType, 'instruction)
      && match("continue with line * of rule * without variables", t.line, m);
      
    if (debug) print("Processing continuation: " + sfu(m));

    S ruleID = $2;
    RuleEngine2.Rule rule = t.ctx.engine.getRule(ruleID);
    if (rule == null) {
      print("Follow-up rule not found: " + ruleID);
      continue with l.remove(i--);
    }
    
    set changes;
    t.mr.rule = rule;
    t.mr.iCond = parseInt($1)-1;
    t.mr.map = ciMap();
    // TODO: remainingConditions?
    
    if (!t.mr.moreConditions()) {
      t.line = rule.out;
      t.lineType = rule.outType();
    }

    gazelle_addPredictionToTreeNode(t);
  }

  if (changes) gazelle_sortChildren(l);
  ret l;
}

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: 196 / 246
Version history: 8 change(s)
Referenced in: [show references]