marty 0.5.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (345) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +84 -0
  4. data/Rakefile +29 -0
  5. data/app/assets/javascripts/marty/application.js +15 -0
  6. data/app/assets/stylesheets/marty/application.css +13 -0
  7. data/app/components/marty/api_auth_view.rb +32 -0
  8. data/app/components/marty/auth_app.rb +55 -0
  9. data/app/components/marty/auth_app.rb~ +51 -0
  10. data/app/components/marty/auth_app/javascripts/auth_app.js +91 -0
  11. data/app/components/marty/auth_app/javascripts/auth_app.js~ +91 -0
  12. data/app/components/marty/cm_form_panel.rb~ +5 -0
  13. data/app/components/marty/cm_grid_panel.rb~ +35 -0
  14. data/app/components/marty/data_import_view.rb~ +142 -0
  15. data/app/components/marty/extras/layout.rb +46 -0
  16. data/app/components/marty/extras/layout.rb~ +46 -0
  17. data/app/components/marty/extras/misc.rb +18 -0
  18. data/app/components/marty/form.rb +6 -0
  19. data/app/components/marty/grid.rb +45 -0
  20. data/app/components/marty/grid_append_only.rb +12 -0
  21. data/app/components/marty/import_type_view.rb +53 -0
  22. data/app/components/marty/live_search_grid_panel.rb +46 -0
  23. data/app/components/marty/live_search_grid_panel.rb~ +49 -0
  24. data/app/components/marty/main_auth_app.rb +269 -0
  25. data/app/components/marty/main_auth_app.rb~ +238 -0
  26. data/app/components/marty/mcfly_grid_panel.rb +62 -0
  27. data/app/components/marty/mcfly_grid_panel.rb~ +80 -0
  28. data/app/components/marty/new_posting_form.rb +46 -0
  29. data/app/components/marty/new_posting_form.rb~ +46 -0
  30. data/app/components/marty/new_posting_window.rb +21 -0
  31. data/app/components/marty/new_posting_window.rb~ +21 -0
  32. data/app/components/marty/panel.rb +12 -0
  33. data/app/components/marty/pivot_grid.rb +52 -0
  34. data/app/components/marty/pivot_grid/endpoints.rb +45 -0
  35. data/app/components/marty/pivot_grid/javascripts/extensions.js +150 -0
  36. data/app/components/marty/pivot_grid/javascripts/pivot_grid.js +86 -0
  37. data/app/components/marty/pivot_grid/services.rb +44 -0
  38. data/app/components/marty/posting_grid.rb +139 -0
  39. data/app/components/marty/posting_grid.rb~ +140 -0
  40. data/app/components/marty/posting_window.rb +27 -0
  41. data/app/components/marty/promise_view.rb +177 -0
  42. data/app/components/marty/promise_view.rb~ +157 -0
  43. data/app/components/marty/promise_view/stylesheets/promise_view.css +26 -0
  44. data/app/components/marty/promise_view/stylesheets/promise_view.css~ +15 -0
  45. data/app/components/marty/report_form.rb +225 -0
  46. data/app/components/marty/report_form.rb~ +217 -0
  47. data/app/components/marty/report_select.rb +145 -0
  48. data/app/components/marty/report_select.rb~ +133 -0
  49. data/app/components/marty/reporting.rb +39 -0
  50. data/app/components/marty/reporting.rb~ +39 -0
  51. data/app/components/marty/script_detail.rb~ +430 -0
  52. data/app/components/marty/script_form.rb +233 -0
  53. data/app/components/marty/script_form.rb~ +233 -0
  54. data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js +698 -0
  55. data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js~ +909 -0
  56. data/app/components/marty/script_form/javascripts/codemirror.js +3130 -0
  57. data/app/components/marty/script_form/javascripts/mode/clike/clike.js +284 -0
  58. data/app/components/marty/script_form/javascripts/mode/clike/index.html +102 -0
  59. data/app/components/marty/script_form/javascripts/mode/clike/scala.html +766 -0
  60. data/app/components/marty/script_form/javascripts/mode/clojure/clojure.js +206 -0
  61. data/app/components/marty/script_form/javascripts/mode/clojure/index.html +67 -0
  62. data/app/components/marty/script_form/javascripts/mode/coffeescript/LICENSE +22 -0
  63. data/app/components/marty/script_form/javascripts/mode/coffeescript/coffeescript.js +346 -0
  64. data/app/components/marty/script_form/javascripts/mode/coffeescript/index.html +728 -0
  65. data/app/components/marty/script_form/javascripts/mode/commonlisp/commonlisp.js +101 -0
  66. data/app/components/marty/script_form/javascripts/mode/commonlisp/index.html +165 -0
  67. data/app/components/marty/script_form/javascripts/mode/css/css.js +448 -0
  68. data/app/components/marty/script_form/javascripts/mode/css/index.html +58 -0
  69. data/app/components/marty/script_form/javascripts/mode/css/test.js +501 -0
  70. data/app/components/marty/script_form/javascripts/mode/delorean/delorean.js +189 -0
  71. data/app/components/marty/script_form/javascripts/mode/diff/diff.js +32 -0
  72. data/app/components/marty/script_form/javascripts/mode/diff/index.html +105 -0
  73. data/app/components/marty/script_form/javascripts/mode/ecl/ecl.js +203 -0
  74. data/app/components/marty/script_form/javascripts/mode/ecl/index.html +42 -0
  75. data/app/components/marty/script_form/javascripts/mode/erlang/erlang.js +463 -0
  76. data/app/components/marty/script_form/javascripts/mode/erlang/index.html +63 -0
  77. data/app/components/marty/script_form/javascripts/mode/gfm/gfm.js +150 -0
  78. data/app/components/marty/script_form/javascripts/mode/gfm/index.html +48 -0
  79. data/app/components/marty/script_form/javascripts/mode/go/go.js +170 -0
  80. data/app/components/marty/script_form/javascripts/mode/go/index.html +73 -0
  81. data/app/components/marty/script_form/javascripts/mode/groovy/groovy.js +210 -0
  82. data/app/components/marty/script_form/javascripts/mode/groovy/index.html +72 -0
  83. data/app/components/marty/script_form/javascripts/mode/haskell/haskell.js +242 -0
  84. data/app/components/marty/script_form/javascripts/mode/haskell/index.html +61 -0
  85. data/app/components/marty/script_form/javascripts/mode/haxe/haxe.js +429 -0
  86. data/app/components/marty/script_form/javascripts/mode/haxe/index.html +91 -0
  87. data/app/components/marty/script_form/javascripts/mode/htmlembedded/htmlembedded.js +72 -0
  88. data/app/components/marty/script_form/javascripts/mode/htmlembedded/index.html +50 -0
  89. data/app/components/marty/script_form/javascripts/mode/htmlmixed/htmlmixed.js +84 -0
  90. data/app/components/marty/script_form/javascripts/mode/htmlmixed/index.html +52 -0
  91. data/app/components/marty/script_form/javascripts/mode/javascript/index.html +78 -0
  92. data/app/components/marty/script_form/javascripts/mode/javascript/javascript.js +361 -0
  93. data/app/components/marty/script_form/javascripts/mode/jinja2/index.html +38 -0
  94. data/app/components/marty/script_form/javascripts/mode/jinja2/jinja2.js +42 -0
  95. data/app/components/marty/script_form/javascripts/mode/less/index.html +740 -0
  96. data/app/components/marty/script_form/javascripts/mode/less/less.js +266 -0
  97. data/app/components/marty/script_form/javascripts/mode/lua/index.html +73 -0
  98. data/app/components/marty/script_form/javascripts/mode/lua/lua.js +140 -0
  99. data/app/components/marty/script_form/javascripts/mode/markdown/index.html +343 -0
  100. data/app/components/marty/script_form/javascripts/mode/markdown/markdown.js +382 -0
  101. data/app/components/marty/script_form/javascripts/mode/markdown/test.js +1084 -0
  102. data/app/components/marty/script_form/javascripts/mode/mysql/index.html +42 -0
  103. data/app/components/marty/script_form/javascripts/mode/mysql/mysql.js +186 -0
  104. data/app/components/marty/script_form/javascripts/mode/ntriples/index.html +33 -0
  105. data/app/components/marty/script_form/javascripts/mode/ntriples/ntriples.js +172 -0
  106. data/app/components/marty/script_form/javascripts/mode/ocaml/index.html +130 -0
  107. data/app/components/marty/script_form/javascripts/mode/ocaml/ocaml.js +114 -0
  108. data/app/components/marty/script_form/javascripts/mode/pascal/LICENSE +7 -0
  109. data/app/components/marty/script_form/javascripts/mode/pascal/index.html +49 -0
  110. data/app/components/marty/script_form/javascripts/mode/pascal/pascal.js +94 -0
  111. data/app/components/marty/script_form/javascripts/mode/perl/LICENSE +19 -0
  112. data/app/components/marty/script_form/javascripts/mode/perl/index.html +63 -0
  113. data/app/components/marty/script_form/javascripts/mode/perl/perl.js +816 -0
  114. data/app/components/marty/script_form/javascripts/mode/php/index.html +49 -0
  115. data/app/components/marty/script_form/javascripts/mode/php/php.js +148 -0
  116. data/app/components/marty/script_form/javascripts/mode/pig/index.html +43 -0
  117. data/app/components/marty/script_form/javascripts/mode/pig/pig.js +172 -0
  118. data/app/components/marty/script_form/javascripts/mode/plsql/index.html +63 -0
  119. data/app/components/marty/script_form/javascripts/mode/plsql/plsql.js +217 -0
  120. data/app/components/marty/script_form/javascripts/mode/properties/index.html +41 -0
  121. data/app/components/marty/script_form/javascripts/mode/properties/properties.js +63 -0
  122. data/app/components/marty/script_form/javascripts/mode/python/LICENSE.txt +21 -0
  123. data/app/components/marty/script_form/javascripts/mode/python/index.html +123 -0
  124. data/app/components/marty/script_form/javascripts/mode/python/python.js +338 -0
  125. data/app/components/marty/script_form/javascripts/mode/r/LICENSE +24 -0
  126. data/app/components/marty/script_form/javascripts/mode/r/index.html +74 -0
  127. data/app/components/marty/script_form/javascripts/mode/r/r.js +141 -0
  128. data/app/components/marty/script_form/javascripts/mode/rpm/changes/changes.js +19 -0
  129. data/app/components/marty/script_form/javascripts/mode/rpm/changes/index.html +54 -0
  130. data/app/components/marty/script_form/javascripts/mode/rpm/spec/index.html +100 -0
  131. data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.css +5 -0
  132. data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.js +66 -0
  133. data/app/components/marty/script_form/javascripts/mode/rst/index.html +526 -0
  134. data/app/components/marty/script_form/javascripts/mode/rst/rst.js +326 -0
  135. data/app/components/marty/script_form/javascripts/mode/ruby/LICENSE +24 -0
  136. data/app/components/marty/script_form/javascripts/mode/ruby/index.html +172 -0
  137. data/app/components/marty/script_form/javascripts/mode/ruby/ruby.js +195 -0
  138. data/app/components/marty/script_form/javascripts/mode/rust/index.html +49 -0
  139. data/app/components/marty/script_form/javascripts/mode/rust/rust.js +432 -0
  140. data/app/components/marty/script_form/javascripts/mode/scheme/index.html +65 -0
  141. data/app/components/marty/script_form/javascripts/mode/scheme/scheme.js +230 -0
  142. data/app/components/marty/script_form/javascripts/mode/shell/index.html +50 -0
  143. data/app/components/marty/script_form/javascripts/mode/shell/shell.js +118 -0
  144. data/app/components/marty/script_form/javascripts/mode/sieve/LICENSE +23 -0
  145. data/app/components/marty/script_form/javascripts/mode/sieve/index.html +81 -0
  146. data/app/components/marty/script_form/javascripts/mode/sieve/sieve.js +156 -0
  147. data/app/components/marty/script_form/javascripts/mode/smalltalk/index.html +56 -0
  148. data/app/components/marty/script_form/javascripts/mode/smalltalk/smalltalk.js +139 -0
  149. data/app/components/marty/script_form/javascripts/mode/smarty/index.html +83 -0
  150. data/app/components/marty/script_form/javascripts/mode/smarty/smarty.js +148 -0
  151. data/app/components/marty/script_form/javascripts/mode/sparql/index.html +41 -0
  152. data/app/components/marty/script_form/javascripts/mode/sparql/sparql.js +143 -0
  153. data/app/components/marty/script_form/javascripts/mode/stex/index.html +98 -0
  154. data/app/components/marty/script_form/javascripts/mode/stex/stex.js +182 -0
  155. data/app/components/marty/script_form/javascripts/mode/stex/test.js +343 -0
  156. data/app/components/marty/script_form/javascripts/mode/tiddlywiki/index.html +141 -0
  157. data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.css +14 -0
  158. data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.js +384 -0
  159. data/app/components/marty/script_form/javascripts/mode/tiki/index.html +83 -0
  160. data/app/components/marty/script_form/javascripts/mode/tiki/tiki.css +26 -0
  161. data/app/components/marty/script_form/javascripts/mode/tiki/tiki.js +309 -0
  162. data/app/components/marty/script_form/javascripts/mode/vb/LICENSE.txt +21 -0
  163. data/app/components/marty/script_form/javascripts/mode/vb/index.html +89 -0
  164. data/app/components/marty/script_form/javascripts/mode/vb/vb.js +260 -0
  165. data/app/components/marty/script_form/javascripts/mode/vbscript/index.html +43 -0
  166. data/app/components/marty/script_form/javascripts/mode/vbscript/vbscript.js +26 -0
  167. data/app/components/marty/script_form/javascripts/mode/velocity/index.html +104 -0
  168. data/app/components/marty/script_form/javascripts/mode/velocity/velocity.js +146 -0
  169. data/app/components/marty/script_form/javascripts/mode/verilog/index.html +211 -0
  170. data/app/components/marty/script_form/javascripts/mode/verilog/verilog.js +194 -0
  171. data/app/components/marty/script_form/javascripts/mode/xml/index.html +45 -0
  172. data/app/components/marty/script_form/javascripts/mode/xml/xml.js +318 -0
  173. data/app/components/marty/script_form/javascripts/mode/xquery/LICENSE +20 -0
  174. data/app/components/marty/script_form/javascripts/mode/xquery/index.html +223 -0
  175. data/app/components/marty/script_form/javascripts/mode/xquery/test/index.html +27 -0
  176. data/app/components/marty/script_form/javascripts/mode/xquery/test/testBase.js +42 -0
  177. data/app/components/marty/script_form/javascripts/mode/xquery/test/testEmptySequenceKeyword.js +16 -0
  178. data/app/components/marty/script_form/javascripts/mode/xquery/test/testMultiAttr.js +16 -0
  179. data/app/components/marty/script_form/javascripts/mode/xquery/test/testNamespaces.js +91 -0
  180. data/app/components/marty/script_form/javascripts/mode/xquery/test/testProcessingInstructions.js +16 -0
  181. data/app/components/marty/script_form/javascripts/mode/xquery/test/testQuotes.js +19 -0
  182. data/app/components/marty/script_form/javascripts/mode/xquery/xquery.js +451 -0
  183. data/app/components/marty/script_form/javascripts/mode/yaml/index.html +68 -0
  184. data/app/components/marty/script_form/javascripts/mode/yaml/yaml.js +95 -0
  185. data/app/components/marty/script_form/javascripts/util/closetag.js +164 -0
  186. data/app/components/marty/script_form/javascripts/util/dialog.css +27 -0
  187. data/app/components/marty/script_form/javascripts/util/dialog.js +70 -0
  188. data/app/components/marty/script_form/javascripts/util/foldcode.js +196 -0
  189. data/app/components/marty/script_form/javascripts/util/formatting.js +193 -0
  190. data/app/components/marty/script_form/javascripts/util/javascript-hint.js +134 -0
  191. data/app/components/marty/script_form/javascripts/util/loadmode.js +51 -0
  192. data/app/components/marty/script_form/javascripts/util/match-highlighter.js +44 -0
  193. data/app/components/marty/script_form/javascripts/util/multiplex.js +77 -0
  194. data/app/components/marty/script_form/javascripts/util/overlay.js +54 -0
  195. data/app/components/marty/script_form/javascripts/util/pig-hint.js +123 -0
  196. data/app/components/marty/script_form/javascripts/util/runmode-standalone.js +90 -0
  197. data/app/components/marty/script_form/javascripts/util/runmode.js +53 -0
  198. data/app/components/marty/script_form/javascripts/util/search.js +118 -0
  199. data/app/components/marty/script_form/javascripts/util/searchcursor.js +119 -0
  200. data/app/components/marty/script_form/javascripts/util/simple-hint.css +16 -0
  201. data/app/components/marty/script_form/javascripts/util/simple-hint.js +97 -0
  202. data/app/components/marty/script_form/javascripts/util/xml-hint.js +137 -0
  203. data/app/components/marty/script_form/stylesheets/codemirror.css +172 -0
  204. data/app/components/marty/script_form/stylesheets/delorean.css +10 -0
  205. data/app/components/marty/script_form/stylesheets/theme/ambiance.css +81 -0
  206. data/app/components/marty/script_form/stylesheets/theme/blackboard.css +25 -0
  207. data/app/components/marty/script_form/stylesheets/theme/cobalt.css +18 -0
  208. data/app/components/marty/script_form/stylesheets/theme/eclipse.css +25 -0
  209. data/app/components/marty/script_form/stylesheets/theme/elegant.css +10 -0
  210. data/app/components/marty/script_form/stylesheets/theme/erlang-dark.css +21 -0
  211. data/app/components/marty/script_form/stylesheets/theme/lesser-dark.css +44 -0
  212. data/app/components/marty/script_form/stylesheets/theme/monokai.css +28 -0
  213. data/app/components/marty/script_form/stylesheets/theme/neat.css +9 -0
  214. data/app/components/marty/script_form/stylesheets/theme/night.css +21 -0
  215. data/app/components/marty/script_form/stylesheets/theme/rubyblue.css +21 -0
  216. data/app/components/marty/script_form/stylesheets/theme/vibrant-ink.css +27 -0
  217. data/app/components/marty/script_form/stylesheets/theme/xq-dark.css +46 -0
  218. data/app/components/marty/script_grid.rb +104 -0
  219. data/app/components/marty/script_grid.rb~ +99 -0
  220. data/app/components/marty/script_tester.rb +114 -0
  221. data/app/components/marty/script_tester.rb~ +213 -0
  222. data/app/components/marty/scripting.rb +132 -0
  223. data/app/components/marty/scripting.rb~ +124 -0
  224. data/app/components/marty/select_report.rb~ +143 -0
  225. data/app/components/marty/simple_app.rb +97 -0
  226. data/app/components/marty/simple_app.rb~ +101 -0
  227. data/app/components/marty/simple_app/javascripts/simple_app.js +50 -0
  228. data/app/components/marty/simple_app/javascripts/statusbar_ext.js +8 -0
  229. data/app/components/marty/tag_grid.rb +83 -0
  230. data/app/components/marty/tag_grid.rb~ +89 -0
  231. data/app/components/marty/tree_panel.rb~ +256 -0
  232. data/app/components/marty/tree_panel/javascripts/tree_panel.js~ +317 -0
  233. data/app/components/marty/user_pivot.rb +128 -0
  234. data/app/components/marty/user_view.rb +181 -0
  235. data/app/components/marty/user_view.rb~ +188 -0
  236. data/app/controllers/marty/application_controller.rb +124 -0
  237. data/app/controllers/marty/application_controller.rb~ +133 -0
  238. data/app/controllers/marty/components_controller.rb +41 -0
  239. data/app/controllers/marty/components_controller.rb~ +37 -0
  240. data/app/controllers/marty/job_controller.rb +28 -0
  241. data/app/controllers/marty/job_controller.rb~ +28 -0
  242. data/app/controllers/marty/rpc_controller.rb +64 -0
  243. data/app/controllers/marty/rpc_controller.rb~ +61 -0
  244. data/app/helpers/marty/application_helper.rb +4 -0
  245. data/app/helpers/marty/script_set.rb +57 -0
  246. data/app/helpers/marty/script_set.rb~ +59 -0
  247. data/app/models/marty/api_auth.rb +44 -0
  248. data/app/models/marty/api_auth.rb~ +48 -0
  249. data/app/models/marty/base.rb +4 -0
  250. data/app/models/marty/data_change.rb +179 -0
  251. data/app/models/marty/data_change.rb~ +141 -0
  252. data/app/models/marty/enum.rb +22 -0
  253. data/app/models/marty/enum.rb~ +16 -0
  254. data/app/models/marty/import_type.rb +44 -0
  255. data/app/models/marty/import_type.rb~ +48 -0
  256. data/app/models/marty/poop.rb~ +169 -0
  257. data/app/models/marty/posting.rb +101 -0
  258. data/app/models/marty/posting.rb~ +86 -0
  259. data/app/models/marty/posting_type.rb +12 -0
  260. data/app/models/marty/posting_type.rb~ +21 -0
  261. data/app/models/marty/promise.rb +252 -0
  262. data/app/models/marty/promise.rb~ +196 -0
  263. data/app/models/marty/role.rb +6 -0
  264. data/app/models/marty/role.rb~ +10 -0
  265. data/app/models/marty/script.rb +144 -0
  266. data/app/models/marty/script.rb~ +62 -0
  267. data/app/models/marty/tag.rb +96 -0
  268. data/app/models/marty/tag.rb~ +91 -0
  269. data/app/models/marty/token.rb +30 -0
  270. data/app/models/marty/user.rb +146 -0
  271. data/app/models/marty/user.rb~ +148 -0
  272. data/app/models/marty/user_role.rb +7 -0
  273. data/app/models/marty/user_role.rb~ +13 -0
  274. data/app/views/layouts/marty/application.html.erb +12 -0
  275. data/app/views/layouts/marty/application.html.erb~ +11 -0
  276. data/config/locales/en.yml +134 -0
  277. data/config/routes.rb +6 -0
  278. data/config/routes.rb~ +10 -0
  279. data/db/migrate/001_create_marty_scripts.rb +14 -0
  280. data/db/migrate/003_create_marty_users.rb +12 -0
  281. data/db/migrate/004_create_marty_roles.rb +7 -0
  282. data/db/migrate/005_create_marty_user_roles.rb +14 -0
  283. data/db/migrate/006_create_marty_tokens.rb +14 -0
  284. data/db/migrate/008_create_marty_posting_types.rb +7 -0
  285. data/db/migrate/019_create_marty_postings.rb +18 -0
  286. data/db/migrate/019_create_marty_postings.rb~ +19 -0
  287. data/db/migrate/068_create_marty_import_types.rb +12 -0
  288. data/db/migrate/069_create_marty_import_synonyms.rb +15 -0
  289. data/db/migrate/070_create_versions.rb +18 -0
  290. data/db/migrate/071_add_object_changes_column_to_versions.rb +9 -0
  291. data/db/migrate/072_add_validation_function_to_import_types.rb +6 -0
  292. data/db/migrate/073_add_preprocess_function_to_import_types.rb +5 -0
  293. data/db/migrate/090_create_delayed_jobs.rb +22 -0
  294. data/db/migrate/091_create_marty_promises.rb +36 -0
  295. data/db/migrate/095_create_marty_tags.rb +14 -0
  296. data/db/migrate/095_create_marty_tags.rb~ +19 -0
  297. data/db/migrate/096_add_user_roles_to_import_types.rb +11 -0
  298. data/db/migrate/097_drop_versions.rb +9 -0
  299. data/db/migrate/098_create_marty_api_auths.rb +20 -0
  300. data/db/seeds.rb +48 -0
  301. data/lib/marty.rb +18 -0
  302. data/lib/marty.rb~ +13 -0
  303. data/lib/marty/content_handler.rb +97 -0
  304. data/lib/marty/content_handler.rb~ +93 -0
  305. data/lib/marty/data_conversion.rb +298 -0
  306. data/lib/marty/data_exporter.rb +150 -0
  307. data/lib/marty/data_exporter.rb~ +137 -0
  308. data/lib/marty/data_importer.rb +122 -0
  309. data/lib/marty/data_importer.rb~ +114 -0
  310. data/lib/marty/data_row_processor.rb~ +206 -0
  311. data/lib/marty/drop_folder_hook.rb~ +17 -0
  312. data/lib/marty/engine.rb +10 -0
  313. data/lib/marty/folder_hook.rb~ +9 -0
  314. data/lib/marty/lazy_column_loader.rb +57 -0
  315. data/lib/marty/lazy_column_loader.rb~ +47 -0
  316. data/lib/marty/mcfly_query.rb +189 -0
  317. data/lib/marty/mcfly_query.rb~ +188 -0
  318. data/lib/marty/migrations.rb +108 -0
  319. data/lib/marty/migrations.rb~ +65 -0
  320. data/lib/marty/monkey.rb +163 -0
  321. data/lib/marty/monkey.rb~ +160 -0
  322. data/lib/marty/permissions.rb +64 -0
  323. data/lib/marty/permissions.rb~ +69 -0
  324. data/lib/marty/promise.rb~ +41 -0
  325. data/lib/marty/promise_job.rb +123 -0
  326. data/lib/marty/promise_job.rb~ +121 -0
  327. data/lib/marty/promise_proxy.rb +94 -0
  328. data/lib/marty/promise_proxy.rb~ +69 -0
  329. data/lib/marty/railtie.rb +5 -0
  330. data/lib/marty/relation.rb +39 -0
  331. data/lib/marty/util.rb +110 -0
  332. data/lib/marty/util.rb~ +80 -0
  333. data/lib/marty/version.rb +3 -0
  334. data/lib/marty/version.rb~ +3 -0
  335. data/lib/marty/xl.rb +527 -0
  336. data/lib/marty/xl.rb~ +526 -0
  337. data/lib/pyxll/README.txt +19 -0
  338. data/lib/pyxll/README.txt~ +16 -0
  339. data/lib/pyxll/gemini.py +155 -0
  340. data/lib/pyxll/gemini.py~ +110 -0
  341. data/lib/pyxll/pyxll.cfg +12 -0
  342. data/lib/pyxll/pyxll.cfg~ +12 -0
  343. data/lib/pyxll/sample.xlsx +0 -0
  344. data/lib/tasks/marty_tasks.rake +37 -0
  345. metadata +517 -0
