WhiteSpace.js 543 B

123456789101112131415161718192021222324252627
  1. import { WhiteSpace } from '../../tokenizer/index.js';
  2. const SPACE = Object.freeze({
  3. type: 'WhiteSpace',
  4. loc: null,
  5. value: ' '
  6. });
  7. export const name = 'WhiteSpace';
  8. export const structure = {
  9. value: String
  10. };
  11. export function parse() {
  12. this.eat(WhiteSpace);
  13. return SPACE;
  14. // return {
  15. // type: 'WhiteSpace',
  16. // loc: this.getLocation(this.tokenStart, this.tokenEnd),
  17. // value: this.consume(WHITESPACE)
  18. // };
  19. }
  20. export function generate(node) {
  21. this.token(WhiteSpace, node.value);
  22. }