Layer.cjs 687 B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. const types = require('../../tokenizer/types.cjs');
  3. const FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  4. const name = 'Layer';
  5. const structure = {
  6. name: String
  7. };
  8. function parse() {
  9. let tokenStart = this.tokenStart;
  10. let name = this.consume(types.Ident);
  11. while (this.isDelim(FULLSTOP)) {
  12. this.eat(types.Delim);
  13. name += '.' + this.consume(types.Ident);
  14. }
  15. return {
  16. type: 'Layer',
  17. loc: this.getLocation(tokenStart, this.tokenStart),
  18. name
  19. };
  20. }
  21. function generate(node) {
  22. this.tokenize(node.name);
  23. }
  24. exports.generate = generate;
  25. exports.name = name;
  26. exports.parse = parse;
  27. exports.structure = structure;