Hash.cjs 587 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. const types = require('../../tokenizer/types.cjs');
  3. // '#' ident
  4. const xxx = 'XXX';
  5. const name = 'Hash';
  6. const structure = {
  7. value: String
  8. };
  9. function parse() {
  10. const start = this.tokenStart;
  11. this.eat(types.Hash);
  12. return {
  13. type: 'Hash',
  14. loc: this.getLocation(start, this.tokenStart),
  15. value: this.substrToCursor(start + 1)
  16. };
  17. }
  18. function generate(node) {
  19. this.token(types.Hash, '#' + node.value);
  20. }
  21. exports.generate = generate;
  22. exports.name = name;
  23. exports.parse = parse;
  24. exports.structure = structure;
  25. exports.xxx = xxx;