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

23
LINES

< > BotCompany Repo | #1008819 // printExplainTree2

JavaX fragment (include)

static void printExplainTree2(Explain e) {
  printExplainTree2(0, e);
}

static void printExplainTree2(int indent, Explain e) {
  bool printNulls = false;
  
  if (e == null) {
    // this would print "null" for every <identifier> etc
    if (printNulls || indent == 0)
      print(indent(indent) + "null");
  } else {
    new L<S> classNames;
    while true {
      classNames.add(e.className());
      if (!e.singleEqualChild()) break;
      e = e.sub(0);
    }
    print(indent(indent) + join(", ", classNames) + " | " + e.string());
    for (Explain sub : e.subs)
      printExplainTree2(indent+2, sub);
  }
}

Author comment

Began life as a copy of #1002738

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008819
Snippet name: printExplainTree2
Eternal ID of this version: #1008819/3
Text MD5: 8127219ca403b73738db827cbdd9b6ce
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-22 23:53:54
Source code size: 635 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 647 / 739
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1008820 - printExplainTree2_filterClasses