From 345f69fd1c13b7fff4ac92dc8b303939c774a35d Mon Sep 17 00:00:00 2001 From: Yura Dupyn <2153100+omedusyo@users.noreply.github.com> Date: Mon, 6 Apr 2026 19:12:36 +0200 Subject: [PATCH] add codePointAt and don't normalize --- src/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 620c4c2..e3a9678 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,9 @@ export class SourceText { readonly lineStarts: CodePointIndex[]; constructor(rawSource: string) { - const source = rawSource.normalize('NFC'); + // TODO: This shouldn't really be a concern of the library. + // const source = rawSource.normalize('NFC'); + const source = rawSource; this.source = source; this.chars = []; @@ -57,6 +59,10 @@ export class SourceText { } } + codePointAt(index: CodePointIndex): CodePoint { + return this.chars[index].char; + } + get length(): number { return this.chars.length; } @@ -196,6 +202,10 @@ export class SourceRegion { public readonly span: Span ) {} + codePointAt(index: CodePointIndex): CodePoint { + return this.source.codePointAt(index); + } + get length(): number { return this.span.end.index - this.span.start.index; }