* Parse a quoted literal (single or double quoted). * @param validatePubid If true, validate as PubidLiteral per XML 1.0 §2.3
(validatePubid = false)
| 516 | * @param validatePubid If true, validate as PubidLiteral per XML 1.0 §2.3 |
| 517 | */ |
| 518 | function parseQuotedLiteral(validatePubid = false): void { |
| 519 | const quote = input.charCodeAt(pos); |
| 520 | if (quote !== CC_DQUOTE && quote !== CC_SQUOTE) { |
| 521 | error("Expected quoted string"); |
| 522 | } |
| 523 | const quoteChar = String.fromCharCode(quote); |
| 524 | pos++; |
| 525 | const valueStart = pos; |
| 526 | while (pos < len && input.charCodeAt(pos) !== quote) { |
| 527 | pos++; |
| 528 | } |
| 529 | if (pos >= len) { |
| 530 | error("Unterminated quoted string"); |
| 531 | } |
| 532 | if (validatePubid) { |
| 533 | const pubidError = validatePubidLiteral( |
| 534 | input.slice(valueStart, pos), |
| 535 | quoteChar, |
| 536 | ); |
| 537 | if (pubidError) error(pubidError); |
| 538 | } |
| 539 | pos++; |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * Parse DTD declaration content with whitespace validation. |
no test coverage detected