@vc-shell/framework 1.1.2 → 1.1.4

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 (271) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/apl-B2DGVGxc.js +76 -0
  3. package/dist/asciiarmor-2LVJmxlE.js +34 -0
  4. package/dist/asn1-jKiBa2Ya.js +95 -0
  5. package/dist/asterisk-DS281yxp.js +271 -0
  6. package/dist/brainfuck-C_p9pTT8.js +34 -0
  7. package/dist/clike-BUuHEmgZ.js +620 -0
  8. package/dist/clojure-CCKyeQKf.js +800 -0
  9. package/dist/cmake-CuaCgAKt.js +28 -0
  10. package/dist/cobol-BlTKFDRj.js +72 -0
  11. package/dist/coffeescript-BVCvwO8I.js +179 -0
  12. package/dist/commonlisp-D_kxz07b.js +75 -0
  13. package/dist/crystal-D309uH6_.js +217 -0
  14. package/dist/css-bIlmDBTK.js +1560 -0
  15. package/dist/cypher-BMq4Fwjl.js +68 -0
  16. package/dist/d-BZcgY6La.js +127 -0
  17. package/dist/diff-Cg9d_RX2.js +18 -0
  18. package/dist/{assets/dockerfile-D0MivFIF.js → dockerfile-DIy8NleC.js} +36 -41
  19. package/dist/dtd-CtLokQ-U.js +84 -0
  20. package/dist/dylan-QYeExnWK.js +234 -0
  21. package/dist/ebnf-DUPDuY4r.js +78 -0
  22. package/dist/ecl-CiXN-g_D.js +121 -0
  23. package/dist/eiffel-yQhjl4T1.js +110 -0
  24. package/dist/elm-CNT9vbN0.js +108 -0
  25. package/dist/erlang-CFOYdy9e.js +487 -0
  26. package/dist/factor-DDOC7X6P.js +65 -0
  27. package/dist/fcl-CPC2WYrI.js +103 -0
  28. package/dist/forth-BmxRyE9S.js +60 -0
  29. package/dist/fortran-9bvPyrOW.js +442 -0
  30. package/dist/framework.js +288 -29
  31. package/dist/gas-BdfkXJT_.js +183 -0
  32. package/dist/gherkin-CJuwpceU.js +34 -0
  33. package/dist/groovy-DZeT_VM-.js +146 -0
  34. package/dist/haskell-Bvt3Qq1t.js +375 -0
  35. package/dist/haxe-70NVW1pR.js +359 -0
  36. package/dist/http-D9LttvKF.js +44 -0
  37. package/dist/idl-B6TRFYjl.js +947 -0
  38. package/dist/{assets/index-BKF-A58l.js → index-BBYKbiRX.js} +79 -92
  39. package/dist/index-BDm0tcWn.js +145680 -0
  40. package/dist/{assets/index-CeeaNa4F.js → index-BDqUaIyQ.js} +136 -167
  41. package/dist/index-BdflTsg6.js +308 -0
  42. package/dist/{assets/index-CtmpJVwa.js → index-BpBTtmQ6.js} +270 -312
  43. package/dist/index-Br0y2YMn.js +58 -0
  44. package/dist/index-CIcET-ZI.js +71 -0
  45. package/dist/index-CYAMpxnu.js +341 -0
  46. package/dist/index-Cf2H7YZ1.js +98 -0
  47. package/dist/{assets/index-Bv_z_qRq.js → index-Ck055pN8.js} +121 -124
  48. package/dist/index-D-fPN3yf.js +75 -0
  49. package/dist/{assets/index-BT8o9-M5.js → index-DJOis7Nc.js} +267 -386
  50. package/dist/index-DKtQMsy4.js +538 -0
  51. package/dist/{assets/index-DMTL7O1s.js → index-DWTsz5bC.js} +570 -586
  52. package/dist/{assets/index-C7zlEJy8.js → index-DuY7BIGm.js} +229 -302
  53. package/dist/{assets/index-B1srGfDb.js → index-o6aSdNED.js} +119 -165
  54. package/dist/index-wfv8ehcx.js +249 -0
  55. package/dist/index.css +9 -18
  56. package/dist/javascript-WMWNx-Vj.js +690 -0
  57. package/dist/jinja2-DnB6dQmV.js +154 -0
  58. package/dist/julia-DpvXAuO6.js +241 -0
  59. package/dist/livescript-CanGTf8u.js +272 -0
  60. package/dist/lua-XplVlWi_.js +217 -0
  61. package/dist/mathematica-jaRHnSxC.js +35 -0
  62. package/dist/mbox-BctzC1hL.js +76 -0
  63. package/dist/mirc-CFBPAOaF.js +72 -0
  64. package/dist/mllike-BSnXJBGA.js +272 -0
  65. package/dist/modelica-vUgVs--1.js +93 -0
  66. package/dist/mscgen-Cpl0NYLN.js +104 -0
  67. package/dist/mumps-CQoS1kWX.js +25 -0
  68. package/dist/nginx-zDPm3Z74.js +89 -0
  69. package/dist/nsis-fePjrhq7.js +62 -0
  70. package/dist/ntriples-CsNjv2QF.js +79 -0
  71. package/dist/octave-C8PmmSRH.js +143 -0
  72. package/dist/oz-Ce8aN8oE.js +151 -0
  73. package/dist/pascal-De0D6mP7.js +77 -0
  74. package/dist/perl-B4bSCe1C.js +915 -0
  75. package/dist/pig-D24Z8EXi.js +54 -0
  76. package/dist/powershell-DkYVfTzP.js +249 -0
  77. package/dist/properties-Dn9wna3M.js +26 -0
  78. package/dist/protobuf-BPIjwpzm.js +49 -0
  79. package/dist/pug-BqUR2bBq.js +248 -0
  80. package/dist/puppet-nyd4dhjf.js +45 -0
  81. package/dist/python-B5QdSKoL.js +313 -0
  82. package/dist/q-DXjKs-tC.js +83 -0
  83. package/dist/r-LKEuhEGI.js +104 -0
  84. package/dist/rpm-IznJm2Xc.js +57 -0
  85. package/dist/ruby-CcYfvIk6.js +228 -0
  86. package/dist/sas-7E8yHoCW.js +105 -0
  87. package/dist/scheme-DjibxsNh.js +124 -0
  88. package/dist/shell-C0C2sNA_.js +182 -0
  89. package/dist/sieve-Bwz7vjP5.js +72 -0
  90. package/dist/simple-mode-B0dvCdAA.js +89 -0
  91. package/dist/smalltalk-Bhddl2pB.js +48 -0
  92. package/dist/solr-BNlsLglM.js +41 -0
  93. package/dist/sparql-FarWu_Gb.js +197 -0
  94. package/dist/spreadsheet-C-cy4P5N.js +49 -0
  95. package/dist/sql-mMre1Bo3.js +282 -0
  96. package/dist/stex-92raWT1r.js +129 -0
  97. package/dist/stylus-CAdqWld3.js +250 -0
  98. package/dist/swift-DSxqR9R6.js +230 -0
  99. package/dist/tcl-xfoLljhY.js +81 -0
  100. package/dist/textile-D1AWE-pc.js +295 -0
  101. package/dist/tiddlywiki-5wqsXtSk.js +155 -0
  102. package/dist/tiki-__Kn3CeS.js +181 -0
  103. package/dist/toml-BHiuTcfn.js +49 -0
  104. package/dist/troff-D2UO-fKf.js +35 -0
  105. package/dist/tsconfig.tsbuildinfo +1 -1
  106. package/dist/ttcn-Bsa4sfRm.js +123 -0
  107. package/dist/ttcn-cfg-Bac_acMi.js +88 -0
  108. package/dist/turtle-xwJUxoPV.js +80 -0
  109. package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
  110. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
  111. package/dist/vb-c2kQGd6-.js +74 -0
  112. package/dist/vbscript-Dz1TtKsy.js +324 -0
  113. package/dist/velocity-DJd0pTTC.js +96 -0
  114. package/dist/verilog-C4VGD9n1.js +263 -0
  115. package/dist/vhdl-T9HkrbI2.js +106 -0
  116. package/dist/webidl-CjfDENEo.js +155 -0
  117. package/dist/xquery-BUQdORAS.js +422 -0
  118. package/dist/yacas-C0absKBh.js +73 -0
  119. package/dist/z80-C8rPtw-0.js +61 -0
  120. package/package.json +4 -4
  121. package/ui/components/atoms/vc-widget/vc-widget.vue +2 -0
  122. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +65 -32
  123. package/dist/assets/apl-NdZ6-T1z.js +0 -142
  124. package/dist/assets/asciiarmor-CmJEbAuq.js +0 -56
  125. package/dist/assets/asn1-Ctc8K72v.js +0 -192
  126. package/dist/assets/asterisk-D6r__RMF.js +0 -187
  127. package/dist/assets/brainfuck-COwWCBpq.js +0 -70
  128. package/dist/assets/clike-C-PtfL50.js +0 -1019
  129. package/dist/assets/clojure-C2XPrGCa.js +0 -274
  130. package/dist/assets/cmake-BGrEgXCL.js +0 -81
  131. package/dist/assets/cobol-DShPmpZe.js +0 -234
  132. package/dist/assets/coffeescript-BG8vTfSz.js +0 -329
  133. package/dist/assets/commonlisp-8oE2EpEe.js +0 -108
  134. package/dist/assets/core-api-BMLS9FrT.js +0 -8288
  135. package/dist/assets/core-composables-DYxpIWyY.js +0 -1799
  136. package/dist/assets/core-constants-DiKDBbnD.js +0 -83
  137. package/dist/assets/core-directives-QhJx9kWh.js +0 -41
  138. package/dist/assets/core-interceptors-CSjUvxQ0.js +0 -78
  139. package/dist/assets/core-plugins-wv2bDZ0l.js +0 -4919
  140. package/dist/assets/core-services-CAfJRsjs.js +0 -4
  141. package/dist/assets/core-utilities-BTktq_a-.js +0 -33
  142. package/dist/assets/crystal--rIRMl16.js +0 -419
  143. package/dist/assets/css/core-directives-FL4vIIkN.css +0 -73
  144. package/dist/assets/css/fonts-M1mtyV8L.css +0 -305
  145. package/dist/assets/css/icons-css-DbCVsovz.css +0 -41
  146. package/dist/assets/css/shared-components-bnLHdCtf.css +0 -429
  147. package/dist/assets/css/shared-modules-CNOICmYQ.css +0 -45
  148. package/dist/assets/css/styles-C62nDZwV.css +0 -4096
  149. package/dist/assets/css/ui-app-Bh9hmlIB.css +0 -1287
  150. package/dist/assets/css/ui-content-B29jsmK7.css +0 -1187
  151. package/dist/assets/css/ui-controls-CRtfFczw.css +0 -387
  152. package/dist/assets/css/ui-data-CYLxfdUa.css +0 -1555
  153. package/dist/assets/css/ui-form-C3WrWfVl.css +0 -71
  154. package/dist/assets/css/ui-form-fields-DOtHhDeM.css +0 -1360
  155. package/dist/assets/css/ui-helpers-bOoNv5dS.css +0 -37
  156. package/dist/assets/css/ui-indicators-CybQnCoU.css +0 -628
  157. package/dist/assets/css/ui-layout-DyGKgizy.css +0 -251
  158. package/dist/assets/css/ui-media-TWYep8js.css +0 -298
  159. package/dist/assets/css/ui-media-advanced-BGxy3VSB.css +0 -183
  160. package/dist/assets/css/ui-navigation-DcPRn8SB.css +0 -1693
  161. package/dist/assets/css-C_ZeEwz2.js +0 -847
  162. package/dist/assets/cypher-Bayei42D.js +0 -122
  163. package/dist/assets/d-B0hhz6be.js +0 -205
  164. package/dist/assets/diff-DQutOIXs.js +0 -30
  165. package/dist/assets/dtd-C1CeYVnM.js +0 -121
  166. package/dist/assets/dylan-Dm9-uD-A.js +0 -337
  167. package/dist/assets/ebnf-jWG_1Yly.js +0 -151
  168. package/dist/assets/ecl-CgJPA6z9.js +0 -190
  169. package/dist/assets/eiffel-lj7uLahq.js +0 -146
  170. package/dist/assets/elm-Cz7o1ijk.js +0 -230
  171. package/dist/assets/erlang-CyL5QOyR.js +0 -581
  172. package/dist/assets/factor-BVWHwYpu.js +0 -65
  173. package/dist/assets/fcl-DiozYjc8.js +0 -154
  174. package/dist/assets/forth-B7vn5ze0.js +0 -164
  175. package/dist/assets/fortran-D2XNEnBT.js +0 -172
  176. package/dist/assets/gas-B_Tj57Ve.js +0 -343
  177. package/dist/assets/gherkin-CJ6Qk4EZ.js +0 -147
  178. package/dist/assets/groovy-ioGz2WSV.js +0 -228
  179. package/dist/assets/haskell-BHnm1B83.js +0 -239
  180. package/dist/assets/haxe-Bn6Yo6N3.js +0 -490
  181. package/dist/assets/http-BOd5SYCT.js +0 -89
  182. package/dist/assets/idl-FSFk8_xX.js +0 -274
  183. package/dist/assets/index--5fKpGeN.js +0 -792
  184. package/dist/assets/index-0lME64YH.js +0 -342
  185. package/dist/assets/index-B6Ip0FgO.js +0 -437
  186. package/dist/assets/index-BmV05E5M.js +0 -479
  187. package/dist/assets/index-C6MavZDA.js +0 -131
  188. package/dist/assets/index-CwKpgcYl.js +0 -85
  189. package/dist/assets/index-DRUmDL0J.js +0 -59
  190. package/dist/assets/index-DgFC-M9G.js +0 -96
  191. package/dist/assets/javascript-DGrAs70C.js +0 -922
  192. package/dist/assets/jinja2-D9k5QrXv.js +0 -171
  193. package/dist/assets/julia-DM42tOPB.js +0 -369
  194. package/dist/assets/livescript-Dci8HnOi.js +0 -259
  195. package/dist/assets/lua-CByQu4v6.js +0 -137
  196. package/dist/assets/lucide-icons-af0BY3bi.js +0 -34555
  197. package/dist/assets/mathematica-Dkv0uCYF.js +0 -153
  198. package/dist/assets/mbox-CYTvs5kC.js +0 -114
  199. package/dist/assets/mirc-DpgP3GCo.js +0 -176
  200. package/dist/assets/mllike-C6tNn2Yt.js +0 -343
  201. package/dist/assets/modelica-CR6hTSce.js +0 -192
  202. package/dist/assets/mscgen-D0GXtzMS.js +0 -149
  203. package/dist/assets/mumps-Bf1EyDa6.js +0 -129
  204. package/dist/assets/nginx-By9Phklj.js +0 -163
  205. package/dist/assets/nsis-B5ggMLQ9.js +0 -80
  206. package/dist/assets/ntriples-C7VJ7pnm.js +0 -141
  207. package/dist/assets/octave-6yR_ix15.js +0 -112
  208. package/dist/assets/oz-CEUnktiQ.js +0 -235
  209. package/dist/assets/pascal-Dksf1EyF.js +0 -124
  210. package/dist/assets/perl-B99DUQQt.js +0 -819
  211. package/dist/assets/pig-DFeDRta6.js +0 -149
  212. package/dist/assets/powershell-DhwsNWMx.js +0 -381
  213. package/dist/assets/properties-o21uErwC.js +0 -62
  214. package/dist/assets/protobuf-YxlANsmD.js +0 -54
  215. package/dist/assets/pug-bUgjeODZ.js +0 -504
  216. package/dist/assets/puppet-B8WICGYE.js +0 -205
  217. package/dist/assets/python-D3FFx1Id.js +0 -389
  218. package/dist/assets/q-D2Hjhl2C.js +0 -123
  219. package/dist/assets/r-D73k5lac.js +0 -174
  220. package/dist/assets/rpm-Duv_WH0z.js +0 -89
  221. package/dist/assets/ruby-DGCVqZDt.js +0 -287
  222. package/dist/assets/sas-XjPv1Vy5.js +0 -268
  223. package/dist/assets/scheme-DeaA28vt.js +0 -263
  224. package/dist/assets/shared-components-CfAt2hC6.js +0 -1501
  225. package/dist/assets/shared-composables-v9NkNuAe.js +0 -35
  226. package/dist/assets/shared-modules-CDP-H5ZB.js +0 -3588
  227. package/dist/assets/shared-pages-BGRRA5WB.js +0 -20
  228. package/dist/assets/shell-Bx6QZTgx.js +0 -145
  229. package/dist/assets/sieve-CWCD62sW.js +0 -178
  230. package/dist/assets/simple-mode-BAO9cD7H.js +0 -136
  231. package/dist/assets/smalltalk-DSQbF4MF.js +0 -153
  232. package/dist/assets/solr-v_XRf31C.js +0 -80
  233. package/dist/assets/sparql-BrfDqf0-.js +0 -170
  234. package/dist/assets/spreadsheet-Csn84Pef.js +0 -98
  235. package/dist/assets/sql-D4utlq1l.js +0 -480
  236. package/dist/assets/stex-DBkktma-.js +0 -246
  237. package/dist/assets/stylus-ByG-Fd6f.js +0 -750
  238. package/dist/assets/swift-CHbTprt3.js +0 -202
  239. package/dist/assets/tcl-BRlMUELr.js +0 -125
  240. package/dist/assets/textile-CqfTUjd4.js +0 -441
  241. package/dist/assets/tiddlywiki-BrsoM8KB.js +0 -278
  242. package/dist/assets/tiki-D-ivWPkc.js +0 -289
  243. package/dist/assets/toml-t_IhJu83.js +0 -75
  244. package/dist/assets/troff-DckGF2AE.js +0 -64
  245. package/dist/assets/ttcn-B8TAFbRR.js +0 -253
  246. package/dist/assets/ttcn-cfg-NHh25oCM.js +0 -197
  247. package/dist/assets/turtle-D9Js0BlL.js +0 -141
  248. package/dist/assets/ui-app-D31Pr1WY.js +0 -1993
  249. package/dist/assets/ui-content-B7SxH8y9.js +0 -52887
  250. package/dist/assets/ui-controls-nmDJYLmC.js +0 -348
  251. package/dist/assets/ui-data-Ci3b1ye0.js +0 -22901
  252. package/dist/assets/ui-form-Cs5ooOo7.js +0 -159
  253. package/dist/assets/ui-form-fields-DFQi31jT.js +0 -40575
  254. package/dist/assets/ui-helpers-CF-EUlOg.js +0 -1736
  255. package/dist/assets/ui-indicators-mIQeEqha.js +0 -199
  256. package/dist/assets/ui-layout-v2XBQky3.js +0 -320
  257. package/dist/assets/ui-media-WWYrwmZw.js +0 -1259
  258. package/dist/assets/ui-media-advanced-T8ibi153.js +0 -492
  259. package/dist/assets/ui-modals-BdZXzI85.js +0 -2
  260. package/dist/assets/ui-navigation-BtHa6ovW.js +0 -24269
  261. package/dist/assets/utils-DZK5fu48.js +0 -17216
  262. package/dist/assets/vb-CbIGLrpY.js +0 -249
  263. package/dist/assets/vbscript-8ANWle9n.js +0 -320
  264. package/dist/assets/velocity-D6hz3Hzw.js +0 -186
  265. package/dist/assets/verilog-DIV442at.js +0 -565
  266. package/dist/assets/vhdl-BlTiZo_v.js +0 -174
  267. package/dist/assets/vueuse-CTQm4Zh0.js +0 -9308
  268. package/dist/assets/webidl-Cp3tcqdk.js +0 -179
  269. package/dist/assets/xquery-Dd4TBzXv.js +0 -411
  270. package/dist/assets/yacas-DQ1WucF0.js +0 -182
  271. package/dist/assets/z80-P1j44jDI.js +0 -102
