MCPcopy Create free account
hub / github.com/angular/angular / scanString

Method scanString

packages/compiler/src/expression_parser/lexer.ts:506–534  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

504 }
505
506 private scanString(): Token {
507 const start = this.index;
508 const quote = this.peek;
509 this.advance(); // Skip initial quote.
510
511 let buffer = '';
512 let marker = this.index;
513 const input = this.input;
514
515 while (this.peek != quote) {
516 if (this.peek == chars.$BACKSLASH) {
517 const result = this.scanStringBackslash(buffer, marker);
518 if (typeof result !== 'string') {
519 return result; // Error
520 }
521 buffer = result;
522 marker = this.index;
523 } else if (this.peek == chars.$EOF) {
524 return this.error('Unterminated quote', 0);
525 } else {
526 this.advance();
527 }
528 }
529
530 const last: string = input.substring(marker, this.index);
531 this.advance(); // Skip terminating quote.
532
533 return new StringToken(start, this.index, buffer + last, StringTokenKind.Plain);
534 }
535
536 private scanQuestion(start: number): Token {
537 this.advance();

Callers 1

scanTokenMethod · 0.95

Calls 3

advanceMethod · 0.95
scanStringBackslashMethod · 0.95
errorMethod · 0.95

Tested by

no test coverage detected