aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-bsl.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-30 19:47:21 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-30 19:47:21 +0100
commita98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch)
tree542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-bsl.js
parentab355897a12b7bda1089a44de326d41455a0f7a3 (diff)
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-bsl.js')
-rw-r--r--public/prism/prism-bsl.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/public/prism/prism-bsl.js b/public/prism/prism-bsl.js
new file mode 100644
index 0000000..d7367fe
--- /dev/null
+++ b/public/prism/prism-bsl.js
@@ -0,0 +1,79 @@
+/* eslint-disable no-misleading-character-class */
+
+// 1C:Enterprise
+// https://github.com/Diversus23/
+//
+Prism.languages.bsl = {
+ comment: /\/\/.*/,
+ string: [
+ // Строки
+ // Strings
+ {
+ pattern: /"(?:[^"]|"")*"(?!")/,
+ greedy: true,
+ },
+ // Дата и время
+ // Date & time
+ {
+ pattern: /'(?:[^'\r\n\\]|\\.)*'/,
+ },
+ ],
+ keyword: [
+ {
+ // RU
+ pattern:
+ /(^|[^\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:пока|для|новый|прервать|попытка|исключение|вызватьисключение|иначе|конецпопытки|неопределено|функция|перем|возврат|конецфункции|если|иначеесли|процедура|конецпроцедуры|тогда|знач|экспорт|конецесли|из|каждого|истина|ложь|по|цикл|конеццикла|выполнить)(?![\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])/i,
+ lookbehind: true,
+ },
+ {
+ // EN
+ pattern:
+ /\b(?:break|do|each|else|elseif|enddo|endfunction|endif|endprocedure|endtry|except|execute|export|false|for|function|if|in|new|null|procedure|raise|return|then|to|true|try|undefined|val|var|while)\b/i,
+ },
+ ],
+ number: {
+ pattern:
+ /(^(?=\d)|[^\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?/i,
+ lookbehind: true,
+ },
+ operator: [
+ /[<>+\-*/]=?|[%=]/,
+ // RU
+ {
+ pattern:
+ /(^|[^\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:и|или|не)(?![\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])/i,
+ lookbehind: true,
+ },
+ // EN
+ {
+ pattern: /\b(?:and|not|or)\b/i,
+ },
+ ],
+ punctuation: /\(\.|\.\)|[()\[\]:;,.]/,
+ directive: [
+ // Теги препроцессора вида &Клиент, &Сервер, ...
+ // Preprocessor tags of the type &Client, &Server, ...
+ {
+ pattern: /^([ \t]*)&.*/m,
+ lookbehind: true,
+ greedy: true,
+ alias: 'important',
+ },
+ // Инструкции препроцессора вида:
+ // #Если Сервер Тогда
+ // ...
+ // #КонецЕсли
+ // Preprocessor instructions of the form:
+ // #If Server Then
+ // ...
+ // #EndIf
+ {
+ pattern: /^([ \t]*)#.*/gm,
+ lookbehind: true,
+ greedy: true,
+ alias: 'important',
+ },
+ ],
+};
+
+Prism.languages.oscript = Prism.languages['bsl'];