aced_rails 0.0.1

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