You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
790 B

4 years ago
  1. module.exports = {
  2. name: 'Selector',
  3. structure: {
  4. children: [[
  5. 'TypeSelector',
  6. 'IdSelector',
  7. 'ClassSelector',
  8. 'AttributeSelector',
  9. 'PseudoClassSelector',
  10. 'PseudoElementSelector',
  11. 'Combinator',
  12. 'WhiteSpace'
  13. ]]
  14. },
  15. parse: function() {
  16. var children = this.readSequence(this.scope.Selector);
  17. // nothing were consumed
  18. if (this.getFirstListNode(children) === null) {
  19. this.error('Selector is expected');
  20. }
  21. return {
  22. type: 'Selector',
  23. loc: this.getLocationFromList(children),
  24. children: children
  25. };
  26. },
  27. generate: function(node) {
  28. this.children(node);
  29. }
  30. };