Skip to content

Commit 5c33f0b

Browse files
authored
Added support for BSL (1C:Enterprise) (#2520)
1 parent 004eaa7 commit 5c33f0b

14 files changed

+565
-3
lines changed

components.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

+8
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@
203203
"title": "Bro",
204204
"owner": "wayward710"
205205
},
206+
"bsl": {
207+
"title": "BSL (1C:Enterprise)",
208+
"alias": "oscript",
209+
"aliasTitles": {
210+
"oscript": "OneScript"
211+
},
212+
"owner": "Diversus23"
213+
},
206214
"c": {
207215
"title": "C",
208216
"require": "clike",

components/prism-bsl.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// 1C:Enterprise
2+
// https://github.com/Diversus23/
3+
//
4+
Prism.languages.bsl = {
5+
'comment': /\/\/.*/,
6+
'string': [
7+
// Строки
8+
// Strings
9+
{
10+
pattern: /"(?:[^"]|"")*"(?!")/,
11+
greedy: true
12+
},
13+
// Дата и время
14+
// Date & time
15+
{
16+
pattern: /'(?:[^'\r\n\\]|\\.)*'/
17+
}
18+
],
19+
'keyword': [
20+
{
21+
// RU
22+
pattern: /(^|[^\w\u0400-\u0484\u0487-\u052f\u1c80-\u1c88\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:пока|для|новый|прервать|попытка|исключение|вызватьисключение|иначе|конецпопытки|неопределено|функция|перем|возврат|конецфункции|если|иначеесли|процедура|конецпроцедуры|тогда|знач|экспорт|конецесли|из|каждого|истина|ложь|по|цикл|конеццикла|выполнить)(?![\w\u0400-\u0484\u0487-\u052f\u1c80-\u1c88\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])/i,
23+
lookbehind: true
24+
},
25+
{
26+
// EN
27+
pattern: /\b(?:while|for|new|break|try|except|raise|else|endtry|undefined|function|var|return|endfunction|null|if|elseif|procedure|endprocedure|then|val|export|endif|in|each|true|false|to|do|enddo|execute)\b/i
28+
}
29+
],
30+
'number': {
31+
pattern: /(^(?=\d)|[^\w\u0400-\u0484\u0487-\u052f\u1c80-\u1c88\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:\d+\.?\d*|\.\d+)(?:E[+-]?\d+)?/i,
32+
lookbehind: true
33+
},
34+
'operator': [
35+
/[<>+\-*/]=?|[%=]/,
36+
// RU
37+
{
38+
pattern: /(^|[^\w\u0400-\u0484\u0487-\u052f\u1c80-\u1c88\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:и|или|не)(?![\w\u0400-\u0484\u0487-\u052f\u1c80-\u1c88\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])/i,
39+
lookbehind: true
40+
},
41+
// EN
42+
{
43+
pattern: /\b(?:and|or|not)\b/i
44+
}
45+
46+
],
47+
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/,
48+
'directive': [
49+
// Теги препроцессора вида &Клиент, &Сервер, ...
50+
// Preprocessor tags of the type &Client, &Server, ...
51+
{
52+
pattern: /^(\s*)&.*/m,
53+
lookbehind: true,
54+
alias: 'important'
55+
},
56+
// Инструкции препроцессора вида:
57+
// #Если Сервер Тогда
58+
// ...
59+
// #КонецЕсли
60+
// Preprocessor instructions of the form:
61+
// #If Server Then
62+
// ...
63+
// #EndIf
64+
{
65+
pattern: /^\s*#.*/gm,
66+
alias: 'important'
67+
}
68+
]
69+
};
70+
71+
Prism.languages.oscript = Prism.languages['bsl'];

components/prism-bsl.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)