prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
75 lines (74 loc) • 2.12 kB
JavaScript
import { r as rest, l as languages, a as tokenize } from "../../index-DF54SWhA.js";
import { e as clikePunctuation, b as boolean } from "../../patterns-Jkz_nwNQ.js";
import { n as nested, r as re } from "../../shared-Sq5P6lf6.js";
import { e as embeddedIn } from "../../templating-BdWShxVo.js";
import "./markup.js";
var FTL_EXPR = [nested(`[^<()"']|\\((?:<self>)*\\)|<(?!#--)|<#--(?:[^-]|-(?!->))*-->|"(?:\\\\.|[^\\\\"])*"|'(?:\\\\.|[^\\\\'])*'`, 2)];
var interpolationInside = {
"interpolation-punctuation": {
pattern: /^..|\}$/g,
alias: "punctuation"
}
};
var ftl = interpolationInside[rest] = {
"comment": /<#--[^]*?-->/,
"string": [
// raw string
/\br(["'])(?:\\.|(?!\1)[^\\])*\1/g,
{
pattern: re(`(["'])(?:\\\\.|(?!\\1|\\$\\{)[^\\\\]|\\$\\{(?:(?!\\})<0>)*\\})*\\1`, FTL_EXPR, "g"),
inside: {
"interpolation": {
pattern: re("((?:^|[^\\\\])(?:\\\\\\\\)*)\\$\\{(?:(?!\\})<0>)*\\}", FTL_EXPR),
lookbehind: true,
inside: interpolationInside
}
}
}
],
"keyword": /\b(?:as)\b/,
"boolean": boolean,
"builtin-function": {
pattern: /((?:^|[^?])\?\s*)\w+/,
lookbehind: true,
alias: "function"
},
"function": /\b\w+(?=\s*\()/,
"number": /\b\d+(?:\.\d+)?\b/,
"operator": /\.\.[<*!]?|->|--|\+\+|&&|\|\||\?\??|[%!=<>/*+-]=?|\b[gl]te?\b/,
"punctuation": clikePunctuation
};
languages.ftl = {
"ftl-comment": {
pattern: /<#--[^]*?-->/g,
alias: "comment"
},
"ftl-directive": {
pattern: re("</?[#@][a-zA-Z]<0>*?>", FTL_EXPR, "gi"),
inside: {
"punctuation": /^<\/?|\/?>$/,
"directive": {
pattern: /^[#@][a-z]\w*/i,
alias: "keyword"
},
"ftl": {
pattern: /\s*\S[^]*/,
alias: "language-ftl",
inside: ftl
}
}
},
"ftl-interpolation": {
pattern: re("\\$\\{<0>*?\\}", FTL_EXPR, "gi"),
inside: {
"punctuation": /^..|\}$/g,
"ftl": {
pattern: /\s*\S[^]*/,
alias: "language-ftl",
inside: ftl
}
}
},
[tokenize]: embeddedIn("html")
};
//# sourceMappingURL=ftl.js.map