@checkly/playwright-core 1.48.20 → 1.48.22-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/lib/checkly/fetch.js +3 -10
  2. package/lib/cli/cli.js +61 -0
  3. package/lib/common/debugLogger.js +90 -0
  4. package/lib/generated/recorderSource.js +1 -1
  5. package/lib/server/fetch.js +1 -1
  6. package/lib/server/recorder/java.js +4 -36
  7. package/lib/server/trace/recorder/tracing.js +22 -17
  8. package/lib/vite/{traceViewer/assets/codeMirrorModule-B7Z3vq11.js → recorder/assets/codeMirrorModule-CR6kB851.js} +1 -1
  9. package/lib/vite/recorder/assets/{index-Bxxcmxlu.js → index-BcaUAUCW.js} +2 -2
  10. package/lib/vite/recorder/index.html +1 -1
  11. package/lib/vite/traceViewer/assets/codeMirrorModule-75b0ca4f.js +24 -0
  12. package/lib/vite/traceViewer/assets/codeMirrorModule-CNHvVrFd.js +16437 -0
  13. package/lib/vite/traceViewer/assets/{codeMirrorModule-BdBhzV6t.js → codeMirrorModule-CpGx_S8D.js} +2 -2
  14. package/lib/vite/traceViewer/assets/{codeMirrorModule-EhKN7Okm.js → codeMirrorModule-DGE2kpkE.js} +954 -960
  15. package/lib/vite/traceViewer/assets/codeMirrorModule-SomGa-Da.js +16443 -0
  16. package/lib/vite/traceViewer/assets/codeMirrorModule-c1454a2e.js +24 -0
  17. package/lib/vite/traceViewer/assets/codeMirrorModule-c9bb9834.js +24 -0
  18. package/lib/vite/traceViewer/assets/{codeMirrorModule-BqcXH1AO.js → codeMirrorModule-cc2329e4.js} +11 -1256
  19. package/lib/vite/traceViewer/assets/codeMirrorModule-d2cc7db0.js +15579 -0
  20. package/lib/vite/traceViewer/assets/codeMirrorModule-da915a35.js +15586 -0
  21. package/lib/vite/traceViewer/assets/{codeMirrorModule-U6XMqGkV.js → codeMirrorModule-f03b1a3e.js} +661 -1519
  22. package/lib/vite/traceViewer/assets/codeMirrorModule-f333a775.js +24 -0
  23. package/lib/vite/traceViewer/assets/{codeMirrorModule-V7N6ppkd.js → codeMirrorModule-uWDlVSQz.js} +2 -2
  24. package/lib/vite/traceViewer/assets/{codeMirrorModule-Dx6AXgMV.js → codeMirrorModule-yboVpgC0.js} +2 -1248
  25. package/lib/vite/traceViewer/assets/{inspectorTab-BABZNwlH.js → inspectorTab-B4ynvyY9.js} +18 -8
  26. package/lib/vite/traceViewer/assets/{inspectorTab-DpvLVMq5.js → inspectorTab-CHcHvp_a.js} +16 -6
  27. package/lib/vite/traceViewer/assets/{workbench-Bjkiwcr1.js → inspectorTab-Dw0Gnh1T.js} +1847 -3605
  28. package/lib/vite/traceViewer/assets/{inspectorTab-BPzVEZSf.js → inspectorTab-Ywa000c9.js} +16 -6
  29. package/lib/vite/traceViewer/assets/{workbench-BcgGQnKb.js → workbench-CROk6Fcc.js} +2 -2
  30. package/lib/vite/traceViewer/assets/{workbench-ByyWxoT8.js → workbench-CfXOj3eT.js} +2 -2
  31. package/lib/vite/traceViewer/assets/{workbench-DhqI6jeL.js → workbench-D9CTkv-4.js} +2 -2
  32. package/lib/vite/traceViewer/assets/{workbench-I4s6sWjN.js → workbench-DNolpp3y.js} +1 -1
  33. package/lib/vite/traceViewer/assets/workbench-DjoIOtwK.js +1473 -0
  34. package/lib/vite/traceViewer/assets/workbench-dnZM5a7x.js +1473 -0
  35. package/lib/vite/traceViewer/assets/wsPort-54626118.js +18361 -0
  36. package/lib/vite/traceViewer/assets/wsPort-57f274c6.js +18361 -0
  37. package/lib/vite/traceViewer/assets/wsPort-762c6840.js +64 -0
  38. package/lib/vite/traceViewer/assets/wsPort-85286e61.js +18361 -0
  39. package/lib/vite/traceViewer/assets/wsPort-98e00a94.js +64 -0
  40. package/lib/vite/traceViewer/assets/{wsPort-EUvw-dwH.js → wsPort-CAXygIGt.js} +3 -3
  41. package/lib/vite/traceViewer/assets/{workbench-Crj6jzdv.js → wsPort-cc0077b5.js} +4046 -4623
  42. package/lib/vite/traceViewer/assets/wsPort-edfeeb7d.js +64 -0
  43. package/lib/vite/traceViewer/assets/wsPort-ee2830d7.js +64 -0
  44. package/lib/vite/traceViewer/assets/{workbench-C5OQh9VX.js → wsPort-peeLnQhT.js} +985 -1540
  45. package/lib/vite/traceViewer/assets/xtermModule-443332e6.js +9 -0
  46. package/lib/vite/traceViewer/assets/xtermModule-60687b6b.js +6410 -0
  47. package/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css +1 -0
  48. package/lib/vite/traceViewer/codeMirrorModule.eb494ea9.css +344 -0
  49. package/lib/vite/traceViewer/codicon.79f233d0.ttf +0 -0
  50. package/lib/vite/traceViewer/{embedded.27BGR_eD.js → embedded.6N1v7bZ1.js} +4 -3
  51. package/lib/vite/traceViewer/{embedded.DTjd2aiy.js → embedded.BaqdbLsy.js} +4 -3
  52. package/lib/vite/traceViewer/{embedded.SsjKHrxC.js → embedded.CwwTDBzP.js} +4 -3
  53. package/lib/vite/traceViewer/{embedded.Zu332ZC1.js → embedded.DeCrOtlO.js} +2 -2
  54. package/lib/vite/traceViewer/embedded.DnD_eIZU.js +106 -0
  55. package/lib/vite/traceViewer/embedded.html +3 -3
  56. package/lib/vite/traceViewer/embedded.i_k4ceMJ.js +106 -0
  57. package/lib/vite/traceViewer/index.1a1fe659.css +1 -0
  58. package/lib/vite/traceViewer/index.1b525c1c.js +181 -0
  59. package/lib/vite/traceViewer/index.55e65778.js +181 -0
  60. package/lib/vite/traceViewer/{index.6KJ-JQ0L.js → index.5nqVcfiC.js} +2 -2
  61. package/lib/vite/traceViewer/{index.C0EgJ4oW.js → index.5ooko4n7.js} +21 -36
  62. package/lib/vite/traceViewer/index.76e9f312.css +124 -0
  63. package/lib/vite/traceViewer/{index.Dz3icWJV.js → index.Bugo2TbS.js} +4 -3
  64. package/lib/vite/traceViewer/{index.PqcsvBxQ.js → index.BzvnAP7t.js} +4 -3
  65. package/lib/vite/traceViewer/{index.CLxsp2W_.js → index.CM_h9lHr.js} +2 -2
  66. package/lib/vite/traceViewer/{index.yxAwzeWG.js → index.CY13pBr8.js} +4 -3
  67. package/lib/vite/traceViewer/index.DblJtEW_.js +197 -0
  68. package/lib/vite/traceViewer/index.UtHmfPiA.js +197 -0
  69. package/lib/vite/traceViewer/index.a265fbdb.js +2 -0
  70. package/lib/vite/traceViewer/index.c9f6fa8f.js +2 -0
  71. package/lib/vite/traceViewer/index.d86e70ca.js +181 -0
  72. package/lib/vite/traceViewer/index.decad628.js +2 -0
  73. package/lib/vite/traceViewer/index.e8730524.js +181 -0
  74. package/lib/vite/traceViewer/index.ed9a3c58.js +2 -0
  75. package/lib/vite/traceViewer/index.html +3 -3
  76. package/lib/vite/traceViewer/{recorder.BufKu9Hp.js → recorder.3Xfrl_zV.js} +3 -2
  77. package/lib/vite/traceViewer/{recorder.am-MV-DQ.js → recorder.BWH6blRw.js} +3 -2
  78. package/lib/vite/traceViewer/{recorder.7Wl6HrQl.js → recorder.Db1aK_DY.js} +3 -2
  79. package/lib/vite/traceViewer/recorder.html +2 -2
  80. package/lib/vite/traceViewer/recorder.uj3cfoMf.js +551 -0
  81. package/lib/vite/traceViewer/uiMode.08ab2d90.js +4 -0
  82. package/lib/vite/traceViewer/uiMode.0d0d667b.js +4 -0
  83. package/lib/vite/traceViewer/uiMode.216233d5.js +1484 -0
  84. package/lib/vite/traceViewer/{uiMode.DVWUEIHq.css → uiMode.2c31018f.css} +88 -188
  85. package/lib/vite/traceViewer/uiMode.3ff70f7d.js +4 -0
  86. package/lib/vite/traceViewer/uiMode.4d0a45af.js +1484 -0
  87. package/lib/vite/traceViewer/uiMode.66eb0ce2.js +1484 -0
  88. package/lib/vite/traceViewer/uiMode.8b41a49d.css +1 -0
  89. package/lib/vite/traceViewer/uiMode.8d080c01.js +1486 -0
  90. package/lib/vite/traceViewer/uiMode.BKrDfnAk.js +1725 -0
  91. package/lib/vite/traceViewer/uiMode.BMYUvsRh.js +1725 -0
  92. package/lib/vite/traceViewer/{uiMode.BZoFj6zV.js → uiMode.BVpTBGoe.js} +4 -3
  93. package/lib/vite/traceViewer/uiMode.BWhJCEE9.js +1725 -0
  94. package/lib/vite/traceViewer/uiMode.Bg9fACTB.js +1725 -0
  95. package/lib/vite/traceViewer/{uiMode.CpC2B27N.js → uiMode.CYBsUhm_.js} +2 -2
  96. package/lib/vite/traceViewer/{uiMode.Dlo9s_YX.js → uiMode.DCSdxlAq.js} +4 -3
  97. package/lib/vite/traceViewer/{uiMode.wsGnVMQK.js → uiMode.DtleKuGI.js} +4 -3
  98. package/lib/vite/traceViewer/uiMode.UamAvOMX.js +1725 -0
  99. package/lib/vite/traceViewer/uiMode._Kp3dUXk.js +1724 -0
  100. package/lib/vite/traceViewer/uiMode.bBcXYWNF.js +1725 -0
  101. package/lib/vite/traceViewer/uiMode.ca6ec898.js +4 -0
  102. package/lib/vite/traceViewer/{uiMode.iq7CyYy7.js → uiMode.e-PLonGl.js} +2 -2
  103. package/lib/vite/traceViewer/uiMode.e_-GuqEi.js +1725 -0
  104. package/lib/vite/traceViewer/uiMode.f1YADWIl.js +1724 -0
  105. package/lib/vite/traceViewer/uiMode.html +3 -3
  106. package/lib/vite/traceViewer/uiMode.kHsXCfV8.js +1490 -0
  107. package/lib/vite/traceViewer/{workbench.B3X2QtYa.css → wsPort.162042f9.css} +63 -315
  108. package/lib/vite/traceViewer/{workbench.wuxQoE2z.css → wsPort.997c92cf.css} +145 -335
  109. package/lib/vite/traceViewer/wsPort.9c9a6767.css +1 -0
  110. package/lib/vite/traceViewer/xtermModule.125f4259.css +191 -0
  111. package/lib/vite/traceViewer/xtermModule.6428296b.css +32 -0
  112. package/package.json +1 -1
  113. package/lib/vite/recorder/assets/codeMirrorModule-d0KhC1qL.js +0 -24
  114. package/lib/vite/traceViewer/assets/codeMirrorModule-5yiV-3wl.js +0 -16831
  115. package/lib/vite/traceViewer/assets/codeMirrorModule-C6p3E9Zg.js +0 -24
  116. package/lib/vite/traceViewer/assets/codeMirrorModule-Ca-1BNel.js +0 -24
  117. package/lib/vite/traceViewer/assets/codeMirrorModule-CcviAl53.js +0 -16831
  118. package/lib/vite/traceViewer/assets/codeMirrorModule-CqYUz5ms.js +0 -24
  119. package/lib/vite/traceViewer/assets/codeMirrorModule-DS3v0XrQ.js +0 -24
  120. package/lib/vite/traceViewer/assets/codeMirrorModule-DZoSgqUd.js +0 -24
  121. package/lib/vite/traceViewer/assets/codeMirrorModule-MzSmL4X2.js +0 -24
  122. package/lib/vite/traceViewer/assets/codeMirrorModule-T_sdMrbM.js +0 -24
  123. package/lib/vite/traceViewer/assets/inspectorTab-BHcfR9dD.js +0 -64
  124. package/lib/vite/traceViewer/assets/inspectorTab-Bbgq0hgt.js +0 -64
  125. package/lib/vite/traceViewer/assets/inspectorTab-DhBbZz8I.js +0 -64
  126. package/lib/vite/traceViewer/assets/workbench-B13nfocr.js +0 -9
  127. package/lib/vite/traceViewer/assets/workbench-BwodYCgl.js +0 -19119
  128. package/lib/vite/traceViewer/assets/workbench-C43LWZEX.js +0 -72
  129. package/lib/vite/traceViewer/assets/workbench-DZqNXdoV.js +0 -9
  130. package/lib/vite/traceViewer/assets/workbench-DrQjKdyE.js +0 -72
  131. package/lib/vite/traceViewer/assets/workbench-Pa1v1Ojh.js +0 -72
  132. package/lib/vite/traceViewer/assets/workbench-caTaZnzx.js +0 -72
  133. package/lib/vite/traceViewer/assets/workbench-gtYcQBNA.js +0 -9
  134. package/lib/vite/traceViewer/assets/workbench-u2lRPMOT.js +0 -72
  135. package/lib/vite/traceViewer/assets/xtermModule-CZ7sDYXB.js +0 -6529
  136. package/lib/vite/traceViewer/embedded.BBZ9gQEw.js +0 -104
  137. package/lib/vite/traceViewer/embedded.BQq6Psnz.js +0 -104
  138. package/lib/vite/traceViewer/embedded.BVDVQOzc.js +0 -2
  139. package/lib/vite/traceViewer/embedded.Bn8Ptzv6.js +0 -2
  140. package/lib/vite/traceViewer/embedded.CorI3dFX.js +0 -104
  141. package/lib/vite/traceViewer/embedded.CvhnUgIi.js +0 -2
  142. package/lib/vite/traceViewer/embedded.D27cnKiB.js +0 -104
  143. package/lib/vite/traceViewer/embedded.D4lqGydT.js +0 -2
  144. package/lib/vite/traceViewer/embedded.DPqrDeET.js +0 -2
  145. package/lib/vite/traceViewer/embedded.DbzY7Q8w.js +0 -2
  146. package/lib/vite/traceViewer/embedded.Dxe2heQk.js +0 -2
  147. package/lib/vite/traceViewer/embedded.f-PLGsBT.js +0 -2
  148. package/lib/vite/traceViewer/index.B7aiTMfZ.js +0 -2
  149. package/lib/vite/traceViewer/index.B8dgQwuN.js +0 -2
  150. package/lib/vite/traceViewer/index.BGj8jY3H.js +0 -2
  151. package/lib/vite/traceViewer/index.BSak5QT9.js +0 -2
  152. package/lib/vite/traceViewer/index.BrT2kfuc.js +0 -2
  153. package/lib/vite/traceViewer/index.CB297BuW.js +0 -2
  154. package/lib/vite/traceViewer/index.CUpI-BFe.js +0 -195
  155. package/lib/vite/traceViewer/index.DkRbtWVo.js +0 -195
  156. package/lib/vite/traceViewer/index.DsjmhbB6.js +0 -195
  157. package/lib/vite/traceViewer/index._cX8k4co.js +0 -2
  158. package/lib/vite/traceViewer/index.pMAN88y-.js +0 -2
  159. package/lib/vite/traceViewer/recorder.C88JDknq.js +0 -2
  160. package/lib/vite/traceViewer/recorder.Ch-WHviK.js +0 -2
  161. package/lib/vite/traceViewer/recorder.POd-toIn.js +0 -2
  162. package/lib/vite/traceViewer/uiMode.2tr9k625.js +0 -5
  163. package/lib/vite/traceViewer/uiMode.BEZVCe5O.js +0 -5
  164. package/lib/vite/traceViewer/uiMode.C4nbcio6.js +0 -1730
  165. package/lib/vite/traceViewer/uiMode.D-tg1Oci.js +0 -1730
  166. package/lib/vite/traceViewer/uiMode.D3cNFP6u.css +0 -1
  167. package/lib/vite/traceViewer/uiMode.DKjMBMlc.js +0 -1730
  168. package/lib/vite/traceViewer/uiMode.DVrL7a1K.js +0 -10
  169. package/lib/vite/traceViewer/uiMode.DdtUZZVS.js +0 -5
  170. package/lib/vite/traceViewer/uiMode.Dg9oJCQU.js +0 -10
  171. package/lib/vite/traceViewer/uiMode.DwZAzstF.js +0 -10
  172. package/lib/vite/traceViewer/uiMode.O07awP3T.js +0 -10
  173. package/lib/vite/traceViewer/uiMode.gGHHTsyL.js +0 -1730
  174. package/lib/vite/traceViewer/uiMode.jY2s-9ps.js +0 -10
  175. package/lib/vite/traceViewer/workbench.DjbIuxix.css +0 -1
  176. package/lib/vite/traceViewer/workbench.DyTpxWVb.css +0 -1
