ace-rails-ap 2.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (301) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -4
  3. data/lib/ace/rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/ace/ace.js +14194 -13349
  5. data/vendor/assets/javascripts/ace/ext-beautify.js +335 -0
  6. data/vendor/assets/javascripts/ace/ext-chromevox.js +6 -1
  7. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +8 -33
  8. data/vendor/assets/javascripts/ace/ext-emmet.js +487 -424
  9. data/vendor/assets/javascripts/ace/ext-error_marker.js +6 -0
  10. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +45 -72
  11. data/vendor/assets/javascripts/ace/ext-language_tools.js +734 -578
  12. data/vendor/assets/javascripts/ace/ext-linking.js +53 -0
  13. data/vendor/assets/javascripts/ace/ext-modelist.js +25 -10
  14. data/vendor/assets/javascripts/ace/ext-old_ie.js +93 -120
  15. data/vendor/assets/javascripts/ace/ext-searchbox.js +8 -41
  16. data/vendor/assets/javascripts/ace/ext-settings_menu.js +229 -234
  17. data/vendor/assets/javascripts/ace/ext-spellcheck.js +7 -3
  18. data/vendor/assets/javascripts/ace/ext-split.js +13 -37
  19. data/vendor/assets/javascripts/ace/ext-static_highlight.js +16 -39
  20. data/vendor/assets/javascripts/ace/ext-statusbar.js +8 -2
  21. data/vendor/assets/javascripts/ace/ext-textarea.js +254 -99
  22. data/vendor/assets/javascripts/ace/ext-themelist.js +13 -40
  23. data/vendor/assets/javascripts/ace/ext-whitespace.js +17 -41
  24. data/vendor/assets/javascripts/ace/keybinding-emacs.js +803 -788
  25. data/vendor/assets/javascripts/ace/keybinding-vim.js +1559 -1560
  26. data/vendor/assets/javascripts/ace/mode-abap.js +52 -83
  27. data/vendor/assets/javascripts/ace/mode-actionscript.js +27 -63
  28. data/vendor/assets/javascripts/ace/mode-ada.js +27 -58
  29. data/vendor/assets/javascripts/ace/mode-apache_conf.js +310 -0
  30. data/vendor/assets/javascripts/ace/mode-applescript.js +226 -0
  31. data/vendor/assets/javascripts/ace/mode-asciidoc.js +39 -70
  32. data/vendor/assets/javascripts/ace/mode-assembly_x86.js +26 -58
  33. data/vendor/assets/javascripts/ace/mode-autohotkey.js +27 -63
  34. data/vendor/assets/javascripts/ace/mode-batchfile.js +27 -63
  35. data/vendor/assets/javascripts/ace/mode-c9search.js +92 -112
  36. data/vendor/assets/javascripts/ace/mode-c_cpp.js +224 -223
  37. data/vendor/assets/javascripts/ace/mode-cirru.js +202 -0
  38. data/vendor/assets/javascripts/ace/mode-clojure.js +98 -92
  39. data/vendor/assets/javascripts/ace/mode-cobol.js +27 -58
  40. data/vendor/assets/javascripts/ace/mode-coffee.js +90 -122
  41. data/vendor/assets/javascripts/ace/mode-coldfusion.js +1908 -1464
  42. data/vendor/assets/javascripts/ace/mode-csharp.js +291 -264
  43. data/vendor/assets/javascripts/ace/mode-css.js +266 -267
  44. data/vendor/assets/javascripts/ace/mode-curly.js +796 -815
  45. data/vendor/assets/javascripts/ace/mode-d.js +64 -95
  46. data/vendor/assets/javascripts/ace/mode-dart.js +254 -256
  47. data/vendor/assets/javascripts/ace/mode-diff.js +27 -58
  48. data/vendor/assets/javascripts/ace/mode-django.js +856 -866
  49. data/vendor/assets/javascripts/ace/mode-dockerfile.js +759 -0
  50. data/vendor/assets/javascripts/ace/mode-dot.js +106 -106
  51. data/vendor/assets/javascripts/ace/mode-eiffel.js +135 -0
  52. data/vendor/assets/javascripts/ace/mode-ejs.js +931 -938
  53. data/vendor/assets/javascripts/ace/mode-erlang.js +27 -58
  54. data/vendor/assets/javascripts/ace/mode-forth.js +27 -63
  55. data/vendor/assets/javascripts/ace/mode-ftl.js +457 -508
  56. data/vendor/assets/javascripts/ace/mode-gcode.js +85 -0
  57. data/vendor/assets/javascripts/ace/mode-gherkin.js +129 -0
  58. data/vendor/assets/javascripts/ace/mode-gitignore.js +50 -0
  59. data/vendor/assets/javascripts/ace/mode-glsl.js +252 -248
  60. data/vendor/assets/javascripts/ace/mode-golang.js +206 -179
  61. data/vendor/assets/javascripts/ace/mode-groovy.js +310 -242
  62. data/vendor/assets/javascripts/ace/mode-haml.js +156 -190
  63. data/vendor/assets/javascripts/ace/mode-handlebars.js +815 -784
  64. data/vendor/assets/javascripts/ace/mode-haskell.js +27 -63
  65. data/vendor/assets/javascripts/ace/mode-haxe.js +206 -176
  66. data/vendor/assets/javascripts/ace/mode-html.js +779 -792
  67. data/vendor/assets/javascripts/ace/mode-html_ruby.js +916 -923
  68. data/vendor/assets/javascripts/ace/mode-ini.js +27 -58
  69. data/vendor/assets/javascripts/ace/mode-io.js +201 -0
  70. data/vendor/assets/javascripts/ace/mode-jack.js +169 -170
  71. data/vendor/assets/javascripts/ace/mode-jade.js +722 -774
  72. data/vendor/assets/javascripts/ace/mode-java.js +310 -245
  73. data/vendor/assets/javascripts/ace/mode-javascript.js +285 -247
  74. data/vendor/assets/javascripts/ace/mode-json.js +183 -184
  75. data/vendor/assets/javascripts/ace/mode-jsoniq.js +3211 -1274
  76. data/vendor/assets/javascripts/ace/mode-jsp.js +481 -504
  77. data/vendor/assets/javascripts/ace/mode-jsx.js +206 -176
  78. data/vendor/assets/javascripts/ace/mode-julia.js +33 -69
  79. data/vendor/assets/javascripts/ace/mode-latex.js +74 -41
  80. data/vendor/assets/javascripts/ace/mode-less.js +250 -251
  81. data/vendor/assets/javascripts/ace/mode-liquid.js +424 -475
  82. data/vendor/assets/javascripts/ace/mode-lisp.js +24 -57
  83. data/vendor/assets/javascripts/ace/mode-livescript.js +42 -41
  84. data/vendor/assets/javascripts/ace/mode-logiql.js +229 -230
  85. data/vendor/assets/javascripts/ace/mode-lsl.js +200 -441
  86. data/vendor/assets/javascripts/ace/mode-lua.js +136 -167
  87. data/vendor/assets/javascripts/ace/mode-luapage.js +904 -884
  88. data/vendor/assets/javascripts/ace/mode-lucene.js +22 -17
  89. data/vendor/assets/javascripts/ace/mode-makefile.js +162 -137
  90. data/vendor/assets/javascripts/ace/mode-markdown.js +846 -854
  91. data/vendor/assets/javascripts/ace/mode-matlab.js +98 -72
  92. data/vendor/assets/javascripts/ace/mode-mel.js +569 -0
  93. data/vendor/assets/javascripts/ace/mode-mushcode.js +84 -115
  94. data/vendor/assets/javascripts/ace/mode-mysql.js +49 -80
  95. data/vendor/assets/javascripts/ace/mode-nix.js +252 -256
  96. data/vendor/assets/javascripts/ace/mode-objectivec.js +242 -274
  97. data/vendor/assets/javascripts/ace/mode-ocaml.js +71 -102
  98. data/vendor/assets/javascripts/ace/mode-pascal.js +32 -68
  99. data/vendor/assets/javascripts/ace/mode-perl.js +67 -98
  100. data/vendor/assets/javascripts/ace/mode-pgsql.js +990 -982
  101. data/vendor/assets/javascripts/ace/mode-php.js +1878 -1900
  102. data/vendor/assets/javascripts/ace/mode-plain_text.js +3 -34
  103. data/vendor/assets/javascripts/ace/mode-powershell.js +181 -151
  104. data/vendor/assets/javascripts/ace/mode-praat.js +418 -0
  105. data/vendor/assets/javascripts/ace/mode-prolog.js +27 -63
  106. data/vendor/assets/javascripts/ace/mode-properties.js +20 -48
  107. data/vendor/assets/javascripts/ace/mode-protobuf.js +252 -259
  108. data/vendor/assets/javascripts/ace/mode-python.js +84 -115
  109. data/vendor/assets/javascripts/ace/mode-r.js +105 -140
  110. data/vendor/assets/javascripts/ace/mode-rdoc.js +84 -89
  111. data/vendor/assets/javascripts/ace/mode-rhtml.js +892 -908
  112. data/vendor/assets/javascripts/ace/mode-ruby.js +434 -98
  113. data/vendor/assets/javascripts/ace/mode-rust.js +27 -63
  114. data/vendor/assets/javascripts/ace/mode-sass.js +75 -106
  115. data/vendor/assets/javascripts/ace/mode-scad.js +219 -220
  116. data/vendor/assets/javascripts/ace/mode-scala.js +311 -243
  117. data/vendor/assets/javascripts/ace/mode-scheme.js +24 -60
  118. data/vendor/assets/javascripts/ace/mode-scss.js +250 -251
  119. data/vendor/assets/javascripts/ace/mode-sh.js +506 -118
  120. data/vendor/assets/javascripts/ace/mode-sjs.js +314 -280
  121. data/vendor/assets/javascripts/ace/mode-smarty.js +2474 -0
  122. data/vendor/assets/javascripts/ace/mode-snippets.js +89 -89
  123. data/vendor/assets/javascripts/ace/mode-soy_template.js +792 -811
  124. data/vendor/assets/javascripts/ace/mode-space.js +22 -23
  125. data/vendor/assets/javascripts/ace/mode-sql.js +31 -58
  126. data/vendor/assets/javascripts/ace/mode-stylus.js +161 -197
  127. data/vendor/assets/javascripts/ace/mode-svg.js +906 -836
  128. data/vendor/assets/javascripts/ace/mode-tcl.js +61 -92
  129. data/vendor/assets/javascripts/ace/mode-tex.js +36 -73
  130. data/vendor/assets/javascripts/ace/mode-text.js +1 -0
  131. data/vendor/assets/javascripts/ace/mode-textile.js +41 -72
  132. data/vendor/assets/javascripts/ace/mode-toml.js +26 -62
  133. data/vendor/assets/javascripts/ace/mode-twig.js +1196 -892
  134. data/vendor/assets/javascripts/ace/mode-typescript.js +313 -277
  135. data/vendor/assets/javascripts/ace/mode-vala.js +982 -0
  136. data/vendor/assets/javascripts/ace/mode-vbscript.js +25 -62
  137. data/vendor/assets/javascripts/ace/mode-velocity.js +2251 -1242
  138. data/vendor/assets/javascripts/ace/mode-verilog.js +27 -59
  139. data/vendor/assets/javascripts/ace/mode-vhdl.js +26 -55
  140. data/vendor/assets/javascripts/ace/mode-xml.js +319 -644
  141. data/vendor/assets/javascripts/ace/mode-xquery.js +2503 -588
  142. data/vendor/assets/javascripts/ace/mode-yaml.js +56 -90
  143. data/vendor/assets/javascripts/ace/snippets/abap.js +7 -0
  144. data/vendor/assets/javascripts/ace/snippets/actionscript.js +159 -0
  145. data/vendor/assets/javascripts/ace/snippets/ada.js +7 -0
  146. data/vendor/assets/javascripts/ace/snippets/apache_conf.js +7 -0
  147. data/vendor/assets/javascripts/ace/snippets/applescript.js +7 -0
  148. data/vendor/assets/javascripts/ace/snippets/asciidoc.js +7 -0
  149. data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +7 -0
  150. data/vendor/assets/javascripts/ace/snippets/autohotkey.js +7 -0
  151. data/vendor/assets/javascripts/ace/snippets/batchfile.js +7 -0
  152. data/vendor/assets/javascripts/ace/snippets/c9search.js +7 -0
  153. data/vendor/assets/javascripts/ace/snippets/c_cpp.js +138 -0
  154. data/vendor/assets/javascripts/ace/snippets/cirru.js +7 -0
  155. data/vendor/assets/javascripts/ace/snippets/clojure.js +97 -0
  156. data/vendor/assets/javascripts/ace/snippets/cobol.js +7 -0
  157. data/vendor/assets/javascripts/ace/snippets/coffee.js +102 -0
  158. data/vendor/assets/javascripts/ace/snippets/coldfusion.js +7 -0
  159. data/vendor/assets/javascripts/ace/snippets/csharp.js +7 -0
  160. data/vendor/assets/javascripts/ace/snippets/css.js +974 -0
  161. data/vendor/assets/javascripts/ace/snippets/curly.js +7 -0
  162. data/vendor/assets/javascripts/ace/snippets/d.js +7 -0
  163. data/vendor/assets/javascripts/ace/snippets/dart.js +90 -0
  164. data/vendor/assets/javascripts/ace/snippets/diff.js +18 -0
  165. data/vendor/assets/javascripts/ace/snippets/django.js +115 -0
  166. data/vendor/assets/javascripts/ace/snippets/dockerfile.js +7 -0
  167. data/vendor/assets/javascripts/ace/snippets/dot.js +7 -0
  168. data/vendor/assets/javascripts/ace/snippets/eiffel.js +7 -0
  169. data/vendor/assets/javascripts/ace/snippets/ejs.js +7 -0
  170. data/vendor/assets/javascripts/ace/snippets/erlang.js +167 -0
  171. data/vendor/assets/javascripts/ace/snippets/forth.js +7 -0
  172. data/vendor/assets/javascripts/ace/snippets/ftl.js +7 -0
  173. data/vendor/assets/javascripts/ace/snippets/gcode.js +7 -0
  174. data/vendor/assets/javascripts/ace/snippets/gherkin.js +7 -0
  175. data/vendor/assets/javascripts/ace/snippets/gitignore.js +7 -0
  176. data/vendor/assets/javascripts/ace/snippets/glsl.js +7 -0
  177. data/vendor/assets/javascripts/ace/snippets/golang.js +7 -0
  178. data/vendor/assets/javascripts/ace/snippets/groovy.js +7 -0
  179. data/vendor/assets/javascripts/ace/snippets/haml.js +27 -0
  180. data/vendor/assets/javascripts/ace/snippets/handlebars.js +7 -0
  181. data/vendor/assets/javascripts/ace/snippets/haskell.js +89 -0
  182. data/vendor/assets/javascripts/ace/snippets/haxe.js +7 -0
  183. data/vendor/assets/javascripts/ace/snippets/html.js +835 -0
  184. data/vendor/assets/javascripts/ace/snippets/html_ruby.js +7 -0
  185. data/vendor/assets/javascripts/ace/snippets/ini.js +7 -0
  186. data/vendor/assets/javascripts/ace/snippets/io.js +69 -0
  187. data/vendor/assets/javascripts/ace/snippets/jack.js +7 -0
  188. data/vendor/assets/javascripts/ace/snippets/jade.js +7 -0
  189. data/vendor/assets/javascripts/ace/snippets/java.js +241 -0
  190. data/vendor/assets/javascripts/ace/snippets/javascript.js +189 -0
  191. data/vendor/assets/javascripts/ace/snippets/json.js +7 -0
  192. data/vendor/assets/javascripts/ace/snippets/jsoniq.js +68 -0
  193. data/vendor/assets/javascripts/ace/snippets/jsp.js +106 -0
  194. data/vendor/assets/javascripts/ace/snippets/jsx.js +7 -0
  195. data/vendor/assets/javascripts/ace/snippets/julia.js +7 -0
  196. data/vendor/assets/javascripts/ace/snippets/latex.js +7 -0
  197. data/vendor/assets/javascripts/ace/snippets/less.js +7 -0
  198. data/vendor/assets/javascripts/ace/snippets/liquid.js +7 -0
  199. data/vendor/assets/javascripts/ace/snippets/lisp.js +7 -0
  200. data/vendor/assets/javascripts/ace/snippets/livescript.js +7 -0
  201. data/vendor/assets/javascripts/ace/snippets/logiql.js +7 -0
  202. data/vendor/assets/javascripts/ace/snippets/lsl.js +1073 -0
  203. data/vendor/assets/javascripts/ace/snippets/lua.js +28 -0
  204. data/vendor/assets/javascripts/ace/snippets/luapage.js +7 -0
  205. data/vendor/assets/javascripts/ace/snippets/lucene.js +7 -0
  206. data/vendor/assets/javascripts/ace/snippets/makefile.js +11 -0
  207. data/vendor/assets/javascripts/ace/snippets/markdown.js +95 -0
  208. data/vendor/assets/javascripts/ace/snippets/matlab.js +7 -0
  209. data/vendor/assets/javascripts/ace/snippets/mel.js +7 -0
  210. data/vendor/assets/javascripts/ace/snippets/mushcode.js +7 -0
  211. data/vendor/assets/javascripts/ace/snippets/mysql.js +7 -0
  212. data/vendor/assets/javascripts/ace/snippets/nix.js +7 -0
  213. data/vendor/assets/javascripts/ace/snippets/objectivec.js +7 -0
  214. data/vendor/assets/javascripts/ace/snippets/ocaml.js +7 -0
  215. data/vendor/assets/javascripts/ace/snippets/pascal.js +7 -0
  216. data/vendor/assets/javascripts/ace/snippets/perl.js +354 -0
  217. data/vendor/assets/javascripts/ace/snippets/pgsql.js +7 -0
  218. data/vendor/assets/javascripts/ace/snippets/php.js +283 -0
  219. data/vendor/assets/javascripts/ace/snippets/plain_text.js +7 -0
  220. data/vendor/assets/javascripts/ace/snippets/powershell.js +7 -0
  221. data/vendor/assets/javascripts/ace/snippets/praat.js +7 -0
  222. data/vendor/assets/javascripts/ace/snippets/prolog.js +7 -0
  223. data/vendor/assets/javascripts/ace/snippets/properties.js +7 -0
  224. data/vendor/assets/javascripts/ace/snippets/protobuf.js +7 -0
  225. data/vendor/assets/javascripts/ace/snippets/python.js +165 -0
  226. data/vendor/assets/javascripts/ace/snippets/r.js +128 -0
  227. data/vendor/assets/javascripts/ace/snippets/rdoc.js +7 -0
  228. data/vendor/assets/javascripts/ace/snippets/rhtml.js +7 -0
  229. data/vendor/assets/javascripts/ace/snippets/ruby.js +935 -0
  230. data/vendor/assets/javascripts/ace/snippets/rust.js +7 -0
  231. data/vendor/assets/javascripts/ace/snippets/sass.js +7 -0
  232. data/vendor/assets/javascripts/ace/snippets/scad.js +7 -0
  233. data/vendor/assets/javascripts/ace/snippets/scala.js +7 -0
  234. data/vendor/assets/javascripts/ace/snippets/scheme.js +7 -0
  235. data/vendor/assets/javascripts/ace/snippets/scss.js +7 -0
  236. data/vendor/assets/javascripts/ace/snippets/sh.js +90 -0
  237. data/vendor/assets/javascripts/ace/snippets/sjs.js +7 -0
  238. data/vendor/assets/javascripts/ace/snippets/smarty.js +7 -0
  239. data/vendor/assets/javascripts/ace/snippets/snippets.js +16 -0
  240. data/vendor/assets/javascripts/ace/snippets/soy_template.js +7 -0
  241. data/vendor/assets/javascripts/ace/snippets/space.js +7 -0
  242. data/vendor/assets/javascripts/ace/snippets/sql.js +33 -0
  243. data/vendor/assets/javascripts/ace/snippets/stylus.js +7 -0
  244. data/vendor/assets/javascripts/ace/snippets/svg.js +7 -0
  245. data/vendor/assets/javascripts/ace/snippets/tcl.js +99 -0
  246. data/vendor/assets/javascripts/ace/snippets/tex.js +197 -0
  247. data/vendor/assets/javascripts/ace/snippets/text.js +7 -0
  248. data/vendor/assets/javascripts/ace/snippets/textile.js +37 -0
  249. data/vendor/assets/javascripts/ace/snippets/toml.js +7 -0
  250. data/vendor/assets/javascripts/ace/snippets/twig.js +7 -0
  251. data/vendor/assets/javascripts/ace/snippets/typescript.js +7 -0
  252. data/vendor/assets/javascripts/ace/snippets/vala.js +193 -0
  253. data/vendor/assets/javascripts/ace/snippets/vbscript.js +7 -0
  254. data/vendor/assets/javascripts/ace/snippets/velocity.js +36 -0
  255. data/vendor/assets/javascripts/ace/snippets/verilog.js +7 -0
  256. data/vendor/assets/javascripts/ace/snippets/vhdl.js +7 -0
  257. data/vendor/assets/javascripts/ace/snippets/xml.js +7 -0
  258. data/vendor/assets/javascripts/ace/snippets/xquery.js +68 -0
  259. data/vendor/assets/javascripts/ace/snippets/yaml.js +7 -0
  260. data/vendor/assets/javascripts/ace/theme-ambiance.js +4 -24
  261. data/vendor/assets/javascripts/ace/theme-chaos.js +2 -25
  262. data/vendor/assets/javascripts/ace/theme-chrome.js +2 -31
  263. data/vendor/assets/javascripts/ace/theme-clouds.js +1 -31
  264. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -31
  265. data/vendor/assets/javascripts/ace/theme-cobalt.js +1 -31
  266. data/vendor/assets/javascripts/ace/theme-crimson_editor.js +1 -31
  267. data/vendor/assets/javascripts/ace/theme-dawn.js +1 -31
  268. data/vendor/assets/javascripts/ace/theme-dreamweaver.js +5 -31
  269. data/vendor/assets/javascripts/ace/theme-eclipse.js +7 -33
  270. data/vendor/assets/javascripts/ace/theme-github.js +2 -35
  271. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +1 -31
  272. data/vendor/assets/javascripts/ace/theme-katzenmilch.js +119 -0
  273. data/vendor/assets/javascripts/ace/theme-kr.js +1 -31
  274. data/vendor/assets/javascripts/ace/theme-kr_theme.js +57 -141
  275. data/vendor/assets/javascripts/ace/theme-kuroir.js +59 -0
  276. data/vendor/assets/javascripts/ace/theme-merbivore.js +1 -31
  277. data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +1 -31
  278. data/vendor/assets/javascripts/ace/theme-mono_industrial.js +1 -31
  279. data/vendor/assets/javascripts/ace/theme-monokai.js +1 -31
  280. data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +1 -31
  281. data/vendor/assets/javascripts/ace/theme-solarized_dark.js +1 -31
  282. data/vendor/assets/javascripts/ace/theme-solarized_light.js +1 -31
  283. data/vendor/assets/javascripts/ace/theme-terminal.js +1 -31
  284. data/vendor/assets/javascripts/ace/theme-textmate.js +3 -32
  285. data/vendor/assets/javascripts/ace/theme-tomorrow.js +1 -31
  286. data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +1 -31
  287. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +1 -31
  288. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +1 -31
  289. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +1 -31
  290. data/vendor/assets/javascripts/ace/theme-twilight.js +1 -31
  291. data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +1 -31
  292. data/vendor/assets/javascripts/ace/theme-xcode.js +2 -33
  293. data/vendor/assets/javascripts/ace/worker-coffee.js +5026 -5008
  294. data/vendor/assets/javascripts/ace/worker-css.js +5489 -5134
  295. data/vendor/assets/javascripts/ace/worker-html.js +11517 -0
  296. data/vendor/assets/javascripts/ace/worker-javascript.js +9810 -9501
  297. data/vendor/assets/javascripts/ace/worker-json.js +1583 -1564
  298. data/vendor/assets/javascripts/ace/worker-lua.js +2631 -2612
  299. data/vendor/assets/javascripts/ace/worker-php.js +2385 -2341
  300. data/vendor/assets/javascripts/ace/worker-xquery.js +31643 -3993
  301. metadata +147 -11
