Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BSL: Made directive greedy (#3112)
  • Loading branch information
RunDevelopment committed Oct 5, 2021
1 parent d7017be commit 5c412cb
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
8 changes: 5 additions & 3 deletions components/prism-bsl.js
Expand Up @@ -44,15 +44,15 @@ Prism.languages.bsl = {
{
pattern: /\b(?:and|not|or)\b/i
}

],
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/,
'directive': [
// Теги препроцессора вида &Клиент, &Сервер, ...
// Preprocessor tags of the type &Client, &Server, ...
{
pattern: /^(\s*)&.*/m,
pattern: /^([ \t]*)&.*/m,
lookbehind: true,
greedy: true,
alias: 'important'
},
// Инструкции препроцессора вида:
Expand All @@ -64,7 +64,9 @@ Prism.languages.bsl = {
// ...
// #EndIf
{
pattern: /^\s*#.*/gm,
pattern: /^([ \t]*)#.*/gm,
lookbehind: true,
greedy: true,
alias: 'important'
}
]
Expand Down
2 changes: 1 addition & 1 deletion components/prism-bsl.min.js

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

13 changes: 13 additions & 0 deletions tests/languages/bsl/directive_feature.test
@@ -0,0 +1,13 @@
&Client

#If Server Then
#EndIf

----------------------------------------------------

[
["directive", "&Client"],

["directive", "#If Server Then"],
["directive", "#EndIf"]
]
18 changes: 18 additions & 0 deletions tests/languages/bsl/punctuation_feature.test
@@ -0,0 +1,18 @@
(. .)
( ) [ ] : ; , .

----------------------------------------------------

[
["punctuation", "(."],
["punctuation", ".)"],

["punctuation", "("],
["punctuation", ")"],
["punctuation", "["],
["punctuation", "]"],
["punctuation", ":"],
["punctuation", ";"],
["punctuation", ","],
["punctuation", "."]
]
10 changes: 8 additions & 2 deletions tests/languages/bsl/string_feature.test
@@ -1,13 +1,19 @@
""
"fo"

''
'foo'

----------------------------------------------------

[
["string", "\"\""],
["string", "\"fo\""]
["string", "\"fo\""],

["string", "''"],
["string", "'foo'"]
]

----------------------------------------------------

Checks for strings and chars.
Checks for strings and chars.

0 comments on commit 5c412cb

Please sign in to comment.