1 | static SS matchDollarVars(S pat, S s) { |
2 | new L<S> vars; |
3 | S pat2 = dollarVarsToStars(pat, vars); |
4 | new Matches m; |
5 | if (!match(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 #1010855
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010858 |
Snippet name: | matchDollarVars |
Eternal ID of this version: | #1010858/2 |
Text MD5: | 8a0fa57a4841e16bb2e5f5d49e2ed6e9 |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-04 22:44:59 |
Source code size: | 396 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 479 / 512 |
Version history: | 1 change(s) |
Referenced in: | [show references] |