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

15
LINES

< > BotCompany Repo | #1008965 - tok_autosemi

JavaX fragment (include)

static void tok_autosemi(L<S> tok) {
  int i;
  while (
    (i = jfind(tok, "autosemi {")) >= 0
    || (i = jfind(tok, "semiauto {")) >= 0) {
    int closing = findEndOfBlock(tok, i+2)-1;
    tok.set(i, ""); // remove autosemi keyword
    tok.set(i+1, "");
    for (int j = i+5; j < closing; j += 2)
      if (containsNewLine(tok.get(j))
        && neqOneOf(tok.get(j-1), "{", "}", ";"))
      tok.set(j-1, tok.get(j-1) + ";");
    reTok(tok, i, closing);
  }
}

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1008965
Snippet name: tok_autosemi
Eternal ID of this version: #1008965/4
Text MD5: 23634fff5b1436f249d637772d07c2c5
Author: stefan
Category: javax / preprocessing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-20 04:33:43
Source code size: 475 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 225 / 250
Version history: 3 change(s)
Referenced in: [show references]

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