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

14
LINES

< > BotCompany Repo | #1017442 // javaTokNPunctuation - put words in C, punctuation + spacing in N

JavaX fragment (include)

static L<S> javaTokNPunctuation(S s) {
  L<S> tok = javaTok(s);
  for (int i = 1; i < l(tok); i += 2) {
    int j = i;
    S t;
    while (j < l(tok) && l(t = tok.get(j)) == 1
      && !Character.isLetterOrDigit(t.charAt(0)))
        j += 2;
    if (j > i)
      // j points to next C token after mergeable stuff
      replaceSubList(tok, i-1, j, ll(joinSubList(tok, i-1, j)));
  }
  ret tok;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1017442
Snippet name: javaTokNPunctuation - put words in C, punctuation + spacing in N
Eternal ID of this version: #1017442/4
Text MD5: 2442aee99517824d460fb8d0cc96d50a
Author: stefan
Category: javax / tokenizing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-11 13:11:33
Source code size: 407 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 442 / 1072
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1020302 - javaTokNPunctuationC - codeTokens of javaTokNPunctuation
#1021069 - javaTokNPunctuation_plusAsterisk
#1021361 - javaTokNPunctuationWithBrackets - put words in C, punctuation + spacing in N, honor brackets
#1021422 - javaTokNPunctuation_bracketsInC - put words + curly & round brackets in C, punctuation + spacing in N