@@ -1,121 +1,5 @@
1
- /* ***** BEGIN LICENSE BLOCK *****
2
- * Distributed under the BSD license:
3
- *
4
- * Copyright (c) 2010, Ajax.org B.V.
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- * * Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- * * Neither the name of Ajax.org B.V. nor the
15
- * names of its contributors may be used to endorse or promote products
16
- * derived from this software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
- *
29
- * ***** END LICENSE BLOCK ***** */
30
-
31
- define('ace/mode/coffee', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/coffee_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/worker/worker_client', 'ace/lib/oop'], function(require, exports, module) {
32
-
33
-
34
- var Tokenizer = require("../tokenizer").Tokenizer;
35
- var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
36
- var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
37
- var FoldMode = require("./folding/coffee").FoldMode;
38
- var Range = require("../range").Range;
39
- var TextMode = require("./text").Mode;
40
- var WorkerClient = require("../worker/worker_client").WorkerClient;
41
- var oop = require("../lib/oop");
42
-
43
- function Mode() {
44
- this.HighlightRules = Rules;
45
- this.$outdent = new Outdent();
46
- this.foldingRules = new FoldMode();
47
- }
48
-
49
- oop.inherits(Mode, TextMode);
50
-
51
- (function() {
52
-
53
- var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/;
54
- var commentLine = /^(\s*)#/;
55
- var hereComment = /^\s*###(?!#)/;
56
- var indentation = /^\s*/;
57
-
58
- this.getNextLineIndent = function(state, line, tab) {
59
- var indent = this.$getIndent(line);
60
- var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
61
-
62
- if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
63
- state === 'start' && indenter.test(line))
64
- indent += tab;
65
- return indent;
66
- };
67
-
68
- this.toggleCommentLines = function(state, doc, startRow, endRow){
69
- console.log("toggle");
70
- var range = new Range(0, 0, 0, 0);
71
- for (var i = startRow; i <= endRow; ++i) {
72
- var line = doc.getLine(i);
73
- if (hereComment.test(line))
74
- continue;
75
-
76
- if (commentLine.test(line))
77
- line = line.replace(commentLine, '$1');
78
- else
79
- line = line.replace(indentation, '$&#');
80
-
81
- range.end.row = range.start.row = i;
82
- range.end.column = line.length + 1;
83
- doc.replace(range, line);
84
- }
85
- };
86
-
87
- this.checkOutdent = function(state, line, input) {
88
- return this.$outdent.checkOutdent(line, input);
89
- };
90
-
91
- this.autoOutdent = function(state, doc, row) {
92
- this.$outdent.autoOutdent(doc, row);
93
- };
94
-
95
- this.createWorker = function(session) {
96
- var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
97
- worker.attachToDocument(session.getDocument());
98
-
99
- worker.on("error", function(e) {
100
- session.setAnnotations([e.data]);
101
- });
102
-
103
- worker.on("ok", function(e) {
104
- session.clearAnnotations();
105
- });
106
-
107
- return worker;
108
- };
109
-
110
- this.$id = "ace/mode/coffee";
111
- }).call(Mode.prototype);
112
-
113
- exports.Mode = Mode;
114
-
115
- });
116
-
117
- define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
118
-
1
+ define("ace/mode/coffee_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
+ "use strict";
119
3
 
120
4
  var oop = require("../lib/oop");
121
5
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
@@ -316,8 +200,8 @@ define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace
316
200
  exports.CoffeeHighlightRules = CoffeeHighlightRules;
317
201
  });
318
202
 
319
- define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
320
-
203
+ define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
204
+ "use strict";
321
205
 
322
206
  var Range = require("../range").Range;
323
207
 
@@ -356,8 +240,8 @@ var MatchingBraceOutdent = function() {};
356
240
  exports.MatchingBraceOutdent = MatchingBraceOutdent;
357
241
  });
358
242
 
359
- define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
360
-
243
+ define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
244
+ "use strict";
361
245
 
362
246
  var oop = require("../../lib/oop");
363
247
  var BaseFoldMode = require("./fold_mode").FoldMode;
@@ -442,3 +326,87 @@ oop.inherits(FoldMode, BaseFoldMode);
442
326
  }).call(FoldMode.prototype);
443
327
 
444
328
  });
329
+
330
+ define("ace/mode/coffee",["require","exports","module","ace/mode/coffee_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/coffee","ace/range","ace/mode/text","ace/worker/worker_client","ace/lib/oop"], function(require, exports, module) {
331
+ "use strict";
332
+
333
+ var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
334
+ var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
335
+ var FoldMode = require("./folding/coffee").FoldMode;
336
+ var Range = require("../range").Range;
337
+ var TextMode = require("./text").Mode;
338
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
339
+ var oop = require("../lib/oop");
340
+
341
+ function Mode() {
342
+ this.HighlightRules = Rules;
343
+ this.$outdent = new Outdent();
344
+ this.foldingRules = new FoldMode();
345
+ }
346
+
347
+ oop.inherits(Mode, TextMode);
348
+
349
+ (function() {
350
+ var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/;
351
+ var commentLine = /^(\s*)#/;
352
+ var hereComment = /^\s*###(?!#)/;
353
+ var indentation = /^\s*/;
354
+
355
+ this.getNextLineIndent = function(state, line, tab) {
356
+ var indent = this.$getIndent(line);
357
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
358
+
359
+ if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
360
+ state === 'start' && indenter.test(line))
361
+ indent += tab;
362
+ return indent;
363
+ };
364
+
365
+ this.toggleCommentLines = function(state, doc, startRow, endRow){
366
+ console.log("toggle");
367
+ var range = new Range(0, 0, 0, 0);
368
+ for (var i = startRow; i <= endRow; ++i) {
369
+ var line = doc.getLine(i);
370
+ if (hereComment.test(line))
371
+ continue;
372
+
373
+ if (commentLine.test(line))
374
+ line = line.replace(commentLine, '$1');
375
+ else
376
+ line = line.replace(indentation, '$&#');
377
+
378
+ range.end.row = range.start.row = i;
379
+ range.end.column = line.length + 1;
380
+ doc.replace(range, line);
381
+ }
382
+ };
383
+
384
+ this.checkOutdent = function(state, line, input) {
385
+ return this.$outdent.checkOutdent(line, input);
386
+ };
387
+
388
+ this.autoOutdent = function(state, doc, row) {
389
+ this.$outdent.autoOutdent(doc, row);
390
+ };
391
+
392
+ this.createWorker = function(session) {
393
+ var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
394
+ worker.attachToDocument(session.getDocument());
395
+
396
+ worker.on("error", function(e) {
397
+ session.setAnnotations([e.data]);
398
+ });
399
+
400
+ worker.on("ok", function(e) {
401
+ session.clearAnnotations();
402
+ });
403
+
404
+ return worker;
405
+ };
406
+
407
+ this.$id = "ace/mode/coffee";
408
+ }).call(Mode.prototype);
409
+
410
+ exports.Mode = Mode;
411
+
412
+ });
@@ -1,516 +1,476 @@
1
- /* ***** BEGIN LICENSE BLOCK *****
2
- * Distributed under the BSD license:
3
- *
4
- * Copyright (c) 2010, Ajax.org B.V.
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- * * Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- * * Neither the name of Ajax.org B.V. nor the
15
- * names of its contributors may be used to endorse or promote products
16
- * derived from this software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
- *
29
- * ***** END LICENSE BLOCK ***** */
30
-
31
- define('ace/mode/coldfusion', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/coldfusion_highlight_rules'], function(require, exports, module) {
32
-
1
+ define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
+ "use strict";
33
3
 
34
4
  var oop = require("../lib/oop");
35
- var XmlMode = require("./xml").Mode;
36
- var JavaScriptMode = require("./javascript").Mode;
37
- var CssMode = require("./css").Mode;
38
- var Tokenizer = require("../tokenizer").Tokenizer;
39
- var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
40
-
41
- var Mode = function() {
42
- XmlMode.call(this);
43
-
44
- this.HighlightRules = ColdfusionHighlightRules;
45
-
46
- this.createModeDelegates({
47
- "js-": JavaScriptMode,
48
- "css-": CssMode
49
- });
50
- };
51
- oop.inherits(Mode, XmlMode);
5
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
52
6
 
53
- (function() {
7
+ var DocCommentHighlightRules = function() {
54
8
 
55
- this.getNextLineIndent = function(state, line, tab) {
56
- return this.$getIndent(line);
9
+ this.$rules = {
10
+ "start" : [ {
11
+ token : "comment.doc.tag",
12
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
13
+ }, {
14
+ token : "comment.doc.tag",
15
+ regex : "\\bTODO\\b"
16
+ }, {
17
+ defaultToken : "comment.doc"
18
+ }]
57
19
  };
20
+ };
58
21
 
59
- this.$id = "ace/mode/coldfusion";
60
- }).call(Mode.prototype);
61
-
62
- exports.Mode = Mode;
63
- });
64
-
65
- define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
66
-
67
-
68
- var oop = require("../lib/oop");
69
- var TextMode = require("./text").Mode;
70
- var Tokenizer = require("../tokenizer").Tokenizer;
71
- var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
72
- var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
73
- var XmlFoldMode = require("./folding/xml").FoldMode;
22
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
74
23
 
75
- var Mode = function() {
76
- this.HighlightRules = XmlHighlightRules;
77
- this.$behaviour = new XmlBehaviour();
78
- this.foldingRules = new XmlFoldMode();
24
+ DocCommentHighlightRules.getStartRule = function(start) {
25
+ return {
26
+ token : "comment.doc", // doc comment
27
+ regex : "\\/\\*(?=\\*)",
28
+ next : start
29
+ };
79
30
  };
80
31
 
81
- oop.inherits(Mode, TextMode);
32
+ DocCommentHighlightRules.getEndRule = function (start) {
33
+ return {
34
+ token : "comment.doc", // closing comment
35
+ regex : "\\*\\/",
36
+ next : start
37
+ };
38
+ };
82
39
 
83
- (function() {
84
-
85
- this.blockComment = {start: "<!--", end: "-->"};
86
40
 
87
- this.$id = "ace/mode/xml";
88
- }).call(Mode.prototype);
41
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
89
42
 
90
- exports.Mode = Mode;
91
43
  });
92
44
 
93
- define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
94
-
45
+ define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
46
+ "use strict";
95
47
 
96
48
  var oop = require("../lib/oop");
97
- var xmlUtil = require("./xml_util");
49
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
98
50
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
99
51
 
