(raw: string, fail: (message: string) => never)
| 1140 | |
| 1141 | // The key's source text, from `raw` before the `:` separator. |
| 1142 | private parseBlockKey(raw: string, fail: (message: string) => never): string { |
| 1143 | const text = trimWhite(raw) |
| 1144 | if (isPropertyIndicatorCode(text.charCodeAt(0))) fail(keyPropertyError) |
| 1145 | if (text.startsWith("%")) fail(directiveIndicatorError) |
| 1146 | // YAML 1.2.2 §7.3.3: `?` directly before the `:` separator starts a plain key. `raw` ends at |
| 1147 | // the separator, so it ends with `?` only then. |
| 1148 | if (isExplicitKey(text) && !(text === "?" && raw.endsWith("?"))) fail(explicitKeyError) |
| 1149 | // YAML 1.2.2 §7.3: a quoted key ends at its closing quote, and only white space may follow it. |
| 1150 | const quote = text[0] |
| 1151 | if ((quote === "\"" || quote === "'") && closingQuote(text, quote, 1) !== text.length - 1) { |
| 1152 | fail("Unexpected content after quoted YAML key") |
| 1153 | } |
| 1154 | return text |
| 1155 | } |
| 1156 | |
| 1157 | // `first` is the entry of a compact nested sequence (`- - item`), which starts on its parent entry's line. |
| 1158 | private parseSequence( |
no test coverage detected