UNPKG

edge-lexer

Version:

Edge parser to convert text markup to lexer tokens

39 lines (37 loc) 1.2 kB
import "../chunk-WLTPKIE5.js"; // src/utils.ts function isTag(token, name) { if (token.type === "tag" /* TAG */ || token.type === "e__tag" /* ETAG */) { return name ? token.properties.name === name : true; } return false; } function isEscapedTag(token, name) { if (token.type === "e__tag" /* ETAG */) { return name ? token.properties.name === name : true; } return false; } function isMustache(token) { return token.type === "e__mustache" /* EMUSTACHE */ || token.type === "es__mustache" /* ESMUSTACHE */ || token.type === "mustache" /* MUSTACHE */ || token.type === "s__mustache" /* SMUSTACHE */; } function isSafeMustache(token) { return token.type === "es__mustache" /* ESMUSTACHE */ || token.type === "s__mustache" /* SMUSTACHE */; } function isEscapedMustache(token) { return token.type === "e__mustache" /* EMUSTACHE */ || token.type === "es__mustache" /* ESMUSTACHE */; } function getLineAndColumn(token) { if (token.type === "newline" || token.type === "raw") { return [token.line, 0]; } return [token.loc.start.line, token.loc.start.col]; } export { getLineAndColumn, isEscapedMustache, isEscapedTag, isMustache, isSafeMustache, isTag };