100
- var XmlHighlightRules = function(normalize) {
52
+ var JavaScriptHighlightRules = function(options) {
53
+ var keywordMapper = this.createKeywordMapper({
54
+ "variable.language":
55
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
56
+ "Namespace|QName|XML|XMLList|" + // E4X
57
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
58
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
59
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
60
+ "SyntaxError|TypeError|URIError|" +
61
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
62
+ "isNaN|parseFloat|parseInt|" +
63
+ "JSON|Math|" + // Other
64
+ "this|arguments|prototype|window|document" , // Pseudo
65
+ "keyword":
66
+ "const|yield|import|get|set|" +
67
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
68
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
69
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
70
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
71
+ "storage.type":
72
+ "const|let|var|function",
73
+ "constant.language":
74
+ "null|Infinity|NaN|undefined",
75
+ "support.function":
76
+ "alert",
77
+ "constant.language.boolean": "true|false"
78
+ }, "identifier");
79
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
80
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
81
+
82
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
83
+ "u[0-9a-fA-F]{4}|" + // unicode
84
+ "[0-2][0-7]{0,2}|" + // oct
85
+ "3[0-6][0-7]?|" + // oct
86
+ "37[0-7]?|" + // oct
87
+ "[4-7][0-7]?|" + //oct
88
+ ".)";
89
+
101
90
  this.$rules = {
102
- start : [
103
- {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"},
104
- {
105
- token : ["punctuation.instruction.begin", "keyword.instruction"],
106
- regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration"
107
- },
91
+ "no_regex" : [
108
92
  {
109
- token : ["punctuation.instruction.begin", "keyword.instruction"],
110
- regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction"
93
+ token : "comment",
94
+ regex : "\\/\\/",
95
+ next : "line_comment"
111
96
  },
112
- {token : "comment", regex : "<\\!--", next : "comment"},
97
+ DocCommentHighlightRules.getStartRule("doc-start"),
113
98
  {
114
- token : ["punctuation.doctype.begin", "meta.tag.doctype"],
115
- regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype"
116
- },
117
- {include : "tag"},
118
- {include : "reference"}
119
- ],
120
-
121
- xml_declaration : [
122
- {include : "attributes"},
123
- {include : "instruction"}
124
- ],
125
-
126
- instruction : [
127
- {token : "punctuation.instruction.end", regex : "\\?>", next : "start"}
128
- ],
129
-
130
- doctype : [
131
- {include : "space"},
132
- {include : "string"},
133
- {token : "punctuation.doctype.end", regex : ">", next : "start"},
134
- {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"},
135
- {token : "punctuation.begin", regex : "\\[", push : "declarations"}
99
+ token : "comment", // multi line comment
100
+ regex : /\/\*/,
101
+ next : "comment"
102
+ }, {
103
+ token : "string",
104
+ regex : "'(?=.)",
105
+ next : "qstring"
106
+ }, {
107
+ token : "string",
108
+ regex : '"(?=.)',
109
+ next : "qqstring"
110
+ }, {
111
+ token : "constant.numeric", // hex
112
+ regex : /0[xX][0-9a-fA-F]+\b/
113
+ }, {
114
+ token : "constant.numeric", // float
115
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
116
+ }, {
117
+ token : [
118
+ "storage.type", "punctuation.operator", "support.function",
119
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
120
+ ],
121
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
122
+ next: "function_arguments"
123
+ }, {
124
+ token : [
125
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
126
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
127
+ ],
128
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
129
+ next: "function_arguments"
130
+ }, {
131
+ token : [
132
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
133
+ "text", "paren.lparen"
134
+ ],
135
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
136
+ next: "function_arguments"
137
+ }, {
138
+ token : [
139
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
140
+ "keyword.operator", "text",
141
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
142
+ ],
143
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
144
+ next: "function_arguments"
145
+ }, {
146
+ token : [
147
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
148
+ ],
149
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
150
+ next: "function_arguments"
151
+ }, {
152
+ token : [
153
+ "entity.name.function", "text", "punctuation.operator",
154
+ "text", "storage.type", "text", "paren.lparen"
155
+ ],
156
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
157
+ next: "function_arguments"
158
+ }, {
159
+ token : [
160
+ "text", "text", "storage.type", "text", "paren.lparen"
161
+ ],
162
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
163
+ next: "function_arguments"
164
+ }, {
165
+ token : "keyword",
166
+ regex : "(?:" + kwBeforeRe + ")\\b",
167
+ next : "start"
168
+ }, {
169
+ token : ["punctuation.operator", "support.function"],
170
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
171
+ }, {
172
+ token : ["punctuation.operator", "support.function.dom"],
173
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
174
+ }, {
175
+ token : ["punctuation.operator", "support.constant"],
176
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
177
+ }, {
178
+ token : ["support.constant"],
179
+ regex : /that\b/
180
+ }, {
181
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
182
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
183
+ }, {
184
+ token : keywordMapper,
185
+ regex : identifierRe
186
+ }, {
187
+ token : "keyword.operator",
188
+ regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
189
+ next : "start"
190
+ }, {
191
+ token : "punctuation.operator",
192
+ regex : /[?:,;.]/,
193
+ next : "start"
194
+ }, {
195
+ token : "paren.lparen",
196
+ regex : /[\[({]/,
197
+ next : "start"
198
+ }, {
199
+ token : "paren.rparen",
200
+ regex : /[\])}]/
201
+ }, {
202
+ token: "comment",
203
+ regex: /^#!.*$/
204
+ }
136
205
  ],
137
-
138
- declarations : [{
139
- token : "text",
140
- regex : "\\s+"
141
- }, {
142
- token: "punctuation.end",
143
- regex: "]",
144
- next: "pop"
145
- }, {
146
- token : ["punctuation.begin", "keyword"],
147
- regex : "(<\\!)([-_a-zA-Z0-9]+)",
148
- push : [{
149
- token : "text",
150
- regex : "\\s+"
151
- },
206
+ "start": [
207
+ DocCommentHighlightRules.getStartRule("doc-start"),
152
208
  {
153
- token : "punctuation.end",
154
- regex : ">",
155
- next : "pop"
156
- },
157
- {include : "string"}]
158
- }],
159
-
160
- cdata : [
161
- {token : "string.end", regex : "\\]\\]>", next : "start"},
162
- {token : "text", regex : "\\s+"},
163
- {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
164
- ],
165
-
166
- comment : [
167
- {token : "comment", regex : "-->", next : "start"},
168
- {defaultToken : "comment"}
169
- ],
170
-
171
- tag : [{
172
- token : ["meta.tag.punctuation.begin", "meta.tag.name"],
173
- regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
174
- next: [
175
- {include : "attributes"},
176
- {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
177
- ]
178
- }, {
179
- token : ["meta.tag.punctuation.begin", "meta.tag.name"],
180
- regex : "(</)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
181
- next: [
182
- {include : "space"},
183
- {token : "meta.tag.punctuation.end", regex : ">", next : "start"}
184
- ]
185
- }],
186
-
187
- space : [
188
- {token : "text", regex : "\\s+"}
209
+ token : "comment", // multi line comment
210
+ regex : "\\/\\*",
211
+ next : "comment_regex_allowed"
212
+ }, {
213
+ token : "comment",
214
+ regex : "\\/\\/",
215
+ next : "line_comment_regex_allowed"
216
+ }, {
217
+ token: "string.regexp",
218
+ regex: "\\/",
219
+ next: "regex"
220
+ }, {
221
+ token : "text",
222
+ regex : "\\s+|^$",
223
+ next : "start"
224
+ }, {
225
+ token: "empty",
226
+ regex: "",
227
+ next: "no_regex"
228
+ }
189
229
  ],
190
-
191
- reference : [{
192
- token : "constant.language.escape",
193
- regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
194
- }, {
195
- token : "text", regex : "&"
196
- }],
197
-
198
- string: [{
199
- token : "string",
200
- regex : "'",
201
- push : "qstring_inner"
230
+ "regex": [
231
+ {
232
+ token: "regexp.keyword.operator",
233
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
234
+ }, {
235
+ token: "string.regexp",
236
+ regex: "/[sxngimy]*",
237
+ next: "no_regex"
238
+ }, {
239
+ token : "invalid",
240
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
241
+ }, {
242
+ token : "constant.language.escape",
243
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
244
+ }, {
245
+ token : "constant.language.delimiter",
246
+ regex: /\|/
247
+ }, {
248
+ token: "constant.language.escape",
249
+ regex: /\[\^?/,
250
+ next: "regex_character_class"
251
+ }, {
252
+ token: "empty",
253
+ regex: "$",
254
+ next: "no_regex"
255
+ }, {
256
+ defaultToken: "string.regexp"
257
+ }
258
+ ],
259
+ "regex_character_class": [
260
+ {
261
+ token: "regexp.charclass.keyword.operator",
262
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
263
+ }, {
264
+ token: "constant.language.escape",
265
+ regex: "]",
266
+ next: "regex"
267
+ }, {
268
+ token: "constant.language.escape",
269
+ regex: "-"
270
+ }, {
271
+ token: "empty",
272
+ regex: "$",
273
+ next: "no_regex"
274
+ }, {
275
+ defaultToken: "string.regexp.charachterclass"
276
+ }
277
+ ],
278
+ "function_arguments": [
279
+ {
280
+ token: "variable.parameter",
281
+ regex: identifierRe
282
+ }, {
283
+ token: "punctuation.operator",
284
+ regex: "[, ]+"
285
+ }, {
286
+ token: "punctuation.operator",
287
+ regex: "$"
288
+ }, {
289
+ token: "empty",
290
+ regex: "",
291
+ next: "no_regex"
292
+ }
293
+ ],
294
+ "comment_regex_allowed" : [
295
+ {token : "comment", regex : "\\*\\/", next : "start"},
296
+ {defaultToken : "comment"}
297
+ ],
298
+ "comment" : [
299
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
300
+ {defaultToken : "comment"}
301
+ ],
302
+ "line_comment_regex_allowed" : [
303
+ {token : "comment", regex : "$|^", next : "start"},
304
+ {defaultToken : "comment"}
305
+ ],
306
+ "line_comment" : [
307
+ {token : "comment", regex : "$|^", next : "no_regex"},
308
+ {defaultToken : "comment"}
309
+ ],
310
+ "qqstring" : [
311
+ {
312
+ token : "constant.language.escape",
313
+ regex : escapedRe
314
+ }, {
315
+ token : "string",
316
+ regex : "\\\\$",
317
+ next : "qqstring"
318
+ }, {
319
+ token : "string",
320
+ regex : '"|$',
321
+ next : "no_regex"
322
+ }, {
323
+ defaultToken: "string"
324
+ }
325
+ ],
326
+ "qstring" : [
327
+ {
328
+ token : "constant.language.escape",
329
+ regex : escapedRe
330
+ }, {
331
+ token : "string",
332
+ regex : "\\\\$",
333
+ next : "qstring"
334
+ }, {
335
+ token : "string",
336
+ regex : "'|$",
337
+ next : "no_regex"
338
+ }, {
339
+ defaultToken: "string"
340
+ }
341
+ ]
342
+ };
343
+
344
+
345
+ if (!options || !options.noES6) {
346
+ this.$rules.no_regex.unshift({
347
+ regex: "[{}]", onMatch: function(val, state, stack) {
348
+ this.next = val == "{" ? this.nextState : "";
349
+ if (val == "{" && stack.length) {
350
+ stack.unshift("start", state);
351
+ return "paren";
352
+ }
353
+ if (val == "}" && stack.length) {
354
+ stack.shift();
355
+ this.next = stack.shift();
356
+ if (this.next.indexOf("string") != -1)
357
+ return "paren.quasi.end";
358
+ }
359
+ return val == "{" ? "paren.lparen" : "paren.rparen";
360
+ },
361
+ nextState: "start"
202
362
  }, {
203
- token : "string",
204
- regex : '"',
205
- push : "qqstring_inner"
206
- }],
363
+ token : "string.quasi.start",
364
+ regex : /`/,
365
+ push : [{
366
+ token : "constant.language.escape",
367
+ regex : escapedRe
368
+ }, {
369
+ token : "paren.quasi.start",
370
+ regex : /\${/,
371
+ push : "start"
372
+ }, {
373
+ token : "string.quasi.end",
374
+ regex : /`/,
375
+ next : "pop"
376
+ }, {
377
+ defaultToken: "string.quasi"
378
+ }]
379
+ });
380
+ }
381
+
382
+ this.embedRules(DocCommentHighlightRules, "doc-",
383
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
384
+
385
+ this.normalizeRules();
386
+ };
207
387
 
208
- qstring_inner: [
209
- {token : "string", regex: "'", next: "pop"},
210
- {include : "reference"},
211
- {defaultToken : "string"}
212
- ],
388
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
213
389
 
214
- qqstring_inner: [
215
- {token : "string", regex: '"', next: "pop"},
216
- {include : "reference"},
217
- {defaultToken : "string"}
218
- ],
390
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
391
+ });
219
392
 
220
- attributes: [{
221
- token : "entity.other.attribute-name",
222
- regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
223
- }, {
224
- token : "keyword.operator.separator",
225
- regex : "="
226
- }, {
227
- include : "space"
228
- }, {
229
- include : "string"
230
- }]
231
- };
393
+ define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
394
+ "use strict";
232
395
 
233
- if (this.constructor === XmlHighlightRules)
234
- this.normalizeRules();
235
- };
396
+ var Range = require("../range").Range;
236
397
 
398
+ var MatchingBraceOutdent = function() {};
237
399
 
238
400
  (function() {
239
401
 
240
- this.embedTagRules = function(HighlightRules, prefix, tag){
241
- this.$rules.tag.unshift({
242
- token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
243
- regex : "(<)(" + tag + ")",
244
- next: [
245
- {include : "space"},
246
- {include : "attributes"},
247
- {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"}
248
- ]
249
- });
250
-
251
- this.$rules[tag + "-end"] = [
252
- {include : "space"},
253
- {token : "meta.tag.punctuation.end", regex : ">", next: "start",
254
- onMatch : function(value, currentState, stack) {
255
- stack.splice(0);
256
- return this.token;
257
- }}
258
- ]
402
+ this.checkOutdent = function(line, input) {
403
+ if (! /^\s+$/.test(line))
404
+ return false;
259
405
 
260
- this.embedRules(HighlightRules, prefix, [{
261
- token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
262
- regex : "(</)(" + tag + ")",
263
- next: tag + "-end"
264
- }, {
265
- token: "string.begin",
266
- regex : "<\\!\\[CDATA\\["
267
- }, {
268
- token: "string.end",
269
- regex : "\\]\\]>"
270
- }]);
406
+ return /^\s*\}/.test(input);
271
407
  };
272
408
 
273
- }).call(TextHighlightRules.prototype);
274
-
275
- oop.inherits(XmlHighlightRules, TextHighlightRules);
409
+ this.autoOutdent = function(doc, row) {
410
+ var line = doc.getLine(row);
411
+ var match = line.match(/^(\s*\})/);
276
412
 
277
- exports.XmlHighlightRules = XmlHighlightRules;
278
- });
413
+ if (!match) return 0;
279
414
 
280
- define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
415
+ var column = match[1].length;
416
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
281
417
 
418
+ if (!openBracePos || openBracePos.row == row) return 0;
282
419
 
283
- function string(state) {
284
- return [{
285
- token : "string",
286
- regex : '"',
287
- next : state + "_qqstring"
288
- }, {
289
- token : "string",
290
- regex : "'",
291
- next : state + "_qstring"
292
- }];
293
- }
420
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
421
+ doc.replace(new Range(row, 0, row, column-1), indent);
422
+ };
294
423
 
295
- function multiLineString(quote, state) {
296
- return [
297
- {token : "string", regex : quote, next : state},
298
- {
299
- token : "constant.language.escape",
300
- regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
301
- },
302
- {defaultToken : "string"}
303
- ];
304
- }
424
+ this.$getIndent = function(line) {
425
+ return line.match(/^\s*/)[0];
426
+ };
305
427
 
306
- exports.tag = function(states, name, nextState, tagMap) {
307
- states[name] = [{
308
- token : "text",
309
- regex : "\\s+"
310
- }, {
311
-
312
- token : !tagMap ? "meta.tag.tag-name" : function(value) {
313
- if (tagMap[value])
314
- return "meta.tag.tag-name." + tagMap[value];
315
- else
316
- return "meta.tag.tag-name";
317
- },
318
- regex : "[-_a-zA-Z0-9:]+",
319
- next : name + "_embed_attribute_list"
320
- }, {
321
- token: "empty",
322
- regex: "",
323
- next : name + "_embed_attribute_list"
324
- }];
325
-
326
- states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
327
- states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
328
-
329
- states[name + "_embed_attribute_list"] = [{
330
- token : "meta.tag.r",
331
- regex : "/?>",
332
- next : nextState
333
- }, {
334
- token : "keyword.operator",
335
- regex : "="
336
- }, {
337
- token : "entity.other.attribute-name",
338
- regex : "[-_a-zA-Z0-9:]+"
339
- }, {
340
- token : "constant.numeric", // float
341
- regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
342
- }, {
343
- token : "text",
344
- regex : "\\s+"
345
- }].concat(string(name));
346
- };
428
+ }).call(MatchingBraceOutdent.prototype);
347
429
 
430
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
348
431
  });
349
432
 
350
- define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
351
-
433
+ define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
434
+ "use strict";
352
435
 
353
436
  var oop = require("../../lib/oop");
354
437
  var Behaviour = require("../behaviour").Behaviour;
355
- var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
356
438
  var TokenIterator = require("../../token_iterator").TokenIterator;
439
+ var lang = require("../../lib/lang");
357
440
 
358
- function hasType(token, type) {
359
- var tokenTypes = token.type.split('.');
360
- return type.split('.').every(function(type){
361
- return (tokenTypes.indexOf(type) !== -1);
362
- });
363
- return hasType;
364
- }
441
+ var SAFE_INSERT_IN_TOKENS =
442
+ ["text", "paren.rparen", "punctuation.operator"];
443
+ var SAFE_INSERT_BEFORE_TOKENS =
444
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
365
445
 
