github-linguist 4.8.5 → 4.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/grammars/{source.sas_log.json → source.SASLog.json} +5 -6
  3. data/grammars/source.ahk.json +81 -57
  4. data/grammars/source.assembly.json +1 -1
  5. data/grammars/source.bro.json +4 -4
  6. data/grammars/source.clojure.json +32 -8
  7. data/grammars/source.coq.json +1 -1
  8. data/grammars/source.crystal.json +21 -6
  9. data/grammars/source.csound-document.json +71 -0
  10. data/grammars/source.csound-score.json +65 -0
  11. data/grammars/source.csound.json +494 -0
  12. data/grammars/source.elm.json +27 -2
  13. data/grammars/source.fsharp.json +1 -1
  14. data/grammars/source.glsl.json +96 -6
  15. data/grammars/source.js.jsx.json +664 -524
  16. data/grammars/source.nu.json +526 -0
  17. data/grammars/source.pawn.json +8 -109
  18. data/grammars/source.pony.json +1 -1
  19. data/grammars/source.python.json +4 -4
  20. data/grammars/source.regexp.babel.json +1 -1
  21. data/grammars/source.shell.json +4 -1
  22. data/grammars/source.swift.json +2 -2
  23. data/grammars/source.wavefront.mtl.json +1177 -0
  24. data/grammars/source.wavefront.obj.json +1344 -0
  25. data/grammars/text.html.creole.json +329 -0
  26. data/grammars/text.html.ecr.json +52 -0
  27. data/grammars/text.html.handlebars.json +1 -1
  28. data/grammars/text.html.mako.json +17 -2
  29. data/grammars/text.html.vue.json +36 -1
  30. data/grammars/text.slim.json +1 -4
  31. data/grammars/text.tex.latex.json +2 -2
  32. data/lib/linguist/languages.json +1 -1
  33. data/lib/linguist/languages.yml +75 -6
  34. data/lib/linguist/samples.json +1856 -71
  35. data/lib/linguist/version.rb +1 -1
  36. metadata +11 -4
  37. data/grammars/source.fan.json +0 -188
@@ -21,13 +21,16 @@
21
21
  "name": "constant.language.unit.elm"
22
22
  },
