(def: string)
| 599 | } |
| 600 | |
| 601 | const scanUncached = (def: string): Facts | undefined => { |
| 602 | const withDefault = defaulted.exec(def) |
| 603 | if (withDefault) { |
| 604 | const base = scanUnion(withDefault[1]) |
| 605 | const raw = withDefault[2] |
| 606 | const value = |
| 607 | raw[0] === "'" ? raw.slice(1, -1) |
| 608 | : raw === "true" ? true |
| 609 | : raw === "false" ? false |
| 610 | : +raw |
| 611 | if (typeof value === "number" && !writesAsParsed(raw)) return |
| 612 | if (!base || !fits(value, base)) return |
| 613 | return { |
| 614 | key: defaultKey(base, value), |
| 615 | domains: base.domains, |
| 616 | pure: false, |
| 617 | defaults: true |
| 618 | } |
| 619 | } |
| 620 | if (def === "string.trim") |
| 621 | return { key: def, domains: stringBits, pure: false } |
| 622 | if (def.startsWith("string.trim |> ")) { |
| 623 | const to = scanAnd(def.slice(15)) |
| 624 | return to?.domains === stringBits && !to.values ? |
| 625 | { key: `string.trim|>${to.key}`, domains: stringBits, pure: false } |
| 626 | : undefined |
| 627 | } |
| 628 | if (regexLiteral.test(def)) return regexLiteralFacts(def) |
| 629 | const record$ = record.exec(def) |
| 630 | if (record$) { |
| 631 | const value = scanUnion(record$[1]) |
| 632 | return value ? |
| 633 | { |
| 634 | key: `Record<${value.key}>`, |
| 635 | domains: objectBits, |
| 636 | pure: true, |
| 637 | ...holding(value) |
| 638 | } |
| 639 | : undefined |
| 640 | } |
| 641 | return scanAnd(def) |
| 642 | } |
| 643 | |
| 644 | // its length says where a name ends, whatever it holds, and a colon where its |
| 645 | // length does, since a name can start with a digit |
no test coverage detected