366
- var XmlBehaviour = function () {
367
-
368
- this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
369
-
370
- this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
371
- if (text == '>') {
372
- var position = editor.getCursorPosition();
373
- var iterator = new TokenIterator(session, position.row, position.column);
374
- var token = iterator.getCurrentToken();
446
+ var context;
447
+ var contextCache = {}
448
+ var initContext = function(editor) {
449
+ var id = -1;
450
+ if (editor.multiSelect) {
451
+ id = editor.selection.id;
452
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
453
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
454
+ }
455
+ if (contextCache[id])
456
+ return context = contextCache[id];
457
+ context = contextCache[id] = {
458
+ autoInsertedBrackets: 0,
459
+ autoInsertedRow: -1,
460
+ autoInsertedLineEnd: "",
461
+ maybeInsertedBrackets: 0,
462
+ maybeInsertedRow: -1,
463
+ maybeInsertedLineStart: "",
464
+ maybeInsertedLineEnd: ""
465
+ };
466
+ };
375
467
 
376
- if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
377
- return;
378
- var atCursor = false;
379
- if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
380
- do {
381
- token = iterator.stepBackward();
382
- } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
383
- } else {
384
- atCursor = true;
385
- }
386
- if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
387
- return;
388
- }
389
- var tag = token.value;
390
- if (atCursor){
391
- var tag = tag.substring(0, position.column - token.start);
392
- }
393
-
394
- return {
395
- text: '>' + '</' + tag + '>',
396
- selection: [1, 1]
397
- }
398
- }
399
- });
400
-
401
- this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
402
- if (text == "\n") {
403
- var cursor = editor.getCursorPosition();
404
- var line = session.getLine(cursor.row);
405
- var rightChars = line.substring(cursor.column, cursor.column + 2);
406
- if (rightChars == '</') {
407
- var next_indent = this.$getIndent(line);
408
- var indent = next_indent + session.getTabString();
409
-
410
- return {
411
- text: '\n' + indent + '\n' + next_indent,
412
- selection: [1, indent.length, 1, indent.length]
413
- }
414
- }
415
- }
416
- });
417
-
418
- }
419
- oop.inherits(XmlBehaviour, Behaviour);
420
-
421
- exports.XmlBehaviour = XmlBehaviour;
422
- });
423
-
424
- define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
425
-
426
-
427
- var oop = require("../../lib/oop");
428
- var Behaviour = require("../behaviour").Behaviour;
429
- var TokenIterator = require("../../token_iterator").TokenIterator;
430
- var lang = require("../../lib/lang");
431
-
432
- var SAFE_INSERT_IN_TOKENS =
433
- ["text", "paren.rparen", "punctuation.operator"];
434
- var SAFE_INSERT_BEFORE_TOKENS =
435
- ["text", "paren.rparen", "punctuation.operator", "comment"];
436
-
437
-
438
- var autoInsertedBrackets = 0;
439
- var autoInsertedRow = -1;
440
- var autoInsertedLineEnd = "";
441
- var maybeInsertedBrackets = 0;
442
- var maybeInsertedRow = -1;
443
- var maybeInsertedLineStart = "";
444
- var maybeInsertedLineEnd = "";
445
-
446
- var CstyleBehaviour = function () {
447
-
448
- CstyleBehaviour.isSaneInsertion = function(editor, session) {
449
- var cursor = editor.getCursorPosition();
450
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
451
- if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
452
- var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
453
- if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
454
- return false;
455
- }
456
- iterator.stepForward();
457
- return iterator.getCurrentTokenRow() !== cursor.row ||
458
- this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
459
- };
460
-
461
- CstyleBehaviour.$matchTokenType = function(token, types) {
462
- return types.indexOf(token.type || token) > -1;
463
- };
464
-
465
- CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
466
- var cursor = editor.getCursorPosition();
467
- var line = session.doc.getLine(cursor.row);
468
- if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
469
- autoInsertedBrackets = 0;
470
- autoInsertedRow = cursor.row;
471
- autoInsertedLineEnd = bracket + line.substr(cursor.column);
472
- autoInsertedBrackets++;
473
- };
474
-
475
- CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
476
- var cursor = editor.getCursorPosition();
477
- var line = session.doc.getLine(cursor.row);
478
- if (!this.isMaybeInsertedClosing(cursor, line))
479
- maybeInsertedBrackets = 0;
480
- maybeInsertedRow = cursor.row;
481
- maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
482
- maybeInsertedLineEnd = line.substr(cursor.column);
483
- maybeInsertedBrackets++;
484
- };
485
-
486
- CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
487
- return autoInsertedBrackets > 0 &&
488
- cursor.row === autoInsertedRow &&
489
- bracket === autoInsertedLineEnd[0] &&
490
- line.substr(cursor.column) === autoInsertedLineEnd;
491
- };
492
-
493
- CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
494
- return maybeInsertedBrackets > 0 &&
495
- cursor.row === maybeInsertedRow &&
496
- line.substr(cursor.column) === maybeInsertedLineEnd &&
497
- line.substr(0, cursor.column) == maybeInsertedLineStart;
498
- };
499
-
500
- CstyleBehaviour.popAutoInsertedClosing = function() {
501
- autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
502
- autoInsertedBrackets--;
503
- };
504
-
505
- CstyleBehaviour.clearMaybeInsertedClosing = function() {
506
- maybeInsertedBrackets = 0;
507
- maybeInsertedRow = -1;
508
- };
509
-
510
- this.add("braces", "insertion", function (state, action, editor, session, text) {
468
+ var CstyleBehaviour = function() {
469
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
511
470
  var cursor = editor.getCursorPosition();
512
471
  var line = session.doc.getLine(cursor.row);
513
472
  if (text == '{') {
473
+ initContext(editor);
514
474
  var selection = editor.getSelectionRange();
515
475
  var selected = session.doc.getTextRange(selection);
516
476
  if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
@@ -534,6 +494,7 @@ var CstyleBehaviour = function () {
534
494
  }
535
495
  }
536
496
  } else if (text == '}') {
497
+ initContext(editor);
537
498
  var rightChar = line.substring(cursor.column, cursor.column + 1);
538
499
  if (rightChar == '}') {
539
500
  var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
@@ -546,9 +507,10 @@ var CstyleBehaviour = function () {
546
507
  }
547
508
  }
548
509
  } else if (text == "\n" || text == "\r\n") {
510
+ initContext(editor);
549
511
  var closing = "";
550
512
  if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
551
- closing = lang.stringRepeat("}", maybeInsertedBrackets);
513
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
552
514
  CstyleBehaviour.clearMaybeInsertedClosing();
553
515
  }
554
516
  var rightChar = line.substring(cursor.column, cursor.column + 1);
@@ -560,6 +522,7 @@ var CstyleBehaviour = function () {
560
522
  } else if (closing) {
561
523
  var next_indent = this.$getIndent(line);
562
524
  } else {
525
+ CstyleBehaviour.clearMaybeInsertedClosing();
563
526
  return;
564
527
  }
565
528
  var indent = next_indent + session.getTabString();
@@ -573,22 +536,24 @@ var CstyleBehaviour = function () {
573
536
  }
574
537
  });
575
538
 
576
- this.add("braces", "deletion", function (state, action, editor, session, range) {
539
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
577
540
  var selected = session.doc.getTextRange(range);
578
541
  if (!range.isMultiLine() && selected == '{') {
542
+ initContext(editor);
579
543
  var line = session.doc.getLine(range.start.row);
580
544
  var rightChar = line.substring(range.end.column, range.end.column + 1);
581
545
  if (rightChar == '}') {
582
546
  range.end.column++;
583
547
  return range;
584
548
  } else {
585
- maybeInsertedBrackets--;
549
+ context.maybeInsertedBrackets--;
586
550
  }
587
551
  }
588
552
  });
589
553
 
590
- this.add("parens", "insertion", function (state, action, editor, session, text) {
554
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
591
555
  if (text == '(') {
556
+ initContext(editor);
592
557
  var selection = editor.getSelectionRange();
593
558
  var selected = session.doc.getTextRange(selection);
594
559
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
@@ -604,6 +569,7 @@ var CstyleBehaviour = function () {
604
569
  };
605
570
  }
606
571
  } else if (text == ')') {
572
+ initContext(editor);
607
573
  var cursor = editor.getCursorPosition();
608
574
  var line = session.doc.getLine(cursor.row);
609
575
  var rightChar = line.substring(cursor.column, cursor.column + 1);
@@ -620,9 +586,10 @@ var CstyleBehaviour = function () {
620
586
  }
621
587
  });
622
588
 
623
- this.add("parens", "deletion", function (state, action, editor, session, range) {
589
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
624
590
  var selected = session.doc.getTextRange(range);
625
591
  if (!range.isMultiLine() && selected == '(') {
592
+ initContext(editor);
626
593
  var line = session.doc.getLine(range.start.row);
627
594
  var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
628
595
  if (rightChar == ')') {
@@ -632,8 +599,9 @@ var CstyleBehaviour = function () {
632
599
  }
633
600
  });
634
601
 
635
- this.add("brackets", "insertion", function (state, action, editor, session, text) {
602
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
636
603
  if (text == '[') {
604
+ initContext(editor);
637
605
  var selection = editor.getSelectionRange();
638
606
  var selected = session.doc.getTextRange(selection);
639
607
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
@@ -649,6 +617,7 @@ var CstyleBehaviour = function () {
649
617
  };
650
618
  }
651
619
  } else if (text == ']') {
620
+ initContext(editor);
652
621
  var cursor = editor.getCursorPosition();
653
622
  var line = session.doc.getLine(cursor.row);
654
623
  var rightChar = line.substring(cursor.column, cursor.column + 1);
@@ -665,9 +634,10 @@ var CstyleBehaviour = function () {
665
634
  }
666
635
  });
667
636
 
668
- this.add("brackets", "deletion", function (state, action, editor, session, range) {
637
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
669
638
  var selected = session.doc.getTextRange(range);
670
639
  if (!range.isMultiLine() && selected == '[') {
640
+ initContext(editor);
671
641
  var line = session.doc.getLine(range.start.row);
672
642
  var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
673
643
  if (rightChar == ']') {
@@ -677,8 +647,9 @@ var CstyleBehaviour = function () {
677
647
  }
678
648
  });
679
649
 
680
- this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
650
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
681
651
  if (text == '"' || text == "'") {
652
+ initContext(editor);
682
653
  var quote = text;
683
654
  var selection = editor.getSelectionRange();
684
655
  var selected = session.doc.getTextRange(selection);
@@ -730,9 +701,10 @@ var CstyleBehaviour = function () {
730
701
  }
731
702
  });
732
703
 
733
- this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
704
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
734
705
  var selected = session.doc.getTextRange(range);
735
706
  if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
707
+ initContext(editor);
736
708
  var line = session.doc.getLine(range.start.row);
737
709
  var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
738
710
  if (rightChar == selected) {
@@ -744,285 +716,225 @@ var CstyleBehaviour = function () {
744
716
 
745
717
  };
746
718
 
719
+
720
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
721
+ var cursor = editor.getCursorPosition();
722
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
723
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
724
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
725
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
726
+ return false;
727
+ }
728
+ iterator.stepForward();
729
+ return iterator.getCurrentTokenRow() !== cursor.row ||
730
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
731
+ };
732
+
733
+ CstyleBehaviour.$matchTokenType = function(token, types) {
734
+ return types.indexOf(token.type || token) > -1;
735
+ };
736
+
737
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
738
+ var cursor = editor.getCursorPosition();
739
+ var line = session.doc.getLine(cursor.row);
740
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
741
+ context.autoInsertedBrackets = 0;
742
+ context.autoInsertedRow = cursor.row;
743
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
744
+ context.autoInsertedBrackets++;
745
+ };
746
+
747
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
748
+ var cursor = editor.getCursorPosition();
749
+ var line = session.doc.getLine(cursor.row);
750
+ if (!this.isMaybeInsertedClosing(cursor, line))
751
+ context.maybeInsertedBrackets = 0;
752
+ context.maybeInsertedRow = cursor.row;
753
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
754
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
755
+ context.maybeInsertedBrackets++;
756
+ };
757
+
758
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
759
+ return context.autoInsertedBrackets > 0 &&
760
+ cursor.row === context.autoInsertedRow &&
761
+ bracket === context.autoInsertedLineEnd[0] &&
762
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
763
+ };
764
+
765
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
766
+ return context.maybeInsertedBrackets > 0 &&
767
+ cursor.row === context.maybeInsertedRow &&
768
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
769
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
770
+ };
771
+
772
+ CstyleBehaviour.popAutoInsertedClosing = function() {
773
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
774
+ context.autoInsertedBrackets--;
775
+ };
776
+
777
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
778
+ if (context) {
779
+ context.maybeInsertedBrackets = 0;
780
+ context.maybeInsertedRow = -1;
781
+ }
782
+ };
783
+
784
+
785
+
747
786
  oop.inherits(CstyleBehaviour, Behaviour);
748
787
 
749
788
  exports.CstyleBehaviour = CstyleBehaviour;
750
789
  });
751
790
 
752
- define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) {
753
-
791
+ define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
792
+ "use strict";
754
793
 
755
794
  var oop = require("../../lib/oop");
756
- var lang = require("../../lib/lang");
757
795
  var Range = require("../../range").Range;
758
796
  var BaseFoldMode = require("./fold_mode").FoldMode;
759
- var TokenIterator = require("../../token_iterator").TokenIterator;
760
797
 
761
- var FoldMode = exports.FoldMode = function(voidElements) {
762
- BaseFoldMode.call(this);
763
- this.voidElements = voidElements || {};
798
+ var FoldMode = exports.FoldMode = function(commentRegex) {
799
+ if (commentRegex) {
800
+ this.foldingStartMarker = new RegExp(
801
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
802
+ );
803
+ this.foldingStopMarker = new RegExp(
804
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
805
+ );
806
+ }
764
807
  };
765
808
  oop.inherits(FoldMode, BaseFoldMode);
766
809
 
767
810
  (function() {
768
811
 
769
- this.getFoldWidget = function(session, foldStyle, row) {
770
- var tag = this._getFirstTagInLine(session, row);
771
-
772
- if (tag.closing)
773
- return foldStyle == "markbeginend" ? "end" : "";
812
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
813
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
774
814
 
775
- if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
776
- return "";
815
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
816
+ var line = session.getLine(row);
817
+ var match = line.match(this.foldingStartMarker);
818
+ if (match) {
819
+ var i = match.index;
777
820
 
778
- if (tag.selfClosing)
779
- return "";
821
+ if (match[1])
822
+ return this.openingBracketBlock(session, match[1], row, i);
823
+
824
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
825
+
826
+ if (range && !range.isMultiLine()) {
827
+ if (forceMultiline) {
828
+ range = this.getSectionRange(session, row);
829
+ } else if (foldStyle != "all")
830
+ range = null;
831
+ }
832
+
833
+ return range;
834
+ }
780
835
 
781
- if (tag.value.indexOf("/" + tag.tagName) !== -1)
782
- return "";
836
+ if (foldStyle === "markbegin")
837
+ return;
783
838
 
784
- return "start";
785
- };
786
-
787
- this._getFirstTagInLine = function(session, row) {
788
- var tokens = session.getTokens(row);
789
- var value = "";
790
- for (var i = 0; i < tokens.length; i++) {
791
- var token = tokens[i];
792
- if (token.type.lastIndexOf("meta.tag", 0) === 0)
793
- value += token.value;
794
- else
795
- value += lang.stringRepeat(" ", token.value.length);
796
- }
797
-
798
- return this._parseTag(value);
799
- };
839
+ var match = line.match(this.foldingStopMarker);
840
+ if (match) {
841
+ var i = match.index + match[0].length;
800
842
 
801
- this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
802
- this._parseTag = function(tag) {
803
-
804
- var match = tag.match(this.tagRe);
805
- var column = 0;
843
+ if (match[1])
844
+ return this.closingBracketBlock(session, match[1], row, i);
806
845
 
807
- return {
808
- value: tag,
809
- match: match ? match[2] : "",
810
- closing: match ? !!match[3] : false,
811
- selfClosing: match ? !!match[5] || match[2] == "/>" : false,
812
- tagName: match ? match[4] : "",
813
- column: match[1] ? column + match[1].length : column
814
- };
846
+ return session.getCommentFoldRange(row, i, -1);
847
+ }
815
848
  };
816
- this._readTagForward = function(iterator) {
817
- var token = iterator.getCurrentToken();
818
- if (!token)
819
- return null;
849
+
850
+ this.getSectionRange = function(session, row) {
851
+ var line = session.getLine(row);
852
+ var startIndent = line.search(/\S/);
853
+ var startRow = row;
854
+ var startColumn = line.length;
855
+ row = row + 1;
856
+ var endRow = row;
857
+ var maxRow = session.getLength();
858
+ while (++row < maxRow) {
859
+ line = session.getLine(row);
860
+ var indent = line.search(/\S/);
861
+ if (indent === -1)
862
+ continue;
863
+ if (startIndent > indent)
864
+ break;
865
+ var subRange = this.getFoldWidgetRange(session, "all", row);
820
866
 
821
- var value = "";
822
- var start;
823
-
824
- do {
825
- if (token.type.lastIndexOf("meta.tag", 0) === 0) {
826
- if (!start) {
827
- var start = {
828
- row: iterator.getCurrentTokenRow(),
829
- column: iterator.getCurrentTokenColumn()
830
- };
831
- }
832
- value += token.value;
833
- if (value.indexOf(">") !== -1) {
834
- var tag = this._parseTag(value);
835
- tag.start = start;
836
- tag.end = {
837
- row: iterator.getCurrentTokenRow(),
838
- column: iterator.getCurrentTokenColumn() + token.value.length
839
- };
840
- iterator.stepForward();
841
- return tag;
867
+ if (subRange) {
868
+ if (subRange.start.row <= startRow) {
869
+ break;
870
+ } else if (subRange.isMultiLine()) {
871
+ row = subRange.end.row;
872
+ } else if (startIndent == indent) {
873
+ break;
842
874
  }
843
875
  }
844
- } while(token = iterator.stepForward());
876
+ endRow = row;
877
+ }
845
878
 
846
- return null;
879
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
847
880
  };
881
+
882
+ }).call(FoldMode.prototype);
883
+
884
+ });
885
+
886
+ define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
887
+ "use strict";
888
+
889
+ var oop = require("../lib/oop");
890
+ var TextMode = require("./text").Mode;
891
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
892
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
893
+ var Range = require("../range").Range;
894
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
895
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
896
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
897
+
898
+ var Mode = function() {
899
+ this.HighlightRules = JavaScriptHighlightRules;
848
900
 
849
- this._readTagBackward = function(iterator) {
850
- var token = iterator.getCurrentToken();
851
- if (!token)
852
- return null;
853
-
854
- var value = "";
855
- var end;
901
+ this.$outdent = new MatchingBraceOutdent();
902
+ this.$behaviour = new CstyleBehaviour();
903
+ this.foldingRules = new CStyleFoldMode();
904
+ };
905
+ oop.inherits(Mode, TextMode);
856
906
 
857
- do {
858
- if (token.type.lastIndexOf("meta.tag", 0) === 0) {
859
- if (!end) {
860
- end = {
861
- row: iterator.getCurrentTokenRow(),
862
- column: iterator.getCurrentTokenColumn() + token.value.length
863
- };
864
- }
865
- value = token.value + value;
866
- if (value.indexOf("<") !== -1) {
867
- var tag = this._parseTag(value);
868
- tag.end = end;
869
- tag.start = {
870
- row: iterator.getCurrentTokenRow(),
871
- column: iterator.getCurrentTokenColumn()
872
- };
873
- iterator.stepBackward();
874
- return tag;
907
+ (function() {
908
+
909
+ this.lineCommentStart = "//";
910
+ this.blockComment = {start: "/*", end: "*/"};
911
+
912
+ this.getNextLineIndent = function(state, line, tab) {
913
+ var indent = this.$getIndent(line);
914
+
915
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
916
+ var tokens = tokenizedLine.tokens;
917
+ var endState = tokenizedLine.state;
918
+
919
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
920
+ return indent;
921
+ }
922
+
923
+ if (state == "start" || state == "no_regex") {
924
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
925
+ if (match) {
926
+ indent += tab;
927
+ }
928
+ } else if (state == "doc-start") {
929
+ if (endState == "start" || endState == "no_regex") {
930
+ return "";
931
+ }
932
+ var match = line.match(/^\s*(\/?)\*/);
933
+ if (match) {
934
+ if (match[1]) {
935
+ indent += " ";
875
936
  }
876
- }
877
- } while(token = iterator.stepBackward());
878
-
879
- return null;
880
- };
881
-
882
- this._pop = function(stack, tag) {
883
- while (stack.length) {
884
-
885
- var top = stack[stack.length-1];
886
- if (!tag || top.tagName == tag.tagName) {
887
- return stack.pop();
888
- }
889
- else if (this.voidElements[tag.tagName]) {
890
- return;
891
- }
892
- else if (this.voidElements[top.tagName]) {
893
- stack.pop();
894
- continue;
895
- } else {
896
- return null;
897
- }
898
- }
899
- };
900
-
901
- this.getFoldWidgetRange = function(session, foldStyle, row) {
902
- var firstTag = this._getFirstTagInLine(session, row);
903
-
904
- if (!firstTag.match)
905
- return null;
906
-
907
- var isBackward = firstTag.closing || firstTag.selfClosing;
908
- var stack = [];
909
- var tag;
910
-
911
- if (!isBackward) {
912
- var iterator = new TokenIterator(session, row, firstTag.column);
913
- var start = {
914
- row: row,
915
- column: firstTag.column + firstTag.tagName.length + 2
916
- };
917
- while (tag = this._readTagForward(iterator)) {
918
- if (tag.selfClosing) {
919
- if (!stack.length) {
920
- tag.start.column += tag.tagName.length + 2;
921
- tag.end.column -= 2;
922
- return Range.fromPoints(tag.start, tag.end);
923
- } else
924
- continue;
925
- }
926
-
927
- if (tag.closing) {
928
- this._pop(stack, tag);
929
- if (stack.length == 0)
930
- return Range.fromPoints(start, tag.start);
931
- }
932
- else {
933
- stack.push(tag)
934
- }
935
- }
936
- }
937
- else {
938
- var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
939
- var end = {
940
- row: row,
941
- column: firstTag.column
942
- };
943
-
944
- while (tag = this._readTagBackward(iterator)) {
945
- if (tag.selfClosing) {
946
- if (!stack.length) {
947
- tag.start.column += tag.tagName.length + 2;
948
- tag.end.column -= 2;
949
- return Range.fromPoints(tag.start, tag.end);
950
- } else
951
- continue;
952
- }
953
-
954
- if (!tag.closing) {
955
- this._pop(stack, tag);
956
- if (stack.length == 0) {
957
- tag.start.column += tag.tagName.length + 2;
958
- return Range.fromPoints(tag.start, end);
959
- }
960
- }
961
- else {
962
- stack.push(tag)
963
- }
964
- }
965
- }
966
-
967
- };
968
-
969
- }).call(FoldMode.prototype);
970
-
971
- });
972
-
973
- define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
974
-
975
-
976
- var oop = require("../lib/oop");
977
- var TextMode = require("./text").Mode;
978
- var Tokenizer = require("../tokenizer").Tokenizer;
979
- var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
980
- var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
981
- var Range = require("../range").Range;
982
- var WorkerClient = require("../worker/worker_client").WorkerClient;
983
- var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
984
- var CStyleFoldMode = require("./folding/cstyle").FoldMode;
985
-
986
- var Mode = function() {
987
- this.HighlightRules = JavaScriptHighlightRules;
988
-
989
- this.$outdent = new MatchingBraceOutdent();
990
- this.$behaviour = new CstyleBehaviour();
991
- this.foldingRules = new CStyleFoldMode();
992
- };
993
- oop.inherits(Mode, TextMode);
994
-
995
- (function() {
996
-
997
- this.lineCommentStart = "//";
998
- this.blockComment = {start: "/*", end: "*/"};
999
-
1000
- this.getNextLineIndent = function(state, line, tab) {
1001
- var indent = this.$getIndent(line);
1002
-
1003
- var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
1004
- var tokens = tokenizedLine.tokens;
1005
- var endState = tokenizedLine.state;
1006
-
1007
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
1008
- return indent;
1009
- }
1010
-
1011
- if (state == "start" || state == "no_regex") {
1012
- var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
1013
- if (match) {
1014
- indent += tab;
1015
- }
1016
- } else if (state == "doc-start") {
1017
- if (endState == "start" || endState == "no_regex") {
1018
- return "";
1019
- }
1020
- var match = line.match(/^\s*(\/?)\*/);
1021
- if (match) {
1022
- if (match[1]) {
1023
- indent += " ";
1024
- }
1025
- indent += "* ";
937
+ indent += "* ";
1026
938
  }
1027
939
  }
1028
940
 
@@ -1058,789 +970,1385 @@ oop.inherits(Mode, TextMode);
1058
970
  exports.Mode = Mode;
1059
971
  });
1060
972
 
1061
- define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1062
-
973
+ define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
974
+ "use strict";
1063
975
 
1064
976
  var oop = require("../lib/oop");
1065
- var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
977
+ var lang = require("../lib/lang");
1066
978
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
979
+ var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|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|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|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-after|cue-before|cue|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|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|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|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
980
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
981
+ var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
982
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
983
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1067
984
 
1068
- var JavaScriptHighlightRules = function() {
1069
- var keywordMapper = this.createKeywordMapper({
1070
- "variable.language":
1071
- "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
1072
- "Namespace|QName|XML|XMLList|" + // E4X
1073
- "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
1074
- "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
1075
- "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
1076
- "SyntaxError|TypeError|URIError|" +
1077
- "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
1078
- "isNaN|parseFloat|parseInt|" +
1079
- "JSON|Math|" + // Other
1080
- "this|arguments|prototype|window|document" , // Pseudo
1081
- "keyword":
1082
- "const|yield|import|get|set|" +
1083
- "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
1084
- "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
1085
- "__parent__|__count__|escape|unescape|with|__proto__|" +
1086
- "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
1087
- "storage.type":
1088
- "const|let|var|function",
1089
- "constant.language":
1090
- "null|Infinity|NaN|undefined",
1091
- "support.function":
1092
- "alert",
1093
- "constant.language.boolean": "true|false"
1094
- }, "identifier");
1095
- var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
1096
- var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
985
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
986
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
987
+ var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
1097
988
 
1098
- var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
1099
- "u[0-9a-fA-F]{4}|" + // unicode
1100
- "[0-2][0-7]{0,2}|" + // oct
1101
- "3[0-6][0-7]?|" + // oct
1102
- "37[0-7]?|" + // oct
1103
- "[4-7][0-7]?|" + //oct
1104
- ".)";
989
+ var CssHighlightRules = function() {
990
+
991
+ var keywordMapper = this.createKeywordMapper({
992
+ "support.function": supportFunction,
993
+ "support.constant": supportConstant,
994
+ "support.type": supportType,
995
+ "support.constant.color": supportConstantColor,
996
+ "support.constant.fonts": supportConstantFonts
997
+ }, "text", true);
1105
998
 
1106
999
  this.$rules = {
1107
- "no_regex" : [
1108
- {
1109
- token : "comment",
1110
- regex : "\\/\\/",
1111
- next : "line_comment"
1112
- },
1113
- DocCommentHighlightRules.getStartRule("doc-start"),
1114
- {
1115
- token : "comment", // multi line comment
1116
- regex : /\/\*/,
1117
- next : "comment"
1118
- }, {
1119
- token : "string",
1120
- regex : "'(?=.)",
1121
- next : "qstring"
1122
- }, {
1123
- token : "string",
1124
- regex : '"(?=.)',
1125
- next : "qqstring"
1126
- }, {
1127
- token : "constant.numeric", // hex
1128
- regex : /0[xX][0-9a-fA-F]+\b/
1129
- }, {
1130
- token : "constant.numeric", // float
1131
- regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
1132
- }, {
1133
- token : [
1134
- "storage.type", "punctuation.operator", "support.function",
1135
- "punctuation.operator", "entity.name.function", "text","keyword.operator"
1136
- ],
1137
- regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
1138
- next: "function_arguments"
1139
- }, {
1140
- token : [
1141
- "storage.type", "punctuation.operator", "entity.name.function", "text",
1142
- "keyword.operator", "text", "storage.type", "text", "paren.lparen"
1143
- ],
1144
- regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1145
- next: "function_arguments"
1146
- }, {
1147
- token : [
1148
- "entity.name.function", "text", "keyword.operator", "text", "storage.type",
1149
- "text", "paren.lparen"
1150
- ],
1151
- regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1152
- next: "function_arguments"
1153
- }, {
1154
- token : [
1155
- "storage.type", "punctuation.operator", "entity.name.function", "text",
1156
- "keyword.operator", "text",
1157
- "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1158
- ],
1159
- regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
1160
- next: "function_arguments"
1161
- }, {
1162
- token : [
1163
- "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1164
- ],
1165
- regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
1166
- next: "function_arguments"
1167
- }, {
1168
- token : [
1169
- "entity.name.function", "text", "punctuation.operator",
1170
- "text", "storage.type", "text", "paren.lparen"
1171
- ],
1172
- regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
1173
- next: "function_arguments"
1174
- }, {
1175
- token : [
1176
- "text", "text", "storage.type", "text", "paren.lparen"
1177
- ],
1178
- regex : "(:)(\\s*)(function)(\\s*)(\\()",
1179
- next: "function_arguments"
1180
- }, {
1181
- token : "keyword",
1182
- regex : "(?:" + kwBeforeRe + ")\\b",
1183
- next : "start"
1184
- }, {
1185
- token : ["punctuation.operator", "support.function"],
1186
- regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
1187
- }, {
1188
- token : ["punctuation.operator", "support.function.dom"],
1189
- regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
1190
- }, {
1191
- token : ["punctuation.operator", "support.constant"],
1192
- regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
1193
- }, {
1194
- token : ["storage.type", "punctuation.operator", "support.function.firebug"],
1195
- regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
1196
- }, {
1197
- token : keywordMapper,
1198
- regex : identifierRe
1199
- }, {
1200
- token : "keyword.operator",
1201
- regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
1202
- next : "start"
1203
- }, {
1204
- token : "punctuation.operator",
1205
- regex : /\?|\:|\,|\;|\./,
1206
- next : "start"
1207
- }, {
1208
- token : "paren.lparen",
1209
- regex : /[\[({]/,
1210
- next : "start"
1211
- }, {
1212
- token : "paren.rparen",
1213
- regex : /[\])}]/
1214
- }, {
1215
- token : "keyword.operator",
1216
- regex : /\/=?/,
1217
- next : "start"
1218
- }, {
1219
- token: "comment",
1220
- regex: /^#!.*$/
1000
+ "start" : [{
1001
+ token : "comment", // multi line comment
1002
+ regex : "\\/\\*",
1003
+ push : "comment"
1004
+ }, {
1005
+ token: "paren.lparen",
1006
+ regex: "\\{",
1007
+ push: "ruleset"
1008
+ }, {
1009
+ token: "string",
1010
+ regex: "@.*?{",
1011
+ push: "media"
1012
+ }, {
1013
+ token: "keyword",
1014
+ regex: "#[a-z0-9-_]+"
1015
+ }, {
1016
+ token: "variable",
1017
+ regex: "\\.[a-z0-9-_]+"
1018
+ }, {
1019
+ token: "string",
1020
+ regex: ":[a-z0-9-_]+"
1021
+ }, {
1022
+ token: "constant",
1023
+ regex: "[a-z0-9-_]+"
1024
+ }, {
1025
+ caseInsensitive: true
1026
+ }],
1027
+
1028
+ "media" : [{
1029
+ token : "comment", // multi line comment
1030
+ regex : "\\/\\*",
1031
+ push : "comment"
1032
+ }, {
1033
+ token: "paren.lparen",
1034
+ regex: "\\{",
1035
+ push: "ruleset"
1036
+ }, {
1037
+ token: "string",
1038
+ regex: "\\}",
1039
+ next: "pop"
1040
+ }, {
1041
+ token: "keyword",
1042
+ regex: "#[a-z0-9-_]+"
1043
+ }, {
1044
+ token: "variable",
1045
+ regex: "\\.[a-z0-9-_]+"
1046
+ }, {
1047
+ token: "string",
1048
+ regex: ":[a-z0-9-_]+"
1049
+ }, {
1050
+ token: "constant",
1051
+ regex: "[a-z0-9-_]+"
1052
+ }, {
1053
+ caseInsensitive: true
1054
+ }],
1055
+
1056
+ "comment" : [{
1057
+ token : "comment",
1058
+ regex : "\\*\\/",
1059
+ next : "pop"
1060
+ }, {
1061
+ defaultToken : "comment"
1062
+ }],
1063
+
1064
+ "ruleset" : [
1065
+ {
1066
+ token : "paren.rparen",
1067
+ regex : "\\}",
1068
+ next: "pop"
1069
+ }, {
1070
+ token : "comment", // multi line comment
1071
+ regex : "\\/\\*",
1072
+ push : "comment"
1073
+ }, {
1074
+ token : "string", // single line
1075
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1076
+ }, {
1077
+ token : "string", // single line
1078
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1079
+ }, {
1080
+ token : ["constant.numeric", "keyword"],
1081
+ regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
1082
+ }, {
1083
+ token : "constant.numeric",
1084
+ regex : numRe
1085
+ }, {
1086
+ token : "constant.numeric", // hex6 color
1087
+ regex : "#[a-f0-9]{6}"
1088
+ }, {
1089
+ token : "constant.numeric", // hex3 color
1090
+ regex : "#[a-f0-9]{3}"
1091
+ }, {
1092
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1093
+ regex : pseudoElements
1094
+ }, {
1095
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1096
+ regex : pseudoClasses
1097
+ }, {
1098
+ token : ["support.function", "string", "support.function"],
1099
+ regex : "(url\\()(.*)(\\))"
1100
+ }, {
1101
+ token : keywordMapper,
1102
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1103
+ }, {
1104
+ caseInsensitive: true
1105
+ }]
1106
+ };
1107
+
1108
+ this.normalizeRules();
1109
+ };
1110
+
1111
+ oop.inherits(CssHighlightRules, TextHighlightRules);
1112
+
1113
+ exports.CssHighlightRules = CssHighlightRules;
1114
+
1115
+ });
1116
+
1117
+ define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
1118
+ "use strict";
1119
+
1120
+ var oop = require("../../lib/oop");
1121
+ var Behaviour = require("../behaviour").Behaviour;
1122
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1123
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1124
+
1125
+ var CssBehaviour = function () {
1126
+
1127
+ this.inherit(CstyleBehaviour);
1128
+
1129
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1130
+ if (text === ':') {
1131
+ var cursor = editor.getCursorPosition();
1132
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1133
+ var token = iterator.getCurrentToken();
1134
+ if (token && token.value.match(/\s+/)) {
1135
+ token = iterator.stepBackward();
1221
1136
  }
1222
- ],
1223
- "start": [
1224
- DocCommentHighlightRules.getStartRule("doc-start"),
1225
- {
1226
- token : "comment", // multi line comment
1227
- regex : "\\/\\*",
1228
- next : "comment_regex_allowed"
1229
- }, {
1230
- token : "comment",
1231
- regex : "\\/\\/",
1232
- next : "line_comment_regex_allowed"
1233
- }, {
1234
- token: "string.regexp",
1235
- regex: "\\/",
1236
- next: "regex"
1237
- }, {
1238
- token : "text",
1239
- regex : "\\s+|^$",
1240
- next : "start"
1241
- }, {
1242
- token: "empty",
1243
- regex: "",
1244
- next: "no_regex"
1137
+ if (token && token.type === 'support.type') {
1138
+ var line = session.doc.getLine(cursor.row);
1139
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1140
+ if (rightChar === ':') {
1141
+ return {
1142
+ text: '',
1143
+ selection: [1, 1]
1144
+ }
1145
+ }
1146
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1147
+ return {
1148
+ text: ':;',
1149
+ selection: [1, 1]
1150
+ }
1151
+ }
1245
1152
  }
1246
- ],
1247
- "regex": [
1153
+ }
1154
+ });
1155
+
1156
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1157
+ var selected = session.doc.getTextRange(range);
1158
+ if (!range.isMultiLine() && selected === ':') {
1159
+ var cursor = editor.getCursorPosition();
1160
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1161
+ var token = iterator.getCurrentToken();
1162
+ if (token && token.value.match(/\s+/)) {
1163
+ token = iterator.stepBackward();
1164
+ }
1165
+ if (token && token.type === 'support.type') {
1166
+ var line = session.doc.getLine(range.start.row);
1167
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1168
+ if (rightChar === ';') {
1169
+ range.end.column ++;
1170
+ return range;
1171
+ }
1172
+ }
1173
+ }
1174
+ });
1175
+
1176
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1177
+ if (text === ';') {
1178
+ var cursor = editor.getCursorPosition();
1179
+ var line = session.doc.getLine(cursor.row);
1180
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1181
+ if (rightChar === ';') {
1182
+ return {
1183
+ text: '',
1184
+ selection: [1, 1]
1185
+ }
1186
+ }
1187
+ }
1188
+ });
1189
+
1190
+ }
1191
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1192
+
1193
+ exports.CssBehaviour = CssBehaviour;
1194
+ });
1195
+
1196
+ define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
1197
+ "use strict";
1198
+
1199
+ var oop = require("../lib/oop");
1200
+ var TextMode = require("./text").Mode;
1201
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1202
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1203
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1204
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
1205
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1206
+
1207
+ var Mode = function() {
1208
+ this.HighlightRules = CssHighlightRules;
1209
+ this.$outdent = new MatchingBraceOutdent();
1210
+ this.$behaviour = new CssBehaviour();
1211
+ this.foldingRules = new CStyleFoldMode();
1212
+ };
1213
+ oop.inherits(Mode, TextMode);
1214
+
1215
+ (function() {
1216
+
1217
+ this.foldingRules = "cStyle";
1218
+ this.blockComment = {start: "/*", end: "*/"};
1219
+
1220
+ this.getNextLineIndent = function(state, line, tab) {
1221
+ var indent = this.$getIndent(line);
1222
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1223
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1224
+ return indent;
1225
+ }
1226
+
1227
+ var match = line.match(/^.*\{\s*$/);
1228
+ if (match) {
1229
+ indent += tab;
1230
+ }
1231
+
1232
+ return indent;
1233
+ };
1234
+
1235
+ this.checkOutdent = function(state, line, input) {
1236
+ return this.$outdent.checkOutdent(line, input);
1237
+ };
1238
+
1239
+ this.autoOutdent = function(state, doc, row) {
1240
+ this.$outdent.autoOutdent(doc, row);
1241
+ };
1242
+
1243
+ this.createWorker = function(session) {
1244
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1245
+ worker.attachToDocument(session.getDocument());
1246
+
1247
+ worker.on("csslint", function(e) {
1248
+ session.setAnnotations(e.data);
1249
+ });
1250
+
1251
+ worker.on("terminate", function() {
1252
+ session.clearAnnotations();
1253
+ });
1254
+
1255
+ return worker;
1256
+ };
1257
+
1258
+ this.$id = "ace/mode/css";
1259
+ }).call(Mode.prototype);
1260
+
1261
+ exports.Mode = Mode;
1262
+
1263
+ });
1264
+
1265
+ define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
1266
+ "use strict";
1267
+
1268
+ var oop = require("../lib/oop");
1269
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1270
+
1271
+ var XmlHighlightRules = function(normalize) {
1272
+ this.$rules = {
1273
+ start : [
1274
+ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
1248
1275
  {
1249
- token: "regexp.keyword.operator",
1250
- regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1251
- }, {
1252
- token: "string.regexp",
1253
- regex: "/[sxngimy]*",
1254
- next: "no_regex"
1255
- }, {
1256
- token : "invalid",
1257
- regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
1258
- }, {
1259
- token : "constant.language.escape",
1260
- regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
1261
- }, {
1262
- token : "constant.language.delimiter",
1263
- regex: /\|/
1264
- }, {
1265
- token: "constant.language.escape",
1266
- regex: /\[\^?/,
1267
- next: "regex_character_class"
1268
- }, {
1269
- token: "empty",
1270
- regex: "$",
1271
- next: "no_regex"
1272
- }, {
1273
- defaultToken: "string.regexp"
1274
- }
1275
- ],
1276
- "regex_character_class": [
1276
+ token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
1277
+ regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
1278
+ },
1277
1279
  {
1278
- token: "regexp.keyword.operator",
1279
- regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1280
- }, {
1281
- token: "constant.language.escape",
1282
- regex: "]",
1283
- next: "regex"
1284
- }, {
1285
- token: "constant.language.escape",
1286
- regex: "-"
1287
- }, {
1288
- token: "empty",
1289
- regex: "$",
1290
- next: "no_regex"
1291
- }, {
1292
- defaultToken: "string.regexp.charachterclass"
1293
- }
1294
- ],
1295
- "function_arguments": [
1280
+ token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
1281
+ regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
1282
+ },
1283
+ {token : "comment.xml", regex : "<\\!--", next : "comment"},
1296
1284
  {
1297
- token: "variable.parameter",
1298
- regex: identifierRe
1299
- }, {
1300
- token: "punctuation.operator",
1301
- regex: "[, ]+"
1302
- }, {
1303
- token: "punctuation.operator",
1304
- regex: "$"
1305
- }, {
1306
- token: "empty",
1307
- regex: "",
1308
- next: "no_regex"
1309
- }
1310
- ],
1311
- "comment_regex_allowed" : [
1312
- {token : "comment", regex : "\\*\\/", next : "start"},
1313
- {defaultToken : "comment"}
1314
- ],
1315
- "comment" : [
1316
- {token : "comment", regex : "\\*\\/", next : "no_regex"},
1317
- {defaultToken : "comment"}
1318
- ],
1319
- "line_comment_regex_allowed" : [
1320
- {token : "comment", regex : "$|^", next : "start"},
1321
- {defaultToken : "comment"}
1285
+ token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
1286
+ regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
1287
+ },
1288
+ {include : "tag"},
1289
+ {token : "text.end-tag-open.xml", regex: "</"},
1290
+ {token : "text.tag-open.xml", regex: "<"},
1291
+ {include : "reference"},
1292
+ {defaultToken : "text.xml"}
1322
1293
  ],
1323
- "line_comment" : [
1324
- {token : "comment", regex : "$|^", next : "no_regex"},
1325
- {defaultToken : "comment"}
1294
+
1295
+ xml_decl : [{
1296
+ token : "entity.other.attribute-name.decl-attribute-name.xml",
1297
+ regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
1298
+ }, {
1299
+ token : "keyword.operator.decl-attribute-equals.xml",
1300
+ regex : "="
1301
+ }, {
1302
+ include: "whitespace"
1303
+ }, {
1304
+ include: "string"
1305
+ }, {
1306
+ token : "punctuation.xml-decl.xml",
1307
+ regex : "\\?>",
1308
+ next : "start"
1309
+ }],
1310
+
1311
+ processing_instruction : [
1312
+ {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
1313
+ {defaultToken : "instruction.xml"}
1326
1314
  ],
1327
- "qqstring" : [
1328
- {
1329
- token : "constant.language.escape",
1330
- regex : escapedRe
1331
- }, {
1332
- token : "string",
1333
- regex : "\\\\$",
1334
- next : "qqstring"
1335
- }, {
1336
- token : "string",
1337
- regex : '"|$',
1338
- next : "no_regex"
1339
- }, {
1340
- defaultToken: "string"
1341
- }
1315
+
1316
+ doctype : [
1317
+ {include : "whitespace"},
1318
+ {include : "string"},
1319
+ {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
1320
+ {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
1321
+ {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
1342
1322
  ],
1343
- "qstring" : [
1344
- {
1345
- token : "constant.language.escape",
1346
- regex : escapedRe
1347
- }, {
1348
- token : "string",
1349
- regex : "\\\\$",
1350
- next : "qstring"
1351
- }, {
1352
- token : "string",
1353
- regex : "'|$",
1354
- next : "no_regex"
1355
- }, {
1356
- defaultToken: "string"
1357
- }
1358
- ]
1359
- };
1360
1323
 
1361
- this.embedRules(DocCommentHighlightRules, "doc-",
1362
- [ DocCommentHighlightRules.getEndRule("no_regex") ]);
1363
- };
1324
+ int_subset : [{
1325
+ token : "text.xml",
1326
+ regex : "\\s+"
1327
+ }, {
1328
+ token: "punctuation.int-subset.xml",
1329
+ regex: "]",
1330
+ next: "pop"
1331
+ }, {
1332
+ token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
1333
+ regex : "(<\\!)([-_a-zA-Z0-9]+)",
1334
+ push : [{
1335
+ token : "text",
1336
+ regex : "\\s+"
1337
+ },
1338
+ {
1339
+ token : "punctuation.markup-decl.xml",
1340
+ regex : ">",
1341
+ next : "pop"
1342
+ },
1343
+ {include : "string"}]
1344
+ }],
1364
1345
 
1365
- oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1346
+ cdata : [
1347
+ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
1348
+ {token : "text.xml", regex : "\\s+"},
1349
+ {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
1350
+ ],
1366
1351
 
1367
- exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1368
- });
1352
+ comment : [
1353
+ {token : "comment.xml", regex : "-->", next : "start"},
1354
+ {defaultToken : "comment.xml"}
1355
+ ],
1369
1356
 
1370
- define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1357
+ reference : [{
1358
+ token : "constant.language.escape.reference.xml",
1359
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1360
+ }],
1371
1361
 
1362
+ attr_reference : [{
1363
+ token : "constant.language.escape.reference.attribute-value.xml",
1364
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1365
+ }],
1372
1366
 
1373
- var oop = require("../lib/oop");
1374
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1367
+ tag : [{
1368
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
1369
+ regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
1370
+ next: [
1371
+ {include : "attributes"},
1372
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1373
+ ]
1374
+ }],
1375
1375
 
1376
- var DocCommentHighlightRules = function() {
1376
+ tag_whitespace : [
1377
+ {token : "text.tag-whitespace.xml", regex : "\\s+"}
1378
+ ],
1379
+ whitespace : [
1380
+ {token : "text.whitespace.xml", regex : "\\s+"}
1381
+ ],
1382
+ string: [{
1383
+ token : "string.xml",
1384
+ regex : "'",
1385
+ push : [
1386
+ {token : "string.xml", regex: "'", next: "pop"},
1387
+ {defaultToken : "string.xml"}
1388
+ ]
1389
+ }, {
1390
+ token : "string.xml",
1391
+ regex : '"',
1392
+ push : [
1393
+ {token : "string.xml", regex: '"', next: "pop"},
1394
+ {defaultToken : "string.xml"}
1395
+ ]
1396
+ }],
1377
1397
 
1378
- this.$rules = {
1379
- "start" : [ {
1380
- token : "comment.doc.tag",
1381
- regex : "@[\\w\\d_]+" // TODO: fix email addresses
1398
+ attributes: [{
1399
+ token : "entity.other.attribute-name.xml",
1400
+ regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
1382
1401
  }, {
1383
- token : "comment.doc.tag",
1384
- regex : "\\bTODO\\b"
1402
+ token : "keyword.operator.attribute-equals.xml",
1403
+ regex : "="
1385
1404
  }, {
1386
- defaultToken : "comment.doc"
1405
+ include: "tag_whitespace"
1406
+ }, {
1407
+ include: "attribute_value"
1408
+ }],
1409
+
1410
+ attribute_value: [{
1411
+ token : "string.attribute-value.xml",
1412
+ regex : "'",
1413
+ push : [
1414
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
1415
+ {include : "attr_reference"},
1416
+ {defaultToken : "string.attribute-value.xml"}
1417
+ ]
1418
+ }, {
1419
+ token : "string.attribute-value.xml",
1420
+ regex : '"',
1421
+ push : [
1422
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
1423
+ {include : "attr_reference"},
1424
+ {defaultToken : "string.attribute-value.xml"}
1425
+ ]
1387
1426
  }]
1388
1427
  };
1428
+
1429
+ if (this.constructor === XmlHighlightRules)
1430
+ this.normalizeRules();
1389
1431
  };
1390
1432
 
1391
- oop.inherits(DocCommentHighlightRules, TextHighlightRules);
1392
1433
 
1393
- DocCommentHighlightRules.getStartRule = function(start) {
1394
- return {
1395
- token : "comment.doc", // doc comment
1396
- regex : "\\/\\*(?=\\*)",
1397
- next : start
1398
- };
1399
- };
1434
+ (function() {
1400
1435
 
1401
- DocCommentHighlightRules.getEndRule = function (start) {
1402
- return {
1403
- token : "comment.doc", // closing comment
1404
- regex : "\\*\\/",
1405
- next : start
1436
+ this.embedTagRules = function(HighlightRules, prefix, tag){
1437
+ this.$rules.tag.unshift({
1438
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1439
+ regex : "(<)(" + tag + "(?=\\s|>|$))",
1440
+ next: [
1441
+ {include : "attributes"},
1442
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
1443
+ ]
1444
+ });
1445
+
1446
+ this.$rules[tag + "-end"] = [
1447
+ {include : "attributes"},
1448
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
1449
+ onMatch : function(value, currentState, stack) {
1450
+ stack.splice(0);
1451
+ return this.token;
1452
+ }}
1453
+ ]
1454
+
1455
+ this.embedRules(HighlightRules, prefix, [{
1456
+ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1457
+ regex : "(</)(" + tag + "(?=\\s|>|$))",
1458
+ next: tag + "-end"
1459
+ }, {
1460
+ token: "string.cdata.xml",
1461
+ regex : "<\\!\\[CDATA\\["
1462
+ }, {
1463
+ token: "string.cdata.xml",
1464
+ regex : "\\]\\]>"
1465
+ }]);
1406
1466
  };
1407
- };
1408
1467
 
1468
+ }).call(TextHighlightRules.prototype);
1409
1469
 
1410
- exports.DocCommentHighlightRules = DocCommentHighlightRules;
1470
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
1471
+
1472
+ exports.XmlHighlightRules = XmlHighlightRules;
1473
+ });
1474
+
1475
+ define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
1476
+ "use strict";
1477
+
1478
+ var oop = require("../lib/oop");
1479
+ var lang = require("../lib/lang");
1480
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1481
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1482
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1411
1483
 
1484
+ var tagMap = lang.createMap({
1485
+ a : 'anchor',
1486
+ button : 'form',
1487
+ form : 'form',
1488
+ img : 'image',
1489
+ input : 'form',
1490
+ label : 'form',
1491
+ option : 'form',
1492
+ script : 'script',
1493
+ select : 'form',
1494
+ textarea : 'form',
1495
+ style : 'style',
1496
+ table : 'table',
1497
+ tbody : 'table',
1498
+ td : 'table',
1499
+ tfoot : 'table',
1500
+ th : 'table',
1501
+ tr : 'table'
1412
1502
  });
1413
1503
 
1414
- define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1415
-
1504
+ var HtmlHighlightRules = function() {
1505
+ XmlHighlightRules.call(this);
1416
1506
 
1417
- var Range = require("../range").Range;
1507
+ this.addRules({
1508
+ attributes: [{
1509
+ include : "tag_whitespace"
1510
+ }, {
1511
+ token : "entity.other.attribute-name.xml",
1512
+ regex : "[-_a-zA-Z0-9:]+"
1513
+ }, {
1514
+ token : "keyword.operator.attribute-equals.xml",
1515
+ regex : "=",
1516
+ push : [{
1517
+ include: "tag_whitespace"
1518
+ }, {
1519
+ token : "string.unquoted.attribute-value.html",
1520
+ regex : "[^<>='\"`\\s]+",
1521
+ next : "pop"
1522
+ }, {
1523
+ token : "empty",
1524
+ regex : "",
1525
+ next : "pop"
1526
+ }]
1527
+ }, {
1528
+ include : "attribute_value"
1529
+ }],
1530
+ tag: [{
1531
+ token : function(start, tag) {
1532
+ var group = tagMap[tag];
1533
+ return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1534
+ "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1535
+ },
1536
+ regex : "(</?)([-_a-zA-Z0-9:]+)",
1537
+ next: "tag_stuff"
1538
+ }],
1539
+ tag_stuff: [
1540
+ {include : "attributes"},
1541
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1542
+ ],
1543
+ });
1418
1544
 
1419
- var MatchingBraceOutdent = function() {};
1545
+ this.embedTagRules(CssHighlightRules, "css-", "style");
1546
+ this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
1420
1547
 
1421
- (function() {
1548
+ if (this.constructor === HtmlHighlightRules)
1549
+ this.normalizeRules();
1550
+ };
1422
1551
 
1423
- this.checkOutdent = function(line, input) {
1424
- if (! /^\s+$/.test(line))
1425
- return false;
1552
+ oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1426
1553
 
1427
- return /^\s*\}/.test(input);
1428
- };
1554
+ exports.HtmlHighlightRules = HtmlHighlightRules;
1555
+ });
1429
1556
 
1430
- this.autoOutdent = function(doc, row) {
1431
- var line = doc.getLine(row);
1432
- var match = line.match(/^(\s*\})/);
1557
+ define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"], function(require, exports, module) {
1558
+ "use strict";
1433
1559
 
1434
- if (!match) return 0;
1560
+ var oop = require("../../lib/oop");
1561
+ var Behaviour = require("../behaviour").Behaviour;
1562
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1435
1563
 
1436
- var column = match[1].length;
1437
- var openBracePos = doc.findMatchingBracket({row: row, column: column});
1564
+ function is(token, type) {
1565
+ return token.type.lastIndexOf(type + ".xml") > -1;
1566
+ }
1438
1567
 
1439
- if (!openBracePos || openBracePos.row == row) return 0;
1568
+ var XmlBehaviour = function () {
1440
1569
 
1441
- var indent = this.$getIndent(doc.getLine(openBracePos.row));
1442
- doc.replace(new Range(row, 0, row, column-1), indent);
1443
- };
1570
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1571
+ if (text == '"' || text == "'") {
1572
+ var quote = text;
1573
+ var selected = session.doc.getTextRange(editor.getSelectionRange());
1574
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1575
+ return {
1576
+ text: quote + selected + quote,
1577
+ selection: false
1578
+ };
1579
+ }
1444
1580
 
1445
- this.$getIndent = function(line) {
1446
- return line.match(/^\s*/)[0];
1447
- };
1581
+ var cursor = editor.getCursorPosition();
1582
+ var line = session.doc.getLine(cursor.row);
1583
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1584
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1585
+ var token = iterator.getCurrentToken();
1448
1586
 
1449
- }).call(MatchingBraceOutdent.prototype);
1587
+ if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1588
+ return {
1589
+ text: "",
1590
+ selection: [1, 1]
1591
+ };
1592
+ }
1450
1593
 
1451
- exports.MatchingBraceOutdent = MatchingBraceOutdent;
1452
- });
1594
+ if (!token)
1595
+ token = iterator.stepBackward();
1453
1596
 
1454
- define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1597
+ if (!token)
1598
+ return;
1455
1599
 
1600
+ while (is(token, "tag-whitespace") || is(token, "whitespace")) {
1601
+ token = iterator.stepBackward();
1602
+ }
1603
+ var rightSpace = !rightChar || rightChar.match(/\s/);
1604
+ if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
1605
+ return {
1606
+ text: quote + quote,
1607
+ selection: [1, 1]
1608
+ };
1609
+ }
1610
+ }
1611
+ });
1456
1612
 
1457
- var oop = require("../../lib/oop");
1458
- var Range = require("../../range").Range;
1459
- var BaseFoldMode = require("./fold_mode").FoldMode;
1613
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
1614
+ var selected = session.doc.getTextRange(range);
1615
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1616
+ var line = session.doc.getLine(range.start.row);
1617
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1618
+ if (rightChar == selected) {
1619
+ range.end.column++;
1620
+ return range;
1621
+ }
1622
+ }
1623
+ });
1460
1624
 
1461
- var FoldMode = exports.FoldMode = function(commentRegex) {
1462
- if (commentRegex) {
1463
- this.foldingStartMarker = new RegExp(
1464
- this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1465
- );
1466
- this.foldingStopMarker = new RegExp(
1467
- this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1468
- );
1469
- }
1470
- };
1471
- oop.inherits(FoldMode, BaseFoldMode);
1625
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1626
+ if (text == '>') {
1627
+ var position = editor.getCursorPosition();
1628
+ var iterator = new TokenIterator(session, position.row, position.column);
1629
+ var token = iterator.getCurrentToken() || iterator.stepBackward();
1630
+ if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
1631
+ return;
1632
+ if (is(token, "reference.attribute-value"))
1633
+ return;
1634
+ if (is(token, "attribute-value")) {
1635
+ var firstChar = token.value.charAt(0);
1636
+ if (firstChar == '"' || firstChar == "'") {
1637
+ var lastChar = token.value.charAt(token.value.length - 1);
1638
+ var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
1639
+ if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
1640
+ return;
1641
+ }
1642
+ }
1643
+ while (!is(token, "tag-name")) {
1644
+ token = iterator.stepBackward();
1645
+ }
1472
1646
 
1473
- (function() {
1647
+ var tokenRow = iterator.getCurrentTokenRow();
1648
+ var tokenColumn = iterator.getCurrentTokenColumn();
1649
+ if (is(iterator.stepBackward(), "end-tag-open"))
1650
+ return;
1474
1651
 
1475
- this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1476
- this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1652
+ var element = token.value;
1653
+ if (tokenRow == position.row)
1654
+ element = element.substring(0, position.column - tokenColumn);
1477
1655
 
1478
- this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
1479
- var line = session.getLine(row);
1480
- var match = line.match(this.foldingStartMarker);
1481
- if (match) {
1482
- var i = match.index;
1656
+ if (this.voidElements.hasOwnProperty(element.toLowerCase()))
1657
+ return;
1483
1658
 
1484
- if (match[1])
1485
- return this.openingBracketBlock(session, match[1], row, i);
1486
-
1487
- var range = session.getCommentFoldRange(row, i + match[0].length, 1);
1488
-
1489
- if (range && !range.isMultiLine()) {
1490
- if (forceMultiline) {
1491
- range = this.getSectionRange(session, row);
1492
- } else if (foldStyle != "all")
1493
- range = null;
1494
- }
1495
-
1496
- return range;
1659
+ return {
1660
+ text: '>' + '</' + element + '>',
1661
+ selection: [1, 1]
1662
+ };
1497
1663
  }
1664
+ });
1498
1665
 
1499
- if (foldStyle === "markbegin")
1500
- return;
1501
-
1502
- var match = line.match(this.foldingStopMarker);
1503
- if (match) {
1504
- var i = match.index + match[0].length;
1505
-
1506
- if (match[1])
1507
- return this.closingBracketBlock(session, match[1], row, i);
1666
+ this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
1667
+ if (text == "\n") {
1668
+ var cursor = editor.getCursorPosition();
1669
+ var line = session.getLine(cursor.row);
1670
+ var rightChars = line.substring(cursor.column, cursor.column + 2);
1671
+ if (rightChars == '</') {
1672
+ var next_indent = this.$getIndent(line);
1673
+ var indent = next_indent + session.getTabString();
1508
1674
 
1509
- return session.getCommentFoldRange(row, i, -1);
1510
- }
1511
- };
1512
-
1513
- this.getSectionRange = function(session, row) {
1514
- var line = session.getLine(row);
1515
- var startIndent = line.search(/\S/);
1516
- var startRow = row;
1517
- var startColumn = line.length;
1518
- row = row + 1;
1519
- var endRow = row;
1520
- var maxRow = session.getLength();
1521
- while (++row < maxRow) {
1522
- line = session.getLine(row);
1523
- var indent = line.search(/\S/);
1524
- if (indent === -1)
1525
- continue;
1526
- if (startIndent > indent)
1527
- break;
1528
- var subRange = this.getFoldWidgetRange(session, "all", row);
1529
-
1530
- if (subRange) {
1531
- if (subRange.start.row <= startRow) {
1532
- break;
1533
- } else if (subRange.isMultiLine()) {
1534
- row = subRange.end.row;
1535
- } else if (startIndent == indent) {
1536
- break;
1537
- }
1675
+ return {
1676
+ text: '\n' + indent + '\n' + next_indent,
1677
+ selection: [1, indent.length, 1, indent.length]
1678
+ };
1538
1679
  }
1539
- endRow = row;
1540
1680
  }
1541
-
1542
- return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1543
- };
1681
+ });
1682
+
1683
+ };
1544
1684
 
1545
- }).call(FoldMode.prototype);
1685
+ oop.inherits(XmlBehaviour, Behaviour);
1546
1686
 
1687
+ exports.XmlBehaviour = XmlBehaviour;
1547
1688
  });
1548
1689
 
1549
- define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1550
-
1690
+ define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
1691
+ "use strict";
1551
1692
 
1552
- var oop = require("../lib/oop");
1553
- var TextMode = require("./text").Mode;
1554
- var Tokenizer = require("../tokenizer").Tokenizer;
1555
- var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1556
- var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1557
- var WorkerClient = require("../worker/worker_client").WorkerClient;
1558
- var CssBehaviour = require("./behaviour/css").CssBehaviour;
1559
- var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1693
+ var oop = require("../../lib/oop");
1694
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1560
1695
 
1561
- var Mode = function() {
1562
- this.HighlightRules = CssHighlightRules;
1563
- this.$outdent = new MatchingBraceOutdent();
1564
- this.$behaviour = new CssBehaviour();
1565
- this.foldingRules = new CStyleFoldMode();
1696
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1697
+ this.defaultMode = defaultMode;
1698
+ this.subModes = subModes;
1566
1699
  };
1567
- oop.inherits(Mode, TextMode);
1700
+ oop.inherits(FoldMode, BaseFoldMode);
1568
1701
 
1569
1702
  (function() {
1570
1703
 
1571
- this.foldingRules = "cStyle";
1572
- this.blockComment = {start: "/*", end: "*/"};
1573
-
1574
- this.getNextLineIndent = function(state, line, tab) {
1575
- var indent = this.$getIndent(line);
1576
- var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1577
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
1578
- return indent;
1579
- }
1580
1704
 
1581
- var match = line.match(/^.*\{\s*$/);
1582
- if (match) {
1583
- indent += tab;
1705
+ this.$getMode = function(state) {
1706
+ if (typeof state != "string")
1707
+ state = state[0];
1708
+ for (var key in this.subModes) {
1709
+ if (state.indexOf(key) === 0)
1710
+ return this.subModes[key];
1584
1711
  }
1585
-
1586
- return indent;
1712
+ return null;
1713
+ };
1714
+
1715
+ this.$tryMode = function(state, session, foldStyle, row) {
1716
+ var mode = this.$getMode(state);
1717
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1587
1718
  };
1588
1719
 
1589
- this.checkOutdent = function(state, line, input) {
1590
- return this.$outdent.checkOutdent(line, input);
1720
+ this.getFoldWidget = function(session, foldStyle, row) {
1721
+ return (
1722
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1723
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
1724
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
1725
+ );
1591
1726
  };
1592
1727
 
1593
- this.autoOutdent = function(state, doc, row) {
1594
- this.$outdent.autoOutdent(doc, row);
1728
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1729
+ var mode = this.$getMode(session.getState(row-1));
1730
+
1731
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1732
+ mode = this.$getMode(session.getState(row));
1733
+
1734
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1735
+ mode = this.defaultMode;
1736
+
1737
+ return mode.getFoldWidgetRange(session, foldStyle, row);
1595
1738
  };
1596
1739
 
1597
- this.createWorker = function(session) {
1598
- var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1599
- worker.attachToDocument(session.getDocument());
1740
+ }).call(FoldMode.prototype);
1600
1741
 
1601
- worker.on("csslint", function(e) {
1602
- session.setAnnotations(e.data);
1603
- });
1742
+ });
1604
1743
 
1605
- worker.on("terminate", function() {
1606
- session.clearAnnotations();
1607
- });
1744
+ define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module) {
1745
+ "use strict";
1608
1746
 
1609
- return worker;
1610
- };
1747
+ var oop = require("../../lib/oop");
1748
+ var lang = require("../../lib/lang");
1749
+ var Range = require("../../range").Range;
1750
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1751
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1611
1752
 
1612
- this.$id = "ace/mode/css";
1613
- }).call(Mode.prototype);
1753
+ var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
1754
+ BaseFoldMode.call(this);
1755
+ this.voidElements = voidElements || {};
1756
+ this.optionalEndTags = oop.mixin({}, this.voidElements);
1757
+ if (optionalEndTags)
1758
+ oop.mixin(this.optionalEndTags, optionalEndTags);
1759
+
1760
+ };
1761
+ oop.inherits(FoldMode, BaseFoldMode);
1614
1762
 
1615
- exports.Mode = Mode;
1763
+ var Tag = function() {
1764
+ this.tagName = "";
1765
+ this.closing = false;
1766
+ this.selfClosing = false;
1767
+ this.start = {row: 0, column: 0};
1768
+ this.end = {row: 0, column: 0};
1769
+ };
1616
1770
 
1617
- });
1771
+ function is(token, type) {
1772
+ return token.type.lastIndexOf(type + ".xml") > -1;
1773
+ }
1618
1774
 
1619
- define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1775
+ (function() {
1620
1776
 
1777
+ this.getFoldWidget = function(session, foldStyle, row) {
1778
+ var tag = this._getFirstTagInLine(session, row);
1621
1779
 
1622
- var oop = require("../lib/oop");
1623
- var lang = require("../lib/lang");
1624
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1625
- var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|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|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|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-after|cue-before|cue|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|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|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|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
1626
- var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1627
- var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
1628
- var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1629
- var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1780
+ if (!tag)
1781
+ return "";
1630
1782
 
1631
- var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1632
- var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1633
- var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
1783
+ if (tag.closing || (!tag.tagName && tag.selfClosing))
1784
+ return foldStyle == "markbeginend" ? "end" : "";
1634
1785
 
1635
- var CssHighlightRules = function() {
1786
+ if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
1787
+ return "";
1636
1788
 
1637
- var keywordMapper = this.createKeywordMapper({
1638
- "support.function": supportFunction,
1639
- "support.constant": supportConstant,
1640
- "support.type": supportType,
1641
- "support.constant.color": supportConstantColor,
1642
- "support.constant.fonts": supportConstantFonts
1643
- }, "text", true);
1789
+ if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
1790
+ return "";
1644
1791
 
1645
- this.$rules = {
1646
- "start" : [{
1647
- token : "comment", // multi line comment
1648
- regex : "\\/\\*",
1649
- push : "comment"
1650
- }, {
1651
- token: "paren.lparen",
1652
- regex: "\\{",
1653
- push: "ruleset"
1654
- }, {
1655
- token: "string",
1656
- regex: "@.*?{",
1657
- push: "media"
1658
- }, {
1659
- token: "keyword",
1660
- regex: "#[a-z0-9-_]+"
1661
- }, {
1662
- token: "variable",
1663
- regex: "\\.[a-z0-9-_]+"
1664
- }, {
1665
- token: "string",
1666
- regex: ":[a-z0-9-_]+"
1667
- }, {
1668
- token: "constant",
1669
- regex: "[a-z0-9-_]+"
1670
- }, {
1671
- caseInsensitive: true
1672
- }],
1792
+ return "start";
1793
+ };
1794
+ this._getFirstTagInLine = function(session, row) {
1795
+ var tokens = session.getTokens(row);
1796
+ var tag = new Tag();
1673
1797
 
1674
- "media" : [{
1675
- token : "comment", // multi line comment
1676
- regex : "\\/\\*",
1677
- push : "comment"
1678
- }, {
1679
- token: "paren.lparen",
1680
- regex: "\\{",
1681
- push: "ruleset"
1682
- }, {
1683
- token: "string",
1684
- regex: "\\}",
1685
- next: "pop"
1686
- }, {
1687
- token: "keyword",
1688
- regex: "#[a-z0-9-_]+"
1689
- }, {
1690
- token: "variable",
1691
- regex: "\\.[a-z0-9-_]+"
1692
- }, {
1693
- token: "string",
1694
- regex: ":[a-z0-9-_]+"
1695
- }, {
1696
- token: "constant",
1697
- regex: "[a-z0-9-_]+"
1698
- }, {
1699
- caseInsensitive: true
1700
- }],
1798
+ for (var i = 0; i < tokens.length; i++) {
1799
+ var token = tokens[i];
1800
+ if (is(token, "tag-open")) {
1801
+ tag.end.column = tag.start.column + token.value.length;
1802
+ tag.closing = is(token, "end-tag-open");
1803
+ token = tokens[++i];
1804
+ if (!token)
1805
+ return null;
1806
+ tag.tagName = token.value;
1807
+ tag.end.column += token.value.length;
1808
+ for (i++; i < tokens.length; i++) {
1809
+ token = tokens[i];
1810
+ tag.end.column += token.value.length;
1811
+ if (is(token, "tag-close")) {
1812
+ tag.selfClosing = token.value == '/>';
1813
+ break;
1814
+ }
1815
+ }
1816
+ return tag;
1817
+ } else if (is(token, "tag-close")) {
1818
+ tag.selfClosing = token.value == '/>';
1819
+ return tag;
1820
+ }
1821
+ tag.start.column += token.value.length;
1822
+ }
1701
1823
 
1702
- "comment" : [{
1703
- token : "comment",
1704
- regex : "\\*\\/",
1705
- next : "pop"
1706
- }, {
1707
- defaultToken : "comment"
1708
- }],
1824
+ return null;
1825
+ };
1709
1826
 
1710
- "ruleset" : [
1711
- {
1712
- token : "paren.rparen",
1713
- regex : "\\}",
1714
- next: "pop"
1715
- }, {
1716
- token : "comment", // multi line comment
1717
- regex : "\\/\\*",
1718
- push : "comment"
1719
- }, {
1720
- token : "string", // single line
1721
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1722
- }, {
1723
- token : "string", // single line
1724
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1725
- }, {
1726
- token : ["constant.numeric", "keyword"],
1727
- regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
1728
- }, {
1729
- token : "constant.numeric",
1730
- regex : numRe
1731
- }, {
1732
- token : "constant.numeric", // hex6 color
1733
- regex : "#[a-f0-9]{6}"
1734
- }, {
1735
- token : "constant.numeric", // hex3 color
1736
- regex : "#[a-f0-9]{3}"
1737
- }, {
1738
- token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1739
- regex : pseudoElements
1740
- }, {
1741
- token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1742
- regex : pseudoClasses
1743
- }, {
1744
- token : ["support.function", "string", "support.function"],
1745
- regex : "(url\\()(.*)(\\))"
1746
- }, {
1747
- token : keywordMapper,
1748
- regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1749
- }, {
1750
- caseInsensitive: true
1751
- }]
1827
+ this._findEndTagInLine = function(session, row, tagName, startColumn) {
1828
+ var tokens = session.getTokens(row);
1829
+ var column = 0;
1830
+ for (var i = 0; i < tokens.length; i++) {
1831
+ var token = tokens[i];
1832
+ column += token.value.length;
1833
+ if (column < startColumn)
1834
+ continue;
1835
+ if (is(token, "end-tag-open")) {
1836
+ token = tokens[i + 1];
1837
+ if (token && token.value == tagName)
1838
+ return true;
1839
+ }
1840
+ }
1841
+ return false;
1842
+ };
1843
+ this._readTagForward = function(iterator) {
1844
+ var token = iterator.getCurrentToken();
1845
+ if (!token)
1846
+ return null;
1847
+
1848
+ var tag = new Tag();
1849
+ do {
1850
+ if (is(token, "tag-open")) {
1851
+ tag.closing = is(token, "end-tag-open");
1852
+ tag.start.row = iterator.getCurrentTokenRow();
1853
+ tag.start.column = iterator.getCurrentTokenColumn();
1854
+ } else if (is(token, "tag-name")) {
1855
+ tag.tagName = token.value;
1856
+ } else if (is(token, "tag-close")) {
1857
+ tag.selfClosing = token.value == "/>";
1858
+ tag.end.row = iterator.getCurrentTokenRow();
1859
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1860
+ iterator.stepForward();
1861
+ return tag;
1862
+ }
1863
+ } while(token = iterator.stepForward());
1864
+
1865
+ return null;
1866
+ };
1867
+
1868
+ this._readTagBackward = function(iterator) {
1869
+ var token = iterator.getCurrentToken();
1870
+ if (!token)
1871
+ return null;
1872
+
1873
+ var tag = new Tag();
1874
+ do {
1875
+ if (is(token, "tag-open")) {
1876
+ tag.closing = is(token, "end-tag-open");
1877
+ tag.start.row = iterator.getCurrentTokenRow();
1878
+ tag.start.column = iterator.getCurrentTokenColumn();
1879
+ iterator.stepBackward();
1880
+ return tag;
1881
+ } else if (is(token, "tag-name")) {
1882
+ tag.tagName = token.value;
1883
+ } else if (is(token, "tag-close")) {
1884
+ tag.selfClosing = token.value == "/>";
1885
+ tag.end.row = iterator.getCurrentTokenRow();
1886
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1887
+ }
1888
+ } while(token = iterator.stepBackward());
1889
+
1890
+ return null;
1891
+ };
1892
+
1893
+ this._pop = function(stack, tag) {
1894
+ while (stack.length) {
1895
+
1896
+ var top = stack[stack.length-1];
1897
+ if (!tag || top.tagName == tag.tagName) {
1898
+ return stack.pop();
1899
+ }
1900
+ else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
1901
+ return;
1902
+ }
1903
+ else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
1904
+ stack.pop();
1905
+ continue;
1906
+ } else {
1907
+ return null;
1908
+ }
1909
+ }
1910
+ };
1911
+
1912
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1913
+ var firstTag = this._getFirstTagInLine(session, row);
1914
+
1915
+ if (!firstTag)
1916
+ return null;
1917
+
1918
+ var isBackward = firstTag.closing || firstTag.selfClosing;
1919
+ var stack = [];
1920
+ var tag;
1921
+
1922
+ if (!isBackward) {
1923
+ var iterator = new TokenIterator(session, row, firstTag.start.column);
1924
+ var start = {
1925
+ row: row,
1926
+ column: firstTag.start.column + firstTag.tagName.length + 2
1927
+ };
1928
+ while (tag = this._readTagForward(iterator)) {
1929
+ if (tag.selfClosing) {
1930
+ if (!stack.length) {
1931
+ tag.start.column += tag.tagName.length + 2;
1932
+ tag.end.column -= 2;
1933
+ return Range.fromPoints(tag.start, tag.end);
1934
+ } else
1935
+ continue;
1936
+ }
1937
+
1938
+ if (tag.closing) {
1939
+ this._pop(stack, tag);
1940
+ if (stack.length == 0)
1941
+ return Range.fromPoints(start, tag.start);
1942
+ }
1943
+ else {
1944
+ stack.push(tag);
1945
+ }
1946
+ }
1947
+ }
1948
+ else {
1949
+ var iterator = new TokenIterator(session, row, firstTag.end.column);
1950
+ var end = {
1951
+ row: row,
1952
+ column: firstTag.start.column
1953
+ };
1954
+
1955
+ while (tag = this._readTagBackward(iterator)) {
1956
+ if (tag.selfClosing) {
1957
+ if (!stack.length) {
1958
+ tag.start.column += tag.tagName.length + 2;
1959
+ tag.end.column -= 2;
1960
+ return Range.fromPoints(tag.start, tag.end);
1961
+ } else
1962
+ continue;
1963
+ }
1964
+
1965
+ if (!tag.closing) {
1966
+ this._pop(stack, tag);
1967
+ if (stack.length == 0) {
1968
+ tag.start.column += tag.tagName.length + 2;
1969
+ return Range.fromPoints(tag.start, end);
1970
+ }
1971
+ }
1972
+ else {
1973
+ stack.push(tag);
1974
+ }
1975
+ }
1976
+ }
1977
+
1752
1978
  };
1753
1979
 
1754
- this.normalizeRules();
1755
- };
1980
+ }).call(FoldMode.prototype);
1756
1981
 
1757
- oop.inherits(CssHighlightRules, TextHighlightRules);
1982
+ });
1758
1983
 
1759
- exports.CssHighlightRules = CssHighlightRules;
1984
+ define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) {
1985
+ "use strict";
1986
+
1987
+ var oop = require("../../lib/oop");
1988
+ var MixedFoldMode = require("./mixed").FoldMode;
1989
+ var XmlFoldMode = require("./xml").FoldMode;
1990
+ var CStyleFoldMode = require("./cstyle").FoldMode;
1991
+
1992
+ var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
1993
+ MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
1994
+ "js-": new CStyleFoldMode(),
1995
+ "css-": new CStyleFoldMode()
1996
+ });
1997
+ };
1998
+
1999
+ oop.inherits(FoldMode, MixedFoldMode);
1760
2000
 
1761
2001
  });
1762
2002
 
