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

21
LINES

< > BotCompany Repo | #1001879 // statements

JavaX fragment (include)

// assumes that it's a list of statements; return them one by one
static L<L<S>> statements(L<S> tok) {
  new L<L<S>> l;
  int i = 0;
  while (i < l(tok)) {
    int j = indexOf(tok, ";", i);
    if (j < 0) {
      if (l(tok)-i >= 3)
        l.add(tok.subList(i, l(tok)));
      break;
    } else {
      l.add(tok.subList(i, j+2)); // actual CNC - we may return some comments twice, but we don't look at them anyways.
      i = j+1; // go to non-code token
    }
  }
  ret l;
}

static L<L<S>> statements(S s) {
  ret statements(javaTok(s));
}

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: #1001879
Snippet name: statements
Eternal ID of this version: #1001879/1
Text MD5: 6286d67100b6c09704487a0720455098
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-01 21:27:33
Source code size: 563 bytes / 21 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 690 / 921
Referenced in: [show references]