"use strict";
const htmlparser = require("htmlparser2");
const buildSyntaxResolver = require("../syntax/build-syntax-resolver");
const buildTemplateSyntax = require("../template/syntax");
const SvelteTokenizer = require("./svelte-tokenizer");
function iterateCode(source, { onStyleTag, onStyleAttribute, svelte }) {
const openTag = {};
let disable, ignore, style;
const parser = new htmlparser.Parser(
{
oncomment: (data) => {
ignore = false;
const match = /(?:^|\s+)postcss-(\w+)(?:\s+|$)/i.exec(data);
if (!match) {
return;
}
const directive = match[1].toLowerCase();
if (directive === "enable") {
disable = false;
} else if (directive === "disable") {
disable = true;
} else if (directive === "ignore") {
ignore = true;
}
},
onopentag(name, attribute) {
openTag[name] = true;
const currIgnore = ignore;
ignore = false;
if (currIgnore) {
// ignore
return;
}
// Test if current tag is a valid