SelectorList.cjs 810 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. const types = require('../../tokenizer/types.cjs');
  3. const name = 'SelectorList';
  4. const walkContext = 'selector';
  5. const structure = {
  6. children: [[
  7. 'Selector',
  8. 'Raw'
  9. ]]
  10. };
  11. function parse() {
  12. const children = this.createList();
  13. while (!this.eof) {
  14. children.push(this.Selector());
  15. if (this.tokenType === types.Comma) {
  16. this.next();
  17. continue;
  18. }
  19. break;
  20. }
  21. return {
  22. type: 'SelectorList',
  23. loc: this.getLocationFromList(children),
  24. children
  25. };
  26. }
  27. function generate(node) {
  28. this.children(node, () => this.token(types.Comma, ','));
  29. }
  30. exports.generate = generate;
  31. exports.name = name;
  32. exports.parse = parse;
  33. exports.structure = structure;
  34. exports.walkContext = walkContext;