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.

27 lines
595 B

4 years ago
  1. var TYPE = require('../../tokenizer').TYPE;
  2. var HASH = TYPE.Hash;
  3. // <hash-token>
  4. module.exports = {
  5. name: 'IdSelector',
  6. structure: {
  7. name: String
  8. },
  9. parse: function() {
  10. var start = this.scanner.tokenStart;
  11. // TODO: check value is an ident
  12. this.eat(HASH);
  13. return {
  14. type: 'IdSelector',
  15. loc: this.getLocation(start, this.scanner.tokenStart),
  16. name: this.scanner.substrToCursor(start + 1)
  17. };
  18. },
  19. generate: function(node) {
  20. this.chunk('#');
  21. this.chunk(node.name);
  22. }
  23. };