ace-rails-ap 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. data/.gitmodules +3 -0
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/update.sh +3 -0
  4. data/vendor/assets/javascripts/ace-compat-noconflict.js +1 -0
  5. data/vendor/assets/javascripts/ace-compat-uncompressed-noconflict.js +480 -0
  6. data/vendor/assets/javascripts/ace-compat-uncompressed.js +480 -0
  7. data/vendor/assets/javascripts/ace-compat.js +1 -0
  8. data/vendor/assets/javascripts/ace-noconflict.js +10 -0
  9. data/vendor/assets/javascripts/ace-uncompressed-noconflict.js +19976 -0
  10. data/vendor/assets/javascripts/ace-uncompressed.js +6568 -998
  11. data/vendor/assets/javascripts/ace.js +1 -1
  12. data/vendor/assets/javascripts/keybinding-emacs-noconflict.js +1 -0
  13. data/vendor/assets/javascripts/keybinding-emacs-uncompressed-noconflict.js +150 -0
  14. data/vendor/assets/javascripts/keybinding-emacs-uncompressed.js +150 -0
  15. data/vendor/assets/javascripts/keybinding-emacs.js +1 -1
  16. data/vendor/assets/javascripts/keybinding-vim-noconflict.js +1 -0
  17. data/vendor/assets/javascripts/keybinding-vim-uncompressed-noconflict.js +138 -0
  18. data/vendor/assets/javascripts/keybinding-vim-uncompressed.js +138 -0
  19. data/vendor/assets/javascripts/keybinding-vim.js +1 -1
  20. data/vendor/assets/javascripts/mode-c_cpp-noconflict.js +1 -0
  21. data/vendor/assets/javascripts/mode-c_cpp-uncompressed-noconflict.js +919 -0
  22. data/vendor/assets/javascripts/mode-c_cpp-uncompressed.js +919 -0
  23. data/vendor/assets/javascripts/mode-c_cpp.js +1 -1
  24. data/vendor/assets/javascripts/mode-clojure-noconflict.js +1 -0
  25. data/vendor/assets/javascripts/mode-clojure-uncompressed-noconflict.js +422 -0
  26. data/vendor/assets/javascripts/mode-clojure-uncompressed.js +422 -0
  27. data/vendor/assets/javascripts/mode-clojure.js +1 -1
  28. data/vendor/assets/javascripts/mode-coffee-noconflict.js +1 -0
  29. data/vendor/assets/javascripts/mode-coffee-uncompressed-noconflict.js +607 -0
  30. data/vendor/assets/javascripts/mode-coffee-uncompressed.js +607 -0
  31. data/vendor/assets/javascripts/mode-coffee.js +1 -1
  32. data/vendor/assets/javascripts/mode-coldfusion-noconflict.js +1 -0
  33. data/vendor/assets/javascripts/mode-coldfusion-uncompressed-noconflict.js +2458 -0
  34. data/vendor/assets/javascripts/mode-coldfusion-uncompressed.js +2458 -0
  35. data/vendor/assets/javascripts/mode-coldfusion.js +1 -0
  36. data/vendor/assets/javascripts/mode-csharp-noconflict.js +1 -0
  37. data/vendor/assets/javascripts/mode-csharp-uncompressed-noconflict.js +769 -0
  38. data/vendor/assets/javascripts/mode-csharp-uncompressed.js +769 -0
  39. data/vendor/assets/javascripts/mode-csharp.js +1 -1
  40. data/vendor/assets/javascripts/mode-css-noconflict.js +1 -0
  41. data/vendor/assets/javascripts/mode-css-uncompressed-noconflict.js +641 -0
  42. data/vendor/assets/javascripts/mode-css-uncompressed.js +641 -0
  43. data/vendor/assets/javascripts/mode-css.js +1 -1
  44. data/vendor/assets/javascripts/mode-golang-noconflict.js +1 -0
  45. data/vendor/assets/javascripts/mode-golang-uncompressed-noconflict.js +378 -0
  46. data/vendor/assets/javascripts/mode-golang-uncompressed.js +378 -0
  47. data/vendor/assets/javascripts/mode-golang.js +1 -0
  48. data/vendor/assets/javascripts/mode-groovy-noconflict.js +1 -0
  49. data/vendor/assets/javascripts/mode-groovy-uncompressed-noconflict.js +1393 -0
  50. data/vendor/assets/javascripts/mode-groovy-uncompressed.js +1393 -0
  51. data/vendor/assets/javascripts/mode-groovy.js +1 -1
  52. data/vendor/assets/javascripts/mode-haxe-noconflict.js +1 -0
  53. data/vendor/assets/javascripts/mode-haxe-uncompressed-noconflict.js +769 -0
  54. data/vendor/assets/javascripts/mode-haxe-uncompressed.js +769 -0
  55. data/vendor/assets/javascripts/mode-haxe.js +1 -0
  56. data/vendor/assets/javascripts/mode-html-noconflict.js +1 -0
  57. data/vendor/assets/javascripts/mode-html-uncompressed-noconflict.js +2475 -0
  58. data/vendor/assets/javascripts/mode-html-uncompressed.js +2475 -0
  59. data/vendor/assets/javascripts/mode-html.js +1 -1
  60. data/vendor/assets/javascripts/mode-java-noconflict.js +1 -0
  61. data/vendor/assets/javascripts/mode-java-uncompressed-noconflict.js +1395 -0
  62. data/vendor/assets/javascripts/mode-java-uncompressed.js +1395 -0
  63. data/vendor/assets/javascripts/mode-java.js +1 -1
  64. data/vendor/assets/javascripts/mode-javascript-noconflict.js +1 -0
  65. data/vendor/assets/javascripts/mode-javascript-uncompressed-noconflict.js +1226 -0
  66. data/vendor/assets/javascripts/mode-javascript-uncompressed.js +1226 -0
  67. data/vendor/assets/javascripts/mode-javascript.js +1 -1
  68. data/vendor/assets/javascripts/mode-json-noconflict.js +1 -0
  69. data/vendor/assets/javascripts/mode-json-uncompressed-noconflict.js +701 -0
  70. data/vendor/assets/javascripts/mode-json-uncompressed.js +701 -0
  71. data/vendor/assets/javascripts/mode-json.js +1 -1
  72. data/vendor/assets/javascripts/mode-latex-noconflict.js +1 -0
  73. data/vendor/assets/javascripts/mode-latex-uncompressed-noconflict.js +95 -0
  74. data/vendor/assets/javascripts/mode-latex-uncompressed.js +95 -0
  75. data/vendor/assets/javascripts/mode-less-noconflict.js +1 -0
  76. data/vendor/assets/javascripts/mode-less-uncompressed-noconflict.js +655 -0
  77. data/vendor/assets/javascripts/mode-less-uncompressed.js +655 -0
  78. data/vendor/assets/javascripts/mode-less.js +1 -0
  79. data/vendor/assets/javascripts/mode-liquid-noconflict.js +1 -0
  80. data/vendor/assets/javascripts/mode-liquid-uncompressed-noconflict.js +1353 -0
  81. data/vendor/assets/javascripts/mode-liquid-uncompressed.js +1353 -0
  82. data/vendor/assets/javascripts/mode-liquid.js +1 -0
  83. data/vendor/assets/javascripts/mode-lua-noconflict.js +1 -0
  84. data/vendor/assets/javascripts/mode-lua-uncompressed-noconflict.js +523 -0
  85. data/vendor/assets/javascripts/mode-lua-uncompressed.js +523 -0
  86. data/vendor/assets/javascripts/mode-markdown-noconflict.js +1 -0
  87. data/vendor/assets/javascripts/mode-markdown-uncompressed-noconflict.js +2925 -0
  88. data/vendor/assets/javascripts/mode-markdown-uncompressed.js +2925 -0
  89. data/vendor/assets/javascripts/mode-markdown.js +1 -1
  90. data/vendor/assets/javascripts/mode-ocaml-noconflict.js +1 -0
  91. data/vendor/assets/javascripts/mode-ocaml-uncompressed-noconflict.js +539 -0
  92. data/vendor/assets/javascripts/mode-ocaml-uncompressed.js +539 -0
  93. data/vendor/assets/javascripts/mode-ocaml.js +1 -1
  94. data/vendor/assets/javascripts/mode-perl-noconflict.js +1 -0
  95. data/vendor/assets/javascripts/mode-perl-uncompressed-noconflict.js +574 -0
  96. data/vendor/assets/javascripts/mode-perl-uncompressed.js +574 -0
  97. data/vendor/assets/javascripts/mode-perl.js +1 -1
  98. data/vendor/assets/javascripts/mode-pgsql-noconflict.js +1 -0
  99. data/vendor/assets/javascripts/mode-pgsql-uncompressed-noconflict.js +1104 -0
  100. data/vendor/assets/javascripts/mode-pgsql-uncompressed.js +1104 -0
  101. data/vendor/assets/javascripts/mode-pgsql.js +1 -0
  102. data/vendor/assets/javascripts/mode-php-noconflict.js +1 -0
  103. data/vendor/assets/javascripts/mode-php-uncompressed-noconflict.js +1885 -0
  104. data/vendor/assets/javascripts/mode-php-uncompressed.js +1885 -0
  105. data/vendor/assets/javascripts/mode-php.js +1 -1
  106. data/vendor/assets/javascripts/mode-powershell-noconflict.js +1 -0
  107. data/vendor/assets/javascripts/mode-powershell-uncompressed-noconflict.js +710 -0
  108. data/vendor/assets/javascripts/mode-powershell-uncompressed.js +710 -0
  109. data/vendor/assets/javascripts/mode-powershell.js +1 -0
  110. data/vendor/assets/javascripts/mode-python-noconflict.js +1 -0
  111. data/vendor/assets/javascripts/mode-python-uncompressed-noconflict.js +507 -0
  112. data/vendor/assets/javascripts/mode-python-uncompressed.js +507 -0
  113. data/vendor/assets/javascripts/mode-python.js +1 -1
  114. data/vendor/assets/javascripts/mode-ruby-noconflict.js +1 -0
  115. data/vendor/assets/javascripts/mode-ruby-uncompressed-noconflict.js +391 -0
  116. data/vendor/assets/javascripts/mode-ruby-uncompressed.js +391 -0
  117. data/vendor/assets/javascripts/mode-ruby.js +1 -1
  118. data/vendor/assets/javascripts/mode-scad-noconflict.js +1 -0
  119. data/vendor/assets/javascripts/mode-scad-uncompressed-noconflict.js +907 -0
  120. data/vendor/assets/javascripts/mode-scad-uncompressed.js +907 -0
  121. data/vendor/assets/javascripts/mode-scad.js +1 -1
  122. data/vendor/assets/javascripts/mode-scala-noconflict.js +1 -0
  123. data/vendor/assets/javascripts/mode-scala-uncompressed-noconflict.js +1395 -0
  124. data/vendor/assets/javascripts/mode-scala-uncompressed.js +1395 -0
  125. data/vendor/assets/javascripts/mode-scala.js +1 -1
  126. data/vendor/assets/javascripts/mode-scss-noconflict.js +1 -0
  127. data/vendor/assets/javascripts/mode-scss-uncompressed-noconflict.js +679 -0
  128. data/vendor/assets/javascripts/mode-scss-uncompressed.js +679 -0
  129. data/vendor/assets/javascripts/mode-scss.js +1 -1
  130. data/vendor/assets/javascripts/mode-sh-noconflict.js +1 -0
  131. data/vendor/assets/javascripts/mode-sh-uncompressed-noconflict.js +289 -0
  132. data/vendor/assets/javascripts/mode-sh-uncompressed.js +289 -0
  133. data/vendor/assets/javascripts/mode-sh.js +1 -0
  134. data/vendor/assets/javascripts/mode-sql-noconflict.js +1 -0
  135. data/vendor/assets/javascripts/mode-sql-uncompressed-noconflict.js +159 -0
  136. data/vendor/assets/javascripts/mode-sql-uncompressed.js +159 -0
  137. data/vendor/assets/javascripts/mode-sql.js +1 -0
  138. data/vendor/assets/javascripts/mode-svg-noconflict.js +1 -0
  139. data/vendor/assets/javascripts/mode-svg-uncompressed-noconflict.js +2137 -0
  140. data/vendor/assets/javascripts/mode-svg-uncompressed.js +2137 -0
  141. data/vendor/assets/javascripts/mode-svg.js +1 -1
  142. data/vendor/assets/javascripts/mode-text-noconflict.js +0 -0
  143. data/vendor/assets/javascripts/mode-text-uncompressed-noconflict.js +0 -0
  144. data/vendor/assets/javascripts/mode-text-uncompressed.js +0 -0
  145. data/vendor/assets/javascripts/mode-text.js +0 -0
  146. data/vendor/assets/javascripts/mode-textile-noconflict.js +1 -0
  147. data/vendor/assets/javascripts/mode-textile-uncompressed-noconflict.js +254 -0
  148. data/vendor/assets/javascripts/mode-textile-uncompressed.js +254 -0
  149. data/vendor/assets/javascripts/mode-textile.js +1 -1
  150. data/vendor/assets/javascripts/mode-xml-noconflict.js +1 -0
  151. data/vendor/assets/javascripts/mode-xml-uncompressed-noconflict.js +1012 -0
  152. data/vendor/assets/javascripts/mode-xml-uncompressed.js +1012 -0
  153. data/vendor/assets/javascripts/mode-xml.js +1 -1
  154. data/vendor/assets/javascripts/mode-xquery-noconflict.js +1 -0
  155. data/vendor/assets/javascripts/mode-xquery-uncompressed-noconflict.js +540 -0
  156. data/vendor/assets/javascripts/mode-xquery-uncompressed.js +540 -0
  157. data/vendor/assets/javascripts/mode-xquery.js +1 -0
  158. data/vendor/assets/javascripts/theme-chrome-noconflict.js +1 -0
  159. data/vendor/assets/javascripts/theme-chrome-uncompressed-noconflict.js +207 -0
  160. data/vendor/assets/javascripts/theme-chrome-uncompressed.js +207 -0
  161. data/vendor/assets/javascripts/theme-chrome.js +1 -0
  162. data/vendor/assets/javascripts/theme-clouds-noconflict.js +1 -0
  163. data/vendor/assets/javascripts/theme-clouds-uncompressed-noconflict.js +160 -0
  164. data/vendor/assets/javascripts/theme-clouds-uncompressed.js +160 -0
  165. data/vendor/assets/javascripts/theme-clouds.js +1 -1
  166. data/vendor/assets/javascripts/theme-clouds_midnight-noconflict.js +1 -0
  167. data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed-noconflict.js +161 -0
  168. data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed.js +161 -0
  169. data/vendor/assets/javascripts/theme-clouds_midnight.js +1 -1
  170. data/vendor/assets/javascripts/theme-cobalt-noconflict.js +1 -0
  171. data/vendor/assets/javascripts/theme-cobalt-uncompressed-noconflict.js +187 -0
  172. data/vendor/assets/javascripts/theme-cobalt-uncompressed.js +187 -0
  173. data/vendor/assets/javascripts/theme-cobalt.js +1 -1
  174. data/vendor/assets/javascripts/theme-crimson_editor-noconflict.js +1 -0
  175. data/vendor/assets/javascripts/theme-crimson_editor-uncompressed-noconflict.js +198 -0
  176. data/vendor/assets/javascripts/theme-crimson_editor-uncompressed.js +198 -0
  177. data/vendor/assets/javascripts/theme-dawn-noconflict.js +1 -0
  178. data/vendor/assets/javascripts/theme-dawn-uncompressed-noconflict.js +191 -0
  179. data/vendor/assets/javascripts/theme-dawn-uncompressed.js +191 -0
  180. data/vendor/assets/javascripts/theme-dawn.js +1 -1
  181. data/vendor/assets/javascripts/theme-dreamweaver-noconflict.js +1 -0
  182. data/vendor/assets/javascripts/theme-dreamweaver-uncompressed-noconflict.js +227 -0
  183. data/vendor/assets/javascripts/theme-dreamweaver-uncompressed.js +227 -0
  184. data/vendor/assets/javascripts/theme-dreamweaver.js +1 -0
  185. data/vendor/assets/javascripts/theme-eclipse-noconflict.js +1 -0
  186. data/vendor/assets/javascripts/theme-eclipse-uncompressed-noconflict.js +147 -0
  187. data/vendor/assets/javascripts/theme-eclipse-uncompressed.js +147 -0
  188. data/vendor/assets/javascripts/theme-eclipse.js +1 -1
  189. data/vendor/assets/javascripts/theme-idle_fingers-noconflict.js +1 -0
  190. data/vendor/assets/javascripts/theme-idle_fingers-uncompressed-noconflict.js +179 -0
  191. data/vendor/assets/javascripts/theme-idle_fingers-uncompressed.js +179 -0
  192. data/vendor/assets/javascripts/theme-idle_fingers.js +1 -1
  193. data/vendor/assets/javascripts/theme-kr_theme-noconflict.js +1 -0
  194. data/vendor/assets/javascripts/theme-kr_theme-uncompressed-noconflict.js +182 -0
  195. data/vendor/assets/javascripts/theme-kr_theme-uncompressed.js +182 -0
  196. data/vendor/assets/javascripts/theme-kr_theme.js +1 -1
  197. data/vendor/assets/javascripts/theme-merbivore-noconflict.js +1 -0
  198. data/vendor/assets/javascripts/theme-merbivore-uncompressed-noconflict.js +182 -0
  199. data/vendor/assets/javascripts/theme-merbivore-uncompressed.js +182 -0
  200. data/vendor/assets/javascripts/theme-merbivore.js +1 -1
  201. data/vendor/assets/javascripts/theme-merbivore_soft-noconflict.js +1 -0
  202. data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed-noconflict.js +188 -0
  203. data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed.js +188 -0
  204. data/vendor/assets/javascripts/theme-merbivore_soft.js +1 -1
  205. data/vendor/assets/javascripts/theme-mono_industrial-noconflict.js +1 -0
  206. data/vendor/assets/javascripts/theme-mono_industrial-uncompressed-noconflict.js +190 -0
  207. data/vendor/assets/javascripts/theme-mono_industrial-uncompressed.js +190 -0
  208. data/vendor/assets/javascripts/theme-mono_industrial.js +1 -1
  209. data/vendor/assets/javascripts/theme-monokai-noconflict.js +1 -0
  210. data/vendor/assets/javascripts/theme-monokai-uncompressed-noconflict.js +191 -0
  211. data/vendor/assets/javascripts/theme-monokai-uncompressed.js +191 -0
  212. data/vendor/assets/javascripts/theme-monokai.js +1 -1
  213. data/vendor/assets/javascripts/theme-pastel_on_dark-noconflict.js +1 -0
  214. data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed-noconflict.js +192 -0
  215. data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed.js +192 -0
  216. data/vendor/assets/javascripts/theme-pastel_on_dark.js +1 -1
  217. data/vendor/assets/javascripts/theme-solarized_dark-noconflict.js +1 -0
  218. data/vendor/assets/javascripts/theme-solarized_dark-uncompressed-noconflict.js +176 -0
  219. data/vendor/assets/javascripts/theme-solarized_dark-uncompressed.js +176 -0
  220. data/vendor/assets/javascripts/theme-solarized_dark.js +1 -1
  221. data/vendor/assets/javascripts/theme-solarized_light-noconflict.js +1 -0
  222. data/vendor/assets/javascripts/theme-solarized_light-uncompressed-noconflict.js +172 -0
  223. data/vendor/assets/javascripts/theme-solarized_light-uncompressed.js +172 -0
  224. data/vendor/assets/javascripts/theme-solarized_light.js +1 -1
  225. data/vendor/assets/javascripts/theme-textmate-noconflict.js +0 -0
  226. data/vendor/assets/javascripts/theme-textmate-uncompressed-noconflict.js +0 -0
  227. data/vendor/assets/javascripts/theme-textmate-uncompressed.js +0 -0
  228. data/vendor/assets/javascripts/theme-tomorrow-noconflict.js +1 -0
  229. data/vendor/assets/javascripts/theme-tomorrow-uncompressed-noconflict.js +206 -0
  230. data/vendor/assets/javascripts/theme-tomorrow-uncompressed.js +206 -0
  231. data/vendor/assets/javascripts/theme-tomorrow.js +1 -1
  232. data/vendor/assets/javascripts/theme-tomorrow_night-noconflict.js +1 -0
  233. data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed-noconflict.js +206 -0
  234. data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed.js +206 -0
  235. data/vendor/assets/javascripts/theme-tomorrow_night.js +1 -1
  236. data/vendor/assets/javascripts/theme-tomorrow_night_blue-noconflict.js +1 -0
  237. data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed-noconflict.js +209 -0
  238. data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed.js +209 -0
  239. data/vendor/assets/javascripts/theme-tomorrow_night_blue.js +1 -1
  240. data/vendor/assets/javascripts/theme-tomorrow_night_bright-noconflict.js +1 -0
  241. data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed-noconflict.js +206 -0
  242. data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed.js +206 -0
  243. data/vendor/assets/javascripts/theme-tomorrow_night_bright.js +1 -1
  244. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-noconflict.js +1 -0
  245. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed-noconflict.js +202 -0
  246. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed.js +202 -0
  247. data/vendor/assets/javascripts/theme-tomorrow_night_eighties.js +1 -1
  248. data/vendor/assets/javascripts/theme-twilight-noconflict.js +1 -0
  249. data/vendor/assets/javascripts/theme-twilight-uncompressed-noconflict.js +204 -0
  250. data/vendor/assets/javascripts/theme-twilight-uncompressed.js +204 -0
  251. data/vendor/assets/javascripts/theme-twilight.js +1 -1
  252. data/vendor/assets/javascripts/theme-vibrant_ink-noconflict.js +1 -0
  253. data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed-noconflict.js +183 -0
  254. data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed.js +183 -0
  255. data/vendor/assets/javascripts/theme-vibrant_ink.js +1 -1
  256. data/vendor/assets/javascripts/worker-coffee.js +2367 -1425
  257. data/vendor/assets/javascripts/worker-css.js +3271 -582
  258. data/vendor/assets/javascripts/worker-javascript.js +4313 -2934
  259. data/vendor/assets/javascripts/worker-json.js +3597 -0
  260. metadata +225 -7
@@ -0,0 +1,2458 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Mozilla Public License Version
5
+ * 1.1 (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ * http://www.mozilla.org/MPL/
8
+ *
9
+ * Software distributed under the License is distributed on an "AS IS" basis,
10
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
+ * for the specific language governing rights and limitations under the
12
+ * License.
13
+ *
14
+ * The Original Code is Ajax.org Code Editor (ACE).
15
+ *
16
+ * The Initial Developer of the Original Code is
17
+ * Ajax.org B.V.
18
+ * Portions created by the Initial Developer are Copyright (C) 2010
19
+ * the Initial Developer. All Rights Reserved.
20
+ *
21
+ * Contributor(s):
22
+ * Fabian Jakobs <fabian AT ajax DOT org>
23
+ *
24
+ * Alternatively, the contents of this file may be used under the terms of
25
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
26
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
+ * in which case the provisions of the GPL or the LGPL are applicable instead
28
+ * of those above. If you wish to allow use of your version of this file only
29
+ * under the terms of either the GPL or the LGPL, and not to allow others to
30
+ * use your version of this file under the terms of the MPL, indicate your
31
+ * decision by deleting the provisions above and replace them with the notice
32
+ * and other provisions required by the GPL or the LGPL. If you do not delete
33
+ * the provisions above, a recipient may use your version of this file under
34
+ * the terms of any one of the MPL, the GPL or the LGPL.
35
+ *
36
+ * ***** END LICENSE BLOCK ***** */
37
+
38
+ 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) {
39
+ "use strict";
40
+
41
+ var oop = require("../lib/oop");
42
+ var XmlMode = require("./xml").Mode;
43
+ var JavaScriptMode = require("./javascript").Mode;
44
+ var CssMode = require("./css").Mode;
45
+ var Tokenizer = require("../tokenizer").Tokenizer;
46
+ var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
47
+
48
+ var Mode = function() {
49
+ XmlMode.call(this);
50
+
51
+ var highlighter = new ColdfusionHighlightRules();
52
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
53
+
54
+ this.$embeds = highlighter.getEmbeds();
55
+ this.createModeDelegates({
56
+ "js-": JavaScriptMode,
57
+ "css-": CssMode
58
+ });
59
+ };
60
+ oop.inherits(Mode, XmlMode);
61
+
62
+ (function() {
63
+
64
+ this.getNextLineIndent = function(state, line, tab) {
65
+ return this.$getIndent(line);
66
+ };
67
+
68
+ }).call(Mode.prototype);
69
+
70
+ exports.Mode = Mode;
71
+ });
72
+ /* ***** BEGIN LICENSE BLOCK *****
73
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
74
+ *
75
+ * The contents of this file are subject to the Mozilla Public License Version
76
+ * 1.1 (the "License"); you may not use this file except in compliance with
77
+ * the License. You may obtain a copy of the License at
78
+ * http://www.mozilla.org/MPL/
79
+ *
80
+ * Software distributed under the License is distributed on an "AS IS" basis,
81
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
82
+ * for the specific language governing rights and limitations under the
83
+ * License.
84
+ *
85
+ * The Original Code is Ajax.org Code Editor (ACE).
86
+ *
87
+ * The Initial Developer of the Original Code is
88
+ * Ajax.org B.V.
89
+ * Portions created by the Initial Developer are Copyright (C) 2010
90
+ * the Initial Developer. All Rights Reserved.
91
+ *
92
+ * Contributor(s):
93
+ * Fabian Jakobs <fabian AT ajax DOT org>
94
+ *
95
+ * Alternatively, the contents of this file may be used under the terms of
96
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
97
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
98
+ * in which case the provisions of the GPL or the LGPL are applicable instead
99
+ * of those above. If you wish to allow use of your version of this file only
100
+ * under the terms of either the GPL or the LGPL, and not to allow others to
101
+ * use your version of this file under the terms of the MPL, indicate your
102
+ * decision by deleting the provisions above and replace them with the notice
103
+ * and other provisions required by the GPL or the LGPL. If you do not delete
104
+ * the provisions above, a recipient may use your version of this file under
105
+ * the terms of any one of the MPL, the GPL or the LGPL.
106
+ *
107
+ * ***** END LICENSE BLOCK ***** */
108
+
109
+ 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) {
110
+ "use strict";
111
+
112
+ var oop = require("../lib/oop");
113
+ var TextMode = require("./text").Mode;
114
+ var Tokenizer = require("../tokenizer").Tokenizer;
115
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
116
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
117
+ var XmlFoldMode = require("./folding/xml").FoldMode;
118
+
119
+ var Mode = function() {
120
+ this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
121
+ this.$behaviour = new XmlBehaviour();
122
+ this.foldingRules = new XmlFoldMode();
123
+ };
124
+
125
+ oop.inherits(Mode, TextMode);
126
+
127
+ (function() {
128
+
129
+ this.getNextLineIndent = function(state, line, tab) {
130
+ return this.$getIndent(line);
131
+ };
132
+
133
+ }).call(Mode.prototype);
134
+
135
+ exports.Mode = Mode;
136
+ });
137
+ /* ***** BEGIN LICENSE BLOCK *****
138
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
139
+ *
140
+ * The contents of this file are subject to the Mozilla Public License Version
141
+ * 1.1 (the "License"); you may not use this file except in compliance with
142
+ * the License. You may obtain a copy of the License at
143
+ * http://www.mozilla.org/MPL/
144
+ *
145
+ * Software distributed under the License is distributed on an "AS IS" basis,
146
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
147
+ * for the specific language governing rights and limitations under the
148
+ * License.
149
+ *
150
+ * The Original Code is Ajax.org Code Editor (ACE).
151
+ *
152
+ * The Initial Developer of the Original Code is
153
+ * Ajax.org B.V.
154
+ * Portions created by the Initial Developer are Copyright (C) 2010
155
+ * the Initial Developer. All Rights Reserved.
156
+ *
157
+ * Contributor(s):
158
+ * Fabian Jakobs <fabian AT ajax DOT org>
159
+ *
160
+ * Alternatively, the contents of this file may be used under the terms of
161
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
162
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
163
+ * in which case the provisions of the GPL or the LGPL are applicable instead
164
+ * of those above. If you wish to allow use of your version of this file only
165
+ * under the terms of either the GPL or the LGPL, and not to allow others to
166
+ * use your version of this file under the terms of the MPL, indicate your
167
+ * decision by deleting the provisions above and replace them with the notice
168
+ * and other provisions required by the GPL or the LGPL. If you do not delete
169
+ * the provisions above, a recipient may use your version of this file under
170
+ * the terms of any one of the MPL, the GPL or the LGPL.
171
+ *
172
+ * ***** END LICENSE BLOCK ***** */
173
+
174
+ 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) {
175
+ "use strict";
176
+
177
+ var oop = require("../lib/oop");
178
+ var xmlUtil = require("./xml_util");
179
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
180
+
181
+ var XmlHighlightRules = function() {
182
+
183
+ // regexp must not have capturing parentheses
184
+ // regexps are ordered -> the first match is used
185
+ this.$rules = {
186
+ start : [{
187
+ token : "text",
188
+ regex : "<\\!\\[CDATA\\[",
189
+ next : "cdata"
190
+ }, {
191
+ token : "xml_pe",
192
+ regex : "<\\?.*?\\?>"
193
+ }, {
194
+ token : "comment",
195
+ merge : true,
196
+ regex : "<\\!--",
197
+ next : "comment"
198
+ }, {
199
+ token : "xml_pe",
200
+ regex : "<\\!.*?>"
201
+ }, {
202
+ token : "meta.tag", // opening tag
203
+ regex : "<\\/?",
204
+ next : "tag"
205
+ }, {
206
+ token : "text",
207
+ regex : "\\s+"
208
+ }, {
209
+ token : "constant.character.entity",
210
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
211
+ }, {
212
+ token : "text",
213
+ regex : "[^<]+"
214
+ }],
215
+
216
+ cdata : [{
217
+ token : "text",
218
+ regex : "\\]\\]>",
219
+ next : "start"
220
+ }, {
221
+ token : "text",
222
+ regex : "\\s+"
223
+ }, {
224
+ token : "text",
225
+ regex : "(?:[^\\]]|\\](?!\\]>))+"
226
+ }],
227
+
228
+ comment : [{
229
+ token : "comment",
230
+ regex : ".*?-->",
231
+ next : "start"
232
+ }, {
233
+ token : "comment",
234
+ merge : true,
235
+ regex : ".+"
236
+ }]
237
+ };
238
+
239
+ xmlUtil.tag(this.$rules, "tag", "start");
240
+ };
241
+
242
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
243
+
244
+ exports.XmlHighlightRules = XmlHighlightRules;
245
+ });
246
+ /* ***** BEGIN LICENSE BLOCK *****
247
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
248
+ *
249
+ * The contents of this file are subject to the Mozilla Public License Version
250
+ * 1.1 (the "License"); you may not use this file except in compliance with
251
+ * the License. You may obtain a copy of the License at
252
+ * http://www.mozilla.org/MPL/
253
+ *
254
+ * Software distributed under the License is distributed on an "AS IS" basis,
255
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
256
+ * for the specific language governing rights and limitations under the
257
+ * License.
258
+ *
259
+ * The Original Code is Ajax.org Code Editor (ACE).
260
+ *
261
+ * The Initial Developer of the Original Code is
262
+ * Ajax.org B.V.
263
+ * Portions created by the Initial Developer are Copyright (C) 2010
264
+ * the Initial Developer. All Rights Reserved.
265
+ *
266
+ * Contributor(s):
267
+ * Fabian Jakobs <fabian AT ajax DOT org>
268
+ *
269
+ * Alternatively, the contents of this file may be used under the terms of
270
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
271
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
272
+ * in which case the provisions of the GPL or the LGPL are applicable instead
273
+ * of those above. If you wish to allow use of your version of this file only
274
+ * under the terms of either the GPL or the LGPL, and not to allow others to
275
+ * use your version of this file under the terms of the MPL, indicate your
276
+ * decision by deleting the provisions above and replace them with the notice
277
+ * and other provisions required by the GPL or the LGPL. If you do not delete
278
+ * the provisions above, a recipient may use your version of this file under
279
+ * the terms of any one of the MPL, the GPL or the LGPL.
280
+ *
281
+ * ***** END LICENSE BLOCK ***** */
282
+
283
+ define('ace/mode/xml_util', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
284
+ "use strict";
285
+
286
+ var lang = require("../lib/lang");
287
+
288
+ var formTags = lang.arrayToMap(
289
+ ("button|form|input|label|select|textarea").split("|")
290
+ );
291
+
292
+ var tableTags = lang.arrayToMap(
293
+ ("table|tbody|td|tfoot|th|tr").split("|")
294
+ );
295
+
296
+ function string(state) {
297
+ return [{
298
+ token : "string",
299
+ regex : '".*?"'
300
+ }, {
301
+ token : "string", // multi line string start
302
+ merge : true,
303
+ regex : '["].*',
304
+ next : state + "_qqstring"
305
+ }, {
306
+ token : "string",
307
+ regex : "'.*?'"
308
+ }, {
309
+ token : "string", // multi line string start
310
+ merge : true,
311
+ regex : "['].*",
312
+ next : state + "_qstring"
313
+ }];
314
+ }
315
+
316
+ function multiLineString(quote, state) {
317
+ return [{
318
+ token : "string",
319
+ merge : true,
320
+ regex : ".*?" + quote,
321
+ next : state
322
+ }, {
323
+ token : "string",
324
+ merge : true,
325
+ regex : '.+'
326
+ }];
327
+ }
328
+
329
+ exports.tag = function(states, name, nextState) {
330
+ states[name] = [{
331
+ token : "text",
332
+ regex : "\\s+"
333
+ }, {
334
+ //token : "meta.tag",
335
+
336
+ token : function(value) {
337
+ if ( value==='a' ) {
338
+ return "meta.tag.anchor";
339
+ }
340
+ else if ( value==='img' ) {
341
+ return "meta.tag.image";
342
+ }
343
+ else if ( value==='script' ) {
344
+ return "meta.tag.script";
345
+ }
346
+ else if ( value==='style' ) {
347
+ return "meta.tag.style";
348
+ }
349
+ else if (formTags.hasOwnProperty(value.toLowerCase())) {
350
+ return "meta.tag.form";
351
+ }
352
+ else if (tableTags.hasOwnProperty(value.toLowerCase())) {
353
+ return "meta.tag.table";
354
+ }
355
+ else {
356
+ return "meta.tag";
357
+ }
358
+ },
359
+ merge : true,
360
+ regex : "[-_a-zA-Z0-9:]+",
361
+ next : name + "_embed_attribute_list"
362
+ }, {
363
+ token: "empty",
364
+ regex: "",
365
+ next : name + "_embed_attribute_list"
366
+ }];
367
+
368
+ states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
369
+ states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
370
+
371
+ states[name + "_embed_attribute_list"] = [{
372
+ token : "meta.tag",
373
+ merge : true,
374
+ regex : "\/?>",
375
+ next : nextState
376
+ }, {
377
+ token : "keyword.operator",
378
+ regex : "="
379
+ }, {
380
+ token : "entity.other.attribute-name",
381
+ regex : "[-_a-zA-Z0-9:]+"
382
+ }, {
383
+ token : "constant.numeric", // float
384
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
385
+ }, {
386
+ token : "text",
387
+ regex : "\\s+"
388
+ }].concat(string(name));
389
+ };
390
+
391
+ });
392
+ /* vim:ts=4:sts=4:sw=4:
393
+ * ***** BEGIN LICENSE BLOCK *****
394
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
395
+ *
396
+ * The contents of this file are subject to the Mozilla Public License Version
397
+ * 1.1 (the "License"); you may not use this file except in compliance with
398
+ * the License. You may obtain a copy of the License at
399
+ * http://www.mozilla.org/MPL/
400
+ *
401
+ * Software distributed under the License is distributed on an "AS IS" basis,
402
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
403
+ * for the specific language governing rights and limitations under the
404
+ * License.
405
+ *
406
+ * The Original Code is Ajax.org Code Editor (ACE).
407
+ *
408
+ * The Initial Developer of the Original Code is
409
+ * Ajax.org B.V.
410
+ * Portions created by the Initial Developer are Copyright (C) 2010
411
+ * the Initial Developer. All Rights Reserved.
412
+ *
413
+ * Contributor(s):
414
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
415
+ *
416
+ * Alternatively, the contents of this file may be used under the terms of
417
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
418
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
419
+ * in which case the provisions of the GPL or the LGPL are applicable instead
420
+ * of those above. If you wish to allow use of your version of this file only
421
+ * under the terms of either the GPL or the LGPL, and not to allow others to
422
+ * use your version of this file under the terms of the MPL, indicate your
423
+ * decision by deleting the provisions above and replace them with the notice
424
+ * and other provisions required by the GPL or the LGPL. If you do not delete
425
+ * the provisions above, a recipient may use your version of this file under
426
+ * the terms of any one of the MPL, the GPL or the LGPL.
427
+ *
428
+ * ***** END LICENSE BLOCK ***** */
429
+
430
+ define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
431
+ "use strict";
432
+
433
+ var oop = require("../../lib/oop");
434
+ var Behaviour = require("../behaviour").Behaviour;
435
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
436
+
437
+ var XmlBehaviour = function () {
438
+
439
+ this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
440
+
441
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
442
+ if (text == '<') {
443
+ var selection = editor.getSelectionRange();
444
+ var selected = session.doc.getTextRange(selection);
445
+ if (selected !== "") {
446
+ return false;
447
+ } else {
448
+ return {
449
+ text: '<>',
450
+ selection: [1, 1]
451
+ }
452
+ }
453
+ } else if (text == '>') {
454
+ var cursor = editor.getCursorPosition();
455
+ var line = session.doc.getLine(cursor.row);
456
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
457
+ if (rightChar == '>') { // need some kind of matching check here
458
+ return {
459
+ text: '',
460
+ selection: [1, 1]
461
+ }
462
+ }
463
+ } else if (text == "\n") {
464
+ var cursor = editor.getCursorPosition();
465
+ var line = session.doc.getLine(cursor.row);
466
+ var rightChars = line.substring(cursor.column, cursor.column + 2);
467
+ if (rightChars == '</') {
468
+ var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
469
+ var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
470
+
471
+ return {
472
+ text: '\n' + indent + '\n' + next_indent,
473
+ selection: [1, indent.length, 1, indent.length]
474
+ }
475
+ }
476
+ }
477
+ });
478
+
479
+ }
480
+ oop.inherits(XmlBehaviour, Behaviour);
481
+
482
+ exports.XmlBehaviour = XmlBehaviour;
483
+ });
484
+ /* vim:ts=4:sts=4:sw=4:
485
+ * ***** BEGIN LICENSE BLOCK *****
486
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
487
+ *
488
+ * The contents of this file are subject to the Mozilla Public License Version
489
+ * 1.1 (the "License"); you may not use this file except in compliance with
490
+ * the License. You may obtain a copy of the License at
491
+ * http://www.mozilla.org/MPL/
492
+ *
493
+ * Software distributed under the License is distributed on an "AS IS" basis,
494
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
495
+ * for the specific language governing rights and limitations under the
496
+ * License.
497
+ *
498
+ * The Original Code is Ajax.org Code Editor (ACE).
499
+ *
500
+ * The Initial Developer of the Original Code is
501
+ * Ajax.org B.V.
502
+ * Portions created by the Initial Developer are Copyright (C) 2010
503
+ * the Initial Developer. All Rights Reserved.
504
+ *
505
+ * Contributor(s):
506
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
507
+ *
508
+ * Alternatively, the contents of this file may be used under the terms of
509
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
510
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
511
+ * in which case the provisions of the GPL or the LGPL are applicable instead
512
+ * of those above. If you wish to allow use of your version of this file only
513
+ * under the terms of either the GPL or the LGPL, and not to allow others to
514
+ * use your version of this file under the terms of the MPL, indicate your
515
+ * decision by deleting the provisions above and replace them with the notice
516
+ * and other provisions required by the GPL or the LGPL. If you do not delete
517
+ * the provisions above, a recipient may use your version of this file under
518
+ * the terms of any one of the MPL, the GPL or the LGPL.
519
+ *
520
+ * ***** END LICENSE BLOCK ***** */
521
+
522
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
523
+ "use strict";
524
+
525
+ var oop = require("../../lib/oop");
526
+ var Behaviour = require('../behaviour').Behaviour;
527
+
528
+ var CstyleBehaviour = function () {
529
+
530
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
531
+ if (text == '{') {
532
+ var selection = editor.getSelectionRange();
533
+ var selected = session.doc.getTextRange(selection);
534
+ if (selected !== "") {
535
+ return {
536
+ text: '{' + selected + '}',
537
+ selection: false
538
+ };
539
+ } else {
540
+ return {
541
+ text: '{}',
542
+ selection: [1, 1]
543
+ };
544
+ }
545
+ } else if (text == '}') {
546
+ var cursor = editor.getCursorPosition();
547
+ var line = session.doc.getLine(cursor.row);
548
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
549
+ if (rightChar == '}') {
550
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
551
+ if (matching !== null) {
552
+ return {
553
+ text: '',
554
+ selection: [1, 1]
555
+ };
556
+ }
557
+ }
558
+ } else if (text == "\n") {
559
+ var cursor = editor.getCursorPosition();
560
+ var line = session.doc.getLine(cursor.row);
561
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
562
+ if (rightChar == '}') {
563
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
564
+ if (!openBracePos)
565
+ return null;
566
+
567
+ var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
568
+ var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
569
+
570
+ return {
571
+ text: '\n' + indent + '\n' + next_indent,
572
+ selection: [1, indent.length, 1, indent.length]
573
+ };
574
+ }
575
+ }
576
+ });
577
+
578
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
579
+ var selected = session.doc.getTextRange(range);
580
+ if (!range.isMultiLine() && selected == '{') {
581
+ var line = session.doc.getLine(range.start.row);
582
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
583
+ if (rightChar == '}') {
584
+ range.end.column++;
585
+ return range;
586
+ }
587
+ }
588
+ });
589
+
590
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
591
+ if (text == '(') {
592
+ var selection = editor.getSelectionRange();
593
+ var selected = session.doc.getTextRange(selection);
594
+ if (selected !== "") {
595
+ return {
596
+ text: '(' + selected + ')',
597
+ selection: false
598
+ };
599
+ } else {
600
+ return {
601
+ text: '()',
602
+ selection: [1, 1]
603
+ };
604
+ }
605
+ } else if (text == ')') {
606
+ var cursor = editor.getCursorPosition();
607
+ var line = session.doc.getLine(cursor.row);
608
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
609
+ if (rightChar == ')') {
610
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
611
+ if (matching !== null) {
612
+ return {
613
+ text: '',
614
+ selection: [1, 1]
615
+ };
616
+ }
617
+ }
618
+ }
619
+ });
620
+
621
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
622
+ var selected = session.doc.getTextRange(range);
623
+ if (!range.isMultiLine() && selected == '(') {
624
+ var line = session.doc.getLine(range.start.row);
625
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
626
+ if (rightChar == ')') {
627
+ range.end.column++;
628
+ return range;
629
+ }
630
+ }
631
+ });
632
+
633
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
634
+ if (text == '"' || text == "'") {
635
+ var quote = text;
636
+ var selection = editor.getSelectionRange();
637
+ var selected = session.doc.getTextRange(selection);
638
+ if (selected !== "") {
639
+ return {
640
+ text: quote + selected + quote,
641
+ selection: false
642
+ };
643
+ } else {
644
+ var cursor = editor.getCursorPosition();
645
+ var line = session.doc.getLine(cursor.row);
646
+ var leftChar = line.substring(cursor.column-1, cursor.column);
647
+
648
+ // We're escaped.
649
+ if (leftChar == '\\') {
650
+ return null;
651
+ }
652
+
653
+ // Find what token we're inside.
654
+ var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
655
+ var col = 0, token;
656
+ var quotepos = -1; // Track whether we're inside an open quote.
657
+
658
+ for (var x = 0; x < tokens.length; x++) {
659
+ token = tokens[x];
660
+ if (token.type == "string") {
661
+ quotepos = -1;
662
+ } else if (quotepos < 0) {
663
+ quotepos = token.value.indexOf(quote);
664
+ }
665
+ if ((token.value.length + col) > selection.start.column) {
666
+ break;
667
+ }
668
+ col += tokens[x].value.length;
669
+ }
670
+
671
+ // Try and be smart about when we auto insert.
672
+ if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
673
+ return {
674
+ text: quote + quote,
675
+ selection: [1,1]
676
+ };
677
+ } else if (token && token.type === "string") {
678
+ // Ignore input and move right one if we're typing over the closing quote.
679
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
680
+ if (rightChar == quote) {
681
+ return {
682
+ text: '',
683
+ selection: [1, 1]
684
+ };
685
+ }
686
+ }
687
+ }
688
+ }
689
+ });
690
+
691
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
692
+ var selected = session.doc.getTextRange(range);
693
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
694
+ var line = session.doc.getLine(range.start.row);
695
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
696
+ if (rightChar == '"') {
697
+ range.end.column++;
698
+ return range;
699
+ }
700
+ }
701
+ });
702
+
703
+ };
704
+
705
+ oop.inherits(CstyleBehaviour, Behaviour);
706
+
707
+ exports.CstyleBehaviour = CstyleBehaviour;
708
+ });
709
+ /* ***** BEGIN LICENSE BLOCK *****
710
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
711
+ *
712
+ * The contents of this file are subject to the Mozilla Public License Version
713
+ * 1.1 (the "License"); you may not use this file except in compliance with
714
+ * the License. You may obtain a copy of the License at
715
+ * http://www.mozilla.org/MPL/
716
+ *
717
+ * Software distributed under the License is distributed on an "AS IS" basis,
718
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
719
+ * for the specific language governing rights and limitations under the
720
+ * License.
721
+ *
722
+ * The Original Code is Ajax.org Code Editor (ACE).
723
+ *
724
+ * The Initial Developer of the Original Code is
725
+ * Ajax.org B.V.
726
+ * Portions created by the Initial Developer are Copyright (C) 2010
727
+ * the Initial Developer. All Rights Reserved.
728
+ *
729
+ * Contributor(s):
730
+ * Fabian Jakobs <fabian AT ajax DOT org>
731
+ *
732
+ * Alternatively, the contents of this file may be used under the terms of
733
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
734
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
735
+ * in which case the provisions of the GPL or the LGPL are applicable instead
736
+ * of those above. If you wish to allow use of your version of this file only
737
+ * under the terms of either the GPL or the LGPL, and not to allow others to
738
+ * use your version of this file under the terms of the MPL, indicate your
739
+ * decision by deleting the provisions above and replace them with the notice
740
+ * and other provisions required by the GPL or the LGPL. If you do not delete
741
+ * the provisions above, a recipient may use your version of this file under
742
+ * the terms of any one of the MPL, the GPL or the LGPL.
743
+ *
744
+ * ***** END LICENSE BLOCK ***** */
745
+
746
+ 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) {
747
+ "use strict";
748
+
749
+ var oop = require("../../lib/oop");
750
+ var lang = require("../../lib/lang");
751
+ var Range = require("../../range").Range;
752
+ var BaseFoldMode = require("./fold_mode").FoldMode;
753
+ var TokenIterator = require("../../token_iterator").TokenIterator;
754
+
755
+ var FoldMode = exports.FoldMode = function(voidElements) {
756
+ BaseFoldMode.call(this);
757
+ this.voidElements = voidElements || {};
758
+ };
759
+ oop.inherits(FoldMode, BaseFoldMode);
760
+
761
+ (function() {
762
+
763
+ this.getFoldWidget = function(session, foldStyle, row) {
764
+ var tag = this._getFirstTagInLine(session, row);
765
+
766
+ if (tag.closing)
767
+ return foldStyle == "markbeginend" ? "end" : "";
768
+
769
+ if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
770
+ return "";
771
+
772
+ if (tag.selfClosing)
773
+ return "";
774
+
775
+ if (tag.value.indexOf("/" + tag.tagName) !== -1)
776
+ return "";
777
+
778
+ return "start";
779
+ };
780
+
781
+ this._getFirstTagInLine = function(session, row) {
782
+ var tokens = session.getTokens(row, row)[0].tokens;
783
+ var value = "";
784
+ for (var i = 0; i < tokens.length; i++) {
785
+ var token = tokens[i];
786
+ if (token.type.indexOf("meta.tag") === 0)
787
+ value += token.value;
788
+ else
789
+ value += lang.stringRepeat(" ", token.value.length);
790
+ }
791
+
792
+ return this._parseTag(value);
793
+ };
794
+
795
+ this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
796
+ this._parseTag = function(tag) {
797
+
798
+ var match = this.tagRe.exec(tag);
799
+ var column = this.tagRe.lastIndex || 0;
800
+ this.tagRe.lastIndex = 0;
801
+
802
+ return {
803
+ value: tag,
804
+ match: match ? match[2] : "",
805
+ closing: match ? !!match[3] : false,
806
+ selfClosing: match ? !!match[5] || match[2] == "/>" : false,
807
+ tagName: match ? match[4] : "",
808
+ column: match[1] ? column + match[1].length : column
809
+ };
810
+ };
811
+
812
+ /*
813
+ * reads a full tag and places the iterator after the tag
814
+ */
815
+ this._readTagForward = function(iterator) {
816
+ var token = iterator.getCurrentToken();
817
+ if (!token)
818
+ return null;
819
+
820
+ var value = "";
821
+ var start;
822
+
823
+ do {
824
+ if (token.type.indexOf("meta.tag") === 0) {
825
+ if (!start) {
826
+ var start = {
827
+ row: iterator.getCurrentTokenRow(),
828
+ column: iterator.getCurrentTokenColumn()
829
+ };
830
+ }
831
+ value += token.value;
832
+ if (value.indexOf(">") !== -1) {
833
+ var tag = this._parseTag(value);
834
+ tag.start = start;
835
+ tag.end = {
836
+ row: iterator.getCurrentTokenRow(),
837
+ column: iterator.getCurrentTokenColumn() + token.value.length
838
+ };
839
+ iterator.stepForward();
840
+ return tag;
841
+ }
842
+ }
843
+ } while(token = iterator.stepForward());
844
+
845
+ return null;
846
+ };
847
+
848
+ this._readTagBackward = function(iterator) {
849
+ var token = iterator.getCurrentToken();
850
+ if (!token)
851
+ return null;
852
+
853
+ var value = "";
854
+ var end;
855
+
856
+ do {
857
+ if (token.type.indexOf("meta.tag") === 0) {
858
+ if (!end) {
859
+ end = {
860
+ row: iterator.getCurrentTokenRow(),
861
+ column: iterator.getCurrentTokenColumn() + token.value.length
862
+ };
863
+ }
864
+ value = token.value + value;
865
+ if (value.indexOf("<") !== -1) {
866
+ var tag = this._parseTag(value);
867
+ tag.end = end;
868
+ tag.start = {
869
+ row: iterator.getCurrentTokenRow(),
870
+ column: iterator.getCurrentTokenColumn()
871
+ };
872
+ iterator.stepBackward();
873
+ return tag;
874
+ }
875
+ }
876
+ } while(token = iterator.stepBackward());
877
+
878
+ return null;
879
+ };
880
+
881
+ this._pop = function(stack, tag) {
882
+ while (stack.length) {
883
+
884
+ var top = stack[stack.length-1];
885
+ if (!tag || top.tagName == tag.tagName) {
886
+ return stack.pop();
887
+ }
888
+ else if (this.voidElements[tag.tagName]) {
889
+ return;
890
+ }
891
+ else if (this.voidElements[top.tagName]) {
892
+ stack.pop();
893
+ continue;
894
+ } else {
895
+ return null;
896
+ }
897
+ }
898
+ };
899
+
900
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
901
+ var firstTag = this._getFirstTagInLine(session, row);
902
+
903
+ if (!firstTag.match)
904
+ return null;
905
+
906
+ var isBackward = firstTag.closing || firstTag.selfClosing;
907
+ var stack = [];
908
+ var tag;
909
+
910
+ if (!isBackward) {
911
+ var iterator = new TokenIterator(session, row, firstTag.column);
912
+ var start = {
913
+ row: row,
914
+ column: firstTag.column + firstTag.tagName.length + 2
915
+ };
916
+ while (tag = this._readTagForward(iterator)) {
917
+ if (tag.selfClosing) {
918
+ if (!stack.length) {
919
+ tag.start.column += tag.tagName.length + 2;
920
+ tag.end.column -= 2;
921
+ return Range.fromPoints(tag.start, tag.end);
922
+ } else
923
+ continue;
924
+ }
925
+
926
+ if (tag.closing) {
927
+ this._pop(stack, tag);
928
+ if (stack.length == 0)
929
+ return Range.fromPoints(start, tag.start);
930
+ }
931
+ else {
932
+ stack.push(tag)
933
+ }
934
+ }
935
+ }
936
+ else {
937
+ var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
938
+ var end = {
939
+ row: row,
940
+ column: firstTag.column
941
+ };
942
+
943
+ while (tag = this._readTagBackward(iterator)) {
944
+ if (tag.selfClosing) {
945
+ if (!stack.length) {
946
+ tag.start.column += tag.tagName.length + 2;
947
+ tag.end.column -= 2;
948
+ return Range.fromPoints(tag.start, tag.end);
949
+ } else
950
+ continue;
951
+ }
952
+
953
+ if (!tag.closing) {
954
+ this._pop(stack, tag);
955
+ if (stack.length == 0) {
956
+ tag.start.column += tag.tagName.length + 2;
957
+ return Range.fromPoints(tag.start, end);
958
+ }
959
+ }
960
+ else {
961
+ stack.push(tag)
962
+ }
963
+ }
964
+ }
965
+
966
+ };
967
+
968
+ }).call(FoldMode.prototype);
969
+
970
+ });
971
+ /* ***** BEGIN LICENSE BLOCK *****
972
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
973
+ *
974
+ * The contents of this file are subject to the Mozilla Public License Version
975
+ * 1.1 (the "License"); you may not use this file except in compliance with
976
+ * the License. You may obtain a copy of the License at
977
+ * http://www.mozilla.org/MPL/
978
+ *
979
+ * Software distributed under the License is distributed on an "AS IS" basis,
980
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
981
+ * for the specific language governing rights and limitations under the
982
+ * License.
983
+ *
984
+ * The Original Code is Ajax.org Code Editor (ACE).
985
+ *
986
+ * The Initial Developer of the Original Code is
987
+ * Ajax.org B.V.
988
+ * Portions created by the Initial Developer are Copyright (C) 2010
989
+ * the Initial Developer. All Rights Reserved.
990
+ *
991
+ * Contributor(s):
992
+ * Fabian Jakobs <fabian AT ajax DOT org>
993
+ *
994
+ * Alternatively, the contents of this file may be used under the terms of
995
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
996
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
997
+ * in which case the provisions of the GPL or the LGPL are applicable instead
998
+ * of those above. If you wish to allow use of your version of this file only
999
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1000
+ * use your version of this file under the terms of the MPL, indicate your
1001
+ * decision by deleting the provisions above and replace them with the notice
1002
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1003
+ * the provisions above, a recipient may use your version of this file under
1004
+ * the terms of any one of the MPL, the GPL or the LGPL.
1005
+ *
1006
+ * ***** END LICENSE BLOCK ***** */
1007
+
1008
+ define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1009
+ "use strict";
1010
+
1011
+ var Range = require("../../range").Range;
1012
+
1013
+ var FoldMode = exports.FoldMode = function() {};
1014
+
1015
+ (function() {
1016
+
1017
+ this.foldingStartMarker = null;
1018
+ this.foldingStopMarker = null;
1019
+
1020
+ // must return "" if there's no fold, to enable caching
1021
+ this.getFoldWidget = function(session, foldStyle, row) {
1022
+ var line = session.getLine(row);
1023
+ if (this.foldingStartMarker.test(line))
1024
+ return "start";
1025
+ if (foldStyle == "markbeginend"
1026
+ && this.foldingStopMarker
1027
+ && this.foldingStopMarker.test(line))
1028
+ return "end";
1029
+ return "";
1030
+ };
1031
+
1032
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1033
+ return null;
1034
+ };
1035
+
1036
+ this.indentationBlock = function(session, row, column) {
1037
+ var re = /^\s*/;
1038
+ var startRow = row;
1039
+ var endRow = row;
1040
+ var line = session.getLine(row);
1041
+ var startColumn = column || line.length;
1042
+ var startLevel = line.match(re)[0].length;
1043
+ var maxRow = session.getLength()
1044
+
1045
+ while (++row < maxRow) {
1046
+ line = session.getLine(row);
1047
+ var level = line.match(re)[0].length;
1048
+
1049
+ if (level == line.length)
1050
+ continue;
1051
+
1052
+ if (level <= startLevel)
1053
+ break;
1054
+
1055
+ endRow = row;
1056
+ }
1057
+
1058
+ if (endRow > startRow) {
1059
+ var endColumn = session.getLine(endRow).length;
1060
+ return new Range(startRow, startColumn, endRow, endColumn);
1061
+ }
1062
+ };
1063
+
1064
+ this.openingBracketBlock = function(session, bracket, row, column) {
1065
+ var start = {row: row, column: column + 1};
1066
+ var end = session.$findClosingBracket(bracket, start);
1067
+ if (!end)
1068
+ return;
1069
+
1070
+ var fw = session.foldWidgets[end.row];
1071
+ if (fw == null)
1072
+ fw = this.getFoldWidget(session, end.row);
1073
+
1074
+ if (fw == "start") {
1075
+ end.row --;
1076
+ end.column = session.getLine(end.row).length;
1077
+ }
1078
+ return Range.fromPoints(start, end);
1079
+ };
1080
+
1081
+ }).call(FoldMode.prototype);
1082
+
1083
+ });
1084
+ /* ***** BEGIN LICENSE BLOCK *****
1085
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1086
+ *
1087
+ * The contents of this file are subject to the Mozilla Public License Version
1088
+ * 1.1 (the "License"); you may not use this file except in compliance with
1089
+ * the License. You may obtain a copy of the License at
1090
+ * http://www.mozilla.org/MPL/
1091
+ *
1092
+ * Software distributed under the License is distributed on an "AS IS" basis,
1093
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1094
+ * for the specific language governing rights and limitations under the
1095
+ * License.
1096
+ *
1097
+ * The Original Code is Ajax.org Code Editor (ACE).
1098
+ *
1099
+ * The Initial Developer of the Original Code is
1100
+ * Ajax.org B.V.
1101
+ * Portions created by the Initial Developer are Copyright (C) 2010
1102
+ * the Initial Developer. All Rights Reserved.
1103
+ *
1104
+ * Contributor(s):
1105
+ * Fabian Jakobs <fabian AT ajax DOT org>
1106
+ *
1107
+ * Alternatively, the contents of this file may be used under the terms of
1108
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1109
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1110
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1111
+ * of those above. If you wish to allow use of your version of this file only
1112
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1113
+ * use your version of this file under the terms of the MPL, indicate your
1114
+ * decision by deleting the provisions above and replace them with the notice
1115
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1116
+ * the provisions above, a recipient may use your version of this file under
1117
+ * the terms of any one of the MPL, the GPL or the LGPL.
1118
+ *
1119
+ * ***** END LICENSE BLOCK ***** */
1120
+
1121
+ 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) {
1122
+ "use strict";
1123
+
1124
+ var oop = require("../lib/oop");
1125
+ var TextMode = require("./text").Mode;
1126
+ var Tokenizer = require("../tokenizer").Tokenizer;
1127
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1128
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1129
+ var Range = require("../range").Range;
1130
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1131
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
1132
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1133
+
1134
+ var Mode = function() {
1135
+ this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
1136
+ this.$outdent = new MatchingBraceOutdent();
1137
+ this.$behaviour = new CstyleBehaviour();
1138
+ this.foldingRules = new CStyleFoldMode();
1139
+ };
1140
+ oop.inherits(Mode, TextMode);
1141
+
1142
+ (function() {
1143
+
1144
+
1145
+ this.toggleCommentLines = function(state, doc, startRow, endRow) {
1146
+ var outdent = true;
1147
+ var re = /^(\s*)\/\//;
1148
+
1149
+ for (var i=startRow; i<= endRow; i++) {
1150
+ if (!re.test(doc.getLine(i))) {
1151
+ outdent = false;
1152
+ break;
1153
+ }
1154
+ }
1155
+
1156
+ if (outdent) {
1157
+ var deleteRange = new Range(0, 0, 0, 0);
1158
+ for (var i=startRow; i<= endRow; i++)
1159
+ {
1160
+ var line = doc.getLine(i);
1161
+ var m = line.match(re);
1162
+ deleteRange.start.row = i;
1163
+ deleteRange.end.row = i;
1164
+ deleteRange.end.column = m[0].length;
1165
+ doc.replace(deleteRange, m[1]);
1166
+ }
1167
+ }
1168
+ else {
1169
+ doc.indentRows(startRow, endRow, "//");
1170
+ }
1171
+ };
1172
+
1173
+ this.getNextLineIndent = function(state, line, tab) {
1174
+ var indent = this.$getIndent(line);
1175
+
1176
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
1177
+ var tokens = tokenizedLine.tokens;
1178
+ var endState = tokenizedLine.state;
1179
+
1180
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1181
+ return indent;
1182
+ }
1183
+
1184
+ if (state == "start" || state == "regex_allowed") {
1185
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
1186
+ if (match) {
1187
+ indent += tab;
1188
+ }
1189
+ } else if (state == "doc-start") {
1190
+ if (endState == "start" || state == "regex_allowed") {
1191
+ return "";
1192
+ }
1193
+ var match = line.match(/^\s*(\/?)\*/);
1194
+ if (match) {
1195
+ if (match[1]) {
1196
+ indent += " ";
1197
+ }
1198
+ indent += "* ";
1199
+ }
1200
+ }
1201
+
1202
+ return indent;
1203
+ };
1204
+
1205
+ this.checkOutdent = function(state, line, input) {
1206
+ return this.$outdent.checkOutdent(line, input);
1207
+ };
1208
+
1209
+ this.autoOutdent = function(state, doc, row) {
1210
+ this.$outdent.autoOutdent(doc, row);
1211
+ };
1212
+
1213
+ this.createWorker = function(session) {
1214
+ var worker = new WorkerClient(["ace"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
1215
+ worker.attachToDocument(session.getDocument());
1216
+
1217
+ worker.on("jslint", function(results) {
1218
+ var errors = [];
1219
+ for (var i=0; i<results.data.length; i++) {
1220
+ var error = results.data[i];
1221
+ if (error)
1222
+ errors.push({
1223
+ row: error.line-1,
1224
+ column: error.character-1,
1225
+ text: error.reason,
1226
+ type: "warning",
1227
+ lint: error
1228
+ });
1229
+ }
1230
+ session.setAnnotations(errors);
1231
+ });
1232
+
1233
+ worker.on("narcissus", function(e) {
1234
+ session.setAnnotations([e.data]);
1235
+ });
1236
+
1237
+ worker.on("terminate", function() {
1238
+ session.clearAnnotations();
1239
+ });
1240
+
1241
+ return worker;
1242
+ };
1243
+
1244
+ }).call(Mode.prototype);
1245
+
1246
+ exports.Mode = Mode;
1247
+ });
1248
+ /* ***** BEGIN LICENSE BLOCK *****
1249
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1250
+ *
1251
+ * The contents of this file are subject to the Mozilla Public License Version
1252
+ * 1.1 (the "License"); you may not use this file except in compliance with
1253
+ * the License. You may obtain a copy of the License at
1254
+ * http://www.mozilla.org/MPL/
1255
+ *
1256
+ * Software distributed under the License is distributed on an "AS IS" basis,
1257
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1258
+ * for the specific language governing rights and limitations under the
1259
+ * License.
1260
+ *
1261
+ * The Original Code is Ajax.org Code Editor (ACE).
1262
+ *
1263
+ * The Initial Developer of the Original Code is
1264
+ * Ajax.org B.V.
1265
+ * Portions created by the Initial Developer are Copyright (C) 2010
1266
+ * the Initial Developer. All Rights Reserved.
1267
+ *
1268
+ * Contributor(s):
1269
+ * Fabian Jakobs <fabian AT ajax DOT org>
1270
+ * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
1271
+ *
1272
+ * Alternatively, the contents of this file may be used under the terms of
1273
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1274
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1275
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1276
+ * of those above. If you wish to allow use of your version of this file only
1277
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1278
+ * use your version of this file under the terms of the MPL, indicate your
1279
+ * decision by deleting the provisions above and replace them with the notice
1280
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1281
+ * the provisions above, a recipient may use your version of this file under
1282
+ * the terms of any one of the MPL, the GPL or the LGPL.
1283
+ *
1284
+ * ***** END LICENSE BLOCK ***** */
1285
+
1286
+ define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/unicode', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1287
+ "use strict";
1288
+
1289
+ var oop = require("../lib/oop");
1290
+ var lang = require("../lib/lang");
1291
+ var unicode = require("../unicode");
1292
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
1293
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1294
+
1295
+ var JavaScriptHighlightRules = function() {
1296
+
1297
+ // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
1298
+ var globals = lang.arrayToMap(
1299
+ // Constructors
1300
+ ("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" +
1301
+ // E4X
1302
+ "Namespace|QName|XML|XMLList|" +
1303
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
1304
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
1305
+ // Errors
1306
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
1307
+ "SyntaxError|TypeError|URIError|" +
1308
+ // Non-constructor functions
1309
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
1310
+ "isNaN|parseFloat|parseInt|" +
1311
+ // Other
1312
+ "JSON|Math|" +
1313
+ // Pseudo
1314
+ "this|arguments|prototype|window|document"
1315
+ ).split("|")
1316
+ );
1317
+
1318
+ var keywords = lang.arrayToMap(
1319
+ ("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
1320
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
1321
+ "const|yield|import|get|set").split("|")
1322
+ );
1323
+
1324
+ // keywords which can be followed by regular expressions
1325
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
1326
+
1327
+ var deprecated = lang.arrayToMap(
1328
+ ("__parent__|__count__|escape|unescape|with|__proto__").split("|")
1329
+ );
1330
+
1331
+ var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
1332
+
1333
+ var buildinConstants = lang.arrayToMap(
1334
+ ("null|Infinity|NaN|undefined").split("|")
1335
+ );
1336
+
1337
+ var futureReserved = lang.arrayToMap(
1338
+ ("class|enum|extends|super|export|implements|private|" +
1339
+ "public|interface|package|protected|static").split("|")
1340
+ );
1341
+
1342
+ // TODO: Unicode escape sequences
1343
+ var identifierRe = "[" + unicode.packages.L + "\\$_]["
1344
+ + unicode.packages.L
1345
+ + unicode.packages.Mn + unicode.packages.Mc
1346
+ + unicode.packages.Nd
1347
+ + unicode.packages.Pc + "\\$_]*\\b";
1348
+
1349
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
1350
+ "u[0-9a-fA-F]{4}|" + // unicode
1351
+ "[0-2][0-7]{0,2}|" + // oct
1352
+ "3[0-6][0-7]?|" + // oct
1353
+ "37[0-7]?|" + // oct
1354
+ "[4-7][0-7]?|" + //oct
1355
+ ".)";
1356
+
1357
+ // regexp must not have capturing parentheses. Use (?:) instead.
1358
+ // regexps are ordered -> the first match is used
1359
+
1360
+ this.$rules = {
1361
+ "start" : [
1362
+ {
1363
+ token : "comment",
1364
+ regex : /\/\/.*$/
1365
+ },
1366
+ DocCommentHighlightRules.getStartRule("doc-start"),
1367
+ {
1368
+ token : "comment", // multi line comment
1369
+ merge : true,
1370
+ regex : /\/\*/,
1371
+ next : "comment"
1372
+ }, {
1373
+ token : "string",
1374
+ regex : "'(?=.)",
1375
+ next : "qstring"
1376
+ }, {
1377
+ token : "string",
1378
+ regex : '"(?=.)',
1379
+ next : "qqstring"
1380
+ }, {
1381
+ token : "constant.numeric", // hex
1382
+ regex : /0[xX][0-9a-fA-F]+\b/
1383
+ }, {
1384
+ token : "constant.numeric", // float
1385
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
1386
+ }, { // match stuff like: Sound.prototype.play = function() { }
1387
+ token : [
1388
+ "storage.type",
1389
+ "punctuation.operator",
1390
+ "support.function",
1391
+ "punctuation.operator",
1392
+ "entity.name.function",
1393
+ "text",
1394
+ "keyword.operator",
1395
+ "text",
1396
+ "storage.type",
1397
+ "text",
1398
+ "paren.lparen"
1399
+ ],
1400
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1401
+ next: "function_arguments"
1402
+ }, { // match stuff like: Sound.prototype.play = myfunc
1403
+ token : [
1404
+ "storage.type",
1405
+ "punctuation.operator",
1406
+ "support.function",
1407
+ "punctuation.operator",
1408
+ "entity.name.function",
1409
+ "text",
1410
+ "keyword.operator",
1411
+ "text"
1412
+ ],
1413
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
1414
+ next: "function_arguments"
1415
+ }, { // match stuff like: Sound.play = function() { }
1416
+ token : [
1417
+ "storage.type",
1418
+ "punctuation.operator",
1419
+ "entity.name.function",
1420
+ "text",
1421
+ "keyword.operator",
1422
+ "text",
1423
+ "storage.type",
1424
+ "text",
1425
+ "paren.lparen"
1426
+ ],
1427
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1428
+ next: "function_arguments"
1429
+ }, { // match stuff like: play = function() { }
1430
+ token : [
1431
+ "entity.name.function",
1432
+ "text",
1433
+ "keyword.operator",
1434
+ "text",
1435
+ "storage.type",
1436
+ "text",
1437
+ "paren.lparen"
1438
+ ],
1439
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1440
+ next: "function_arguments"
1441
+ }, { // match regular function like: function myFunc(arg) { }
1442
+ token : [
1443
+ "storage.type",
1444
+ "text",
1445
+ "entity.name.function",
1446
+ "text",
1447
+ "paren.lparen"
1448
+ ],
1449
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
1450
+ next: "function_arguments"
1451
+ }, { // match stuff like: foobar: function() { }
1452
+ token : [
1453
+ "entity.name.function",
1454
+ "text",
1455
+ "punctuation.operator",
1456
+ "text",
1457
+ "storage.type",
1458
+ "text",
1459
+ "paren.lparen"
1460
+ ],
1461
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
1462
+ next: "function_arguments"
1463
+ }, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
1464
+ token : [
1465
+ "text",
1466
+ "text",
1467
+ "storage.type",
1468
+ "text",
1469
+ "paren.lparen"
1470
+ ],
1471
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
1472
+ next: "function_arguments"
1473
+ }, {
1474
+ token : "constant.language.boolean",
1475
+ regex : /(?:true|false)\b/
1476
+ }, {
1477
+ token : "keyword",
1478
+ regex : "(?:" + kwBeforeRe + ")\\b",
1479
+ next : "regex_allowed"
1480
+ }, {
1481
+ token : ["punctuation.operator", "support.function"],
1482
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|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(?=\()/
1483
+ }, {
1484
+ token : ["punctuation.operator", "support.function.dom"],
1485
+ 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(?=\()/
1486
+ }, {
1487
+ token : ["punctuation.operator", "support.constant"],
1488
+ 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/
1489
+ }, {
1490
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
1491
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
1492
+ }, {
1493
+ token : function(value) {
1494
+ if (globals.hasOwnProperty(value))
1495
+ return "variable.language";
1496
+ else if (deprecated.hasOwnProperty(value))
1497
+ return "invalid.deprecated";
1498
+ else if (definitions.hasOwnProperty(value))
1499
+ return "storage.type";
1500
+ else if (keywords.hasOwnProperty(value))
1501
+ return "keyword";
1502
+ else if (buildinConstants.hasOwnProperty(value))
1503
+ return "constant.language";
1504
+ else if (futureReserved.hasOwnProperty(value))
1505
+ return "invalid.illegal";
1506
+ else if (value == "debugger")
1507
+ return "invalid.deprecated";
1508
+ else
1509
+ return "identifier";
1510
+ },
1511
+ regex : identifierRe
1512
+ }, {
1513
+ token : "keyword.operator",
1514
+ regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
1515
+ next : "regex_allowed"
1516
+ }, {
1517
+ token : "punctuation.operator",
1518
+ regex : /\?|\:|\,|\;|\./,
1519
+ next : "regex_allowed"
1520
+ }, {
1521
+ token : "paren.lparen",
1522
+ regex : /[\[({]/,
1523
+ next : "regex_allowed"
1524
+ }, {
1525
+ token : "paren.rparen",
1526
+ regex : /[\])}]/
1527
+ }, {
1528
+ token : "keyword.operator",
1529
+ regex : /\/=?/,
1530
+ next : "regex_allowed"
1531
+ }, {
1532
+ token: "comment",
1533
+ regex: /^#!.*$/
1534
+ }, {
1535
+ token : "text",
1536
+ regex : /\s+/
1537
+ }
1538
+ ],
1539
+ // regular expressions are only allowed after certain tokens. This
1540
+ // makes sure we don't mix up regexps with the divison operator
1541
+ "regex_allowed": [
1542
+ DocCommentHighlightRules.getStartRule("doc-start"),
1543
+ {
1544
+ token : "comment", // multi line comment
1545
+ merge : true,
1546
+ regex : "\\/\\*",
1547
+ next : "comment_regex_allowed"
1548
+ }, {
1549
+ token : "comment",
1550
+ regex : "\\/\\/.*$"
1551
+ }, {
1552
+ token: "string.regexp",
1553
+ regex: "\\/",
1554
+ next: "regex",
1555
+ merge: true
1556
+ }, {
1557
+ token : "text",
1558
+ regex : "\\s+"
1559
+ }, {
1560
+ // immediately return to the start mode without matching
1561
+ // anything
1562
+ token: "empty",
1563
+ regex: "",
1564
+ next: "start"
1565
+ }
1566
+ ],
1567
+ "regex": [
1568
+ {
1569
+ token: "regexp.keyword.operator",
1570
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1571
+ }, {
1572
+ // flag
1573
+ token: "string.regexp",
1574
+ regex: "/\\w*",
1575
+ next: "start",
1576
+ merge: true
1577
+ }, {
1578
+ token: "string.regexp",
1579
+ regex: "[^\\\\/\\[]+",
1580
+ merge: true
1581
+ }, {
1582
+ token: "string.regexp.charachterclass",
1583
+ regex: "\\[",
1584
+ next: "regex_character_class",
1585
+ merge: true
1586
+ }, {
1587
+ token: "empty",
1588
+ regex: "",
1589
+ next: "start"
1590
+ }
1591
+ ],
1592
+ "regex_character_class": [
1593
+ {
1594
+ token: "regexp.keyword.operator",
1595
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1596
+ }, {
1597
+ token: "string.regexp.charachterclass",
1598
+ regex: "]",
1599
+ next: "regex",
1600
+ merge: true
1601
+ }, {
1602
+ token: "string.regexp.charachterclass",
1603
+ regex: "[^\\\\\\]]+",
1604
+ merge: true
1605
+ }, {
1606
+ token: "empty",
1607
+ regex: "",
1608
+ next: "start"
1609
+ }
1610
+ ],
1611
+ "function_arguments": [
1612
+ {
1613
+ token: "variable.parameter",
1614
+ regex: identifierRe,
1615
+ }, {
1616
+ token: "punctuation.operator",
1617
+ regex: "[, ]+",
1618
+ merge: true
1619
+ }, {
1620
+ token: "punctuation.operator",
1621
+ regex: "$",
1622
+ merge: true
1623
+ }, {
1624
+ token: "empty",
1625
+ regex: "",
1626
+ next: "start"
1627
+ }
1628
+ ],
1629
+ "comment_regex_allowed" : [
1630
+ {
1631
+ token : "comment", // closing comment
1632
+ regex : ".*?\\*\\/",
1633
+ merge : true,
1634
+ next : "regex_allowed"
1635
+ }, {
1636
+ token : "comment", // comment spanning whole line
1637
+ merge : true,
1638
+ regex : ".+"
1639
+ }
1640
+ ],
1641
+ "comment" : [
1642
+ {
1643
+ token : "comment", // closing comment
1644
+ regex : ".*?\\*\\/",
1645
+ merge : true,
1646
+ next : "start"
1647
+ }, {
1648
+ token : "comment", // comment spanning whole line
1649
+ merge : true,
1650
+ regex : ".+"
1651
+ }
1652
+ ],
1653
+ "qqstring" : [
1654
+ {
1655
+ token : "constant.language.escape",
1656
+ regex : escapedRe
1657
+ }, {
1658
+ token : "string",
1659
+ regex : '[^"\\\\]+',
1660
+ merge : true
1661
+ }, {
1662
+ token : "string",
1663
+ regex : "\\\\$",
1664
+ next : "qqstring",
1665
+ merge : true
1666
+ }, {
1667
+ token : "string",
1668
+ regex : '"|$',
1669
+ next : "start",
1670
+ merge : true
1671
+ }
1672
+ ],
1673
+ "qstring" : [
1674
+ {
1675
+ token : "constant.language.escape",
1676
+ regex : escapedRe
1677
+ }, {
1678
+ token : "string",
1679
+ regex : "[^'\\\\]+",
1680
+ merge : true
1681
+ }, {
1682
+ token : "string",
1683
+ regex : "\\\\$",
1684
+ next : "qstring",
1685
+ merge : true
1686
+ }, {
1687
+ token : "string",
1688
+ regex : "'|$",
1689
+ next : "start",
1690
+ merge : true
1691
+ }
1692
+ ]
1693
+ };
1694
+
1695
+ this.embedRules(DocCommentHighlightRules, "doc-",
1696
+ [ DocCommentHighlightRules.getEndRule("start") ]);
1697
+ };
1698
+
1699
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1700
+
1701
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1702
+ });
1703
+ /* ***** BEGIN LICENSE BLOCK *****
1704
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1705
+ *
1706
+ * The contents of this file are subject to the Mozilla Public License Version
1707
+ * 1.1 (the "License"); you may not use this file except in compliance with
1708
+ * the License. You may obtain a copy of the License at
1709
+ * http://www.mozilla.org/MPL/
1710
+ *
1711
+ * Software distributed under the License is distributed on an "AS IS" basis,
1712
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1713
+ * for the specific language governing rights and limitations under the
1714
+ * License.
1715
+ *
1716
+ * The Original Code is Ajax.org Code Editor (ACE).
1717
+ *
1718
+ * The Initial Developer of the Original Code is
1719
+ * Ajax.org B.V.
1720
+ * Portions created by the Initial Developer are Copyright (C) 2010
1721
+ * the Initial Developer. All Rights Reserved.
1722
+ *
1723
+ * Contributor(s):
1724
+ * Fabian Jakobs <fabian AT ajax DOT org>
1725
+ *
1726
+ * Alternatively, the contents of this file may be used under the terms of
1727
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1728
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1729
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1730
+ * of those above. If you wish to allow use of your version of this file only
1731
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1732
+ * use your version of this file under the terms of the MPL, indicate your
1733
+ * decision by deleting the provisions above and replace them with the notice
1734
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1735
+ * the provisions above, a recipient may use your version of this file under
1736
+ * the terms of any one of the MPL, the GPL or the LGPL.
1737
+ *
1738
+ * ***** END LICENSE BLOCK ***** */
1739
+
1740
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1741
+ "use strict";
1742
+
1743
+ var oop = require("../lib/oop");
1744
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1745
+
1746
+ var DocCommentHighlightRules = function() {
1747
+
1748
+ this.$rules = {
1749
+ "start" : [ {
1750
+ token : "comment.doc.tag",
1751
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
1752
+ }, {
1753
+ token : "comment.doc",
1754
+ merge : true,
1755
+ regex : "\\s+"
1756
+ }, {
1757
+ token : "comment.doc",
1758
+ merge : true,
1759
+ regex : "TODO"
1760
+ }, {
1761
+ token : "comment.doc",
1762
+ merge : true,
1763
+ regex : "[^@\\*]+"
1764
+ }, {
1765
+ token : "comment.doc",
1766
+ merge : true,
1767
+ regex : "."
1768
+ }]
1769
+ };
1770
+ };
1771
+
1772
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
1773
+
1774
+ DocCommentHighlightRules.getStartRule = function(start) {
1775
+ return {
1776
+ token : "comment.doc", // doc comment
1777
+ merge : true,
1778
+ regex : "\\/\\*(?=\\*)",
1779
+ next : start
1780
+ };
1781
+ };
1782
+
1783
+ DocCommentHighlightRules.getEndRule = function (start) {
1784
+ return {
1785
+ token : "comment.doc", // closing comment
1786
+ merge : true,
1787
+ regex : "\\*\\/",
1788
+ next : start
1789
+ };
1790
+ };
1791
+
1792
+
1793
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
1794
+
1795
+ });
1796
+ /* ***** BEGIN LICENSE BLOCK *****
1797
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1798
+ *
1799
+ * The contents of this file are subject to the Mozilla Public License Version
1800
+ * 1.1 (the "License"); you may not use this file except in compliance with
1801
+ * the License. You may obtain a copy of the License at
1802
+ * http://www.mozilla.org/MPL/
1803
+ *
1804
+ * Software distributed under the License is distributed on an "AS IS" basis,
1805
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1806
+ * for the specific language governing rights and limitations under the
1807
+ * License.
1808
+ *
1809
+ * The Original Code is Ajax.org Code Editor (ACE).
1810
+ *
1811
+ * The Initial Developer of the Original Code is
1812
+ * Ajax.org B.V.
1813
+ * Portions created by the Initial Developer are Copyright (C) 2010
1814
+ * the Initial Developer. All Rights Reserved.
1815
+ *
1816
+ * Contributor(s):
1817
+ * Fabian Jakobs <fabian AT ajax DOT org>
1818
+ *
1819
+ * Alternatively, the contents of this file may be used under the terms of
1820
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1821
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1822
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1823
+ * of those above. If you wish to allow use of your version of this file only
1824
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1825
+ * use your version of this file under the terms of the MPL, indicate your
1826
+ * decision by deleting the provisions above and replace them with the notice
1827
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1828
+ * the provisions above, a recipient may use your version of this file under
1829
+ * the terms of any one of the MPL, the GPL or the LGPL.
1830
+ *
1831
+ * ***** END LICENSE BLOCK ***** */
1832
+
1833
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1834
+ "use strict";
1835
+
1836
+ var Range = require("../range").Range;
1837
+
1838
+ var MatchingBraceOutdent = function() {};
1839
+
1840
+ (function() {
1841
+
1842
+ this.checkOutdent = function(line, input) {
1843
+ if (! /^\s+$/.test(line))
1844
+ return false;
1845
+
1846
+ return /^\s*\}/.test(input);
1847
+ };
1848
+
1849
+ this.autoOutdent = function(doc, row) {
1850
+ var line = doc.getLine(row);
1851
+ var match = line.match(/^(\s*\})/);
1852
+
1853
+ if (!match) return 0;
1854
+
1855
+ var column = match[1].length;
1856
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
1857
+
1858
+ if (!openBracePos || openBracePos.row == row) return 0;
1859
+
1860
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
1861
+ doc.replace(new Range(row, 0, row, column-1), indent);
1862
+ };
1863
+
1864
+ this.$getIndent = function(line) {
1865
+ var match = line.match(/^(\s+)/);
1866
+ if (match) {
1867
+ return match[1];
1868
+ }
1869
+
1870
+ return "";
1871
+ };
1872
+
1873
+ }).call(MatchingBraceOutdent.prototype);
1874
+
1875
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
1876
+ });
1877
+ /* ***** BEGIN LICENSE BLOCK *****
1878
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1879
+ *
1880
+ * The contents of this file are subject to the Mozilla Public License Version
1881
+ * 1.1 (the "License"); you may not use this file except in compliance with
1882
+ * the License. You may obtain a copy of the License at
1883
+ * http://www.mozilla.org/MPL/
1884
+ *
1885
+ * Software distributed under the License is distributed on an "AS IS" basis,
1886
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1887
+ * for the specific language governing rights and limitations under the
1888
+ * License.
1889
+ *
1890
+ * The Original Code is Ajax.org Code Editor (ACE).
1891
+ *
1892
+ * The Initial Developer of the Original Code is
1893
+ * Ajax.org B.V.
1894
+ * Portions created by the Initial Developer are Copyright (C) 2010
1895
+ * the Initial Developer. All Rights Reserved.
1896
+ *
1897
+ * Contributor(s):
1898
+ * Fabian Jakobs <fabian AT ajax DOT org>
1899
+ *
1900
+ * Alternatively, the contents of this file may be used under the terms of
1901
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1902
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1903
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1904
+ * of those above. If you wish to allow use of your version of this file only
1905
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1906
+ * use your version of this file under the terms of the MPL, indicate your
1907
+ * decision by deleting the provisions above and replace them with the notice
1908
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1909
+ * the provisions above, a recipient may use your version of this file under
1910
+ * the terms of any one of the MPL, the GPL or the LGPL.
1911
+ *
1912
+ * ***** END LICENSE BLOCK ***** */
1913
+
1914
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1915
+ "use strict";
1916
+
1917
+ var oop = require("../../lib/oop");
1918
+ var Range = require("../../range").Range;
1919
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1920
+
1921
+ var FoldMode = exports.FoldMode = function() {};
1922
+ oop.inherits(FoldMode, BaseFoldMode);
1923
+
1924
+ (function() {
1925
+
1926
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1927
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1928
+
1929
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1930
+ var line = session.getLine(row);
1931
+ var match = line.match(this.foldingStartMarker);
1932
+ if (match) {
1933
+ var i = match.index;
1934
+
1935
+ if (match[1])
1936
+ return this.openingBracketBlock(session, match[1], row, i);
1937
+
1938
+ var range = session.getCommentFoldRange(row, i + match[0].length);
1939
+ range.end.column -= 2;
1940
+ return range;
1941
+ }
1942
+
1943
+ if (foldStyle !== "markbeginend")
1944
+ return;
1945
+
1946
+ var match = line.match(this.foldingStopMarker);
1947
+ if (match) {
1948
+ var i = match.index + match[0].length;
1949
+
1950
+ if (match[2]) {
1951
+ var range = session.getCommentFoldRange(row, i);
1952
+ range.end.column -= 2;
1953
+ return range;
1954
+ }
1955
+
1956
+ var end = {row: row, column: i};
1957
+ var start = session.$findOpeningBracket(match[1], end);
1958
+
1959
+ if (!start)
1960
+ return;
1961
+
1962
+ start.column++;
1963
+ end.column--;
1964
+
1965
+ return Range.fromPoints(start, end);
1966
+ }
1967
+ };
1968
+
1969
+ }).call(FoldMode.prototype);
1970
+
1971
+ });
1972
+ /* ***** BEGIN LICENSE BLOCK *****
1973
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1974
+ *
1975
+ * The contents of this file are subject to the Mozilla Public License Version
1976
+ * 1.1 (the "License"); you may not use this file except in compliance with
1977
+ * the License. You may obtain a copy of the License at
1978
+ * http://www.mozilla.org/MPL/
1979
+ *
1980
+ * Software distributed under the License is distributed on an "AS IS" basis,
1981
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1982
+ * for the specific language governing rights and limitations under the
1983
+ * License.
1984
+ *
1985
+ * The Original Code is Ajax.org Code Editor (ACE).
1986
+ *
1987
+ * The Initial Developer of the Original Code is
1988
+ * Ajax.org B.V.
1989
+ * Portions created by the Initial Developer are Copyright (C) 2010
1990
+ * the Initial Developer. All Rights Reserved.
1991
+ *
1992
+ * Contributor(s):
1993
+ * Fabian Jakobs <fabian AT ajax DOT org>
1994
+ *
1995
+ * Alternatively, the contents of this file may be used under the terms of
1996
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1997
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1998
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1999
+ * of those above. If you wish to allow use of your version of this file only
2000
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2001
+ * use your version of this file under the terms of the MPL, indicate your
2002
+ * decision by deleting the provisions above and replace them with the notice
2003
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2004
+ * the provisions above, a recipient may use your version of this file under
2005
+ * the terms of any one of the MPL, the GPL or the LGPL.
2006
+ *
2007
+ * ***** END LICENSE BLOCK ***** */
2008
+
2009
+ 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/folding/cstyle'], function(require, exports, module) {
2010
+ "use strict";
2011
+
2012
+ var oop = require("../lib/oop");
2013
+ var TextMode = require("./text").Mode;
2014
+ var Tokenizer = require("../tokenizer").Tokenizer;
2015
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2016
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
2017
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
2018
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
2019
+
2020
+ var Mode = function() {
2021
+ this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules(), "i");
2022
+ this.$outdent = new MatchingBraceOutdent();
2023
+ this.foldingRules = new CStyleFoldMode();
2024
+ };
2025
+ oop.inherits(Mode, TextMode);
2026
+
2027
+ (function() {
2028
+
2029
+ this.foldingRules = "cStyle";
2030
+
2031
+ this.getNextLineIndent = function(state, line, tab) {
2032
+ var indent = this.$getIndent(line);
2033
+
2034
+ // ignore braces in comments
2035
+ var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
2036
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
2037
+ return indent;
2038
+ }
2039
+
2040
+ var match = line.match(/^.*\{\s*$/);
2041
+ if (match) {
2042
+ indent += tab;
2043
+ }
2044
+
2045
+ return indent;
2046
+ };
2047
+
2048
+ this.checkOutdent = function(state, line, input) {
2049
+ return this.$outdent.checkOutdent(line, input);
2050
+ };
2051
+
2052
+ this.autoOutdent = function(state, doc, row) {
2053
+ this.$outdent.autoOutdent(doc, row);
2054
+ };
2055
+
2056
+ this.createWorker = function(session) {
2057
+ var worker = new WorkerClient(["ace"], "worker-css.js", "ace/mode/css_worker", "Worker");
2058
+ worker.attachToDocument(session.getDocument());
2059
+
2060
+ worker.on("csslint", function(e) {
2061
+ var errors = [];
2062
+ e.data.forEach(function(message) {
2063
+ errors.push({
2064
+ row: message.line - 1,
2065
+ column: message.col - 1,
2066
+ text: message.message,
2067
+ type: message.type,
2068
+ lint: message
2069
+ });
2070
+ });
2071
+
2072
+ session.setAnnotations(errors);
2073
+ });
2074
+ return worker;
2075
+ };
2076
+
2077
+ }).call(Mode.prototype);
2078
+
2079
+ exports.Mode = Mode;
2080
+
2081
+ });
2082
+ /* ***** BEGIN LICENSE BLOCK *****
2083
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2084
+ *
2085
+ * The contents of this file are subject to the Mozilla Public License Version
2086
+ * 1.1 (the "License"); you may not use this file except in compliance with
2087
+ * the License. You may obtain a copy of the License at
2088
+ * http://www.mozilla.org/MPL/
2089
+ *
2090
+ * Software distributed under the License is distributed on an "AS IS" basis,
2091
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2092
+ * for the specific language governing rights and limitations under the
2093
+ * License.
2094
+ *
2095
+ * The Original Code is Ajax.org Code Editor (ACE).
2096
+ *
2097
+ * The Initial Developer of the Original Code is
2098
+ * Ajax.org B.V.
2099
+ * Portions created by the Initial Developer are Copyright (C) 2010
2100
+ * the Initial Developer. All Rights Reserved.
2101
+ *
2102
+ * Contributor(s):
2103
+ * Fabian Jakobs <fabian AT ajax DOT org>
2104
+ *
2105
+ * Alternatively, the contents of this file may be used under the terms of
2106
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2107
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2108
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2109
+ * of those above. If you wish to allow use of your version of this file only
2110
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2111
+ * use your version of this file under the terms of the MPL, indicate your
2112
+ * decision by deleting the provisions above and replace them with the notice
2113
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2114
+ * the provisions above, a recipient may use your version of this file under
2115
+ * the terms of any one of the MPL, the GPL or the LGPL.
2116
+ *
2117
+ * ***** END LICENSE BLOCK ***** */
2118
+
2119
+ define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
2120
+ "use strict";
2121
+
2122
+ var oop = require("../lib/oop");
2123
+ var lang = require("../lib/lang");
2124
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2125
+
2126
+ var CssHighlightRules = function() {
2127
+
2128
+ var properties = lang.arrayToMap(
2129
+ ("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|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").split("|")
2130
+ );
2131
+
2132
+ var functions = lang.arrayToMap(
2133
+ ("rgb|rgba|url|attr|counter|counters").split("|")
2134
+ );
2135
+
2136
+ var constants = lang.arrayToMap(
2137
+ ("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|font-size|font|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|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
2138
+ );
2139
+
2140
+ var colors = lang.arrayToMap(
2141
+ ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
2142
+ "purple|red|silver|teal|white|yellow").split("|")
2143
+ );
2144
+
2145
+ var fonts = lang.arrayToMap(
2146
+ ("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
2147
+ "symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
2148
+ "serif|monospace").split("|")
2149
+ );
2150
+
2151
+ // regexp must not have capturing parentheses. Use (?:) instead.
2152
+ // regexps are ordered -> the first match is used
2153
+
2154
+ var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
2155
+ var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
2156
+ var 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";
2157
+
2158
+ var base_ruleset = [
2159
+ {
2160
+ token : "comment", // multi line comment
2161
+ merge : true,
2162
+ regex : "\\/\\*",
2163
+ next : "ruleset_comment"
2164
+ }, {
2165
+ token : "string", // single line
2166
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
2167
+ }, {
2168
+ token : "string", // single line
2169
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
2170
+ }, {
2171
+ token : ["constant.numeric", "keyword"],
2172
+ 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|%)"
2173
+ }, {
2174
+ token : ["constant.numeric"],
2175
+ regex : "([0-9]+)"
2176
+ }, {
2177
+ token : "constant.numeric", // hex6 color
2178
+ regex : "#[a-f0-9]{6}"
2179
+ }, {
2180
+ token : "constant.numeric", // hex3 color
2181
+ regex : "#[a-f0-9]{3}"
2182
+ }, {
2183
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
2184
+ regex : pseudoElements
2185
+ }, {
2186
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
2187
+ regex : pseudoClasses
2188
+ }, {
2189
+ token : function(value) {
2190
+ if (properties.hasOwnProperty(value.toLowerCase())) {
2191
+ return "support.type";
2192
+ }
2193
+ else if (functions.hasOwnProperty(value.toLowerCase())) {
2194
+ return "support.function";
2195
+ }
2196
+ else if (constants.hasOwnProperty(value.toLowerCase())) {
2197
+ return "support.constant";
2198
+ }
2199
+ else if (colors.hasOwnProperty(value.toLowerCase())) {
2200
+ return "support.constant.color";
2201
+ }
2202
+ else if (fonts.hasOwnProperty(value.toLowerCase())) {
2203
+ return "support.constant.fonts";
2204
+ }
2205
+ else {
2206
+ return "text";
2207
+ }
2208
+ },
2209
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
2210
+ }
2211
+ ];
2212
+
2213
+ var ruleset = lang.copyArray(base_ruleset);
2214
+ ruleset.unshift({
2215
+ token : "paren.rparen",
2216
+ regex : "\\}",
2217
+ next: "start"
2218
+ });
2219
+
2220
+ var media_ruleset = lang.copyArray( base_ruleset );
2221
+ media_ruleset.unshift({
2222
+ token : "paren.rparen",
2223
+ regex : "\\}",
2224
+ next: "media"
2225
+ });
2226
+
2227
+ var base_comment = [{
2228
+ token : "comment", // comment spanning whole line
2229
+ merge : true,
2230
+ regex : ".+"
2231
+ }];
2232
+
2233
+ var comment = lang.copyArray(base_comment);
2234
+ comment.unshift({
2235
+ token : "comment", // closing comment
2236
+ regex : ".*?\\*\\/",
2237
+ next : "start"
2238
+ });
2239
+
2240
+ var media_comment = lang.copyArray(base_comment);
2241
+ media_comment.unshift({
2242
+ token : "comment", // closing comment
2243
+ regex : ".*?\\*\\/",
2244
+ next : "media"
2245
+ });
2246
+
2247
+ var ruleset_comment = lang.copyArray(base_comment);
2248
+ ruleset_comment.unshift({
2249
+ token : "comment", // closing comment
2250
+ regex : ".*?\\*\\/",
2251
+ next : "ruleset"
2252
+ });
2253
+
2254
+ this.$rules = {
2255
+ "start" : [{
2256
+ token : "comment", // multi line comment
2257
+ merge : true,
2258
+ regex : "\\/\\*",
2259
+ next : "comment"
2260
+ }, {
2261
+ token: "paren.lparen",
2262
+ regex: "\\{",
2263
+ next: "ruleset"
2264
+ }, {
2265
+ token: "string",
2266
+ regex: "@.*?{",
2267
+ next: "media"
2268
+ },{
2269
+ token: "keyword",
2270
+ regex: "#[a-z0-9-_]+"
2271
+ },{
2272
+ token: "variable",
2273
+ regex: "\\.[a-z0-9-_]+"
2274
+ },{
2275
+ token: "string",
2276
+ regex: ":[a-z0-9-_]+"
2277
+ },{
2278
+ token: "constant",
2279
+ regex: "[a-z0-9-_]+"
2280
+ }],
2281
+
2282
+ "media" : [ {
2283
+ token : "comment", // multi line comment
2284
+ merge : true,
2285
+ regex : "\\/\\*",
2286
+ next : "media_comment"
2287
+ }, {
2288
+ token: "paren.lparen",
2289
+ regex: "\\{",
2290
+ next: "media_ruleset"
2291
+ },{
2292
+ token: "string",
2293
+ regex: "\\}",
2294
+ next: "start"
2295
+ },{
2296
+ token: "keyword",
2297
+ regex: "#[a-z0-9-_]+"
2298
+ },{
2299
+ token: "variable",
2300
+ regex: "\\.[a-z0-9-_]+"
2301
+ },{
2302
+ token: "string",
2303
+ regex: ":[a-z0-9-_]+"
2304
+ },{
2305
+ token: "constant",
2306
+ regex: "[a-z0-9-_]+"
2307
+ }],
2308
+
2309
+ "comment" : comment,
2310
+
2311
+ "ruleset" : ruleset,
2312
+ "ruleset_comment" : ruleset_comment,
2313
+
2314
+ "media_ruleset" : media_ruleset,
2315
+ "media_comment" : media_comment
2316
+ };
2317
+ };
2318
+
2319
+ oop.inherits(CssHighlightRules, TextHighlightRules);
2320
+
2321
+ exports.CssHighlightRules = CssHighlightRules;
2322
+
2323
+ });
2324
+ /* ***** BEGIN LICENSE BLOCK *****
2325
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2326
+ *
2327
+ * The contents of this file are subject to the Mozilla Public License Version
2328
+ * 1.1 (the "License"); you may not use this file except in compliance with
2329
+ * the License. You may obtain a copy of the License at
2330
+ * http://www.mozilla.org/MPL/
2331
+ *
2332
+ * Software distributed under the License is distributed on an "AS IS" basis,
2333
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2334
+ * for the specific language governing rights and limitations under the
2335
+ * License.
2336
+ *
2337
+ * The Original Code is Ajax.org Code Editor (ACE).
2338
+ *
2339
+ * The Initial Developer of the Original Code is
2340
+ * Ajax.org B.V.
2341
+ * Portions created by the Initial Developer are Copyright (C) 2010
2342
+ * the Initial Developer. All Rights Reserved.
2343
+ *
2344
+ * Contributor(s):
2345
+ * Fabian Jakobs <fabian AT ajax DOT org>
2346
+ *
2347
+ * Alternatively, the contents of this file may be used under the terms of
2348
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2349
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2350
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2351
+ * of those above. If you wish to allow use of your version of this file only
2352
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2353
+ * use your version of this file under the terms of the MPL, indicate your
2354
+ * decision by deleting the provisions above and replace them with the notice
2355
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2356
+ * the provisions above, a recipient may use your version of this file under
2357
+ * the terms of any one of the MPL, the GPL or the LGPL.
2358
+ *
2359
+ * ***** END LICENSE BLOCK ***** */
2360
+
2361
+ define('ace/mode/coldfusion_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/text_highlight_rules', 'ace/mode/xml_util'], function(require, exports, module) {
2362
+ "use strict";
2363
+
2364
+ var oop = require("../lib/oop");
2365
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2366
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
2367
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2368
+ var xml_util = require("./xml_util");
2369
+
2370
+ var ColdfusionHighlightRules = function() {
2371
+
2372
+ // regexp must not have capturing parentheses
2373
+ // regexps are ordered -> the first match is used
2374
+
2375
+ this.$rules = {
2376
+ start : [ {
2377
+ token : "text",
2378
+ merge : true,
2379
+ regex : "<\\!\\[CDATA\\[",
2380
+ next : "cdata"
2381
+ }, {
2382
+ token : "xml_pe",
2383
+ regex : "<\\?.*?\\?>"
2384
+ }, {
2385
+ token : "comment",
2386
+ merge : true,
2387
+ regex : "<\\!--",
2388
+ next : "comment"
2389
+ }, {
2390
+ token : "meta.tag",
2391
+ regex : "<(?=\s*script)",
2392
+ next : "script"
2393
+ }, {
2394
+ token : "meta.tag",
2395
+ regex : "<(?=\s*style)",
2396
+ next : "style"
2397
+ }, {
2398
+ token : "meta.tag", // opening tag
2399
+ regex : "<\\/?",
2400
+ next : "tag"
2401
+ }, {
2402
+ token : "text",
2403
+ regex : "\\s+"
2404
+ }, {
2405
+ token : "text",
2406
+ regex : "[^<]+"
2407
+ } ],
2408
+
2409
+ cdata : [ {
2410
+ token : "text",
2411
+ regex : "\\]\\]>",
2412
+ next : "start"
2413
+ }, {
2414
+ token : "text",
2415
+ merge : true,
2416
+ regex : "\\s+"
2417
+ }, {
2418
+ token : "text",
2419
+ merge : true,
2420
+ regex : ".+"
2421
+ } ],
2422
+
2423
+ comment : [ {
2424
+ token : "comment",
2425
+ regex : ".*?-->",
2426
+ next : "start"
2427
+ }, {
2428
+ token : "comment",
2429
+ merge : true,
2430
+ regex : ".+"
2431
+ } ]
2432
+ };
2433
+
2434
+ xml_util.tag(this.$rules, "tag", "start");
2435
+ xml_util.tag(this.$rules, "style", "css-start");
2436
+ xml_util.tag(this.$rules, "script", "js-start");
2437
+
2438
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
2439
+ token: "comment",
2440
+ regex: "\\/\\/.*(?=<\\/script>)",
2441
+ next: "tag"
2442
+ }, {
2443
+ token: "meta.tag",
2444
+ regex: "<\\/(?=script)",
2445
+ next: "tag"
2446
+ }]);
2447
+
2448
+ this.embedRules(CssHighlightRules, "css-", [{
2449
+ token: "meta.tag",
2450
+ regex: "<\\/(?=style)",
2451
+ next: "tag"
2452
+ }]);
2453
+ };
2454
+
2455
+ oop.inherits(ColdfusionHighlightRules, TextHighlightRules);
2456
+
2457
+ exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
2458
+ });