@quirekit/cm-legacy-modes 0.0.0-stage → 0.0.1-alpha.1

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 (420) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -2
  3. package/README.zh-CN.md +28 -0
  4. package/THIRD_PARTY_NOTICES.md +141 -0
  5. package/UPSTREAM.json +16 -0
  6. package/dist/mode/README.md +52 -0
  7. package/dist/mode/apl.d.ts +2 -0
  8. package/dist/mode/apl.js +140 -0
  9. package/dist/mode/asciiarmor.d.ts +2 -0
  10. package/dist/mode/asciiarmor.js +54 -0
  11. package/dist/mode/asn1.d.ts +12 -0
  12. package/dist/mode/asn1.js +190 -0
  13. package/dist/mode/asterisk.d.ts +2 -0
  14. package/dist/mode/asterisk.js +186 -0
  15. package/dist/mode/brainfuck.d.ts +2 -0
  16. package/dist/mode/brainfuck.js +68 -0
  17. package/dist/mode/clike.d.ts +35 -0
  18. package/dist/mode/clike.js +1019 -0
  19. package/dist/mode/clojure.d.ts +2 -0
  20. package/dist/mode/clojure.js +272 -0
  21. package/dist/mode/cmake.d.ts +2 -0
  22. package/dist/mode/cmake.js +80 -0
  23. package/dist/mode/cobol.d.ts +2 -0
  24. package/dist/mode/cobol.js +234 -0
  25. package/dist/mode/coffeescript.d.ts +2 -0
  26. package/dist/mode/coffeescript.js +327 -0
  27. package/dist/mode/commonlisp.d.ts +2 -0
  28. package/dist/mode/commonlisp.js +107 -0
  29. package/dist/mode/crystal.d.ts +2 -0
  30. package/dist/mode/crystal.js +417 -0
  31. package/dist/mode/css.d.ts +5 -0
  32. package/dist/mode/css.js +846 -0
  33. package/dist/mode/cypher.d.ts +2 -0
  34. package/dist/mode/cypher.js +120 -0
  35. package/dist/mode/d.d.ts +2 -0
  36. package/dist/mode/d.js +203 -0
  37. package/dist/mode/diff.d.ts +2 -0
  38. package/dist/mode/diff.js +29 -0
  39. package/dist/mode/dockerfile.d.ts +2 -0
  40. package/dist/mode/dockerfile.js +198 -0
  41. package/dist/mode/dtd.d.ts +2 -0
  42. package/dist/mode/dtd.js +120 -0
  43. package/dist/mode/dylan.d.ts +2 -0
  44. package/dist/mode/dylan.js +336 -0
  45. package/dist/mode/ebnf.d.ts +2 -0
  46. package/dist/mode/ebnf.js +149 -0
  47. package/dist/mode/ecl.d.ts +2 -0
  48. package/dist/mode/ecl.js +188 -0
  49. package/dist/mode/eiffel.d.ts +2 -0
  50. package/dist/mode/eiffel.js +145 -0
  51. package/dist/mode/elm.d.ts +2 -0
  52. package/dist/mode/elm.js +228 -0
  53. package/dist/mode/erlang.d.ts +2 -0
  54. package/dist/mode/erlang.js +580 -0
  55. package/dist/mode/factor.d.ts +2 -0
  56. package/dist/mode/factor.js +63 -0
  57. package/dist/mode/fcl.d.ts +2 -0
  58. package/dist/mode/fcl.js +153 -0
  59. package/dist/mode/forth.d.ts +2 -0
  60. package/dist/mode/forth.js +162 -0
  61. package/dist/mode/fortran.d.ts +2 -0
  62. package/dist/mode/fortran.js +171 -0
  63. package/dist/mode/gas.d.ts +3 -0
  64. package/dist/mode/gas.js +342 -0
  65. package/dist/mode/gherkin.d.ts +2 -0
  66. package/dist/mode/gherkin.js +146 -0
  67. package/dist/mode/go.d.ts +2 -0
  68. package/dist/mode/go.js +163 -0
  69. package/dist/mode/groovy.d.ts +2 -0
  70. package/dist/mode/groovy.js +226 -0
  71. package/dist/mode/haskell.d.ts +2 -0
  72. package/dist/mode/haskell.js +238 -0
  73. package/dist/mode/haxe.d.ts +3 -0
  74. package/dist/mode/haxe.js +490 -0
  75. package/dist/mode/http.d.ts +2 -0
  76. package/dist/mode/http.js +87 -0
  77. package/dist/mode/idl.d.ts +2 -0
  78. package/dist/mode/idl.js +274 -0
  79. package/dist/mode/javascript.d.ts +5 -0
  80. package/dist/mode/javascript.js +922 -0
  81. package/dist/mode/jinja2.d.ts +2 -0
  82. package/dist/mode/jinja2.js +170 -0
  83. package/dist/mode/julia.d.ts +2 -0
  84. package/dist/mode/julia.js +367 -0
  85. package/dist/mode/livescript.d.ts +2 -0
  86. package/dist/mode/livescript.js +257 -0
  87. package/dist/mode/lua.d.ts +2 -0
  88. package/dist/mode/lua.js +135 -0
  89. package/dist/mode/mathematica.d.ts +2 -0
  90. package/dist/mode/mathematica.js +153 -0
  91. package/dist/mode/mbox.d.ts +2 -0
  92. package/dist/mode/mbox.js +114 -0
  93. package/dist/mode/mirc.d.ts +2 -0
  94. package/dist/mode/mirc.js +174 -0
  95. package/dist/mode/mllike.d.ts +4 -0
  96. package/dist/mode/mllike.js +346 -0
  97. package/dist/mode/modelica.d.ts +2 -0
  98. package/dist/mode/modelica.js +190 -0
  99. package/dist/mode/mscgen.d.ts +4 -0
  100. package/dist/mode/mscgen.js +147 -0
  101. package/dist/mode/mumps.d.ts +2 -0
  102. package/dist/mode/mumps.js +127 -0
  103. package/dist/mode/nginx.d.ts +2 -0
  104. package/dist/mode/nginx.js +161 -0
  105. package/dist/mode/nsis.d.ts +2 -0
  106. package/dist/mode/nsis.js +78 -0
  107. package/dist/mode/ntriples.d.ts +2 -0
  108. package/dist/mode/ntriples.js +139 -0
  109. package/dist/mode/octave.d.ts +2 -0
  110. package/dist/mode/octave.js +123 -0
  111. package/dist/mode/oz.d.ts +2 -0
  112. package/dist/mode/oz.js +233 -0
  113. package/dist/mode/pascal.d.ts +2 -0
  114. package/dist/mode/pascal.js +122 -0
  115. package/dist/mode/pegjs.d.ts +2 -0
  116. package/dist/mode/pegjs.js +85 -0
  117. package/dist/mode/perl.d.ts +2 -0
  118. package/dist/mode/perl.js +818 -0
  119. package/dist/mode/pig.d.ts +2 -0
  120. package/dist/mode/pig.js +147 -0
  121. package/dist/mode/powershell.d.ts +2 -0
  122. package/dist/mode/powershell.js +379 -0
  123. package/dist/mode/properties.d.ts +2 -0
  124. package/dist/mode/properties.js +60 -0
  125. package/dist/mode/protobuf.d.ts +2 -0
  126. package/dist/mode/protobuf.js +55 -0
  127. package/dist/mode/pug.d.ts +2 -0
  128. package/dist/mode/pug.js +502 -0
  129. package/dist/mode/puppet.d.ts +2 -0
  130. package/dist/mode/puppet.js +203 -0
  131. package/dist/mode/python.d.ts +3 -0
  132. package/dist/mode/python.js +388 -0
  133. package/dist/mode/q.d.ts +2 -0
  134. package/dist/mode/q.js +124 -0
  135. package/dist/mode/r.d.ts +2 -0
  136. package/dist/mode/r.js +172 -0
  137. package/dist/mode/rpm.d.ts +3 -0
  138. package/dist/mode/rpm.js +88 -0
  139. package/dist/mode/ruby.d.ts +2 -0
  140. package/dist/mode/ruby.js +287 -0
  141. package/dist/mode/rust.d.ts +2 -0
  142. package/dist/mode/rust.js +54 -0
  143. package/dist/mode/sas.d.ts +2 -0
  144. package/dist/mode/sas.js +266 -0
  145. package/dist/mode/sass.d.ts +2 -0
  146. package/dist/mode/sass.js +427 -0
  147. package/dist/mode/scheme.d.ts +2 -0
  148. package/dist/mode/scheme.js +261 -0
  149. package/dist/mode/shell.d.ts +2 -0
  150. package/dist/mode/shell.js +146 -0
  151. package/dist/mode/sieve.d.ts +2 -0
  152. package/dist/mode/sieve.js +176 -0
  153. package/dist/mode/simple-mode.d.ts +14 -0
  154. package/dist/mode/simple-mode.js +136 -0
  155. package/dist/mode/smalltalk.d.ts +2 -0
  156. package/dist/mode/smalltalk.js +151 -0
  157. package/dist/mode/solr.d.ts +2 -0
  158. package/dist/mode/solr.js +78 -0
  159. package/dist/mode/sparql.d.ts +2 -0
  160. package/dist/mode/sparql.js +169 -0
  161. package/dist/mode/spreadsheet.d.ts +2 -0
  162. package/dist/mode/spreadsheet.js +96 -0
  163. package/dist/mode/sql.d.ts +27 -0
  164. package/dist/mode/sql.js +481 -0
  165. package/dist/mode/stex.d.ts +3 -0
  166. package/dist/mode/stex.js +245 -0
  167. package/dist/mode/stylus.d.ts +2 -0
  168. package/dist/mode/stylus.js +747 -0
  169. package/dist/mode/swift.d.ts +2 -0
  170. package/dist/mode/swift.js +200 -0
  171. package/dist/mode/tcl.d.ts +2 -0
  172. package/dist/mode/tcl.js +123 -0
  173. package/dist/mode/textile.d.ts +2 -0
  174. package/dist/mode/textile.js +440 -0
  175. package/dist/mode/tiddlywiki.d.ts +2 -0
  176. package/dist/mode/tiddlywiki.js +277 -0
  177. package/dist/mode/tiki.d.ts +2 -0
  178. package/dist/mode/tiki.js +291 -0
  179. package/dist/mode/toml.d.ts +2 -0
  180. package/dist/mode/toml.js +74 -0
  181. package/dist/mode/troff.d.ts +2 -0
  182. package/dist/mode/troff.js +63 -0
  183. package/dist/mode/ttcn-cfg.d.ts +2 -0
  184. package/dist/mode/ttcn-cfg.js +199 -0
  185. package/dist/mode/ttcn.d.ts +2 -0
  186. package/dist/mode/ttcn.js +255 -0
  187. package/dist/mode/turtle.d.ts +2 -0
  188. package/dist/mode/turtle.js +145 -0
  189. package/dist/mode/vb.d.ts +2 -0
  190. package/dist/mode/vb.js +254 -0
  191. package/dist/mode/vbscript.d.ts +3 -0
  192. package/dist/mode/vbscript.js +320 -0
  193. package/dist/mode/velocity.d.ts +2 -0
  194. package/dist/mode/velocity.js +184 -0
  195. package/dist/mode/verilog.d.ts +3 -0
  196. package/dist/mode/verilog.js +601 -0
  197. package/dist/mode/vhdl.d.ts +2 -0
  198. package/dist/mode/vhdl.js +172 -0
  199. package/dist/mode/wast.d.ts +2 -0
  200. package/dist/mode/wast.js +119 -0
  201. package/dist/mode/webidl.d.ts +2 -0
  202. package/dist/mode/webidl.js +179 -0
  203. package/dist/mode/xml.d.ts +3 -0
  204. package/dist/mode/xml.js +397 -0
  205. package/dist/mode/xquery.d.ts +2 -0
  206. package/dist/mode/xquery.js +415 -0
  207. package/dist/mode/yacas.d.ts +2 -0
  208. package/dist/mode/yacas.js +181 -0
  209. package/dist/mode/yaml.d.ts +2 -0
  210. package/dist/mode/yaml.js +101 -0
  211. package/dist/mode/z80.d.ts +3 -0
  212. package/dist/mode/z80.js +101 -0
  213. package/mode/README.md +52 -0
  214. package/mode/apl.d.ts +2 -0
  215. package/mode/apl.js +140 -0
  216. package/mode/asciiarmor.d.ts +2 -0
  217. package/mode/asciiarmor.js +54 -0
  218. package/mode/asn1.d.ts +12 -0
  219. package/mode/asn1.js +190 -0
  220. package/mode/asterisk.d.ts +2 -0
  221. package/mode/asterisk.js +186 -0
  222. package/mode/brainfuck.d.ts +2 -0
  223. package/mode/brainfuck.js +68 -0
  224. package/mode/clike.d.ts +35 -0
  225. package/mode/clike.js +1019 -0
  226. package/mode/clojure.d.ts +2 -0
  227. package/mode/clojure.js +272 -0
  228. package/mode/cmake.d.ts +2 -0
  229. package/mode/cmake.js +80 -0
  230. package/mode/cobol.d.ts +2 -0
  231. package/mode/cobol.js +234 -0
  232. package/mode/coffeescript.d.ts +2 -0
  233. package/mode/coffeescript.js +327 -0
  234. package/mode/commonlisp.d.ts +2 -0
  235. package/mode/commonlisp.js +107 -0
  236. package/mode/crystal.d.ts +2 -0
  237. package/mode/crystal.js +417 -0
  238. package/mode/css.d.ts +5 -0
  239. package/mode/css.js +846 -0
  240. package/mode/cypher.d.ts +2 -0
  241. package/mode/cypher.js +120 -0
  242. package/mode/d.d.ts +2 -0
  243. package/mode/d.js +203 -0
  244. package/mode/diff.d.ts +2 -0
  245. package/mode/diff.js +29 -0
  246. package/mode/dockerfile.d.ts +2 -0
  247. package/mode/dockerfile.js +198 -0
  248. package/mode/dtd.d.ts +2 -0
  249. package/mode/dtd.js +120 -0
  250. package/mode/dylan.d.ts +2 -0
  251. package/mode/dylan.js +336 -0
  252. package/mode/ebnf.d.ts +2 -0
  253. package/mode/ebnf.js +149 -0
  254. package/mode/ecl.d.ts +2 -0
  255. package/mode/ecl.js +188 -0
  256. package/mode/eiffel.d.ts +2 -0
  257. package/mode/eiffel.js +145 -0
  258. package/mode/elm.d.ts +2 -0
  259. package/mode/elm.js +228 -0
  260. package/mode/erlang.d.ts +2 -0
  261. package/mode/erlang.js +580 -0
  262. package/mode/factor.d.ts +2 -0
  263. package/mode/factor.js +63 -0
  264. package/mode/fcl.d.ts +2 -0
  265. package/mode/fcl.js +153 -0
  266. package/mode/forth.d.ts +2 -0
  267. package/mode/forth.js +162 -0
  268. package/mode/fortran.d.ts +2 -0
  269. package/mode/fortran.js +171 -0
  270. package/mode/gas.d.ts +3 -0
  271. package/mode/gas.js +342 -0
  272. package/mode/gherkin.d.ts +2 -0
  273. package/mode/gherkin.js +146 -0
  274. package/mode/go.d.ts +2 -0
  275. package/mode/go.js +163 -0
  276. package/mode/groovy.d.ts +2 -0
  277. package/mode/groovy.js +226 -0
  278. package/mode/haskell.d.ts +2 -0
  279. package/mode/haskell.js +238 -0
  280. package/mode/haxe.d.ts +3 -0
  281. package/mode/haxe.js +490 -0
  282. package/mode/http.d.ts +2 -0
  283. package/mode/http.js +87 -0
  284. package/mode/idl.d.ts +2 -0
  285. package/mode/idl.js +274 -0
  286. package/mode/javascript.d.ts +5 -0
  287. package/mode/javascript.js +922 -0
  288. package/mode/jinja2.d.ts +2 -0
  289. package/mode/jinja2.js +170 -0
  290. package/mode/julia.d.ts +2 -0
  291. package/mode/julia.js +367 -0
  292. package/mode/livescript.d.ts +2 -0
  293. package/mode/livescript.js +257 -0
  294. package/mode/lua.d.ts +2 -0
  295. package/mode/lua.js +135 -0
  296. package/mode/mathematica.d.ts +2 -0
  297. package/mode/mathematica.js +153 -0
  298. package/mode/mbox.d.ts +2 -0
  299. package/mode/mbox.js +114 -0
  300. package/mode/mirc.d.ts +2 -0
  301. package/mode/mirc.js +174 -0
  302. package/mode/mllike.d.ts +4 -0
  303. package/mode/mllike.js +346 -0
  304. package/mode/modelica.d.ts +2 -0
  305. package/mode/modelica.js +190 -0
  306. package/mode/mscgen.d.ts +4 -0
  307. package/mode/mscgen.js +147 -0
  308. package/mode/mumps.d.ts +2 -0
  309. package/mode/mumps.js +127 -0
  310. package/mode/nginx.d.ts +2 -0
  311. package/mode/nginx.js +161 -0
  312. package/mode/nsis.d.ts +2 -0
  313. package/mode/nsis.js +78 -0
  314. package/mode/ntriples.d.ts +2 -0
  315. package/mode/ntriples.js +139 -0
  316. package/mode/octave.d.ts +2 -0
  317. package/mode/octave.js +123 -0
  318. package/mode/oz.d.ts +2 -0
  319. package/mode/oz.js +233 -0
  320. package/mode/pascal.d.ts +2 -0
  321. package/mode/pascal.js +122 -0
  322. package/mode/pegjs.d.ts +2 -0
  323. package/mode/pegjs.js +85 -0
  324. package/mode/perl.d.ts +2 -0
  325. package/mode/perl.js +818 -0
  326. package/mode/pig.d.ts +2 -0
  327. package/mode/pig.js +147 -0
  328. package/mode/powershell.d.ts +2 -0
  329. package/mode/powershell.js +379 -0
  330. package/mode/properties.d.ts +2 -0
  331. package/mode/properties.js +60 -0
  332. package/mode/protobuf.d.ts +2 -0
  333. package/mode/protobuf.js +55 -0
  334. package/mode/pug.d.ts +2 -0
  335. package/mode/pug.js +502 -0
  336. package/mode/puppet.d.ts +2 -0
  337. package/mode/puppet.js +203 -0
  338. package/mode/python.d.ts +3 -0
  339. package/mode/python.js +388 -0
  340. package/mode/q.d.ts +2 -0
  341. package/mode/q.js +124 -0
  342. package/mode/r.d.ts +2 -0
  343. package/mode/r.js +172 -0
  344. package/mode/rpm.d.ts +3 -0
  345. package/mode/rpm.js +88 -0
  346. package/mode/ruby.d.ts +2 -0
  347. package/mode/ruby.js +287 -0
  348. package/mode/rust.d.ts +2 -0
  349. package/mode/rust.js +54 -0
  350. package/mode/sas.d.ts +2 -0
  351. package/mode/sas.js +266 -0
  352. package/mode/sass.d.ts +2 -0
  353. package/mode/sass.js +427 -0
  354. package/mode/scheme.d.ts +2 -0
  355. package/mode/scheme.js +261 -0
  356. package/mode/shell.d.ts +2 -0
  357. package/mode/shell.js +146 -0
  358. package/mode/sieve.d.ts +2 -0
  359. package/mode/sieve.js +176 -0
  360. package/mode/simple-mode.d.ts +14 -0
  361. package/mode/simple-mode.js +136 -0
  362. package/mode/smalltalk.d.ts +2 -0
  363. package/mode/smalltalk.js +151 -0
  364. package/mode/solr.d.ts +2 -0
  365. package/mode/solr.js +78 -0
  366. package/mode/sparql.d.ts +2 -0
  367. package/mode/sparql.js +169 -0
  368. package/mode/spreadsheet.d.ts +2 -0
  369. package/mode/spreadsheet.js +96 -0
  370. package/mode/sql.d.ts +27 -0
  371. package/mode/sql.js +481 -0
  372. package/mode/stex.d.ts +3 -0
  373. package/mode/stex.js +245 -0
  374. package/mode/stylus.d.ts +2 -0
  375. package/mode/stylus.js +747 -0
  376. package/mode/swift.d.ts +2 -0
  377. package/mode/swift.js +200 -0
  378. package/mode/tcl.d.ts +2 -0
  379. package/mode/tcl.js +123 -0
  380. package/mode/textile.d.ts +2 -0
  381. package/mode/textile.js +440 -0
  382. package/mode/tiddlywiki.d.ts +2 -0
  383. package/mode/tiddlywiki.js +277 -0
  384. package/mode/tiki.d.ts +2 -0
  385. package/mode/tiki.js +291 -0
  386. package/mode/toml.d.ts +2 -0
  387. package/mode/toml.js +74 -0
  388. package/mode/troff.d.ts +2 -0
  389. package/mode/troff.js +63 -0
  390. package/mode/ttcn-cfg.d.ts +2 -0
  391. package/mode/ttcn-cfg.js +199 -0
  392. package/mode/ttcn.d.ts +2 -0
  393. package/mode/ttcn.js +255 -0
  394. package/mode/turtle.d.ts +2 -0
  395. package/mode/turtle.js +145 -0
  396. package/mode/vb.d.ts +2 -0
  397. package/mode/vb.js +254 -0
  398. package/mode/vbscript.d.ts +3 -0
  399. package/mode/vbscript.js +320 -0
  400. package/mode/velocity.d.ts +2 -0
  401. package/mode/velocity.js +184 -0
  402. package/mode/verilog.d.ts +3 -0
  403. package/mode/verilog.js +601 -0
  404. package/mode/vhdl.d.ts +2 -0
  405. package/mode/vhdl.js +172 -0
  406. package/mode/wast.d.ts +2 -0
  407. package/mode/wast.js +119 -0
  408. package/mode/webidl.d.ts +2 -0
  409. package/mode/webidl.js +179 -0
  410. package/mode/xml.d.ts +3 -0
  411. package/mode/xml.js +397 -0
  412. package/mode/xquery.d.ts +2 -0
  413. package/mode/xquery.js +415 -0
  414. package/mode/yacas.d.ts +2 -0
  415. package/mode/yacas.js +181 -0
  416. package/mode/yaml.d.ts +2 -0
  417. package/mode/yaml.js +101 -0
  418. package/mode/z80.d.ts +3 -0
  419. package/mode/z80.js +101 -0
  420. package/package.json +37 -3
