(
indent: number,
first?: { readonly text: string; readonly separator: number; readonly line: Line }
)
| 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)`. |
no test coverage detected