// returns pair(functionName, args) static Pair<S, L<S>> tok_parseFunctionCall(S s) { ret tok_parseFunctionCall(javaTok(s)); } static Pair<S, L<S>> tok_parseFunctionCall(L<S> tok) { if (!(isIdentifier(get(tok, 1)) && eqGet(tok, 3, "("))) null; Map<Int> bracketMap = getBracketMap(tok); Int iClosing = bracketMap.get(3); if (!(eq(iClosing, l(tok)-4) && eqGet(tok, l(tok)-2, ";")) && neq(iClosing, l(tok)-2)) null; int i = 5, argStart = 5; new L<S> args; while (i < iClosing) { Int j = bracketMap.get(i); if (j != null) continue with i = j+2; if (eqGetOneOf(tok, i, ",")) { if (i > argStart) args.add(trimJoinSubList(tok, argStart, i)); argStart = i+2; } i += 2; } if (i > argStart) args.add(trimJoinSubList(tok, argStart, i)); ret pair(tok.get(1), args); }
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: | #1012494 |
Snippet name: | tok_parseFunctionCall |
Eternal ID of this version: | #1012494/4 |
Text MD5: | 0a26db96eec2d7ceb02a8e6ac4ff863c |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-20 13:46:09 |
Source code size: | 840 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 480 / 522 |
Version history: | 3 change(s) |
Referenced in: | [show references] |