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

36
LINES

< > BotCompany Repo | #1022481 // gazelle_reason_repeat

JavaX fragment (include)

!include once #1022792 // often-used functions

static L<GazelleTree> gazelle_reason_repeat(S input, O... _) {
  new L<GazelleTree> out;
  
  int steps = 0, max = 10;
  while (steps++ < max) {
    addAll(out, (L<GazelleTree>) callF(optPar sendToModules(_), input));
      
    L<GazelleTree> l = gazelle_reasonWithPreAndPost(input, paramsMinus(_, 'sendToModules));
    
    // commit to one entry
    
    if (empty(l)) break;
    
    gazelle_sortBeforeCommit(l, _);
    
    GazelleTree t = first(l);
    if (boolPar debug(_) || boolPar debugCommit(_))
      print("Committing to: " + t.line + " (out of " + l(l) + ")");

    LS lines = tok_splitAtPlusAtBeginningOfLine(t.line);
    if (l(lines) == 2 && t.rule() != null && contains(t.rule().comments, "out 2 = process")) {
      print("splitting!");
      t.line = first(lines);
      out.add(t);
      input = second(lines);
      continue;
    }
    
    out.add(t);
    break;
  }
  
  ret out;
}

Author comment

Began life as a copy of #1022445

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022481
Snippet name: gazelle_reason_repeat
Eternal ID of this version: #1022481/14
Text MD5: cb8154805dc40b410f98bb151c5c6edc
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-07 16:36:35
Source code size: 987 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 273 / 330
Version history: 13 change(s)
Referenced in: [show references]