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

Method parseSequence

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

Source from the content-addressed store, hash-verified

1156
1157 // `first` is the entry of a compact nested sequence (`- - item`), which starts on its parent entry's line.
1158 private parseSequence(
1159 indent: number,
1160 first?: { readonly text: string; readonly separator: number; readonly line: Line }
1161 ): Array<unknown> {
1162 this.enterCollection()
1163 const output: Array<unknown> = []
1164 if (first !== undefined) output.push(this.parseSequenceEntry(first.text, first.separator, indent, first.line))
1165 while (true) {
1166 this.skipIgnored()
1167 const line = this.lineAt(this.index)
1168 if (line === undefined || line.indent < indent) break
1169 if (line.indent > indent) this.fail(line, `Unexpected indentation of ${line.indent} spaces`)
1170 if (!isSequenceEntry(line.text)) break
1171 this.index++
1172 output.push(this.parseSequenceEntry(line.text, line.separator, indent, line))
1173 }
1174 this.depth--
1175 return output
1176 }
1177
1178 // `entry` starts with the `-` indicator, which sits at column `indent` of `line`, and
1179 // `separator` is `mappingSeparator(entry)`.

Callers 3

parseNodeMethod · 0.95
parseSequenceEntryMethod · 0.95
parseBlockValueMethod · 0.95

Calls 7

enterCollectionMethod · 0.95
parseSequenceEntryMethod · 0.95
skipIgnoredMethod · 0.95
lineAtMethod · 0.95
failMethod · 0.95
isSequenceEntryFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected