ClassSelector.cjs 619 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const types = require('../../tokenizer/types.cjs');
  3. const FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  4. // '.' ident
  5. const name = 'ClassSelector';
  6. const structure = {
  7. name: String
  8. };
  9. function parse() {
  10. this.eatDelim(FULLSTOP);
  11. return {
  12. type: 'ClassSelector',
  13. loc: this.getLocation(this.tokenStart - 1, this.tokenEnd),
  14. name: this.consume(types.Ident)
  15. };
  16. }
  17. function generate(node) {
  18. this.token(types.Delim, '.');
  19. this.token(types.Ident, node.name);
  20. }
  21. exports.generate = generate;
  22. exports.name = name;
  23. exports.parse = parse;
  24. exports.structure = structure;