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.

29 lines
673 B

4 years ago
  1. var TYPE = require('../../tokenizer').TYPE;
  2. var IDENT = TYPE.Ident;
  3. var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  4. // '.' ident
  5. module.exports = {
  6. name: 'ClassSelector',
  7. structure: {
  8. name: String
  9. },
  10. parse: function() {
  11. if (!this.scanner.isDelim(FULLSTOP)) {
  12. this.error('Full stop is expected');
  13. }
  14. this.scanner.next();
  15. return {
  16. type: 'ClassSelector',
  17. loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
  18. name: this.consume(IDENT)
  19. };
  20. },
  21. generate: function(node) {
  22. this.chunk('.');
  23. this.chunk(node.name);
  24. }
  25. };