Hash.js 469 B

1234567891011121314151617181920212223
  1. import { Hash } from '../../tokenizer/index.js';
  2. // '#' ident
  3. export const xxx = 'XXX';
  4. export const name = 'Hash';
  5. export const structure = {
  6. value: String
  7. };
  8. export function parse() {
  9. const start = this.tokenStart;
  10. this.eat(Hash);
  11. return {
  12. type: 'Hash',
  13. loc: this.getLocation(start, this.tokenStart),
  14. value: this.substrToCursor(start + 1)
  15. };
  16. }
  17. export function generate(node) {
  18. this.token(Hash, '#' + node.value);
  19. }