daftos 0.1.0 → 0.2.0

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 (307) hide show
  1. data/.DS_Store +0 -0
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +2 -0
  4. data/Rakefile +4 -0
  5. data/VERSION +1 -1
  6. data/bin/daftos +14 -0
  7. data/daftos.gemspec +363 -0
  8. data/lib/.DS_Store +0 -0
  9. data/lib/apis/.DS_Store +0 -0
  10. data/lib/apis/filesystem_api.rb +68 -0
  11. data/lib/apps/.DS_Store +0 -0
  12. data/lib/apps/apps/body.html +6 -0
  13. data/lib/apps/apps/options.json +7 -0
  14. data/lib/apps/filebrowser/.DS_Store +0 -0
  15. data/lib/apps/filebrowser/body.html +32 -0
  16. data/lib/apps/filebrowser/coffee/filebrowser.coffee +51 -0
  17. data/lib/apps/filebrowser/js/.DS_Store +0 -0
  18. data/lib/apps/filebrowser/js/daftos.js +1 -0
  19. data/lib/apps/filebrowser/options.json +7 -0
  20. data/lib/apps/photobooth/.DS_Store +0 -0
  21. data/lib/apps/photobooth/body.html +1 -0
  22. data/lib/apps/photobooth/coffee/photobooth.coffee +37 -0
  23. data/lib/apps/photobooth/coffee/test.html +278 -0
  24. data/lib/apps/photobooth/css/style.css +30 -0
  25. data/lib/apps/photobooth/js/.DS_Store +0 -0
  26. data/lib/apps/photobooth/js/daftos.js +1 -0
  27. data/lib/apps/photobooth/options.json +26 -0
  28. data/lib/apps/photobrowser/body.html +2 -0
  29. data/lib/apps/photobrowser/coffee/photobrowser.coffee +18 -0
  30. data/lib/apps/photobrowser/js/.DS_Store +0 -0
  31. data/lib/apps/photobrowser/options.json +16 -0
  32. data/lib/apps/texteditor/body.html +1 -0
  33. data/lib/apps/texteditor/coffee/texteditor.coffee +31 -0
  34. data/lib/apps/texteditor/js/.DS_Store +0 -0
  35. data/lib/apps/texteditor/js/ace-compat-noconflict.js +1 -0
  36. data/lib/apps/texteditor/js/ace-compat-uncompressed-noconflict.js +480 -0
  37. data/lib/apps/texteditor/js/ace-compat-uncompressed.js +480 -0
  38. data/lib/apps/texteditor/js/ace-compat.js +1 -0
  39. data/lib/apps/texteditor/js/ace-noconflict.js +10 -0
  40. data/lib/apps/texteditor/js/ace-uncompressed-noconflict.js +19559 -0
  41. data/lib/apps/texteditor/js/ace-uncompressed.js +19559 -0
  42. data/lib/apps/texteditor/js/ace.js +10 -0
  43. data/lib/apps/texteditor/js/keybinding-emacs-noconflict.js +1 -0
  44. data/lib/apps/texteditor/js/keybinding-emacs-uncompressed-noconflict.js +150 -0
  45. data/lib/apps/texteditor/js/keybinding-emacs-uncompressed.js +150 -0
  46. data/lib/apps/texteditor/js/keybinding-emacs.js +1 -0
  47. data/lib/apps/texteditor/js/keybinding-vim-noconflict.js +1 -0
  48. data/lib/apps/texteditor/js/keybinding-vim-uncompressed-noconflict.js +138 -0
  49. data/lib/apps/texteditor/js/keybinding-vim-uncompressed.js +138 -0
  50. data/lib/apps/texteditor/js/keybinding-vim.js +1 -0
  51. data/lib/apps/texteditor/js/mode-c_cpp-noconflict.js +1 -0
  52. data/lib/apps/texteditor/js/mode-c_cpp-uncompressed-noconflict.js +917 -0
  53. data/lib/apps/texteditor/js/mode-c_cpp-uncompressed.js +917 -0
  54. data/lib/apps/texteditor/js/mode-c_cpp.js +1 -0
  55. data/lib/apps/texteditor/js/mode-clojure-noconflict.js +1 -0
  56. data/lib/apps/texteditor/js/mode-clojure-uncompressed-noconflict.js +422 -0
  57. data/lib/apps/texteditor/js/mode-clojure-uncompressed.js +422 -0
  58. data/lib/apps/texteditor/js/mode-clojure.js +1 -0
  59. data/lib/apps/texteditor/js/mode-coffee-noconflict.js +1 -0
  60. data/lib/apps/texteditor/js/mode-coffee-uncompressed-noconflict.js +605 -0
  61. data/lib/apps/texteditor/js/mode-coffee-uncompressed.js +605 -0
  62. data/lib/apps/texteditor/js/mode-coffee.js +1 -0
  63. data/lib/apps/texteditor/js/mode-coldfusion-noconflict.js +1 -0
  64. data/lib/apps/texteditor/js/mode-coldfusion-uncompressed-noconflict.js +2454 -0
  65. data/lib/apps/texteditor/js/mode-coldfusion-uncompressed.js +2454 -0
  66. data/lib/apps/texteditor/js/mode-coldfusion.js +1 -0
  67. data/lib/apps/texteditor/js/mode-csharp-noconflict.js +1 -0
  68. data/lib/apps/texteditor/js/mode-csharp-uncompressed-noconflict.js +767 -0
  69. data/lib/apps/texteditor/js/mode-csharp-uncompressed.js +767 -0
  70. data/lib/apps/texteditor/js/mode-csharp.js +1 -0
  71. data/lib/apps/texteditor/js/mode-css-noconflict.js +1 -0
  72. data/lib/apps/texteditor/js/mode-css-uncompressed-noconflict.js +640 -0
  73. data/lib/apps/texteditor/js/mode-css-uncompressed.js +640 -0
  74. data/lib/apps/texteditor/js/mode-css.js +1 -0
  75. data/lib/apps/texteditor/js/mode-golang-noconflict.js +1 -0
  76. data/lib/apps/texteditor/js/mode-golang-uncompressed-noconflict.js +378 -0
  77. data/lib/apps/texteditor/js/mode-golang-uncompressed.js +378 -0
  78. data/lib/apps/texteditor/js/mode-golang.js +1 -0
  79. data/lib/apps/texteditor/js/mode-groovy-noconflict.js +1 -0
  80. data/lib/apps/texteditor/js/mode-groovy-uncompressed-noconflict.js +1391 -0
  81. data/lib/apps/texteditor/js/mode-groovy-uncompressed.js +1391 -0
  82. data/lib/apps/texteditor/js/mode-groovy.js +1 -0
  83. data/lib/apps/texteditor/js/mode-haxe-noconflict.js +1 -0
  84. data/lib/apps/texteditor/js/mode-haxe-uncompressed-noconflict.js +767 -0
  85. data/lib/apps/texteditor/js/mode-haxe-uncompressed.js +767 -0
  86. data/lib/apps/texteditor/js/mode-haxe.js +1 -0
  87. data/lib/apps/texteditor/js/mode-html-noconflict.js +1 -0
  88. data/lib/apps/texteditor/js/mode-html-uncompressed-noconflict.js +2470 -0
  89. data/lib/apps/texteditor/js/mode-html-uncompressed.js +2470 -0
  90. data/lib/apps/texteditor/js/mode-html.js +1 -0
  91. data/lib/apps/texteditor/js/mode-java-noconflict.js +1 -0
  92. data/lib/apps/texteditor/js/mode-java-uncompressed-noconflict.js +1393 -0
  93. data/lib/apps/texteditor/js/mode-java-uncompressed.js +1393 -0
  94. data/lib/apps/texteditor/js/mode-java.js +1 -0
  95. data/lib/apps/texteditor/js/mode-javascript-noconflict.js +1 -0
  96. data/lib/apps/texteditor/js/mode-javascript-uncompressed-noconflict.js +1224 -0
  97. data/lib/apps/texteditor/js/mode-javascript-uncompressed.js +1224 -0
  98. data/lib/apps/texteditor/js/mode-javascript.js +1 -0
  99. data/lib/apps/texteditor/js/mode-json-noconflict.js +1 -0
  100. data/lib/apps/texteditor/js/mode-json-uncompressed-noconflict.js +698 -0
  101. data/lib/apps/texteditor/js/mode-json-uncompressed.js +698 -0
  102. data/lib/apps/texteditor/js/mode-json.js +1 -0
  103. data/lib/apps/texteditor/js/mode-latex-noconflict.js +1 -0
  104. data/lib/apps/texteditor/js/mode-latex-uncompressed-noconflict.js +95 -0
  105. data/lib/apps/texteditor/js/mode-latex-uncompressed.js +95 -0
  106. data/lib/apps/texteditor/js/mode-latex.js +1 -0
  107. data/lib/apps/texteditor/js/mode-less-noconflict.js +1 -0
  108. data/lib/apps/texteditor/js/mode-less-uncompressed-noconflict.js +654 -0
  109. data/lib/apps/texteditor/js/mode-less-uncompressed.js +654 -0
  110. data/lib/apps/texteditor/js/mode-less.js +1 -0
  111. data/lib/apps/texteditor/js/mode-liquid-noconflict.js +1 -0
  112. data/lib/apps/texteditor/js/mode-liquid-uncompressed-noconflict.js +1353 -0
  113. data/lib/apps/texteditor/js/mode-liquid-uncompressed.js +1353 -0
  114. data/lib/apps/texteditor/js/mode-liquid.js +1 -0
  115. data/lib/apps/texteditor/js/mode-lua-noconflict.js +1 -0
  116. data/lib/apps/texteditor/js/mode-lua-uncompressed-noconflict.js +523 -0
  117. data/lib/apps/texteditor/js/mode-lua-uncompressed.js +523 -0
  118. data/lib/apps/texteditor/js/mode-lua.js +1 -0
  119. data/lib/apps/texteditor/js/mode-markdown-noconflict.js +1 -0
  120. data/lib/apps/texteditor/js/mode-markdown-uncompressed-noconflict.js +2918 -0
  121. data/lib/apps/texteditor/js/mode-markdown-uncompressed.js +2918 -0
  122. data/lib/apps/texteditor/js/mode-markdown.js +1 -0
  123. data/lib/apps/texteditor/js/mode-ocaml-noconflict.js +1 -0
  124. data/lib/apps/texteditor/js/mode-ocaml-uncompressed-noconflict.js +539 -0
  125. data/lib/apps/texteditor/js/mode-ocaml-uncompressed.js +539 -0
  126. data/lib/apps/texteditor/js/mode-ocaml.js +1 -0
  127. data/lib/apps/texteditor/js/mode-perl-noconflict.js +1 -0
  128. data/lib/apps/texteditor/js/mode-perl-uncompressed-noconflict.js +573 -0
  129. data/lib/apps/texteditor/js/mode-perl-uncompressed.js +573 -0
  130. data/lib/apps/texteditor/js/mode-perl.js +1 -0
  131. data/lib/apps/texteditor/js/mode-pgsql-noconflict.js +1 -0
  132. data/lib/apps/texteditor/js/mode-pgsql-uncompressed-noconflict.js +1104 -0
  133. data/lib/apps/texteditor/js/mode-pgsql-uncompressed.js +1104 -0
  134. data/lib/apps/texteditor/js/mode-pgsql.js +1 -0
  135. data/lib/apps/texteditor/js/mode-php-noconflict.js +1 -0
  136. data/lib/apps/texteditor/js/mode-php-uncompressed-noconflict.js +1883 -0
  137. data/lib/apps/texteditor/js/mode-php-uncompressed.js +1883 -0
  138. data/lib/apps/texteditor/js/mode-php.js +1 -0
  139. data/lib/apps/texteditor/js/mode-powershell-noconflict.js +1 -0
  140. data/lib/apps/texteditor/js/mode-powershell-uncompressed-noconflict.js +708 -0
  141. data/lib/apps/texteditor/js/mode-powershell-uncompressed.js +708 -0
  142. data/lib/apps/texteditor/js/mode-powershell.js +1 -0
  143. data/lib/apps/texteditor/js/mode-python-noconflict.js +1 -0
  144. data/lib/apps/texteditor/js/mode-python-uncompressed-noconflict.js +506 -0
  145. data/lib/apps/texteditor/js/mode-python-uncompressed.js +506 -0
  146. data/lib/apps/texteditor/js/mode-python.js +1 -0
  147. data/lib/apps/texteditor/js/mode-ruby-noconflict.js +1 -0
  148. data/lib/apps/texteditor/js/mode-ruby-uncompressed-noconflict.js +391 -0
  149. data/lib/apps/texteditor/js/mode-ruby-uncompressed.js +391 -0
  150. data/lib/apps/texteditor/js/mode-ruby.js +1 -0
  151. data/lib/apps/texteditor/js/mode-scad-noconflict.js +1 -0
  152. data/lib/apps/texteditor/js/mode-scad-uncompressed-noconflict.js +905 -0
  153. data/lib/apps/texteditor/js/mode-scad-uncompressed.js +905 -0
  154. data/lib/apps/texteditor/js/mode-scad.js +1 -0
  155. data/lib/apps/texteditor/js/mode-scala-noconflict.js +1 -0
  156. data/lib/apps/texteditor/js/mode-scala-uncompressed-noconflict.js +1393 -0
  157. data/lib/apps/texteditor/js/mode-scala-uncompressed.js +1393 -0
  158. data/lib/apps/texteditor/js/mode-scala.js +1 -0
  159. data/lib/apps/texteditor/js/mode-scss-noconflict.js +1 -0
  160. data/lib/apps/texteditor/js/mode-scss-uncompressed-noconflict.js +678 -0
  161. data/lib/apps/texteditor/js/mode-scss-uncompressed.js +678 -0
  162. data/lib/apps/texteditor/js/mode-scss.js +1 -0
  163. data/lib/apps/texteditor/js/mode-sh-noconflict.js +1 -0
  164. data/lib/apps/texteditor/js/mode-sh-uncompressed-noconflict.js +289 -0
  165. data/lib/apps/texteditor/js/mode-sh-uncompressed.js +289 -0
  166. data/lib/apps/texteditor/js/mode-sh.js +1 -0
  167. data/lib/apps/texteditor/js/mode-sql-noconflict.js +1 -0
  168. data/lib/apps/texteditor/js/mode-sql-uncompressed-noconflict.js +159 -0
  169. data/lib/apps/texteditor/js/mode-sql-uncompressed.js +159 -0
  170. data/lib/apps/texteditor/js/mode-sql.js +1 -0
  171. data/lib/apps/texteditor/js/mode-svg-noconflict.js +1 -0
  172. data/lib/apps/texteditor/js/mode-svg-uncompressed-noconflict.js +2133 -0
  173. data/lib/apps/texteditor/js/mode-svg-uncompressed.js +2133 -0
  174. data/lib/apps/texteditor/js/mode-svg.js +1 -0
  175. data/lib/apps/texteditor/js/mode-text-noconflict.js +0 -0
  176. data/lib/apps/texteditor/js/mode-text-uncompressed-noconflict.js +0 -0
  177. data/lib/apps/texteditor/js/mode-text-uncompressed.js +0 -0
  178. data/lib/apps/texteditor/js/mode-text.js +0 -0
  179. data/lib/apps/texteditor/js/mode-textile-noconflict.js +1 -0
  180. data/lib/apps/texteditor/js/mode-textile-uncompressed-noconflict.js +254 -0
  181. data/lib/apps/texteditor/js/mode-textile-uncompressed.js +254 -0
  182. data/lib/apps/texteditor/js/mode-textile.js +1 -0
  183. data/lib/apps/texteditor/js/mode-xml-noconflict.js +1 -0
  184. data/lib/apps/texteditor/js/mode-xml-uncompressed-noconflict.js +1009 -0
  185. data/lib/apps/texteditor/js/mode-xml-uncompressed.js +1009 -0
  186. data/lib/apps/texteditor/js/mode-xml.js +1 -0
  187. data/lib/apps/texteditor/js/mode-xquery-noconflict.js +1 -0
  188. data/lib/apps/texteditor/js/mode-xquery-uncompressed-noconflict.js +540 -0
  189. data/lib/apps/texteditor/js/mode-xquery-uncompressed.js +540 -0
  190. data/lib/apps/texteditor/js/mode-xquery.js +1 -0
  191. data/lib/apps/texteditor/js/theme-chrome-noconflict.js +1 -0
  192. data/lib/apps/texteditor/js/theme-chrome-uncompressed-noconflict.js +207 -0
  193. data/lib/apps/texteditor/js/theme-chrome-uncompressed.js +207 -0
  194. data/lib/apps/texteditor/js/theme-chrome.js +1 -0
  195. data/lib/apps/texteditor/js/theme-clouds-noconflict.js +1 -0
  196. data/lib/apps/texteditor/js/theme-clouds-uncompressed-noconflict.js +160 -0
  197. data/lib/apps/texteditor/js/theme-clouds-uncompressed.js +160 -0
  198. data/lib/apps/texteditor/js/theme-clouds.js +1 -0
  199. data/lib/apps/texteditor/js/theme-clouds_midnight-noconflict.js +1 -0
  200. data/lib/apps/texteditor/js/theme-clouds_midnight-uncompressed-noconflict.js +161 -0
  201. data/lib/apps/texteditor/js/theme-clouds_midnight-uncompressed.js +161 -0
  202. data/lib/apps/texteditor/js/theme-clouds_midnight.js +1 -0
  203. data/lib/apps/texteditor/js/theme-cobalt-noconflict.js +1 -0
  204. data/lib/apps/texteditor/js/theme-cobalt-uncompressed-noconflict.js +187 -0
  205. data/lib/apps/texteditor/js/theme-cobalt-uncompressed.js +187 -0
  206. data/lib/apps/texteditor/js/theme-cobalt.js +1 -0
  207. data/lib/apps/texteditor/js/theme-crimson_editor-noconflict.js +1 -0
  208. data/lib/apps/texteditor/js/theme-crimson_editor-uncompressed-noconflict.js +198 -0
  209. data/lib/apps/texteditor/js/theme-crimson_editor-uncompressed.js +198 -0
  210. data/lib/apps/texteditor/js/theme-crimson_editor.js +1 -0
  211. data/lib/apps/texteditor/js/theme-dawn-noconflict.js +1 -0
  212. data/lib/apps/texteditor/js/theme-dawn-uncompressed-noconflict.js +191 -0
  213. data/lib/apps/texteditor/js/theme-dawn-uncompressed.js +191 -0
  214. data/lib/apps/texteditor/js/theme-dawn.js +1 -0
  215. data/lib/apps/texteditor/js/theme-dreamweaver-noconflict.js +1 -0
  216. data/lib/apps/texteditor/js/theme-dreamweaver-uncompressed-noconflict.js +227 -0
  217. data/lib/apps/texteditor/js/theme-dreamweaver-uncompressed.js +227 -0
  218. data/lib/apps/texteditor/js/theme-dreamweaver.js +1 -0
  219. data/lib/apps/texteditor/js/theme-eclipse-noconflict.js +1 -0
  220. data/lib/apps/texteditor/js/theme-eclipse-uncompressed-noconflict.js +147 -0
  221. data/lib/apps/texteditor/js/theme-eclipse-uncompressed.js +147 -0
  222. data/lib/apps/texteditor/js/theme-eclipse.js +1 -0
  223. data/lib/apps/texteditor/js/theme-idle_fingers-noconflict.js +1 -0
  224. data/lib/apps/texteditor/js/theme-idle_fingers-uncompressed-noconflict.js +179 -0
  225. data/lib/apps/texteditor/js/theme-idle_fingers-uncompressed.js +179 -0
  226. data/lib/apps/texteditor/js/theme-idle_fingers.js +1 -0
  227. data/lib/apps/texteditor/js/theme-kr_theme-noconflict.js +1 -0
  228. data/lib/apps/texteditor/js/theme-kr_theme-uncompressed-noconflict.js +182 -0
  229. data/lib/apps/texteditor/js/theme-kr_theme-uncompressed.js +182 -0
  230. data/lib/apps/texteditor/js/theme-kr_theme.js +1 -0
  231. data/lib/apps/texteditor/js/theme-merbivore-noconflict.js +1 -0
  232. data/lib/apps/texteditor/js/theme-merbivore-uncompressed-noconflict.js +182 -0
  233. data/lib/apps/texteditor/js/theme-merbivore-uncompressed.js +182 -0
  234. data/lib/apps/texteditor/js/theme-merbivore.js +1 -0
  235. data/lib/apps/texteditor/js/theme-merbivore_soft-noconflict.js +1 -0
  236. data/lib/apps/texteditor/js/theme-merbivore_soft-uncompressed-noconflict.js +188 -0
  237. data/lib/apps/texteditor/js/theme-merbivore_soft-uncompressed.js +188 -0
  238. data/lib/apps/texteditor/js/theme-merbivore_soft.js +1 -0
  239. data/lib/apps/texteditor/js/theme-mono_industrial-noconflict.js +1 -0
  240. data/lib/apps/texteditor/js/theme-mono_industrial-uncompressed-noconflict.js +190 -0
  241. data/lib/apps/texteditor/js/theme-mono_industrial-uncompressed.js +190 -0
  242. data/lib/apps/texteditor/js/theme-mono_industrial.js +1 -0
  243. data/lib/apps/texteditor/js/theme-monokai-noconflict.js +1 -0
  244. data/lib/apps/texteditor/js/theme-monokai-uncompressed-noconflict.js +188 -0
  245. data/lib/apps/texteditor/js/theme-monokai-uncompressed.js +188 -0
  246. data/lib/apps/texteditor/js/theme-monokai.js +1 -0
  247. data/lib/apps/texteditor/js/theme-pastel_on_dark-noconflict.js +1 -0
  248. data/lib/apps/texteditor/js/theme-pastel_on_dark-uncompressed-noconflict.js +192 -0
  249. data/lib/apps/texteditor/js/theme-pastel_on_dark-uncompressed.js +192 -0
  250. data/lib/apps/texteditor/js/theme-pastel_on_dark.js +1 -0
  251. data/lib/apps/texteditor/js/theme-solarized_dark-noconflict.js +1 -0
  252. data/lib/apps/texteditor/js/theme-solarized_dark-uncompressed-noconflict.js +173 -0
  253. data/lib/apps/texteditor/js/theme-solarized_dark-uncompressed.js +173 -0
  254. data/lib/apps/texteditor/js/theme-solarized_dark.js +1 -0
  255. data/lib/apps/texteditor/js/theme-solarized_light-noconflict.js +1 -0
  256. data/lib/apps/texteditor/js/theme-solarized_light-uncompressed-noconflict.js +172 -0
  257. data/lib/apps/texteditor/js/theme-solarized_light-uncompressed.js +172 -0
  258. data/lib/apps/texteditor/js/theme-solarized_light.js +1 -0
  259. data/lib/apps/texteditor/js/theme-textmate-noconflict.js +0 -0
  260. data/lib/apps/texteditor/js/theme-textmate-uncompressed-noconflict.js +0 -0
  261. data/lib/apps/texteditor/js/theme-textmate-uncompressed.js +0 -0
  262. data/lib/apps/texteditor/js/theme-textmate.js +0 -0
  263. data/lib/apps/texteditor/js/theme-tomorrow-noconflict.js +1 -0
  264. data/lib/apps/texteditor/js/theme-tomorrow-uncompressed-noconflict.js +206 -0
  265. data/lib/apps/texteditor/js/theme-tomorrow-uncompressed.js +206 -0
  266. data/lib/apps/texteditor/js/theme-tomorrow.js +1 -0
  267. data/lib/apps/texteditor/js/theme-tomorrow_night-noconflict.js +1 -0
  268. data/lib/apps/texteditor/js/theme-tomorrow_night-uncompressed-noconflict.js +206 -0
  269. data/lib/apps/texteditor/js/theme-tomorrow_night-uncompressed.js +206 -0
  270. data/lib/apps/texteditor/js/theme-tomorrow_night.js +1 -0
  271. data/lib/apps/texteditor/js/theme-tomorrow_night_blue-noconflict.js +1 -0
  272. data/lib/apps/texteditor/js/theme-tomorrow_night_blue-uncompressed-noconflict.js +206 -0
  273. data/lib/apps/texteditor/js/theme-tomorrow_night_blue-uncompressed.js +206 -0
  274. data/lib/apps/texteditor/js/theme-tomorrow_night_blue.js +1 -0
  275. data/lib/apps/texteditor/js/theme-tomorrow_night_bright-noconflict.js +1 -0
  276. data/lib/apps/texteditor/js/theme-tomorrow_night_bright-uncompressed-noconflict.js +206 -0
  277. data/lib/apps/texteditor/js/theme-tomorrow_night_bright-uncompressed.js +206 -0
  278. data/lib/apps/texteditor/js/theme-tomorrow_night_bright.js +1 -0
  279. data/lib/apps/texteditor/js/theme-tomorrow_night_eighties-noconflict.js +1 -0
  280. data/lib/apps/texteditor/js/theme-tomorrow_night_eighties-uncompressed-noconflict.js +202 -0
  281. data/lib/apps/texteditor/js/theme-tomorrow_night_eighties-uncompressed.js +202 -0
  282. data/lib/apps/texteditor/js/theme-tomorrow_night_eighties.js +1 -0
  283. data/lib/apps/texteditor/js/theme-twilight-noconflict.js +1 -0
  284. data/lib/apps/texteditor/js/theme-twilight-uncompressed-noconflict.js +204 -0
  285. data/lib/apps/texteditor/js/theme-twilight-uncompressed.js +204 -0
  286. data/lib/apps/texteditor/js/theme-twilight.js +1 -0
  287. data/lib/apps/texteditor/js/theme-vibrant_ink-noconflict.js +1 -0
  288. data/lib/apps/texteditor/js/theme-vibrant_ink-uncompressed-noconflict.js +183 -0
  289. data/lib/apps/texteditor/js/theme-vibrant_ink-uncompressed.js +183 -0
  290. data/lib/apps/texteditor/js/theme-vibrant_ink.js +1 -0
  291. data/lib/apps/texteditor/js/worker-coffee.js +7991 -0
  292. data/lib/apps/texteditor/js/worker-css.js +12224 -0
  293. data/lib/apps/texteditor/js/worker-javascript.js +11124 -0
  294. data/lib/apps/texteditor/js/worker-json.js +3593 -0
  295. data/lib/apps/texteditor/options.json +16 -0
  296. data/lib/daftos/.DS_Store +0 -0
  297. data/lib/daftos/server.rb +106 -0
  298. data/lib/daftos/views/app_footer.erb +2 -0
  299. data/lib/daftos/views/app_header.erb +33 -0
  300. data/lib/daftos.rb +25 -2
  301. data/lib/libs/.DS_Store +0 -0
  302. data/lib/libs/coffee/daftos.coffee +36 -0
  303. data/lib/libs/css/bootstrap.css +3496 -0
  304. data/lib/libs/js/bootstrap.js +1720 -0
  305. data/lib/libs/js/jquery.js +4 -0
  306. data/myapp.pid +1 -0
  307. metadata +325 -12