@@ -1,4 +1,4 @@
1
- import { U as commonjsGlobal, V as getDefaultExportFromCjs } from "./inspectorTab-DpvLVMq5.js";
1
+ import { U as commonjsGlobal, V as getDefaultExportFromCjs } from "./inspectorTab-CHcHvp_a.js";
2
2
  var codemirror$1 = { exports: {} };
3
3
  var hasRequiredCodemirror;
4
4
  function requireCodemirror() {
@@ -12973,1030 +12973,1025 @@ function requireXml() {
12973
12973
  return xml.exports;
12974
12974
  }
12975
12975
  var javascript = { exports: {} };
12976
- var hasRequiredJavascript;
12977
- function requireJavascript() {
12978
- if (hasRequiredJavascript) return javascript.exports;
12979
- hasRequiredJavascript = 1;
12980
- (function(module, exports) {
12981
- (function(mod) {
12982
- mod(requireCodemirror());
12983
- })(function(CodeMirror) {
12984
- CodeMirror.defineMode("javascript", function(config, parserConfig) {
12985
- var indentUnit = config.indentUnit;
12986
- var statementIndent = parserConfig.statementIndent;
12987
- var jsonldMode = parserConfig.jsonld;
12988
- var jsonMode = parserConfig.json || jsonldMode;
12989
- var trackScope = parserConfig.trackScope !== false;
12990
- var isTS = parserConfig.typescript;
12991
- var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
12992
- var keywords = function() {
12993
- function kw(type2) {
12994
- return { type: type2, style: "keyword" };
12995
- }
12996
- var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
12997
- var operator = kw("operator"), atom = { type: "atom", style: "atom" };
12998
- return {
12999
- "if": kw("if"),
13000
- "while": A,
13001
- "with": A,
13002
- "else": B,
13003
- "do": B,
13004
- "try": B,
13005
- "finally": B,
13006
- "return": D,
13007
- "break": D,
13008
- "continue": D,
13009
- "new": kw("new"),
13010
- "delete": C,
13011
- "void": C,
13012
- "throw": C,
13013
- "debugger": kw("debugger"),
13014
- "var": kw("var"),
13015
- "const": kw("var"),
13016
- "let": kw("var"),
13017
- "function": kw("function"),
13018
- "catch": kw("catch"),
13019
- "for": kw("for"),
13020
- "switch": kw("switch"),
13021
- "case": kw("case"),
13022
- "default": kw("default"),
13023
- "in": operator,
13024
- "typeof": operator,
13025
- "instanceof": operator,
13026
- "true": atom,
13027
- "false": atom,
13028
- "null": atom,
13029
- "undefined": atom,
13030
- "NaN": atom,
13031
- "Infinity": atom,
13032
- "this": kw("this"),
13033
- "class": kw("class"),
13034
- "super": kw("atom"),
13035
- "yield": C,
13036
- "export": kw("export"),
13037
- "import": kw("import"),
13038
- "extends": C,
13039
- "await": C
13040
- };
13041
- }();
13042
- var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
13043
- var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
13044
- function readRegexp(stream) {
13045
- var escaped = false, next, inSet = false;
13046
- while ((next = stream.next()) != null) {
13047
- if (!escaped) {
13048
- if (next == "/" && !inSet) return;
13049
- if (next == "[") inSet = true;
13050
- else if (inSet && next == "]") inSet = false;
13051
- }
13052
- escaped = !escaped && next == "\\";
13053
- }
13054
- }
13055
- var type, content;
13056
- function ret(tp, style, cont2) {
13057
- type = tp;
13058
- content = cont2;
13059
- return style;
13060
- }
13061
- function tokenBase(stream, state) {
13062
- var ch = stream.next();
13063
- if (ch == '"' || ch == "'") {
13064
- state.tokenize = tokenString(ch);
13065
- return state.tokenize(stream, state);
13066
- } else if (ch == "." && stream.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/)) {
13067
- return ret("number", "number");
13068
- } else if (ch == "." && stream.match("..")) {
13069
- return ret("spread", "meta");
13070
- } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
13071
- return ret(ch);
13072
- } else if (ch == "=" && stream.eat(">")) {
13073
- return ret("=>", "operator");
13074
- } else if (ch == "0" && stream.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {
13075
- return ret("number", "number");
13076
- } else if (/\d/.test(ch)) {
13077
- stream.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/);
13078
- return ret("number", "number");
13079
- } else if (ch == "/") {
13080
- if (stream.eat("*")) {
13081
- state.tokenize = tokenComment;
13082
- return tokenComment(stream, state);
13083
- } else if (stream.eat("/")) {
13084
- stream.skipToEnd();
13085
- return ret("comment", "comment");
13086
- } else if (expressionAllowed(stream, state, 1)) {
13087
- readRegexp(stream);
13088
- stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
13089
- return ret("regexp", "string-2");
13090
- } else {
13091
- stream.eat("=");
13092
- return ret("operator", "operator", stream.current());
13093
- }
13094
- } else if (ch == "`") {
13095
- state.tokenize = tokenQuasi;
13096
- return tokenQuasi(stream, state);
13097
- } else if (ch == "#" && stream.peek() == "!") {
13098
- stream.skipToEnd();
13099
- return ret("meta", "meta");
13100
- } else if (ch == "#" && stream.eatWhile(wordRE)) {
13101
- return ret("variable", "property");
13102
- } else if (ch == "<" && stream.match("!--") || ch == "-" && stream.match("->") && !/\S/.test(stream.string.slice(0, stream.start))) {
12976
+ (function(module, exports) {
12977
+ (function(mod) {
12978
+ mod(requireCodemirror());
12979
+ })(function(CodeMirror) {
12980
+ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12981
+ var indentUnit = config.indentUnit;
12982
+ var statementIndent = parserConfig.statementIndent;
12983
+ var jsonldMode = parserConfig.jsonld;
12984
+ var jsonMode = parserConfig.json || jsonldMode;
12985
+ var trackScope = parserConfig.trackScope !== false;
12986
+ var isTS = parserConfig.typescript;
12987
+ var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
12988
+ var keywords = function() {
12989
+ function kw(type2) {
12990
+ return { type: type2, style: "keyword" };
12991
+ }
12992
+ var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
12993
+ var operator = kw("operator"), atom = { type: "atom", style: "atom" };
12994
+ return {
12995
+ "if": kw("if"),
12996
+ "while": A,
12997
+ "with": A,
12998
+ "else": B,
12999
+ "do": B,
13000
+ "try": B,
13001
+ "finally": B,
13002
+ "return": D,
13003
+ "break": D,
13004
+ "continue": D,
13005
+ "new": kw("new"),
13006
+ "delete": C,
13007
+ "void": C,
13008
+ "throw": C,
13009
+ "debugger": kw("debugger"),
13010
+ "var": kw("var"),
13011
+ "const": kw("var"),
13012
+ "let": kw("var"),
13013
+ "function": kw("function"),
13014
+ "catch": kw("catch"),
13015
+ "for": kw("for"),
13016
+ "switch": kw("switch"),
13017
+ "case": kw("case"),
13018
+ "default": kw("default"),
13019
+ "in": operator,
13020
+ "typeof": operator,
13021
+ "instanceof": operator,
13022
+ "true": atom,
13023
+ "false": atom,
13024
+ "null": atom,
13025
+ "undefined": atom,
13026
+ "NaN": atom,
13027
+ "Infinity": atom,
13028
+ "this": kw("this"),
13029
+ "class": kw("class"),
13030
+ "super": kw("atom"),
13031
+ "yield": C,
13032
+ "export": kw("export"),
13033
+ "import": kw("import"),
13034
+ "extends": C,
13035
+ "await": C
13036
+ };
13037
+ }();
13038
+ var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
13039
+ var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
13040
+ function readRegexp(stream) {
13041
+ var escaped = false, next, inSet = false;
13042
+ while ((next = stream.next()) != null) {
13043
+ if (!escaped) {
13044
+ if (next == "/" && !inSet) return;
13045
+ if (next == "[") inSet = true;
13046
+ else if (inSet && next == "]") inSet = false;
13047
+ }
13048
+ escaped = !escaped && next == "\\";
13049
+ }
13050
+ }
13051
+ var type, content;
13052
+ function ret(tp, style, cont2) {
13053
+ type = tp;
13054
+ content = cont2;
13055
+ return style;
13056
+ }
13057
+ function tokenBase(stream, state) {
13058
+ var ch = stream.next();
13059
+ if (ch == '"' || ch == "'") {
13060
+ state.tokenize = tokenString(ch);
13061
+ return state.tokenize(stream, state);
13062
+ } else if (ch == "." && stream.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/)) {
13063
+ return ret("number", "number");
13064
+ } else if (ch == "." && stream.match("..")) {
13065
+ return ret("spread", "meta");
13066
+ } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
13067
+ return ret(ch);
13068
+ } else if (ch == "=" && stream.eat(">")) {
13069
+ return ret("=>", "operator");
13070
+ } else if (ch == "0" && stream.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {
13071
+ return ret("number", "number");
13072
+ } else if (/\d/.test(ch)) {
13073
+ stream.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/);
13074
+ return ret("number", "number");
13075
+ } else if (ch == "/") {
13076
+ if (stream.eat("*")) {
13077
+ state.tokenize = tokenComment;
13078
+ return tokenComment(stream, state);
13079
+ } else if (stream.eat("/")) {
13103
13080
  stream.skipToEnd();
13104
13081
  return ret("comment", "comment");
13105
- } else if (isOperatorChar.test(ch)) {
13106
- if (ch != ">" || !state.lexical || state.lexical.type != ">") {
13107
- if (stream.eat("=")) {
13108
- if (ch == "!" || ch == "=") stream.eat("=");
13109
- } else if (/[<>*+\-|&?]/.test(ch)) {
13110
- stream.eat(ch);
13111
- if (ch == ">") stream.eat(ch);
13112
- }
13113
- }
13114
- if (ch == "?" && stream.eat(".")) return ret(".");
13082
+ } else if (expressionAllowed(stream, state, 1)) {
13083
+ readRegexp(stream);
13084
+ stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
13085
+ return ret("regexp", "string-2");
13086
+ } else {
13087
+ stream.eat("=");
13115
13088
  return ret("operator", "operator", stream.current());
13116
- } else if (wordRE.test(ch)) {
13117
- stream.eatWhile(wordRE);
13118
- var word = stream.current();
13119
- if (state.lastType != ".") {
13120
- if (keywords.propertyIsEnumerable(word)) {
13121
- var kw = keywords[word];
13122
- return ret(kw.type, kw.style, word);
13123
- }
13124
- if (word == "async" && stream.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/, false))
13125
- return ret("async", "keyword", word);
13126
- }
13127
- return ret("variable", "variable", word);
13128
13089
  }
13129
- }
13130
- function tokenString(quote) {
13131
- return function(stream, state) {
13132
- var escaped = false, next;
13133
- if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)) {
13134
- state.tokenize = tokenBase;
13135
- return ret("jsonld-keyword", "meta");
13136
- }
13137
- while ((next = stream.next()) != null) {
13138
- if (next == quote && !escaped) break;
13139
- escaped = !escaped && next == "\\";
13090
+ } else if (ch == "`") {
13091
+ state.tokenize = tokenQuasi;
13092
+ return tokenQuasi(stream, state);
13093
+ } else if (ch == "#" && stream.peek() == "!") {
13094
+ stream.skipToEnd();
13095
+ return ret("meta", "meta");
13096
+ } else if (ch == "#" && stream.eatWhile(wordRE)) {
13097
+ return ret("variable", "property");
13098
+ } else if (ch == "<" && stream.match("!--") || ch == "-" && stream.match("->") && !/\S/.test(stream.string.slice(0, stream.start))) {
13099
+ stream.skipToEnd();
13100
+ return ret("comment", "comment");
13101
+ } else if (isOperatorChar.test(ch)) {
13102
+ if (ch != ">" || !state.lexical || state.lexical.type != ">") {
13103
+ if (stream.eat("=")) {
13104
+ if (ch == "!" || ch == "=") stream.eat("=");
13105
+ } else if (/[<>*+\-|&?]/.test(ch)) {
13106
+ stream.eat(ch);
13107
+ if (ch == ">") stream.eat(ch);
13140
13108
  }
13141
- if (!escaped) state.tokenize = tokenBase;
13142
- return ret("string", "string");
13143
- };
13144
- }
13145
- function tokenComment(stream, state) {
13146
- var maybeEnd = false, ch;
13147
- while (ch = stream.next()) {
13148
- if (ch == "/" && maybeEnd) {
13149
- state.tokenize = tokenBase;
13150
- break;
13109
+ }
13110
+ if (ch == "?" && stream.eat(".")) return ret(".");
13111
+ return ret("operator", "operator", stream.current());
13112
+ } else if (wordRE.test(ch)) {
13113
+ stream.eatWhile(wordRE);
13114
+ var word = stream.current();
13115
+ if (state.lastType != ".") {
13116
+ if (keywords.propertyIsEnumerable(word)) {
13117
+ var kw = keywords[word];
13118
+ return ret(kw.type, kw.style, word);
13151
13119
  }
13152
- maybeEnd = ch == "*";
13120
+ if (word == "async" && stream.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/, false))
13121
+ return ret("async", "keyword", word);
13153
13122
  }
13154
- return ret("comment", "comment");
13123
+ return ret("variable", "variable", word);
13155
13124
  }
13156
- function tokenQuasi(stream, state) {
13125
+ }
13126
+ function tokenString(quote) {
13127
+ return function(stream, state) {
13157
13128
  var escaped = false, next;
13129
+ if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)) {
13130
+ state.tokenize = tokenBase;
13131
+ return ret("jsonld-keyword", "meta");
13132
+ }
13158
13133
  while ((next = stream.next()) != null) {
13159
- if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
13160
- state.tokenize = tokenBase;
13161
- break;
13162
- }
13134
+ if (next == quote && !escaped) break;
13163
13135
  escaped = !escaped && next == "\\";
13164
13136
  }
13165
- return ret("quasi", "string-2", stream.current());
13166
- }
13167
- var brackets = "([{}])";
13168
- function findFatArrow(stream, state) {
13169
- if (state.fatArrowAt) state.fatArrowAt = null;
13170
- var arrow = stream.string.indexOf("=>", stream.start);
13171
- if (arrow < 0) return;
13172
- if (isTS) {
13173
- var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow));
13174
- if (m) arrow = m.index;
13175
- }
13176
- var depth = 0, sawSomething = false;
13177
- for (var pos = arrow - 1; pos >= 0; --pos) {
13178
- var ch = stream.string.charAt(pos);
13179
- var bracket = brackets.indexOf(ch);
13180
- if (bracket >= 0 && bracket < 3) {
13181
- if (!depth) {
13182
- ++pos;
13183
- break;
13184
- }
13185
- if (--depth == 0) {
13186
- if (ch == "(") sawSomething = true;
13187
- break;
13188
- }
13189
- } else if (bracket >= 3 && bracket < 6) {
13190
- ++depth;
13191
- } else if (wordRE.test(ch)) {
13192
- sawSomething = true;
13193
- } else if (/["'\/`]/.test(ch)) {
13194
- for (; ; --pos) {
13195
- if (pos == 0) return;
13196
- var next = stream.string.charAt(pos - 1);
13197
- if (next == ch && stream.string.charAt(pos - 2) != "\\") {
13198
- pos--;
13199
- break;
13200
- }
13201
- }
13202
- } else if (sawSomething && !depth) {
13137
+ if (!escaped) state.tokenize = tokenBase;
13138
+ return ret("string", "string");
13139
+ };
13140
+ }
13141
+ function tokenComment(stream, state) {
13142
+ var maybeEnd = false, ch;
13143
+ while (ch = stream.next()) {
13144
+ if (ch == "/" && maybeEnd) {
13145
+ state.tokenize = tokenBase;
13146
+ break;
13147
+ }
13148
+ maybeEnd = ch == "*";
13149
+ }
13150
+ return ret("comment", "comment");
13151
+ }
13152
+ function tokenQuasi(stream, state) {
13153
+ var escaped = false, next;
13154
+ while ((next = stream.next()) != null) {
13155
+ if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
13156
+ state.tokenize = tokenBase;
13157
+ break;
13158
+ }
13159
+ escaped = !escaped && next == "\\";
13160
+ }
13161
+ return ret("quasi", "string-2", stream.current());
13162
+ }
13163
+ var brackets = "([{}])";
13164
+ function findFatArrow(stream, state) {
13165
+ if (state.fatArrowAt) state.fatArrowAt = null;
13166
+ var arrow = stream.string.indexOf("=>", stream.start);
13167
+ if (arrow < 0) return;
13168
+ if (isTS) {
13169
+ var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow));
13170
+ if (m) arrow = m.index;
13171
+ }
13172
+ var depth = 0, sawSomething = false;
13173
+ for (var pos = arrow - 1; pos >= 0; --pos) {
13174
+ var ch = stream.string.charAt(pos);
13175
+ var bracket = brackets.indexOf(ch);
13176
+ if (bracket >= 0 && bracket < 3) {
13177
+ if (!depth) {
13203
13178
  ++pos;
13204
13179
  break;
13205
13180
  }
13206
- }
13207
- if (sawSomething && !depth) state.fatArrowAt = pos;
13208
- }
13209
- var atomicTypes = {
13210
- "atom": true,
13211
- "number": true,
13212
- "variable": true,
13213
- "string": true,
13214
- "regexp": true,
13215
- "this": true,
13216
- "import": true,
13217
- "jsonld-keyword": true
13218
- };
13219
- function JSLexical(indented, column, type2, align, prev, info) {
13220
- this.indented = indented;
13221
- this.column = column;
13222
- this.type = type2;
13223
- this.prev = prev;
13224
- this.info = info;
13225
- if (align != null) this.align = align;
13226
- }
13227
- function inScope(state, varname) {
13228
- if (!trackScope) return false;
13229
- for (var v = state.localVars; v; v = v.next)
13230
- if (v.name == varname) return true;
13231
- for (var cx2 = state.context; cx2; cx2 = cx2.prev) {
13232
- for (var v = cx2.vars; v; v = v.next)
13233
- if (v.name == varname) return true;
13234
- }
13235
- }
13236
- function parseJS(state, style, type2, content2, stream) {
13237
- var cc = state.cc;
13238
- cx.state = state;
13239
- cx.stream = stream;
13240
- cx.marked = null, cx.cc = cc;
13241
- cx.style = style;
13242
- if (!state.lexical.hasOwnProperty("align"))
13243
- state.lexical.align = true;
13244
- while (true) {
13245
- var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
13246
- if (combinator(type2, content2)) {
13247
- while (cc.length && cc[cc.length - 1].lex)
13248
- cc.pop()();
13249
- if (cx.marked) return cx.marked;
13250
- if (type2 == "variable" && inScope(state, content2)) return "variable-2";
13251
- return style;
13181
+ if (--depth == 0) {
13182
+ if (ch == "(") sawSomething = true;
13183
+ break;
13252
13184
  }
13253
- }
13254
- }
13255
- var cx = { state: null, column: null, marked: null, cc: null };
13256
- function pass() {
13257
- for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
13258
- }
13259
- function cont() {
13260
- pass.apply(null, arguments);
13261
- return true;
13262
- }
13263
- function inList(name, list) {
13264
- for (var v = list; v; v = v.next) if (v.name == name) return true;
13265
- return false;
13266
- }
13267
- function register(varname) {
13268
- var state = cx.state;
13269
- cx.marked = "def";
13270
- if (!trackScope) return;
13271
- if (state.context) {
13272
- if (state.lexical.info == "var" && state.context && state.context.block) {
13273
- var newContext = registerVarScoped(varname, state.context);
13274
- if (newContext != null) {
13275
- state.context = newContext;
13276
- return;
13185
+ } else if (bracket >= 3 && bracket < 6) {
13186
+ ++depth;
13187
+ } else if (wordRE.test(ch)) {
13188
+ sawSomething = true;
13189
+ } else if (/["'\/`]/.test(ch)) {
13190
+ for (; ; --pos) {
13191
+ if (pos == 0) return;
13192
+ var next = stream.string.charAt(pos - 1);
13193
+ if (next == ch && stream.string.charAt(pos - 2) != "\\") {
13194
+ pos--;
13195
+ break;
13277
13196
  }
13278
- } else if (!inList(varname, state.localVars)) {
13279
- state.localVars = new Var(varname, state.localVars);
13280
- return;
13281
13197
  }
13282
- }
13283
- if (parserConfig.globalVars && !inList(varname, state.globalVars))
13284
- state.globalVars = new Var(varname, state.globalVars);
13285
- }
13286
- function registerVarScoped(varname, context) {
13287
- if (!context) {
13288
- return null;
13289
- } else if (context.block) {
13290
- var inner = registerVarScoped(varname, context.prev);
13291
- if (!inner) return null;
13292
- if (inner == context.prev) return context;
13293
- return new Context(inner, context.vars, true);
13294
- } else if (inList(varname, context.vars)) {
13295
- return context;
13296
- } else {
13297
- return new Context(context.prev, new Var(varname, context.vars), false);
13298
- }
13299
- }
13300
- function isModifier(name) {
13301
- return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly";
13302
- }
13303
- function Context(prev, vars, block2) {
13304
- this.prev = prev;
13305
- this.vars = vars;
13306
- this.block = block2;
13307
- }
13308
- function Var(name, next) {
13309
- this.name = name;
13310
- this.next = next;
13311
- }
13312
- var defaultVars = new Var("this", new Var("arguments", null));
13313
- function pushcontext() {
13314
- cx.state.context = new Context(cx.state.context, cx.state.localVars, false);
13315
- cx.state.localVars = defaultVars;
13316
- }
13317
- function pushblockcontext() {
13318
- cx.state.context = new Context(cx.state.context, cx.state.localVars, true);
13319
- cx.state.localVars = null;
13320
- }
13321
- pushcontext.lex = pushblockcontext.lex = true;
13322
- function popcontext() {
13323
- cx.state.localVars = cx.state.context.vars;
13324
- cx.state.context = cx.state.context.prev;
13325
- }
13326
- popcontext.lex = true;
13327
- function pushlex(type2, info) {
13328
- var result = function() {
13329
- var state = cx.state, indent = state.indented;
13330
- if (state.lexical.type == "stat") indent = state.lexical.indented;
13331
- else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
13332
- indent = outer.indented;
13333
- state.lexical = new JSLexical(indent, cx.stream.column(), type2, null, state.lexical, info);
13334
- };
13335
- result.lex = true;
13336
- return result;
13337
- }
13338
- function poplex() {
13339
- var state = cx.state;
13340
- if (state.lexical.prev) {
13341
- if (state.lexical.type == ")")
13342
- state.indented = state.lexical.indented;
13343
- state.lexical = state.lexical.prev;
13344
- }
13345
- }
13346
- poplex.lex = true;
13347
- function expect(wanted) {
13348
- function exp(type2) {
13349
- if (type2 == wanted) return cont();
13350
- else if (wanted == ";" || type2 == "}" || type2 == ")" || type2 == "]") return pass();
13351
- else return cont(exp);
13352
- }
13353
- return exp;
13354
- }
13355
- function statement(type2, value) {
13356
- if (type2 == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
13357
- if (type2 == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
13358
- if (type2 == "keyword b") return cont(pushlex("form"), statement, poplex);
13359
- if (type2 == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
13360
- if (type2 == "debugger") return cont(expect(";"));
13361
- if (type2 == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
13362
- if (type2 == ";") return cont();
13363
- if (type2 == "if") {
13364
- if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
13365
- cx.state.cc.pop()();
13366
- return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
13367
- }
13368
- if (type2 == "function") return cont(functiondef);
13369
- if (type2 == "for") return cont(pushlex("form"), pushblockcontext, forspec, statement, popcontext, poplex);
13370
- if (type2 == "class" || isTS && value == "interface") {
13371
- cx.marked = "keyword";
13372
- return cont(pushlex("form", type2 == "class" ? type2 : value), className, poplex);
13373
- }
13374
- if (type2 == "variable") {
13375
- if (isTS && value == "declare") {
13376
- cx.marked = "keyword";
13377
- return cont(statement);
13378
- } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
13379
- cx.marked = "keyword";
13380
- if (value == "enum") return cont(enumdef);
13381
- else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";"));
13382
- else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex);
13383
- } else if (isTS && value == "namespace") {
13384
- cx.marked = "keyword";
13385
- return cont(pushlex("form"), expression, statement, poplex);
13386
- } else if (isTS && value == "abstract") {
13387
- cx.marked = "keyword";
13388
- return cont(statement);
13389
- } else {
13390
- return cont(pushlex("stat"), maybelabel);
13391
- }
13392
- }
13393
- if (type2 == "switch") return cont(
13394
- pushlex("form"),
13395
- parenExpr,
13396
- expect("{"),
13397
- pushlex("}", "switch"),
13398
- pushblockcontext,
13399
- block,
13400
- poplex,
13401
- poplex,
13402
- popcontext
13403
- );
13404
- if (type2 == "case") return cont(expression, expect(":"));
13405
- if (type2 == "default") return cont(expect(":"));
13406
- if (type2 == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
13407
- if (type2 == "export") return cont(pushlex("stat"), afterExport, poplex);
13408
- if (type2 == "import") return cont(pushlex("stat"), afterImport, poplex);
13409
- if (type2 == "async") return cont(statement);
13410
- if (value == "@") return cont(expression, statement);
13411
- return pass(pushlex("stat"), expression, expect(";"), poplex);
13412
- }
13413
- function maybeCatchBinding(type2) {
13414
- if (type2 == "(") return cont(funarg, expect(")"));
13415
- }
13416
- function expression(type2, value) {
13417
- return expressionInner(type2, value, false);
13418
- }
13419
- function expressionNoComma(type2, value) {
13420
- return expressionInner(type2, value, true);
13421
- }
13422
- function parenExpr(type2) {
13423
- if (type2 != "(") return pass();
13424
- return cont(pushlex(")"), maybeexpression, expect(")"), poplex);
13425
- }
13426
- function expressionInner(type2, value, noComma) {
13427
- if (cx.state.fatArrowAt == cx.stream.start) {
13428
- var body = noComma ? arrowBodyNoComma : arrowBody;
13429
- if (type2 == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
13430
- else if (type2 == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
13431
- }
13432
- var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
13433
- if (atomicTypes.hasOwnProperty(type2)) return cont(maybeop);
13434
- if (type2 == "function") return cont(functiondef, maybeop);
13435
- if (type2 == "class" || isTS && value == "interface") {
13436
- cx.marked = "keyword";
13437
- return cont(pushlex("form"), classExpression, poplex);
13438
- }
13439
- if (type2 == "keyword c" || type2 == "async") return cont(noComma ? expressionNoComma : expression);
13440
- if (type2 == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
13441
- if (type2 == "operator" || type2 == "spread") return cont(noComma ? expressionNoComma : expression);
13442
- if (type2 == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
13443
- if (type2 == "{") return contCommasep(objprop, "}", null, maybeop);
13444
- if (type2 == "quasi") return pass(quasi, maybeop);
13445
- if (type2 == "new") return cont(maybeTarget(noComma));
13446
- return cont();
13447
- }
13448
- function maybeexpression(type2) {
13449
- if (type2.match(/[;\}\)\],]/)) return pass();
13450
- return pass(expression);
13451
- }
13452
- function maybeoperatorComma(type2, value) {
13453
- if (type2 == ",") return cont(maybeexpression);
13454
- return maybeoperatorNoComma(type2, value, false);
13455
- }
13456
- function maybeoperatorNoComma(type2, value, noComma) {
13457
- var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
13458
- var expr = noComma == false ? expression : expressionNoComma;
13459
- if (type2 == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
13460
- if (type2 == "operator") {
13461
- if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
13462
- if (isTS && value == "<" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/, false))
13463
- return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
13464
- if (value == "?") return cont(expression, expect(":"), expr);
13465
- return cont(expr);
13466
- }
13467
- if (type2 == "quasi") {
13468
- return pass(quasi, me);
13469
- }
13470
- if (type2 == ";") return;
13471
- if (type2 == "(") return contCommasep(expressionNoComma, ")", "call", me);
13472
- if (type2 == ".") return cont(property, me);
13473
- if (type2 == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
13474
- if (isTS && value == "as") {
13475
- cx.marked = "keyword";
13476
- return cont(typeexpr, me);
13477
- }
13478
- if (type2 == "regexp") {
13479
- cx.state.lastType = cx.marked = "operator";
13480
- cx.stream.backUp(cx.stream.pos - cx.stream.start - 1);
13481
- return cont(expr);
13198
+ } else if (sawSomething && !depth) {
13199
+ ++pos;
13200
+ break;
13482
13201
  }
13483
13202
  }
13484
- function quasi(type2, value) {
13485
- if (type2 != "quasi") return pass();
13486
- if (value.slice(value.length - 2) != "${") return cont(quasi);
13487
- return cont(maybeexpression, continueQuasi);
13203
+ if (sawSomething && !depth) state.fatArrowAt = pos;
13204
+ }
13205
+ var atomicTypes = {
13206
+ "atom": true,
13207
+ "number": true,
13208
+ "variable": true,
13209
+ "string": true,
13210
+ "regexp": true,
13211
+ "this": true,
13212
+ "import": true,
13213
+ "jsonld-keyword": true
13214
+ };
13215
+ function JSLexical(indented, column, type2, align, prev, info) {
13216
+ this.indented = indented;
13217
+ this.column = column;
13218
+ this.type = type2;
13219
+ this.prev = prev;
13220
+ this.info = info;
13221
+ if (align != null) this.align = align;
13222
+ }
13223
+ function inScope(state, varname) {
13224
+ if (!trackScope) return false;
13225
+ for (var v = state.localVars; v; v = v.next)
13226
+ if (v.name == varname) return true;
13227
+ for (var cx2 = state.context; cx2; cx2 = cx2.prev) {
13228
+ for (var v = cx2.vars; v; v = v.next)
13229
+ if (v.name == varname) return true;
13488
13230
  }
13489
- function continueQuasi(type2) {
13490
- if (type2 == "}") {
13491
- cx.marked = "string-2";
13492
- cx.state.tokenize = tokenQuasi;
13493
- return cont(quasi);
13231
+ }
13232
+ function parseJS(state, style, type2, content2, stream) {
13233
+ var cc = state.cc;
13234
+ cx.state = state;
13235
+ cx.stream = stream;
13236
+ cx.marked = null, cx.cc = cc;
13237
+ cx.style = style;
13238
+ if (!state.lexical.hasOwnProperty("align"))
13239
+ state.lexical.align = true;
13240
+ while (true) {
13241
+ var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
13242
+ if (combinator(type2, content2)) {
13243
+ while (cc.length && cc[cc.length - 1].lex)
13244
+ cc.pop()();
13245
+ if (cx.marked) return cx.marked;
13246
+ if (type2 == "variable" && inScope(state, content2)) return "variable-2";
13247
+ return style;
13494
13248
  }
13495
13249
  }
13496
- function arrowBody(type2) {
13497
- findFatArrow(cx.stream, cx.state);
13498
- return pass(type2 == "{" ? statement : expression);
13499
- }
13500
- function arrowBodyNoComma(type2) {
13501
- findFatArrow(cx.stream, cx.state);
13502
- return pass(type2 == "{" ? statement : expressionNoComma);
13503
- }
13504
- function maybeTarget(noComma) {
13505
- return function(type2) {
13506
- if (type2 == ".") return cont(noComma ? targetNoComma : target);
13507
- else if (type2 == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma);
13508
- else return pass(noComma ? expressionNoComma : expression);
13509
- };
13510
- }
13511
- function target(_, value) {
13512
- if (value == "target") {
13513
- cx.marked = "keyword";
13514
- return cont(maybeoperatorComma);
13250
+ }
13251
+ var cx = { state: null, column: null, marked: null, cc: null };
13252
+ function pass() {
13253
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
13254
+ }
13255
+ function cont() {
13256
+ pass.apply(null, arguments);
13257
+ return true;
13258
+ }
13259
+ function inList(name, list) {
13260
+ for (var v = list; v; v = v.next) if (v.name == name) return true;
13261
+ return false;
13262
+ }
13263
+ function register(varname) {
13264
+ var state = cx.state;
13265
+ cx.marked = "def";
13266
+ if (!trackScope) return;
13267
+ if (state.context) {
13268
+ if (state.lexical.info == "var" && state.context && state.context.block) {
13269
+ var newContext = registerVarScoped(varname, state.context);
13270
+ if (newContext != null) {
13271
+ state.context = newContext;
13272
+ return;
13273
+ }
13274
+ } else if (!inList(varname, state.localVars)) {
13275
+ state.localVars = new Var(varname, state.localVars);
13276
+ return;
13515
13277
  }
13516
13278
  }
13517
- function targetNoComma(_, value) {
13518
- if (value == "target") {
13519
- cx.marked = "keyword";
13520
- return cont(maybeoperatorNoComma);
13521
- }
13522
- }
13523
- function maybelabel(type2) {
13524
- if (type2 == ":") return cont(poplex, statement);
13525
- return pass(maybeoperatorComma, expect(";"), poplex);
13526
- }
13527
- function property(type2) {
13528
- if (type2 == "variable") {
13529
- cx.marked = "property";
13530
- return cont();
13531
- }
13532
- }
13533
- function objprop(type2, value) {
13534
- if (type2 == "async") {
13535
- cx.marked = "property";
13536
- return cont(objprop);
13537
- } else if (type2 == "variable" || cx.style == "keyword") {
13538
- cx.marked = "property";
13539
- if (value == "get" || value == "set") return cont(getterSetter);
13540
- var m;
13541
- if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false)))
13542
- cx.state.fatArrowAt = cx.stream.pos + m[0].length;
13543
- return cont(afterprop);
13544
- } else if (type2 == "number" || type2 == "string") {
13545
- cx.marked = jsonldMode ? "property" : cx.style + " property";
13546
- return cont(afterprop);
13547
- } else if (type2 == "jsonld-keyword") {
13548
- return cont(afterprop);
13549
- } else if (isTS && isModifier(value)) {
13279
+ if (parserConfig.globalVars && !inList(varname, state.globalVars))
13280
+ state.globalVars = new Var(varname, state.globalVars);
13281
+ }
13282
+ function registerVarScoped(varname, context) {
13283
+ if (!context) {
13284
+ return null;
13285
+ } else if (context.block) {
13286
+ var inner = registerVarScoped(varname, context.prev);
13287
+ if (!inner) return null;
13288
+ if (inner == context.prev) return context;
13289
+ return new Context(inner, context.vars, true);
13290
+ } else if (inList(varname, context.vars)) {
13291
+ return context;
13292
+ } else {
13293
+ return new Context(context.prev, new Var(varname, context.vars), false);
13294
+ }
13295
+ }
13296
+ function isModifier(name) {
13297
+ return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly";
13298
+ }
13299
+ function Context(prev, vars, block2) {
13300
+ this.prev = prev;
13301
+ this.vars = vars;
13302
+ this.block = block2;
13303
+ }
13304
+ function Var(name, next) {
13305
+ this.name = name;
13306
+ this.next = next;
13307
+ }
13308
+ var defaultVars = new Var("this", new Var("arguments", null));
13309
+ function pushcontext() {
13310
+ cx.state.context = new Context(cx.state.context, cx.state.localVars, false);
13311
+ cx.state.localVars = defaultVars;
13312
+ }
13313
+ function pushblockcontext() {
13314
+ cx.state.context = new Context(cx.state.context, cx.state.localVars, true);
13315
+ cx.state.localVars = null;
13316
+ }
13317
+ pushcontext.lex = pushblockcontext.lex = true;
13318
+ function popcontext() {
13319
+ cx.state.localVars = cx.state.context.vars;
13320
+ cx.state.context = cx.state.context.prev;
13321
+ }
13322
+ popcontext.lex = true;
13323
+ function pushlex(type2, info) {
13324
+ var result = function() {
13325
+ var state = cx.state, indent = state.indented;
13326
+ if (state.lexical.type == "stat") indent = state.lexical.indented;
13327
+ else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
13328
+ indent = outer.indented;
13329
+ state.lexical = new JSLexical(indent, cx.stream.column(), type2, null, state.lexical, info);
13330
+ };
13331
+ result.lex = true;
13332
+ return result;
13333
+ }
13334
+ function poplex() {
13335
+ var state = cx.state;
13336
+ if (state.lexical.prev) {
13337
+ if (state.lexical.type == ")")
13338
+ state.indented = state.lexical.indented;
13339
+ state.lexical = state.lexical.prev;
13340
+ }
13341
+ }
13342
+ poplex.lex = true;
13343
+ function expect(wanted) {
13344
+ function exp(type2) {
13345
+ if (type2 == wanted) return cont();
13346
+ else if (wanted == ";" || type2 == "}" || type2 == ")" || type2 == "]") return pass();
13347
+ else return cont(exp);
13348
+ }
13349
+ return exp;
13350
+ }
13351
+ function statement(type2, value) {
13352
+ if (type2 == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
13353
+ if (type2 == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
13354
+ if (type2 == "keyword b") return cont(pushlex("form"), statement, poplex);
13355
+ if (type2 == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
13356
+ if (type2 == "debugger") return cont(expect(";"));
13357
+ if (type2 == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
13358
+ if (type2 == ";") return cont();
13359
+ if (type2 == "if") {
13360
+ if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
13361
+ cx.state.cc.pop()();
13362
+ return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
13363
+ }
13364
+ if (type2 == "function") return cont(functiondef);
13365
+ if (type2 == "for") return cont(pushlex("form"), pushblockcontext, forspec, statement, popcontext, poplex);
13366
+ if (type2 == "class" || isTS && value == "interface") {
13367
+ cx.marked = "keyword";
13368
+ return cont(pushlex("form", type2 == "class" ? type2 : value), className, poplex);
13369
+ }
13370
+ if (type2 == "variable") {
13371
+ if (isTS && value == "declare") {
13550
13372
  cx.marked = "keyword";
13551
- return cont(objprop);
13552
- } else if (type2 == "[") {
13553
- return cont(expression, maybetype, expect("]"), afterprop);
13554
- } else if (type2 == "spread") {
13555
- return cont(expressionNoComma, afterprop);
13556
- } else if (value == "*") {
13373
+ return cont(statement);
13374
+ } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
13557
13375
  cx.marked = "keyword";
13558
- return cont(objprop);
13559
- } else if (type2 == ":") {
13560
- return pass(afterprop);
13561
- }
13562
- }
13563
- function getterSetter(type2) {
13564
- if (type2 != "variable") return pass(afterprop);
13565
- cx.marked = "property";
13566
- return cont(functiondef);
13567
- }
13568
- function afterprop(type2) {
13569
- if (type2 == ":") return cont(expressionNoComma);
13570
- if (type2 == "(") return pass(functiondef);
13571
- }
13572
- function commasep(what, end, sep) {
13573
- function proceed(type2, value) {
13574
- if (sep ? sep.indexOf(type2) > -1 : type2 == ",") {
13575
- var lex = cx.state.lexical;
13576
- if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
13577
- return cont(function(type3, value2) {
13578
- if (type3 == end || value2 == end) return pass();
13579
- return pass(what);
13580
- }, proceed);
13581
- }
13582
- if (type2 == end || value == end) return cont();
13583
- if (sep && sep.indexOf(";") > -1) return pass(what);
13584
- return cont(expect(end));
13585
- }
13586
- return function(type2, value) {
13587
- if (type2 == end || value == end) return cont();
13588
- return pass(what, proceed);
13589
- };
13590
- }
13591
- function contCommasep(what, end, info) {
13592
- for (var i = 3; i < arguments.length; i++)
13593
- cx.cc.push(arguments[i]);
13594
- return cont(pushlex(end, info), commasep(what, end), poplex);
13595
- }
13596
- function block(type2) {
13597
- if (type2 == "}") return cont();
13598
- return pass(statement, block);
13599
- }
13600
- function maybetype(type2, value) {
13601
- if (isTS) {
13602
- if (type2 == ":") return cont(typeexpr);
13603
- if (value == "?") return cont(maybetype);
13604
- }
13605
- }
13606
- function maybetypeOrIn(type2, value) {
13607
- if (isTS && (type2 == ":" || value == "in")) return cont(typeexpr);
13608
- }
13609
- function mayberettype(type2) {
13610
- if (isTS && type2 == ":") {
13611
- if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr);
13612
- else return cont(typeexpr);
13613
- }
13614
- }
13615
- function isKW(_, value) {
13616
- if (value == "is") {
13376
+ if (value == "enum") return cont(enumdef);
13377
+ else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";"));
13378
+ else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex);
13379
+ } else if (isTS && value == "namespace") {
13617
13380
  cx.marked = "keyword";
13618
- return cont();
13619
- }
13620
- }
13621
- function typeexpr(type2, value) {
13622
- if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") {
13381
+ return cont(pushlex("form"), expression, statement, poplex);
13382
+ } else if (isTS && value == "abstract") {
13623
13383
  cx.marked = "keyword";
13624
- return cont(value == "typeof" ? expressionNoComma : typeexpr);
13625
- }
13626
- if (type2 == "variable" || value == "void") {
13627
- cx.marked = "type";
13628
- return cont(afterType);
13629
- }
13630
- if (value == "|" || value == "&") return cont(typeexpr);
13631
- if (type2 == "string" || type2 == "number" || type2 == "atom") return cont(afterType);
13632
- if (type2 == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType);
13633
- if (type2 == "{") return cont(pushlex("}"), typeprops, poplex, afterType);
13634
- if (type2 == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType);
13635
- if (type2 == "<") return cont(commasep(typeexpr, ">"), typeexpr);
13636
- if (type2 == "quasi") {
13637
- return pass(quasiType, afterType);
13638
- }
13639
- }
13640
- function maybeReturnType(type2) {
13641
- if (type2 == "=>") return cont(typeexpr);
13642
- }
13643
- function typeprops(type2) {
13644
- if (type2.match(/[\}\)\]]/)) return cont();
13645
- if (type2 == "," || type2 == ";") return cont(typeprops);
13646
- return pass(typeprop, typeprops);
13647
- }
13648
- function typeprop(type2, value) {
13649
- if (type2 == "variable" || cx.style == "keyword") {
13650
- cx.marked = "property";
13651
- return cont(typeprop);
13652
- } else if (value == "?" || type2 == "number" || type2 == "string") {
13653
- return cont(typeprop);
13654
- } else if (type2 == ":") {
13655
- return cont(typeexpr);
13656
- } else if (type2 == "[") {
13657
- return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop);
13658
- } else if (type2 == "(") {
13659
- return pass(functiondecl, typeprop);
13660
- } else if (!type2.match(/[;\}\)\],]/)) {
13661
- return cont();
13662
- }
13384
+ return cont(statement);
13385
+ } else {
13386
+ return cont(pushlex("stat"), maybelabel);
13387
+ }
13388
+ }
13389
+ if (type2 == "switch") return cont(
13390
+ pushlex("form"),
13391
+ parenExpr,
13392
+ expect("{"),
13393
+ pushlex("}", "switch"),
13394
+ pushblockcontext,
13395
+ block,
13396
+ poplex,
13397
+ poplex,
13398
+ popcontext
13399
+ );
13400
+ if (type2 == "case") return cont(expression, expect(":"));
13401
+ if (type2 == "default") return cont(expect(":"));
13402
+ if (type2 == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
13403
+ if (type2 == "export") return cont(pushlex("stat"), afterExport, poplex);
13404
+ if (type2 == "import") return cont(pushlex("stat"), afterImport, poplex);
13405
+ if (type2 == "async") return cont(statement);
13406
+ if (value == "@") return cont(expression, statement);
13407
+ return pass(pushlex("stat"), expression, expect(";"), poplex);
13408
+ }
13409
+ function maybeCatchBinding(type2) {
13410
+ if (type2 == "(") return cont(funarg, expect(")"));
13411
+ }
13412
+ function expression(type2, value) {
13413
+ return expressionInner(type2, value, false);
13414
+ }
13415
+ function expressionNoComma(type2, value) {
13416
+ return expressionInner(type2, value, true);
13417
+ }
13418
+ function parenExpr(type2) {
13419
+ if (type2 != "(") return pass();
13420
+ return cont(pushlex(")"), maybeexpression, expect(")"), poplex);
13421
+ }
13422
+ function expressionInner(type2, value, noComma) {
13423
+ if (cx.state.fatArrowAt == cx.stream.start) {
13424
+ var body = noComma ? arrowBodyNoComma : arrowBody;
13425
+ if (type2 == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
13426
+ else if (type2 == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
13427
+ }
13428
+ var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
13429
+ if (atomicTypes.hasOwnProperty(type2)) return cont(maybeop);
13430
+ if (type2 == "function") return cont(functiondef, maybeop);
13431
+ if (type2 == "class" || isTS && value == "interface") {
13432
+ cx.marked = "keyword";
13433
+ return cont(pushlex("form"), classExpression, poplex);
13434
+ }
13435
+ if (type2 == "keyword c" || type2 == "async") return cont(noComma ? expressionNoComma : expression);
13436
+ if (type2 == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
13437
+ if (type2 == "operator" || type2 == "spread") return cont(noComma ? expressionNoComma : expression);
13438
+ if (type2 == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
13439
+ if (type2 == "{") return contCommasep(objprop, "}", null, maybeop);
13440
+ if (type2 == "quasi") return pass(quasi, maybeop);
13441
+ if (type2 == "new") return cont(maybeTarget(noComma));
13442
+ return cont();
13443
+ }
13444
+ function maybeexpression(type2) {
13445
+ if (type2.match(/[;\}\)\],]/)) return pass();
13446
+ return pass(expression);
13447
+ }
13448
+ function maybeoperatorComma(type2, value) {
13449
+ if (type2 == ",") return cont(maybeexpression);
13450
+ return maybeoperatorNoComma(type2, value, false);
13451
+ }
13452
+ function maybeoperatorNoComma(type2, value, noComma) {
13453
+ var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
13454
+ var expr = noComma == false ? expression : expressionNoComma;
13455
+ if (type2 == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
13456
+ if (type2 == "operator") {
13457
+ if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
13458
+ if (isTS && value == "<" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/, false))
13459
+ return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
13460
+ if (value == "?") return cont(expression, expect(":"), expr);
13461
+ return cont(expr);
13462
+ }
13463
+ if (type2 == "quasi") {
13464
+ return pass(quasi, me);
13465
+ }
13466
+ if (type2 == ";") return;
13467
+ if (type2 == "(") return contCommasep(expressionNoComma, ")", "call", me);
13468
+ if (type2 == ".") return cont(property, me);
13469
+ if (type2 == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
13470
+ if (isTS && value == "as") {
13471
+ cx.marked = "keyword";
13472
+ return cont(typeexpr, me);
13473
+ }
13474
+ if (type2 == "regexp") {
13475
+ cx.state.lastType = cx.marked = "operator";
13476
+ cx.stream.backUp(cx.stream.pos - cx.stream.start - 1);
13477
+ return cont(expr);
13478
+ }
13479
+ }
13480
+ function quasi(type2, value) {
13481
+ if (type2 != "quasi") return pass();
13482
+ if (value.slice(value.length - 2) != "${") return cont(quasi);
13483
+ return cont(maybeexpression, continueQuasi);
13484
+ }
13485
+ function continueQuasi(type2) {
13486
+ if (type2 == "}") {
13487
+ cx.marked = "string-2";
13488
+ cx.state.tokenize = tokenQuasi;
13489
+ return cont(quasi);
13490
+ }
13491
+ }
13492
+ function arrowBody(type2) {
13493
+ findFatArrow(cx.stream, cx.state);
13494
+ return pass(type2 == "{" ? statement : expression);
13495
+ }
13496
+ function arrowBodyNoComma(type2) {
13497
+ findFatArrow(cx.stream, cx.state);
13498
+ return pass(type2 == "{" ? statement : expressionNoComma);
13499
+ }
13500
+ function maybeTarget(noComma) {
13501
+ return function(type2) {
13502
+ if (type2 == ".") return cont(noComma ? targetNoComma : target);
13503
+ else if (type2 == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma);
13504
+ else return pass(noComma ? expressionNoComma : expression);
13505
+ };
13506
+ }
13507
+ function target(_, value) {
13508
+ if (value == "target") {
13509
+ cx.marked = "keyword";
13510
+ return cont(maybeoperatorComma);
13663
13511
  }
13664
- function quasiType(type2, value) {
13665
- if (type2 != "quasi") return pass();
13666
- if (value.slice(value.length - 2) != "${") return cont(quasiType);
13667
- return cont(typeexpr, continueQuasiType);
13512
+ }
13513
+ function targetNoComma(_, value) {
13514
+ if (value == "target") {
13515
+ cx.marked = "keyword";
13516
+ return cont(maybeoperatorNoComma);
13668
13517
  }
13669
- function continueQuasiType(type2) {
13670
- if (type2 == "}") {
13671
- cx.marked = "string-2";
13672
- cx.state.tokenize = tokenQuasi;
13673
- return cont(quasiType);
13674
- }
13518
+ }
13519
+ function maybelabel(type2) {
13520
+ if (type2 == ":") return cont(poplex, statement);
13521
+ return pass(maybeoperatorComma, expect(";"), poplex);
13522
+ }
13523
+ function property(type2) {
13524
+ if (type2 == "variable") {
13525
+ cx.marked = "property";
13526
+ return cont();
13675
13527
  }
13676
- function typearg(type2, value) {
13677
- if (type2 == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg);
13528
+ }
13529
+ function objprop(type2, value) {
13530
+ if (type2 == "async") {
13531
+ cx.marked = "property";
13532
+ return cont(objprop);
13533
+ } else if (type2 == "variable" || cx.style == "keyword") {
13534
+ cx.marked = "property";
13535
+ if (value == "get" || value == "set") return cont(getterSetter);
13536
+ var m;
13537
+ if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false)))
13538
+ cx.state.fatArrowAt = cx.stream.pos + m[0].length;
13539
+ return cont(afterprop);
13540
+ } else if (type2 == "number" || type2 == "string") {
13541
+ cx.marked = jsonldMode ? "property" : cx.style + " property";
13542
+ return cont(afterprop);
13543
+ } else if (type2 == "jsonld-keyword") {
13544
+ return cont(afterprop);
13545
+ } else if (isTS && isModifier(value)) {
13546
+ cx.marked = "keyword";
13547
+ return cont(objprop);
13548
+ } else if (type2 == "[") {
13549
+ return cont(expression, maybetype, expect("]"), afterprop);
13550
+ } else if (type2 == "spread") {
13551
+ return cont(expressionNoComma, afterprop);
13552
+ } else if (value == "*") {
13553
+ cx.marked = "keyword";
13554
+ return cont(objprop);
13555
+ } else if (type2 == ":") {
13556
+ return pass(afterprop);
13557
+ }
13558
+ }
13559
+ function getterSetter(type2) {
13560
+ if (type2 != "variable") return pass(afterprop);
13561
+ cx.marked = "property";
13562
+ return cont(functiondef);
13563
+ }
13564
+ function afterprop(type2) {
13565
+ if (type2 == ":") return cont(expressionNoComma);
13566
+ if (type2 == "(") return pass(functiondef);
13567
+ }
13568
+ function commasep(what, end, sep) {
13569
+ function proceed(type2, value) {
13570
+ if (sep ? sep.indexOf(type2) > -1 : type2 == ",") {
13571
+ var lex = cx.state.lexical;
13572
+ if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
13573
+ return cont(function(type3, value2) {
13574
+ if (type3 == end || value2 == end) return pass();
13575
+ return pass(what);
13576
+ }, proceed);
13577
+ }
13578
+ if (type2 == end || value == end) return cont();
13579
+ if (sep && sep.indexOf(";") > -1) return pass(what);
13580
+ return cont(expect(end));
13581
+ }
13582
+ return function(type2, value) {
13583
+ if (type2 == end || value == end) return cont();
13584
+ return pass(what, proceed);
13585
+ };
13586
+ }
13587
+ function contCommasep(what, end, info) {
13588
+ for (var i = 3; i < arguments.length; i++)
13589
+ cx.cc.push(arguments[i]);
13590
+ return cont(pushlex(end, info), commasep(what, end), poplex);
13591
+ }
13592
+ function block(type2) {
13593
+ if (type2 == "}") return cont();
13594
+ return pass(statement, block);
13595
+ }
13596
+ function maybetype(type2, value) {
13597
+ if (isTS) {
13678
13598
  if (type2 == ":") return cont(typeexpr);
13679
- if (type2 == "spread") return cont(typearg);
13680
- return pass(typeexpr);
13681
- }
13682
- function afterType(type2, value) {
13683
- if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType);
13684
- if (value == "|" || type2 == "." || value == "&") return cont(typeexpr);
13685
- if (type2 == "[") return cont(typeexpr, expect("]"), afterType);
13686
- if (value == "extends" || value == "implements") {
13687
- cx.marked = "keyword";
13688
- return cont(typeexpr);
13689
- }
13690
- if (value == "?") return cont(typeexpr, expect(":"), typeexpr);
13599
+ if (value == "?") return cont(maybetype);
13691
13600
  }
13692
- function maybeTypeArgs(_, value) {
13693
- if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType);
13694
- }
13695
- function typeparam() {
13696
- return pass(typeexpr, maybeTypeDefault);
13697
- }
13698
- function maybeTypeDefault(_, value) {
13699
- if (value == "=") return cont(typeexpr);
13700
- }
13701
- function vardef(_, value) {
13702
- if (value == "enum") {
13703
- cx.marked = "keyword";
13704
- return cont(enumdef);
13705
- }
13706
- return pass(pattern, maybetype, maybeAssign, vardefCont);
13601
+ }
13602
+ function maybetypeOrIn(type2, value) {
13603
+ if (isTS && (type2 == ":" || value == "in")) return cont(typeexpr);
13604
+ }
13605
+ function mayberettype(type2) {
13606
+ if (isTS && type2 == ":") {
13607
+ if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr);
13608
+ else return cont(typeexpr);
13707
13609
  }
13708
- function pattern(type2, value) {
13709
- if (isTS && isModifier(value)) {
13710
- cx.marked = "keyword";
13711
- return cont(pattern);
13712
- }
13713
- if (type2 == "variable") {
13714
- register(value);
13715
- return cont();
13716
- }
13717
- if (type2 == "spread") return cont(pattern);
13718
- if (type2 == "[") return contCommasep(eltpattern, "]");
13719
- if (type2 == "{") return contCommasep(proppattern, "}");
13610
+ }
13611
+ function isKW(_, value) {
13612
+ if (value == "is") {
13613
+ cx.marked = "keyword";
13614
+ return cont();
13720
13615
  }
13721
- function proppattern(type2, value) {
13722
- if (type2 == "variable" && !cx.stream.match(/^\s*:/, false)) {
13723
- register(value);
13724
- return cont(maybeAssign);
13725
- }
13726
- if (type2 == "variable") cx.marked = "property";
13727
- if (type2 == "spread") return cont(pattern);
13728
- if (type2 == "}") return pass();
13729
- if (type2 == "[") return cont(expression, expect("]"), expect(":"), proppattern);
13730
- return cont(expect(":"), pattern, maybeAssign);
13616
+ }
13617
+ function typeexpr(type2, value) {
13618
+ if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") {
13619
+ cx.marked = "keyword";
13620
+ return cont(value == "typeof" ? expressionNoComma : typeexpr);
13731
13621
  }
13732
- function eltpattern() {
13733
- return pass(pattern, maybeAssign);
13622
+ if (type2 == "variable" || value == "void") {
13623
+ cx.marked = "type";
13624
+ return cont(afterType);
13734
13625
  }
13735
- function maybeAssign(_type, value) {
13736
- if (value == "=") return cont(expressionNoComma);
13626
+ if (value == "|" || value == "&") return cont(typeexpr);
13627
+ if (type2 == "string" || type2 == "number" || type2 == "atom") return cont(afterType);
13628
+ if (type2 == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType);
13629
+ if (type2 == "{") return cont(pushlex("}"), typeprops, poplex, afterType);
13630
+ if (type2 == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType);
13631
+ if (type2 == "<") return cont(commasep(typeexpr, ">"), typeexpr);
13632
+ if (type2 == "quasi") {
13633
+ return pass(quasiType, afterType);
13737
13634
  }
13738
- function vardefCont(type2) {
13739
- if (type2 == ",") return cont(vardef);
13635
+ }
13636
+ function maybeReturnType(type2) {
13637
+ if (type2 == "=>") return cont(typeexpr);
13638
+ }
13639
+ function typeprops(type2) {
13640
+ if (type2.match(/[\}\)\]]/)) return cont();
13641
+ if (type2 == "," || type2 == ";") return cont(typeprops);
13642
+ return pass(typeprop, typeprops);
13643
+ }
13644
+ function typeprop(type2, value) {
13645
+ if (type2 == "variable" || cx.style == "keyword") {
13646
+ cx.marked = "property";
13647
+ return cont(typeprop);
13648
+ } else if (value == "?" || type2 == "number" || type2 == "string") {
13649
+ return cont(typeprop);
13650
+ } else if (type2 == ":") {
13651
+ return cont(typeexpr);
13652
+ } else if (type2 == "[") {
13653
+ return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop);
13654
+ } else if (type2 == "(") {
13655
+ return pass(functiondecl, typeprop);
13656
+ } else if (!type2.match(/[;\}\)\],]/)) {
13657
+ return cont();
13740
13658
  }
13741
- function maybeelse(type2, value) {
13742
- if (type2 == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
13659
+ }
13660
+ function quasiType(type2, value) {
13661
+ if (type2 != "quasi") return pass();
13662
+ if (value.slice(value.length - 2) != "${") return cont(quasiType);
13663
+ return cont(typeexpr, continueQuasiType);
13664
+ }
13665
+ function continueQuasiType(type2) {
13666
+ if (type2 == "}") {
13667
+ cx.marked = "string-2";
13668
+ cx.state.tokenize = tokenQuasi;
13669
+ return cont(quasiType);
13743
13670
  }
13744
- function forspec(type2, value) {
13745
- if (value == "await") return cont(forspec);
13746
- if (type2 == "(") return cont(pushlex(")"), forspec1, poplex);
13671
+ }
13672
+ function typearg(type2, value) {
13673
+ if (type2 == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg);
13674
+ if (type2 == ":") return cont(typeexpr);
13675
+ if (type2 == "spread") return cont(typearg);
13676
+ return pass(typeexpr);
13677
+ }
13678
+ function afterType(type2, value) {
13679
+ if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType);
13680
+ if (value == "|" || type2 == "." || value == "&") return cont(typeexpr);
13681
+ if (type2 == "[") return cont(typeexpr, expect("]"), afterType);
13682
+ if (value == "extends" || value == "implements") {
13683
+ cx.marked = "keyword";
13684
+ return cont(typeexpr);
13747
13685
  }
13748
- function forspec1(type2) {
13749
- if (type2 == "var") return cont(vardef, forspec2);
13750
- if (type2 == "variable") return cont(forspec2);
13751
- return pass(forspec2);
13686
+ if (value == "?") return cont(typeexpr, expect(":"), typeexpr);
13687
+ }
13688
+ function maybeTypeArgs(_, value) {
13689
+ if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType);
13690
+ }
13691
+ function typeparam() {
13692
+ return pass(typeexpr, maybeTypeDefault);
13693
+ }
13694
+ function maybeTypeDefault(_, value) {
13695
+ if (value == "=") return cont(typeexpr);
13696
+ }
13697
+ function vardef(_, value) {
13698
+ if (value == "enum") {
13699
+ cx.marked = "keyword";
13700
+ return cont(enumdef);
13752
13701
  }
13753
- function forspec2(type2, value) {
13754
- if (type2 == ")") return cont();
13755
- if (type2 == ";") return cont(forspec2);
13756
- if (value == "in" || value == "of") {
13757
- cx.marked = "keyword";
13758
- return cont(expression, forspec2);
13759
- }
13760
- return pass(expression, forspec2);
13702
+ return pass(pattern, maybetype, maybeAssign, vardefCont);
13703
+ }
13704
+ function pattern(type2, value) {
13705
+ if (isTS && isModifier(value)) {
13706
+ cx.marked = "keyword";
13707
+ return cont(pattern);
13761
13708
  }
13762
- function functiondef(type2, value) {
13763
- if (value == "*") {
13764
- cx.marked = "keyword";
13765
- return cont(functiondef);
13766
- }
13767
- if (type2 == "variable") {
13768
- register(value);
13769
- return cont(functiondef);
13770
- }
13771
- if (type2 == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
13772
- if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef);
13709
+ if (type2 == "variable") {
13710
+ register(value);
13711
+ return cont();
13773
13712
  }
13774
- function functiondecl(type2, value) {
13775
- if (value == "*") {
13776
- cx.marked = "keyword";
13777
- return cont(functiondecl);
13778
- }
13779
- if (type2 == "variable") {
13780
- register(value);
13781
- return cont(functiondecl);
13782
- }
13783
- if (type2 == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, popcontext);
13784
- if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondecl);
13713
+ if (type2 == "spread") return cont(pattern);
13714
+ if (type2 == "[") return contCommasep(eltpattern, "]");
13715
+ if (type2 == "{") return contCommasep(proppattern, "}");
13716
+ }
13717
+ function proppattern(type2, value) {
13718
+ if (type2 == "variable" && !cx.stream.match(/^\s*:/, false)) {
13719
+ register(value);
13720
+ return cont(maybeAssign);
13785
13721
  }
13786
- function typename(type2, value) {
13787
- if (type2 == "keyword" || type2 == "variable") {
13788
- cx.marked = "type";
13789
- return cont(typename);
13790
- } else if (value == "<") {
13791
- return cont(pushlex(">"), commasep(typeparam, ">"), poplex);
13792
- }
13722
+ if (type2 == "variable") cx.marked = "property";
13723
+ if (type2 == "spread") return cont(pattern);
13724
+ if (type2 == "}") return pass();
13725
+ if (type2 == "[") return cont(expression, expect("]"), expect(":"), proppattern);
13726
+ return cont(expect(":"), pattern, maybeAssign);
13727
+ }
13728
+ function eltpattern() {
13729
+ return pass(pattern, maybeAssign);
13730
+ }
13731
+ function maybeAssign(_type, value) {
13732
+ if (value == "=") return cont(expressionNoComma);
13733
+ }
13734
+ function vardefCont(type2) {
13735
+ if (type2 == ",") return cont(vardef);
13736
+ }
13737
+ function maybeelse(type2, value) {
13738
+ if (type2 == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
13739
+ }
13740
+ function forspec(type2, value) {
13741
+ if (value == "await") return cont(forspec);
13742
+ if (type2 == "(") return cont(pushlex(")"), forspec1, poplex);
13743
+ }
13744
+ function forspec1(type2) {
13745
+ if (type2 == "var") return cont(vardef, forspec2);
13746
+ if (type2 == "variable") return cont(forspec2);
13747
+ return pass(forspec2);
13748
+ }
13749
+ function forspec2(type2, value) {
13750
+ if (type2 == ")") return cont();
13751
+ if (type2 == ";") return cont(forspec2);
13752
+ if (value == "in" || value == "of") {
13753
+ cx.marked = "keyword";
13754
+ return cont(expression, forspec2);
13793
13755
  }
13794
- function funarg(type2, value) {
13795
- if (value == "@") cont(expression, funarg);
13796
- if (type2 == "spread") return cont(funarg);
13797
- if (isTS && isModifier(value)) {
13798
- cx.marked = "keyword";
13799
- return cont(funarg);
13800
- }
13801
- if (isTS && type2 == "this") return cont(maybetype, maybeAssign);
13802
- return pass(pattern, maybetype, maybeAssign);
13756
+ return pass(expression, forspec2);
13757
+ }
13758
+ function functiondef(type2, value) {
13759
+ if (value == "*") {
13760
+ cx.marked = "keyword";
13761
+ return cont(functiondef);
13803
13762
  }
13804
- function classExpression(type2, value) {
13805
- if (type2 == "variable") return className(type2, value);
13806
- return classNameAfter(type2, value);
13763
+ if (type2 == "variable") {
13764
+ register(value);
13765
+ return cont(functiondef);
13807
13766
  }
13808
- function className(type2, value) {
13809
- if (type2 == "variable") {
13810
- register(value);
13811
- return cont(classNameAfter);
13812
- }
13767
+ if (type2 == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
13768
+ if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef);
13769
+ }
13770
+ function functiondecl(type2, value) {
13771
+ if (value == "*") {
13772
+ cx.marked = "keyword";
13773
+ return cont(functiondecl);
13813
13774
  }
13814
- function classNameAfter(type2, value) {
13815
- if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter);
13816
- if (value == "extends" || value == "implements" || isTS && type2 == ",") {
13817
- if (value == "implements") cx.marked = "keyword";
13818
- return cont(isTS ? typeexpr : expression, classNameAfter);
13819
- }
13820
- if (type2 == "{") return cont(pushlex("}"), classBody, poplex);
13775
+ if (type2 == "variable") {
13776
+ register(value);
13777
+ return cont(functiondecl);
13821
13778
  }
13822
- function classBody(type2, value) {
13823
- if (type2 == "async" || type2 == "variable" && (value == "static" || value == "get" || value == "set" || isTS && isModifier(value)) && cx.stream.match(/^\s+#?[\w$\xa1-\uffff]/, false)) {
13824
- cx.marked = "keyword";
13825
- return cont(classBody);
13826
- }
13827
- if (type2 == "variable" || cx.style == "keyword") {
13828
- cx.marked = "property";
13829
- return cont(classfield, classBody);
13830
- }
13831
- if (type2 == "number" || type2 == "string") return cont(classfield, classBody);
13832
- if (type2 == "[")
13833
- return cont(expression, maybetype, expect("]"), classfield, classBody);
13834
- if (value == "*") {
13835
- cx.marked = "keyword";
13836
- return cont(classBody);
13837
- }
13838
- if (isTS && type2 == "(") return pass(functiondecl, classBody);
13839
- if (type2 == ";" || type2 == ",") return cont(classBody);
13840
- if (type2 == "}") return cont();
13841
- if (value == "@") return cont(expression, classBody);
13842
- }
13843
- function classfield(type2, value) {
13844
- if (value == "!") return cont(classfield);
13845
- if (value == "?") return cont(classfield);
13846
- if (type2 == ":") return cont(typeexpr, maybeAssign);
13847
- if (value == "=") return cont(expressionNoComma);
13848
- var context = cx.state.lexical.prev, isInterface = context && context.info == "interface";
13849
- return pass(isInterface ? functiondecl : functiondef);
13850
- }
13851
- function afterExport(type2, value) {
13852
- if (value == "*") {
13853
- cx.marked = "keyword";
13854
- return cont(maybeFrom, expect(";"));
13855
- }
13856
- if (value == "default") {
13857
- cx.marked = "keyword";
13858
- return cont(expression, expect(";"));
13859
- }
13860
- if (type2 == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
13861
- return pass(statement);
13779
+ if (type2 == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, popcontext);
13780
+ if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondecl);
13781
+ }
13782
+ function typename(type2, value) {
13783
+ if (type2 == "keyword" || type2 == "variable") {
13784
+ cx.marked = "type";
13785
+ return cont(typename);
13786
+ } else if (value == "<") {
13787
+ return cont(pushlex(">"), commasep(typeparam, ">"), poplex);
13862
13788
  }
13863
- function exportField(type2, value) {
13864
- if (value == "as") {
13865
- cx.marked = "keyword";
13866
- return cont(expect("variable"));
13867
- }
13868
- if (type2 == "variable") return pass(expressionNoComma, exportField);
13789
+ }
13790
+ function funarg(type2, value) {
13791
+ if (value == "@") cont(expression, funarg);
13792
+ if (type2 == "spread") return cont(funarg);
13793
+ if (isTS && isModifier(value)) {
13794
+ cx.marked = "keyword";
13795
+ return cont(funarg);
13869
13796
  }
13870
- function afterImport(type2) {
13871
- if (type2 == "string") return cont();
13872
- if (type2 == "(") return pass(expression);
13873
- if (type2 == ".") return pass(maybeoperatorComma);
13874
- return pass(importSpec, maybeMoreImports, maybeFrom);
13797
+ if (isTS && type2 == "this") return cont(maybetype, maybeAssign);
13798
+ return pass(pattern, maybetype, maybeAssign);
13799
+ }
13800
+ function classExpression(type2, value) {
13801
+ if (type2 == "variable") return className(type2, value);
13802
+ return classNameAfter(type2, value);
13803
+ }
13804
+ function className(type2, value) {
13805
+ if (type2 == "variable") {
13806
+ register(value);
13807
+ return cont(classNameAfter);
13875
13808
  }
13876
- function importSpec(type2, value) {
13877
- if (type2 == "{") return contCommasep(importSpec, "}");
13878
- if (type2 == "variable") register(value);
13879
- if (value == "*") cx.marked = "keyword";
13880
- return cont(maybeAs);
13809
+ }
13810
+ function classNameAfter(type2, value) {
13811
+ if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter);
13812
+ if (value == "extends" || value == "implements" || isTS && type2 == ",") {
13813
+ if (value == "implements") cx.marked = "keyword";
13814
+ return cont(isTS ? typeexpr : expression, classNameAfter);
13881
13815
  }
13882
- function maybeMoreImports(type2) {
13883
- if (type2 == ",") return cont(importSpec, maybeMoreImports);
13816
+ if (type2 == "{") return cont(pushlex("}"), classBody, poplex);
13817
+ }
13818
+ function classBody(type2, value) {
13819
+ if (type2 == "async" || type2 == "variable" && (value == "static" || value == "get" || value == "set" || isTS && isModifier(value)) && cx.stream.match(/^\s+#?[\w$\xa1-\uffff]/, false)) {
13820
+ cx.marked = "keyword";
13821
+ return cont(classBody);
13884
13822
  }
13885
- function maybeAs(_type, value) {
13886
- if (value == "as") {
13887
- cx.marked = "keyword";
13888
- return cont(importSpec);
13889
- }
13823
+ if (type2 == "variable" || cx.style == "keyword") {
13824
+ cx.marked = "property";
13825
+ return cont(classfield, classBody);
13890
13826
  }
13891
- function maybeFrom(_type, value) {
13892
- if (value == "from") {
13893
- cx.marked = "keyword";
13894
- return cont(expression);
13895
- }
13827
+ if (type2 == "number" || type2 == "string") return cont(classfield, classBody);
13828
+ if (type2 == "[")
13829
+ return cont(expression, maybetype, expect("]"), classfield, classBody);
13830
+ if (value == "*") {
13831
+ cx.marked = "keyword";
13832
+ return cont(classBody);
13896
13833
  }
13897
- function arrayLiteral(type2) {
13898
- if (type2 == "]") return cont();
13899
- return pass(commasep(expressionNoComma, "]"));
13834
+ if (isTS && type2 == "(") return pass(functiondecl, classBody);
13835
+ if (type2 == ";" || type2 == ",") return cont(classBody);
13836
+ if (type2 == "}") return cont();
13837
+ if (value == "@") return cont(expression, classBody);
13838
+ }
13839
+ function classfield(type2, value) {
13840
+ if (value == "!") return cont(classfield);
13841
+ if (value == "?") return cont(classfield);
13842
+ if (type2 == ":") return cont(typeexpr, maybeAssign);
13843
+ if (value == "=") return cont(expressionNoComma);
13844
+ var context = cx.state.lexical.prev, isInterface = context && context.info == "interface";
13845
+ return pass(isInterface ? functiondecl : functiondef);
13846
+ }
13847
+ function afterExport(type2, value) {
13848
+ if (value == "*") {
13849
+ cx.marked = "keyword";
13850
+ return cont(maybeFrom, expect(";"));
13900
13851
  }
13901
- function enumdef() {
13902
- return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex);
13852
+ if (value == "default") {
13853
+ cx.marked = "keyword";
13854
+ return cont(expression, expect(";"));
13903
13855
  }
13904
- function enummember() {
13905
- return pass(pattern, maybeAssign);
13856
+ if (type2 == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
13857
+ return pass(statement);
13858
+ }
13859
+ function exportField(type2, value) {
13860
+ if (value == "as") {
13861
+ cx.marked = "keyword";
13862
+ return cont(expect("variable"));
13906
13863
  }
13907
- function isContinuedStatement(state, textAfter) {
13908
- return state.lastType == "operator" || state.lastType == "," || isOperatorChar.test(textAfter.charAt(0)) || /[,.]/.test(textAfter.charAt(0));
13864
+ if (type2 == "variable") return pass(expressionNoComma, exportField);
13865
+ }
13866
+ function afterImport(type2) {
13867
+ if (type2 == "string") return cont();
13868
+ if (type2 == "(") return pass(expression);
13869
+ if (type2 == ".") return pass(maybeoperatorComma);
13870
+ return pass(importSpec, maybeMoreImports, maybeFrom);
13871
+ }
13872
+ function importSpec(type2, value) {
13873
+ if (type2 == "{") return contCommasep(importSpec, "}");
13874
+ if (type2 == "variable") register(value);
13875
+ if (value == "*") cx.marked = "keyword";
13876
+ return cont(maybeAs);
13877
+ }
13878
+ function maybeMoreImports(type2) {
13879
+ if (type2 == ",") return cont(importSpec, maybeMoreImports);
13880
+ }
13881
+ function maybeAs(_type, value) {
13882
+ if (value == "as") {
13883
+ cx.marked = "keyword";
13884
+ return cont(importSpec);
13909
13885
  }
13910
- function expressionAllowed(stream, state, backUp) {
13911
- return state.tokenize == tokenBase && /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) || state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0)));
13886
+ }
13887
+ function maybeFrom(_type, value) {
13888
+ if (value == "from") {
13889
+ cx.marked = "keyword";
13890
+ return cont(expression);
13912
13891
  }
13913
- return {
13914
- startState: function(basecolumn) {
13915
- var state = {
13916
- tokenize: tokenBase,
13917
- lastType: "sof",
13918
- cc: [],
13919
- lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
13920
- localVars: parserConfig.localVars,
13921
- context: parserConfig.localVars && new Context(null, null, false),
13922
- indented: basecolumn || 0
13923
- };
13924
- if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
13925
- state.globalVars = parserConfig.globalVars;
13926
- return state;
13927
- },
13928
- token: function(stream, state) {
13929
- if (stream.sol()) {
13930
- if (!state.lexical.hasOwnProperty("align"))
13931
- state.lexical.align = false;
13932
- state.indented = stream.indentation();
13933
- findFatArrow(stream, state);
13934
- }
13935
- if (state.tokenize != tokenComment && stream.eatSpace()) return null;
13936
- var style = state.tokenize(stream, state);
13937
- if (type == "comment") return style;
13938
- state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
13939
- return parseJS(state, style, type, content, stream);
13940
- },
13941
- indent: function(state, textAfter) {
13942
- if (state.tokenize == tokenComment || state.tokenize == tokenQuasi) return CodeMirror.Pass;
13943
- if (state.tokenize != tokenBase) return 0;
13944
- var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top;
13945
- if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
13946
- var c = state.cc[i];
13947
- if (c == poplex) lexical = lexical.prev;
13948
- else if (c != maybeelse && c != popcontext) break;
13949
- }
13950
- while ((lexical.type == "stat" || lexical.type == "form") && (firstChar == "}" || (top = state.cc[state.cc.length - 1]) && (top == maybeoperatorComma || top == maybeoperatorNoComma) && !/^[,\.=+\-*:?[\(]/.test(textAfter)))
13951
- lexical = lexical.prev;
13952
- if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
13953
- lexical = lexical.prev;
13954
- var type2 = lexical.type, closing = firstChar == type2;
13955
- if (type2 == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
13956
- else if (type2 == "form" && firstChar == "{") return lexical.indented;
13957
- else if (type2 == "form") return lexical.indented + indentUnit;
13958
- else if (type2 == "stat")
13959
- return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
13960
- else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
13961
- return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
13962
- else if (lexical.align) return lexical.column + (closing ? 0 : 1);
13963
- else return lexical.indented + (closing ? 0 : indentUnit);
13964
- },
13965
- electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
13966
- blockCommentStart: jsonMode ? null : "/*",
13967
- blockCommentEnd: jsonMode ? null : "*/",
13968
- blockCommentContinue: jsonMode ? null : " * ",
13969
- lineComment: jsonMode ? null : "//",
13970
- fold: "brace",
13971
- closeBrackets: "()[]{}''\"\"``",
13972
- helperType: jsonMode ? "json" : "javascript",
13973
- jsonldMode,
13974
- jsonMode,
13975
- expressionAllowed,
13976
- skipExpression: function(state) {
13977
- parseJS(state, "atom", "atom", "true", new CodeMirror.StringStream("", 2, null));
13892
+ }
13893
+ function arrayLiteral(type2) {
13894
+ if (type2 == "]") return cont();
13895
+ return pass(commasep(expressionNoComma, "]"));
13896
+ }
13897
+ function enumdef() {
13898
+ return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex);
13899
+ }
13900
+ function enummember() {
13901
+ return pass(pattern, maybeAssign);
13902
+ }
13903
+ function isContinuedStatement(state, textAfter) {
13904
+ return state.lastType == "operator" || state.lastType == "," || isOperatorChar.test(textAfter.charAt(0)) || /[,.]/.test(textAfter.charAt(0));
13905
+ }
13906
+ function expressionAllowed(stream, state, backUp) {
13907
+ return state.tokenize == tokenBase && /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) || state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0)));
13908
+ }
13909
+ return {
13910
+ startState: function(basecolumn) {
13911
+ var state = {
13912
+ tokenize: tokenBase,
13913
+ lastType: "sof",
13914
+ cc: [],
13915
+ lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
13916
+ localVars: parserConfig.localVars,
13917
+ context: parserConfig.localVars && new Context(null, null, false),
13918
+ indented: basecolumn || 0
13919
+ };
13920
+ if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
13921
+ state.globalVars = parserConfig.globalVars;
13922
+ return state;
13923
+ },
13924
+ token: function(stream, state) {
13925
+ if (stream.sol()) {
13926
+ if (!state.lexical.hasOwnProperty("align"))
13927
+ state.lexical.align = false;
13928
+ state.indented = stream.indentation();
13929
+ findFatArrow(stream, state);
13978
13930
  }
13979
- };
13980
- });
13981
- CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
13982
- CodeMirror.defineMIME("text/javascript", "javascript");
13983
- CodeMirror.defineMIME("text/ecmascript", "javascript");
13984
- CodeMirror.defineMIME("application/javascript", "javascript");
13985
- CodeMirror.defineMIME("application/x-javascript", "javascript");
13986
- CodeMirror.defineMIME("application/ecmascript", "javascript");
13987
- CodeMirror.defineMIME("application/json", { name: "javascript", json: true });
13988
- CodeMirror.defineMIME("application/x-json", { name: "javascript", json: true });
13989
- CodeMirror.defineMIME("application/manifest+json", { name: "javascript", json: true });
13990
- CodeMirror.defineMIME("application/ld+json", { name: "javascript", jsonld: true });
13991
- CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
13992
- CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
13931
+ if (state.tokenize != tokenComment && stream.eatSpace()) return null;
13932
+ var style = state.tokenize(stream, state);
13933
+ if (type == "comment") return style;
13934
+ state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
13935
+ return parseJS(state, style, type, content, stream);
13936
+ },
13937
+ indent: function(state, textAfter) {
13938
+ if (state.tokenize == tokenComment || state.tokenize == tokenQuasi) return CodeMirror.Pass;
13939
+ if (state.tokenize != tokenBase) return 0;
13940
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top;
13941
+ if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
13942
+ var c = state.cc[i];
13943
+ if (c == poplex) lexical = lexical.prev;
13944
+ else if (c != maybeelse && c != popcontext) break;
13945
+ }
13946
+ while ((lexical.type == "stat" || lexical.type == "form") && (firstChar == "}" || (top = state.cc[state.cc.length - 1]) && (top == maybeoperatorComma || top == maybeoperatorNoComma) && !/^[,\.=+\-*:?[\(]/.test(textAfter)))
13947
+ lexical = lexical.prev;
13948
+ if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
13949
+ lexical = lexical.prev;
13950
+ var type2 = lexical.type, closing = firstChar == type2;
13951
+ if (type2 == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
13952
+ else if (type2 == "form" && firstChar == "{") return lexical.indented;
13953
+ else if (type2 == "form") return lexical.indented + indentUnit;
13954
+ else if (type2 == "stat")
13955
+ return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
13956
+ else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
13957
+ return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
13958
+ else if (lexical.align) return lexical.column + (closing ? 0 : 1);
13959
+ else return lexical.indented + (closing ? 0 : indentUnit);
13960
+ },
13961
+ electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
13962
+ blockCommentStart: jsonMode ? null : "/*",
13963
+ blockCommentEnd: jsonMode ? null : "*/",
13964
+ blockCommentContinue: jsonMode ? null : " * ",
13965
+ lineComment: jsonMode ? null : "//",
13966
+ fold: "brace",
13967
+ closeBrackets: "()[]{}''\"\"``",
13968
+ helperType: jsonMode ? "json" : "javascript",
13969
+ jsonldMode,
13970
+ jsonMode,
13971
+ expressionAllowed,
13972
+ skipExpression: function(state) {
13973
+ parseJS(state, "atom", "atom", "true", new CodeMirror.StringStream("", 2, null));
13974
+ }
13975
+ };
13993
13976
  });
13994
- })();
13995
- return javascript.exports;
13996
- }
13977
+ CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
13978
+ CodeMirror.defineMIME("text/javascript", "javascript");
13979
+ CodeMirror.defineMIME("text/ecmascript", "javascript");
13980
+ CodeMirror.defineMIME("application/javascript", "javascript");
13981
+ CodeMirror.defineMIME("application/x-javascript", "javascript");
13982
+ CodeMirror.defineMIME("application/ecmascript", "javascript");
13983
+ CodeMirror.defineMIME("application/json", { name: "javascript", json: true });
13984
+ CodeMirror.defineMIME("application/x-json", { name: "javascript", json: true });
13985
+ CodeMirror.defineMIME("application/manifest+json", { name: "javascript", json: true });
13986
+ CodeMirror.defineMIME("application/ld+json", { name: "javascript", jsonld: true });
13987
+ CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
13988
+ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
13989
+ });
13990
+ })();
13991
+ var javascriptExports = javascript.exports;
13997
13992
  (function(module, exports) {
13998
13993
  (function(mod) {
13999
- mod(requireCodemirror(), requireXml(), requireJavascript(), requireCss());
13994
+ mod(requireCodemirror(), requireXml(), javascriptExports, requireCss());
14000
13995
  })(function(CodeMirror) {
14001
13996
  var defaultTags = {
14002
13997
  script: [
@@ -14126,7 +14121,6 @@ function requireJavascript() {
14126
14121
  CodeMirror.defineMIME("text/html", "htmlmixed");
14127
14122
  });
14128
14123
  })();
14129
- requireJavascript();
14130
14124
  (function(module, exports) {
14131
14125
  (function(mod) {
14132
14126
  mod(requireCodemirror());
@@ -16446,4 +16440,4 @@ function requireMeta() {
16446
16440
  export {
16447
16441
  codemirror as default
16448
16442
  };
16449
- //# sourceMappingURL=codeMirrorModule-EhKN7Okm.js.map
16443
+ //# sourceMappingURL=codeMirrorModule-DGE2kpkE.js.map