SelectorList.js 825 B

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