prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
71 lines (70 loc) • 1.86 kB
JavaScript
import { l as t, i as n } from "../prismCore-5c7f03d0.js";
import "./markup.js";
var e = t.parser = t.extend("markup", {
keyword: {
pattern: /(^|[^^])(?:\^(?:case|eval|for|if|switch|throw)\b|@(?:BASE|CLASS|GET(?:_DEFAULT)?|OPTIONS|SET_DEFAULT|USE)\b)/,
lookbehind: !0
},
variable: {
pattern: /(^|[^^])\B\$(?:\w+|(?=[.{]))(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
lookbehind: !0,
inside: {
punctuation: /\.|:+/
}
},
function: {
pattern: /(^|[^^])\B[@^]\w+(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
lookbehind: !0,
inside: {
keyword: {
pattern: /(^@)(?:GET_|SET_)/,
lookbehind: !0
},
punctuation: /\.|:+/
}
},
escape: {
pattern: /\^(?:[$^;@()\[\]{}"':]|#[a-f\d]*)/i,
alias: "builtin"
},
punctuation: /[\[\](){};]/
});
n("parser", "keyword", {
"parser-comment": {
pattern: /(\s)#.*/,
lookbehind: !0,
alias: "comment"
},
expression: {
// Allow for 3 levels of depth
pattern: /(^|[^^])\((?:[^()]|\((?:[^()]|\((?:[^()])*\))*\))*\)/,
greedy: !0,
lookbehind: !0,
inside: {
string: {
pattern: /(^|[^^])(["'])(?:(?!\2)[^^]|\^[\s\S])*\2/,
lookbehind: !0
},
keyword: e.keyword,
variable: e.variable,
function: e.function,
boolean: /\b(?:false|true)\b/,
number: /\b(?:0x[a-f\d]+|\d+(?:\.\d*)?(?:e[+-]?\d+)?)\b/i,
escape: e.escape,
operator: /[~+*\/\\%]|!(?:\|\|?|=)?|&&?|\|\|?|==|<[<=]?|>[>=]?|-[fd]?|\b(?:def|eq|ge|gt|in|is|le|lt|ne)\b/,
punctuation: e.punctuation
}
}
});
n("inside", "punctuation", {
expression: e.expression,
keyword: e.keyword,
variable: e.variable,
function: e.function,
escape: e.escape,
"parser-punctuation": {
pattern: e.punctuation,
alias: "punctuation"
}
}, e.tag.inside["attr-value"]);
delete e["markup-bracket"];