Skip to content

Commit 3e124d8

Browse files
committed
[php] update grammar
1 parent d312f2b commit 3e124d8

2 files changed

Lines changed: 104 additions & 23 deletions

File tree

extensions/php/syntaxes/php.tmLanguage.json

Lines changed: 31 additions & 16 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/e1290265f3d68316347e0ab2665686016b4b24b7",
7+
"version": "https://github.com/atom/language-php/commit/16d8c3ea6f30c808e270a7be02a33e27ed19eed0",
88
"scopeName": "text.html.php",
99
"name": "PHP",
1010
"fileTypes": [
@@ -449,6 +449,10 @@
449449
{
450450
"include": "#comments"
451451
},
452+
{
453+
"match": ",",
454+
"name": "punctuation.separator.delimiter.php"
455+
},
452456
{
453457
"begin": "(?xi)\n(array) # Typehint\n\\s+((&)?\\s*(\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # Variable name with possible reference\n\\s*(=)\\s*(array)\\s*(\\() # Default value",
454458
"beginCaptures": {
@@ -535,21 +539,34 @@
535539
}
536540
},
537541
{
538-
"begin": "(?xi)\n([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # Typehinted class name\n\\s*((&)?\\s*(\\.\\.\\.)?(\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # Variable name with possible reference",
542+
"begin": "(?xi)\n(\\\\?(?:[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*\\\\)*) # Optional namespace\n([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # Typehinted class name\n\\s+((&)?\\s*(\\.\\.\\.)?(\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # Variable name with possible reference",
539543
"beginCaptures": {
540544
"1": {
541-
"name": "storage.type.php"
545+
"name": "support.other.namespace.php",
546+
"patterns": [
547+
{
548+
"match": "(?i)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*",
549+
"name": "storage.type.php"
550+
},
551+
{
552+
"match": "\\\\",
553+
"name": "punctuation.separator.inheritance.php"
554+
}
555+
]
542556
},
543557
"2": {
544-
"name": "variable.other.php"
558+
"name": "storage.type.php"
545559
},
546560
"3": {
547-
"name": "storage.modifier.reference.php"
561+
"name": "variable.other.php"
548562
},
549563
"4": {
550-
"name": "keyword.operator.variadic.php"
564+
"name": "storage.modifier.reference.php"
551565
},
552566
"5": {
567+
"name": "keyword.operator.variadic.php"
568+
},
569+
"6": {
553570
"name": "punctuation.definition.variable.php"
554571
}
555572
},
@@ -1760,13 +1777,10 @@
17601777
"name": "keyword.control.exception.php"
17611778
},
17621779
{
1763-
"begin": "(?i)\\b(function)\\s*(&)?\\s*(?=\\()",
1780+
"begin": "(?i)\\b(function)\\s*(?=\\()",
17641781
"beginCaptures": {
17651782
"1": {
17661783
"name": "storage.type.function.php"
1767-
},
1768-
"2": {
1769-
"name": "storage.modifier.reference.php"
17701784
}
17711785
},
17721786
"end": "(?={)",
@@ -1829,7 +1843,7 @@
18291843
]
18301844
},
18311845
{
1832-
"begin": "(?x)\n((?:(?:final|abstract|public|private|protected|static)\\s+)*)\n(function)\n\\s*(&)?\\s*\n(?i:\n (__(?:call|construct|debugInfo|destruct|get|set|isset|unset|tostring|\n clone|set_state|sleep|wakeup|autoload|invoke|callStatic))\n |([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n)\n\\s*(\\()",
1846+
"begin": "(?x)\n((?:(?:final|abstract|public|private|protected|static)\\s+)*)\n(function)\\s+\n(?i:\n (__(?:call|construct|debugInfo|destruct|get|set|isset|unset|tostring|\n clone|set_state|sleep|wakeup|autoload|invoke|callStatic))\n |([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n)\n\\s*(\\()",
18331847
"beginCaptures": {
18341848
"1": {
18351849
"patterns": [
@@ -1843,15 +1857,12 @@
18431857
"name": "storage.type.function.php"
18441858
},
18451859
"3": {
1846-
"name": "storage.modifier.reference.php"
1847-
},
1848-
"4": {
18491860
"name": "support.function.magic.php"
18501861
},
1851-
"5": {
1862+
"4": {
18521863
"name": "entity.name.function.php"
18531864
},
1854-
"6": {
1865+
"5": {
18551866
"name": "punctuation.definition.parameters.begin.bracket.round.php"
18561867
}
18571868
},
@@ -2099,6 +2110,10 @@
20992110
},
21002111
{
21012112
"include": "#constants"
2113+
},
2114+
{
2115+
"match": ",",
2116+
"name": "punctuation.separator.delimiter.php"
21022117
}
21032118
]
21042119
},

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

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,18 @@
550550
}
551551
},
552552
{
553-
"c": ", ",
553+
"c": ",",
554+
"t": "text.html.php meta.embedded.block.php source.php meta.array.php punctuation.separator.delimiter.php",
555+
"r": {
556+
"dark_plus": "default: #D4D4D4",
557+
"light_plus": "default: #000000",
558+
"dark_vs": "default: #D4D4D4",
559+
"light_vs": "default: #000000",
560+
"hc_black": "default: #FFFFFF"
561+
}
562+
},
563+
{
564+
"c": " ",
554565
"t": "text.html.php meta.embedded.block.php source.php meta.array.php",
555566
"r": {
556567
"dark_plus": "default: #D4D4D4",
@@ -594,7 +605,18 @@
594605
}
595606
},
596607
{
597-
"c": ", ",
608+
"c": ",",
609+
"t": "text.html.php meta.embedded.block.php source.php meta.array.php punctuation.separator.delimiter.php",
610+
"r": {
611+
"dark_plus": "default: #D4D4D4",
612+
"light_plus": "default: #000000",
613+
"dark_vs": "default: #D4D4D4",
614+
"light_vs": "default: #000000",
615+
"hc_black": "default: #FFFFFF"
616+
}
617+
},
618+
{
619+
"c": " ",
598620
"t": "text.html.php meta.embedded.block.php source.php meta.array.php",
599621
"r": {
600622
"dark_plus": "default: #D4D4D4",
@@ -638,7 +660,18 @@
638660
}
639661
},
640662
{
641-
"c": ", ",
663+
"c": ",",
664+
"t": "text.html.php meta.embedded.block.php source.php meta.array.php punctuation.separator.delimiter.php",
665+
"r": {
666+
"dark_plus": "default: #D4D4D4",
667+
"light_plus": "default: #000000",
668+
"dark_vs": "default: #D4D4D4",
669+
"light_vs": "default: #000000",
670+
"hc_black": "default: #FFFFFF"
671+
}
672+
},
673+
{
674+
"c": " ",
642675
"t": "text.html.php meta.embedded.block.php source.php meta.array.php",
643676
"r": {
644677
"dark_plus": "default: #D4D4D4",
@@ -683,7 +716,7 @@
683716
},
684717
{
685718
"c": ",",
686-
"t": "text.html.php meta.embedded.block.php source.php meta.array.php",
719+
"t": "text.html.php meta.embedded.block.php source.php meta.array.php punctuation.separator.delimiter.php",
687720
"r": {
688721
"dark_plus": "default: #D4D4D4",
689722
"light_plus": "default: #000000",
@@ -737,7 +770,18 @@
737770
}
738771
},
739772
{
740-
"c": ", ",
773+
"c": ",",
774+
"t": "text.html.php meta.embedded.block.php source.php meta.array.php punctuation.separator.delimiter.php",
775+
"r": {
776+
"dark_plus": "default: #D4D4D4",
777+
"light_plus": "default: #000000",
778+
"dark_vs": "default: #D4D4D4",
779+
"light_vs": "default: #000000",
780+
"hc_black": "default: #FFFFFF"
781+
}
782+
},
783+
{
784+
"c": " ",
741785
"t": "text.html.php meta.embedded.block.php source.php meta.array.php",
742786
"r": {
743787
"dark_plus": "default: #D4D4D4",
@@ -781,7 +825,18 @@
781825
}
782826
},
783827
{
784-
"c": ", ",
828+
"c": ",",
829+
"t": "text.html.php meta.embedded.block.php source.php meta.array.php punctuation.separator.delimiter.php",
830+
"r": {
831+
"dark_plus": "default: #D4D4D4",
832+
"light_plus": "default: #000000",
833+
"dark_vs": "default: #D4D4D4",
834+
"light_vs": "default: #000000",
835+
"hc_black": "default: #FFFFFF"
836+
}
837+
},
838+
{
839+
"c": " ",
785840
"t": "text.html.php meta.embedded.block.php source.php meta.array.php",
786841
"r": {
787842
"dark_plus": "default: #D4D4D4",
@@ -825,7 +880,18 @@
825880
}
826881
},
827882
{
828-
"c": ", ",
883+
"c": ",",
884+
"t": "text.html.php meta.embedded.block.php source.php meta.array.php punctuation.separator.delimiter.php",
885+
"r": {
886+
"dark_plus": "default: #D4D4D4",
887+
"light_plus": "default: #000000",
888+
"dark_vs": "default: #D4D4D4",
889+
"light_vs": "default: #000000",
890+
"hc_black": "default: #FFFFFF"
891+
}
892+
},
893+
{
894+
"c": " ",
829895
"t": "text.html.php meta.embedded.block.php source.php meta.array.php",
830896
"r": {
831897
"dark_plus": "default: #D4D4D4",

0 commit comments

Comments
 (0)