(second, rule, source)
| 771 | * @returns {{ request: string } | { errorPos: number }} the unquoted request, or the position for the parse warning |
| 772 | */ |
| 773 | const parseIcssImportRequest = (second, rule, source) => { |
| 774 | /** @type {AstNode[] | undefined} */ |
| 775 | let args; |
| 776 | if (A.type(second) === NodeType.Function) { |
| 777 | args = A.children(second); |
| 778 | } else { |
| 779 | for (const p of A.prelude(rule)) { |
| 780 | if (A.type(p) === NodeType.SimpleBlock && A.blockToken(p) === "(") { |
| 781 | args = A.children(p); |
| 782 | break; |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | // The first non-whitespace value inside `(...)` must be a string. |
| 787 | const innerStrToken = |
| 788 | args && args.find((v) => A.type(v) !== NodeType.Whitespace); |
| 789 | if (!innerStrToken || A.type(innerStrToken) !== NodeType.String) { |
| 790 | const errorPos = |
| 791 | A.type(second) === NodeType.Function |
| 792 | ? A.nameEnd(second) + 1 |
| 793 | : A.end(second); |
| 794 | return { errorPos }; |
| 795 | } |
| 796 | return { |
| 797 | request: source.slice(A.start(innerStrToken) + 1, A.end(innerStrToken) - 1) |
| 798 | }; |
| 799 | }; |
| 800 | |
| 801 | class CssParser extends Parser { |
| 802 | /** |
no test coverage detected