ClassSelector.js 514 B

123456789101112131415161718192021222324
  1. import { Delim, Ident } from '../../tokenizer/index.js';
  2. const FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  3. // '.' ident
  4. export const name = 'ClassSelector';
  5. export const structure = {
  6. name: String
  7. };
  8. export function parse() {
  9. this.eatDelim(FULLSTOP);
  10. return {
  11. type: 'ClassSelector',
  12. loc: this.getLocation(this.tokenStart - 1, this.tokenEnd),
  13. name: this.consume(Ident)
  14. };
  15. }
  16. export function generate(node) {
  17. this.token(Delim, '.');
  18. this.token(Ident, node.name);
  19. }