@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,747 @@
1
+ // developer.mozilla.org/en-US/docs/Web/HTML/Element
2
+ var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1", "h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe", "img","input","ins","kbd","keygen","label","legend","li","link","main","map", "mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes", "noscript","object","ol","optgroup","option","output","p","param","pre", "progress","q","rp","rt","ruby","s","samp","script","section","select", "small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track", "u","ul","var","video"];
3
+
4
+ // Note, "url-prefix" should precede "url" in order to match correctly in documentTypesRegexp
5
+ var documentTypes_ = ["domain", "regexp", "url-prefix", "url"];
6
+ var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"];
7
+ var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","dynamic-range","video-dynamic-range"];
8
+ var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"];
9
+ var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"];
10
+ var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"];
11
+ var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
12
+ var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","conic-gradient","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","high","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-play-button","media-slider","media-sliderthumb","media-volume-slider","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","standard","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"];
13
+
14
+ var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"],
15
+ blockKeywords_ = ["for","if","else","unless", "from", "to"],
16
+ commonAtoms_ = ["null","true","false","href","title","type","not-allowed","readonly","disabled"],
17
+ commonDef_ = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"];
18
+
19
+ var hintWords = tagKeywords_.concat(documentTypes_,mediaTypes_,mediaFeatures_,
20
+ propertyKeywords_,nonStandardPropertyKeywords_,
21
+ colorKeywords_,valueKeywords_,fontProperties_,
22
+ wordOperatorKeywords_,blockKeywords_,
23
+ commonAtoms_,commonDef_);
24
+
25
+ function wordRegexp(words) {
26
+ words = words.sort(function(a,b){return b > a;});
27
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
28
+ }
29
+
30
+ function keySet(array) {
31
+ var keys = {};
32
+ for (var i = 0; i < array.length; ++i) keys[array[i]] = true;
33
+ return keys;
34
+ }
35
+
36
+ function escapeRegExp(text) {
37
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
38
+ }
39
+
40
+ var tagKeywords = keySet(tagKeywords_),
41
+ tagVariablesRegexp = /^(a|b|i|s|col|em)$/i,
42
+ propertyKeywords = keySet(propertyKeywords_),
43
+ nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_),
44
+ valueKeywords = keySet(valueKeywords_),
45
+ colorKeywords = keySet(colorKeywords_),
46
+ documentTypes = keySet(documentTypes_),
47
+ documentTypesRegexp = wordRegexp(documentTypes_),
48
+ mediaFeatures = keySet(mediaFeatures_),
49
+ mediaTypes = keySet(mediaTypes_),
50
+ fontProperties = keySet(fontProperties_),
51
+ operatorsRegexp = /^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/,
52
+ wordOperatorKeywordsRegexp = wordRegexp(wordOperatorKeywords_),
53
+ blockKeywords = keySet(blockKeywords_),
54
+ vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/i),
55
+ commonAtoms = keySet(commonAtoms_),
56
+ firstWordMatch = "",
57
+ states = {},
58
+ ch,
59
+ style,
60
+ type,
61
+ override;
62
+
63
+ /**
64
+ * Tokenizers
65
+ */
66
+ function tokenBase(stream, state) {
67
+ firstWordMatch = stream.string.match(/(^[\w-]+\s*=\s*$)|(^\s*[\w-]+\s*=\s*[\w-])|(^\s*(\.|#|@|\$|\&|\[|\d|\+|::?|\{|\>|~|\/)?\s*[\w-]*([a-z0-9-]|\*|\/\*)(\(|,)?)/);
68
+ state.context.line.firstWord = firstWordMatch ? firstWordMatch[0].replace(/^\s*/, "") : "";
69
+ state.context.line.indent = stream.indentation();
70
+ ch = stream.peek();
71
+
72
+ // Line comment
73
+ if (stream.match("//")) {
74
+ stream.skipToEnd();
75
+ return ["comment", "comment"];
76
+ }
77
+ // Block comment
78
+ if (stream.match("/*")) {
79
+ state.tokenize = tokenCComment;
80
+ return tokenCComment(stream, state);
81
+ }
82
+ // String
83
+ if (ch == "\"" || ch == "'") {
84
+ stream.next();
85
+ state.tokenize = tokenString(ch);
86
+ return state.tokenize(stream, state);
87
+ }
88
+ // Def
89
+ if (ch == "@") {
90
+ stream.next();
91
+ stream.eatWhile(/[\w\\-]/);
92
+ return ["def", stream.current()];
93
+ }
94
+ // ID selector or Hex color
95
+ if (ch == "#") {
96
+ stream.next();
97
+ // Hex color
98
+ if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b(?!-)/i)) {
99
+ return ["atom", "atom"];
100
+ }
101
+ // ID selector
102
+ if (stream.match(/^[a-z][\w-]*/i)) {
103
+ return ["builtin", "hash"];
104
+ }
105
+ }
106
+ // Vendor prefixes
107
+ if (stream.match(vendorPrefixesRegexp)) {
108
+ return ["meta", "vendor-prefixes"];
109
+ }
110
+ // Numbers
111
+ if (stream.match(/^-?[0-9]?\.?[0-9]/)) {
112
+ stream.eatWhile(/[a-z%]/i);
113
+ return ["number", "unit"];
114
+ }
115
+ // !important|optional
116
+ if (ch == "!") {
117
+ stream.next();
118
+ return [stream.match(/^(important|optional)/i) ? "keyword": "operator", "important"];
119
+ }
120
+ // Class
121
+ if (ch == "." && stream.match(/^\.[a-z][\w-]*/i)) {
122
+ return ["qualifier", "qualifier"];
123
+ }
124
+ // url url-prefix domain regexp
125
+ if (stream.match(documentTypesRegexp)) {
126
+ if (stream.peek() == "(") state.tokenize = tokenParenthesized;
127
+ return ["property", "word"];
128
+ }
129
+ // Mixins / Functions
130
+ if (stream.match(/^[a-z][\w-]*\(/i)) {
131
+ stream.backUp(1);
132
+ return ["keyword", "mixin"];
133
+ }
134
+ // Block mixins
135
+ if (stream.match(/^(\+|-)[a-z][\w-]*\(/i)) {
136
+ stream.backUp(1);
137
+ return ["keyword", "block-mixin"];
138
+ }
139
+ // Parent Reference BEM naming
140
+ if (stream.string.match(/^\s*&/) && stream.match(/^[-_]+[a-z][\w-]*/)) {
141
+ return ["qualifier", "qualifier"];
142
+ }
143
+ // / Root Reference & Parent Reference
144
+ if (stream.match(/^(\/|&)(-|_|:|\.|#|[a-z])/)) {
145
+ stream.backUp(1);
146
+ return ["variableName.special", "reference"];
147
+ }
148
+ if (stream.match(/^&{1}\s*$/)) {
149
+ return ["variableName.special", "reference"];
150
+ }
151
+ // Word operator
152
+ if (stream.match(wordOperatorKeywordsRegexp)) {
153
+ return ["operator", "operator"];
154
+ }
155
+ // Word
156
+ if (stream.match(/^\$?[-_]*[a-z0-9]+[\w-]*/i)) {
157
+ // Variable
158
+ if (stream.match(/^(\.|\[)[\w-\'\"\]]+/i, false)) {
159
+ if (!wordIsTag(stream.current())) {
160
+ stream.match('.');
161
+ return ["variable", "variable-name"];
162
+ }
163
+ }
164
+ return ["variable", "word"];
165
+ }
166
+ // Operators
167
+ if (stream.match(operatorsRegexp)) {
168
+ return ["operator", stream.current()];
169
+ }
170
+ // Delimiters
171
+ if (/[:;,{}\[\]\(\)]/.test(ch)) {
172
+ stream.next();
173
+ return [null, ch];
174
+ }
175
+ // Non-detected items
176
+ stream.next();
177
+ return [null, null];
178
+ }
179
+
180
+ /**
181
+ * Token comment
182
+ */
183
+ function tokenCComment(stream, state) {
184
+ var maybeEnd = false, ch;
185
+ while ((ch = stream.next()) != null) {
186
+ if (maybeEnd && ch == "/") {
187
+ state.tokenize = null;
188
+ break;
189
+ }
190
+ maybeEnd = (ch == "*");
191
+ }
192
+ return ["comment", "comment"];
193
+ }
194
+
195
+ /**
196
+ * Token string
197
+ */
198
+ function tokenString(quote) {
199
+ return function(stream, state) {
200
+ var escaped = false, ch;
201
+ while ((ch = stream.next()) != null) {
202
+ if (ch == quote && !escaped) {
203
+ if (quote == ")") stream.backUp(1);
204
+ break;
205
+ }
206
+ escaped = !escaped && ch == "\\";
207
+ }
208
+ if (ch == quote || !escaped && quote != ")") state.tokenize = null;
209
+ return ["string", "string"];
210
+ };
211
+ }
212
+
213
+ /**
214
+ * Token parenthesized
215
+ */
216
+ function tokenParenthesized(stream, state) {
217
+ stream.next(); // Must be "("
218
+ if (!stream.match(/\s*[\"\')]/, false))
219
+ state.tokenize = tokenString(")");
220
+ else
221
+ state.tokenize = null;
222
+ return [null, "("];
223
+ }
224
+
225
+ /**
226
+ * Context management
227
+ */
228
+ function Context(type, indent, prev, line) {
229
+ this.type = type;
230
+ this.indent = indent;
231
+ this.prev = prev;
232
+ this.line = line || {firstWord: "", indent: 0};
233
+ }
234
+
235
+ function pushContext(state, stream, type, indent) {
236
+ indent = indent >= 0 ? indent : stream.indentUnit;
237
+ state.context = new Context(type, stream.indentation() + indent, state.context);
238
+ return type;
239
+ }
240
+
241
+ function popContext(state, stream, currentIndent) {
242
+ var contextIndent = state.context.indent - stream.indentUnit;
243
+ currentIndent = currentIndent || false;
244
+ state.context = state.context.prev;
245
+ if (currentIndent) state.context.indent = contextIndent;
246
+ return state.context.type;
247
+ }
248
+
249
+ function pass(type, stream, state) {
250
+ return states[state.context.type](type, stream, state);
251
+ }
252
+
253
+ function popAndPass(type, stream, state, n) {
254
+ for (var i = n || 1; i > 0; i--)
255
+ state.context = state.context.prev;
256
+ return pass(type, stream, state);
257
+ }
258
+
259
+
260
+ /**
261
+ * Parser
262
+ */
263
+ function wordIsTag(word) {
264
+ return word.toLowerCase() in tagKeywords;
265
+ }
266
+
267
+ function wordIsProperty(word) {
268
+ word = word.toLowerCase();
269
+ return word in propertyKeywords || word in fontProperties;
270
+ }
271
+
272
+ function wordIsBlock(word) {
273
+ return word.toLowerCase() in blockKeywords;
274
+ }
275
+
276
+ function wordIsVendorPrefix(word) {
277
+ return word.toLowerCase().match(vendorPrefixesRegexp);
278
+ }
279
+
280
+ function wordAsValue(word) {
281
+ var wordLC = word.toLowerCase();
282
+ var override = "variable";
283
+ if (wordIsTag(word)) override = "tag";
284
+ else if (wordIsBlock(word)) override = "block-keyword";
285
+ else if (wordIsProperty(word)) override = "property";
286
+ else if (wordLC in valueKeywords || wordLC in commonAtoms) override = "atom";
287
+ else if (wordLC == "return" || wordLC in colorKeywords) override = "keyword";
288
+
289
+ // Font family
290
+ else if (word.match(/^[A-Z]/)) override = "string";
291
+ return override;
292
+ }
293
+
294
+ function typeIsBlock(type, stream) {
295
+ return ((endOfLine(stream) && (type == "{" || type == "]" || type == "hash" || type == "qualifier")) || type == "block-mixin");
296
+ }
297
+
298
+ function typeIsInterpolation(type, stream) {
299
+ return type == "{" && stream.match(/^\s*\$?[\w-]+/i, false);
300
+ }
301
+
302
+ function typeIsPseudo(type, stream) {
303
+ return type == ":" && stream.match(/^[a-z-]+/, false);
304
+ }
305
+
306
+ function startOfLine(stream) {
307
+ return stream.sol() || stream.string.match(new RegExp("^\\s*" + escapeRegExp(stream.current())));
308
+ }
309
+
310
+ function endOfLine(stream) {
311
+ return stream.eol() || stream.match(/^\s*$/, false);
312
+ }
313
+
314
+ function firstWordOfLine(line) {
315
+ var re = /^\s*[-_]*[a-z0-9]+[\w-]*/i;
316
+ var result = typeof line == "string" ? line.match(re) : line.string.match(re);
317
+ return result ? result[0].replace(/^\s*/, "") : "";
318
+ }
319
+
320
+
321
+ /**
322
+ * Block
323
+ */
324
+ states.block = function(type, stream, state) {
325
+ if ((type == "comment" && startOfLine(stream)) ||
326
+ (type == "," && endOfLine(stream)) ||
327
+ type == "mixin") {
328
+ return pushContext(state, stream, "block", 0);
329
+ }
330
+ if (typeIsInterpolation(type, stream)) {
331
+ return pushContext(state, stream, "interpolation");
332
+ }
333
+ if (endOfLine(stream) && type == "]") {
334
+ if (!/^\s*(\.|#|:|\[|\*|&)/.test(stream.string) && !wordIsTag(firstWordOfLine(stream))) {
335
+ return pushContext(state, stream, "block", 0);
336
+ }
337
+ }
338
+ if (typeIsBlock(type, stream)) {
339
+ return pushContext(state, stream, "block");
340
+ }
341
+ if (type == "}" && endOfLine(stream)) {
342
+ return pushContext(state, stream, "block", 0);
343
+ }
344
+ if (type == "variable-name") {
345
+ if (stream.string.match(/^\s?\$[\w-\.\[\]\'\"]+$/) || wordIsBlock(firstWordOfLine(stream))) {
346
+ return pushContext(state, stream, "variableName");
347
+ }
348
+ else {
349
+ return pushContext(state, stream, "variableName", 0);
350
+ }
351
+ }
352
+ if (type == "=") {
353
+ if (!endOfLine(stream) && !wordIsBlock(firstWordOfLine(stream))) {
354
+ return pushContext(state, stream, "block", 0);
355
+ }
356
+ return pushContext(state, stream, "block");
357
+ }
358
+ if (type == "*") {
359
+ if (endOfLine(stream) || stream.match(/\s*(,|\.|#|\[|:|{)/,false)) {
360
+ override = "tag";
361
+ return pushContext(state, stream, "block");
362
+ }
363
+ }
364
+ if (typeIsPseudo(type, stream)) {
365
+ return pushContext(state, stream, "pseudo");
366
+ }
367
+ if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
368
+ return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
369
+ }
370
+ if (/@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
371
+ return pushContext(state, stream, "keyframes");
372
+ }
373
+ if (/@extends?/.test(type)) {
374
+ return pushContext(state, stream, "extend", 0);
375
+ }
376
+ if (type && type.charAt(0) == "@") {
377
+
378
+ // Property Lookup
379
+ if (stream.indentation() > 0 && wordIsProperty(stream.current().slice(1))) {
380
+ override = "variable";
381
+ return "block";
382
+ }
383
+ if (/(@import|@require|@charset)/.test(type)) {
384
+ return pushContext(state, stream, "block", 0);
385
+ }
386
+ return pushContext(state, stream, "block");
387
+ }
388
+ if (type == "reference" && endOfLine(stream)) {
389
+ return pushContext(state, stream, "block");
390
+ }
391
+ if (type == "(") {
392
+ return pushContext(state, stream, "parens");
393
+ }
394
+
395
+ if (type == "vendor-prefixes") {
396
+ return pushContext(state, stream, "vendorPrefixes");
397
+ }
398
+ if (type == "word") {
399
+ var word = stream.current();
400
+ override = wordAsValue(word);
401
+
402
+ if (override == "property") {
403
+ if (startOfLine(stream)) {
404
+ return pushContext(state, stream, "block", 0);
405
+ } else {
406
+ override = "atom";
407
+ return "block";
408
+ }
409
+ }
410
+
411
+ if (override == "tag") {
412
+
413
+ // tag is a css value
414
+ if (/embed|menu|pre|progress|sub|table/.test(word)) {
415
+ if (wordIsProperty(firstWordOfLine(stream))) {
416
+ override = "atom";
417
+ return "block";
418
+ }
419
+ }
420
+
421
+ // tag is an attribute
422
+ if (stream.string.match(new RegExp("\\[\\s*" + word + "|" + word +"\\s*\\]"))) {
423
+ override = "atom";
424
+ return "block";
425
+ }
426
+
427
+ // tag is a variable
428
+ if (tagVariablesRegexp.test(word)) {
429
+ if ((startOfLine(stream) && stream.string.match(/=/)) ||
430
+ (!startOfLine(stream) &&
431
+ !stream.string.match(/^(\s*\.|#|\&|\[|\/|>|\*)/) &&
432
+ !wordIsTag(firstWordOfLine(stream)))) {
433
+ override = "variable";
434
+ if (wordIsBlock(firstWordOfLine(stream))) return "block";
435
+ return pushContext(state, stream, "block", 0);
436
+ }
437
+ }
438
+
439
+ if (endOfLine(stream)) return pushContext(state, stream, "block");
440
+ }
441
+ if (override == "block-keyword") {
442
+ override = "keyword";
443
+
444
+ // Postfix conditionals
445
+ if (stream.current(/(if|unless)/) && !startOfLine(stream)) {
446
+ return "block";
447
+ }
448
+ return pushContext(state, stream, "block");
449
+ }
450
+ if (word == "return") return pushContext(state, stream, "block", 0);
451
+
452
+ // Placeholder selector
453
+ if (override == "variable" && stream.string.match(/^\s?\$[\w-\.\[\]\'\"]+$/)) {
454
+ return pushContext(state, stream, "block");
455
+ }
456
+ }
457
+ return state.context.type;
458
+ };
459
+
460
+
461
+ /**
462
+ * Parens
463
+ */
464
+ states.parens = function(type, stream, state) {
465
+ if (type == "(") return pushContext(state, stream, "parens");
466
+ if (type == ")") {
467
+ if (state.context.prev.type == "parens") {
468
+ return popContext(state, stream);
469
+ }
470
+ if ((stream.string.match(/^[a-z][\w-]*\(/i) && endOfLine(stream)) ||
471
+ wordIsBlock(firstWordOfLine(stream)) ||
472
+ /(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(firstWordOfLine(stream)) ||
473
+ (!stream.string.match(/^-?[a-z][\w-\.\[\]\'\"]*\s*=/) &&
474
+ wordIsTag(firstWordOfLine(stream)))) {
475
+ return pushContext(state, stream, "block");
476
+ }
477
+ if (stream.string.match(/^[\$-]?[a-z][\w-\.\[\]\'\"]*\s*=/) ||
478
+ stream.string.match(/^\s*(\(|\)|[0-9])/) ||
479
+ stream.string.match(/^\s+[a-z][\w-]*\(/i) ||
480
+ stream.string.match(/^\s+[\$-]?[a-z]/i)) {
481
+ return pushContext(state, stream, "block", 0);
482
+ }
483
+ if (endOfLine(stream)) return pushContext(state, stream, "block");
484
+ else return pushContext(state, stream, "block", 0);
485
+ }
486
+ if (type && type.charAt(0) == "@" && wordIsProperty(stream.current().slice(1))) {
487
+ override = "variable";
488
+ }
489
+ if (type == "word") {
490
+ var word = stream.current();
491
+ override = wordAsValue(word);
492
+ if (override == "tag" && tagVariablesRegexp.test(word)) {
493
+ override = "variable";
494
+ }
495
+ if (override == "property" || word == "to") override = "atom";
496
+ }
497
+ if (type == "variable-name") {
498
+ return pushContext(state, stream, "variableName");
499
+ }
500
+ if (typeIsPseudo(type, stream)) {
501
+ return pushContext(state, stream, "pseudo");
502
+ }
503
+ return state.context.type;
504
+ };
505
+
506
+
507
+ /**
508
+ * Vendor prefixes
509
+ */
510
+ states.vendorPrefixes = function(type, stream, state) {
511
+ if (type == "word") {
512
+ override = "property";
513
+ return pushContext(state, stream, "block", 0);
514
+ }
515
+ return popContext(state, stream);
516
+ };
517
+
518
+
519
+ /**
520
+ * Pseudo
521
+ */
522
+ states.pseudo = function(type, stream, state) {
523
+ if (!wordIsProperty(firstWordOfLine(stream.string))) {
524
+ stream.match(/^[a-z-]+/);
525
+ override = "variableName.special";
526
+ if (endOfLine(stream)) return pushContext(state, stream, "block");
527
+ return popContext(state, stream);
528
+ }
529
+ return popAndPass(type, stream, state);
530
+ };
531
+
532
+
533
+ /**
534
+ * atBlock
535
+ */
536
+ states.atBlock = function(type, stream, state) {
537
+ if (type == "(") return pushContext(state, stream, "atBlock_parens");
538
+ if (typeIsBlock(type, stream)) {
539
+ return pushContext(state, stream, "block");
540
+ }
541
+ if (typeIsInterpolation(type, stream)) {
542
+ return pushContext(state, stream, "interpolation");
543
+ }
544
+ if (type == "word") {
545
+ var word = stream.current().toLowerCase();
546
+ if (/^(only|not|and|or)$/.test(word))
547
+ override = "keyword";
548
+ else if (documentTypes.hasOwnProperty(word))
549
+ override = "tag";
550
+ else if (mediaTypes.hasOwnProperty(word))
551
+ override = "attribute";
552
+ else if (mediaFeatures.hasOwnProperty(word))
553
+ override = "property";
554
+ else if (nonStandardPropertyKeywords.hasOwnProperty(word))
555
+ override = "string.special";
556
+ else override = wordAsValue(stream.current());
557
+ if (override == "tag" && endOfLine(stream)) {
558
+ return pushContext(state, stream, "block");
559
+ }
560
+ }
561
+ if (type == "operator" && /^(not|and|or)$/.test(stream.current())) {
562
+ override = "keyword";
563
+ }
564
+ return state.context.type;
565
+ };
566
+
567
+ states.atBlock_parens = function(type, stream, state) {
568
+ if (type == "{" || type == "}") return state.context.type;
569
+ if (type == ")") {
570
+ if (endOfLine(stream)) return pushContext(state, stream, "block");
571
+ else return pushContext(state, stream, "atBlock");
572
+ }
573
+ if (type == "word") {
574
+ var word = stream.current().toLowerCase();
575
+ override = wordAsValue(word);
576
+ if (/^(max|min)/.test(word)) override = "property";
577
+ if (override == "tag") {
578
+ tagVariablesRegexp.test(word) ? override = "variable" : override = "atom";
579
+ }
580
+ return state.context.type;
581
+ }
582
+ return states.atBlock(type, stream, state);
583
+ };
584
+
585
+
586
+ /**
587
+ * Keyframes
588
+ */
589
+ states.keyframes = function(type, stream, state) {
590
+ if (stream.indentation() == "0" && ((type == "}" && startOfLine(stream)) || type == "]" || type == "hash"
591
+ || type == "qualifier" || wordIsTag(stream.current()))) {
592
+ return popAndPass(type, stream, state);
593
+ }
594
+ if (type == "{") return pushContext(state, stream, "keyframes");
595
+ if (type == "}") {
596
+ if (startOfLine(stream)) return popContext(state, stream, true);
597
+ else return pushContext(state, stream, "keyframes");
598
+ }
599
+ if (type == "unit" && /^[0-9]+\%$/.test(stream.current())) {
600
+ return pushContext(state, stream, "keyframes");
601
+ }
602
+ if (type == "word") {
603
+ override = wordAsValue(stream.current());
604
+ if (override == "block-keyword") {
605
+ override = "keyword";
606
+ return pushContext(state, stream, "keyframes");
607
+ }
608
+ }
609
+ if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
610
+ return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
611
+ }
612
+ if (type == "mixin") {
613
+ return pushContext(state, stream, "block", 0);
614
+ }
615
+ return state.context.type;
616
+ };
617
+
618
+
619
+ /**
620
+ * Interpolation
621
+ */
622
+ states.interpolation = function(type, stream, state) {
623
+ if (type == "{") popContext(state, stream) && pushContext(state, stream, "block");
624
+ if (type == "}") {
625
+ if (stream.string.match(/^\s*(\.|#|:|\[|\*|&|>|~|\+|\/)/i) ||
626
+ (stream.string.match(/^\s*[a-z]/i) && wordIsTag(firstWordOfLine(stream)))) {
627
+ return pushContext(state, stream, "block");
628
+ }
629
+ if (!stream.string.match(/^(\{|\s*\&)/) ||
630
+ stream.match(/\s*[\w-]/,false)) {
631
+ return pushContext(state, stream, "block", 0);
632
+ }
633
+ return pushContext(state, stream, "block");
634
+ }
635
+ if (type == "variable-name") {
636
+ return pushContext(state, stream, "variableName", 0);
637
+ }
638
+ if (type == "word") {
639
+ override = wordAsValue(stream.current());
640
+ if (override == "tag") override = "atom";
641
+ }
642
+ return state.context.type;
643
+ };
644
+
645
+
646
+ /**
647
+ * Extend/s
648
+ */
649
+ states.extend = function(type, stream, state) {
650
+ if (type == "[" || type == "=") return "extend";
651
+ if (type == "]") return popContext(state, stream);
652
+ if (type == "word") {
653
+ override = wordAsValue(stream.current());
654
+ return "extend";
655
+ }
656
+ return popContext(state, stream);
657
+ };
658
+
659
+
660
+ /**
661
+ * Variable name
662
+ */
663
+ states.variableName = function(type, stream, state) {
664
+ if (type == "string" || type == "[" || type == "]" || stream.current().match(/^(\.|\$)/)) {
665
+ if (stream.current().match(/^\.[\w-]+/i)) override = "variable";
666
+ return "variableName";
667
+ }
668
+ return popAndPass(type, stream, state);
669
+ };
670
+
671
+ export const stylus = {
672
+ name: "stylus",
673
+ startState: function() {
674
+ return {
675
+ tokenize: null,
676
+ state: "block",
677
+ context: new Context("block", 0, null)
678
+ };
679
+ },
680
+ token: function(stream, state) {
681
+ if (!state.tokenize && stream.eatSpace()) return null;
682
+ style = (state.tokenize || tokenBase)(stream, state);
683
+ if (style && typeof style == "object") {
684
+ type = style[1];
685
+ style = style[0];
686
+ }
687
+ override = style;
688
+ state.state = states[state.state](type, stream, state);
689
+ return override;
690
+ },
691
+ indent: function(state, textAfter, iCx) {
692
+ var cx = state.context,
693
+ ch = textAfter && textAfter.charAt(0),
694
+ indent = cx.indent,
695
+ lineFirstWord = firstWordOfLine(textAfter),
696
+ lineIndent = cx.line.indent,
697
+ prevLineFirstWord = state.context.prev ? state.context.prev.line.firstWord : "",
698
+ prevLineIndent = state.context.prev ? state.context.prev.line.indent : lineIndent;
699
+
700
+ if (cx.prev &&
701
+ (ch == "}" && (cx.type == "block" || cx.type == "atBlock" || cx.type == "keyframes") ||
702
+ ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
703
+ ch == "{" && (cx.type == "at"))) {
704
+ indent = cx.indent - iCx.unit;
705
+ } else if (!(/(\})/.test(ch))) {
706
+ if (/@|\$|\d/.test(ch) ||
707
+ /^\{/.test(textAfter) ||
708
+ /^\s*\/(\/|\*)/.test(textAfter) ||
709
+ /^\s*\/\*/.test(prevLineFirstWord) ||
710
+ /^\s*[\w-\.\[\]\'\"]+\s*(\?|:|\+)?=/i.test(textAfter) ||
711
+ /^(\+|-)?[a-z][\w-]*\(/i.test(textAfter) ||
712
+ /^return/.test(textAfter) ||
713
+ wordIsBlock(lineFirstWord)) {
714
+ indent = lineIndent;
715
+ } else if (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(ch) || wordIsTag(lineFirstWord)) {
716
+ if (/\,\s*$/.test(prevLineFirstWord)) {
717
+ indent = prevLineIndent;
718
+ } else if (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(prevLineFirstWord) || wordIsTag(prevLineFirstWord)) {
719
+ indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + iCx.unit;
720
+ } else {
721
+ indent = lineIndent;
722
+ }
723
+ } else if (!/,\s*$/.test(textAfter) && (wordIsVendorPrefix(lineFirstWord) || wordIsProperty(lineFirstWord))) {
724
+ if (wordIsBlock(prevLineFirstWord)) {
725
+ indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + iCx.unit;
726
+ } else if (/^\{/.test(prevLineFirstWord)) {
727
+ indent = lineIndent <= prevLineIndent ? lineIndent : prevLineIndent + iCx.unit;
728
+ } else if (wordIsVendorPrefix(prevLineFirstWord) || wordIsProperty(prevLineFirstWord)) {
729
+ indent = lineIndent >= prevLineIndent ? prevLineIndent : lineIndent;
730
+ } else if (/^(\.|#|:|\[|\*|&|@|\+|\-|>|~|\/)/.test(prevLineFirstWord) ||
731
+ /=\s*$/.test(prevLineFirstWord) ||
732
+ wordIsTag(prevLineFirstWord) ||
733
+ /^\$[\w-\.\[\]\'\"]/.test(prevLineFirstWord)) {
734
+ indent = prevLineIndent + iCx.unit;
735
+ } else {
736
+ indent = lineIndent;
737
+ }
738
+ }
739
+ }
740
+ return indent;
741
+ },
742
+ languageData: {
743
+ indentOnInput: /^\s*\}$/,
744
+ commentTokens: {line: "//", block: {open: "/*", close: "*/"}},
745
+ autocomplete: hintWords
746
+ }
747
+ };