@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,254 @@
1
+ var ERRORCLASS = 'error';
2
+
3
+ function wordRegexp(words) {
4
+ return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
5
+ }
6
+
7
+ var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]");
8
+ var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
9
+ var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
10
+ var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
11
+ var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
12
+ var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
13
+
14
+ var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try', 'structure', 'synclock', 'using', 'with'];
15
+ var middleKeywords = ['else','elseif','case', 'catch', 'finally'];
16
+ var endKeywords = ['next','loop'];
17
+
18
+ var operatorKeywords = ['and', "andalso", 'or', 'orelse', 'xor', 'in', 'not', 'is', 'isnot', 'like'];
19
+ var wordOperators = wordRegexp(operatorKeywords);
20
+
21
+ var commonKeywords = ["#const", "#else", "#elseif", "#end", "#if", "#region", "addhandler", "addressof", "alias", "as", "byref", "byval", "cbool", "cbyte", "cchar", "cdate", "cdbl", "cdec", "cint", "clng", "cobj", "compare", "const", "continue", "csbyte", "cshort", "csng", "cstr", "cuint", "culng", "cushort", "declare", "default", "delegate", "dim", "directcast", "each", "erase", "error", "event", "exit", "explicit", "false", "for", "friend", "gettype", "goto", "handles", "implements", "imports", "infer", "inherits", "interface", "isfalse", "istrue", "lib", "me", "mod", "mustinherit", "mustoverride", "my", "mybase", "myclass", "namespace", "narrowing", "new", "nothing", "notinheritable", "notoverridable", "of", "off", "on", "operator", "option", "optional", "out", "overloads", "overridable", "overrides", "paramarray", "partial", "private", "protected", "public", "raiseevent", "readonly", "redim", "removehandler", "resume", "return", "shadows", "shared", "static", "step", "stop", "strict", "then", "throw", "to", "true", "trycast", "typeof", "until", "until", "when", "widening", "withevents", "writeonly"];
22
+
23
+ var commontypes = ['object', 'boolean', 'char', 'string', 'byte', 'sbyte', 'short', 'ushort', 'int16', 'uint16', 'integer', 'uinteger', 'int32', 'uint32', 'long', 'ulong', 'int64', 'uint64', 'decimal', 'single', 'double', 'float', 'date', 'datetime', 'intptr', 'uintptr'];
24
+
25
+ var keywords = wordRegexp(commonKeywords);
26
+ var types = wordRegexp(commontypes);
27
+ var stringPrefixes = '"';
28
+
29
+ var opening = wordRegexp(openingKeywords);
30
+ var middle = wordRegexp(middleKeywords);
31
+ var closing = wordRegexp(endKeywords);
32
+ var doubleClosing = wordRegexp(['end']);
33
+ var doOpening = wordRegexp(['do']);
34
+
35
+ var indentInfo = null;
36
+
37
+ function indent(_stream, state) {
38
+ state.currentIndent++;
39
+ }
40
+
41
+ function dedent(_stream, state) {
42
+ state.currentIndent--;
43
+ }
44
+ // tokenizers
45
+ function tokenBase(stream, state) {
46
+ if (stream.eatSpace()) {
47
+ return null;
48
+ }
49
+
50
+ var ch = stream.peek();
51
+
52
+ // Handle Comments
53
+ if (ch === "'") {
54
+ stream.skipToEnd();
55
+ return 'comment';
56
+ }
57
+
58
+
59
+ // Handle Number Literals
60
+ if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) {
61
+ var floatLiteral = false;
62
+ // Floats
63
+ if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; }
64
+ else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; }
65
+ else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; }
66
+
67
+ if (floatLiteral) {
68
+ // Float literals may be "imaginary"
69
+ stream.eat(/J/i);
70
+ return 'number';
71
+ }
72
+ // Integers
73
+ var intLiteral = false;
74
+ // Hex
75
+ if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
76
+ // Octal
77
+ else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
78
+ // Decimal
79
+ else if (stream.match(/^[1-9]\d*F?/)) {
80
+ // Decimal literals may be "imaginary"
81
+ stream.eat(/J/i);
82
+ // TODO - Can you have imaginary longs?
83
+ intLiteral = true;
84
+ }
85
+ // Zero by itself with no other piece of number.
86
+ else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
87
+ if (intLiteral) {
88
+ // Integer literals may be "long"
89
+ stream.eat(/L/i);
90
+ return 'number';
91
+ }
92
+ }
93
+
94
+ // Handle Strings
95
+ if (stream.match(stringPrefixes)) {
96
+ state.tokenize = tokenStringFactory(stream.current());
97
+ return state.tokenize(stream, state);
98
+ }
99
+
100
+ // Handle operators and Delimiters
101
+ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
102
+ return null;
103
+ }
104
+ if (stream.match(doubleOperators)
105
+ || stream.match(singleOperators)
106
+ || stream.match(wordOperators)) {
107
+ return 'operator';
108
+ }
109
+ if (stream.match(singleDelimiters)) {
110
+ return null;
111
+ }
112
+ if (stream.match(doOpening)) {
113
+ indent(stream,state);
114
+ state.doInCurrentLine = true;
115
+ return 'keyword';
116
+ }
117
+ if (stream.match(opening)) {
118
+ if (! state.doInCurrentLine)
119
+ indent(stream,state);
120
+ else
121
+ state.doInCurrentLine = false;
122
+ return 'keyword';
123
+ }
124
+ if (stream.match(middle)) {
125
+ return 'keyword';
126
+ }
127
+
128
+ if (stream.match(doubleClosing)) {
129
+ dedent(stream,state);
130
+ dedent(stream,state);
131
+ return 'keyword';
132
+ }
133
+ if (stream.match(closing)) {
134
+ dedent(stream,state);
135
+ return 'keyword';
136
+ }
137
+
138
+ if (stream.match(types)) {
139
+ return 'keyword';
140
+ }
141
+
142
+ if (stream.match(keywords)) {
143
+ return 'keyword';
144
+ }
145
+
146
+ if (stream.match(identifiers)) {
147
+ return 'variable';
148
+ }
149
+
150
+ // Handle non-detected items
151
+ stream.next();
152
+ return ERRORCLASS;
153
+ }
154
+
155
+ function tokenStringFactory(delimiter) {
156
+ var singleline = delimiter.length == 1;
157
+ var OUTCLASS = 'string';
158
+
159
+ return function(stream, state) {
160
+ while (!stream.eol()) {
161
+ stream.eatWhile(/[^'"]/);
162
+ if (stream.match(delimiter)) {
163
+ state.tokenize = tokenBase;
164
+ return OUTCLASS;
165
+ } else {
166
+ stream.eat(/['"]/);
167
+ }
168
+ }
169
+ if (singleline) {
170
+ state.tokenize = tokenBase;
171
+ }
172
+ return OUTCLASS;
173
+ };
174
+ }
175
+
176
+
177
+ function tokenLexer(stream, state) {
178
+ var style = state.tokenize(stream, state);
179
+ var current = stream.current();
180
+
181
+ // Handle '.' connected identifiers
182
+ if (current === '.') {
183
+ style = state.tokenize(stream, state);
184
+ if (style === 'variable') {
185
+ return 'variable';
186
+ } else {
187
+ return ERRORCLASS;
188
+ }
189
+ }
190
+
191
+
192
+ var delimiter_index = '[({'.indexOf(current);
193
+ if (delimiter_index !== -1) {
194
+ indent(stream, state );
195
+ }
196
+ if (indentInfo === 'dedent') {
197
+ if (dedent(stream, state)) {
198
+ return ERRORCLASS;
199
+ }
200
+ }
201
+ delimiter_index = '])}'.indexOf(current);
202
+ if (delimiter_index !== -1) {
203
+ if (dedent(stream, state)) {
204
+ return ERRORCLASS;
205
+ }
206
+ }
207
+
208
+ return style;
209
+ }
210
+
211
+ export const vb = {
212
+ name: "vb",
213
+
214
+ startState: function() {
215
+ return {
216
+ tokenize: tokenBase,
217
+ lastToken: null,
218
+ currentIndent: 0,
219
+ nextLineIndent: 0,
220
+ doInCurrentLine: false
221
+
222
+
223
+ };
224
+ },
225
+
226
+ token: function(stream, state) {
227
+ if (stream.sol()) {
228
+ state.currentIndent += state.nextLineIndent;
229
+ state.nextLineIndent = 0;
230
+ state.doInCurrentLine = 0;
231
+ }
232
+ var style = tokenLexer(stream, state);
233
+
234
+ state.lastToken = {style:style, content: stream.current()};
235
+
236
+
237
+
238
+ return style;
239
+ },
240
+
241
+ indent: function(state, textAfter, cx) {
242
+ var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
243
+ if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return cx.unit*(state.currentIndent-1);
244
+ if(state.currentIndent < 0) return 0;
245
+ return state.currentIndent * cx.unit;
246
+ },
247
+
248
+ languageData: {
249
+ closeBrackets: {brackets: ["(", "[", "{", '"']},
250
+ commentTokens: {line: "'"},
251
+ autocomplete: openingKeywords.concat(middleKeywords).concat(endKeywords)
252
+ .concat(operatorKeywords).concat(commonKeywords).concat(commontypes)
253
+ }
254
+ };
@@ -0,0 +1,3 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const vbScript: StreamParser<unknown>
3
+ export declare const vbScriptASP: StreamParser<unknown>
@@ -0,0 +1,320 @@
1
+ function mkVBScript(parserConf) {
2
+ var ERRORCLASS = 'error';
3
+
4
+ function wordRegexp(words) {
5
+ return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
6
+ }
7
+
8
+ var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]");
9
+ var doubleOperators = new RegExp("^((<>)|(<=)|(>=))");
10
+ var singleDelimiters = new RegExp('^[\\.,]');
11
+ var brackets = new RegExp('^[\\(\\)]');
12
+ var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*");
13
+
14
+ var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for'];
15
+ var middleKeywords = ['else','elseif','case'];
16
+ var endKeywords = ['next','loop','wend'];
17
+
18
+ var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']);
19
+ var commonkeywords = ['dim', 'redim', 'then', 'until', 'randomize',
20
+ 'byval','byref','new','property', 'exit', 'in',
21
+ 'const','private', 'public',
22
+ 'get','set','let', 'stop', 'on error resume next', 'on error goto 0', 'option explicit', 'call', 'me'];
23
+
24
+ //This list was from: http://msdn.microsoft.com/en-us/library/f8tbc79x(v=vs.84).aspx
25
+ var atomWords = ['true', 'false', 'nothing', 'empty', 'null'];
26
+ //This list was from: http://msdn.microsoft.com/en-us/library/3ca8tfek(v=vs.84).aspx
27
+ var builtinFuncsWords = ['abs', 'array', 'asc', 'atn', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'chr', 'cint', 'clng', 'cos', 'csng', 'cstr', 'date', 'dateadd', 'datediff', 'datepart',
28
+ 'dateserial', 'datevalue', 'day', 'escape', 'eval', 'execute', 'exp', 'filter', 'formatcurrency', 'formatdatetime', 'formatnumber', 'formatpercent', 'getlocale', 'getobject',
29
+ 'getref', 'hex', 'hour', 'inputbox', 'instr', 'instrrev', 'int', 'fix', 'isarray', 'isdate', 'isempty', 'isnull', 'isnumeric', 'isobject', 'join', 'lbound', 'lcase', 'left',
30
+ 'len', 'loadpicture', 'log', 'ltrim', 'rtrim', 'trim', 'maths', 'mid', 'minute', 'month', 'monthname', 'msgbox', 'now', 'oct', 'replace', 'rgb', 'right', 'rnd', 'round',
31
+ 'scriptengine', 'scriptenginebuildversion', 'scriptenginemajorversion', 'scriptengineminorversion', 'second', 'setlocale', 'sgn', 'sin', 'space', 'split', 'sqr', 'strcomp',
32
+ 'string', 'strreverse', 'tan', 'time', 'timer', 'timeserial', 'timevalue', 'typename', 'ubound', 'ucase', 'unescape', 'vartype', 'weekday', 'weekdayname', 'year'];
33
+
34
+ //This list was from: http://msdn.microsoft.com/en-us/library/ydz4cfk3(v=vs.84).aspx
35
+ var builtinConsts = ['vbBlack', 'vbRed', 'vbGreen', 'vbYellow', 'vbBlue', 'vbMagenta', 'vbCyan', 'vbWhite', 'vbBinaryCompare', 'vbTextCompare',
36
+ 'vbSunday', 'vbMonday', 'vbTuesday', 'vbWednesday', 'vbThursday', 'vbFriday', 'vbSaturday', 'vbUseSystemDayOfWeek', 'vbFirstJan1', 'vbFirstFourDays', 'vbFirstFullWeek',
37
+ 'vbGeneralDate', 'vbLongDate', 'vbShortDate', 'vbLongTime', 'vbShortTime', 'vbObjectError',
38
+ 'vbOKOnly', 'vbOKCancel', 'vbAbortRetryIgnore', 'vbYesNoCancel', 'vbYesNo', 'vbRetryCancel', 'vbCritical', 'vbQuestion', 'vbExclamation', 'vbInformation', 'vbDefaultButton1', 'vbDefaultButton2',
39
+ 'vbDefaultButton3', 'vbDefaultButton4', 'vbApplicationModal', 'vbSystemModal', 'vbOK', 'vbCancel', 'vbAbort', 'vbRetry', 'vbIgnore', 'vbYes', 'vbNo',
40
+ 'vbCr', 'VbCrLf', 'vbFormFeed', 'vbLf', 'vbNewLine', 'vbNullChar', 'vbNullString', 'vbTab', 'vbVerticalTab', 'vbUseDefault', 'vbTrue', 'vbFalse',
41
+ 'vbEmpty', 'vbNull', 'vbInteger', 'vbLong', 'vbSingle', 'vbDouble', 'vbCurrency', 'vbDate', 'vbString', 'vbObject', 'vbError', 'vbBoolean', 'vbVariant', 'vbDataObject', 'vbDecimal', 'vbByte', 'vbArray'];
42
+ //This list was from: http://msdn.microsoft.com/en-us/library/hkc375ea(v=vs.84).aspx
43
+ var builtinObjsWords = ['WScript', 'err', 'debug', 'RegExp'];
44
+ var knownProperties = ['description', 'firstindex', 'global', 'helpcontext', 'helpfile', 'ignorecase', 'length', 'number', 'pattern', 'source', 'value', 'count'];
45
+ var knownMethods = ['clear', 'execute', 'raise', 'replace', 'test', 'write', 'writeline', 'close', 'open', 'state', 'eof', 'update', 'addnew', 'end', 'createobject', 'quit'];
46
+
47
+ var aspBuiltinObjsWords = ['server', 'response', 'request', 'session', 'application'];
48
+ var aspKnownProperties = ['buffer', 'cachecontrol', 'charset', 'contenttype', 'expires', 'expiresabsolute', 'isclientconnected', 'pics', 'status', //response
49
+ 'clientcertificate', 'cookies', 'form', 'querystring', 'servervariables', 'totalbytes', //request
50
+ 'contents', 'staticobjects', //application
51
+ 'codepage', 'lcid', 'sessionid', 'timeout', //session
52
+ 'scripttimeout']; //server
53
+ var aspKnownMethods = ['addheader', 'appendtolog', 'binarywrite', 'end', 'flush', 'redirect', //response
54
+ 'binaryread', //request
55
+ 'remove', 'removeall', 'lock', 'unlock', //application
56
+ 'abandon', //session
57
+ 'getlasterror', 'htmlencode', 'mappath', 'transfer', 'urlencode']; //server
58
+
59
+ var knownWords = knownMethods.concat(knownProperties);
60
+
61
+ builtinObjsWords = builtinObjsWords.concat(builtinConsts);
62
+
63
+ if (parserConf.isASP){
64
+ builtinObjsWords = builtinObjsWords.concat(aspBuiltinObjsWords);
65
+ knownWords = knownWords.concat(aspKnownMethods, aspKnownProperties);
66
+ };
67
+
68
+ var keywords = wordRegexp(commonkeywords);
69
+ var atoms = wordRegexp(atomWords);
70
+ var builtinFuncs = wordRegexp(builtinFuncsWords);
71
+ var builtinObjs = wordRegexp(builtinObjsWords);
72
+ var known = wordRegexp(knownWords);
73
+ var stringPrefixes = '"';
74
+
75
+ var opening = wordRegexp(openingKeywords);
76
+ var middle = wordRegexp(middleKeywords);
77
+ var closing = wordRegexp(endKeywords);
78
+ var doubleClosing = wordRegexp(['end']);
79
+ var doOpening = wordRegexp(['do']);
80
+ var noIndentWords = wordRegexp(['on error resume next', 'exit']);
81
+ var comment = wordRegexp(['rem']);
82
+
83
+
84
+ function indent(_stream, state) {
85
+ state.currentIndent++;
86
+ }
87
+
88
+ function dedent(_stream, state) {
89
+ state.currentIndent--;
90
+ }
91
+ // tokenizers
92
+ function tokenBase(stream, state) {
93
+ if (stream.eatSpace()) {
94
+ return null
95
+ //return null;
96
+ }
97
+
98
+ var ch = stream.peek();
99
+
100
+ // Handle Comments
101
+ if (ch === "'") {
102
+ stream.skipToEnd();
103
+ return 'comment';
104
+ }
105
+ if (stream.match(comment)){
106
+ stream.skipToEnd();
107
+ return 'comment';
108
+ }
109
+
110
+
111
+ // Handle Number Literals
112
+ if (stream.match(/^((&H)|(&O))?[0-9\.]/i, false) && !stream.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i, false)) {
113
+ var floatLiteral = false;
114
+ // Floats
115
+ if (stream.match(/^\d*\.\d+/i)) { floatLiteral = true; }
116
+ else if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
117
+ else if (stream.match(/^\.\d+/)) { floatLiteral = true; }
118
+
119
+ if (floatLiteral) {
120
+ // Float literals may be "imaginary"
121
+ stream.eat(/J/i);
122
+ return 'number';
123
+ }
124
+ // Integers
125
+ var intLiteral = false;
126
+ // Hex
127
+ if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
128
+ // Octal
129
+ else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
130
+ // Decimal
131
+ else if (stream.match(/^[1-9]\d*F?/)) {
132
+ // Decimal literals may be "imaginary"
133
+ stream.eat(/J/i);
134
+ // TODO - Can you have imaginary longs?
135
+ intLiteral = true;
136
+ }
137
+ // Zero by itself with no other piece of number.
138
+ else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
139
+ if (intLiteral) {
140
+ // Integer literals may be "long"
141
+ stream.eat(/L/i);
142
+ return 'number';
143
+ }
144
+ }
145
+
146
+ // Handle Strings
147
+ if (stream.match(stringPrefixes)) {
148
+ state.tokenize = tokenStringFactory(stream.current());
149
+ return state.tokenize(stream, state);
150
+ }
151
+
152
+ // Handle operators and Delimiters
153
+ if (stream.match(doubleOperators)
154
+ || stream.match(singleOperators)
155
+ || stream.match(wordOperators)) {
156
+ return 'operator';
157
+ }
158
+ if (stream.match(singleDelimiters)) {
159
+ return null;
160
+ }
161
+
162
+ if (stream.match(brackets)) {
163
+ return "bracket";
164
+ }
165
+
166
+ if (stream.match(noIndentWords)) {
167
+ state.doInCurrentLine = true;
168
+
169
+ return 'keyword';
170
+ }
171
+
172
+ if (stream.match(doOpening)) {
173
+ indent(stream,state);
174
+ state.doInCurrentLine = true;
175
+
176
+ return 'keyword';
177
+ }
178
+ if (stream.match(opening)) {
179
+ if (! state.doInCurrentLine)
180
+ indent(stream,state);
181
+ else
182
+ state.doInCurrentLine = false;
183
+
184
+ return 'keyword';
185
+ }
186
+ if (stream.match(middle)) {
187
+ return 'keyword';
188
+ }
189
+
190
+
191
+ if (stream.match(doubleClosing)) {
192
+ dedent(stream,state);
193
+ dedent(stream,state);
194
+
195
+ return 'keyword';
196
+ }
197
+ if (stream.match(closing)) {
198
+ if (! state.doInCurrentLine)
199
+ dedent(stream,state);
200
+ else
201
+ state.doInCurrentLine = false;
202
+
203
+ return 'keyword';
204
+ }
205
+
206
+ if (stream.match(keywords)) {
207
+ return 'keyword';
208
+ }
209
+
210
+ if (stream.match(atoms)) {
211
+ return 'atom';
212
+ }
213
+
214
+ if (stream.match(known)) {
215
+ return 'variableName.special';
216
+ }
217
+
218
+ if (stream.match(builtinFuncs)) {
219
+ return 'builtin';
220
+ }
221
+
222
+ if (stream.match(builtinObjs)){
223
+ return 'builtin';
224
+ }
225
+
226
+ if (stream.match(identifiers)) {
227
+ return 'variable';
228
+ }
229
+
230
+ // Handle non-detected items
231
+ stream.next();
232
+ return ERRORCLASS;
233
+ }
234
+
235
+ function tokenStringFactory(delimiter) {
236
+ var singleline = delimiter.length == 1;
237
+ var OUTCLASS = 'string';
238
+
239
+ return function(stream, state) {
240
+ while (!stream.eol()) {
241
+ stream.eatWhile(/[^'"]/);
242
+ if (stream.match(delimiter)) {
243
+ state.tokenize = tokenBase;
244
+ return OUTCLASS;
245
+ } else {
246
+ stream.eat(/['"]/);
247
+ }
248
+ }
249
+ if (singleline) {
250
+ state.tokenize = tokenBase;
251
+ }
252
+ return OUTCLASS;
253
+ };
254
+ }
255
+
256
+
257
+ function tokenLexer(stream, state) {
258
+ var style = state.tokenize(stream, state);
259
+ var current = stream.current();
260
+
261
+ // Handle '.' connected identifiers
262
+ if (current === '.') {
263
+ style = state.tokenize(stream, state);
264
+
265
+ current = stream.current();
266
+ if (style && (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword')){//|| knownWords.indexOf(current.substring(1)) > -1) {
267
+ if (style === 'builtin' || style === 'keyword') style='variable';
268
+ if (knownWords.indexOf(current.substr(1)) > -1) style='keyword';
269
+
270
+ return style;
271
+ } else {
272
+ return ERRORCLASS;
273
+ }
274
+ }
275
+
276
+ return style;
277
+ }
278
+
279
+ return {
280
+ name: "vbscript",
281
+ startState: function() {
282
+ return {
283
+ tokenize: tokenBase,
284
+ lastToken: null,
285
+ currentIndent: 0,
286
+ nextLineIndent: 0,
287
+ doInCurrentLine: false,
288
+ ignoreKeyword: false
289
+
290
+
291
+ };
292
+ },
293
+
294
+ token: function(stream, state) {
295
+ if (stream.sol()) {
296
+ state.currentIndent += state.nextLineIndent;
297
+ state.nextLineIndent = 0;
298
+ state.doInCurrentLine = 0;
299
+ }
300
+ var style = tokenLexer(stream, state);
301
+
302
+ state.lastToken = {style:style, content: stream.current()};
303
+
304
+ if (style===null) style=null;
305
+
306
+ return style;
307
+ },
308
+
309
+ indent: function(state, textAfter, cx) {
310
+ var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
311
+ if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return cx.unit*(state.currentIndent-1);
312
+ if(state.currentIndent < 0) return 0;
313
+ return state.currentIndent * cx.unit
314
+ }
315
+
316
+ };
317
+ };
318
+
319
+ export const vbScript = mkVBScript({})
320
+ export const vbScriptASP = mkVBScript({isASP: true})
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const velocity: StreamParser<unknown>