aced_rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. data/.gitignore +17 -0
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +22 -0
  5. data/README.md +49 -0
  6. data/Rakefile +2 -0
  7. data/aced_rails.gemspec +19 -0
  8. data/lib/aced_rails.rb +7 -0
  9. data/lib/aced_rails/engine.rb +4 -0
  10. data/lib/aced_rails/version.rb +3 -0
  11. data/vendor/assets/javascripts/ace/ace-compat-noconflict.js +1 -0
  12. data/vendor/assets/javascripts/ace/ace-compat-uncompressed-noconflict.js +480 -0
  13. data/vendor/assets/javascripts/ace/ace-compat-uncompressed.js +480 -0
  14. data/vendor/assets/javascripts/ace/ace-compat.js +1 -0
  15. data/vendor/assets/javascripts/ace/ace-noconflict.js +10 -0
  16. data/vendor/assets/javascripts/ace/ace-uncompressed-noconflict.js +14649 -0
  17. data/vendor/assets/javascripts/ace/ace-uncompressed.js +14649 -0
  18. data/vendor/assets/javascripts/ace/ace.js +10 -0
  19. data/vendor/assets/javascripts/ace/keybinding-emacs-noconflict.js +1 -0
  20. data/vendor/assets/javascripts/ace/keybinding-emacs-uncompressed-noconflict.js +405 -0
  21. data/vendor/assets/javascripts/ace/keybinding-emacs-uncompressed.js +405 -0
  22. data/vendor/assets/javascripts/ace/keybinding-emacs.js +1 -0
  23. data/vendor/assets/javascripts/ace/keybinding-vim-noconflict.js +1 -0
  24. data/vendor/assets/javascripts/ace/keybinding-vim-uncompressed-noconflict.js +393 -0
  25. data/vendor/assets/javascripts/ace/keybinding-vim-uncompressed.js +393 -0
  26. data/vendor/assets/javascripts/ace/keybinding-vim.js +1 -0
  27. data/vendor/assets/javascripts/ace/mode-c_cpp-noconflict.js +1 -0
  28. data/vendor/assets/javascripts/ace/mode-c_cpp-uncompressed-noconflict.js +918 -0
  29. data/vendor/assets/javascripts/ace/mode-c_cpp-uncompressed.js +918 -0
  30. data/vendor/assets/javascripts/ace/mode-c_cpp.js +1 -0
  31. data/vendor/assets/javascripts/ace/mode-clojure-noconflict.js +1 -0
  32. data/vendor/assets/javascripts/ace/mode-clojure-uncompressed-noconflict.js +422 -0
  33. data/vendor/assets/javascripts/ace/mode-clojure-uncompressed.js +422 -0
  34. data/vendor/assets/javascripts/ace/mode-clojure.js +1 -0
  35. data/vendor/assets/javascripts/ace/mode-coffee-noconflict.js +1 -0
  36. data/vendor/assets/javascripts/ace/mode-coffee-uncompressed-noconflict.js +605 -0
  37. data/vendor/assets/javascripts/ace/mode-coffee-uncompressed.js +605 -0
  38. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -0
  39. data/vendor/assets/javascripts/ace/mode-coldfusion-noconflict.js +1 -0
  40. data/vendor/assets/javascripts/ace/mode-coldfusion-uncompressed-noconflict.js +2361 -0
  41. data/vendor/assets/javascripts/ace/mode-coldfusion-uncompressed.js +2361 -0
  42. data/vendor/assets/javascripts/ace/mode-coldfusion.js +1 -0
  43. data/vendor/assets/javascripts/ace/mode-csharp-noconflict.js +1 -0
  44. data/vendor/assets/javascripts/ace/mode-csharp-uncompressed-noconflict.js +768 -0
  45. data/vendor/assets/javascripts/ace/mode-csharp-uncompressed.js +768 -0
  46. data/vendor/assets/javascripts/ace/mode-csharp.js +1 -0
  47. data/vendor/assets/javascripts/ace/mode-css-noconflict.js +1 -0
  48. data/vendor/assets/javascripts/ace/mode-css-uncompressed-noconflict.js +664 -0
  49. data/vendor/assets/javascripts/ace/mode-css-uncompressed.js +664 -0
  50. data/vendor/assets/javascripts/ace/mode-css.js +1 -0
  51. data/vendor/assets/javascripts/ace/mode-groovy-noconflict.js +1 -0
  52. data/vendor/assets/javascripts/ace/mode-groovy-uncompressed-noconflict.js +1280 -0
  53. data/vendor/assets/javascripts/ace/mode-groovy-uncompressed.js +1280 -0
  54. data/vendor/assets/javascripts/ace/mode-groovy.js +1 -0
  55. data/vendor/assets/javascripts/ace/mode-haxe-noconflict.js +1 -0
  56. data/vendor/assets/javascripts/ace/mode-haxe-uncompressed-noconflict.js +768 -0
  57. data/vendor/assets/javascripts/ace/mode-haxe-uncompressed.js +768 -0
  58. data/vendor/assets/javascripts/ace/mode-haxe.js +1 -0
  59. data/vendor/assets/javascripts/ace/mode-html-noconflict.js +1 -0
  60. data/vendor/assets/javascripts/ace/mode-html-uncompressed-noconflict.js +2377 -0
  61. data/vendor/assets/javascripts/ace/mode-html-uncompressed.js +2377 -0
  62. data/vendor/assets/javascripts/ace/mode-html.js +1 -0
  63. data/vendor/assets/javascripts/ace/mode-java-noconflict.js +1 -0
  64. data/vendor/assets/javascripts/ace/mode-java-uncompressed-noconflict.js +1282 -0
  65. data/vendor/assets/javascripts/ace/mode-java-uncompressed.js +1282 -0
  66. data/vendor/assets/javascripts/ace/mode-java.js +1 -0
  67. data/vendor/assets/javascripts/ace/mode-javascript-noconflict.js +1 -0
  68. data/vendor/assets/javascripts/ace/mode-javascript-uncompressed-noconflict.js +1113 -0
  69. data/vendor/assets/javascripts/ace/mode-javascript-uncompressed.js +1113 -0
  70. data/vendor/assets/javascripts/ace/mode-javascript.js +1 -0
  71. data/vendor/assets/javascripts/ace/mode-json-noconflict.js +1 -0
  72. data/vendor/assets/javascripts/ace/mode-json-uncompressed-noconflict.js +696 -0
  73. data/vendor/assets/javascripts/ace/mode-json-uncompressed.js +696 -0
  74. data/vendor/assets/javascripts/ace/mode-json.js +1 -0
  75. data/vendor/assets/javascripts/ace/mode-latex-noconflict.js +1 -0
  76. data/vendor/assets/javascripts/ace/mode-latex-uncompressed-noconflict.js +95 -0
  77. data/vendor/assets/javascripts/ace/mode-latex-uncompressed.js +95 -0
  78. data/vendor/assets/javascripts/ace/mode-latex.js +1 -0
  79. data/vendor/assets/javascripts/ace/mode-lua-noconflict.js +1 -0
  80. data/vendor/assets/javascripts/ace/mode-lua-uncompressed-noconflict.js +523 -0
  81. data/vendor/assets/javascripts/ace/mode-lua-uncompressed.js +523 -0
  82. data/vendor/assets/javascripts/ace/mode-lua.js +1 -0
  83. data/vendor/assets/javascripts/ace/mode-markdown-noconflict.js +1 -0
  84. data/vendor/assets/javascripts/ace/mode-markdown-uncompressed-noconflict.js +2819 -0
  85. data/vendor/assets/javascripts/ace/mode-markdown-uncompressed.js +2819 -0
  86. data/vendor/assets/javascripts/ace/mode-markdown.js +1 -0
  87. data/vendor/assets/javascripts/ace/mode-ocaml-noconflict.js +1 -0
  88. data/vendor/assets/javascripts/ace/mode-ocaml-uncompressed-noconflict.js +539 -0
  89. data/vendor/assets/javascripts/ace/mode-ocaml-uncompressed.js +539 -0
  90. data/vendor/assets/javascripts/ace/mode-ocaml.js +1 -0
  91. data/vendor/assets/javascripts/ace/mode-perl-noconflict.js +1 -0
  92. data/vendor/assets/javascripts/ace/mode-perl-uncompressed-noconflict.js +573 -0
  93. data/vendor/assets/javascripts/ace/mode-perl-uncompressed.js +573 -0
  94. data/vendor/assets/javascripts/ace/mode-perl.js +1 -0
  95. data/vendor/assets/javascripts/ace/mode-pgsql-noconflict.js +1 -0
  96. data/vendor/assets/javascripts/ace/mode-pgsql-uncompressed-noconflict.js +1107 -0
  97. data/vendor/assets/javascripts/ace/mode-pgsql-uncompressed.js +1107 -0
  98. data/vendor/assets/javascripts/ace/mode-pgsql.js +1 -0
  99. data/vendor/assets/javascripts/ace/mode-php-noconflict.js +1 -0
  100. data/vendor/assets/javascripts/ace/mode-php-uncompressed-noconflict.js +1884 -0
  101. data/vendor/assets/javascripts/ace/mode-php-uncompressed.js +1884 -0
  102. data/vendor/assets/javascripts/ace/mode-php.js +1 -0
  103. data/vendor/assets/javascripts/ace/mode-powershell-noconflict.js +1 -0
  104. data/vendor/assets/javascripts/ace/mode-powershell-uncompressed-noconflict.js +706 -0
  105. data/vendor/assets/javascripts/ace/mode-powershell-uncompressed.js +706 -0
  106. data/vendor/assets/javascripts/ace/mode-powershell.js +1 -0
  107. data/vendor/assets/javascripts/ace/mode-python-noconflict.js +1 -0
  108. data/vendor/assets/javascripts/ace/mode-python-uncompressed-noconflict.js +506 -0
  109. data/vendor/assets/javascripts/ace/mode-python-uncompressed.js +506 -0
  110. data/vendor/assets/javascripts/ace/mode-python.js +1 -0
  111. data/vendor/assets/javascripts/ace/mode-ruby-noconflict.js +1 -0
  112. data/vendor/assets/javascripts/ace/mode-ruby-uncompressed-noconflict.js +391 -0
  113. data/vendor/assets/javascripts/ace/mode-ruby-uncompressed.js +391 -0
  114. data/vendor/assets/javascripts/ace/mode-ruby.js +1 -0
  115. data/vendor/assets/javascripts/ace/mode-scad-noconflict.js +1 -0
  116. data/vendor/assets/javascripts/ace/mode-scad-uncompressed-noconflict.js +906 -0
  117. data/vendor/assets/javascripts/ace/mode-scad-uncompressed.js +906 -0
  118. data/vendor/assets/javascripts/ace/mode-scad.js +1 -0
  119. data/vendor/assets/javascripts/ace/mode-scala-noconflict.js +1 -0
  120. data/vendor/assets/javascripts/ace/mode-scala-uncompressed-noconflict.js +1282 -0
  121. data/vendor/assets/javascripts/ace/mode-scala-uncompressed.js +1282 -0
  122. data/vendor/assets/javascripts/ace/mode-scala.js +1 -0
  123. data/vendor/assets/javascripts/ace/mode-scss-noconflict.js +1 -0
  124. data/vendor/assets/javascripts/ace/mode-scss-uncompressed-noconflict.js +678 -0
  125. data/vendor/assets/javascripts/ace/mode-scss-uncompressed.js +678 -0
  126. data/vendor/assets/javascripts/ace/mode-scss.js +1 -0
  127. data/vendor/assets/javascripts/ace/mode-sh-noconflict.js +1 -0
  128. data/vendor/assets/javascripts/ace/mode-sh-uncompressed-noconflict.js +268 -0
  129. data/vendor/assets/javascripts/ace/mode-sh-uncompressed.js +268 -0
  130. data/vendor/assets/javascripts/ace/mode-sh.js +1 -0
  131. data/vendor/assets/javascripts/ace/mode-sql-noconflict.js +1 -0
  132. data/vendor/assets/javascripts/ace/mode-sql-uncompressed-noconflict.js +159 -0
  133. data/vendor/assets/javascripts/ace/mode-sql-uncompressed.js +159 -0
  134. data/vendor/assets/javascripts/ace/mode-sql.js +1 -0
  135. data/vendor/assets/javascripts/ace/mode-svg-noconflict.js +1 -0
  136. data/vendor/assets/javascripts/ace/mode-svg-uncompressed-noconflict.js +2016 -0
  137. data/vendor/assets/javascripts/ace/mode-svg-uncompressed.js +2016 -0
  138. data/vendor/assets/javascripts/ace/mode-svg.js +1 -0
  139. data/vendor/assets/javascripts/ace/mode-text-noconflict.js +0 -0
  140. data/vendor/assets/javascripts/ace/mode-text-uncompressed-noconflict.js +0 -0
  141. data/vendor/assets/javascripts/ace/mode-text-uncompressed.js +0 -0
  142. data/vendor/assets/javascripts/ace/mode-text.js +0 -0
  143. data/vendor/assets/javascripts/ace/mode-textile-noconflict.js +1 -0
  144. data/vendor/assets/javascripts/ace/mode-textile-uncompressed-noconflict.js +254 -0
  145. data/vendor/assets/javascripts/ace/mode-textile-uncompressed.js +254 -0
  146. data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
  147. data/vendor/assets/javascripts/ace/mode-xml-noconflict.js +1 -0
  148. data/vendor/assets/javascripts/ace/mode-xml-uncompressed-noconflict.js +1001 -0
  149. data/vendor/assets/javascripts/ace/mode-xml-uncompressed.js +1001 -0
  150. data/vendor/assets/javascripts/ace/mode-xml.js +1 -0
  151. data/vendor/assets/javascripts/ace/theme-chrome-noconflict.js +1 -0
  152. data/vendor/assets/javascripts/ace/theme-chrome-uncompressed-noconflict.js +212 -0
  153. data/vendor/assets/javascripts/ace/theme-chrome-uncompressed.js +212 -0
  154. data/vendor/assets/javascripts/ace/theme-chrome.js +1 -0
  155. data/vendor/assets/javascripts/ace/theme-clouds-noconflict.js +1 -0
  156. data/vendor/assets/javascripts/ace/theme-clouds-uncompressed-noconflict.js +155 -0
  157. data/vendor/assets/javascripts/ace/theme-clouds-uncompressed.js +155 -0
  158. data/vendor/assets/javascripts/ace/theme-clouds.js +1 -0
  159. data/vendor/assets/javascripts/ace/theme-clouds_midnight-noconflict.js +1 -0
  160. data/vendor/assets/javascripts/ace/theme-clouds_midnight-uncompressed-noconflict.js +156 -0
  161. data/vendor/assets/javascripts/ace/theme-clouds_midnight-uncompressed.js +156 -0
  162. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -0
  163. data/vendor/assets/javascripts/ace/theme-cobalt-noconflict.js +1 -0
  164. data/vendor/assets/javascripts/ace/theme-cobalt-uncompressed-noconflict.js +170 -0
  165. data/vendor/assets/javascripts/ace/theme-cobalt-uncompressed.js +170 -0
  166. data/vendor/assets/javascripts/ace/theme-cobalt.js +1 -0
  167. data/vendor/assets/javascripts/ace/theme-crimson_editor-noconflict.js +1 -0
  168. data/vendor/assets/javascripts/ace/theme-crimson_editor-uncompressed-noconflict.js +198 -0
  169. data/vendor/assets/javascripts/ace/theme-crimson_editor-uncompressed.js +198 -0
  170. data/vendor/assets/javascripts/ace/theme-crimson_editor.js +1 -0
  171. data/vendor/assets/javascripts/ace/theme-dawn-noconflict.js +1 -0
  172. data/vendor/assets/javascripts/ace/theme-dawn-uncompressed-noconflict.js +174 -0
  173. data/vendor/assets/javascripts/ace/theme-dawn-uncompressed.js +174 -0
  174. data/vendor/assets/javascripts/ace/theme-dawn.js +1 -0
  175. data/vendor/assets/javascripts/ace/theme-dreamweaver-noconflict.js +1 -0
  176. data/vendor/assets/javascripts/ace/theme-dreamweaver-uncompressed-noconflict.js +227 -0
  177. data/vendor/assets/javascripts/ace/theme-dreamweaver-uncompressed.js +227 -0
  178. data/vendor/assets/javascripts/ace/theme-dreamweaver.js +1 -0
  179. data/vendor/assets/javascripts/ace/theme-eclipse-noconflict.js +1 -0
  180. data/vendor/assets/javascripts/ace/theme-eclipse-uncompressed-noconflict.js +147 -0
  181. data/vendor/assets/javascripts/ace/theme-eclipse-uncompressed.js +147 -0
  182. data/vendor/assets/javascripts/ace/theme-eclipse.js +1 -0
  183. data/vendor/assets/javascripts/ace/theme-idle_fingers-noconflict.js +1 -0
  184. data/vendor/assets/javascripts/ace/theme-idle_fingers-uncompressed-noconflict.js +162 -0
  185. data/vendor/assets/javascripts/ace/theme-idle_fingers-uncompressed.js +162 -0
  186. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +1 -0
  187. data/vendor/assets/javascripts/ace/theme-kr_theme-noconflict.js +1 -0
  188. data/vendor/assets/javascripts/ace/theme-kr_theme-uncompressed-noconflict.js +165 -0
  189. data/vendor/assets/javascripts/ace/theme-kr_theme-uncompressed.js +165 -0
  190. data/vendor/assets/javascripts/ace/theme-kr_theme.js +1 -0
  191. data/vendor/assets/javascripts/ace/theme-merbivore-noconflict.js +1 -0
  192. data/vendor/assets/javascripts/ace/theme-merbivore-uncompressed-noconflict.js +165 -0
  193. data/vendor/assets/javascripts/ace/theme-merbivore-uncompressed.js +165 -0
  194. data/vendor/assets/javascripts/ace/theme-merbivore.js +1 -0
  195. data/vendor/assets/javascripts/ace/theme-merbivore_soft-noconflict.js +1 -0
  196. data/vendor/assets/javascripts/ace/theme-merbivore_soft-uncompressed-noconflict.js +171 -0
  197. data/vendor/assets/javascripts/ace/theme-merbivore_soft-uncompressed.js +171 -0
  198. data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +1 -0
  199. data/vendor/assets/javascripts/ace/theme-mono_industrial-noconflict.js +1 -0
  200. data/vendor/assets/javascripts/ace/theme-mono_industrial-uncompressed-noconflict.js +169 -0
  201. data/vendor/assets/javascripts/ace/theme-mono_industrial-uncompressed.js +169 -0
  202. data/vendor/assets/javascripts/ace/theme-mono_industrial.js +1 -0
  203. data/vendor/assets/javascripts/ace/theme-monokai-noconflict.js +1 -0
  204. data/vendor/assets/javascripts/ace/theme-monokai-uncompressed-noconflict.js +171 -0
  205. data/vendor/assets/javascripts/ace/theme-monokai-uncompressed.js +171 -0
  206. data/vendor/assets/javascripts/ace/theme-monokai.js +1 -0
  207. data/vendor/assets/javascripts/ace/theme-pastel_on_dark-noconflict.js +1 -0
  208. data/vendor/assets/javascripts/ace/theme-pastel_on_dark-uncompressed-noconflict.js +179 -0
  209. data/vendor/assets/javascripts/ace/theme-pastel_on_dark-uncompressed.js +179 -0
  210. data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +1 -0
  211. data/vendor/assets/javascripts/ace/theme-solarized_dark-noconflict.js +1 -0
  212. data/vendor/assets/javascripts/ace/theme-solarized_dark-uncompressed-noconflict.js +160 -0
  213. data/vendor/assets/javascripts/ace/theme-solarized_dark-uncompressed.js +160 -0
  214. data/vendor/assets/javascripts/ace/theme-solarized_dark.js +1 -0
  215. data/vendor/assets/javascripts/ace/theme-solarized_light-noconflict.js +1 -0
  216. data/vendor/assets/javascripts/ace/theme-solarized_light-uncompressed-noconflict.js +159 -0
  217. data/vendor/assets/javascripts/ace/theme-solarized_light-uncompressed.js +159 -0
  218. data/vendor/assets/javascripts/ace/theme-solarized_light.js +1 -0
  219. data/vendor/assets/javascripts/ace/theme-textmate-noconflict.js +0 -0
  220. data/vendor/assets/javascripts/ace/theme-textmate-uncompressed-noconflict.js +0 -0
  221. data/vendor/assets/javascripts/ace/theme-textmate-uncompressed.js +0 -0
  222. data/vendor/assets/javascripts/ace/theme-textmate.js +0 -0
  223. data/vendor/assets/javascripts/ace/theme-tomorrow-noconflict.js +1 -0
  224. data/vendor/assets/javascripts/ace/theme-tomorrow-uncompressed-noconflict.js +189 -0
  225. data/vendor/assets/javascripts/ace/theme-tomorrow-uncompressed.js +189 -0
  226. data/vendor/assets/javascripts/ace/theme-tomorrow.js +1 -0
  227. data/vendor/assets/javascripts/ace/theme-tomorrow_night-noconflict.js +1 -0
  228. data/vendor/assets/javascripts/ace/theme-tomorrow_night-uncompressed-noconflict.js +189 -0
  229. data/vendor/assets/javascripts/ace/theme-tomorrow_night-uncompressed.js +189 -0
  230. data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +1 -0
  231. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue-noconflict.js +1 -0
  232. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue-uncompressed-noconflict.js +189 -0
  233. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue-uncompressed.js +189 -0
  234. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +1 -0
  235. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright-noconflict.js +1 -0
  236. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright-uncompressed-noconflict.js +189 -0
  237. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright-uncompressed.js +189 -0
  238. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +1 -0
  239. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties-noconflict.js +1 -0
  240. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties-uncompressed-noconflict.js +185 -0
  241. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties-uncompressed.js +185 -0
  242. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +1 -0
  243. data/vendor/assets/javascripts/ace/theme-twilight-noconflict.js +1 -0
  244. data/vendor/assets/javascripts/ace/theme-twilight-uncompressed-noconflict.js +183 -0
  245. data/vendor/assets/javascripts/ace/theme-twilight-uncompressed.js +183 -0
  246. data/vendor/assets/javascripts/ace/theme-twilight.js +1 -0
  247. data/vendor/assets/javascripts/ace/theme-vibrant_ink-noconflict.js +1 -0
  248. data/vendor/assets/javascripts/ace/theme-vibrant_ink-uncompressed-noconflict.js +166 -0
  249. data/vendor/assets/javascripts/ace/theme-vibrant_ink-uncompressed.js +166 -0
  250. data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +1 -0
  251. data/vendor/assets/javascripts/ace/worker-coffee.js +7456 -0
  252. data/vendor/assets/javascripts/ace/worker-css.js +11693 -0
  253. data/vendor/assets/javascripts/ace/worker-javascript.js +10305 -0
  254. data/vendor/assets/javascripts/ace/worker-json.js +3062 -0
  255. metadata +310 -0
