1 | static SS jmatchDollarVars(S pat, S s) { |
2 | new L<S> vars; |
3 | S pat2 = dollarVarsToStars(pat, vars); |
4 | new Matches m; |
5 | if (!jmatch(pat2, s, m)) null; |
6 | new SS map; |
7 | for (int i = 0; i < l(m.m); i++) { |
8 | S var = vars.get(i); |
9 | S value = m.get(i); |
10 | S oldValue = map.get(var); |
11 | if (oldValue == null) map.put(var, value); |
12 | else if (neq(oldValue, value)) null; |
13 | } |
14 | ret map; |
15 | } |
Began life as a copy of #1010858
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: | #1018068 |
Snippet name: | jmatchDollarVars |
Eternal ID of this version: | #1018068/1 |
Text MD5: | 4a095047b6855029010d56935ee5f43e |
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:19:09 |
Source code size: | 398 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 356 / 384 |
Referenced in: | [show references] |