MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / match

Function match

src/common/parser.ts:88–98  ·  view source on GitHub ↗
(pattern: string)

Source from the content-addressed store, hash-verified

86
87 // @todo: atString()?, or just at()?
88 match(pattern: string): boolean {
89 const start = this.pos;
90 for (const char of pattern) {
91 if (this.peek() !== char) {
92 this.pos = start; // Reset position if match fails
93 return false;
94 }
95 this.consume(); // Consume the character
96 }
97 return true;
98 }
99
100 skipWhitespace(): void {
101 while (!this.atEnd && /\s/.test(this.peek()!)) this.pos += 1;

Callers

nothing calls this directly

Calls 2

consumeMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected