MCPcopy Create free account
hub / github.com/aiscript-dev/aiscript / readUnicodeEscapeSequence

Method readUnicodeEscapeSequence

src/parser/scanner.ts:466–482  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

464 }
465
466 private readUnicodeEscapeSequence(): `u${string}` {
467 if (this.stream.eof || (this.stream.char as string) !== 'u') {
468 throw new AiScriptSyntaxError('character "u" expected', this.stream.getPos());
469 }
470 this.stream.next();
471
472 let code = '';
473 for (let i = 0; i < 4; i++) {
474 if (this.stream.eof || !hexDigit.test(this.stream.char)) {
475 throw new AiScriptSyntaxError('hexadecimal digit expected', this.stream.getPos());
476 }
477 code += this.stream.char;
478 this.stream.next();
479 }
480
481 return `u${code}`;
482 }
483
484 private tryReadDigits(hasLeftSpacing: boolean): Token | undefined {
485 let wholeNumber = '';

Callers 1

Calls 2

getPosMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected