SupportsDeclaration.cjs 776 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. const types = require('../../tokenizer/types.cjs');
  3. const name = 'SupportsDeclaration';
  4. const structure = {
  5. declaration: 'Declaration'
  6. };
  7. function parse() {
  8. const start = this.tokenStart;
  9. this.eat(types.LeftParenthesis);
  10. this.skipSC();
  11. const declaration = this.Declaration();
  12. if (!this.eof) {
  13. this.eat(types.RightParenthesis);
  14. }
  15. return {
  16. type: 'SupportsDeclaration',
  17. loc: this.getLocation(start, this.tokenStart),
  18. declaration
  19. };
  20. }
  21. function generate(node) {
  22. this.token(types.LeftParenthesis, '(');
  23. this.node(node.declaration);
  24. this.token(types.RightParenthesis, ')');
  25. }
  26. exports.generate = generate;
  27. exports.name = name;
  28. exports.parse = parse;
  29. exports.structure = structure;