(value: string, parentIndent: number)
| 1306 | } |
| 1307 | |
| 1308 | private parsePlainValue(value: string, parentIndent: number): unknown { |
| 1309 | const first = this.lines[this.index - 1] |
| 1310 | if (/:(?:[ \t]|$)/.test(value)) this.fail(first, "Invalid colon in plain scalar") |
| 1311 | if (value.startsWith("%")) this.fail(first, directiveIndicatorError) |
| 1312 | let output = value |
| 1313 | let terminated = first.comment |
| 1314 | while (!terminated) { |
| 1315 | const blankLines = this.skipBlankLines() |
| 1316 | const next = this.lineAt(this.index) |
| 1317 | if (next === undefined || next.indent <= parentIndent) break |
| 1318 | this.rejectTabIndent(next) |
| 1319 | // Quotes in plain continuations are literal. |
| 1320 | const content = next.raw.slice(next.indent) |
| 1321 | const comment = content.search(/(?:^|[ \t])#/) |
| 1322 | const text = trimWhiteEnd(comment === -1 ? content : content.slice(0, comment)) |
| 1323 | if (text.length === 0) break |
| 1324 | if (/:(?:[ \t]|$)/.test(text)) this.fail(next, "Invalid colon in plain scalar") |
| 1325 | this.rejectTabIndentedBlankLines(blankLines, parentIndent) |
| 1326 | output += foldLineBreak(blankLines) + text |
| 1327 | this.index++ |
| 1328 | terminated = comment !== -1 |
| 1329 | } |
| 1330 | this.plainText = output |
| 1331 | return parseScalar(output) |
| 1332 | } |
| 1333 | |
| 1334 | private parseQuotedValue(value: string, parentIndent: number): unknown { |
| 1335 | const quote = value[0] |
no test coverage detected