1 | // i = last C token of type |
2 | // returns first C token of type |
3 | static int tok_scanTypeBackwards(LS tok, int i) { |
4 | if (i < 0) ret i; |
5 | int level = 0; |
6 | while (i > 0) { |
7 | S t = tok.get(i); |
8 | if (isIdentifier(t) && level == 0) { |
9 | while (eqGet(tok, i-2, ".") && isIdentifier(get(tok, i-4))) |
10 | i -= 4; |
11 | ret i; |
12 | } |
13 | if (eq(t, ">")) ++level; |
14 | else if (eq(t, "<")) --level; |
15 | i -= 2; |
16 | } |
17 | ret i; |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021797 |
Snippet name: | tok_scanTypeBackwards (also jumps over package names) |
Eternal ID of this version: | #1021797/4 |
Text MD5: | cc793182290087c06493e455ac16f477 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-09 22:33:47 |
Source code size: | 436 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 369 / 377 |
Version history: | 3 change(s) |
Referenced in: | [show references] |