@@ -1,1019 +0,0 @@
1
- function Context(indented, column, type, info, align, prev) {
2
- this.indented = indented;
3
- this.column = column;
4
- this.type = type;
5
- this.info = info;
6
- this.align = align;
7
- this.prev = prev;
8
- }
9
- function pushContext(state, col, type, info) {
10
- var indent = state.indented;
11
- if (state.context && state.context.type == "statement" && type != "statement")
12
- indent = state.context.indented;
13
- return state.context = new Context(indent, col, type, info, null, state.context);
14
- }
15
- function popContext(state) {
16
- var t = state.context.type;
17
- if (t == ")" || t == "]" || t == "}")
18
- state.indented = state.context.indented;
19
- return state.context = state.context.prev;
20
- }
21
-
22
- function typeBefore(stream, state, pos) {
23
- if (state.prevToken == "variable" || state.prevToken == "type") return true;
24
- if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
25
- if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
26
- }
27
-
28
- function isTopScope(context) {
29
- for (;;) {
30
- if (!context || context.type == "top") return true;
31
- if (context.type == "}" && context.prev.info != "namespace") return false;
32
- context = context.prev;
33
- }
34
- }
35
-
36
- function clike(parserConfig) {
37
- var statementIndentUnit = parserConfig.statementIndentUnit,
38
- dontAlignCalls = parserConfig.dontAlignCalls,
39
- keywords = parserConfig.keywords || {},
40
- types = parserConfig.types || {},
41
- builtin = parserConfig.builtin || {},
42
- blockKeywords = parserConfig.blockKeywords || {},
43
- defKeywords = parserConfig.defKeywords || {},
44
- atoms = parserConfig.atoms || {},
45
- hooks = parserConfig.hooks || {},
46
- multiLineStrings = parserConfig.multiLineStrings,
47
- indentStatements = parserConfig.indentStatements !== false,
48
- indentSwitch = parserConfig.indentSwitch !== false,
49
- namespaceSeparator = parserConfig.namespaceSeparator,
50
- isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
51
- numberStart = parserConfig.numberStart || /[\d\.]/,
52
- number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
53
- isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
54
- isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/,
55
- // An optional function that takes a {string} token and returns true if it
56
- // should be treated as a builtin.
57
- isReservedIdentifier = parserConfig.isReservedIdentifier || false;
58
-
59
- var curPunc, isDefKeyword;
60
-
61
- function tokenBase(stream, state) {
62
- var ch = stream.next();
63
- if (hooks[ch]) {
64
- var result = hooks[ch](stream, state);
65
- if (result !== false) return result;
66
- }
67
- if (ch == '"' || ch == "'") {
68
- state.tokenize = tokenString(ch);
69
- return state.tokenize(stream, state);
70
- }
71
- if (numberStart.test(ch)) {
72
- stream.backUp(1);
73
- if (stream.match(number)) return "number"
74
- stream.next();
75
- }
76
- if (isPunctuationChar.test(ch)) {
77
- curPunc = ch;
78
- return null;
79
- }
80
- if (ch == "/") {
81
- if (stream.eat("*")) {
82
- state.tokenize = tokenComment;
83
- return tokenComment(stream, state);
84
- }
85
- if (stream.eat("/")) {
86
- stream.skipToEnd();
87
- return "comment";
88
- }
89
- }
90
- if (isOperatorChar.test(ch)) {
91
- while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
92
- return "operator";
93
- }
94
- stream.eatWhile(isIdentifierChar);
95
- if (namespaceSeparator) while (stream.match(namespaceSeparator))
96
- stream.eatWhile(isIdentifierChar);
97
-
98
- var cur = stream.current();
99
- if (contains(keywords, cur)) {
100
- if (contains(blockKeywords, cur)) curPunc = "newstatement";
101
- if (contains(defKeywords, cur)) isDefKeyword = true;
102
- return "keyword";
103
- }
104
- if (contains(types, cur)) return "type";
105
- if (contains(builtin, cur)
106
- || (isReservedIdentifier && isReservedIdentifier(cur))) {
107
- if (contains(blockKeywords, cur)) curPunc = "newstatement";
108
- return "builtin";
109
- }
110
- if (contains(atoms, cur)) return "atom";
111
- return "variable";
112
- }
113
-
114
- function tokenString(quote) {
115
- return function(stream, state) {
116
- var escaped = false, next, end = false;
117
- while ((next = stream.next()) != null) {
118
- if (next == quote && !escaped) {end = true; break;}
119
- escaped = !escaped && next == "\\";
120
- }
121
- if (end || !(escaped || multiLineStrings))
122
- state.tokenize = null;
123
- return "string";
124
- };
125
- }
126
-
127
- function tokenComment(stream, state) {
128
- var maybeEnd = false, ch;
129
- while (ch = stream.next()) {
130
- if (ch == "/" && maybeEnd) {
131
- state.tokenize = null;
132
- break;
133
- }
134
- maybeEnd = (ch == "*");
135
- }
136
- return "comment";
137
- }
138
-
139
- function maybeEOL(stream, state) {
140
- if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context))
141
- state.typeAtEndOfLine = typeBefore(stream, state, stream.pos);
142
- }
143
-
144
- // Interface
145
-
146
- return {
147
- name: parserConfig.name,
148
- startState: function(indentUnit) {
149
- return {
150
- tokenize: null,
151
- context: new Context(-indentUnit, 0, "top", null, false),
152
- indented: 0,
153
- startOfLine: true,
154
- prevToken: null
155
- };
156
- },
157
-
158
- token: function(stream, state) {
159
- var ctx = state.context;
160
- if (stream.sol()) {
161
- if (ctx.align == null) ctx.align = false;
162
- state.indented = stream.indentation();
163
- state.startOfLine = true;
164
- }
165
- if (stream.eatSpace()) { maybeEOL(stream, state); return null; }
166
- curPunc = isDefKeyword = null;
167
- var style = (state.tokenize || tokenBase)(stream, state);
168
- if (style == "comment" || style == "meta") return style;
169
- if (ctx.align == null) ctx.align = true;
170
-
171
- if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)))
172
- while (state.context.type == "statement") popContext(state);
173
- else if (curPunc == "{") pushContext(state, stream.column(), "}");
174
- else if (curPunc == "[") pushContext(state, stream.column(), "]");
175
- else if (curPunc == "(") pushContext(state, stream.column(), ")");
176
- else if (curPunc == "}") {
177
- while (ctx.type == "statement") ctx = popContext(state);
178
- if (ctx.type == "}") ctx = popContext(state);
179
- while (ctx.type == "statement") ctx = popContext(state);
180
- }
181
- else if (curPunc == ctx.type) popContext(state);
182
- else if (indentStatements &&
183
- (((ctx.type == "}" || ctx.type == "top") && curPunc != ";") ||
184
- (ctx.type == "statement" && curPunc == "newstatement"))) {
185
- pushContext(state, stream.column(), "statement", stream.current());
186
- }
187
-
188
- if (style == "variable" &&
189
- ((state.prevToken == "def" ||
190
- (parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) &&
191
- isTopScope(state.context) && stream.match(/^\s*\(/, false)))))
192
- style = "def";
193
-
194
- if (hooks.token) {
195
- var result = hooks.token(stream, state, style);
196
- if (result !== undefined) style = result;
197
- }
198
-
199
- if (style == "def" && parserConfig.styleDefs === false) style = "variable";
200
-
201
- state.startOfLine = false;
202
- state.prevToken = isDefKeyword ? "def" : style || curPunc;
203
- maybeEOL(stream, state);
204
- return style;
205
- },
206
-
207
- indent: function(state, textAfter, context) {
208
- if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine && isTopScope(state.context))
209
- return null;
210
- var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
211
- var closing = firstChar == ctx.type;
212
- if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
213
- if (parserConfig.dontIndentStatements)
214
- while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
215
- ctx = ctx.prev;
216
- if (hooks.indent) {
217
- var hook = hooks.indent(state, ctx, textAfter, context.unit);
218
- if (typeof hook == "number") return hook
219
- }
220
- var switchBlock = ctx.prev && ctx.prev.info == "switch";
221
- if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
222
- while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev;
223
- return ctx.indented
224
- }
225
- if (ctx.type == "statement")
226
- return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit || context.unit);
227
- if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
228
- return ctx.column + (closing ? 0 : 1);
229
- if (ctx.type == ")" && !closing)
230
- return ctx.indented + (statementIndentUnit || context.unit);
231
-
232
- return ctx.indented + (closing ? 0 : context.unit) +
233
- (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? context.unit : 0);
234
- },
235
-
236
- languageData: {
237
- indentOnInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
238
- commentTokens: {line: "//", block: {open: "/*", close: "*/"}},
239
- autocomplete: Object.keys(keywords).concat(Object.keys(types)).concat(Object.keys(builtin)).concat(Object.keys(atoms)),
240
- ...parserConfig.languageData
241
- }
242
- };
243
- }
244
- function words(str) {
245
- var obj = {}, words = str.split(" ");
246
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
247
- return obj;
248
- }
249
- function contains(words, word) {
250
- if (typeof words === "function") {
251
- return words(word);
252
- } else {
253
- return words.propertyIsEnumerable(word);
254
- }
255
- }
256
- var cKeywords = "auto if break case register continue return default do sizeof " +
257
- "static else struct switch extern typedef union for goto while enum const " +
258
- "volatile inline restrict asm fortran";
259
-
260
- // Keywords from https://en.cppreference.com/w/cpp/keyword includes C++20.
261
- var cppKeywords = "alignas alignof and and_eq audit axiom bitand bitor catch " +
262
- "class compl concept constexpr const_cast decltype delete dynamic_cast " +
263
- "explicit export final friend import module mutable namespace new noexcept " +
264
- "not not_eq operator or or_eq override private protected public " +
265
- "reinterpret_cast requires static_assert static_cast template this " +
266
- "thread_local throw try typeid typename using virtual xor xor_eq";
267
-
268
- var objCKeywords = "bycopy byref in inout oneway out self super atomic nonatomic retain copy " +
269
- "readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd " +
270
- "@interface @implementation @end @protocol @encode @property @synthesize @dynamic @class " +
271
- "@public @package @private @protected @required @optional @try @catch @finally @import " +
272
- "@selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available";
273
-
274
- var objCBuiltins = "FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION " +
275
- " NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER " +
276
- "NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION " +
277
- "NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT";
278
-
279
- // Do not use this. Use the cTypes function below. This is global just to avoid
280
- // excessive calls when cTypes is being called multiple times during a parse.
281
- var basicCTypes = words("int long char short double float unsigned signed " +
282
- "void bool");
283
-
284
- // Do not use this. Use the objCTypes function below. This is global just to avoid
285
- // excessive calls when objCTypes is being called multiple times during a parse.
286
- var basicObjCTypes = words("SEL instancetype id Class Protocol BOOL");
287
-
288
- // Returns true if identifier is a "C" type.
289
- // C type is defined as those that are reserved by the compiler (basicTypes),
290
- // and those that end in _t (Reserved by POSIX for types)
291
- // http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
292
- function cTypes(identifier) {
293
- return contains(basicCTypes, identifier) || /.+_t$/.test(identifier);
294
- }
295
-
296
- // Returns true if identifier is a "Objective C" type.
297
- function objCTypes(identifier) {
298
- return cTypes(identifier) || contains(basicObjCTypes, identifier);
299
- }
300
-
301
- var cBlockKeywords = "case do else for if switch while struct enum union";
302
- var cDefKeywords = "struct enum union";
303
-
304
- function cppHook(stream, state) {
305
- if (!state.startOfLine) return false
306
- for (var ch, next = null; ch = stream.peek();) {
307
- if (ch == "\\" && stream.match(/^.$/)) {
308
- next = cppHook;
309
- break
310
- } else if (ch == "/" && stream.match(/^\/[\/\*]/, false)) {
311
- break
312
- }
313
- stream.next();
314
- }
315
- state.tokenize = next;
316
- return "meta"
317
- }
318
-
319
- function pointerHook(_stream, state) {
320
- if (state.prevToken == "type") return "type";
321
- return false;
322
- }
323
-
324
- // For C and C++ (and ObjC): identifiers starting with __
325
- // or _ followed by a capital letter are reserved for the compiler.
326
- function cIsReservedIdentifier(token) {
327
- if (!token || token.length < 2) return false;
328
- if (token[0] != '_') return false;
329
- return (token[1] == '_') || (token[1] !== token[1].toLowerCase());
330
- }
331
-
332
- function cpp14Literal(stream) {
333
- stream.eatWhile(/[\w\.']/);
334
- return "number";
335
- }
336
-
337
- function cpp11StringHook(stream, state) {
338
- stream.backUp(1);
339
- // Raw strings.
340
- if (stream.match(/^(?:R|u8R|uR|UR|LR)/)) {
341
- var match = stream.match(/^"([^\s\\()]{0,16})\(/);
342
- if (!match) {
343
- return false;
344
- }
345
- state.cpp11RawStringDelim = match[1];
346
- state.tokenize = tokenRawString;
347
- return tokenRawString(stream, state);
348
- }
349
- // Unicode strings/chars.
350
- if (stream.match(/^(?:u8|u|U|L)/)) {
351
- if (stream.match(/^["']/, /* eat */ false)) {
352
- return "string";
353
- }
354
- return false;
355
- }
356
- // Ignore this hook.
357
- stream.next();
358
- return false;
359
- }
360
-
361
- function cppLooksLikeConstructor(word) {
362
- var lastTwo = /(\w+)::~?(\w+)$/.exec(word);
363
- return lastTwo && lastTwo[1] == lastTwo[2];
364
- }
365
-
366
- // C#-style strings where "" escapes a quote.
367
- function tokenAtString(stream, state) {
368
- var next;
369
- while ((next = stream.next()) != null) {
370
- if (next == '"' && !stream.eat('"')) {
371
- state.tokenize = null;
372
- break;
373
- }
374
- }
375
- return "string";
376
- }
377
-
378
- // C++11 raw string literal is <prefix>"<delim>( anything )<delim>", where
379
- // <delim> can be a string up to 16 characters long.
380
- function tokenRawString(stream, state) {
381
- // Escape characters that have special regex meanings.
382
- var delim = state.cpp11RawStringDelim.replace(/[^\w\s]/g, '\\$&');
383
- var match = stream.match(new RegExp(".*?\\)" + delim + '"'));
384
- if (match)
385
- state.tokenize = null;
386
- else
387
- stream.skipToEnd();
388
- return "string";
389
- }
390
-
391
- const c = clike({
392
- name: "c",
393
- keywords: words(cKeywords),
394
- types: cTypes,
395
- blockKeywords: words(cBlockKeywords),
396
- defKeywords: words(cDefKeywords),
397
- typeFirstDefinitions: true,
398
- atoms: words("NULL true false"),
399
- isReservedIdentifier: cIsReservedIdentifier,
400
- hooks: {
401
- "#": cppHook,
402
- "*": pointerHook,
403
- }
404
- });
405
-
406
- const cpp = clike({
407
- name: "cpp",
408
- keywords: words(cKeywords + " " + cppKeywords),
409
- types: cTypes,
410
- blockKeywords: words(cBlockKeywords + " class try catch"),
411
- defKeywords: words(cDefKeywords + " class namespace"),
412
- typeFirstDefinitions: true,
413
- atoms: words("true false NULL nullptr"),
414
- dontIndentStatements: /^template$/,
415
- isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
416
- isReservedIdentifier: cIsReservedIdentifier,
417
- hooks: {
418
- "#": cppHook,
419
- "*": pointerHook,
420
- "u": cpp11StringHook,
421
- "U": cpp11StringHook,
422
- "L": cpp11StringHook,
423
- "R": cpp11StringHook,
424
- "0": cpp14Literal,
425
- "1": cpp14Literal,
426
- "2": cpp14Literal,
427
- "3": cpp14Literal,
428
- "4": cpp14Literal,
429
- "5": cpp14Literal,
430
- "6": cpp14Literal,
431
- "7": cpp14Literal,
432
- "8": cpp14Literal,
433
- "9": cpp14Literal,
434
- token: function(stream, state, style) {
435
- if (style == "variable" && stream.peek() == "(" &&
436
- (state.prevToken == ";" || state.prevToken == null ||
437
- state.prevToken == "}") &&
438
- cppLooksLikeConstructor(stream.current()))
439
- return "def";
440
- }
441
- },
442
- namespaceSeparator: "::"
443
- });
444
-
445
- const java = clike({
446
- name: "java",
447
- keywords: words("abstract assert break case catch class const continue default " +
448
- "do else enum extends final finally for goto if implements import " +
449
- "instanceof interface native new package private protected public " +
450
- "return static strictfp super switch synchronized this throw throws transient " +
451
- "try volatile while @interface"),
452
- types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float " +
453
- "Integer Long Number Object Short String StringBuffer StringBuilder Void"),
454
- blockKeywords: words("catch class do else finally for if switch try while"),
455
- defKeywords: words("class interface enum @interface"),
456
- typeFirstDefinitions: true,
457
- atoms: words("true false null"),
458
- number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
459
- hooks: {
460
- "@": function(stream) {
461
- // Don't match the @interface keyword.
462
- if (stream.match('interface', false)) return false;
463
-
464
- stream.eatWhile(/[\w\$_]/);
465
- return "meta";
466
- },
467
- '"': function(stream, state) {
468
- if (!stream.match(/""$/)) return false;
469
- state.tokenize = tokenTripleString;
470
- return state.tokenize(stream, state);
471
- }
472
- }
473
- });
474
-
475
- const csharp = clike({
476
- name: "csharp",
477
- keywords: words("abstract as async await base break case catch checked class const continue" +
478
- " default delegate do else enum event explicit extern finally fixed for" +
479
- " foreach goto if implicit in init interface internal is lock namespace new" +
480
- " operator out override params private protected public readonly record ref required return sealed" +
481
- " sizeof stackalloc static struct switch this throw try typeof unchecked" +
482
- " unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
483
- " global group into join let orderby partial remove select set value var yield"),
484
- types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" +
485
- " Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" +
486
- " UInt64 bool byte char decimal double short int long object" +
487
- " sbyte float string ushort uint ulong"),
488
- blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
489
- defKeywords: words("class interface namespace record struct var"),
490
- typeFirstDefinitions: true,
491
- atoms: words("true false null"),
492
- hooks: {
493
- "@": function(stream, state) {
494
- if (stream.eat('"')) {
495
- state.tokenize = tokenAtString;
496
- return tokenAtString(stream, state);
497
- }
498
- stream.eatWhile(/[\w\$_]/);
499
- return "meta";
500
- }
501
- }
502
- });
503
-
504
- function tokenTripleString(stream, state) {
505
- var escaped = false;
506
- while (!stream.eol()) {
507
- if (!escaped && stream.match('"""')) {
508
- state.tokenize = null;
509
- break;
510
- }
511
- escaped = stream.next() == "\\" && !escaped;
512
- }
513
- return "string";
514
- }
515
-
516
- function tokenNestedComment(depth) {
517
- return function (stream, state) {
518
- var ch;
519
- while (ch = stream.next()) {
520
- if (ch == "*" && stream.eat("/")) {
521
- if (depth == 1) {
522
- state.tokenize = null;
523
- break
524
- } else {
525
- state.tokenize = tokenNestedComment(depth - 1);
526
- return state.tokenize(stream, state)
527
- }
528
- } else if (ch == "/" && stream.eat("*")) {
529
- state.tokenize = tokenNestedComment(depth + 1);
530
- return state.tokenize(stream, state)
531
- }
532
- }
533
- return "comment"
534
- }
535
- }
536
-
537
- const scala = clike({
538
- name: "scala",
539
- keywords: words(
540
- /* scala */
541
- "abstract case catch class def do else extends final finally for forSome if " +
542
- "implicit import lazy match new null object override package private protected return " +
543
- "sealed super this throw trait try type val var while with yield _ " +
544
-
545
- /* package scala */
546
- "assert assume require print println printf readLine readBoolean readByte readShort " +
547
- "readChar readInt readLong readFloat readDouble"
548
- ),
549
- types: words(
550
- "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
551
- "Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " +
552
- "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
553
- "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
554
- "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
555
-
556
- /* package java.lang */
557
- "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
558
- "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
559
- "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
560
- "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
561
- ),
562
- multiLineStrings: true,
563
- blockKeywords: words("catch class enum do else finally for forSome if match switch try while"),
564
- defKeywords: words("class enum def object package trait type val var"),
565
- atoms: words("true false null"),
566
- indentStatements: false,
567
- indentSwitch: false,
568
- isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
569
- hooks: {
570
- "@": function(stream) {
571
- stream.eatWhile(/[\w\$_]/);
572
- return "meta";
573
- },
574
- '"': function(stream, state) {
575
- if (!stream.match('""')) return false;
576
- state.tokenize = tokenTripleString;
577
- return state.tokenize(stream, state);
578
- },
579
- "'": function(stream) {
580
- if (stream.match(/^(\\[^'\s]+|[^\\'])'/)) return "character"
581
- stream.eatWhile(/[\w\$_\xa1-\uffff]/);
582
- return "atom";
583
- },
584
- "=": function(stream, state) {
585
- var cx = state.context;
586
- if (cx.type == "}" && cx.align && stream.eat(">")) {
587
- state.context = new Context(cx.indented, cx.column, cx.type, cx.info, null, cx.prev);
588
- return "operator"
589
- } else {
590
- return false
591
- }
592
- },
593
-
594
- "/": function(stream, state) {
595
- if (!stream.eat("*")) return false
596
- state.tokenize = tokenNestedComment(1);
597
- return state.tokenize(stream, state)
598
- }
599
- },
600
- languageData: {
601
- closeBrackets: {brackets: ["(", "[", "{", "'", '"', '"""']}
602
- }
603
- });
604
-
605
- function tokenKotlinString(tripleString){
606
- return function (stream, state) {
607
- var escaped = false, next, end = false;
608
- while (!stream.eol()) {
609
- if (!tripleString && !escaped && stream.match('"') ) {end = true; break;}
610
- if (tripleString && stream.match('"""')) {end = true; break;}
611
- next = stream.next();
612
- if(!escaped && next == "$" && stream.match('{'))
613
- stream.skipTo("}");
614
- escaped = !escaped && next == "\\" && !tripleString;
615
- }
616
- if (end || !tripleString)
617
- state.tokenize = null;
618
- return "string";
619
- }
620
- }
621
-
622
- const kotlin = clike({
623
- name: "kotlin",
624
- keywords: words(
625
- /*keywords*/
626
- "package as typealias class interface this super val operator " +
627
- "var fun for is in This throw return annotation " +
628
- "break continue object if else while do try when !in !is as? " +
629
-
630
- /*soft keywords*/
631
- "file import where by get set abstract enum open inner override private public internal " +
632
- "protected catch finally out final vararg reified dynamic companion constructor init " +
633
- "sealed field property receiver param sparam lateinit data inline noinline tailrec " +
634
- "external annotation crossinline const operator infix suspend actual expect setparam"
635
- ),
636
- types: words(
637
- /* package java.lang */
638
- "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
639
- "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
640
- "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
641
- "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray " +
642
- "ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy " +
643
- "LazyThreadSafetyMode LongArray Nothing ShortArray Unit"
644
- ),
645
- indentStatements: false,
646
- multiLineStrings: true,
647
- number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
648
- blockKeywords: words("catch class do else finally for if where try while enum"),
649
- defKeywords: words("class val var object interface fun"),
650
- atoms: words("true false null this"),
651
- hooks: {
652
- "@": function(stream) {
653
- stream.eatWhile(/[\w\$_]/);
654
- return "meta";
655
- },
656
- '*': function(_stream, state) {
657
- return state.prevToken == '.' ? 'variable' : 'operator';
658
- },
659
- '"': function(stream, state) {
660
- state.tokenize = tokenKotlinString(stream.match('""'));
661
- return state.tokenize(stream, state);
662
- },
663
- "/": function(stream, state) {
664
- if (!stream.eat("*")) return false;
665
- state.tokenize = tokenNestedComment(1);
666
- return state.tokenize(stream, state)
667
- },
668
- indent: function(state, ctx, textAfter, indentUnit) {
669
- var firstChar = textAfter && textAfter.charAt(0);
670
- if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "")
671
- return state.indented;
672
- if ((state.prevToken == "operator" && textAfter != "}" && state.context.type != "}") ||
673
- state.prevToken == "variable" && firstChar == "." ||
674
- (state.prevToken == "}" || state.prevToken == ")") && firstChar == ".")
675
- return indentUnit * 2 + ctx.indented;
676
- if (ctx.align && ctx.type == "}")
677
- return ctx.indented + (state.context.type == (textAfter || "").charAt(0) ? 0 : indentUnit);
678
- }
679
- },
680
- languageData: {
681
- closeBrackets: {brackets: ["(", "[", "{", "'", '"', '"""']}
682
- }
683
- });
684
-
685
- const shader = clike({
686
- name: "shader",
687
- keywords: words("sampler1D sampler2D sampler3D samplerCube " +
688
- "sampler1DShadow sampler2DShadow " +
689
- "const attribute uniform varying " +
690
- "break continue discard return " +
691
- "for while do if else struct " +
692
- "in out inout"),
693
- types: words("float int bool void " +
694
- "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
695
- "mat2 mat3 mat4"),
696
- blockKeywords: words("for while do if else struct"),
697
- builtin: words("radians degrees sin cos tan asin acos atan " +
698
- "pow exp log exp2 sqrt inversesqrt " +
699
- "abs sign floor ceil fract mod min max clamp mix step smoothstep " +
700
- "length distance dot cross normalize ftransform faceforward " +
701
- "reflect refract matrixCompMult " +
702
- "lessThan lessThanEqual greaterThan greaterThanEqual " +
703
- "equal notEqual any all not " +
704
- "texture1D texture1DProj texture1DLod texture1DProjLod " +
705
- "texture2D texture2DProj texture2DLod texture2DProjLod " +
706
- "texture3D texture3DProj texture3DLod texture3DProjLod " +
707
- "textureCube textureCubeLod " +
708
- "shadow1D shadow2D shadow1DProj shadow2DProj " +
709
- "shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod " +
710
- "dFdx dFdy fwidth " +
711
- "noise1 noise2 noise3 noise4"),
712
- atoms: words("true false " +
713
- "gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex " +
714
- "gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 " +
715
- "gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 " +
716
- "gl_FogCoord gl_PointCoord " +
717
- "gl_Position gl_PointSize gl_ClipVertex " +
718
- "gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor " +
719
- "gl_TexCoord gl_FogFragCoord " +
720
- "gl_FragCoord gl_FrontFacing " +
721
- "gl_FragData gl_FragDepth " +
722
- "gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " +
723
- "gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " +
724
- "gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse " +
725
- "gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose " +
726
- "gl_ProjectionMatrixInverseTranspose " +
727
- "gl_ModelViewProjectionMatrixInverseTranspose " +
728
- "gl_TextureMatrixInverseTranspose " +
729
- "gl_NormalScale gl_DepthRange gl_ClipPlane " +
730
- "gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel " +
731
- "gl_FrontLightModelProduct gl_BackLightModelProduct " +
732
- "gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ " +
733
- "gl_FogParameters " +
734
- "gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords " +
735
- "gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats " +
736
- "gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
737
- "gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
738
- "gl_MaxDrawBuffers"),
739
- indentSwitch: false,
740
- hooks: {"#": cppHook}
741
- });
742
-
743
- const nesC = clike({
744
- name: "nesc",
745
- keywords: words(cKeywords + " as atomic async call command component components configuration event generic " +
746
- "implementation includes interface module new norace nx_struct nx_union post provides " +
747
- "signal task uses abstract extends"),
748
- types: cTypes,
749
- blockKeywords: words(cBlockKeywords),
750
- atoms: words("null true false"),
751
- hooks: {"#": cppHook}
752
- });
753
-
754
- const objectiveC = clike({
755
- name: "objectivec",
756
- keywords: words(cKeywords + " " + objCKeywords),
757
- types: objCTypes,
758
- builtin: words(objCBuiltins),
759
- blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized"),
760
- defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class"),
761
- dontIndentStatements: /^@.*$/,
762
- typeFirstDefinitions: true,
763
- atoms: words("YES NO NULL Nil nil true false nullptr"),
764
- isReservedIdentifier: cIsReservedIdentifier,
765
- hooks: {
766
- "#": cppHook,
767
- "*": pointerHook,
768
- }
769
- });
770
-
771
- const objectiveCpp = clike({
772
- name: "objectivecpp",
773
- keywords: words(cKeywords + " " + objCKeywords + " " + cppKeywords),
774
- types: objCTypes,
775
- builtin: words(objCBuiltins),
776
- blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),
777
- defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class class namespace"),
778
- dontIndentStatements: /^@.*$|^template$/,
779
- typeFirstDefinitions: true,
780
- atoms: words("YES NO NULL Nil nil true false nullptr"),
781
- isReservedIdentifier: cIsReservedIdentifier,
782
- hooks: {
783
- "#": cppHook,
784
- "*": pointerHook,
785
- "u": cpp11StringHook,
786
- "U": cpp11StringHook,
787
- "L": cpp11StringHook,
788
- "R": cpp11StringHook,
789
- "0": cpp14Literal,
790
- "1": cpp14Literal,
791
- "2": cpp14Literal,
792
- "3": cpp14Literal,
793
- "4": cpp14Literal,
794
- "5": cpp14Literal,
795
- "6": cpp14Literal,
796
- "7": cpp14Literal,
797
- "8": cpp14Literal,
798
- "9": cpp14Literal,
799
- token: function(stream, state, style) {
800
- if (style == "variable" && stream.peek() == "(" &&
801
- (state.prevToken == ";" || state.prevToken == null ||
802
- state.prevToken == "}") &&
803
- cppLooksLikeConstructor(stream.current()))
804
- return "def";
805
- }
806
- },
807
- namespaceSeparator: "::"
808
- });
809
-
810
- const squirrel = clike({
811
- name: "squirrel",
812
- keywords: words("base break clone continue const default delete enum extends function in class" +
813
- " foreach local resume return this throw typeof yield constructor instanceof static"),
814
- types: cTypes,
815
- blockKeywords: words("case catch class else for foreach if switch try while"),
816
- defKeywords: words("function local class"),
817
- typeFirstDefinitions: true,
818
- atoms: words("true false null"),
819
- hooks: {"#": cppHook}
820
- });
821
-
822
- // Ceylon Strings need to deal with interpolation
823
- var stringTokenizer = null;
824
- function tokenCeylonString(type) {
825
- return function(stream, state) {
826
- var escaped = false, next, end = false;
827
- while (!stream.eol()) {
828
- if (!escaped && stream.match('"') &&
829
- (type == "single" || stream.match('""'))) {
830
- end = true;
831
- break;
832
- }
833
- if (!escaped && stream.match('``')) {
834
- stringTokenizer = tokenCeylonString(type);
835
- end = true;
836
- break;
837
- }
838
- next = stream.next();
839
- escaped = type == "single" && !escaped && next == "\\";
840
- }
841
- if (end)
842
- state.tokenize = null;
843
- return "string";
844
- }
845
- }
846
-
847
- const ceylon = clike({
848
- name: "ceylon",
849
- keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else" +
850
- " exists extends finally for function given if import in interface is let module new" +
851
- " nonempty object of out outer package return satisfies super switch then this throw" +
852
- " try value void while"),
853
- types: function(word) {
854
- // In Ceylon all identifiers that start with an uppercase are types
855
- var first = word.charAt(0);
856
- return (first === first.toUpperCase() && first !== first.toLowerCase());
857
- },
858
- blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"),
859
- defKeywords: words("class dynamic function interface module object package value"),
860
- builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license" +
861
- " native optional sealed see serializable shared suppressWarnings tagged throws variable"),
862
- isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
863
- isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
864
- numberStart: /[\d#$]/,
865
- number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
866
- multiLineStrings: true,
867
- typeFirstDefinitions: true,
868
- atoms: words("true false null larger smaller equal empty finished"),
869
- indentSwitch: false,
870
- styleDefs: false,
871
- hooks: {
872
- "@": function(stream) {
873
- stream.eatWhile(/[\w\$_]/);
874
- return "meta";
875
- },
876
- '"': function(stream, state) {
877
- state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single");
878
- return state.tokenize(stream, state);
879
- },
880
- '`': function(stream, state) {
881
- if (!stringTokenizer || !stream.match('`')) return false;
882
- state.tokenize = stringTokenizer;
883
- stringTokenizer = null;
884
- return state.tokenize(stream, state);
885
- },
886
- "'": function(stream) {
887
- if (stream.match(/^(\\[^'\s]+|[^\\'])'/)) return "string.special"
888
- stream.eatWhile(/[\w\$_\xa1-\uffff]/);
889
- return "atom";
890
- },
891
- token: function(_stream, state, style) {
892
- if ((style == "variable" || style == "type") &&
893
- state.prevToken == ".") {
894
- return "variableName.special";
895
- }
896
- }
897
- },
898
- languageData: {
899
- closeBrackets: {brackets: ["(", "[", "{", "'", '"', '"""']}
900
- }
901
- });
902
-
903
- function pushInterpolationStack(state) {
904
- (state.interpolationStack || (state.interpolationStack = [])).push(state.tokenize);
905
- }
906
-
907
- function popInterpolationStack(state) {
908
- return (state.interpolationStack || (state.interpolationStack = [])).pop();
909
- }
910
-
911
- function sizeInterpolationStack(state) {
912
- return state.interpolationStack ? state.interpolationStack.length : 0;
913
- }
914
-
915
- function tokenDartString(quote, stream, state, raw) {
916
- var tripleQuoted = false;
917
- if (stream.eat(quote)) {
918
- if (stream.eat(quote)) tripleQuoted = true;
919
- else return "string"; //empty string
920
- }
921
- function tokenStringHelper(stream, state) {
922
- var escaped = false;
923
- while (!stream.eol()) {
924
- if (!raw && !escaped && stream.peek() == "$") {
925
- pushInterpolationStack(state);
926
- state.tokenize = tokenInterpolation;
927
- return "string";
928
- }
929
- var next = stream.next();
930
- if (next == quote && !escaped && (!tripleQuoted || stream.match(quote + quote))) {
931
- state.tokenize = null;
932
- break;
933
- }
934
- escaped = !raw && !escaped && next == "\\";
935
- }
936
- return "string";
937
- }
938
- state.tokenize = tokenStringHelper;
939
- return tokenStringHelper(stream, state);
940
- }
941
-
942
- function tokenInterpolation(stream, state) {
943
- stream.eat("$");
944
- if (stream.eat("{")) {
945
- // let clike handle the content of ${...},
946
- // we take over again when "}" appears (see hooks).
947
- state.tokenize = null;
948
- } else {
949
- state.tokenize = tokenInterpolationIdentifier;
950
- }
951
- return null;
952
- }
953
-
954
- function tokenInterpolationIdentifier(stream, state) {
955
- stream.eatWhile(/[\w_]/);
956
- state.tokenize = popInterpolationStack(state);
957
- return "variable";
958
- }
959
-
960
- const dart = clike({
961
- name: "dart",
962
- keywords: words("this super static final const abstract class extends external factory " +
963
- "implements mixin get native set typedef with enum throw rethrow assert break case " +
964
- "continue default in return new deferred async await covariant try catch finally " +
965
- "do else for if switch while import library export part of show hide is as extension " +
966
- "on yield late required sealed base interface when inline"),
967
- blockKeywords: words("try catch finally do else for if switch while"),
968
- builtin: words("void bool num int double dynamic var String Null Never"),
969
- atoms: words("true false null"),
970
- // clike numbers without the suffixes, and with '_' separators.
971
- number: /^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,
972
- hooks: {
973
- "@": function(stream) {
974
- stream.eatWhile(/[\w\$_\.]/);
975
- return "meta";
976
- },
977
-
978
- // custom string handling to deal with triple-quoted strings and string interpolation
979
- "'": function(stream, state) {
980
- return tokenDartString("'", stream, state, false);
981
- },
982
- "\"": function(stream, state) {
983
- return tokenDartString("\"", stream, state, false);
984
- },
985
- "r": function(stream, state) {
986
- var peek = stream.peek();
987
- if (peek == "'" || peek == "\"") {
988
- return tokenDartString(stream.next(), stream, state, true);
989
- }
990
- return false;
991
- },
992
-
993
- "}": function(_stream, state) {
994
- // "}" is end of interpolation, if interpolation stack is non-empty
995
- if (sizeInterpolationStack(state) > 0) {
996
- state.tokenize = popInterpolationStack(state);
997
- return null;
998
- }
999
- return false;
1000
- },
1001
-
1002
- "/": function(stream, state) {
1003
- if (!stream.eat("*")) return false
1004
- state.tokenize = tokenNestedComment(1);
1005
- return state.tokenize(stream, state)
1006
- },
1007
- token: function(stream, _, style) {
1008
- if (style == "variable") {
1009
- // Assume uppercase symbols are classes
1010
- var isUpper = RegExp('^[_$]*[A-Z][a-zA-Z0-9_$]*$','g');
1011
- if (isUpper.test(stream.current())) {
1012
- return 'type';
1013
- }
1014
- }
1015
- }
1016
- }
1017
- });
1018
-
1019
- export { c, ceylon, clike, cpp, csharp, dart, java, kotlin, nesC, objectiveC, objectiveCpp, scala, shader, squirrel };