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,1226 @@
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/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) {
39
+ "use strict";
40
+
41
+ var oop = require("../lib/oop");
42
+ var TextMode = require("./text").Mode;
43
+ var Tokenizer = require("../tokenizer").Tokenizer;
44
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
45
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
46
+ var Range = require("../range").Range;
47
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
48
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
49
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
50
+
51
+ var Mode = function() {
52
+ this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
53
+ this.$outdent = new MatchingBraceOutdent();
54
+ this.$behaviour = new CstyleBehaviour();
55
+ this.foldingRules = new CStyleFoldMode();
56
+ };
57
+ oop.inherits(Mode, TextMode);
58
+
59
+ (function() {
60
+
61
+
62
+ this.toggleCommentLines = function(state, doc, startRow, endRow) {
63
+ var outdent = true;
64
+ var re = /^(\s*)\/\//;
65
+
66
+ for (var i=startRow; i<= endRow; i++) {
67
+ if (!re.test(doc.getLine(i))) {
68
+ outdent = false;
69
+ break;
70
+ }
71
+ }
72
+
73
+ if (outdent) {
74
+ var deleteRange = new Range(0, 0, 0, 0);
75
+ for (var i=startRow; i<= endRow; i++)
76
+ {
77
+ var line = doc.getLine(i);
78
+ var m = line.match(re);
79
+ deleteRange.start.row = i;
80
+ deleteRange.end.row = i;
81
+ deleteRange.end.column = m[0].length;
82
+ doc.replace(deleteRange, m[1]);
83
+ }
84
+ }
85
+ else {
86
+ doc.indentRows(startRow, endRow, "//");
87
+ }
88
+ };
89
+
90
+ this.getNextLineIndent = function(state, line, tab) {
91
+ var indent = this.$getIndent(line);
92
+
93
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
94
+ var tokens = tokenizedLine.tokens;
95
+ var endState = tokenizedLine.state;
96
+
97
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
98
+ return indent;
99
+ }
100
+
101
+ if (state == "start" || state == "regex_allowed") {
102
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
103
+ if (match) {
104
+ indent += tab;
105
+ }
106
+ } else if (state == "doc-start") {
107
+ if (endState == "start" || state == "regex_allowed") {
108
+ return "";
109
+ }
110
+ var match = line.match(/^\s*(\/?)\*/);
111
+ if (match) {
112
+ if (match[1]) {
113
+ indent += " ";
114
+ }
115
+ indent += "* ";
116
+ }
117
+ }
118
+
119
+ return indent;
120
+ };
121
+
122
+ this.checkOutdent = function(state, line, input) {
123
+ return this.$outdent.checkOutdent(line, input);
124
+ };
125
+
126
+ this.autoOutdent = function(state, doc, row) {
127
+ this.$outdent.autoOutdent(doc, row);
128
+ };
129
+
130
+ this.createWorker = function(session) {
131
+ var worker = new WorkerClient(["ace"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
132
+ worker.attachToDocument(session.getDocument());
133
+
134
+ worker.on("jslint", function(results) {
135
+ var errors = [];
136
+ for (var i=0; i<results.data.length; i++) {
137
+ var error = results.data[i];
138
+ if (error)
139
+ errors.push({
140
+ row: error.line-1,
141
+ column: error.character-1,
142
+ text: error.reason,
143
+ type: "warning",
144
+ lint: error
145
+ });
146
+ }
147
+ session.setAnnotations(errors);
148
+ });
149
+
150
+ worker.on("narcissus", function(e) {
151
+ session.setAnnotations([e.data]);
152
+ });
153
+
154
+ worker.on("terminate", function() {
155
+ session.clearAnnotations();
156
+ });
157
+
158
+ return worker;
159
+ };
160
+
161
+ }).call(Mode.prototype);
162
+
163
+ exports.Mode = Mode;
164
+ });
165
+ /* ***** BEGIN LICENSE BLOCK *****
166
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
167
+ *
168
+ * The contents of this file are subject to the Mozilla Public License Version
169
+ * 1.1 (the "License"); you may not use this file except in compliance with
170
+ * the License. You may obtain a copy of the License at
171
+ * http://www.mozilla.org/MPL/
172
+ *
173
+ * Software distributed under the License is distributed on an "AS IS" basis,
174
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
175
+ * for the specific language governing rights and limitations under the
176
+ * License.
177
+ *
178
+ * The Original Code is Ajax.org Code Editor (ACE).
179
+ *
180
+ * The Initial Developer of the Original Code is
181
+ * Ajax.org B.V.
182
+ * Portions created by the Initial Developer are Copyright (C) 2010
183
+ * the Initial Developer. All Rights Reserved.
184
+ *
185
+ * Contributor(s):
186
+ * Fabian Jakobs <fabian AT ajax DOT org>
187
+ * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
188
+ *
189
+ * Alternatively, the contents of this file may be used under the terms of
190
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
191
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
192
+ * in which case the provisions of the GPL or the LGPL are applicable instead
193
+ * of those above. If you wish to allow use of your version of this file only
194
+ * under the terms of either the GPL or the LGPL, and not to allow others to
195
+ * use your version of this file under the terms of the MPL, indicate your
196
+ * decision by deleting the provisions above and replace them with the notice
197
+ * and other provisions required by the GPL or the LGPL. If you do not delete
198
+ * the provisions above, a recipient may use your version of this file under
199
+ * the terms of any one of the MPL, the GPL or the LGPL.
200
+ *
201
+ * ***** END LICENSE BLOCK ***** */
202
+
203
+ 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) {
204
+ "use strict";
205
+
206
+ var oop = require("../lib/oop");
207
+ var lang = require("../lib/lang");
208
+ var unicode = require("../unicode");
209
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
210
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
211
+
212
+ var JavaScriptHighlightRules = function() {
213
+
214
+ // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
215
+ var globals = lang.arrayToMap(
216
+ // Constructors
217
+ ("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" +
218
+ // E4X
219
+ "Namespace|QName|XML|XMLList|" +
220
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
221
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
222
+ // Errors
223
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
224
+ "SyntaxError|TypeError|URIError|" +
225
+ // Non-constructor functions
226
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
227
+ "isNaN|parseFloat|parseInt|" +
228
+ // Other
229
+ "JSON|Math|" +
230
+ // Pseudo
231
+ "this|arguments|prototype|window|document"
232
+ ).split("|")
233
+ );
234
+
235
+ var keywords = lang.arrayToMap(
236
+ ("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
237
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
238
+ "const|yield|import|get|set").split("|")
239
+ );
240
+
241
+ // keywords which can be followed by regular expressions
242
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
243
+
244
+ var deprecated = lang.arrayToMap(
245
+ ("__parent__|__count__|escape|unescape|with|__proto__").split("|")
246
+ );
247
+
248
+ var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
249
+
250
+ var buildinConstants = lang.arrayToMap(
251
+ ("null|Infinity|NaN|undefined").split("|")
252
+ );
253
+
254
+ var futureReserved = lang.arrayToMap(
255
+ ("class|enum|extends|super|export|implements|private|" +
256
+ "public|interface|package|protected|static").split("|")
257
+ );
258
+
259
+ // TODO: Unicode escape sequences
260
+ var identifierRe = "[" + unicode.packages.L + "\\$_]["
261
+ + unicode.packages.L
262
+ + unicode.packages.Mn + unicode.packages.Mc
263
+ + unicode.packages.Nd
264
+ + unicode.packages.Pc + "\\$_]*\\b";
265
+
266
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
267
+ "u[0-9a-fA-F]{4}|" + // unicode
268
+ "[0-2][0-7]{0,2}|" + // oct
269
+ "3[0-6][0-7]?|" + // oct
270
+ "37[0-7]?|" + // oct
271
+ "[4-7][0-7]?|" + //oct
272
+ ".)";
273
+
274
+ // regexp must not have capturing parentheses. Use (?:) instead.
275
+ // regexps are ordered -> the first match is used
276
+
277
+ this.$rules = {
278
+ "start" : [
279
+ {
280
+ token : "comment",
281
+ regex : /\/\/.*$/
282
+ },
283
+ DocCommentHighlightRules.getStartRule("doc-start"),
284
+ {
285
+ token : "comment", // multi line comment
286
+ merge : true,
287
+ regex : /\/\*/,
288
+ next : "comment"
289
+ }, {
290
+ token : "string",
291
+ regex : "'(?=.)",
292
+ next : "qstring"
293
+ }, {
294
+ token : "string",
295
+ regex : '"(?=.)',
296
+ next : "qqstring"
297
+ }, {
298
+ token : "constant.numeric", // hex
299
+ regex : /0[xX][0-9a-fA-F]+\b/
300
+ }, {
301
+ token : "constant.numeric", // float
302
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
303
+ }, { // match stuff like: Sound.prototype.play = function() { }
304
+ token : [
305
+ "storage.type",
306
+ "punctuation.operator",
307
+ "support.function",
308
+ "punctuation.operator",
309
+ "entity.name.function",
310
+ "text",
311
+ "keyword.operator",
312
+ "text",
313
+ "storage.type",
314
+ "text",
315
+ "paren.lparen"
316
+ ],
317
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
318
+ next: "function_arguments"
319
+ }, { // match stuff like: Sound.prototype.play = myfunc
320
+ token : [
321
+ "storage.type",
322
+ "punctuation.operator",
323
+ "support.function",
324
+ "punctuation.operator",
325
+ "entity.name.function",
326
+ "text",
327
+ "keyword.operator",
328
+ "text"
329
+ ],
330
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
331
+ next: "function_arguments"
332
+ }, { // match stuff like: Sound.play = function() { }
333
+ token : [
334
+ "storage.type",
335
+ "punctuation.operator",
336
+ "entity.name.function",
337
+ "text",
338
+ "keyword.operator",
339
+ "text",
340
+ "storage.type",
341
+ "text",
342
+ "paren.lparen"
343
+ ],
344
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
345
+ next: "function_arguments"
346
+ }, { // match stuff like: play = function() { }
347
+ token : [
348
+ "entity.name.function",
349
+ "text",
350
+ "keyword.operator",
351
+ "text",
352
+ "storage.type",
353
+ "text",
354
+ "paren.lparen"
355
+ ],
356
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
357
+ next: "function_arguments"
358
+ }, { // match regular function like: function myFunc(arg) { }
359
+ token : [
360
+ "storage.type",
361
+ "text",
362
+ "entity.name.function",
363
+ "text",
364
+ "paren.lparen"
365
+ ],
366
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
367
+ next: "function_arguments"
368
+ }, { // match stuff like: foobar: function() { }
369
+ token : [
370
+ "entity.name.function",
371
+ "text",
372
+ "punctuation.operator",
373
+ "text",
374
+ "storage.type",
375
+ "text",
376
+ "paren.lparen"
377
+ ],
378
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
379
+ next: "function_arguments"
380
+ }, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
381
+ token : [
382
+ "text",
383
+ "text",
384
+ "storage.type",
385
+ "text",
386
+ "paren.lparen"
387
+ ],
388
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
389
+ next: "function_arguments"
390
+ }, {
391
+ token : "constant.language.boolean",
392
+ regex : /(?:true|false)\b/
393
+ }, {
394
+ token : "keyword",
395
+ regex : "(?:" + kwBeforeRe + ")\\b",
396
+ next : "regex_allowed"
397
+ }, {
398
+ token : ["punctuation.operator", "support.function"],
399
+ 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(?=\()/
400
+ }, {
401
+ token : ["punctuation.operator", "support.function.dom"],
402
+ 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(?=\()/
403
+ }, {
404
+ token : ["punctuation.operator", "support.constant"],
405
+ 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/
406
+ }, {
407
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
408
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
409
+ }, {
410
+ token : function(value) {
411
+ if (globals.hasOwnProperty(value))
412
+ return "variable.language";
413
+ else if (deprecated.hasOwnProperty(value))
414
+ return "invalid.deprecated";
415
+ else if (definitions.hasOwnProperty(value))
416
+ return "storage.type";
417
+ else if (keywords.hasOwnProperty(value))
418
+ return "keyword";
419
+ else if (buildinConstants.hasOwnProperty(value))
420
+ return "constant.language";
421
+ else if (futureReserved.hasOwnProperty(value))
422
+ return "invalid.illegal";
423
+ else if (value == "debugger")
424
+ return "invalid.deprecated";
425
+ else
426
+ return "identifier";
427
+ },
428
+ regex : identifierRe
429
+ }, {
430
+ token : "keyword.operator",
431
+ regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
432
+ next : "regex_allowed"
433
+ }, {
434
+ token : "punctuation.operator",
435
+ regex : /\?|\:|\,|\;|\./,
436
+ next : "regex_allowed"
437
+ }, {
438
+ token : "paren.lparen",
439
+ regex : /[\[({]/,
440
+ next : "regex_allowed"
441
+ }, {
442
+ token : "paren.rparen",
443
+ regex : /[\])}]/
444
+ }, {
445
+ token : "keyword.operator",
446
+ regex : /\/=?/,
447
+ next : "regex_allowed"
448
+ }, {
449
+ token: "comment",
450
+ regex: /^#!.*$/
451
+ }, {
452
+ token : "text",
453
+ regex : /\s+/
454
+ }
455
+ ],
456
+ // regular expressions are only allowed after certain tokens. This
457
+ // makes sure we don't mix up regexps with the divison operator
458
+ "regex_allowed": [
459
+ DocCommentHighlightRules.getStartRule("doc-start"),
460
+ {
461
+ token : "comment", // multi line comment
462
+ merge : true,
463
+ regex : "\\/\\*",
464
+ next : "comment_regex_allowed"
465
+ }, {
466
+ token : "comment",
467
+ regex : "\\/\\/.*$"
468
+ }, {
469
+ token: "string.regexp",
470
+ regex: "\\/",
471
+ next: "regex",
472
+ merge: true
473
+ }, {
474
+ token : "text",
475
+ regex : "\\s+"
476
+ }, {
477
+ // immediately return to the start mode without matching
478
+ // anything
479
+ token: "empty",
480
+ regex: "",
481
+ next: "start"
482
+ }
483
+ ],
484
+ "regex": [
485
+ {
486
+ token: "regexp.keyword.operator",
487
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
488
+ }, {
489
+ // flag
490
+ token: "string.regexp",
491
+ regex: "/\\w*",
492
+ next: "start",
493
+ merge: true
494
+ }, {
495
+ token: "string.regexp",
496
+ regex: "[^\\\\/\\[]+",
497
+ merge: true
498
+ }, {
499
+ token: "string.regexp.charachterclass",
500
+ regex: "\\[",
501
+ next: "regex_character_class",
502
+ merge: true
503
+ }, {
504
+ token: "empty",
505
+ regex: "",
506
+ next: "start"
507
+ }
508
+ ],
509
+ "regex_character_class": [
510
+ {
511
+ token: "regexp.keyword.operator",
512
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
513
+ }, {
514
+ token: "string.regexp.charachterclass",
515
+ regex: "]",
516
+ next: "regex",
517
+ merge: true
518
+ }, {
519
+ token: "string.regexp.charachterclass",
520
+ regex: "[^\\\\\\]]+",
521
+ merge: true
522
+ }, {
523
+ token: "empty",
524
+ regex: "",
525
+ next: "start"
526
+ }
527
+ ],
528
+ "function_arguments": [
529
+ {
530
+ token: "variable.parameter",
531
+ regex: identifierRe,
532
+ }, {
533
+ token: "punctuation.operator",
534
+ regex: "[, ]+",
535
+ merge: true
536
+ }, {
537
+ token: "punctuation.operator",
538
+ regex: "$",
539
+ merge: true
540
+ }, {
541
+ token: "empty",
542
+ regex: "",
543
+ next: "start"
544
+ }
545
+ ],
546
+ "comment_regex_allowed" : [
547
+ {
548
+ token : "comment", // closing comment
549
+ regex : ".*?\\*\\/",
550
+ merge : true,
551
+ next : "regex_allowed"
552
+ }, {
553
+ token : "comment", // comment spanning whole line
554
+ merge : true,
555
+ regex : ".+"
556
+ }
557
+ ],
558
+ "comment" : [
559
+ {
560
+ token : "comment", // closing comment
561
+ regex : ".*?\\*\\/",
562
+ merge : true,
563
+ next : "start"
564
+ }, {
565
+ token : "comment", // comment spanning whole line
566
+ merge : true,
567
+ regex : ".+"
568
+ }
569
+ ],
570
+ "qqstring" : [
571
+ {
572
+ token : "constant.language.escape",
573
+ regex : escapedRe
574
+ }, {
575
+ token : "string",
576
+ regex : '[^"\\\\]+',
577
+ merge : true
578
+ }, {
579
+ token : "string",
580
+ regex : "\\\\$",
581
+ next : "qqstring",
582
+ merge : true
583
+ }, {
584
+ token : "string",
585
+ regex : '"|$',
586
+ next : "start",
587
+ merge : true
588
+ }
589
+ ],
590
+ "qstring" : [
591
+ {
592
+ token : "constant.language.escape",
593
+ regex : escapedRe
594
+ }, {
595
+ token : "string",
596
+ regex : "[^'\\\\]+",
597
+ merge : true
598
+ }, {
599
+ token : "string",
600
+ regex : "\\\\$",
601
+ next : "qstring",
602
+ merge : true
603
+ }, {
604
+ token : "string",
605
+ regex : "'|$",
606
+ next : "start",
607
+ merge : true
608
+ }
609
+ ]
610
+ };
611
+
612
+ this.embedRules(DocCommentHighlightRules, "doc-",
613
+ [ DocCommentHighlightRules.getEndRule("start") ]);
614
+ };
615
+
616
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
617
+
618
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
619
+ });
620
+ /* ***** BEGIN LICENSE BLOCK *****
621
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
622
+ *
623
+ * The contents of this file are subject to the Mozilla Public License Version
624
+ * 1.1 (the "License"); you may not use this file except in compliance with
625
+ * the License. You may obtain a copy of the License at
626
+ * http://www.mozilla.org/MPL/
627
+ *
628
+ * Software distributed under the License is distributed on an "AS IS" basis,
629
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
630
+ * for the specific language governing rights and limitations under the
631
+ * License.
632
+ *
633
+ * The Original Code is Ajax.org Code Editor (ACE).
634
+ *
635
+ * The Initial Developer of the Original Code is
636
+ * Ajax.org B.V.
637
+ * Portions created by the Initial Developer are Copyright (C) 2010
638
+ * the Initial Developer. All Rights Reserved.
639
+ *
640
+ * Contributor(s):
641
+ * Fabian Jakobs <fabian AT ajax DOT org>
642
+ *
643
+ * Alternatively, the contents of this file may be used under the terms of
644
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
645
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
646
+ * in which case the provisions of the GPL or the LGPL are applicable instead
647
+ * of those above. If you wish to allow use of your version of this file only
648
+ * under the terms of either the GPL or the LGPL, and not to allow others to
649
+ * use your version of this file under the terms of the MPL, indicate your
650
+ * decision by deleting the provisions above and replace them with the notice
651
+ * and other provisions required by the GPL or the LGPL. If you do not delete
652
+ * the provisions above, a recipient may use your version of this file under
653
+ * the terms of any one of the MPL, the GPL or the LGPL.
654
+ *
655
+ * ***** END LICENSE BLOCK ***** */
656
+
657
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
658
+ "use strict";
659
+
660
+ var oop = require("../lib/oop");
661
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
662
+
663
+ var DocCommentHighlightRules = function() {
664
+
665
+ this.$rules = {
666
+ "start" : [ {
667
+ token : "comment.doc.tag",
668
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
669
+ }, {
670
+ token : "comment.doc",
671
+ merge : true,
672
+ regex : "\\s+"
673
+ }, {
674
+ token : "comment.doc",
675
+ merge : true,
676
+ regex : "TODO"
677
+ }, {
678
+ token : "comment.doc",
679
+ merge : true,
680
+ regex : "[^@\\*]+"
681
+ }, {
682
+ token : "comment.doc",
683
+ merge : true,
684
+ regex : "."
685
+ }]
686
+ };
687
+ };
688
+
689
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
690
+
691
+ DocCommentHighlightRules.getStartRule = function(start) {
692
+ return {
693
+ token : "comment.doc", // doc comment
694
+ merge : true,
695
+ regex : "\\/\\*(?=\\*)",
696
+ next : start
697
+ };
698
+ };
699
+
700
+ DocCommentHighlightRules.getEndRule = function (start) {
701
+ return {
702
+ token : "comment.doc", // closing comment
703
+ merge : true,
704
+ regex : "\\*\\/",
705
+ next : start
706
+ };
707
+ };
708
+
709
+
710
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
711
+
712
+ });
713
+ /* ***** BEGIN LICENSE BLOCK *****
714
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
715
+ *
716
+ * The contents of this file are subject to the Mozilla Public License Version
717
+ * 1.1 (the "License"); you may not use this file except in compliance with
718
+ * the License. You may obtain a copy of the License at
719
+ * http://www.mozilla.org/MPL/
720
+ *
721
+ * Software distributed under the License is distributed on an "AS IS" basis,
722
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
723
+ * for the specific language governing rights and limitations under the
724
+ * License.
725
+ *
726
+ * The Original Code is Ajax.org Code Editor (ACE).
727
+ *
728
+ * The Initial Developer of the Original Code is
729
+ * Ajax.org B.V.
730
+ * Portions created by the Initial Developer are Copyright (C) 2010
731
+ * the Initial Developer. All Rights Reserved.
732
+ *
733
+ * Contributor(s):
734
+ * Fabian Jakobs <fabian AT ajax DOT org>
735
+ *
736
+ * Alternatively, the contents of this file may be used under the terms of
737
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
738
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
739
+ * in which case the provisions of the GPL or the LGPL are applicable instead
740
+ * of those above. If you wish to allow use of your version of this file only
741
+ * under the terms of either the GPL or the LGPL, and not to allow others to
742
+ * use your version of this file under the terms of the MPL, indicate your
743
+ * decision by deleting the provisions above and replace them with the notice
744
+ * and other provisions required by the GPL or the LGPL. If you do not delete
745
+ * the provisions above, a recipient may use your version of this file under
746
+ * the terms of any one of the MPL, the GPL or the LGPL.
747
+ *
748
+ * ***** END LICENSE BLOCK ***** */
749
+
750
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
751
+ "use strict";
752
+
753
+ var Range = require("../range").Range;
754
+
755
+ var MatchingBraceOutdent = function() {};
756
+
757
+ (function() {
758
+
759
+ this.checkOutdent = function(line, input) {
760
+ if (! /^\s+$/.test(line))
761
+ return false;
762
+
763
+ return /^\s*\}/.test(input);
764
+ };
765
+
766
+ this.autoOutdent = function(doc, row) {
767
+ var line = doc.getLine(row);
768
+ var match = line.match(/^(\s*\})/);
769
+
770
+ if (!match) return 0;
771
+
772
+ var column = match[1].length;
773
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
774
+
775
+ if (!openBracePos || openBracePos.row == row) return 0;
776
+
777
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
778
+ doc.replace(new Range(row, 0, row, column-1), indent);
779
+ };
780
+
781
+ this.$getIndent = function(line) {
782
+ var match = line.match(/^(\s+)/);
783
+ if (match) {
784
+ return match[1];
785
+ }
786
+
787
+ return "";
788
+ };
789
+
790
+ }).call(MatchingBraceOutdent.prototype);
791
+
792
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
793
+ });
794
+ /* vim:ts=4:sts=4:sw=4:
795
+ * ***** BEGIN LICENSE BLOCK *****
796
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
797
+ *
798
+ * The contents of this file are subject to the Mozilla Public License Version
799
+ * 1.1 (the "License"); you may not use this file except in compliance with
800
+ * the License. You may obtain a copy of the License at
801
+ * http://www.mozilla.org/MPL/
802
+ *
803
+ * Software distributed under the License is distributed on an "AS IS" basis,
804
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
805
+ * for the specific language governing rights and limitations under the
806
+ * License.
807
+ *
808
+ * The Original Code is Ajax.org Code Editor (ACE).
809
+ *
810
+ * The Initial Developer of the Original Code is
811
+ * Ajax.org B.V.
812
+ * Portions created by the Initial Developer are Copyright (C) 2010
813
+ * the Initial Developer. All Rights Reserved.
814
+ *
815
+ * Contributor(s):
816
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
817
+ *
818
+ * Alternatively, the contents of this file may be used under the terms of
819
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
820
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
821
+ * in which case the provisions of the GPL or the LGPL are applicable instead
822
+ * of those above. If you wish to allow use of your version of this file only
823
+ * under the terms of either the GPL or the LGPL, and not to allow others to
824
+ * use your version of this file under the terms of the MPL, indicate your
825
+ * decision by deleting the provisions above and replace them with the notice
826
+ * and other provisions required by the GPL or the LGPL. If you do not delete
827
+ * the provisions above, a recipient may use your version of this file under
828
+ * the terms of any one of the MPL, the GPL or the LGPL.
829
+ *
830
+ * ***** END LICENSE BLOCK ***** */
831
+
832
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
833
+ "use strict";
834
+
835
+ var oop = require("../../lib/oop");
836
+ var Behaviour = require('../behaviour').Behaviour;
837
+
838
+ var CstyleBehaviour = function () {
839
+
840
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
841
+ if (text == '{') {
842
+ var selection = editor.getSelectionRange();
843
+ var selected = session.doc.getTextRange(selection);
844
+ if (selected !== "") {
845
+ return {
846
+ text: '{' + selected + '}',
847
+ selection: false
848
+ };
849
+ } else {
850
+ return {
851
+ text: '{}',
852
+ selection: [1, 1]
853
+ };
854
+ }
855
+ } else if (text == '}') {
856
+ var cursor = editor.getCursorPosition();
857
+ var line = session.doc.getLine(cursor.row);
858
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
859
+ if (rightChar == '}') {
860
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
861
+ if (matching !== null) {
862
+ return {
863
+ text: '',
864
+ selection: [1, 1]
865
+ };
866
+ }
867
+ }
868
+ } else if (text == "\n") {
869
+ var cursor = editor.getCursorPosition();
870
+ var line = session.doc.getLine(cursor.row);
871
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
872
+ if (rightChar == '}') {
873
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
874
+ if (!openBracePos)
875
+ return null;
876
+
877
+ var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
878
+ var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
879
+
880
+ return {
881
+ text: '\n' + indent + '\n' + next_indent,
882
+ selection: [1, indent.length, 1, indent.length]
883
+ };
884
+ }
885
+ }
886
+ });
887
+
888
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
889
+ var selected = session.doc.getTextRange(range);
890
+ if (!range.isMultiLine() && selected == '{') {
891
+ var line = session.doc.getLine(range.start.row);
892
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
893
+ if (rightChar == '}') {
894
+ range.end.column++;
895
+ return range;
896
+ }
897
+ }
898
+ });
899
+
900
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
901
+ if (text == '(') {
902
+ var selection = editor.getSelectionRange();
903
+ var selected = session.doc.getTextRange(selection);
904
+ if (selected !== "") {
905
+ return {
906
+ text: '(' + selected + ')',
907
+ selection: false
908
+ };
909
+ } else {
910
+ return {
911
+ text: '()',
912
+ selection: [1, 1]
913
+ };
914
+ }
915
+ } else if (text == ')') {
916
+ var cursor = editor.getCursorPosition();
917
+ var line = session.doc.getLine(cursor.row);
918
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
919
+ if (rightChar == ')') {
920
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
921
+ if (matching !== null) {
922
+ return {
923
+ text: '',
924
+ selection: [1, 1]
925
+ };
926
+ }
927
+ }
928
+ }
929
+ });
930
+
931
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
932
+ var selected = session.doc.getTextRange(range);
933
+ if (!range.isMultiLine() && selected == '(') {
934
+ var line = session.doc.getLine(range.start.row);
935
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
936
+ if (rightChar == ')') {
937
+ range.end.column++;
938
+ return range;
939
+ }
940
+ }
941
+ });
942
+
943
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
944
+ if (text == '"' || text == "'") {
945
+ var quote = text;
946
+ var selection = editor.getSelectionRange();
947
+ var selected = session.doc.getTextRange(selection);
948
+ if (selected !== "") {
949
+ return {
950
+ text: quote + selected + quote,
951
+ selection: false
952
+ };
953
+ } else {
954
+ var cursor = editor.getCursorPosition();
955
+ var line = session.doc.getLine(cursor.row);
956
+ var leftChar = line.substring(cursor.column-1, cursor.column);
957
+
958
+ // We're escaped.
959
+ if (leftChar == '\\') {
960
+ return null;
961
+ }
962
+
963
+ // Find what token we're inside.
964
+ var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
965
+ var col = 0, token;
966
+ var quotepos = -1; // Track whether we're inside an open quote.
967
+
968
+ for (var x = 0; x < tokens.length; x++) {
969
+ token = tokens[x];
970
+ if (token.type == "string") {
971
+ quotepos = -1;
972
+ } else if (quotepos < 0) {
973
+ quotepos = token.value.indexOf(quote);
974
+ }
975
+ if ((token.value.length + col) > selection.start.column) {
976
+ break;
977
+ }
978
+ col += tokens[x].value.length;
979
+ }
980
+
981
+ // Try and be smart about when we auto insert.
982
+ 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)))) {
983
+ return {
984
+ text: quote + quote,
985
+ selection: [1,1]
986
+ };
987
+ } else if (token && token.type === "string") {
988
+ // Ignore input and move right one if we're typing over the closing quote.
989
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
990
+ if (rightChar == quote) {
991
+ return {
992
+ text: '',
993
+ selection: [1, 1]
994
+ };
995
+ }
996
+ }
997
+ }
998
+ }
999
+ });
1000
+
1001
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
1002
+ var selected = session.doc.getTextRange(range);
1003
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1004
+ var line = session.doc.getLine(range.start.row);
1005
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1006
+ if (rightChar == '"') {
1007
+ range.end.column++;
1008
+ return range;
1009
+ }
1010
+ }
1011
+ });
1012
+
1013
+ };
1014
+
1015
+ oop.inherits(CstyleBehaviour, Behaviour);
1016
+
1017
+ exports.CstyleBehaviour = CstyleBehaviour;
1018
+ });
1019
+ /* ***** BEGIN LICENSE BLOCK *****
1020
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1021
+ *
1022
+ * The contents of this file are subject to the Mozilla Public License Version
1023
+ * 1.1 (the "License"); you may not use this file except in compliance with
1024
+ * the License. You may obtain a copy of the License at
1025
+ * http://www.mozilla.org/MPL/
1026
+ *
1027
+ * Software distributed under the License is distributed on an "AS IS" basis,
1028
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1029
+ * for the specific language governing rights and limitations under the
1030
+ * License.
1031
+ *
1032
+ * The Original Code is Ajax.org Code Editor (ACE).
1033
+ *
1034
+ * The Initial Developer of the Original Code is
1035
+ * Ajax.org B.V.
1036
+ * Portions created by the Initial Developer are Copyright (C) 2010
1037
+ * the Initial Developer. All Rights Reserved.
1038
+ *
1039
+ * Contributor(s):
1040
+ * Fabian Jakobs <fabian AT ajax DOT org>
1041
+ *
1042
+ * Alternatively, the contents of this file may be used under the terms of
1043
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1044
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1045
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1046
+ * of those above. If you wish to allow use of your version of this file only
1047
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1048
+ * use your version of this file under the terms of the MPL, indicate your
1049
+ * decision by deleting the provisions above and replace them with the notice
1050
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1051
+ * the provisions above, a recipient may use your version of this file under
1052
+ * the terms of any one of the MPL, the GPL or the LGPL.
1053
+ *
1054
+ * ***** END LICENSE BLOCK ***** */
1055
+
1056
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1057
+ "use strict";
1058
+
1059
+ var oop = require("../../lib/oop");
1060
+ var Range = require("../../range").Range;
1061
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1062
+
1063
+ var FoldMode = exports.FoldMode = function() {};
1064
+ oop.inherits(FoldMode, BaseFoldMode);
1065
+
1066
+ (function() {
1067
+
1068
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1069
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1070
+
1071
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1072
+ var line = session.getLine(row);
1073
+ var match = line.match(this.foldingStartMarker);
1074
+ if (match) {
1075
+ var i = match.index;
1076
+
1077
+ if (match[1])
1078
+ return this.openingBracketBlock(session, match[1], row, i);
1079
+
1080
+ var range = session.getCommentFoldRange(row, i + match[0].length);
1081
+ range.end.column -= 2;
1082
+ return range;
1083
+ }
1084
+
1085
+ if (foldStyle !== "markbeginend")
1086
+ return;
1087
+
1088
+ var match = line.match(this.foldingStopMarker);
1089
+ if (match) {
1090
+ var i = match.index + match[0].length;
1091
+
1092
+ if (match[2]) {
1093
+ var range = session.getCommentFoldRange(row, i);
1094
+ range.end.column -= 2;
1095
+ return range;
1096
+ }
1097
+
1098
+ var end = {row: row, column: i};
1099
+ var start = session.$findOpeningBracket(match[1], end);
1100
+
1101
+ if (!start)
1102
+ return;
1103
+
1104
+ start.column++;
1105
+ end.column--;
1106
+
1107
+ return Range.fromPoints(start, end);
1108
+ }
1109
+ };
1110
+
1111
+ }).call(FoldMode.prototype);
1112
+
1113
+ });
1114
+ /* ***** BEGIN LICENSE BLOCK *****
1115
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1116
+ *
1117
+ * The contents of this file are subject to the Mozilla Public License Version
1118
+ * 1.1 (the "License"); you may not use this file except in compliance with
1119
+ * the License. You may obtain a copy of the License at
1120
+ * http://www.mozilla.org/MPL/
1121
+ *
1122
+ * Software distributed under the License is distributed on an "AS IS" basis,
1123
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1124
+ * for the specific language governing rights and limitations under the
1125
+ * License.
1126
+ *
1127
+ * The Original Code is Ajax.org Code Editor (ACE).
1128
+ *
1129
+ * The Initial Developer of the Original Code is
1130
+ * Ajax.org B.V.
1131
+ * Portions created by the Initial Developer are Copyright (C) 2010
1132
+ * the Initial Developer. All Rights Reserved.
1133
+ *
1134
+ * Contributor(s):
1135
+ * Fabian Jakobs <fabian AT ajax DOT org>
1136
+ *
1137
+ * Alternatively, the contents of this file may be used under the terms of
1138
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1139
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1140
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1141
+ * of those above. If you wish to allow use of your version of this file only
1142
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1143
+ * use your version of this file under the terms of the MPL, indicate your
1144
+ * decision by deleting the provisions above and replace them with the notice
1145
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1146
+ * the provisions above, a recipient may use your version of this file under
1147
+ * the terms of any one of the MPL, the GPL or the LGPL.
1148
+ *
1149
+ * ***** END LICENSE BLOCK ***** */
1150
+
1151
+ define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1152
+ "use strict";
1153
+
1154
+ var Range = require("../../range").Range;
1155
+
1156
+ var FoldMode = exports.FoldMode = function() {};
1157
+
1158
+ (function() {
1159
+
1160
+ this.foldingStartMarker = null;
1161
+ this.foldingStopMarker = null;
1162
+
1163
+ // must return "" if there's no fold, to enable caching
1164
+ this.getFoldWidget = function(session, foldStyle, row) {
1165
+ var line = session.getLine(row);
1166
+ if (this.foldingStartMarker.test(line))
1167
+ return "start";
1168
+ if (foldStyle == "markbeginend"
1169
+ && this.foldingStopMarker
1170
+ && this.foldingStopMarker.test(line))
1171
+ return "end";
1172
+ return "";
1173
+ };
1174
+
1175
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1176
+ return null;
1177
+ };
1178
+
1179
+ this.indentationBlock = function(session, row, column) {
1180
+ var re = /^\s*/;
1181
+ var startRow = row;
1182
+ var endRow = row;
1183
+ var line = session.getLine(row);
1184
+ var startColumn = column || line.length;
1185
+ var startLevel = line.match(re)[0].length;
1186
+ var maxRow = session.getLength()
1187
+
1188
+ while (++row < maxRow) {
1189
+ line = session.getLine(row);
1190
+ var level = line.match(re)[0].length;
1191
+
1192
+ if (level == line.length)
1193
+ continue;
1194
+
1195
+ if (level <= startLevel)
1196
+ break;
1197
+
1198
+ endRow = row;
1199
+ }
1200
+
1201
+ if (endRow > startRow) {
1202
+ var endColumn = session.getLine(endRow).length;
1203
+ return new Range(startRow, startColumn, endRow, endColumn);
1204
+ }
1205
+ };
1206
+
1207
+ this.openingBracketBlock = function(session, bracket, row, column) {
1208
+ var start = {row: row, column: column + 1};
1209
+ var end = session.$findClosingBracket(bracket, start);
1210
+ if (!end)
1211
+ return;
1212
+
1213
+ var fw = session.foldWidgets[end.row];
1214
+ if (fw == null)
1215
+ fw = this.getFoldWidget(session, end.row);
1216
+
1217
+ if (fw == "start") {
1218
+ end.row --;
1219
+ end.column = session.getLine(end.row).length;
1220
+ }
1221
+ return Range.fromPoints(start, end);
1222
+ };
1223
+
1224
+ }).call(FoldMode.prototype);
1225
+
1226
+ });