(start: Line)
| 1061 | } |
| 1062 | |
| 1063 | private parseDocumentContent(start: Line): unknown { |
| 1064 | if (isDocumentStart(start)) { |
| 1065 | // Strip the comment after the marker, so quotes and flow openers are read as token starts. |
| 1066 | const rest = start.raw.slice(3).replace(/^[ \t]+/, "") |
| 1067 | const comment = findIndicator(rest, "#") |
| 1068 | const content = comment === -1 ? rest : trimWhiteEnd(rest.slice(0, comment)) |
| 1069 | if (content.length > 0) { |
| 1070 | // Plain and flow scalars end at a comment flagged on their line. The marker hid |
| 1071 | // quotes from the scan that set the flag, so take it from this scan of the content. |
| 1072 | this.lines[this.index - 1] = { ...start, comment: comment !== -1 } |
| 1073 | // Block collections start on the line after the marker. |
| 1074 | if (isSequenceEntry(content) || mappingSeparator(content) !== -1) { |
| 1075 | this.fail(start, "Block collections cannot start on the document start line") |
| 1076 | } |
| 1077 | return this.parseNodeValue(content, -1) |
| 1078 | } |
| 1079 | } |
| 1080 | this.skipIgnored() |
| 1081 | const line = this.lineAt(this.index) |
| 1082 | if (line === undefined) return null |
| 1083 | return this.parseNode(line.indent) |
| 1084 | } |
| 1085 | |
| 1086 | // `allowIndentless` is set for a mapping value, whose block sequence may sit at the mapping's |
| 1087 | // indentation (YAML 1.2.2 §8.2.1), also after node properties on their own lines. |
no test coverage detected