github-linguist 4.7.6 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. checksums.yaml +4 -4
  2. data/bin/git-linguist +1 -1
  3. data/grammars/file.lasso.json +713 -0
  4. data/grammars/module.ceylon.json +54 -0
  5. data/grammars/objdump.x86asm.json +73 -0
  6. data/grammars/source.Kotlin.json +777 -0
  7. data/grammars/source.LS.json +104 -0
  8. data/grammars/source.MCPOST.json +68 -0
  9. data/grammars/source.MOD.json +70 -0
  10. data/grammars/source.abap.json +176 -0
  11. data/grammars/source.abl.json +138 -0
  12. data/grammars/source.actionscript.3.json +1571 -0
  13. data/grammars/source.acucobol.json +16 -0
  14. data/grammars/source.ada.json +140 -0
  15. data/grammars/source.agda.json +254 -0
  16. data/grammars/source.ahk.json +171 -0
  17. data/grammars/source.alloy.json +44 -0
  18. data/grammars/source.ampl.json +157 -0
  19. data/grammars/source.antlr.json +300 -0
  20. data/grammars/source.apache-config.json +352 -0
  21. data/grammars/source.apache-config.mod_perl.json +70 -0
  22. data/grammars/source.apl.json +442 -0
  23. data/grammars/source.applescript.json +1385 -0
  24. data/grammars/source.apt.json +25 -0
  25. data/grammars/source.asm.x86.json +182 -0
  26. data/grammars/source.asp.json +157 -0
  27. data/grammars/source.aspectj.json +966 -0
  28. data/grammars/source.ats.json +240 -0
  29. data/grammars/source.autoit.3.json +132 -0
  30. data/grammars/source.awk.json +388 -0
  31. data/grammars/source.befunge.json +38 -0
  32. data/grammars/source.bf.json +36 -0
  33. data/grammars/source.bison.json +59 -0
  34. data/grammars/source.blitzmax.json +912 -0
  35. data/grammars/source.boo.json +452 -0
  36. data/grammars/source.brightauthorproject.json +29 -0
  37. data/grammars/source.brightscript.json +158 -0
  38. data/grammars/source.bro.json +409 -0
  39. data/grammars/source.bsv.json +283 -0
  40. data/grammars/source.c++.json +364 -0
  41. data/grammars/source.c++.qt.json +37 -0
  42. data/grammars/source.c.ec.json +39 -0
  43. data/grammars/source.c.json +727 -0
  44. data/grammars/source.c.platform.json +154 -0
  45. data/grammars/source.cache.cmake.json +75 -0
  46. data/grammars/source.cake.json +16 -0
  47. data/grammars/source.camlp4.ocaml.json +63 -0
  48. data/grammars/source.capnp.json +93 -0
  49. data/grammars/source.ceylon.json +77 -0
  50. data/grammars/source.cfscript.cfc.json +170 -0
  51. data/grammars/source.cfscript.json +744 -0
  52. data/grammars/source.chapel.json +240 -0
  53. data/grammars/source.cirru.json +66 -0
  54. data/grammars/source.clarion.json +159 -0
  55. data/grammars/source.click.json +99 -0
  56. data/grammars/source.clips.json +80 -0
  57. data/grammars/source.clojure.json +414 -0
  58. data/grammars/source.cm.json +54 -0
  59. data/grammars/source.cmake.json +181 -0
  60. data/grammars/source.cobol.json +498 -0
  61. data/grammars/source.coffee.json +682 -0
  62. data/grammars/source.compiled-papyrus.json +11 -0
  63. data/grammars/source.cool.json +103 -0
  64. data/grammars/source.coq.json +62 -0
  65. data/grammars/source.crystal.json +2760 -0
  66. data/grammars/source.cs.json +566 -0
  67. data/grammars/source.css.json +630 -0
  68. data/grammars/source.css.less.json +614 -0
  69. data/grammars/source.css.mss.json +256 -0
  70. data/grammars/source.csx.json +16 -0
  71. data/grammars/source.cuda-c++.json +137 -0
  72. data/grammars/source.cython.json +2108 -0
  73. data/grammars/source.d.json +726 -0
  74. data/grammars/source.dart.json +763 -0
  75. data/grammars/source.desktop.json +90 -0
  76. data/grammars/source.diff.json +162 -0
  77. data/grammars/source.dockerfile.json +89 -0
  78. data/grammars/source.dosbatch.json +70 -0
  79. data/grammars/source.dot.json +126 -0
  80. data/grammars/source.dylan.json +217 -0
  81. data/grammars/source.eiffel.json +138 -0
  82. data/grammars/source.elixir.json +971 -0
  83. data/grammars/source.elm.json +356 -0
  84. data/grammars/source.erazor.json +126 -0
  85. data/grammars/source.erlang.json +1674 -0
  86. data/grammars/source.essl.json +50 -0
  87. data/grammars/source.factor.json +258 -0
  88. data/grammars/source.fan.json +188 -0
  89. data/grammars/source.fancy.json +270 -0
  90. data/grammars/source.fish.json +214 -0
  91. data/grammars/source.forth.json +101 -0
  92. data/grammars/source.fortran.json +499 -0
  93. data/grammars/source.fortran.modern.json +226 -0
  94. data/grammars/source.fsharp.fsi.json +14 -0
  95. data/grammars/source.fsharp.fsl.json +14 -0
  96. data/grammars/source.fsharp.fsx.json +18 -0
  97. data/grammars/source.fsharp.json +527 -0
  98. data/grammars/source.gap.json +167 -0
  99. data/grammars/source.gcode.json +25 -0
  100. data/grammars/source.gdscript.json +154 -0
  101. data/grammars/source.gfm.json +1392 -0
  102. data/grammars/source.glsl.json +74 -0
  103. data/grammars/source.gnuplot.json +276 -0
  104. data/grammars/source.go.json +552 -0
  105. data/grammars/source.golo.json +182 -0
  106. data/grammars/source.gosu.2.json +163 -0
  107. data/grammars/source.grace.json +679 -0
  108. data/grammars/source.groovy.gradle.json +73 -0
  109. data/grammars/source.groovy.json +1385 -0
  110. data/grammars/source.harbour.json +450 -0
  111. data/grammars/source.haskell.json +449 -0
  112. data/grammars/source.haxe.2.json +1278 -0
  113. data/grammars/source.hss.1.json +464 -0
  114. data/grammars/source.httpspec.json +287 -0
  115. data/grammars/source.hxml.json +26 -0
  116. data/grammars/source.hy.json +270 -0
  117. data/grammars/source.idl-dlm.json +112 -0
  118. data/grammars/source.idl.json +267 -0
  119. data/grammars/source.idris.json +537 -0
  120. data/grammars/source.inform7.json +187 -0
  121. data/grammars/source.ini.json +113 -0
  122. data/grammars/source.inno.json +69 -0
  123. data/grammars/source.io.json +164 -0
  124. data/grammars/source.ioke.json +272 -0
  125. data/grammars/source.isabelle.root.json +68 -0
  126. data/grammars/source.isabelle.theory.json +106 -0
  127. data/grammars/source.j.json +49 -0
  128. data/grammars/source.jasmin.json +299 -0
  129. data/grammars/source.java-properties.json +97 -0
  130. data/grammars/source.java.json +1026 -0
  131. data/grammars/source.jcl.json +49 -0
  132. data/grammars/source.jflex.json +490 -0
  133. data/grammars/source.jq.json +218 -0
  134. data/grammars/source.js.json +1646 -0
  135. data/grammars/source.js.jsx.json +3185 -0
  136. data/grammars/source.js.objj.json +424 -0
  137. data/grammars/source.js.regexp.json +150 -0
  138. data/grammars/source.js.regexp.replacement.json +30 -0
  139. data/grammars/source.json.json +149 -0
  140. data/grammars/source.julia.json +407 -0
  141. data/grammars/source.lean.json +145 -0
  142. data/grammars/source.lid.json +23 -0
  143. data/grammars/source.lilypond.json +623 -0
  144. data/grammars/source.lisp.json +111 -0
  145. data/grammars/source.litcoffee.json +667 -0
  146. data/grammars/source.livescript.json +616 -0
  147. data/grammars/source.llvm.json +71 -0
  148. data/grammars/source.logos.json +31 -0
  149. data/grammars/source.logtalk.json +315 -0
  150. data/grammars/source.loomscript.json +214 -0
  151. data/grammars/source.lsl.json +216 -0
  152. data/grammars/source.lua.json +191 -0
  153. data/grammars/source.makefile.json +474 -0
  154. data/grammars/source.makegen.json +13 -0
  155. data/grammars/source.man.json +53 -0
  156. data/grammars/source.mask.json +795 -0
  157. data/grammars/source.mata.json +133 -0
  158. data/grammars/source.mathematica.json +429 -0
  159. data/grammars/source.matlab.json +1109 -0
  160. data/grammars/source.maxscript.json +453 -0
  161. data/grammars/source.mercury.json +251 -0
  162. data/grammars/source.meta-info.json +156 -0
  163. data/grammars/source.ml.json +291 -0
  164. data/grammars/source.modelica.json +142 -0
  165. data/grammars/source.modula2.json +103 -0
  166. data/grammars/source.monkey.json +701 -0
  167. data/grammars/source.moonscript.json +149 -0
  168. data/grammars/source.mupad.json +149 -0
  169. data/grammars/source.nant-build.json +86 -0
  170. data/grammars/source.ncl.json +66 -0
  171. data/grammars/source.nemerle.json +137 -0
  172. data/grammars/source.nesc.json +27 -0
  173. data/grammars/source.netlinx.erb.json +47 -0
  174. data/grammars/source.netlinx.json +768 -0
  175. data/grammars/source.nginx.json +824 -0
  176. data/grammars/source.nim.json +1169 -0
  177. data/grammars/source.nim_filter.json +133 -0
  178. data/grammars/source.nimcfg.json +116 -0
  179. data/grammars/source.ninja.json +66 -0
  180. data/grammars/source.nit.json +238 -0
  181. data/grammars/source.nix.json +1200 -0
  182. data/grammars/source.nmml.json +87 -0
  183. data/grammars/source.nsis.json +158 -0
  184. data/grammars/source.objc++.json +19 -0
  185. data/grammars/source.objc.json +918 -0
  186. data/grammars/source.objc.platform.json +277 -0
  187. data/grammars/source.ocaml.json +1426 -0
  188. data/grammars/source.ocamllex.json +305 -0
  189. data/grammars/source.ocamlyacc.json +346 -0
  190. data/grammars/source.octave.json +451 -0
  191. data/grammars/source.ooc.json +692 -0
  192. data/grammars/source.opa.json +206 -0
  193. data/grammars/source.opal.json +415 -0
  194. data/grammars/source.opalsysdefs.json +70 -0
  195. data/grammars/source.opencobol.json +65 -0
  196. data/grammars/source.ox.json +97 -0
  197. data/grammars/source.oz.json +84 -0
  198. data/grammars/source.papyrus-assembly.json +266 -0
  199. data/grammars/source.papyrus.json +231 -0
  200. data/grammars/source.parrot.pir.json +117 -0
  201. data/grammars/source.pascal.json +150 -0
  202. data/grammars/source.perl.6.json +318 -0
  203. data/grammars/source.perl.json +2424 -0
  204. data/grammars/source.perl6fe.json +1755 -0
  205. data/grammars/source.php.zephir.json +362 -0
  206. data/grammars/source.pig_latin.json +172 -0
  207. data/grammars/source.pike.json +62 -0
  208. data/grammars/source.plsql.oracle.json +642 -0
  209. data/grammars/source.po.json +232 -0
  210. data/grammars/source.pogoscript.json +85 -0
  211. data/grammars/source.pony.json +255 -0
  212. data/grammars/source.postscript.json +231 -0
  213. data/grammars/source.pov-ray sdl.json +88 -0
  214. data/grammars/source.powershell.json +755 -0
  215. data/grammars/source.processing.json +885 -0
  216. data/grammars/source.prolog.eclipse.json +206 -0
  217. data/grammars/source.prolog.json +292 -0
  218. data/grammars/source.protobuf.json +395 -0
  219. data/grammars/source.pubspec.json +13 -0
  220. data/grammars/source.puppet.json +494 -0
  221. data/grammars/source.purescript.json +833 -0
  222. data/grammars/source.pyjade.json +1010 -0
  223. data/grammars/source.python.django.json +34 -0
  224. data/grammars/source.python.json +3435 -0
  225. data/grammars/source.python.salt.json +13 -0
  226. data/grammars/source.qmake.json +217 -0
  227. data/grammars/source.qml.json +195 -0
  228. data/grammars/source.r.json +203 -0
  229. data/grammars/source.racket.json +119 -0
  230. data/grammars/source.rebol.json +647 -0
  231. data/grammars/source.red.json +652 -0
  232. data/grammars/source.regexp.babel.json +190 -0
  233. data/grammars/source.regexp.perl6fe.json +220 -0
  234. data/grammars/source.regexp.python.json +434 -0
  235. data/grammars/source.regexp.spin.json +188 -0
  236. data/grammars/source.renpy.json +2181 -0
  237. data/grammars/source.ruby.json +1956 -0
  238. data/grammars/source.ruby.rspec.cucumber.steps.json +274 -0
  239. data/grammars/source.rust.json +212 -0
  240. data/grammars/source.sas.json +370 -0
  241. data/grammars/source.sas_log.json +26 -0
  242. data/grammars/source.sass.json +248 -0
  243. data/grammars/source.sbt.json +36 -0
  244. data/grammars/source.scad.json +152 -0
  245. data/grammars/source.scala.json +739 -0
  246. data/grammars/source.scaml.json +466 -0
  247. data/grammars/source.scheme.json +370 -0
  248. data/grammars/source.scilab.json +103 -0
  249. data/grammars/source.scss.json +1321 -0
  250. data/grammars/source.shell.json +1308 -0
  251. data/grammars/source.smali.json +1671 -0
  252. data/grammars/source.smalltalk.json +135 -0
  253. data/grammars/source.smt.json +173 -0
  254. data/grammars/source.sp.json +118 -0
  255. data/grammars/source.sparql.json +23 -0
  256. data/grammars/source.spin.json +936 -0
  257. data/grammars/source.sqf.json +112 -0
  258. data/grammars/source.sql.json +473 -0
  259. data/grammars/source.stan.json +312 -0
  260. data/grammars/source.stata.json +208 -0
  261. data/grammars/source.strings.json +53 -0
  262. data/grammars/source.stylus.json +1017 -0
  263. data/grammars/source.supercollider.json +100 -0
  264. data/grammars/source.swift.json +983 -0
  265. data/grammars/source.systemverilog.json +1050 -0
  266. data/grammars/source.tcl.json +277 -0
  267. data/grammars/source.tea.json +180 -0
  268. data/grammars/source.thrift.json +704 -0
  269. data/grammars/source.toml.json +327 -0
  270. data/grammars/source.ts.json +1188 -0
  271. data/grammars/source.tsx.json +1421 -0
  272. data/grammars/source.turtle.json +505 -0
  273. data/grammars/source.txl.json +62 -0
  274. data/grammars/source.ucfconstraints.json +72 -0
  275. data/grammars/source.ur.json +43 -0
  276. data/grammars/source.vala.json +814 -0
  277. data/grammars/source.varnish.vcl.json +343 -0
  278. data/grammars/source.vbnet.json +338 -0
  279. data/grammars/source.verilog.json +302 -0
  280. data/grammars/source.vhdl.json +1349 -0
  281. data/grammars/source.viml.json +224 -0
  282. data/grammars/source.webidl.json +814 -0
  283. data/grammars/source.x10.json +68 -0
  284. data/grammars/source.x86asm.json +47 -0
  285. data/grammars/source.xc.json +379 -0
  286. data/grammars/source.xq.json +241 -0
  287. data/grammars/source.xquery.json +193 -0
  288. data/grammars/source.xtend.json +733 -0
  289. data/grammars/source.yaml.json +341 -0
  290. data/grammars/source.yaml.salt.json +348 -0
  291. data/grammars/source.yang.json +81 -0
  292. data/grammars/text.bibtex.json +251 -0
  293. data/grammars/text.cfml.basic.json +736 -0
  294. data/grammars/text.dart-analysis-output.json +162 -0
  295. data/grammars/text.dart-doccomments.json +19 -0
  296. data/grammars/text.elixir.json +45 -0
  297. data/grammars/text.gherkin.feature.json +135 -0
  298. data/grammars/text.groff.json +113 -0
  299. data/grammars/text.haml.json +299 -0
  300. data/grammars/text.html.abl.json +75 -0
  301. data/grammars/text.html.asciidoc.json +492 -0
  302. data/grammars/text.html.asdoc.json +541 -0
  303. data/grammars/text.html.asp.json +58 -0
  304. data/grammars/text.html.basic.json +552 -0
  305. data/grammars/text.html.cfm.json +811 -0
  306. data/grammars/text.html.creole.json +329 -0
  307. data/grammars/text.html.django.json +69 -0
  308. data/grammars/text.html.elixir.json +18 -0
  309. data/grammars/text.html.erb.json +157 -0
  310. data/grammars/text.html.erlang.yaws.json +72 -0
  311. data/grammars/text.html.factor.json +25 -0
  312. data/grammars/text.html.ftl.json +85 -0
  313. data/grammars/text.html.handlebars.json +838 -0
  314. data/grammars/text.html.jsp.json +1203 -0
  315. data/grammars/text.html.liquid.json +35 -0
  316. data/grammars/text.html.mako.json +729 -0
  317. data/grammars/text.html.markdown.source.gfm.apib.json +1297 -0
  318. data/grammars/text.html.markdown.source.gfm.mson.json +1165 -0
  319. data/grammars/text.html.mediawiki.json +972 -0
  320. data/grammars/text.html.php.json +2615 -0
  321. data/grammars/text.html.slash.json +313 -0
  322. data/grammars/text.html.smarty.json +216 -0
  323. data/grammars/text.html.ssp.json +49 -0
  324. data/grammars/text.html.tcl.json +44 -0
  325. data/grammars/text.html.twig.json +1353 -0
  326. data/grammars/text.html.vue.json +642 -0
  327. data/grammars/text.idl-idldoc.json +14 -0
  328. data/grammars/text.jade.json +1024 -0
  329. data/grammars/text.junit-test-report.json +92 -0
  330. data/grammars/text.log.latex.json +86 -0
  331. data/grammars/text.python.console.json +25 -0
  332. data/grammars/text.python.traceback.json +46 -0
  333. data/grammars/text.rdoc.json +48 -0
  334. data/grammars/text.restructuredtext.json +561 -0
  335. data/grammars/text.robot.json +73 -0
  336. data/grammars/text.shell-session.json +32 -0
  337. data/grammars/text.slim.json +527 -0
  338. data/grammars/text.tex.json +271 -0
  339. data/grammars/text.tex.latex.beamer.json +63 -0
  340. data/grammars/text.tex.latex.haskell.json +56 -0
  341. data/grammars/text.tex.latex.json +1013 -0
  342. data/grammars/text.tex.latex.memoir.json +136 -0
  343. data/grammars/text.tex.latex.rd.json +117 -0
  344. data/grammars/text.xml.ant.json +202 -0
  345. data/grammars/text.xml.flex-config.json +2634 -0
  346. data/grammars/text.xml.genshi.json +34 -0
  347. data/grammars/text.xml.json +364 -0
  348. data/grammars/text.xml.pom.json +774 -0
  349. data/grammars/text.xml.xsl.json +94 -0
  350. data/grammars/text.zone_file.json +72 -0
  351. data/lib/linguist.rb +79 -0
  352. data/lib/linguist/blob_helper.rb +2 -2
  353. data/lib/linguist/grammars.rb +10 -0
  354. data/lib/linguist/heuristics.rb +17 -1
  355. data/lib/linguist/language.rb +2 -36
  356. data/lib/linguist/languages.json +1 -1
  357. data/lib/linguist/languages.yml +50 -2
  358. data/lib/linguist/samples.json +2580 -116
  359. data/lib/linguist/vendor.yml +11 -1
  360. data/lib/linguist/version.rb +1 -1
  361. metadata +365 -2
