SelectorList.js 676 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { Comma } from '../../tokenizer/index.js';
  2. export const name = 'SelectorList';
  3. export const walkContext = 'selector';
  4. export const structure = {
  5. children: [[
  6. 'Selector',
  7. 'Raw'
  8. ]]
  9. };
  10. export function parse() {
  11. const children = this.createList();
  12. while (!this.eof) {
  13. children.push(this.Selector());
  14. if (this.tokenType === Comma) {
  15. this.next();
  16. continue;
  17. }
  18. break;
  19. }
  20. return {
  21. type: 'SelectorList',
  22. loc: this.getLocationFromList(children),
  23. children
  24. };
  25. }
  26. export function generate(node) {
  27. this.children(node, () => this.token(Comma, ','));
  28. }