(entry: string, separator: number, indent: number, line: Line)
| 1178 | // `entry` starts with the `-` indicator, which sits at column `indent` of `line`, and |
| 1179 | // `separator` is `mappingSeparator(entry)`. |
| 1180 | private parseSequenceEntry(entry: string, separator: number, indent: number, line: Line): unknown { |
| 1181 | const item = trimWhiteStart(entry.slice(1)) |
| 1182 | if (isExplicitKey(item)) this.fail(line, explicitKeyError) |
| 1183 | // A compact nested sequence or mapping is indented to its first character, |
| 1184 | // which may sit more than one space after the dash. |
| 1185 | const offset = entry.length - item.length |
| 1186 | // Removing the dash and separation shifts the separator without changing its meaning. |
| 1187 | const itemSeparator = separator === -1 ? -1 : separator - offset |
| 1188 | const nested = isSequenceEntry(item) |
| 1189 | if (!nested && itemSeparator === -1) { |
| 1190 | return item.length === 0 ? this.parseBlockValue(indent, false) : this.parseNodeValue(item, indent) |
| 1191 | } |
| 1192 | if (entry.slice(1, offset).includes("\t")) this.fail(line, "Tabs cannot be used for YAML indentation") |
| 1193 | return nested |
| 1194 | ? this.parseSequence(indent + offset, { text: item, separator: itemSeparator, line }) |
| 1195 | : this.parseMapping(indent + offset, { text: item, separator: itemSeparator, line }) |
| 1196 | } |
| 1197 | |
| 1198 | private enterCollection(): void { |
| 1199 | if (++this.depth > maxDepth) throw new SyntaxError(depthError) |
no test coverage detected