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).

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

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: 142 / 233
Version history: 4 change(s)
Referenced in: [show references]