MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / scanUntil

Method scanUntil

Extension/src/Utility/Text/scanner.ts:790–820  ·  view source on GitHub ↗
(predicate: (char: number, charNext: number, charNextNext: number) => boolean, expectedClose?: string, consumeClose?: number)

Source from the content-addressed store, hash-verified

788 }
789
790 private scanUntil(predicate: (char: number, charNext: number, charNextNext: number) => boolean, expectedClose?: string, consumeClose?: number) {
791 const start = this.#offset;
792
793 do {
794 // advance the position
795 if (isLineBreak(this.#ch)) {
796 this.advance(this.#ch === CharacterCodes.carriageReturn && this.#chNext === CharacterCodes.lineFeed ? 2 : 1);
797 this.#line++;
798 this.#column = 0;
799 this.markPosition(); // make sure the map has the new location
800 } else {
801 this.#column += this.widthOfCh;
802 this.advance();
803 }
804
805 if (this.eof) {
806 this.assert(!expectedClose, `Unexpected end of file while searching for '${expectedClose}'`);
807 break;
808 }
809
810 } while (!predicate(this.#ch, this.#chNext, this.#chNextNext));
811
812 if (consumeClose) {
813 this.advance(consumeClose);
814 }
815
816 // and after...
817 this.markPosition();
818
819 return this.#text.substring(start, this.#offset);
820 }
821
822 private scanSingleLineComment() {
823 this.text = this.scanUntil(isLineBreak);

Callers 10

scanHexNumberMethod · 0.95
scanBinaryNumberMethod · 0.95
scanSingleLineCommentMethod · 0.95
scanHashCommentMethod · 0.95
scanMultiLineCommentMethod · 0.95
scanStringMethod · 0.95
scanCodeFenceMethod · 0.95
scanIdentifierMethod · 0.95
scanVariableMethod · 0.95

Calls 4

advanceMethod · 0.95
markPositionMethod · 0.95
assertMethod · 0.95
isLineBreakFunction · 0.90

Tested by

no test coverage detected