Skip to content

Commit dda24c0

Browse files
committed
Improve regex compatibility
1 parent 7c63562 commit dda24c0

5 files changed

+50
-51
lines changed

syntaxes/package-scopes.tmLanguage.json

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,38 @@
1212
],
1313
"repository": {
1414
"embeddedLanguages": {
15-
"match": "(?<=\")\\G(?>[^\\\\\"\\x-\\x1F]++|\\\\.)++",
16-
"captures": {
17-
"0": {
18-
"name": "meta.embedded.json.textmate.source",
15+
"begin": "(?<=\")\\G(?=(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++\")",
16+
"end": "(?=\"|$)",
17+
"name": "meta.embedded.json.textmate.source",
18+
"patterns": [
19+
{
20+
"begin": "(?>text|source|markdown)(?=\\.[\\w.:])",
21+
"end": "(?![\\w.:-])",
22+
"beginCaptures": { "0": { "name": "support.function.tm" } },
23+
"name": "string",
1924
"patterns": [
2025
{
21-
"begin": "(?>text|source|markdown)(?=\\.[\\w.:])",
22-
"end": "(?![\\w.:-])",
23-
"beginCaptures": { "0": { "name": "support.function.tm" } },
24-
"name": "string",
25-
"patterns": [
26-
{
27-
"match": "\\.",
28-
"name": "support.function.tm"
29-
}
30-
]
31-
},
32-
{
33-
"match": "[\\w.:][\\w.:-]*",
34-
"name": "string $0"
35-
},
36-
{
37-
"comment": "balancedBracketScopes ONLY",
38-
"match": "(?<=\")\\*(?!.)",
39-
"name": "keyword.control.any"
40-
},
41-
{
42-
"comment": "tokenTypes Type ONLY",
43-
"match": "(?<=\")other(?!.)",
44-
"name": "meta.embedded.other"
45-
},
46-
{ "include": "source.json#stringcontent" }
26+
"match": "\\.",
27+
"name": "support.function.tm"
28+
}
4729
]
48-
}
49-
}
30+
},
31+
{
32+
"match": "[\\w.:][\\w.:-]*",
33+
"name": "string $0"
34+
},
35+
{
36+
"comment": "balancedBracketScopes ONLY",
37+
"match": "(?<=\")\\*(?=\")",
38+
"name": "keyword.control.any"
39+
},
40+
{
41+
"comment": "tokenTypes Type ONLY",
42+
"match": "(?<=\")other(?=\")",
43+
"name": "meta.embedded.other"
44+
},
45+
{ "include": "source.json#stringcontent" }
46+
]
5047
}
5148
}
52-
}
49+
}

