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

19
LINES

< > BotCompany Repo | #1017875 // matchDollarVarsIC_plusBrackets - use match() with dollar vars; allow curly phrases in s; now supports $_q_

JavaX fragment (include)

static SS matchDollarVarsIC_plusBrackets(S pat, S s) {
  if (pat == null || s == null) null;
  new L<S> vars;
  S pat2 = dollarVarsToStars(pat, vars);
  new Matches m;
  if (!match3_plusBrackets(pat2, s, m)) null;
  new SS map;
  for (int i = 0; i < l(m.m); i++) {
    S var = vars.get(i);
    S value = m.get(i);
    if (startsWith(var, "$_q_")) {
      if (!isQuoted(value)) null;
      var = "$" + substring(var, 4);
      value = unquote(value);
    }
    if (!strictPutIC(map, var, value)) null;
  }
  ret map;
}

Author comment

Began life as a copy of #1010862

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017875
Snippet name: matchDollarVarsIC_plusBrackets - use match() with dollar vars; allow curly phrases in s; now supports $_q_
Eternal ID of this version: #1017875/8
Text MD5: 18fbb75c4be377ba7cb105d58efc9a9a
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-29 13:52:38
Source code size: 535 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 343 / 374
Version history: 7 change(s)
Referenced in: [show references]