marty 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,63 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>CodeMirror: Erlang mode</title>
|
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
|
8
|
+
<script src="erlang.js"></script>
|
|
9
|
+
<link rel="stylesheet" href="../../theme/erlang-dark.css">
|
|
10
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
|
11
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<h1>CodeMirror: Erlang mode</h1>
|
|
15
|
+
|
|
16
|
+
<form><textarea id="code" name="code">
|
|
17
|
+
%% -*- mode: erlang; erlang-indent-level: 2 -*-
|
|
18
|
+
%%% Created : 7 May 2012 by mats cronqvist <masse@klarna.com>
|
|
19
|
+
|
|
20
|
+
%% @doc
|
|
21
|
+
%% Demonstrates how to print a record.
|
|
22
|
+
%% @end
|
|
23
|
+
|
|
24
|
+
-module('ex').
|
|
25
|
+
-author('mats cronqvist').
|
|
26
|
+
-export([demo/0,
|
|
27
|
+
rec_info/1]).
|
|
28
|
+
|
|
29
|
+
-record(demo,{a="One",b="Two",c="Three",d="Four"}).
|
|
30
|
+
|
|
31
|
+
rec_info(demo) -> record_info(fields,demo).
|
|
32
|
+
|
|
33
|
+
demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}).
|
|
34
|
+
|
|
35
|
+
expand_recs(M,List) when is_list(List) ->
|
|
36
|
+
[expand_recs(M,L)||L<-List];
|
|
37
|
+
expand_recs(M,Tup) when is_tuple(Tup) ->
|
|
38
|
+
case tuple_size(Tup) of
|
|
39
|
+
L when L < 1 -> Tup;
|
|
40
|
+
L ->
|
|
41
|
+
try Fields = M:rec_info(element(1,Tup)),
|
|
42
|
+
L = length(Fields)+1,
|
|
43
|
+
lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup))))
|
|
44
|
+
catch _:_ ->
|
|
45
|
+
list_to_tuple(expand_recs(M,tuple_to_list(Tup)))
|
|
46
|
+
end
|
|
47
|
+
end;
|
|
48
|
+
expand_recs(_,Term) ->
|
|
49
|
+
Term.
|
|
50
|
+
</textarea></form>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
54
|
+
lineNumbers: true,
|
|
55
|
+
matchBrackets: true,
|
|
56
|
+
extraKeys: {"Tab": "indentAuto"},
|
|
57
|
+
theme: "erlang-dark"
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<p><strong>MIME types defined:</strong> <code>text/x-erlang</code>.</p>
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
CodeMirror.defineMode("gfm", function(config, parserConfig) {
|
|
2
|
+
var mdMode = CodeMirror.getMode(config, "markdown");
|
|
3
|
+
var aliases = {
|
|
4
|
+
html: "htmlmixed",
|
|
5
|
+
js: "javascript",
|
|
6
|
+
json: "application/json",
|
|
7
|
+
c: "text/x-csrc",
|
|
8
|
+
"c++": "text/x-c++src",
|
|
9
|
+
java: "text/x-java",
|
|
10
|
+
csharp: "text/x-csharp",
|
|
11
|
+
"c#": "text/x-csharp"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// make this lazy so that we don't need to load GFM last
|
|
15
|
+
var getMode = (function () {
|
|
16
|
+
var i, modes = {}, mimes = {}, mime;
|
|
17
|
+
|
|
18
|
+
var list = CodeMirror.listModes();
|
|
19
|
+
for (i = 0; i < list.length; i++) {
|
|
20
|
+
modes[list[i]] = list[i];
|
|
21
|
+
}
|
|
22
|
+
var mimesList = CodeMirror.listMIMEs();
|
|
23
|
+
for (i = 0; i < mimesList.length; i++) {
|
|
24
|
+
mime = mimesList[i].mime;
|
|
25
|
+
mimes[mime] = mimesList[i].mime;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
for (var a in aliases) {
|
|
29
|
+
if (aliases[a] in modes || aliases[a] in mimes)
|
|
30
|
+
modes[a] = aliases[a];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return function (lang) {
|
|
34
|
+
return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null;
|
|
35
|
+
};
|
|
36
|
+
}());
|
|
37
|
+
|
|
38
|
+
function markdown(stream, state) {
|
|
39
|
+
// intercept fenced code blocks
|
|
40
|
+
if (stream.sol() && stream.match(/^```([\w+#]*)/)) {
|
|
41
|
+
// try switching mode
|
|
42
|
+
state.localMode = getMode(RegExp.$1);
|
|
43
|
+
if (state.localMode)
|
|
44
|
+
state.localState = state.localMode.startState();
|
|
45
|
+
|
|
46
|
+
state.token = local;
|
|
47
|
+
return 'code';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return mdMode.token(stream, state.mdState);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function local(stream, state) {
|
|
54
|
+
if (stream.sol() && stream.match(/^```/)) {
|
|
55
|
+
state.localMode = state.localState = null;
|
|
56
|
+
state.token = markdown;
|
|
57
|
+
return 'code';
|
|
58
|
+
}
|
|
59
|
+
else if (state.localMode) {
|
|
60
|
+
return state.localMode.token(stream, state.localState);
|
|
61
|
+
} else {
|
|
62
|
+
stream.skipToEnd();
|
|
63
|
+
return 'code';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// custom handleText to prevent emphasis in the middle of a word
|
|
68
|
+
// and add autolinking
|
|
69
|
+
function handleText(stream, mdState) {
|
|
70
|
+
var match;
|
|
71
|
+
if (stream.match(/^\w+:\/\/\S+/)) {
|
|
72
|
+
return 'link';
|
|
73
|
+
}
|
|
74
|
+
if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
|
|
75
|
+
return mdMode.getType(mdState);
|
|
76
|
+
}
|
|
77
|
+
if (match = stream.match(/^[^\[*\\<>` ]+/)) {
|
|
78
|
+
var word = match[0];
|
|
79
|
+
if (word[0] === '_' && word[word.length-1] === '_') {
|
|
80
|
+
stream.backUp(word.length);
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return mdMode.getType(mdState);
|
|
84
|
+
}
|
|
85
|
+
if (stream.eatSpace()) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
startState: function() {
|
|
92
|
+
var mdState = mdMode.startState();
|
|
93
|
+
mdState.text = handleText;
|
|
94
|
+
return {token: markdown, mode: "markdown", mdState: mdState,
|
|
95
|
+
localMode: null, localState: null};
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
copyState: function(state) {
|
|
99
|
+
return {token: state.token, mdState: CodeMirror.copyState(mdMode, state.mdState),
|
|
100
|
+
localMode: state.localMode,
|
|
101
|
+
localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null};
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
token: function(stream, state) {
|
|
105
|
+
/* Parse GFM double bracket links */
|
|
106
|
+
var ch;
|
|
107
|
+
if ((ch = stream.peek()) != undefined && ch == '[') {
|
|
108
|
+
stream.next(); // Advance the stream
|
|
109
|
+
|
|
110
|
+
/* Only handle double bracket links */
|
|
111
|
+
if ((ch = stream.peek()) == undefined || ch != '[') {
|
|
112
|
+
stream.backUp(1);
|
|
113
|
+
return state.token(stream, state);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
while ((ch = stream.next()) != undefined && ch != ']') {}
|
|
117
|
+
|
|
118
|
+
if (ch == ']' && (ch = stream.next()) != undefined && ch == ']')
|
|
119
|
+
return 'link';
|
|
120
|
+
|
|
121
|
+
/* If we did not find the second ']' */
|
|
122
|
+
stream.backUp(1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Match GFM latex formulas, as well as latex formulas within '$' */
|
|
126
|
+
if (stream.match(/^\$[^\$]+\$/)) {
|
|
127
|
+
return "string";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (stream.match(/^\\\((.*?)\\\)/)) {
|
|
131
|
+
return "string";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (stream.match(/^\$\$[^\$]+\$\$/)) {
|
|
135
|
+
return "string";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (stream.match(/^\\\[(.*?)\\\]/)) {
|
|
139
|
+
return "string";
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return state.token(stream, state);
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
innerMode: function(state) {
|
|
146
|
+
if (state.token == markdown) return {state: state.mdState, mode: mdMode};
|
|
147
|
+
else return {state: state.localState, mode: state.localMode};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}, "markdown");
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>CodeMirror: GFM 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="../markdown/markdown.js"></script>
|
|
10
|
+
<script src="gfm.js"></script>
|
|
11
|
+
<script src="../javascript/javascript.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="../markdown/markdown.css">
|
|
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: GFM mode</h1>
|
|
18
|
+
|
|
19
|
+
<!-- source: http://daringfireball.net/projects/markdown/basics.text -->
|
|
20
|
+
<form><textarea id="code" name="code">
|
|
21
|
+
Github Flavored Markdown
|
|
22
|
+
========================
|
|
23
|
+
|
|
24
|
+
Everything from markdown plus GFM features:
|
|
25
|
+
|
|
26
|
+
## Fenced code blocks
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
for (var i = 0; i < items.length; i++) {
|
|
30
|
+
console.log(items[i], i); // log them
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
See http://github.github.com/github-flavored-markdown/
|
|
35
|
+
|
|
36
|
+
</textarea></form>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
40
|
+
mode: 'gfm',
|
|
41
|
+
lineNumbers: true,
|
|
42
|
+
matchBrackets: true,
|
|
43
|
+
theme: "default"
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
CodeMirror.defineMode("go", function(config, parserConfig) {
|
|
2
|
+
var indentUnit = config.indentUnit;
|
|
3
|
+
|
|
4
|
+
var keywords = {
|
|
5
|
+
"break":true, "case":true, "chan":true, "const":true, "continue":true,
|
|
6
|
+
"default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
|
|
7
|
+
"func":true, "go":true, "goto":true, "if":true, "import":true,
|
|
8
|
+
"interface":true, "map":true, "package":true, "range":true, "return":true,
|
|
9
|
+
"select":true, "struct":true, "switch":true, "type":true, "var":true,
|
|
10
|
+
"bool":true, "byte":true, "complex64":true, "complex128":true,
|
|
11
|
+
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
|
|
12
|
+
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
|
|
13
|
+
"uint64":true, "int":true, "uint":true, "uintptr":true
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var atoms = {
|
|
17
|
+
"true":true, "false":true, "iota":true, "nil":true, "append":true,
|
|
18
|
+
"cap":true, "close":true, "complex":true, "copy":true, "imag":true,
|
|
19
|
+
"len":true, "make":true, "new":true, "panic":true, "print":true,
|
|
20
|
+
"println":true, "real":true, "recover":true
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var blockKeywords = {
|
|
24
|
+
"else":true, "for":true, "func":true, "if":true, "interface":true,
|
|
25
|
+
"select":true, "struct":true, "switch":true
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
|
|
29
|
+
|
|
30
|
+
var curPunc;
|
|
31
|
+
|
|
32
|
+
function tokenBase(stream, state) {
|
|
33
|
+
var ch = stream.next();
|
|
34
|
+
if (ch == '"' || ch == "'" || ch == "`") {
|
|
35
|
+
state.tokenize = tokenString(ch);
|
|
36
|
+
return state.tokenize(stream, state);
|
|
37
|
+
}
|
|
38
|
+
if (/[\d\.]/.test(ch)) {
|
|
39
|
+
if (ch == ".") {
|
|
40
|
+
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
|
|
41
|
+
} else if (ch == "0") {
|
|
42
|
+
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
|
|
43
|
+
} else {
|
|
44
|
+
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
|
|
45
|
+
}
|
|
46
|
+
return "number";
|
|
47
|
+
}
|
|
48
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
|
49
|
+
curPunc = ch;
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (ch == "/") {
|
|
53
|
+
if (stream.eat("*")) {
|
|
54
|
+
state.tokenize = tokenComment;
|
|
55
|
+
return tokenComment(stream, state);
|
|
56
|
+
}
|
|
57
|
+
if (stream.eat("/")) {
|
|
58
|
+
stream.skipToEnd();
|
|
59
|
+
return "comment";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (isOperatorChar.test(ch)) {
|
|
63
|
+
stream.eatWhile(isOperatorChar);
|
|
64
|
+
return "operator";
|
|
65
|
+
}
|
|
66
|
+
stream.eatWhile(/[\w\$_]/);
|
|
67
|
+
var cur = stream.current();
|
|
68
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
|
69
|
+
if (cur == "case" || cur == "default") curPunc = "case";
|
|
70
|
+
return "keyword";
|
|
71
|
+
}
|
|
72
|
+
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
|
73
|
+
return "variable";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function tokenString(quote) {
|
|
77
|
+
return function(stream, state) {
|
|
78
|
+
var escaped = false, next, end = false;
|
|
79
|
+
while ((next = stream.next()) != null) {
|
|
80
|
+
if (next == quote && !escaped) {end = true; break;}
|
|
81
|
+
escaped = !escaped && next == "\\";
|
|
82
|
+
}
|
|
83
|
+
if (end || !(escaped || quote == "`"))
|
|
84
|
+
state.tokenize = tokenBase;
|
|
85
|
+
return "string";
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function tokenComment(stream, state) {
|
|
90
|
+
var maybeEnd = false, ch;
|
|
91
|
+
while (ch = stream.next()) {
|
|
92
|
+
if (ch == "/" && maybeEnd) {
|
|
93
|
+
state.tokenize = tokenBase;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
maybeEnd = (ch == "*");
|
|
97
|
+
}
|
|
98
|
+
return "comment";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function Context(indented, column, type, align, prev) {
|
|
102
|
+
this.indented = indented;
|
|
103
|
+
this.column = column;
|
|
104
|
+
this.type = type;
|
|
105
|
+
this.align = align;
|
|
106
|
+
this.prev = prev;
|
|
107
|
+
}
|
|
108
|
+
function pushContext(state, col, type) {
|
|
109
|
+
return state.context = new Context(state.indented, col, type, null, state.context);
|
|
110
|
+
}
|
|
111
|
+
function popContext(state) {
|
|
112
|
+
var t = state.context.type;
|
|
113
|
+
if (t == ")" || t == "]" || t == "}")
|
|
114
|
+
state.indented = state.context.indented;
|
|
115
|
+
return state.context = state.context.prev;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Interface
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
startState: function(basecolumn) {
|
|
122
|
+
return {
|
|
123
|
+
tokenize: null,
|
|
124
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
|
125
|
+
indented: 0,
|
|
126
|
+
startOfLine: true
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
token: function(stream, state) {
|
|
131
|
+
var ctx = state.context;
|
|
132
|
+
if (stream.sol()) {
|
|
133
|
+
if (ctx.align == null) ctx.align = false;
|
|
134
|
+
state.indented = stream.indentation();
|
|
135
|
+
state.startOfLine = true;
|
|
136
|
+
if (ctx.type == "case") ctx.type = "}";
|
|
137
|
+
}
|
|
138
|
+
if (stream.eatSpace()) return null;
|
|
139
|
+
curPunc = null;
|
|
140
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
|
141
|
+
if (style == "comment") return style;
|
|
142
|
+
if (ctx.align == null) ctx.align = true;
|
|
143
|
+
|
|
144
|
+
if (curPunc == "{") pushContext(state, stream.column(), "}");
|
|
145
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
|
146
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
|
147
|
+
else if (curPunc == "case") ctx.type = "case";
|
|
148
|
+
else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
|
|
149
|
+
else if (curPunc == ctx.type) popContext(state);
|
|
150
|
+
state.startOfLine = false;
|
|
151
|
+
return style;
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
indent: function(state, textAfter) {
|
|
155
|
+
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
|
156
|
+
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
|
157
|
+
if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
|
|
158
|
+
state.context.type = "}";
|
|
159
|
+
return ctx.indented;
|
|
160
|
+
}
|
|
161
|
+
var closing = firstChar == ctx.type;
|
|
162
|
+
if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
|
163
|
+
else return ctx.indented + (closing ? 0 : indentUnit);
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
electricChars: "{}:"
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
CodeMirror.defineMIME("text/x-go", "go");
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>CodeMirror: Go mode</title>
|
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
7
|
+
<link rel="stylesheet" href="../../theme/elegant.css">
|
|
8
|
+
<script src="../../lib/codemirror.js"></script>
|
|
9
|
+
<script src="go.js"></script>
|
|
10
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
|
11
|
+
<style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<h1>CodeMirror: Go mode</h1>
|
|
15
|
+
|
|
16
|
+
<form><textarea id="code" name="code">
|
|
17
|
+
// Prime Sieve in Go.
|
|
18
|
+
// Taken from the Go specification.
|
|
19
|
+
// Copyright © The Go Authors.
|
|
20
|
+
|
|
21
|
+
package main
|
|
22
|
+
|
|
23
|
+
import "fmt"
|
|
24
|
+
|
|
25
|
+
// Send the sequence 2, 3, 4, ... to channel 'ch'.
|
|
26
|
+
func generate(ch chan<- int) {
|
|
27
|
+
for i := 2; ; i++ {
|
|
28
|
+
ch <- i // Send 'i' to channel 'ch'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Copy the values from channel 'src' to channel 'dst',
|
|
33
|
+
// removing those divisible by 'prime'.
|
|
34
|
+
func filter(src <-chan int, dst chan<- int, prime int) {
|
|
35
|
+
for i := range src { // Loop over values received from 'src'.
|
|
36
|
+
if i%prime != 0 {
|
|
37
|
+
dst <- i // Send 'i' to channel 'dst'.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// The prime sieve: Daisy-chain filter processes together.
|
|
43
|
+
func sieve() {
|
|
44
|
+
ch := make(chan int) // Create a new channel.
|
|
45
|
+
go generate(ch) // Start generate() as a subprocess.
|
|
46
|
+
for {
|
|
47
|
+
prime := <-ch
|
|
48
|
+
fmt.Print(prime, "\n")
|
|
49
|
+
ch1 := make(chan int)
|
|
50
|
+
go filter(ch, ch1, prime)
|
|
51
|
+
ch = ch1
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
func main() {
|
|
56
|
+
sieve()
|
|
57
|
+
}
|
|
58
|
+
</textarea></form>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
62
|
+
theme: "elegant",
|
|
63
|
+
matchBrackets: true,
|
|
64
|
+
indentUnit: 8,
|
|
65
|
+
tabSize: 8,
|
|
66
|
+
indentWithTabs: true,
|
|
67
|
+
mode: "text/x-go"
|
|
68
|
+
});
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<p><strong>MIME type:</strong> <code>text/x-go</code></p>
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|