Libraryless. Click here for Pure Java version (2968L/18K).
sclass TokScanner { LS tok; int idx = 1; // always points to code token *() {} *(LS *tok) {} *(LS *tok, int *idx) { idx |= 1; } *(S s) { this(javaTok(s)); } S get(int ofs default 0) { ret _get(tok, idx+ofs*2); } S consume() { ret atEnd() ? null : tok.get((idx += 2)-2); } void consume(int n) { idx += n*2; } void skipTo(int idx) { this.idx = idx | 1; } bool atEnd() { ret idx >= l(tok); } S consumeBracketPart() { int idx2 = findEndOfBracketPart(tok, idx); S result = joinSubList(tok, idx, idx2); skipTo(idx2); ret result; } }
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: | 172 / 390 |
Version history: | 10 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |