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

16
LINES

< > BotCompany Repo | #1027657 // tok_transpileIfQuoted_dollarVars

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

Libraryless. Click here for Pure Java version (3193L/20K).

1  
// "i call you $name"
2  
svoid tok_transpileIfQuoted_dollarVars(LS tok) {
3  
  jreplace_dyn(tok, "if <quoted>", func(L<S> tok, int cIdx) -> S {
4  
    S pat = unquote(tok.get(cIdx+2));
5  
    new LS vars;
6  
    S pat2 = dollarVarsToStars(pat, vars);
7  
    
8  
    int iCurly = cIdx+4;
9  
    tok_statementToBlock(tok, iCurly);
10  
    tokAppend_reTok(tok, iCurly, joinWithSpace(mapWithIndexStartingAt1(vars,
11  
      (i, var) -> "S \*var*/ = $\*i*/;")));
12  
    ret "if (match(\*quote(pat2)*/, s, m))";
13  
  }, tokcondition {
14  
    ret containsDollarVars(unquote(tok.get(i+3)));
15  
  });
16  
}

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: #1027657
Snippet name: tok_transpileIfQuoted_dollarVars
Eternal ID of this version: #1027657/5
Text MD5: 7a8dceff73d207e0e1a298be0456266e
Transpilation MD5: b813f389395bbdb8198ea20be1adbeda
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-29 20:28:05
Source code size: 564 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 238 / 353
Version history: 4 change(s)
Referenced in: [show references]