@@ -0,0 +1,338 @@
1
+ CodeMirror.defineMode("python", function(conf, parserConf) {
2
+ var ERRORCLASS = 'error';
3
+
4
+ function wordRegexp(words) {
5
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
6
+ }
7
+
8
+ var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
9
+ var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
10
+ var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
11
+ var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
12
+ var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
13
+ var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
14
+
15
+ var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
16
+ var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
17
+ 'def', 'del', 'elif', 'else', 'except', 'finally',
18
+ 'for', 'from', 'global', 'if', 'import',
19
+ 'lambda', 'pass', 'raise', 'return',
20
+ 'try', 'while', 'with', 'yield'];
21
+ var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr',
22
+ 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod',
23
+ 'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset',
24
+ 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id',
25
+ 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len',
26
+ 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next',
27
+ 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
28
+ 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
29
+ 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
30
+ 'type', 'vars', 'zip', '__import__', 'NotImplemented',
31
+ 'Ellipsis', '__debug__'];
32
+ var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile',
33
+ 'file', 'intern', 'long', 'raw_input', 'reduce', 'reload',
34
+ 'unichr', 'unicode', 'xrange', 'False', 'True', 'None'],
35
+ 'keywords': ['exec', 'print']};
36
+ var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'],
37
+ 'keywords': ['nonlocal', 'False', 'True', 'None']};
38
+
39
+ if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
40
+ commonkeywords = commonkeywords.concat(py3.keywords);
41
+ commonBuiltins = commonBuiltins.concat(py3.builtins);
42
+ var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
43
+ } else {
44
+ commonkeywords = commonkeywords.concat(py2.keywords);
45
+ commonBuiltins = commonBuiltins.concat(py2.builtins);
46
+ var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
47
+ }
48
+ var keywords = wordRegexp(commonkeywords);
49
+ var builtins = wordRegexp(commonBuiltins);
50
+
51
+ var indentInfo = null;
52
+
53
+ // tokenizers
54
+ function tokenBase(stream, state) {
55
+ // Handle scope changes
56
+ if (stream.sol()) {
57
+ var scopeOffset = state.scopes[0].offset;
58
+ if (stream.eatSpace()) {
59
+ var lineOffset = stream.indentation();
60
+ if (lineOffset > scopeOffset) {
61
+ indentInfo = 'indent';
62
+ } else if (lineOffset < scopeOffset) {
63
+ indentInfo = 'dedent';
64
+ }
65
+ return null;
66
+ } else {
67
+ if (scopeOffset > 0) {
68
+ dedent(stream, state);
69
+ }
70
+ }
71
+ }
72
+ if (stream.eatSpace()) {
73
+ return null;
74
+ }
75
+
76
+ var ch = stream.peek();
77
+
78
+ // Handle Comments
79
+ if (ch === '#') {
80
+ stream.skipToEnd();
81
+ return 'comment';
82
+ }
83
+
84
+ // Handle Number Literals
85
+ if (stream.match(/^[0-9\.]/, false)) {
86
+ var floatLiteral = false;
87
+ // Floats
88
+ if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
89
+ if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
90
+ if (stream.match(/^\.\d+/)) { floatLiteral = true; }
91
+ if (floatLiteral) {
92
+ // Float literals may be "imaginary"
93
+ stream.eat(/J/i);
94
+ return 'number';
95
+ }
96
+ // Integers
97
+ var intLiteral = false;
98
+ // Hex
99
+ if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
100
+ // Binary
101
+ if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
102
+ // Octal
103
+ if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
104
+ // Decimal
105
+ if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
106
+ // Decimal literals may be "imaginary"
107
+ stream.eat(/J/i);
108
+ // TODO - Can you have imaginary longs?
109
+ intLiteral = true;
110
+ }
111
+ // Zero by itself with no other piece of number.
112
+ if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
113
+ if (intLiteral) {
114
+ // Integer literals may be "long"
115
+ stream.eat(/L/i);
116
+ return 'number';
117
+ }
118
+ }
119
+
120
+ // Handle Strings
121
+ if (stream.match(stringPrefixes)) {
122
+ state.tokenize = tokenStringFactory(stream.current());
123
+ return state.tokenize(stream, state);
124
+ }
125
+
126
+ // Handle operators and Delimiters
127
+ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
128
+ return null;
129
+ }
130
+ if (stream.match(doubleOperators)
131
+ || stream.match(singleOperators)
132
+ || stream.match(wordOperators)) {
133
+ return 'operator';
134
+ }
135
+ if (stream.match(singleDelimiters)) {
136
+ return null;
137
+ }
138
+
139
+ if (stream.match(keywords)) {
140
+ return 'keyword';
141
+ }
142
+
143
+ if (stream.match(builtins)) {
144
+ return 'builtin';
145
+ }
146
+
147
+ if (stream.match(identifiers)) {
148
+ return 'variable';
149
+ }
150
+
151
+ // Handle non-detected items
152
+ stream.next();
153
+ return ERRORCLASS;
154
+ }
155
+
156
+ function tokenStringFactory(delimiter) {
157
+ while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
158
+ delimiter = delimiter.substr(1);
159
+ }
160
+ var singleline = delimiter.length == 1;
161
+ var OUTCLASS = 'string';
162
+
163
+ return function tokenString(stream, state) {
164
+ while (!stream.eol()) {
165
+ stream.eatWhile(/[^'"\\]/);
166
+ if (stream.eat('\\')) {
167
+ stream.next();
168
+ if (singleline && stream.eol()) {
169
+ return OUTCLASS;
170
+ }
171
+ } else if (stream.match(delimiter)) {
172
+ state.tokenize = tokenBase;
173
+ return OUTCLASS;
174
+ } else {
175
+ stream.eat(/['"]/);
176
+ }
177
+ }
178
+ if (singleline) {
179
+ if (parserConf.singleLineStringErrors) {
180
+ return ERRORCLASS;
181
+ } else {
182
+ state.tokenize = tokenBase;
183
+ }
184
+ }
185
+ return OUTCLASS;
186
+ };
187
+ }
188
+
189
+ function indent(stream, state, type) {
190
+ type = type || 'py';
191
+ var indentUnit = 0;
192
+ if (type === 'py') {
193
+ if (state.scopes[0].type !== 'py') {
194
+ state.scopes[0].offset = stream.indentation();
195
+ return;
196
+ }
197
+ for (var i = 0; i < state.scopes.length; ++i) {
198
+ if (state.scopes[i].type === 'py') {
199
+ indentUnit = state.scopes[i].offset + conf.indentUnit;
200
+ break;
201
+ }
202
+ }
203
+ } else {
204
+ indentUnit = stream.column() + stream.current().length;
205
+ }
206
+ state.scopes.unshift({
207
+ offset: indentUnit,
208
+ type: type
209
+ });
210
+ }
211
+
212
+ function dedent(stream, state, type) {
213
+ type = type || 'py';
214
+ if (state.scopes.length == 1) return;
215
+ if (state.scopes[0].type === 'py') {
216
+ var _indent = stream.indentation();
217
+ var _indent_index = -1;
218
+ for (var i = 0; i < state.scopes.length; ++i) {
219
+ if (_indent === state.scopes[i].offset) {
220
+ _indent_index = i;
221
+ break;
222
+ }
223
+ }
224
+ if (_indent_index === -1) {
225
+ return true;
226
+ }
227
+ while (state.scopes[0].offset !== _indent) {
228
+ state.scopes.shift();
229
+ }
230
+ return false;
231
+ } else {
232
+ if (type === 'py') {
233
+ state.scopes[0].offset = stream.indentation();
234
+ return false;
235
+ } else {
236
+ if (state.scopes[0].type != type) {
237
+ return true;
238
+ }
239
+ state.scopes.shift();
240
+ return false;
241
+ }
242
+ }
243
+ }
244
+
245
+ function tokenLexer(stream, state) {
246
+ indentInfo = null;
247
+ var style = state.tokenize(stream, state);
248
+ var current = stream.current();
249
+
250
+ // Handle '.' connected identifiers
251
+ if (current === '.') {
252
+ style = stream.match(identifiers, false) ? null : ERRORCLASS;
253
+ if (style === null && state.lastToken === 'meta') {
254
+ // Apply 'meta' style to '.' connected identifiers when
255
+ // appropriate.
256
+ style = 'meta';
257
+ }
258
+ return style;
259
+ }
260
+
261
+ // Handle decorators
262
+ if (current === '@') {
263
+ return stream.match(identifiers, false) ? 'meta' : ERRORCLASS;
264
+ }
265
+
266
+ if ((style === 'variable' || style === 'builtin')
267
+ && state.lastToken === 'meta') {
268
+ style = 'meta';
269
+ }
270
+
271
+ // Handle scope changes.
272
+ if (current === 'pass' || current === 'return') {
273
+ state.dedent += 1;
274
+ }
275
+ if (current === 'lambda') state.lambda = true;
276
+ if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
277
+ || indentInfo === 'indent') {
278
+ indent(stream, state);
279
+ }
280
+ var delimiter_index = '[({'.indexOf(current);
281
+ if (delimiter_index !== -1) {
282
+ indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
283
+ }
284
+ if (indentInfo === 'dedent') {
285
+ if (dedent(stream, state)) {
286
+ return ERRORCLASS;
287
+ }
288
+ }
289
+ delimiter_index = '])}'.indexOf(current);
290
+ if (delimiter_index !== -1) {
291
+ if (dedent(stream, state, current)) {
292
+ return ERRORCLASS;
293
+ }
294
+ }
295
+ if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
296
+ if (state.scopes.length > 1) state.scopes.shift();
297
+ state.dedent -= 1;
298
+ }
299
+
300
+ return style;
301
+ }
302
+
303
+ var external = {
304
+ startState: function(basecolumn) {
305
+ return {
306
+ tokenize: tokenBase,
307
+ scopes: [{offset:basecolumn || 0, type:'py'}],
308
+ lastToken: null,
309
+ lambda: false,
310
+ dedent: 0
311
+ };
312
+ },
313
+
314
+ token: function(stream, state) {
315
+ var style = tokenLexer(stream, state);
316
+
317
+ state.lastToken = style;
318
+
319
+ if (stream.eol() && stream.lambda) {
320
+ state.lambda = false;
321
+ }
322
+
323
+ return style;
324
+ },
325
+
326
+ indent: function(state, textAfter) {
327
+ if (state.tokenize != tokenBase) {
328
+ return 0;
329
+ }
330
+
331
+ return state.scopes[0].offset;
332
+ }
333
+
334
+ };
335
+ return external;
336
+ });
337
+
338
+ CodeMirror.defineMIME("text/x-python", "python");
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2011, Ubalo, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Ubalo, Inc nor the names of its
12
+ contributors may be used to endorse or promote products derived
13
+ from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,74 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>CodeMirror: R mode</title>
6
+ <link rel="stylesheet" href="../../lib/codemirror.css">
7
+ <script src="../../lib/codemirror.js"></script>
8
+ <script src="r.js"></script>
9
+ <style>
10
+ .CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
11
+ .cm-s-default span.cm-semi { color: blue; font-weight: bold; }
12
+ .cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
13
+ .cm-s-default span.cm-arrow { color: brown; }
14
+ .cm-s-default span.cm-arg-is { color: brown; }
15
+ </style>
16
+ <link rel="stylesheet" href="../../doc/docs.css">
17
+ </head>
18
+ <body>
19
+ <h1>CodeMirror: R mode</h1>
20
+ <form><textarea id="code" name="code">
21
+ # Code from http://www.mayin.org/ajayshah/KB/R/
22
+
23
+ # FIRST LEARN ABOUT LISTS --
24
+ X = list(height=5.4, weight=54)
25
+ print("Use default printing --")
26
+ print(X)
27
+ print("Accessing individual elements --")
28
+ cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
29
+
30
+ # FUNCTIONS --
31
+ square <- function(x) {
32
+ return(x*x)
33
+ }
34
+ cat("The square of 3 is ", square(3), "\n")
35
+
36
+ # default value of the arg is set to 5.
37
+ cube <- function(x=5) {
38
+ return(x*x*x);
39
+ }
40
+ cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
41
+ cat("Calling cube : ", cube(), "\n") # will default to 5^3.
42
+
43
+ # LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
44
+ powers <- function(x) {
45
+ parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
46
+ return(parcel);
47
+ }
48
+
49
+ X = powers(3);
50
+ print("Showing powers of 3 --"); print(X);
51
+
52
+ # WRITING THIS COMPACTLY (4 lines instead of 7)
53
+
54
+ powerful <- function(x) {
55
+ return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
56
+ }
57
+ print("Showing powers of 3 --"); print(powerful(3));
58
+
59
+ # In R, the last expression in a function is, by default, what is
60
+ # returned. So you could equally just say:
61
+ powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
62
+ </textarea></form>
63
+ <script>
64
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
65
+ </script>
66
+
67
+ <p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
68
+
69
+ <p>Development of the CodeMirror R mode was kindly sponsored
70
+ by <a href="http://ubalo.com/">Ubalo</a>, who hold
71
+ the <a href="LICENSE">license</a>.</p>
72
+
73
+ </body>
74
+ </html>
@@ -0,0 +1,141 @@
1
+ CodeMirror.defineMode("r", function(config) {
2
+ function wordObj(str) {
3
+ var words = str.split(" "), res = {};
4
+ for (var i = 0; i < words.length; ++i) res[words[i]] = true;
5
+ return res;
6
+ }
7
+ var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
8
+ var builtins = wordObj("list quote bquote eval return call parse deparse");
9
+ var keywords = wordObj("if else repeat while function for in next break");
10
+ var blockkeywords = wordObj("if else repeat while function for");
11
+ var opChars = /[+\-*\/^<>=!&|~$:]/;
12
+ var curPunc;
13
+
14
+ function tokenBase(stream, state) {
15
+ curPunc = null;
16
+ var ch = stream.next();
17
+ if (ch == "#") {
18
+ stream.skipToEnd();
19
+ return "comment";
20
+ } else if (ch == "0" && stream.eat("x")) {
21
+ stream.eatWhile(/[\da-f]/i);
22
+ return "number";
23
+ } else if (ch == "." && stream.eat(/\d/)) {
24
+ stream.match(/\d*(?:e[+\-]?\d+)?/);
25
+ return "number";
26
+ } else if (/\d/.test(ch)) {
27
+ stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
28
+ return "number";
29
+ } else if (ch == "'" || ch == '"') {
30
+ state.tokenize = tokenString(ch);
31
+ return "string";
32
+ } else if (ch == "." && stream.match(/.[.\d]+/)) {
33
+ return "keyword";
34
+ } else if (/[\w\.]/.test(ch) && ch != "_") {
35
+ stream.eatWhile(/[\w\.]/);
36
+ var word = stream.current();
37
+ if (atoms.propertyIsEnumerable(word)) return "atom";
38
+ if (keywords.propertyIsEnumerable(word)) {
39
+ if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block";
40
+ return "keyword";
41
+ }
42
+ if (builtins.propertyIsEnumerable(word)) return "builtin";
43
+ return "variable";
44
+ } else if (ch == "%") {
45
+ if (stream.skipTo("%")) stream.next();
46
+ return "variable-2";
47
+ } else if (ch == "<" && stream.eat("-")) {
48
+ return "arrow";
49
+ } else if (ch == "=" && state.ctx.argList) {
50
+ return "arg-is";
51
+ } else if (opChars.test(ch)) {
52
+ if (ch == "$") return "dollar";
53
+ stream.eatWhile(opChars);
54
+ return "operator";
55
+ } else if (/[\(\){}\[\];]/.test(ch)) {
56
+ curPunc = ch;
57
+ if (ch == ";") return "semi";
58
+ return null;
59
+ } else {
60
+ return null;
61
+ }
62
+ }
63
+
64
+ function tokenString(quote) {
65
+ return function(stream, state) {
66
+ if (stream.eat("\\")) {
67
+ var ch = stream.next();
68
+ if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
69
+ else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
70
+ else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
71
+ else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
72
+ else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
73
+ return "string-2";
74
+ } else {
75
+ var next;
76
+ while ((next = stream.next()) != null) {
77
+ if (next == quote) { state.tokenize = tokenBase; break; }
78
+ if (next == "\\") { stream.backUp(1); break; }
79
+ }
80
+ return "string";
81
+ }
82
+ };
83
+ }
84
+
85
+ function push(state, type, stream) {
86
+ state.ctx = {type: type,
87
+ indent: state.indent,
88
+ align: null,
89
+ column: stream.column(),
90
+ prev: state.ctx};
91
+ }
92
+ function pop(state) {
93
+ state.indent = state.ctx.indent;
94
+ state.ctx = state.ctx.prev;
95
+ }
96
+
97
+ return {
98
+ startState: function(base) {
99
+ return {tokenize: tokenBase,
100
+ ctx: {type: "top",
101
+ indent: -config.indentUnit,
102
+ align: false},
103
+ indent: 0,
104
+ afterIdent: false};
105
+ },
106
+
107
+ token: function(stream, state) {
108
+ if (stream.sol()) {
109
+ if (state.ctx.align == null) state.ctx.align = false;
110
+ state.indent = stream.indentation();
111
+ }
112
+ if (stream.eatSpace()) return null;
113
+ var style = state.tokenize(stream, state);
114
+ if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
115
+
116
+ var ctype = state.ctx.type;
117
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
118
+ if (curPunc == "{") push(state, "}", stream);
119
+ else if (curPunc == "(") {
120
+ push(state, ")", stream);
121
+ if (state.afterIdent) state.ctx.argList = true;
122
+ }
123
+ else if (curPunc == "[") push(state, "]", stream);
124
+ else if (curPunc == "block") push(state, "block", stream);
125
+ else if (curPunc == ctype) pop(state);
126
+ state.afterIdent = style == "variable" || style == "keyword";
127
+ return style;
128
+ },
129
+
130
+ indent: function(state, textAfter) {
131
+ if (state.tokenize != tokenBase) return 0;
132
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
133
+ closing = firstChar == ctx.type;
134
+ if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
135
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
136
+ else return ctx.indent + (closing ? 0 : config.indentUnit);
137
+ }
138
+ };
139
+ });
140
+
141
+ CodeMirror.defineMIME("text/x-rsrc", "r");