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


< > BotCompany Repo | #1018068 // jmatchDollarVars

JavaX fragment (include)

static SS jmatchDollarVars(S pat, S s) {
  new L<S> vars;
  S pat2 = dollarVarsToStars(pat, vars);
  new Matches m;
  if (!jmatch(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);
    S oldValue = map.get(var);
    if (oldValue == null) map.put(var, value);
    else if (neq(oldValue, value)) null;
  ret map;

Author comment

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: 229 / 255
Referenced in: [show references]