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

12
LINES

< > BotCompany Repo | #1017528 - tok_expandLPair - LPair<...> to L<Pair<...>>

JavaX fragment (include)

svoid tok_expandLPair(L<S> tok) {
  if (!tok.contains("LPair")) ret;
  int n = l(tok)-6;
  for (int i = 1; i < n; i += 2) {
    continue unless eq(tok.get(i), "LPair") && eq(tok.get(i+2), "<");
    int j = findEndOfTypeArgs(tok, i+2)-1; // j = index of >
    tok.set(i, "L<Pair");
    tok.set(j, ">>");
    reTok(tok, i, j+1);
    n = l(tok)-6;
  }
}

Author comment

Began life as a copy of #1017378

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1017528
Snippet name: tok_expandLPair - LPair<...> to L<Pair<...>>
Eternal ID of this version: #1017528/1
Text MD5: 8b6f0aa73fb3de590e364802fdb135bd
Author: stefan
Category: javax / transpilation
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-26 10:11:37
Source code size: 363 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 171 / 171
Referenced in: [show references]

Formerly at http://tinybrain.de/1017528 & http://1017528.tinybrain.de