chess_engine 0.0.1
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/Gemfile +5 -0
- data/Gemfile.lock +21 -0
- data/README.md +26 -0
- data/chess_engine.gemspec +14 -0
- data/lib/chess_engine/board.rb +95 -0
- data/lib/chess_engine/cli.rb +105 -0
- data/lib/chess_engine/game.rb +148 -0
- data/lib/chess_engine/input.rb +19 -0
- data/lib/chess_engine/move.rb +35 -0
- data/lib/chess_engine/piece.rb +97 -0
- data/lib/chess_engine/validator.rb +87 -0
- data/lib/chess_engine.rb +1 -0
- data/spec/board_spec.rb +70 -0
- data/spec/game_helper.rb +5 -0
- data/spec/game_spec.rb +79 -0
- data/spec/spec_helper.rb +100 -0
- data/spec/validator_spec.rb +26 -0
- data/vendor/bundle/bin/coderay +27 -0
- data/vendor/bundle/bin/pry +27 -0
- data/vendor/bundle/cache/coderay-1.1.2.gem +0 -0
- data/vendor/bundle/cache/colorize-0.8.1.gem +0 -0
- data/vendor/bundle/cache/method_source-0.9.2.gem +0 -0
- data/vendor/bundle/cache/pry-0.12.2.gem +0 -0
- data/vendor/bundle/cache/rb-readline-0.5.5.gem +0 -0
- data/vendor/bundle/gems/coderay-1.1.2/MIT-LICENSE +22 -0
- data/vendor/bundle/gems/coderay-1.1.2/README_INDEX.rdoc +123 -0
- data/vendor/bundle/gems/coderay-1.1.2/bin/coderay +215 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/duo.rb +81 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/_map.rb +17 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/comment_filter.rb +25 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/count.rb +39 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug.rb +49 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug_lint.rb +63 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/div.rb +23 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/encoder.rb +190 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/filter.rb +58 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/css.rb +65 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/numbering.rb +108 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/output.rb +166 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html.rb +333 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/json.rb +83 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lines_of_code.rb +45 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lint.rb +59 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/null.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/page.rb +24 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/span.rb +23 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/statistic.rb +95 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/terminal.rb +195 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/text.rb +46 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/token_kind_filter.rb +111 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/xml.rb +72 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/yaml.rb +50 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/for_redcloth.rb +95 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/file_type.rb +151 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin.rb +55 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin_host.rb +221 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/word_list.rb +72 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/_map.rb +24 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/c.rb +189 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/clojure.rb +217 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/cpp.rb +217 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/css.rb +196 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/debug.rb +75 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/delphi.rb +144 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/diff.rb +221 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/erb.rb +81 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/go.rb +208 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/groovy.rb +268 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/haml.rb +168 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/html.rb +275 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java/builtin_types.rb +421 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java.rb +174 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java_script.rb +237 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/json.rb +98 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/lua.rb +280 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/php.rb +527 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/python.rb +287 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/raydebug.rb +75 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/patterns.rb +178 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/string_state.rb +79 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby.rb +477 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sass.rb +232 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/scanner.rb +337 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sql.rb +169 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/taskpaper.rb +36 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/text.rb +26 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/xml.rb +17 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/yaml.rb +140 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners.rb +27 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/_map.rb +7 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/alpha.rb +153 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/style.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles.rb +15 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/token_kinds.rb +85 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens.rb +161 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens_proxy.rb +55 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/version.rb +3 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay.rb +284 -0
- data/vendor/bundle/gems/colorize-0.8.1/CHANGELOG +65 -0
- data/vendor/bundle/gems/colorize-0.8.1/LICENSE +339 -0
- data/vendor/bundle/gems/colorize-0.8.1/README.md +105 -0
- data/vendor/bundle/gems/colorize-0.8.1/Rakefile +13 -0
- data/vendor/bundle/gems/colorize-0.8.1/colorize.gemspec +36 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/class_methods.rb +120 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/instance_methods.rb +132 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize.rb +12 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorized_string.rb +19 -0
- data/vendor/bundle/gems/colorize-0.8.1/test/test_colorize.rb +164 -0
- data/vendor/bundle/gems/method_source-0.9.2/Gemfile +2 -0
- data/vendor/bundle/gems/method_source-0.9.2/LICENSE +25 -0
- data/vendor/bundle/gems/method_source-0.9.2/README.markdown +91 -0
- data/vendor/bundle/gems/method_source-0.9.2/Rakefile +81 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/code_helpers.rb +154 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/source_location.rb +138 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/version.rb +3 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source.rb +141 -0
- data/vendor/bundle/gems/method_source-0.9.2/method_source.gemspec +35 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/method_source/code_helpers_spec.rb +43 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/method_source_spec.rb +143 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/spec_helper.rb +101 -0
- data/vendor/bundle/gems/pry-0.12.2/CHANGELOG.md +953 -0
- data/vendor/bundle/gems/pry-0.12.2/LICENSE +25 -0
- data/vendor/bundle/gems/pry-0.12.2/README.md +390 -0
- data/vendor/bundle/gems/pry-0.12.2/bin/pry +8 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/basic_object.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/cli.rb +218 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_file.rb +110 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_range.rb +71 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/loc.rb +98 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code.rb +353 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code_object.rb +195 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/color_printer.rb +65 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/command.rb +723 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/command_set.rb +415 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/amend_line.rb +98 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang.rb +20 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang_pry.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/abstract_formatter.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/exception_formatter.rb +79 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/file_formatter.rb +71 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat.rb +63 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cd.rb +41 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_inspector.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_prompt.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/clear_screen.rb +14 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/code_collector.rb +167 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disable_pry.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disabled_commands.rb +2 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/easter_eggs.rb +112 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/exception_patcher.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/file_and_line_locator.rb +36 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit.rb +200 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit.rb +43 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_all.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_program.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/find_method.rb +191 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/fix_indent.rb +19 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_cd.rb +26 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_install.rb +32 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_list.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_open.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_readme.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_search.rb +40 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_stats.rb +83 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gist.rb +102 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/help.rb +164 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/hist.rb +181 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/import_set.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/install_command.rb +54 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/jump_to.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/list_inspectors.rb +35 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/constants.rb +58 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/formatter.rb +51 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/globals.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/grep.rb +19 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/instance_vars.rb +38 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/interrogatable.rb +18 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/jruby_hacks.rb +49 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_names.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_vars.rb +37 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb +69 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods.rb +54 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/self_methods.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls.rb +113 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/nesting.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/play.rb +102 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_backtrace.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_version.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/raise_up.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reload_code.rb +62 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reset.rb +18 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ri.rb +65 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/save_file.rb +61 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_command.rb +75 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_mode.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_doc.rb +81 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_info.rb +216 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_input.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_source.rb +53 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/stat.rb +40 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/switch_to.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/toggle_color.rb +24 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression/expression.rb +38 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression.rb +107 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/whereami.rb +197 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/wtf.rb +70 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/behavior.rb +255 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/convenience.rb +28 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/default.rb +159 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/memoization.rb +48 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config.rb +35 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/core_extensions.rb +142 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/editor.rb +128 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/exceptions.rb +76 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/forwardable.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/base_helpers.rb +200 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/command_helpers.rb +157 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/documentation_helpers.rb +76 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/platform.rb +58 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/table.rb +114 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/text.rb +115 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/history.rb +161 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/hooks.rb +171 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/indent.rb +408 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_completer.rb +265 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_lock.rb +130 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/inspector.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/last_exception.rb +61 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/disowned.rb +55 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/patcher.rb +122 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb +198 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method.rb +552 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/object_path.rb +83 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/output.rb +50 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pager.rb +250 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/platform.rb +91 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/plugins.rb +122 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/prompt.rb +145 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_class.rb +425 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_instance.rb +699 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl.rb +261 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl_file_loader.rb +73 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/ring.rb +84 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/rubygem.rb +84 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/LICENSE +20 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/commands.rb +195 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/option.rb +206 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop.rb +661 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/terminal.rb +91 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/evalable.rb +15 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/mockable.rb +14 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/pry_tester.rb +73 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/utility.rb +26 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/variables.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable.rb +70 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/version.rb +3 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module/candidate.rb +131 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module.rb +378 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry.rb +132 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/CHANGES +94 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/LICENSE +25 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/README.md +81 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/Rakefile +25 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/bench/_rl_adjust_point.rb +26 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline.rb +8 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline_with_completion.rb +18 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/tinyirb.rb +11 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rb-readline.rb +18 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline/version.rb +3 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline.rb +8920 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/readline.rb +539 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/rb-readline.gemspec +51 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/setup.rb +1585 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/support/filesystem_completion_helper.rb +53 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_completion.rb +100 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_filename_completion_proc.rb +88 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_history.rb +29 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_rbreadline.rb +23 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_readline.rb +221 -0
- data/vendor/bundle/specifications/coderay-1.1.2.gemspec +26 -0
- data/vendor/bundle/specifications/colorize-0.8.1.gemspec +38 -0
- data/vendor/bundle/specifications/method_source-0.9.2.gemspec +35 -0
- data/vendor/bundle/specifications/pry-0.12.2.gemspec +38 -0
- data/vendor/bundle/specifications/rb-readline-0.5.5.gemspec +39 -0
- metadata +363 -0
@@ -0,0 +1,287 @@
|
|
1
|
+
module CodeRay
|
2
|
+
module Scanners
|
3
|
+
|
4
|
+
# Scanner for Python. Supports Python 3.
|
5
|
+
#
|
6
|
+
# Based on pygments' PythonLexer, see
|
7
|
+
# http://dev.pocoo.org/projects/pygments/browser/pygments/lexers/agile.py.
|
8
|
+
class Python < Scanner
|
9
|
+
|
10
|
+
register_for :python
|
11
|
+
file_extension 'py'
|
12
|
+
|
13
|
+
KEYWORDS = [
|
14
|
+
'and', 'as', 'assert', 'break', 'class', 'continue', 'def',
|
15
|
+
'del', 'elif', 'else', 'except', 'finally', 'for',
|
16
|
+
'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not',
|
17
|
+
'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield',
|
18
|
+
'nonlocal', # new in Python 3
|
19
|
+
] # :nodoc:
|
20
|
+
|
21
|
+
OLD_KEYWORDS = [
|
22
|
+
'exec', 'print', # gone in Python 3
|
23
|
+
] # :nodoc:
|
24
|
+
|
25
|
+
PREDEFINED_METHODS_AND_TYPES = %w[
|
26
|
+
__import__ abs all any apply basestring bin bool buffer
|
27
|
+
bytearray bytes callable chr classmethod cmp coerce compile
|
28
|
+
complex delattr dict dir divmod enumerate eval execfile exit
|
29
|
+
file filter float frozenset getattr globals hasattr hash hex id
|
30
|
+
input int intern isinstance issubclass iter len list locals
|
31
|
+
long map max min next object oct open ord pow property range
|
32
|
+
raw_input reduce reload repr reversed round set setattr slice
|
33
|
+
sorted staticmethod str sum super tuple type unichr unicode
|
34
|
+
vars xrange zip
|
35
|
+
] # :nodoc:
|
36
|
+
|
37
|
+
PREDEFINED_EXCEPTIONS = %w[
|
38
|
+
ArithmeticError AssertionError AttributeError
|
39
|
+
BaseException DeprecationWarning EOFError EnvironmentError
|
40
|
+
Exception FloatingPointError FutureWarning GeneratorExit IOError
|
41
|
+
ImportError ImportWarning IndentationError IndexError KeyError
|
42
|
+
KeyboardInterrupt LookupError MemoryError NameError
|
43
|
+
NotImplemented NotImplementedError OSError OverflowError
|
44
|
+
OverflowWarning PendingDeprecationWarning ReferenceError
|
45
|
+
RuntimeError RuntimeWarning StandardError StopIteration
|
46
|
+
SyntaxError SyntaxWarning SystemError SystemExit TabError
|
47
|
+
TypeError UnboundLocalError UnicodeDecodeError
|
48
|
+
UnicodeEncodeError UnicodeError UnicodeTranslateError
|
49
|
+
UnicodeWarning UserWarning ValueError Warning ZeroDivisionError
|
50
|
+
] # :nodoc:
|
51
|
+
|
52
|
+
PREDEFINED_VARIABLES_AND_CONSTANTS = [
|
53
|
+
'False', 'True', 'None', # "keywords" since Python 3
|
54
|
+
'self', 'Ellipsis', 'NotImplemented',
|
55
|
+
] # :nodoc:
|
56
|
+
|
57
|
+
IDENT_KIND = WordList.new(:ident).
|
58
|
+
add(KEYWORDS, :keyword).
|
59
|
+
add(OLD_KEYWORDS, :old_keyword).
|
60
|
+
add(PREDEFINED_METHODS_AND_TYPES, :predefined).
|
61
|
+
add(PREDEFINED_VARIABLES_AND_CONSTANTS, :predefined_constant).
|
62
|
+
add(PREDEFINED_EXCEPTIONS, :exception) # :nodoc:
|
63
|
+
|
64
|
+
NAME = / [[:alpha:]_] \w* /x # :nodoc:
|
65
|
+
ESCAPE = / [abfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
|
66
|
+
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} | N\{[-\w ]+\} /x # :nodoc:
|
67
|
+
|
68
|
+
OPERATOR = /
|
69
|
+
\.\.\. | # ellipsis
|
70
|
+
\.(?!\d) | # dot but not decimal point
|
71
|
+
[,;:()\[\]{}] | # simple delimiters
|
72
|
+
\/\/=? | \*\*=? | # special math
|
73
|
+
[-+*\/%&|^]=? | # ordinary math and binary logic
|
74
|
+
[~`] | # binary complement and inspection
|
75
|
+
<<=? | >>=? | [<>=]=? | != # comparison and assignment
|
76
|
+
/x # :nodoc:
|
77
|
+
|
78
|
+
STRING_DELIMITER_REGEXP = Hash.new { |h, delimiter|
|
79
|
+
h[delimiter] = Regexp.union delimiter # :nodoc:
|
80
|
+
}
|
81
|
+
|
82
|
+
STRING_CONTENT_REGEXP = Hash.new { |h, delimiter|
|
83
|
+
h[delimiter] = / [^\\\n]+? (?= \\ | $ | #{Regexp.escape(delimiter)} ) /x # :nodoc:
|
84
|
+
}
|
85
|
+
|
86
|
+
DEF_NEW_STATE = WordList.new(:initial).
|
87
|
+
add(%w(def), :def_expected).
|
88
|
+
add(%w(import from), :include_expected).
|
89
|
+
add(%w(class), :class_expected) # :nodoc:
|
90
|
+
|
91
|
+
DESCRIPTOR = /
|
92
|
+
#{NAME}
|
93
|
+
(?: \. #{NAME} )*
|
94
|
+
| \*
|
95
|
+
/x # :nodoc:
|
96
|
+
|
97
|
+
DOCSTRING_COMING = /
|
98
|
+
[ \t]* u?r? ("""|''')
|
99
|
+
/x # :nodoc:
|
100
|
+
|
101
|
+
protected
|
102
|
+
|
103
|
+
def scan_tokens encoder, options
|
104
|
+
|
105
|
+
state = :initial
|
106
|
+
string_delimiter = nil
|
107
|
+
string_raw = false
|
108
|
+
string_type = nil
|
109
|
+
docstring_coming = match?(/#{DOCSTRING_COMING}/o)
|
110
|
+
last_token_dot = false
|
111
|
+
unicode = string.respond_to?(:encoding) && string.encoding.name == 'UTF-8'
|
112
|
+
from_import_state = []
|
113
|
+
|
114
|
+
until eos?
|
115
|
+
|
116
|
+
if state == :string
|
117
|
+
if match = scan(STRING_DELIMITER_REGEXP[string_delimiter])
|
118
|
+
encoder.text_token match, :delimiter
|
119
|
+
encoder.end_group string_type
|
120
|
+
string_type = nil
|
121
|
+
state = :initial
|
122
|
+
next
|
123
|
+
elsif string_delimiter.size == 3 && match = scan(/\n/)
|
124
|
+
encoder.text_token match, :content
|
125
|
+
elsif match = scan(STRING_CONTENT_REGEXP[string_delimiter])
|
126
|
+
encoder.text_token match, :content
|
127
|
+
elsif !string_raw && match = scan(/ \\ #{ESCAPE} /ox)
|
128
|
+
encoder.text_token match, :char
|
129
|
+
elsif match = scan(/ \\ #{UNICODE_ESCAPE} /ox)
|
130
|
+
encoder.text_token match, :char
|
131
|
+
elsif match = scan(/ \\ . /x)
|
132
|
+
encoder.text_token match, :content
|
133
|
+
elsif match = scan(/ \\ | $ /x)
|
134
|
+
encoder.end_group string_type
|
135
|
+
string_type = nil
|
136
|
+
encoder.text_token match, :error unless match.empty?
|
137
|
+
state = :initial
|
138
|
+
else
|
139
|
+
raise_inspect "else case \" reached; %p not handled." % peek(1), encoder, state
|
140
|
+
end
|
141
|
+
|
142
|
+
elsif match = scan(/ [ \t]+ | \\?\n /x)
|
143
|
+
encoder.text_token match, :space
|
144
|
+
if match == "\n"
|
145
|
+
state = :initial if state == :include_expected
|
146
|
+
docstring_coming = true if match?(/#{DOCSTRING_COMING}/o)
|
147
|
+
end
|
148
|
+
next
|
149
|
+
|
150
|
+
elsif match = scan(/ \# [^\n]* /mx)
|
151
|
+
encoder.text_token match, :comment
|
152
|
+
next
|
153
|
+
|
154
|
+
elsif state == :initial
|
155
|
+
|
156
|
+
if match = scan(/#{OPERATOR}/o)
|
157
|
+
encoder.text_token match, :operator
|
158
|
+
|
159
|
+
elsif match = scan(/(u?r?|b)?("""|"|'''|')/i)
|
160
|
+
modifiers = self[1]
|
161
|
+
string_delimiter = self[2]
|
162
|
+
string_type = docstring_coming ? :docstring : (modifiers == 'b' ? :binary : :string)
|
163
|
+
docstring_coming = false if docstring_coming
|
164
|
+
encoder.begin_group string_type
|
165
|
+
string_raw = false
|
166
|
+
unless modifiers.empty?
|
167
|
+
string_raw = !!modifiers.index(?r)
|
168
|
+
encoder.text_token modifiers, :modifier
|
169
|
+
match = string_delimiter
|
170
|
+
end
|
171
|
+
state = :string
|
172
|
+
encoder.text_token match, :delimiter
|
173
|
+
|
174
|
+
# TODO: backticks
|
175
|
+
|
176
|
+
elsif match = scan(unicode ? /#{NAME}/uo : /#{NAME}/o)
|
177
|
+
kind = IDENT_KIND[match]
|
178
|
+
# TODO: keyword arguments
|
179
|
+
kind = :ident if last_token_dot
|
180
|
+
if kind == :old_keyword
|
181
|
+
kind = check(/\(/) ? :ident : :keyword
|
182
|
+
elsif kind == :predefined && check(/ *=/)
|
183
|
+
kind = :ident
|
184
|
+
elsif kind == :keyword
|
185
|
+
state = DEF_NEW_STATE[match]
|
186
|
+
from_import_state << match.to_sym if state == :include_expected
|
187
|
+
end
|
188
|
+
encoder.text_token match, kind
|
189
|
+
|
190
|
+
elsif match = scan(/@[a-zA-Z0-9_.]+[lL]?/)
|
191
|
+
encoder.text_token match, :decorator
|
192
|
+
|
193
|
+
elsif match = scan(/0[xX][0-9A-Fa-f]+[lL]?/)
|
194
|
+
encoder.text_token match, :hex
|
195
|
+
|
196
|
+
elsif match = scan(/0[bB][01]+[lL]?/)
|
197
|
+
encoder.text_token match, :binary
|
198
|
+
|
199
|
+
elsif match = scan(/(?:\d*\.\d+|\d+\.\d*)(?:[eE][+-]?\d+)?|\d+[eE][+-]?\d+/)
|
200
|
+
if scan(/[jJ]/)
|
201
|
+
match << matched
|
202
|
+
encoder.text_token match, :imaginary
|
203
|
+
else
|
204
|
+
encoder.text_token match, :float
|
205
|
+
end
|
206
|
+
|
207
|
+
elsif match = scan(/0[oO][0-7]+|0[0-7]+(?![89.eE])[lL]?/)
|
208
|
+
encoder.text_token match, :octal
|
209
|
+
|
210
|
+
elsif match = scan(/\d+([lL])?/)
|
211
|
+
if self[1] == nil && scan(/[jJ]/)
|
212
|
+
match << matched
|
213
|
+
encoder.text_token match, :imaginary
|
214
|
+
else
|
215
|
+
encoder.text_token match, :integer
|
216
|
+
end
|
217
|
+
|
218
|
+
else
|
219
|
+
encoder.text_token getch, :error
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
elsif state == :def_expected
|
224
|
+
state = :initial
|
225
|
+
if match = scan(unicode ? /#{NAME}/uo : /#{NAME}/o)
|
226
|
+
encoder.text_token match, :method
|
227
|
+
else
|
228
|
+
next
|
229
|
+
end
|
230
|
+
|
231
|
+
elsif state == :class_expected
|
232
|
+
state = :initial
|
233
|
+
if match = scan(unicode ? /#{NAME}/uo : /#{NAME}/o)
|
234
|
+
encoder.text_token match, :class
|
235
|
+
else
|
236
|
+
next
|
237
|
+
end
|
238
|
+
|
239
|
+
elsif state == :include_expected
|
240
|
+
if match = scan(unicode ? /#{DESCRIPTOR}/uo : /#{DESCRIPTOR}/o)
|
241
|
+
if match == 'as'
|
242
|
+
encoder.text_token match, :keyword
|
243
|
+
from_import_state << :as
|
244
|
+
elsif from_import_state.first == :from && match == 'import'
|
245
|
+
encoder.text_token match, :keyword
|
246
|
+
from_import_state << :import
|
247
|
+
elsif from_import_state.last == :as
|
248
|
+
# encoder.text_token match, match[0,1][unicode ? /[[:upper:]]/u : /[[:upper:]]/] ? :class : :method
|
249
|
+
encoder.text_token match, :ident
|
250
|
+
from_import_state.pop
|
251
|
+
elsif IDENT_KIND[match] == :keyword
|
252
|
+
unscan
|
253
|
+
match = nil
|
254
|
+
state = :initial
|
255
|
+
next
|
256
|
+
else
|
257
|
+
encoder.text_token match, :include
|
258
|
+
end
|
259
|
+
elsif match = scan(/,/)
|
260
|
+
from_import_state.pop if from_import_state.last == :as
|
261
|
+
encoder.text_token match, :operator
|
262
|
+
else
|
263
|
+
from_import_state = []
|
264
|
+
state = :initial
|
265
|
+
next
|
266
|
+
end
|
267
|
+
|
268
|
+
else
|
269
|
+
raise_inspect 'Unknown state', encoder, state
|
270
|
+
|
271
|
+
end
|
272
|
+
|
273
|
+
last_token_dot = match == '.'
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
if state == :string
|
278
|
+
encoder.end_group string_type
|
279
|
+
end
|
280
|
+
|
281
|
+
encoder
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
module CodeRay
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# = Raydebug Scanner
|
7
|
+
#
|
8
|
+
# Highlights the output of the Encoders::Debug encoder.
|
9
|
+
class Raydebug < Scanner
|
10
|
+
|
11
|
+
register_for :raydebug
|
12
|
+
file_extension 'raydebug'
|
13
|
+
title 'CodeRay Token Dump'
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
@known_token_kinds = TokenKinds.keys.map(&:to_s).to_set
|
20
|
+
end
|
21
|
+
|
22
|
+
def scan_tokens encoder, options
|
23
|
+
|
24
|
+
opened_tokens = []
|
25
|
+
|
26
|
+
until eos?
|
27
|
+
|
28
|
+
if match = scan(/\s+/)
|
29
|
+
encoder.text_token match, :space
|
30
|
+
|
31
|
+
elsif match = scan(/ (\w+) \( ( [^\)\\]* ( \\. [^\)\\]* )* ) /x)
|
32
|
+
kind = self[1]
|
33
|
+
encoder.text_token kind, :class
|
34
|
+
encoder.text_token '(', :operator
|
35
|
+
match = self[2]
|
36
|
+
unless match.empty?
|
37
|
+
if @known_token_kinds.include? kind
|
38
|
+
encoder.text_token match, kind.to_sym
|
39
|
+
else
|
40
|
+
encoder.text_token match, :plain
|
41
|
+
end
|
42
|
+
end
|
43
|
+
encoder.text_token match, :operator if match = scan(/\)/)
|
44
|
+
|
45
|
+
elsif match = scan(/ (\w+) ([<\[]) /x)
|
46
|
+
encoder.text_token self[1], :class
|
47
|
+
if @known_token_kinds.include? self[1]
|
48
|
+
kind = self[1].to_sym
|
49
|
+
else
|
50
|
+
kind = :unknown
|
51
|
+
end
|
52
|
+
opened_tokens << kind
|
53
|
+
encoder.begin_group kind
|
54
|
+
encoder.text_token self[2], :operator
|
55
|
+
|
56
|
+
elsif !opened_tokens.empty? && match = scan(/ [>\]] /x)
|
57
|
+
encoder.text_token match, :operator
|
58
|
+
encoder.end_group opened_tokens.pop
|
59
|
+
|
60
|
+
else
|
61
|
+
encoder.text_token getch, :space
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
encoder.end_group opened_tokens.pop until opened_tokens.empty?
|
68
|
+
|
69
|
+
encoder
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module CodeRay
|
3
|
+
module Scanners
|
4
|
+
|
5
|
+
module Ruby::Patterns # :nodoc: all
|
6
|
+
|
7
|
+
KEYWORDS = %w[
|
8
|
+
and def end in or unless begin
|
9
|
+
defined? ensure module redo super until
|
10
|
+
BEGIN break do next rescue then
|
11
|
+
when END case else for retry
|
12
|
+
while alias class elsif if not return
|
13
|
+
undef yield
|
14
|
+
]
|
15
|
+
|
16
|
+
# See http://murfy.de/ruby-constants.
|
17
|
+
PREDEFINED_CONSTANTS = %w[
|
18
|
+
nil true false self
|
19
|
+
DATA ARGV ARGF ENV
|
20
|
+
FALSE TRUE NIL
|
21
|
+
STDERR STDIN STDOUT
|
22
|
+
TOPLEVEL_BINDING
|
23
|
+
RUBY_COPYRIGHT RUBY_DESCRIPTION RUBY_ENGINE RUBY_PATCHLEVEL
|
24
|
+
RUBY_PLATFORM RUBY_RELEASE_DATE RUBY_REVISION RUBY_VERSION
|
25
|
+
__FILE__ __LINE__ __ENCODING__
|
26
|
+
]
|
27
|
+
|
28
|
+
IDENT_KIND = WordList.new(:ident).
|
29
|
+
add(KEYWORDS, :keyword).
|
30
|
+
add(PREDEFINED_CONSTANTS, :predefined_constant)
|
31
|
+
|
32
|
+
KEYWORD_NEW_STATE = WordList.new(:initial).
|
33
|
+
add(%w[ def ], :def_expected).
|
34
|
+
add(%w[ undef ], :undef_expected).
|
35
|
+
add(%w[ alias ], :alias_expected).
|
36
|
+
add(%w[ class module ], :module_expected)
|
37
|
+
|
38
|
+
IDENT = 'ä'[/[[:alpha:]]/] == 'ä' ? Regexp.new('[[:alpha:]_[^\0-\177]][[:alnum:]_[^\0-\177]]*') : /[^\W\d]\w*/
|
39
|
+
|
40
|
+
METHOD_NAME = / #{IDENT} [?!]? /ox
|
41
|
+
METHOD_NAME_OPERATOR = /
|
42
|
+
\*\*? # multiplication and power
|
43
|
+
| [-+~]@? # plus, minus, tilde with and without at sign
|
44
|
+
| [\/%&|^`] # division, modulo or format strings, and, or, xor, system
|
45
|
+
| \[\]=? # array getter and setter
|
46
|
+
| << | >> # append or shift left, shift right
|
47
|
+
| <=?>? | >=? # comparison, rocket operator
|
48
|
+
| ===? | =~ # simple equality, case equality, match
|
49
|
+
| ![~=@]? # negation with and without at sign, not-equal and not-match
|
50
|
+
/ox
|
51
|
+
METHOD_SUFFIX = / (?: [?!] | = (?![~>]|=(?!>)) ) /x
|
52
|
+
METHOD_NAME_EX = / #{IDENT} #{METHOD_SUFFIX}? | #{METHOD_NAME_OPERATOR} /ox
|
53
|
+
METHOD_AFTER_DOT = / #{IDENT} [?!]? | #{METHOD_NAME_OPERATOR} /ox
|
54
|
+
INSTANCE_VARIABLE = / @ #{IDENT} /ox
|
55
|
+
CLASS_VARIABLE = / @@ #{IDENT} /ox
|
56
|
+
OBJECT_VARIABLE = / @@? #{IDENT} /ox
|
57
|
+
GLOBAL_VARIABLE = / \$ (?: #{IDENT} | [1-9]\d* | 0\w* | [~&+`'=\/,;_.<>!@$?*":\\] | -[a-zA-Z_0-9] ) /ox
|
58
|
+
PREFIX_VARIABLE = / #{GLOBAL_VARIABLE} | #{OBJECT_VARIABLE} /ox
|
59
|
+
VARIABLE = / @?@? #{IDENT} | #{GLOBAL_VARIABLE} /ox
|
60
|
+
|
61
|
+
QUOTE_TO_TYPE = {
|
62
|
+
'`' => :shell,
|
63
|
+
'/'=> :regexp,
|
64
|
+
}
|
65
|
+
QUOTE_TO_TYPE.default = :string
|
66
|
+
|
67
|
+
REGEXP_MODIFIERS = /[mousenix]*/
|
68
|
+
|
69
|
+
DECIMAL = /\d+(?:_\d+)*/
|
70
|
+
OCTAL = /0_?[0-7]+(?:_[0-7]+)*/
|
71
|
+
HEXADECIMAL = /0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/
|
72
|
+
BINARY = /0b[01]+(?:_[01]+)*/
|
73
|
+
|
74
|
+
EXPONENT = / [eE] [+-]? #{DECIMAL} /ox
|
75
|
+
FLOAT_SUFFIX = / #{EXPONENT} | \. #{DECIMAL} #{EXPONENT}? /ox
|
76
|
+
FLOAT_OR_INT = / #{DECIMAL} (?: #{FLOAT_SUFFIX} () )? /ox
|
77
|
+
NUMERIC = / (?: (?=0) (?: #{OCTAL} | #{HEXADECIMAL} | #{BINARY} ) | #{FLOAT_OR_INT} ) /ox
|
78
|
+
|
79
|
+
SYMBOL = /
|
80
|
+
:
|
81
|
+
(?:
|
82
|
+
#{METHOD_NAME_EX}
|
83
|
+
| #{PREFIX_VARIABLE}
|
84
|
+
| ['"]
|
85
|
+
)
|
86
|
+
/ox
|
87
|
+
METHOD_NAME_OR_SYMBOL = / #{METHOD_NAME_EX} | #{SYMBOL} /ox
|
88
|
+
|
89
|
+
SIMPLE_ESCAPE = /
|
90
|
+
[abefnrstv]
|
91
|
+
| [0-7]{1,3}
|
92
|
+
| x[0-9A-Fa-f]{1,2}
|
93
|
+
| .
|
94
|
+
/mx
|
95
|
+
|
96
|
+
CONTROL_META_ESCAPE = /
|
97
|
+
(?: M-|C-|c )
|
98
|
+
(?: \\ (?: M-|C-|c ) )*
|
99
|
+
(?: [^\\] | \\ #{SIMPLE_ESCAPE} )?
|
100
|
+
/mox
|
101
|
+
|
102
|
+
ESCAPE = /
|
103
|
+
#{CONTROL_META_ESCAPE} | #{SIMPLE_ESCAPE}
|
104
|
+
/mox
|
105
|
+
|
106
|
+
CHARACTER = /
|
107
|
+
\?
|
108
|
+
(?:
|
109
|
+
[^\s\\]
|
110
|
+
| \\ #{ESCAPE}
|
111
|
+
)
|
112
|
+
/mox
|
113
|
+
|
114
|
+
# NOTE: This is not completely correct, but
|
115
|
+
# nobody needs heredoc delimiters ending with \n.
|
116
|
+
HEREDOC_OPEN = /
|
117
|
+
<< ([-~])? # $1 = float
|
118
|
+
(?:
|
119
|
+
( [A-Za-z_0-9]+ ) # $2 = delim
|
120
|
+
|
|
121
|
+
( ["'`\/] ) # $3 = quote, type
|
122
|
+
( [^\n]*? ) \3 # $4 = delim
|
123
|
+
)
|
124
|
+
/mx
|
125
|
+
|
126
|
+
RUBYDOC = /
|
127
|
+
=begin (?!\S)
|
128
|
+
.*?
|
129
|
+
(?: \Z | ^=end (?!\S) [^\n]* )
|
130
|
+
/mx
|
131
|
+
|
132
|
+
DATA = /
|
133
|
+
__END__$
|
134
|
+
.*?
|
135
|
+
(?: \Z | (?=^\#CODE) )
|
136
|
+
/mx
|
137
|
+
|
138
|
+
RUBYDOC_OR_DATA = / #{RUBYDOC} | #{DATA} /xo
|
139
|
+
|
140
|
+
# Checks for a valid value to follow. This enables
|
141
|
+
# value_expected in method calls without parentheses.
|
142
|
+
VALUE_FOLLOWS = /
|
143
|
+
(?>[ \t\f\v]+)
|
144
|
+
(?:
|
145
|
+
[%\/][^\s=]
|
146
|
+
| <<-?\S
|
147
|
+
| [-+] \d
|
148
|
+
| #{CHARACTER}
|
149
|
+
)
|
150
|
+
/ox
|
151
|
+
KEYWORDS_EXPECTING_VALUE = WordList.new.add(%w[
|
152
|
+
and end in or unless begin
|
153
|
+
defined? ensure redo super until
|
154
|
+
break do next rescue then
|
155
|
+
when case else for retry
|
156
|
+
while elsif if not return
|
157
|
+
yield
|
158
|
+
])
|
159
|
+
|
160
|
+
FANCY_STRING_START = / % ( [iIqQrswWx] | (?![a-zA-Z0-9]) ) ([^a-zA-Z0-9]) /x
|
161
|
+
FANCY_STRING_KIND = Hash.new(:string).merge({
|
162
|
+
'i' => :symbol,
|
163
|
+
'I' => :symbol,
|
164
|
+
'r' => :regexp,
|
165
|
+
's' => :symbol,
|
166
|
+
'x' => :shell,
|
167
|
+
})
|
168
|
+
FANCY_STRING_INTERPRETED = Hash.new(true).merge({
|
169
|
+
'i' => false,
|
170
|
+
'q' => false,
|
171
|
+
's' => false,
|
172
|
+
'w' => false,
|
173
|
+
})
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
end
|