MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseKeyPath

Method parseKeyPath

packages/effect/src/encoding/Toml.ts:188–219  ·  view source on GitHub ↗
(stop: "=" | "]")

Source from the content-addressed store, hash-verified

186 }
187
188 private parseKeyPath(stop: "=" | "]"): Array<string> {
189 const keys: Array<string> = []
190 while (true) {
191 this.skipInlineWhitespace()
192 const character = this.peek()
193 let key: string
194 if (character === "\"") {
195 key = this.parseBasicString(false)
196 } else if (character === "'") {
197 key = this.parseLiteralString(false)
198 } else {
199 const start = this.index
200 while (/[A-Za-z0-9_-]/.test(this.peek())) {
201 this.advance()
202 }
203 key = this.input.slice(start, this.index)
204 if (key.length === 0) {
205 this.fail("Expected a key")
206 }
207 }
208 keys.push(key)
209 this.skipInlineWhitespace()
210 if (this.peek() === ".") {
211 this.advance()
212 continue
213 }
214 if (this.peek() !== stop) {
215 this.fail(`Expected '${stop}'`)
216 }
217 return keys
218 }
219 }
220
221 private parseValue(): unknown {
222 const character = this.peek()

Callers 3

parseMethod · 0.95
parseHeaderMethod · 0.95
parseInlineTableMethod · 0.95

Calls 8

skipInlineWhitespaceMethod · 0.95
peekMethod · 0.95
parseBasicStringMethod · 0.95
parseLiteralStringMethod · 0.95
advanceMethod · 0.95
failMethod · 0.95
sliceMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected