Skip to content

Commit 5c412cb

Browse files
authoredOct 5, 2021
BSL: Made directive greedy (#3112)
1 parent d7017be commit 5c412cb

File tree

5 files changed

+45
-6
lines changed

5 files changed

+45
-6
lines changed
 

‎components/prism-bsl.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ Prism.languages.bsl = {
4444
{
4545
pattern: /\b(?:and|not|or)\b/i
4646
}
47-
4847
],
4948
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/,
5049
'directive': [
5150
// Теги препроцессора вида &Клиент, &Сервер, ...
5251
// Preprocessor tags of the type &Client, &Server, ...
5352
{
54-
pattern: /^(\s*)&.*/m,
53+
pattern: /^([ \t]*)&.*/m,
5554
lookbehind: true,
55+
greedy: true,
5656
alias: 'important'
5757
},
5858
// Инструкции препроцессора вида:
@@ -64,7 +64,9 @@ Prism.languages.bsl = {
6464
// ...
6565
// #EndIf
6666
{
67-
pattern: /^\s*#.*/gm,
67+
pattern: /^([ \t]*)#.*/gm,
68+
lookbehind: true,
69+
greedy: true,
6870
alias: 'important'
6971
}
7072
]

‎components/prism-bsl.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
&Client
2+
3+
#If Server Then
4+
#EndIf
5+
6+
----------------------------------------------------
7+
8+
[
9+
["directive", "&Client"],
10+
11+
["directive", "#If Server Then"],
12+
["directive", "#EndIf"]
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(. .)
2+
( ) [ ] : ; , .
3+
4+
----------------------------------------------------
5+
6+
[
7+
["punctuation", "(."],
8+
["punctuation", ".)"],
9+
10+
["punctuation", "("],
11+
["punctuation", ")"],
12+
["punctuation", "["],
13+
["punctuation", "]"],
14+
["punctuation", ":"],
15+
["punctuation", ";"],
16+
["punctuation", ","],
17+
["punctuation", "."]
18+
]
+8-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
""
22
"fo"
33

4+
''
5+
'foo'
6+
47
----------------------------------------------------
58

69
[
710
["string", "\"\""],
8-
["string", "\"fo\""]
11+
["string", "\"fo\""],
12+
13+
["string", "''"],
14+
["string", "'foo'"]
915
]
1016

1117
----------------------------------------------------
1218

13-
Checks for strings and chars.
19+
Checks for strings and chars.

0 commit comments

Comments
 (0)
Please sign in to comment.