static L<S> tok_withoutOuterBrackets(L<S> tok) { if (!eq(get(tok, 1), "(") || !eq(nextToLast(tok), ")")) ret tok; int level = 1; for (int i = 3; i < l(tok)-2; i += 2) { S t = get(tok, i); if (eq(t, "(")) ++level; else if (eq(t, ")")) if (--level == 0) ret tok; } ret level == 1 ? subList(tok, 2, l(tok)-2) : tok; }
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: | #1012906 |
Snippet name: | tok_withoutOuterBrackets |
Eternal ID of this version: | #1012906/2 |
Text MD5: | 4e0d981884761c158ec92b9e4e6c511b |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-16 13:21:58 |
Source code size: | 345 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 424 / 433 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |