@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
package/mode/css.js ADDED
@@ -0,0 +1,846 @@
1
+ export function mkCSS(parserConfig) {
2
+ parserConfig = {...defaults, ...parserConfig}
3
+ var inline = parserConfig.inline
4
+
5
+ var tokenHooks = parserConfig.tokenHooks,
6
+ documentTypes = parserConfig.documentTypes || {},
7
+ mediaTypes = parserConfig.mediaTypes || {},
8
+ mediaFeatures = parserConfig.mediaFeatures || {},
9
+ mediaValueKeywords = parserConfig.mediaValueKeywords || {},
10
+ propertyKeywords = parserConfig.propertyKeywords || {},
11
+ nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
12
+ fontProperties = parserConfig.fontProperties || {},
13
+ counterDescriptors = parserConfig.counterDescriptors || {},
14
+ colorKeywords = parserConfig.colorKeywords || {},
15
+ valueKeywords = parserConfig.valueKeywords || {},
16
+ allowNested = parserConfig.allowNested,
17
+ lineComment = parserConfig.lineComment,
18
+ supportsAtComponent = parserConfig.supportsAtComponent === true,
19
+ highlightNonStandardPropertyKeywords = parserConfig.highlightNonStandardPropertyKeywords !== false;
20
+
21
+ var type, override;
22
+ function ret(style, tp) { type = tp; return style; }
23
+
24
+ // Tokenizers
25
+
26
+ function tokenBase(stream, state) {
27
+ var ch = stream.next();
28
+ if (tokenHooks[ch]) {
29
+ var result = tokenHooks[ch](stream, state);
30
+ if (result !== false) return result;
31
+ }
32
+ if (ch == "@") {
33
+ stream.eatWhile(/[\w\\\-]/);
34
+ return ret("def", stream.current());
35
+ } else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
36
+ return ret(null, "compare");
37
+ } else if (ch == "\"" || ch == "'") {
38
+ state.tokenize = tokenString(ch);
39
+ return state.tokenize(stream, state);
40
+ } else if (ch == "#") {
41
+ stream.eatWhile(/[\w\\\-]/);
42
+ return ret("atom", "hash");
43
+ } else if (ch == "!") {
44
+ stream.match(/^\s*\w*/);
45
+ return ret("keyword", "important");
46
+ } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
47
+ stream.eatWhile(/[\w.%]/);
48
+ return ret("number", "unit");
49
+ } else if (ch === "-") {
50
+ if (/[\d.]/.test(stream.peek())) {
51
+ stream.eatWhile(/[\w.%]/);
52
+ return ret("number", "unit");
53
+ } else if (stream.match(/^-[\w\\\-]*/)) {
54
+ stream.eatWhile(/[\w\\\-]/);
55
+ if (stream.match(/^\s*:/, false))
56
+ return ret("def", "variable-definition");
57
+ return ret("variableName", "variable");
58
+ } else if (stream.match(/^\w+-/)) {
59
+ return ret("meta", "meta");
60
+ }
61
+ } else if (/[,+>*\/]/.test(ch)) {
62
+ return ret(null, "select-op");
63
+ } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
64
+ return ret("qualifier", "qualifier");
65
+ } else if (/[:;{}\[\]\(\)]/.test(ch)) {
66
+ return ret(null, ch);
67
+ } else if (stream.match(/^[\w-.]+(?=\()/)) {
68
+ if (/^(url(-prefix)?|domain|regexp)$/i.test(stream.current())) {
69
+ state.tokenize = tokenParenthesized;
70
+ }
71
+ return ret("variableName.function", "variable");
72
+ } else if (/[\w\\\-]/.test(ch)) {
73
+ stream.eatWhile(/[\w\\\-]/);
74
+ return ret("property", "word");
75
+ } else {
76
+ return ret(null, null);
77
+ }
78
+ }
79
+
80
+ function tokenString(quote) {
81
+ return function(stream, state) {
82
+ var escaped = false, ch;
83
+ while ((ch = stream.next()) != null) {
84
+ if (ch == quote && !escaped) {
85
+ if (quote == ")") stream.backUp(1);
86
+ break;
87
+ }
88
+ escaped = !escaped && ch == "\\";
89
+ }
90
+ if (ch == quote || !escaped && quote != ")") state.tokenize = null;
91
+ return ret("string", "string");
92
+ };
93
+ }
94
+
95
+ function tokenParenthesized(stream, state) {
96
+ stream.next(); // Must be '('
97
+ if (!stream.match(/^\s*[\"\')]/, false))
98
+ state.tokenize = tokenString(")");
99
+ else
100
+ state.tokenize = null;
101
+ return ret(null, "(");
102
+ }
103
+
104
+ // Context management
105
+
106
+ function Context(type, indent, prev) {
107
+ this.type = type;
108
+ this.indent = indent;
109
+ this.prev = prev;
110
+ }
111
+
112
+ function pushContext(state, stream, type, indent) {
113
+ state.context = new Context(type, stream.indentation() + (indent === false ? 0 : stream.indentUnit), state.context);
114
+ return type;
115
+ }
116
+
117
+ function popContext(state) {
118
+ if (state.context.prev)
119
+ state.context = state.context.prev;
120
+ return state.context.type;
121
+ }
122
+
123
+ function pass(type, stream, state) {
124
+ return states[state.context.type](type, stream, state);
125
+ }
126
+ function popAndPass(type, stream, state, n) {
127
+ for (var i = n || 1; i > 0; i--)
128
+ state.context = state.context.prev;
129
+ return pass(type, stream, state);
130
+ }
131
+
132
+ // Parser
133
+
134
+ function wordAsValue(stream) {
135
+ var word = stream.current().toLowerCase();
136
+ if (valueKeywords.hasOwnProperty(word))
137
+ override = "atom";
138
+ else if (colorKeywords.hasOwnProperty(word))
139
+ override = "keyword";
140
+ else
141
+ override = "variable";
142
+ }
143
+
144
+ var states = {};
145
+
146
+ states.top = function(type, stream, state) {
147
+ if (type == "{") {
148
+ return pushContext(state, stream, "block");
149
+ } else if (type == "}" && state.context.prev) {
150
+ return popContext(state);
151
+ } else if (supportsAtComponent && /@component/i.test(type)) {
152
+ return pushContext(state, stream, "atComponentBlock");
153
+ } else if (/^@(-moz-)?document$/i.test(type)) {
154
+ return pushContext(state, stream, "documentTypes");
155
+ } else if (/^@(media|supports|(-moz-)?document|import)$/i.test(type)) {
156
+ return pushContext(state, stream, "atBlock");
157
+ } else if (/^@(font-face|counter-style)/i.test(type)) {
158
+ state.stateArg = type;
159
+ return "restricted_atBlock_before";
160
+ } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(type)) {
161
+ return "keyframes";
162
+ } else if (type && type.charAt(0) == "@") {
163
+ return pushContext(state, stream, "at");
164
+ } else if (type == "hash") {
165
+ override = "builtin";
166
+ } else if (type == "word") {
167
+ override = "tag";
168
+ } else if (type == "variable-definition") {
169
+ return "maybeprop";
170
+ } else if (type == "interpolation") {
171
+ return pushContext(state, stream, "interpolation");
172
+ } else if (type == ":") {
173
+ return "pseudo";
174
+ } else if (allowNested && type == "(") {
175
+ return pushContext(state, stream, "parens");
176
+ }
177
+ return state.context.type;
178
+ };
179
+
180
+ states.block = function(type, stream, state) {
181
+ if (type == "word") {
182
+ var word = stream.current().toLowerCase();
183
+ if (propertyKeywords.hasOwnProperty(word)) {
184
+ override = "property";
185
+ return "maybeprop";
186
+ } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
187
+ override = highlightNonStandardPropertyKeywords ? "string.special" : "property";
188
+ return "maybeprop";
189
+ } else if (allowNested) {
190
+ override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
191
+ return "block";
192
+ } else {
193
+ override = "error";
194
+ return "maybeprop";
195
+ }
196
+ } else if (type == "meta") {
197
+ return "block";
198
+ } else if (!allowNested && (type == "hash" || type == "qualifier")) {
199
+ override = "error";
200
+ return "block";
201
+ } else {
202
+ return states.top(type, stream, state);
203
+ }
204
+ };
205
+
206
+ states.maybeprop = function(type, stream, state) {
207
+ if (type == ":") return pushContext(state, stream, "prop");
208
+ return pass(type, stream, state);
209
+ };
210
+
211
+ states.prop = function(type, stream, state) {
212
+ if (type == ";") return popContext(state);
213
+ if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
214
+ if (type == "}" || type == "{") return popAndPass(type, stream, state);
215
+ if (type == "(") return pushContext(state, stream, "parens");
216
+
217
+ if (type == "hash" && !/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(stream.current())) {
218
+ override = "error";
219
+ } else if (type == "word") {
220
+ wordAsValue(stream);
221
+ } else if (type == "interpolation") {
222
+ return pushContext(state, stream, "interpolation");
223
+ }
224
+ return "prop";
225
+ };
226
+
227
+ states.propBlock = function(type, _stream, state) {
228
+ if (type == "}") return popContext(state);
229
+ if (type == "word") { override = "property"; return "maybeprop"; }
230
+ return state.context.type;
231
+ };
232
+
233
+ states.parens = function(type, stream, state) {
234
+ if (type == "{" || type == "}") return popAndPass(type, stream, state);
235
+ if (type == ")") return popContext(state);
236
+ if (type == "(") return pushContext(state, stream, "parens");
237
+ if (type == "interpolation") return pushContext(state, stream, "interpolation");
238
+ if (type == "word") wordAsValue(stream);
239
+ return "parens";
240
+ };
241
+
242
+ states.pseudo = function(type, stream, state) {
243
+ if (type == "meta") return "pseudo";
244
+
245
+ if (type == "word") {
246
+ override = "variableName.constant";
247
+ return state.context.type;
248
+ }
249
+ return pass(type, stream, state);
250
+ };
251
+
252
+ states.documentTypes = function(type, stream, state) {
253
+ if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
254
+ override = "tag";
255
+ return state.context.type;
256
+ } else {
257
+ return states.atBlock(type, stream, state);
258
+ }
259
+ };
260
+
261
+ states.atBlock = function(type, stream, state) {
262
+ if (type == "(") return pushContext(state, stream, "atBlock_parens");
263
+ if (type == "}" || type == ";") return popAndPass(type, stream, state);
264
+ if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
265
+
266
+ if (type == "interpolation") return pushContext(state, stream, "interpolation");
267
+
268
+ if (type == "word") {
269
+ var word = stream.current().toLowerCase();
270
+ if (word == "only" || word == "not" || word == "and" || word == "or")
271
+ override = "keyword";
272
+ else if (mediaTypes.hasOwnProperty(word))
273
+ override = "attribute";
274
+ else if (mediaFeatures.hasOwnProperty(word))
275
+ override = "property";
276
+ else if (mediaValueKeywords.hasOwnProperty(word))
277
+ override = "keyword";
278
+ else if (propertyKeywords.hasOwnProperty(word))
279
+ override = "property";
280
+ else if (nonStandardPropertyKeywords.hasOwnProperty(word))
281
+ override = highlightNonStandardPropertyKeywords ? "string.special" : "property";
282
+ else if (valueKeywords.hasOwnProperty(word))
283
+ override = "atom";
284
+ else if (colorKeywords.hasOwnProperty(word))
285
+ override = "keyword";
286
+ else
287
+ override = "error";
288
+ }
289
+ return state.context.type;
290
+ };
291
+
292
+ states.atComponentBlock = function(type, stream, state) {
293
+ if (type == "}")
294
+ return popAndPass(type, stream, state);
295
+ if (type == "{")
296
+ return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
297
+ if (type == "word")
298
+ override = "error";
299
+ return state.context.type;
300
+ };
301
+
302
+ states.atBlock_parens = function(type, stream, state) {
303
+ if (type == ")") return popContext(state);
304
+ if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
305
+ return states.atBlock(type, stream, state);
306
+ };
307
+
308
+ states.restricted_atBlock_before = function(type, stream, state) {
309
+ if (type == "{")
310
+ return pushContext(state, stream, "restricted_atBlock");
311
+ if (type == "word" && state.stateArg == "@counter-style") {
312
+ override = "variable";
313
+ return "restricted_atBlock_before";
314
+ }
315
+ return pass(type, stream, state);
316
+ };
317
+
318
+ states.restricted_atBlock = function(type, stream, state) {
319
+ if (type == "}") {
320
+ state.stateArg = null;
321
+ return popContext(state);
322
+ }
323
+ if (type == "word") {
324
+ if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
325
+ (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
326
+ override = "error";
327
+ else
328
+ override = "property";
329
+ return "maybeprop";
330
+ }
331
+ return "restricted_atBlock";
332
+ };
333
+
334
+ states.keyframes = function(type, stream, state) {
335
+ if (type == "word") { override = "variable"; return "keyframes"; }
336
+ if (type == "{") return pushContext(state, stream, "top");
337
+ return pass(type, stream, state);
338
+ };
339
+
340
+ states.at = function(type, stream, state) {
341
+ if (type == ";") return popContext(state);
342
+ if (type == "{" || type == "}") return popAndPass(type, stream, state);
343
+ if (type == "word") override = "tag";
344
+ else if (type == "hash") override = "builtin";
345
+ return "at";
346
+ };
347
+
348
+ states.interpolation = function(type, stream, state) {
349
+ if (type == "}") return popContext(state);
350
+ if (type == "{" || type == ";") return popAndPass(type, stream, state);
351
+ if (type == "word") override = "variable";
352
+ else if (type != "variable" && type != "(" && type != ")") override = "error";
353
+ return "interpolation";
354
+ };
355
+
356
+ return {
357
+ name: parserConfig.name,
358
+ startState: function() {
359
+ return {tokenize: null,
360
+ state: inline ? "block" : "top",
361
+ stateArg: null,
362
+ context: new Context(inline ? "block" : "top", 0, null)};
363
+ },
364
+
365
+ token: function(stream, state) {
366
+ if (!state.tokenize && stream.eatSpace()) return null;
367
+ var style = (state.tokenize || tokenBase)(stream, state);
368
+ if (style && typeof style == "object") {
369
+ type = style[1];
370
+ style = style[0];
371
+ }
372
+ override = style;
373
+ if (type != "comment")
374
+ state.state = states[state.state](type, stream, state);
375
+ return override;
376
+ },
377
+
378
+ indent: function(state, textAfter, iCx) {
379
+ var cx = state.context, ch = textAfter && textAfter.charAt(0);
380
+ var indent = cx.indent;
381
+ if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
382
+ if (cx.prev) {
383
+ if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
384
+ cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
385
+ // Resume indentation from parent context.
386
+ cx = cx.prev;
387
+ indent = cx.indent;
388
+ } else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
389
+ ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
390
+ // Dedent relative to current context.
391
+ indent = Math.max(0, cx.indent - iCx.unit);
392
+ }
393
+ }
394
+ return indent;
395
+ },
396
+
397
+ languageData: {
398
+ indentOnInput: /^\s*\}$/,
399
+ commentTokens: {line: lineComment, block: {open: "/*", close: "*/"}},
400
+ autocomplete: allWords
401
+ }
402
+ };
403
+ };
404
+
405
+ function keySet(array) {
406
+ var keys = {};
407
+ for (var i = 0; i < array.length; ++i) {
408
+ keys[array[i].toLowerCase()] = true;
409
+ }
410
+ return keys;
411
+ }
412
+
413
+ var documentTypes_ = [
414
+ "domain", "regexp", "url", "url-prefix"
415
+ ], documentTypes = keySet(documentTypes_);
416
+
417
+ var mediaTypes_ = [
418
+ "all", "aural", "braille", "handheld", "print", "projection", "screen",
419
+ "tty", "tv", "embossed"
420
+ ], mediaTypes = keySet(mediaTypes_);
421
+
422
+ var mediaFeatures_ = [
423
+ "width", "min-width", "max-width", "height", "min-height", "max-height",
424
+ "device-width", "min-device-width", "max-device-width", "device-height",
425
+ "min-device-height", "max-device-height", "aspect-ratio",
426
+ "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
427
+ "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
428
+ "max-color", "color-index", "min-color-index", "max-color-index",
429
+ "monochrome", "min-monochrome", "max-monochrome", "resolution",
430
+ "min-resolution", "max-resolution", "scan", "grid", "orientation",
431
+ "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
432
+ "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme",
433
+ "dynamic-range", "video-dynamic-range"
434
+ ], mediaFeatures = keySet(mediaFeatures_);
435
+
436
+ var mediaValueKeywords_ = [
437
+ "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
438
+ "interlace", "progressive",
439
+ "dark", "light",
440
+ "standard", "high"
441
+ ], mediaValueKeywords = keySet(mediaValueKeywords_);
442
+
443
+ var propertyKeywords_ = [
444
+ "align-content", "align-items", "align-self", "alignment-adjust",
445
+ "alignment-baseline", "all", "anchor-point", "animation", "animation-delay",
446
+ "animation-direction", "animation-duration", "animation-fill-mode",
447
+ "animation-iteration-count", "animation-name", "animation-play-state",
448
+ "animation-timing-function", "appearance", "azimuth", "backdrop-filter",
449
+ "backface-visibility", "background", "background-attachment",
450
+ "background-blend-mode", "background-clip", "background-color",
451
+ "background-image", "background-origin", "background-position",
452
+ "background-position-x", "background-position-y", "background-repeat",
453
+ "background-size", "baseline-shift", "binding", "bleed", "block-size",
454
+ "bookmark-label", "bookmark-level", "bookmark-state", "bookmark-target",
455
+ "border", "border-bottom", "border-bottom-color", "border-bottom-left-radius",
456
+ "border-bottom-right-radius", "border-bottom-style", "border-bottom-width",
457
+ "border-collapse", "border-color", "border-image", "border-image-outset",
458
+ "border-image-repeat", "border-image-slice", "border-image-source",
459
+ "border-image-width", "border-left", "border-left-color", "border-left-style",
460
+ "border-left-width", "border-radius", "border-right", "border-right-color",
461
+ "border-right-style", "border-right-width", "border-spacing", "border-style",
462
+ "border-top", "border-top-color", "border-top-left-radius",
463
+ "border-top-right-radius", "border-top-style", "border-top-width",
464
+ "border-width", "bottom", "box-decoration-break", "box-shadow", "box-sizing",
465
+ "break-after", "break-before", "break-inside", "caption-side", "caret-color",
466
+ "clear", "clip", "color", "color-profile", "column-count", "column-fill",
467
+ "column-gap", "column-rule", "column-rule-color", "column-rule-style",
468
+ "column-rule-width", "column-span", "column-width", "columns", "contain",
469
+ "content", "counter-increment", "counter-reset", "crop", "cue", "cue-after",
470
+ "cue-before", "cursor", "direction", "display", "dominant-baseline",
471
+ "drop-initial-after-adjust", "drop-initial-after-align",
472
+ "drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size",
473
+ "drop-initial-value", "elevation", "empty-cells", "fit", "fit-content", "fit-position",
474
+ "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow",
475
+ "flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into",
476
+ "font", "font-family", "font-feature-settings", "font-kerning",
477
+ "font-language-override", "font-optical-sizing", "font-size",
478
+ "font-size-adjust", "font-stretch", "font-style", "font-synthesis",
479
+ "font-variant", "font-variant-alternates", "font-variant-caps",
480
+ "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric",
481
+ "font-variant-position", "font-variation-settings", "font-weight", "gap",
482
+ "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows",
483
+ "grid-column", "grid-column-end", "grid-column-gap", "grid-column-start",
484
+ "grid-gap", "grid-row", "grid-row-end", "grid-row-gap", "grid-row-start",
485
+ "grid-template", "grid-template-areas", "grid-template-columns",
486
+ "grid-template-rows", "hanging-punctuation", "height", "hyphens", "icon",
487
+ "image-orientation", "image-rendering", "image-resolution", "inline-box-align",
488
+ "inset", "inset-block", "inset-block-end", "inset-block-start", "inset-inline",
489
+ "inset-inline-end", "inset-inline-start", "isolation", "justify-content",
490
+ "justify-items", "justify-self", "left", "letter-spacing", "line-break",
491
+ "line-height", "line-height-step", "line-stacking", "line-stacking-ruby",
492
+ "line-stacking-shift", "line-stacking-strategy", "list-style",
493
+ "list-style-image", "list-style-position", "list-style-type", "margin",
494
+ "margin-bottom", "margin-left", "margin-right", "margin-top", "marks",
495
+ "marquee-direction", "marquee-loop", "marquee-play-count", "marquee-speed",
496
+ "marquee-style", "mask-clip", "mask-composite", "mask-image", "mask-mode",
497
+ "mask-origin", "mask-position", "mask-repeat", "mask-size","mask-type",
498
+ "max-block-size", "max-height", "max-inline-size",
499
+ "max-width", "min-block-size", "min-height", "min-inline-size", "min-width",
500
+ "mix-blend-mode", "move-to", "nav-down", "nav-index", "nav-left", "nav-right",
501
+ "nav-up", "object-fit", "object-position", "offset", "offset-anchor",
502
+ "offset-distance", "offset-path", "offset-position", "offset-rotate",
503
+ "opacity", "order", "orphans", "outline", "outline-color", "outline-offset",
504
+ "outline-style", "outline-width", "overflow", "overflow-style",
505
+ "overflow-wrap", "overflow-x", "overflow-y", "padding", "padding-bottom",
506
+ "padding-left", "padding-right", "padding-top", "page", "page-break-after",
507
+ "page-break-before", "page-break-inside", "page-policy", "pause",
508
+ "pause-after", "pause-before", "perspective", "perspective-origin", "pitch",
509
+ "pitch-range", "place-content", "place-items", "place-self", "play-during",
510
+ "position", "presentation-level", "punctuation-trim", "quotes",
511
+ "region-break-after", "region-break-before", "region-break-inside",
512
+ "region-fragment", "rendering-intent", "resize", "rest", "rest-after",
513
+ "rest-before", "richness", "right", "rotate", "rotation", "rotation-point",
514
+ "row-gap", "ruby-align", "ruby-overhang", "ruby-position", "ruby-span",
515
+ "scale", "scroll-behavior", "scroll-margin", "scroll-margin-block",
516
+ "scroll-margin-block-end", "scroll-margin-block-start", "scroll-margin-bottom",
517
+ "scroll-margin-inline", "scroll-margin-inline-end",
518
+ "scroll-margin-inline-start", "scroll-margin-left", "scroll-margin-right",
519
+ "scroll-margin-top", "scroll-padding", "scroll-padding-block",
520
+ "scroll-padding-block-end", "scroll-padding-block-start",
521
+ "scroll-padding-bottom", "scroll-padding-inline", "scroll-padding-inline-end",
522
+ "scroll-padding-inline-start", "scroll-padding-left", "scroll-padding-right",
523
+ "scroll-padding-top", "scroll-snap-align", "scroll-snap-type",
524
+ "shape-image-threshold", "shape-inside", "shape-margin", "shape-outside",
525
+ "size", "speak", "speak-as", "speak-header", "speak-numeral",
526
+ "speak-punctuation", "speech-rate", "stress", "string-set", "tab-size",
527
+ "table-layout", "target", "target-name", "target-new", "target-position",
528
+ "text-align", "text-align-last", "text-combine-upright", "text-decoration",
529
+ "text-decoration-color", "text-decoration-line", "text-decoration-skip",
530
+ "text-decoration-skip-ink", "text-decoration-style", "text-emphasis",
531
+ "text-emphasis-color", "text-emphasis-position", "text-emphasis-style",
532
+ "text-height", "text-indent", "text-justify", "text-orientation",
533
+ "text-outline", "text-overflow", "text-rendering", "text-shadow",
534
+ "text-size-adjust", "text-space-collapse", "text-transform",
535
+ "text-underline-position", "text-wrap", "top", "touch-action", "transform", "transform-origin",
536
+ "transform-style", "transition", "transition-delay", "transition-duration",
537
+ "transition-property", "transition-timing-function", "translate",
538
+ "unicode-bidi", "user-select", "vertical-align", "visibility", "voice-balance",
539
+ "voice-duration", "voice-family", "voice-pitch", "voice-range", "voice-rate",
540
+ "voice-stress", "voice-volume", "volume", "white-space", "widows", "width",
541
+ "will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "z-index",
542
+ // SVG-specific
543
+ "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
544
+ "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
545
+ "color-interpolation", "color-interpolation-filters",
546
+ "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
547
+ "marker", "marker-end", "marker-mid", "marker-start", "paint-order", "shape-rendering", "stroke",
548
+ "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
549
+ "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
550
+ "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
551
+ "glyph-orientation-vertical", "text-anchor", "writing-mode",
552
+ ], propertyKeywords = keySet(propertyKeywords_);
553
+
554
+ var nonStandardPropertyKeywords_ = [
555
+ "accent-color", "aspect-ratio", "border-block", "border-block-color", "border-block-end",
556
+ "border-block-end-color", "border-block-end-style", "border-block-end-width",
557
+ "border-block-start", "border-block-start-color", "border-block-start-style",
558
+ "border-block-start-width", "border-block-style", "border-block-width",
559
+ "border-inline", "border-inline-color", "border-inline-end",
560
+ "border-inline-end-color", "border-inline-end-style",
561
+ "border-inline-end-width", "border-inline-start", "border-inline-start-color",
562
+ "border-inline-start-style", "border-inline-start-width",
563
+ "border-inline-style", "border-inline-width", "content-visibility", "margin-block",
564
+ "margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end",
565
+ "margin-inline-start", "overflow-anchor", "overscroll-behavior", "padding-block", "padding-block-end",
566
+ "padding-block-start", "padding-inline", "padding-inline-end",
567
+ "padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color",
568
+ "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
569
+ "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
570
+ "scrollbar-track-color", "searchfield-cancel-button", "searchfield-decoration",
571
+ "searchfield-results-button", "searchfield-results-decoration", "shape-inside", "zoom"
572
+ ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
573
+
574
+ var fontProperties_ = [
575
+ "font-display", "font-family", "src", "unicode-range", "font-variant",
576
+ "font-feature-settings", "font-stretch", "font-weight", "font-style"
577
+ ], fontProperties = keySet(fontProperties_);
578
+
579
+ var counterDescriptors_ = [
580
+ "additive-symbols", "fallback", "negative", "pad", "prefix", "range",
581
+ "speak-as", "suffix", "symbols", "system"
582
+ ], counterDescriptors = keySet(counterDescriptors_);
583
+
584
+ var colorKeywords_ = [
585
+ "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
586
+ "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
587
+ "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
588
+ "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
589
+ "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen",
590
+ "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
591
+ "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet",
592
+ "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick",
593
+ "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
594
+ "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
595
+ "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
596
+ "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
597
+ "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink",
598
+ "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey",
599
+ "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
600
+ "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
601
+ "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
602
+ "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
603
+ "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
604
+ "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
605
+ "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
606
+ "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
607
+ "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
608
+ "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan",
609
+ "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
610
+ "whitesmoke", "yellow", "yellowgreen"
611
+ ], colorKeywords = keySet(colorKeywords_);
612
+
613
+ var valueKeywords_ = [
614
+ "above", "absolute", "activeborder", "additive", "activecaption", "afar",
615
+ "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
616
+ "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
617
+ "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
618
+ "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary",
619
+ "bengali", "blink", "block", "block-axis", "blur", "bold", "bolder", "border", "border-box",
620
+ "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button",
621
+ "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
622
+ "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
623
+ "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
624
+ "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
625
+ "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
626
+ "compact", "condensed", "conic-gradient", "contain", "content", "contents",
627
+ "content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop",
628
+ "cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
629
+ "decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
630
+ "destination-in", "destination-out", "destination-over", "devanagari", "difference",
631
+ "disc", "discard", "disclosure-closed", "disclosure-open", "document",
632
+ "dot-dash", "dot-dot-dash",
633
+ "dotted", "double", "down", "drop-shadow", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
634
+ "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
635
+ "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
636
+ "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
637
+ "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
638
+ "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
639
+ "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
640
+ "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
641
+ "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
642
+ "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
643
+ "forwards", "from", "geometricPrecision", "georgian", "grayscale", "graytext", "grid", "groove",
644
+ "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
645
+ "help", "hidden", "hide", "higher", "highlight", "highlighttext",
646
+ "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "hue-rotate", "icon", "ignore",
647
+ "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
648
+ "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
649
+ "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
650
+ "italic", "japanese-formal", "japanese-informal", "justify", "kannada",
651
+ "katakana", "katakana-iroha", "keep-all", "khmer",
652
+ "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
653
+ "landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
654
+ "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
655
+ "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
656
+ "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
657
+ "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "manipulation", "match", "matrix", "matrix3d",
658
+ "media-play-button", "media-slider", "media-sliderthumb",
659
+ "media-volume-slider", "media-volume-sliderthumb", "medium",
660
+ "menu", "menulist", "menulist-button",
661
+ "menutext", "message-box", "middle", "min-intrinsic",
662
+ "mix", "mongolian", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "myanmar", "n-resize",
663
+ "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
664
+ "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
665
+ "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
666
+ "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
667
+ "outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
668
+ "painted", "page", "paused", "persian", "perspective", "pinch-zoom", "plus-darker", "plus-lighter",
669
+ "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
670
+ "progress", "push-button", "radial-gradient", "radio", "read-only",
671
+ "read-write", "read-write-plaintext-only", "rectangle", "region",
672
+ "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient",
673
+ "repeating-conic-gradient", "repeat-x", "repeat-y", "reset", "reverse",
674
+ "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
675
+ "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
676
+ "s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
677
+ "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
678
+ "searchfield-cancel-button", "searchfield-decoration",
679
+ "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
680
+ "semi-condensed", "semi-expanded", "separate", "sepia", "serif", "show", "sidama",
681
+ "simp-chinese-formal", "simp-chinese-informal", "single",
682
+ "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
683
+ "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
684
+ "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
685
+ "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
686
+ "square-button", "start", "static", "status-bar", "stretch", "stroke", "stroke-box", "sub",
687
+ "subpixel-antialiased", "svg_masks", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
688
+ "table-caption", "table-cell", "table-column", "table-column-group",
689
+ "table-footer-group", "table-header-group", "table-row", "table-row-group",
690
+ "tamil",
691
+ "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
692
+ "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
693
+ "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
694
+ "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
695
+ "trad-chinese-formal", "trad-chinese-informal", "transform",
696
+ "translate", "translate3d", "translateX", "translateY", "translateZ",
697
+ "transparent", "ultra-condensed", "ultra-expanded", "underline", "unidirectional-pan", "unset", "up",
698
+ "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
699
+ "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
700
+ "var", "vertical", "vertical-text", "view-box", "visible", "visibleFill", "visiblePainted",
701
+ "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
702
+ "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
703
+ "xx-large", "xx-small"
704
+ ], valueKeywords = keySet(valueKeywords_);
705
+
706
+ var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
707
+ .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
708
+ .concat(valueKeywords_);
709
+
710
+ export const keywords = {properties: propertyKeywords_, colors: colorKeywords_,
711
+ fonts: fontProperties_, values: valueKeywords_, all: allWords}
712
+
713
+ const defaults = {
714
+ documentTypes: documentTypes,
715
+ mediaTypes: mediaTypes,
716
+ mediaFeatures: mediaFeatures,
717
+ mediaValueKeywords: mediaValueKeywords,
718
+ propertyKeywords: propertyKeywords,
719
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
720
+ fontProperties: fontProperties,
721
+ counterDescriptors: counterDescriptors,
722
+ colorKeywords: colorKeywords,
723
+ valueKeywords: valueKeywords,
724
+ tokenHooks: {
725
+ "/": function(stream, state) {
726
+ if (!stream.eat("*")) return false;
727
+ state.tokenize = tokenCComment;
728
+ return tokenCComment(stream, state);
729
+ }
730
+ }
731
+ }
732
+
733
+ export const css = mkCSS({name: "css"})
734
+
735
+ function tokenCComment(stream, state) {
736
+ var maybeEnd = false, ch;
737
+ while ((ch = stream.next()) != null) {
738
+ if (maybeEnd && ch == "/") {
739
+ state.tokenize = null;
740
+ break;
741
+ }
742
+ maybeEnd = (ch == "*");
743
+ }
744
+ return ["comment", "comment"];
745
+ }
746
+
747
+ export const sCSS = mkCSS({
748
+ name: "scss",
749
+ mediaTypes: mediaTypes,
750
+ mediaFeatures: mediaFeatures,
751
+ mediaValueKeywords: mediaValueKeywords,
752
+ propertyKeywords: propertyKeywords,
753
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
754
+ colorKeywords: colorKeywords,
755
+ valueKeywords: valueKeywords,
756
+ fontProperties: fontProperties,
757
+ allowNested: true,
758
+ lineComment: "//",
759
+ tokenHooks: {
760
+ "/": function(stream, state) {
761
+ if (stream.eat("/")) {
762
+ stream.skipToEnd();
763
+ return ["comment", "comment"];
764
+ } else if (stream.eat("*")) {
765
+ state.tokenize = tokenCComment;
766
+ return tokenCComment(stream, state);
767
+ } else {
768
+ return ["operator", "operator"];
769
+ }
770
+ },
771
+ ":": function(stream) {
772
+ if (stream.match(/^\s*\{/, false))
773
+ return [null, null]
774
+ return false;
775
+ },
776
+ "$": function(stream) {
777
+ stream.match(/^[\w-]+/);
778
+ if (stream.match(/^\s*:/, false))
779
+ return ["def", "variable-definition"];
780
+ return ["variableName.special", "variable"];
781
+ },
782
+ "#": function(stream) {
783
+ if (!stream.eat("{")) return false;
784
+ return [null, "interpolation"];
785
+ }
786
+ }
787
+ })
788
+
789
+ export const less = mkCSS({
790
+ name: "less",
791
+ mediaTypes: mediaTypes,
792
+ mediaFeatures: mediaFeatures,
793
+ mediaValueKeywords: mediaValueKeywords,
794
+ propertyKeywords: propertyKeywords,
795
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
796
+ colorKeywords: colorKeywords,
797
+ valueKeywords: valueKeywords,
798
+ fontProperties: fontProperties,
799
+ allowNested: true,
800
+ lineComment: "//",
801
+ tokenHooks: {
802
+ "/": function(stream, state) {
803
+ if (stream.eat("/")) {
804
+ stream.skipToEnd();
805
+ return ["comment", "comment"];
806
+ } else if (stream.eat("*")) {
807
+ state.tokenize = tokenCComment;
808
+ return tokenCComment(stream, state);
809
+ } else {
810
+ return ["operator", "operator"];
811
+ }
812
+ },
813
+ "@": function(stream) {
814
+ if (stream.eat("{")) return [null, "interpolation"];
815
+ if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i, false)) return false;
816
+ stream.eatWhile(/[\w\\\-]/);
817
+ if (stream.match(/^\s*:/, false))
818
+ return ["def", "variable-definition"];
819
+ return ["variableName", "variable"];
820
+ },
821
+ "&": function() {
822
+ return ["atom", "atom"];
823
+ }
824
+ }
825
+ })
826
+
827
+ export const gss = mkCSS({
828
+ name: "gss",
829
+ documentTypes: documentTypes,
830
+ mediaTypes: mediaTypes,
831
+ mediaFeatures: mediaFeatures,
832
+ propertyKeywords: propertyKeywords,
833
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
834
+ fontProperties: fontProperties,
835
+ counterDescriptors: counterDescriptors,
836
+ colorKeywords: colorKeywords,
837
+ valueKeywords: valueKeywords,
838
+ supportsAtComponent: true,
839
+ tokenHooks: {
840
+ "/": function(stream, state) {
841
+ if (!stream.eat("*")) return false;
842
+ state.tokenize = tokenCComment;
843
+ return tokenCComment(stream, state);
844
+ }
845
+ }
846
+ })