| 407 | } |
| 408 | |
| 409 | function* RuleParser() { |
| 410 | const declarations: Array<Declaraction> = []; |
| 411 | |
| 412 | const [selector]: [string] = yield /^(:root|[*]|[a-z][\w]*)/; |
| 413 | |
| 414 | yield whitespaceMay; |
| 415 | yield '{'; |
| 416 | yield whitespaceMay; |
| 417 | while ((yield has('}')) === false) { |
| 418 | yield whitespaceMay; |
| 419 | declarations.push(yield DeclarationParser); |
| 420 | yield whitespaceMay; |
| 421 | } |
| 422 | |
| 423 | return { selectors: [selector], declarations } as Rule; |
| 424 | } |
| 425 | |
| 426 | function* RulesParser(): ParseGenerator<Array<Rule>> { |
| 427 | const rules: Array<Rule> = []; |