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

11
LINES

< > BotCompany Repo | #1014433 // tok_forall - parse "forall ($1) { $2 }" - returns index of next code token

JavaX fragment (include)

static int tok_forall(L<S> tok, Matches m) {
  if (!(eqGet(tok, 1, "forall") && eqGet(tok, 3, "("))) ret -1;
  int argsFrom = 5;
  int iClosing = indexOf(tok, argsFrom, ")");
  assertTrue(iClosing >= 0);
  assertEquals(get(tok, iClosing+2), "{");
  int iEnd = findEndOfBlock(tok, iClosing+2)-1;
  setMatches(m, joinSubList(tok, argsFrom, iClosing-1),
    joinSubList(tok, iClosing+4, iEnd-1));
  ret iEnd+2;
}

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: #1014433
Snippet name: tok_forall - parse "forall ($1) { $2 }" - returns index of next code token
Eternal ID of this version: #1014433/8
Text MD5: aadef4503ab3a7de57dc27535297b31f
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-21 18:24:21
Source code size: 419 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 301 / 331
Version history: 7 change(s)
Referenced in: [show references]