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

17
LINES

< > BotCompany Repo | #1027655 // transpile_inStringEval

JavaX fragment (include)

1  
sS transpile_inStringEval(S t) {
2  
  t = dropPrefix("\"", dropSuffix("\"", t));
3  
  new L<S> l;
4  
  int idx;
5  
  while ((idx = t.indexOf("\\*")) >= 0) {
6  
    int j = indexOf(t, idx, "*/");
7  
    if (j < 0) break;
8  
    if (idx > 0)
9  
      l.add("\"" + substring(t, 0, idx) + "\"");
10  
    S code = trim(substring(t, idx+2, j));
11  
    l.add(isIdentifier(code) ? code : "(" + code + ")");
12  
    t = substring(t, j+2);
13  
  }
14  
  if (nempty(t))
15  
    l.add("\"" + t + "\"");
16  
  ret "(" + join(" + ", l) + ")";
17  
}

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: #1027655
Snippet name: transpile_inStringEval
Eternal ID of this version: #1027655/1
Text MD5: 2e89f26530863ddb5b432438c96b0589
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-29 19:48:40
Source code size: 495 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 107 / 145
Referenced in: [show references]