MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / isEscapedAt

Function isEscapedAt

packages/queryLanguage/src/tokens.ts:133–143  ·  view source on GitHub ↗

* Checks whether the character at the given offset is escaped by an odd number * of immediately preceding backslashes.

(input: InputStream, offset: number)

Source from the content-addressed store, hash-verified

131 * of immediately preceding backslashes.
132 */
133function isEscapedAt(input: InputStream, offset: number): boolean {
134 let backslashCount = 0;
135 let currentOffset = offset - 1;
136
137 while (input.peek(currentOffset) === 92 /* backslash */) {
138 backslashCount++;
139 currentOffset--;
140 }
141
142 return backslashCount % 2 === 1;
143}
144
145/**
146 * Returns the offset of the closing ')' that matches the '(' at startOffset.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected