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