Skip to content

Commit 44aa7c2

Browse files
committed
[php] update grammar
1 parent 79166ed commit 44aa7c2

3 files changed

Lines changed: 51 additions & 74 deletions

File tree

extensions/php/syntaxes/php.tmLanguage.json

Lines changed: 35 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
55
"Once accepted there, we are happy to receive an update request."
66
],
7-
"version": "https://github.com/atom/language-php/commit/2091139972d9a5022213697e5ce774cb19053925",
7+
"version": "https://github.com/atom/language-php/commit/f53f2fc2c3f52468b6d205b8c2bbf79aca95f5b2",
88
"scopeName": "text.html.php",
99
"name": "PHP",
1010
"fileTypes": [
@@ -153,79 +153,45 @@
153153
"repository": {
154154
"class-body": {
155155
"patterns": [
156-
{
157-
"match": "(?xi)\n\\b(use)\\s+\n([a-z_\\x{7f}-\\x{ff}\\\\][a-z0-9_\\x{7f}-\\x{ff}\\\\]*)\n((?:\\s*,\\s*[a-z_\\x{7f}-\\x{ff}\\\\][a-z0-9_\\x{7f}-\\x{ff}\\\\]*)*)\n(?=\\s*;)",
158-
"name": "meta.use.php",
159-
"captures": {
160-
"1": {
161-
"name": "keyword.other.use.php"
162-
},
163-
"2": {
164-
"patterns": [
165-
{
166-
"include": "#class-name"
167-
}
168-
]
169-
},
170-
"3": {
171-
"patterns": [
172-
{
173-
"include": "#class-name"
174-
},
175-
{
176-
"match": ",",
177-
"name": "punctuation.separator.delimiter.php"
178-
}
179-
]
180-
}
181-
}
182-
},
183156
{
184157
"begin": "(?i)\\buse\\b",
185158
"beginCaptures": {
186159
"0": {
187160
"name": "keyword.other.use.php"
188161
}
189162
},
190-
"end": "}",
191-
"endCaptures": {
192-
"0": {
193-
"name": "punctuation.definition.use.end.bracket.curly.php"
194-
}
195-
},
163+
"end": "(?=;)",
196164
"name": "meta.use.php",
197165
"patterns": [
198166
{
199-
"match": "(?xi)\n([a-z_\\x{7f}-\\x{ff}\\\\][a-z0-9_\\x{7f}-\\x{ff}\\\\]*)\n((?:\\s*,\\s*[a-z_\\x{7f}-\\x{ff}\\\\][a-z0-9_\\x{7f}-\\x{ff}\\\\]*)*)",
167+
"match": "(?i)[a-z_\\x{7f}-\\x{ff}\\\\][a-z0-9_\\x{7f}-\\x{ff}\\\\]*",
200168
"captures": {
201-
"1": {
202-
"patterns": [
203-
{
204-
"include": "#class-name"
205-
}
206-
]
207-
},
208-
"2": {
169+
"0": {
209170
"patterns": [
210171
{
211172
"include": "#class-name"
212-
},
213-
{
214-
"match": ",",
215-
"name": "punctuation.separator.delimiter.php"
216173
}
217174
]
218175
}
219176
}
220177
},
178+
{
179+
"match": ",",
180+
"name": "punctuation.separator.delimiter.php"
181+
},
221182
{
222183
"begin": "{",
223184
"beginCaptures": {
224185
"0": {
225186
"name": "punctuation.definition.use.begin.bracket.curly.php"
226187
}
227188
},
228-
"end": "(?=})",
189+
"end": "}",
190+
"endCaptures": {
191+
"0": {
192+
"name": "punctuation.definition.use.end.bracket.curly.php"
193+
}
194+
},
229195
"contentName": "meta.use.body.php",
230196
"patterns": [
231197
{
@@ -1462,14 +1428,6 @@
14621428
{
14631429
"include": "#comments"
14641430
},
1465-
{
1466-
"match": "{",
1467-
"name": "punctuation.section.scope.begin.php"
1468-
},
1469-
{
1470-
"match": "}",
1471-
"name": "punctuation.section.scope.end.php"
1472-
},
14731431
{
14741432
"begin": "(?i)^\\s*(interface)\\s+([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)\\s*(extends)?\\s*",
14751433
"beginCaptures": {
@@ -1606,7 +1564,7 @@
16061564
"name": "storage.type.${2:/downcase}.php"
16071565
}
16081566
},
1609-
"end": "(?=;|(?:^\\s*$))",
1567+
"end": "(?=;)",
16101568
"name": "meta.use.php",
16111569
"patterns": [
16121570
{
@@ -2128,6 +2086,25 @@
21282086
{
21292087
"include": "#string-backtick"
21302088
},
2089+
{
2090+
"begin": "{",
2091+
"beginCaptures": {
2092+
"0": {
2093+
"name": "punctuation.definition.begin.bracket.curly.php"
2094+
}
2095+
},
2096+
"end": "}",
2097+
"endCaptures": {
2098+
"0": {
2099+
"name": "punctuation.definition.end.bracket.curly.php"
2100+
}
2101+
},
2102+
"patterns": [
2103+
{
2104+
"include": "#language"
2105+
}
2106+
]
2107+
},
21312108
{
21322109
"begin": "\\[",
21332110
"beginCaptures": {
@@ -3402,7 +3379,7 @@
34023379
},
34033380
{
34043381
"match": ",",
3405-
"name": "punctuation.definition.separator.delimiter.php"
3382+
"name": "punctuation.separator.delimiter.php"
34063383
}
34073384
]
34083385
},

extensions/php/test/colorize-results/issue-28354_php.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
},
211211
{
212212
"c": "{",
213-
"t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.section.scope.begin.php",
213+
"t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
214214
"r": {
215215
"dark_plus": "default: #D4D4D4",
216216
"light_plus": "default: #000000",
@@ -430,7 +430,7 @@
430430
},
431431
{
432432
"c": "}",
433-
"t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.section.scope.end.php",
433+
"t": "text.html.php meta.embedded.block.html source.js meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
434434
"r": {
435435
"dark_plus": "default: #D4D4D4",
436436
"light_plus": "default: #000000",

extensions/php/test/colorize-results/test_php.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@
298298
},
299299
{
300300
"c": "{",
301-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.begin.php",
301+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
302302
"r": {
303303
"dark_plus": "default: #D4D4D4",
304304
"light_plus": "default: #000000",
@@ -353,7 +353,7 @@
353353
},
354354
{
355355
"c": "}",
356-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.end.php",
356+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
357357
"r": {
358358
"dark_plus": "default: #D4D4D4",
359359
"light_plus": "default: #000000",
@@ -1310,7 +1310,7 @@
13101310
},
13111311
{
13121312
"c": "{",
1313-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.begin.php",
1313+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
13141314
"r": {
13151315
"dark_plus": "default: #D4D4D4",
13161316
"light_plus": "default: #000000",
@@ -1794,7 +1794,7 @@
17941794
},
17951795
{
17961796
"c": "{",
1797-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.begin.php",
1797+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
17981798
"r": {
17991799
"dark_plus": "default: #D4D4D4",
18001800
"light_plus": "default: #000000",
@@ -1871,7 +1871,7 @@
18711871
},
18721872
{
18731873
"c": "}",
1874-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.end.php",
1874+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
18751875
"r": {
18761876
"dark_plus": "default: #D4D4D4",
18771877
"light_plus": "default: #000000",
@@ -1915,7 +1915,7 @@
19151915
},
19161916
{
19171917
"c": "{",
1918-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.begin.php",
1918+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
19191919
"r": {
19201920
"dark_plus": "default: #D4D4D4",
19211921
"light_plus": "default: #000000",
@@ -2245,7 +2245,7 @@
22452245
},
22462246
{
22472247
"c": "}",
2248-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.end.php",
2248+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
22492249
"r": {
22502250
"dark_plus": "default: #D4D4D4",
22512251
"light_plus": "default: #000000",
@@ -2267,7 +2267,7 @@
22672267
},
22682268
{
22692269
"c": "}",
2270-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.end.php",
2270+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
22712271
"r": {
22722272
"dark_plus": "default: #D4D4D4",
22732273
"light_plus": "default: #000000",
@@ -2949,7 +2949,7 @@
29492949
},
29502950
{
29512951
"c": "{",
2952-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.begin.php",
2952+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
29532953
"r": {
29542954
"dark_plus": "default: #D4D4D4",
29552955
"light_plus": "default: #000000",
@@ -3092,7 +3092,7 @@
30923092
},
30933093
{
30943094
"c": "{",
3095-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.begin.php",
3095+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
30963096
"r": {
30973097
"dark_plus": "default: #D4D4D4",
30983098
"light_plus": "default: #000000",
@@ -3202,7 +3202,7 @@
32023202
},
32033203
{
32043204
"c": "}",
3205-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.end.php",
3205+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
32063206
"r": {
32073207
"dark_plus": "default: #D4D4D4",
32083208
"light_plus": "default: #000000",
@@ -3444,7 +3444,7 @@
34443444
},
34453445
{
34463446
"c": "}",
3447-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.end.php",
3447+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
34483448
"r": {
34493449
"dark_plus": "default: #D4D4D4",
34503450
"light_plus": "default: #000000",
@@ -3521,7 +3521,7 @@
35213521
},
35223522
{
35233523
"c": "{",
3524-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.begin.php",
3524+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.curly.php",
35253525
"r": {
35263526
"dark_plus": "default: #D4D4D4",
35273527
"light_plus": "default: #000000",
@@ -3532,7 +3532,7 @@
35323532
},
35333533
{
35343534
"c": "}",
3535-
"t": "text.html.php meta.embedded.block.php source.php punctuation.section.scope.end.php",
3535+
"t": "text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.curly.php",
35363536
"r": {
35373537
"dark_plus": "default: #D4D4D4",
35383538
"light_plus": "default: #000000",

0 commit comments

Comments
 (0)