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)

1  
static SS matchDollarVarsIC_plusBrackets(S pat, S s) {
2  
  if (pat == null || s == null) null;
3  
  new L<S> vars;
4  
  S pat2 = dollarVarsToStars(pat, vars);
5  
  new Matches m;
6  
  if (!match3_plusBrackets(pat2, s, m)) null;
7  
  new SS map;
8  
  for (int i = 0; i < l(m.m); i++) {
9  
    S var = vars.get(i);
10  
    S value = m.get(i);
11  
    if (startsWith(var, "$_q_")) {
12  
      if (!isQuoted(value)) null;
13  
      var = "$" + substring(var, 4);
14  
      value = unquote(value);
15  
    }
16  
    if (!strictPutIC(map, var, value)) null;
17  
  }
18  
  ret map;
19  
}

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