@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
package/mode/nsis.js ADDED
@@ -0,0 +1,78 @@
1
+ import {simpleMode} from "./simple-mode.js"
2
+ export const nsis = simpleMode({
3
+ start:[
4
+ // Numbers
5
+ {regex: /(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/, token: "number"},
6
+
7
+ // Strings
8
+ { regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
9
+ { regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
10
+ { regex: /`(?:[^\\`]|\\.)*`?/, token: "string" },
11
+
12
+ // Compile Time Commands
13
+ {regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|appendmemfile|assert|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|macroundef|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i, token: "keyword"},
14
+
15
+ // Conditional Compilation
16
+ {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/i, token: "keyword", indent: true},
17
+ {regex: /^\s*(?:\!(else|endif|macroend))\b/i, token: "keyword", dedent: true},
18
+
19
+ // Runtime Commands
20
+ {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetRegView|GetShellVarContext|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfAltRegView|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestAppendCustomString|ManifestDisableWindowFiltering|ManifestDPIAware|ManifestDPIAwareness|ManifestGdiScaling|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadMemory|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionInstType|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressionLevel|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UnsafeStrCpy|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/i, token: "keyword"},
21
+ {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/i, token: "keyword", indent: true},
22
+ {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/i, token: "keyword", dedent: true},
23
+
24
+ // Command Options
25
+ {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOW|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/i, token: "atom"},
26
+ {regex: /\b(?:admin|all|amd64-unicode|auto|both|bottom|bzip2|components|current|custom|default|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|Win8\.1|WinVista|x86-(ansi|unicode)|zlib)\b/i, token: "builtin"},
27
+
28
+ // LogicLib.nsh
29
+ {regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:2|3|4|5|Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i, token: "variable-2", indent: true},
30
+
31
+ // FileFunc.nsh
32
+ {regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/i, token: "variable-2", dedent: true},
33
+
34
+ // Memento.nsh
35
+ {regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/i, token: "variable-2", dedent: true},
36
+
37
+ // TextFunc.nsh
38
+ {regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/i, token: "variable-2", dedent: true},
39
+
40
+ // WinVer.nsh
41
+ {regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|8\.1|10|11|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/i, token: "variable", dedent: true},
42
+
43
+ // WordFunc.nsh
44
+ {regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/i, token: "keyword", dedent: true},
45
+
46
+ // x64.nsh
47
+ {regex: /\$\{(?:RunningX64)\}/i, token: "variable", dedent: true},
48
+ {regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/i, token: "keyword", dedent: true},
49
+
50
+ // Line Comment
51
+ {regex: /(#|;).*/, token: "comment"},
52
+
53
+ // Block Comment
54
+ {regex: /\/\*/, token: "comment", next: "comment"},
55
+
56
+ // Operator
57
+ {regex: /[-+\/*=<>!]+/, token: "operator"},
58
+
59
+ // Variable
60
+ {regex: /\$\w[\w\.]*/, token: "variable"},
61
+
62
+ // Constant
63
+ {regex: /\${[\!\w\.:-]+}/, token: "variableName.constant"},
64
+
65
+ // Language String
66
+ {regex: /\$\([\!\w\.:-]+\)/, token: "atom"}
67
+ ],
68
+ comment: [
69
+ {regex: /.*?\*\//, token: "comment", next: "start"},
70
+ {regex: /.*/, token: "comment"}
71
+ ],
72
+ languageData: {
73
+ name: "nsis",
74
+ indentOnInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/i,
75
+ commentTokens: {line: "#", block: {open: "/*", close: "*/"}}
76
+ }
77
+ });
78
+
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const ntriples: StreamParser<unknown>
@@ -0,0 +1,139 @@
1
+ var Location = {
2
+ PRE_SUBJECT : 0,
3
+ WRITING_SUB_URI : 1,
4
+ WRITING_BNODE_URI : 2,
5
+ PRE_PRED : 3,
6
+ WRITING_PRED_URI : 4,
7
+ PRE_OBJ : 5,
8
+ WRITING_OBJ_URI : 6,
9
+ WRITING_OBJ_BNODE : 7,
10
+ WRITING_OBJ_LITERAL : 8,
11
+ WRITING_LIT_LANG : 9,
12
+ WRITING_LIT_TYPE : 10,
13
+ POST_OBJ : 11,
14
+ ERROR : 12
15
+ };
16
+ function transitState(currState, c) {
17
+ var currLocation = currState.location;
18
+ var ret;
19
+
20
+ // Opening.
21
+ if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI;
22
+ else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI;
23
+ else if(currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI;
24
+ else if(currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI;
25
+ else if(currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE;
26
+ else if(currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL;
27
+
28
+ // Closing.
29
+ else if(currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED;
30
+ else if(currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED;
31
+ else if(currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ;
32
+ else if(currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ;
33
+ else if(currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ;
34
+ else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ;
35
+ else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ;
36
+ else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ;
37
+
38
+ // Closing typed and language literal.
39
+ else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG;
40
+ else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE;
41
+
42
+ // Spaces.
43
+ else if( c == ' ' &&
44
+ (
45
+ currLocation == Location.PRE_SUBJECT ||
46
+ currLocation == Location.PRE_PRED ||
47
+ currLocation == Location.PRE_OBJ ||
48
+ currLocation == Location.POST_OBJ
49
+ )
50
+ ) ret = currLocation;
51
+
52
+ // Reset.
53
+ else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT;
54
+
55
+ // Error
56
+ else ret = Location.ERROR;
57
+
58
+ currState.location=ret;
59
+ }
60
+
61
+ export const ntriples = {
62
+ name: "ntriples",
63
+ startState: function() {
64
+ return {
65
+ location : Location.PRE_SUBJECT,
66
+ uris : [],
67
+ anchors : [],
68
+ bnodes : [],
69
+ langs : [],
70
+ types : []
71
+ };
72
+ },
73
+ token: function(stream, state) {
74
+ var ch = stream.next();
75
+ if(ch == '<') {
76
+ transitState(state, ch);
77
+ var parsedURI = '';
78
+ stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} );
79
+ state.uris.push(parsedURI);
80
+ if( stream.match('#', false) ) return 'variable';
81
+ stream.next();
82
+ transitState(state, '>');
83
+ return 'variable';
84
+ }
85
+ if(ch == '#') {
86
+ var parsedAnchor = '';
87
+ stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false;});
88
+ state.anchors.push(parsedAnchor);
89
+ return 'url';
90
+ }
91
+ if(ch == '>') {
92
+ transitState(state, '>');
93
+ return 'variable';
94
+ }
95
+ if(ch == '_') {
96
+ transitState(state, ch);
97
+ var parsedBNode = '';
98
+ stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;});
99
+ state.bnodes.push(parsedBNode);
100
+ stream.next();
101
+ transitState(state, ' ');
102
+ return 'builtin';
103
+ }
104
+ if(ch == '"') {
105
+ transitState(state, ch);
106
+ stream.eatWhile( function(c) { return c != '"'; } );
107
+ stream.next();
108
+ if( stream.peek() != '@' && stream.peek() != '^' ) {
109
+ transitState(state, '"');
110
+ }
111
+ return 'string';
112
+ }
113
+ if( ch == '@' ) {
114
+ transitState(state, '@');
115
+ var parsedLang = '';
116
+ stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;});
117
+ state.langs.push(parsedLang);
118
+ stream.next();
119
+ transitState(state, ' ');
120
+ return 'string.special';
121
+ }
122
+ if( ch == '^' ) {
123
+ stream.next();
124
+ transitState(state, '^');
125
+ var parsedType = '';
126
+ stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} );
127
+ state.types.push(parsedType);
128
+ stream.next();
129
+ transitState(state, '>');
130
+ return 'variable';
131
+ }
132
+ if( ch == ' ' ) {
133
+ transitState(state, ch);
134
+ }
135
+ if( ch == '.' ) {
136
+ transitState(state, ch);
137
+ }
138
+ }
139
+ };
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const octave: StreamParser<unknown>
package/mode/octave.js ADDED
@@ -0,0 +1,123 @@
1
+ function wordRegexp(words) {
2
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
3
+ }
4
+
5
+ var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]");
6
+ var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;\\.]');
7
+ var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))");
8
+ var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))");
9
+ var tripleDelimiters = new RegExp("^((>>=)|(<<=))");
10
+ var expressionEnd = new RegExp("^[\\]\\)]");
11
+ var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*");
12
+
13
+ var builtins = wordRegexp([
14
+ 'error', 'eval', 'function', 'abs', 'acos', 'atan', 'asin', 'cos',
15
+ 'cosh', 'exp', 'log', 'prod', 'sum', 'log10', 'max', 'min', 'sign', 'sin', 'sinh',
16
+ 'sqrt', 'tan', 'reshape', 'break', 'zeros', 'default', 'margin', 'round', 'ones',
17
+ 'rand', 'syn', 'ceil', 'floor', 'size', 'clear', 'zeros', 'eye', 'mean', 'std', 'cov',
18
+ 'det', 'eig', 'inv', 'norm', 'rank', 'trace', 'expm', 'logm', 'sqrtm', 'linspace', 'plot',
19
+ 'title', 'xlabel', 'ylabel', 'legend', 'text', 'grid', 'meshgrid', 'mesh', 'num2str',
20
+ 'fft', 'ifft', 'arrayfun', 'cellfun', 'input', 'fliplr', 'flipud', 'ismember'
21
+ ]);
22
+
23
+ var keywords = wordRegexp([
24
+ 'return', 'case', 'switch', 'else', 'elseif', 'end', 'endif', 'endfunction',
25
+ 'if', 'otherwise', 'do', 'for', 'while', 'try', 'catch', 'classdef', 'properties', 'events',
26
+ 'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'sprintf', 'disp', 'until',
27
+ 'continue', 'pkg'
28
+ ]);
29
+
30
+
31
+ // tokenizers
32
+ function tokenTranspose(stream, state) {
33
+ if (!stream.sol() && stream.peek() === '\'') {
34
+ stream.next();
35
+ state.tokenize = tokenBase;
36
+ return 'operator';
37
+ }
38
+ state.tokenize = tokenBase;
39
+ return tokenBase(stream, state);
40
+ }
41
+
42
+
43
+ function tokenComment(stream, state) {
44
+ if (stream.match(/^.*%}/)) {
45
+ state.tokenize = tokenBase;
46
+ return 'comment';
47
+ };
48
+ stream.skipToEnd();
49
+ return 'comment';
50
+ }
51
+
52
+ function tokenBase(stream, state) {
53
+ // whitespaces
54
+ if (stream.eatSpace()) return null;
55
+
56
+ // Handle one line Comments
57
+ if (stream.match('%{')){
58
+ state.tokenize = tokenComment;
59
+ stream.skipToEnd();
60
+ return 'comment';
61
+ }
62
+
63
+ if (stream.match(/^[%#]/)){
64
+ stream.skipToEnd();
65
+ return 'comment';
66
+ }
67
+
68
+ // Handle Number Literals
69
+ if (stream.match(/^[0-9\.+-]/, false)) {
70
+ if (stream.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/)) {
71
+ stream.tokenize = tokenBase;
72
+ return 'number'; };
73
+ if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; };
74
+ if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; };
75
+ }
76
+ if (stream.match(wordRegexp(['nan','NaN','inf','Inf']))) { return 'number'; };
77
+
78
+ // Handle Strings
79
+ var m = stream.match(/^"(?:[^"]|"")*("|$)/) || stream.match(/^'(?:[^']|'')*('|$)/)
80
+ if (m) { return m[1] ? 'string' : "error"; }
81
+
82
+ // Handle words
83
+ if (stream.match(keywords)) { return 'keyword'; } ;
84
+ if (stream.match(builtins)) { return 'builtin'; } ;
85
+ if (stream.match(identifiers)) { return 'variable'; } ;
86
+
87
+ if (stream.match(singleOperators) || stream.match(doubleOperators)) { return 'operator'; };
88
+ if (stream.match(singleDelimiters) || stream.match(doubleDelimiters) || stream.match(tripleDelimiters)) { return null; };
89
+
90
+ if (stream.match(expressionEnd)) {
91
+ state.tokenize = tokenTranspose;
92
+ return null;
93
+ };
94
+
95
+
96
+ // Handle non-detected items
97
+ stream.next();
98
+ return 'error';
99
+ };
100
+
101
+
102
+ export const octave = {
103
+ name: "octave",
104
+
105
+ startState: function() {
106
+ return {
107
+ tokenize: tokenBase
108
+ };
109
+ },
110
+
111
+ token: function(stream, state) {
112
+ var style = state.tokenize(stream, state);
113
+ if (style === 'number' || style === 'variable'){
114
+ state.tokenize = tokenTranspose;
115
+ }
116
+ return style;
117
+ },
118
+
119
+ languageData: {
120
+ commentTokens: {line: "%"}
121
+ }
122
+ };
123
+
package/mode/oz.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const oz: StreamParser<unknown>
package/mode/oz.js ADDED
@@ -0,0 +1,233 @@
1
+ function wordRegexp(words) {
2
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
3
+ }
4
+
5
+ var singleOperators = /[\^@!\|<>#~\.\*\-\+\\/,=]/;
6
+ var doubleOperators = /(<-)|(:=)|(=<)|(>=)|(<=)|(<:)|(>:)|(=:)|(\\=)|(\\=:)|(!!)|(==)|(::)/;
7
+ var tripleOperators = /(:::)|(\.\.\.)|(=<:)|(>=:)/;
8
+
9
+ var middle = ["in", "then", "else", "of", "elseof", "elsecase", "elseif", "catch",
10
+ "finally", "with", "require", "prepare", "import", "export", "define", "do"];
11
+ var end = ["end"];
12
+
13
+ var atoms = wordRegexp(["true", "false", "nil", "unit"]);
14
+ var commonKeywords = wordRegexp(["andthen", "at", "attr", "declare", "feat", "from", "lex",
15
+ "mod", "div", "mode", "orelse", "parser", "prod", "prop", "scanner", "self", "syn", "token"]);
16
+ var openingKeywords = wordRegexp(["local", "proc", "fun", "case", "class", "if", "cond", "or", "dis",
17
+ "choice", "not", "thread", "try", "raise", "lock", "for", "suchthat", "meth", "functor"]);
18
+ var middleKeywords = wordRegexp(middle);
19
+ var endKeywords = wordRegexp(end);
20
+
21
+ // Tokenizers
22
+ function tokenBase(stream, state) {
23
+ if (stream.eatSpace()) {
24
+ return null;
25
+ }
26
+
27
+ // Brackets
28
+ if(stream.match(/[{}]/)) {
29
+ return "bracket";
30
+ }
31
+
32
+ // Special [] keyword
33
+ if (stream.match('[]')) {
34
+ return "keyword"
35
+ }
36
+
37
+ // Operators
38
+ if (stream.match(tripleOperators) || stream.match(doubleOperators)) {
39
+ return "operator";
40
+ }
41
+
42
+ // Atoms
43
+ if(stream.match(atoms)) {
44
+ return 'atom';
45
+ }
46
+
47
+ // Opening keywords
48
+ var matched = stream.match(openingKeywords);
49
+ if (matched) {
50
+ if (!state.doInCurrentLine)
51
+ state.currentIndent++;
52
+ else
53
+ state.doInCurrentLine = false;
54
+
55
+ // Special matching for signatures
56
+ if(matched[0] == "proc" || matched[0] == "fun")
57
+ state.tokenize = tokenFunProc;
58
+ else if(matched[0] == "class")
59
+ state.tokenize = tokenClass;
60
+ else if(matched[0] == "meth")
61
+ state.tokenize = tokenMeth;
62
+
63
+ return 'keyword';
64
+ }
65
+
66
+ // Middle and other keywords
67
+ if (stream.match(middleKeywords) || stream.match(commonKeywords)) {
68
+ return "keyword"
69
+ }
70
+
71
+ // End keywords
72
+ if (stream.match(endKeywords)) {
73
+ state.currentIndent--;
74
+ return 'keyword';
75
+ }
76
+
77
+ // Eat the next char for next comparisons
78
+ var ch = stream.next();
79
+
80
+ // Strings
81
+ if (ch == '"' || ch == "'") {
82
+ state.tokenize = tokenString(ch);
83
+ return state.tokenize(stream, state);
84
+ }
85
+
86
+ // Numbers
87
+ if (/[~\d]/.test(ch)) {
88
+ if (ch == "~") {
89
+ if(! /^[0-9]/.test(stream.peek()))
90
+ return null;
91
+ else if (( stream.next() == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) || stream.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/))
92
+ return "number";
93
+ }
94
+
95
+ if ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) || stream.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/))
96
+ return "number";
97
+
98
+ return null;
99
+ }
100
+
101
+ // Comments
102
+ if (ch == "%") {
103
+ stream.skipToEnd();
104
+ return 'comment';
105
+ }
106
+ else if (ch == "/") {
107
+ if (stream.eat("*")) {
108
+ state.tokenize = tokenComment;
109
+ return tokenComment(stream, state);
110
+ }
111
+ }
112
+
113
+ // Single operators
114
+ if(singleOperators.test(ch)) {
115
+ return "operator";
116
+ }
117
+
118
+ // If nothing match, we skip the entire alphanumerical block
119
+ stream.eatWhile(/\w/);
120
+
121
+ return "variable";
122
+ }
123
+
124
+ function tokenClass(stream, state) {
125
+ if (stream.eatSpace()) {
126
+ return null;
127
+ }
128
+ stream.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)/);
129
+ state.tokenize = tokenBase;
130
+ return "type"
131
+ }
132
+
133
+ function tokenMeth(stream, state) {
134
+ if (stream.eatSpace()) {
135
+ return null;
136
+ }
137
+ stream.match(/([a-zA-Z][A-Za-z0-9_]*)|(`.+`)/);
138
+ state.tokenize = tokenBase;
139
+ return "def"
140
+ }
141
+
142
+ function tokenFunProc(stream, state) {
143
+ if (stream.eatSpace()) {
144
+ return null;
145
+ }
146
+
147
+ if(!state.hasPassedFirstStage && stream.eat("{")) {
148
+ state.hasPassedFirstStage = true;
149
+ return "bracket";
150
+ }
151
+ else if(state.hasPassedFirstStage) {
152
+ stream.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)|\$/);
153
+ state.hasPassedFirstStage = false;
154
+ state.tokenize = tokenBase;
155
+ return "def"
156
+ }
157
+ else {
158
+ state.tokenize = tokenBase;
159
+ return null;
160
+ }
161
+ }
162
+
163
+ function tokenComment(stream, state) {
164
+ var maybeEnd = false, ch;
165
+ while (ch = stream.next()) {
166
+ if (ch == "/" && maybeEnd) {
167
+ state.tokenize = tokenBase;
168
+ break;
169
+ }
170
+ maybeEnd = (ch == "*");
171
+ }
172
+ return "comment";
173
+ }
174
+
175
+ function tokenString(quote) {
176
+ return function (stream, state) {
177
+ var escaped = false, next, end = false;
178
+ while ((next = stream.next()) != null) {
179
+ if (next == quote && !escaped) {
180
+ end = true;
181
+ break;
182
+ }
183
+ escaped = !escaped && next == "\\";
184
+ }
185
+ if (end || !escaped)
186
+ state.tokenize = tokenBase;
187
+ return "string";
188
+ };
189
+ }
190
+
191
+ function buildElectricInputRegEx() {
192
+ // Reindentation should occur on [] or on a match of any of
193
+ // the block closing keywords, at the end of a line.
194
+ var allClosings = middle.concat(end);
195
+ return new RegExp("[\\[\\]]|(" + allClosings.join("|") + ")$");
196
+ }
197
+
198
+ export const oz = {
199
+ name: "oz",
200
+
201
+ startState: function () {
202
+ return {
203
+ tokenize: tokenBase,
204
+ currentIndent: 0,
205
+ doInCurrentLine: false,
206
+ hasPassedFirstStage: false
207
+ };
208
+ },
209
+
210
+ token: function (stream, state) {
211
+ if (stream.sol())
212
+ state.doInCurrentLine = 0;
213
+
214
+ return state.tokenize(stream, state);
215
+ },
216
+
217
+ indent: function (state, textAfter, cx) {
218
+ var trueText = textAfter.replace(/^\s+|\s+$/g, '');
219
+
220
+ if (trueText.match(endKeywords) || trueText.match(middleKeywords) || trueText.match(/(\[])/))
221
+ return cx.unit * (state.currentIndent - 1);
222
+
223
+ if (state.currentIndent < 0)
224
+ return 0;
225
+
226
+ return state.currentIndent * cx.unit
227
+ },
228
+
229
+ languageData: {
230
+ indentOnInut: buildElectricInputRegEx(),
231
+ commentTokens: {line: "%", block: {open: "/*", close: "*/"}}
232
+ }
233
+ };
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const pascal: StreamParser<unknown>