@univerjs/uniscript 0.4.0-alpha.0 → 0.4.0-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. package/lib/abap-BZS-1p12.js +6 -0
  2. package/lib/abap-D8H3nII2.mjs +1404 -0
  3. package/lib/apex-B2xdRF0k.js +6 -0
  4. package/lib/apex-BVHYDV51.mjs +334 -0
  5. package/lib/azcli-BwJ4gbR1.mjs +74 -0
  6. package/lib/azcli-CKk2q0zF.js +6 -0
  7. package/lib/bat-BDmMqWXx.mjs +106 -0
  8. package/lib/bat-Ehz5Z_mk.js +6 -0
  9. package/lib/bicep-B5L2IbSj.mjs +110 -0
  10. package/lib/bicep-WbLMPUMj.js +7 -0
  11. package/lib/cameligo-B_ldnAvM.js +6 -0
  12. package/lib/cameligo-CmyOPZUd.mjs +180 -0
  13. package/lib/cjs/index.js +1 -9
  14. package/lib/clojure-Dg-qgg-1.js +6 -0
  15. package/lib/clojure-iSXHsTlR.mjs +767 -0
  16. package/lib/coffee-BCg0pb49.js +6 -0
  17. package/lib/coffee-BUCk2FHC.mjs +238 -0
  18. package/lib/cpp-CJWZ7Zo7.js +6 -0
  19. package/lib/cpp-MUyeqRt5.mjs +395 -0
  20. package/lib/csharp-B9vyMfVU.mjs +332 -0
  21. package/lib/csharp-BZypj8XG.js +6 -0
  22. package/lib/csp-BfXxGnNN.js +6 -0
  23. package/lib/csp-CbylPXe5.mjs +59 -0
  24. package/lib/css-BPDnvT2s.js +8 -0
  25. package/lib/css-BQSMT8k7.mjs +193 -0
  26. package/lib/cssMode-B_of5tVd.js +9 -0
  27. package/lib/cssMode-BuX-eUHc.mjs +1604 -0
  28. package/lib/cypher-3bNWMNCJ.js +6 -0
  29. package/lib/cypher-D7IWy_82.mjs +269 -0
  30. package/lib/dart-BCVbUKaH.mjs +287 -0
  31. package/lib/dart-C9Glm5m-.js +6 -0
  32. package/lib/dockerfile-CjnlcV5o.js +6 -0
  33. package/lib/dockerfile-D2-hSnDX.mjs +136 -0
  34. package/lib/ecl-DRJlPmOb.mjs +462 -0
  35. package/lib/ecl-UyoSfv7F.js +6 -0
  36. package/lib/elixir-Bol0p0Ia.js +6 -0
  37. package/lib/elixir-D8NBXKCb.mjs +575 -0
  38. package/lib/es/index.js +5 -262
  39. package/lib/flow9-Be1OUdJl.js +6 -0
  40. package/lib/flow9-Dp7h8rKW.mjs +148 -0
  41. package/lib/freemarker2-D8-fH4uC.mjs +1001 -0
  42. package/lib/freemarker2-S5ay_GEf.js +8 -0
  43. package/lib/fsharp-CJxdVP7r.mjs +223 -0
  44. package/lib/fsharp-CKIYWNYJ.js +6 -0
  45. package/lib/go-DWj6zslQ.js +6 -0
  46. package/lib/go-IPaMO3Uz.mjs +224 -0
  47. package/lib/graphql-BzJpwfxN.js +6 -0
  48. package/lib/graphql-CMoDK5uf.mjs +157 -0
  49. package/lib/handlebars-CEMNnGaU.mjs +427 -0
  50. package/lib/handlebars-CM3PRDRO.js +6 -0
  51. package/lib/hcl-BCY6T0iq.js +6 -0
  52. package/lib/hcl-BTAYK4pT.mjs +189 -0
  53. package/lib/html-BSUn7oJR.mjs +316 -0
  54. package/lib/html-Df-Osxjs.js +6 -0
  55. package/lib/htmlMode-Bj4CfAzA.js +9 -0
  56. package/lib/htmlMode-xJPwX0cD.mjs +1615 -0
  57. package/lib/index-D6nY5NdF.mjs +116821 -0
  58. package/lib/index-rYV4VmC2.js +1163 -0
  59. package/lib/index.css +1 -1
  60. package/lib/ini-CC3_THb4.js +6 -0
  61. package/lib/ini-CiaphB6F.mjs +77 -0
  62. package/lib/java-CwRV8Dsg.js +6 -0
  63. package/lib/java-DxksziCw.mjs +238 -0
  64. package/lib/javascript-D1eKEotE.js +6 -0
  65. package/lib/javascript-c8D1_K05.mjs +76 -0
  66. package/lib/jsonMode-8-L3-E9k.mjs +2042 -0
  67. package/lib/jsonMode-BdBVsN9_.js +15 -0
  68. package/lib/julia-7Z1jwT4W.js +6 -0
  69. package/lib/julia-TTty8och.mjs +517 -0
  70. package/lib/kotlin-BAXgl2QX.js +6 -0
  71. package/lib/kotlin-Dzand-bM.mjs +259 -0
  72. package/lib/less-CSG9Zdoy.js +7 -0
  73. package/lib/less-CWDFQI_i.mjs +168 -0
  74. package/lib/lexon-BiTtMD9F.js +6 -0
  75. package/lib/lexon-bZpjZioh.mjs +163 -0
  76. package/lib/liquid-BmlJOXgY.js +6 -0
  77. package/lib/liquid-Bs7DM5cg.mjs +248 -0
  78. package/lib/lua-CoWYKXUu.mjs +168 -0
  79. package/lib/lua-o7UTFJ05.js +6 -0
  80. package/lib/m3-DIJY3uEe.mjs +216 -0
  81. package/lib/m3-DOYTRLxi.js +6 -0
  82. package/lib/markdown-CDlkMTMZ.mjs +235 -0
  83. package/lib/markdown-Di5faXtP.js +6 -0
  84. package/lib/mdx-BEI71kqO.mjs +173 -0
  85. package/lib/mdx-DJV2KJ98.js +6 -0
  86. package/lib/mips-CIiuS33B.mjs +204 -0
  87. package/lib/mips-CjGjcf9D.js +6 -0
  88. package/lib/msdax-4_jBeazN.mjs +381 -0
  89. package/lib/msdax-DZFpIwAH.js +6 -0
  90. package/lib/mysql-6Y0DL_eO.js +6 -0
  91. package/lib/mysql-D_KZRjSR.mjs +884 -0
  92. package/lib/objective-c-7nsY1fc1.mjs +189 -0
  93. package/lib/objective-c-BtrzMwBz.js +6 -0
  94. package/lib/pascal-BF06Dt9I.js +6 -0
  95. package/lib/pascal-BHpF9PW1.mjs +257 -0
  96. package/lib/pascaligo-BDrxVOcH.js +6 -0
  97. package/lib/pascaligo-C3mRbxmU.mjs +170 -0
  98. package/lib/perl-BMlqAyyD.js +6 -0
  99. package/lib/perl-F3tWDMLI.mjs +632 -0
  100. package/lib/pgsql-D62t1RD_.mjs +857 -0
  101. package/lib/pgsql-DXYBcnYD.js +6 -0
  102. package/lib/php-C8GGPjjI.mjs +506 -0
  103. package/lib/php-DmDmMNs3.js +6 -0
  104. package/lib/pla-2A6q3K8_.js +6 -0
  105. package/lib/pla-C_W_x2fV.mjs +143 -0
  106. package/lib/postiats-CMS8WwLg.mjs +913 -0
  107. package/lib/postiats-DQ-6iLGI.js +6 -0
  108. package/lib/powerquery-CuZPk7NC.js +6 -0
  109. package/lib/powerquery-Dcs0XplE.mjs +896 -0
  110. package/lib/powershell-Brx1N_3T.mjs +245 -0
  111. package/lib/powershell-D7BqJxnS.js +6 -0
  112. package/lib/protobuf-CkqkhuUG.js +7 -0
  113. package/lib/protobuf-UEJDuX6l.mjs +426 -0
  114. package/lib/pug-65DF18O8.js +6 -0
  115. package/lib/pug-LDwDmrMc.mjs +408 -0
  116. package/lib/python-BOeTitp9.mjs +309 -0
  117. package/lib/python-DRyE-VQQ.js +6 -0
  118. package/lib/qsharp-Cb7hPwnM.mjs +307 -0
  119. package/lib/qsharp-Dw07PXbd.js +6 -0
  120. package/lib/r-BHuY0po5.js +6 -0
  121. package/lib/r-BiFgSgcs.mjs +249 -0
  122. package/lib/razor-D0RPXCAO.mjs +558 -0
  123. package/lib/razor-DtDOotKq.js +6 -0
  124. package/lib/redis-BdzqoKC2.mjs +308 -0
  125. package/lib/redis-_Q4kv9ug.js +6 -0
  126. package/lib/redshift-DNNCHCLR.js +6 -0
  127. package/lib/redshift-Df6PoiEL.mjs +815 -0
  128. package/lib/restructuredtext-C9FM3r80.js +6 -0
  129. package/lib/restructuredtext-CW0ZtQ2l.mjs +180 -0
  130. package/lib/ruby-DyIFepcy.mjs +517 -0
  131. package/lib/ruby-DyJmXCYh.js +6 -0
  132. package/lib/rust-BiRHKB0S.mjs +349 -0
  133. package/lib/rust-DVvzZ_uH.js +6 -0
  134. package/lib/sb-CFwmZh3c.js +6 -0
  135. package/lib/sb-CahkGwPC.mjs +121 -0
  136. package/lib/scala-Cg9Wfw6B.mjs +376 -0
  137. package/lib/scala-DjaRe0PR.js +6 -0
  138. package/lib/scheme-Bqb0wlMX.mjs +114 -0
  139. package/lib/scheme-ZdeLzG0d.js +6 -0
  140. package/lib/scss-3qd2syug.mjs +268 -0
  141. package/lib/scss-Dqv1RljX.js +8 -0
  142. package/lib/shell-B5iW6U-v.mjs +227 -0
  143. package/lib/shell-BJ5zD_-e.js +6 -0
  144. package/lib/solidity-8Ys0iSgd.mjs +1373 -0
  145. package/lib/solidity-CagYWQAe.js +6 -0
  146. package/lib/sophia-PnZfErC3.mjs +205 -0
  147. package/lib/sophia-szuux90p.js +6 -0
  148. package/lib/sparql-CXz1-gkd.js +6 -0
  149. package/lib/sparql-CgWX-KRM.mjs +207 -0
  150. package/lib/sql-CN3Vg4Sm.mjs +859 -0
  151. package/lib/sql-CWZ5x4mg.js +6 -0
  152. package/lib/st-CcWMPoh3.js +6 -0
  153. package/lib/st-DKDuarOh.mjs +422 -0
  154. package/lib/swift-DUBoAkDR.js +8 -0
  155. package/lib/swift-DnXH6Con.mjs +318 -0
  156. package/lib/systemverilog-5hQzl-99.js +6 -0
  157. package/lib/systemverilog-pJOgZU46.mjs +582 -0
  158. package/lib/tcl-Bls9iNXn.mjs +238 -0
  159. package/lib/tcl-CiK0GhJi.js +6 -0
  160. package/lib/tsMode-BB2mDc5d.mjs +906 -0
  161. package/lib/tsMode-N-LS5RKx.js +16 -0
  162. package/lib/twig-B14HEeE0.mjs +398 -0
  163. package/lib/twig-Cbq-Ua-E.js +6 -0
  164. package/lib/typescript-CZplv8KD.js +6 -0
  165. package/lib/typescript-f9PHTVoW.mjs +351 -0
  166. package/lib/typespec-Br_LC070.js +6 -0
  167. package/lib/typespec-dAaIdBal.mjs +125 -0
  168. package/lib/umd/index.js +1914 -2
  169. package/lib/vb-B1HzwoGL.js +6 -0
  170. package/lib/vb-CPBujGrP.mjs +378 -0
  171. package/lib/wgsl-BNAUPMiJ.js +303 -0
  172. package/lib/wgsl-CqCqdnZC.mjs +448 -0
  173. package/lib/xml-BSe-ETnG.js +6 -0
  174. package/lib/xml-Dv0cmUxw.mjs +103 -0
  175. package/lib/yaml-O_DoXtBP.js +6 -0
  176. package/lib/yaml-eXS7QSgG.mjs +214 -0
  177. package/package.json +10 -17
