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

19
LINES

< > BotCompany Repo | #1034464 // Tok_SimpleSizeAnalysis

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (6166L) is out of date.

srecord noeq Tok_SimpleSizeAnalysis(LS tok) {
  new LS lines;
  
  S get() {
    scan(tok, 1);
    ret lines(sortedDesc(lines));
  }
  
  void scan(LS tok, int level) {
    for (IntRange r : tok_allCurlyBodies(tok)) {
      int iLineStart = tok_beginningOfLine(tok, r.start);
      int tokens = countTokens(r);
      lines.add(lpad(14, nTokens(tokens)) + " (level " + level + "): " 
        + shorten(trimJoinSubList(tok, iLineStart, r.start-1)));
    
      scan(tokSubList(tok, intRange(r.start+2, r.end)), level+1);
    }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034464
Snippet name: Tok_SimpleSizeAnalysis
Eternal ID of this version: #1034464/7
Text MD5: fa95cb4147aea80de7c5ba20311f8199
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-08 01:41:51
Source code size: 548 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 134 / 233
Version history: 6 change(s)
Referenced in: [show references]