Libraryless. Click here for Pure Java version (8649L/49K).
1 | static LS findFunctionDefsAtCurlyLevel(int curlyLevel, S s) { |
2 | ret findFunctionDefsAtCurlyLevel(curlyLevel, javaTok(s)); |
3 | } |
4 | |
5 | static LS findFunctionDefsAtCurlyLevel(int targetCurlyLevel, LS tok) { |
6 | ifclass IContentsIndexedList2 |
7 | if (tok cast IContentsIndexedList2<S>) |
8 | ret findFunctionDefsAtCurlyLevel_indexed(targetCurlyLevel, tok); |
9 | endif |
10 | |
11 | new LS functions; |
12 | |
13 | var keywords = findFunctionDefs_keywords(); |
14 | |
15 | int n = l(tok); |
16 | int curlyLevel = 0; |
17 | new BitSet ignore; |
18 | for (int i = 1; i < n; i += 2) { |
19 | if (ignore.get(i)) continue; |
20 | S t = tok.get(i); |
21 | |
22 | // Account for meta-for (don't change curly level) |
23 | if (eqSubList(tok, i, "meta", "", "-", "", "for")) { |
24 | var r = tok_findFirstBlock(tok, i); |
25 | ignore.set(r.start); |
26 | ignore.set(r.end-1); |
27 | } |
28 | |
29 | curlyLevel += curlyLevel(t); |
30 | if (curlyLevel == targetCurlyLevel) |
31 | if (keywords.contains(t)) |
32 | findFunctionDefs_step(tok, i, functions); |
33 | } |
34 | ret functions; |
35 | } |
Began life as a copy of #1004051
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034500 |
Snippet name: | findFunctionDefsAtCurlyLevel |
Eternal ID of this version: | #1034500/4 |
Text MD5: | 9c50ca8a9e3d049a16d450f52b9ed088 |
Transpilation MD5: | 3c7d1acf527ed3ad094e90e86954a55e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-01 20:17:49 |
Source code size: | 1011 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 184 / 271 |
Version history: | 3 change(s) |
Referenced in: | [show references] |