@@ -0,0 +1,101 @@
1
+ var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
2
+ var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
3
+
4
+ export const yaml = {
5
+ name: "yaml",
6
+ token: function(stream, state) {
7
+ var ch = stream.peek();
8
+ var esc = state.escaped;
9
+ state.escaped = false;
10
+ /* comments */
11
+ if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
12
+ stream.skipToEnd();
13
+ return "comment";
14
+ }
15
+
16
+ if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))
17
+ return "string";
18
+
19
+ if (state.literal && stream.indentation() > state.keyCol) {
20
+ stream.skipToEnd(); return "string";
21
+ } else if (state.literal) { state.literal = false; }
22
+ if (stream.sol()) {
23
+ state.keyCol = 0;
24
+ state.pair = false;
25
+ state.pairStart = false;
26
+ /* document start */
27
+ if(stream.match('---')) { return "def"; }
28
+ /* document end */
29
+ if (stream.match('...')) { return "def"; }
30
+ /* array list item */
31
+ if (stream.match(/^\s*-\s+/)) { return 'meta'; }
32
+ }
33
+ /* inline pairs/lists */
34
+ if (stream.match(/^(\{|\}|\[|\])/)) {
35
+ if (ch == '{')
36
+ state.inlinePairs++;
37
+ else if (ch == '}')
38
+ state.inlinePairs--;
39
+ else if (ch == '[')
40
+ state.inlineList++;
41
+ else
42
+ state.inlineList--;
43
+ return 'meta';
44
+ }
45
+
46
+ /* list separator */
47
+ if (state.inlineList > 0 && !esc && ch == ',') {
48
+ stream.next();
49
+ return 'meta';
50
+ }
51
+ /* pairs separator */
52
+ if (state.inlinePairs > 0 && !esc && ch == ',') {
53
+ state.keyCol = 0;
54
+ state.pair = false;
55
+ state.pairStart = false;
56
+ stream.next();
57
+ return 'meta';
58
+ }
59
+
60
+ /* start of value of a pair */
61
+ if (state.pairStart) {
62
+ /* block literals */
63
+ if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
64
+ /* references */
65
+ if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable'; }
66
+ /* numbers */
67
+ if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
68
+ if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
69
+ /* keywords */
70
+ if (stream.match(keywordRegex)) { return 'keyword'; }
71
+ }
72
+
73
+ /* pairs (associative arrays) -> key */
74
+ if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) {
75
+ state.pair = true;
76
+ state.keyCol = stream.indentation();
77
+ return "atom";
78
+ }
79
+ if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
80
+
81
+ /* nothing found, continue */
82
+ state.pairStart = false;
83
+ state.escaped = (ch == '\\');
84
+ stream.next();
85
+ return null;
86
+ },
87
+ startState: function() {
88
+ return {
89
+ pair: false,
90
+ pairStart: false,
91
+ keyCol: 0,
92
+ inlinePairs: 0,
93
+ inlineList: 0,
94
+ literal: false,
95
+ escaped: false
96
+ };
97
+ },
98
+ languageData: {
99
+ commentTokens: {line: "#"}
100
+ }
101
+ };
@@ -0,0 +1,3 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const z80: StreamParser<unknown>
3
+ export declare const ez80: StreamParser<unknown>
@@ -0,0 +1,101 @@
1
+ function mkZ80(ez80) {
2
+ var keywords1, keywords2;
3
+ if (ez80) {
4
+ keywords1 = /^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i;
5
+ keywords2 = /^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i;
6
+ } else {
7
+ keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i;
8
+ keywords2 = /^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i;
9
+ }
10
+
11
+ var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i;
12
+ var variables2 = /^(n?[zc]|p[oe]?|m)\b/i;
13
+ var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i;
14
+ var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i;
15
+
16
+ return {
17
+ name: "z80",
18
+ startState: function() {
19
+ return {
20
+ context: 0
21
+ };
22
+ },
23
+ token: function(stream, state) {
24
+ if (!stream.column())
25
+ state.context = 0;
26
+
27
+ if (stream.eatSpace())
28
+ return null;
29
+
30
+ var w;
31
+
32
+ if (stream.eatWhile(/\w/)) {
33
+ if (ez80 && stream.eat('.')) {
34
+ stream.eatWhile(/\w/);
35
+ }
36
+ w = stream.current();
37
+
38
+ if (stream.indentation()) {
39
+ if ((state.context == 1 || state.context == 4) && variables1.test(w)) {
40
+ state.context = 4;
41
+ return 'variable';
42
+ }
43
+
44
+ if (state.context == 2 && variables2.test(w)) {
45
+ state.context = 4;
46
+ return 'variableName.special';
47
+ }
48
+
49
+ if (keywords1.test(w)) {
50
+ state.context = 1;
51
+ return 'keyword';
52
+ } else if (keywords2.test(w)) {
53
+ state.context = 2;
54
+ return 'keyword';
55
+ } else if (state.context == 4 && numbers.test(w)) {
56
+ return 'number';
57
+ }
58
+
59
+ if (errors.test(w))
60
+ return 'error';
61
+ } else if (stream.match(numbers)) {
62
+ return 'number';
63
+ } else {
64
+ return null;
65
+ }
66
+ } else if (stream.eat(';')) {
67
+ stream.skipToEnd();
68
+ return 'comment';
69
+ } else if (stream.eat('"')) {
70
+ while (w = stream.next()) {
71
+ if (w == '"')
72
+ break;
73
+
74
+ if (w == '\\')
75
+ stream.next();
76
+ }
77
+ return 'string';
78
+ } else if (stream.eat('\'')) {
79
+ if (stream.match(/\\?.'/))
80
+ return 'number';
81
+ } else if (stream.eat('.') || stream.sol() && stream.eat('#')) {
82
+ state.context = 5;
83
+
84
+ if (stream.eatWhile(/\w/))
85
+ return 'def';
86
+ } else if (stream.eat('$')) {
87
+ if (stream.eatWhile(/[\da-f]/i))
88
+ return 'number';
89
+ } else if (stream.eat('%')) {
90
+ if (stream.eatWhile(/[01]/))
91
+ return 'number';
92
+ } else {
93
+ stream.next();
94
+ }
95
+ return null;
96
+ }
97
+ };
98
+ };
99
+
100
+ export const z80 = mkZ80(false)
101
+ export const ez80 = mkZ80(true)
package/mode/README.md ADDED
@@ -0,0 +1,52 @@
1
+ <!-- NOTE: README.md is generated from mode/README.md -->
2
+
3
+ # @codemirror/legacy-modes [![NPM version](https://img.shields.io/npm/v/@codemirror/legacy-modes.svg)](https://www.npmjs.org/package/@codemirror/legacy-modes)
4
+
5
+ [ [**WEBSITE**](https://codemirror.net/) | [**ISSUES**](https://code.haverbeke.berlin/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://code.haverbeke.berlin/codemirror/legacy-modes/src/branch/main/CHANGELOG.md) ]
6
+
7
+ This package implements a collection of ported [stream
8
+ language](https://codemirror.net/docs/ref#language.StreamParser) modes for
9
+ the [CodeMirror](https://codemirror.net/) code editor. Each mode is
10
+ available as a separate script file, under
11
+ `"@codemirror/legacy-modes/mode/[name]"`, and exports the values
12
+ listed below.
13
+
14
+ The [project page](https://codemirror.net/) has more information, a
15
+ number of [examples](https://codemirror.net/examples/) and the
16
+ [documentation](https://codemirror.net/docs/).
17
+
18
+ This code is released under an
19
+ [MIT license](https://code.haverbeke.berlin/codemirror/legacy-modes/tree/main/LICENSE).
20
+
21
+ We aim to be an inclusive, welcoming community. To make that explicit,
22
+ we have a [code of
23
+ conduct](http://contributor-covenant.org/version/1/1/0/) that applies
24
+ to communication around the project.
25
+
26
+ ## Usage
27
+
28
+ Using modes from this package works like this:
29
+
30
+ - Install this package and the
31
+ [`@codemirror/language`](https://codemirror.net/docs/ref/#language)
32
+ package.
33
+
34
+ - Find the `StreamParser` instance you need in the reference below.
35
+
36
+ - Add `StreamLanguage.define(theParser)` to your editor's
37
+ configuration.
38
+
39
+ For example, to load the Lua mode, you'd do something like...
40
+
41
+ ```javascript
42
+ import {StreamLanguage} from "@codemirror/language"
43
+ import {lua} from "@codemirror/legacy-modes/mode/lua"
44
+
45
+ import {EditorView, basicSetup} from "codemirror"
46
+
47
+ let view = new EditorView({
48
+ extensions: [basicSetup, StreamLanguage.define(lua)]
49
+ })
50
+ ```
51
+
52
+ ## API Reference
package/mode/apl.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const apl: StreamParser<unknown>
package/mode/apl.js ADDED
@@ -0,0 +1,140 @@
1
+ var builtInFuncs = {
2
+ "+": ["conjugate", "add"],
3
+ "−": ["negate", "subtract"],
4
+ "×": ["signOf", "multiply"],
5
+ "÷": ["reciprocal", "divide"],
6
+ "⌈": ["ceiling", "greaterOf"],
7
+ "⌊": ["floor", "lesserOf"],
8
+ "∣": ["absolute", "residue"],
9
+ "⍳": ["indexGenerate", "indexOf"],
10
+ "?": ["roll", "deal"],
11
+ "⋆": ["exponentiate", "toThePowerOf"],
12
+ "⍟": ["naturalLog", "logToTheBase"],
13
+ "○": ["piTimes", "circularFuncs"],
14
+ "!": ["factorial", "binomial"],
15
+ "⌹": ["matrixInverse", "matrixDivide"],
16
+ "<": [null, "lessThan"],
17
+ "≤": [null, "lessThanOrEqual"],
18
+ "=": [null, "equals"],
19
+ ">": [null, "greaterThan"],
20
+ "≥": [null, "greaterThanOrEqual"],
21
+ "≠": [null, "notEqual"],
22
+ "≡": ["depth", "match"],
23
+ "≢": [null, "notMatch"],
24
+ "∈": ["enlist", "membership"],
25
+ "⍷": [null, "find"],
26
+ "∪": ["unique", "union"],
27
+ "∩": [null, "intersection"],
28
+ "∼": ["not", "without"],
29
+ "∨": [null, "or"],
30
+ "∧": [null, "and"],
31
+ "⍱": [null, "nor"],
32
+ "⍲": [null, "nand"],
33
+ "⍴": ["shapeOf", "reshape"],
34
+ ",": ["ravel", "catenate"],
35
+ "⍪": [null, "firstAxisCatenate"],
36
+ "⌽": ["reverse", "rotate"],
37
+ "⊖": ["axis1Reverse", "axis1Rotate"],
38
+ "⍉": ["transpose", null],
39
+ "↑": ["first", "take"],
40
+ "↓": [null, "drop"],
41
+ "⊂": ["enclose", "partitionWithAxis"],
42
+ "⊃": ["diclose", "pick"],
43
+ "⌷": [null, "index"],
44
+ "⍋": ["gradeUp", null],
45
+ "⍒": ["gradeDown", null],
46
+ "⊤": ["encode", null],
47
+ "⊥": ["decode", null],
48
+ "⍕": ["format", "formatByExample"],
49
+ "⍎": ["execute", null],
50
+ "⊣": ["stop", "left"],
51
+ "⊢": ["pass", "right"]
52
+ };
53
+
54
+ var isOperator = /[\.\/⌿⍀¨⍣]/;
55
+ var isNiladic = /⍬/;
56
+ var isFunction = /[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/;
57
+ var isArrow = /←/;
58
+ var isComment = /[⍝#].*$/;
59
+
60
+ var stringEater = function(type) {
61
+ var prev;
62
+ prev = false;
63
+ return function(c) {
64
+ prev = c;
65
+ if (c === type) {
66
+ return prev === "\\";
67
+ }
68
+ return true;
69
+ };
70
+ };
71
+
72
+ export const apl = {
73
+ name: "apl",
74
+ startState: function() {
75
+ return {
76
+ prev: false,
77
+ func: false,
78
+ op: false,
79
+ string: false,
80
+ escape: false
81
+ };
82
+ },
83
+ token: function(stream, state) {
84
+ var ch;
85
+ if (stream.eatSpace()) {
86
+ return null;
87
+ }
88
+ ch = stream.next();
89
+ if (ch === '"' || ch === "'") {
90
+ stream.eatWhile(stringEater(ch));
91
+ stream.next();
92
+ state.prev = true;
93
+ return "string";
94
+ }
95
+ if (/[\[{\(]/.test(ch)) {
96
+ state.prev = false;
97
+ return null;
98
+ }
99
+ if (/[\]}\)]/.test(ch)) {
100
+ state.prev = true;
101
+ return null;
102
+ }
103
+ if (isNiladic.test(ch)) {
104
+ state.prev = false;
105
+ return "atom";
106
+ }
107
+ if (/[¯\d]/.test(ch)) {
108
+ if (state.func) {
109
+ state.func = false;
110
+ state.prev = false;
111
+ } else {
112
+ state.prev = true;
113
+ }
114
+ stream.eatWhile(/[\w\.]/);
115
+ return "number";
116
+ }
117
+ if (isOperator.test(ch)) {
118
+ return "operator"
119
+ }
120
+ if (isArrow.test(ch)) {
121
+ return "operator";
122
+ }
123
+ if (isFunction.test(ch)) {
124
+ state.func = true;
125
+ state.prev = false;
126
+ return builtInFuncs[ch] ? "variableName.function.standard" : "variableName.function"
127
+ }
128
+ if (isComment.test(ch)) {
129
+ stream.skipToEnd();
130
+ return "comment";
131
+ }
132
+ if (ch === "∘" && stream.peek() === ".") {
133
+ stream.next();
134
+ return "variableName.function";
135
+ }
136
+ stream.eatWhile(/[\w\$_]/);
137
+ state.prev = true;
138
+ return "keyword";
139
+ }
140
+ }
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const asciiArmor: StreamParser<unknown>
@@ -0,0 +1,54 @@
1
+ function errorIfNotEmpty(stream) {
2
+ var nonWS = stream.match(/^\s*\S/);
3
+ stream.skipToEnd();
4
+ return nonWS ? "error" : null;
5
+ }
6
+
7
+ export const asciiArmor = {
8
+ name: "asciiarmor",
9
+ token: function(stream, state) {
10
+ var m;
11
+ if (state.state == "top") {
12
+ if (stream.sol() && (m = stream.match(/^-----BEGIN (.*)?-----\s*$/))) {
13
+ state.state = "headers";
14
+ state.type = m[1];
15
+ return "tag";
16
+ }
17
+ return errorIfNotEmpty(stream);
18
+ } else if (state.state == "headers") {
19
+ if (stream.sol() && stream.match(/^\w+:/)) {
20
+ state.state = "header";
21
+ return "atom";
22
+ } else {
23
+ var result = errorIfNotEmpty(stream);
24
+ if (result) state.state = "body";
25
+ return result;
26
+ }
27
+ } else if (state.state == "header") {
28
+ stream.skipToEnd();
29
+ state.state = "headers";
30
+ return "string";
31
+ } else if (state.state == "body") {
32
+ if (stream.sol() && (m = stream.match(/^-----END (.*)?-----\s*$/))) {
33
+ if (m[1] != state.type) return "error";
34
+ state.state = "end";
35
+ return "tag";
36
+ } else {
37
+ if (stream.eatWhile(/[A-Za-z0-9+\/=]/)) {
38
+ return null;
39
+ } else {
40
+ stream.next();
41
+ return "error";
42
+ }
43
+ }
44
+ } else if (state.state == "end") {
45
+ return errorIfNotEmpty(stream);
46
+ }
47
+ },
48
+ blankLine: function(state) {
49
+ if (state.state == "headers") state.state = "body";
50
+ },
51
+ startState: function() {
52
+ return {state: "top", type: null};
53
+ }
54
+ };
package/mode/asn1.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare function asn1(conf: {
3
+ keywords?: {[word: string]: any},
4
+ cmipVerbs?: {[word: string]: any},
5
+ compareTypes?: {[word: string]: any},
6
+ status?: {[word: string]: any},
7
+ tags?: {[word: string]: any},
8
+ storage?: {[word: string]: any},
9
+ modifier?: {[word: string]: any},
10
+ accessTypes?: {[word: string]: any},
11
+ multiLineStrings?: boolean
12
+ }): StreamParser<unknown>
package/mode/asn1.js ADDED
@@ -0,0 +1,190 @@
1
+ function words(str) {
2
+ var obj = {}, words = str.split(" ");
3
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
4
+ return obj;
5
+ }
6
+
7
+ const defaults = {
8
+ keywords: words("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION" +
9
+ " REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED" +
10
+ " WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN" +
11
+ " IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS" +
12
+ " MINACCESS MAXACCESS REVISION STATUS DESCRIPTION" +
13
+ " SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName" +
14
+ " ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY" +
15
+ " IMPLIED EXPORTS"),
16
+ cmipVerbs: words("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),
17
+ compareTypes: words("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY" +
18
+ " MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY" +
19
+ " OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL" +
20
+ " SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL" +
21
+ " TEXTUAL-CONVENTION"),
22
+ status: words("current deprecated mandatory obsolete"),
23
+ tags: words("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS" +
24
+ " UNIVERSAL"),
25
+ storage: words("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING" +
26
+ " UTCTime InterfaceIndex IANAifType CMIP-Attribute" +
27
+ " REAL PACKAGE PACKAGES IpAddress PhysAddress" +
28
+ " NetworkAddress BITS BMPString TimeStamp TimeTicks" +
29
+ " TruthValue RowStatus DisplayString GeneralString" +
30
+ " GraphicString IA5String NumericString" +
31
+ " PrintableString SnmpAdminString TeletexString" +
32
+ " UTF8String VideotexString VisibleString StringStore" +
33
+ " ISO646String T61String UniversalString Unsigned32" +
34
+ " Integer32 Gauge Gauge32 Counter Counter32 Counter64"),
35
+ modifier: words("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS" +
36
+ " GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS" +
37
+ " DEFINED"),
38
+ accessTypes: words("not-accessible accessible-for-notify read-only" +
39
+ " read-create read-write"),
40
+ multiLineStrings: true
41
+ }
42
+
43
+ export function asn1(parserConfig) {
44
+ var keywords = parserConfig.keywords || defaults.keywords,
45
+ cmipVerbs = parserConfig.cmipVerbs || defaults.cmipVerbs,
46
+ compareTypes = parserConfig.compareTypes || defaults.compareTypes,
47
+ status = parserConfig.status || defaults.status,
48
+ tags = parserConfig.tags || defaults.tags,
49
+ storage = parserConfig.storage || defaults.storage,
50
+ modifier = parserConfig.modifier || defaults.modifier,
51
+ accessTypes = parserConfig.accessTypes|| defaults.accessTypes,
52
+ multiLineStrings = parserConfig.multiLineStrings || defaults.multiLineStrings,
53
+ indentStatements = parserConfig.indentStatements !== false;
54
+ var isOperatorChar = /[\|\^]/;
55
+ var curPunc;
56
+
57
+ function tokenBase(stream, state) {
58
+ var ch = stream.next();
59
+ if (ch == '"' || ch == "'") {
60
+ state.tokenize = tokenString(ch);
61
+ return state.tokenize(stream, state);
62
+ }
63
+ if (/[\[\]\(\){}:=,;]/.test(ch)) {
64
+ curPunc = ch;
65
+ return "punctuation";
66
+ }
67
+ if (ch == "-"){
68
+ if (stream.eat("-")) {
69
+ stream.skipToEnd();
70
+ return "comment";
71
+ }
72
+ }
73
+ if (/\d/.test(ch)) {
74
+ stream.eatWhile(/[\w\.]/);
75
+ return "number";
76
+ }
77
+ if (isOperatorChar.test(ch)) {
78
+ stream.eatWhile(isOperatorChar);
79
+ return "operator";
80
+ }
81
+
82
+ stream.eatWhile(/[\w\-]/);
83
+ var cur = stream.current();
84
+ if (keywords.propertyIsEnumerable(cur)) return "keyword";
85
+ if (cmipVerbs.propertyIsEnumerable(cur)) return "variableName";
86
+ if (compareTypes.propertyIsEnumerable(cur)) return "atom";
87
+ if (status.propertyIsEnumerable(cur)) return "comment";
88
+ if (tags.propertyIsEnumerable(cur)) return "typeName";
89
+ if (storage.propertyIsEnumerable(cur)) return "modifier";
90
+ if (modifier.propertyIsEnumerable(cur)) return "modifier";
91
+ if (accessTypes.propertyIsEnumerable(cur)) return "modifier";
92
+
93
+ return "variableName";
94
+ }
95
+
96
+ function tokenString(quote) {
97
+ return function(stream, state) {
98
+ var escaped = false, next, end = false;
99
+ while ((next = stream.next()) != null) {
100
+ if (next == quote && !escaped){
101
+ var afterNext = stream.peek();
102
+ //look if the character if the quote is like the B in '10100010'B
103
+ if (afterNext){
104
+ afterNext = afterNext.toLowerCase();
105
+ if(afterNext == "b" || afterNext == "h" || afterNext == "o")
106
+ stream.next();
107
+ }
108
+ end = true; break;
109
+ }
110
+ escaped = !escaped && next == "\\";
111
+ }
112
+ if (end || !(escaped || multiLineStrings))
113
+ state.tokenize = null;
114
+ return "string";
115
+ };
116
+ }
117
+
118
+ function Context(indented, column, type, align, prev) {
119
+ this.indented = indented;
120
+ this.column = column;
121
+ this.type = type;
122
+ this.align = align;
123
+ this.prev = prev;
124
+ }
125
+ function pushContext(state, col, type) {
126
+ var indent = state.indented;
127
+ if (state.context && state.context.type == "statement")
128
+ indent = state.context.indented;
129
+ return state.context = new Context(indent, col, type, null, state.context);
130
+ }
131
+ function popContext(state) {
132
+ var t = state.context.type;
133
+ if (t == ")" || t == "]" || t == "}")
134
+ state.indented = state.context.indented;
135
+ return state.context = state.context.prev;
136
+ }
137
+
138
+ //Interface
139
+ return {
140
+ name: "asn1",
141
+ startState: function() {
142
+ return {
143
+ tokenize: null,
144
+ context: new Context(-2, 0, "top", false),
145
+ indented: 0,
146
+ startOfLine: true
147
+ };
148
+ },
149
+
150
+ token: function(stream, state) {
151
+ var ctx = state.context;
152
+ if (stream.sol()) {
153
+ if (ctx.align == null) ctx.align = false;
154
+ state.indented = stream.indentation();
155
+ state.startOfLine = true;
156
+ }
157
+ if (stream.eatSpace()) return null;
158
+ curPunc = null;
159
+ var style = (state.tokenize || tokenBase)(stream, state);
160
+ if (style == "comment") return style;
161
+ if (ctx.align == null) ctx.align = true;
162
+
163
+ if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
164
+ && ctx.type == "statement"){
165
+ popContext(state);
166
+ }
167
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
168
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
169
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
170
+ else if (curPunc == "}") {
171
+ while (ctx.type == "statement") ctx = popContext(state);
172
+ if (ctx.type == "}") ctx = popContext(state);
173
+ while (ctx.type == "statement") ctx = popContext(state);
174
+ }
175
+ else if (curPunc == ctx.type) popContext(state);
176
+ else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
177
+ && curPunc != ';') || (ctx.type == "statement"
178
+ && curPunc == "newstatement")))
179
+ pushContext(state, stream.column(), "statement");
180
+
181
+ state.startOfLine = false;
182
+ return style;
183
+ },
184
+
185
+ languageData: {
186
+ indentOnInput: /^\s*[{}]$/,
187
+ commentTokens: {line: "--"}
188
+ }
189
+ };
190
+ };
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const asterisk: StreamParser<unknown>