ace-rails-ap 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. data/.gitmodules +3 -0
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/update.sh +3 -0
  4. data/vendor/assets/javascripts/ace-compat-noconflict.js +1 -0
  5. data/vendor/assets/javascripts/ace-compat-uncompressed-noconflict.js +480 -0
  6. data/vendor/assets/javascripts/ace-compat-uncompressed.js +480 -0
  7. data/vendor/assets/javascripts/ace-compat.js +1 -0
  8. data/vendor/assets/javascripts/ace-noconflict.js +10 -0
  9. data/vendor/assets/javascripts/ace-uncompressed-noconflict.js +19976 -0
  10. data/vendor/assets/javascripts/ace-uncompressed.js +6568 -998
  11. data/vendor/assets/javascripts/ace.js +1 -1
  12. data/vendor/assets/javascripts/keybinding-emacs-noconflict.js +1 -0
  13. data/vendor/assets/javascripts/keybinding-emacs-uncompressed-noconflict.js +150 -0
  14. data/vendor/assets/javascripts/keybinding-emacs-uncompressed.js +150 -0
  15. data/vendor/assets/javascripts/keybinding-emacs.js +1 -1
  16. data/vendor/assets/javascripts/keybinding-vim-noconflict.js +1 -0
  17. data/vendor/assets/javascripts/keybinding-vim-uncompressed-noconflict.js +138 -0
  18. data/vendor/assets/javascripts/keybinding-vim-uncompressed.js +138 -0
  19. data/vendor/assets/javascripts/keybinding-vim.js +1 -1
  20. data/vendor/assets/javascripts/mode-c_cpp-noconflict.js +1 -0
  21. data/vendor/assets/javascripts/mode-c_cpp-uncompressed-noconflict.js +919 -0
  22. data/vendor/assets/javascripts/mode-c_cpp-uncompressed.js +919 -0
  23. data/vendor/assets/javascripts/mode-c_cpp.js +1 -1
  24. data/vendor/assets/javascripts/mode-clojure-noconflict.js +1 -0
  25. data/vendor/assets/javascripts/mode-clojure-uncompressed-noconflict.js +422 -0
  26. data/vendor/assets/javascripts/mode-clojure-uncompressed.js +422 -0
  27. data/vendor/assets/javascripts/mode-clojure.js +1 -1
  28. data/vendor/assets/javascripts/mode-coffee-noconflict.js +1 -0
  29. data/vendor/assets/javascripts/mode-coffee-uncompressed-noconflict.js +607 -0
  30. data/vendor/assets/javascripts/mode-coffee-uncompressed.js +607 -0
  31. data/vendor/assets/javascripts/mode-coffee.js +1 -1
  32. data/vendor/assets/javascripts/mode-coldfusion-noconflict.js +1 -0
  33. data/vendor/assets/javascripts/mode-coldfusion-uncompressed-noconflict.js +2458 -0
  34. data/vendor/assets/javascripts/mode-coldfusion-uncompressed.js +2458 -0
  35. data/vendor/assets/javascripts/mode-coldfusion.js +1 -0
  36. data/vendor/assets/javascripts/mode-csharp-noconflict.js +1 -0
  37. data/vendor/assets/javascripts/mode-csharp-uncompressed-noconflict.js +769 -0
  38. data/vendor/assets/javascripts/mode-csharp-uncompressed.js +769 -0
  39. data/vendor/assets/javascripts/mode-csharp.js +1 -1
  40. data/vendor/assets/javascripts/mode-css-noconflict.js +1 -0
  41. data/vendor/assets/javascripts/mode-css-uncompressed-noconflict.js +641 -0
  42. data/vendor/assets/javascripts/mode-css-uncompressed.js +641 -0
  43. data/vendor/assets/javascripts/mode-css.js +1 -1
  44. data/vendor/assets/javascripts/mode-golang-noconflict.js +1 -0
  45. data/vendor/assets/javascripts/mode-golang-uncompressed-noconflict.js +378 -0
  46. data/vendor/assets/javascripts/mode-golang-uncompressed.js +378 -0
  47. data/vendor/assets/javascripts/mode-golang.js +1 -0
  48. data/vendor/assets/javascripts/mode-groovy-noconflict.js +1 -0
  49. data/vendor/assets/javascripts/mode-groovy-uncompressed-noconflict.js +1393 -0
  50. data/vendor/assets/javascripts/mode-groovy-uncompressed.js +1393 -0
  51. data/vendor/assets/javascripts/mode-groovy.js +1 -1
  52. data/vendor/assets/javascripts/mode-haxe-noconflict.js +1 -0
  53. data/vendor/assets/javascripts/mode-haxe-uncompressed-noconflict.js +769 -0
  54. data/vendor/assets/javascripts/mode-haxe-uncompressed.js +769 -0
  55. data/vendor/assets/javascripts/mode-haxe.js +1 -0
  56. data/vendor/assets/javascripts/mode-html-noconflict.js +1 -0
  57. data/vendor/assets/javascripts/mode-html-uncompressed-noconflict.js +2475 -0
  58. data/vendor/assets/javascripts/mode-html-uncompressed.js +2475 -0
  59. data/vendor/assets/javascripts/mode-html.js +1 -1
  60. data/vendor/assets/javascripts/mode-java-noconflict.js +1 -0
  61. data/vendor/assets/javascripts/mode-java-uncompressed-noconflict.js +1395 -0
  62. data/vendor/assets/javascripts/mode-java-uncompressed.js +1395 -0
  63. data/vendor/assets/javascripts/mode-java.js +1 -1
  64. data/vendor/assets/javascripts/mode-javascript-noconflict.js +1 -0
  65. data/vendor/assets/javascripts/mode-javascript-uncompressed-noconflict.js +1226 -0
  66. data/vendor/assets/javascripts/mode-javascript-uncompressed.js +1226 -0
  67. data/vendor/assets/javascripts/mode-javascript.js +1 -1
  68. data/vendor/assets/javascripts/mode-json-noconflict.js +1 -0
  69. data/vendor/assets/javascripts/mode-json-uncompressed-noconflict.js +701 -0
  70. data/vendor/assets/javascripts/mode-json-uncompressed.js +701 -0
  71. data/vendor/assets/javascripts/mode-json.js +1 -1
  72. data/vendor/assets/javascripts/mode-latex-noconflict.js +1 -0
  73. data/vendor/assets/javascripts/mode-latex-uncompressed-noconflict.js +95 -0
  74. data/vendor/assets/javascripts/mode-latex-uncompressed.js +95 -0
  75. data/vendor/assets/javascripts/mode-less-noconflict.js +1 -0
  76. data/vendor/assets/javascripts/mode-less-uncompressed-noconflict.js +655 -0
  77. data/vendor/assets/javascripts/mode-less-uncompressed.js +655 -0
  78. data/vendor/assets/javascripts/mode-less.js +1 -0
  79. data/vendor/assets/javascripts/mode-liquid-noconflict.js +1 -0
  80. data/vendor/assets/javascripts/mode-liquid-uncompressed-noconflict.js +1353 -0
  81. data/vendor/assets/javascripts/mode-liquid-uncompressed.js +1353 -0
  82. data/vendor/assets/javascripts/mode-liquid.js +1 -0
  83. data/vendor/assets/javascripts/mode-lua-noconflict.js +1 -0
  84. data/vendor/assets/javascripts/mode-lua-uncompressed-noconflict.js +523 -0
  85. data/vendor/assets/javascripts/mode-lua-uncompressed.js +523 -0
  86. data/vendor/assets/javascripts/mode-markdown-noconflict.js +1 -0
  87. data/vendor/assets/javascripts/mode-markdown-uncompressed-noconflict.js +2925 -0
  88. data/vendor/assets/javascripts/mode-markdown-uncompressed.js +2925 -0
  89. data/vendor/assets/javascripts/mode-markdown.js +1 -1
  90. data/vendor/assets/javascripts/mode-ocaml-noconflict.js +1 -0
  91. data/vendor/assets/javascripts/mode-ocaml-uncompressed-noconflict.js +539 -0
  92. data/vendor/assets/javascripts/mode-ocaml-uncompressed.js +539 -0
  93. data/vendor/assets/javascripts/mode-ocaml.js +1 -1
  94. data/vendor/assets/javascripts/mode-perl-noconflict.js +1 -0
  95. data/vendor/assets/javascripts/mode-perl-uncompressed-noconflict.js +574 -0
  96. data/vendor/assets/javascripts/mode-perl-uncompressed.js +574 -0
  97. data/vendor/assets/javascripts/mode-perl.js +1 -1
  98. data/vendor/assets/javascripts/mode-pgsql-noconflict.js +1 -0
  99. data/vendor/assets/javascripts/mode-pgsql-uncompressed-noconflict.js +1104 -0
  100. data/vendor/assets/javascripts/mode-pgsql-uncompressed.js +1104 -0
  101. data/vendor/assets/javascripts/mode-pgsql.js +1 -0
  102. data/vendor/assets/javascripts/mode-php-noconflict.js +1 -0
  103. data/vendor/assets/javascripts/mode-php-uncompressed-noconflict.js +1885 -0
  104. data/vendor/assets/javascripts/mode-php-uncompressed.js +1885 -0
  105. data/vendor/assets/javascripts/mode-php.js +1 -1
  106. data/vendor/assets/javascripts/mode-powershell-noconflict.js +1 -0
  107. data/vendor/assets/javascripts/mode-powershell-uncompressed-noconflict.js +710 -0
  108. data/vendor/assets/javascripts/mode-powershell-uncompressed.js +710 -0
  109. data/vendor/assets/javascripts/mode-powershell.js +1 -0
  110. data/vendor/assets/javascripts/mode-python-noconflict.js +1 -0
  111. data/vendor/assets/javascripts/mode-python-uncompressed-noconflict.js +507 -0
  112. data/vendor/assets/javascripts/mode-python-uncompressed.js +507 -0
  113. data/vendor/assets/javascripts/mode-python.js +1 -1
  114. data/vendor/assets/javascripts/mode-ruby-noconflict.js +1 -0
  115. data/vendor/assets/javascripts/mode-ruby-uncompressed-noconflict.js +391 -0
  116. data/vendor/assets/javascripts/mode-ruby-uncompressed.js +391 -0
  117. data/vendor/assets/javascripts/mode-ruby.js +1 -1
  118. data/vendor/assets/javascripts/mode-scad-noconflict.js +1 -0
  119. data/vendor/assets/javascripts/mode-scad-uncompressed-noconflict.js +907 -0
  120. data/vendor/assets/javascripts/mode-scad-uncompressed.js +907 -0
  121. data/vendor/assets/javascripts/mode-scad.js +1 -1
  122. data/vendor/assets/javascripts/mode-scala-noconflict.js +1 -0
  123. data/vendor/assets/javascripts/mode-scala-uncompressed-noconflict.js +1395 -0
  124. data/vendor/assets/javascripts/mode-scala-uncompressed.js +1395 -0
  125. data/vendor/assets/javascripts/mode-scala.js +1 -1
  126. data/vendor/assets/javascripts/mode-scss-noconflict.js +1 -0
  127. data/vendor/assets/javascripts/mode-scss-uncompressed-noconflict.js +679 -0
  128. data/vendor/assets/javascripts/mode-scss-uncompressed.js +679 -0
  129. data/vendor/assets/javascripts/mode-scss.js +1 -1
  130. data/vendor/assets/javascripts/mode-sh-noconflict.js +1 -0
  131. data/vendor/assets/javascripts/mode-sh-uncompressed-noconflict.js +289 -0
  132. data/vendor/assets/javascripts/mode-sh-uncompressed.js +289 -0
  133. data/vendor/assets/javascripts/mode-sh.js +1 -0
  134. data/vendor/assets/javascripts/mode-sql-noconflict.js +1 -0
  135. data/vendor/assets/javascripts/mode-sql-uncompressed-noconflict.js +159 -0
  136. data/vendor/assets/javascripts/mode-sql-uncompressed.js +159 -0
  137. data/vendor/assets/javascripts/mode-sql.js +1 -0
  138. data/vendor/assets/javascripts/mode-svg-noconflict.js +1 -0
  139. data/vendor/assets/javascripts/mode-svg-uncompressed-noconflict.js +2137 -0
  140. data/vendor/assets/javascripts/mode-svg-uncompressed.js +2137 -0
  141. data/vendor/assets/javascripts/mode-svg.js +1 -1
  142. data/vendor/assets/javascripts/mode-text-noconflict.js +0 -0
  143. data/vendor/assets/javascripts/mode-text-uncompressed-noconflict.js +0 -0
  144. data/vendor/assets/javascripts/mode-text-uncompressed.js +0 -0
  145. data/vendor/assets/javascripts/mode-text.js +0 -0
  146. data/vendor/assets/javascripts/mode-textile-noconflict.js +1 -0
  147. data/vendor/assets/javascripts/mode-textile-uncompressed-noconflict.js +254 -0
  148. data/vendor/assets/javascripts/mode-textile-uncompressed.js +254 -0
  149. data/vendor/assets/javascripts/mode-textile.js +1 -1
  150. data/vendor/assets/javascripts/mode-xml-noconflict.js +1 -0
  151. data/vendor/assets/javascripts/mode-xml-uncompressed-noconflict.js +1012 -0
  152. data/vendor/assets/javascripts/mode-xml-uncompressed.js +1012 -0
  153. data/vendor/assets/javascripts/mode-xml.js +1 -1
  154. data/vendor/assets/javascripts/mode-xquery-noconflict.js +1 -0
  155. data/vendor/assets/javascripts/mode-xquery-uncompressed-noconflict.js +540 -0
  156. data/vendor/assets/javascripts/mode-xquery-uncompressed.js +540 -0
  157. data/vendor/assets/javascripts/mode-xquery.js +1 -0
  158. data/vendor/assets/javascripts/theme-chrome-noconflict.js +1 -0
  159. data/vendor/assets/javascripts/theme-chrome-uncompressed-noconflict.js +207 -0
  160. data/vendor/assets/javascripts/theme-chrome-uncompressed.js +207 -0
  161. data/vendor/assets/javascripts/theme-chrome.js +1 -0
  162. data/vendor/assets/javascripts/theme-clouds-noconflict.js +1 -0
  163. data/vendor/assets/javascripts/theme-clouds-uncompressed-noconflict.js +160 -0
  164. data/vendor/assets/javascripts/theme-clouds-uncompressed.js +160 -0
  165. data/vendor/assets/javascripts/theme-clouds.js +1 -1
  166. data/vendor/assets/javascripts/theme-clouds_midnight-noconflict.js +1 -0
  167. data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed-noconflict.js +161 -0
  168. data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed.js +161 -0
  169. data/vendor/assets/javascripts/theme-clouds_midnight.js +1 -1
  170. data/vendor/assets/javascripts/theme-cobalt-noconflict.js +1 -0
  171. data/vendor/assets/javascripts/theme-cobalt-uncompressed-noconflict.js +187 -0
  172. data/vendor/assets/javascripts/theme-cobalt-uncompressed.js +187 -0
  173. data/vendor/assets/javascripts/theme-cobalt.js +1 -1
  174. data/vendor/assets/javascripts/theme-crimson_editor-noconflict.js +1 -0
  175. data/vendor/assets/javascripts/theme-crimson_editor-uncompressed-noconflict.js +198 -0
  176. data/vendor/assets/javascripts/theme-crimson_editor-uncompressed.js +198 -0
  177. data/vendor/assets/javascripts/theme-dawn-noconflict.js +1 -0
  178. data/vendor/assets/javascripts/theme-dawn-uncompressed-noconflict.js +191 -0
  179. data/vendor/assets/javascripts/theme-dawn-uncompressed.js +191 -0
  180. data/vendor/assets/javascripts/theme-dawn.js +1 -1
  181. data/vendor/assets/javascripts/theme-dreamweaver-noconflict.js +1 -0
  182. data/vendor/assets/javascripts/theme-dreamweaver-uncompressed-noconflict.js +227 -0
  183. data/vendor/assets/javascripts/theme-dreamweaver-uncompressed.js +227 -0
  184. data/vendor/assets/javascripts/theme-dreamweaver.js +1 -0
  185. data/vendor/assets/javascripts/theme-eclipse-noconflict.js +1 -0
  186. data/vendor/assets/javascripts/theme-eclipse-uncompressed-noconflict.js +147 -0
  187. data/vendor/assets/javascripts/theme-eclipse-uncompressed.js +147 -0
  188. data/vendor/assets/javascripts/theme-eclipse.js +1 -1
  189. data/vendor/assets/javascripts/theme-idle_fingers-noconflict.js +1 -0
  190. data/vendor/assets/javascripts/theme-idle_fingers-uncompressed-noconflict.js +179 -0
  191. data/vendor/assets/javascripts/theme-idle_fingers-uncompressed.js +179 -0
  192. data/vendor/assets/javascripts/theme-idle_fingers.js +1 -1
  193. data/vendor/assets/javascripts/theme-kr_theme-noconflict.js +1 -0
  194. data/vendor/assets/javascripts/theme-kr_theme-uncompressed-noconflict.js +182 -0
  195. data/vendor/assets/javascripts/theme-kr_theme-uncompressed.js +182 -0
  196. data/vendor/assets/javascripts/theme-kr_theme.js +1 -1
  197. data/vendor/assets/javascripts/theme-merbivore-noconflict.js +1 -0
  198. data/vendor/assets/javascripts/theme-merbivore-uncompressed-noconflict.js +182 -0
  199. data/vendor/assets/javascripts/theme-merbivore-uncompressed.js +182 -0
  200. data/vendor/assets/javascripts/theme-merbivore.js +1 -1
  201. data/vendor/assets/javascripts/theme-merbivore_soft-noconflict.js +1 -0
  202. data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed-noconflict.js +188 -0
  203. data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed.js +188 -0
  204. data/vendor/assets/javascripts/theme-merbivore_soft.js +1 -1
  205. data/vendor/assets/javascripts/theme-mono_industrial-noconflict.js +1 -0
  206. data/vendor/assets/javascripts/theme-mono_industrial-uncompressed-noconflict.js +190 -0
  207. data/vendor/assets/javascripts/theme-mono_industrial-uncompressed.js +190 -0
  208. data/vendor/assets/javascripts/theme-mono_industrial.js +1 -1
  209. data/vendor/assets/javascripts/theme-monokai-noconflict.js +1 -0
  210. data/vendor/assets/javascripts/theme-monokai-uncompressed-noconflict.js +191 -0
  211. data/vendor/assets/javascripts/theme-monokai-uncompressed.js +191 -0
  212. data/vendor/assets/javascripts/theme-monokai.js +1 -1
  213. data/vendor/assets/javascripts/theme-pastel_on_dark-noconflict.js +1 -0
  214. data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed-noconflict.js +192 -0
  215. data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed.js +192 -0
  216. data/vendor/assets/javascripts/theme-pastel_on_dark.js +1 -1
  217. data/vendor/assets/javascripts/theme-solarized_dark-noconflict.js +1 -0
  218. data/vendor/assets/javascripts/theme-solarized_dark-uncompressed-noconflict.js +176 -0
  219. data/vendor/assets/javascripts/theme-solarized_dark-uncompressed.js +176 -0
  220. data/vendor/assets/javascripts/theme-solarized_dark.js +1 -1
  221. data/vendor/assets/javascripts/theme-solarized_light-noconflict.js +1 -0
  222. data/vendor/assets/javascripts/theme-solarized_light-uncompressed-noconflict.js +172 -0
  223. data/vendor/assets/javascripts/theme-solarized_light-uncompressed.js +172 -0
  224. data/vendor/assets/javascripts/theme-solarized_light.js +1 -1
  225. data/vendor/assets/javascripts/theme-textmate-noconflict.js +0 -0
  226. data/vendor/assets/javascripts/theme-textmate-uncompressed-noconflict.js +0 -0
  227. data/vendor/assets/javascripts/theme-textmate-uncompressed.js +0 -0
  228. data/vendor/assets/javascripts/theme-tomorrow-noconflict.js +1 -0
  229. data/vendor/assets/javascripts/theme-tomorrow-uncompressed-noconflict.js +206 -0
  230. data/vendor/assets/javascripts/theme-tomorrow-uncompressed.js +206 -0
  231. data/vendor/assets/javascripts/theme-tomorrow.js +1 -1
  232. data/vendor/assets/javascripts/theme-tomorrow_night-noconflict.js +1 -0
  233. data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed-noconflict.js +206 -0
  234. data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed.js +206 -0
  235. data/vendor/assets/javascripts/theme-tomorrow_night.js +1 -1
  236. data/vendor/assets/javascripts/theme-tomorrow_night_blue-noconflict.js +1 -0
  237. data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed-noconflict.js +209 -0
  238. data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed.js +209 -0
  239. data/vendor/assets/javascripts/theme-tomorrow_night_blue.js +1 -1
  240. data/vendor/assets/javascripts/theme-tomorrow_night_bright-noconflict.js +1 -0
  241. data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed-noconflict.js +206 -0
  242. data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed.js +206 -0
  243. data/vendor/assets/javascripts/theme-tomorrow_night_bright.js +1 -1
  244. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-noconflict.js +1 -0
  245. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed-noconflict.js +202 -0
  246. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed.js +202 -0
  247. data/vendor/assets/javascripts/theme-tomorrow_night_eighties.js +1 -1
  248. data/vendor/assets/javascripts/theme-twilight-noconflict.js +1 -0
  249. data/vendor/assets/javascripts/theme-twilight-uncompressed-noconflict.js +204 -0
  250. data/vendor/assets/javascripts/theme-twilight-uncompressed.js +204 -0
  251. data/vendor/assets/javascripts/theme-twilight.js +1 -1
  252. data/vendor/assets/javascripts/theme-vibrant_ink-noconflict.js +1 -0
  253. data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed-noconflict.js +183 -0
  254. data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed.js +183 -0
  255. data/vendor/assets/javascripts/theme-vibrant_ink.js +1 -1
  256. data/vendor/assets/javascripts/worker-coffee.js +2367 -1425
  257. data/vendor/assets/javascripts/worker-css.js +3271 -582
  258. data/vendor/assets/javascripts/worker-javascript.js +4313 -2934
  259. data/vendor/assets/javascripts/worker-json.js +3597 -0
  260. metadata +225 -7
