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

Method parseKeyPath

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

Source from the content-addressed store, hash-verified

153 }
154
155 private parseKeyPath(stop: "=" | "]"): Array<string> {
156 const keys: Array<string> = []
157 while (true) {
158 this.skipInlineWhitespace()
159 const character = this.peek()
160 let key: string
161 if (character === "\"") {
162 key = this.parseBasicString(false)
163 } else if (character === "'") {
164 key = this.parseLiteralString(false)
165 } else {
166 const start = this.index
167 while (/[A-Za-z0-9_-]/.test(this.peek())) {
168 this.advance()
169 }
170 key = this.input.slice(start, this.index)
171 }
172 if (key.length === 0) {
173 this.fail("Expected a key")
174 }
175 keys.push(key)
176 this.skipInlineWhitespace()
177 if (this.peek() === ".") {
178 this.advance()
179 continue
180 }
181 if (this.peek() !== stop) {
182 this.fail(`Expected '${stop}'`)
183 }
184 return keys
185 }
186 }
187
188 private parseValue(): unknown {
189 const character = this.peek()

Callers 3

parseMethod · 0.95
parseHeaderMethod · 0.95
parseInlineTableMethod · 0.95

Calls 7

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

Tested by

no test coverage detected