LayerName.cjs 660 B

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