1763
- define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
2003
+ define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2004
+ "use strict";
2005
+
2006
+ var TokenIterator = require("../token_iterator").TokenIterator;
2007
+
2008
+ var commonAttributes = [
2009
+ "accesskey",
2010
+ "class",
2011
+ "contenteditable",
2012
+ "contextmenu",
2013
+ "dir",
2014
+ "draggable",
2015
+ "dropzone",
2016
+ "hidden",
2017
+ "id",
2018
+ "inert",
2019
+ "itemid",
2020
+ "itemprop",
2021
+ "itemref",
2022
+ "itemscope",
2023
+ "itemtype",
2024
+ "lang",
2025
+ "spellcheck",
2026
+ "style",
2027
+ "tabindex",
2028
+ "title",
2029
+ "translate"
2030
+ ];
2031
+
2032
+ var eventAttributes = [
2033
+ "onabort",
2034
+ "onblur",
2035
+ "oncancel",
2036
+ "oncanplay",
2037
+ "oncanplaythrough",
2038
+ "onchange",
2039
+ "onclick",
2040
+ "onclose",
2041
+ "oncontextmenu",
2042
+ "oncuechange",
2043
+ "ondblclick",
2044
+ "ondrag",
2045
+ "ondragend",
2046
+ "ondragenter",
2047
+ "ondragleave",
2048
+ "ondragover",
2049
+ "ondragstart",
2050
+ "ondrop",
2051
+ "ondurationchange",
2052
+ "onemptied",
2053
+ "onended",
2054
+ "onerror",
2055
+ "onfocus",
2056
+ "oninput",
2057
+ "oninvalid",
2058
+ "onkeydown",
2059
+ "onkeypress",
2060
+ "onkeyup",
2061
+ "onload",
2062
+ "onloadeddata",
2063
+ "onloadedmetadata",
2064
+ "onloadstart",
2065
+ "onmousedown",
2066
+ "onmousemove",
2067
+ "onmouseout",
2068
+ "onmouseover",
2069
+ "onmouseup",
2070
+ "onmousewheel",
2071
+ "onpause",
2072
+ "onplay",
2073
+ "onplaying",
2074
+ "onprogress",
2075
+ "onratechange",
2076
+ "onreset",
2077
+ "onscroll",
2078
+ "onseeked",
2079
+ "onseeking",
2080
+ "onselect",
2081
+ "onshow",
2082
+ "onstalled",
2083
+ "onsubmit",
2084
+ "onsuspend",
2085
+ "ontimeupdate",
2086
+ "onvolumechange",
2087
+ "onwaiting"
2088
+ ];
2089
+
2090
+ var globalAttributes = commonAttributes.concat(eventAttributes);
2091
+
2092
+ var attributeMap = {
2093
+ "html": ["manifest"],
2094
+ "head": [],
2095
+ "title": [],
2096
+ "base": ["href", "target"],
2097
+ "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
2098
+ "meta": ["http-equiv", "name", "content", "charset"],
2099
+ "style": ["type", "media", "scoped"],
2100
+ "script": ["charset", "type", "src", "defer", "async"],
2101
+ "noscript": ["href"],
2102
+ "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
2103
+ "section": [],
2104
+ "nav": [],
2105
+ "article": ["pubdate"],
2106
+ "aside": [],
2107
+ "h1": [],
2108
+ "h2": [],
2109
+ "h3": [],
2110
+ "h4": [],
2111
+ "h5": [],
2112
+ "h6": [],
2113
+ "header": [],
2114
+ "footer": [],
2115
+ "address": [],
2116
+ "main": [],
2117
+ "p": [],
2118
+ "hr": [],
2119
+ "pre": [],
2120
+ "blockquote": ["cite"],
2121
+ "ol": ["start", "reversed"],
2122
+ "ul": [],
2123
+ "li": ["value"],
2124
+ "dl": [],
2125
+ "dt": [],
2126
+ "dd": [],
2127
+ "figure": [],
2128
+ "figcaption": [],
2129
+ "div": [],
2130
+ "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
2131
+ "em": [],
2132
+ "strong": [],
2133
+ "small": [],
2134
+ "s": [],
2135
+ "cite": [],
2136
+ "q": ["cite"],
2137
+ "dfn": [],
2138
+ "abbr": [],
2139
+ "data": [],
2140
+ "time": ["datetime"],
2141
+ "code": [],
2142
+ "var": [],
2143
+ "samp": [],
2144
+ "kbd": [],
2145
+ "sub": [],
2146
+ "sup": [],
2147
+ "i": [],
2148
+ "b": [],
2149
+ "u": [],
2150
+ "mark": [],
2151
+ "ruby": [],
2152
+ "rt": [],
2153
+ "rp": [],
2154
+ "bdi": [],
2155
+ "bdo": [],
2156
+ "span": [],
2157
+ "br": [],
2158
+ "wbr": [],
2159
+ "ins": ["cite", "datetime"],
2160
+ "del": ["cite", "datetime"],
2161
+ "img": ["alt", "src", "height", "width", "usemap", "ismap"],
2162
+ "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
2163
+ "embed": ["src", "height", "width", "type"],
2164
+ "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
2165
+ "param": ["name", "value"],
2166
+ "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
2167
+ "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
2168
+ "source": ["src", "type", "media"],
2169
+ "track": ["kind", "src", "srclang", "label", "default"],
2170
+ "canvas": ["width", "height"],
2171
+ "map": ["name"],
2172
+ "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
2173
+ "svg": [],
2174
+ "math": [],
2175
+ "table": ["summary"],
2176
+ "caption": [],
2177
+ "colgroup": ["span"],
2178
+ "col": ["span"],
2179
+ "tbody": [],
2180
+ "thead": [],
2181
+ "tfoot": [],
2182
+ "tr": [],
2183
+ "td": ["headers", "rowspan", "colspan"],
2184
+ "th": ["headers", "rowspan", "colspan", "scope"],
2185
+ "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
2186
+ "fieldset": ["disabled", "form", "name"],
2187
+ "legend": [],
2188
+ "label": ["form", "for"],
2189
+ "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
2190
+ "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
2191
+ "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
2192
+ "datalist": [],
2193
+ "optgroup": ["disabled", "label"],
2194
+ "option": ["disabled", "selected", "label", "value"],
2195
+ "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
2196
+ "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
2197
+ "output": ["for", "form", "name"],
2198
+ "progress": ["value", "max"],
2199
+ "meter": ["value", "min", "max", "low", "high", "optimum"],
2200
+ "details": ["open"],
2201
+ "summary": [],
2202
+ "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
2203
+ "menu": ["type", "label"],
2204
+ "dialog": ["open"]
2205
+ };
1764
2206
 
2207
+ var elements = Object.keys(attributeMap);
1765
2208
 
1766
- var oop = require("../../lib/oop");
1767
- var Behaviour = require("../behaviour").Behaviour;
1768
- var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1769
- var TokenIterator = require("../../token_iterator").TokenIterator;
2209
+ function is(token, type) {
2210
+ return token.type.lastIndexOf(type + ".xml") > -1;
2211
+ }
1770
2212
 
1771
- var CssBehaviour = function () {
2213
+ function findTagName(session, pos) {
2214
+ var iterator = new TokenIterator(session, pos.row, pos.column);
2215
+ var token = iterator.getCurrentToken();
2216
+ while (token && !is(token, "tag-name")){
2217
+ token = iterator.stepBackward();
2218
+ }
2219
+ if (token)
2220
+ return token.value;
2221
+ }
1772
2222
 
1773
- this.inherit(CstyleBehaviour);
2223
+ var HtmlCompletions = function() {
1774
2224
 
1775
- this.add("colon", "insertion", function (state, action, editor, session, text) {
1776
- if (text === ':') {
1777
- var cursor = editor.getCursorPosition();
1778
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
1779
- var token = iterator.getCurrentToken();
1780
- if (token && token.value.match(/\s+/)) {
1781
- token = iterator.stepBackward();
1782
- }
1783
- if (token && token.type === 'support.type') {
1784
- var line = session.doc.getLine(cursor.row);
1785
- var rightChar = line.substring(cursor.column, cursor.column + 1);
1786
- if (rightChar === ':') {
1787
- return {
1788
- text: '',
1789
- selection: [1, 1]
1790
- }
1791
- }
1792
- if (!line.substring(cursor.column).match(/^\s*;/)) {
1793
- return {
1794
- text: ':;',
1795
- selection: [1, 1]
1796
- }
1797
- }
1798
- }
1799
- }
1800
- });
2225
+ };
1801
2226
 
1802
- this.add("colon", "deletion", function (state, action, editor, session, range) {
1803
- var selected = session.doc.getTextRange(range);
1804
- if (!range.isMultiLine() && selected === ':') {
1805
- var cursor = editor.getCursorPosition();
1806
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
1807
- var token = iterator.getCurrentToken();
1808
- if (token && token.value.match(/\s+/)) {
1809
- token = iterator.stepBackward();
1810
- }
1811
- if (token && token.type === 'support.type') {
1812
- var line = session.doc.getLine(range.start.row);
1813
- var rightChar = line.substring(range.end.column, range.end.column + 1);
1814
- if (rightChar === ';') {
1815
- range.end.column ++;
1816
- return range;
1817
- }
1818
- }
1819
- }
1820
- });
2227
+ (function() {
1821
2228
 
1822
- this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1823
- if (text === ';') {
1824
- var cursor = editor.getCursorPosition();
1825
- var line = session.doc.getLine(cursor.row);
1826
- var rightChar = line.substring(cursor.column, cursor.column + 1);
1827
- if (rightChar === ';') {
1828
- return {
1829
- text: '',
1830
- selection: [1, 1]
1831
- }
1832
- }
2229
+ this.getCompletions = function(state, session, pos, prefix) {
2230
+ var token = session.getTokenAt(pos.row, pos.column);
2231
+
2232
+ if (!token)
2233
+ return [];
2234
+ if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2235
+ return this.getTagCompletions(state, session, pos, prefix);
2236
+ if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2237
+ return this.getAttributeCompetions(state, session, pos, prefix);
2238
+
2239
+ return [];
2240
+ };
2241
+
2242
+ this.getTagCompletions = function(state, session, pos, prefix) {
2243
+ return elements.map(function(element){
2244
+ return {
2245
+ value: element,
2246
+ meta: "tag",
2247
+ score: Number.MAX_VALUE
2248
+ };
2249
+ });
2250
+ };
2251
+
2252
+ this.getAttributeCompetions = function(state, session, pos, prefix) {
2253
+ var tagName = findTagName(session, pos);
2254
+ if (!tagName)
2255
+ return [];
2256
+ var attributes = globalAttributes;
2257
+ if (tagName in attributeMap) {
2258
+ attributes = attributes.concat(attributeMap[tagName]);
1833
2259
  }
1834
- });
2260
+ return attributes.map(function(attribute){
2261
+ return {
2262
+ caption: attribute,
2263
+ snippet: attribute + '="$0"',
2264
+ meta: "attribute",
2265
+ score: Number.MAX_VALUE
2266
+ };
2267
+ });
2268
+ };
1835
2269
 
1836
- }
1837
- oop.inherits(CssBehaviour, CstyleBehaviour);
2270
+ }).call(HtmlCompletions.prototype);
1838
2271
 
1839
- exports.CssBehaviour = CssBehaviour;
2272
+ exports.HtmlCompletions = HtmlCompletions;
1840
2273
  });
1841
2274
 
1842
- define('ace/mode/coldfusion_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules', 'ace/mode/html_highlight_rules'], function(require, exports, module) {
2275
+ define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) {
2276
+ "use strict";
2277
+
2278
+ var oop = require("../lib/oop");
2279
+ var lang = require("../lib/lang");
2280
+ var TextMode = require("./text").Mode;
2281
+ var JavaScriptMode = require("./javascript").Mode;
2282
+ var CssMode = require("./css").Mode;
2283
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2284
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2285
+ var HtmlFoldMode = require("./folding/html").FoldMode;
2286
+ var HtmlCompletions = require("./html_completions").HtmlCompletions;
2287
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
2288
+ var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2289
+ var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2290
+
2291
+ var Mode = function(options) {
2292
+ this.fragmentContext = options && options.fragmentContext;
2293
+ this.HighlightRules = HtmlHighlightRules;
2294
+ this.$behaviour = new XmlBehaviour();
2295
+ this.$completer = new HtmlCompletions();
2296
+
2297
+ this.createModeDelegates({
2298
+ "js-": JavaScriptMode,
2299
+ "css-": CssMode
2300
+ });
2301
+
2302
+ this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2303
+ };
2304
+ oop.inherits(Mode, TextMode);
2305
+
2306
+ (function() {
2307
+
2308
+ this.blockComment = {start: "<!--", end: "-->"};
2309
+
2310
+ this.voidElements = lang.arrayToMap(voidElements);
2311
+
2312
+ this.getNextLineIndent = function(state, line, tab) {
2313
+ return this.$getIndent(line);
2314
+ };
2315
+
2316
+ this.checkOutdent = function(state, line, input) {
2317
+ return false;
2318
+ };
2319
+
2320
+ this.getCompletions = function(state, session, pos, prefix) {
2321
+ return this.$completer.getCompletions(state, session, pos, prefix);
2322
+ };
2323
+
2324
+ this.createWorker = function(session) {
2325
+ if (this.constructor != Mode)
2326
+ return;
2327
+ var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2328
+ worker.attachToDocument(session.getDocument());
2329
+
2330
+ if (this.fragmentContext)
2331
+ worker.call("setOptions", [{context: this.fragmentContext}]);
2332
+
2333
+ worker.on("error", function(e) {
2334
+ session.setAnnotations(e.data);
2335
+ });
2336
+
2337
+ worker.on("terminate", function() {
2338
+ session.clearAnnotations();
2339
+ });
2340
+
2341
+ return worker;
2342
+ };
2343
+
2344
+ this.$id = "ace/mode/html";
2345
+ }).call(Mode.prototype);
2346
+
2347
+ exports.Mode = Mode;
2348
+ });
1843
2349
 
2350
+ define("ace/mode/coldfusion_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/javascript_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
2351
+ "use strict";
1844
2352
 
1845
2353
  var oop = require("../lib/oop");
1846
2354
  var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
@@ -1859,96 +2367,32 @@ oop.inherits(ColdfusionHighlightRules, HtmlHighlightRules);
1859
2367
  exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
1860
2368
  });
1861
2369
 
1862
- define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) {
1863
-
2370
+ define("ace/mode/coldfusion",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/html","ace/mode/coldfusion_highlight_rules"], function(require, exports, module) {
2371
+ "use strict";
1864
2372
 
1865
2373
  var oop = require("../lib/oop");
1866
2374
  var lang = require("../lib/lang");
1867
- var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1868
- var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1869
- var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1870
-
1871
- var tagMap = lang.createMap({
1872
- a : 'anchor',
1873
- button : 'form',
1874
- form : 'form',
1875
- img : 'image',
1876
- input : 'form',
1877
- label : 'form',
1878
- option : 'form',
1879
- script : 'script',
1880
- select : 'form',
1881
- textarea : 'form',
1882
- style : 'style',
1883
- table : 'table',
1884
- tbody : 'table',
1885
- td : 'table',
1886
- tfoot : 'table',
1887
- th : 'table',
1888
- tr : 'table'
1889
- });
2375
+ var HtmlMode = require("./html").Mode;
2376
+ var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
1890
2377
 
1891
- var HtmlHighlightRules = function() {
1892
- XmlHighlightRules.call(this);
2378
+ var voidElements = "cfabort|cfapplication|cfargument|cfassociate|cfbreak|cfcache|cfcollection|cfcookie|cfdbinfo|cfdirectory|cfdump|cfelse|cfelseif|cferror|cfexchangecalendar|cfexchangeconnection|cfexchangecontact|cfexchangefilter|cfexchangetask|cfexit|cffeed|cffile|cfflush|cfftp|cfheader|cfhtmlhead|cfhttpparam|cfimage|cfimport|cfinclude|cfindex|cfinsert|cfinvokeargument|cflocation|cflog|cfmailparam|cfNTauthenticate|cfobject|cfobjectcache|cfparam|cfpdfformparam|cfprint|cfprocparam|cfprocresult|cfproperty|cfqueryparam|cfregistry|cfreportparam|cfrethrow|cfreturn|cfschedule|cfsearch|cfset|cfsetting|cfthrow|cfzipparam)".split("|");
1893
2379
 
1894
- this.addRules({
1895
- attributes: [{
1896
- include : "space"
1897
- }, {
1898
- token : "entity.other.attribute-name",
1899
- regex : "[-_a-zA-Z0-9:]+"
1900
- }, {
1901
- token : "keyword.operator.separator",
1902
- regex : "=",
1903
- push : [{
1904
- include: "space"
1905
- }, {
1906
- token : "string",
1907
- regex : "[^<>='\"`\\s]+",
1908
- next : "pop"
1909
- }, {
1910
- token : "empty",
1911
- regex : "",
1912
- next : "pop"
1913
- }]
1914
- }, {
1915
- include : "string"
1916
- }],
1917
- tag: [{
1918
- token : function(start, tag) {
1919
- var group = tagMap[tag];
1920
- return ["meta.tag.punctuation.begin",
1921
- "meta.tag.name" + (group ? "." + group : "")];
1922
- },
1923
- regex : "(<)([-_a-zA-Z0-9:]+)",
1924
- next: "start_tag_stuff"
1925
- }, {
1926
- token : function(start, tag) {
1927
- var group = tagMap[tag];
1928
- return ["meta.tag.punctuation.begin",
1929
- "meta.tag.name" + (group ? "." + group : "")];
1930
- },
1931
- regex : "(</)([-_a-zA-Z0-9:]+)",
1932
- next: "end_tag_stuff"
1933
- }],
1934
- start_tag_stuff: [
1935
- {include : "attributes"},
1936
- {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
1937
- ],
1938
- end_tag_stuff: [
1939
- {include : "space"},
1940
- {token : "meta.tag.punctuation.end", regex : ">", next : "start"}
1941
- ]
1942
- });
2380
+ var Mode = function() {
2381
+ HtmlMode.call(this);
2382
+
2383
+ this.HighlightRules = ColdfusionHighlightRules;
2384
+ };
2385
+ oop.inherits(Mode, HtmlMode);
1943
2386
 
1944
- this.embedTagRules(CssHighlightRules, "css-", "style");
1945
- this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
2387
+ (function() {
2388
+ this.voidElements = oop.mixin(lang.arrayToMap(voidElements), this.voidElements);
1946
2389
 
1947
- if (this.constructor === HtmlHighlightRules)
1948
- this.normalizeRules();
1949
- };
2390
+ this.getNextLineIndent = function(state, line, tab) {
2391
+ return this.$getIndent(line);
2392
+ };
1950
2393
 
1951
- oop.inherits(HtmlHighlightRules, XmlHighlightRules);
2394
+ this.$id = "ace/mode/coldfusion";
2395
+ }).call(Mode.prototype);
1952
2396
 
1953
- exports.HtmlHighlightRules = HtmlHighlightRules;
2397
+ exports.Mode = Mode;
1954
2398
  });