1 | // returns pair(functionName, args) |
2 | static Pair<S, L<S>> tok_parseFunctionCall(S s) { |
3 | ret tok_parseFunctionCall(javaTok(s)); |
4 | } |
5 | |
6 | static Pair<S, L<S>> tok_parseFunctionCall(L<S> tok) { |
7 | if (!(isIdentifier(get(tok, 1)) && eqGet(tok, 3, "("))) null; |
8 | Map<Int> bracketMap = getBracketMap(tok); |
9 | Int iClosing = bracketMap.get(3); |
10 | if (!(eq(iClosing, l(tok)-4) && eqGet(tok, l(tok)-2, ";")) |
11 | && neq(iClosing, l(tok)-2)) null; |
12 | int i = 5, argStart = 5; |
13 | new L<S> args; |
14 | while (i < iClosing) { |
15 | Int j = bracketMap.get(i); |
16 | if (j != null) continue with i = j+2; |
17 | if (eqGetOneOf(tok, i, ",")) { |
18 | if (i > argStart) args.add(trimJoinSubList(tok, argStart, i)); |
19 | argStart = i+2; |
20 | } |
21 | i += 2; |
22 | } |
23 | if (i > argStart) args.add(trimJoinSubList(tok, argStart, i)); |
24 | ret pair(tok.get(1), args); |
25 | } |
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: | 482 / 525 |
Version history: | 3 change(s) |
Referenced in: | [show references] |