UNPKG

prism-code-editor

Version:

Lightweight, extensible code editor component for the web using Prism

76 lines (75 loc) 2.01 kB
import { a as languages } from "../../core-8vQkh0Rd.js"; import { n as extend, r as insertBefore } from "../../language-D-vtM55V.js"; import { t as boolean } from "../../patterns-C0vJBvXO.js"; import "./markup.js"; //#region src/prism/languages/parser.js var keyword = { pattern: /(^|[^^])(?:\^(?:case|eval|for|if|switch|throw)\b|@(?:BASE|CLASS|GET(?:_DEFAULT)?|OPTIONS|SET_DEFAULT|USE)\b)/, lookbehind: true }; var variable = { pattern: /(^|[^^])\B\$(?:\w+|(?=[.{]))(?:(?:\.|::?)\w+)*(?:\.|::?)?/, lookbehind: true, inside: { "punctuation": /\.|:+/ } }; var func = { pattern: /(^|[^^])\B[@^]\w+(?:(?:\.|::?)\w+)*(?:\.|::?)?/, lookbehind: true, inside: { "keyword": { pattern: /(^@)(?:GET_|SET_)/, lookbehind: true }, "punctuation": /\.|:+/ } }; var escape = { pattern: /\^(?:[$^;@()[\]{}"':]|#[a-f\d]*)/i, alias: "builtin" }; var punctuation = /[()[\]{};]/; var expression = { pattern: /(^|[^^])\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\)/g, lookbehind: true, inside: { "string": { pattern: /(^|[^^])(["'])(?:(?!\2)[^^]|\^[^])*\2/, lookbehind: true }, "keyword": keyword, "variable": variable, "function": func, "boolean": boolean, "number": /\b(?:0x[a-f\d]+|\d+(?:\.\d*)?(?:e[+-]?\d+)?)\b/i, "escape": escape, "operator": /[~/\\%*+]|!\|\|?|&&?|\|\|?|==|>>|<<|[!<>]=?|-[fd]?|\b(?:def|eq|[gl][et]|in|is|ne)\b/, "punctuation": punctuation } }; var parser = languages.parser = extend("html", { "parser-comment": { pattern: /(\s)#.*/, lookbehind: true, alias: "comment" }, "expression": expression, "keyword": keyword, "variable": variable, "function": func, "escape": escape, "punctuation": punctuation }); insertBefore(parser["tag"].inside["attr-value"][2].inside, "punctuation", { "expression": expression, "keyword": keyword, "variable": variable, "function": func, "escape": escape, "parser-punctuation": { pattern: punctuation, alias: "punctuation" } }); delete parser["markup-bracket"]; //#endregion //# sourceMappingURL=parser.js.map