diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist
index dd46b1f..4542ff0 100644
--- a/Syntaxes/JavaScript.plist
+++ b/Syntaxes/JavaScript.plist
@@ -675,6 +675,104 @@
+
+ begin
+ (?x)
+ (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)? # optional assignment to identifier
+ (?= # lookahead to:
+ (\( # open parenthesis
+ (?>(?>[^()]+)|\g<-1>)* # anything except parens (atomic)
+ \)) # close parenthesis
+ \s* # optional space
+ (=>) # arrow
+ )
+
+ beginCaptures
+
+ 1
+
+ name
+ entity.name.function.js
+
+ 2
+
+ name
+ keyword.operator.assignment.js
+
+
+ comment
+
+ Arrow function.
+ https://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions
+
+ end
+ (?<=\))\s*(=>)
+ name
+ meta.function.js
+ patterns
+
+
+ match
+ \G\(
+ name
+ punctuation.definition.parameters.begin.js
+
+
+ match
+ \)(?=\s*=>)
+ name
+ punctuation.definition.parameters.end.js
+
+
+ include
+ #function-params
+
+
+
+
+ captures
+
+ 1
+
+ name
+ entity.name.function.js
+
+ 2
+
+ name
+ keyword.operator.assignment.js
+
+ 3
+
+ name
+ keyword.control.js
+
+ 4
+
+ name
+ variable.parameter.function.js
+
+ 5
+
+ name
+ storage.type.function.arrow.js
+
+
+ comment
+
+ Arrow function, but without parentheses delimiting the parameters. Only valid when there is exactly one parameter without a default value.
+ https://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions
+
+ match
+ (?x)
+ (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)? # optional assignment to identifier
+ (?:(async)\s+)? # optional "async" annotation
+ \b([_$a-zA-Z][$\w]*) # single parameter name
+ \s*(=>) # optional space and arrow
+
+ name
+ meta.function.js
+
begin
(?<=[\[=(?:+,!]|^|return|=>|&&|\|\|)\s*(?=/[^/*+?].*/)
@@ -731,7 +829,7 @@
comment
Matching as a capture group prevents false positives with other uses of :
end
- ([^:"'`\[\]{}()]*)(:)
+ ([^:"`\[\]{}()]*)(:)
endCaptures
1
@@ -1008,10 +1106,8 @@
invalid.illegal.js
- match
- \b(false|Infinity|NaN|null|true|undefined)\b
- name
- constant.language.js
+ include
+ #constants
match
@@ -1239,6 +1335,13 @@
+ constants
+
+ match
+ \b(false|Infinity|NaN|null|true|undefined)\b
+ name
+ constant.language.js
+
function-call
patterns
@@ -1316,6 +1419,10 @@
include
#numbers
+
+ include
+ #constants
+
include
#strings