@@ -0,0 +1,1395 @@
1
+ define('ace/mode/scala', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/scala_highlight_rules'], function(require, exports, module) {
2
+ "use strict";
3
+
4
+ var oop = require("../lib/oop");
5
+ var JavaScriptMode = require("./javascript").Mode;
6
+ var Tokenizer = require("../tokenizer").Tokenizer;
7
+ var ScalaHighlightRules = require("./scala_highlight_rules").ScalaHighlightRules;
8
+
9
+ var Mode = function() {
10
+ JavaScriptMode.call(this);
11
+
12
+ this.$tokenizer = new Tokenizer(new ScalaHighlightRules().getRules());
13
+ };
14
+ oop.inherits(Mode, JavaScriptMode);
15
+
16
+ (function() {
17
+
18
+ this.createWorker = function(session) {
19
+ return null;
20
+ };
21
+
22
+ }).call(Mode.prototype);
23
+
24
+ exports.Mode = Mode;
25
+ });
26
+ /* ***** BEGIN LICENSE BLOCK *****
27
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
28
+ *
29
+ * The contents of this file are subject to the Mozilla Public License Version
30
+ * 1.1 (the "License"); you may not use this file except in compliance with
31
+ * the License. You may obtain a copy of the License at
32
+ * http://www.mozilla.org/MPL/
33
+ *
34
+ * Software distributed under the License is distributed on an "AS IS" basis,
35
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
36
+ * for the specific language governing rights and limitations under the
37
+ * License.
38
+ *
39
+ * The Original Code is Ajax.org Code Editor (ACE).
40
+ *
41
+ * The Initial Developer of the Original Code is
42
+ * Ajax.org B.V.
43
+ * Portions created by the Initial Developer are Copyright (C) 2010
44
+ * the Initial Developer. All Rights Reserved.
45
+ *
46
+ * Contributor(s):
47
+ * Fabian Jakobs <fabian AT ajax DOT org>
48
+ *
49
+ * Alternatively, the contents of this file may be used under the terms of
50
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
51
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
52
+ * in which case the provisions of the GPL or the LGPL are applicable instead
53
+ * of those above. If you wish to allow use of your version of this file only
54
+ * under the terms of either the GPL or the LGPL, and not to allow others to
55
+ * use your version of this file under the terms of the MPL, indicate your
56
+ * decision by deleting the provisions above and replace them with the notice
57
+ * and other provisions required by the GPL or the LGPL. If you do not delete
58
+ * the provisions above, a recipient may use your version of this file under
59
+ * the terms of any one of the MPL, the GPL or the LGPL.
60
+ *
61
+ * ***** END LICENSE BLOCK ***** */
62
+
63
+ 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) {
64
+ "use strict";
65
+
66
+ var oop = require("../lib/oop");
67
+ var TextMode = require("./text").Mode;
68
+ var Tokenizer = require("../tokenizer").Tokenizer;
69
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
70
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
71
+ var Range = require("../range").Range;
72
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
73
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
74
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
75
+
76
+ var Mode = function() {
77
+ this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
78
+ this.$outdent = new MatchingBraceOutdent();
79
+ this.$behaviour = new CstyleBehaviour();
80
+ this.foldingRules = new CStyleFoldMode();
81
+ };
82
+ oop.inherits(Mode, TextMode);
83
+
84
+ (function() {
85
+
86
+
87
+ this.toggleCommentLines = function(state, doc, startRow, endRow) {
88
+ var outdent = true;
89
+ var re = /^(\s*)\/\//;
90
+
91
+ for (var i=startRow; i<= endRow; i++) {
92
+ if (!re.test(doc.getLine(i))) {
93
+ outdent = false;
94
+ break;
95
+ }
96
+ }
97
+
98
+ if (outdent) {
99
+ var deleteRange = new Range(0, 0, 0, 0);
100
+ for (var i=startRow; i<= endRow; i++)
101
+ {
102
+ var line = doc.getLine(i);
103
+ var m = line.match(re);
104
+ deleteRange.start.row = i;
105
+ deleteRange.end.row = i;
106
+ deleteRange.end.column = m[0].length;
107
+ doc.replace(deleteRange, m[1]);
108
+ }
109
+ }
110
+ else {
111
+ doc.indentRows(startRow, endRow, "//");
112
+ }
113
+ };
114
+
115
+ this.getNextLineIndent = function(state, line, tab) {
116
+ var indent = this.$getIndent(line);
117
+
118
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
119
+ var tokens = tokenizedLine.tokens;
120
+ var endState = tokenizedLine.state;
121
+
122
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
123
+ return indent;
124
+ }
125
+
126
+ if (state == "start" || state == "regex_allowed") {
127
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
128
+ if (match) {
129
+ indent += tab;
130
+ }
131
+ } else if (state == "doc-start") {
132
+ if (endState == "start" || state == "regex_allowed") {
133
+ return "";
134
+ }
135
+ var match = line.match(/^\s*(\/?)\*/);
136
+ if (match) {
137
+ if (match[1]) {
138
+ indent += " ";
139
+ }
140
+ indent += "* ";
141
+ }
142
+ }
143
+
144
+ return indent;
145
+ };
146
+
147
+ this.checkOutdent = function(state, line, input) {
148
+ return this.$outdent.checkOutdent(line, input);
149
+ };
150
+
151
+ this.autoOutdent = function(state, doc, row) {
152
+ this.$outdent.autoOutdent(doc, row);
153
+ };
154
+
155
+ this.createWorker = function(session) {
156
+ var worker = new WorkerClient(["ace"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
157
+ worker.attachToDocument(session.getDocument());
158
+
159
+ worker.on("jslint", function(results) {
160
+ var errors = [];
161
+ for (var i=0; i<results.data.length; i++) {
162
+ var error = results.data[i];
163
+ if (error)
164
+ errors.push({
165
+ row: error.line-1,
166
+ column: error.character-1,
167
+ text: error.reason,
168
+ type: "warning",
169
+ lint: error
170
+ });
171
+ }
172
+ session.setAnnotations(errors);
173
+ });
174
+
175
+ worker.on("narcissus", function(e) {
176
+ session.setAnnotations([e.data]);
177
+ });
178
+
179
+ worker.on("terminate", function() {
180
+ session.clearAnnotations();
181
+ });
182
+
183
+ return worker;
184
+ };
185
+
186
+ }).call(Mode.prototype);
187
+
188
+ exports.Mode = Mode;
189
+ });
190
+ /* ***** BEGIN LICENSE BLOCK *****
191
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
192
+ *
193
+ * The contents of this file are subject to the Mozilla Public License Version
194
+ * 1.1 (the "License"); you may not use this file except in compliance with
195
+ * the License. You may obtain a copy of the License at
196
+ * http://www.mozilla.org/MPL/
197
+ *
198
+ * Software distributed under the License is distributed on an "AS IS" basis,
199
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
200
+ * for the specific language governing rights and limitations under the
201
+ * License.
202
+ *
203
+ * The Original Code is Ajax.org Code Editor (ACE).
204
+ *
205
+ * The Initial Developer of the Original Code is
206
+ * Ajax.org B.V.
207
+ * Portions created by the Initial Developer are Copyright (C) 2010
208
+ * the Initial Developer. All Rights Reserved.
209
+ *
210
+ * Contributor(s):
211
+ * Fabian Jakobs <fabian AT ajax DOT org>
212
+ * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
213
+ *
214
+ * Alternatively, the contents of this file may be used under the terms of
215
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
216
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
217
+ * in which case the provisions of the GPL or the LGPL are applicable instead
218
+ * of those above. If you wish to allow use of your version of this file only
219
+ * under the terms of either the GPL or the LGPL, and not to allow others to
220
+ * use your version of this file under the terms of the MPL, indicate your
221
+ * decision by deleting the provisions above and replace them with the notice
222
+ * and other provisions required by the GPL or the LGPL. If you do not delete
223
+ * the provisions above, a recipient may use your version of this file under
224
+ * the terms of any one of the MPL, the GPL or the LGPL.
225
+ *
226
+ * ***** END LICENSE BLOCK ***** */
227
+
228
+ 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) {
229
+ "use strict";
230
+
231
+ var oop = require("../lib/oop");
232
+ var lang = require("../lib/lang");
233
+ var unicode = require("../unicode");
234
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
235
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
236
+
237
+ var JavaScriptHighlightRules = function() {
238
+
239
+ // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
240
+ var globals = lang.arrayToMap(
241
+ // Constructors
242
+ ("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" +
243
+ // E4X
244
+ "Namespace|QName|XML|XMLList|" +
245
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
246
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
247
+ // Errors
248
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
249
+ "SyntaxError|TypeError|URIError|" +
250
+ // Non-constructor functions
251
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
252
+ "isNaN|parseFloat|parseInt|" +
253
+ // Other
254
+ "JSON|Math|" +
255
+ // Pseudo
256
+ "this|arguments|prototype|window|document"
257
+ ).split("|")
258
+ );
259
+
260
+ var keywords = lang.arrayToMap(
261
+ ("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
262
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
263
+ "const|yield|import|get|set").split("|")
264
+ );
265
+
266
+ // keywords which can be followed by regular expressions
267
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
268
+
269
+ var deprecated = lang.arrayToMap(
270
+ ("__parent__|__count__|escape|unescape|with|__proto__").split("|")
271
+ );
272
+
273
+ var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
274
+
275
+ var buildinConstants = lang.arrayToMap(
276
+ ("null|Infinity|NaN|undefined").split("|")
277
+ );
278
+
279
+ var futureReserved = lang.arrayToMap(
280
+ ("class|enum|extends|super|export|implements|private|" +
281
+ "public|interface|package|protected|static").split("|")
282
+ );
283
+
284
+ // TODO: Unicode escape sequences
285
+ var identifierRe = "[" + unicode.packages.L + "\\$_]["
286
+ + unicode.packages.L
287
+ + unicode.packages.Mn + unicode.packages.Mc
288
+ + unicode.packages.Nd
289
+ + unicode.packages.Pc + "\\$_]*\\b";
290
+
291
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
292
+ "u[0-9a-fA-F]{4}|" + // unicode
293
+ "[0-2][0-7]{0,2}|" + // oct
294
+ "3[0-6][0-7]?|" + // oct
295
+ "37[0-7]?|" + // oct
296
+ "[4-7][0-7]?|" + //oct
297
+ ".)";
298
+
299
+ // regexp must not have capturing parentheses. Use (?:) instead.
300
+ // regexps are ordered -> the first match is used
301
+
302
+ this.$rules = {
303
+ "start" : [
304
+ {
305
+ token : "comment",
306
+ regex : /\/\/.*$/
307
+ },
308
+ DocCommentHighlightRules.getStartRule("doc-start"),
309
+ {
310
+ token : "comment", // multi line comment
311
+ merge : true,
312
+ regex : /\/\*/,
313
+ next : "comment"
314
+ }, {
315
+ token : "string",
316
+ regex : "'(?=.)",
317
+ next : "qstring"
318
+ }, {
319
+ token : "string",
320
+ regex : '"(?=.)',
321
+ next : "qqstring"
322
+ }, {
323
+ token : "constant.numeric", // hex
324
+ regex : /0[xX][0-9a-fA-F]+\b/
325
+ }, {
326
+ token : "constant.numeric", // float
327
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
328
+ }, { // match stuff like: Sound.prototype.play = function() { }
329
+ token : [
330
+ "storage.type",
331
+ "punctuation.operator",
332
+ "support.function",
333
+ "punctuation.operator",
334
+ "entity.name.function",
335
+ "text",
336
+ "keyword.operator",
337
+ "text",
338
+ "storage.type",
339
+ "text",
340
+ "paren.lparen"
341
+ ],
342
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
343
+ next: "function_arguments"
344
+ }, { // match stuff like: Sound.prototype.play = myfunc
345
+ token : [
346
+ "storage.type",
347
+ "punctuation.operator",
348
+ "support.function",
349
+ "punctuation.operator",
350
+ "entity.name.function",
351
+ "text",
352
+ "keyword.operator",
353
+ "text"
354
+ ],
355
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
356
+ next: "function_arguments"
357
+ }, { // match stuff like: Sound.play = function() { }
358
+ token : [
359
+ "storage.type",
360
+ "punctuation.operator",
361
+ "entity.name.function",
362
+ "text",
363
+ "keyword.operator",
364
+ "text",
365
+ "storage.type",
366
+ "text",
367
+ "paren.lparen"
368
+ ],
369
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
370
+ next: "function_arguments"
371
+ }, { // match stuff like: play = function() { }
372
+ token : [
373
+ "entity.name.function",
374
+ "text",
375
+ "keyword.operator",
376
+ "text",
377
+ "storage.type",
378
+ "text",
379
+ "paren.lparen"
380
+ ],
381
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
382
+ next: "function_arguments"
383
+ }, { // match regular function like: function myFunc(arg) { }
384
+ token : [
385
+ "storage.type",
386
+ "text",
387
+ "entity.name.function",
388
+ "text",
389
+ "paren.lparen"
390
+ ],
391
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
392
+ next: "function_arguments"
393
+ }, { // match stuff like: foobar: function() { }
394
+ token : [
395
+ "entity.name.function",
396
+ "text",
397
+ "punctuation.operator",
398
+ "text",
399
+ "storage.type",
400
+ "text",
401
+ "paren.lparen"
402
+ ],
403
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
404
+ next: "function_arguments"
405
+ }, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
406
+ token : [
407
+ "text",
408
+ "text",
409
+ "storage.type",
410
+ "text",
411
+ "paren.lparen"
412
+ ],
413
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
414
+ next: "function_arguments"
415
+ }, {
416
+ token : "constant.language.boolean",
417
+ regex : /(?:true|false)\b/
418
+ }, {
419
+ token : "keyword",
420
+ regex : "(?:" + kwBeforeRe + ")\\b",
421
+ next : "regex_allowed"
422
+ }, {
423
+ token : ["punctuation.operator", "support.function"],
424
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
425
+ }, {
426
+ token : ["punctuation.operator", "support.function.dom"],
427
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
428
+ }, {
429
+ token : ["punctuation.operator", "support.constant"],
430
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
431
+ }, {
432
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
433
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
434
+ }, {
435
+ token : function(value) {
436
+ if (globals.hasOwnProperty(value))
437
+ return "variable.language";
438
+ else if (deprecated.hasOwnProperty(value))
439
+ return "invalid.deprecated";
440
+ else if (definitions.hasOwnProperty(value))
441
+ return "storage.type";
442
+ else if (keywords.hasOwnProperty(value))
443
+ return "keyword";
444
+ else if (buildinConstants.hasOwnProperty(value))
445
+ return "constant.language";
446
+ else if (futureReserved.hasOwnProperty(value))
447
+ return "invalid.illegal";
448
+ else if (value == "debugger")
449
+ return "invalid.deprecated";
450
+ else
451
+ return "identifier";
452
+ },
453
+ regex : identifierRe
454
+ }, {
455
+ token : "keyword.operator",
456
+ regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
457
+ next : "regex_allowed"
458
+ }, {
459
+ token : "punctuation.operator",
460
+ regex : /\?|\:|\,|\;|\./,
461
+ next : "regex_allowed"
462
+ }, {
463
+ token : "paren.lparen",
464
+ regex : /[\[({]/,
465
+ next : "regex_allowed"
466
+ }, {
467
+ token : "paren.rparen",
468
+ regex : /[\])}]/
469
+ }, {
470
+ token : "keyword.operator",
471
+ regex : /\/=?/,
472
+ next : "regex_allowed"
473
+ }, {
474
+ token: "comment",
475
+ regex: /^#!.*$/
476
+ }, {
477
+ token : "text",
478
+ regex : /\s+/
479
+ }
480
+ ],
481
+ // regular expressions are only allowed after certain tokens. This
482
+ // makes sure we don't mix up regexps with the divison operator
483
+ "regex_allowed": [
484
+ DocCommentHighlightRules.getStartRule("doc-start"),
485
+ {
486
+ token : "comment", // multi line comment
487
+ merge : true,
488
+ regex : "\\/\\*",
489
+ next : "comment_regex_allowed"
490
+ }, {
491
+ token : "comment",
492
+ regex : "\\/\\/.*$"
493
+ }, {
494
+ token: "string.regexp",
495
+ regex: "\\/",
496
+ next: "regex",
497
+ merge: true
498
+ }, {
499
+ token : "text",
500
+ regex : "\\s+"
501
+ }, {
502
+ // immediately return to the start mode without matching
503
+ // anything
504
+ token: "empty",
505
+ regex: "",
506
+ next: "start"
507
+ }
508
+ ],
509
+ "regex": [
510
+ {
511
+ token: "regexp.keyword.operator",
512
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
513
+ }, {
514
+ // flag
515
+ token: "string.regexp",
516
+ regex: "/\\w*",
517
+ next: "start",
518
+ merge: true
519
+ }, {
520
+ token: "string.regexp",
521
+ regex: "[^\\\\/\\[]+",
522
+ merge: true
523
+ }, {
524
+ token: "string.regexp.charachterclass",
525
+ regex: "\\[",
526
+ next: "regex_character_class",
527
+ merge: true
528
+ }, {
529
+ token: "empty",
530
+ regex: "",
531
+ next: "start"
532
+ }
533
+ ],
534
+ "regex_character_class": [
535
+ {
536
+ token: "regexp.keyword.operator",
537
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
538
+ }, {
539
+ token: "string.regexp.charachterclass",
540
+ regex: "]",
541
+ next: "regex",
542
+ merge: true
543
+ }, {
544
+ token: "string.regexp.charachterclass",
545
+ regex: "[^\\\\\\]]+",
546
+ merge: true
547
+ }, {
548
+ token: "empty",
549
+ regex: "",
550
+ next: "start"
551
+ }
552
+ ],
553
+ "function_arguments": [
554
+ {
555
+ token: "variable.parameter",
556
+ regex: identifierRe,
557
+ }, {
558
+ token: "punctuation.operator",
559
+ regex: "[, ]+",
560
+ merge: true
561
+ }, {
562
+ token: "punctuation.operator",
563
+ regex: "$",
564
+ merge: true
565
+ }, {
566
+ token: "empty",
567
+ regex: "",
568
+ next: "start"
569
+ }
570
+ ],
571
+ "comment_regex_allowed" : [
572
+ {
573
+ token : "comment", // closing comment
574
+ regex : ".*?\\*\\/",
575
+ merge : true,
576
+ next : "regex_allowed"
577
+ }, {
578
+ token : "comment", // comment spanning whole line
579
+ merge : true,
580
+ regex : ".+"
581
+ }
582
+ ],
583
+ "comment" : [
584
+ {
585
+ token : "comment", // closing comment
586
+ regex : ".*?\\*\\/",
587
+ merge : true,
588
+ next : "start"
589
+ }, {
590
+ token : "comment", // comment spanning whole line
591
+ merge : true,
592
+ regex : ".+"
593
+ }
594
+ ],
595
+ "qqstring" : [
596
+ {
597
+ token : "constant.language.escape",
598
+ regex : escapedRe
599
+ }, {
600
+ token : "string",
601
+ regex : '[^"\\\\]+',
602
+ merge : true
603
+ }, {
604
+ token : "string",
605
+ regex : "\\\\$",
606
+ next : "qqstring",
607
+ merge : true
608
+ }, {
609
+ token : "string",
610
+ regex : '"|$',
611
+ next : "start",
612
+ merge : true
613
+ }
614
+ ],
615
+ "qstring" : [
616
+ {
617
+ token : "constant.language.escape",
618
+ regex : escapedRe
619
+ }, {
620
+ token : "string",
621
+ regex : "[^'\\\\]+",
622
+ merge : true
623
+ }, {
624
+ token : "string",
625
+ regex : "\\\\$",
626
+ next : "qstring",
627
+ merge : true
628
+ }, {
629
+ token : "string",
630
+ regex : "'|$",
631
+ next : "start",
632
+ merge : true
633
+ }
634
+ ]
635
+ };
636
+
637
+ this.embedRules(DocCommentHighlightRules, "doc-",
638
+ [ DocCommentHighlightRules.getEndRule("start") ]);
639
+ };
640
+
641
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
642
+
643
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
644
+ });
645
+ /* ***** BEGIN LICENSE BLOCK *****
646
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
647
+ *
648
+ * The contents of this file are subject to the Mozilla Public License Version
649
+ * 1.1 (the "License"); you may not use this file except in compliance with
650
+ * the License. You may obtain a copy of the License at
651
+ * http://www.mozilla.org/MPL/
652
+ *
653
+ * Software distributed under the License is distributed on an "AS IS" basis,
654
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
655
+ * for the specific language governing rights and limitations under the
656
+ * License.
657
+ *
658
+ * The Original Code is Ajax.org Code Editor (ACE).
659
+ *
660
+ * The Initial Developer of the Original Code is
661
+ * Ajax.org B.V.
662
+ * Portions created by the Initial Developer are Copyright (C) 2010
663
+ * the Initial Developer. All Rights Reserved.
664
+ *
665
+ * Contributor(s):
666
+ * Fabian Jakobs <fabian AT ajax DOT org>
667
+ *
668
+ * Alternatively, the contents of this file may be used under the terms of
669
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
670
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
671
+ * in which case the provisions of the GPL or the LGPL are applicable instead
672
+ * of those above. If you wish to allow use of your version of this file only
673
+ * under the terms of either the GPL or the LGPL, and not to allow others to
674
+ * use your version of this file under the terms of the MPL, indicate your
675
+ * decision by deleting the provisions above and replace them with the notice
676
+ * and other provisions required by the GPL or the LGPL. If you do not delete
677
+ * the provisions above, a recipient may use your version of this file under
678
+ * the terms of any one of the MPL, the GPL or the LGPL.
679
+ *
680
+ * ***** END LICENSE BLOCK ***** */
681
+
682
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
683
+ "use strict";
684
+
685
+ var oop = require("../lib/oop");
686
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
687
+
688
+ var DocCommentHighlightRules = function() {
689
+
690
+ this.$rules = {
691
+ "start" : [ {
692
+ token : "comment.doc.tag",
693
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
694
+ }, {
695
+ token : "comment.doc",
696
+ merge : true,
697
+ regex : "\\s+"
698
+ }, {
699
+ token : "comment.doc",
700
+ merge : true,
701
+ regex : "TODO"
702
+ }, {
703
+ token : "comment.doc",
704
+ merge : true,
705
+ regex : "[^@\\*]+"
706
+ }, {
707
+ token : "comment.doc",
708
+ merge : true,
709
+ regex : "."
710
+ }]
711
+ };
712
+ };
713
+
714
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
715
+
716
+ DocCommentHighlightRules.getStartRule = function(start) {
717
+ return {
718
+ token : "comment.doc", // doc comment
719
+ merge : true,
720
+ regex : "\\/\\*(?=\\*)",
721
+ next : start
722
+ };
723
+ };
724
+
725
+ DocCommentHighlightRules.getEndRule = function (start) {
726
+ return {
727
+ token : "comment.doc", // closing comment
728
+ merge : true,
729
+ regex : "\\*\\/",
730
+ next : start
731
+ };
732
+ };
733
+
734
+
735
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
736
+
737
+ });
738
+ /* ***** BEGIN LICENSE BLOCK *****
739
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
740
+ *
741
+ * The contents of this file are subject to the Mozilla Public License Version
742
+ * 1.1 (the "License"); you may not use this file except in compliance with
743
+ * the License. You may obtain a copy of the License at
744
+ * http://www.mozilla.org/MPL/
745
+ *
746
+ * Software distributed under the License is distributed on an "AS IS" basis,
747
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
748
+ * for the specific language governing rights and limitations under the
749
+ * License.
750
+ *
751
+ * The Original Code is Ajax.org Code Editor (ACE).
752
+ *
753
+ * The Initial Developer of the Original Code is
754
+ * Ajax.org B.V.
755
+ * Portions created by the Initial Developer are Copyright (C) 2010
756
+ * the Initial Developer. All Rights Reserved.
757
+ *
758
+ * Contributor(s):
759
+ * Fabian Jakobs <fabian AT ajax DOT org>
760
+ *
761
+ * Alternatively, the contents of this file may be used under the terms of
762
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
763
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
764
+ * in which case the provisions of the GPL or the LGPL are applicable instead
765
+ * of those above. If you wish to allow use of your version of this file only
766
+ * under the terms of either the GPL or the LGPL, and not to allow others to
767
+ * use your version of this file under the terms of the MPL, indicate your
768
+ * decision by deleting the provisions above and replace them with the notice
769
+ * and other provisions required by the GPL or the LGPL. If you do not delete
770
+ * the provisions above, a recipient may use your version of this file under
771
+ * the terms of any one of the MPL, the GPL or the LGPL.
772
+ *
773
+ * ***** END LICENSE BLOCK ***** */
774
+
775
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
776
+ "use strict";
777
+
778
+ var Range = require("../range").Range;
779
+
780
+ var MatchingBraceOutdent = function() {};
781
+
782
+ (function() {
783
+
784
+ this.checkOutdent = function(line, input) {
785
+ if (! /^\s+$/.test(line))
786
+ return false;
787
+
788
+ return /^\s*\}/.test(input);
789
+ };
790
+
791
+ this.autoOutdent = function(doc, row) {
792
+ var line = doc.getLine(row);
793
+ var match = line.match(/^(\s*\})/);
794
+
795
+ if (!match) return 0;
796
+
797
+ var column = match[1].length;
798
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
799
+
800
+ if (!openBracePos || openBracePos.row == row) return 0;
801
+
802
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
803
+ doc.replace(new Range(row, 0, row, column-1), indent);
804
+ };
805
+
806
+ this.$getIndent = function(line) {
807
+ var match = line.match(/^(\s+)/);
808
+ if (match) {
809
+ return match[1];
810
+ }
811
+
812
+ return "";
813
+ };
814
+
815
+ }).call(MatchingBraceOutdent.prototype);
816
+
817
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
818
+ });
819
+ /* vim:ts=4:sts=4:sw=4:
820
+ * ***** BEGIN LICENSE BLOCK *****
821
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
822
+ *
823
+ * The contents of this file are subject to the Mozilla Public License Version
824
+ * 1.1 (the "License"); you may not use this file except in compliance with
825
+ * the License. You may obtain a copy of the License at
826
+ * http://www.mozilla.org/MPL/
827
+ *
828
+ * Software distributed under the License is distributed on an "AS IS" basis,
829
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
830
+ * for the specific language governing rights and limitations under the
831
+ * License.
832
+ *
833
+ * The Original Code is Ajax.org Code Editor (ACE).
834
+ *
835
+ * The Initial Developer of the Original Code is
836
+ * Ajax.org B.V.
837
+ * Portions created by the Initial Developer are Copyright (C) 2010
838
+ * the Initial Developer. All Rights Reserved.
839
+ *
840
+ * Contributor(s):
841
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
842
+ *
843
+ * Alternatively, the contents of this file may be used under the terms of
844
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
845
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
846
+ * in which case the provisions of the GPL or the LGPL are applicable instead
847
+ * of those above. If you wish to allow use of your version of this file only
848
+ * under the terms of either the GPL or the LGPL, and not to allow others to
849
+ * use your version of this file under the terms of the MPL, indicate your
850
+ * decision by deleting the provisions above and replace them with the notice
851
+ * and other provisions required by the GPL or the LGPL. If you do not delete
852
+ * the provisions above, a recipient may use your version of this file under
853
+ * the terms of any one of the MPL, the GPL or the LGPL.
854
+ *
855
+ * ***** END LICENSE BLOCK ***** */
856
+
857
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
858
+ "use strict";
859
+
860
+ var oop = require("../../lib/oop");
861
+ var Behaviour = require('../behaviour').Behaviour;
862
+
863
+ var CstyleBehaviour = function () {
864
+
865
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
866
+ if (text == '{') {
867
+ var selection = editor.getSelectionRange();
868
+ var selected = session.doc.getTextRange(selection);
869
+ if (selected !== "") {
870
+ return {
871
+ text: '{' + selected + '}',
872
+ selection: false
873
+ };
874
+ } else {
875
+ return {
876
+ text: '{}',
877
+ selection: [1, 1]
878
+ };
879
+ }
880
+ } else if (text == '}') {
881
+ var cursor = editor.getCursorPosition();
882
+ var line = session.doc.getLine(cursor.row);
883
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
884
+ if (rightChar == '}') {
885
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
886
+ if (matching !== null) {
887
+ return {
888
+ text: '',
889
+ selection: [1, 1]
890
+ };
891
+ }
892
+ }
893
+ } else if (text == "\n") {
894
+ var cursor = editor.getCursorPosition();
895
+ var line = session.doc.getLine(cursor.row);
896
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
897
+ if (rightChar == '}') {
898
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
899
+ if (!openBracePos)
900
+ return null;
901
+
902
+ var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
903
+ var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
904
+
905
+ return {
906
+ text: '\n' + indent + '\n' + next_indent,
907
+ selection: [1, indent.length, 1, indent.length]
908
+ };
909
+ }
910
+ }
911
+ });
912
+
913
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
914
+ var selected = session.doc.getTextRange(range);
915
+ if (!range.isMultiLine() && selected == '{') {
916
+ var line = session.doc.getLine(range.start.row);
917
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
918
+ if (rightChar == '}') {
919
+ range.end.column++;
920
+ return range;
921
+ }
922
+ }
923
+ });
924
+
925
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
926
+ if (text == '(') {
927
+ var selection = editor.getSelectionRange();
928
+ var selected = session.doc.getTextRange(selection);
929
+ if (selected !== "") {
930
+ return {
931
+ text: '(' + selected + ')',
932
+ selection: false
933
+ };
934
+ } else {
935
+ return {
936
+ text: '()',
937
+ selection: [1, 1]
938
+ };
939
+ }
940
+ } else if (text == ')') {
941
+ var cursor = editor.getCursorPosition();
942
+ var line = session.doc.getLine(cursor.row);
943
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
944
+ if (rightChar == ')') {
945
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
946
+ if (matching !== null) {
947
+ return {
948
+ text: '',
949
+ selection: [1, 1]
950
+ };
951
+ }
952
+ }
953
+ }
954
+ });
955
+
956
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
957
+ var selected = session.doc.getTextRange(range);
958
+ if (!range.isMultiLine() && selected == '(') {
959
+ var line = session.doc.getLine(range.start.row);
960
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
961
+ if (rightChar == ')') {
962
+ range.end.column++;
963
+ return range;
964
+ }
965
+ }
966
+ });
967
+
968
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
969
+ if (text == '"' || text == "'") {
970
+ var quote = text;
971
+ var selection = editor.getSelectionRange();
972
+ var selected = session.doc.getTextRange(selection);
973
+ if (selected !== "") {
974
+ return {
975
+ text: quote + selected + quote,
976
+ selection: false
977
+ };
978
+ } else {
979
+ var cursor = editor.getCursorPosition();
980
+ var line = session.doc.getLine(cursor.row);
981
+ var leftChar = line.substring(cursor.column-1, cursor.column);
982
+
983
+ // We're escaped.
984
+ if (leftChar == '\\') {
985
+ return null;
986
+ }
987
+
988
+ // Find what token we're inside.
989
+ var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
990
+ var col = 0, token;
991
+ var quotepos = -1; // Track whether we're inside an open quote.
992
+
993
+ for (var x = 0; x < tokens.length; x++) {
994
+ token = tokens[x];
995
+ if (token.type == "string") {
996
+ quotepos = -1;
997
+ } else if (quotepos < 0) {
998
+ quotepos = token.value.indexOf(quote);
999
+ }
1000
+ if ((token.value.length + col) > selection.start.column) {
1001
+ break;
1002
+ }
1003
+ col += tokens[x].value.length;
1004
+ }
1005
+
1006
+ // Try and be smart about when we auto insert.
1007
+ if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
1008
+ return {
1009
+ text: quote + quote,
1010
+ selection: [1,1]
1011
+ };
1012
+ } else if (token && token.type === "string") {
1013
+ // Ignore input and move right one if we're typing over the closing quote.
1014
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1015
+ if (rightChar == quote) {
1016
+ return {
1017
+ text: '',
1018
+ selection: [1, 1]
1019
+ };
1020
+ }
1021
+ }
1022
+ }
1023
+ }
1024
+ });
1025
+
1026
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
1027
+ var selected = session.doc.getTextRange(range);
1028
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1029
+ var line = session.doc.getLine(range.start.row);
1030
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1031
+ if (rightChar == '"') {
1032
+ range.end.column++;
1033
+ return range;
1034
+ }
1035
+ }
1036
+ });
1037
+
1038
+ };
1039
+
1040
+ oop.inherits(CstyleBehaviour, Behaviour);
1041
+
1042
+ exports.CstyleBehaviour = CstyleBehaviour;
1043
+ });
1044
+ /* ***** BEGIN LICENSE BLOCK *****
1045
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1046
+ *
1047
+ * The contents of this file are subject to the Mozilla Public License Version
1048
+ * 1.1 (the "License"); you may not use this file except in compliance with
1049
+ * the License. You may obtain a copy of the License at
1050
+ * http://www.mozilla.org/MPL/
1051
+ *
1052
+ * Software distributed under the License is distributed on an "AS IS" basis,
1053
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1054
+ * for the specific language governing rights and limitations under the
1055
+ * License.
1056
+ *
1057
+ * The Original Code is Ajax.org Code Editor (ACE).
1058
+ *
1059
+ * The Initial Developer of the Original Code is
1060
+ * Ajax.org B.V.
1061
+ * Portions created by the Initial Developer are Copyright (C) 2010
1062
+ * the Initial Developer. All Rights Reserved.
1063
+ *
1064
+ * Contributor(s):
1065
+ * Fabian Jakobs <fabian AT ajax DOT org>
1066
+ *
1067
+ * Alternatively, the contents of this file may be used under the terms of
1068
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1069
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1070
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1071
+ * of those above. If you wish to allow use of your version of this file only
1072
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1073
+ * use your version of this file under the terms of the MPL, indicate your
1074
+ * decision by deleting the provisions above and replace them with the notice
1075
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1076
+ * the provisions above, a recipient may use your version of this file under
1077
+ * the terms of any one of the MPL, the GPL or the LGPL.
1078
+ *
1079
+ * ***** END LICENSE BLOCK ***** */
1080
+
1081
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1082
+ "use strict";
1083
+
1084
+ var oop = require("../../lib/oop");
1085
+ var Range = require("../../range").Range;
1086
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1087
+
1088
+ var FoldMode = exports.FoldMode = function() {};
1089
+ oop.inherits(FoldMode, BaseFoldMode);
1090
+
1091
+ (function() {
1092
+
1093
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1094
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1095
+
1096
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1097
+ var line = session.getLine(row);
1098
+ var match = line.match(this.foldingStartMarker);
1099
+ if (match) {
1100
+ var i = match.index;
1101
+
1102
+ if (match[1])
1103
+ return this.openingBracketBlock(session, match[1], row, i);
1104
+
1105
+ var range = session.getCommentFoldRange(row, i + match[0].length);
1106
+ range.end.column -= 2;
1107
+ return range;
1108
+ }
1109
+
1110
+ if (foldStyle !== "markbeginend")
1111
+ return;
1112
+
1113
+ var match = line.match(this.foldingStopMarker);
1114
+ if (match) {
1115
+ var i = match.index + match[0].length;
1116
+
1117
+ if (match[2]) {
1118
+ var range = session.getCommentFoldRange(row, i);
1119
+ range.end.column -= 2;
1120
+ return range;
1121
+ }
1122
+
1123
+ var end = {row: row, column: i};
1124
+ var start = session.$findOpeningBracket(match[1], end);
1125
+
1126
+ if (!start)
1127
+ return;
1128
+
1129
+ start.column++;
1130
+ end.column--;
1131
+
1132
+ return Range.fromPoints(start, end);
1133
+ }
1134
+ };
1135
+
1136
+ }).call(FoldMode.prototype);
1137
+
1138
+ });
1139
+ /* ***** BEGIN LICENSE BLOCK *****
1140
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1141
+ *
1142
+ * The contents of this file are subject to the Mozilla Public License Version
1143
+ * 1.1 (the "License"); you may not use this file except in compliance with
1144
+ * the License. You may obtain a copy of the License at
1145
+ * http://www.mozilla.org/MPL/
1146
+ *
1147
+ * Software distributed under the License is distributed on an "AS IS" basis,
1148
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1149
+ * for the specific language governing rights and limitations under the
1150
+ * License.
1151
+ *
1152
+ * The Original Code is Ajax.org Code Editor (ACE).
1153
+ *
1154
+ * The Initial Developer of the Original Code is
1155
+ * Ajax.org B.V.
1156
+ * Portions created by the Initial Developer are Copyright (C) 2010
1157
+ * the Initial Developer. All Rights Reserved.
1158
+ *
1159
+ * Contributor(s):
1160
+ * Fabian Jakobs <fabian AT ajax DOT org>
1161
+ *
1162
+ * Alternatively, the contents of this file may be used under the terms of
1163
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1164
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1165
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1166
+ * of those above. If you wish to allow use of your version of this file only
1167
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1168
+ * use your version of this file under the terms of the MPL, indicate your
1169
+ * decision by deleting the provisions above and replace them with the notice
1170
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1171
+ * the provisions above, a recipient may use your version of this file under
1172
+ * the terms of any one of the MPL, the GPL or the LGPL.
1173
+ *
1174
+ * ***** END LICENSE BLOCK ***** */
1175
+
1176
+ define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1177
+ "use strict";
1178
+
1179
+ var Range = require("../../range").Range;
1180
+
1181
+ var FoldMode = exports.FoldMode = function() {};
1182
+
1183
+ (function() {
1184
+
1185
+ this.foldingStartMarker = null;
1186
+ this.foldingStopMarker = null;
1187
+
1188
+ // must return "" if there's no fold, to enable caching
1189
+ this.getFoldWidget = function(session, foldStyle, row) {
1190
+ var line = session.getLine(row);
1191
+ if (this.foldingStartMarker.test(line))
1192
+ return "start";
1193
+ if (foldStyle == "markbeginend"
1194
+ && this.foldingStopMarker
1195
+ && this.foldingStopMarker.test(line))
1196
+ return "end";
1197
+ return "";
1198
+ };
1199
+
1200
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1201
+ return null;
1202
+ };
1203
+
1204
+ this.indentationBlock = function(session, row, column) {
1205
+ var re = /^\s*/;
1206
+ var startRow = row;
1207
+ var endRow = row;
1208
+ var line = session.getLine(row);
1209
+ var startColumn = column || line.length;
1210
+ var startLevel = line.match(re)[0].length;
1211
+ var maxRow = session.getLength()
1212
+
1213
+ while (++row < maxRow) {
1214
+ line = session.getLine(row);
1215
+ var level = line.match(re)[0].length;
1216
+
1217
+ if (level == line.length)
1218
+ continue;
1219
+
1220
+ if (level <= startLevel)
1221
+ break;
1222
+
1223
+ endRow = row;
1224
+ }
1225
+
1226
+ if (endRow > startRow) {
1227
+ var endColumn = session.getLine(endRow).length;
1228
+ return new Range(startRow, startColumn, endRow, endColumn);
1229
+ }
1230
+ };
1231
+
1232
+ this.openingBracketBlock = function(session, bracket, row, column) {
1233
+ var start = {row: row, column: column + 1};
1234
+ var end = session.$findClosingBracket(bracket, start);
1235
+ if (!end)
1236
+ return;
1237
+
1238
+ var fw = session.foldWidgets[end.row];
1239
+ if (fw == null)
1240
+ fw = this.getFoldWidget(session, end.row);
1241
+
1242
+ if (fw == "start") {
1243
+ end.row --;
1244
+ end.column = session.getLine(end.row).length;
1245
+ }
1246
+ return Range.fromPoints(start, end);
1247
+ };
1248
+
1249
+ }).call(FoldMode.prototype);
1250
+
1251
+ });
1252
+ define('ace/mode/scala_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1253
+ "use strict";
1254
+
1255
+ var oop = require("../lib/oop");
1256
+ var lang = require("../lib/lang");
1257
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
1258
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1259
+
1260
+ var ScalaHighlightRules = function() {
1261
+
1262
+ // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html
1263
+ var keywords = lang.arrayToMap(
1264
+ (
1265
+ "case|default|do|else|for|if|match|while|throw|return|try|catch|finally|yield|" +
1266
+ "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|" +
1267
+ "override|package|private|protected|sealed|super|this|trait|type|val|var|with"
1268
+ ).split("|")
1269
+ );
1270
+
1271
+ var buildinConstants = lang.arrayToMap(
1272
+ ("true|false").split("|")
1273
+ );
1274
+
1275
+ var langClasses = lang.arrayToMap(
1276
+ ("AbstractMethodError|AssertionError|ClassCircularityError|"+
1277
+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
1278
+ "ExceptionInInitializerError|IllegalAccessError|"+
1279
+ "IllegalThreadStateException|InstantiationError|InternalError|"+
1280
+
1281
+ "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
1282
+ "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
1283
+ "SuppressWarnings|TypeNotPresentException|UnknownError|"+
1284
+ "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
1285
+ "InstantiationException|IndexOutOfBoundsException|"+
1286
+ "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
1287
+ "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
1288
+ "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
1289
+ "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
1290
+ "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
1291
+ "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
1292
+ "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
1293
+ "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
1294
+ "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
1295
+ "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
1296
+ "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
1297
+ "ArrayStoreException|ClassCastException|LinkageError|"+
1298
+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
1299
+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
1300
+ "Cloneable|Class|CharSequence|Comparable|String|Object|" +
1301
+ "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" +
1302
+ "Option|Array|Char|Byte|Short|Int|Long|Nothing"
1303
+
1304
+ ).split("|")
1305
+ );
1306
+
1307
+ var importClasses = lang.arrayToMap(
1308
+ ("").split("|")
1309
+ );
1310
+ // regexp must not have capturing parentheses. Use (?:) instead.
1311
+ // regexps are ordered -> the first match is used
1312
+
1313
+ this.$rules = {
1314
+ "start" : [
1315
+ {
1316
+ token : "comment",
1317
+ regex : "\\/\\/.*$"
1318
+ },
1319
+ DocCommentHighlightRules.getStartRule("doc-start"),
1320
+ {
1321
+ token : "comment", // multi line comment
1322
+ merge : true,
1323
+ regex : "\\/\\*",
1324
+ next : "comment"
1325
+ }, {
1326
+ token : "string.regexp",
1327
+ regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
1328
+ }, {
1329
+ token : "string", // single line
1330
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1331
+ }, {
1332
+ token : "string", // single line
1333
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1334
+ }, {
1335
+ token : "constant.numeric", // hex
1336
+ regex : "0[xX][0-9a-fA-F]+\\b"
1337
+ }, {
1338
+ token : "constant.numeric", // float
1339
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1340
+ }, {
1341
+ token : "constant.language.boolean",
1342
+ regex : "(?:true|false)\\b"
1343
+ }, {
1344
+ token : function(value) {
1345
+ if (value == "this")
1346
+ return "variable.language";
1347
+ else if (keywords.hasOwnProperty(value))
1348
+ return "keyword";
1349
+ else if (langClasses.hasOwnProperty(value))
1350
+ return "support.function";
1351
+ else if (importClasses.hasOwnProperty(value))
1352
+ return "support.function";
1353
+ else if (buildinConstants.hasOwnProperty(value))
1354
+ return "constant.language";
1355
+ else
1356
+ return "identifier";
1357
+ },
1358
+ // TODO: Unicode escape sequences
1359
+ // TODO: Unicode identifiers
1360
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
1361
+ }, {
1362
+ token : "keyword.operator",
1363
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
1364
+ }, {
1365
+ token : "paren.lparen",
1366
+ regex : "[[({]"
1367
+ }, {
1368
+ token : "paren.rparen",
1369
+ regex : "[\\])}]"
1370
+ }, {
1371
+ token : "text",
1372
+ regex : "\\s+"
1373
+ }
1374
+ ],
1375
+ "comment" : [
1376
+ {
1377
+ token : "comment", // closing comment
1378
+ regex : ".*?\\*\\/",
1379
+ next : "start"
1380
+ }, {
1381
+ token : "comment", // comment spanning whole line
1382
+ merge : true,
1383
+ regex : ".+"
1384
+ }
1385
+ ]
1386
+ };
1387
+
1388
+ this.embedRules(DocCommentHighlightRules, "doc-",
1389
+ [ DocCommentHighlightRules.getEndRule("start") ]);
1390
+ };
1391
+
1392
+ oop.inherits(ScalaHighlightRules, TextHighlightRules);
1393
+
1394
+ exports.ScalaHighlightRules = ScalaHighlightRules;
1395
+ });