diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
| commit | a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch) | |
| tree | 542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-cfscript.js | |
| parent | ab355897a12b7bda1089a44de326d41455a0f7a3 (diff) | |
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-cfscript.js')
| -rw-r--r-- | public/prism/prism-cfscript.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/public/prism/prism-cfscript.js b/public/prism/prism-cfscript.js new file mode 100644 index 0000000..da83537 --- /dev/null +++ b/public/prism/prism-cfscript.js @@ -0,0 +1,48 @@ +// https://cfdocs.org/script +Prism.languages.cfscript = Prism.languages.extend('clike', { + comment: [ + { + pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, + lookbehind: true, + inside: { + annotation: { + pattern: /(?:^|[^.])@[\w\.]+/, + alias: 'punctuation', + }, + }, + }, + { + pattern: /(^|[^\\:])\/\/.*/, + lookbehind: true, + greedy: true, + }, + ], + keyword: + /\b(?:abstract|break|catch|component|continue|default|do|else|extends|final|finally|for|function|if|in|include|package|private|property|public|remote|required|rethrow|return|static|switch|throw|try|var|while|xml)\b(?!\s*=)/, + operator: [ + /\+\+|--|&&|\|\||::|=>|[!=]==|<=?|>=?|[-+*/%&|^!=<>]=?|\?(?:\.|:)?|[?:]/, + /\b(?:and|contains|eq|equal|eqv|gt|gte|imp|is|lt|lte|mod|not|or|xor)\b/, + ], + scope: { + pattern: + /\b(?:application|arguments|cgi|client|cookie|local|session|super|this|variables)\b/, + alias: 'global', + }, + type: { + pattern: + /\b(?:any|array|binary|boolean|date|guid|numeric|query|string|struct|uuid|void|xml)\b/, + alias: 'builtin', + }, +}); + +Prism.languages.insertBefore('cfscript', 'keyword', { + // This must be declared before keyword because we use "function" inside the lookahead + 'function-variable': { + pattern: + /[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/, + alias: 'function', + }, +}); + +delete Prism.languages.cfscript['class-name']; +Prism.languages.cfc = Prism.languages['cfscript']; |
