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

16
LINES

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

JavaX fragment (include)

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

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: 289 / 323
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)