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

16
LINES

< > BotCompany Repo | #1028482 // renderLineCompedSingleWithBrackets

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

Libraryless. Click here for Pure Java version (2578L/17K).

1  
sS renderLineCompedSingleWithBrackets(LineCompedSingle<Char> lc) {
2  
  new StringBuilder buf;
3  
  renderLineCompedSingleWithBrackets_step(lc, buf, lc.main);
4  
  ret str(buf);
5  
}
6  
  
7  
svoid renderLineCompedSingleWithBrackets_step(LineCompedSingle<Char> lc, StringBuilder buf, L<Int> chunks) {
8  
  for (int idx : chunks)
9  
    if (idx < l(lc.literals))
10  
      buf.append(lc.literals.get(idx));
11  
    else {
12  
      buf.append("(");
13  
      renderLineCompedSingleWithBrackets_step(lc, buf, intPairToList(lc.pairs.get(idx-l(lc.literals))));
14  
      buf.append(")");
15  
    }
16  
}

Author comment

Began life as a copy of #1028479

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1028482
Snippet name: renderLineCompedSingleWithBrackets
Eternal ID of this version: #1028482/6
Text MD5: c0797e2fb7d49654ca2ed3d85f022bba
Transpilation MD5: fd5f35e486a446c5477fa01e553cafe0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-22 00:40:39
Source code size: 562 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 214 / 301
Version history: 5 change(s)
Referenced in: [show references]