From 413f949cff30cff7ec7b10e52c29854e95019879 Mon Sep 17 00:00:00 2001 From: Michael Newton Date: Tue, 24 Nov 2020 14:06:53 -0700 Subject: [PATCH 1/6] respect indented HEREDOC terminator resolves #84 --- Syntaxes/PHP.plist | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Syntaxes/PHP.plist b/Syntaxes/PHP.plist index 45e5525..5576316 100644 --- a/Syntaxes/PHP.plist +++ b/Syntaxes/PHP.plist @@ -777,7 +777,7 @@ contentName text.html end - ^(\3)\b + ^\s*(\3)\b endCaptures 0 @@ -825,7 +825,7 @@ contentName text.xml end - ^(\3)\b + ^\s*(\3)\b endCaptures 0 @@ -873,7 +873,7 @@ contentName source.sql end - ^(\3)\b + ^\s*(\3)\b endCaptures 0 @@ -921,7 +921,7 @@ contentName source.js end - ^(\3)\b + ^\s*(\3)\b endCaptures 0 @@ -969,7 +969,7 @@ contentName source.json end - ^(\3)\b + ^\s*(\3)\b endCaptures 0 @@ -1017,7 +1017,7 @@ contentName source.css end - ^(\3)\b + ^\s*(\3)\b endCaptures 0 @@ -1065,7 +1065,7 @@ contentName string.regexp.heredoc.php end - ^(\3)\b + ^\s*(\3)\b endCaptures 0 @@ -1184,7 +1184,7 @@ end - ^(\3)\b + ^\s*(\3)\b endCaptures 1 From fe03f52ab679b164f4d21ec7ef0d361f4eda14b9 Mon Sep 17 00:00:00 2001 From: Michael Newton Date: Tue, 24 Nov 2020 14:54:22 -0700 Subject: [PATCH 2/6] allow uncaptured exceptions --- Syntaxes/PHP.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/PHP.plist b/Syntaxes/PHP.plist index 5576316..62f5e2f 100644 --- a/Syntaxes/PHP.plist +++ b/Syntaxes/PHP.plist @@ -1720,7 +1720,7 @@ end - ([A-Za-z_][A-Za-z_0-9]*)\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*\) + ([A-Za-z_][A-Za-z_0-9]*)\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)?\s*\) endCaptures 1 From 53c788b038794f052dc6a828534313abbcdb0ecb Mon Sep 17 00:00:00 2001 From: Michael Newton Date: Tue, 24 Nov 2020 14:57:39 -0700 Subject: [PATCH 3/6] support native "mixed" type --- Syntaxes/PHP.plist | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Syntaxes/PHP.plist b/Syntaxes/PHP.plist index 62f5e2f..60f2e0c 100644 --- a/Syntaxes/PHP.plist +++ b/Syntaxes/PHP.plist @@ -547,17 +547,17 @@ begin (?ix) - (?: # Optional + (?: # Optional (\?)? (?: - (array|bool|float|int|string) # scalar-type - | (callable|iterable) # base-type-declaration + (array|bool|float|int|string|mixed) # scalar-type + | (callable|iterable) # base-type-declaration | ([a-z_0-9\\]*[a-z_][a-z_0-9]*) ) \s+ )? - (?:(&)\s*)? # Reference - ((\$+)[a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*) # Variable name + (?:(&)\s*)? # Reference + ((\$+)[a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*) # Variable name beginCaptures @@ -1920,15 +1920,15 @@ meta.function.arguments.php end (?ix) - (\)) # Close arguments - (?: # Optional return type + (\)) # Close arguments + (?: # Optional return type \s*(:)\s* (\?)? (?: - (array|bool|float|int|string) # scalar-type - | (callable|iterable) # base-type-declaration + (array|bool|float|int|string|mixed) # scalar-type + | (callable|iterable) # base-type-declaration | (void) - | ([a-z_0-9\\]*[a-z_][a-z_0-9]*) # qualified-name + | ([a-z_0-9\\]*[a-z_][a-z_0-9]*) # qualified-name ) )? @@ -2138,7 +2138,7 @@ match - (?i)\b(array|real|double|float|int(eger)?|bool(ean)?|string|class|clone|var|function|interface|parent|self|object)\b + (?i)\b(array|real|double|float|int(eger)?|bool(ean)?|string|mixed|class|clone|var|function|interface|parent|self|object)\b name storage.type.php From 9fd9c8f19d3ca3eb090e7f2478911917dbbd9bb4 Mon Sep 17 00:00:00 2001 From: Michael Newton Date: Tue, 24 Nov 2020 15:07:56 -0700 Subject: [PATCH 4/6] add static return type (also self and parent from PHP 7) --- Syntaxes/PHP.plist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Syntaxes/PHP.plist b/Syntaxes/PHP.plist index 60f2e0c..145f605 100644 --- a/Syntaxes/PHP.plist +++ b/Syntaxes/PHP.plist @@ -1928,6 +1928,7 @@ (array|bool|float|int|string|mixed) # scalar-type | (callable|iterable) # base-type-declaration | (void) + | (self|parent|static) # late static binding | ([a-z_0-9\\]*[a-z_][a-z_0-9]*) # qualified-name ) )? @@ -1965,6 +1966,11 @@ storage.type.void.php 7 + + name + storage.type.$7.php + + 8 patterns From caa18329d413b32389e36be3f04a5ed863f4486b Mon Sep 17 00:00:00 2001 From: Michael Newton Date: Tue, 24 Nov 2020 15:29:52 -0700 Subject: [PATCH 5/6] recognize match control structure --- Syntaxes/PHP.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/PHP.plist b/Syntaxes/PHP.plist index 145f605..a750478 100644 --- a/Syntaxes/PHP.plist +++ b/Syntaxes/PHP.plist @@ -1683,7 +1683,7 @@ match - \s*\b((break|c(ase|ontinue)|d(e(clare|fault)|ie|o)|e(lse(if)?|nd(declare|for(each)?|if|switch|while)|xit)|for(each)?|if|return|switch|use|while|yield))\b + \s*\b((break|c(ase|ontinue)|d(e(clare|fault)|ie|o)|e(lse(if)?|nd(declare|for(each)?|if|switch|while)|xit)|for(each)?|if|match|return|switch|use|while|yield))\b begin From c36b500f8ceeba78c716a1bff2f98d0e7405d3da Mon Sep 17 00:00:00 2001 From: Michael Newton Date: Tue, 24 Nov 2020 15:39:23 -0700 Subject: [PATCH 6/6] highlight nullsafe operator --- Syntaxes/PHP.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/PHP.plist b/Syntaxes/PHP.plist index a750478..53c73af 100644 --- a/Syntaxes/PHP.plist +++ b/Syntaxes/PHP.plist @@ -2456,7 +2456,7 @@ match - (?x)(->) + (?x)(\??->) (?: ([A-Za-z_][A-Za-z_0-9]*)\s*\( |