marty 0.5.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +84 -0
- data/Rakefile +29 -0
- data/app/assets/javascripts/marty/application.js +15 -0
- data/app/assets/stylesheets/marty/application.css +13 -0
- data/app/components/marty/api_auth_view.rb +32 -0
- data/app/components/marty/auth_app.rb +55 -0
- data/app/components/marty/auth_app.rb~ +51 -0
- data/app/components/marty/auth_app/javascripts/auth_app.js +91 -0
- data/app/components/marty/auth_app/javascripts/auth_app.js~ +91 -0
- data/app/components/marty/cm_form_panel.rb~ +5 -0
- data/app/components/marty/cm_grid_panel.rb~ +35 -0
- data/app/components/marty/data_import_view.rb~ +142 -0
- data/app/components/marty/extras/layout.rb +46 -0
- data/app/components/marty/extras/layout.rb~ +46 -0
- data/app/components/marty/extras/misc.rb +18 -0
- data/app/components/marty/form.rb +6 -0
- data/app/components/marty/grid.rb +45 -0
- data/app/components/marty/grid_append_only.rb +12 -0
- data/app/components/marty/import_type_view.rb +53 -0
- data/app/components/marty/live_search_grid_panel.rb +46 -0
- data/app/components/marty/live_search_grid_panel.rb~ +49 -0
- data/app/components/marty/main_auth_app.rb +269 -0
- data/app/components/marty/main_auth_app.rb~ +238 -0
- data/app/components/marty/mcfly_grid_panel.rb +62 -0
- data/app/components/marty/mcfly_grid_panel.rb~ +80 -0
- data/app/components/marty/new_posting_form.rb +46 -0
- data/app/components/marty/new_posting_form.rb~ +46 -0
- data/app/components/marty/new_posting_window.rb +21 -0
- data/app/components/marty/new_posting_window.rb~ +21 -0
- data/app/components/marty/panel.rb +12 -0
- data/app/components/marty/pivot_grid.rb +52 -0
- data/app/components/marty/pivot_grid/endpoints.rb +45 -0
- data/app/components/marty/pivot_grid/javascripts/extensions.js +150 -0
- data/app/components/marty/pivot_grid/javascripts/pivot_grid.js +86 -0
- data/app/components/marty/pivot_grid/services.rb +44 -0
- data/app/components/marty/posting_grid.rb +139 -0
- data/app/components/marty/posting_grid.rb~ +140 -0
- data/app/components/marty/posting_window.rb +27 -0
- data/app/components/marty/promise_view.rb +177 -0
- data/app/components/marty/promise_view.rb~ +157 -0
- data/app/components/marty/promise_view/stylesheets/promise_view.css +26 -0
- data/app/components/marty/promise_view/stylesheets/promise_view.css~ +15 -0
- data/app/components/marty/report_form.rb +225 -0
- data/app/components/marty/report_form.rb~ +217 -0
- data/app/components/marty/report_select.rb +145 -0
- data/app/components/marty/report_select.rb~ +133 -0
- data/app/components/marty/reporting.rb +39 -0
- data/app/components/marty/reporting.rb~ +39 -0
- data/app/components/marty/script_detail.rb~ +430 -0
- data/app/components/marty/script_form.rb +233 -0
- data/app/components/marty/script_form.rb~ +233 -0
- data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js +698 -0
- data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js~ +909 -0
- data/app/components/marty/script_form/javascripts/codemirror.js +3130 -0
- data/app/components/marty/script_form/javascripts/mode/clike/clike.js +284 -0
- data/app/components/marty/script_form/javascripts/mode/clike/index.html +102 -0
- data/app/components/marty/script_form/javascripts/mode/clike/scala.html +766 -0
- data/app/components/marty/script_form/javascripts/mode/clojure/clojure.js +206 -0
- data/app/components/marty/script_form/javascripts/mode/clojure/index.html +67 -0
- data/app/components/marty/script_form/javascripts/mode/coffeescript/LICENSE +22 -0
- data/app/components/marty/script_form/javascripts/mode/coffeescript/coffeescript.js +346 -0
- data/app/components/marty/script_form/javascripts/mode/coffeescript/index.html +728 -0
- data/app/components/marty/script_form/javascripts/mode/commonlisp/commonlisp.js +101 -0
- data/app/components/marty/script_form/javascripts/mode/commonlisp/index.html +165 -0
- data/app/components/marty/script_form/javascripts/mode/css/css.js +448 -0
- data/app/components/marty/script_form/javascripts/mode/css/index.html +58 -0
- data/app/components/marty/script_form/javascripts/mode/css/test.js +501 -0
- data/app/components/marty/script_form/javascripts/mode/delorean/delorean.js +189 -0
- data/app/components/marty/script_form/javascripts/mode/diff/diff.js +32 -0
- data/app/components/marty/script_form/javascripts/mode/diff/index.html +105 -0
- data/app/components/marty/script_form/javascripts/mode/ecl/ecl.js +203 -0
- data/app/components/marty/script_form/javascripts/mode/ecl/index.html +42 -0
- data/app/components/marty/script_form/javascripts/mode/erlang/erlang.js +463 -0
- data/app/components/marty/script_form/javascripts/mode/erlang/index.html +63 -0
- data/app/components/marty/script_form/javascripts/mode/gfm/gfm.js +150 -0
- data/app/components/marty/script_form/javascripts/mode/gfm/index.html +48 -0
- data/app/components/marty/script_form/javascripts/mode/go/go.js +170 -0
- data/app/components/marty/script_form/javascripts/mode/go/index.html +73 -0
- data/app/components/marty/script_form/javascripts/mode/groovy/groovy.js +210 -0
- data/app/components/marty/script_form/javascripts/mode/groovy/index.html +72 -0
- data/app/components/marty/script_form/javascripts/mode/haskell/haskell.js +242 -0
- data/app/components/marty/script_form/javascripts/mode/haskell/index.html +61 -0
- data/app/components/marty/script_form/javascripts/mode/haxe/haxe.js +429 -0
- data/app/components/marty/script_form/javascripts/mode/haxe/index.html +91 -0
- data/app/components/marty/script_form/javascripts/mode/htmlembedded/htmlembedded.js +72 -0
- data/app/components/marty/script_form/javascripts/mode/htmlembedded/index.html +50 -0
- data/app/components/marty/script_form/javascripts/mode/htmlmixed/htmlmixed.js +84 -0
- data/app/components/marty/script_form/javascripts/mode/htmlmixed/index.html +52 -0
- data/app/components/marty/script_form/javascripts/mode/javascript/index.html +78 -0
- data/app/components/marty/script_form/javascripts/mode/javascript/javascript.js +361 -0
- data/app/components/marty/script_form/javascripts/mode/jinja2/index.html +38 -0
- data/app/components/marty/script_form/javascripts/mode/jinja2/jinja2.js +42 -0
- data/app/components/marty/script_form/javascripts/mode/less/index.html +740 -0
- data/app/components/marty/script_form/javascripts/mode/less/less.js +266 -0
- data/app/components/marty/script_form/javascripts/mode/lua/index.html +73 -0
- data/app/components/marty/script_form/javascripts/mode/lua/lua.js +140 -0
- data/app/components/marty/script_form/javascripts/mode/markdown/index.html +343 -0
- data/app/components/marty/script_form/javascripts/mode/markdown/markdown.js +382 -0
- data/app/components/marty/script_form/javascripts/mode/markdown/test.js +1084 -0
- data/app/components/marty/script_form/javascripts/mode/mysql/index.html +42 -0
- data/app/components/marty/script_form/javascripts/mode/mysql/mysql.js +186 -0
- data/app/components/marty/script_form/javascripts/mode/ntriples/index.html +33 -0
- data/app/components/marty/script_form/javascripts/mode/ntriples/ntriples.js +172 -0
- data/app/components/marty/script_form/javascripts/mode/ocaml/index.html +130 -0
- data/app/components/marty/script_form/javascripts/mode/ocaml/ocaml.js +114 -0
- data/app/components/marty/script_form/javascripts/mode/pascal/LICENSE +7 -0
- data/app/components/marty/script_form/javascripts/mode/pascal/index.html +49 -0
- data/app/components/marty/script_form/javascripts/mode/pascal/pascal.js +94 -0
- data/app/components/marty/script_form/javascripts/mode/perl/LICENSE +19 -0
- data/app/components/marty/script_form/javascripts/mode/perl/index.html +63 -0
- data/app/components/marty/script_form/javascripts/mode/perl/perl.js +816 -0
- data/app/components/marty/script_form/javascripts/mode/php/index.html +49 -0
- data/app/components/marty/script_form/javascripts/mode/php/php.js +148 -0
- data/app/components/marty/script_form/javascripts/mode/pig/index.html +43 -0
- data/app/components/marty/script_form/javascripts/mode/pig/pig.js +172 -0
- data/app/components/marty/script_form/javascripts/mode/plsql/index.html +63 -0
- data/app/components/marty/script_form/javascripts/mode/plsql/plsql.js +217 -0
- data/app/components/marty/script_form/javascripts/mode/properties/index.html +41 -0
- data/app/components/marty/script_form/javascripts/mode/properties/properties.js +63 -0
- data/app/components/marty/script_form/javascripts/mode/python/LICENSE.txt +21 -0
- data/app/components/marty/script_form/javascripts/mode/python/index.html +123 -0
- data/app/components/marty/script_form/javascripts/mode/python/python.js +338 -0
- data/app/components/marty/script_form/javascripts/mode/r/LICENSE +24 -0
- data/app/components/marty/script_form/javascripts/mode/r/index.html +74 -0
- data/app/components/marty/script_form/javascripts/mode/r/r.js +141 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/changes/changes.js +19 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/changes/index.html +54 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/spec/index.html +100 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.css +5 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.js +66 -0
- data/app/components/marty/script_form/javascripts/mode/rst/index.html +526 -0
- data/app/components/marty/script_form/javascripts/mode/rst/rst.js +326 -0
- data/app/components/marty/script_form/javascripts/mode/ruby/LICENSE +24 -0
- data/app/components/marty/script_form/javascripts/mode/ruby/index.html +172 -0
- data/app/components/marty/script_form/javascripts/mode/ruby/ruby.js +195 -0
- data/app/components/marty/script_form/javascripts/mode/rust/index.html +49 -0
- data/app/components/marty/script_form/javascripts/mode/rust/rust.js +432 -0
- data/app/components/marty/script_form/javascripts/mode/scheme/index.html +65 -0
- data/app/components/marty/script_form/javascripts/mode/scheme/scheme.js +230 -0
- data/app/components/marty/script_form/javascripts/mode/shell/index.html +50 -0
- data/app/components/marty/script_form/javascripts/mode/shell/shell.js +118 -0
- data/app/components/marty/script_form/javascripts/mode/sieve/LICENSE +23 -0
- data/app/components/marty/script_form/javascripts/mode/sieve/index.html +81 -0
- data/app/components/marty/script_form/javascripts/mode/sieve/sieve.js +156 -0
- data/app/components/marty/script_form/javascripts/mode/smalltalk/index.html +56 -0
- data/app/components/marty/script_form/javascripts/mode/smalltalk/smalltalk.js +139 -0
- data/app/components/marty/script_form/javascripts/mode/smarty/index.html +83 -0
- data/app/components/marty/script_form/javascripts/mode/smarty/smarty.js +148 -0
- data/app/components/marty/script_form/javascripts/mode/sparql/index.html +41 -0
- data/app/components/marty/script_form/javascripts/mode/sparql/sparql.js +143 -0
- data/app/components/marty/script_form/javascripts/mode/stex/index.html +98 -0
- data/app/components/marty/script_form/javascripts/mode/stex/stex.js +182 -0
- data/app/components/marty/script_form/javascripts/mode/stex/test.js +343 -0
- data/app/components/marty/script_form/javascripts/mode/tiddlywiki/index.html +141 -0
- data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.js +384 -0
- data/app/components/marty/script_form/javascripts/mode/tiki/index.html +83 -0
- data/app/components/marty/script_form/javascripts/mode/tiki/tiki.css +26 -0
- data/app/components/marty/script_form/javascripts/mode/tiki/tiki.js +309 -0
- data/app/components/marty/script_form/javascripts/mode/vb/LICENSE.txt +21 -0
- data/app/components/marty/script_form/javascripts/mode/vb/index.html +89 -0
- data/app/components/marty/script_form/javascripts/mode/vb/vb.js +260 -0
- data/app/components/marty/script_form/javascripts/mode/vbscript/index.html +43 -0
- data/app/components/marty/script_form/javascripts/mode/vbscript/vbscript.js +26 -0
- data/app/components/marty/script_form/javascripts/mode/velocity/index.html +104 -0
- data/app/components/marty/script_form/javascripts/mode/velocity/velocity.js +146 -0
- data/app/components/marty/script_form/javascripts/mode/verilog/index.html +211 -0
- data/app/components/marty/script_form/javascripts/mode/verilog/verilog.js +194 -0
- data/app/components/marty/script_form/javascripts/mode/xml/index.html +45 -0
- data/app/components/marty/script_form/javascripts/mode/xml/xml.js +318 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/LICENSE +20 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/index.html +223 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/index.html +27 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testBase.js +42 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testEmptySequenceKeyword.js +16 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testMultiAttr.js +16 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testNamespaces.js +91 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testProcessingInstructions.js +16 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testQuotes.js +19 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/xquery.js +451 -0
- data/app/components/marty/script_form/javascripts/mode/yaml/index.html +68 -0
- data/app/components/marty/script_form/javascripts/mode/yaml/yaml.js +95 -0
- data/app/components/marty/script_form/javascripts/util/closetag.js +164 -0
- data/app/components/marty/script_form/javascripts/util/dialog.css +27 -0
- data/app/components/marty/script_form/javascripts/util/dialog.js +70 -0
- data/app/components/marty/script_form/javascripts/util/foldcode.js +196 -0
- data/app/components/marty/script_form/javascripts/util/formatting.js +193 -0
- data/app/components/marty/script_form/javascripts/util/javascript-hint.js +134 -0
- data/app/components/marty/script_form/javascripts/util/loadmode.js +51 -0
- data/app/components/marty/script_form/javascripts/util/match-highlighter.js +44 -0
- data/app/components/marty/script_form/javascripts/util/multiplex.js +77 -0
- data/app/components/marty/script_form/javascripts/util/overlay.js +54 -0
- data/app/components/marty/script_form/javascripts/util/pig-hint.js +123 -0
- data/app/components/marty/script_form/javascripts/util/runmode-standalone.js +90 -0
- data/app/components/marty/script_form/javascripts/util/runmode.js +53 -0
- data/app/components/marty/script_form/javascripts/util/search.js +118 -0
- data/app/components/marty/script_form/javascripts/util/searchcursor.js +119 -0
- data/app/components/marty/script_form/javascripts/util/simple-hint.css +16 -0
- data/app/components/marty/script_form/javascripts/util/simple-hint.js +97 -0
- data/app/components/marty/script_form/javascripts/util/xml-hint.js +137 -0
- data/app/components/marty/script_form/stylesheets/codemirror.css +172 -0
- data/app/components/marty/script_form/stylesheets/delorean.css +10 -0
- data/app/components/marty/script_form/stylesheets/theme/ambiance.css +81 -0
- data/app/components/marty/script_form/stylesheets/theme/blackboard.css +25 -0
- data/app/components/marty/script_form/stylesheets/theme/cobalt.css +18 -0
- data/app/components/marty/script_form/stylesheets/theme/eclipse.css +25 -0
- data/app/components/marty/script_form/stylesheets/theme/elegant.css +10 -0
- data/app/components/marty/script_form/stylesheets/theme/erlang-dark.css +21 -0
- data/app/components/marty/script_form/stylesheets/theme/lesser-dark.css +44 -0
- data/app/components/marty/script_form/stylesheets/theme/monokai.css +28 -0
- data/app/components/marty/script_form/stylesheets/theme/neat.css +9 -0
- data/app/components/marty/script_form/stylesheets/theme/night.css +21 -0
- data/app/components/marty/script_form/stylesheets/theme/rubyblue.css +21 -0
- data/app/components/marty/script_form/stylesheets/theme/vibrant-ink.css +27 -0
- data/app/components/marty/script_form/stylesheets/theme/xq-dark.css +46 -0
- data/app/components/marty/script_grid.rb +104 -0
- data/app/components/marty/script_grid.rb~ +99 -0
- data/app/components/marty/script_tester.rb +114 -0
- data/app/components/marty/script_tester.rb~ +213 -0
- data/app/components/marty/scripting.rb +132 -0
- data/app/components/marty/scripting.rb~ +124 -0
- data/app/components/marty/select_report.rb~ +143 -0
- data/app/components/marty/simple_app.rb +97 -0
- data/app/components/marty/simple_app.rb~ +101 -0
- data/app/components/marty/simple_app/javascripts/simple_app.js +50 -0
- data/app/components/marty/simple_app/javascripts/statusbar_ext.js +8 -0
- data/app/components/marty/tag_grid.rb +83 -0
- data/app/components/marty/tag_grid.rb~ +89 -0
- data/app/components/marty/tree_panel.rb~ +256 -0
- data/app/components/marty/tree_panel/javascripts/tree_panel.js~ +317 -0
- data/app/components/marty/user_pivot.rb +128 -0
- data/app/components/marty/user_view.rb +181 -0
- data/app/components/marty/user_view.rb~ +188 -0
- data/app/controllers/marty/application_controller.rb +124 -0
- data/app/controllers/marty/application_controller.rb~ +133 -0
- data/app/controllers/marty/components_controller.rb +41 -0
- data/app/controllers/marty/components_controller.rb~ +37 -0
- data/app/controllers/marty/job_controller.rb +28 -0
- data/app/controllers/marty/job_controller.rb~ +28 -0
- data/app/controllers/marty/rpc_controller.rb +64 -0
- data/app/controllers/marty/rpc_controller.rb~ +61 -0
- data/app/helpers/marty/application_helper.rb +4 -0
- data/app/helpers/marty/script_set.rb +57 -0
- data/app/helpers/marty/script_set.rb~ +59 -0
- data/app/models/marty/api_auth.rb +44 -0
- data/app/models/marty/api_auth.rb~ +48 -0
- data/app/models/marty/base.rb +4 -0
- data/app/models/marty/data_change.rb +179 -0
- data/app/models/marty/data_change.rb~ +141 -0
- data/app/models/marty/enum.rb +22 -0
- data/app/models/marty/enum.rb~ +16 -0
- data/app/models/marty/import_type.rb +44 -0
- data/app/models/marty/import_type.rb~ +48 -0
- data/app/models/marty/poop.rb~ +169 -0
- data/app/models/marty/posting.rb +101 -0
- data/app/models/marty/posting.rb~ +86 -0
- data/app/models/marty/posting_type.rb +12 -0
- data/app/models/marty/posting_type.rb~ +21 -0
- data/app/models/marty/promise.rb +252 -0
- data/app/models/marty/promise.rb~ +196 -0
- data/app/models/marty/role.rb +6 -0
- data/app/models/marty/role.rb~ +10 -0
- data/app/models/marty/script.rb +144 -0
- data/app/models/marty/script.rb~ +62 -0
- data/app/models/marty/tag.rb +96 -0
- data/app/models/marty/tag.rb~ +91 -0
- data/app/models/marty/token.rb +30 -0
- data/app/models/marty/user.rb +146 -0
- data/app/models/marty/user.rb~ +148 -0
- data/app/models/marty/user_role.rb +7 -0
- data/app/models/marty/user_role.rb~ +13 -0
- data/app/views/layouts/marty/application.html.erb +12 -0
- data/app/views/layouts/marty/application.html.erb~ +11 -0
- data/config/locales/en.yml +134 -0
- data/config/routes.rb +6 -0
- data/config/routes.rb~ +10 -0
- data/db/migrate/001_create_marty_scripts.rb +14 -0
- data/db/migrate/003_create_marty_users.rb +12 -0
- data/db/migrate/004_create_marty_roles.rb +7 -0
- data/db/migrate/005_create_marty_user_roles.rb +14 -0
- data/db/migrate/006_create_marty_tokens.rb +14 -0
- data/db/migrate/008_create_marty_posting_types.rb +7 -0
- data/db/migrate/019_create_marty_postings.rb +18 -0
- data/db/migrate/019_create_marty_postings.rb~ +19 -0
- data/db/migrate/068_create_marty_import_types.rb +12 -0
- data/db/migrate/069_create_marty_import_synonyms.rb +15 -0
- data/db/migrate/070_create_versions.rb +18 -0
- data/db/migrate/071_add_object_changes_column_to_versions.rb +9 -0
- data/db/migrate/072_add_validation_function_to_import_types.rb +6 -0
- data/db/migrate/073_add_preprocess_function_to_import_types.rb +5 -0
- data/db/migrate/090_create_delayed_jobs.rb +22 -0
- data/db/migrate/091_create_marty_promises.rb +36 -0
- data/db/migrate/095_create_marty_tags.rb +14 -0
- data/db/migrate/095_create_marty_tags.rb~ +19 -0
- data/db/migrate/096_add_user_roles_to_import_types.rb +11 -0
- data/db/migrate/097_drop_versions.rb +9 -0
- data/db/migrate/098_create_marty_api_auths.rb +20 -0
- data/db/seeds.rb +48 -0
- data/lib/marty.rb +18 -0
- data/lib/marty.rb~ +13 -0
- data/lib/marty/content_handler.rb +97 -0
- data/lib/marty/content_handler.rb~ +93 -0
- data/lib/marty/data_conversion.rb +298 -0
- data/lib/marty/data_exporter.rb +150 -0
- data/lib/marty/data_exporter.rb~ +137 -0
- data/lib/marty/data_importer.rb +122 -0
- data/lib/marty/data_importer.rb~ +114 -0
- data/lib/marty/data_row_processor.rb~ +206 -0
- data/lib/marty/drop_folder_hook.rb~ +17 -0
- data/lib/marty/engine.rb +10 -0
- data/lib/marty/folder_hook.rb~ +9 -0
- data/lib/marty/lazy_column_loader.rb +57 -0
- data/lib/marty/lazy_column_loader.rb~ +47 -0
- data/lib/marty/mcfly_query.rb +189 -0
- data/lib/marty/mcfly_query.rb~ +188 -0
- data/lib/marty/migrations.rb +108 -0
- data/lib/marty/migrations.rb~ +65 -0
- data/lib/marty/monkey.rb +163 -0
- data/lib/marty/monkey.rb~ +160 -0
- data/lib/marty/permissions.rb +64 -0
- data/lib/marty/permissions.rb~ +69 -0
- data/lib/marty/promise.rb~ +41 -0
- data/lib/marty/promise_job.rb +123 -0
- data/lib/marty/promise_job.rb~ +121 -0
- data/lib/marty/promise_proxy.rb +94 -0
- data/lib/marty/promise_proxy.rb~ +69 -0
- data/lib/marty/railtie.rb +5 -0
- data/lib/marty/relation.rb +39 -0
- data/lib/marty/util.rb +110 -0
- data/lib/marty/util.rb~ +80 -0
- data/lib/marty/version.rb +3 -0
- data/lib/marty/version.rb~ +3 -0
- data/lib/marty/xl.rb +527 -0
- data/lib/marty/xl.rb~ +526 -0
- data/lib/pyxll/README.txt +19 -0
- data/lib/pyxll/README.txt~ +16 -0
- data/lib/pyxll/gemini.py +155 -0
- data/lib/pyxll/gemini.py~ +110 -0
- data/lib/pyxll/pyxll.cfg +12 -0
- data/lib/pyxll/pyxll.cfg~ +12 -0
- data/lib/pyxll/sample.xlsx +0 -0
- data/lib/tasks/marty_tasks.rake +37 -0
- metadata +517 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: Haxe mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="haxe.js"></script>
|
9
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
10
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>CodeMirror: Haxe mode</h1>
|
14
|
+
|
15
|
+
<div><textarea id="code" name="code">
|
16
|
+
import one.two.Three;
|
17
|
+
|
18
|
+
@attr("test")
|
19
|
+
class Foo<T> extends Three
|
20
|
+
{
|
21
|
+
public function new()
|
22
|
+
{
|
23
|
+
noFoo = 12;
|
24
|
+
}
|
25
|
+
|
26
|
+
public static inline function doFoo(obj:{k:Int, l:Float}):Int
|
27
|
+
{
|
28
|
+
for(i in 0...10)
|
29
|
+
{
|
30
|
+
obj.k++;
|
31
|
+
trace(i);
|
32
|
+
var var1 = new Array();
|
33
|
+
if(var1.length > 1)
|
34
|
+
throw "Error";
|
35
|
+
}
|
36
|
+
// The following line should not be colored, the variable is scoped out
|
37
|
+
var1;
|
38
|
+
/* Multi line
|
39
|
+
* Comment test
|
40
|
+
*/
|
41
|
+
return obj.k;
|
42
|
+
}
|
43
|
+
private function bar():Void
|
44
|
+
{
|
45
|
+
#if flash
|
46
|
+
var t1:String = "1.21";
|
47
|
+
#end
|
48
|
+
try {
|
49
|
+
doFoo({k:3, l:1.2});
|
50
|
+
}
|
51
|
+
catch (e : String) {
|
52
|
+
trace(e);
|
53
|
+
}
|
54
|
+
var t2:Float = cast(3.2);
|
55
|
+
var t3:haxe.Timer = new haxe.Timer();
|
56
|
+
var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
|
57
|
+
var t5 = ~/123+.*$/i;
|
58
|
+
doFoo(t4);
|
59
|
+
untyped t1 = 4;
|
60
|
+
bob = new Foo<Int>
|
61
|
+
}
|
62
|
+
public var okFoo(default, never):Float;
|
63
|
+
var noFoo(getFoo, null):Int;
|
64
|
+
function getFoo():Int {
|
65
|
+
return noFoo;
|
66
|
+
}
|
67
|
+
|
68
|
+
public var three:Int;
|
69
|
+
}
|
70
|
+
enum Color
|
71
|
+
{
|
72
|
+
red;
|
73
|
+
green;
|
74
|
+
blue;
|
75
|
+
grey( v : Int );
|
76
|
+
rgb (r:Int,g:Int,b:Int);
|
77
|
+
}
|
78
|
+
</textarea></div>
|
79
|
+
|
80
|
+
<script>
|
81
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
82
|
+
lineNumbers: true,
|
83
|
+
matchBrackets: true,
|
84
|
+
indentUnit: 4,
|
85
|
+
indentWithTabs: true
|
86
|
+
});
|
87
|
+
</script>
|
88
|
+
|
89
|
+
<p><strong>MIME types defined:</strong> <code>text/x-haxe</code>.</p>
|
90
|
+
</body>
|
91
|
+
</html>
|
@@ -0,0 +1,72 @@
|
|
1
|
+
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
2
|
+
|
3
|
+
//config settings
|
4
|
+
var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
|
5
|
+
scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
|
6
|
+
|
7
|
+
//inner modes
|
8
|
+
var scriptingMode, htmlMixedMode;
|
9
|
+
|
10
|
+
//tokenizer when in html mode
|
11
|
+
function htmlDispatch(stream, state) {
|
12
|
+
if (stream.match(scriptStartRegex, false)) {
|
13
|
+
state.token=scriptingDispatch;
|
14
|
+
return scriptingMode.token(stream, state.scriptState);
|
15
|
+
}
|
16
|
+
else
|
17
|
+
return htmlMixedMode.token(stream, state.htmlState);
|
18
|
+
}
|
19
|
+
|
20
|
+
//tokenizer when in scripting mode
|
21
|
+
function scriptingDispatch(stream, state) {
|
22
|
+
if (stream.match(scriptEndRegex, false)) {
|
23
|
+
state.token=htmlDispatch;
|
24
|
+
return htmlMixedMode.token(stream, state.htmlState);
|
25
|
+
}
|
26
|
+
else
|
27
|
+
return scriptingMode.token(stream, state.scriptState);
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
return {
|
32
|
+
startState: function() {
|
33
|
+
scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
|
34
|
+
htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
|
35
|
+
return {
|
36
|
+
token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
|
37
|
+
htmlState : htmlMixedMode.startState(),
|
38
|
+
scriptState : scriptingMode.startState()
|
39
|
+
};
|
40
|
+
},
|
41
|
+
|
42
|
+
token: function(stream, state) {
|
43
|
+
return state.token(stream, state);
|
44
|
+
},
|
45
|
+
|
46
|
+
indent: function(state, textAfter) {
|
47
|
+
if (state.token == htmlDispatch)
|
48
|
+
return htmlMixedMode.indent(state.htmlState, textAfter);
|
49
|
+
else
|
50
|
+
return scriptingMode.indent(state.scriptState, textAfter);
|
51
|
+
},
|
52
|
+
|
53
|
+
copyState: function(state) {
|
54
|
+
return {
|
55
|
+
token : state.token,
|
56
|
+
htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
|
57
|
+
scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
|
58
|
+
};
|
59
|
+
},
|
60
|
+
|
61
|
+
electricChars: "/{}:",
|
62
|
+
|
63
|
+
innerMode: function(state) {
|
64
|
+
if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
|
65
|
+
else return {state: state.htmlState, mode: htmlMixedMode};
|
66
|
+
}
|
67
|
+
};
|
68
|
+
}, "htmlmixed");
|
69
|
+
|
70
|
+
CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
|
71
|
+
CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
|
72
|
+
CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: Html Embedded Scripts mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="../xml/xml.js"></script>
|
9
|
+
<script src="../javascript/javascript.js"></script>
|
10
|
+
<script src="../css/css.js"></script>
|
11
|
+
<script src="../htmlmixed/htmlmixed.js"></script>
|
12
|
+
<script src="htmlembedded.js"></script>
|
13
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
14
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<h1>CodeMirror: Html Embedded Scripts mode</h1>
|
18
|
+
|
19
|
+
<form><textarea id="code" name="code">
|
20
|
+
<%
|
21
|
+
function hello(who) {
|
22
|
+
return "Hello " + who;
|
23
|
+
}
|
24
|
+
%>
|
25
|
+
This is an example of EJS (embedded javascript)
|
26
|
+
<p>The program says <%= hello("world") %>.</p>
|
27
|
+
<script>
|
28
|
+
alert("And here is some normal JS code"); // also colored
|
29
|
+
</script>
|
30
|
+
</textarea></form>
|
31
|
+
|
32
|
+
<script>
|
33
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
34
|
+
lineNumbers: true,
|
35
|
+
matchBrackets: true,
|
36
|
+
mode: "application/x-ejs",
|
37
|
+
indentUnit: 4,
|
38
|
+
indentWithTabs: true,
|
39
|
+
enterMode: "keep",
|
40
|
+
tabMode: "shift"
|
41
|
+
});
|
42
|
+
</script>
|
43
|
+
|
44
|
+
<p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
|
45
|
+
JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p>
|
46
|
+
|
47
|
+
<p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
|
48
|
+
<code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
|
49
|
+
</body>
|
50
|
+
</html>
|
@@ -0,0 +1,84 @@
|
|
1
|
+
CodeMirror.defineMode("htmlmixed", function(config) {
|
2
|
+
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
|
3
|
+
var jsMode = CodeMirror.getMode(config, "javascript");
|
4
|
+
var cssMode = CodeMirror.getMode(config, "css");
|
5
|
+
|
6
|
+
function html(stream, state) {
|
7
|
+
var style = htmlMode.token(stream, state.htmlState);
|
8
|
+
if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
|
9
|
+
if (/^script$/i.test(state.htmlState.context.tagName)) {
|
10
|
+
state.token = javascript;
|
11
|
+
state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
|
12
|
+
}
|
13
|
+
else if (/^style$/i.test(state.htmlState.context.tagName)) {
|
14
|
+
state.token = css;
|
15
|
+
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
|
16
|
+
}
|
17
|
+
}
|
18
|
+
return style;
|
19
|
+
}
|
20
|
+
function maybeBackup(stream, pat, style) {
|
21
|
+
var cur = stream.current();
|
22
|
+
var close = cur.search(pat), m;
|
23
|
+
if (close > -1) stream.backUp(cur.length - close);
|
24
|
+
else if (m = cur.match(/<\/?$/)) {
|
25
|
+
stream.backUp(cur[0].length);
|
26
|
+
if (!stream.match(pat, false)) stream.match(cur[0]);
|
27
|
+
}
|
28
|
+
return style;
|
29
|
+
}
|
30
|
+
function javascript(stream, state) {
|
31
|
+
if (stream.match(/^<\/\s*script\s*>/i, false)) {
|
32
|
+
state.token = html;
|
33
|
+
state.localState = null;
|
34
|
+
return html(stream, state);
|
35
|
+
}
|
36
|
+
return maybeBackup(stream, /<\/\s*script\s*>/,
|
37
|
+
jsMode.token(stream, state.localState));
|
38
|
+
}
|
39
|
+
function css(stream, state) {
|
40
|
+
if (stream.match(/^<\/\s*style\s*>/i, false)) {
|
41
|
+
state.token = html;
|
42
|
+
state.localState = null;
|
43
|
+
return html(stream, state);
|
44
|
+
}
|
45
|
+
return maybeBackup(stream, /<\/\s*style\s*>/,
|
46
|
+
cssMode.token(stream, state.localState));
|
47
|
+
}
|
48
|
+
|
49
|
+
return {
|
50
|
+
startState: function() {
|
51
|
+
var state = htmlMode.startState();
|
52
|
+
return {token: html, localState: null, mode: "html", htmlState: state};
|
53
|
+
},
|
54
|
+
|
55
|
+
copyState: function(state) {
|
56
|
+
if (state.localState)
|
57
|
+
var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState);
|
58
|
+
return {token: state.token, localState: local, mode: state.mode,
|
59
|
+
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
|
60
|
+
},
|
61
|
+
|
62
|
+
token: function(stream, state) {
|
63
|
+
return state.token(stream, state);
|
64
|
+
},
|
65
|
+
|
66
|
+
indent: function(state, textAfter) {
|
67
|
+
if (state.token == html || /^\s*<\//.test(textAfter))
|
68
|
+
return htmlMode.indent(state.htmlState, textAfter);
|
69
|
+
else if (state.token == javascript)
|
70
|
+
return jsMode.indent(state.localState, textAfter);
|
71
|
+
else
|
72
|
+
return cssMode.indent(state.localState, textAfter);
|
73
|
+
},
|
74
|
+
|
75
|
+
electricChars: "/{}:",
|
76
|
+
|
77
|
+
innerMode: function(state) {
|
78
|
+
var mode = state.token == html ? htmlMode : state.token == javascript ? jsMode : cssMode;
|
79
|
+
return {state: state.localState || state.htmlState, mode: mode};
|
80
|
+
}
|
81
|
+
};
|
82
|
+
}, "xml", "javascript", "css");
|
83
|
+
|
84
|
+
CodeMirror.defineMIME("text/html", "htmlmixed");
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: HTML mixed mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="../xml/xml.js"></script>
|
9
|
+
<script src="../javascript/javascript.js"></script>
|
10
|
+
<script src="../css/css.js"></script>
|
11
|
+
<script src="htmlmixed.js"></script>
|
12
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
13
|
+
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<h1>CodeMirror: HTML mixed mode</h1>
|
17
|
+
<form><textarea id="code" name="code">
|
18
|
+
<html style="color: green">
|
19
|
+
<!-- this is a comment -->
|
20
|
+
<head>
|
21
|
+
<title>Mixed HTML Example</title>
|
22
|
+
<style type="text/css">
|
23
|
+
h1 {font-family: comic sans; color: #f0f;}
|
24
|
+
div {background: yellow !important;}
|
25
|
+
body {
|
26
|
+
max-width: 50em;
|
27
|
+
margin: 1em 2em 1em 5em;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
</head>
|
31
|
+
<body>
|
32
|
+
<h1>Mixed HTML Example</h1>
|
33
|
+
<script>
|
34
|
+
function jsFunc(arg1, arg2) {
|
35
|
+
if (arg1 && arg2) document.body.innerHTML = "achoo";
|
36
|
+
}
|
37
|
+
</script>
|
38
|
+
</body>
|
39
|
+
</html>
|
40
|
+
</textarea></form>
|
41
|
+
<script>
|
42
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", tabMode: "indent"});
|
43
|
+
</script>
|
44
|
+
|
45
|
+
<p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
|
46
|
+
|
47
|
+
<p><strong>MIME types defined:</strong> <code>text/html</code>
|
48
|
+
(redefined, only takes effect if you load this parser after the
|
49
|
+
XML parser).</p>
|
50
|
+
|
51
|
+
</body>
|
52
|
+
</html>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: JavaScript mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="javascript.js"></script>
|
9
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
10
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>CodeMirror: JavaScript mode</h1>
|
14
|
+
|
15
|
+
<div><textarea id="code" name="code">
|
16
|
+
// Demo code (the actual new parser character stream implementation)
|
17
|
+
|
18
|
+
function StringStream(string) {
|
19
|
+
this.pos = 0;
|
20
|
+
this.string = string;
|
21
|
+
}
|
22
|
+
|
23
|
+
StringStream.prototype = {
|
24
|
+
done: function() {return this.pos >= this.string.length;},
|
25
|
+
peek: function() {return this.string.charAt(this.pos);},
|
26
|
+
next: function() {
|
27
|
+
if (this.pos < this.string.length)
|
28
|
+
return this.string.charAt(this.pos++);
|
29
|
+
},
|
30
|
+
eat: function(match) {
|
31
|
+
var ch = this.string.charAt(this.pos);
|
32
|
+
if (typeof match == "string") var ok = ch == match;
|
33
|
+
else var ok = ch && match.test ? match.test(ch) : match(ch);
|
34
|
+
if (ok) {this.pos++; return ch;}
|
35
|
+
},
|
36
|
+
eatWhile: function(match) {
|
37
|
+
var start = this.pos;
|
38
|
+
while (this.eat(match));
|
39
|
+
if (this.pos > start) return this.string.slice(start, this.pos);
|
40
|
+
},
|
41
|
+
backUp: function(n) {this.pos -= n;},
|
42
|
+
column: function() {return this.pos;},
|
43
|
+
eatSpace: function() {
|
44
|
+
var start = this.pos;
|
45
|
+
while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
|
46
|
+
return this.pos - start;
|
47
|
+
},
|
48
|
+
match: function(pattern, consume, caseInsensitive) {
|
49
|
+
if (typeof pattern == "string") {
|
50
|
+
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
|
51
|
+
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
|
52
|
+
if (consume !== false) this.pos += str.length;
|
53
|
+
return true;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
var match = this.string.slice(this.pos).match(pattern);
|
58
|
+
if (match && consume !== false) this.pos += match[0].length;
|
59
|
+
return match;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
};
|
63
|
+
</textarea></div>
|
64
|
+
|
65
|
+
<script>
|
66
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
67
|
+
lineNumbers: true,
|
68
|
+
matchBrackets: true
|
69
|
+
});
|
70
|
+
</script>
|
71
|
+
|
72
|
+
<p>JavaScript mode supports a single configuration
|
73
|
+
option, <code>json</code>, which will set the mode to expect JSON
|
74
|
+
data rather than a JavaScript program.</p>
|
75
|
+
|
76
|
+
<p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
|
77
|
+
</body>
|
78
|
+
</html>
|
@@ -0,0 +1,361 @@
|
|
1
|
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
2
|
+
var indentUnit = config.indentUnit;
|
3
|
+
var jsonMode = parserConfig.json;
|
4
|
+
|
5
|
+
// Tokenizer
|
6
|
+
|
7
|
+
var keywords = function(){
|
8
|
+
function kw(type) {return {type: type, style: "keyword"};}
|
9
|
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
10
|
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
11
|
+
return {
|
12
|
+
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
13
|
+
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
14
|
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
15
|
+
"function": kw("function"), "catch": kw("catch"),
|
16
|
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
17
|
+
"in": operator, "typeof": operator, "instanceof": operator,
|
18
|
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
|
19
|
+
};
|
20
|
+
}();
|
21
|
+
|
22
|
+
var isOperatorChar = /[+\-*&%=<>!?|]/;
|
23
|
+
|
24
|
+
function chain(stream, state, f) {
|
25
|
+
state.tokenize = f;
|
26
|
+
return f(stream, state);
|
27
|
+
}
|
28
|
+
|
29
|
+
function nextUntilUnescaped(stream, end) {
|
30
|
+
var escaped = false, next;
|
31
|
+
while ((next = stream.next()) != null) {
|
32
|
+
if (next == end && !escaped)
|
33
|
+
return false;
|
34
|
+
escaped = !escaped && next == "\\";
|
35
|
+
}
|
36
|
+
return escaped;
|
37
|
+
}
|
38
|
+
|
39
|
+
// Used as scratch variables to communicate multiple values without
|
40
|
+
// consing up tons of objects.
|
41
|
+
var type, content;
|
42
|
+
function ret(tp, style, cont) {
|
43
|
+
type = tp; content = cont;
|
44
|
+
return style;
|
45
|
+
}
|
46
|
+
|
47
|
+
function jsTokenBase(stream, state) {
|
48
|
+
var ch = stream.next();
|
49
|
+
if (ch == '"' || ch == "'")
|
50
|
+
return chain(stream, state, jsTokenString(ch));
|
51
|
+
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
|
52
|
+
return ret(ch);
|
53
|
+
else if (ch == "0" && stream.eat(/x/i)) {
|
54
|
+
stream.eatWhile(/[\da-f]/i);
|
55
|
+
return ret("number", "number");
|
56
|
+
}
|
57
|
+
else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
|
58
|
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
59
|
+
return ret("number", "number");
|
60
|
+
}
|
61
|
+
else if (ch == "/") {
|
62
|
+
if (stream.eat("*")) {
|
63
|
+
return chain(stream, state, jsTokenComment);
|
64
|
+
}
|
65
|
+
else if (stream.eat("/")) {
|
66
|
+
stream.skipToEnd();
|
67
|
+
return ret("comment", "comment");
|
68
|
+
}
|
69
|
+
else if (state.reAllowed) {
|
70
|
+
nextUntilUnescaped(stream, "/");
|
71
|
+
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
72
|
+
return ret("regexp", "string-2");
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
stream.eatWhile(isOperatorChar);
|
76
|
+
return ret("operator", null, stream.current());
|
77
|
+
}
|
78
|
+
}
|
79
|
+
else if (ch == "#") {
|
80
|
+
stream.skipToEnd();
|
81
|
+
return ret("error", "error");
|
82
|
+
}
|
83
|
+
else if (isOperatorChar.test(ch)) {
|
84
|
+
stream.eatWhile(isOperatorChar);
|
85
|
+
return ret("operator", null, stream.current());
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
stream.eatWhile(/[\w\$_]/);
|
89
|
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
90
|
+
return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
|
91
|
+
ret("variable", "variable", word);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
function jsTokenString(quote) {
|
96
|
+
return function(stream, state) {
|
97
|
+
if (!nextUntilUnescaped(stream, quote))
|
98
|
+
state.tokenize = jsTokenBase;
|
99
|
+
return ret("string", "string");
|
100
|
+
};
|
101
|
+
}
|
102
|
+
|
103
|
+
function jsTokenComment(stream, state) {
|
104
|
+
var maybeEnd = false, ch;
|
105
|
+
while (ch = stream.next()) {
|
106
|
+
if (ch == "/" && maybeEnd) {
|
107
|
+
state.tokenize = jsTokenBase;
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
maybeEnd = (ch == "*");
|
111
|
+
}
|
112
|
+
return ret("comment", "comment");
|
113
|
+
}
|
114
|
+
|
115
|
+
// Parser
|
116
|
+
|
117
|
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
|
118
|
+
|
119
|
+
function JSLexical(indented, column, type, align, prev, info) {
|
120
|
+
this.indented = indented;
|
121
|
+
this.column = column;
|
122
|
+
this.type = type;
|
123
|
+
this.prev = prev;
|
124
|
+
this.info = info;
|
125
|
+
if (align != null) this.align = align;
|
126
|
+
}
|
127
|
+
|
128
|
+
function inScope(state, varname) {
|
129
|
+
for (var v = state.localVars; v; v = v.next)
|
130
|
+
if (v.name == varname) return true;
|
131
|
+
}
|
132
|
+
|
133
|
+
function parseJS(state, style, type, content, stream) {
|
134
|
+
var cc = state.cc;
|
135
|
+
// Communicate our context to the combinators.
|
136
|
+
// (Less wasteful than consing up a hundred closures on every call.)
|
137
|
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
138
|
+
|
139
|
+
if (!state.lexical.hasOwnProperty("align"))
|
140
|
+
state.lexical.align = true;
|
141
|
+
|
142
|
+
while(true) {
|
143
|
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
144
|
+
if (combinator(type, content)) {
|
145
|
+
while(cc.length && cc[cc.length - 1].lex)
|
146
|
+
cc.pop()();
|
147
|
+
if (cx.marked) return cx.marked;
|
148
|
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
149
|
+
return style;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
// Combinator utils
|
155
|
+
|
156
|
+
var cx = {state: null, column: null, marked: null, cc: null};
|
157
|
+
function pass() {
|
158
|
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
159
|
+
}
|
160
|
+
function cont() {
|
161
|
+
pass.apply(null, arguments);
|
162
|
+
return true;
|
163
|
+
}
|
164
|
+
function register(varname) {
|
165
|
+
var state = cx.state;
|
166
|
+
if (state.context) {
|
167
|
+
cx.marked = "def";
|
168
|
+
for (var v = state.localVars; v; v = v.next)
|
169
|
+
if (v.name == varname) return;
|
170
|
+
state.localVars = {name: varname, next: state.localVars};
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
// Combinators
|
175
|
+
|
176
|
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
177
|
+
function pushcontext() {
|
178
|
+
if (!cx.state.context) cx.state.localVars = defaultVars;
|
179
|
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
180
|
+
}
|
181
|
+
function popcontext() {
|
182
|
+
cx.state.localVars = cx.state.context.vars;
|
183
|
+
cx.state.context = cx.state.context.prev;
|
184
|
+
}
|
185
|
+
function pushlex(type, info) {
|
186
|
+
var result = function() {
|
187
|
+
var state = cx.state;
|
188
|
+
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
|
189
|
+
};
|
190
|
+
result.lex = true;
|
191
|
+
return result;
|
192
|
+
}
|
193
|
+
function poplex() {
|
194
|
+
var state = cx.state;
|
195
|
+
if (state.lexical.prev) {
|
196
|
+
if (state.lexical.type == ")")
|
197
|
+
state.indented = state.lexical.indented;
|
198
|
+
state.lexical = state.lexical.prev;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
poplex.lex = true;
|
202
|
+
|
203
|
+
function expect(wanted) {
|
204
|
+
return function expecting(type) {
|
205
|
+
if (type == wanted) return cont();
|
206
|
+
else if (wanted == ";") return pass();
|
207
|
+
else return cont(arguments.callee);
|
208
|
+
};
|
209
|
+
}
|
210
|
+
|
211
|
+
function statement(type) {
|
212
|
+
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
|
213
|
+
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
214
|
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
215
|
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
216
|
+
if (type == ";") return cont();
|
217
|
+
if (type == "function") return cont(functiondef);
|
218
|
+
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
|
219
|
+
poplex, statement, poplex);
|
220
|
+
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
221
|
+
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
222
|
+
block, poplex, poplex);
|
223
|
+
if (type == "case") return cont(expression, expect(":"));
|
224
|
+
if (type == "default") return cont(expect(":"));
|
225
|
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
226
|
+
statement, poplex, popcontext);
|
227
|
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
228
|
+
}
|
229
|
+
function expression(type) {
|
230
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
|
231
|
+
if (type == "function") return cont(functiondef);
|
232
|
+
if (type == "keyword c") return cont(maybeexpression);
|
233
|
+
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
|
234
|
+
if (type == "operator") return cont(expression);
|
235
|
+
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
|
236
|
+
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
|
237
|
+
return cont();
|
238
|
+
}
|
239
|
+
function maybeexpression(type) {
|
240
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
241
|
+
return pass(expression);
|
242
|
+
}
|
243
|
+
|
244
|
+
function maybeoperator(type, value) {
|
245
|
+
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
|
246
|
+
if (type == "operator" && value == "?") return cont(expression, expect(":"), expression);
|
247
|
+
if (type == ";") return;
|
248
|
+
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
|
249
|
+
if (type == ".") return cont(property, maybeoperator);
|
250
|
+
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
|
251
|
+
}
|
252
|
+
function maybelabel(type) {
|
253
|
+
if (type == ":") return cont(poplex, statement);
|
254
|
+
return pass(maybeoperator, expect(";"), poplex);
|
255
|
+
}
|
256
|
+
function property(type) {
|
257
|
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
258
|
+
}
|
259
|
+
function objprop(type) {
|
260
|
+
if (type == "variable") cx.marked = "property";
|
261
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
|
262
|
+
}
|
263
|
+
function commasep(what, end) {
|
264
|
+
function proceed(type) {
|
265
|
+
if (type == ",") return cont(what, proceed);
|
266
|
+
if (type == end) return cont();
|
267
|
+
return cont(expect(end));
|
268
|
+
}
|
269
|
+
return function commaSeparated(type) {
|
270
|
+
if (type == end) return cont();
|
271
|
+
else return pass(what, proceed);
|
272
|
+
};
|
273
|
+
}
|
274
|
+
function block(type) {
|
275
|
+
if (type == "}") return cont();
|
276
|
+
return pass(statement, block);
|
277
|
+
}
|
278
|
+
function vardef1(type, value) {
|
279
|
+
if (type == "variable"){register(value); return cont(vardef2);}
|
280
|
+
return cont();
|
281
|
+
}
|
282
|
+
function vardef2(type, value) {
|
283
|
+
if (value == "=") return cont(expression, vardef2);
|
284
|
+
if (type == ",") return cont(vardef1);
|
285
|
+
}
|
286
|
+
function forspec1(type) {
|
287
|
+
if (type == "var") return cont(vardef1, forspec2);
|
288
|
+
if (type == ";") return pass(forspec2);
|
289
|
+
if (type == "variable") return cont(formaybein);
|
290
|
+
return pass(forspec2);
|
291
|
+
}
|
292
|
+
function formaybein(type, value) {
|
293
|
+
if (value == "in") return cont(expression);
|
294
|
+
return cont(maybeoperator, forspec2);
|
295
|
+
}
|
296
|
+
function forspec2(type, value) {
|
297
|
+
if (type == ";") return cont(forspec3);
|
298
|
+
if (value == "in") return cont(expression);
|
299
|
+
return cont(expression, expect(";"), forspec3);
|
300
|
+
}
|
301
|
+
function forspec3(type) {
|
302
|
+
if (type != ")") cont(expression);
|
303
|
+
}
|
304
|
+
function functiondef(type, value) {
|
305
|
+
if (type == "variable") {register(value); return cont(functiondef);}
|
306
|
+
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
|
307
|
+
}
|
308
|
+
function funarg(type, value) {
|
309
|
+
if (type == "variable") {register(value); return cont();}
|
310
|
+
}
|
311
|
+
|
312
|
+
// Interface
|
313
|
+
|
314
|
+
return {
|
315
|
+
startState: function(basecolumn) {
|
316
|
+
return {
|
317
|
+
tokenize: jsTokenBase,
|
318
|
+
reAllowed: true,
|
319
|
+
kwAllowed: true,
|
320
|
+
cc: [],
|
321
|
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
322
|
+
localVars: parserConfig.localVars,
|
323
|
+
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
324
|
+
indented: 0
|
325
|
+
};
|
326
|
+
},
|
327
|
+
|
328
|
+
token: function(stream, state) {
|
329
|
+
if (stream.sol()) {
|
330
|
+
if (!state.lexical.hasOwnProperty("align"))
|
331
|
+
state.lexical.align = false;
|
332
|
+
state.indented = stream.indentation();
|
333
|
+
}
|
334
|
+
if (stream.eatSpace()) return null;
|
335
|
+
var style = state.tokenize(stream, state);
|
336
|
+
if (type == "comment") return style;
|
337
|
+
state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/));
|
338
|
+
state.kwAllowed = type != '.';
|
339
|
+
return parseJS(state, style, type, content, stream);
|
340
|
+
},
|
341
|
+
|
342
|
+
indent: function(state, textAfter) {
|
343
|
+
if (state.tokenize != jsTokenBase) return 0;
|
344
|
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
|
345
|
+
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
|
346
|
+
var type = lexical.type, closing = firstChar == type;
|
347
|
+
if (type == "vardef") return lexical.indented + 4;
|
348
|
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
349
|
+
else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
|
350
|
+
else if (lexical.info == "switch" && !closing)
|
351
|
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
352
|
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
353
|
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
354
|
+
},
|
355
|
+
|
356
|
+
electricChars: ":{}"
|
357
|
+
};
|
358
|
+
});
|
359
|
+
|
360
|
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
361
|
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|