syntaxes/package-scripts.tmLanguage.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
],
1313
"repository": {
1414
"scripts": {
15-
"match": "\\G(?>[^\\\\\"\\x-\\x1F]++|\\\\.)++",
15+
"match": "(?<=\")\\G(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++(?=\")",
1616
"captures": {
1717
"0": {
1818
"name": "meta.embedded.shellscript.json",
1919
"patterns": [
2020
{
2121
"comment": "Setup a `\\G` anchor for ShellScript to use",
2222
"begin": "|",
23-
"end": "(*FAIL)",
23+
"end": "(?!)",
2424
"patterns": [
2525
{ "include": "source.shell" },
2626
{
@@ -37,4 +37,4 @@
3737
}
3838
}
3939
}
40-
}
40+
}

syntaxes/schema-defaultSnippets.tmLanguage.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,45 +17,47 @@
1717
],
1818
"repository": {
1919
"body-key": {
20-
"match": "(?<={\\s*+\")\\G(?>[^\\\\\"\\x-\\x1F]++|\\\\.)++|(?<=\")\\G(?>[^\\\\\"\\x-\\x1F]++|\\\\.)++(?=\"\\s*+:)",
20+
"match": "(?<={\\s*+\")\\G(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++(?=\")|(?<=\")\\G(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++(?=\"\\s*+:)",
2121
"captures": {
2222
"0": {
23-
"name": "meta.embedded.json.comments.snippets.snippets string.json support.type.property-name.json",
23+
"name": "support.type.property-name.string.json",
2424
"patterns": [
2525
{ "include": "source.json.comments.snippets#any" },
2626
{ "include": "source.json.comments.snippets#body_stringcontent" },
2727
{ "include": "source.json#stringcontent" }
2828
]
2929
}
30-
}
30+
},
31+
"name": "meta.embedded.json.comments.snippets.snippets"
3132
},
3233
"bodyText-string": {
33-
"match": "(?<=\"bodyText\"\\s*+:\\s*+\")\\G(?>[^\\\\\"\\x-\\x1F]++|\\\\.)++",
34+
"match": "(?<=\"bodyText\"\\s*+:\\s*+\")\\G(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++(?=\")",
3435
"captures": {
3536
"0": {
36-
"name": "meta.embedded.json.comments.snippets.snippets string.quoted.double.json",
37+
"name": "string.quoted.double.json",
3738
"patterns": [
3839
{ "include": "source.json.comments.snippets#any" },
3940
{ "include": "source.json.comments.snippets#body_stringcontent" },
4041
{ "include": "source.json#stringcontent" }
4142
]
4243
}
43-
}
44+
},
45+
"name": "meta.embedded.json.comments.snippets.snippets"
4446
},
4547
"body-string": {
46-
"match": "(?<=\")\\G(?>(\\^)?+((?>[^\\\\\"\\x-\\x1F]++|\\\\.)++)|(\\^))",
48+
"match": "(?<=\")\\G(?!\")(?>(\\^)?+((?>[^\\x00-\\x1F\"\\\\]++|\\\\.)*+))(?=\")",
4749
"captures": {
4850
"1": { "name": "keyword.control.unstringify.json.schema" },
4951
"2": {
50-
"name": "meta.embedded.json.comments.snippets.snippets string.quoted.double.json",
52+
"name": "string.quoted.double.json",
5153
"patterns": [
5254
{ "include": "source.json.comments.snippets#any" },
5355
{ "include": "source.json.comments.snippets#body_stringcontent" },
5456
{ "include": "source.json#stringcontent" }
5557
]
56-
},
57-
"3": { "name": "keyword.control.unstringify.json.schema" }
58-
}
58+
}
59+
},
60+
"name": "meta.embedded.json.comments.snippets.snippets"
5961
}
6062
}
6163
}

syntaxes/schema-markdown.tmLanguage.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
],
1818
"repository": {
1919
"markdown": {
20-
"match": "(?<=\"|\\\\[nr])(?>[^\\\\\"\\x-\\x1F]++|\\\\[^nr])++(?=\"|\\\\[nr])",
20+
"match": "(?<=\"|\\\\[nr])(?>[^\\x00-\\x1F\"\\\\]++|\\\\[^nr])++(?=\"|\\\\[nr])",
2121
"captures": {
2222
"0": {
2323
"name": "meta.embedded.text.html.markdown",
2424
"patterns": [
2525
{
2626
"comment": "Setup \\G anchor for Markdown",
2727
"begin": "|",
28-
"end": "(*FAIL)",
28+
"end": "(?!)",
2929
"patterns": [ { "include": "text.html.markdown" } ]
3030
}
3131
]

syntaxes/test-query-sql.tmLanguage.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"repository": {
1515
"query": {
16-
"match": "\\G(?>[^\\\\\"\\x-\\x1F]++|\\\\.)++",
16+
"match": "\\G(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++",
1717
"captures": {
1818
"0": {
1919
"name": "meta.embedded.sql.json",
@@ -25,4 +25,4 @@
2525
}
2626
}
2727
}
28-
}
28+
}

0 commit comments

Comments
 (0)