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