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

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 +143 -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,266 @@
1
+ var words = {};
2
+ var isDoubleOperatorSym = {
3
+ eq: 'operator',
4
+ lt: 'operator',
5
+ le: 'operator',
6
+ gt: 'operator',
7
+ ge: 'operator',
8
+ "in": 'operator',
9
+ ne: 'operator',
10
+ or: 'operator'
11
+ };
12
+ var isDoubleOperatorChar = /(<=|>=|!=|<>)/;
13
+ var isSingleOperatorChar = /[=\(:\),{}.*<>+\-\/^\[\]]/;
14
+
15
+ // Takes a string of words separated by spaces and adds them as
16
+ // keys with the value of the first argument 'style'
17
+ function define(style, string, context) {
18
+ if (context) {
19
+ var split = string.split(' ');
20
+ for (var i = 0; i < split.length; i++) {
21
+ words[split[i]] = {style: style, state: context};
22
+ }
23
+ }
24
+ }
25
+ //datastep
26
+ define('def', 'stack pgm view source debug nesting nolist', ['inDataStep']);
27
+ define('def', 'if while until for do do; end end; then else cancel', ['inDataStep']);
28
+ define('def', 'label format _n_ _error_', ['inDataStep']);
29
+ define('def', 'ALTER BUFNO BUFSIZE CNTLLEV COMPRESS DLDMGACTION ENCRYPT ENCRYPTKEY EXTENDOBSCOUNTER GENMAX GENNUM INDEX LABEL OBSBUF OUTREP PW PWREQ READ REPEMPTY REPLACE REUSE ROLE SORTEDBY SPILL TOBSNO TYPE WRITE FILECLOSE FIRSTOBS IN OBS POINTOBS WHERE WHEREUP IDXNAME IDXWHERE DROP KEEP RENAME', ['inDataStep']);
30
+ define('def', 'filevar finfo finv fipname fipnamel fipstate first firstobs floor', ['inDataStep']);
31
+ define('def', 'varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vnferr vtype vtypex weekday', ['inDataStep']);
32
+ define('def', 'zipfips zipname zipnamel zipstate', ['inDataStep']);
33
+ define('def', 'put putc putn', ['inDataStep']);
34
+ define('builtin', 'data run', ['inDataStep']);
35
+
36
+
37
+ //proc
38
+ define('def', 'data', ['inProc']);
39
+
40
+ // flow control for macros
41
+ define('def', '%if %end %end; %else %else; %do %do; %then', ['inMacro']);
42
+
43
+ //everywhere
44
+ define('builtin', 'proc run; quit; libname filename %macro %mend option options', ['ALL']);
45
+
46
+ define('def', 'footnote title libname ods', ['ALL']);
47
+ define('def', '%let %put %global %sysfunc %eval ', ['ALL']);
48
+ // automatic macro variables http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003167023.htm
49
+ define('variable', '&sysbuffr &syscc &syscharwidth &syscmd &sysdate &sysdate9 &sysday &sysdevic &sysdmg &sysdsn &sysencoding &sysenv &syserr &syserrortext &sysfilrc &syshostname &sysindex &sysinfo &sysjobid &syslast &syslckrc &syslibrc &syslogapplname &sysmacroname &sysmenv &sysmsg &sysncpu &sysodspath &sysparm &syspbuff &sysprocessid &sysprocessname &sysprocname &sysrc &sysscp &sysscpl &sysscpl &syssite &sysstartid &sysstartname &systcpiphostname &systime &sysuserid &sysver &sysvlong &sysvlong4 &syswarningtext', ['ALL']);
50
+
51
+ //footnote[1-9]? title[1-9]?
52
+
53
+ //options statement
54
+ define('def', 'source2 nosource2 page pageno pagesize', ['ALL']);
55
+
56
+ //proc and datastep
57
+ define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddfm ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau random ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni rcorr read recfm register regr remote remove rename repeat repeated replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover sub subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max', ['inDataStep', 'inProc']);
58
+ define('operator', 'and not ', ['inDataStep', 'inProc']);
59
+
60
+ // Main function
61
+ function tokenize(stream, state) {
62
+ // Finally advance the stream
63
+ var ch = stream.next();
64
+
65
+ // BLOCKCOMMENT
66
+ if (ch === '/' && stream.eat('*')) {
67
+ state.continueComment = true;
68
+ return "comment";
69
+ } else if (state.continueComment === true) { // in comment block
70
+ //comment ends at the beginning of the line
71
+ if (ch === '*' && stream.peek() === '/') {
72
+ stream.next();
73
+ state.continueComment = false;
74
+ } else if (stream.skipTo('*')) { //comment is potentially later in line
75
+ stream.skipTo('*');
76
+ stream.next();
77
+ if (stream.eat('/'))
78
+ state.continueComment = false;
79
+ } else {
80
+ stream.skipToEnd();
81
+ }
82
+ return "comment";
83
+ }
84
+
85
+ if (ch == "*" && stream.column() == stream.indentation()) {
86
+ stream.skipToEnd()
87
+ return "comment"
88
+ }
89
+
90
+ // DoubleOperator match
91
+ var doubleOperator = ch + stream.peek();
92
+
93
+ if ((ch === '"' || ch === "'") && !state.continueString) {
94
+ state.continueString = ch
95
+ return "string"
96
+ } else if (state.continueString) {
97
+ if (state.continueString == ch) {
98
+ state.continueString = null;
99
+ } else if (stream.skipTo(state.continueString)) {
100
+ // quote found on this line
101
+ stream.next();
102
+ state.continueString = null;
103
+ } else {
104
+ stream.skipToEnd();
105
+ }
106
+ return "string";
107
+ } else if (state.continueString !== null && stream.eol()) {
108
+ stream.skipTo(state.continueString) || stream.skipToEnd();
109
+ return "string";
110
+ } else if (/[\d\.]/.test(ch)) { //find numbers
111
+ if (ch === ".")
112
+ stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
113
+ else if (ch === "0")
114
+ stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
115
+ else
116
+ stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
117
+ return "number";
118
+ } else if (isDoubleOperatorChar.test(ch + stream.peek())) { // TWO SYMBOL TOKENS
119
+ stream.next();
120
+ return "operator";
121
+ } else if (isDoubleOperatorSym.hasOwnProperty(doubleOperator)) {
122
+ stream.next();
123
+ if (stream.peek() === ' ')
124
+ return isDoubleOperatorSym[doubleOperator.toLowerCase()];
125
+ } else if (isSingleOperatorChar.test(ch)) { // SINGLE SYMBOL TOKENS
126
+ return "operator";
127
+ }
128
+
129
+ // Matches one whole word -- even if the word is a character
130
+ var word;
131
+ if (stream.match(/[%&;\w]+/, false) != null) {
132
+ word = ch + stream.match(/[%&;\w]+/, true);
133
+ if (/&/.test(word)) return 'variable'
134
+ } else {
135
+ word = ch;
136
+ }
137
+ // the word after DATA PROC or MACRO
138
+ if (state.nextword) {
139
+ stream.match(/[\w]+/);
140
+ // match memname.libname
141
+ if (stream.peek() === '.') stream.skipTo(' ');
142
+ state.nextword = false;
143
+ return 'variableName.special';
144
+ }
145
+
146
+ word = word.toLowerCase()
147
+ // Are we in a DATA Step?
148
+ if (state.inDataStep) {
149
+ if (word === 'run;' || stream.match(/run\s;/)) {
150
+ state.inDataStep = false;
151
+ return 'builtin';
152
+ }
153
+ // variable formats
154
+ if ((word) && stream.next() === '.') {
155
+ //either a format or libname.memname
156
+ if (/\w/.test(stream.peek())) return 'variableName.special';
157
+ else return 'variable';
158
+ }
159
+ // do we have a DATA Step keyword
160
+ if (word && words.hasOwnProperty(word) &&
161
+ (words[word].state.indexOf("inDataStep") !== -1 ||
162
+ words[word].state.indexOf("ALL") !== -1)) {
163
+ //backup to the start of the word
164
+ if (stream.start < stream.pos)
165
+ stream.backUp(stream.pos - stream.start);
166
+ //advance the length of the word and return
167
+ for (var i = 0; i < word.length; ++i) stream.next();
168
+ return words[word].style;
169
+ }
170
+ }
171
+ // Are we in an Proc statement?
172
+ if (state.inProc) {
173
+ if (word === 'run;' || word === 'quit;') {
174
+ state.inProc = false;
175
+ return 'builtin';
176
+ }
177
+ // do we have a proc keyword
178
+ if (word && words.hasOwnProperty(word) &&
179
+ (words[word].state.indexOf("inProc") !== -1 ||
180
+ words[word].state.indexOf("ALL") !== -1)) {
181
+ stream.match(/[\w]+/);
182
+ return words[word].style;
183
+ }
184
+ }
185
+ // Are we in a Macro statement?
186
+ if (state.inMacro) {
187
+ if (word === '%mend') {
188
+ if (stream.peek() === ';') stream.next();
189
+ state.inMacro = false;
190
+ return 'builtin';
191
+ }
192
+ if (word && words.hasOwnProperty(word) &&
193
+ (words[word].state.indexOf("inMacro") !== -1 ||
194
+ words[word].state.indexOf("ALL") !== -1)) {
195
+ stream.match(/[\w]+/);
196
+ return words[word].style;
197
+ }
198
+
199
+ return 'atom';
200
+ }
201
+ // Do we have Keywords specific words?
202
+ if (word && words.hasOwnProperty(word)) {
203
+ // Negates the initial next()
204
+ stream.backUp(1);
205
+ // Actually move the stream
206
+ stream.match(/[\w]+/);
207
+ if (word === 'data' && /=/.test(stream.peek()) === false) {
208
+ state.inDataStep = true;
209
+ state.nextword = true;
210
+ return 'builtin';
211
+ }
212
+ if (word === 'proc') {
213
+ state.inProc = true;
214
+ state.nextword = true;
215
+ return 'builtin';
216
+ }
217
+ if (word === '%macro') {
218
+ state.inMacro = true;
219
+ state.nextword = true;
220
+ return 'builtin';
221
+ }
222
+ if (/title[1-9]/.test(word)) return 'def';
223
+
224
+ if (word === 'footnote') {
225
+ stream.eat(/[1-9]/);
226
+ return 'def';
227
+ }
228
+
229
+ // Returns their value as state in the prior define methods
230
+ if (state.inDataStep === true && words[word].state.indexOf("inDataStep") !== -1)
231
+ return words[word].style;
232
+ if (state.inProc === true && words[word].state.indexOf("inProc") !== -1)
233
+ return words[word].style;
234
+ if (state.inMacro === true && words[word].state.indexOf("inMacro") !== -1)
235
+ return words[word].style;
236
+ if (words[word].state.indexOf("ALL") !== -1)
237
+ return words[word].style;
238
+ return null;
239
+ }
240
+ // Unrecognized syntax
241
+ return null;
242
+ }
243
+
244
+ export const sas = {
245
+ name: "sas",
246
+ startState: function () {
247
+ return {
248
+ inDataStep: false,
249
+ inProc: false,
250
+ inMacro: false,
251
+ nextword: false,
252
+ continueString: null,
253
+ continueComment: false
254
+ };
255
+ },
256
+ token: function (stream, state) {
257
+ // Strip the spaces, but regex will account for them either way
258
+ if (stream.eatSpace()) return null;
259
+ // Go through the main process
260
+ return tokenize(stream, state);
261
+ },
262
+
263
+ languageData: {
264
+ commentTokens: {block: {open: "/*", close: "*/"}}
265
+ }
266
+ };
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const sass: StreamParser<unknown>
@@ -0,0 +1,427 @@
1
+ import {keywords as cssKeywords} from "./css.js"
2
+ const propertyKeywords = new Set(cssKeywords.properties)
3
+ const colorKeywords = new Set(cssKeywords.colors)
4
+ const valueKeywords = new Set(cssKeywords.values)
5
+ const fontProperties = new Set(cssKeywords.fonts)
6
+
7
+ function tokenRegexp(words) {
8
+ return new RegExp("^" + words.join("|"))
9
+ }
10
+
11
+ let keywords = ["true", "false", "null", "auto"]
12
+ let keywordsRegexp = new RegExp("^" + keywords.join("|"))
13
+
14
+ let operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-",
15
+ "\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"]
16
+ let opRegexp = tokenRegexp(operators)
17
+
18
+ let pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/
19
+
20
+ let word
21
+
22
+ function isEndLine(stream) {
23
+ return !stream.peek() || stream.match(/\s+$/, false)
24
+ }
25
+
26
+ function urlTokens(stream, state) {
27
+ let ch = stream.peek()
28
+
29
+ if (ch === ")") {
30
+ stream.next()
31
+ state.tokenizer = tokenBase
32
+ return "operator"
33
+ } else if (ch === "(") {
34
+ stream.next()
35
+ stream.eatSpace()
36
+
37
+ return "operator"
38
+ } else if (ch === "'" || ch === '"') {
39
+ state.tokenizer = buildStringTokenizer(stream.next())
40
+ return "string"
41
+ } else {
42
+ state.tokenizer = buildStringTokenizer(")", false)
43
+ return "string"
44
+ }
45
+ }
46
+ function comment(indentation, multiLine) {
47
+ return function(stream, state) {
48
+ if (stream.sol() && stream.indentation() <= indentation) {
49
+ state.tokenizer = tokenBase
50
+ return tokenBase(stream, state)
51
+ }
52
+
53
+ if (multiLine && stream.skipTo("*/")) {
54
+ stream.next()
55
+ stream.next()
56
+ state.tokenizer = tokenBase
57
+ } else {
58
+ stream.skipToEnd()
59
+ }
60
+
61
+ return "comment"
62
+ }
63
+ }
64
+
65
+ function buildStringTokenizer(quote, greedy) {
66
+ if (greedy == null) { greedy = true }
67
+
68
+ function stringTokenizer(stream, state) {
69
+ let nextChar = stream.next()
70
+ let peekChar = stream.peek()
71
+ let previousChar = stream.string.charAt(stream.pos-2)
72
+
73
+ let endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\"))
74
+
75
+ if (endingString) {
76
+ if (nextChar !== quote && greedy) { stream.next() }
77
+ if (isEndLine(stream)) {
78
+ state.cursorHalf = 0
79
+ }
80
+ state.tokenizer = tokenBase
81
+ return "string"
82
+ } else if (nextChar === "#" && peekChar === "{") {
83
+ state.tokenizer = buildInterpolationTokenizer(stringTokenizer)
84
+ stream.next()
85
+ return "operator"
86
+ } else {
87
+ return "string"
88
+ }
89
+ }
90
+
91
+ return stringTokenizer
92
+ }
93
+
94
+ function buildInterpolationTokenizer(currentTokenizer) {
95
+ return function(stream, state) {
96
+ if (stream.peek() === "}") {
97
+ stream.next()
98
+ state.tokenizer = currentTokenizer
99
+ return "operator"
100
+ } else {
101
+ return tokenBase(stream, state)
102
+ }
103
+ }
104
+ }
105
+
106
+ function indent(state, stream) {
107
+ if (state.indentCount == 0) {
108
+ state.indentCount++
109
+ let lastScopeOffset = state.scopes[0].offset
110
+ let currentOffset = lastScopeOffset + stream.indentUnit
111
+ state.scopes.unshift({ offset:currentOffset })
112
+ }
113
+ }
114
+
115
+ function dedent(state) {
116
+ if (state.scopes.length == 1) return
117
+
118
+ state.scopes.shift()
119
+ }
120
+
121
+ function tokenBase(stream, state) {
122
+ let ch = stream.peek()
123
+
124
+ // Comment
125
+ if (stream.match("/*")) {
126
+ state.tokenizer = comment(stream.indentation(), true)
127
+ return state.tokenizer(stream, state)
128
+ }
129
+ if (stream.match("//")) {
130
+ state.tokenizer = comment(stream.indentation(), false)
131
+ return state.tokenizer(stream, state)
132
+ }
133
+
134
+ // Interpolation
135
+ if (stream.match("#{")) {
136
+ state.tokenizer = buildInterpolationTokenizer(tokenBase)
137
+ return "operator"
138
+ }
139
+
140
+ // Strings
141
+ if (ch === '"' || ch === "'") {
142
+ stream.next()
143
+ state.tokenizer = buildStringTokenizer(ch)
144
+ return "string"
145
+ }
146
+
147
+ if (!state.cursorHalf) {
148
+ // first half i.e. before : for key-value pairs
149
+ // including selectors
150
+ if (ch === "-") {
151
+ if (stream.match(/^-\w+-/)) {
152
+ return "meta"
153
+ }
154
+ }
155
+
156
+ if (ch === ".") {
157
+ stream.next()
158
+ if (stream.match(/^[\w-]+/)) {
159
+ indent(state, stream)
160
+ return "qualifier"
161
+ } else if (stream.peek() === "#") {
162
+ indent(state, stream)
163
+ return "tag"
164
+ }
165
+ }
166
+
167
+ if (ch === "#") {
168
+ stream.next()
169
+ // ID selectors
170
+ if (stream.match(/^[\w-]+/)) {
171
+ indent(state, stream)
172
+ return "builtin"
173
+ }
174
+ if (stream.peek() === "#") {
175
+ indent(state, stream)
176
+ return "tag"
177
+ }
178
+ }
179
+
180
+ // Variables
181
+ if (ch === "$") {
182
+ stream.next()
183
+ stream.eatWhile(/[\w-]/)
184
+ return "variable-2"
185
+ }
186
+
187
+ // Numbers
188
+ if (stream.match(/^-?[0-9\.]+/))
189
+ return "number"
190
+
191
+ // Units
192
+ if (stream.match(/^(px|em|in)\b/))
193
+ return "unit"
194
+
195
+ if (stream.match(keywordsRegexp))
196
+ return "keyword"
197
+
198
+ if (stream.match(/^url/) && stream.peek() === "(") {
199
+ state.tokenizer = urlTokens
200
+ return "atom"
201
+ }
202
+
203
+ if (ch === "=") {
204
+ // Match shortcut mixin definition
205
+ if (stream.match(/^=[\w-]+/)) {
206
+ indent(state, stream)
207
+ return "meta"
208
+ }
209
+ }
210
+
211
+ if (ch === "+") {
212
+ // Match shortcut mixin definition
213
+ if (stream.match(/^\+[\w-]+/)) {
214
+ return "meta"
215
+ }
216
+ }
217
+
218
+ if (ch === "@") {
219
+ if (stream.match('@extend')) {
220
+ if (!stream.match(/\s*[\w]/))
221
+ dedent(state)
222
+ }
223
+ }
224
+
225
+
226
+ // Indent Directives
227
+ if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) {
228
+ indent(state, stream)
229
+ return "def"
230
+ }
231
+
232
+ // Other Directives
233
+ if (ch === "@") {
234
+ stream.next()
235
+ stream.eatWhile(/[\w-]/)
236
+ return "def"
237
+ }
238
+
239
+ if (stream.eatWhile(/[\w-]/)) {
240
+ if (stream.match(/ *: *[\w-\+\$#!\("']/,false)) {
241
+ word = stream.current().toLowerCase()
242
+ let prop = state.prevProp + "-" + word
243
+ if (propertyKeywords.has(prop)) {
244
+ return "property"
245
+ } else if (propertyKeywords.has(word)) {
246
+ state.prevProp = word
247
+ return "property"
248
+ } else if (fontProperties.has(word)) {
249
+ return "property"
250
+ }
251
+ return "tag"
252
+ } else if (stream.match(/ *:/,false)) {
253
+ indent(state, stream)
254
+ state.cursorHalf = 1
255
+ state.prevProp = stream.current().toLowerCase()
256
+ return "property"
257
+ } else if (stream.match(/ *,/,false)) {
258
+ return "tag"
259
+ } else {
260
+ indent(state, stream)
261
+ return "tag"
262
+ }
263
+ }
264
+
265
+ if (ch === ":") {
266
+ if (stream.match(pseudoElementsRegexp)) { // could be a pseudo-element
267
+ return "type"
268
+ }
269
+ stream.next()
270
+ state.cursorHalf=1
271
+ return "operator"
272
+ }
273
+ } else {
274
+ if (ch === "#") {
275
+ stream.next()
276
+ // Hex numbers
277
+ if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)) {
278
+ if (isEndLine(stream)) {
279
+ state.cursorHalf = 0
280
+ }
281
+ return "number"
282
+ }
283
+ }
284
+
285
+ // Numbers
286
+ if (stream.match(/^-?[0-9\.]+/)) {
287
+ if (isEndLine(stream)) {
288
+ state.cursorHalf = 0
289
+ }
290
+ return "number"
291
+ }
292
+
293
+ // Units
294
+ if (stream.match(/^(px|em|in)\b/)) {
295
+ if (isEndLine(stream)) {
296
+ state.cursorHalf = 0
297
+ }
298
+ return "unit"
299
+ }
300
+
301
+ if (stream.match(keywordsRegexp)) {
302
+ if (isEndLine(stream)) {
303
+ state.cursorHalf = 0
304
+ }
305
+ return "keyword"
306
+ }
307
+
308
+ if (stream.match(/^url/) && stream.peek() === "(") {
309
+ state.tokenizer = urlTokens
310
+ if (isEndLine(stream)) {
311
+ state.cursorHalf = 0
312
+ }
313
+ return "atom"
314
+ }
315
+
316
+ // Variables
317
+ if (ch === "$") {
318
+ stream.next()
319
+ stream.eatWhile(/[\w-]/)
320
+ if (isEndLine(stream)) {
321
+ state.cursorHalf = 0
322
+ }
323
+ return "variable-2"
324
+ }
325
+
326
+ // bang character for !important, !default, etc.
327
+ if (ch === "!") {
328
+ stream.next()
329
+ state.cursorHalf = 0
330
+ return stream.match(/^[\w]+/) ? "keyword": "operator"
331
+ }
332
+
333
+ if (stream.match(opRegexp)) {
334
+ if (isEndLine(stream)) {
335
+ state.cursorHalf = 0
336
+ }
337
+ return "operator"
338
+ }
339
+
340
+ // attributes
341
+ if (stream.eatWhile(/[\w-]/)) {
342
+ if (isEndLine(stream)) {
343
+ state.cursorHalf = 0
344
+ }
345
+ word = stream.current().toLowerCase()
346
+ if (valueKeywords.has(word)) {
347
+ return "atom"
348
+ } else if (colorKeywords.has(word)) {
349
+ return "keyword"
350
+ } else if (propertyKeywords.has(word)) {
351
+ state.prevProp = stream.current().toLowerCase()
352
+ return "property"
353
+ } else {
354
+ return "tag"
355
+ }
356
+ }
357
+
358
+ if (isEndLine(stream)) {
359
+ state.cursorHalf = 0
360
+ return null
361
+ }
362
+ }
363
+
364
+ if (stream.match(opRegexp))
365
+ return "operator"
366
+
367
+ stream.next()
368
+ return null
369
+ }
370
+
371
+ function tokenLexer(stream, state) {
372
+ if (stream.sol()) state.indentCount = 0
373
+ let style = state.tokenizer(stream, state)
374
+ let current = stream.current()
375
+
376
+ if (current === "@return" || current === "}") {
377
+ dedent(state)
378
+ }
379
+
380
+ if (style !== null) {
381
+ let startOfToken = stream.pos - current.length
382
+
383
+ let withCurrentIndent = startOfToken + (stream.indentUnit * state.indentCount)
384
+
385
+ let newScopes = []
386
+
387
+ for (let i = 0; i < state.scopes.length; i++) {
388
+ let scope = state.scopes[i]
389
+
390
+ if (scope.offset <= withCurrentIndent)
391
+ newScopes.push(scope)
392
+ }
393
+
394
+ state.scopes = newScopes
395
+ }
396
+
397
+ return style
398
+ }
399
+
400
+ export const sass = {
401
+ name: "sass",
402
+ startState: function() {
403
+ return {
404
+ tokenizer: tokenBase,
405
+ scopes: [{offset: 0, type: "sass"}],
406
+ indentCount: 0,
407
+ cursorHalf: 0, // cursor half tells us if cursor lies after (1)
408
+ // or before (0) colon (well... more or less)
409
+ definedVars: [],
410
+ definedMixins: []
411
+ }
412
+ },
413
+ token: function(stream, state) {
414
+ let style = tokenLexer(stream, state)
415
+ state.lastToken = { style: style, content: stream.current() }
416
+ return style
417
+ },
418
+
419
+ indent: function(state) {
420
+ return state.scopes[0].offset
421
+ },
422
+
423
+ languageData: {
424
+ commentTokens: {line: "//", block: {open: "/*", close: "*/"}},
425
+ autocomplete: cssKeywords.all
426
+ }
427
+ }
@@ -0,0 +1,2 @@
1
+ import {StreamParser} from "@quirekit/cm-language"
2
+ export declare const scheme: StreamParser<unknown>