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

10
LINES

< > BotCompany Repo | #1022271 // tok_addCurlyBracketsAroundPart - modifies tok

JavaX fragment (include)

// i = first C token, j = last C token
static LS tok_addCurlyBracketsAroundPart(LS tok, int i, int j) {
  if (i == 1 && j == l(tok)-2) ret tok;
  S pre = get(tok, i-1), post = get(tok, j+1);
  if (endsWith(pre, "{") && startsWith(post, "}"))
    ret tok;
  tokPrepend(tok, i, "{");
  tokAppend(tok, j, "}");
  ret tok;
}

Author comment

Began life as a copy of #1021553

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022271
Snippet name: tok_addCurlyBracketsAroundPart - modifies tok
Eternal ID of this version: #1022271/5
Text MD5: 913fe585ed996d927d25d83dd3b10c1d
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 13:47:12
Source code size: 329 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 231
Version history: 4 change(s)
Referenced in: [show references]