prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
65 lines (64 loc) • 2 kB
JavaScript
import { l as languages } from "../../index-C1_GGQ8y.js";
import { d as clikePunctuation, b as boolean, a as clikeComment } from "../../patterns-Cp3h1ylA.js";
languages.chaiscript = {
"comment": clikeComment(),
"string-interpolation": {
pattern: /(^|[^\\])"(?:\\[^]|[^\\$"]|\$(?!\{)|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\})*"/g,
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\\\)*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}/,
lookbehind: true,
inside: {
"interpolation-expression": {
pattern: /(..)[^]+(?=.)/,
lookbehind: true,
inside: "chaiscript"
},
"interpolation-punctuation": {
pattern: /.+/,
alias: "punctuation"
}
}
},
"string": /[^]+/
}
},
"string": {
pattern: /(^|[^\\])'(?:\\[^]|[^\\'])*'/g,
lookbehind: true,
greedy: true
},
"class-name": [
{
// e.g. class Rectangle { ... }
pattern: /(\bclass\s+)\w+/,
lookbehind: true
},
{
// e.g. attr Rectangle::height, def Rectangle::area() { ... }
pattern: /(\b(?:attr|def)\s+)\w+(?=\s*::)/,
lookbehind: true
}
],
"keyword": /\b(?:attr|auto|break|case|catch|class|continue|def|default|else|finally|for|fun|global|if|return|switch|this|try|var|while)\b/,
"boolean": boolean,
"function": /\b\w+(?=\()/,
"number": [
{
pattern: /(?:\b0b[01']+|\b0x(?:[a-f\d']+(?:\.[a-f\d']*)?|\.[a-f\d']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/gi,
greedy: true
},
/\b(?:Infinity|NaN)\b/
],
"parameter-type": {
// e.g. def foo(int x, Vector y) {...}
pattern: /([,(]\s*)\w+(?=\s+\w)/,
lookbehind: true,
alias: "class-name"
},
"operator": /:[:=]|--|\+\+|&&|\|\||>>=?|<<=?|[%&|^!=<>/*+-]=?|[?:~]|`[^\n`]{1,4}`/,
"punctuation": clikePunctuation
};
//# sourceMappingURL=chaiscript.js.map