MCPcopy Create free account
hub / github.com/arktypeio/arktype / shiftControlEscape

Method shiftControlEscape

ark/util/scanner.ts:122–136  ·  view source on GitHub ↗

the control character escaped after a backslash, or the backslash as written

()

Source from the content-addressed store, hash-verified

120
121 /** the control character escaped after a backslash, or the backslash as written */
122 private shiftControlEscape(): string {
123 const peek = this.peek
124 if (peek in namedControlEscapes) {
125 this.shift()
126 return namedControlEscapes[peek as keyof NamedControlEscapes]
127 }
128 if (peek === "u") {
129 const code = this.chars.slice(this.i + 1, this.i + 5).join("")
130 if (code.toLowerCase() in controlEscapes) {
131 this.jumpForward(5)
132 return controlEscapes[code.toLowerCase() as keyof ControlEscapes]
133 }
134 }
135 return `${Backslash}${this.shift()}`
136 }
137
138 shiftUntilNext(charOrSet: string | KeySet): string {
139 return typeof charOrSet === "string" ?

Callers 1

shiftUntilEscapableMethod · 0.95

Calls 2

shiftMethod · 0.95
jumpForwardMethod · 0.95

Tested by

no test coverage detected