(text: string, fail: (message: string) => never)
| 273 | |
| 274 | // The tag token at the start of `text`, which must be a core tag. |
| 275 | const readTag = (text: string, fail: (message: string) => never): string => { |
| 276 | // A verbatim tag (`!<...>`) may contain `,`, so it is read whole. |
| 277 | const tag = /^!(?:<[^>]*>?|[^ \t\n,[\]{}]*)/.exec(text)![0] |
| 278 | if (!coreTags.has(tag)) { |
| 279 | fail(`Unsupported YAML tag '${tag}', only the core tags ${[...coreTags].join(", ")} are supported`) |
| 280 | } |
| 281 | return tag |
| 282 | } |
| 283 | |
| 284 | // YAML 1.2.2 §10.3: the core schema's scalar spellings, matched against source text. |
| 285 | // Shared by tag resolution and by the printer, which quotes any string spelled this way. |
no test coverage detected