23
23
  {
24
- "begin": "^\\b(module)\\s+",
24
+ "begin": "^\\b((effect|port)\\s+)?(module)\\s+",
25
25
  "beginCaptures": {
26
26
  "1": {
27
27
  "name": "keyword.other.elm"
28
+ },
29
+ "3": {
30
+ "name": "keyword.other.elm"
28
31
  }
29
32
  },
30
- "end": "\\b(where)\\b",
33
+ "end": "$|;",
31
34
  "endCaptures": {
32
35
  "1": {
33
36
  "name": "keyword.other.elm"
@@ -38,9 +41,31 @@
38
41
  {
39
42
  "include": "#module_name"
40
43
  },
44
+ {
45
+ "begin": "(where)\\s*\\{",
46
+ "beginCaptures": {
47
+ "1": {
48
+ "name": "keyword.other.elm"
49
+ }
50
+ },
51
+ "end": "\\}",
52
+ "patterns": [
53
+ {
54
+ "include": "#type_signature"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "match": "(exposing)",
60
+ "name": "keyword.other.elm"
61
+ },
41
62
  {
42
63
  "include": "#module_exports"
43
64
  },
65
+ {
66
+ "match": "(where)",
67
+ "name": "keyword.other.elm"
68
+ },
44
69
  {
45
70
  "match": "[a-z]+",
46
71
  "name": "invalid"
@@ -315,7 +315,7 @@
315
315
  {
316
316
  "name": "string.quoted.literal.fsharp",
317
317
  "begin": "(?=[^\\\\])(@\")",
318
- "end": "(\")",
318
+ "end": "(\")(?!\")",
319
319
  "beginCaptures": {
320
320
  "1": {
321
321
  "name": "punctuation.definition.string.begin.fsharp"
@@ -25,6 +25,37 @@
25
25
  "keyEquivalent": "^~G",
26
26
  "name": "GLSL",
27
27
  "patterns": [
28
+ {
29
+ "include": "#literal"
30
+ },
31
+ {
32
+ "include": "#operator"
33
+ },
34
+ {
35
+ "begin": "/\\*",
36
+ "beginCaptures": {
37
+ "0": {
38
+ "name": "punctuation.definition.comment.block.begin.glsl"
39
+ }
40
+ },
41
+ "end": "\\*/",
42
+ "endCaptures": {
43
+ "0": {
44
+ "name": "punctuation.definition.comment.block.end.glsl"
45
+ }
46
+ },
47
+ "name": "comment.block.glsl"
48
+ },
49
+ {
50
+ "begin": "//",
51
+ "beginCapture": {
52
+ "0": {
53
+ "name": "punctuation.definition.comment.glsl"
54
+ }
55
+ },
56
+ "end": "\\n",
57
+ "name": "comment.line.double-slash.glsl"
58
+ },
28
59
  {
29
60
  "match": "^\\s*#\\s*(define|undef|if|ifdef|ifndef|else|elif|endif|error|pragma|extension|version|line)\\b",
30
61
  "name": "keyword.directive.preprocessor.glsl"
@@ -60,15 +91,74 @@
60
91
  {
61
92
  "match": "\\b(abs|acos|all|any|asin|atan|ceil|clamp|cos|cross|degrees|dFdx|dFdy|distance|dot|equal|exp|exp2|faceforward|floor|fract|ftransform|fwidth|greaterThan|greaterThanEqual|inversesqrt|length|lessThan|lessThanEqual|log|log2|matrixCompMult|max|min|mix|mod|noise[1-4]|normalize|not|notEqual|outerProduct|pow|radians|reflect|refract|shadow1D|shadow1DLod|shadow1DProj|shadow1DProjLod|shadow2D|shadow2DLod|shadow2DProj|shadow2DProjLod|sign|sin|smoothstep|sqrt|step|tan|texture1D|texture1DLod|texture1DProj|texture1DProjLod|texture2D|texture2DLod|texture2DProj|texture2DProjLod|texture3D|texture3DLod|texture3DProj|texture3DProjLod|textureCube|textureCubeLod|transpose)\\b",
62
93
  "name": "support.function.glsl"
94
+ }
95
+ ],
96
+ "repository": {
97
+ "literal": {
98
+ "patterns": [
99
+ {
100
+ "include": "#numeric-literal"
101
+ }
102
+ ]
63
103
  },
64
- {
65
- "match": "\\b(asm|enum|extern|goto|inline|long|short|sizeof|static|typedef|union|unsigned)\\b",
66
- "name": "invalid.illegal.glsl"
104
+ "operator": {
105
+ "patterns": [
106
+ {
107
+ "include": "#arithmetic-operator"
108
+ },
109
+ {
110
+ "include": "#increment-decrement-operator"
111
+ },
112
+ {
113
+ "include": "#bitwise-operator"
114
+ },
115
+ {
116
+ "include": "#comparative-operator"
117
+ },
118
+ {
119
+ "include": "#assignment-operator"
120
+ },
121
+ {
122
+ "include": "#logical-operator"
123
+ },
124
+ {
125
+ "include": "#ternary-operator"
126
+ }
127
+ ]
67
128
  },
68
- {
69
- "include": "source.c"
129
+ "numeric-literal": {
130
+ "match": "\\b([0-9][0-9_]*)(\\.([0-9][0-9_]*))?([eE][+/-]?([0-9][0-9_]*))?\\b",
131
+ "name": "constant.numeric.glsl"
132
+ },
133
+ "arithmetic-operator": {
134
+ "match": "(?<![/=\\-+!*%<>&|\\^~.])(\\+|\\-|\\*|\\/|\\%)(?![/=\\-+!*%<>&|^~.])",
135
+ "name": "keyword.operator.arithmetic.glsl"
136
+ },
137
+ "increment-decrement-operator": {
138
+ "match": "(?<![/=\\-+!*%<>&|\\^~.])(\\+\\+|\\-\\-)(?![/=\\-+!*%<>&|^~.])",
139
+ "name": "keyword.operator.increment-or-decrement.glsl"
140
+ },
141
+ "bitwise-operator": {
142
+ "match": "(?<![/=\\-+!*%<>&|\\^~.])(~|&|\\||\\^|<<|>>)(?![/=\\-+!*%<>&|^~.])",
143
+ "name": "keyword.operator.bitwise.glsl"
144
+ },
145
+ "assignment-operator": {
146
+ "match": "(?<![/=\\-+!*%<>&|\\^~.])(\\+|\\-|\\*|\\%|\\/|<<|>>|&|\\^|\\|)?=(?![/=\\-+!*%<>&|^~.])",
147
+ "name": "keyword.operator.assignment.glsl"
148
+ },
149
+ "comparative-operator": {
150
+ "match": "(?<![/=\\-+!*%<>&|\\^~.])((=|!)=|(<|>)=?)(?![/=\\-+!*%<>&|^~.])",
151
+ "name": "keyword.operator.comparative.glsl"
152
+ },
153
+ "logical-operator": {
154
+ "match": "(?<![/=\\-+!*%<>&|\\^~.])(!|&&|\\|\\||\\^\\^)(?![/=\\-+!*%<>&|^~.])",
155
+ "name": "keyword.operator.arithmetic.glsl"
156
+ },
157
+ "ternary-operator": {
158
+ "match": "(\\?|:)",
159
+ "name": "keyword.operator.ternary.glsl"
70
160
  }
71
- ],
161
+ },
72
162
  "scopeName": "source.glsl",
73
163
  "uuid": "D0FD1B52-F137-4FBA-A148-B8A893CD948C"
74
164
  }
@@ -24,13 +24,7 @@
24
24
  "include": "#ignore-long-lines"
25
25
  },
26
26
  {
27
- "include": "#flowtype-declare"
28
- },
29
- {
30
- "include": "#flowtype-type-aliases"
31
- },
32
- {
33
- "include": "#flowtype-interface"
27
+ "include": "#flowtype-keywords"
34
28
  },
35
29
  {
36
30
  "include": "#literal-function-labels"
@@ -84,6 +78,9 @@
84
78
  {
85
79
  "include": "#literal-arrow-function"
86
80
  },
81
+ {
82
+ "include": "#literal-method-alternate"
83
+ },
87
84
  {
88
85
  "include": "#literal-prototype",
89
86
  "comment": "after literal-function, which includes some prototype strings"
@@ -108,7 +105,8 @@
108
105
  "include": "#literal-language-variable"
109
106
  },
110
107
  {
111
- "include": "#literal-object"
108
+ "include": "#literal-object",
109
+ "comment": "before literal-module as it traps default {"
112
110
  },
113
111
  {
114
112
  "include": "#literal-module"
@@ -187,7 +185,7 @@
187
185
  {
188
186
  "comment": "e.g. 'play': function(arg1, arg2) { }",
189
187
  "name": "meta.function.json.js",
190
- "begin": "(?<=^|{|,)\\s*+(('|\\\")(\\b[_$a-zA-Z][$\\w]*)(\\k<2>))\\s*+(:)\\s*+(async)?\\s*+((?<!\\.)\\bfunction\\b)\\s*(\\*\\s*)?\\s*(?=\\(|<)",
188
+ "begin": "(?<=^|{|,)\\s*+(('|\\\")([^\"']*)(\\k<-3>))\\s*+(:)\\s*+(async)?\\s*+((?<!\\.)\\bfunction\\b)\\s*(\\*\\s*)?\\s*(?=\\(|<)",
191
189
  "end": "(?=\\{)",
192
190
  "applyEndPatternLast": 1,
193
191
  "beginCaptures": {
@@ -229,7 +227,7 @@
229
227
  {
230
228
  "comment": "e.g. play: async <T>(args) => { }",
231
229
  "name": "meta.function.json.arrow.js",
232
- "begin": "(?<=^|{|,)\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*\\s*=>)",
230
+ "begin": "(?<=^|{|,)\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
233
231
  "end": "\\s*(=>)",
234
232
  "beginCaptures": {
235
233
  "1": {
@@ -256,7 +254,7 @@
256
254
  {
257
255
  "comment": "e.g. play: arg => { }",
258
256
  "name": "meta.function.json.arrow.js",
259
- "begin": "(?<=^|{|,)\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
257
+ "begin": "(?<=^|{|,)\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
260
258
  "end": "\\s*(=>)",
261
259
  "beginCaptures": {
262
260
  "1": {
@@ -286,7 +284,7 @@
286
284
  {
287
285
  "comment": "e.g. 'play': (args) => { }",
288
286
  "name": "meta.function.json.arrow.js",
289
- "begin": "(?<=^|{|,)\\s*+(('|\\\")(\\b[_$a-zA-Z][$\\w]*)(\\k<2>))\\s*(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\s*+([\"']).*?\\k<-1>(?<!\\\\.))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
287
+ "begin": "(?<=^|{|,)\\s*+(('|\\\")([^\"']*)(\\k<-3>))\\s*(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
290
288
  "end": "\\s*(=>)",
291
289
  "applyEndPatternLast": 1,
292
290
  "endCaptures": {
@@ -323,7 +321,7 @@
323
321
  {
324
322
  "comment": "e.g. 'play': arg => { }",
325
323
  "name": "meta.function.json.arrow.js",
326
- "begin": "(?<=^|{|,)\\s*+(('|\\\")(\\b[_$a-zA-Z][$\\w]*)(\\k<2>))\\s*+(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\s*+([\"']).*?\\k<-1>(?<!\\\\.))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
324
+ "begin": "(?<=^|{|,)\\s*+(('|\\\")([^\"']*)(\\k<-3>))\\s*+(:)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
327
325
  "end": "\\s*(=>)",
328
326
  "beginCaptures": {
329
327
  "1": {
@@ -825,69 +823,30 @@
825
823
  "literal-keyword-storage": {
826
824
  "patterns": [
827
825
  {
828
- "comment": "flowtype vars with a : to indicate type",
829
- "begin": "\\s*+(?<!\\.)\\b(const|let|var)\\b\\s+(?=[$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}-]*+\\s*+:))",
830
- "end": "\\s*((\\;)|(?=\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare)\\b|^\\s*$|}))",
831
- "beginCaptures": {
832
- "1": {
833
- "name": "storage.type.js"
834
- }
835
- },
836
- "endCaptures": {
837
- "2": {
838
- "name": "punctuation.terminator.statement.js"
839
- }
840
- },
841
- "patterns": [
842
- {
843
- "include": "#flowtype-variable"
844
- }
845
- ]
846
- },
847
- {
848
- "comment": "flowtype objects {a,b,{z}} with a : to indicate type",
849
- "begin": "\\s*+(?<!\\.)\\b(const|let|var)\\b\\s+(?=(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})\\s*+:)",
850
- "end": "\\s*((\\;)|(?=\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare)\\b|^\\s*$|}))",
851
- "beginCaptures": {
852
- "1": {
853
- "name": "storage.type.js"
854
- }
855
- },
856
- "endCaptures": {
857
- "2": {
858
- "name": "punctuation.terminator.statement.js"
859
- }
860
- },
861
- "patterns": [
862
- {
863
- "include": "#flowtype-destruct-lhs"
864
- }
865
- ]
866
- },
867
- {
868
- "comment": "flowtype arrays [a,[b,c]] with a : to indicate type",
869
- "begin": "\\s*+(?<!\\.)\\b(const|let|var)\\b\\s+(?=(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*+:)",
870
- "end": "\\s*((\\;)|(?=\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare)\\b|^\\s*$|}))",
826
+ "begin": "\\s*+(?<!\\.)\\b(const|let|var)\\b",
827
+ "end": "\\s*(?=\\;|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|})",
871
828
  "beginCaptures": {
872
829
  "1": {
873
830
  "name": "storage.type.js"
874
831
  }
875
832
  },
876
- "endCaptures": {
877
- "2": {
878
- "name": "punctuation.terminator.statement.js"
879
- }
880
- },
881
833
  "patterns": [
882
834
  {
883
- "include": "#flowtype-destruct-lhs"
835
+ "comment": "other variables",
836
+ "begin": "\\s*",
837
+ "end": "\\s*((,)|(?=(\\;)|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|}))",
838
+ "endCaptures": {
839
+ "2": {
840
+ "name": "punctuation.terminator.statement.js"
841
+ }
842
+ },
843
+ "patterns": [
844
+ {
845
+ "include": "#flowtype-variable"
846
+ }
847
+ ]
884
848
  }
885
849
  ]
886
- },
887
- {
888
- "comment": "var statements that done start with a flow indicator",
889
- "name": "storage.type.js",
890
- "match": "\\s*+(?<!\\.)\\b(const|let|var)\\b"
891
850
  }
892
851
  ]
893
852
  },
@@ -897,7 +856,7 @@
897
856
  "comment": "e.g. function play<T>(arg1, arg2) { }",
898
857
  "name": "meta.function.js",
899
858
  "begin": "\\s*+(?:\\b(async)\\b\\s+)?\\s*+(?:(?<=\\.\\.\\.)|(?<!\\.))(\\bfunction\\b)\\s*+(\\*?)\\s*+([_$a-zA-Z][$\\w]*)?\\s*+(?=\\(|<)",
900
- "end": "(?=\\s*+\\{)",
859
+ "end": "\\s*(?=\\;|{|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|})",
901
860
  "applyEndPatternLast": 1,
902
861
  "beginCaptures": {
903
862
  "1": {
@@ -923,7 +882,7 @@
923
882
  "comment": "e.g. play = function(arg1, arg2) { }",
924
883
  "name": "meta.function.js",
925
884
  "begin": "\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(?:(async)\\s+)?\\s*+((?<!\\.)\\bfunction\\b)\\s*+(\\*?)\\s*+([_$a-zA-Z][$\\w]*)?\\s*+(?=\\(|<)",
926
- "end": "(?=\\s*+\\{)",
885
+ "end": "\\s*(?=\\;|{|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|})",
927
886
  "applyEndPatternLast": 1,
928
887
  "beginCaptures": {
929
888
  "1": {
@@ -955,7 +914,7 @@
955
914
  "comment": "e.g. Sound.prototype.play = function(arg1, arg2) { }",
956
915
  "name": "meta.prototype.function.js",
957
916
  "begin": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(?:(async)\\s+)?\\s*+((?<!\\.)\\bfunction\\b)\\s*+(\\*?)\\s*+([_$a-zA-Z][$\\w]*)?\\s*+(?=\\(|<)",
958
- "end": "(?=\\s*+\\{)",
917
+ "end": "\\s*(?=\\;|{|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|})",
959
918
  "applyEndPatternLast": 1,
960
919
  "beginCaptures": {
961
920
  "1": {
@@ -999,7 +958,7 @@
999
958
  "comment": "e.g. Sound.play = function(arg1, arg2) { }",
1000
959
  "name": "meta.function.static.js",
1001
960
  "begin": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(?:(async)\\s+)?\\s*+((?<!\\.)\\bfunction\\b)\\s*+(\\*?)\\s*+([_$a-zA-Z][$\\w]*)?\\s*+(?=\\(|<)",
1002
- "end": "(?=\\s*+\\{)",
961
+ "end": "\\s*(?=\\;|{|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|})",
1003
962
  "applyEndPatternLast": 1,
1004
963
  "beginCaptures": {
1005
964
  "1": {
@@ -1094,7 +1053,7 @@
1094
1053
  "patterns": [
1095
1054
  {
1096
1055
  "comment": "obj lteral ({ or ,{ or [{ or ={ or return { or default {",
1097
- "begin": "(?:(?<=\\(|\\[|:)|(?:\\s*(?:(=)|\\b(default)\\b|\\b(return)\\b|(,))))\\s*({)",
1056
+ "begin": "(?:(?<=\\(|\\[)|(?:\\s*(?:(=)|\\b(default)\\b|\\b(return)\\b|(,))))\\s*({)",
1098
1057
  "end": "\\s*+(})",
1099
1058
  "beginCaptures": {
1100
1059
  "1": {
@@ -1216,21 +1175,21 @@
1216
1175
  },
1217
1176
  {
1218
1177
  "name": "meta.function-call.without-arguments.js",
1219
- "begin": "\\s*+((\\bnew\\b)*)\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?=\\(\\s*+\\))",
1220
- "end": "\\s*(?<=\\))",
1221
- "beginCaptures": {
1178
+ "match": "\\s*+((\\bnew\\b)*)\\s*+([_$a-zA-Z][$\\w]*)\\s*+(\\()\\s*+(\\))",
1179
+ "captures": {
1222
1180
  "2": {
1223
1181
  "name": "keyword.operator.js"
1224
1182
  },
1225
1183
  "3": {
1226
1184
  "name": "entity.name.function.js"
1185
+ },
1186
+ "4": {
1187
+ "name": "meta.brace.round.js"
1188
+ },
1189
+ "5": {
1190
+ "name": "meta.brace.round.js"
1227
1191
  }
1228
- },
1229
- "patterns": [
1230
- {
1231
- "include": "#flowtype-bracketed-parameters"
1232
- }
1233
- ]
1192
+ }
1234
1193
  },
1235
1194
  {
1236
1195
  "name": "meta.function-call.without-arguments.js",
@@ -1244,10 +1203,10 @@
1244
1203
  },
1245
1204
  "patterns": [
1246
1205
  {
1247
- "include": "#flowtype-parse-array"
1206
+ "include": "#square-brackets"
1248
1207
  },
1249
1208
  {
1250
- "include": "#flowtype-bracketed-parameters"
1209
+ "include": "#round-brackets"
1251
1210
  }
1252
1211
  ]
1253
1212
  },
@@ -1266,7 +1225,7 @@
1266
1225
  },
1267
1226
  "patterns": [
1268
1227
  {
1269
- "include": "#flowtype-bracketed-parameters"
1228
+ "include": "#round-brackets"
1270
1229
  }
1271
1230
  ]
1272
1231
  },
@@ -1282,10 +1241,10 @@
1282
1241
  },
1283
1242
  "patterns": [
1284
1243
  {
1285
- "include": "#flowtype-parse-array"
1244
+ "include": "#square-brackets"
1286
1245
  },
1287
1246
  {
1288
- "include": "#flowtype-bracketed-parameters"
1247
+ "include": "#round-brackets"
1289
1248
  }
1290
1249
  ]
1291
1250
  }
@@ -1421,7 +1380,7 @@
1421
1380
  {
1422
1381
  "comment": "Classes",
1423
1382
  "begin": "\\s*+(?<!\\.)\\b(class)\\s+",
1424
- "end": "\\s*(})",
1383
+ "end": "\\s*(?<=})",
1425
1384
  "beginCaptures": {
1426
1385
  "0": {
1427
1386
  "name": "meta.class.js"
@@ -1430,11 +1389,6 @@
1430
1389
  "name": "storage.type.class.js"
1431
1390
  }
1432
1391
  },
1433
- "endCaptures": {
1434
- "1": {
1435
- "name": "punctuation.section.class.end.js"
1436
- }
1437
- },
1438
1392
  "patterns": [
1439
1393
  {
1440
1394
  "match": "\\s*+\\b(extends)\\b\\s*+",
@@ -1448,42 +1402,30 @@
1448
1402
  }
1449
1403
  },
1450
1404
  {
1451
- "include": "#flowtype-class-name"
1405
+ "comment": "look for classes names but dont assume uppercase start char",
1406
+ "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
1407
+ "name": "entity.name.class.js"
1452
1408
  },
1453
1409
  {
1454
1410
  "include": "#flowtype-polymorphs"
1455
1411
  },
1456
1412
  {
1457
1413
  "begin": "\\s*+{",
1458
- "end": "\\s*(?=})",
1414
+ "end": "\\s*(})",
1459
1415
  "contentName": "meta.class.body.js",
1460
1416
  "beginCaptures": {
1461
1417
  "0": {
1462
1418
  "name": "punctuation.section.class.begin.js"
1463
1419
  }
1464
1420
  },
1421
+ "endCaptures": {
1422
+ "1": {
1423
+ "name": "punctuation.section.class.end.js"
1424
+ }
1425
+ },
1465
1426
  "patterns": [
1466
1427
  {
1467
- "match": "\\s*+\\b(?<!\\.)static\\b(?!\\.)",
1468
- "name": "storage.modifier.js"
1469
- },
1470
- {
1471
- "include": "#literal-method"
1472
- },
1473
- {
1474
- "include": "#brackets"
1475
- },
1476
- {
1477
- "include": "#es7-decorators"
1478
- },
1479
- {
1480
- "include": "#comments"
1481
- },
1482
- {
1483
- "include": "#flowtype-variable"
1484
- },
1485
- {
1486
- "include": "#literal-semi-colon"
1428
+ "include": "#class-body"
1487
1429
  }
1488
1430
  ]
1489
1431
  },
@@ -1494,6 +1436,50 @@
1494
1436
  }
1495
1437
  ]
1496
1438
  },
1439
+ "class-body": {
1440
+ "patterns": [
1441
+ {
1442
+ "include": "#flowtype-keywords"
1443
+ },
1444
+ {
1445
+ "include": "#literal-method"
1446
+ },
1447
+ {
1448
+ "include": "#brackets"
1449
+ },
1450
+ {
1451
+ "include": "#es7-decorators"
1452
+ },
1453
+ {
1454
+ "include": "#comments"
1455
+ },
1456
+ {
1457
+ "comment": "a line starts with a static, [, name( or a semi-colon anywhere",
1458
+ "begin": "\\s*+(?==[^=>])",
1459
+ "end": "(^\\s*+(?=([$\\w]*\\s*+\\??\\s*+(:|=(?!^==|=>))|\\[|[$\\w]\\s*+\\(|\\bstatic\\b|\\s*++)))|\\s*(;)",
1460
+ "endCaptures": {
1461
+ "4": {
1462
+ "name": "punctuation.terminator.statement.js"
1463
+ }
1464
+ },
1465
+ "patterns": [
1466
+ {
1467
+ "include": "#expression"
1468
+ }
1469
+ ]
1470
+ },
1471
+ {
1472
+ "match": "\\s*+\\b(?<!\\.)static\\b(?!\\.)",
1473
+ "name": "storage.modifier.js"
1474
+ },
1475
+ {
1476
+ "include": "#flowtype-variable"
1477
+ },
1478
+ {
1479
+ "include": "#literal-semi-colon"
1480
+ }
1481
+ ]
1482
+ },
1497
1483
  "literal-method-call": {
1498
1484
  "patterns": [
1499
1485
  {
@@ -1517,8 +1503,10 @@
1517
1503
  },
1518
1504
  {
1519
1505
  "name": "meta.function-call.static.with-arguments.js",
1520
- "match": "\\s*+(?:(?<=\\.)|\\b)\\s*+([A-Z][$\\w]*)\\s*+(\\.)([_$a-zA-Z][$\\w]*)\\s*+(?=\\()",
1521
- "captures": {
1506
+ "begin": "\\s*+(?:(?<=\\.)|\\b)\\s*+([A-Z][$\\w]*)\\s*+(\\.)([_$a-zA-Z][$\\w]*)\\s*+(?=\\()",
1507
+ "end": "(?=.)",
1508
+ "applyEndPatternLast": 1,
1509
+ "beginCaptures": {
1522
1510
  "1": {
1523
1511
  "name": "variable.other.class.js"
1524
1512
  },
@@ -1528,7 +1516,12 @@
1528
1516
  "3": {
1529
1517
  "name": "entity.name.function.js"
1530
1518
  }
1531
- }
1519
+ },
1520
+ "patterns": [
1521
+ {
1522
+ "include": "#round-brackets"
1523
+ }
1524
+ ]
1532
1525
  },
1533
1526
  {
1534
1527
  "name": "meta.function-call.method.without-arguments.js",
@@ -1544,12 +1537,19 @@
1544
1537
  },
1545
1538
  {
1546
1539
  "name": "meta.function-call.method.with-arguments.js",
1547
- "match": "\\s*+(?<=\\.)([_$a-zA-Z][$\\w]*)\\s*+(?=\\()",
1548
- "captures": {
1540
+ "begin": "\\s*+(?<=\\.)([_$a-zA-Z][$\\w]*)\\s*+(?=\\()",
1541
+ "end": "(?=.)",
1542
+ "applyEndPatternLast": 1,
1543
+ "beginCaptures": {
1549
1544
  "1": {
1550
1545
  "name": "entity.name.function.js"
1551
1546
  }
1552
- }
1547
+ },
1548
+ "patterns": [
1549
+ {
1550
+ "include": "#round-brackets"
1551
+ }
1552
+ ]
1553
1553
  }
1554
1554
  ]
1555
1555
  },
@@ -1658,7 +1658,7 @@
1658
1658
  {
1659
1659
  "comment": "e.g. (args) => { }",
1660
1660
  "name": "meta.function.arrow.js",
1661
- "begin": "\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1661
+ "begin": "\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
1662
1662
  "end": "\\s*(=>)",
1663
1663
  "applyEndPatternLast": 1,
1664
1664
  "endCaptures": {
@@ -1680,31 +1680,23 @@
1680
1680
  {
1681
1681
  "comment": "e.g. arg => { }",
1682
1682
  "name": "meta.function.arrow.js",
1683
- "begin": "\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1684
- "end": "\\s*(=>)",
1685
- "beginCaptures": {
1683
+ "match": "\\s*+(\\basync\\b)?\\s*+([_$a-zA-Z][$\\w]*)\\s*(=>)",
1684
+ "captures": {
1686
1685
  "1": {
1687
1686
  "name": "storage.type.js"
1688
- }
1689
- },
1690
- "endCaptures": {
1691
- "1": {
1692
- "name": "storage.type.function.arrow.js"
1693
- }
1694
- },
1695
- "patterns": [
1696
- {
1697
- "include": "#flowtype-polymorphs"
1698
1687
  },
1699
- {
1700
- "include": "#flowtype-variable"
1688
+ "2": {
1689
+ "name": "variable.other.readwrite.js"
1690
+ },
1691
+ "3": {
1692
+ "name": "storage.type.function.arrow.js"
1701
1693
  }
1702
- ]
1694
+ }
1703
1695
  },
1704
1696
  {
1705
1697
  "comment": "e.g. play = (args) => { }",
1706
1698
  "name": "meta.function.arrow.js",
1707
- "begin": "\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1699
+ "begin": "\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
1708
1700
  "end": "\\s*(=>)",
1709
1701
  "applyEndPatternLast": 1,
1710
1702
  "beginCaptures": {
@@ -1732,9 +1724,8 @@
1732
1724
  {
1733
1725
  "comment": "e.g. play = arg => { }",
1734
1726
  "name": "meta.function.arrow.js",
1735
- "begin": "\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1736
- "end": "\\s*(=>)",
1737
- "beginCaptures": {
1727
+ "match": "\\s*+(\\b[_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+\\s*+(\\basync\\b)?\\s*+([_$a-zA-Z][$\\w]*)\\s*(=>)",
1728
+ "captures": {
1738
1729
  "1": {
1739
1730
  "name": "entity.name.function.js"
1740
1731
  },
@@ -1743,26 +1734,19 @@
1743
1734
  },
1744
1735
  "3": {
1745
1736
  "name": "storage.type.js"
1746
- }
1747
- },
1748
- "endCaptures": {
1749
- "1": {
1750
- "name": "storage.type.function.arrow.js"
1751
- }
1752
- },
1753
- "patterns": [
1754
- {
1755
- "include": "#flowtype-polymorphs"
1756
1737
  },
1757
- {
1758
- "include": "#flowtype-variable"
1738
+ "4": {
1739
+ "name": "variable.other.readwrite.js"
1740
+ },
1741
+ "5": {
1742
+ "name": "storage.type.function.arrow.js"
1759
1743
  }
1760
- ]
1744
+ }
1761
1745
  },
1762
1746
  {
1763
1747
  "comment": "Sound.prototype.play = (args) => { }",
1764
1748
  "name": "meta.prototype.function.arrow.js",
1765
- "begin": "\\s*+(\\b[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1749
+ "begin": "\\s*+(\\b[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
1766
1750
  "end": "\\s*(=>)",
1767
1751
  "applyEndPatternLast": 1,
1768
1752
  "beginCaptures": {
@@ -1802,9 +1786,8 @@
1802
1786
  {
1803
1787
  "comment": "e.g. Sound.prototype.play = arg => { }",
1804
1788
  "name": "meta.prototype.function.arrow.js",
1805
- "begin": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1806
- "end": "\\s*(=>)",
1807
- "beginCaptures": {
1789
+ "match": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+([_$a-zA-Z][$\\w]*)\\s*(=>)",
1790
+ "captures": {
1808
1791
  "1": {
1809
1792
  "name": "entity.name.class.js"
1810
1793
  },
@@ -1825,26 +1808,19 @@
1825
1808
  },
1826
1809
  "7": {
1827
1810
  "name": "storage.type.js"
1828
- }
1829
- },
1830
- "endCaptures": {
1831
- "1": {
1832
- "name": "storage.type.function.arrow.js"
1833
- }
1834
- },
1835
- "patterns": [
1836
- {
1837
- "include": "#flowtype-polymorphs"
1838
1811
  },
1839
- {
1840
- "include": "#flowtype-variable"
1812
+ "8": {
1813
+ "name": "variable.other.readwrite.js"
1814
+ },
1815
+ "9": {
1816
+ "name": "storage.type.function.arrow.js"
1841
1817
  }
1842
- ]
1818
+ }
1843
1819
  },
1844
1820
  {
1845
1821
  "comment": "e.g. Sound.play = (args) => { }",
1846
1822
  "name": "meta.function.static.arrow.js",
1847
- "begin": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1823
+ "begin": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*=>)",
1848
1824
  "end": "\\s*(=>)",
1849
1825
  "applyEndPatternLast": 1,
1850
1826
  "beginCaptures": {
@@ -1878,9 +1854,8 @@
1878
1854
  {
1879
1855
  "comment": "e.g. Sound.play = arg => { }",
1880
1856
  "name": "meta.function.static.arrow.js",
1881
- "begin": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+([_$a-zA-Z][$\\w]*)\\s*+(?:\\s*+(:|\\|)(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\")))|\\s*+[x0-9A-Fa-f]+))*\\s*+=>)",
1882
- "end": "\\s*(=>)",
1883
- "beginCaptures": {
1857
+ "match": "\\s*+(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*+(=)\\s*+(\\basync\\b)?\\s*+([_$a-zA-Z][$\\w]*)\\s*(=>)",
1858
+ "captures": {
1884
1859
  "1": {
1885
1860
  "name": "entity.name.class.js"
1886
1861
  },
@@ -1895,30 +1870,24 @@
1895
1870
  },
1896
1871
  "5": {
1897
1872
  "name": "storage.type.js"
1898
- }
1899
- },
1900
- "endCaptures": {
1901
- "1": {
1902
- "name": "storage.type.function.arrow.js"
1903
- }
1904
- },
1905
- "patterns": [
1906
- {
1907
- "include": "#flowtype-polymorphs"
1908
1873
  },
1909
- {
1910
- "include": "#flowtype-variable"
1874
+ "6": {
1875
+ "name": "variable.other.readwrite.js"
1876
+ },
1877
+ "7": {
1878
+ "name": "storage.type.function.arrow.js"
1911
1879
  }
1912
- ]
1880
+ }
1913
1881
  }
1914
1882
  ]
1915
1883
  },
1916
- "literal-method": {
1884
+ "literal-method-alternate": {
1885
+ "comment": "it assumes methods start on a new line/statement and have a open brace on the same line",
1917
1886
  "patterns": [
1918
1887
  {
1919
1888
  "comment": "e.g. play<T,T>(arg1, arg2): Type<T> { }",
1920
1889
  "name": "meta.function.method.js",
1921
- "begin": "\\s*+(\\bstatic\\b)?\\s*+(\\basync\\b)?\\s*+(\\*?)\\s*+(?<!\\.)([_$a-zA-Z][$\\w]*)\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?(\\())",
1890
+ "begin": "(?:^|;)\\s*+(\\bstatic\\b)?\\s*+(\\basync\\b)?\\s*+(\\*?)\\s*+(?<!\\.)(?!\\b(break|case|catch|continue|do|else|finally|for|function|if|export|import|package|return|switch|throw|try|while|with)\\b)([_$a-zA-Z][$\\w]*)\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*+(?:\\s*:(\\s*+(&|\\|)?(\\s*+[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*+(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*+(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(\\s*([\"']).*?\\k<-1>(?<!\\\\.))|\\s*[x0-9A-Fa-f]+))*+)*\\s*\\{)",
1922
1891
  "end": "\\s*(?=.)",
1923
1892
  "applyEndPatternLast": 1,
1924
1893
  "beginCaptures": {
@@ -1931,7 +1900,7 @@
1931
1900
  "3": {
1932
1901
  "name": "keyword.generator.asterisk.js"
1933
1902
  },
1934
- "4": {
1903
+ "5": {
1935
1904
  "name": "entity.name.function.method.js"
1936
1905
  }
1937
1906
  },
@@ -1940,11 +1909,15 @@
1940
1909
  "include": "#flowtype"
1941
1910
  }
1942
1911
  ]
1943
- },
1944
- {
1945
- "comment": "e.g. [var]<T,T>(arg1, arg2): Type<T> { } or 'var'<T,T>(arg1, arg2)",
1946
- "name": "meta.function.method.js",
1947
- "begin": "\\s*+(\\bstatic\\b)?\\s*+(\\basync\\b)?\\s*+(\\*?)\\s*+(?=((\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*+(((')((?:[^']|\\\\')*)('))|\\s*+((\")((?:[^\"]|\\\\\")*)(\"))))\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\())",
1912
+ }
1913
+ ]
1914
+ },
1915
+ "literal-method": {
1916
+ "patterns": [
1917
+ {
1918
+ "comment": "e.g. play<T,T>(arg1, arg2): Type<T> { }",
1919
+ "name": "meta.function.method.js",
1920
+ "begin": "(?<!:)\\s*+(\\bstatic\\b)?\\s*+(\\basync\\b)?\\s*+(\\*?)\\s*+(?<!\\.)([_$a-zA-Z][$\\w]*)\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?(\\())",
1948
1921
  "end": "\\s*(?=.)",
1949
1922
  "applyEndPatternLast": 1,
1950
1923
  "beginCaptures": {
@@ -1959,20 +1932,66 @@
1959
1932
  },
1960
1933
  "4": {
1961
1934
  "name": "entity.name.function.method.js"
1935
+ }
1936
+ },
1937
+ "patterns": [
1938
+ {
1939
+ "include": "#flowtype"
1940
+ }
1941
+ ]
1942
+ },
1943
+ {
1944
+ "comment": "e.g. 'play'<T,T>(arg1, arg2): Type<T> { }",
1945
+ "name": "meta.function.method.js",
1946
+ "begin": "(?<!:)\\s*+(\\bstatic\\b)?\\s*+(\\basync\\b)?\\s*+(\\*?)\\s*+(?<!\\.)(('|\\\")([^\"']*)(\\k<-3>))\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?(\\())",
1947
+ "end": "\\s*(?=.)",
1948
+ "applyEndPatternLast": 1,
1949
+ "beginCaptures": {
1950
+ "1": {
1951
+ "name": "storage.modifier.js"
1962
1952
  },
1963
- "6": {
1953
+ "2": {
1954
+ "name": "storage.type.js"
1955
+ },
1956
+ "3": {
1957
+ "name": "keyword.generator.asterisk.js"
1958
+ },
1959
+ "4": {
1964
1960
  "name": "entity.name.function.method.js"
1965
1961
  }
1966
1962
  },
1967
1963
  "patterns": [
1968
1964
  {
1969
- "include": "#flowtype-parse-array"
1965
+ "include": "#flowtype"
1966
+ }
1967
+ ]
1968
+ },
1969
+ {
1970
+ "comment": "e.g. [var]<T,T>(arg1, arg2): Type<T> { } or 'var'<T,T>(arg1, arg2)",
1971
+ "name": "meta.function.method.js",
1972
+ "begin": "(?<!:)\\s*+(\\bstatic\\b)?\\s*+(\\basync\\b)?\\s*+(\\*?)\\s*+(?=((\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\]))\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\())",
1973
+ "end": "\\s*(?=.)",
1974
+ "applyEndPatternLast": 1,
1975
+ "beginCaptures": {
1976
+ "1": {
1977
+ "name": "storage.modifier.js"
1970
1978
  },
1971
- {
1972
- "include": "#literal-string"
1979
+ "2": {
1980
+ "name": "storage.type.js"
1973
1981
  },
1982
+ "3": {
1983
+ "name": "keyword.generator.asterisk.js"
1984
+ },
1985
+ "4": {
1986
+ "name": "entity.name.function.method.js"
1987
+ }
1988
+ },
1989
+ "patterns": [
1974
1990
  {
1975
1991
  "include": "#flowtype"
1992
+ },
1993
+ {
1994
+ "include": "#square-brackets"
1976
1995
  }
1977
1996
  ]
1978
1997
  },
@@ -1984,7 +2003,7 @@
1984
2003
  "applyEndPatternLast": 1,
1985
2004
  "beginCaptures": {
1986
2005
  "1": {
1987
- "name": "storage.modifier.static.js"
2006
+ "name": "storage.modifier.js"
1988
2007
  },
1989
2008
  "2": {
1990
2009
  "name": "storage.type.accessor.js"
@@ -2007,7 +2026,7 @@
2007
2026
  "applyEndPatternLast": 1,
2008
2027
  "beginCaptures": {
2009
2028
  "1": {
2010
- "name": "storage.modifier.static.js"
2029
+ "name": "storage.modifier.js"
2011
2030
  },
2012
2031
  "2": {
2013
2032
  "name": "storage.type.accessor.js"
@@ -2122,12 +2141,202 @@
2122
2141
  "literal-module": {
2123
2142
  "patterns": [
2124
2143
  {
2125
- "name": "keyword.control.module.js",
2126
- "match": "\\s*+(?<!\\.)\\b(import|export|default)\\b"
2144
+ "include": "#literal-module-import"
2145
+ },
2146
+ {
2147
+ "include": "#literal-module-export"
2148
+ }
2149
+ ]
2150
+ },
2151
+ "literal-module-import": {
2152
+ "begin": "\\s*+(?<!\\.)\\b(import)(?!\\s*:)\\b",
2153
+ "end": "\\s*(?:(?:(\\bfrom\\b)?+\\s++(('|\\\")([^\\\"']*)(\\k<-3>)))|(?=\\;|^\\s*\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|}))",
2154
+ "beginCaptures": {
2155
+ "1": {
2156
+ "name": "keyword.control.module.js"
2157
+ }
2158
+ },
2159
+ "endCaptures": {
2160
+ "1": {
2161
+ "name": "keyword.control.module.js"
2162
+ },
2163
+ "3": {
2164
+ "name": "punctuation.definition.string.begin.js"
2165
+ },
2166
+ "4": {
2167
+ "name": "string.quoted.module.js"
2168
+ },
2169
+ "5": {
2170
+ "name": "punctuation.definition.string.begin.js"
2171
+ }
2172
+ },
2173
+ "patterns": [
2174
+ {
2175
+ "match": "\\s*\\b(default)\\b",
2176
+ "captures": {
2177
+ "1": {
2178
+ "name": "keyword.control.module.js"
2179
+ }
2180
+ }
2181
+ },
2182
+ {
2183
+ "match": "\\s*\\b(typeof|type)\\b\\s++(?=\\{|[$_a-zA-Z])(?!\\b(instanceof|in|as)\\b|,)",
2184
+ "captures": {
2185
+ "1": {
2186
+ "name": "keyword.other.typedef.flowtype"
2187
+ }
2188
+ }
2189
+ },
2190
+ {
2191
+ "name": "keyword.operator.module.all.js",
2192
+ "match": "\\*"
2193
+ },
2194
+ {
2195
+ "include": "#literal-module-as"
2196
+ },
2197
+ {
2198
+ "include": "#literal-module-brackets"
2199
+ },
2200
+ {
2201
+ "include": "#literal-variable"
2202
+ },
2203
+ {
2204
+ "include": "#comments"
2205
+ },
2206
+ {
2207
+ "include": "#literal-comma"
2208
+ }
2209
+ ]
2210
+ },
2211
+ "literal-module-export": {
2212
+ "patterns": [
2213
+ {
2214
+ "comment": "e.g. export let variable =, export type a=",
2215
+ "match": "\\s*+(?<!\\.)\\b(export)(?!\\s*:)\\b(?=\\s++(let|type|typeof)\\s++[$_a-zA-Z])",
2216
+ "captures": {
2217
+ "1": {
2218
+ "name": "keyword.control.module.js"
2219
+ }
2220
+ }
2221
+ },
2222
+ {
2223
+ "comment": "export { or export * or export var from module",
2224
+ "begin": "\\s*+(?<!\\.)\\b(export)\\b(?=\\s++({|\\*|[$_a-zA-Z][$_\\w]*(\\s++from\\b|\\s*,)))",
2225
+ "end": "\\s*(?:(?:(\\bfrom\\b)?+\\s++(('|\\\")([^\\\"']*)(\\k<-3>)))|(?=\\;|^\\s*\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b|\\)|}))",
2226
+ "beginCaptures": {
2227
+ "1": {
2228
+ "name": "keyword.control.module.js"
2229
+ }
2230
+ },
2231
+ "endCaptures": {
2232
+ "1": {
2233
+ "name": "keyword.control.module.js"
2234
+ },
2235
+ "3": {
2236
+ "name": "punctuation.definition.string.begin.js"
2237
+ },
2238
+ "4": {
2239
+ "name": "string.quoted.module.js"
2240
+ },
2241
+ "5": {
2242
+ "name": "punctuation.definition.string.begin.js"
2243
+ }
2244
+ },
2245
+ "patterns": [
2246
+ {
2247
+ "name": "keyword.operator.module.all.js",
2248
+ "match": "\\*"
2249
+ },
2250
+ {
2251
+ "include": "#literal-module-as"
2252
+ },
2253
+ {
2254
+ "include": "#literal-module-brackets"
2255
+ },
2256
+ {
2257
+ "include": "#literal-variable"
2258
+ },
2259
+ {
2260
+ "include": "#comments"
2261
+ },
2262
+ {
2263
+ "include": "#literal-comma"
2264
+ }
2265
+ ]
2266
+ },
2267
+ {
2268
+ "comment": "trap expressions among - export function* () {}",
2269
+ "match": "\\s*+(?<!\\.)\\b(export|default)(?!\\s*:)\\b",
2270
+ "captures": {
2271
+ "1": {
2272
+ "name": "keyword.control.module.js"
2273
+ }
2274
+ }
2275
+ }
2276
+ ]
2277
+ },
2278
+ "literal-module-as": {
2279
+ "match": "\\s*+(?:(\\*)|([$_a-zA-Z][$_\\w]*))\\s++(\\bas\\b)\\s++(?:(\\bdefault\\b)|([$_a-zA-Z][$_\\w]*))",
2280
+ "captures": {
2281
+ "1": {
2282
+ "name": "keyword.operator.module.all.js"
2283
+ },
2284
+ "2": {
2285
+ "name": "variable.other.readwrite.js"
2286
+ },
2287
+ "3": {
2288
+ "name": "keyword.control.module.reference.js"
2127
2289
  },
2290
+ "4": {
2291
+ "name": "keyword.control.module.js"
2292
+ },
2293
+ "5": {
2294
+ "name": "variable.other.readwrite.js"
2295
+ }
2296
+ }
2297
+ },
2298
+ "literal-module-brackets": {
2299
+ "patterns": [
2128
2300
  {
2129
- "name": "keyword.control.module.reference.js",
2130
- "match": "\\s*+(?<!\\.)\\b(from|as)\\b"
2301
+ "begin": "\\s*+(?:(\\{)|(\\[))",
2302
+ "end": "\\s*(?:(\\})|(\\]))",
2303
+ "beginCaptures": {
2304
+ "1": {
2305
+ "name": "meta.brace.curly.js"
2306
+ },
2307
+ "2": {
2308
+ "name": "meta.brace.square.js"
2309
+ }
2310
+ },
2311
+ "endCaptures": {
2312
+ "1": {
2313
+ "name": "meta.brace.curly.js"
2314
+ },
2315
+ "2": {
2316
+ "name": "meta.brace.square.js"
2317
+ }
2318
+ },
2319
+ "patterns": [
2320
+ {
2321
+ "name": "keyword.operator.module.all.js",
2322
+ "match": "\\*"
2323
+ },
2324
+ {
2325
+ "include": "#literal-module-as"
2326
+ },
2327
+ {
2328
+ "include": "#literal-module-brackets"
2329
+ },
2330
+ {
2331
+ "include": "#literal-variable"
2332
+ },
2333
+ {
2334
+ "include": "#literal-string"
2335
+ },
2336
+ {
2337
+ "include": "#literal-comma"
2338
+ }
2339
+ ]
2131
2340
  }
2132
2341
  ]
2133
2342
  },
@@ -2526,6 +2735,18 @@
2526
2735
  },
2527
2736
  "flowtype-variable": {
2528
2737
  "patterns": [
2738
+ {
2739
+ "comment": "e.g. let a: ()=>null = function() {return null}",
2740
+ "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)\\s*+(\\??)\\s*+(?=:\\s*(\\bFunction\\b|(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*=>|\\(\\s*$))",
2741
+ "captures": {
2742
+ "1": {
2743
+ "name": "storage.type.function.js"
2744
+ },
2745
+ "2": {
2746
+ "name": "keyword.operator.optional.parameter.flowtype"
2747
+ }
2748
+ }
2749
+ },
2529
2750
  {
2530
2751
  "comment": "name of variable spread var with optional ? and optional flowtype :",
2531
2752
  "match": "\\s*+((?<!\\.)\\.\\.\\.)?([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)\\s*+(\\??)\\s*+(?=:|=>)",
@@ -2546,118 +2767,71 @@
2546
2767
  }
2547
2768
  ]
2548
2769
  },
2549
- "flowtype-destruct-lhs": {
2550
- "comment": "use this pattern to colour code the variable part correctly",
2770
+ "flowtype-vars-and-props": {
2551
2771
  "patterns": [
2552
2772
  {
2553
- "begin": "\\s*+{",
2554
- "end": "\\s*}",
2773
+ "comment": "flowtype optional arg/parameter e.g. protocol? : string",
2774
+ "name": "punctuation.type.flowtype",
2775
+ "match": "\\s*+\\?"
2776
+ },
2777
+ {
2778
+ "comment": "Type Unions |",
2779
+ "name": "kewyword.operator.union.flowtype",
2780
+ "match": "\\s*+\\|"
2781
+ },
2782
+ {
2783
+ "comment": "intersection of types &",
2784
+ "name": "kewyword.operator.intersection.flowtype",
2785
+ "match": "\\s*+\\&"
2786
+ },
2787
+ {
2788
+ "comment": "typed entity :",
2789
+ "begin": "\\s*+(:)",
2790
+ "end": "(?=.)",
2791
+ "applyEndPatternLast": 1,
2792
+ "beginCaptures": {
2793
+ "1": {
2794
+ "name": "punctuation.type.flowtype"
2795
+ }
2796
+ },
2555
2797
  "patterns": [
2556
2798
  {
2557
- "include": "#flowtype-destruct-lhs"
2799
+ "include": "#flowtype-parse-types"
2558
2800
  }
2559
2801
  ]
2560
2802
  },
2561
2803
  {
2562
- "begin": "\\s*+\\[",
2563
- "end": "\\s*\\]",
2804
+ "include": "#literal-comma"
2805
+ },
2806
+ {
2807
+ "comment": "An Iterator prefix?",
2808
+ "match": "\\s*+@@"
2809
+ },
2810
+ {
2811
+ "begin": "\\s*+(=>)",
2812
+ "end": "(?=.)",
2813
+ "applyEndPatternLast": 1,
2814
+ "beginCaptures": {
2815
+ "1": {
2816
+ "name": "storage.type.function.arrow.js"
2817
+ }
2818
+ },
2564
2819
  "patterns": [
2565
2820
  {
2566
- "include": "#flowtype-destruct-lhs"
2821
+ "include": "#flowtype-parse-types"
2567
2822
  }
2568
2823
  ]
2569
2824
  },
2570
2825
  {
2571
- "comment": "string as destructor target",
2572
- "match": "\\s*+((['\\\"]).*?\\k<-1>(?<!\\\\.))\\s*+(:)\\s*+(([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+))",
2573
- "captures": {
2574
- "1": {
2575
- "name": "string.quoted.js"
2576
- },
2577
- "3": {
2578
- "name": "punctuation"
2579
- },
2580
- "4": {
2581
- "name": "variable.other.property.js"
2582
- }
2583
- }
2584
- },
2585
- {
2586
- "comment": "prop name : var name as destructor target",
2587
- "match": "\\s*+([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)\\s*+(:)\\s*+(([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+))",
2588
- "captures": {
2589
- "1": {
2590
- "name": "string.unquoted.js"
2591
- },
2592
- "2": {
2593
- "name": "punctuation"
2594
- },
2595
- "3": {
2596
- "name": "variable.other.property.js"
2597
- }
2598
- }
2599
- },
2600
- {
2601
- "comment": "var name as destructor target",
2602
- "match": "\\s*+((?<!\\.)\\.\\.\\.)?([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
2603
- "captures": {
2604
- "1": {
2605
- "name": "keyword.operator.spread.js"
2606
- },
2607
- "2": {
2608
- "name": "variable.other.property.js"
2609
- }
2610
- }
2611
- },
2612
- {
2613
- "include": "#literal-comma"
2614
- },
2615
- {
2616
- "include": "#flowtype-vars-and-props"
2617
- }
2618
- ]
2619
- },
2620
- "flowtype-vars-and-props": {
2621
- "patterns": [
2622
- {
2623
- "comment": "flowtype optional arg/parameter e.g. protocol? : string",
2624
- "name": "punctuation.type.flowtype",
2625
- "match": "\\s*+\\?"
2626
- },
2627
- {
2628
- "comment": "typed entity :",
2629
- "begin": "\\s*+(:)",
2630
- "end": "(?=.)",
2631
- "applyEndPatternLast": 1,
2632
- "beginCaptures": {
2633
- "1": {
2634
- "name": "punctuation.type.flowtype"
2635
- }
2636
- },
2826
+ "comment": "assignment var = or = ",
2827
+ "begin": "\\s*+(?=([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)?\\s*=)(?!=>|==)",
2828
+ "end": "\\s*(?=,|;|\\)|}|\\]|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield)\\b|type\\s+[$\\w]+|declare\\s+[$\\w]+|interface\\s+[$\\w]+)",
2637
2829
  "patterns": [
2638
2830
  {
2639
- "include": "#flowtype-parse-types"
2831
+ "include": "#expression"
2640
2832
  }
2641
2833
  ]
2642
2834
  },
2643
- {
2644
- "include": "#literal-object"
2645
- },
2646
- {
2647
- "include": "#literal-comma"
2648
- },
2649
- {
2650
- "comment": "An Iterator prefix?",
2651
- "match": "\\s*+@@"
2652
- },
2653
- {
2654
- "match": "\\s*+(=>)",
2655
- "captures": {
2656
- "1": {
2657
- "name": "storage.type.function.arrow.js"
2658
- }
2659
- }
2660
- },
2661
2835
  {
2662
2836
  "include": "#flowtype-bracketed-parameters"
2663
2837
  },
@@ -2669,47 +2843,6 @@
2669
2843
  }
2670
2844
  ]
2671
2845
  },
2672
- "flowtype-parse-operators": {
2673
- "patterns": [
2674
- {
2675
- "comment": "call back with a form ) => type",
2676
- "begin": "(?<=\\))\\s*+(=>)",
2677
- "end": "(?=.)",
2678
- "applyEndPatternLast": 1,
2679
- "beginCaptures": {
2680
- "1": {
2681
- "name": "storage.type.function.arrow.js"
2682
- }
2683
- },
2684
- "patterns": [
2685
- {
2686
- "include": "#flowtype-parse-types"
2687
- }
2688
- ]
2689
- },
2690
- {
2691
- "include": "#literal-object"
2692
- },
2693
- {
2694
- "comment": "some form of default assignment for func args",
2695
- "begin": "\\s*+=(?!>|=|==)",
2696
- "end": "\\s*(?=,|;|\\)|}|\\]|\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare)\\b)",
2697
- "beginCaptures": {
2698
- "0": {
2699
- "name": "keyword.operator.assignment.js"
2700
- }
2701
- },
2702
- "patterns": [
2703
- {
2704
- "include": "#literal-labels"
2705
- },
2706
- {
2707
- "include": "#expression"
2708
- }
2709
- ]
2710
- }
2711
- ]
2712
- },
2713
2846
  "flowtype-parse-types": {
2714
2847
  "patterns": [
2715
2848
  {
@@ -2753,7 +2886,7 @@
2753
2886
  },
2754
2887
  {
2755
2888
  "comment": "custom primitive/var Types e.g. abc avoid abc(",
2756
- "match": "(?!^)\\s*+(?!\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare)\\b)([$_\\p{L}][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*+)(?!\\s*+\\()",
2889
+ "match": "(?!^)\\s*+(?!\\b(if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b)([$_\\p{L}][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*+)(?!\\s*+\\()",
2757
2890
  "captures": {
2758
2891
  "2": {
2759
2892
  "name": "support.type.primitive.flowtype"
@@ -2775,6 +2908,20 @@
2775
2908
  "name": "kewyword.operator.existential.flowtype",
2776
2909
  "match": "\\s*+\\*"
2777
2910
  },
2911
+ {
2912
+ "comment": "types of type marker e.g. <T: number | string>",
2913
+ "name": "punctuation.type.flowtype",
2914
+ "match": "\\s*+(:)"
2915
+ },
2916
+ {
2917
+ "comment": "call back with a form ) => type",
2918
+ "match": "(?<=\\))\\s*+(=>)",
2919
+ "captures": {
2920
+ "1": {
2921
+ "name": "storage.type.function.arrow.js"
2922
+ }
2923
+ }
2924
+ },
2778
2925
  {
2779
2926
  "include": "#literal-string"
2780
2927
  },
@@ -2787,9 +2934,6 @@
2787
2934
  {
2788
2935
  "include": "#flowtype-parse-objects"
2789
2936
  },
2790
- {
2791
- "include": "#flowtype-parse-operators"
2792
- },
2793
2937
  {
2794
2938
  "include": "#flowtype-parse-array"
2795
2939
  },
@@ -2802,7 +2946,7 @@
2802
2946
  "patterns": [
2803
2947
  {
2804
2948
  "comment": "Get parameters within a function/method call",
2805
- "begin": "\\s*+(\\()",
2949
+ "begin": "(?<!=)\\s*+(\\()",
2806
2950
  "end": "\\s*(\\))",
2807
2951
  "beginCaptures": {
2808
2952
  "1": {
@@ -2844,12 +2988,7 @@
2844
2988
  },
2845
2989
  "patterns": [
2846
2990
  {
2847
- "match": "\\s*+(,|:)",
2848
- "captures": {
2849
- "1": {
2850
- "name": "punctuation.type.separator.flowtype"
2851
- }
2852
- }
2991
+ "include": "#literal-comma"
2853
2992
  },
2854
2993
  {
2855
2994
  "match": "\\s*+(\\+|-)",
@@ -2880,12 +3019,7 @@
2880
3019
  },
2881
3020
  "patterns": [
2882
3021
  {
2883
- "match": "\\s*+(,|:)",
2884
- "captures": {
2885
- "1": {
2886
- "name": "punctuation.type.separator.flowtype"
2887
- }
2888
- }
3022
+ "include": "#literal-comma"
2889
3023
  },
2890
3024
  {
2891
3025
  "match": "\\s*+(\\+|-)",
@@ -2903,8 +3037,8 @@
2903
3037
  ]
2904
3038
  },
2905
3039
  "flowtype-parse-objects": {
2906
- "comment": "object literal flowtype preceded by either : | & ? symbols",
2907
- "begin": "(?<=:|\\||&|\\?)\\s*+(\\{)",
3040
+ "comment": "object literal flowtype preceded by either => : | & ? symbols",
3041
+ "begin": "(?<=:|\\||&|\\?|=>|<)\\s*+(\\{)",
2908
3042
  "end": "\\s*(\\})",
2909
3043
  "applyEndPatternLast": 1,
2910
3044
  "beginCaptures": {
@@ -2944,7 +3078,7 @@
2944
3078
  },
2945
3079
  "flowtype-parse-array": {
2946
3080
  "comment": "arrays such as [name: string, dob: Date]",
2947
- "begin": "\\s*+(\\[)",
3081
+ "begin": "(?<!=|[$_A-Za-z0-9])\\s*+(\\[)",
2948
3082
  "end": "\\s*(\\])",
2949
3083
  "beginCaptures": {
2950
3084
  "1": {
@@ -2964,25 +3098,13 @@
2964
3098
  },
2965
3099
  "flowtype-type-aliases": {
2966
3100
  "patterns": [
2967
- {
2968
- "comment": "import for types",
2969
- "match": "\\s*+(?<!\\.)\\b(import)\\b\\s*+(type)\\b",
2970
- "captures": {
2971
- "1": {
2972
- "name": "keyword.control.module.js"
2973
- },
2974
- "2": {
2975
- "name": "support.type.type.flowtype"
2976
- }
2977
- }
2978
- },
2979
3101
  {
2980
3102
  "comment": "type aliases for export but avoid type instaceof or type in operators",
2981
- "begin": "\\s*+\\b(type)\\b\\s+(?!(instanceof|in)\\b)(?=[$_\\p{L}])",
2982
- "end": "\\s*(\\;|\\n|\\b(?=if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare)\\b)",
3103
+ "begin": "\\s*+\\b(type)\\b\\s*(?!(instanceof|in)\\b)(?=[$_A-Za-z{\\[])",
3104
+ "end": "\\s*(\\;)|\\b(?=if|switch|try|var|let|const|static|function|return|class|do|for|while|debugger|export|import|yield|type|declare|interface)\\b",
2983
3105
  "beginCaptures": {
2984
3106
  "1": {
2985
- "name": "support.type.type.flowtype"
3107
+ "name": "keyword.other.typedef.flowtype"
2986
3108
  }
2987
3109
  },
2988
3110
  "endCaptures": {
@@ -3040,232 +3162,250 @@
3040
3162
  ]
3041
3163
  },
3042
3164
  "flowtype-interface": {
3165
+ "begin": "\\s*+(?<!\\.)\\b(interface)\\s++",
3166
+ "end": "\\s*(?<=})",
3167
+ "beginCaptures": {
3168
+ "1": {
3169
+ "name": "keyword.other.interface.flowtype"
3170
+ }
3171
+ },
3043
3172
  "patterns": [
3044
3173
  {
3045
- "comment": "find declare module and declare class defs",
3046
- "begin": "\\s*+\\b(interface)\\s+(?=[$_\\p{L}])",
3047
- "end": "\\s*(?:(;)|\\n|(}))",
3048
- "applyEndPatternLast": 1,
3174
+ "comment": "look for interface names but dont assume uppercase start char",
3175
+ "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3176
+ "name": "support.type.class.interface.js"
3177
+ },
3178
+ {
3179
+ "include": "#flowtype-polymorphs"
3180
+ },
3181
+ {
3182
+ "begin": "\\s*+{",
3183
+ "end": "\\s*(})",
3184
+ "contentName": "meta.class.body.js",
3049
3185
  "beginCaptures": {
3050
- "1": {
3051
- "name": "support.type.interface.flowtype"
3186
+ "0": {
3187
+ "name": "punctuation.section.class.begin.js"
3052
3188
  }
3053
3189
  },
3054
3190
  "endCaptures": {
3055
3191
  "1": {
3056
- "name": "punctuation.terminator.statement.js"
3057
- },
3058
- "2": {
3059
3192
  "name": "punctuation.section.class.end.js"
3060
3193
  }
3061
3194
  },
3062
3195
  "patterns": [
3063
3196
  {
3064
- "include": "#comments"
3197
+ "include": "#flowtype-literal-method"
3065
3198
  },
3066
3199
  {
3067
- "match": "\\s*+\\b(extends)\\b\\s*+",
3068
- "captures": {
3069
- "1": {
3070
- "name": "storage.type.extends.flowtype"
3071
- }
3072
- }
3073
- },
3074
- {
3075
- "include": "#flowtype"
3076
- },
3077
- {
3078
- "include": "#flowtype-interface-name"
3079
- },
3080
- {
3081
- "begin": "\\s*+{",
3082
- "end": "\\s*(?=})",
3083
- "contentName": "meta.class.body.js",
3084
- "beginCaptures": {
3085
- "0": {
3086
- "name": "punctuation.section.class.begin.js"
3087
- }
3088
- },
3089
- "patterns": [
3090
- {
3091
- "match": "\\s*+\\b(?<!\\.)static\\b(?!\\.)",
3092
- "name": "storage.modifier.js"
3093
- },
3094
- {
3095
- "include": "#flowtype"
3096
- },
3097
- {
3098
- "include": "#flowtype-variable"
3099
- },
3100
- {
3101
- "include": "#comments"
3102
- },
3103
- {
3104
- "include": "#flowtype-function-name"
3105
- }
3106
- ]
3200
+ "include": "#class-body"
3107
3201
  }
3108
3202
  ]
3109
3203
  }
3110
3204
  ]
3111
3205
  },
3112
- "flowtype-function-name": {
3113
- "match": "\\s*+(\\bstatic\\b)?\\s*+([$_\\p{L}][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*)?\\s*+(?!:)(?=\\(|<.*\\()",
3114
- "captures": {
3115
- "1": {
3116
- "name": "storage.modifier.static.js"
3117
- },
3118
- "2": {
3119
- "name": "entity.name.function.js"
3120
- }
3121
- }
3122
- },
3123
- "flowtype-class-name": {
3124
- "comment": "look for classes names but dont assume uppercase start char",
3125
- "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3126
- "name": "entity.name.class.js"
3127
- },
3128
- "flowtype-interface-name": {
3129
- "comment": "look for interface names but dont assume uppercase start char",
3130
- "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3131
- "name": "support.type.class.interface.js"
3132
- },
3133
3206
  "flowtype-declare": {
3134
3207
  "patterns": [
3135
3208
  {
3136
- "begin": "\\s*+\\b(declare)\\s+(?=(class|function|module|var))\\b",
3209
+ "match": "\\s*+(?<!\\.)\\b(declare)\\b\\s++(?=\\b(function|var|type|interface)\\s++)",
3210
+ "captures": {
3211
+ "1": {
3212
+ "name": "keyword.other.declare.flowtype"
3213
+ }
3214
+ }
3215
+ },
3216
+ {
3217
+ "comment": "declare module.exports:",
3218
+ "begin": "\\s*+(?<!\\.)\\b(declare)\\b\\s*+\\b(module)(.)(exports)(:)",
3137
3219
  "end": "(?=.)",
3138
3220
  "applyEndPatternLast": 1,
3139
3221
  "beginCaptures": {
3140
3222
  "1": {
3141
- "name": "support.type.declare.flowtype"
3223
+ "name": "keyword.other.declare.flowtype"
3224
+ },
3225
+ "2": {
3226
+ "name": "storage.type.module.flowtype"
3227
+ },
3228
+ "3": {
3229
+ "name": "keyword.operator.accessor.flowtype"
3230
+ },
3231
+ "4": {
3232
+ "name": "storage.type.module.flowtype"
3233
+ },
3234
+ "5": {
3235
+ "name": "punctuation.type.flowtype"
3236
+ }
3237
+ },
3238
+ "patterns": [
3239
+ {
3240
+ "include": "#flowtype-parse-types"
3241
+ }
3242
+ ]
3243
+ },
3244
+ {
3245
+ "comment": "declare modules",
3246
+ "begin": "\\s*+(?<!\\.)\\b(declare)\\b\\s*+\\b(module)\\b",
3247
+ "end": "\\s*(?<=})",
3248
+ "beginCaptures": {
3249
+ "1": {
3250
+ "name": "keyword.other.declare.flowtype"
3251
+ },
3252
+ "2": {
3253
+ "name": "storage.type.module.flowtype"
3142
3254
  }
3143
3255
  },
3144
3256
  "patterns": [
3145
3257
  {
3146
- "include": "#flowtype-declare-classes"
3258
+ "include": "#flowtype-polymorphs"
3147
3259
  },
3148
3260
  {
3149
- "include": "#flowtype-declare-modules"
3261
+ "comment": "look for module names but dont assume uppercase start char",
3262
+ "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3263
+ "name": "entity.name.class.js"
3150
3264
  },
3151
3265
  {
3152
- "include": "#flowtype-declare-function"
3266
+ "comment": "look for module names in quoted string forms",
3267
+ "include": "#literal-string"
3153
3268
  },
3154
3269
  {
3155
- "include": "#flowtype-declare-vars"
3270
+ "begin": "\\s*+({)",
3271
+ "end": "\\s*(})",
3272
+ "contentName": "meta.class.body.js",
3273
+ "beginCaptures": {
3274
+ "1": {
3275
+ "name": "punctuation.section.class.begin.js"
3276
+ }
3277
+ },
3278
+ "endCaptures": {
3279
+ "1": {
3280
+ "name": "punctuation.section.class.end.js"
3281
+ }
3282
+ },
3283
+ "patterns": [
3284
+ {
3285
+ "include": "#flowtype-literal-method"
3286
+ },
3287
+ {
3288
+ "include": "#class-body"
3289
+ }
3290
+ ]
3156
3291
  }
3157
3292
  ]
3158
- }
3159
- ]
3160
- },
3161
- "flowtype-declare-modules": {
3162
- "match": "\\s*+\\bmodule\\b\\s+",
3163
- "name": "support.type.object.module.js"
3164
- },
3165
- "flowtype-declare-classes": {
3166
- "patterns": [
3293
+ },
3167
3294
  {
3168
- "begin": "\\s*+\\b(class)\\s+",
3169
- "end": "\\s*(})",
3170
- "applyEndPatternLast": 1,
3295
+ "comment": "declare classes",
3296
+ "begin": "\\s*+(?<!\\.)\\b(declare)\\b\\s*+\\b(class)\\b",
3297
+ "end": "\\s*(?<=})",
3171
3298
  "beginCaptures": {
3172
3299
  "1": {
3300
+ "name": "keyword.other.declare.flowtype"
3301
+ },
3302
+ "2": {
3173
3303
  "name": "storage.type.class.flowtype"
3174
3304
  }
3175
3305
  },
3176
- "endCaptures": {
3177
- "1": {
3178
- "name": "punctuation.section.class.end.js"
3179
- }
3180
- },
3181
3306
  "patterns": [
3182
3307
  {
3183
- "match": "\\s*+\\b(extends|mixins)\\b\\s*+",
3308
+ "include": "#flowtype-polymorphs"
3309
+ },
3310
+ {
3311
+ "comment": "look for extends keyword",
3312
+ "match": "\\s*+\\b((extends))\\b\\s*+",
3184
3313
  "captures": {
3185
3314
  "1": {
3186
- "name": "storage.type.extends.flowtype"
3315
+ "name": "meta.class.extends.js"
3316
+ },
3317
+ "2": {
3318
+ "name": "storage.type.extends.js"
3187
3319
  }
3188
3320
  }
3189
3321
  },
3190
3322
  {
3191
- "begin": "{",
3192
- "end": "\\s*(?=})",
3193
- "contentName": "meta.class.body.js",
3323
+ "comment": "look for mixins keyword",
3324
+ "begin": "\\s*+\\b((mixins))\\b\\s*+",
3325
+ "end": "\\s*(?={)",
3194
3326
  "beginCaptures": {
3195
- "0": {
3196
- "name": "punctuation.section.class.begin.js"
3327
+ "1": {
3328
+ "name": "meta.class.extends.js"
3329
+ },
3330
+ "2": {
3331
+ "name": "storage.type.extends.js"
3197
3332
  }
3198
3333
  },
3199
3334
  "patterns": [
3200
3335
  {
3201
- "match": "\\s*+\\b(?<!\\.)static\\b(?!\\.)",
3202
- "name": "storage.modifier.js"
3203
- },
3204
- {
3205
- "include": "#literal-method"
3206
- },
3207
- {
3208
- "include": "#flowtype"
3209
- },
3210
- {
3211
- "include": "#flowtype-variable"
3212
- },
3213
- {
3214
- "include": "#comments"
3336
+ "comment": "look for mixin names but dont assume uppercase start char",
3337
+ "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3338
+ "name": "entity.name.class.js"
3215
3339
  },
3216
3340
  {
3217
- "include": "#flowtype-function-name"
3341
+ "include": "#literal-comma"
3218
3342
  }
3219
3343
  ]
3220
3344
  },
3221
3345
  {
3222
- "include": "#flowtype-class-name"
3346
+ "comment": "look for class names but dont assume uppercase start char",
3347
+ "match": "(?<!\\.)\\s*+([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3348
+ "name": "entity.name.class.js"
3223
3349
  },
3224
3350
  {
3225
- "include": "#flowtype-polymorphs"
3351
+ "begin": "\\s*+({)",
3352
+ "end": "\\s*(})",
3353
+ "contentName": "meta.class.body.js",
3354
+ "beginCaptures": {
3355
+ "1": {
3356
+ "name": "punctuation.section.class.begin.js"
3357
+ }
3358
+ },
3359
+ "endCaptures": {
3360
+ "1": {
3361
+ "name": "punctuation.section.class.end.js"
3362
+ }
3363
+ },
3364
+ "patterns": [
3365
+ {
3366
+ "include": "#flowtype-literal-method"
3367
+ },
3368
+ {
3369
+ "include": "#class-body"
3370
+ }
3371
+ ]
3226
3372
  }
3227
3373
  ]
3228
3374
  }
3229
3375
  ]
3230
3376
  },
3231
- "flowtype-declare-function": {
3377
+ "flowtype-literal-method": {
3378
+ "comment": "trap methods without a name e.g. <Key, Value>(): Map<Key, Value>",
3379
+ "begin": "(?<!:)\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?(\\())",
3380
+ "end": "\\s*(?=.)",
3381
+ "applyEndPatternLast": 1,
3382
+ "beginCaptures": {
3383
+ "1": {
3384
+ "name": "storage.modifier.js"
3385
+ },
3386
+ "2": {
3387
+ "name": "storage.type.js"
3388
+ },
3389
+ "3": {
3390
+ "name": "keyword.generator.asterisk.js"
3391
+ }
3392
+ },
3232
3393
  "patterns": [
3233
3394
  {
3234
- "begin": "\\s*+\\b(function)\\s+",
3235
- "end": "\\s*(;)",
3236
- "applyEndPatternLast": 1,
3237
- "beginCaptures": {
3238
- "1": {
3239
- "name": "storage.type.function.js"
3240
- }
3241
- },
3242
- "patterns": [
3243
- {
3244
- "include": "#flowtype"
3245
- },
3246
- {
3247
- "include": "#flowtype-function-name"
3248
- }
3249
- ]
3395
+ "include": "#flowtype"
3250
3396
  }
3251
3397
  ]
3252
3398
  },
3253
- "flowtype-declare-vars": {
3399
+ "flowtype-keywords": {
3254
3400
  "patterns": [
3255
3401
  {
3256
- "begin": "\\s*+\\b(var)\\s+",
3257
- "end": "\\s*(?=.)",
3258
- "applyEndPatternLast": 1,
3259
- "beginCaptures": {
3260
- "1": {
3261
- "name": "storage.type.var.js"
3262
- }
3263
- },
3264
- "patterns": [
3265
- {
3266
- "include": "#flowtype-variable"
3267
- }
3268
- ]
3402
+ "include": "#flowtype-declare"
3403
+ },
3404
+ {
3405
+ "include": "#flowtype-type-aliases"
3406
+ },
3407
+ {
3408
+ "include": "#flowtype-interface"
3269
3409
  }
3270
3410
  ]
3271
3411
  },