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

19
LINES

< > BotCompany Repo | #1025738 // gazelle_deepZip_keepBrackets - Gazelle's magic function

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3092L/19K).

static SS gazelle_deepZip_keepBrackets(S inputA, S inputB, O... _) {
  SS map = gazelle_zip_keepBrackets(inputA, inputB);
  if (map == null) null;
  SS map2 = similarEmptyMap(map);
  for (S a, S b : map) {
    bool iba = tok_isRoundOrCurlyBracketed(a), ibb = tok_isRoundOrCurlyBracketed(b);
    if (iba && ibb) {
      S aa = tok_deRoundOrCurlyBracket(a);
      S bb = tok_deRoundOrCurlyBracket(b);
      SS subMap = gazelle_deepZip_keepBrackets(aa, bb, _);
      if (subMap == null) null;
      if (!putAllStrictlyIC(map2, subMap)) null;
    } else if (eqic_roundBracketed(a, b)) {
      // OK, match
    } else
      if (!strictPutIC(map2, a, b)) null;
  }
  ret map2;
}

Author comment

Began life as a copy of #1025728

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1025738
Snippet name: gazelle_deepZip_keepBrackets - Gazelle's magic function
Eternal ID of this version: #1025738/7
Text MD5: 115f9477eb81d3aa6513bbe9afdc9daf
Transpilation MD5: 94ff9e6682fdb45b461fe237ccc74392
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-23 12:47:27
Source code size: 690 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 259 / 394
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1025840 - gazelle_deepReplaceVars - doesn't auto-bracket map values
#1027140 - gazelle_visit - call a function on input and all inner parts of input
#1027988 - gazelle_deepZip_keepBrackets - Gazelle's magic function [backup 1]