@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/xquery.js ADDED
@@ -0,0 +1,415 @@
1
+ // The keywords object is set to the result of this self executing
2
+ // function. Each keyword is a property of the keywords object whose
3
+ // value is {type: atype, style: astyle}
4
+ var keywords = function(){
5
+ // convenience functions used to build keywords object
6
+ function kw(type) {return {type: type, style: "keyword"};}
7
+ var operator = kw("operator")
8
+ , atom = {type: "atom", style: "atom"}
9
+ , punctuation = {type: "punctuation", style: null}
10
+ , qualifier = {type: "axis_specifier", style: "qualifier"};
11
+
12
+ // kwObj is what is return from this function at the end
13
+ var kwObj = {
14
+ ',': punctuation
15
+ };
16
+
17
+ // a list of 'basic' keywords. For each add a property to kwObj with the value of
18
+ // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
19
+ var basic = ['after', 'all', 'allowing', 'ancestor', 'ancestor-or-self', 'any', 'array', 'as',
20
+ 'ascending', 'at', 'attribute', 'base-uri', 'before', 'boundary-space', 'by', 'case', 'cast',
21
+ 'castable', 'catch', 'child', 'collation', 'comment', 'construction', 'contains', 'content',
22
+ 'context', 'copy', 'copy-namespaces', 'count', 'decimal-format', 'declare', 'default', 'delete',
23
+ 'descendant', 'descendant-or-self', 'descending', 'diacritics', 'different', 'distance',
24
+ 'document', 'document-node', 'element', 'else', 'empty', 'empty-sequence', 'encoding', 'end',
25
+ 'entire', 'every', 'exactly', 'except', 'external', 'first', 'following', 'following-sibling',
26
+ 'for', 'from', 'ftand', 'ftnot', 'ft-option', 'ftor', 'function', 'fuzzy', 'greatest', 'group',
27
+ 'if', 'import', 'in', 'inherit', 'insensitive', 'insert', 'instance', 'intersect', 'into',
28
+ 'invoke', 'is', 'item', 'language', 'last', 'lax', 'least', 'let', 'levels', 'lowercase', 'map',
29
+ 'modify', 'module', 'most', 'namespace', 'next', 'no', 'node', 'nodes', 'no-inherit',
30
+ 'no-preserve', 'not', 'occurs', 'of', 'only', 'option', 'order', 'ordered', 'ordering',
31
+ 'paragraph', 'paragraphs', 'parent', 'phrase', 'preceding', 'preceding-sibling', 'preserve',
32
+ 'previous', 'processing-instruction', 'relationship', 'rename', 'replace', 'return',
33
+ 'revalidation', 'same', 'satisfies', 'schema', 'schema-attribute', 'schema-element', 'score',
34
+ 'self', 'sensitive', 'sentence', 'sentences', 'sequence', 'skip', 'sliding', 'some', 'stable',
35
+ 'start', 'stemming', 'stop', 'strict', 'strip', 'switch', 'text', 'then', 'thesaurus', 'times',
36
+ 'to', 'transform', 'treat', 'try', 'tumbling', 'type', 'typeswitch', 'union', 'unordered',
37
+ 'update', 'updating', 'uppercase', 'using', 'validate', 'value', 'variable', 'version',
38
+ 'weight', 'when', 'where', 'wildcards', 'window', 'with', 'without', 'word', 'words', 'xquery'];
39
+ for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);};
40
+
41
+ // a list of types. For each add a property to kwObj with the value of
42
+ // {type: "atom", style: "atom"}
43
+ var types = ['xs:anyAtomicType', 'xs:anySimpleType', 'xs:anyType', 'xs:anyURI',
44
+ 'xs:base64Binary', 'xs:boolean', 'xs:byte', 'xs:date', 'xs:dateTime', 'xs:dateTimeStamp',
45
+ 'xs:dayTimeDuration', 'xs:decimal', 'xs:double', 'xs:duration', 'xs:ENTITIES', 'xs:ENTITY',
46
+ 'xs:float', 'xs:gDay', 'xs:gMonth', 'xs:gMonthDay', 'xs:gYear', 'xs:gYearMonth', 'xs:hexBinary',
47
+ 'xs:ID', 'xs:IDREF', 'xs:IDREFS', 'xs:int', 'xs:integer', 'xs:item', 'xs:java', 'xs:language',
48
+ 'xs:long', 'xs:Name', 'xs:NCName', 'xs:negativeInteger', 'xs:NMTOKEN', 'xs:NMTOKENS',
49
+ 'xs:nonNegativeInteger', 'xs:nonPositiveInteger', 'xs:normalizedString', 'xs:NOTATION',
50
+ 'xs:numeric', 'xs:positiveInteger', 'xs:precisionDecimal', 'xs:QName', 'xs:short', 'xs:string',
51
+ 'xs:time', 'xs:token', 'xs:unsignedByte', 'xs:unsignedInt', 'xs:unsignedLong',
52
+ 'xs:unsignedShort', 'xs:untyped', 'xs:untypedAtomic', 'xs:yearMonthDuration'];
53
+ for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;};
54
+
55
+ // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
56
+ var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-'];
57
+ for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;};
58
+
59
+ // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"}
60
+ var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::",
61
+ "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"];
62
+ for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; };
63
+
64
+ return kwObj;
65
+ }();
66
+
67
+ function chain(stream, state, f) {
68
+ state.tokenize = f;
69
+ return f(stream, state);
70
+ }
71
+
72
+ // the primary mode tokenizer
73
+ function tokenBase(stream, state) {
74
+ var ch = stream.next(),
75
+ mightBeFunction = false,
76
+ isEQName = isEQNameAhead(stream);
77
+
78
+ // an XML tag (if not in some sub, chained tokenizer)
79
+ if (ch == "<") {
80
+ if(stream.match("!--", true))
81
+ return chain(stream, state, tokenXMLComment);
82
+
83
+ if(stream.match("![CDATA", false)) {
84
+ state.tokenize = tokenCDATA;
85
+ return "tag";
86
+ }
87
+
88
+ if(stream.match("?", false)) {
89
+ return chain(stream, state, tokenPreProcessing);
90
+ }
91
+
92
+ var isclose = stream.eat("/");
93
+ stream.eatSpace();
94
+ var tagName = "", c;
95
+ while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
96
+
97
+ return chain(stream, state, tokenTag(tagName, isclose));
98
+ }
99
+ // start code block
100
+ else if(ch == "{") {
101
+ pushStateStack(state, { type: "codeblock"});
102
+ return null;
103
+ }
104
+ // end code block
105
+ else if(ch == "}") {
106
+ popStateStack(state);
107
+ return null;
108
+ }
109
+ // if we're in an XML block
110
+ else if(isInXmlBlock(state)) {
111
+ if(ch == ">")
112
+ return "tag";
113
+ else if(ch == "/" && stream.eat(">")) {
114
+ popStateStack(state);
115
+ return "tag";
116
+ }
117
+ else
118
+ return "variable";
119
+ }
120
+ // if a number
121
+ else if (/\d/.test(ch)) {
122
+ stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
123
+ return "atom";
124
+ }
125
+ // comment start
126
+ else if (ch === "(" && stream.eat(":")) {
127
+ pushStateStack(state, { type: "comment"});
128
+ return chain(stream, state, tokenComment);
129
+ }
130
+ // quoted string
131
+ else if (!isEQName && (ch === '"' || ch === "'"))
132
+ return startString(stream, state, ch);
133
+ // variable
134
+ else if(ch === "$") {
135
+ return chain(stream, state, tokenVariable);
136
+ }
137
+ // assignment
138
+ else if(ch ===":" && stream.eat("=")) {
139
+ return "keyword";
140
+ }
141
+ // open paren
142
+ else if(ch === "(") {
143
+ pushStateStack(state, { type: "paren"});
144
+ return null;
145
+ }
146
+ // close paren
147
+ else if(ch === ")") {
148
+ popStateStack(state);
149
+ return null;
150
+ }
151
+ // open paren
152
+ else if(ch === "[") {
153
+ pushStateStack(state, { type: "bracket"});
154
+ return null;
155
+ }
156
+ // close paren
157
+ else if(ch === "]") {
158
+ popStateStack(state);
159
+ return null;
160
+ }
161
+ else {
162
+ var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
163
+
164
+ // if there's a EQName ahead, consume the rest of the string portion, it's likely a function
165
+ if(isEQName && ch === '\"') while(stream.next() !== '"'){}
166
+ if(isEQName && ch === '\'') while(stream.next() !== '\''){}
167
+
168
+ // gobble up a word if the character is not known
169
+ if(!known) stream.eatWhile(/[\w\$_-]/);
170
+
171
+ // gobble a colon in the case that is a lib func type call fn:doc
172
+ var foundColon = stream.eat(":");
173
+
174
+ // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier
175
+ // which should get matched as a keyword
176
+ if(!stream.eat(":") && foundColon) {
177
+ stream.eatWhile(/[\w\$_-]/);
178
+ }
179
+ // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)
180
+ if(stream.match(/^[ \t]*\(/, false)) {
181
+ mightBeFunction = true;
182
+ }
183
+ // is the word a keyword?
184
+ var word = stream.current();
185
+ known = keywords.propertyIsEnumerable(word) && keywords[word];
186
+
187
+ // if we think it's a function call but not yet known,
188
+ // set style to variable for now for lack of something better
189
+ if(mightBeFunction && !known) known = {type: "function_call", style: "def"};
190
+
191
+ // if the previous word was element, attribute, axis specifier, this word should be the name of that
192
+ if(isInXmlConstructor(state)) {
193
+ popStateStack(state);
194
+ return "variable";
195
+ }
196
+ // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
197
+ // push the stack so we know to look for it on the next word
198
+ if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
199
+
200
+ // if the word is known, return the details of that else just call this a generic 'word'
201
+ return known ? known.style : "variable";
202
+ }
203
+ }
204
+
205
+ // handle comments, including nested
206
+ function tokenComment(stream, state) {
207
+ var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
208
+ while (ch = stream.next()) {
209
+ if (ch == ")" && maybeEnd) {
210
+ if(nestedCount > 0)
211
+ nestedCount--;
212
+ else {
213
+ popStateStack(state);
214
+ break;
215
+ }
216
+ }
217
+ else if(ch == ":" && maybeNested) {
218
+ nestedCount++;
219
+ }
220
+ maybeEnd = (ch == ":");
221
+ maybeNested = (ch == "(");
222
+ }
223
+
224
+ return "comment";
225
+ }
226
+
227
+ // tokenizer for string literals
228
+ // optionally pass a tokenizer function to set state.tokenize back to when finished
229
+ function tokenString(quote, f) {
230
+ return function(stream, state) {
231
+ var ch;
232
+ while (ch = stream.next()) {
233
+ if (ch == quote) {
234
+ popStateStack(state);
235
+ if (f) state.tokenize = f;
236
+ break;
237
+ } else if (stream.match("{", false) && isInXmlAttributeBlock(state)) {
238
+ // if we're in a string and in an XML block, allow an embedded code block in an attribute
239
+ pushStateStack(state, { type: "codeblock"});
240
+ state.tokenize = tokenBase;
241
+ return "string";
242
+ }
243
+ }
244
+
245
+ return "string";
246
+ };
247
+ }
248
+
249
+ function startString(stream, state, quote, f) {
250
+ let tokenize = tokenString(quote, f);
251
+ pushStateStack(state, { type: "string", name: quote, tokenize });
252
+ return chain(stream, state, tokenize);
253
+ }
254
+
255
+ // tokenizer for variables
256
+ function tokenVariable(stream, state) {
257
+ var isVariableChar = /[\w\$_-]/;
258
+
259
+ // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote
260
+ if(stream.eat("\"")) {
261
+ while(stream.next() !== '\"'){};
262
+ stream.eat(":");
263
+ } else {
264
+ stream.eatWhile(isVariableChar);
265
+ if(!stream.match(":=", false)) stream.eat(":");
266
+ }
267
+ stream.eatWhile(isVariableChar);
268
+ state.tokenize = tokenBase;
269
+ return "variable";
270
+ }
271
+
272
+ // tokenizer for XML tags
273
+ function tokenTag(name, isclose) {
274
+ return function(stream, state) {
275
+ stream.eatSpace();
276
+ if(isclose && stream.eat(">")) {
277
+ popStateStack(state);
278
+ state.tokenize = tokenBase;
279
+ return "tag";
280
+ }
281
+ // self closing tag without attributes?
282
+ if(!stream.eat("/"))
283
+ pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
284
+ if(!stream.eat(">")) {
285
+ state.tokenize = tokenAttribute;
286
+ return "tag";
287
+ }
288
+ else {
289
+ state.tokenize = tokenBase;
290
+ }
291
+ return "tag";
292
+ };
293
+ }
294
+
295
+ // tokenizer for XML attributes
296
+ function tokenAttribute(stream, state) {
297
+ var ch = stream.next();
298
+
299
+ if(ch == "/" && stream.eat(">")) {
300
+ if(isInXmlAttributeBlock(state)) popStateStack(state);
301
+ if(isInXmlBlock(state)) popStateStack(state);
302
+ return "tag";
303
+ }
304
+ if(ch == ">") {
305
+ if(isInXmlAttributeBlock(state)) popStateStack(state);
306
+ return "tag";
307
+ }
308
+ if(ch == "=")
309
+ return null;
310
+ // quoted string
311
+ if (ch == '"' || ch == "'")
312
+ return startString(stream, state, ch, tokenAttribute);
313
+
314
+ if(!isInXmlAttributeBlock(state))
315
+ pushStateStack(state, { type: "attribute", tokenize: tokenAttribute});
316
+
317
+ stream.eat(/[a-zA-Z_:]/);
318
+ stream.eatWhile(/[-a-zA-Z0-9_:.]/);
319
+ stream.eatSpace();
320
+
321
+ // the case where the attribute has not value and the tag was closed
322
+ if(stream.match(">", false) || stream.match("/", false)) {
323
+ popStateStack(state);
324
+ state.tokenize = tokenBase;
325
+ }
326
+
327
+ return "attribute";
328
+ }
329
+
330
+ // handle comments, including nested
331
+ function tokenXMLComment(stream, state) {
332
+ var ch;
333
+ while (ch = stream.next()) {
334
+ if (ch == "-" && stream.match("->", true)) {
335
+ state.tokenize = tokenBase;
336
+ return "comment";
337
+ }
338
+ }
339
+ }
340
+
341
+
342
+ // handle CDATA
343
+ function tokenCDATA(stream, state) {
344
+ var ch;
345
+ while (ch = stream.next()) {
346
+ if (ch == "]" && stream.match("]", true)) {
347
+ state.tokenize = tokenBase;
348
+ return "comment";
349
+ }
350
+ }
351
+ }
352
+
353
+ // handle preprocessing instructions
354
+ function tokenPreProcessing(stream, state) {
355
+ var ch;
356
+ while (ch = stream.next()) {
357
+ if (ch == "?" && stream.match(">", true)) {
358
+ state.tokenize = tokenBase;
359
+ return "processingInstruction";
360
+ }
361
+ }
362
+ }
363
+
364
+
365
+ // functions to test the current context of the state
366
+ function isInXmlBlock(state) { return isIn(state, "tag"); }
367
+ function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); }
368
+ function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); }
369
+ function isInString(state) { return isIn(state, "string"); }
370
+
371
+ function isEQNameAhead(stream) {
372
+ // assume we've already eaten a quote (")
373
+ if(stream.current() === '"')
374
+ return stream.match(/^[^\"]+\"\:/, false);
375
+ else if(stream.current() === '\'')
376
+ return stream.match(/^[^\"]+\'\:/, false);
377
+ else
378
+ return false;
379
+ }
380
+
381
+ function isIn(state, type) {
382
+ return (state.stack.length && state.stack[state.stack.length - 1].type == type);
383
+ }
384
+
385
+ function pushStateStack(state, newState) {
386
+ state.stack.push(newState);
387
+ }
388
+
389
+ function popStateStack(state) {
390
+ state.stack.pop();
391
+ var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize;
392
+ state.tokenize = reinstateTokenize || tokenBase;
393
+ }
394
+
395
+ // the interface for the mode API
396
+ export const xQuery = {
397
+ name: "xquery",
398
+ startState: function() {
399
+ return {
400
+ tokenize: tokenBase,
401
+ cc: [],
402
+ stack: []
403
+ };
404
+ },
405
+
406
+ token: function(stream, state) {
407
+ if (stream.eatSpace()) return null;
408
+ var style = state.tokenize(stream, state);
409
+ return style;
410
+ },
411
+
412
+ languageData: {
413
+ commentTokens: {block: {open: "(:", close: ":)"}}
414
+ }
415
+ };
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const yacas: StreamParser<unknown>
package/mode/yacas.js ADDED
@@ -0,0 +1,181 @@
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
+ var bodiedOps = words("Assert BackQuote D Defun Deriv For ForEach FromFile " +
8
+ "FromString Function Integrate InverseTaylor Limit " +
9
+ "LocalSymbols Macro MacroRule MacroRulePattern " +
10
+ "NIntegrate Rule RulePattern Subst TD TExplicitSum " +
11
+ "TSum Taylor Taylor1 Taylor2 Taylor3 ToFile " +
12
+ "ToStdout ToString TraceRule Until While");
13
+
14
+ // patterns
15
+ var pFloatForm = "(?:(?:\\.\\d+|\\d+\\.\\d*|\\d+)(?:[eE][+-]?\\d+)?)";
16
+ var pIdentifier = "(?:[a-zA-Z\\$'][a-zA-Z0-9\\$']*)";
17
+
18
+ // regular expressions
19
+ var reFloatForm = new RegExp(pFloatForm);
20
+ var reIdentifier = new RegExp(pIdentifier);
21
+ var rePattern = new RegExp(pIdentifier + "?_" + pIdentifier);
22
+ var reFunctionLike = new RegExp(pIdentifier + "\\s*\\(");
23
+
24
+ function tokenBase(stream, state) {
25
+ var ch;
26
+
27
+ // get next character
28
+ ch = stream.next();
29
+
30
+ // string
31
+ if (ch === '"') {
32
+ state.tokenize = tokenString;
33
+ return state.tokenize(stream, state);
34
+ }
35
+
36
+ // comment
37
+ if (ch === '/') {
38
+ if (stream.eat('*')) {
39
+ state.tokenize = tokenComment;
40
+ return state.tokenize(stream, state);
41
+ }
42
+ if (stream.eat("/")) {
43
+ stream.skipToEnd();
44
+ return "comment";
45
+ }
46
+ }
47
+
48
+ // go back one character
49
+ stream.backUp(1);
50
+
51
+ // update scope info
52
+ var m = stream.match(/^(\w+)\s*\(/, false);
53
+ if (m !== null && bodiedOps.hasOwnProperty(m[1]))
54
+ state.scopes.push('bodied');
55
+
56
+ var scope = currentScope(state);
57
+
58
+ if (scope === 'bodied' && ch === '[')
59
+ state.scopes.pop();
60
+
61
+ if (ch === '[' || ch === '{' || ch === '(')
62
+ state.scopes.push(ch);
63
+
64
+ scope = currentScope(state);
65
+
66
+ if (scope === '[' && ch === ']' ||
67
+ scope === '{' && ch === '}' ||
68
+ scope === '(' && ch === ')')
69
+ state.scopes.pop();
70
+
71
+ if (ch === ';') {
72
+ while (scope === 'bodied') {
73
+ state.scopes.pop();
74
+ scope = currentScope(state);
75
+ }
76
+ }
77
+
78
+ // look for ordered rules
79
+ if (stream.match(/\d+ *#/, true, false)) {
80
+ return 'qualifier';
81
+ }
82
+
83
+ // look for numbers
84
+ if (stream.match(reFloatForm, true, false)) {
85
+ return 'number';
86
+ }
87
+
88
+ // look for placeholders
89
+ if (stream.match(rePattern, true, false)) {
90
+ return 'variableName.special';
91
+ }
92
+
93
+ // match all braces separately
94
+ if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
95
+ return 'bracket';
96
+ }
97
+
98
+ // literals looking like function calls
99
+ if (stream.match(reFunctionLike, true, false)) {
100
+ stream.backUp(1);
101
+ return 'variableName.function';
102
+ }
103
+
104
+ // all other identifiers
105
+ if (stream.match(reIdentifier, true, false)) {
106
+ return 'variable';
107
+ }
108
+
109
+ // operators; note that operators like @@ or /; are matched separately for each symbol.
110
+ if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%|#)/, true, false)) {
111
+ return 'operator';
112
+ }
113
+
114
+ // everything else is an error
115
+ return 'error';
116
+ }
117
+
118
+ function tokenString(stream, state) {
119
+ var next, end = false, escaped = false;
120
+ while ((next = stream.next()) != null) {
121
+ if (next === '"' && !escaped) {
122
+ end = true;
123
+ break;
124
+ }
125
+ escaped = !escaped && next === '\\';
126
+ }
127
+ if (end && !escaped) {
128
+ state.tokenize = tokenBase;
129
+ }
130
+ return 'string';
131
+ };
132
+
133
+ function tokenComment(stream, state) {
134
+ var prev, next;
135
+ while((next = stream.next()) != null) {
136
+ if (prev === '*' && next === '/') {
137
+ state.tokenize = tokenBase;
138
+ break;
139
+ }
140
+ prev = next;
141
+ }
142
+ return 'comment';
143
+ }
144
+
145
+ function currentScope(state) {
146
+ var scope = null;
147
+ if (state.scopes.length > 0)
148
+ scope = state.scopes[state.scopes.length - 1];
149
+ return scope;
150
+ }
151
+
152
+ export const yacas = {
153
+ name: "yacas",
154
+ startState: function() {
155
+ return {
156
+ tokenize: tokenBase,
157
+ scopes: []
158
+ };
159
+ },
160
+ token: function(stream, state) {
161
+ if (stream.eatSpace()) return null;
162
+ return state.tokenize(stream, state);
163
+ },
164
+ indent: function(state, textAfter, cx) {
165
+ if (state.tokenize !== tokenBase && state.tokenize !== null)
166
+ return null;
167
+
168
+ var delta = 0;
169
+ if (textAfter === ']' || textAfter === '];' ||
170
+ textAfter === '}' || textAfter === '};' ||
171
+ textAfter === ');')
172
+ delta = -1;
173
+
174
+ return (state.scopes.length + delta) * cx.unit;
175
+ },
176
+
177
+ languageData: {
178
+ electricInput: /[{}\[\]()\;]/,
179
+ commentTokens: {line: "//", block: {open: "/*", close: "*/"}}
180
+ }
181
+ };
package/mode/yaml.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const yaml: StreamParser<unknown>