@@ -0,0 +1,2918 @@
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
+ ace.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
+ ace.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
+ ace.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
+ 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
+ }, { // match stuff like: Sound.prototype.play = function() { }
384
+ token : [
385
+ "storage.type",
386
+ "punctuation.operator",
387
+ "support.function",
388
+ "punctuation.operator",
389
+ "entity.name.function",
390
+ "text",
391
+ "keyword.operator",
392
+ "text",
393
+ "storage.type",
394
+ "text",
395
+ "paren.lparen"
396
+ ],
397
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
398
+ next: "function_arguments"
399
+ }, { // match stuff like: Sound.prototype.play = myfunc
400
+ token : [
401
+ "storage.type",
402
+ "punctuation.operator",
403
+ "support.function",
404
+ "punctuation.operator",
405
+ "entity.name.function",
406
+ "text",
407
+ "keyword.operator",
408
+ "text"
409
+ ],
410
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
411
+ next: "function_arguments"
412
+ }, { // match stuff like: Sound.play = function() { }
413
+ token : [
414
+ "storage.type",
415
+ "punctuation.operator",
416
+ "entity.name.function",
417
+ "text",
418
+ "keyword.operator",
419
+ "text",
420
+ "storage.type",
421
+ "text",
422
+ "paren.lparen"
423
+ ],
424
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
425
+ next: "function_arguments"
426
+ }, { // match stuff like: play = function() { }
427
+ token : [
428
+ "entity.name.function",
429
+ "text",
430
+ "keyword.operator",
431
+ "text",
432
+ "storage.type",
433
+ "text",
434
+ "paren.lparen"
435
+ ],
436
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
437
+ next: "function_arguments"
438
+ }, { // match regular function like: function myFunc(arg) { }
439
+ token : [
440
+ "storage.type",
441
+ "text",
442
+ "entity.name.function",
443
+ "text",
444
+ "paren.lparen"
445
+ ],
446
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
447
+ next: "function_arguments"
448
+ }, { // match stuff like: foobar: function() { }
449
+ token : [
450
+ "entity.name.function",
451
+ "text",
452
+ "punctuation.operator",
453
+ "text",
454
+ "storage.type",
455
+ "text",
456
+ "paren.lparen"
457
+ ],
458
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
459
+ next: "function_arguments"
460
+ }, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
461
+ token : [
462
+ "text",
463
+ "text",
464
+ "storage.type",
465
+ "text",
466
+ "paren.lparen"
467
+ ],
468
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
469
+ next: "function_arguments"
470
+ }, {
471
+ token : "constant.language.boolean",
472
+ regex : /(?:true|false)\b/
473
+ }, {
474
+ token : "keyword",
475
+ regex : "(?:" + kwBeforeRe + ")\\b",
476
+ next : "regex_allowed"
477
+ }, {
478
+ token : ["punctuation.operator", "support.function"],
479
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
480
+ }, {
481
+ token : ["punctuation.operator", "support.function.dom"],
482
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
483
+ }, {
484
+ token : ["punctuation.operator", "support.constant"],
485
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
486
+ }, {
487
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
488
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
489
+ }, {
490
+ token : function(value) {
491
+ if (globals.hasOwnProperty(value))
492
+ return "variable.language";
493
+ else if (deprecated.hasOwnProperty(value))
494
+ return "invalid.deprecated";
495
+ else if (definitions.hasOwnProperty(value))
496
+ return "storage.type";
497
+ else if (keywords.hasOwnProperty(value))
498
+ return "keyword";
499
+ else if (buildinConstants.hasOwnProperty(value))
500
+ return "constant.language";
501
+ else if (futureReserved.hasOwnProperty(value))
502
+ return "invalid.illegal";
503
+ else if (value == "debugger")
504
+ return "invalid.deprecated";
505
+ else
506
+ return "identifier";
507
+ },
508
+ regex : identifierRe
509
+ }, {
510
+ token : "keyword.operator",
511
+ regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
512
+ next : "regex_allowed"
513
+ }, {
514
+ token : "punctuation.operator",
515
+ regex : /\?|\:|\,|\;|\./,
516
+ next : "regex_allowed"
517
+ }, {
518
+ token : "paren.lparen",
519
+ regex : /[\[({]/,
520
+ next : "regex_allowed"
521
+ }, {
522
+ token : "paren.rparen",
523
+ regex : /[\])}]/
524
+ }, {
525
+ token : "keyword.operator",
526
+ regex : /\/=?/,
527
+ next : "regex_allowed"
528
+ }, {
529
+ token: "comment",
530
+ regex: /^#!.*$/
531
+ }, {
532
+ token : "text",
533
+ regex : /\s+/
534
+ }
535
+ ],
536
+ // regular expressions are only allowed after certain tokens. This
537
+ // makes sure we don't mix up regexps with the divison operator
538
+ "regex_allowed": [
539
+ DocCommentHighlightRules.getStartRule("doc-start"),
540
+ {
541
+ token : "comment", // multi line comment
542
+ merge : true,
543
+ regex : "\\/\\*",
544
+ next : "comment_regex_allowed"
545
+ }, {
546
+ token : "comment",
547
+ regex : "\\/\\/.*$"
548
+ }, {
549
+ token: "string.regexp",
550
+ regex: "\\/",
551
+ next: "regex",
552
+ merge: true
553
+ }, {
554
+ token : "text",
555
+ regex : "\\s+"
556
+ }, {
557
+ // immediately return to the start mode without matching
558
+ // anything
559
+ token: "empty",
560
+ regex: "",
561
+ next: "start"
562
+ }
563
+ ],
564
+ "regex": [
565
+ {
566
+ token: "regexp.keyword.operator",
567
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
568
+ }, {
569
+ // flag
570
+ token: "string.regexp",
571
+ regex: "/\\w*",
572
+ next: "start",
573
+ merge: true
574
+ }, {
575
+ token: "string.regexp",
576
+ regex: "[^\\\\/\\[]+",
577
+ merge: true
578
+ }, {
579
+ token: "string.regexp.charachterclass",
580
+ regex: "\\[",
581
+ next: "regex_character_class",
582
+ merge: true
583
+ }, {
584
+ token: "empty",
585
+ regex: "",
586
+ next: "start"
587
+ }
588
+ ],
589
+ "regex_character_class": [
590
+ {
591
+ token: "regexp.keyword.operator",
592
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
593
+ }, {
594
+ token: "string.regexp.charachterclass",
595
+ regex: "]",
596
+ next: "regex",
597
+ merge: true
598
+ }, {
599
+ token: "string.regexp.charachterclass",
600
+ regex: "[^\\\\\\]]+",
601
+ merge: true
602
+ }, {
603
+ token: "empty",
604
+ regex: "",
605
+ next: "start"
606
+ }
607
+ ],
608
+ "function_arguments": [
609
+ {
610
+ token: "variable.parameter",
611
+ regex: identifierRe,
612
+ }, {
613
+ token: "punctuation.operator",
614
+ regex: "[, ]+",
615
+ merge: true
616
+ }, {
617
+ token: "punctuation.operator",
618
+ regex: "$",
619
+ merge: true
620
+ }, {
621
+ token: "empty",
622
+ regex: "",
623
+ next: "start"
624
+ }
625
+ ],
626
+ "comment_regex_allowed" : [
627
+ {
628
+ token : "comment", // closing comment
629
+ regex : ".*?\\*\\/",
630
+ merge : true,
631
+ next : "regex_allowed"
632
+ }, {
633
+ token : "comment", // comment spanning whole line
634
+ merge : true,
635
+ regex : ".+"
636
+ }
637
+ ],
638
+ "comment" : [
639
+ {
640
+ token : "comment", // closing comment
641
+ regex : ".*?\\*\\/",
642
+ merge : true,
643
+ next : "start"
644
+ }, {
645
+ token : "comment", // comment spanning whole line
646
+ merge : true,
647
+ regex : ".+"
648
+ }
649
+ ],
650
+ "qqstring" : [
651
+ {
652
+ token : "constant.language.escape",
653
+ regex : escapedRe
654
+ }, {
655
+ token : "string",
656
+ regex : '[^"\\\\]+',
657
+ merge : true
658
+ }, {
659
+ token : "string",
660
+ regex : "\\\\$",
661
+ next : "qqstring",
662
+ merge : true
663
+ }, {
664
+ token : "string",
665
+ regex : '"|$',
666
+ next : "start",
667
+ merge : true
668
+ }
669
+ ],
670
+ "qstring" : [
671
+ {
672
+ token : "constant.language.escape",
673
+ regex : escapedRe
674
+ }, {
675
+ token : "string",
676
+ regex : "[^'\\\\]+",
677
+ merge : true
678
+ }, {
679
+ token : "string",
680
+ regex : "\\\\$",
681
+ next : "qstring",
682
+ merge : true
683
+ }, {
684
+ token : "string",
685
+ regex : "'|$",
686
+ next : "start",
687
+ merge : true
688
+ }
689
+ ]
690
+ };
691
+
692
+ this.embedRules(DocCommentHighlightRules, "doc-",
693
+ [ DocCommentHighlightRules.getEndRule("start") ]);
694
+ };
695
+
696
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
697
+
698
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
699
+ });
700
+ /* ***** BEGIN LICENSE BLOCK *****
701
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
702
+ *
703
+ * The contents of this file are subject to the Mozilla Public License Version
704
+ * 1.1 (the "License"); you may not use this file except in compliance with
705
+ * the License. You may obtain a copy of the License at
706
+ * http://www.mozilla.org/MPL/
707
+ *
708
+ * Software distributed under the License is distributed on an "AS IS" basis,
709
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
710
+ * for the specific language governing rights and limitations under the
711
+ * License.
712
+ *
713
+ * The Original Code is Ajax.org Code Editor (ACE).
714
+ *
715
+ * The Initial Developer of the Original Code is
716
+ * Ajax.org B.V.
717
+ * Portions created by the Initial Developer are Copyright (C) 2010
718
+ * the Initial Developer. All Rights Reserved.
719
+ *
720
+ * Contributor(s):
721
+ * Fabian Jakobs <fabian AT ajax DOT org>
722
+ *
723
+ * Alternatively, the contents of this file may be used under the terms of
724
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
725
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
726
+ * in which case the provisions of the GPL or the LGPL are applicable instead
727
+ * of those above. If you wish to allow use of your version of this file only
728
+ * under the terms of either the GPL or the LGPL, and not to allow others to
729
+ * use your version of this file under the terms of the MPL, indicate your
730
+ * decision by deleting the provisions above and replace them with the notice
731
+ * and other provisions required by the GPL or the LGPL. If you do not delete
732
+ * the provisions above, a recipient may use your version of this file under
733
+ * the terms of any one of the MPL, the GPL or the LGPL.
734
+ *
735
+ * ***** END LICENSE BLOCK ***** */
736
+
737
+ ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
738
+ "use strict";
739
+
740
+ var oop = require("../lib/oop");
741
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
742
+
743
+ var DocCommentHighlightRules = function() {
744
+
745
+ this.$rules = {
746
+ "start" : [ {
747
+ token : "comment.doc.tag",
748
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
749
+ }, {
750
+ token : "comment.doc",
751
+ merge : true,
752
+ regex : "\\s+"
753
+ }, {
754
+ token : "comment.doc",
755
+ merge : true,
756
+ regex : "TODO"
757
+ }, {
758
+ token : "comment.doc",
759
+ merge : true,
760
+ regex : "[^@\\*]+"
761
+ }, {
762
+ token : "comment.doc",
763
+ merge : true,
764
+ regex : "."
765
+ }]
766
+ };
767
+ };
768
+
769
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
770
+
771
+ DocCommentHighlightRules.getStartRule = function(start) {
772
+ return {
773
+ token : "comment.doc", // doc comment
774
+ merge : true,
775
+ regex : "\\/\\*(?=\\*)",
776
+ next : start
777
+ };
778
+ };
779
+
780
+ DocCommentHighlightRules.getEndRule = function (start) {
781
+ return {
782
+ token : "comment.doc", // closing comment
783
+ merge : true,
784
+ regex : "\\*\\/",
785
+ next : start
786
+ };
787
+ };
788
+
789
+
790
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
791
+
792
+ });
793
+ /* ***** BEGIN LICENSE BLOCK *****
794
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
795
+ *
796
+ * The contents of this file are subject to the Mozilla Public License Version
797
+ * 1.1 (the "License"); you may not use this file except in compliance with
798
+ * the License. You may obtain a copy of the License at
799
+ * http://www.mozilla.org/MPL/
800
+ *
801
+ * Software distributed under the License is distributed on an "AS IS" basis,
802
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
803
+ * for the specific language governing rights and limitations under the
804
+ * License.
805
+ *
806
+ * The Original Code is Ajax.org Code Editor (ACE).
807
+ *
808
+ * The Initial Developer of the Original Code is
809
+ * Ajax.org B.V.
810
+ * Portions created by the Initial Developer are Copyright (C) 2010
811
+ * the Initial Developer. All Rights Reserved.
812
+ *
813
+ * Contributor(s):
814
+ * Fabian Jakobs <fabian AT ajax DOT org>
815
+ *
816
+ * Alternatively, the contents of this file may be used under the terms of
817
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
818
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
819
+ * in which case the provisions of the GPL or the LGPL are applicable instead
820
+ * of those above. If you wish to allow use of your version of this file only
821
+ * under the terms of either the GPL or the LGPL, and not to allow others to
822
+ * use your version of this file under the terms of the MPL, indicate your
823
+ * decision by deleting the provisions above and replace them with the notice
824
+ * and other provisions required by the GPL or the LGPL. If you do not delete
825
+ * the provisions above, a recipient may use your version of this file under
826
+ * the terms of any one of the MPL, the GPL or the LGPL.
827
+ *
828
+ * ***** END LICENSE BLOCK ***** */
829
+
830
+ ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
831
+ "use strict";
832
+
833
+ var Range = require("../range").Range;
834
+
835
+ var MatchingBraceOutdent = function() {};
836
+
837
+ (function() {
838
+
839
+ this.checkOutdent = function(line, input) {
840
+ if (! /^\s+$/.test(line))
841
+ return false;
842
+
843
+ return /^\s*\}/.test(input);
844
+ };
845
+
846
+ this.autoOutdent = function(doc, row) {
847
+ var line = doc.getLine(row);
848
+ var match = line.match(/^(\s*\})/);
849
+
850
+ if (!match) return 0;
851
+
852
+ var column = match[1].length;
853
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
854
+
855
+ if (!openBracePos || openBracePos.row == row) return 0;
856
+
857
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
858
+ doc.replace(new Range(row, 0, row, column-1), indent);
859
+ };
860
+
861
+ this.$getIndent = function(line) {
862
+ var match = line.match(/^(\s+)/);
863
+ if (match) {
864
+ return match[1];
865
+ }
866
+
867
+ return "";
868
+ };
869
+
870
+ }).call(MatchingBraceOutdent.prototype);
871
+
872
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
873
+ });
874
+ /* vim:ts=4:sts=4:sw=4:
875
+ * ***** BEGIN LICENSE BLOCK *****
876
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
877
+ *
878
+ * The contents of this file are subject to the Mozilla Public License Version
879
+ * 1.1 (the "License"); you may not use this file except in compliance with
880
+ * the License. You may obtain a copy of the License at
881
+ * http://www.mozilla.org/MPL/
882
+ *
883
+ * Software distributed under the License is distributed on an "AS IS" basis,
884
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
885
+ * for the specific language governing rights and limitations under the
886
+ * License.
887
+ *
888
+ * The Original Code is Ajax.org Code Editor (ACE).
889
+ *
890
+ * The Initial Developer of the Original Code is
891
+ * Ajax.org B.V.
892
+ * Portions created by the Initial Developer are Copyright (C) 2010
893
+ * the Initial Developer. All Rights Reserved.
894
+ *
895
+ * Contributor(s):
896
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
897
+ *
898
+ * Alternatively, the contents of this file may be used under the terms of
899
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
900
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
901
+ * in which case the provisions of the GPL or the LGPL are applicable instead
902
+ * of those above. If you wish to allow use of your version of this file only
903
+ * under the terms of either the GPL or the LGPL, and not to allow others to
904
+ * use your version of this file under the terms of the MPL, indicate your
905
+ * decision by deleting the provisions above and replace them with the notice
906
+ * and other provisions required by the GPL or the LGPL. If you do not delete
907
+ * the provisions above, a recipient may use your version of this file under
908
+ * the terms of any one of the MPL, the GPL or the LGPL.
909
+ *
910
+ * ***** END LICENSE BLOCK ***** */
911
+
912
+ ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
913
+ "use strict";
914
+
915
+ var oop = require("../../lib/oop");
916
+ var Behaviour = require('../behaviour').Behaviour;
917
+
918
+ var CstyleBehaviour = function () {
919
+
920
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
921
+ if (text == '{') {
922
+ var selection = editor.getSelectionRange();
923
+ var selected = session.doc.getTextRange(selection);
924
+ if (selected !== "") {
925
+ return {
926
+ text: '{' + selected + '}',
927
+ selection: false
928
+ };
929
+ } else {
930
+ return {
931
+ text: '{}',
932
+ selection: [1, 1]
933
+ };
934
+ }
935
+ } else if (text == '}') {
936
+ var cursor = editor.getCursorPosition();
937
+ var line = session.doc.getLine(cursor.row);
938
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
939
+ if (rightChar == '}') {
940
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
941
+ if (matching !== null) {
942
+ return {
943
+ text: '',
944
+ selection: [1, 1]
945
+ };
946
+ }
947
+ }
948
+ } else if (text == "\n") {
949
+ var cursor = editor.getCursorPosition();
950
+ var line = session.doc.getLine(cursor.row);
951
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
952
+ if (rightChar == '}') {
953
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
954
+ if (!openBracePos)
955
+ return null;
956
+
957
+ var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
958
+ var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
959
+
960
+ return {
961
+ text: '\n' + indent + '\n' + next_indent,
962
+ selection: [1, indent.length, 1, indent.length]
963
+ };
964
+ }
965
+ }
966
+ });
967
+
968
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
969
+ var selected = session.doc.getTextRange(range);
970
+ if (!range.isMultiLine() && selected == '{') {
971
+ var line = session.doc.getLine(range.start.row);
972
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
973
+ if (rightChar == '}') {
974
+ range.end.column++;
975
+ return range;
976
+ }
977
+ }
978
+ });
979
+
980
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
981
+ if (text == '(') {
982
+ var selection = editor.getSelectionRange();
983
+ var selected = session.doc.getTextRange(selection);
984
+ if (selected !== "") {
985
+ return {
986
+ text: '(' + selected + ')',
987
+ selection: false
988
+ };
989
+ } else {
990
+ return {
991
+ text: '()',
992
+ selection: [1, 1]
993
+ };
994
+ }
995
+ } else if (text == ')') {
996
+ var cursor = editor.getCursorPosition();
997
+ var line = session.doc.getLine(cursor.row);
998
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
999
+ if (rightChar == ')') {
1000
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
1001
+ if (matching !== null) {
1002
+ return {
1003
+ text: '',
1004
+ selection: [1, 1]
1005
+ };
1006
+ }
1007
+ }
1008
+ }
1009
+ });
1010
+
1011
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
1012
+ var selected = session.doc.getTextRange(range);
1013
+ if (!range.isMultiLine() && selected == '(') {
1014
+ var line = session.doc.getLine(range.start.row);
1015
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1016
+ if (rightChar == ')') {
1017
+ range.end.column++;
1018
+ return range;
1019
+ }
1020
+ }
1021
+ });
1022
+
1023
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1024
+ if (text == '"' || text == "'") {
1025
+ var quote = text;
1026
+ var selection = editor.getSelectionRange();
1027
+ var selected = session.doc.getTextRange(selection);
1028
+ if (selected !== "") {
1029
+ return {
1030
+ text: quote + selected + quote,
1031
+ selection: false
1032
+ };
1033
+ } else {
1034
+ var cursor = editor.getCursorPosition();
1035
+ var line = session.doc.getLine(cursor.row);
1036
+ var leftChar = line.substring(cursor.column-1, cursor.column);
1037
+
1038
+ // We're escaped.
1039
+ if (leftChar == '\\') {
1040
+ return null;
1041
+ }
1042
+
1043
+ // Find what token we're inside.
1044
+ var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
1045
+ var col = 0, token;
1046
+ var quotepos = -1; // Track whether we're inside an open quote.
1047
+
1048
+ for (var x = 0; x < tokens.length; x++) {
1049
+ token = tokens[x];
1050
+ if (token.type == "string") {
1051
+ quotepos = -1;
1052
+ } else if (quotepos < 0) {
1053
+ quotepos = token.value.indexOf(quote);
1054
+ }
1055
+ if ((token.value.length + col) > selection.start.column) {
1056
+ break;
1057
+ }
1058
+ col += tokens[x].value.length;
1059
+ }
1060
+
1061
+ // Try and be smart about when we auto insert.
1062
+ if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
1063
+ return {
1064
+ text: quote + quote,
1065
+ selection: [1,1]
1066
+ };
1067
+ } else if (token && token.type === "string") {
1068
+ // Ignore input and move right one if we're typing over the closing quote.
1069
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1070
+ if (rightChar == quote) {
1071
+ return {
1072
+ text: '',
1073
+ selection: [1, 1]
1074
+ };
1075
+ }
1076
+ }
1077
+ }
1078
+ }
1079
+ });
1080
+
1081
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
1082
+ var selected = session.doc.getTextRange(range);
1083
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1084
+ var line = session.doc.getLine(range.start.row);
1085
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1086
+ if (rightChar == '"') {
1087
+ range.end.column++;
1088
+ return range;
1089
+ }
1090
+ }
1091
+ });
1092
+
1093
+ };
1094
+
1095
+ oop.inherits(CstyleBehaviour, Behaviour);
1096
+
1097
+ exports.CstyleBehaviour = CstyleBehaviour;
1098
+ });/* ***** BEGIN LICENSE BLOCK *****
1099
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1100
+ *
1101
+ * The contents of this file are subject to the Mozilla Public License Version
1102
+ * 1.1 (the "License"); you may not use this file except in compliance with
1103
+ * the License. You may obtain a copy of the License at
1104
+ * http://www.mozilla.org/MPL/
1105
+ *
1106
+ * Software distributed under the License is distributed on an "AS IS" basis,
1107
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1108
+ * for the specific language governing rights and limitations under the
1109
+ * License.
1110
+ *
1111
+ * The Original Code is Ajax.org Code Editor (ACE).
1112
+ *
1113
+ * The Initial Developer of the Original Code is
1114
+ * Ajax.org B.V.
1115
+ * Portions created by the Initial Developer are Copyright (C) 2010
1116
+ * the Initial Developer. All Rights Reserved.
1117
+ *
1118
+ * Contributor(s):
1119
+ * Fabian Jakobs <fabian AT ajax DOT org>
1120
+ *
1121
+ * Alternatively, the contents of this file may be used under the terms of
1122
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1123
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1124
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1125
+ * of those above. If you wish to allow use of your version of this file only
1126
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1127
+ * use your version of this file under the terms of the MPL, indicate your
1128
+ * decision by deleting the provisions above and replace them with the notice
1129
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1130
+ * the provisions above, a recipient may use your version of this file under
1131
+ * the terms of any one of the MPL, the GPL or the LGPL.
1132
+ *
1133
+ * ***** END LICENSE BLOCK ***** */
1134
+
1135
+ ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1136
+ "use strict";
1137
+
1138
+ var oop = require("../../lib/oop");
1139
+ var Range = require("../../range").Range;
1140
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1141
+
1142
+ var FoldMode = exports.FoldMode = function() {};
1143
+ oop.inherits(FoldMode, BaseFoldMode);
1144
+
1145
+ (function() {
1146
+
1147
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1148
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1149
+
1150
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1151
+ var line = session.getLine(row);
1152
+ var match = line.match(this.foldingStartMarker);
1153
+ if (match) {
1154
+ var i = match.index;
1155
+
1156
+ if (match[1])
1157
+ return this.openingBracketBlock(session, match[1], row, i);
1158
+
1159
+ var range = session.getCommentFoldRange(row, i + match[0].length);
1160
+ range.end.column -= 2;
1161
+ return range;
1162
+ }
1163
+
1164
+ if (foldStyle !== "markbeginend")
1165
+ return;
1166
+
1167
+ var match = line.match(this.foldingStopMarker);
1168
+ if (match) {
1169
+ var i = match.index + match[0].length;
1170
+
1171
+ if (match[2]) {
1172
+ var range = session.getCommentFoldRange(row, i);
1173
+ range.end.column -= 2;
1174
+ return range;
1175
+ }
1176
+
1177
+ var end = {row: row, column: i};
1178
+ var start = session.$findOpeningBracket(match[1], end);
1179
+
1180
+ if (!start)
1181
+ return;
1182
+
1183
+ start.column++;
1184
+ end.column--;
1185
+
1186
+ return Range.fromPoints(start, end);
1187
+ }
1188
+ };
1189
+
1190
+ }).call(FoldMode.prototype);
1191
+
1192
+ });/* ***** BEGIN LICENSE BLOCK *****
1193
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1194
+ *
1195
+ * The contents of this file are subject to the Mozilla Public License Version
1196
+ * 1.1 (the "License"); you may not use this file except in compliance with
1197
+ * the License. You may obtain a copy of the License at
1198
+ * http://www.mozilla.org/MPL/
1199
+ *
1200
+ * Software distributed under the License is distributed on an "AS IS" basis,
1201
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1202
+ * for the specific language governing rights and limitations under the
1203
+ * License.
1204
+ *
1205
+ * The Original Code is Ajax.org Code Editor (ACE).
1206
+ *
1207
+ * The Initial Developer of the Original Code is
1208
+ * Ajax.org B.V.
1209
+ * Portions created by the Initial Developer are Copyright (C) 2010
1210
+ * the Initial Developer. All Rights Reserved.
1211
+ *
1212
+ * Contributor(s):
1213
+ * Fabian Jakobs <fabian AT ajax DOT org>
1214
+ *
1215
+ * Alternatively, the contents of this file may be used under the terms of
1216
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1217
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1218
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1219
+ * of those above. If you wish to allow use of your version of this file only
1220
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1221
+ * use your version of this file under the terms of the MPL, indicate your
1222
+ * decision by deleting the provisions above and replace them with the notice
1223
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1224
+ * the provisions above, a recipient may use your version of this file under
1225
+ * the terms of any one of the MPL, the GPL or the LGPL.
1226
+ *
1227
+ * ***** END LICENSE BLOCK ***** */
1228
+
1229
+ ace.define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1230
+ "use strict";
1231
+
1232
+ var Range = require("../../range").Range;
1233
+
1234
+ var FoldMode = exports.FoldMode = function() {};
1235
+
1236
+ (function() {
1237
+
1238
+ this.foldingStartMarker = null;
1239
+ this.foldingStopMarker = null;
1240
+
1241
+ // must return "" if there's no fold, to enable caching
1242
+ this.getFoldWidget = function(session, foldStyle, row) {
1243
+ var line = session.getLine(row);
1244
+ if (this.foldingStartMarker.test(line))
1245
+ return "start";
1246
+ if (foldStyle == "markbeginend"
1247
+ && this.foldingStopMarker
1248
+ && this.foldingStopMarker.test(line))
1249
+ return "end";
1250
+ return "";
1251
+ };
1252
+
1253
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1254
+ return null;
1255
+ };
1256
+
1257
+ this.indentationBlock = function(session, row, column) {
1258
+ var re = /^\s*/;
1259
+ var startRow = row;
1260
+ var endRow = row;
1261
+ var line = session.getLine(row);
1262
+ var startColumn = column || line.length;
1263
+ var startLevel = line.match(re)[0].length;
1264
+ var maxRow = session.getLength()
1265
+
1266
+ while (++row < maxRow) {
1267
+ line = session.getLine(row);
1268
+ var level = line.match(re)[0].length;
1269
+
1270
+ if (level == line.length)
1271
+ continue;
1272
+
1273
+ if (level <= startLevel)
1274
+ break;
1275
+
1276
+ endRow = row;
1277
+ }
1278
+
1279
+ if (endRow > startRow) {
1280
+ var endColumn = session.getLine(endRow).length;
1281
+ return new Range(startRow, startColumn, endRow, endColumn);
1282
+ }
1283
+ };
1284
+
1285
+ this.openingBracketBlock = function(session, bracket, row, column) {
1286
+ var start = {row: row, column: column + 1};
1287
+ var end = session.$findClosingBracket(bracket, start);
1288
+ if (!end)
1289
+ return;
1290
+
1291
+ var fw = session.foldWidgets[end.row];
1292
+ if (fw == null)
1293
+ fw = this.getFoldWidget(session, end.row);
1294
+
1295
+ if (fw == "start") {
1296
+ end.row --;
1297
+ end.column = session.getLine(end.row).length;
1298
+ }
1299
+ return Range.fromPoints(start, end);
1300
+ };
1301
+
1302
+ }).call(FoldMode.prototype);
1303
+
1304
+ });
1305
+ /* ***** BEGIN LICENSE BLOCK *****
1306
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1307
+ *
1308
+ * The contents of this file are subject to the Mozilla Public License Version
1309
+ * 1.1 (the "License"); you may not use this file except in compliance with
1310
+ * the License. You may obtain a copy of the License at
1311
+ * http://www.mozilla.org/MPL/
1312
+ *
1313
+ * Software distributed under the License is distributed on an "AS IS" basis,
1314
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1315
+ * for the specific language governing rights and limitations under the
1316
+ * License.
1317
+ *
1318
+ * The Original Code is Ajax.org Code Editor (ACE).
1319
+ *
1320
+ * The Initial Developer of the Original Code is
1321
+ * Ajax.org B.V.
1322
+ * Portions created by the Initial Developer are Copyright (C) 2010
1323
+ * the Initial Developer. All Rights Reserved.
1324
+ *
1325
+ * Contributor(s):
1326
+ * Fabian Jakobs <fabian AT ajax DOT org>
1327
+ *
1328
+ * Alternatively, the contents of this file may be used under the terms of
1329
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1330
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1331
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1332
+ * of those above. If you wish to allow use of your version of this file only
1333
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1334
+ * use your version of this file under the terms of the MPL, indicate your
1335
+ * decision by deleting the provisions above and replace them with the notice
1336
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1337
+ * the provisions above, a recipient may use your version of this file under
1338
+ * the terms of any one of the MPL, the GPL or the LGPL.
1339
+ *
1340
+ * ***** END LICENSE BLOCK ***** */
1341
+
1342
+ ace.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) {
1343
+ "use strict";
1344
+
1345
+ var oop = require("../lib/oop");
1346
+ var TextMode = require("./text").Mode;
1347
+ var Tokenizer = require("../tokenizer").Tokenizer;
1348
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1349
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
1350
+ var XmlFoldMode = require("./folding/xml").FoldMode;
1351
+
1352
+ var Mode = function() {
1353
+ this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
1354
+ this.$behaviour = new XmlBehaviour();
1355
+ this.foldingRules = new XmlFoldMode();
1356
+ };
1357
+
1358
+ oop.inherits(Mode, TextMode);
1359
+
1360
+ (function() {
1361
+
1362
+ this.getNextLineIndent = function(state, line, tab) {
1363
+ return this.$getIndent(line);
1364
+ };
1365
+
1366
+ }).call(Mode.prototype);
1367
+
1368
+ exports.Mode = Mode;
1369
+ });
1370
+ /* ***** BEGIN LICENSE BLOCK *****
1371
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1372
+ *
1373
+ * The contents of this file are subject to the Mozilla Public License Version
1374
+ * 1.1 (the "License"); you may not use this file except in compliance with
1375
+ * the License. You may obtain a copy of the License at
1376
+ * http://www.mozilla.org/MPL/
1377
+ *
1378
+ * Software distributed under the License is distributed on an "AS IS" basis,
1379
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1380
+ * for the specific language governing rights and limitations under the
1381
+ * License.
1382
+ *
1383
+ * The Original Code is Ajax.org Code Editor (ACE).
1384
+ *
1385
+ * The Initial Developer of the Original Code is
1386
+ * Ajax.org B.V.
1387
+ * Portions created by the Initial Developer are Copyright (C) 2010
1388
+ * the Initial Developer. All Rights Reserved.
1389
+ *
1390
+ * Contributor(s):
1391
+ * Fabian Jakobs <fabian AT ajax DOT org>
1392
+ *
1393
+ * Alternatively, the contents of this file may be used under the terms of
1394
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1395
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1396
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1397
+ * of those above. If you wish to allow use of your version of this file only
1398
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1399
+ * use your version of this file under the terms of the MPL, indicate your
1400
+ * decision by deleting the provisions above and replace them with the notice
1401
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1402
+ * the provisions above, a recipient may use your version of this file under
1403
+ * the terms of any one of the MPL, the GPL or the LGPL.
1404
+ *
1405
+ * ***** END LICENSE BLOCK ***** */
1406
+
1407
+ ace.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) {
1408
+ "use strict";
1409
+
1410
+ var oop = require("../lib/oop");
1411
+ var xmlUtil = require("./xml_util");
1412
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1413
+
1414
+ var XmlHighlightRules = function() {
1415
+
1416
+ // regexp must not have capturing parentheses
1417
+ // regexps are ordered -> the first match is used
1418
+ this.$rules = {
1419
+ start : [{
1420
+ token : "text",
1421
+ regex : "<\\!\\[CDATA\\[",
1422
+ next : "cdata"
1423
+ }, {
1424
+ token : "xml_pe",
1425
+ regex : "<\\?.*?\\?>"
1426
+ }, {
1427
+ token : "comment",
1428
+ merge : true,
1429
+ regex : "<\\!--",
1430
+ next : "comment"
1431
+ }, {
1432
+ token : "xml_pe",
1433
+ regex : "<\\!.*?>"
1434
+ }, {
1435
+ token : "meta.tag", // opening tag
1436
+ regex : "<\\/?",
1437
+ next : "tag"
1438
+ }, {
1439
+ token : "text",
1440
+ regex : "\\s+"
1441
+ }, {
1442
+ token : "constant.character.entity",
1443
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1444
+ }, {
1445
+ token : "text",
1446
+ regex : "[^<]+"
1447
+ }],
1448
+
1449
+ cdata : [{
1450
+ token : "text",
1451
+ regex : "\\]\\]>",
1452
+ next : "start"
1453
+ }, {
1454
+ token : "text",
1455
+ regex : "\\s+"
1456
+ }, {
1457
+ token : "text",
1458
+ regex : "(?:[^\\]]|\\](?!\\]>))+"
1459
+ }],
1460
+
1461
+ comment : [{
1462
+ token : "comment",
1463
+ regex : ".*?-->",
1464
+ next : "start"
1465
+ }, {
1466
+ token : "comment",
1467
+ merge : true,
1468
+ regex : ".+"
1469
+ }]
1470
+ };
1471
+
1472
+ xmlUtil.tag(this.$rules, "tag", "start");
1473
+ };
1474
+
1475
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
1476
+
1477
+ exports.XmlHighlightRules = XmlHighlightRules;
1478
+ });
1479
+ /* ***** BEGIN LICENSE BLOCK *****
1480
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1481
+ *
1482
+ * The contents of this file are subject to the Mozilla Public License Version
1483
+ * 1.1 (the "License"); you may not use this file except in compliance with
1484
+ * the License. You may obtain a copy of the License at
1485
+ * http://www.mozilla.org/MPL/
1486
+ *
1487
+ * Software distributed under the License is distributed on an "AS IS" basis,
1488
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1489
+ * for the specific language governing rights and limitations under the
1490
+ * License.
1491
+ *
1492
+ * The Original Code is Ajax.org Code Editor (ACE).
1493
+ *
1494
+ * The Initial Developer of the Original Code is
1495
+ * Ajax.org B.V.
1496
+ * Portions created by the Initial Developer are Copyright (C) 2010
1497
+ * the Initial Developer. All Rights Reserved.
1498
+ *
1499
+ * Contributor(s):
1500
+ * Fabian Jakobs <fabian AT ajax DOT org>
1501
+ *
1502
+ * Alternatively, the contents of this file may be used under the terms of
1503
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1504
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1505
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1506
+ * of those above. If you wish to allow use of your version of this file only
1507
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1508
+ * use your version of this file under the terms of the MPL, indicate your
1509
+ * decision by deleting the provisions above and replace them with the notice
1510
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1511
+ * the provisions above, a recipient may use your version of this file under
1512
+ * the terms of any one of the MPL, the GPL or the LGPL.
1513
+ *
1514
+ * ***** END LICENSE BLOCK ***** */
1515
+
1516
+ ace.define('ace/mode/xml_util', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
1517
+ "use strict";
1518
+
1519
+ var lang = require("../lib/lang");
1520
+
1521
+ var formTags = lang.arrayToMap(
1522
+ ("button|form|input|label|select|textarea").split("|")
1523
+ );
1524
+
1525
+ var tableTags = lang.arrayToMap(
1526
+ ("table|tbody|td|tfoot|th|tr").split("|")
1527
+ );
1528
+
1529
+ function string(state) {
1530
+ return [{
1531
+ token : "string",
1532
+ regex : '".*?"'
1533
+ }, {
1534
+ token : "string", // multi line string start
1535
+ merge : true,
1536
+ regex : '["].*',
1537
+ next : state + "_qqstring"
1538
+ }, {
1539
+ token : "string",
1540
+ regex : "'.*?'"
1541
+ }, {
1542
+ token : "string", // multi line string start
1543
+ merge : true,
1544
+ regex : "['].*",
1545
+ next : state + "_qstring"
1546
+ }];
1547
+ }
1548
+
1549
+ function multiLineString(quote, state) {
1550
+ return [{
1551
+ token : "string",
1552
+ merge : true,
1553
+ regex : ".*?" + quote,
1554
+ next : state
1555
+ }, {
1556
+ token : "string",
1557
+ merge : true,
1558
+ regex : '.+'
1559
+ }];
1560
+ }
1561
+
1562
+ exports.tag = function(states, name, nextState) {
1563
+ states[name] = [{
1564
+ token : "text",
1565
+ regex : "\\s+"
1566
+ }, {
1567
+ //token : "meta.tag",
1568
+
1569
+ token : function(value) {
1570
+ if ( value==='a' ) {
1571
+ return "meta.tag.anchor";
1572
+ }
1573
+ else if ( value==='img' ) {
1574
+ return "meta.tag.image";
1575
+ }
1576
+ else if ( value==='script' ) {
1577
+ return "meta.tag.script";
1578
+ }
1579
+ else if ( value==='style' ) {
1580
+ return "meta.tag.style";
1581
+ }
1582
+ else if (formTags.hasOwnProperty(value.toLowerCase())) {
1583
+ return "meta.tag.form";
1584
+ }
1585
+ else if (tableTags.hasOwnProperty(value.toLowerCase())) {
1586
+ return "meta.tag.table";
1587
+ }
1588
+ else {
1589
+ return "meta.tag";
1590
+ }
1591
+ },
1592
+ merge : true,
1593
+ regex : "[-_a-zA-Z0-9:]+",
1594
+ next : name + "_embed_attribute_list"
1595
+ }, {
1596
+ token: "empty",
1597
+ regex: "",
1598
+ next : name + "_embed_attribute_list"
1599
+ }];
1600
+
1601
+ states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
1602
+ states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
1603
+
1604
+ states[name + "_embed_attribute_list"] = [{
1605
+ token : "meta.tag",
1606
+ merge : true,
1607
+ regex : "\/?>",
1608
+ next : nextState
1609
+ }, {
1610
+ token : "keyword.operator",
1611
+ regex : "="
1612
+ }, {
1613
+ token : "entity.other.attribute-name",
1614
+ regex : "[-_a-zA-Z0-9:]+"
1615
+ }, {
1616
+ token : "constant.numeric", // float
1617
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1618
+ }, {
1619
+ token : "text",
1620
+ regex : "\\s+"
1621
+ }].concat(string(name));
1622
+ };
1623
+
1624
+ });
1625
+ /* vim:ts=4:sts=4:sw=4:
1626
+ * ***** BEGIN LICENSE BLOCK *****
1627
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1628
+ *
1629
+ * The contents of this file are subject to the Mozilla Public License Version
1630
+ * 1.1 (the "License"); you may not use this file except in compliance with
1631
+ * the License. You may obtain a copy of the License at
1632
+ * http://www.mozilla.org/MPL/
1633
+ *
1634
+ * Software distributed under the License is distributed on an "AS IS" basis,
1635
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1636
+ * for the specific language governing rights and limitations under the
1637
+ * License.
1638
+ *
1639
+ * The Original Code is Ajax.org Code Editor (ACE).
1640
+ *
1641
+ * The Initial Developer of the Original Code is
1642
+ * Ajax.org B.V.
1643
+ * Portions created by the Initial Developer are Copyright (C) 2010
1644
+ * the Initial Developer. All Rights Reserved.
1645
+ *
1646
+ * Contributor(s):
1647
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
1648
+ *
1649
+ * Alternatively, the contents of this file may be used under the terms of
1650
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1651
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1652
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1653
+ * of those above. If you wish to allow use of your version of this file only
1654
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1655
+ * use your version of this file under the terms of the MPL, indicate your
1656
+ * decision by deleting the provisions above and replace them with the notice
1657
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1658
+ * the provisions above, a recipient may use your version of this file under
1659
+ * the terms of any one of the MPL, the GPL or the LGPL.
1660
+ *
1661
+ * ***** END LICENSE BLOCK ***** */
1662
+
1663
+ ace.define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
1664
+ "use strict";
1665
+
1666
+ var oop = require("../../lib/oop");
1667
+ var Behaviour = require("../behaviour").Behaviour;
1668
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1669
+
1670
+ var XmlBehaviour = function () {
1671
+
1672
+ this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
1673
+
1674
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
1675
+ if (text == '<') {
1676
+ var selection = editor.getSelectionRange();
1677
+ var selected = session.doc.getTextRange(selection);
1678
+ if (selected !== "") {
1679
+ return false;
1680
+ } else {
1681
+ return {
1682
+ text: '<>',
1683
+ selection: [1, 1]
1684
+ }
1685
+ }
1686
+ } else if (text == '>') {
1687
+ var cursor = editor.getCursorPosition();
1688
+ var line = session.doc.getLine(cursor.row);
1689
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1690
+ if (rightChar == '>') { // need some kind of matching check here
1691
+ return {
1692
+ text: '',
1693
+ selection: [1, 1]
1694
+ }
1695
+ }
1696
+ } else if (text == "\n") {
1697
+ var cursor = editor.getCursorPosition();
1698
+ var line = session.doc.getLine(cursor.row);
1699
+ var rightChars = line.substring(cursor.column, cursor.column + 2);
1700
+ if (rightChars == '</') {
1701
+ var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
1702
+ var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
1703
+
1704
+ return {
1705
+ text: '\n' + indent + '\n' + next_indent,
1706
+ selection: [1, indent.length, 1, indent.length]
1707
+ }
1708
+ }
1709
+ }
1710
+ });
1711
+
1712
+ }
1713
+ oop.inherits(XmlBehaviour, Behaviour);
1714
+
1715
+ exports.XmlBehaviour = XmlBehaviour;
1716
+ });/* ***** BEGIN LICENSE BLOCK *****
1717
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1718
+ *
1719
+ * The contents of this file are subject to the Mozilla Public License Version
1720
+ * 1.1 (the "License"); you may not use this file except in compliance with
1721
+ * the License. You may obtain a copy of the License at
1722
+ * http://www.mozilla.org/MPL/
1723
+ *
1724
+ * Software distributed under the License is distributed on an "AS IS" basis,
1725
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1726
+ * for the specific language governing rights and limitations under the
1727
+ * License.
1728
+ *
1729
+ * The Original Code is Ajax.org Code Editor (ACE).
1730
+ *
1731
+ * The Initial Developer of the Original Code is
1732
+ * Ajax.org B.V.
1733
+ * Portions created by the Initial Developer are Copyright (C) 2010
1734
+ * the Initial Developer. All Rights Reserved.
1735
+ *
1736
+ * Contributor(s):
1737
+ * Fabian Jakobs <fabian AT ajax DOT org>
1738
+ *
1739
+ * Alternatively, the contents of this file may be used under the terms of
1740
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
1741
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1742
+ * in which case the provisions of the GPL or the LGPL are applicable instead
1743
+ * of those above. If you wish to allow use of your version of this file only
1744
+ * under the terms of either the GPL or the LGPL, and not to allow others to
1745
+ * use your version of this file under the terms of the MPL, indicate your
1746
+ * decision by deleting the provisions above and replace them with the notice
1747
+ * and other provisions required by the GPL or the LGPL. If you do not delete
1748
+ * the provisions above, a recipient may use your version of this file under
1749
+ * the terms of any one of the MPL, the GPL or the LGPL.
1750
+ *
1751
+ * ***** END LICENSE BLOCK ***** */
1752
+
1753
+ ace.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) {
1754
+ "use strict";
1755
+
1756
+ var oop = require("../../lib/oop");
1757
+ var lang = require("../../lib/lang");
1758
+ var Range = require("../../range").Range;
1759
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1760
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1761
+
1762
+ var FoldMode = exports.FoldMode = function(voidElements) {
1763
+ BaseFoldMode.call(this);
1764
+ this.voidElements = voidElements || {};
1765
+ };
1766
+ oop.inherits(FoldMode, BaseFoldMode);
1767
+
1768
+ (function() {
1769
+
1770
+ this.getFoldWidget = function(session, foldStyle, row) {
1771
+ var tag = this._getFirstTagInLine(session, row);
1772
+
1773
+ if (tag.closing)
1774
+ return foldStyle == "markbeginend" ? "end" : "";
1775
+
1776
+ if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
1777
+ return "";
1778
+
1779
+ if (tag.selfClosing)
1780
+ return "";
1781
+
1782
+ if (tag.value.indexOf("/" + tag.tagName) !== -1)
1783
+ return "";
1784
+
1785
+ return "start";
1786
+ };
1787
+
1788
+ this._getFirstTagInLine = function(session, row) {
1789
+ var tokens = session.getTokens(row, row)[0].tokens;
1790
+ var value = "";
1791
+ for (var i = 0; i < tokens.length; i++) {
1792
+ var token = tokens[i];
1793
+ if (token.type.indexOf("meta.tag") === 0)
1794
+ value += token.value;
1795
+ else
1796
+ value += lang.stringRepeat(" ", token.value.length);
1797
+ }
1798
+
1799
+ return this._parseTag(value);
1800
+ };
1801
+
1802
+ this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
1803
+ this._parseTag = function(tag) {
1804
+
1805
+ var match = this.tagRe.exec(tag);
1806
+ var column = this.tagRe.lastIndex || 0;
1807
+ this.tagRe.lastIndex = 0;
1808
+
1809
+ return {
1810
+ value: tag,
1811
+ match: match ? match[2] : "",
1812
+ closing: match ? !!match[3] : false,
1813
+ selfClosing: match ? !!match[5] || match[2] == "/>" : false,
1814
+ tagName: match ? match[4] : "",
1815
+ column: match[1] ? column + match[1].length : column
1816
+ };
1817
+ };
1818
+
1819
+ /*
1820
+ * reads a full tag and places the iterator after the tag
1821
+ */
1822
+ this._readTagForward = function(iterator) {
1823
+ var token = iterator.getCurrentToken();
1824
+ if (!token)
1825
+ return null;
1826
+
1827
+ var value = "";
1828
+ var start;
1829
+
1830
+ do {
1831
+ if (token.type.indexOf("meta.tag") === 0) {
1832
+ if (!start) {
1833
+ var start = {
1834
+ row: iterator.getCurrentTokenRow(),
1835
+ column: iterator.getCurrentTokenColumn()
1836
+ };
1837
+ }
1838
+ value += token.value;
1839
+ if (value.indexOf(">") !== -1) {
1840
+ var tag = this._parseTag(value);
1841
+ tag.start = start;
1842
+ tag.end = {
1843
+ row: iterator.getCurrentTokenRow(),
1844
+ column: iterator.getCurrentTokenColumn() + token.value.length
1845
+ };
1846
+ iterator.stepForward();
1847
+ return tag;
1848
+ }
1849
+ }
1850
+ } while(token = iterator.stepForward());
1851
+
1852
+ return null;
1853
+ };
1854
+
1855
+ this._readTagBackward = function(iterator) {
1856
+ var token = iterator.getCurrentToken();
1857
+ if (!token)
1858
+ return null;
1859
+
1860
+ var value = "";
1861
+ var end;
1862
+
1863
+ do {
1864
+ if (token.type.indexOf("meta.tag") === 0) {
1865
+ if (!end) {
1866
+ end = {
1867
+ row: iterator.getCurrentTokenRow(),
1868
+ column: iterator.getCurrentTokenColumn() + token.value.length
1869
+ };
1870
+ }
1871
+ value = token.value + value;
1872
+ if (value.indexOf("<") !== -1) {
1873
+ var tag = this._parseTag(value);
1874
+ tag.end = end;
1875
+ tag.start = {
1876
+ row: iterator.getCurrentTokenRow(),
1877
+ column: iterator.getCurrentTokenColumn()
1878
+ };
1879
+ iterator.stepBackward();
1880
+ return tag;
1881
+ }
1882
+ }
1883
+ } while(token = iterator.stepBackward());
1884
+
1885
+ return null;
1886
+ };
1887
+
1888
+ this._pop = function(stack, tag) {
1889
+ while (stack.length) {
1890
+
1891
+ var top = stack[stack.length-1];
1892
+ if (!tag || top.tagName == tag.tagName) {
1893
+ return stack.pop();
1894
+ }
1895
+ else if (this.voidElements[tag.tagName]) {
1896
+ return;
1897
+ }
1898
+ else if (this.voidElements[top.tagName]) {
1899
+ stack.pop();
1900
+ continue;
1901
+ } else {
1902
+ return null;
1903
+ }
1904
+ }
1905
+ };
1906
+
1907
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1908
+ var firstTag = this._getFirstTagInLine(session, row);
1909
+
1910
+ if (!firstTag.match)
1911
+ return null;
1912
+
1913
+ var isBackward = firstTag.closing || firstTag.selfClosing;
1914
+ var stack = [];
1915
+ var tag;
1916
+
1917
+ if (!isBackward) {
1918
+ var iterator = new TokenIterator(session, row, firstTag.column);
1919
+ var start = {
1920
+ row: row,
1921
+ column: firstTag.column + firstTag.tagName.length + 2
1922
+ };
1923
+ while (tag = this._readTagForward(iterator)) {
1924
+ if (tag.selfClosing) {
1925
+ if (!stack.length) {
1926
+ tag.start.column += tag.tagName.length + 2;
1927
+ tag.end.column -= 2;
1928
+ return Range.fromPoints(tag.start, tag.end);
1929
+ } else
1930
+ continue;
1931
+ }
1932
+
1933
+ if (tag.closing) {
1934
+ this._pop(stack, tag);
1935
+ if (stack.length == 0)
1936
+ return Range.fromPoints(start, tag.start);
1937
+ }
1938
+ else {
1939
+ stack.push(tag)
1940
+ }
1941
+ }
1942
+ }
1943
+ else {
1944
+ var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
1945
+ var end = {
1946
+ row: row,
1947
+ column: firstTag.column
1948
+ };
1949
+
1950
+ while (tag = this._readTagBackward(iterator)) {
1951
+ if (tag.selfClosing) {
1952
+ if (!stack.length) {
1953
+ tag.start.column += tag.tagName.length + 2;
1954
+ tag.end.column -= 2;
1955
+ return Range.fromPoints(tag.start, tag.end);
1956
+ } else
1957
+ continue;
1958
+ }
1959
+
1960
+ if (!tag.closing) {
1961
+ this._pop(stack, tag);
1962
+ if (stack.length == 0) {
1963
+ tag.start.column += tag.tagName.length + 2;
1964
+ return Range.fromPoints(tag.start, end);
1965
+ }
1966
+ }
1967
+ else {
1968
+ stack.push(tag)
1969
+ }
1970
+ }
1971
+ }
1972
+
1973
+ };
1974
+
1975
+ }).call(FoldMode.prototype);
1976
+
1977
+ });/* ***** BEGIN LICENSE BLOCK *****
1978
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1979
+ *
1980
+ * The contents of this file are subject to the Mozilla Public License Version
1981
+ * 1.1 (the "License"); you may not use this file except in compliance with
1982
+ * the License. You may obtain a copy of the License at
1983
+ * http://www.mozilla.org/MPL/
1984
+ *
1985
+ * Software distributed under the License is distributed on an "AS IS" basis,
1986
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1987
+ * for the specific language governing rights and limitations under the
1988
+ * License.
1989
+ *
1990
+ * The Original Code is Ajax.org Code Editor (ACE).
1991
+ *
1992
+ * The Initial Developer of the Original Code is
1993
+ * Ajax.org B.V.
1994
+ * Portions created by the Initial Developer are Copyright (C) 2010
1995
+ * the Initial Developer. All Rights Reserved.
1996
+ *
1997
+ * Contributor(s):
1998
+ * Fabian Jakobs <fabian AT ajax DOT org>
1999
+ *
2000
+ * Alternatively, the contents of this file may be used under the terms of
2001
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2002
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2003
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2004
+ * of those above. If you wish to allow use of your version of this file only
2005
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2006
+ * use your version of this file under the terms of the MPL, indicate your
2007
+ * decision by deleting the provisions above and replace them with the notice
2008
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2009
+ * the provisions above, a recipient may use your version of this file under
2010
+ * the terms of any one of the MPL, the GPL or the LGPL.
2011
+ *
2012
+ * ***** END LICENSE BLOCK ***** */
2013
+
2014
+ ace.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) {
2015
+ "use strict";
2016
+
2017
+ var oop = require("../lib/oop");
2018
+ var TextMode = require("./text").Mode;
2019
+ var JavaScriptMode = require("./javascript").Mode;
2020
+ var CssMode = require("./css").Mode;
2021
+ var Tokenizer = require("../tokenizer").Tokenizer;
2022
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2023
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2024
+ var HtmlFoldMode = require("./folding/html").FoldMode;
2025
+
2026
+ var Mode = function() {
2027
+ var highlighter = new HtmlHighlightRules();
2028
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
2029
+ this.$behaviour = new XmlBehaviour();
2030
+
2031
+ this.$embeds = highlighter.getEmbeds();
2032
+ this.createModeDelegates({
2033
+ "js-": JavaScriptMode,
2034
+ "css-": CssMode
2035
+ });
2036
+
2037
+ this.foldingRules = new HtmlFoldMode();
2038
+ };
2039
+ oop.inherits(Mode, TextMode);
2040
+
2041
+ (function() {
2042
+
2043
+
2044
+ this.toggleCommentLines = function(state, doc, startRow, endRow) {
2045
+ return 0;
2046
+ };
2047
+
2048
+ this.getNextLineIndent = function(state, line, tab) {
2049
+ return this.$getIndent(line);
2050
+ };
2051
+
2052
+ this.checkOutdent = function(state, line, input) {
2053
+ return false;
2054
+ };
2055
+
2056
+ }).call(Mode.prototype);
2057
+
2058
+ exports.Mode = Mode;
2059
+ });
2060
+ /* ***** BEGIN LICENSE BLOCK *****
2061
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2062
+ *
2063
+ * The contents of this file are subject to the Mozilla Public License Version
2064
+ * 1.1 (the "License"); you may not use this file except in compliance with
2065
+ * the License. You may obtain a copy of the License at
2066
+ * http://www.mozilla.org/MPL/
2067
+ *
2068
+ * Software distributed under the License is distributed on an "AS IS" basis,
2069
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2070
+ * for the specific language governing rights and limitations under the
2071
+ * License.
2072
+ *
2073
+ * The Original Code is Ajax.org Code Editor (ACE).
2074
+ *
2075
+ * The Initial Developer of the Original Code is
2076
+ * Ajax.org B.V.
2077
+ * Portions created by the Initial Developer are Copyright (C) 2010
2078
+ * the Initial Developer. All Rights Reserved.
2079
+ *
2080
+ * Contributor(s):
2081
+ * Fabian Jakobs <fabian AT ajax DOT org>
2082
+ *
2083
+ * Alternatively, the contents of this file may be used under the terms of
2084
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2085
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2086
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2087
+ * of those above. If you wish to allow use of your version of this file only
2088
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2089
+ * use your version of this file under the terms of the MPL, indicate your
2090
+ * decision by deleting the provisions above and replace them with the notice
2091
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2092
+ * the provisions above, a recipient may use your version of this file under
2093
+ * the terms of any one of the MPL, the GPL or the LGPL.
2094
+ *
2095
+ * ***** END LICENSE BLOCK ***** */
2096
+
2097
+ ace.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) {
2098
+ "use strict";
2099
+
2100
+ var oop = require("../lib/oop");
2101
+ var TextMode = require("./text").Mode;
2102
+ var Tokenizer = require("../tokenizer").Tokenizer;
2103
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2104
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
2105
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
2106
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
2107
+
2108
+ var Mode = function() {
2109
+ this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules(), "i");
2110
+ this.$outdent = new MatchingBraceOutdent();
2111
+ this.foldingRules = new CStyleFoldMode();
2112
+ };
2113
+ oop.inherits(Mode, TextMode);
2114
+
2115
+ (function() {
2116
+
2117
+ this.foldingRules = "cStyle";
2118
+
2119
+ this.getNextLineIndent = function(state, line, tab) {
2120
+ var indent = this.$getIndent(line);
2121
+
2122
+ // ignore braces in comments
2123
+ var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
2124
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
2125
+ return indent;
2126
+ }
2127
+
2128
+ var match = line.match(/^.*\{\s*$/);
2129
+ if (match) {
2130
+ indent += tab;
2131
+ }
2132
+
2133
+ return indent;
2134
+ };
2135
+
2136
+ this.checkOutdent = function(state, line, input) {
2137
+ return this.$outdent.checkOutdent(line, input);
2138
+ };
2139
+
2140
+ this.autoOutdent = function(state, doc, row) {
2141
+ this.$outdent.autoOutdent(doc, row);
2142
+ };
2143
+
2144
+ this.createWorker = function(session) {
2145
+ var worker = new WorkerClient(["ace"], "worker-css.js", "ace/mode/css_worker", "Worker");
2146
+ worker.attachToDocument(session.getDocument());
2147
+
2148
+ worker.on("csslint", function(e) {
2149
+ var errors = [];
2150
+ e.data.forEach(function(message) {
2151
+ errors.push({
2152
+ row: message.line - 1,
2153
+ column: message.col - 1,
2154
+ text: message.message,
2155
+ type: message.type,
2156
+ lint: message
2157
+ });
2158
+ });
2159
+
2160
+ session.setAnnotations(errors);
2161
+ });
2162
+ return worker;
2163
+ };
2164
+
2165
+ }).call(Mode.prototype);
2166
+
2167
+ exports.Mode = Mode;
2168
+
2169
+ });
2170
+ /* ***** BEGIN LICENSE BLOCK *****
2171
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2172
+ *
2173
+ * The contents of this file are subject to the Mozilla Public License Version
2174
+ * 1.1 (the "License"); you may not use this file except in compliance with
2175
+ * the License. You may obtain a copy of the License at
2176
+ * http://www.mozilla.org/MPL/
2177
+ *
2178
+ * Software distributed under the License is distributed on an "AS IS" basis,
2179
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2180
+ * for the specific language governing rights and limitations under the
2181
+ * License.
2182
+ *
2183
+ * The Original Code is Ajax.org Code Editor (ACE).
2184
+ *
2185
+ * The Initial Developer of the Original Code is
2186
+ * Ajax.org B.V.
2187
+ * Portions created by the Initial Developer are Copyright (C) 2010
2188
+ * the Initial Developer. All Rights Reserved.
2189
+ *
2190
+ * Contributor(s):
2191
+ * Fabian Jakobs <fabian AT ajax DOT org>
2192
+ *
2193
+ * Alternatively, the contents of this file may be used under the terms of
2194
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2195
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2196
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2197
+ * of those above. If you wish to allow use of your version of this file only
2198
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2199
+ * use your version of this file under the terms of the MPL, indicate your
2200
+ * decision by deleting the provisions above and replace them with the notice
2201
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2202
+ * the provisions above, a recipient may use your version of this file under
2203
+ * the terms of any one of the MPL, the GPL or the LGPL.
2204
+ *
2205
+ * ***** END LICENSE BLOCK ***** */
2206
+
2207
+ ace.define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
2208
+ "use strict";
2209
+
2210
+ var oop = require("../lib/oop");
2211
+ var lang = require("../lib/lang");
2212
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2213
+
2214
+ var CssHighlightRules = function() {
2215
+
2216
+ var properties = lang.arrayToMap(
2217
+ ("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
2218
+ );
2219
+
2220
+ var functions = lang.arrayToMap(
2221
+ ("rgb|rgba|url|attr|counter|counters").split("|")
2222
+ );
2223
+
2224
+ var constants = lang.arrayToMap(
2225
+ ("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
2226
+ );
2227
+
2228
+ var colors = lang.arrayToMap(
2229
+ ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
2230
+ "purple|red|silver|teal|white|yellow").split("|")
2231
+ );
2232
+
2233
+ var fonts = lang.arrayToMap(
2234
+ ("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
2235
+ "symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
2236
+ "serif|monospace").split("|")
2237
+ );
2238
+
2239
+ // regexp must not have capturing parentheses. Use (?:) instead.
2240
+ // regexps are ordered -> the first match is used
2241
+
2242
+ var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
2243
+ var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
2244
+ var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
2245
+
2246
+ var base_ruleset = [
2247
+ {
2248
+ token : "comment", // multi line comment
2249
+ merge : true,
2250
+ regex : "\\/\\*",
2251
+ next : "ruleset_comment"
2252
+ }, {
2253
+ token : "string", // single line
2254
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
2255
+ }, {
2256
+ token : "string", // single line
2257
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
2258
+ }, {
2259
+ token : ["constant.numeric", "keyword"],
2260
+ regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
2261
+ }, {
2262
+ token : ["constant.numeric"],
2263
+ regex : "([0-9]+)"
2264
+ }, {
2265
+ token : "constant.numeric", // hex6 color
2266
+ regex : "#[a-f0-9]{6}"
2267
+ }, {
2268
+ token : "constant.numeric", // hex3 color
2269
+ regex : "#[a-f0-9]{3}"
2270
+ }, {
2271
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
2272
+ regex : pseudoElements
2273
+ }, {
2274
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
2275
+ regex : pseudoClasses
2276
+ }, {
2277
+ token : function(value) {
2278
+ if (properties.hasOwnProperty(value.toLowerCase())) {
2279
+ return "support.type";
2280
+ }
2281
+ else if (functions.hasOwnProperty(value.toLowerCase())) {
2282
+ return "support.function";
2283
+ }
2284
+ else if (constants.hasOwnProperty(value.toLowerCase())) {
2285
+ return "support.constant";
2286
+ }
2287
+ else if (colors.hasOwnProperty(value.toLowerCase())) {
2288
+ return "support.constant.color";
2289
+ }
2290
+ else if (fonts.hasOwnProperty(value.toLowerCase())) {
2291
+ return "support.constant.fonts";
2292
+ }
2293
+ else {
2294
+ return "text";
2295
+ }
2296
+ },
2297
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
2298
+ }
2299
+ ];
2300
+
2301
+ var ruleset = lang.copyArray(base_ruleset);
2302
+ ruleset.unshift({
2303
+ token : "paren.rparen",
2304
+ regex : "\\}",
2305
+ next: "start"
2306
+ });
2307
+
2308
+ var media_ruleset = lang.copyArray( base_ruleset );
2309
+ media_ruleset.unshift({
2310
+ token : "paren.rparen",
2311
+ regex : "\\}",
2312
+ next: "media"
2313
+ });
2314
+
2315
+ var base_comment = [{
2316
+ token : "comment", // comment spanning whole line
2317
+ merge : true,
2318
+ regex : ".+"
2319
+ }];
2320
+
2321
+ var comment = lang.copyArray(base_comment);
2322
+ comment.unshift({
2323
+ token : "comment", // closing comment
2324
+ regex : ".*?\\*\\/",
2325
+ next : "start"
2326
+ });
2327
+
2328
+ var media_comment = lang.copyArray(base_comment);
2329
+ media_comment.unshift({
2330
+ token : "comment", // closing comment
2331
+ regex : ".*?\\*\\/",
2332
+ next : "media"
2333
+ });
2334
+
2335
+ var ruleset_comment = lang.copyArray(base_comment);
2336
+ ruleset_comment.unshift({
2337
+ token : "comment", // closing comment
2338
+ regex : ".*?\\*\\/",
2339
+ next : "ruleset"
2340
+ });
2341
+
2342
+ this.$rules = {
2343
+ "start" : [{
2344
+ token : "comment", // multi line comment
2345
+ merge : true,
2346
+ regex : "\\/\\*",
2347
+ next : "comment"
2348
+ }, {
2349
+ token: "paren.lparen",
2350
+ regex: "\\{",
2351
+ next: "ruleset"
2352
+ }, {
2353
+ token: "string",
2354
+ regex: "@.*?{",
2355
+ next: "media"
2356
+ },{
2357
+ token: "keyword",
2358
+ regex: "#[a-z0-9-_]+"
2359
+ },{
2360
+ token: "variable",
2361
+ regex: "\\.[a-z0-9-_]+"
2362
+ },{
2363
+ token: "string",
2364
+ regex: ":[a-z0-9-_]+"
2365
+ },{
2366
+ token: "constant",
2367
+ regex: "[a-z0-9-_]+"
2368
+ }],
2369
+
2370
+ "media" : [ {
2371
+ token : "comment", // multi line comment
2372
+ merge : true,
2373
+ regex : "\\/\\*",
2374
+ next : "media_comment"
2375
+ }, {
2376
+ token: "paren.lparen",
2377
+ regex: "\\{",
2378
+ next: "media_ruleset"
2379
+ },{
2380
+ token: "string",
2381
+ regex: "\\}",
2382
+ next: "start"
2383
+ },{
2384
+ token: "keyword",
2385
+ regex: "#[a-z0-9-_]+"
2386
+ },{
2387
+ token: "variable",
2388
+ regex: "\\.[a-z0-9-_]+"
2389
+ },{
2390
+ token: "string",
2391
+ regex: ":[a-z0-9-_]+"
2392
+ },{
2393
+ token: "constant",
2394
+ regex: "[a-z0-9-_]+"
2395
+ }],
2396
+
2397
+ "comment" : comment,
2398
+
2399
+ "ruleset" : ruleset,
2400
+ "ruleset_comment" : ruleset_comment,
2401
+
2402
+ "media_ruleset" : media_ruleset,
2403
+ "media_comment" : media_comment
2404
+ };
2405
+ };
2406
+
2407
+ oop.inherits(CssHighlightRules, TextHighlightRules);
2408
+
2409
+ exports.CssHighlightRules = CssHighlightRules;
2410
+
2411
+ });
2412
+ /* ***** BEGIN LICENSE BLOCK *****
2413
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2414
+ *
2415
+ * The contents of this file are subject to the Mozilla Public License Version
2416
+ * 1.1 (the "License"); you may not use this file except in compliance with
2417
+ * the License. You may obtain a copy of the License at
2418
+ * http://www.mozilla.org/MPL/
2419
+ *
2420
+ * Software distributed under the License is distributed on an "AS IS" basis,
2421
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2422
+ * for the specific language governing rights and limitations under the
2423
+ * License.
2424
+ *
2425
+ * The Original Code is Ajax.org Code Editor (ACE).
2426
+ *
2427
+ * The Initial Developer of the Original Code is
2428
+ * Ajax.org B.V.
2429
+ * Portions created by the Initial Developer are Copyright (C) 2010
2430
+ * the Initial Developer. All Rights Reserved.
2431
+ *
2432
+ * Contributor(s):
2433
+ * Fabian Jakobs <fabian AT ajax DOT org>
2434
+ *
2435
+ * Alternatively, the contents of this file may be used under the terms of
2436
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2437
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2438
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2439
+ * of those above. If you wish to allow use of your version of this file only
2440
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2441
+ * use your version of this file under the terms of the MPL, indicate your
2442
+ * decision by deleting the provisions above and replace them with the notice
2443
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2444
+ * the provisions above, a recipient may use your version of this file under
2445
+ * the terms of any one of the MPL, the GPL or the LGPL.
2446
+ *
2447
+ * ***** END LICENSE BLOCK ***** */
2448
+
2449
+ ace.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) {
2450
+ "use strict";
2451
+
2452
+ var oop = require("../lib/oop");
2453
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2454
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
2455
+ var xmlUtil = require("./xml_util");
2456
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2457
+
2458
+ var HtmlHighlightRules = function() {
2459
+
2460
+ // regexp must not have capturing parentheses
2461
+ // regexps are ordered -> the first match is used
2462
+ this.$rules = {
2463
+ start : [{
2464
+ token : "text",
2465
+ merge : true,
2466
+ regex : "<\\!\\[CDATA\\[",
2467
+ next : "cdata"
2468
+ }, {
2469
+ token : "xml_pe",
2470
+ regex : "<\\?.*?\\?>"
2471
+ }, {
2472
+ token : "comment",
2473
+ merge : true,
2474
+ regex : "<\\!--",
2475
+ next : "comment"
2476
+ }, {
2477
+ token : "xml_pe",
2478
+ regex : "<\\!.*?>"
2479
+ }, {
2480
+ token : "meta.tag",
2481
+ regex : "<(?=\s*script\\b)",
2482
+ next : "script"
2483
+ }, {
2484
+ token : "meta.tag",
2485
+ regex : "<(?=\s*style\\b)",
2486
+ next : "style"
2487
+ }, {
2488
+ token : "meta.tag", // opening tag
2489
+ regex : "<\\/?",
2490
+ next : "tag"
2491
+ }, {
2492
+ token : "text",
2493
+ regex : "\\s+"
2494
+ }, {
2495
+ token : "constant.character.entity",
2496
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
2497
+ }, {
2498
+ token : "text",
2499
+ regex : "[^<]+"
2500
+ } ],
2501
+
2502
+ cdata : [ {
2503
+ token : "text",
2504
+ regex : "\\]\\]>",
2505
+ next : "start"
2506
+ }, {
2507
+ token : "text",
2508
+ merge : true,
2509
+ regex : "\\s+"
2510
+ }, {
2511
+ token : "text",
2512
+ merge : true,
2513
+ regex : ".+"
2514
+ } ],
2515
+
2516
+ comment : [ {
2517
+ token : "comment",
2518
+ regex : ".*?-->",
2519
+ next : "start"
2520
+ }, {
2521
+ token : "comment",
2522
+ merge : true,
2523
+ regex : ".+"
2524
+ } ]
2525
+ };
2526
+
2527
+ xmlUtil.tag(this.$rules, "tag", "start");
2528
+ xmlUtil.tag(this.$rules, "style", "css-start");
2529
+ xmlUtil.tag(this.$rules, "script", "js-start");
2530
+
2531
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
2532
+ token: "comment",
2533
+ regex: "\\/\\/.*(?=<\\/script>)",
2534
+ next: "tag"
2535
+ }, {
2536
+ token: "meta.tag",
2537
+ regex: "<\\/(?=script)",
2538
+ next: "tag"
2539
+ }]);
2540
+
2541
+ this.embedRules(CssHighlightRules, "css-", [{
2542
+ token: "meta.tag",
2543
+ regex: "<\\/(?=style)",
2544
+ next: "tag"
2545
+ }]);
2546
+ };
2547
+
2548
+ oop.inherits(HtmlHighlightRules, TextHighlightRules);
2549
+
2550
+ exports.HtmlHighlightRules = HtmlHighlightRules;
2551
+ });
2552
+ /* ***** BEGIN LICENSE BLOCK *****
2553
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2554
+ *
2555
+ * The contents of this file are subject to the Mozilla Public License Version
2556
+ * 1.1 (the "License"); you may not use this file except in compliance with
2557
+ * the License. You may obtain a copy of the License at
2558
+ * http://www.mozilla.org/MPL/
2559
+ *
2560
+ * Software distributed under the License is distributed on an "AS IS" basis,
2561
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2562
+ * for the specific language governing rights and limitations under the
2563
+ * License.
2564
+ *
2565
+ * The Original Code is Ajax.org Code Editor (ACE).
2566
+ *
2567
+ * The Initial Developer of the Original Code is
2568
+ * Ajax.org B.V.
2569
+ * Portions created by the Initial Developer are Copyright (C) 2010
2570
+ * the Initial Developer. All Rights Reserved.
2571
+ *
2572
+ * Contributor(s):
2573
+ * Fabian Jakobs <fabian AT ajax DOT org>
2574
+ *
2575
+ * Alternatively, the contents of this file may be used under the terms of
2576
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2577
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2578
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2579
+ * of those above. If you wish to allow use of your version of this file only
2580
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2581
+ * use your version of this file under the terms of the MPL, indicate your
2582
+ * decision by deleting the provisions above and replace them with the notice
2583
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2584
+ * the provisions above, a recipient may use your version of this file under
2585
+ * the terms of any one of the MPL, the GPL or the LGPL.
2586
+ *
2587
+ * ***** END LICENSE BLOCK ***** */
2588
+
2589
+ ace.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) {
2590
+ "use strict";
2591
+
2592
+ var oop = require("../../lib/oop");
2593
+ var MixedFoldMode = require("./mixed").FoldMode;
2594
+ var XmlFoldMode = require("./xml").FoldMode;
2595
+ var CStyleFoldMode = require("./cstyle").FoldMode;
2596
+
2597
+ var FoldMode = exports.FoldMode = function() {
2598
+ MixedFoldMode.call(this, new XmlFoldMode({
2599
+ // void elements
2600
+ "area": 1,
2601
+ "base": 1,
2602
+ "br": 1,
2603
+ "col": 1,
2604
+ "command": 1,
2605
+ "embed": 1,
2606
+ "hr": 1,
2607
+ "img": 1,
2608
+ "input": 1,
2609
+ "keygen": 1,
2610
+ "link": 1,
2611
+ "meta": 1,
2612
+ "param": 1,
2613
+ "source": 1,
2614
+ "track": 1,
2615
+ "wbr": 1,
2616
+
2617
+ // optional tags
2618
+ "li": 1,
2619
+ "dt": 1,
2620
+ "dd": 1,
2621
+ "p": 1,
2622
+ "rt": 1,
2623
+ "rp": 1,
2624
+ "optgroup": 1,
2625
+ "option": 1,
2626
+ "colgroup": 1,
2627
+ "td": 1,
2628
+ "th": 1
2629
+ }), {
2630
+ "js-": new CStyleFoldMode(),
2631
+ "css-": new CStyleFoldMode()
2632
+ });
2633
+ };
2634
+
2635
+ oop.inherits(FoldMode, MixedFoldMode);
2636
+
2637
+ });/* ***** BEGIN LICENSE BLOCK *****
2638
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2639
+ *
2640
+ * The contents of this file are subject to the Mozilla Public License Version
2641
+ * 1.1 (the "License"); you may not use this file except in compliance with
2642
+ * the License. You may obtain a copy of the License at
2643
+ * http://www.mozilla.org/MPL/
2644
+ *
2645
+ * Software distributed under the License is distributed on an "AS IS" basis,
2646
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2647
+ * for the specific language governing rights and limitations under the
2648
+ * License.
2649
+ *
2650
+ * The Original Code is Ajax.org Code Editor (ACE).
2651
+ *
2652
+ * The Initial Developer of the Original Code is
2653
+ * Ajax.org B.V.
2654
+ * Portions created by the Initial Developer are Copyright (C) 2010
2655
+ * the Initial Developer. All Rights Reserved.
2656
+ *
2657
+ * Contributor(s):
2658
+ * Fabian Jakobs <fabian AT ajax DOT org>
2659
+ *
2660
+ * Alternatively, the contents of this file may be used under the terms of
2661
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2662
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2663
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2664
+ * of those above. If you wish to allow use of your version of this file only
2665
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2666
+ * use your version of this file under the terms of the MPL, indicate your
2667
+ * decision by deleting the provisions above and replace them with the notice
2668
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2669
+ * the provisions above, a recipient may use your version of this file under
2670
+ * the terms of any one of the MPL, the GPL or the LGPL.
2671
+ *
2672
+ * ***** END LICENSE BLOCK ***** */
2673
+
2674
+ ace.define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
2675
+ "use strict";
2676
+
2677
+ var oop = require("../../lib/oop");
2678
+ var BaseFoldMode = require("./fold_mode").FoldMode;
2679
+
2680
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
2681
+ this.defaultMode = defaultMode;
2682
+ this.subModes = subModes;
2683
+ };
2684
+ oop.inherits(FoldMode, BaseFoldMode);
2685
+
2686
+ (function() {
2687
+
2688
+
2689
+ this.$getMode = function(state) {
2690
+ for (var key in this.subModes) {
2691
+ if (state.indexOf(key) === 0)
2692
+ return this.subModes[key];
2693
+ }
2694
+ return null;
2695
+ };
2696
+
2697
+ this.$tryMode = function(state, session, foldStyle, row) {
2698
+ var mode = this.$getMode(state);
2699
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
2700
+ };
2701
+
2702
+ this.getFoldWidget = function(session, foldStyle, row) {
2703
+ return (
2704
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
2705
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
2706
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
2707
+ );
2708
+ };
2709
+
2710
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
2711
+ var mode = this.$getMode(session.getState(row-1));
2712
+
2713
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2714
+ mode = this.$getMode(session.getState(row));
2715
+
2716
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2717
+ mode = this.defaultMode;
2718
+
2719
+ return mode.getFoldWidgetRange(session, foldStyle, row);
2720
+ };
2721
+
2722
+ }).call(FoldMode.prototype);
2723
+
2724
+ });/* ***** BEGIN LICENSE BLOCK *****
2725
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2726
+ *
2727
+ * The contents of this file are subject to the Mozilla Public License Version
2728
+ * 1.1 (the "License"); you may not use this file except in compliance with
2729
+ * the License. You may obtain a copy of the License at
2730
+ * http://www.mozilla.org/MPL/
2731
+ *
2732
+ * Software distributed under the License is distributed on an "AS IS" basis,
2733
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2734
+ * for the specific language governing rights and limitations under the
2735
+ * License.
2736
+ *
2737
+ * The Original Code is Ajax.org Code Editor (ACE).
2738
+ *
2739
+ * The Initial Developer of the Original Code is
2740
+ * Ajax.org B.V.
2741
+ * Portions created by the Initial Developer are Copyright (C) 2010
2742
+ * the Initial Developer. All Rights Reserved.
2743
+ *
2744
+ * Contributor(s):
2745
+ * Fabian Jakobs <fabian AT ajax DOT org>
2746
+ * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
2747
+ *
2748
+ * Alternatively, the contents of this file may be used under the terms of
2749
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
2750
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2751
+ * in which case the provisions of the GPL or the LGPL are applicable instead
2752
+ * of those above. If you wish to allow use of your version of this file only
2753
+ * under the terms of either the GPL or the LGPL, and not to allow others to
2754
+ * use your version of this file under the terms of the MPL, indicate your
2755
+ * decision by deleting the provisions above and replace them with the notice
2756
+ * and other provisions required by the GPL or the LGPL. If you do not delete
2757
+ * the provisions above, a recipient may use your version of this file under
2758
+ * the terms of any one of the MPL, the GPL or the LGPL.
2759
+ *
2760
+ * ***** END LICENSE BLOCK ***** */
2761
+
2762
+ ace.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) {
2763
+ "use strict";
2764
+
2765
+ var oop = require("../lib/oop");
2766
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2767
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
2768
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
2769
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2770
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2771
+
2772
+ function github_embed(tag, prefix) {
2773
+ return { // Github style block
2774
+ token : "support.function",
2775
+ regex : "^```" + tag + "\\s*$",
2776
+ next : prefix + "start"
2777
+ };
2778
+ }
2779
+
2780
+ var MarkdownHighlightRules = function() {
2781
+
2782
+ // regexp must not have capturing parentheses
2783
+ // regexps are ordered -> the first match is used
2784
+
2785
+ this.$rules = {
2786
+ "start" : [ {
2787
+ token : "empty_line",
2788
+ regex : '^$'
2789
+ }, { // code span `
2790
+ token : ["support.function", "support.function", "support.function"],
2791
+ regex : "(`+)([^\\r]*?[^`])(\\1)"
2792
+ }, { // code block
2793
+ token : "support.function",
2794
+ regex : "^[ ]{4}.+"
2795
+ }, { // h1
2796
+ token: "markup.heading.1",
2797
+ regex: "^=+(?=\\s*$)"
2798
+ }, { // h2
2799
+ token: "markup.heading.1",
2800
+ regex: "^\\-+(?=\\s*$)"
2801
+ }, { // header
2802
+ token : function(value) {
2803
+ return "markup.heading." + value.length;
2804
+ },
2805
+ regex : "^#{1,6}"
2806
+ }, github_embed("javascript", "js-"),
2807
+ github_embed("xml", "xml-"),
2808
+ github_embed("html", "html-"),
2809
+ github_embed("css", "css-"),
2810
+ { // Github style block
2811
+ token : "support.function",
2812
+ regex : "^```[a-zA-Z]+\\s*$",
2813
+ next : "githubblock"
2814
+ }, { // block quote
2815
+ token : "string",
2816
+ regex : "^>[ ].+$",
2817
+ next : "blockquote"
2818
+ }, { // reference
2819
+ token : ["text", "constant", "text", "url", "string", "text"],
2820
+ regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
2821
+ }, { // link by reference
2822
+ token : ["text", "string", "text", "constant", "text"],
2823
+ regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
2824
+ }, { // link by url
2825
+ token : ["text", "string", "text", "markup.underline", "string", "text"],
2826
+ regex : "(\\[)"+
2827
+ "(\\[[^\\]]*\\]|[^\\[\\]]*)"+
2828
+ "(\\]\\([ \\t]*)"+
2829
+ "(<?(?:(?:[^\\(]*?\\([^\\)]*?\\)\\S*?)|(?:.*?))>?)"+
2830
+ "((?:[ \t]*\"(?:.*?)\"[ \\t]*)?)"+
2831
+ "(\\))"
2832
+ }, { // HR *
2833
+ token : "constant",
2834
+ regex : "^[ ]{0,2}(?:[ ]?\\*[ ]?){3,}\\s*$"
2835
+ }, { // HR -
2836
+ token : "constant",
2837
+ regex : "^[ ]{0,2}(?:[ ]?\\-[ ]?){3,}\\s*$"
2838
+ }, { // HR _
2839
+ token : "constant",
2840
+ regex : "^[ ]{0,2}(?:[ ]?\\_[ ]?){3,}\\s*$"
2841
+ }, { // list
2842
+ token : "markup.list",
2843
+ regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
2844
+ next : "listblock"
2845
+ }, { // strong ** __
2846
+ token : ["string", "string", "string"],
2847
+ regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
2848
+ }, { // emphasis * _
2849
+ token : ["string", "string", "string"],
2850
+ regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
2851
+ }, { //
2852
+ token : ["text", "url", "text"],
2853
+ regex : "(<)("+
2854
+ "(?:https?|ftp|dict):[^'\">\\s]+"+
2855
+ "|"+
2856
+ "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
2857
+ ")(>)"
2858
+ }, {
2859
+ token : "text",
2860
+ regex : "[^\\*_%$`\\[#<>]+"
2861
+ } ],
2862
+
2863
+ "listblock" : [ { // Lists only escape on completely blank lines.
2864
+ token : "empty_line",
2865
+ regex : "^$",
2866
+ next : "start"
2867
+ }, {
2868
+ token : "markup.list",
2869
+ regex : ".+"
2870
+ } ],
2871
+
2872
+ "blockquote" : [ { // BLockquotes only escape on blank lines.
2873
+ token : "empty_line",
2874
+ regex : "^\\s*$",
2875
+ next : "start"
2876
+ }, {
2877
+ token : "string",
2878
+ regex : ".+"
2879
+ } ],
2880
+
2881
+ "githubblock" : [ {
2882
+ token : "support.function",
2883
+ regex : "^```",
2884
+ next : "start"
2885
+ }, {
2886
+ token : "support.function",
2887
+ regex : ".+"
2888
+ } ]
2889
+ };
2890
+
2891
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
2892
+ token : "support.function",
2893
+ regex : "^```",
2894
+ next : "start"
2895
+ }]);
2896
+
2897
+ this.embedRules(HtmlHighlightRules, "html-", [{
2898
+ token : "support.function",
2899
+ regex : "^```",
2900
+ next : "start"
2901
+ }]);
2902
+
2903
+ this.embedRules(CssHighlightRules, "css-", [{
2904
+ token : "support.function",
2905
+ regex : "^```",
2906
+ next : "start"
2907
+ }]);
2908
+
2909
+ this.embedRules(XmlHighlightRules, "xml-", [{
2910
+ token : "support.function",
2911
+ regex : "^```",
2912
+ next : "start"
2913
+ }]);
2914
+ };
2915
+ oop.inherits(MarkdownHighlightRules, TextHighlightRules);
2916
+
2917
+ exports.MarkdownHighlightRules = MarkdownHighlightRules;
2918
+ });