Libraryless. Click here for Pure Java version (2968L/18K).
1 | sclass TokScanner { |
2 | LS tok; |
3 | int idx = 1; // always points to code token |
4 | |
5 | *() {} |
6 | *(LS *tok) {} |
7 | *(LS *tok, int *idx) { idx |= 1; } |
8 | *(S s) { this(javaTok(s)); } |
9 | |
10 | S get(int ofs default 0) { ret _get(tok, idx+ofs*2); } |
11 | S consume() { ret atEnd() ? null : tok.get((idx += 2)-2); } |
12 | void consume(int n) { idx += n*2; } |
13 | void skipTo(int idx) { this.idx = idx | 1; } |
14 | |
15 | bool atEnd() { ret idx >= l(tok); } |
16 | |
17 | S consumeBracketPart() { |
18 | int idx2 = findEndOfBracketPart(tok, idx); |
19 | S result = joinSubList(tok, idx, idx2); |
20 | skipTo(idx2); |
21 | ret result; |
22 | } |
23 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030990 |
Snippet name: | TokScanner |
Eternal ID of this version: | #1030990/11 |
Text MD5: | c363777a67b95de069c98897546b4d94 |
Transpilation MD5: | 9d75a21ca2da301ef8653b63f2b93f25 |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-18 18:16:10 |
Source code size: | 602 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 173 / 393 |
Version history: | 10 change(s) |
Referenced in: | [show references] |