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

13
LINES

< > BotCompany Repo | #1017258 // tok_shouldAddReturn

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2723L/17K).

sbool tok_shouldAddReturn(LS tok) {
  S lastToken = get(tok, l(tok)-2);
  if (eqOneOf(lastToken, ";", null)) false;
  if (eq(lastToken, "}")) {
    int i = findBeginningOfBlock(tok, l(tok)-2);
    ret eqGet(tok, i-4, "-") && eqGet(tok, i-3, "") && eqGet(tok, i-2, ">"); // it's a lambda definition
  }
  true;
}

sbool tok_shouldAddReturn(S s) {
  ret tok_shouldAddReturn(javaTok(s));
}

Author comment

Began life as a copy of #1003852

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017258
Snippet name: tok_shouldAddReturn
Eternal ID of this version: #1017258/5
Text MD5: 2e06e2472c515075feb8459ac9d15026
Transpilation MD5: c782a9d74627704ea3d2d909a059453e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-04 12:16:37
Source code size: 398 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 333 / 428
Version history: 4 change(s)
Referenced in: [show references]