template-safe-parser.js 623 B

123456789101112131415161718192021
  1. 'use strict';
  2. const helper = require('./template-parser-helper');
  3. // eslint-disable-next-line node/no-unpublished-require
  4. const SafeParser = require('postcss-safe-parser/lib/safe-parser');
  5. const templateTokenize = require('./template-tokenize');
  6. class TemplateSafeParser extends SafeParser {
  7. createTokenizer() {
  8. this.tokenizer = templateTokenize(this.input, { ignoreErrors: true });
  9. }
  10. other() {
  11. const args = arguments;
  12. return helper.literal.apply(this, args) || super.other.apply(this, args);
  13. }
  14. freeSemicolon() {
  15. return helper.freeSemicolon.apply(this, arguments);
  16. }
  17. }
  18. module.exports = TemplateSafeParser;