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

23
LINES

< > BotCompany Repo | #1008819 // printExplainTree2

JavaX fragment (include)

1  
static void printExplainTree2(Explain e) {
2  
  printExplainTree2(0, e);
3  
}
4  
5  
static void printExplainTree2(int indent, Explain e) {
6  
  bool printNulls = false;
7  
  
8  
  if (e == null) {
9  
    // this would print "null" for every <identifier> etc
10  
    if (printNulls || indent == 0)
11  
      print(indent(indent) + "null");
12  
  } else {
13  
    new L<S> classNames;
14  
    while true {
15  
      classNames.add(e.className());
16  
      if (!e.singleEqualChild()) break;
17  
      e = e.sub(0);
18  
    }
19  
    print(indent(indent) + join(", ", classNames) + " | " + e.string());
20  
    for (Explain sub : e.subs)
21  
      printExplainTree2(indent+2, sub);
22  
  }
23  
}

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: 568 / 665
Version history: 2 change(s)
Referenced in: [show references]