diff --git a/src/parser/scanner.ts b/src/parser/scanner.ts index a3fefd7..d569456 100644 --- a/src/parser/scanner.ts +++ b/src/parser/scanner.ts @@ -248,20 +248,17 @@ export class Scanner { case char("0"): value += "\0"; break; case char('"'): value += '"'; this.next(); break; // Unicode Escape: \u{XXXX} - case char('v'): { - const braceStart = 123123; - } case char('u'): { this.next(); // consume 'u' - // 1. Expect '{' + // Expect '{' const braceStart = this.currentLocation(); if (this.peek() !== char('{')) { throw { tag: "InvalidEscape", reason: "Expected '{' after \\u", span: this.makeSpan(braceStart) }; } this.next(); // consume '{' - // 2. Consume Hex Digits + // Consume Hex Digits const hexStart = this.i; const hexCount = this.consumeWhile(c => (c >= char('0') && c <= char('9')) || @@ -273,13 +270,13 @@ export class Scanner { throw { tag: "InvalidEscape", reason: "Expected hex digits in \\u{...}", span: this.makeSpan(braceStart) }; } - // 3. Expect '}' + // Expect '}' if (this.peek() !== char("}")) { throw { tag: "InvalidEscape", reason: "Expected '}' closing unicode escape", span: this.makeSpan(braceStart) }; } this.next(); // consume '}' - // 4. Convert & Append + // Convert & Append const hexStr = this.text.sliceByCp(hexStart, hexStart + hexCount); const codePoint = parseInt(hexStr, 16);