@@ -0,0 +1,913 @@
1
+ /*!-----------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Version: 0.52.0(f6dc0eb8fce67e57f6036f4769d92c1666cdf546)
4
+ * Released under the MIT license
5
+ * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
6
+ *-----------------------------------------------------------------------------*/
7
+ var conf = {
8
+ comments: {
9
+ lineComment: "//",
10
+ blockComment: ["(*", "*)"]
11
+ },
12
+ brackets: [
13
+ ["{", "}"],
14
+ ["[", "]"],
15
+ ["(", ")"],
16
+ ["<", ">"]
17
+ ],
18
+ autoClosingPairs: [
19
+ { open: '"', close: '"', notIn: ["string", "comment"] },
20
+ { open: "{", close: "}", notIn: ["string", "comment"] },
21
+ { open: "[", close: "]", notIn: ["string", "comment"] },
22
+ { open: "(", close: ")", notIn: ["string", "comment"] }
23
+ ]
24
+ }, language = {
25
+ tokenPostfix: ".pats",
26
+ // TODO: staload and dynload are followed by a special kind of string literals
27
+ // with {$IDENTIFER} variables, and it also may make sense to highlight
28
+ // the punctuation (. and / and \) differently.
29
+ // Set defaultToken to invalid to see what you do not tokenize yet
30
+ defaultToken: "invalid",
31
+ // keyword reference: https://github.com/githwxi/ATS-Postiats/blob/master/src/pats_lexing_token.dats
32
+ keywords: [
33
+ //
34
+ "abstype",
35
+ // ABSTYPE
36
+ "abst0ype",
37
+ // ABST0YPE
38
+ "absprop",
39
+ // ABSPROP
40
+ "absview",
41
+ // ABSVIEW
42
+ "absvtype",
43
+ // ABSVIEWTYPE
44
+ "absviewtype",
45
+ // ABSVIEWTYPE
46
+ "absvt0ype",
47
+ // ABSVIEWT0YPE
48
+ "absviewt0ype",
49
+ // ABSVIEWT0YPE
50
+ //
51
+ "as",
52
+ // T_AS
53
+ //
54
+ "and",
55
+ // T_AND
56
+ //
57
+ "assume",
58
+ // T_ASSUME
59
+ //
60
+ "begin",
61
+ // T_BEGIN
62
+ //
63
+ /*
64
+ "case", // CASE
65
+ */
66
+ //
67
+ "classdec",
68
+ // T_CLASSDEC
69
+ //
70
+ "datasort",
71
+ // T_DATASORT
72
+ //
73
+ "datatype",
74
+ // DATATYPE
75
+ "dataprop",
76
+ // DATAPROP
77
+ "dataview",
78
+ // DATAVIEW
79
+ "datavtype",
80
+ // DATAVIEWTYPE
81
+ "dataviewtype",
82
+ // DATAVIEWTYPE
83
+ //
84
+ "do",
85
+ // T_DO
86
+ //
87
+ "end",
88
+ // T_END
89
+ //
90
+ "extern",
91
+ // T_EXTERN
92
+ "extype",
93
+ // T_EXTYPE
94
+ "extvar",
95
+ // T_EXTVAR
96
+ //
97
+ "exception",
98
+ // T_EXCEPTION
99
+ //
100
+ "fn",
101
+ // FN // non-recursive
102
+ "fnx",
103
+ // FNX // mutual tail-rec.
104
+ "fun",
105
+ // FUN // general-recursive
106
+ //
107
+ "prfn",
108
+ // PRFN
109
+ "prfun",
110
+ // PRFUN
111
+ //
112
+ "praxi",
113
+ // PRAXI
114
+ "castfn",
115
+ // CASTFN
116
+ //
117
+ "if",
118
+ // T_IF
119
+ "then",
120
+ // T_THEN
121
+ "else",
122
+ // T_ELSE
123
+ //
124
+ "ifcase",
125
+ // T_IFCASE
126
+ //
127
+ "in",
128
+ // T_IN
129
+ //
130
+ "infix",
131
+ // INFIX
132
+ "infixl",
133
+ // INFIXL
134
+ "infixr",
135
+ // INFIXR
136
+ "prefix",
137
+ // PREFIX
138
+ "postfix",
139
+ // POSTFIX
140
+ //
141
+ "implmnt",
142
+ // IMPLMNT // 0
143
+ "implement",
144
+ // IMPLEMENT // 1
145
+ //
146
+ "primplmnt",
147
+ // PRIMPLMNT // ~1
148
+ "primplement",
149
+ // PRIMPLMNT // ~1
150
+ //
151
+ "import",
152
+ // T_IMPORT // for importing packages
153
+ //
154
+ /*
155
+ "lam", // LAM
156
+ "llam", // LLAM
157
+ "fix", // FIX
158
+ */
159
+ //
160
+ "let",
161
+ // T_LET
162
+ //
163
+ "local",
164
+ // T_LOCAL
165
+ //
166
+ "macdef",
167
+ // MACDEF
168
+ "macrodef",
169
+ // MACRODEF
170
+ //
171
+ "nonfix",
172
+ // T_NONFIX
173
+ //
174
+ "symelim",
175
+ // T_SYMELIM
176
+ "symintr",
177
+ // T_SYMINTR
178
+ "overload",
179
+ // T_OVERLOAD
180
+ //
181
+ "of",
182
+ // T_OF
183
+ "op",
184
+ // T_OP
185
+ //
186
+ "rec",
187
+ // T_REC
188
+ //
189
+ "sif",
190
+ // T_SIF
191
+ "scase",
192
+ // T_SCASE
193
+ //
194
+ "sortdef",
195
+ // T_SORTDEF
196
+ /*
197
+ // HX: [sta] is now deprecated
198
+ */
199
+ "sta",
200
+ // T_STACST
201
+ "stacst",
202
+ // T_STACST
203
+ "stadef",
204
+ // T_STADEF
205
+ "static",
206
+ // T_STATIC
207
+ /*
208
+ "stavar", // T_STAVAR
209
+ */
210
+ //
211
+ "staload",
212
+ // T_STALOAD
213
+ "dynload",
214
+ // T_DYNLOAD
215
+ //
216
+ "try",
217
+ // T_TRY
218
+ //
219
+ "tkindef",
220
+ // T_TKINDEF // HX-2012-05-23
221
+ //
222
+ /*
223
+ "type", // TYPE
224
+ */
225
+ "typedef",
226
+ // TYPEDEF
227
+ "propdef",
228
+ // PROPDEF
229
+ "viewdef",
230
+ // VIEWDEF
231
+ "vtypedef",
232
+ // VIEWTYPEDEF
233
+ "viewtypedef",
234
+ // VIEWTYPEDEF
235
+ //
236
+ /*
237
+ "val", // VAL
238
+ */
239
+ "prval",
240
+ // PRVAL
241
+ //
242
+ "var",
243
+ // VAR
244
+ "prvar",
245
+ // PRVAR
246
+ //
247
+ "when",
248
+ // T_WHEN
249
+ "where",
250
+ // T_WHERE
251
+ //
252
+ /*
253
+ "for", // T_FOR
254
+ "while", // T_WHILE
255
+ */
256
+ //
257
+ "with",
258
+ // T_WITH
259
+ //
260
+ "withtype",
261
+ // WITHTYPE
262
+ "withprop",
263
+ // WITHPROP
264
+ "withview",
265
+ // WITHVIEW
266
+ "withvtype",
267
+ // WITHVIEWTYPE
268
+ "withviewtype"
269
+ // WITHVIEWTYPE
270
+ //
271
+ ],
272
+ keywords_dlr: [
273
+ "$delay",
274
+ // DLRDELAY
275
+ "$ldelay",
276
+ // DLRLDELAY
277
+ //
278
+ "$arrpsz",
279
+ // T_DLRARRPSZ
280
+ "$arrptrsize",
281
+ // T_DLRARRPSZ
282
+ //
283
+ "$d2ctype",
284
+ // T_DLRD2CTYPE
285
+ //
286
+ "$effmask",
287
+ // DLREFFMASK
288
+ "$effmask_ntm",
289
+ // DLREFFMASK_NTM
290
+ "$effmask_exn",
291
+ // DLREFFMASK_EXN
292
+ "$effmask_ref",
293
+ // DLREFFMASK_REF
294
+ "$effmask_wrt",
295
+ // DLREFFMASK_WRT
296
+ "$effmask_all",
297
+ // DLREFFMASK_ALL
298
+ //
299
+ "$extern",
300
+ // T_DLREXTERN
301
+ "$extkind",
302
+ // T_DLREXTKIND
303
+ "$extype",
304
+ // T_DLREXTYPE
305
+ "$extype_struct",
306
+ // T_DLREXTYPE_STRUCT
307
+ //
308
+ "$extval",
309
+ // T_DLREXTVAL
310
+ "$extfcall",
311
+ // T_DLREXTFCALL
312
+ "$extmcall",
313
+ // T_DLREXTMCALL
314
+ //
315
+ "$literal",
316
+ // T_DLRLITERAL
317
+ //
318
+ "$myfilename",
319
+ // T_DLRMYFILENAME
320
+ "$mylocation",
321
+ // T_DLRMYLOCATION
322
+ "$myfunction",
323
+ // T_DLRMYFUNCTION
324
+ //
325
+ "$lst",
326
+ // DLRLST
327
+ "$lst_t",
328
+ // DLRLST_T
329
+ "$lst_vt",
330
+ // DLRLST_VT
331
+ "$list",
332
+ // DLRLST
333
+ "$list_t",
334
+ // DLRLST_T
335
+ "$list_vt",
336
+ // DLRLST_VT
337
+ //
338
+ "$rec",
339
+ // DLRREC
340
+ "$rec_t",
341
+ // DLRREC_T
342
+ "$rec_vt",
343
+ // DLRREC_VT
344
+ "$record",
345
+ // DLRREC
346
+ "$record_t",
347
+ // DLRREC_T
348
+ "$record_vt",
349
+ // DLRREC_VT
350
+ //
351
+ "$tup",
352
+ // DLRTUP
353
+ "$tup_t",
354
+ // DLRTUP_T
355
+ "$tup_vt",
356
+ // DLRTUP_VT
357
+ "$tuple",
358
+ // DLRTUP
359
+ "$tuple_t",
360
+ // DLRTUP_T
361
+ "$tuple_vt",
362
+ // DLRTUP_VT
363
+ //
364
+ "$break",
365
+ // T_DLRBREAK
366
+ "$continue",
367
+ // T_DLRCONTINUE
368
+ //
369
+ "$raise",
370
+ // T_DLRRAISE
371
+ //
372
+ "$showtype",
373
+ // T_DLRSHOWTYPE
374
+ //
375
+ "$vcopyenv_v",
376
+ // DLRVCOPYENV_V
377
+ "$vcopyenv_vt",
378
+ // DLRVCOPYENV_VT
379
+ //
380
+ "$tempenver",
381
+ // T_DLRTEMPENVER
382
+ //
383
+ "$solver_assert",
384
+ // T_DLRSOLASSERT
385
+ "$solver_verify"
386
+ // T_DLRSOLVERIFY
387
+ ],
388
+ keywords_srp: [
389
+ //
390
+ "#if",
391
+ // T_SRPIF
392
+ "#ifdef",
393
+ // T_SRPIFDEF
394
+ "#ifndef",
395
+ // T_SRPIFNDEF
396
+ //
397
+ "#then",
398
+ // T_SRPTHEN
399
+ //
400
+ "#elif",
401
+ // T_SRPELIF
402
+ "#elifdef",
403
+ // T_SRPELIFDEF
404
+ "#elifndef",
405
+ // T_SRPELIFNDEF
406
+ //
407
+ "#else",
408
+ // T_SRPELSE
409
+ "#endif",
410
+ // T_SRPENDIF
411
+ //
412
+ "#error",
413
+ // T_SRPERROR
414
+ //
415
+ "#prerr",
416
+ // T_SRPPRERR // outpui to stderr
417
+ "#print",
418
+ // T_SRPPRINT // output to stdout
419
+ //
420
+ "#assert",
421
+ // T_SRPASSERT
422
+ //
423
+ "#undef",
424
+ // T_SRPUNDEF
425
+ "#define",
426
+ // T_SRPDEFINE
427
+ //
428
+ "#include",
429
+ // T_SRPINCLUDE
430
+ "#require",
431
+ // T_SRPREQUIRE
432
+ //
433
+ "#pragma",
434
+ // T_SRPPRAGMA // HX: general pragma
435
+ "#codegen2",
436
+ // T_SRPCODEGEN2 // for level-2 codegen
437
+ "#codegen3"
438
+ // T_SRPCODEGEN3 // for level-3 codegen
439
+ //
440
+ // HX: end of special tokens
441
+ //
442
+ ],
443
+ irregular_keyword_list: [
444
+ "val+",
445
+ "val-",
446
+ "val",
447
+ "case+",
448
+ "case-",
449
+ "case",
450
+ "addr@",
451
+ "addr",
452
+ "fold@",
453
+ "free@",
454
+ "fix@",
455
+ "fix",
456
+ "lam@",
457
+ "lam",
458
+ "llam@",
459
+ "llam",
460
+ "viewt@ype+",
461
+ "viewt@ype-",
462
+ "viewt@ype",
463
+ "viewtype+",
464
+ "viewtype-",
465
+ "viewtype",
466
+ "view+",
467
+ "view-",
468
+ "view@",
469
+ "view",
470
+ "type+",
471
+ "type-",
472
+ "type",
473
+ "vtype+",
474
+ "vtype-",
475
+ "vtype",
476
+ "vt@ype+",
477
+ "vt@ype-",
478
+ "vt@ype",
479
+ "viewt@ype+",
480
+ "viewt@ype-",
481
+ "viewt@ype",
482
+ "viewtype+",
483
+ "viewtype-",
484
+ "viewtype",
485
+ "prop+",
486
+ "prop-",
487
+ "prop",
488
+ "type+",
489
+ "type-",
490
+ "type",
491
+ "t@ype",
492
+ "t@ype+",
493
+ "t@ype-",
494
+ "abst@ype",
495
+ "abstype",
496
+ "absviewt@ype",
497
+ "absvt@ype",
498
+ "for*",
499
+ "for",
500
+ "while*",
501
+ "while"
502
+ ],
503
+ keywords_types: [
504
+ "bool",
505
+ "double",
506
+ "byte",
507
+ "int",
508
+ "short",
509
+ "char",
510
+ "void",
511
+ "unit",
512
+ "long",
513
+ "float",
514
+ "string",
515
+ "strptr"
516
+ ],
517
+ // TODO: reference for this?
518
+ keywords_effects: [
519
+ "0",
520
+ // no effects
521
+ "fun",
522
+ "clo",
523
+ "prf",
524
+ "funclo",
525
+ "cloptr",
526
+ "cloref",
527
+ "ref",
528
+ "ntm",
529
+ "1"
530
+ // all effects
531
+ ],
532
+ operators: [
533
+ "@",
534
+ // T_AT
535
+ "!",
536
+ // T_BANG
537
+ "|",
538
+ // T_BAR
539
+ "`",
540
+ // T_BQUOTE
541
+ ":",
542
+ // T_COLON
543
+ "$",
544
+ // T_DOLLAR
545
+ ".",
546
+ // T_DOT
547
+ "=",
548
+ // T_EQ
549
+ "#",
550
+ // T_HASH
551
+ "~",
552
+ // T_TILDE
553
+ //
554
+ "..",
555
+ // T_DOTDOT
556
+ "...",
557
+ // T_DOTDOTDOT
558
+ //
559
+ "=>",
560
+ // T_EQGT
561
+ // "=<", // T_EQLT
562
+ "=<>",
563
+ // T_EQLTGT
564
+ "=/=>",
565
+ // T_EQSLASHEQGT
566
+ "=>>",
567
+ // T_EQGTGT
568
+ "=/=>>",
569
+ // T_EQSLASHEQGTGT
570
+ //
571
+ "<",
572
+ // T_LT // opening a tmparg
573
+ ">",
574
+ // T_GT // closing a tmparg
575
+ //
576
+ "><",
577
+ // T_GTLT
578
+ //
579
+ ".<",
580
+ // T_DOTLT
581
+ ">.",
582
+ // T_GTDOT
583
+ //
584
+ ".<>.",
585
+ // T_DOTLTGTDOT
586
+ //
587
+ "->",
588
+ // T_MINUSGT
589
+ //"-<", // T_MINUSLT
590
+ "-<>"
591
+ // T_MINUSLTGT
592
+ //
593
+ /*
594
+ ":<", // T_COLONLT
595
+ */
596
+ ],
597
+ brackets: [
598
+ { open: ",(", close: ")", token: "delimiter.parenthesis" },
599
+ // meta-programming syntax
600
+ { open: "`(", close: ")", token: "delimiter.parenthesis" },
601
+ { open: "%(", close: ")", token: "delimiter.parenthesis" },
602
+ { open: "'(", close: ")", token: "delimiter.parenthesis" },
603
+ { open: "'{", close: "}", token: "delimiter.parenthesis" },
604
+ { open: "@(", close: ")", token: "delimiter.parenthesis" },
605
+ { open: "@{", close: "}", token: "delimiter.brace" },
606
+ { open: "@[", close: "]", token: "delimiter.square" },
607
+ { open: "#[", close: "]", token: "delimiter.square" },
608
+ { open: "{", close: "}", token: "delimiter.curly" },
609
+ { open: "[", close: "]", token: "delimiter.square" },
610
+ { open: "(", close: ")", token: "delimiter.parenthesis" },
611
+ { open: "<", close: ">", token: "delimiter.angle" }
612
+ ],
613
+ // we include these common regular expressions
614
+ symbols: /[=><!~?:&|+\-*\/\^%]+/,
615
+ IDENTFST: /[a-zA-Z_]/,
616
+ IDENTRST: /[a-zA-Z0-9_'$]/,
617
+ symbolic: /[%&+-./:=@~`^|*!$#?<>]/,
618
+ digit: /[0-9]/,
619
+ digitseq0: /@digit*/,
620
+ xdigit: /[0-9A-Za-z]/,
621
+ xdigitseq0: /@xdigit*/,
622
+ INTSP: /[lLuU]/,
623
+ FLOATSP: /[fFlL]/,
624
+ fexponent: /[eE][+-]?[0-9]+/,
625
+ fexponent_bin: /[pP][+-]?[0-9]+/,
626
+ deciexp: /\.[0-9]*@fexponent?/,
627
+ hexiexp: /\.[0-9a-zA-Z]*@fexponent_bin?/,
628
+ irregular_keywords: /val[+-]?|case[+-]?|addr\@?|fold\@|free\@|fix\@?|lam\@?|llam\@?|prop[+-]?|type[+-]?|view[+-@]?|viewt@?ype[+-]?|t@?ype[+-]?|v(iew)?t@?ype[+-]?|abst@?ype|absv(iew)?t@?ype|for\*?|while\*?/,
629
+ ESCHAR: /[ntvbrfa\\\?'"\(\[\{]/,
630
+ start: "root",
631
+ // The main tokenizer for ATS/Postiats
632
+ // reference: https://github.com/githwxi/ATS-Postiats/blob/master/src/pats_lexing.dats
633
+ tokenizer: {
634
+ root: [
635
+ // lexing_blankseq0
636
+ { regex: /[ \t\r\n]+/, action: { token: "" } },
637
+ // NOTE: (*) is an invalid ML-like comment!
638
+ { regex: /\(\*\)/, action: { token: "invalid" } },
639
+ {
640
+ regex: /\(\*/,
641
+ action: { token: "comment", next: "lexing_COMMENT_block_ml" }
642
+ },
643
+ {
644
+ regex: /\(/,
645
+ action: "@brackets"
646
+ /*{ token: 'delimiter.parenthesis' }*/
647
+ },
648
+ {
649
+ regex: /\)/,
650
+ action: "@brackets"
651
+ /*{ token: 'delimiter.parenthesis' }*/
652
+ },
653
+ {
654
+ regex: /\[/,
655
+ action: "@brackets"
656
+ /*{ token: 'delimiter.bracket' }*/
657
+ },
658
+ {
659
+ regex: /\]/,
660
+ action: "@brackets"
661
+ /*{ token: 'delimiter.bracket' }*/
662
+ },
663
+ {
664
+ regex: /\{/,
665
+ action: "@brackets"
666
+ /*{ token: 'delimiter.brace' }*/
667
+ },
668
+ {
669
+ regex: /\}/,
670
+ action: "@brackets"
671
+ /*{ token: 'delimiter.brace' }*/
672
+ },
673
+ // lexing_COMMA
674
+ {
675
+ regex: /,\(/,
676
+ action: "@brackets"
677
+ /*{ token: 'delimiter.parenthesis' }*/
678
+ },
679
+ // meta-programming syntax
680
+ { regex: /,/, action: { token: "delimiter.comma" } },
681
+ { regex: /;/, action: { token: "delimiter.semicolon" } },
682
+ // lexing_AT
683
+ {
684
+ regex: /@\(/,
685
+ action: "@brackets"
686
+ /* { token: 'delimiter.parenthesis' }*/
687
+ },
688
+ {
689
+ regex: /@\[/,
690
+ action: "@brackets"
691
+ /* { token: 'delimiter.bracket' }*/
692
+ },
693
+ {
694
+ regex: /@\{/,
695
+ action: "@brackets"
696
+ /*{ token: 'delimiter.brace' }*/
697
+ },
698
+ // lexing_COLON
699
+ {
700
+ regex: /:</,
701
+ action: { token: "keyword", next: "@lexing_EFFECT_commaseq0" }
702
+ },
703
+ // T_COLONLT
704
+ /*
705
+ lexing_DOT:
706
+
707
+ . // SYMBOLIC => lexing_IDENT_sym
708
+ . FLOATDOT => lexing_FLOAT_deciexp
709
+ . DIGIT => T_DOTINT
710
+ */
711
+ { regex: /\.@symbolic+/, action: { token: "identifier.sym" } },
712
+ // FLOATDOT case
713
+ {
714
+ regex: /\.@digit*@fexponent@FLOATSP*/,
715
+ action: { token: "number.float" }
716
+ },
717
+ { regex: /\.@digit+/, action: { token: "number.float" } },
718
+ // T_DOTINT
719
+ // lexing_DOLLAR:
720
+ // '$' IDENTFST IDENTRST* => lexing_IDENT_dlr, _ => lexing_IDENT_sym
721
+ {
722
+ regex: /\$@IDENTFST@IDENTRST*/,
723
+ action: {
724
+ cases: {
725
+ "@keywords_dlr": { token: "keyword.dlr" },
726
+ "@default": { token: "namespace" }
727
+ // most likely a module qualifier
728
+ }
729
+ }
730
+ },
731
+ // lexing_SHARP:
732
+ // '#' IDENTFST IDENTRST* => lexing_ident_srp, _ => lexing_IDENT_sym
733
+ {
734
+ regex: /\#@IDENTFST@IDENTRST*/,
735
+ action: {
736
+ cases: {
737
+ "@keywords_srp": { token: "keyword.srp" },
738
+ "@default": { token: "identifier" }
739
+ }
740
+ }
741
+ },
742
+ // lexing_PERCENT:
743
+ { regex: /%\(/, action: { token: "delimiter.parenthesis" } },
744
+ {
745
+ regex: /^%{(#|\^|\$)?/,
746
+ action: {
747
+ token: "keyword",
748
+ next: "@lexing_EXTCODE",
749
+ nextEmbedded: "text/javascript"
750
+ }
751
+ },
752
+ { regex: /^%}/, action: { token: "keyword" } },
753
+ // lexing_QUOTE
754
+ { regex: /'\(/, action: { token: "delimiter.parenthesis" } },
755
+ { regex: /'\[/, action: { token: "delimiter.bracket" } },
756
+ { regex: /'\{/, action: { token: "delimiter.brace" } },
757
+ [/(')(\\@ESCHAR|\\[xX]@xdigit+|\\@digit+)(')/, ["string", "string.escape", "string"]],
758
+ [/'[^\\']'/, "string"],
759
+ // lexing_DQUOTE
760
+ [/"/, "string.quote", "@lexing_DQUOTE"],
761
+ // lexing_BQUOTE
762
+ {
763
+ regex: /`\(/,
764
+ action: "@brackets"
765
+ /* { token: 'delimiter.parenthesis' }*/
766
+ },
767
+ // TODO: otherwise, try lexing_IDENT_sym
768
+ { regex: /\\/, action: { token: "punctuation" } },
769
+ // just T_BACKSLASH
770
+ // lexing_IDENT_alp:
771
+ // NOTE: (?!regex) is syntax for "not-followed-by" regex
772
+ // to resolve ambiguity such as foreach$fwork being incorrectly lexed as [for] [each$fwork]!
773
+ {
774
+ regex: /@irregular_keywords(?!@IDENTRST)/,
775
+ action: { token: "keyword" }
776
+ },
777
+ {
778
+ regex: /@IDENTFST@IDENTRST*[<!\[]?/,
779
+ action: {
780
+ cases: {
781
+ // TODO: dynload and staload should be specially parsed
782
+ // dynload whitespace+ "special_string"
783
+ // this special string is really:
784
+ // '/' '\\' '.' => punctuation
785
+ // ({\$)([a-zA-Z_][a-zA-Z_0-9]*)(}) => punctuation,keyword,punctuation
786
+ // [^"] => identifier/literal
787
+ "@keywords": { token: "keyword" },
788
+ "@keywords_types": { token: "type" },
789
+ "@default": { token: "identifier" }
790
+ }
791
+ }
792
+ },
793
+ // lexing_IDENT_sym:
794
+ {
795
+ regex: /\/\/\/\//,
796
+ action: { token: "comment", next: "@lexing_COMMENT_rest" }
797
+ },
798
+ { regex: /\/\/.*$/, action: { token: "comment" } },
799
+ {
800
+ regex: /\/\*/,
801
+ action: { token: "comment", next: "@lexing_COMMENT_block_c" }
802
+ },
803
+ // AS-20160627: specifically for effect annotations
804
+ {
805
+ regex: /-<|=</,
806
+ action: { token: "keyword", next: "@lexing_EFFECT_commaseq0" }
807
+ },
808
+ {
809
+ regex: /@symbolic+/,
810
+ action: {
811
+ cases: {
812
+ "@operators": "keyword",
813
+ "@default": "operator"
814
+ }
815
+ }
816
+ },
817
+ // lexing_ZERO:
818
+ // FIXME: this one is quite messy/unfinished yet
819
+ // TODO: lexing_INT_hex
820
+ // - testing_hexiexp => lexing_FLOAT_hexiexp
821
+ // - testing_fexponent_bin => lexing_FLOAT_hexiexp
822
+ // - testing_intspseq0 => T_INT_hex
823
+ // lexing_INT_hex:
824
+ {
825
+ regex: /0[xX]@xdigit+(@hexiexp|@fexponent_bin)@FLOATSP*/,
826
+ action: { token: "number.float" }
827
+ },
828
+ { regex: /0[xX]@xdigit+@INTSP*/, action: { token: "number.hex" } },
829
+ {
830
+ regex: /0[0-7]+(?![0-9])@INTSP*/,
831
+ action: { token: "number.octal" }
832
+ },
833
+ // lexing_INT_oct
834
+ //{regex: /0/, action: { token: 'number' } }, // INTZERO
835
+ // lexing_INT_dec:
836
+ // - testing_deciexp => lexing_FLOAT_deciexp
837
+ // - testing_fexponent => lexing_FLOAT_deciexp
838
+ // - otherwise => intspseq0 ([0-9]*[lLuU]?)
839
+ {
840
+ regex: /@digit+(@fexponent|@deciexp)@FLOATSP*/,
841
+ action: { token: "number.float" }
842
+ },
843
+ {
844
+ regex: /@digit@digitseq0@INTSP*/,
845
+ action: { token: "number.decimal" }
846
+ },
847
+ // DIGIT, if followed by digitseq0, is lexing_INT_dec
848
+ { regex: /@digit+@INTSP*/, action: { token: "number" } }
849
+ ],
850
+ lexing_COMMENT_block_ml: [
851
+ [/[^\(\*]+/, "comment"],
852
+ [/\(\*/, "comment", "@push"],
853
+ [/\(\*/, "comment.invalid"],
854
+ [/\*\)/, "comment", "@pop"],
855
+ [/\*/, "comment"]
856
+ ],
857
+ lexing_COMMENT_block_c: [
858
+ [/[^\/*]+/, "comment"],
859
+ // [/\/\*/, 'comment', '@push' ], // nested C-style block comments not allowed
860
+ // [/\/\*/, 'comment.invalid' ], // NOTE: this breaks block comments in the shape of /* //*/
861
+ [/\*\//, "comment", "@pop"],
862
+ [/[\/*]/, "comment"]
863
+ ],
864
+ lexing_COMMENT_rest: [
865
+ [/$/, "comment", "@pop"],
866
+ // FIXME: does it match? docs say 'no'
867
+ [/.*/, "comment"]
868
+ ],
869
+ // NOTE: added by AS, specifically for highlighting
870
+ lexing_EFFECT_commaseq0: [
871
+ {
872
+ regex: /@IDENTFST@IDENTRST+|@digit+/,
873
+ action: {
874
+ cases: {
875
+ "@keywords_effects": { token: "type.effect" },
876
+ "@default": { token: "identifier" }
877
+ }
878
+ }
879
+ },
880
+ { regex: /,/, action: { token: "punctuation" } },
881
+ { regex: />/, action: { token: "@rematch", next: "@pop" } }
882
+ ],
883
+ lexing_EXTCODE: [
884
+ {
885
+ regex: /^%}/,
886
+ action: {
887
+ token: "@rematch",
888
+ next: "@pop",
889
+ nextEmbedded: "@pop"
890
+ }
891
+ },
892
+ { regex: /[^%]+/, action: "" }
893
+ ],
894
+ lexing_DQUOTE: [
895
+ { regex: /"/, action: { token: "string.quote", next: "@pop" } },
896
+ // AS-20160628: additional hi-lighting for variables in staload/dynload strings
897
+ {
898
+ regex: /(\{\$)(@IDENTFST@IDENTRST*)(\})/,
899
+ action: [{ token: "string.escape" }, { token: "identifier" }, { token: "string.escape" }]
900
+ },
901
+ { regex: /\\$/, action: { token: "string.escape" } },
902
+ {
903
+ regex: /\\(@ESCHAR|[xX]@xdigit+|@digit+)/,
904
+ action: { token: "string.escape" }
905
+ },
906
+ { regex: /[^\\"]+/, action: { token: "string" } }
907
+ ]
908
+ }
909
+ };
910
+ export {
911
+ conf,
912
+ language
913
+ };