From 738697d546ceef0a3973bd2421be3382dd110cb4 Mon Sep 17 00:00:00 2001 From: Paul Vick Date: Mon, 3 Oct 2022 13:37:22 -0700 Subject: [PATCH] Fix colorization --- syntaxes/hack.json | 10 +++++----- syntaxes/test/modules.hack | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/syntaxes/hack.json b/syntaxes/hack.json index ff2d4c9..e70bec6 100644 --- a/syntaxes/hack.json +++ b/syntaxes/hack.json @@ -605,7 +605,7 @@ "name": "meta.function-call.invoke.php" }, "interface": { - "begin": "^(?i)\\s*(?:(public|internal)?\\s+)(interface)\\b", + "begin": "^(?i)\\s*(?:(public|internal)\\s+)?(interface)\\b", "beginCaptures": { "1": { "name": "storage.modifier.php" @@ -697,7 +697,7 @@ ] }, { - "begin": "(?i)^\\s*(?:(public|internal)?\\s+)(enum)\\s+(class)\\s+([a-z0-9_]+)\\s*:?", + "begin": "(?i)^\\s*(?:(public|internal)\\s+)?(enum)\\s+(class)\\s+([a-z0-9_]+)\\s*:?", "beginCaptures": { "1": { "name": "storage.modifier.php" @@ -725,7 +725,7 @@ ] }, { - "begin": "(?i)^\\s*(?:(public|internal)?\\s+)(enum)\\s+([a-z0-9_]+)\\s*:?", + "begin": "(?i)^\\s*(?:(public|internal)\\s+)?(enum)\\s+([a-z0-9_]+)\\s*:?", "beginCaptures": { "1": { "name": "storage.modifier.php" @@ -749,7 +749,7 @@ ] }, { - "begin": "(?i)^\\s*(?:(public|internal)?\\s+)(trait)\\s+([a-z0-9_]+)\\s*", + "begin": "(?i)^\\s*(?:(public|internal)\\s+)?(trait)\\s+([a-z0-9_]+)\\s*", "beginCaptures": { "1": { "name": "storage.modifier.php" @@ -1022,7 +1022,7 @@ "name": "keyword.control.exception.php" }, { - "begin": "(?i)\\s*(?:(public|internal)?\\s+)(function)\\s*(?=\\()", + "begin": "(?i)\\s*(?:(public|internal)\\s+)?(function)\\s*(?=\\()", "beginCaptures": { "1": { "name": "storage.modifier.php" diff --git a/syntaxes/test/modules.hack b/syntaxes/test/modules.hack index 90de0a5..203b36c 100644 --- a/syntaxes/test/modules.hack +++ b/syntaxes/test/modules.hack @@ -11,18 +11,27 @@ internal interface foo { public interface foo { } +interface foo { +} + internal enum foo { } public enum foo { } +enum foo { +} + internal enum class foo { } public enum class foo { } +enum class foo { +} + internal trait foo { internal int $x; internal function y(): void { @@ -32,6 +41,9 @@ internal trait foo { public trait foo { } +trait foo { +} + internal class foo { internal int $x; internal function y(): void { @@ -40,3 +52,15 @@ internal class foo { public class foo { } + +class foo { +} + +internal function foo(): void { +} + +public function foo(): void { +} + +function foo(): void { +} \ No newline at end of file