Skip to content

Commit

Permalink
Added support for BSL (1C:Enterprise) (#2520)
Browse files Browse the repository at this point in the history
  • Loading branch information
Diversus23 authored Aug 17, 2020
1 parent 004eaa7 commit 5c33f0b
Show file tree
Hide file tree
Showing 14 changed files with 565 additions and 3 deletions.
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
}
],
'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

0 comments on commit 5c33f0b

Please sign in to comment.