Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language BSL (1C:Enterprise) #2520

Merged
merged 14 commits into from
Aug 17, 2020
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@
"title": "Bro",
"owner": "wayward710"
},
"bsl": {
"title": "BSL (1C:Enterprise)",
"alias": "oscript",
"aliasTitles": {
"oscript": "OneScript"
},
"owner": "Diversus23"
},
"c": {
"title": "C",
"require": "clike",
Expand Down
71 changes: 71 additions & 0 deletions components/prism-bsl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// 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\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,
lookbehind: true
},
{
// EN
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
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
}
],
'number': {
pattern: /(^(?=\d)|[^\w\u0400-\u0484\u0487-\u052f\u1c80-\u1c88\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:\d+\.?\d*|\.\d+)(?:E[+-]?\d+)?/i,
lookbehind: true
},
'operator': [
/[<>+\-*/]=?|[%=]/,
// RU
{
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,
lookbehind: true
},
// EN
{
pattern: /\b(?:and|or|not)\b/i
}

],
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/,
'directive': [
// Теги препроцессора вида &Клиент, &Сервер, ...
// Preprocessor tags of the type &Client, &Server, ...
{
pattern: /^(\s*)&.*/m,
lookbehind: true,
alias: 'important'
},
// Инструкции препроцессора вида:
// #Если Сервер Тогда
// ...
// #КонецЕсли
// Preprocessor instructions of the form:
// #If Server Then
// ...
// #EndIf
{
pattern: /^\s*#.*/gm,
alias: 'important'
}
]
};

Prism.languages.oscript = Prism.languages['bsl'];
1 change: 1 addition & 0 deletions components/prism-bsl.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading