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

Method parseFlowValue

packages/effect/src/encoding/Yaml.ts:1283–1306  ·  view source on GitHub ↗
(text: string, parentIndent: number)

Source from the content-addressed store, hash-verified

1281 }
1282
1283 private parseFlowValue(text: string, parentIndent: number): unknown {
1284 return new FlowParser(
1285 text,
1286 this.anchors,
1287 this.merges,
1288 (quoted) => {
1289 const next = this.lineAt(this.index)
1290 if (next === undefined) return undefined
1291 if (quoted) {
1292 // Inside a quote, `#` and brackets are content: every non-blank line is indented past the parent.
1293 if (!isSeparationOnly(next.raw) && next.indent <= parentIndent) return undefined
1294 } else {
1295 // Continuation lines are more indented than the parent; a closing bracket may sit at its indentation.
1296 const content = !isSeparationOnly(next.text)
1297 if (content && next.indent < parentIndent) return undefined
1298 if (content && next.indent === parentIndent && !/^[\]}]/.test(next.text)) return undefined
1299 }
1300 this.index++
1301 return next.raw.slice(next.indent)
1302 },
1303 this.depth,
1304 this.lines[this.index - 1].comment
1305 ).parse()
1306 }
1307
1308 private parsePlainValue(value: string, parentIndent: number): unknown {
1309 const first = this.lines[this.index - 1]

Callers 1

parseValueMethod · 0.95

Calls 4

lineAtMethod · 0.95
isSeparationOnlyFunction · 0.85
sliceMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected