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

16
LINES

< > BotCompany Repo | #1022646 // extractEmbeddedEvals - "... {= bla} ..."

JavaX fragment (include)

1  
static LS extractEmbeddedEvals(S s, O... _) {
2  
  new LS list;
3  
  if (!contains(s, "{=")) ret list;
4  
  
5  
  LS tok = javaTok(s);
6  
  Map<Int> bracketMap = curlyBracketMap(tok);
7  
  for (int i = 1; i < l(tok)-4; i += 2) {
8  
    continue unless eq(tok.get(i), "{") && eqGet(tok, i+1, "") && eqGet(tok, i+2, "=");
9  
    // eval found
10  
    
11  
    int j = or(bracketMap.get(i), l(tok));
12  
    S code = joinSubList(tok, i+4, j-1);
13  
    list.add(code);
14  
  }
15  
  ret list;
16  
}

Author comment

Began life as a copy of #1022318

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022646
Snippet name: extractEmbeddedEvals - "... {= bla} ..."
Eternal ID of this version: #1022646/1
Text MD5: 695871459cfd179caed1ae096834b75f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-26 00:46:27
Source code size: 458 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 290 / 325
Referenced in: [show references]