MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseUntilCharCode

Method parseUntilCharCode

compiler/companion/src/utils/TextParser.ts:45–62  ·  view source on GitHub ↗
(charCode: number)

Source from the content-addressed store, hash-verified

43 }
44
45 parseUntilCharCode(charCode: number): string {
46 let startPosition = this.position;
47 let endPosition = startPosition;
48 let foundCharCode = false;
49
50 while (endPosition < this.text.length) {
51 const code = this.text.charCodeAt(endPosition);
52 endPosition++;
53 if (code === charCode) {
54 foundCharCode = true;
55 break;
56 }
57 }
58
59 this.position = endPosition;
60
61 return this.text.substring(startPosition, foundCharCode ? endPosition - 1 : endPosition);
62 }
63
64 peek(term: string): boolean {
65 this.consumeWhitespaces();

Callers 2

parseQuotedStringMethod · 0.95
parseImportFunction · 0.80

Calls 1

substringMethod · 0.80

Tested by

no test coverage detected