Libraryless. Click here for Pure Java version (23717L/144K).
sclass TokenRangeWithSrc extends TokenRange { LS tok; settable O sourceInfo; // e.g. script ID *() {} *(LS tok, int *start) { end = start; } *(LS tok, int *start, int *end) {} *(TokPtr startPtr, TokPtr endPtr) { assertNotNull(+startPtr); assertNotNull(+endPtr); assertSame(tok = startPtr.list(), endPtr.list()); start = startPtr.idx(); end = endPtr.idx(); } TokPtr startPtr() { ret ListAndIndex(tok, start); } TokPtr endPtr() { ret ListAndIndex(tok, end); } LineAndColumn startLineAndCol() { ret tokenToLineAndColumn(startPtr()); } LineAndColumn endLineAndCol() { ret tokenToLineAndColumn(endPtr()); } S text() { ret joinSubList(tok, start, end); } S renderRange() { ret renderLineAndColumnRange(startLineAndCol(), endLineAndCol()); } toString { ret spaceCombine(sourceInfo(), renderRange()); } S fullSourceText() { ret join(tok); } }
Began life as a copy of #1027942
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034243 |
Snippet name: | TokenRangeWithSrc |
Eternal ID of this version: | #1034243/12 |
Text MD5: | 53d17691137e2c4b075c46990826c0d5 |
Transpilation MD5: | c71564ec460afa8dbbb0edc83f5a4705 |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-11 19:44:15 |
Source code size: | 965 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 254 / 439 |
Version history: | 11 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) #1034244 - IHasTokenRangeWithSrc |