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);
  }
}