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

43
LINES

< > BotCompany Repo | #1022572 // gazelle_reason_repeat_v2 - handle multiple [process] lines, dev.

JavaX fragment (include)

static L<GazelleTree> gazelle_reason_repeat_v2(S input1, O... _) {
  int max = 10;
  
  new L<GazelleTree> out;
  Set<S> seen = litCISet(input1);
  LinkedList<S> queue = ll_linkedList(input1);
  
  while (nempty(queue) && l(seen) < max) {
    S input = popFirst(queue);
    addAll(out, (L<GazelleTree>) callF(optPar sendToModules(_), input));
      
    L<GazelleTree> l = gazelle_reasonWithPreAndPost(input, paramsMinus(_, 'sendToModules));
    
    // commit to one entry
    
    if (empty(l)) continue;
    gazelle_sortBeforeCommit(l, _);
    
    GazelleTree t = first(l);
    if (boolPar debug(_) || boolPar debugCommit(_))
      print("Committing to: " + t.line + " (out of " + l(l) + ")");

    RuleEngine2.Rule r = t.rule();
    if (r == null || !contains(r.outTypes, "process"))
      continue with out.add(t); // normal line
      
    // separate lines & add to queue
    
    LS lines = tok_splitAtPlusAtBeginningOfLine(t.line);
    for i over lines: {
      S line = lines.get(i);
      if (eqGet(r.outTypes, i, "process"))
        addWithTesterSet(queue, seen, line);
      else {
        t.line = line;
        out.add(t);
        t = null;
      }
    }
  }
  
  ret out;
}

Author comment

Began life as a copy of #1022481

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022572
Snippet name: gazelle_reason_repeat_v2 - handle multiple [process] lines, dev.
Eternal ID of this version: #1022572/7
Text MD5: 27016b4d0a9bb4ad493ee8db0fb839ab
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-22 16:48:27
Source code size: 1232 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 317
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)