diff --git a/syntaxes/hack.json b/syntaxes/hack.json index 8024564..50d785a 100644 --- a/syntaxes/hack.json +++ b/syntaxes/hack.json @@ -339,11 +339,7 @@ "name": "support.type.php", "patterns": [ { - "match": "\\barray\\b", - "name": "support.type.array.php" - }, - { - "match": "\\b(?:bool|int|float|string|array|resource|mixed|arraykey|nonnull|dict|vec|keyset)\\b", + "match": "\\b(?:bool|int|float|string|resource|mixed|arraykey|nonnull|dict|vec|keyset)\\b", "name": "support.type.php" }, { @@ -410,16 +406,13 @@ "include": "#type-annotation" }, { - "begin": "(?xi)\n\\s*(&)? # Reference\n\\s*((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # The variable name", + "begin": "(?xi)((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # The variable name", "end": "(?xi)\n\\s*(?=,|\\)|$) # A closing parentheses (end of argument list) or a comma", "beginCaptures": { "1": { - "name": "storage.modifier.reference.php" - }, - "2": { "name": "variable.other.php" }, - "3": { + "2": { "name": "punctuation.definition.variable.php" } }, @@ -902,7 +895,7 @@ "name": "keyword.control.php" } }, - "match": "\\s*\\b((break|c(ase|ontinue)|d(e(clare|fault)|o)|e(lse|nd(declare|for(each)?|switch|while))|for(each)?|if|return|switch|use|while))\\b" + "match": "\\s*\\b(await|break|c(ase|ontinue)|concurrent|default|do|else|for(each)?|if|return|switch|use|while)\\b" }, { "begin": "(?i)\\b((?:require|include)(?:_once)?)\\b\\s*", @@ -973,13 +966,10 @@ "name": "keyword.control.exception.php" }, { - "begin": "(?i)\\b(function)\\s*(&\\s*)?(?=\\()", + "begin": "(?i)\\b(function)\\s*(?=\\()", "beginCaptures": { "1": { "name": "storage.type.function.php" - }, - "2": { - "name": "storage.modifier.reference.php" } }, "end": "\\{|\\)", @@ -1042,7 +1032,7 @@ ] }, { - "begin": "(?x)\n\\s*((?:(?:final|abstract|public|private|protected|static|async)\\s+)*)\n(function)\n(?:\\s+|(\\s*&\\s*))\n(?:\n (__(?:call|construct|destruct|get|set|isset|unset|tostring|clone|set_state|sleep|wakeup|autoload|invoke|callStatic|dispose|disposeAsync)(?=[^a-zA-Z0-9_\\x7f-\\xff]))\n |\n ([a-zA-Z0-9_]+)\n)", + "begin": "(?x)\n\\s*((?:(?:final|abstract|public|private|protected|static|async)\\s+)*)\n(function)\n(?:\\s+)\n(?:\n (__(?:call|construct|destruct|get|set|isset|unset|tostring|clone|set_state|sleep|wakeup|autoload|invoke|callStatic|dispose|disposeAsync)(?=[^a-zA-Z0-9_\\x7f-\\xff]))\n |\n ([a-zA-Z0-9_]+)\n)", "beginCaptures": { "1": { "patterns": [ @@ -1056,15 +1046,12 @@ "name": "storage.type.function.php" }, "3": { - "name": "storage.modifier.reference.php" - }, - "4": { "name": "support.function.magic.php" }, - "5": { + "4": { "name": "entity.name.function.php" }, - "6": { + "5": { "name": "meta.function.generics.php" } }, @@ -1227,10 +1214,6 @@ "match": "\\|>", "name": "keyword.operator.pipe.php" }, - { - "match": "(@)", - "name": "keyword.operator.error-control.php" - }, { "match": "(!==|!=|===|==)", "name": "keyword.operator.comparison.php" @@ -1428,33 +1411,6 @@ "match": "=", "name": "keyword.operator.assignment.php" }, - { - "match": "&(?=\\s*\\$)", - "name": "storage.modifier.reference.php" - }, - { - "begin": "(array)\\s*(\\()", - "beginCaptures": { - "1": { - "name": "support.function.construct.php" - }, - "2": { - "name": "punctuation.definition.array.begin.php" - } - }, - "end": "\\)", - "endCaptures": { - "0": { - "name": "punctuation.definition.array.end.php" - } - }, - "name": "meta.array.php", - "patterns": [ - { - "include": "#parameter-default-types" - } - ] - }, { "include": "#instantiation" }, diff --git a/syntaxes/test/async.hack b/syntaxes/test/async.hack new file mode 100644 index 0000000..3c71502 --- /dev/null +++ b/syntaxes/test/async.hack @@ -0,0 +1,10 @@ +async function gen_foo(): Awaitable { + return 1; +} + +async function gen_bar(): Awaitable { + concurrent { + $x = await gen_foo(1); + $y = await gen_foo(2); + } +} \ No newline at end of file