Libraryless. Click here for Pure Java version (3829L/22K).
1 | svoid tok_qFunctions(LS tok) { |
2 | tok_qFunctions(tok, "q", "dm_q"); |
3 | tok_qFunctions(tok, "runInQAndWait", "dm_runInQAndWait"); |
4 | } |
5 | |
6 | svoid tok_qFunctions(LS tok, S keyword, S function) { |
7 | int i; |
8 | while ((i = jfind_check(keyword, tok, "void <id> " + keyword + " {")) >= 0) { |
9 | int bracket = findCodeTokens(tok, i, false, "{"); |
10 | int j = findEndOfBracketPart(tok, bracket); |
11 | clearTokens(tok, i+4, i+6); |
12 | tok.set(bracket, "{ " + function + "(module(), r {"); |
13 | tok.set(j-1, "}); }"); |
14 | reTok(tok, i+4, j); |
15 | } |
16 | |
17 | while ((i = jfind_check(keyword, tok, ") " + keyword + " {")) >= 0) { |
18 | int opening = findBeginningOfBracketPart(tok, i); |
19 | S fname = assertIdentifier(get(tok, opening-2)); |
20 | int bracket = findCodeTokens(tok, i, false, "{"); |
21 | int j = findEndOfBracketPart(tok, bracket); |
22 | clearTokens(tok, i+2, i+4); |
23 | tok.set(bracket, "{ " + function + "(module(), r {"); |
24 | tok.set(j-1, "}); }"); |
25 | reTok(tok, i+4, j); |
26 | tok_makeArgumentsFinal(tok, opening, i); |
27 | } |
28 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024896 |
Snippet name: | tok_qFunctions - "q {" for running function in module queue |
Eternal ID of this version: | #1024896/4 |
Text MD5: | 0cf9ea9abb8f1fee195d4f4aeabd2102 |
Transpilation MD5: | 50c53266e07db8f877406341437506e4 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-24 02:25:35 |
Source code size: | 1024 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 247 / 362 |
Version history: | 3 change(s) |
Referenced in: | [show references] |