@@ -0,0 +1,3185 @@
1
+ {
2
+ "name": "Babel ES6 JavaScript",
3
+ "scopeName": "source.js.jsx",
4
+ "foldingStartMarker": "(/\\*|\\{|\\()",
5
+ "foldingEndMarker": "(\\*/|\\}|\\))",
6
+ "firstLineMatch": "^#!\\s*/.*\\b(node|js)$\\n?",
7
+ "fileTypes": [
8
+ "js",
9
+ "es6",
10
+ "babel",
11
+ "jsx",
12
+ "flow"
13
+ ],
14
+ "patterns": [
15
+ {
16
+ "include": "#core"
17
+ }
18
+ ],
19
+ "repository": {
20
+ "core": {
21
+ "patterns": [
22
+ {
23
+ "include": "#ignore-long-lines"
24
+ },
25
+ {
26
+ "include": "#flowtype-declare"
27
+ },
28
+ {
29
+ "include": "#flowtype-type-aliases"
30
+ },
31
+ {
32
+ "include": "#flowtype-interface"
33
+ },
34
+ {
35
+ "include": "#literal-function-labels"
36
+ },
37
+ {
38
+ "include": "#literal-arrow-function-labels"
39
+ },
40
+ {
41
+ "include": "#literal-labels"
42
+ },
43
+ {
44
+ "include": "#literal-keywords"
45
+ },
46
+ {
47
+ "include": "#literal-for"
48
+ },
49
+ {
50
+ "include": "#literal-switch"
51
+ },
52
+ {
53
+ "include": "#expression"
54
+ },
55
+ {
56
+ "include": "#literal-punctuation"
57
+ }
58
+ ]
59
+ },
60
+ "expression": {
61
+ "patterns": [
62
+ {
63
+ "include": "#ignore-long-lines"
64
+ },
65
+ {
66
+ "include": "#jsx"
67
+ },
68
+ {
69
+ "include": "#es7-decorators"
70
+ },
71
+ {
72
+ "include": "#support"
73
+ },
74
+ {
75
+ "include": "#literal-function-labels"
76
+ },
77
+ {
78
+ "include": "#literal-arrow-function-labels"
79
+ },
80
+ {
81
+ "include": "#literal-function"
82
+ },
83
+ {
84
+ "include": "#literal-arrow-function"
85
+ },
86
+ {
87
+ "include": "#literal-prototype",
88
+ "comment": "after literal-function, which includes some prototype strings"
89
+ },
90
+ {
91
+ "include": "#literal-regexp",
92
+ "comment": "before operators to avoid abiguities"
93
+ },
94
+ {
95
+ "include": "#literal-number"
96
+ },
97
+ {
98
+ "include": "#literal-quasi"
99
+ },
100
+ {
101
+ "include": "#literal-string"
102
+ },
103
+ {
104
+ "include": "#literal-language-constant"
105
+ },
106
+ {
107
+ "include": "#literal-language-variable"
108
+ },
109
+ {
110
+ "include": "#literal-module"
111
+ },
112
+ {
113
+ "include": "#literal-class"
114
+ },
115
+ {
116
+ "include": "#literal-constructor"
117
+ },
118
+ {
119
+ "include": "#literal-method-call"
120
+ },
121
+ {
122
+ "include": "#literal-function-call"
123
+ },
124
+ {
125
+ "include": "#comments"
126
+ },
127
+ {
128
+ "include": "#brackets"
129
+ },
130
+ {
131
+ "include": "#literal-operators"
132
+ },
133
+ {
134
+ "include": "#literal-variable"
135
+ },
136
+ {
137
+ "include": "#literal-comma"
138
+ }
139
+ ]
140
+ },
141
+ "ignore-long-lines": {
142
+ "comment": "so set at arbitary 1000 chars to avoid parsing minified files",
143
+ "patterns": [
144
+ {
145
+ "match": "^(?:).{1000,}"
146
+ }
147
+ ]
148
+ },
149
+ "literal-function-labels": {
150
+ "patterns": [
151
+ {
152
+ "comment": "e.g. play: function(arg1, arg2) { }",
153
+ "name": "meta.function.json.js",
154
+ "begin": "\\s*([_$a-zA-Z][$\\w]*)\\s*(:)\\s*(?:(async)\\s+)?\\s*(\\bfunction\\b)\\s*(?:(\\*)\\s*)?\\s*(?=\\(|<)",
155
+ "end": "(?=\\{)",
156
+ "applyEndPatternLast": 1,
157
+ "beginCaptures": {
158
+ "1": {
159
+ "name": "entity.name.function.js"
160
+ },
161
+ "2": {
162
+ "name": "punctuation.separator.key-value.js"
163
+ },
164
+ "3": {
165
+ "name": "storage.type.js"
166
+ },
167
+ "4": {
168
+ "name": "storage.type.function.js"
169
+ },
170
+ "5": {
171
+ "name": "keyword.generator.asterisk.js"
172
+ }
173
+ },
174
+ "patterns": [
175
+ {
176
+ "include": "#flowtype"
177
+ }
178
+ ]
179
+ },
180
+ {
181
+ "comment": "e.g. 'play': function(arg1, arg2) { }",
182
+ "name": "meta.function.json.js",
183
+ "begin": "\\s*(('|\\\")(\\b[_$a-zA-Z][$\\w]*)(\\k<2>))\\s*(:)\\s*(async)?\\s+(\\bfunction\\b)\\s*(\\*\\s*)?\\s*(?=\\(|<)",
184
+ "end": "(?=\\{)",
185
+ "applyEndPatternLast": 1,
186
+ "beginCaptures": {
187
+ "1": {
188
+ "name": "string.quoted.js"
189
+ },
190
+ "2": {
191
+ "name": "punctuation.definition.string.begin.js"
192
+ },
193
+ "3": {
194
+ "name": "entity.name.function.js"
195
+ },
196
+ "4": {
197
+ "name": "punctuation.definition.string.end.js"
198
+ },
199
+ "5": {
200
+ "name": "punctuation.separator.key-value.js"
201
+ },
202
+ "6": {
203
+ "name": "storage.type.js"
204
+ },
205
+ "7": {
206
+ "name": "storage.type.function.js"
207
+ },
208
+ "8": {
209
+ "name": "keyword.generator.asterisk.js"
210
+ }
211
+ },
212
+ "patterns": [
213
+ {
214
+ "include": "#flowtype"
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ },
220
+ "literal-arrow-function-labels": {
221
+ "patterns": [
222
+ {
223
+ "comment": "e.g. play: async <T>(args) => { }",
224
+ "name": "meta.function.json.arrow.js",
225
+ "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*=>)",
226
+ "end": "\\s*(=>)",
227
+ "applyEndPatternLast": 1,
228
+ "beginCaptures": {
229
+ "1": {
230
+ "name": "entity.name.function.js"
231
+ },
232
+ "2": {
233
+ "name": "punctuation.separator.key-value.js"
234
+ },
235
+ "3": {
236
+ "name": "storage.type.js"
237
+ }
238
+ },
239
+ "endCaptures": {
240
+ "1": {
241
+ "name": "storage.type.function.arrow.js"
242
+ }
243
+ },
244
+ "patterns": [
245
+ {
246
+ "include": "#flowtype"
247
+ }
248
+ ]
249
+ },
250
+ {
251
+ "comment": "e.g. play: arg => { }",
252
+ "name": "meta.function.json.arrow.js",
253
+ "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*=>)",
254
+ "end": "\\s*(=>)",
255
+ "beginCaptures": {
256
+ "1": {
257
+ "name": "entity.name.function.js"
258
+ },
259
+ "2": {
260
+ "name": "punctuation.separator.key-value.js"
261
+ },
262
+ "3": {
263
+ "name": "storage.type.js"
264
+ }
265
+ },
266
+ "endCaptures": {
267
+ "1": {
268
+ "name": "storage.type.function.arrow.js"
269
+ }
270
+ },
271
+ "patterns": [
272
+ {
273
+ "include": "#flowtype-polymorphs"
274
+ },
275
+ {
276
+ "include": "#flowtype-variable"
277
+ }
278
+ ]
279
+ },
280
+ {
281
+ "comment": "e.g. 'play': (args) => { }",
282
+ "name": "meta.function.json.arrow.js",
283
+ "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*=>)",
284
+ "end": "\\s*(=>)",
285
+ "applyEndPatternLast": 1,
286
+ "endCaptures": {
287
+ "1": {
288
+ "name": "storage.type.function.arrow.js"
289
+ }
290
+ },
291
+ "beginCaptures": {
292
+ "1": {
293
+ "name": "string.quoted.js"
294
+ },
295
+ "2": {
296
+ "name": "punctuation.definition.string.begin.js"
297
+ },
298
+ "3": {
299
+ "name": "entity.name.function.js"
300
+ },
301
+ "4": {
302
+ "name": "punctuation.definition.string.end.js"
303
+ },
304
+ "5": {
305
+ "name": "punctuation.separator.key-value.js"
306
+ },
307
+ "6": {
308
+ "name": "storage.type.js"
309
+ }
310
+ },
311
+ "patterns": [
312
+ {
313
+ "include": "#flowtype"
314
+ }
315
+ ]
316
+ },
317
+ {
318
+ "comment": "e.g. 'play': arg => { }",
319
+ "name": "meta.function.json.arrow.js",
320
+ "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*=>)",
321
+ "end": "\\s*(=>)",
322
+ "beginCaptures": {
323
+ "1": {
324
+ "name": "string.quoted.js"
325
+ },
326
+ "2": {
327
+ "name": "punctuation.definition.string.begin.js"
328
+ },
329
+ "3": {
330
+ "name": "entity.name.function.js"
331
+ },
332
+ "4": {
333
+ "name": "punctuation.definition.string.end.js"
334
+ },
335
+ "5": {
336
+ "name": "punctuation.separator.key-value.js"
337
+ },
338
+ "6": {
339
+ "name": "storage.type.js"
340
+ }
341
+ },
342
+ "endCaptures": {
343
+ "1": {
344
+ "name": "storage.type.function.arrow.js"
345
+ }
346
+ },
347
+ "patterns": [
348
+ {
349
+ "include": "#flowtype-polymorphs"
350
+ },
351
+ {
352
+ "include": "#flowtype-variable"
353
+ }
354
+ ]
355
+ }
356
+ ]
357
+ },
358
+ "literal-labels": {
359
+ "patterns": [
360
+ {
361
+ "comment": "string as a property name",
362
+ "match": "\\s*(?<!\\.|\\?|\\?\\s|\\?\\s\\s)(((\\\")(\\\\.|[^\\\\\"])*(\\\"))|((')(\\\\.|[^\\\\'])*(')))\\s*(:)",
363
+ "captures": {
364
+ "1": {
365
+ "name": "constant.other.object.key.js"
366
+ },
367
+ "2": {
368
+ "name": "string.quoted.double.js"
369
+ },
370
+ "3": {
371
+ "name": "punctuation.definition.string.begin.js"
372
+ },
373
+ "5": {
374
+ "name": "punctuation.definition.string.end.js"
375
+ },
376
+ "6": {
377
+ "name": "string.quoted.single.js"
378
+ },
379
+ "7": {
380
+ "name": "punctuation.definition.string.begin.js"
381
+ },
382
+ "9": {
383
+ "name": "punctuation.definition.string.end.js"
384
+ },
385
+ "10": {
386
+ "name": "punctuation.separator.key-value.js"
387
+ }
388
+ }
389
+ },
390
+ {
391
+ "comment": "[something] : as property name",
392
+ "begin": "\\s*(?<!\\.|\\?|\\?\\s|\\?\\s\\s)(\\[)(?=(?:[^\\[]+)*?\\]\\s*(:)(?=\\s*\\S))",
393
+ "end": "\\s*(\\])\\s*(:)",
394
+ "beginCaptures": {
395
+ "1": {
396
+ "name": "meta.brace.square.js"
397
+ }
398
+ },
399
+ "endCaptures": {
400
+ "1": {
401
+ "name": "meta.brace.square.js"
402
+ },
403
+ "2": {
404
+ "name": "punctuation.separator.key-value.js"
405
+ }
406
+ },
407
+ "patterns": [
408
+ {
409
+ "include": "#expression"
410
+ }
411
+ ]
412
+ },
413
+ {
414
+ "name": "constant.other.object.key.js",
415
+ "match": "\\s*(?<!\\.|\\?|\\?\\s|\\?\\s\\s)\\s*([_$a-zA-Z][$\\w]*)\\s*(:)",
416
+ "captures": {
417
+ "1": {
418
+ "name": "string.unquoted.js"
419
+ },
420
+ "2": {
421
+ "name": "punctuation.separator.key-value.js"
422
+ }
423
+ }
424
+ }
425
+ ]
426
+ },
427
+ "literal-keywords": {
428
+ "patterns": [
429
+ {
430
+ "include": "#literal-keyword-storage"
431
+ },
432
+ {
433
+ "name": "keyword.control.flow.js",
434
+ "match": "\\s*(?<!\\.)\\b(yield)\\b(?:\\s*(\\*))?",
435
+ "captures": {
436
+ "1": {
437
+ "name": "keyword.control.flow.js"
438
+ },
439
+ "2": {
440
+ "name": "keyword.generator.asterisk.js"
441
+ }
442
+ }
443
+ },
444
+ {
445
+ "name": "keyword.control.flow.js",
446
+ "match": "\\s*(?<!\\.)\\b(await|return)\\b"
447
+ },
448
+ {
449
+ "name": "keyword.control.conditional.js",
450
+ "match": "\\s*(?<!\\.)\\b(if|else)\\b"
451
+ },
452
+ {
453
+ "name": "keyword.control.trycatch.js",
454
+ "match": "\\s*(?<!\\.)\\b(catch|finally|throw|try)\\b"
455
+ },
456
+ {
457
+ "name": "keyword.control.loop.js",
458
+ "match": "\\s*(?<!\\.)\\b(break|continue|do|goto|while)\\b"
459
+ }
460
+ ]
461
+ },
462
+ "literal-for": {
463
+ "patterns": [
464
+ {
465
+ "name": "meta.for.js",
466
+ "begin": "\\s*(?<!\\.)\\b(for)\\b",
467
+ "end": "\\s*\\)",
468
+ "endCaptures": {
469
+ "0": {
470
+ "name": "meta.brace.round.js"
471
+ }
472
+ },
473
+ "beginCaptures": {
474
+ "1": {
475
+ "name": "keyword.control.loop.js"
476
+ }
477
+ },
478
+ "patterns": [
479
+ {
480
+ "begin": "\\s*\\(",
481
+ "end": "\\s*(?=\\))",
482
+ "beginCaptures": {
483
+ "0": {
484
+ "name": "meta.brace.round.js"
485
+ }
486
+ },
487
+ "patterns": [
488
+ {
489
+ "include": "#literal-keyword-storage"
490
+ },
491
+ {
492
+ "include": "#expression"
493
+ },
494
+ {
495
+ "include": "#literal-punctuation"
496
+ }
497
+ ]
498
+ }
499
+ ]
500
+ }
501
+ ]
502
+ },
503
+ "literal-switch": {
504
+ "patterns": [
505
+ {
506
+ "name": "meta.switch.js",
507
+ "begin": "\\s*(?<!\\.)\\b(switch)\\b",
508
+ "end": "\\s*\\}",
509
+ "beginCaptures": {
510
+ "1": {
511
+ "name": "keyword.control.switch.js"
512
+ }
513
+ },
514
+ "endCaptures": {
515
+ "0": {
516
+ "name": "meta.brace.curly.js"
517
+ }
518
+ },
519
+ "patterns": [
520
+ {
521
+ "include": "#round-brackets"
522
+ },
523
+ {
524
+ "begin": "\\s*\\{",
525
+ "end": "\\s*(?=})",
526
+ "beginCaptures": {
527
+ "0": {
528
+ "name": "meta.brace.curly.js"
529
+ }
530
+ },
531
+ "patterns": [
532
+ {
533
+ "begin": "\\s*(?<!\\.)\\b(case|default)\\b",
534
+ "end": "\\s*(:)",
535
+ "beginCaptures": {
536
+ "1": {
537
+ "name": "keyword.control.switch.js"
538
+ }
539
+ },
540
+ "endCaptures": {
541
+ "1": {
542
+ "name": "keyword.operator.js"
543
+ }
544
+ },
545
+ "patterns": [
546
+ {
547
+ "include": "#expression"
548
+ }
549
+ ]
550
+ },
551
+ {
552
+ "include": "$self"
553
+ }
554
+ ]
555
+ }
556
+ ]
557
+ }
558
+ ]
559
+ },
560
+ "brackets": {
561
+ "patterns": [
562
+ {
563
+ "include": "#round-brackets"
564
+ },
565
+ {
566
+ "include": "#square-brackets"
567
+ },
568
+ {
569
+ "include": "#curly-brackets"
570
+ }
571
+ ]
572
+ },
573
+ "round-brackets": {
574
+ "patterns": [
575
+ {
576
+ "comment": "try to avoid ternary operators which have a '? some chars :'",
577
+ "name": "meta.group.braces.round",
578
+ "begin": "(^|:|;|=|(?<=:|;|=))\\s*(\\((?=((\"|').*?(?<=[^\\\\])\\k<-1>|[^?:])*(:|\\?\\s*:)))",
579
+ "end": "\\s*\\)",
580
+ "beginCaptures": {
581
+ "2": {
582
+ "name": "meta.brace.round.js"
583
+ }
584
+ },
585
+ "endCaptures": {
586
+ "0": {
587
+ "name": "meta.brace.round.js"
588
+ }
589
+ },
590
+ "patterns": [
591
+ {
592
+ "include": "#flowtype-typecast"
593
+ },
594
+ {
595
+ "include": "#expression"
596
+ }
597
+ ]
598
+ },
599
+ {
600
+ "name": "meta.group.braces.round",
601
+ "begin": "\\s*\\(",
602
+ "end": "\\s*\\)",
603
+ "endCaptures": {
604
+ "0": {
605
+ "name": "meta.brace.round.js"
606
+ }
607
+ },
608
+ "beginCaptures": {
609
+ "0": {
610
+ "name": "meta.brace.round.js"
611
+ }
612
+ },
613
+ "patterns": [
614
+ {
615
+ "include": "#expression"
616
+ }
617
+ ]
618
+ }
619
+ ]
620
+ },
621
+ "square-brackets": {
622
+ "patterns": [
623
+ {
624
+ "name": "meta.group.braces.square",
625
+ "begin": "\\s*\\[",
626
+ "end": "\\s*\\]",
627
+ "endCaptures": {
628
+ "0": {
629
+ "name": "meta.brace.square.js"
630
+ }
631
+ },
632
+ "beginCaptures": {
633
+ "0": {
634
+ "name": "meta.brace.square.js"
635
+ }
636
+ },
637
+ "patterns": [
638
+ {
639
+ "include": "#expression"
640
+ }
641
+ ]
642
+ }
643
+ ]
644
+ },
645
+ "curly-brackets": {
646
+ "patterns": [
647
+ {
648
+ "name": "meta.group.braces.curly",
649
+ "begin": "\\s*\\{",
650
+ "end": "\\s*\\}",
651
+ "endCaptures": {
652
+ "0": {
653
+ "name": "meta.brace.curly.js"
654
+ }
655
+ },
656
+ "beginCaptures": {
657
+ "0": {
658
+ "name": "meta.brace.curly.js"
659
+ }
660
+ },
661
+ "patterns": [
662
+ {
663
+ "include": "$self"
664
+ }
665
+ ]
666
+ }
667
+ ]
668
+ },
669
+ "jsdoc": {
670
+ "patterns": [
671
+ {
672
+ "comment": "common doc @ keywords",
673
+ "match": "(?<!\\w)@(abstract|alias|author|class|constructor|deprecated|enum|event|example|extends|fires|ignore|inheritdoc|member|method|param|private|property|protected|readonly|requires|return|since|static|throws|type|var)\\b",
674
+ "name": "storage.type.class.doc"
675
+ },
676
+ {
677
+ "comment": "additional jsdoc keywords",
678
+ "match": "(?<!\\w)@(access|also|arg|arguments|augments|borrows|callback|classdesc|constant|const|constructs|copyright|default|defaultvalue|desc|description|emits|exception|exports|external|file|fileoverview|function|func|global|host|implements|inner|instance|interface|kind|lends|license|listens|memberof|mixes|mixin|module|name|namsepace|overview|prop|public|returns|see|summary|this|todo|tutorial|typedef|undocumented|variation|version|virtual)\\b",
679
+ "name": "storage.type.class.jsdoc"
680
+ },
681
+ {
682
+ "comment": "additional jsduck keywords",
683
+ "match": "(?<!\\w)@(accessor|alternateClassName|aside|cfg|chainable|docauthor|evented|experimental|ftype|hide|inheritable|localdoc|markdown|mixins|new|override|preventable|ptype|removed|scss mixin|singleton|template|uses|xtype)\\b",
684
+ "name": "storage.type.class.jsduck"
685
+ }
686
+ ]
687
+ },
688
+ "comments": {
689
+ "patterns": [
690
+ {
691
+ "include": "#special-comments-conditional-compilation"
692
+ },
693
+ {
694
+ "name": "comment.block.documentation.js",
695
+ "begin": "\\s*/\\*\\*(?!/)",
696
+ "end": "\\s*\\*/",
697
+ "captures": {
698
+ "0": {
699
+ "name": "punctuation.definition.comment.js"
700
+ }
701
+ },
702
+ "patterns": [
703
+ {
704
+ "include": "#jsdoc"
705
+ }
706
+ ]
707
+ },
708
+ {
709
+ "name": "comment.block.js",
710
+ "begin": "\\s*/\\*",
711
+ "end": "\\s*\\*/",
712
+ "captures": {
713
+ "0": {
714
+ "name": "punctuation.definition.comment.js"
715
+ }
716
+ }
717
+ },
718
+ {
719
+ "name": "comment.block.html.js",
720
+ "match": "\\s*(<!--|-->)",
721
+ "captures": {
722
+ "0": {
723
+ "name": "punctuation.definition.comment.js"
724
+ }
725
+ }
726
+ },
727
+ {
728
+ "name": "comment.line.double-slash.js",
729
+ "begin": "\\s*(//)",
730
+ "end": "\\s*$",
731
+ "beginCaptures": {
732
+ "1": {
733
+ "name": "punctuation.definition.comment.js"
734
+ }
735
+ }
736
+ },
737
+ {
738
+ "name": "comment.line.shebang.js",
739
+ "match": "^(#!).*$\\n?",
740
+ "captures": {
741
+ "1": {
742
+ "name": "punctuation.definition.comment.js"
743
+ }
744
+ }
745
+ }
746
+ ]
747
+ },
748
+ "special-comments-conditional-compilation": {
749
+ "patterns": [
750
+ {
751
+ "name": "comment.block.conditional.js",
752
+ "begin": "\\s*/\\*(?=@)",
753
+ "end": "\\s*\\*/",
754
+ "captures": {
755
+ "0": {
756
+ "name": "punctuation.definition.comment.js"
757
+ }
758
+ },
759
+ "endCaptures": {
760
+ "1": {
761
+ "name": "keyword.control.conditional.js"
762
+ },
763
+ "2": {
764
+ "name": "punctuation.definition.keyword.js"
765
+ }
766
+ },
767
+ "patterns": [
768
+ {
769
+ "name": "punctuation.definition.comment.js",
770
+ "match": "\\s*/\\*"
771
+ },
772
+ {
773
+ "include": "$self"
774
+ }
775
+ ]
776
+ },
777
+ {
778
+ "name": "keyword.control.conditional.js",
779
+ "match": "\\s*(?!@)(@)(if|elif|else|end|ifdef|endif|cc_on|set)\\b",
780
+ "captures": {
781
+ "1": {
782
+ "name": "punctuation.definition.keyword.js"
783
+ }
784
+ }
785
+ },
786
+ {
787
+ "name": "variable.other.conditional.js",
788
+ "match": "\\s*(?!@)(@)(_win32|_win16|_mac|_alpha|_x86|_mc680x0|_PowerPC|_jscript|_jscript_build|_jscript_version|_debug|_fast|[a-zA-Z]\\w+)",
789
+ "captures": {
790
+ "1": {
791
+ "name": "punctuation.definition.variable.js"
792
+ }
793
+ }
794
+ }
795
+ ]
796
+ },
797
+ "literal-punctuation": {
798
+ "patterns": [
799
+ {
800
+ "include": "#literal-semi-colon"
801
+ },
802
+ {
803
+ "include": "#literal-comma"
804
+ }
805
+ ]
806
+ },
807
+ "literal-semi-colon": {
808
+ "patterns": [
809
+ {
810
+ "name": "punctuation.terminator.statement.js",
811
+ "match": "\\s*\\;"
812
+ }
813
+ ]
814
+ },
815
+ "literal-comma": {
816
+ "patterns": [
817
+ {
818
+ "name": "meta.delimiter.comma.js",
819
+ "match": "\\s*,"
820
+ }
821
+ ]
822
+ },
823
+ "literal-keyword-storage": {
824
+ "patterns": [
825
+ {
826
+ "comment": "these statements must end in a ;",
827
+ "begin": "\\s*(?<!\\.)\\b(const|let|var)\\b\\s+(?=[$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}-]*+\\s*:))",
828
+ "end": "\\s*\\;",
829
+ "beginCaptures": {
830
+ "1": {
831
+ "name": "storage.type.js"
832
+ }
833
+ },
834
+ "endCaptures": {
835
+ "0": {
836
+ "name": "punctuation.terminator.statement.js"
837
+ }
838
+ },
839
+ "patterns": [
840
+ {
841
+ "include": "#flowtype-variable"
842
+ }
843
+ ]
844
+ },
845
+ {
846
+ "comment": "these statements must end in a ;",
847
+ "begin": "\\s*(?<!\\.)\\b(const|let|var)\\b\\s+(?=(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})\\s*:)",
848
+ "end": "\\s*\\;",
849
+ "beginCaptures": {
850
+ "1": {
851
+ "name": "storage.type.js"
852
+ }
853
+ },
854
+ "endCaptures": {
855
+ "0": {
856
+ "name": "punctuation.terminator.statement.js"
857
+ }
858
+ },
859
+ "patterns": [
860
+ {
861
+ "include": "#flowtype-destruct-lhs"
862
+ }
863
+ ]
864
+ },
865
+ {
866
+ "comment": "these statements must end in a ;",
867
+ "begin": "\\s*(?<!\\.)\\b(const|let|var)\\b\\s+(?=(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*:)",
868
+ "end": "\\s*\\;",
869
+ "beginCaptures": {
870
+ "1": {
871
+ "name": "storage.type.js"
872
+ }
873
+ },
874
+ "endCaptures": {
875
+ "0": {
876
+ "name": "punctuation.terminator.statement.js"
877
+ }
878
+ },
879
+ "patterns": [
880
+ {
881
+ "include": "#flowtype-destruct-lhs"
882
+ }
883
+ ]
884
+ },
885
+ {
886
+ "comment": "var statements that done start with a flow indicator",
887
+ "name": "storage.type.js",
888
+ "match": "\\s*(?<!\\.)\\b(const|let|var)\\b"
889
+ }
890
+ ]
891
+ },
892
+ "literal-function": {
893
+ "patterns": [
894
+ {
895
+ "comment": "e.g. function play<T>(arg1, arg2) { }",
896
+ "name": "meta.function.js",
897
+ "begin": "\\s*(?:\\b(async)\\b\\s+)?\\s*(\\bfunction\\b)\\s*(\\*?)\\s*([_$a-zA-Z][$\\w]*)?\\s*(?=\\(|<)",
898
+ "end": "(?=\\s*\\{)",
899
+ "applyEndPatternLast": 1,
900
+ "beginCaptures": {
901
+ "1": {
902
+ "name": "storage.type.js"
903
+ },
904
+ "2": {
905
+ "name": "storage.type.function.js"
906
+ },
907
+ "3": {
908
+ "name": "keyword.generator.asterisk.js"
909
+ },
910
+ "4": {
911
+ "name": "entity.name.function.js"
912
+ }
913
+ },
914
+ "patterns": [
915
+ {
916
+ "include": "#flowtype"
917
+ }
918
+ ]
919
+ },
920
+ {
921
+ "comment": "e.g. play = function(arg1, arg2) { }",
922
+ "name": "meta.function.js",
923
+ "begin": "\\s*(\\b[_$a-zA-Z][$\\w]*)\\s*(=)\\s*(?:(async)\\s+)?\\s*(\\bfunction\\b)\\s*(\\*?)\\s*([_$a-zA-Z][$\\w]*)?\\s*(?=\\(|<)",
924
+ "end": "(?=\\s*\\{)",
925
+ "applyEndPatternLast": 1,
926
+ "beginCaptures": {
927
+ "1": {
928
+ "name": "entity.name.function.js"
929
+ },
930
+ "2": {
931
+ "name": "keyword.operator.assignment.js"
932
+ },
933
+ "3": {
934
+ "name": "storage.type.js"
935
+ },
936
+ "4": {
937
+ "name": "storage.type.function.js"
938
+ },
939
+ "5": {
940
+ "name": "keyword.generator.asterisk.js"
941
+ },
942
+ "6": {
943
+ "name": "entity.name.function.js"
944
+ }
945
+ },
946
+ "patterns": [
947
+ {
948
+ "include": "#flowtype"
949
+ }
950
+ ]
951
+ },
952
+ {
953
+ "comment": "e.g. Sound.prototype.play = function(arg1, arg2) { }",
954
+ "name": "meta.prototype.function.js",
955
+ "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*(?=\\(|<)",
956
+ "end": "(?=\\s*\\{)",
957
+ "applyEndPatternLast": 1,
958
+ "beginCaptures": {
959
+ "1": {
960
+ "name": "entity.name.class.js"
961
+ },
962
+ "2": {
963
+ "name": "keyword.operator.accessor.js"
964
+ },
965
+ "3": {
966
+ "name": "variable.language.prototype.js"
967
+ },
968
+ "4": {
969
+ "name": "keyword.operator.accessor.js"
970
+ },
971
+ "5": {
972
+ "name": "entity.name.function.js"
973
+ },
974
+ "6": {
975
+ "name": "keyword.operator.assignment.js"
976
+ },
977
+ "7": {
978
+ "name": "storage.type.js"
979
+ },
980
+ "8": {
981
+ "name": "storage.type.function.js"
982
+ },
983
+ "9": {
984
+ "name": "keyword.generator.asterisk.js"
985
+ },
986
+ "10": {
987
+ "name": "entity.name.function.js"
988
+ }
989
+ },
990
+ "patterns": [
991
+ {
992
+ "include": "#flowtype"
993
+ }
994
+ ]
995
+ },
996
+ {
997
+ "comment": "e.g. Sound.play = function(arg1, arg2) { }",
998
+ "name": "meta.function.static.js",
999
+ "begin": "\\s*(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*(=)\\s*(?:(async)\\s+)?\\s*(\\bfunction\\b)\\s*(\\*?)\\s*([_$a-zA-Z][$\\w]*)?\\s*(?=\\(|<)",
1000
+ "end": "(?=\\s*\\{)",
1001
+ "applyEndPatternLast": 1,
1002
+ "beginCaptures": {
1003
+ "1": {
1004
+ "name": "entity.name.class.js"
1005
+ },
1006
+ "2": {
1007
+ "name": "keyword.operator.accessor.js"
1008
+ },
1009
+ "3": {
1010
+ "name": "entity.name.function.js"
1011
+ },
1012
+ "4": {
1013
+ "name": "keyword.operator.assignment.js"
1014
+ },
1015
+ "5": {
1016
+ "name": "storage.type.js"
1017
+ },
1018
+ "6": {
1019
+ "name": "storage.type.function.js"
1020
+ },
1021
+ "7": {
1022
+ "name": "keyword.generator.asterisk.js"
1023
+ },
1024
+ "8": {
1025
+ "name": "entity.name.function.js"
1026
+ }
1027
+ },
1028
+ "patterns": [
1029
+ {
1030
+ "include": "#flowtype"
1031
+ }
1032
+ ]
1033
+ }
1034
+ ]
1035
+ },
1036
+ "literal-quasi": {
1037
+ "patterns": [
1038
+ {
1039
+ "name": "string.quasi.js",
1040
+ "begin": "\\s*([a-zA-Z$_][\\w$_]*)?(`)",
1041
+ "end": "\\s*(?<!\\\\)`",
1042
+ "beginCaptures": {
1043
+ "1": {
1044
+ "name": "entity.quasi.tag.name.js"
1045
+ },
1046
+ "2": {
1047
+ "name": "punctuation.definition.quasi.begin.js"
1048
+ }
1049
+ },
1050
+ "endCaptures": {
1051
+ "0": {
1052
+ "name": "punctuation.definition.quasi.end.js"
1053
+ }
1054
+ },
1055
+ "patterns": [
1056
+ {
1057
+ "name": "entity.quasi.element.js",
1058
+ "begin": "(?<!\\\\)\\${",
1059
+ "end": "\\s*}",
1060
+ "beginCaptures": {
1061
+ "0": {
1062
+ "name": "punctuation.quasi.element.begin.js"
1063
+ }
1064
+ },
1065
+ "endCaptures": {
1066
+ "0": {
1067
+ "name": "punctuation.quasi.element.end.js"
1068
+ }
1069
+ },
1070
+ "patterns": [
1071
+ {
1072
+ "include": "#expression"
1073
+ }
1074
+ ]
1075
+ },
1076
+ {
1077
+ "include": "#string-content"
1078
+ }
1079
+ ]
1080
+ }
1081
+ ]
1082
+ },
1083
+ "literal-operators": {
1084
+ "patterns": [
1085
+ {
1086
+ "name": "keyword.operator.js",
1087
+ "match": "\\s*(?<!\\.)\\b(delete|in|instanceof|new|of|typeof|void|with)\\b"
1088
+ },
1089
+ {
1090
+ "name": "keyword.operator.logical.js",
1091
+ "match": "\\s*(!(?!=)|&&|\\|\\|)"
1092
+ },
1093
+ {
1094
+ "name": "keyword.operator.assignment.js",
1095
+ "match": "\\s*(=(?!=))"
1096
+ },
1097
+ {
1098
+ "name": "keyword.operator.assignment.augmented.js",
1099
+ "match": "\\s*(%=|&=|\\*=|\\+=|-=|/=|\\^=|\\|=|<<=|>>=|>>>=)"
1100
+ },
1101
+ {
1102
+ "name": "keyword.operator.bitwise.js",
1103
+ "match": "\\s*(~|<<|>>>|>>|&|\\^|\\|)"
1104
+ },
1105
+ {
1106
+ "name": "keyword.operator.relational.js",
1107
+ "match": "\\s*(<=|>=|<|>)"
1108
+ },
1109
+ {
1110
+ "name": "keyword.operator.comparison.js",
1111
+ "match": "\\s*(===|!==|==|!=)"
1112
+ },
1113
+ {
1114
+ "name": "keyword.operator.arithmetic.js",
1115
+ "match": "\\s*(--|\\+\\+|/(?!/|\\*)|%|\\*(?<!/\\*)|\\+|-)"
1116
+ },
1117
+ {
1118
+ "comment": "ternary operator - make sure end : is consumed to avoid mistake as flow type",
1119
+ "begin": "\\s*(\\?)",
1120
+ "end": "\\s*(:)",
1121
+ "beginCaptures": {
1122
+ "1": {
1123
+ "name": "keyword.operator.ternary.js"
1124
+ }
1125
+ },
1126
+ "endCaptures": {
1127
+ "1": {
1128
+ "name": "keyword.operator.ternary.js"
1129
+ }
1130
+ },
1131
+ "patterns": [
1132
+ {
1133
+ "include": "#expression"
1134
+ }
1135
+ ]
1136
+ },
1137
+ {
1138
+ "name": "keyword.operator.spread.js",
1139
+ "match": "\\s*(?<!\\.)\\.\\.\\."
1140
+ },
1141
+ {
1142
+ "name": "keyword.operator.accessor.js",
1143
+ "match": "\\."
1144
+ }
1145
+ ]
1146
+ },
1147
+ "literal-function-call": {
1148
+ "comment": "maybe in array form e.g. foo[bar]()",
1149
+ "patterns": [
1150
+ {
1151
+ "name": "meta.function-call.without-arguments.js",
1152
+ "begin": "\\s*([_$a-zA-Z][$\\w]*)\\s*(?=\\(\\s*\\))",
1153
+ "end": "\\s*(?<=\\))",
1154
+ "beginCaptures": {
1155
+ "1": {
1156
+ "name": "entity.name.function.js"
1157
+ }
1158
+ },
1159
+ "patterns": [
1160
+ {
1161
+ "include": "#flowtype-bracketed-parameters"
1162
+ }
1163
+ ]
1164
+ },
1165
+ {
1166
+ "name": "meta.function-call.without-arguments.js",
1167
+ "begin": "\\s*(?=(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*\\(\\s*\\))",
1168
+ "end": "(?=.)",
1169
+ "applyEndPatternLast": 1,
1170
+ "patterns": [
1171
+ {
1172
+ "include": "#flowtype-parse-array"
1173
+ },
1174
+ {
1175
+ "include": "#flowtype-bracketed-parameters"
1176
+ }
1177
+ ]
1178
+ },
1179
+ {
1180
+ "name": "meta.function-call.with-arguments.js",
1181
+ "begin": "\\s*([_$a-zA-Z][$\\w]*)\\s*(?=\\()",
1182
+ "end": "(?=.)",
1183
+ "applyEndPatternLast": 1,
1184
+ "beginCaptures": {
1185
+ "1": {
1186
+ "name": "entity.name.function.js"
1187
+ }
1188
+ },
1189
+ "patterns": [
1190
+ {
1191
+ "include": "#flowtype-bracketed-parameters"
1192
+ }
1193
+ ]
1194
+ },
1195
+ {
1196
+ "name": "meta.function-call.without-arguments.js",
1197
+ "begin": "\\s*(?=(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*\\()",
1198
+ "end": "(?=.)",
1199
+ "applyEndPatternLast": 1,
1200
+ "patterns": [
1201
+ {
1202
+ "include": "#flowtype-parse-array"
1203
+ },
1204
+ {
1205
+ "include": "#flowtype-bracketed-parameters"
1206
+ }
1207
+ ]
1208
+ }
1209
+ ]
1210
+ },
1211
+ "literal-language-constant": {
1212
+ "patterns": [
1213
+ {
1214
+ "name": "constant.language.boolean.true.js",
1215
+ "match": "\\s*(?<!\\.)\\btrue\\b"
1216
+ },
1217
+ {
1218
+ "name": "constant.language.boolean.false.js",
1219
+ "match": "\\s*(?<!\\.)\\bfalse\\b"
1220
+ },
1221
+ {
1222
+ "name": "constant.language.null.js",
1223
+ "match": "\\s*(?<!\\.)\\bnull\\b"
1224
+ },
1225
+ {
1226
+ "name": "constant.language.undefined.js",
1227
+ "match": "\\s*(?<!\\.)\\bundefined\\b"
1228
+ },
1229
+ {
1230
+ "name": "constant.language.nan.js",
1231
+ "match": "\\s*(?<!\\.)\\bNaN\\b"
1232
+ }
1233
+ ]
1234
+ },
1235
+ "support": {
1236
+ "patterns": [
1237
+ {
1238
+ "name": "support.class.builtin.js",
1239
+ "match": "\\s*\\b(Array|ArrayBuffer|Boolean|DataView|Date|Float(32|64)Array|Int(8|16|32)Array|Function|GeneratorFunction|Map|Math|Number|Object|Promise|Proxy|RegExp|Set|String|Uint(8|16|32)Array|Uint8ClampedArray|WeakMap|WeakSet)\\b"
1240
+ },
1241
+ {
1242
+ "name": "support.function.js",
1243
+ "match": "\\s*(?<!\\.)\\b(decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|isFinite|isNaN|parseFloat|parseInt|unescape)\\b"
1244
+ },
1245
+ {
1246
+ "name": "support.function.mutator.js",
1247
+ "match": "(?<=\\.)(shift|sort|splice|unshift|pop|push|reverse)\\b"
1248
+ },
1249
+ {
1250
+ "name": "support.class.error.js",
1251
+ "match": "\\s*(?<!\\.)\\b((Eval|Range|Reference|Syntax|Type|URI)?Error)\\b"
1252
+ },
1253
+ {
1254
+ "name": "keyword.other.js",
1255
+ "match": "\\s*(?<!\\.)\\b(debugger)\\b"
1256
+ },
1257
+ {
1258
+ "name": "support.type.object.dom.js",
1259
+ "match": "\\s*(?<!\\.)\\b(document|window)\\b"
1260
+ },
1261
+ {
1262
+ "name": "support.constant.dom.js",
1263
+ "match": "\\s*\\b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\\b"
1264
+ },
1265
+ {
1266
+ "match": "\\s*(?<!\\.)\\b(console)(?:(\\.)(warn|info|log|error|time|timeEnd|assert))?\\b",
1267
+ "captures": {
1268
+ "1": {
1269
+ "name": "support.type.object.console.js"
1270
+ },
1271
+ "2": {
1272
+ "name": "keyword.operator.accessor.js"
1273
+ },
1274
+ "3": {
1275
+ "name": "support.function.console.js"
1276
+ }
1277
+ }
1278
+ },
1279
+ {
1280
+ "match": "\\s*(?<!\\.)\\b(process)(?:(\\.)(stdout|stderr|stdin|argv|execPath|execArgv|env|exitCode|version|versions|config|pid|title|arch|platform|mainModule))?\\b",
1281
+ "captures": {
1282
+ "1": {
1283
+ "name": "support.type.object.process.js"
1284
+ },
1285
+ "2": {
1286
+ "name": "keyword.operator.accessor.js"
1287
+ },
1288
+ "3": {
1289
+ "name": "support.type.object.process.js"
1290
+ }
1291
+ }
1292
+ },
1293
+ {
1294
+ "match": "\\s*(?<!\\.)\\b(process)(?:(\\.)(abort|chdir|cwd|exit|getgid|setgid|getuid|setuid|setgroups|getgroups|initgroups|kill|memoryUsage|nextTick|umask|uptime|hrtime))?\\b",
1295
+ "captures": {
1296
+ "1": {
1297
+ "name": "support.type.object.process.js"
1298
+ },
1299
+ "2": {
1300
+ "name": "keyword.operator.accessor.js"
1301
+ },
1302
+ "3": {
1303
+ "name": "support.function.process.js"
1304
+ }
1305
+ }
1306
+ },
1307
+ {
1308
+ "match": "\\s*\\b(((?<!\\.)module\\.((?<!\\,)exports|id|require|parent|filename|loaded|children)|exports))\\b",
1309
+ "captures": {
1310
+ "1": {
1311
+ "name": "support.type.object.module.js"
1312
+ },
1313
+ "2": {
1314
+ "name": "keyword.operator.accessor.js"
1315
+ },
1316
+ "3": {
1317
+ "name": "support.type.object.module.js"
1318
+ }
1319
+ }
1320
+ },
1321
+ {
1322
+ "name": "support.type.object.node.js",
1323
+ "match": "\\s*(?<!\\.)\\b(global|GLOBAL|root|__dirname|__filename)\\b"
1324
+ },
1325
+ {
1326
+ "name": "support.class.node.js",
1327
+ "match": "\\s*\\b(Buffer|EventEmitter|Server|Pipe|Socket|REPLServer|ReadStream|WriteStream|Stream|Inflate|Deflate|InflateRaw|DeflateRaw|GZip|GUnzip|Unzip|Zip)\\b"
1328
+ },
1329
+ {
1330
+ "name": "meta.tag.mustache.js",
1331
+ "begin": "\\s*{{",
1332
+ "end": "\\s*}}"
1333
+ }
1334
+ ]
1335
+ },
1336
+ "literal-class": {
1337
+ "patterns": [
1338
+ {
1339
+ "comment": "Classes",
1340
+ "begin": "\\s*(?<!\\.)\\b(class)\\s+",
1341
+ "end": "\\s*(})",
1342
+ "beginCaptures": {
1343
+ "0": {
1344
+ "name": "meta.class.js"
1345
+ },
1346
+ "1": {
1347
+ "name": "storage.type.class.js"
1348
+ }
1349
+ },
1350
+ "endCaptures": {
1351
+ "1": {
1352
+ "name": "punctuation.section.class.end.js"
1353
+ }
1354
+ },
1355
+ "patterns": [
1356
+ {
1357
+ "match": "\\s*\\b(extends)\\b\\s*",
1358
+ "captures": {
1359
+ "0": {
1360
+ "name": "meta.class.extends.js"
1361
+ },
1362
+ "1": {
1363
+ "name": "storage.type.extends.js"
1364
+ }
1365
+ }
1366
+ },
1367
+ {
1368
+ "include": "#flowtype-class-name"
1369
+ },
1370
+ {
1371
+ "include": "#flowtype-polymorphs"
1372
+ },
1373
+ {
1374
+ "begin": "\\s*{",
1375
+ "end": "\\s*(?=})",
1376
+ "contentName": "meta.class.body.js",
1377
+ "beginCaptures": {
1378
+ "0": {
1379
+ "name": "punctuation.section.class.begin.js"
1380
+ }
1381
+ },
1382
+ "patterns": [
1383
+ {
1384
+ "match": "\\s*\\b(?<!\\.)static\\b(?!\\.)",
1385
+ "name": "storage.modifier.js"
1386
+ },
1387
+ {
1388
+ "include": "#literal-method"
1389
+ },
1390
+ {
1391
+ "include": "#brackets"
1392
+ },
1393
+ {
1394
+ "include": "#es7-decorators"
1395
+ },
1396
+ {
1397
+ "include": "#comments"
1398
+ },
1399
+ {
1400
+ "include": "#flowtype-variable"
1401
+ },
1402
+ {
1403
+ "include": "#literal-semi-colon"
1404
+ }
1405
+ ]
1406
+ },
1407
+ {
1408
+ "include": "#expression"
1409
+ }
1410
+ ]
1411
+ }
1412
+ ]
1413
+ },
1414
+ "literal-method-call": {
1415
+ "patterns": [
1416
+ {
1417
+ "name": "meta.function-call.static.without-arguments.js",
1418
+ "comment": "e.g Abc.aaa()",
1419
+ "match": "\\s*(?:(?<=\\.)|\\b)([A-Z][$\\w]*)\\s*(\\.)([_$a-zA-Z][$\\w]*)\\s*(\\(\\s*\\))",
1420
+ "captures": {
1421
+ "1": {
1422
+ "name": "variable.other.class.js"
1423
+ },
1424
+ "2": {
1425
+ "name": "keyword.operator.accessor.js"
1426
+ },
1427
+ "3": {
1428
+ "name": "entity.name.function.js"
1429
+ },
1430
+ "4": {
1431
+ "name": "meta.group.braces.round.function.arguments.js"
1432
+ }
1433
+ }
1434
+ },
1435
+ {
1436
+ "name": "meta.function-call.static.with-arguments.js",
1437
+ "match": "\\s*(?:(?<=\\.)|\\b)\\s*([A-Z][$\\w]*)\\s*(\\.)([_$a-zA-Z][$\\w]*)\\s*(?=\\()",
1438
+ "captures": {
1439
+ "1": {
1440
+ "name": "variable.other.class.js"
1441
+ },
1442
+ "2": {
1443
+ "name": "keyword.operator.accessor.js"
1444
+ },
1445
+ "3": {
1446
+ "name": "entity.name.function.js"
1447
+ }
1448
+ }
1449
+ },
1450
+ {
1451
+ "name": "meta.function-call.method.without-arguments.js",
1452
+ "match": "\\s*(?<=\\.)\\s*([_$a-zA-Z][$\\w]*)\\s*(\\(\\s*\\))",
1453
+ "captures": {
1454
+ "1": {
1455
+ "name": "entity.name.function.js"
1456
+ },
1457
+ "2": {
1458
+ "name": "meta.group.braces.round.function.arguments.js"
1459
+ }
1460
+ }
1461
+ },
1462
+ {
1463
+ "name": "meta.function-call.method.with-arguments.js",
1464
+ "match": "\\s*(?<=\\.)([_$a-zA-Z][$\\w]*)\\s*(?=\\()",
1465
+ "captures": {
1466
+ "1": {
1467
+ "name": "entity.name.function.js"
1468
+ }
1469
+ }
1470
+ }
1471
+ ]
1472
+ },
1473
+ "literal-language-variable": {
1474
+ "patterns": [
1475
+ {
1476
+ "name": "variable.language.arguments.js",
1477
+ "match": "\\s*(?<!(?<!\\.\\.)\\.)\\b(arguments)\\b"
1478
+ },
1479
+ {
1480
+ "name": "variable.language.super.js",
1481
+ "match": "\\s*(?<!(?<!\\.\\.)\\.)\\b(super)\\b\\s*(?!\\()"
1482
+ },
1483
+ {
1484
+ "name": "variable.language.this.js",
1485
+ "match": "\\s*(?<!(?<!\\.\\.)\\.)\\b(this)\\b"
1486
+ },
1487
+ {
1488
+ "name": "variable.language.self.js",
1489
+ "match": "\\s*(?<!(?<!\\.\\.)\\.)\\b(self)\\b\\s*(?!\\()"
1490
+ },
1491
+ {
1492
+ "name": "variable.language.proto.js",
1493
+ "match": "\\s*(?<=\\.)\\b(__proto__)\\b"
1494
+ },
1495
+ {
1496
+ "name": "variable.language.constructor.js",
1497
+ "match": "\\s*(?<=\\.)\\b(constructor)\\b\\s*(?!\\()"
1498
+ },
1499
+ {
1500
+ "name": "variable.language.prototype.js",
1501
+ "match": "\\s*(?<=\\.)\\b(prototype)\\b"
1502
+ }
1503
+ ]
1504
+ },
1505
+ "string-content": {
1506
+ "patterns": [
1507
+ {
1508
+ "name": "constant.character.escape.newline.js",
1509
+ "match": "\\\\\\s*\\n"
1510
+ },
1511
+ {
1512
+ "name": "constant.character.escape",
1513
+ "match": "\\\\['|\"|\\\\|n|r|t|b|f|v|0]"
1514
+ },
1515
+ {
1516
+ "name": "constant.character.escape",
1517
+ "match": "\\\\u((\\{[0-9a-fA-F]+\\})|[0-9a-fA-F]{4})"
1518
+ },
1519
+ {
1520
+ "name": "constant.character.escape",
1521
+ "match": "\\\\x[0-9a-fA-F]{2}"
1522
+ }
1523
+ ]
1524
+ },
1525
+ "literal-number": {
1526
+ "patterns": [
1527
+ {
1528
+ "match": "\\s*((?i)(?:\\B[-+]|\\b)0x[0-9a-f]*\\.(\\B|\\b[0-9]+))",
1529
+ "captures": {
1530
+ "1": {
1531
+ "name": "invalid.illegal.numeric.hex.js"
1532
+ }
1533
+ }
1534
+ },
1535
+ {
1536
+ "match": "\\s*((?:\\B[-+]|\\b)0[0-9]+\\.(\\B|\\b[0-9]+))",
1537
+ "captures": {
1538
+ "1": {
1539
+ "name": "invalid.illegal.numeric.octal.js"
1540
+ }
1541
+ }
1542
+ },
1543
+ {
1544
+ "match": "\\s*((?:\\B[-+])?(?:\\b0b[0-1]*|\\b0o[0-7]*|\\b0x[0-9a-f]*|(\\B\\.[0-9]+|\\b[0-9]+(\\.[0-9]*)?)(e[-+]?[0-9]+)?))",
1545
+ "captures": {
1546
+ "1": {
1547
+ "name": "constant.numeric.js"
1548
+ }
1549
+ }
1550
+ },
1551
+ {
1552
+ "match": "\\s*((?:\\B[-+]|\\b)(Infinity)\\b)",
1553
+ "captures": {
1554
+ "1": {
1555
+ "name": "constant.language.infinity.js"
1556
+ }
1557
+ }
1558
+ }
1559
+ ]
1560
+ },
1561
+ "literal-constructor": {
1562
+ "patterns": [
1563
+ {
1564
+ "disabled": 1,
1565
+ "name": "meta.instance.constructor",
1566
+ "begin": "\\s*(new)\\s+(?=[_$a-zA-Z][$\\w.]*)",
1567
+ "end": "(?![_$a-zA-Z][$\\w.]*)",
1568
+ "beginCaptures": {
1569
+ "1": {
1570
+ "name": "keyword.operator.new.js"
1571
+ }
1572
+ },
1573
+ "patterns": [
1574
+ {
1575
+ "include": "#support"
1576
+ },
1577
+ {
1578
+ "match": "([_$a-zA-Z][$\\w.]*\\.)?([_$a-zA-Z][$\\w]*)",
1579
+ "captures": {
1580
+ "2": {
1581
+ "name": "entity.name.type.new.js"
1582
+ }
1583
+ }
1584
+ }
1585
+ ]
1586
+ }
1587
+ ]
1588
+ },
1589
+ "literal-arrow-function": {
1590
+ "patterns": [
1591
+ {
1592
+ "comment": "e.g. (args) => { }",
1593
+ "name": "meta.function.arrow.js",
1594
+ "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*=>)",
1595
+ "end": "\\s*(=>)",
1596
+ "applyEndPatternLast": 1,
1597
+ "endCaptures": {
1598
+ "1": {
1599
+ "name": "storage.type.function.arrow.js"
1600
+ }
1601
+ },
1602
+ "beginCaptures": {
1603
+ "1": {
1604
+ "name": "storage.type.js"
1605
+ }
1606
+ },
1607
+ "patterns": [
1608
+ {
1609
+ "include": "#flowtype"
1610
+ }
1611
+ ]
1612
+ },
1613
+ {
1614
+ "comment": "e.g. arg => { }",
1615
+ "name": "meta.function.arrow.js",
1616
+ "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*=>)",
1617
+ "end": "\\s*(=>)",
1618
+ "beginCaptures": {
1619
+ "1": {
1620
+ "name": "storage.type.js"
1621
+ }
1622
+ },
1623
+ "endCaptures": {
1624
+ "1": {
1625
+ "name": "storage.type.function.arrow.js"
1626
+ }
1627
+ },
1628
+ "patterns": [
1629
+ {
1630
+ "include": "#flowtype-polymorphs"
1631
+ },
1632
+ {
1633
+ "include": "#flowtype-variable"
1634
+ }
1635
+ ]
1636
+ },
1637
+ {
1638
+ "comment": "e.g. play = (args) => { }",
1639
+ "name": "meta.function.arrow.js",
1640
+ "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*=>)",
1641
+ "end": "\\s*(=>)",
1642
+ "applyEndPatternLast": 1,
1643
+ "beginCaptures": {
1644
+ "1": {
1645
+ "name": "entity.name.function.js"
1646
+ },
1647
+ "2": {
1648
+ "name": "keyword.operator.assignment.js"
1649
+ },
1650
+ "3": {
1651
+ "name": "storage.type.js"
1652
+ }
1653
+ },
1654
+ "endCaptures": {
1655
+ "1": {
1656
+ "name": "storage.type.function.arrow.js"
1657
+ }
1658
+ },
1659
+ "patterns": [
1660
+ {
1661
+ "include": "#flowtype"
1662
+ }
1663
+ ]
1664
+ },
1665
+ {
1666
+ "comment": "e.g. play = arg => { }",
1667
+ "name": "meta.function.arrow.js",
1668
+ "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*=>)",
1669
+ "end": "\\s*(=>)",
1670
+ "beginCaptures": {
1671
+ "1": {
1672
+ "name": "entity.name.function.js"
1673
+ },
1674
+ "2": {
1675
+ "name": "keyword.operator.assignment.js"
1676
+ },
1677
+ "3": {
1678
+ "name": "storage.type.js"
1679
+ }
1680
+ },
1681
+ "endCaptures": {
1682
+ "1": {
1683
+ "name": "storage.type.function.arrow.js"
1684
+ }
1685
+ },
1686
+ "patterns": [
1687
+ {
1688
+ "include": "#flowtype-polymorphs"
1689
+ },
1690
+ {
1691
+ "include": "#flowtype-variable"
1692
+ }
1693
+ ]
1694
+ },
1695
+ {
1696
+ "comment": "Sound.prototype.play = (args) => { }",
1697
+ "name": "meta.prototype.function.arrow.js",
1698
+ "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*=>)",
1699
+ "end": "\\s*(=>)",
1700
+ "applyEndPatternLast": 1,
1701
+ "beginCaptures": {
1702
+ "1": {
1703
+ "name": "entity.name.class.js"
1704
+ },
1705
+ "2": {
1706
+ "name": "keyword.operator.accessor.js"
1707
+ },
1708
+ "3": {
1709
+ "name": "variable.language.prototype.js"
1710
+ },
1711
+ "4": {
1712
+ "name": "keyword.operator.accessor.js"
1713
+ },
1714
+ "5": {
1715
+ "name": "entity.name.function.js"
1716
+ },
1717
+ "6": {
1718
+ "name": "keyword.operator.assignment.js"
1719
+ },
1720
+ "7": {
1721
+ "name": "storage.type.js"
1722
+ }
1723
+ },
1724
+ "endCaptures": {
1725
+ "1": {
1726
+ "name": "storage.type.function.arrow.js"
1727
+ }
1728
+ },
1729
+ "patterns": [
1730
+ {
1731
+ "include": "#flowtype"
1732
+ }
1733
+ ]
1734
+ },
1735
+ {
1736
+ "comment": "e.g. Sound.prototype.play = arg => { }",
1737
+ "name": "meta.prototype.function.arrow.js",
1738
+ "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*=>)",
1739
+ "end": "\\s*(=>)",
1740
+ "beginCaptures": {
1741
+ "1": {
1742
+ "name": "entity.name.class.js"
1743
+ },
1744
+ "2": {
1745
+ "name": "keyword.operator.accessor.js"
1746
+ },
1747
+ "3": {
1748
+ "name": "variable.language.prototype.js"
1749
+ },
1750
+ "4": {
1751
+ "name": "keyword.operator.accessor.js"
1752
+ },
1753
+ "5": {
1754
+ "name": "entity.name.function.js"
1755
+ },
1756
+ "6": {
1757
+ "name": "keyword.operator.assignment.js"
1758
+ },
1759
+ "7": {
1760
+ "name": "storage.type.js"
1761
+ }
1762
+ },
1763
+ "endCaptures": {
1764
+ "1": {
1765
+ "name": "storage.type.function.arrow.js"
1766
+ }
1767
+ },
1768
+ "patterns": [
1769
+ {
1770
+ "include": "#flowtype-polymorphs"
1771
+ },
1772
+ {
1773
+ "include": "#flowtype-variable"
1774
+ }
1775
+ ]
1776
+ },
1777
+ {
1778
+ "comment": "e.g. Sound.play = (args) => { }",
1779
+ "name": "meta.function.static.arrow.js",
1780
+ "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*=>)",
1781
+ "end": "\\s*(=>)",
1782
+ "applyEndPatternLast": 1,
1783
+ "beginCaptures": {
1784
+ "1": {
1785
+ "name": "entity.name.class.js"
1786
+ },
1787
+ "2": {
1788
+ "name": "keyword.operator.accessor.js"
1789
+ },
1790
+ "3": {
1791
+ "name": "entity.name.function.js"
1792
+ },
1793
+ "4": {
1794
+ "name": "keyword.operator.assignment.js"
1795
+ },
1796
+ "5": {
1797
+ "name": "storage.type.js"
1798
+ }
1799
+ },
1800
+ "endCaptures": {
1801
+ "1": {
1802
+ "name": "storage.type.function.arrow.js"
1803
+ }
1804
+ },
1805
+ "patterns": [
1806
+ {
1807
+ "include": "#flowtype"
1808
+ }
1809
+ ]
1810
+ },
1811
+ {
1812
+ "comment": "e.g. Sound.play = arg => { }",
1813
+ "name": "meta.function.static.arrow.js",
1814
+ "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*=>)",
1815
+ "end": "\\s*(=>)",
1816
+ "beginCaptures": {
1817
+ "1": {
1818
+ "name": "entity.name.class.js"
1819
+ },
1820
+ "2": {
1821
+ "name": "keyword.operator.accessor.js"
1822
+ },
1823
+ "3": {
1824
+ "name": "entity.name.function.js"
1825
+ },
1826
+ "4": {
1827
+ "name": "keyword.operator.assignment.js"
1828
+ },
1829
+ "5": {
1830
+ "name": "storage.type.js"
1831
+ }
1832
+ },
1833
+ "endCaptures": {
1834
+ "1": {
1835
+ "name": "storage.type.function.arrow.js"
1836
+ }
1837
+ },
1838
+ "patterns": [
1839
+ {
1840
+ "include": "#flowtype-polymorphs"
1841
+ },
1842
+ {
1843
+ "include": "#flowtype-variable"
1844
+ }
1845
+ ]
1846
+ }
1847
+ ]
1848
+ },
1849
+ "literal-method": {
1850
+ "patterns": [
1851
+ {
1852
+ "comment": "e.g. play<T,T>(arg1, arg2): Type<T> { }",
1853
+ "name": "meta.function.method.js",
1854
+ "begin": "\\s*(\\bstatic\\b)?\\s*(\\basync\\b)?\\s*(\\*?)\\s*(?<!\\.)([_$a-zA-Z][$\\w]*)\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?(\\())",
1855
+ "end": "\\s*(?=.)",
1856
+ "applyEndPatternLast": 1,
1857
+ "beginCaptures": {
1858
+ "1": {
1859
+ "name": "storage.modifier.js"
1860
+ },
1861
+ "2": {
1862
+ "name": "storage.type.js"
1863
+ },
1864
+ "3": {
1865
+ "name": "keyword.generator.asterisk.js"
1866
+ },
1867
+ "4": {
1868
+ "name": "entity.name.function.method.js"
1869
+ }
1870
+ },
1871
+ "patterns": [
1872
+ {
1873
+ "include": "#flowtype"
1874
+ }
1875
+ ]
1876
+ },
1877
+ {
1878
+ "comment": "e.g. [var]<T,T>(arg1, arg2): Type<T> { } or 'var'<T,T>(arg1, arg2)",
1879
+ "name": "meta.function.method.js",
1880
+ "begin": "\\s*(\\bstatic\\b)?\\s*(\\basync\\b)?\\s*(\\*?)\\s*(?=((\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*(((')((?:[^']|\\\\')*)('))|\\s*((\")((?:[^\"]|\\\\\")*)(\"))))\\s*(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*(\\())",
1881
+ "end": "\\s*(?=.)",
1882
+ "applyEndPatternLast": 1,
1883
+ "beginCaptures": {
1884
+ "1": {
1885
+ "name": "storage.modifier.js"
1886
+ },
1887
+ "2": {
1888
+ "name": "storage.type.js"
1889
+ },
1890
+ "3": {
1891
+ "name": "keyword.generator.asterisk.js"
1892
+ },
1893
+ "4": {
1894
+ "name": "entity.name.function.method.js"
1895
+ },
1896
+ "6": {
1897
+ "name": "entity.name.function.method.js"
1898
+ }
1899
+ },
1900
+ "patterns": [
1901
+ {
1902
+ "include": "#flowtype-parse-array"
1903
+ },
1904
+ {
1905
+ "include": "#literal-string"
1906
+ },
1907
+ {
1908
+ "include": "#flowtype"
1909
+ }
1910
+ ]
1911
+ },
1912
+ {
1913
+ "comment": "getter/setter",
1914
+ "name": "meta.accessor.js",
1915
+ "begin": "\\s*\\b(?:(static)\\s+)?(get|set)\\s+([_$a-zA-Z][$\\w]*)\\s*(?=\\()",
1916
+ "end": "\\s*(?={)",
1917
+ "applyEndPatternLast": 1,
1918
+ "beginCaptures": {
1919
+ "1": {
1920
+ "name": "storage.modifier.static.js"
1921
+ },
1922
+ "2": {
1923
+ "name": "storage.type.accessor.js"
1924
+ },
1925
+ "3": {
1926
+ "name": "entity.name.accessor.js"
1927
+ }
1928
+ },
1929
+ "patterns": [
1930
+ {
1931
+ "include": "#flowtype"
1932
+ }
1933
+ ]
1934
+ },
1935
+ {
1936
+ "comment": "getter/setter set [var]() or get 'name'()",
1937
+ "name": "meta.accessor.js",
1938
+ "begin": "\\s*\\b(?:(static)\\s+)?(get|set)\\s+(?=((\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])|\\s*(((')((?:[^']|\\\\')*)('))|\\s*((\")((?:[^\"]|\\\\\")*)(\"))))\\s*(\\())",
1939
+ "end": "\\s*(?={)",
1940
+ "applyEndPatternLast": 1,
1941
+ "beginCaptures": {
1942
+ "1": {
1943
+ "name": "storage.modifier.static.js"
1944
+ },
1945
+ "2": {
1946
+ "name": "storage.type.accessor.js"
1947
+ },
1948
+ "3": {
1949
+ "name": "entity.name.accessor.js"
1950
+ }
1951
+ },
1952
+ "patterns": [
1953
+ {
1954
+ "include": "#flowtype-parse-array"
1955
+ },
1956
+ {
1957
+ "include": "#literal-string"
1958
+ },
1959
+ {
1960
+ "include": "#flowtype"
1961
+ }
1962
+ ]
1963
+ }
1964
+ ]
1965
+ },
1966
+ "literal-regexp": {
1967
+ "patterns": [
1968
+ {
1969
+ "name": "string.regexp.js",
1970
+ "begin": "(?<=\\.|\\(|,|{|}|\\[|;|,|<|>|<=|>=|==|!=|===|!==|\\+|-|\\*|%|\\+\\+|--|<<|>>|>>>|&|\\||\\^|!|~|&&|\\|\\||\\?|:|=|\\+=|-=|\\*=|%=|<<=|>>=|>>>=|&=|\\|=|\\^=|/|/=|\\Wnew|\\Wdelete|\\Wvoid|\\Wtypeof|\\Winstanceof|\\Win|\\Wdo|\\Wreturn|\\Wcase|\\Wthrow|^new|^delete|^void|^typeof|^instanceof|^in|^do|^return|^case|^throw|^)\\s*(/)(?!/|\\*|$)",
1971
+ "end": "(/)([gimy]*)",
1972
+ "beginCaptures": {
1973
+ "1": {
1974
+ "name": "punctuation.definition.string.begin.js"
1975
+ }
1976
+ },
1977
+ "endCaptures": {
1978
+ "1": {
1979
+ "name": "punctuation.definition.string.end.js"
1980
+ },
1981
+ "2": {
1982
+ "name": "keyword.other.js"
1983
+ }
1984
+ },
1985
+ "patterns": [
1986
+ {
1987
+ "include": "source.regexp.babel"
1988
+ }
1989
+ ]
1990
+ }
1991
+ ]
1992
+ },
1993
+ "literal-string": {
1994
+ "patterns": [
1995
+ {
1996
+ "contentName": "string.quoted.single.js",
1997
+ "begin": "\\s*(('))",
1998
+ "end": "(('))|(\\n)",
1999
+ "beginCaptures": {
2000
+ "1": {
2001
+ "name": "string.quoted.single.js"
2002
+ },
2003
+ "2": {
2004
+ "name": "punctuation.definition.string.begin.js"
2005
+ }
2006
+ },
2007
+ "endCaptures": {
2008
+ "1": {
2009
+ "name": "string.quoted.single.js"
2010
+ },
2011
+ "2": {
2012
+ "name": "punctuation.definition.string.end.js"
2013
+ },
2014
+ "3": {
2015
+ "name": "invalid.illegal.newline.js"
2016
+ }
2017
+ },
2018
+ "patterns": [
2019
+ {
2020
+ "include": "#string-content"
2021
+ }
2022
+ ]
2023
+ },
2024
+ {
2025
+ "contentName": "string.quoted.double.js",
2026
+ "begin": "\\s*((\"))",
2027
+ "end": "((\"))|(\\n)",
2028
+ "beginCaptures": {
2029
+ "1": {
2030
+ "name": "string.quoted.double.js"
2031
+ },
2032
+ "2": {
2033
+ "name": "punctuation.definition.string.begin.js"
2034
+ }
2035
+ },
2036
+ "endCaptures": {
2037
+ "1": {
2038
+ "name": "string.quoted.double.js"
2039
+ },
2040
+ "2": {
2041
+ "name": "punctuation.definition.string.end.js"
2042
+ },
2043
+ "3": {
2044
+ "name": "invalid.illegal.newline.js"
2045
+ }
2046
+ },
2047
+ "patterns": [
2048
+ {
2049
+ "include": "#string-content"
2050
+ }
2051
+ ]
2052
+ }
2053
+ ]
2054
+ },
2055
+ "literal-module": {
2056
+ "patterns": [
2057
+ {
2058
+ "name": "keyword.control.module.js",
2059
+ "match": "\\s*(?<!\\.)\\b(import|export|default)\\b"
2060
+ },
2061
+ {
2062
+ "name": "keyword.control.module.reference.js",
2063
+ "match": "\\s*(?<!\\.)\\b(from|as)\\b"
2064
+ }
2065
+ ]
2066
+ },
2067
+ "literal-variable": {
2068
+ "patterns": [
2069
+ {
2070
+ "comment": "e.g. CONSTANT",
2071
+ "name": "variable.other.constant.js",
2072
+ "match": "\\s*[A-Z][_$\\dA-Z]*\\b"
2073
+ },
2074
+ {
2075
+ "comment": "e.g. dollar vars",
2076
+ "name": "variable.other.dollar.js",
2077
+ "match": "\\s*\\$[$\\w]*"
2078
+ },
2079
+ {
2080
+ "comment": "e.g. Class.property",
2081
+ "name": "meta.property.class.js",
2082
+ "match": "\\s*\\b([A-Z][$\\w]*)\\s*(\\.)([_$a-zA-Z][$\\w]*)",
2083
+ "captures": {
2084
+ "1": {
2085
+ "name": "variable.other.class.js"
2086
+ },
2087
+ "2": {
2088
+ "name": "keyword.operator.accessor.js"
2089
+ },
2090
+ "3": {
2091
+ "name": "variable.other.property.static.js"
2092
+ }
2093
+ }
2094
+ },
2095
+ {
2096
+ "comment": "e.g. obj.property",
2097
+ "name": "variable.other.object.js",
2098
+ "match": "\\s*(?<!\\.)[_$a-zA-Z][$\\w]*\\s*(?=[\\[\\.])",
2099
+ "captures": {
2100
+ "1": {
2101
+ "name": "variable.other.object.js"
2102
+ }
2103
+ }
2104
+ },
2105
+ {
2106
+ "comment": "e.g. obj.property",
2107
+ "name": "meta.property.object.js",
2108
+ "match": "\\s*(?<=\\.)\\s*[_$a-zA-Z][$\\w]*",
2109
+ "captures": {
2110
+ "0": {
2111
+ "name": "variable.other.property.js"
2112
+ }
2113
+ }
2114
+ },
2115
+ {
2116
+ "name": "variable.other.readwrite.js",
2117
+ "match": "\\s*[_$a-zA-Z][$\\w]*"
2118
+ }
2119
+ ]
2120
+ },
2121
+ "literal-prototype": {
2122
+ "patterns": [
2123
+ {
2124
+ "comment": "e.g. Sound.prototype",
2125
+ "name": "meta.prototype.access.js",
2126
+ "match": "\\s*([_$a-zA-Z][$\\w]*)(\\.)(prototype)\\b",
2127
+ "captures": {
2128
+ "1": {
2129
+ "name": "entity.name.class.js"
2130
+ },
2131
+ "2": {
2132
+ "name": "keyword.operator.accessor.js"
2133
+ },
2134
+ "3": {
2135
+ "name": "variable.language.prototype.js"
2136
+ }
2137
+ }
2138
+ },
2139
+ {
2140
+ "comment": "e.g. Sound.prototype = { }",
2141
+ "name": "meta.prototype.declaration.js",
2142
+ "match": "\\s*([_$a-zA-Z][$\\w]*)(\\.)(prototype)\\s*=\\s*",
2143
+ "captures": {
2144
+ "1": {
2145
+ "name": "entity.name.class.js"
2146
+ },
2147
+ "2": {
2148
+ "name": "keyword.operator.accessor.js"
2149
+ },
2150
+ "3": {
2151
+ "name": "variable.language.prototype.js"
2152
+ }
2153
+ }
2154
+ }
2155
+ ]
2156
+ },
2157
+ "es7-decorators": {
2158
+ "patterns": [
2159
+ {
2160
+ "comment": "https://github.com/wycats/javascript-decorators",
2161
+ "name": "tag.decorator.js",
2162
+ "match": "\\s*(?<!@)(@)([_$a-zA-Z][$\\w]*)\\b",
2163
+ "captures": {
2164
+ "1": {
2165
+ "name": "punctuation.definition.tag.js"
2166
+ },
2167
+ "2": {
2168
+ "name": "entity.name.tag.js"
2169
+ }
2170
+ }
2171
+ }
2172
+ ]
2173
+ },
2174
+ "jsx": {
2175
+ "comment": "Avoid < operator expressions as best we can using Zertosh's regex",
2176
+ "patterns": [
2177
+ {
2178
+ "begin": "(?<=\\(|\\{|\\[|,|&&|\\|\\||\\?|:|=|=>|\\Wreturn|^return|^)\\s*(?=<[_$a-zA-Z])",
2179
+ "end": "(?=.)",
2180
+ "applyEndPatternLast": 1,
2181
+ "patterns": [
2182
+ {
2183
+ "include": "#jsx-tag-element-name"
2184
+ }
2185
+ ]
2186
+ }
2187
+ ]
2188
+ },
2189
+ "jsx-tag-element-name": {
2190
+ "patterns": [
2191
+ {
2192
+ "comment": "Tags that end > are trapped in #jsx-tag-termination",
2193
+ "name": "meta.tag.jsx",
2194
+ "begin": "\\s*(<)([$_\\p{L}](?:[$.:\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}-](?<!\\.\\.))*+)(?=[/>\\s])(?<![\\.:])",
2195
+ "end": "\\s*(?<=</)(\\2)(>)|(/>)|((?<=</)[\\S ]*?)>",
2196
+ "beginCaptures": {
2197
+ "1": {
2198
+ "name": "punctuation.definition.tag.jsx"
2199
+ },
2200
+ "2": {
2201
+ "name": "entity.name.tag.open.jsx"
2202
+ }
2203
+ },
2204
+ "endCaptures": {
2205
+ "1": {
2206
+ "name": "entity.name.tag.close.jsx"
2207
+ },
2208
+ "2": {
2209
+ "name": "punctuation.definition.tag.jsx"
2210
+ },
2211
+ "3": {
2212
+ "name": "punctuation.definition.tag.jsx"
2213
+ },
2214
+ "4": {
2215
+ "name": "invalid.illegal.termination.jsx"
2216
+ }
2217
+ },
2218
+ "patterns": [
2219
+ {
2220
+ "include": "#jsx-tag-termination"
2221
+ },
2222
+ {
2223
+ "include": "#jsx-tag-attributes"
2224
+ }
2225
+ ]
2226
+ }
2227
+ ]
2228
+ },
2229
+ "jsx-tag-termination": {
2230
+ "patterns": [
2231
+ {
2232
+ "comment": "uses non consuming search for </ in </tag>",
2233
+ "begin": "(>)",
2234
+ "end": "(</)",
2235
+ "beginCaptures": {
2236
+ "0": {
2237
+ "name": "punctuation.definition.tag.jsx"
2238
+ },
2239
+ "1": {
2240
+ "name": "JSXStartTagEnd"
2241
+ }
2242
+ },
2243
+ "endCaptures": {
2244
+ "0": {
2245
+ "name": "punctuation.definition.tag.jsx"
2246
+ },
2247
+ "1": {
2248
+ "name": "JSXEndTagStart"
2249
+ }
2250
+ },
2251
+ "patterns": [
2252
+ {
2253
+ "include": "#jsx-evaluated-code"
2254
+ },
2255
+ {
2256
+ "include": "#jsx-entities"
2257
+ },
2258
+ {
2259
+ "include": "#jsx-tag-element-name"
2260
+ }
2261
+ ]
2262
+ }
2263
+ ]
2264
+ },
2265
+ "jsx-tag-attributes": {
2266
+ "patterns": [
2267
+ {
2268
+ "include": "#jsx-attribute-name"
2269
+ },
2270
+ {
2271
+ "include": "#jsx-assignment"
2272
+ },
2273
+ {
2274
+ "include": "#jsx-string-double-quoted"
2275
+ },
2276
+ {
2277
+ "include": "#jsx-string-single-quoted"
2278
+ },
2279
+ {
2280
+ "include": "#jsx-evaluated-code"
2281
+ },
2282
+ {
2283
+ "include": "#jsx-tag-element-name"
2284
+ },
2285
+ {
2286
+ "include": "#comments"
2287
+ }
2288
+ ]
2289
+ },
2290
+ "jsx-spread-attribute": {
2291
+ "patterns": [
2292
+ {
2293
+ "comment": "Spread attribute { ... AssignmentExpression }",
2294
+ "match": "(?<!\\.)\\.\\.\\.",
2295
+ "name": "keyword.operator.spread.jsx"
2296
+ }
2297
+ ]
2298
+ },
2299
+ "jsx-attribute-name": {
2300
+ "patterns": [
2301
+ {
2302
+ "comment": "look for attribute name",
2303
+ "match": "(?<!\\S)([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}-](?<!\\.\\.))*+)(?<!\\.)(?=//|/\\*|=|\\s|>|/>)",
2304
+ "captures": {
2305
+ "0": {
2306
+ "name": "entity.other.attribute-name.jsx"
2307
+ }
2308
+ }
2309
+ }
2310
+ ]
2311
+ },
2312
+ "jsx-assignment": {
2313
+ "patterns": [
2314
+ {
2315
+ "comment": "look for attribute assignment",
2316
+ "name": "keyword.operator.assignment.jsx",
2317
+ "match": "=(?=\\s*(?:'|\"|{|/\\*|<|//|\\n))"
2318
+ }
2319
+ ]
2320
+ },
2321
+ "jsx-string-double-quoted": {
2322
+ "name": "string.quoted.double.js",
2323
+ "begin": "\"",
2324
+ "end": "\"(?<!\\\\\")",
2325
+ "beginCaptures": {
2326
+ "0": {
2327
+ "name": "punctuation.definition.string.begin.jsx"
2328
+ }
2329
+ },
2330
+ "endCaptures": {
2331
+ "0": {
2332
+ "name": "punctuation.definition.string.end.jsx"
2333
+ }
2334
+ },
2335
+ "patterns": [
2336
+ {
2337
+ "include": "#jsx-entities"
2338
+ }
2339
+ ]
2340
+ },
2341
+ "jsx-string-single-quoted": {
2342
+ "name": "string.quoted.single.js",
2343
+ "begin": "'",
2344
+ "end": "'(?<!\\\\')",
2345
+ "beginCaptures": {
2346
+ "0": {
2347
+ "name": "punctuation.definition.string.begin.jsx"
2348
+ }
2349
+ },
2350
+ "endCaptures": {
2351
+ "0": {
2352
+ "name": "punctuation.definition.string.end.jsx"
2353
+ }
2354
+ },
2355
+ "patterns": [
2356
+ {
2357
+ "include": "#jsx-entities"
2358
+ }
2359
+ ]
2360
+ },
2361
+ "jsx-evaluated-code": {
2362
+ "name": "meta.embedded.expression.js",
2363
+ "begin": "{",
2364
+ "end": "}",
2365
+ "beginCaptures": {
2366
+ "0": {
2367
+ "name": "punctuation.section.embedded.begin.jsx"
2368
+ }
2369
+ },
2370
+ "endCaptures": {
2371
+ "0": {
2372
+ "name": "punctuation.section.embedded.end.jsx"
2373
+ }
2374
+ },
2375
+ "contentName": "source.js.jsx",
2376
+ "patterns": [
2377
+ {
2378
+ "include": "#jsx-string-double-quoted"
2379
+ },
2380
+ {
2381
+ "include": "#jsx-string-single-quoted"
2382
+ },
2383
+ {
2384
+ "include": "#jsx-spread-attribute"
2385
+ },
2386
+ {
2387
+ "include": "#expression"
2388
+ }
2389
+ ]
2390
+ },
2391
+ "jsx-entities": {
2392
+ "patterns": [
2393
+ {
2394
+ "comment": "Embeded HTML entities &blah",
2395
+ "match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)",
2396
+ "captures": {
2397
+ "0": {
2398
+ "name": "constant.character.entity.jsx"
2399
+ },
2400
+ "1": {
2401
+ "name": "punctuation.definition.entity.jsx"
2402
+ },
2403
+ "2": {
2404
+ "name": "entity.name.tag.html.jsx"
2405
+ },
2406
+ "3": {
2407
+ "name": "punctuation.definition.entity.jsx"
2408
+ }
2409
+ }
2410
+ },
2411
+ {
2412
+ "comment": "Entity with & and invalid name",
2413
+ "match": "&\\S*;",
2414
+ "name": "invalid.illegal.bad-ampersand.jsx"
2415
+ }
2416
+ ]
2417
+ },
2418
+ "flowtype": {
2419
+ "patterns": [
2420
+ {
2421
+ "include": "#flowtype-polymorphs"
2422
+ },
2423
+ {
2424
+ "include": "#flowtype-bracketed-parameters"
2425
+ },
2426
+ {
2427
+ "include": "#flowtype-return"
2428
+ }
2429
+ ]
2430
+ },
2431
+ "flowtype-return": {
2432
+ "patterns": [
2433
+ {
2434
+ "comment": "maybe an issue if a object literal is returned and the start of func block isn't on same line!",
2435
+ "begin": "(?<=\\))\\s*(:)",
2436
+ "end": "(?=.)",
2437
+ "applyEndPatternLast": 1,
2438
+ "beginCaptures": {
2439
+ "1": {
2440
+ "name": "punctuation.type.flowtype"
2441
+ }
2442
+ },
2443
+ "patterns": [
2444
+ {
2445
+ "include": "#flowtype-parse-types"
2446
+ }
2447
+ ]
2448
+ }
2449
+ ]
2450
+ },
2451
+ "flowtype-variable": {
2452
+ "patterns": [
2453
+ {
2454
+ "comment": "name of variable spread var with flowtype :",
2455
+ "match": "\\s*((?<!\\.)\\.\\.\\.)?([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)\\s*(\\??)\\s*(?=:|=>)",
2456
+ "captures": {
2457
+ "1": {
2458
+ "name": "keyword.operator.spread.js"
2459
+ },
2460
+ "2": {
2461
+ "name": "variable.other.readwrite.js"
2462
+ },
2463
+ "3": {
2464
+ "name": "keyword.operator.optional.parameter.flowtype"
2465
+ }
2466
+ }
2467
+ },
2468
+ {
2469
+ "include": "#flowtype-vars-and-props"
2470
+ }
2471
+ ]
2472
+ },
2473
+ "flowtype-destruct-lhs": {
2474
+ "comment": "use this pattern to colour code the variable part correctly",
2475
+ "patterns": [
2476
+ {
2477
+ "begin": "\\s*{",
2478
+ "end": "\\s*}",
2479
+ "patterns": [
2480
+ {
2481
+ "include": "#flowtype-destruct-lhs"
2482
+ }
2483
+ ]
2484
+ },
2485
+ {
2486
+ "begin": "\\s*\\[",
2487
+ "end": "\\s*\\]",
2488
+ "patterns": [
2489
+ {
2490
+ "include": "#flowtype-destruct-lhs"
2491
+ }
2492
+ ]
2493
+ },
2494
+ {
2495
+ "comment": "string as destructor target",
2496
+ "match": "\\s*((['\\\"]).*?\\k<-1>(?<!\\\\.))\\s*(:)\\s*(([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+))",
2497
+ "captures": {
2498
+ "1": {
2499
+ "name": "string.quoted.js"
2500
+ },
2501
+ "3": {
2502
+ "name": "punctuation"
2503
+ },
2504
+ "4": {
2505
+ "name": "variable.other.property.js"
2506
+ }
2507
+ }
2508
+ },
2509
+ {
2510
+ "comment": "prop name : var name as destructor target",
2511
+ "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}])*+))",
2512
+ "captures": {
2513
+ "1": {
2514
+ "name": "string.unquoted.js"
2515
+ },
2516
+ "2": {
2517
+ "name": "punctuation"
2518
+ },
2519
+ "3": {
2520
+ "name": "variable.other.property.js"
2521
+ }
2522
+ }
2523
+ },
2524
+ {
2525
+ "comment": "var name as destructor target",
2526
+ "match": "\\s*((?<!\\.)\\.\\.\\.)?([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
2527
+ "captures": {
2528
+ "1": {
2529
+ "name": "keyword.operator.spread.js"
2530
+ },
2531
+ "2": {
2532
+ "name": "variable.other.property.js"
2533
+ }
2534
+ }
2535
+ },
2536
+ {
2537
+ "include": "#literal-comma"
2538
+ },
2539
+ {
2540
+ "include": "#flowtype-vars-and-props"
2541
+ }
2542
+ ]
2543
+ },
2544
+ "flowtype-vars-and-props": {
2545
+ "patterns": [
2546
+ {
2547
+ "comment": "flowtype optional arg/parameter e.g. protocol? : string",
2548
+ "name": "punctuation.type.flowtype",
2549
+ "match": "\\?(?=\\s*:)"
2550
+ },
2551
+ {
2552
+ "comment": "typed entity :",
2553
+ "begin": "\\s*(:)",
2554
+ "end": "(?=.)",
2555
+ "applyEndPatternLast": 1,
2556
+ "beginCaptures": {
2557
+ "1": {
2558
+ "name": "punctuation.type.flowtype"
2559
+ }
2560
+ },
2561
+ "patterns": [
2562
+ {
2563
+ "include": "#flowtype-parse-types"
2564
+ }
2565
+ ]
2566
+ },
2567
+ {
2568
+ "include": "#literal-comma"
2569
+ },
2570
+ {
2571
+ "comment": "An Iterator prefix?",
2572
+ "match": "\\s*@@"
2573
+ },
2574
+ {
2575
+ "match": "\\s*(=>)",
2576
+ "captures": {
2577
+ "1": {
2578
+ "name": "storage.type.function.arrow.js"
2579
+ }
2580
+ }
2581
+ },
2582
+ {
2583
+ "include": "#flowtype-bracketed-parameters"
2584
+ },
2585
+ {
2586
+ "include": "#flowtype-parse-array"
2587
+ },
2588
+ {
2589
+ "include": "#expression"
2590
+ }
2591
+ ]
2592
+ },
2593
+ "flowtype-parse-operators": {
2594
+ "patterns": [
2595
+ {
2596
+ "comment": "call back with a form ) => type",
2597
+ "begin": "(?<=\\))\\s*(=>)",
2598
+ "end": "(?=.)",
2599
+ "applyEndPatternLast": 1,
2600
+ "beginCaptures": {
2601
+ "1": {
2602
+ "name": "storage.type.function.arrow.js"
2603
+ }
2604
+ },
2605
+ "patterns": [
2606
+ {
2607
+ "include": "#flowtype-parse-types"
2608
+ }
2609
+ ]
2610
+ },
2611
+ {
2612
+ "comment": "some form of default assignment for func args",
2613
+ "begin": "\\s*=(?!>|=|==)",
2614
+ "end": "\\s*(?=,|;|\\))",
2615
+ "beginCaptures": {
2616
+ "0": {
2617
+ "name": "keyword.operator.assignment.js"
2618
+ }
2619
+ },
2620
+ "patterns": [
2621
+ {
2622
+ "include": "#expression"
2623
+ }
2624
+ ]
2625
+ }
2626
+ ]
2627
+ },
2628
+ "flowtype-parse-types": {
2629
+ "patterns": [
2630
+ {
2631
+ "comment": "Maybe types",
2632
+ "name": "keyword.operator.maybe.flowtype",
2633
+ "match": "\\s*\\?"
2634
+ },
2635
+ {
2636
+ "name": "keyword.operator.flowtype",
2637
+ "match": "\\s*\\btypeof\\b\\s*"
2638
+ },
2639
+ {
2640
+ "comment": "primitive flowtypes",
2641
+ "match": "\\s*\\b((?>any|boolean|mixed|number|string|void))\\b",
2642
+ "captures": {
2643
+ "1": {
2644
+ "name": "support.type.builtin.primitive.flowtype"
2645
+ }
2646
+ }
2647
+ },
2648
+ {
2649
+ "comment": "Built-in Class Types",
2650
+ "match": "\\s*\\b((?>ArrayBuffer|ArrayBufferView|Boolean|Date|DataView|Error|EvalError|Float32Array|Float64Array|Function|Int8Array|Int16Array|Int32Array|JSON|Math|Number|Object|RangeError|ReferenceError|RegExp|String|Symbol|TypeError|Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray))\\b",
2651
+ "captures": {
2652
+ "1": {
2653
+ "name": "support.type.builtin.class.flowtype"
2654
+ }
2655
+ }
2656
+ },
2657
+ {
2658
+ "include": "#flowtype-polymorphs"
2659
+ },
2660
+ {
2661
+ "comment": "custom Class Types e.g. Abc avoid Abc(",
2662
+ "match": "\\s*([$_[\\p{Lu}\\p{Lt}\\p{Lm}\\p{Lo}]][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*+)(?!\\s*\\()",
2663
+ "captures": {
2664
+ "1": {
2665
+ "name": "support.type.class.flowtype"
2666
+ }
2667
+ }
2668
+ },
2669
+ {
2670
+ "comment": "custom primitive/var Types e.g. abc avoid abc(",
2671
+ "match": "\\s*([$_\\p{L}][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*+)(?!\\s*\\()",
2672
+ "captures": {
2673
+ "1": {
2674
+ "name": "support.type.primitive.flowtype"
2675
+ }
2676
+ }
2677
+ },
2678
+ {
2679
+ "comment": "Type Unions |",
2680
+ "name": "kewyword.operator.union.flowtype",
2681
+ "match": "\\s*\\|"
2682
+ },
2683
+ {
2684
+ "comment": "intersection of types &",
2685
+ "name": "kewyword.operator.intersection.flowtype",
2686
+ "match": "\\s*\\&"
2687
+ },
2688
+ {
2689
+ "comment": "as per React declares in flowtype github",
2690
+ "name": "kewyword.operator.existential.flowtype",
2691
+ "match": "\\s*\\*"
2692
+ },
2693
+ {
2694
+ "include": "#literal-string"
2695
+ },
2696
+ {
2697
+ "include": "#literal-number"
2698
+ },
2699
+ {
2700
+ "include": "#flowtype-bracketed-parameters"
2701
+ },
2702
+ {
2703
+ "include": "#flowtype-parse-objects"
2704
+ },
2705
+ {
2706
+ "include": "#flowtype-parse-operators"
2707
+ },
2708
+ {
2709
+ "include": "#flowtype-parse-array"
2710
+ },
2711
+ {
2712
+ "include": "#comments"
2713
+ }
2714
+ ]
2715
+ },
2716
+ "flowtype-bracketed-parameters": {
2717
+ "patterns": [
2718
+ {
2719
+ "comment": "Get parameters within a function/method call",
2720
+ "begin": "\\s*(\\()",
2721
+ "end": "\\s*(\\))",
2722
+ "beginCaptures": {
2723
+ "1": {
2724
+ "name": "punctuation.definition.parameters.begin.js"
2725
+ }
2726
+ },
2727
+ "endCaptures": {
2728
+ "1": {
2729
+ "name": "punctuation.definition.parameters.end.js"
2730
+ }
2731
+ },
2732
+ "patterns": [
2733
+ {
2734
+ "include": "#flowtype-variable"
2735
+ }
2736
+ ]
2737
+ }
2738
+ ]
2739
+ },
2740
+ "flowtype-polymorphs": {
2741
+ "comment": "Support Bounded Polymorphism http://flowtype.org/blog/2015/03/12/Bounded-Polymorphism.html",
2742
+ "patterns": [
2743
+ {
2744
+ "comment": "Built-in Class Types with elements of type <T>",
2745
+ "begin": "\\s*\\b((?>Array|Class|Map|Promise|Set|WeakMap|WeakSet))\\s*(<)",
2746
+ "end": "\\s*(>)",
2747
+ "beginCaptures": {
2748
+ "1": {
2749
+ "name": "support.type.builtin.class.flowtype"
2750
+ },
2751
+ "2": {
2752
+ "name": "punctuation.flowtype"
2753
+ }
2754
+ },
2755
+ "endCaptures": {
2756
+ "1": {
2757
+ "name": "punctuation.flowtype"
2758
+ }
2759
+ },
2760
+ "patterns": [
2761
+ {
2762
+ "match": "\\s*,",
2763
+ "name": "punctuation.type.separator.flowtype"
2764
+ },
2765
+ {
2766
+ "match": "\\s*:",
2767
+ "name": "punctuation.type.separator.flowtype"
2768
+ },
2769
+ {
2770
+ "include": "#flowtype-parse-types"
2771
+ }
2772
+ ]
2773
+ },
2774
+ {
2775
+ "comment": "just the polymorph bit like this <K,V>(arg,arg)",
2776
+ "begin": "\\s*(<)(?!<)",
2777
+ "end": "\\s*(>)",
2778
+ "beginCaptures": {
2779
+ "1": {
2780
+ "name": "punctutation.flowtype"
2781
+ }
2782
+ },
2783
+ "endCaptures": {
2784
+ "1": {
2785
+ "name": "punctutation.flowtype"
2786
+ }
2787
+ },
2788
+ "patterns": [
2789
+ {
2790
+ "match": "\\s*,",
2791
+ "name": "punctuation.type.separator.flowtype"
2792
+ },
2793
+ {
2794
+ "match": "\\s*:",
2795
+ "name": "punctuation.type.separator.flowtype"
2796
+ },
2797
+ {
2798
+ "include": "#flowtype-parse-types"
2799
+ }
2800
+ ]
2801
+ }
2802
+ ]
2803
+ },
2804
+ "flowtype-parse-objects": {
2805
+ "comment": "object literal flowtype preceded by either : | & ? symbols",
2806
+ "begin": "(?<=:|\\||&|\\?)\\s*(\\{)",
2807
+ "end": "\\s*(\\})",
2808
+ "applyEndPatternLast": 1,
2809
+ "beginCaptures": {
2810
+ "1": {
2811
+ "name": "meta.brace.round.open.flowtype"
2812
+ }
2813
+ },
2814
+ "endCaptures": {
2815
+ "1": {
2816
+ "name": "meta.brace.round.close.flowtype"
2817
+ }
2818
+ },
2819
+ "patterns": [
2820
+ {
2821
+ "include": "#flowtype-object-property"
2822
+ }
2823
+ ]
2824
+ },
2825
+ "flowtype-object-property": {
2826
+ "patterns": [
2827
+ {
2828
+ "comment": "name of property which can be a string",
2829
+ "match": "\\s*(((\"|').*?(?<=[^\\\\])\\k<-1>)|([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+))\\s*(\\??)\\s*(?=:)",
2830
+ "captures": {
2831
+ "1": {
2832
+ "name": "variable.other.property.flowtype"
2833
+ },
2834
+ "5": {
2835
+ "name": "keyword.operator.optional.parameter.flowtype"
2836
+ }
2837
+ }
2838
+ },
2839
+ {
2840
+ "include": "#flowtype-vars-and-props"
2841
+ }
2842
+ ]
2843
+ },
2844
+ "flowtype-parse-array": {
2845
+ "comment": "arrays such as [name: string, dob: Date]",
2846
+ "begin": "\\s*(\\[)",
2847
+ "end": "\\s*(\\])",
2848
+ "beginCaptures": {
2849
+ "1": {
2850
+ "name": "meta.brace.square.open.flowtype"
2851
+ }
2852
+ },
2853
+ "endCaptures": {
2854
+ "1": {
2855
+ "name": "meta.brace.square.end.flowtype"
2856
+ }
2857
+ },
2858
+ "patterns": [
2859
+ {
2860
+ "include": "#flowtype-variable"
2861
+ }
2862
+ ]
2863
+ },
2864
+ "flowtype-type-aliases": {
2865
+ "patterns": [
2866
+ {
2867
+ "comment": "import for types",
2868
+ "match": "\\s*(?<!\\.)\\b(import)\\b\\s*(type)\\b",
2869
+ "captures": {
2870
+ "1": {
2871
+ "name": "keyword.control.module.js"
2872
+ },
2873
+ "2": {
2874
+ "name": "support.type.type.flowtype"
2875
+ }
2876
+ }
2877
+ },
2878
+ {
2879
+ "comment": "type aliases for export but avoid type instaceof or type in operators",
2880
+ "begin": "\\s*\\b(type)\\b\\s+(?!(instanceof|in)\\b)(?=[$_\\p{L}])",
2881
+ "end": "\\s*;|\\n",
2882
+ "beginCaptures": {
2883
+ "1": {
2884
+ "name": "support.type.type.flowtype"
2885
+ }
2886
+ },
2887
+ "endCaptures": {
2888
+ "1": {
2889
+ "name": "punctuation.object.end.flowtype"
2890
+ }
2891
+ },
2892
+ "patterns": [
2893
+ {
2894
+ "match": "\\s*="
2895
+ },
2896
+ {
2897
+ "begin": "\\s*{",
2898
+ "end": "\\s*}",
2899
+ "applyEndPatternLast": 1,
2900
+ "beginCaptures": {
2901
+ "0": {
2902
+ "name": "meta.brace.curly.js"
2903
+ }
2904
+ },
2905
+ "endCaptures": {
2906
+ "0": {
2907
+ "name": "meta.brace.curly.js"
2908
+ }
2909
+ },
2910
+ "patterns": [
2911
+ {
2912
+ "include": "#flowtype"
2913
+ },
2914
+ {
2915
+ "include": "#flowtype-variable"
2916
+ },
2917
+ {
2918
+ "include": "#comments"
2919
+ },
2920
+ {
2921
+ "include": "#flowtype-function-name"
2922
+ }
2923
+ ]
2924
+ },
2925
+ {
2926
+ "include": "#flowtype"
2927
+ },
2928
+ {
2929
+ "include": "#flowtype-parse-types"
2930
+ },
2931
+ {
2932
+ "include": "#comments"
2933
+ },
2934
+ {
2935
+ "include": "#flowtype-function-name"
2936
+ }
2937
+ ]
2938
+ }
2939
+ ]
2940
+ },
2941
+ "flowtype-interface": {
2942
+ "patterns": [
2943
+ {
2944
+ "comment": "find declare module and declare class defs",
2945
+ "begin": "\\s*\\b(interface)\\s+(?=[$_\\p{L}])",
2946
+ "end": "\\s*(?:(;)|\\n|(}))",
2947
+ "applyEndPatternLast": 1,
2948
+ "beginCaptures": {
2949
+ "1": {
2950
+ "name": "support.type.interface.flowtype"
2951
+ }
2952
+ },
2953
+ "endCaptures": {
2954
+ "1": {
2955
+ "name": "punctuation.terminator.statement.js"
2956
+ },
2957
+ "2": {
2958
+ "name": "punctuation.section.class.end.js"
2959
+ }
2960
+ },
2961
+ "patterns": [
2962
+ {
2963
+ "include": "#comments"
2964
+ },
2965
+ {
2966
+ "match": "\\s*\\b(extends)\\b\\s*",
2967
+ "captures": {
2968
+ "1": {
2969
+ "name": "storage.type.extends.flowtype"
2970
+ }
2971
+ }
2972
+ },
2973
+ {
2974
+ "include": "#flowtype"
2975
+ },
2976
+ {
2977
+ "include": "#flowtype-interface-name"
2978
+ },
2979
+ {
2980
+ "begin": "\\s*{",
2981
+ "end": "\\s*(?=})",
2982
+ "contentName": "meta.class.body.js",
2983
+ "beginCaptures": {
2984
+ "0": {
2985
+ "name": "punctuation.section.class.begin.js"
2986
+ }
2987
+ },
2988
+ "patterns": [
2989
+ {
2990
+ "match": "\\s*\\b(?<!\\.)static\\b(?!\\.)",
2991
+ "name": "storage.modifier.js"
2992
+ },
2993
+ {
2994
+ "include": "#flowtype"
2995
+ },
2996
+ {
2997
+ "include": "#flowtype-variable"
2998
+ },
2999
+ {
3000
+ "include": "#comments"
3001
+ },
3002
+ {
3003
+ "include": "#flowtype-function-name"
3004
+ }
3005
+ ]
3006
+ }
3007
+ ]
3008
+ }
3009
+ ]
3010
+ },
3011
+ "flowtype-function-name": {
3012
+ "match": "\\s*(\\bstatic\\b)?\\s*([$_\\p{L}][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*)?\\s*(?!:)(?=\\(|<.*\\()",
3013
+ "captures": {
3014
+ "1": {
3015
+ "name": "storage.modifier.static.js"
3016
+ },
3017
+ "2": {
3018
+ "name": "entity.name.function.js"
3019
+ }
3020
+ }
3021
+ },
3022
+ "flowtype-class-name": {
3023
+ "comment": "look for classes names but dont assume uppercase start char",
3024
+ "match": "(?<!\\.)\\s*([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3025
+ "name": "entity.name.class.js"
3026
+ },
3027
+ "flowtype-interface-name": {
3028
+ "comment": "look for interface names but dont assume uppercase start char",
3029
+ "match": "(?<!\\.)\\s*([$_\\p{L}](?:[$\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)",
3030
+ "name": "support.type.class.interface.js"
3031
+ },
3032
+ "flowtype-declare": {
3033
+ "patterns": [
3034
+ {
3035
+ "begin": "\\s*\\b(declare)\\s+(?=(class|function|module|var))\\b",
3036
+ "end": "(?=.)",
3037
+ "applyEndPatternLast": 1,
3038
+ "beginCaptures": {
3039
+ "1": {
3040
+ "name": "support.type.declare.flowtype"
3041
+ }
3042
+ },
3043
+ "patterns": [
3044
+ {
3045
+ "include": "#flowtype-declare-classes"
3046
+ },
3047
+ {
3048
+ "include": "#flowtype-declare-modules"
3049
+ },
3050
+ {
3051
+ "include": "#flowtype-declare-function"
3052
+ },
3053
+ {
3054
+ "include": "#flowtype-declare-vars"
3055
+ }
3056
+ ]
3057
+ }
3058
+ ]
3059
+ },
3060
+ "flowtype-declare-modules": {
3061
+ "match": "\\s*\\bmodule\\b\\s+",
3062
+ "name": "support.type.object.module.js"
3063
+ },
3064
+ "flowtype-declare-classes": {
3065
+ "patterns": [
3066
+ {
3067
+ "begin": "\\s*\\b(class)\\s+",
3068
+ "end": "\\s*(})",
3069
+ "applyEndPatternLast": 1,
3070
+ "beginCaptures": {
3071
+ "1": {
3072
+ "name": "storage.type.class.flowtype"
3073
+ }
3074
+ },
3075
+ "endCaptures": {
3076
+ "1": {
3077
+ "name": "punctuation.section.class.end.js"
3078
+ }
3079
+ },
3080
+ "patterns": [
3081
+ {
3082
+ "match": "\\s*\\b(extends|mixins)\\b\\s*",
3083
+ "captures": {
3084
+ "1": {
3085
+ "name": "storage.type.extends.flowtype"
3086
+ }
3087
+ }
3088
+ },
3089
+ {
3090
+ "begin": "{",
3091
+ "end": "\\s*(?=})",
3092
+ "contentName": "meta.class.body.js",
3093
+ "beginCaptures": {
3094
+ "0": {
3095
+ "name": "punctuation.section.class.begin.js"
3096
+ }
3097
+ },
3098
+ "patterns": [
3099
+ {
3100
+ "match": "\\s*\\b(?<!\\.)static\\b(?!\\.)",
3101
+ "name": "storage.modifier.js"
3102
+ },
3103
+ {
3104
+ "include": "#literal-method"
3105
+ },
3106
+ {
3107
+ "include": "#flowtype"
3108
+ },
3109
+ {
3110
+ "include": "#flowtype-variable"
3111
+ },
3112
+ {
3113
+ "include": "#comments"
3114
+ },
3115
+ {
3116
+ "include": "#flowtype-function-name"
3117
+ }
3118
+ ]
3119
+ },
3120
+ {
3121
+ "include": "#flowtype-class-name"
3122
+ },
3123
+ {
3124
+ "include": "#flowtype-polymorphs"
3125
+ }
3126
+ ]
3127
+ }
3128
+ ]
3129
+ },
3130
+ "flowtype-declare-function": {
3131
+ "patterns": [
3132
+ {
3133
+ "begin": "\\s*\\b(function)\\s+",
3134
+ "end": "\\s*(;)",
3135
+ "applyEndPatternLast": 1,
3136
+ "beginCaptures": {
3137
+ "1": {
3138
+ "name": "storage.type.function.js"
3139
+ }
3140
+ },
3141
+ "patterns": [
3142
+ {
3143
+ "include": "#flowtype"
3144
+ },
3145
+ {
3146
+ "include": "#flowtype-function-name"
3147
+ }
3148
+ ]
3149
+ }
3150
+ ]
3151
+ },
3152
+ "flowtype-declare-vars": {
3153
+ "patterns": [
3154
+ {
3155
+ "begin": "\\s*\\b(var)\\s+",
3156
+ "end": "\\s*(?=.)",
3157
+ "applyEndPatternLast": 1,
3158
+ "beginCaptures": {
3159
+ "1": {
3160
+ "name": "storage.type.var.js"
3161
+ }
3162
+ },
3163
+ "patterns": [
3164
+ {
3165
+ "include": "#flowtype-variable"
3166
+ }
3167
+ ]
3168
+ }
3169
+ ]
3170
+ },
3171
+ "flowtype-typecast": {
3172
+ "patterns": [
3173
+ {
3174
+ "begin": "\\s*:",
3175
+ "end": "(?=\\s*\\))",
3176
+ "patterns": [
3177
+ {
3178
+ "include": "#flowtype-parse-types"
3179
+ }
3180
+ ]
3181
+ }
3182
+ ]
3183
+ }
3184
+ }
3185
+ }