prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
60 lines (59 loc) • 1.6 kB
JavaScript
import { l as languages } from "../../index-DF54SWhA.js";
import { b as boolean } from "../../patterns-Jkz_nwNQ.js";
var content = {
pattern: /[^]+/
};
var interpolation = "\\\\\\((?:[^()]|\\([^)]*\\))*\\)";
var string = '(^|[^\\\\])"(?:[^\\\\\n"]|\\\\[^\n(]|__)*"'.replace(/__/g, interpolation);
var stringInterpolation = {
"interpolation": {
pattern: RegExp("((?:^|[^\\\\])(?:\\\\\\\\)*)" + interpolation),
lookbehind: true,
inside: {
"punctuation": /^..|\)$/g,
"content": content
}
}
};
content.inside = languages.jq = {
"comment": /#.*/,
"property": {
pattern: RegExp(string + "(?=\\s*:(?!:))", "g"),
lookbehind: true,
inside: stringInterpolation
},
"string": {
pattern: RegExp(string, "g"),
lookbehind: true,
inside: stringInterpolation
},
"function": {
pattern: /(\bdef\s+)[a-z_]\w+/i,
lookbehind: true
},
"variable": /\B\$\w+/,
"property-literal": {
pattern: /\b[a-z_]\w*(?=\s*:(?!:))/i,
alias: "property"
},
"keyword": /\b(?:as|break|catch|def|elif|else|end|foreach|if|import|include|label|module|modulemeta|null|reduce|then|try|while)\b/,
"boolean": boolean,
"number": /(?:\b\d+\.|\B\.)?\b\d+(?:[eE][+-]?\d+)?\b/,
"operator": [
{
pattern: /\|=?/,
alias: "pipe"
},
/\.\.|!=|\?\/\/|\/\/=?|[%=<>/*+-]=?|\?|\b(?:and|not|or)\b/
],
"c-style-function": {
pattern: /\b[a-z_]\w*(?=\s*\()/i,
alias: "function"
},
"punctuation": /::|[()[\]{},:;]|\.(?=\s*[\[$\w])/,
"dot": {
pattern: /\./,
alias: "important"
}
};
//# sourceMappingURL=jq.js.map