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

Method parseMapping

packages/effect/src/encoding/Yaml.ts:1101–1121  ·  view source on GitHub ↗
(
    indent: number,
    first?: { readonly text: string; readonly separator: number; readonly line: Line }
  )

Source from the content-addressed store, hash-verified

1099
1100 // `first` is the entry on a sequence item's line, parsed once the mapping counts toward the depth.
1101 private parseMapping(
1102 indent: number,
1103 first?: { readonly text: string; readonly separator: number; readonly line: Line }
1104 ): YamlRecord {
1105 this.enterCollection()
1106 const mapping = new MappingBuilder(this.merges)
1107 if (first !== undefined) this.parseMappingEntry(mapping, first.text, first.separator, indent, first.line)
1108 while (true) {
1109 this.skipIgnored()
1110 const line = this.lineAt(this.index)
1111 if (line === undefined || line.indent < indent) break
1112 if (line.indent > indent) this.fail(line, `Unexpected indentation of ${line.indent} spaces`)
1113 if (isExplicitKey(line.text)) this.fail(line, explicitKeyError)
1114 const separator = line.separator
1115 if (separator === -1) break
1116 this.index++
1117 this.parseMappingEntry(mapping, line.text, separator, indent, line)
1118 }
1119 this.depth--
1120 return mapping.output
1121 }
1122
1123 private parseMappingEntry(
1124 mapping: MappingBuilder,

Callers 2

parseNodeMethod · 0.95
parseSequenceEntryMethod · 0.95

Calls 6

enterCollectionMethod · 0.95
parseMappingEntryMethod · 0.95
skipIgnoredMethod · 0.95
lineAtMethod · 0.95
failMethod · 0.95
isExplicitKeyFunction · 0.85

Tested by

no test coverage detected