@@ -0,0 +1,2016 @@
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/svg', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/svg_highlight_rules', 'ace/mode/folding/mixed', 'ace/mode/folding/xml', 'ace/mode/folding/cstyle'], 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 Tokenizer = require("../tokenizer").Tokenizer;
45
+ var SvgHighlightRules = require("./svg_highlight_rules").SvgHighlightRules;
46
+ var MixedFoldMode = require("./folding/mixed").FoldMode;
47
+ var XmlFoldMode = require("./folding/xml").FoldMode;
48
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
49
+
50
+ var Mode = function() {
51
+ XmlMode.call(this);
52
+
53
+ this.highlighter = new SvgHighlightRules();
54
+ this.$tokenizer = new Tokenizer(this.highlighter.getRules());
55
+
56
+ this.$embeds = this.highlighter.getEmbeds();
57
+ this.createModeDelegates({
58
+ "js-": JavaScriptMode
59
+ });
60
+
61
+ this.foldingRules = new MixedFoldMode(new XmlFoldMode({}), {
62
+ "js-": new CStyleFoldMode()
63
+ });
64
+ };
65
+
66
+ oop.inherits(Mode, XmlMode);
67
+
68
+ (function() {
69
+
70
+ this.getNextLineIndent = function(state, line, tab) {
71
+ return this.$getIndent(line);
72
+ };
73
+
74
+
75
+ }).call(Mode.prototype);
76
+
77
+ exports.Mode = Mode;
78
+ });
79
+ /* ***** BEGIN LICENSE BLOCK *****
80
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
81
+ *
82
+ * The contents of this file are subject to the Mozilla Public License Version
83
+ * 1.1 (the "License"); you may not use this file except in compliance with
84
+ * the License. You may obtain a copy of the License at
85
+ * http://www.mozilla.org/MPL/
86
+ *
87
+ * Software distributed under the License is distributed on an "AS IS" basis,
88
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
89
+ * for the specific language governing rights and limitations under the
90
+ * License.
91
+ *
92
+ * The Original Code is Ajax.org Code Editor (ACE).
93
+ *
94
+ * The Initial Developer of the Original Code is
95
+ * Ajax.org B.V.
96
+ * Portions created by the Initial Developer are Copyright (C) 2010
97
+ * the Initial Developer. All Rights Reserved.
98
+ *
99
+ * Contributor(s):
100
+ * Fabian Jakobs <fabian AT ajax DOT org>
101
+ *
102
+ * Alternatively, the contents of this file may be used under the terms of
103
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
104
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
105
+ * in which case the provisions of the GPL or the LGPL are applicable instead
106
+ * of those above. If you wish to allow use of your version of this file only
107
+ * under the terms of either the GPL or the LGPL, and not to allow others to
108
+ * use your version of this file under the terms of the MPL, indicate your
109
+ * decision by deleting the provisions above and replace them with the notice
110
+ * and other provisions required by the GPL or the LGPL. If you do not delete
111
+ * the provisions above, a recipient may use your version of this file under
112
+ * the terms of any one of the MPL, the GPL or the LGPL.
113
+ *
114
+ * ***** END LICENSE BLOCK ***** */
115
+
116
+ 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) {
117
+ "use strict";
118
+
119
+ var oop = require("../lib/oop");
120
+ var TextMode = require("./text").Mode;
121
+ var Tokenizer = require("../tokenizer").Tokenizer;
122
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
123
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
124
+ var XmlFoldMode = require("./folding/xml").FoldMode;
125
+
126
+ var Mode = function() {
127
+ this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
128
+ this.$behaviour = new XmlBehaviour();
129
+ this.foldingRules = new XmlFoldMode();
130
+ };
131
+
132
+ oop.inherits(Mode, TextMode);
133
+
134
+ (function() {
135
+
136
+ this.getNextLineIndent = function(state, line, tab) {
137
+ return this.$getIndent(line);
138
+ };
139
+
140
+ }).call(Mode.prototype);
141
+
142
+ exports.Mode = Mode;
143
+ });
144
+ /* ***** BEGIN LICENSE BLOCK *****
145
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
146
+ *
147
+ * The contents of this file are subject to the Mozilla Public License Version
148
+ * 1.1 (the "License"); you may not use this file except in compliance with
149
+ * the License. You may obtain a copy of the License at
150
+ * http://www.mozilla.org/MPL/
151
+ *
152
+ * Software distributed under the License is distributed on an "AS IS" basis,
153
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
154
+ * for the specific language governing rights and limitations under the
155
+ * License.
156
+ *
157
+ * The Original Code is Ajax.org Code Editor (ACE).
158
+ *
159
+ * The Initial Developer of the Original Code is
160
+ * Ajax.org B.V.
161
+ * Portions created by the Initial Developer are Copyright (C) 2010
162
+ * the Initial Developer. All Rights Reserved.
163
+ *
164
+ * Contributor(s):
165
+ * Fabian Jakobs <fabian AT ajax DOT org>
166
+ *
167
+ * Alternatively, the contents of this file may be used under the terms of
168
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
169
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
170
+ * in which case the provisions of the GPL or the LGPL are applicable instead
171
+ * of those above. If you wish to allow use of your version of this file only
172
+ * under the terms of either the GPL or the LGPL, and not to allow others to
173
+ * use your version of this file under the terms of the MPL, indicate your
174
+ * decision by deleting the provisions above and replace them with the notice
175
+ * and other provisions required by the GPL or the LGPL. If you do not delete
176
+ * the provisions above, a recipient may use your version of this file under
177
+ * the terms of any one of the MPL, the GPL or the LGPL.
178
+ *
179
+ * ***** END LICENSE BLOCK ***** */
180
+
181
+ 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) {
182
+ "use strict";
183
+
184
+ var oop = require("../lib/oop");
185
+ var xmlUtil = require("./xml_util");
186
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
187
+
188
+ var XmlHighlightRules = function() {
189
+
190
+ // regexp must not have capturing parentheses
191
+ // regexps are ordered -> the first match is used
192
+ this.$rules = {
193
+ start : [{
194
+ token : "text",
195
+ regex : "<\\!\\[CDATA\\[",
196
+ next : "cdata"
197
+ }, {
198
+ token : "xml_pe",
199
+ regex : "<\\?.*?\\?>"
200
+ }, {
201
+ token : "comment",
202
+ merge : true,
203
+ regex : "<\\!--",
204
+ next : "comment"
205
+ }, {
206
+ token : "meta.tag", // opening tag
207
+ regex : "<\\/?",
208
+ next : "tag"
209
+ }, {
210
+ token : "text",
211
+ regex : "\\s+"
212
+ }, {
213
+ token : "text",
214
+ regex : "[^<]+"
215
+ }],
216
+
217
+ cdata : [{
218
+ token : "text",
219
+ regex : "\\]\\]>",
220
+ next : "start"
221
+ }, {
222
+ token : "text",
223
+ regex : "\\s+"
224
+ }, {
225
+ token : "text",
226
+ regex : "(?:[^\\]]|\\](?!\\]>))+"
227
+ }],
228
+
229
+ comment : [{
230
+ token : "comment",
231
+ regex : ".*?-->",
232
+ next : "start"
233
+ }, {
234
+ token : "comment",
235
+ merge : true,
236
+ regex : ".+"
237
+ }]
238
+ };
239
+
240
+ xmlUtil.tag(this.$rules, "tag", "start");
241
+ };
242
+
243
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
244
+
245
+ exports.XmlHighlightRules = XmlHighlightRules;
246
+ });
247
+ /* ***** BEGIN LICENSE BLOCK *****
248
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
249
+ *
250
+ * The contents of this file are subject to the Mozilla Public License Version
251
+ * 1.1 (the "License"); you may not use this file except in compliance with
252
+ * the License. You may obtain a copy of the License at
253
+ * http://www.mozilla.org/MPL/
254
+ *
255
+ * Software distributed under the License is distributed on an "AS IS" basis,
256
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
257
+ * for the specific language governing rights and limitations under the
258
+ * License.
259
+ *
260
+ * The Original Code is Ajax.org Code Editor (ACE).
261
+ *
262
+ * The Initial Developer of the Original Code is
263
+ * Ajax.org B.V.
264
+ * Portions created by the Initial Developer are Copyright (C) 2010
265
+ * the Initial Developer. All Rights Reserved.
266
+ *
267
+ * Contributor(s):
268
+ * Fabian Jakobs <fabian AT ajax DOT org>
269
+ *
270
+ * Alternatively, the contents of this file may be used under the terms of
271
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
272
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
273
+ * in which case the provisions of the GPL or the LGPL are applicable instead
274
+ * of those above. If you wish to allow use of your version of this file only
275
+ * under the terms of either the GPL or the LGPL, and not to allow others to
276
+ * use your version of this file under the terms of the MPL, indicate your
277
+ * decision by deleting the provisions above and replace them with the notice
278
+ * and other provisions required by the GPL or the LGPL. If you do not delete
279
+ * the provisions above, a recipient may use your version of this file under
280
+ * the terms of any one of the MPL, the GPL or the LGPL.
281
+ *
282
+ * ***** END LICENSE BLOCK ***** */
283
+
284
+ define('ace/mode/xml_util', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
285
+ "use strict";
286
+
287
+ var lang = require("../lib/lang");
288
+
289
+ var formTags = lang.arrayToMap(
290
+ ("button|form|input|label|select|textarea").split("|")
291
+ );
292
+
293
+ var tableTags = lang.arrayToMap(
294
+ ("table|tbody|td|tfoot|th|tr").split("|")
295
+ );
296
+
297
+ function string(state) {
298
+ return [{
299
+ token : "string",
300
+ regex : '".*?"'
301
+ }, {
302
+ token : "string", // multi line string start
303
+ merge : true,
304
+ regex : '["].*',
305
+ next : state + "_qqstring"
306
+ }, {
307
+ token : "string",
308
+ regex : "'.*?'"
309
+ }, {
310
+ token : "string", // multi line string start
311
+ merge : true,
312
+ regex : "['].*",
313
+ next : state + "_qstring"
314
+ }];
315
+ }
316
+
317
+ function multiLineString(quote, state) {
318
+ return [{
319
+ token : "string",
320
+ merge : true,
321
+ regex : ".*?" + quote,
322
+ next : state
323
+ }, {
324
+ token : "string",
325
+ merge : true,
326
+ regex : '.+'
327
+ }];
328
+ }
329
+
330
+ exports.tag = function(states, name, nextState) {
331
+ states[name] = [{
332
+ token : "text",
333
+ regex : "\\s+"
334
+ }, {
335
+ //token : "meta.tag",
336
+
337
+ token : function(value) {
338
+ if ( value==='a' ) {
339
+ return "meta.tag.anchor";
340
+ }
341
+ else if ( value==='img' ) {
342
+ return "meta.tag.image";
343
+ }
344
+ else if ( value==='script' ) {
345
+ return "meta.tag.script";
346
+ }
347
+ else if ( value==='style' ) {
348
+ return "meta.tag.style";
349
+ }
350
+ else if (formTags.hasOwnProperty(value.toLowerCase())) {
351
+ return "meta.tag.form";
352
+ }
353
+ else if (tableTags.hasOwnProperty(value.toLowerCase())) {
354
+ return "meta.tag.table";
355
+ }
356
+ else {
357
+ return "meta.tag";
358
+ }
359
+ },
360
+ merge : true,
361
+ regex : "[-_a-zA-Z0-9:!]+",
362
+ next : name + "_embed_attribute_list"
363
+ }, {
364
+ token: "empty",
365
+ regex: "",
366
+ next : name + "_embed_attribute_list"
367
+ }];
368
+
369
+ states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
370
+ states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
371
+
372
+ states[name + "_embed_attribute_list"] = [{
373
+ token : "meta.tag",
374
+ merge : true,
375
+ regex : "\/?>",
376
+ next : nextState
377
+ }, {
378
+ token : "keyword.operator",
379
+ regex : "="
380
+ }, {
381
+ token : "entity.other.attribute-name",
382
+ regex : "[-_a-zA-Z0-9:]+"
383
+ }, {
384
+ token : "constant.numeric", // float
385
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
386
+ }, {
387
+ token : "text",
388
+ regex : "\\s+"
389
+ }].concat(string(name));
390
+ };
391
+
392
+ });
393
+ /* vim:ts=4:sts=4:sw=4:
394
+ * ***** BEGIN LICENSE BLOCK *****
395
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
396
+ *
397
+ * The contents of this file are subject to the Mozilla Public License Version
398
+ * 1.1 (the "License"); you may not use this file except in compliance with
399
+ * the License. You may obtain a copy of the License at
400
+ * http://www.mozilla.org/MPL/
401
+ *
402
+ * Software distributed under the License is distributed on an "AS IS" basis,
403
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
404
+ * for the specific language governing rights and limitations under the
405
+ * License.
406
+ *
407
+ * The Original Code is Ajax.org Code Editor (ACE).
408
+ *
409
+ * The Initial Developer of the Original Code is
410
+ * Ajax.org B.V.
411
+ * Portions created by the Initial Developer are Copyright (C) 2010
412
+ * the Initial Developer. All Rights Reserved.
413
+ *
414
+ * Contributor(s):
415
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
416
+ *
417
+ * Alternatively, the contents of this file may be used under the terms of
418
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
419
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
420
+ * in which case the provisions of the GPL or the LGPL are applicable instead
421
+ * of those above. If you wish to allow use of your version of this file only
422
+ * under the terms of either the GPL or the LGPL, and not to allow others to
423
+ * use your version of this file under the terms of the MPL, indicate your
424
+ * decision by deleting the provisions above and replace them with the notice
425
+ * and other provisions required by the GPL or the LGPL. If you do not delete
426
+ * the provisions above, a recipient may use your version of this file under
427
+ * the terms of any one of the MPL, the GPL or the LGPL.
428
+ *
429
+ * ***** END LICENSE BLOCK ***** */
430
+
431
+ define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
432
+ "use strict";
433
+
434
+ var oop = require("../../lib/oop");
435
+ var Behaviour = require("../behaviour").Behaviour;
436
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
437
+
438
+ var XmlBehaviour = function () {
439
+
440
+ this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
441
+
442
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
443
+ if (text == '<') {
444
+ var selection = editor.getSelectionRange();
445
+ var selected = session.doc.getTextRange(selection);
446
+ if (selected !== "") {
447
+ return false;
448
+ } else {
449
+ return {
450
+ text: '<>',
451
+ selection: [1, 1]
452
+ }
453
+ }
454
+ } else if (text == '>') {
455
+ var cursor = editor.getCursorPosition();
456
+ var line = session.doc.getLine(cursor.row);
457
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
458
+ if (rightChar == '>') { // need some kind of matching check here
459
+ return {
460
+ text: '',
461
+ selection: [1, 1]
462
+ }
463
+ }
464
+ } else if (text == "\n") {
465
+ var cursor = editor.getCursorPosition();
466
+ var line = session.doc.getLine(cursor.row);
467
+ var rightChars = line.substring(cursor.column, cursor.column + 2);
468
+ if (rightChars == '</') {
469
+ var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
470
+ var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
471
+
472
+ return {
473
+ text: '\n' + indent + '\n' + next_indent,
474
+ selection: [1, indent.length, 1, indent.length]
475
+ }
476
+ }
477
+ }
478
+ });
479
+
480
+ }
481
+ oop.inherits(XmlBehaviour, Behaviour);
482
+
483
+ exports.XmlBehaviour = XmlBehaviour;
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 == '"') {
635
+ var selection = editor.getSelectionRange();
636
+ var selected = session.doc.getTextRange(selection);
637
+ if (selected !== "") {
638
+ return {
639
+ text: '"' + selected + '"',
640
+ selection: false
641
+ }
642
+ } else {
643
+ var cursor = editor.getCursorPosition();
644
+ var line = session.doc.getLine(cursor.row);
645
+ var leftChar = line.substring(cursor.column-1, cursor.column);
646
+
647
+ // We're escaped.
648
+ if (leftChar == '\\') {
649
+ return null;
650
+ }
651
+
652
+ // Find what token we're inside.
653
+ var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
654
+ var col = 0, token;
655
+ var quotepos = -1; // Track whether we're inside an open quote.
656
+
657
+ for (var x = 0; x < tokens.length; x++) {
658
+ token = tokens[x];
659
+ if (token.type == "string") {
660
+ quotepos = -1;
661
+ } else if (quotepos < 0) {
662
+ quotepos = token.value.indexOf('"');
663
+ }
664
+ if ((token.value.length + col) > selection.start.column) {
665
+ break;
666
+ }
667
+ col += tokens[x].value.length;
668
+ }
669
+
670
+ // Try and be smart about when we auto insert.
671
+ if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
672
+ return {
673
+ text: '""',
674
+ selection: [1,1]
675
+ }
676
+ } else if (token && token.type === "string") {
677
+ // Ignore input and move right one if we're typing over the closing quote.
678
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
679
+ if (rightChar == '"') {
680
+ return {
681
+ text: '',
682
+ selection: [1, 1]
683
+ }
684
+ }
685
+ }
686
+ }
687
+ }
688
+ });
689
+
690
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
691
+ var selected = session.doc.getTextRange(range);
692
+ if (!range.isMultiLine() && selected == '"') {
693
+ var line = session.doc.getLine(range.start.row);
694
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
695
+ if (rightChar == '"') {
696
+ range.end.column++;
697
+ return range;
698
+ }
699
+ }
700
+ });
701
+
702
+ }
703
+ oop.inherits(CstyleBehaviour, Behaviour);
704
+
705
+ exports.CstyleBehaviour = CstyleBehaviour;
706
+ });/* ***** BEGIN LICENSE BLOCK *****
707
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
708
+ *
709
+ * The contents of this file are subject to the Mozilla Public License Version
710
+ * 1.1 (the "License"); you may not use this file except in compliance with
711
+ * the License. You may obtain a copy of the License at
712
+ * http://www.mozilla.org/MPL/
713
+ *
714
+ * Software distributed under the License is distributed on an "AS IS" basis,
715
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
716
+ * for the specific language governing rights and limitations under the
717
+ * License.
718
+ *
719
+ * The Original Code is Ajax.org Code Editor (ACE).
720
+ *
721
+ * The Initial Developer of the Original Code is
722
+ * Ajax.org B.V.
723
+ * Portions created by the Initial Developer are Copyright (C) 2010
724
+ * the Initial Developer. All Rights Reserved.
725
+ *
726
+ * Contributor(s):
727
+ * Fabian Jakobs <fabian AT ajax DOT org>
728
+ *
729
+ * Alternatively, the contents of this file may be used under the terms of
730
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
731
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
732
+ * in which case the provisions of the GPL or the LGPL are applicable instead
733
+ * of those above. If you wish to allow use of your version of this file only
734
+ * under the terms of either the GPL or the LGPL, and not to allow others to
735
+ * use your version of this file under the terms of the MPL, indicate your
736
+ * decision by deleting the provisions above and replace them with the notice
737
+ * and other provisions required by the GPL or the LGPL. If you do not delete
738
+ * the provisions above, a recipient may use your version of this file under
739
+ * the terms of any one of the MPL, the GPL or the LGPL.
740
+ *
741
+ * ***** END LICENSE BLOCK ***** */
742
+
743
+ 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) {
744
+ "use strict";
745
+
746
+ var oop = require("../../lib/oop");
747
+ var lang = require("../../lib/lang");
748
+ var Range = require("../../range").Range;
749
+ var BaseFoldMode = require("./fold_mode").FoldMode;
750
+ var TokenIterator = require("../../token_iterator").TokenIterator;
751
+
752
+ var FoldMode = exports.FoldMode = function(voidElements) {
753
+ BaseFoldMode.call(this);
754
+ this.voidElements = voidElements || {};
755
+ };
756
+ oop.inherits(FoldMode, BaseFoldMode);
757
+
758
+ (function() {
759
+
760
+ this.getFoldWidget = function(session, foldStyle, row) {
761
+ var tag = this._getFirstTagInLine(session, row);
762
+
763
+ if (tag.closing)
764
+ return foldStyle == "markbeginend" ? "end" : "";
765
+
766
+ if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
767
+ return "";
768
+
769
+ if (tag.selfClosing)
770
+ return "";
771
+
772
+ if (tag.value.indexOf("/" + tag.tagName) !== -1)
773
+ return "";
774
+
775
+ return "start";
776
+ };
777
+
778
+ this._getFirstTagInLine = function(session, row) {
779
+ var tokens = session.getTokens(row, row)[0].tokens;
780
+ var value = "";
781
+ for (var i = 0; i < tokens.length; i++) {
782
+ var token = tokens[i];
783
+ if (token.type.indexOf("meta.tag") === 0)
784
+ value += token.value;
785
+ else
786
+ value += lang.stringRepeat(" ", token.value.length);
787
+ }
788
+
789
+ return this._parseTag(value);
790
+ };
791
+
792
+ this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
793
+ this._parseTag = function(tag) {
794
+
795
+ var match = this.tagRe.exec(tag);
796
+ var column = this.tagRe.lastIndex || 0;
797
+ this.tagRe.lastIndex = 0;
798
+
799
+ return {
800
+ value: tag,
801
+ match: match ? match[2] : "",
802
+ closing: match ? !!match[3] : false,
803
+ selfClosing: match ? !!match[5] || match[2] == "/>" : false,
804
+ tagName: match ? match[4] : "",
805
+ column: match[1] ? column + match[1].length : column
806
+ };
807
+ };
808
+
809
+ /**
810
+ * reads a full tag and places the iterator after the tag
811
+ */
812
+ this._readTagForward = function(iterator) {
813
+ var token = iterator.getCurrentToken();
814
+ if (!token)
815
+ return null;
816
+
817
+ var value = "";
818
+ var start;
819
+
820
+ do {
821
+ if (token.type.indexOf("meta.tag") === 0) {
822
+ if (!start) {
823
+ var start = {
824
+ row: iterator.getCurrentTokenRow(),
825
+ column: iterator.getCurrentTokenColumn()
826
+ };
827
+ }
828
+ value += token.value;
829
+ if (value.indexOf(">") !== -1) {
830
+ var tag = this._parseTag(value);
831
+ tag.start = start;
832
+ tag.end = {
833
+ row: iterator.getCurrentTokenRow(),
834
+ column: iterator.getCurrentTokenColumn() + token.value.length
835
+ };
836
+ iterator.stepForward();
837
+ return tag;
838
+ }
839
+ }
840
+ } while(token = iterator.stepForward());
841
+
842
+ return null;
843
+ };
844
+
845
+ this._readTagBackward = function(iterator) {
846
+ var token = iterator.getCurrentToken();
847
+ if (!token)
848
+ return null;
849
+
850
+ var value = "";
851
+ var end;
852
+
853
+ do {
854
+ if (token.type.indexOf("meta.tag") === 0) {
855
+ if (!end) {
856
+ end = {
857
+ row: iterator.getCurrentTokenRow(),
858
+ column: iterator.getCurrentTokenColumn() + token.value.length
859
+ };
860
+ }
861
+ value = token.value + value;
862
+ if (value.indexOf("<") !== -1) {
863
+ var tag = this._parseTag(value);
864
+ tag.end = end;
865
+ tag.start = {
866
+ row: iterator.getCurrentTokenRow(),
867
+ column: iterator.getCurrentTokenColumn()
868
+ };
869
+ iterator.stepBackward();
870
+ return tag;
871
+ }
872
+ }
873
+ } while(token = iterator.stepBackward());
874
+
875
+ return null;
876
+ };
877
+
878
+ this._pop = function(stack, tag) {
879
+ while (stack.length) {
880
+
881
+ var top = stack[stack.length-1];
882
+ if (!tag || top.tagName == tag.tagName) {
883
+ return stack.pop();
884
+ }
885
+ else if (this.voidElements[tag.tagName]) {
886
+ return;
887
+ }
888
+ else if (this.voidElements[top.tagName]) {
889
+ stack.pop();
890
+ continue;
891
+ } else {
892
+ return null;
893
+ }
894
+ }
895
+ };
896
+
897
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
898
+ var firstTag = this._getFirstTagInLine(session, row);
899
+
900
+ if (!firstTag.match)
901
+ return null;
902
+
903
+ var isBackward = firstTag.closing || firstTag.selfClosing;
904
+ var stack = [];
905
+ var tag;
906
+
907
+ if (!isBackward) {
908
+ var iterator = new TokenIterator(session, row, firstTag.column);
909
+ var start = {
910
+ row: row,
911
+ column: firstTag.column + firstTag.tagName.length + 2
912
+ };
913
+ while (tag = this._readTagForward(iterator)) {
914
+ if (tag.selfClosing) {
915
+ if (!stack.length) {
916
+ tag.start.column += tag.tagName.length + 2;
917
+ tag.end.column -= 2;
918
+ return Range.fromPoints(tag.start, tag.end);
919
+ } else
920
+ continue;
921
+ }
922
+
923
+ if (tag.closing) {
924
+ this._pop(stack, tag);
925
+ if (stack.length == 0)
926
+ return Range.fromPoints(start, tag.start);
927
+ }
928
+ else {
929
+ stack.push(tag)
930
+ }
931
+ }
932
+ }
933
+ else {
934
+ var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
935
+ var end = {
936
+ row: row,
937
+ column: firstTag.column
938
+ };
939
+
940
+ while (tag = this._readTagBackward(iterator)) {
941
+ if (tag.selfClosing) {
942
+ if (!stack.length) {
943
+ tag.start.column += tag.tagName.length + 2;
944
+ tag.end.column -= 2;
945
+ return Range.fromPoints(tag.start, tag.end);
946
+ } else
947
+ continue;
948
+ }
949
+
950
+ if (!tag.closing) {
951
+ this._pop(stack, tag);
952
+ if (stack.length == 0) {
953
+ tag.start.column += tag.tagName.length + 2;
954
+ return Range.fromPoints(tag.start, end);
955
+ }
956
+ }
957
+ else {
958
+ stack.push(tag)
959
+ }
960
+ }
961
+ }
962
+
963
+ };
964
+
965
+ }).call(FoldMode.prototype);
966
+
967
+ });/* ***** BEGIN LICENSE BLOCK *****
968
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
969
+ *
970
+ * The contents of this file are subject to the Mozilla Public License Version
971
+ * 1.1 (the "License"); you may not use this file except in compliance with
972
+ * the License. You may obtain a copy of the License at
973
+ * http://www.mozilla.org/MPL/
974
+ *
975
+ * Software distributed under the License is distributed on an "AS IS" basis,
976
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
977
+ * for the specific language governing rights and limitations under the
978
+ * License.
979
+ *
980
+ * The Original Code is Ajax.org Code Editor (ACE).
981
+ *
982
+ * The Initial Developer of the Original Code is
983
+ * Ajax.org B.V.
984
+ * Portions created by the Initial Developer are Copyright (C) 2010
985
+ * the Initial Developer. All Rights Reserved.
986
+ *
987
+ * Contributor(s):
988
+ * Fabian Jakobs <fabian AT ajax DOT org>
989
+ *
990
+ * Alternatively, the contents of this file may be used under the terms of
991
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
992
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
993
+ * in which case the provisions of the GPL or the LGPL are applicable instead
994
+ * of those above. If you wish to allow use of your version of this file only
995
+ * under the terms of either the GPL or the LGPL, and not to allow others to
996
+ * use your version of this file under the terms of the MPL, indicate your
997
+ * decision by deleting the provisions above and replace them with the notice
998
+ * and other provisions required by the GPL or the LGPL. If you do not delete
999
+ * the provisions above, a recipient may use your version of this file under
1000
+ * the terms of any one of the MPL, the GPL or the LGPL.
1001
+ *
1002
+ * ***** END LICENSE BLOCK ***** */
1003
+
1004
+ define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1005
+ "use strict";
1006
+
1007
+ var Range = require("../../range").Range;
1008
+
1009
+ var FoldMode = exports.FoldMode = function() {};
1010
+
1011
+ (function() {
1012
+
1013
+ this.foldingStartMarker = null;
1014
+ this.foldingStopMarker = null;
1015
+
1016
+ // must return "" if there's no fold, to enable caching
1017
+ this.getFoldWidget = function(session, foldStyle, row) {
1018
+ var line = session.getLine(row);
1019
+ if (this.foldingStartMarker.test(line))
1020
+ return "start";
1021
+ if (foldStyle == "markbeginend"
1022
+ && this.foldingStopMarker
1023
+ && this.foldingStopMarker.test(line))
1024
+ return "end";
1025
+ return "";
1026
+ };
1027
+
1028
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1029
+ return null;
1030
+ };
1031
+
1032
+ this.indentationBlock = function(session, row, column) {
1033
+ var re = /^\s*/;
1034
+ var startRow = row;
1035
+ var endRow = row;
1036
+ var line = session.getLine(row);
1037
+ var startColumn = column || line.length;
1038
+ var startLevel = line.match(re)[0].length;
1039
+ var maxRow = session.getLength()
1040
+
1041
+ while (++row < maxRow) {
1042
+ line = session.getLine(row);
1043
+ var level = line.match(re)[0].length;
1044
+
1045
+ if (level == line.length)
1046
+ continue;
1047
+
1048
+ if (level <= startLevel)
1049
+ break;
1050
+
1051
+ endRow = row;
1052
+ }
1053
+
1054
+ if (endRow > startRow) {
1055
+ var endColumn = session.getLine(endRow).length;
1056
+ return new Range(startRow, startColumn, endRow, endColumn);
1057
+ }
1058
+ };
1059
+
1060
+ this.openingBracketBlock = function(session, bracket, row, column) {
1061
+ var start = {row: row, column: column + 1};
1062
+ var end = session.$findClosingBracket(bracket, start);
1063
+ if (!end)
1064
+ return;
1065
+
1066
+ var fw = session.foldWidgets[end.row];
1067
+ if (fw == null)
1068
+ fw = this.getFoldWidget(session, end.row);
1069
+
1070
+ if (fw == "start") {
1071
+ end.row --;
1072
+ end.column = session.getLine(end.row).length;
1073
+ }
1074
+ return Range.fromPoints(start, end);
1075
+ };
1076
+
1077
+ }).call(FoldMode.prototype);
1078
+
1079
+ });
1080
+ /* ***** BEGIN LICENSE BLOCK *****
1081
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1082
+ *
1083
+ * The contents of this file are subject to the Mozilla Public License Version
1084
+ * 1.1 (the "License"); you may not use this file except in compliance with
1085
+ * the License. You may obtain a copy of the License at
1086
+ * http://www.mozilla.org/MPL/
1087
+ *
1088
+ * Software distributed under the License is distributed on an "AS IS" basis,
1089
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1090
+ * for the specific language governing rights and limitations under the
1091
+ * License.
1092
+ *
1093
+ * The Original Code is Ajax.org Code Editor (ACE).
1094
+ *
1095
+ * The Initial Developer of the Original Code is
1096
+ * Ajax.org B.V.
1097
+ * Portions created by the Initial Developer are Copyright (C) 2010
1098
+ * the Initial Developer. All Rights Reserved.
1099
+ *
1100
+ * Contributor(s):
1101
+ * Fabian Jakobs <fabian AT ajax DOT org>
1102
+ *
1103
+ * Alternatively, the contents of this file may be used under the terms of
1104
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1105
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1106
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1107
+ * of those above. If you wish to allow use of your version of this file only
1108
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1109
+ * use your version of this file under the terms of the MPL, indicate your
1110
+ * decision by deleting the provisions above and replace them with the notice
1111
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1112
+ * the provisions above, a recipient may use your version of this file under
1113
+ * the terms of any one of the MPL, the GPL or the LGPL.
1114
+ *
1115
+ * ***** END LICENSE BLOCK ***** */
1116
+
1117
+ 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) {
1118
+ "use strict";
1119
+
1120
+ var oop = require("../lib/oop");
1121
+ var TextMode = require("./text").Mode;
1122
+ var Tokenizer = require("../tokenizer").Tokenizer;
1123
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1124
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1125
+ var Range = require("../range").Range;
1126
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1127
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
1128
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1129
+
1130
+ var Mode = function() {
1131
+ this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
1132
+ this.$outdent = new MatchingBraceOutdent();
1133
+ this.$behaviour = new CstyleBehaviour();
1134
+ this.foldingRules = new CStyleFoldMode();
1135
+ };
1136
+ oop.inherits(Mode, TextMode);
1137
+
1138
+ (function() {
1139
+
1140
+
1141
+ this.toggleCommentLines = function(state, doc, startRow, endRow) {
1142
+ var outdent = true;
1143
+ var re = /^(\s*)\/\//;
1144
+
1145
+ for (var i=startRow; i<= endRow; i++) {
1146
+ if (!re.test(doc.getLine(i))) {
1147
+ outdent = false;
1148
+ break;
1149
+ }
1150
+ }
1151
+
1152
+ if (outdent) {
1153
+ var deleteRange = new Range(0, 0, 0, 0);
1154
+ for (var i=startRow; i<= endRow; i++)
1155
+ {
1156
+ var line = doc.getLine(i);
1157
+ var m = line.match(re);
1158
+ deleteRange.start.row = i;
1159
+ deleteRange.end.row = i;
1160
+ deleteRange.end.column = m[0].length;
1161
+ doc.replace(deleteRange, m[1]);
1162
+ }
1163
+ }
1164
+ else {
1165
+ doc.indentRows(startRow, endRow, "//");
1166
+ }
1167
+ };
1168
+
1169
+ this.getNextLineIndent = function(state, line, tab) {
1170
+ var indent = this.$getIndent(line);
1171
+
1172
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
1173
+ var tokens = tokenizedLine.tokens;
1174
+ var endState = tokenizedLine.state;
1175
+
1176
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1177
+ return indent;
1178
+ }
1179
+
1180
+ if (state == "start" || state == "regex_allowed") {
1181
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
1182
+ if (match) {
1183
+ indent += tab;
1184
+ }
1185
+ } else if (state == "doc-start") {
1186
+ if (endState == "start" || state == "regex_allowed") {
1187
+ return "";
1188
+ }
1189
+ var match = line.match(/^\s*(\/?)\*/);
1190
+ if (match) {
1191
+ if (match[1]) {
1192
+ indent += " ";
1193
+ }
1194
+ indent += "* ";
1195
+ }
1196
+ }
1197
+
1198
+ return indent;
1199
+ };
1200
+
1201
+ this.checkOutdent = function(state, line, input) {
1202
+ return this.$outdent.checkOutdent(line, input);
1203
+ };
1204
+
1205
+ this.autoOutdent = function(state, doc, row) {
1206
+ this.$outdent.autoOutdent(doc, row);
1207
+ };
1208
+
1209
+ this.createWorker = function(session) {
1210
+ var worker = new WorkerClient(["ace"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
1211
+ worker.attachToDocument(session.getDocument());
1212
+
1213
+ worker.on("jslint", function(results) {
1214
+ var errors = [];
1215
+ for (var i=0; i<results.data.length; i++) {
1216
+ var error = results.data[i];
1217
+ if (error)
1218
+ errors.push({
1219
+ row: error.line-1,
1220
+ column: error.character-1,
1221
+ text: error.reason,
1222
+ type: "warning",
1223
+ lint: error
1224
+ });
1225
+ }
1226
+ session.setAnnotations(errors);
1227
+ });
1228
+
1229
+ worker.on("narcissus", function(e) {
1230
+ session.setAnnotations([e.data]);
1231
+ });
1232
+
1233
+ worker.on("terminate", function() {
1234
+ session.clearAnnotations();
1235
+ });
1236
+
1237
+ return worker;
1238
+ };
1239
+
1240
+ }).call(Mode.prototype);
1241
+
1242
+ exports.Mode = Mode;
1243
+ });
1244
+ /* ***** BEGIN LICENSE BLOCK *****
1245
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1246
+ *
1247
+ * The contents of this file are subject to the Mozilla Public License Version
1248
+ * 1.1 (the "License"); you may not use this file except in compliance with
1249
+ * the License. You may obtain a copy of the License at
1250
+ * http://www.mozilla.org/MPL/
1251
+ *
1252
+ * Software distributed under the License is distributed on an "AS IS" basis,
1253
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1254
+ * for the specific language governing rights and limitations under the
1255
+ * License.
1256
+ *
1257
+ * The Original Code is Ajax.org Code Editor (ACE).
1258
+ *
1259
+ * The Initial Developer of the Original Code is
1260
+ * Ajax.org B.V.
1261
+ * Portions created by the Initial Developer are Copyright (C) 2010
1262
+ * the Initial Developer. All Rights Reserved.
1263
+ *
1264
+ * Contributor(s):
1265
+ * Fabian Jakobs <fabian AT ajax DOT org>
1266
+ * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
1267
+ *
1268
+ * Alternatively, the contents of this file may be used under the terms of
1269
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1270
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1271
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1272
+ * of those above. If you wish to allow use of your version of this file only
1273
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1274
+ * use your version of this file under the terms of the MPL, indicate your
1275
+ * decision by deleting the provisions above and replace them with the notice
1276
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1277
+ * the provisions above, a recipient may use your version of this file under
1278
+ * the terms of any one of the MPL, the GPL or the LGPL.
1279
+ *
1280
+ * ***** END LICENSE BLOCK ***** */
1281
+
1282
+ 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) {
1283
+ "use strict";
1284
+
1285
+ var oop = require("../lib/oop");
1286
+ var lang = require("../lib/lang");
1287
+ var unicode = require("../unicode");
1288
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
1289
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1290
+
1291
+ var JavaScriptHighlightRules = function() {
1292
+
1293
+ // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
1294
+ var globals = lang.arrayToMap(
1295
+ // Constructors
1296
+ ("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" +
1297
+ // E4X
1298
+ "Namespace|QName|XML|XMLList|" +
1299
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
1300
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
1301
+ // Errors
1302
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
1303
+ "SyntaxError|TypeError|URIError|" +
1304
+ // Non-constructor functions
1305
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
1306
+ "isNaN|parseFloat|parseInt|" +
1307
+ // Other
1308
+ "JSON|Math|" +
1309
+ // Pseudo
1310
+ "this|arguments|prototype|window|document"
1311
+ ).split("|")
1312
+ );
1313
+
1314
+ var keywords = lang.arrayToMap(
1315
+ ("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
1316
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
1317
+ "const|yield|import|get|set").split("|")
1318
+ );
1319
+
1320
+ // keywords which can be followed by regular expressions
1321
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
1322
+
1323
+ var deprecated = lang.arrayToMap(
1324
+ ("__parent__|__count__|escape|unescape|with|__proto__").split("|")
1325
+ );
1326
+
1327
+ var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
1328
+
1329
+ var buildinConstants = lang.arrayToMap(
1330
+ ("null|Infinity|NaN|undefined").split("|")
1331
+ );
1332
+
1333
+ var futureReserved = lang.arrayToMap(
1334
+ ("class|enum|extends|super|export|implements|private|" +
1335
+ "public|interface|package|protected|static").split("|")
1336
+ );
1337
+
1338
+ // TODO: Unicode escape sequences
1339
+ var identifierRe = "[" + unicode.packages.L + "\\$_]["
1340
+ + unicode.packages.L
1341
+ + unicode.packages.Mn + unicode.packages.Mc
1342
+ + unicode.packages.Nd
1343
+ + unicode.packages.Pc + "\\$_]*\\b";
1344
+
1345
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
1346
+ "u[0-9a-fA-F]{4}|" + // unicode
1347
+ "[0-2][0-7]{0,2}|" + // oct
1348
+ "3[0-6][0-7]?|" + // oct
1349
+ "37[0-7]?|" + // oct
1350
+ "[4-7][0-7]?|" + //oct
1351
+ ".)";
1352
+
1353
+ // regexp must not have capturing parentheses. Use (?:) instead.
1354
+ // regexps are ordered -> the first match is used
1355
+
1356
+ this.$rules = {
1357
+ "start" : [
1358
+ {
1359
+ token : "comment",
1360
+ regex : "\\/\\/.*$"
1361
+ },
1362
+ new DocCommentHighlightRules().getStartRule("doc-start"),
1363
+ {
1364
+ token : "comment", // multi line comment
1365
+ merge : true,
1366
+ regex : "\\/\\*",
1367
+ next : "comment"
1368
+ }, {
1369
+ token : "string",
1370
+ regex : "'",
1371
+ next : "qstring"
1372
+ }, {
1373
+ token : "string",
1374
+ regex : '"',
1375
+ next : "qqstring"
1376
+ }, {
1377
+ token : "constant.numeric", // hex
1378
+ regex : "0[xX][0-9a-fA-F]+\\b"
1379
+ }, {
1380
+ token : "constant.numeric", // float
1381
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1382
+ }, {
1383
+ token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
1384
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
1385
+ }, {
1386
+ token : "constant.language.boolean",
1387
+ regex : "(?:true|false)\\b"
1388
+ }, {
1389
+ token : "keyword",
1390
+ regex : "(?:" + kwBeforeRe + ")\\b",
1391
+ next : "regex_allowed"
1392
+ }, {
1393
+ token : "support.function",
1394
+ regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
1395
+ }, {
1396
+ token : "support.function.dom",
1397
+ regex : "\\b(?: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(?=\\()"
1398
+ }, {
1399
+ token : "support.function.constant",
1400
+ regex : "\\b(?: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"
1401
+ }, {
1402
+ token : ["punctuation.operator", "support.function.firebug"],
1403
+ regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
1404
+
1405
+ }, {
1406
+ token : function(value) {
1407
+ if (globals.hasOwnProperty(value))
1408
+ return "variable.language";
1409
+ else if (deprecated.hasOwnProperty(value))
1410
+ return "invalid.deprecated";
1411
+ else if (definitions.hasOwnProperty(value))
1412
+ return "storage.type";
1413
+ else if (keywords.hasOwnProperty(value))
1414
+ return "keyword";
1415
+ else if (buildinConstants.hasOwnProperty(value))
1416
+ return "constant.language";
1417
+ else if (futureReserved.hasOwnProperty(value))
1418
+ return "invalid.illegal";
1419
+ else if (value == "debugger")
1420
+ return "invalid.deprecated";
1421
+ else
1422
+ return "identifier";
1423
+ },
1424
+ regex : identifierRe
1425
+ }, {
1426
+ token : "keyword.operator",
1427
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
1428
+ next : "regex_allowed"
1429
+ }, {
1430
+ token : "punctuation.operator",
1431
+ regex : "\\?|\\:|\\,|\\;|\\.",
1432
+ next : "regex_allowed"
1433
+ }, {
1434
+ token : "paren.lparen",
1435
+ regex : "[[({]",
1436
+ next : "regex_allowed"
1437
+ }, {
1438
+ token : "paren.rparen",
1439
+ regex : "[\\])}]"
1440
+ }, {
1441
+ token : "keyword.operator",
1442
+ regex : "\\/=?",
1443
+ next : "regex_allowed"
1444
+ }, {
1445
+ token: "comment",
1446
+ regex: "^#!.*$"
1447
+ }, {
1448
+ token : "text",
1449
+ regex : "\\s+"
1450
+ }
1451
+ ],
1452
+ // regular expressions are only allowed after certain tokens. This
1453
+ // makes sure we don't mix up regexps with the divison operator
1454
+ "regex_allowed": [
1455
+ {
1456
+ token : "comment", // multi line comment
1457
+ merge : true,
1458
+ regex : "\\/\\*",
1459
+ next : "comment_regex_allowed"
1460
+ }, {
1461
+ token : "comment",
1462
+ regex : "\\/\\/.*$"
1463
+ }, {
1464
+ token: "string.regexp",
1465
+ regex: "\\/",
1466
+ next: "regex",
1467
+ merge: true
1468
+ }, {
1469
+ token : "text",
1470
+ regex : "\\s+"
1471
+ }, {
1472
+ // immediately return to the start mode without matching
1473
+ // anything
1474
+ token: "empty",
1475
+ regex: "",
1476
+ next: "start"
1477
+ }
1478
+ ],
1479
+ "regex": [
1480
+ {
1481
+ token: "regexp.keyword.operator",
1482
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
1483
+ next: "regex"
1484
+ }, {
1485
+ // flag
1486
+ token: "string.regexp",
1487
+ regex: "/\\w*",
1488
+ next: "start",
1489
+ merge: true
1490
+ }, {
1491
+ token: "string.regexp",
1492
+ regex: "[^\\\\/\\[]+",
1493
+ next: "regex",
1494
+ merge: true
1495
+ }, {
1496
+ token: "string.regexp.charachterclass",
1497
+ regex: "\\[",
1498
+ next: "regex_character_class",
1499
+ merge: true
1500
+ }, {
1501
+ token: "empty",
1502
+ regex: "",
1503
+ next: "start"
1504
+ }
1505
+ ],
1506
+ "regex_character_class": [
1507
+ {
1508
+ token: "regexp.keyword.operator",
1509
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
1510
+ next: "regex_character_class"
1511
+ }, {
1512
+ token: "string.regexp.charachterclass",
1513
+ regex: "]",
1514
+ next: "regex",
1515
+ merge: true
1516
+ }, {
1517
+ token: "string.regexp.charachterclass",
1518
+ regex: "[^\\\\\\]]+",
1519
+ next: "regex_character_class",
1520
+ merge: true
1521
+ }, {
1522
+ token: "empty",
1523
+ regex: "",
1524
+ next: "start"
1525
+ }
1526
+ ],
1527
+ "comment_regex_allowed" : [
1528
+ {
1529
+ token : "comment", // closing comment
1530
+ regex : ".*?\\*\\/",
1531
+ merge : true,
1532
+ next : "regex_allowed"
1533
+ }, {
1534
+ token : "comment", // comment spanning whole line
1535
+ merge : true,
1536
+ regex : ".+"
1537
+ }
1538
+ ],
1539
+ "comment" : [
1540
+ {
1541
+ token : "comment", // closing comment
1542
+ regex : ".*?\\*\\/",
1543
+ merge : true,
1544
+ next : "start"
1545
+ }, {
1546
+ token : "comment", // comment spanning whole line
1547
+ merge : true,
1548
+ regex : ".+"
1549
+ }
1550
+ ],
1551
+ "qqstring" : [
1552
+ {
1553
+ token : "constant.language.escape",
1554
+ regex : escapedRe
1555
+ }, {
1556
+ token : "string",
1557
+ regex : '[^"\\\\]+'
1558
+ }, {
1559
+ token : "string",
1560
+ regex : '"',
1561
+ next : "start"
1562
+ }
1563
+ ],
1564
+ "qstring" : [
1565
+ {
1566
+ token : "constant.language.escape",
1567
+ regex : escapedRe
1568
+ }, {
1569
+ token : "string",
1570
+ regex : "[^'\\\\]+"
1571
+ }, {
1572
+ token : "string",
1573
+ regex : "'",
1574
+ next : "start"
1575
+ }
1576
+ ]
1577
+ };
1578
+
1579
+ this.embedRules(DocCommentHighlightRules, "doc-",
1580
+ [ new DocCommentHighlightRules().getEndRule("start") ]);
1581
+ };
1582
+
1583
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1584
+
1585
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1586
+ });
1587
+ /* ***** BEGIN LICENSE BLOCK *****
1588
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1589
+ *
1590
+ * The contents of this file are subject to the Mozilla Public License Version
1591
+ * 1.1 (the "License"); you may not use this file except in compliance with
1592
+ * the License. You may obtain a copy of the License at
1593
+ * http://www.mozilla.org/MPL/
1594
+ *
1595
+ * Software distributed under the License is distributed on an "AS IS" basis,
1596
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1597
+ * for the specific language governing rights and limitations under the
1598
+ * License.
1599
+ *
1600
+ * The Original Code is Ajax.org Code Editor (ACE).
1601
+ *
1602
+ * The Initial Developer of the Original Code is
1603
+ * Ajax.org B.V.
1604
+ * Portions created by the Initial Developer are Copyright (C) 2010
1605
+ * the Initial Developer. All Rights Reserved.
1606
+ *
1607
+ * Contributor(s):
1608
+ * Fabian Jakobs <fabian AT ajax DOT org>
1609
+ *
1610
+ * Alternatively, the contents of this file may be used under the terms of
1611
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1612
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1613
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1614
+ * of those above. If you wish to allow use of your version of this file only
1615
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1616
+ * use your version of this file under the terms of the MPL, indicate your
1617
+ * decision by deleting the provisions above and replace them with the notice
1618
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1619
+ * the provisions above, a recipient may use your version of this file under
1620
+ * the terms of any one of the MPL, the GPL or the LGPL.
1621
+ *
1622
+ * ***** END LICENSE BLOCK ***** */
1623
+
1624
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1625
+ "use strict";
1626
+
1627
+ var oop = require("../lib/oop");
1628
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1629
+
1630
+ var DocCommentHighlightRules = function() {
1631
+
1632
+ this.$rules = {
1633
+ "start" : [ {
1634
+ token : "comment.doc.tag",
1635
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
1636
+ }, {
1637
+ token : "comment.doc",
1638
+ merge : true,
1639
+ regex : "\\s+"
1640
+ }, {
1641
+ token : "comment.doc",
1642
+ merge : true,
1643
+ regex : "TODO"
1644
+ }, {
1645
+ token : "comment.doc",
1646
+ merge : true,
1647
+ regex : "[^@\\*]+"
1648
+ }, {
1649
+ token : "comment.doc",
1650
+ merge : true,
1651
+ regex : "."
1652
+ }]
1653
+ };
1654
+ };
1655
+
1656
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
1657
+
1658
+ (function() {
1659
+
1660
+ this.getStartRule = function(start) {
1661
+ return {
1662
+ token : "comment.doc", // doc comment
1663
+ merge : true,
1664
+ regex : "\\/\\*(?=\\*)",
1665
+ next : start
1666
+ };
1667
+ };
1668
+
1669
+ this.getEndRule = function (start) {
1670
+ return {
1671
+ token : "comment.doc", // closing comment
1672
+ merge : true,
1673
+ regex : "\\*\\/",
1674
+ next : start
1675
+ };
1676
+ };
1677
+
1678
+ }).call(DocCommentHighlightRules.prototype);
1679
+
1680
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
1681
+
1682
+ });
1683
+ /* ***** BEGIN LICENSE BLOCK *****
1684
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1685
+ *
1686
+ * The contents of this file are subject to the Mozilla Public License Version
1687
+ * 1.1 (the "License"); you may not use this file except in compliance with
1688
+ * the License. You may obtain a copy of the License at
1689
+ * http://www.mozilla.org/MPL/
1690
+ *
1691
+ * Software distributed under the License is distributed on an "AS IS" basis,
1692
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1693
+ * for the specific language governing rights and limitations under the
1694
+ * License.
1695
+ *
1696
+ * The Original Code is Ajax.org Code Editor (ACE).
1697
+ *
1698
+ * The Initial Developer of the Original Code is
1699
+ * Ajax.org B.V.
1700
+ * Portions created by the Initial Developer are Copyright (C) 2010
1701
+ * the Initial Developer. All Rights Reserved.
1702
+ *
1703
+ * Contributor(s):
1704
+ * Fabian Jakobs <fabian AT ajax DOT org>
1705
+ *
1706
+ * Alternatively, the contents of this file may be used under the terms of
1707
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1708
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1709
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1710
+ * of those above. If you wish to allow use of your version of this file only
1711
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1712
+ * use your version of this file under the terms of the MPL, indicate your
1713
+ * decision by deleting the provisions above and replace them with the notice
1714
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1715
+ * the provisions above, a recipient may use your version of this file under
1716
+ * the terms of any one of the MPL, the GPL or the LGPL.
1717
+ *
1718
+ * ***** END LICENSE BLOCK ***** */
1719
+
1720
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1721
+ "use strict";
1722
+
1723
+ var Range = require("../range").Range;
1724
+
1725
+ var MatchingBraceOutdent = function() {};
1726
+
1727
+ (function() {
1728
+
1729
+ this.checkOutdent = function(line, input) {
1730
+ if (! /^\s+$/.test(line))
1731
+ return false;
1732
+
1733
+ return /^\s*\}/.test(input);
1734
+ };
1735
+
1736
+ this.autoOutdent = function(doc, row) {
1737
+ var line = doc.getLine(row);
1738
+ var match = line.match(/^(\s*\})/);
1739
+
1740
+ if (!match) return 0;
1741
+
1742
+ var column = match[1].length;
1743
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
1744
+
1745
+ if (!openBracePos || openBracePos.row == row) return 0;
1746
+
1747
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
1748
+ doc.replace(new Range(row, 0, row, column-1), indent);
1749
+ };
1750
+
1751
+ this.$getIndent = function(line) {
1752
+ var match = line.match(/^(\s+)/);
1753
+ if (match) {
1754
+ return match[1];
1755
+ }
1756
+
1757
+ return "";
1758
+ };
1759
+
1760
+ }).call(MatchingBraceOutdent.prototype);
1761
+
1762
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
1763
+ });
1764
+ /* ***** BEGIN LICENSE BLOCK *****
1765
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1766
+ *
1767
+ * The contents of this file are subject to the Mozilla Public License Version
1768
+ * 1.1 (the "License"); you may not use this file except in compliance with
1769
+ * the License. You may obtain a copy of the License at
1770
+ * http://www.mozilla.org/MPL/
1771
+ *
1772
+ * Software distributed under the License is distributed on an "AS IS" basis,
1773
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1774
+ * for the specific language governing rights and limitations under the
1775
+ * License.
1776
+ *
1777
+ * The Original Code is Ajax.org Code Editor (ACE).
1778
+ *
1779
+ * The Initial Developer of the Original Code is
1780
+ * Ajax.org B.V.
1781
+ * Portions created by the Initial Developer are Copyright (C) 2010
1782
+ * the Initial Developer. All Rights Reserved.
1783
+ *
1784
+ * Contributor(s):
1785
+ * Fabian Jakobs <fabian AT ajax DOT org>
1786
+ *
1787
+ * Alternatively, the contents of this file may be used under the terms of
1788
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1789
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1790
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1791
+ * of those above. If you wish to allow use of your version of this file only
1792
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1793
+ * use your version of this file under the terms of the MPL, indicate your
1794
+ * decision by deleting the provisions above and replace them with the notice
1795
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1796
+ * the provisions above, a recipient may use your version of this file under
1797
+ * the terms of any one of the MPL, the GPL or the LGPL.
1798
+ *
1799
+ * ***** END LICENSE BLOCK ***** */
1800
+
1801
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1802
+ "use strict";
1803
+
1804
+ var oop = require("../../lib/oop");
1805
+ var Range = require("../../range").Range;
1806
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1807
+
1808
+ var FoldMode = exports.FoldMode = function() {};
1809
+ oop.inherits(FoldMode, BaseFoldMode);
1810
+
1811
+ (function() {
1812
+
1813
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1814
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1815
+
1816
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1817
+ var line = session.getLine(row);
1818
+ var match = line.match(this.foldingStartMarker);
1819
+ if (match) {
1820
+ var i = match.index;
1821
+
1822
+ if (match[1])
1823
+ return this.openingBracketBlock(session, match[1], row, i);
1824
+
1825
+ var range = session.getCommentFoldRange(row, i + match[0].length);
1826
+ range.end.column -= 2;
1827
+ return range;
1828
+ }
1829
+
1830
+ if (foldStyle !== "markbeginend")
1831
+ return;
1832
+
1833
+ var match = line.match(this.foldingStopMarker);
1834
+ if (match) {
1835
+ var i = match.index + match[0].length;
1836
+
1837
+ if (match[2]) {
1838
+ var range = session.getCommentFoldRange(row, i);
1839
+ range.end.column -= 2;
1840
+ return range;
1841
+ }
1842
+
1843
+ var end = {row: row, column: i};
1844
+ var start = session.$findOpeningBracket(match[1], end);
1845
+
1846
+ if (!start)
1847
+ return;
1848
+
1849
+ start.column++;
1850
+ end.column--;
1851
+
1852
+ return Range.fromPoints(start, end);
1853
+ }
1854
+ };
1855
+
1856
+ }).call(FoldMode.prototype);
1857
+
1858
+ });/* ***** BEGIN LICENSE BLOCK *****
1859
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1860
+ *
1861
+ * The contents of this file are subject to the Mozilla Public License Version
1862
+ * 1.1 (the "License"); you may not use this file except in compliance with
1863
+ * the License. You may obtain a copy of the License at
1864
+ * http://www.mozilla.org/MPL/
1865
+ *
1866
+ * Software distributed under the License is distributed on an "AS IS" basis,
1867
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1868
+ * for the specific language governing rights and limitations under the
1869
+ * License.
1870
+ *
1871
+ * The Original Code is Ajax.org Code Editor (ACE).
1872
+ *
1873
+ * The Initial Developer of the Original Code is
1874
+ * Ajax.org B.V.
1875
+ * Portions created by the Initial Developer are Copyright (C) 2010
1876
+ * the Initial Developer. All Rights Reserved.
1877
+ *
1878
+ * Contributor(s):
1879
+ * Fabian Jakobs <fabian AT ajax DOT org>
1880
+ *
1881
+ * Alternatively, the contents of this file may be used under the terms of
1882
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1883
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1884
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1885
+ * of those above. If you wish to allow use of your version of this file only
1886
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1887
+ * use your version of this file under the terms of the MPL, indicate your
1888
+ * decision by deleting the provisions above and replace them with the notice
1889
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1890
+ * the provisions above, a recipient may use your version of this file under
1891
+ * the terms of any one of the MPL, the GPL or the LGPL.
1892
+ *
1893
+ * ***** END LICENSE BLOCK ***** */
1894
+
1895
+ define('ace/mode/svg_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules', 'ace/mode/xml_util'], function(require, exports, module) {
1896
+ "use strict";
1897
+
1898
+ var oop = require("../lib/oop");
1899
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1900
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1901
+ var xmlUtil = require("./xml_util");
1902
+
1903
+ var SvgHighlightRules = function() {
1904
+ XmlHighlightRules.call(this);
1905
+
1906
+ this.$rules.start.splice(3, 0, {
1907
+ token : "meta.tag",
1908
+ regex : "<(?=\s*script)",
1909
+ next : "script"
1910
+ });
1911
+
1912
+ xmlUtil.tag(this.$rules, "script", "js-start");
1913
+
1914
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
1915
+ token: "comment",
1916
+ regex: "\\/\\/.*(?=<\\/script>)",
1917
+ next: "tag"
1918
+ }, {
1919
+ token: "meta.tag",
1920
+ regex: "<\\/(?=script)",
1921
+ next: "tag"
1922
+ }]);
1923
+ };
1924
+
1925
+ oop.inherits(SvgHighlightRules, XmlHighlightRules);
1926
+
1927
+ exports.SvgHighlightRules = SvgHighlightRules;
1928
+ });
1929
+ /* ***** BEGIN LICENSE BLOCK *****
1930
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1931
+ *
1932
+ * The contents of this file are subject to the Mozilla Public License Version
1933
+ * 1.1 (the "License"); you may not use this file except in compliance with
1934
+ * the License. You may obtain a copy of the License at
1935
+ * http://www.mozilla.org/MPL/
1936
+ *
1937
+ * Software distributed under the License is distributed on an "AS IS" basis,
1938
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1939
+ * for the specific language governing rights and limitations under the
1940
+ * License.
1941
+ *
1942
+ * The Original Code is Ajax.org Code Editor (ACE).
1943
+ *
1944
+ * The Initial Developer of the Original Code is
1945
+ * Ajax.org B.V.
1946
+ * Portions created by the Initial Developer are Copyright (C) 2010
1947
+ * the Initial Developer. All Rights Reserved.
1948
+ *
1949
+ * Contributor(s):
1950
+ * Fabian Jakobs <fabian AT ajax DOT org>
1951
+ *
1952
+ * Alternatively, the contents of this file may be used under the terms of
1953
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1954
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1955
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1956
+ * of those above. If you wish to allow use of your version of this file only
1957
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1958
+ * use your version of this file under the terms of the MPL, indicate your
1959
+ * decision by deleting the provisions above and replace them with the notice
1960
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1961
+ * the provisions above, a recipient may use your version of this file under
1962
+ * the terms of any one of the MPL, the GPL or the LGPL.
1963
+ *
1964
+ * ***** END LICENSE BLOCK ***** */
1965
+
1966
+ define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1967
+ "use strict";
1968
+
1969
+ var oop = require("../../lib/oop");
1970
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1971
+
1972
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1973
+ this.defaultMode = defaultMode;
1974
+ this.subModes = subModes;
1975
+ };
1976
+ oop.inherits(FoldMode, BaseFoldMode);
1977
+
1978
+ (function() {
1979
+
1980
+
1981
+ this.$getMode = function(state) {
1982
+ for (var key in this.subModes) {
1983
+ if (state.indexOf(key) === 0)
1984
+ return this.subModes[key];
1985
+ }
1986
+ return null;
1987
+ };
1988
+
1989
+ this.$tryMode = function(state, session, foldStyle, row) {
1990
+ var mode = this.$getMode(state);
1991
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1992
+ };
1993
+
1994
+ this.getFoldWidget = function(session, foldStyle, row) {
1995
+ return (
1996
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1997
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
1998
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
1999
+ );
2000
+ };
2001
+
2002
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
2003
+ var mode = this.$getMode(session.getState(row-1));
2004
+
2005
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2006
+ mode = this.$getMode(session.getState(row));
2007
+
2008
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2009
+ mode = this.defaultMode;
2010
+
2011
+ return mode.getFoldWidgetRange(session, foldStyle, row);
2012
+ };
2013
+
2014
+ }).call(FoldMode.prototype);
2015
+
2016
+ });