diff --git a/src/index.ts b/src/index.ts index fde615d..c9fe663 100644 --- a/src/index.ts +++ b/src/index.ts @@ -241,6 +241,10 @@ export class SourceRegion { return this.source.sliceByCp(this.span.start.index, this.span.end.index); } + stringOf(span: Span): string { + return this.subRegion(span).toString(); + } + // Returns a Span for the given line (1-based index). getLineSpan(line: number, stripNewlines = true): Span { if (line < this.span.start.line || line > this.span.end.line) {