aboutsummaryrefslogtreecommitdiffstats
path: root/test/irb
Commit message (Collapse)AuthorAgeFilesLines
...
* Warn compile_error only when input is finishedTakashi Kokubun2019-05-311-3/+31
| | | | | | | | | | | | | | | | | | | | Let's say we are in progress to write `"foo"`: ``` irb> "fo ``` at this moment, nothing is wrong. It would be just a normal way to write `"foo"`. Prior to this commit, the `fo` part was warned because of 5b64d7ac6e7cbf759b859428f125539e58bac0bd. But I think warning such a normal input is not valuable for users. However, we'd like to warn `:@1` or `@@1` which is also a syntax error. Then this commit switches the syntax highlight based on whether the input text is finished or not. When it's not finished yet, it does not warn compile_error.
* Colorize errors moreNobuyoshi Nakada2019-05-291-0/+1
| | | | | * lib/irb/color.rb (IRB::Color.colorize_code): colorize `compile_error` part as same as `on_parse_error`.
* Colorize compile_error as same as on_parse_errorNobuyoshi Nakada2019-05-291-1/+1
|
* Colorize error partNobuyoshi Nakada2019-05-271-1/+3
|
* context.rb: hide wrapping linesNobuyoshi Nakada2019-05-271-0/+5
| | | | | | * lib/irb/context.rb (IRB::Context#evaluate): separate the code from wrapping lines to propagate the given exception, not to show the wrapping lines when SyntaxError.
* Highlight global variable on IRBTakashi Kokubun2019-05-261-0/+1
|
* Refactor IRB color dispatchTakashi Kokubun2019-05-261-1/+1
| | | | | | | | | | | | | | | The reason why we were checking lexer state in addition to token was that we do not want to colorize local variable, method call, etc., while they share the :on_ident token with a name of method definition which should be colored as blue. It means that we're concerned about the lexer state only for :on_ident. Thus we can skip checking lexer state for non-:on_ident tokens. This refactoring is based on that idea. Also, now we manage Ripper's lexer state as Integer (use `|` if you need to check multiple states). It should be faster than using Array of Integer because #any? block call is not needed.
* Support :@@cvar and : on colorizeaycabta2019-05-271-1/+1
|
* Make the imaginary color on IRB close to pryTakashi Kokubun2019-05-261-1/+1
| | | | and sorted the token names alphabetically.
* Colorize imaginary and rational literalsNobuyoshi Nakada2019-05-261-0/+2
|
* parse.y: adjust error indicatorNobuyoshi Nakada2019-05-261-1/+1
| | | | | | | | | | | | | | | | | * parse.y (parser_yylex): adjust the error indicator of unexpected fraction part. before: ~~~ 1.2.3 ^~~ ~~~ after: ~~~ 1.2.3 ^~ ~~~
* Fix scanner event at invalid syntaxNobuyoshi Nakada2019-05-261-1/+1
| | | | | | * parse.y (parser_yyerror, parser_compile_error): revert r67224 (e5d10cda07b23682e5e4e64d1324e4d3247d4785) "Flush erred token".
* Handle keyword symbol in IRB::Color::SymbolStateTakashi Kokubun2019-05-251-0/+1
|
* Deal with more syntax highlight edge casesTakashi Kokubun2019-05-251-1/+4
| | | | Please refer to the tests again.
* Fix more unintended syntax highlightsTakashi Kokubun2019-05-251-0/+12
| | | | See tests for what kind of things are fixed.
* Always color Symbol as Yellow on IRB::ColorTakashi Kokubun2019-05-251-2/+6
| | | | | | | | | | | | | | | | | | | Symbol color was made blue as a workaround because it was hard to distinguish `foo`s in `:foo` and `def foo; end` (both are :on_ident). But I wanted to make it yellow like pry. `:Struct` had the same problem in :on_const. Because the :on_const was also blue (but underlined and bold), it was not a big issue. While they're not so problematic since we got a workaround, we also had a more serious issue for highlighting a symbol like `:"a#{b}c"`. The first half was considered as Symbol and the last half was considered as String, because the colorizer did not have a state like a parser. To approach the last issue, I introduced `IRB::Color::SymbolState` which is a thin state manager knowing only "the token is Symbol or not". Having this module magically solves the first two problems as well. So now we can highlight Symbol as yellow in the perfect manner.
* Colorize empty embexpr more on IRB::ColorTakashi Kokubun2019-05-251-0/+1
|
* Support some unhandled syntax highlightTakashi Kokubun2019-05-251-0/+6
| | | | | | Heredoc, %i, :Foo, { 'a': ... }, ... :'a' is still half-broken.
* Clear IRB::Color escape sequence before newlineTakashi Kokubun2019-05-251-2/+16
| | | | because otherwise prompt and other things could be polluted.
* Add and use Reline::Unicode.escape_for_printTakashi Kokubun2019-05-251-0/+1
|
* Incremental syntax highlight for IRB source linesTakashi Kokubun2019-05-241-0/+3
| | | | Closes: https://github.com/ruby/ruby/pull/2202
* Copy config to make IRB::Context#use_colorize? functionalTakashi Kokubun2019-05-211-0/+4
| | | | | | on initialize This fixes https://github.com/ruby/ruby/pull/2188
* Add "require 'irb'" to use IRB.confaycabta2019-05-211-0/+1
|
* Use Ripper for IRBaycabta2019-04-301-108/+0
| | | | | The debug option of IRB is deleted because it's just for IRB's pure Ruby parser.
* make sync-default-gems GEM=irbTakashi Kokubun2019-04-281-0/+1
| | | | | | from https://github.com/ruby/irb/commit/e8e79d569ed59fe4ed4fbca968917ce799f02a5e. This colorizes Range object on IRB inspect.
* make sync-default-gems GEM=irbTakashi Kokubun2019-04-281-7/+2
| | | | | | | from https://github.com/ruby/irb/commit/96f05e726879e9858eb015c8d043c9f52b864ff9. Just syncing newer test changes so that conflicts do not happen when trunk is modified and we need to backport that to ruby/irb.
* make sync-default-gems GEM=irbTakashi Kokubun2019-04-281-13/+9
| | | | | | from https://github.com/ruby/irb/commit/44301d382794d91e2caa16dd4efe62439e0041d8. This includes some fixes for string interpolation highlight fixes.
* * remove trailing spaces.git2019-04-281-1/+1
|
* make sync-default-gems GEM=irbTakashi Kokubun2019-04-281-0/+1
| | | | | | | | | from https://github.com/ruby/irb/commit/89e9add06da3fd5f9ce91a2f5fa0b0190aa5d42f. This adds syntax highlight support for Module on inspect. In addition to that, I'm adding a trailing space in test_color.rb for testing ruby-commit-hook's auto-style.
* make sync-default-gems GEM=irbTakashi Kokubun2019-04-274-5/+6
| | | | | Synced from https://github.com/ruby/irb/commit/5feb361ed80736efa5b2c2b629837ec2a5fc2cdb. This includes a support to colorize named Class instance on IRB inspect.
* make sync-default-gems GEM=irbTakashi Kokubun2019-04-271-1/+1
| | | | Backport changes from ruby/irb.
* suppress warning in test/irbnaruse2019-04-272-1/+4
| | | | | | | | https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos7/ruby-trunk/log/20190421T040003Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Re-committing https://github.com/ruby/ruby/commit/7f09b5e9da8f83f84c5b6ae7a644a562811fec73
* Revert "Class instance should be also colorable on IRB"Takashi Kokubun2019-04-261-1/+0
| | | | | | This reverts commit 6669c966d2744f21315047d1725ad4494d15b8ba. It seems to make tests fail... let me fix this later.
* Class instance should be also colorable on IRBTakashi Kokubun2019-04-261-0/+1
| | | | | | inspect. Change is made with: `$ make -C .ruby sync-default-gems GEM=irb`
* make sync-default-gems GEM=irbTakashi Kokubun2019-04-266-8/+151
| | | | from https://github.com/ruby/irb/commit/e6739d8c66dc78562930adb0b96935c9b38acf74
* Syntax-highlight yield in IRBTakashi Kokubun2019-04-261-0/+1
|
* Support highlighting Regexp in inspectTakashi Kokubun2019-04-261-0/+2
|
* Force IRB::Color to recognize TERMTakashi Kokubun2019-04-261-1/+19
| | | | Closes: https://github.com/ruby/ruby/pull/2150
* Colorize IRB's inspect resultTakashi Kokubun2019-04-261-0/+14
| | | | Closes: https://github.com/ruby/ruby/pull/2150
* Colorize IRB's code_around_bindingTakashi Kokubun2019-04-262-2/+41
| | | | Closes: https://github.com/ruby/ruby/pull/2150
* Remove unused variable and check if successednobu2019-04-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* suppress warning in test/irbnaruse2019-04-212-1/+4
| | | | | | https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos7/ruby-trunk/log/20190421T040003Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove IRB's old test filesaycabta2019-04-202-130/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Suppress read of ~/.irbrckazu2018-08-181-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* irb.rb: update `_`nobu2018-05-121-0/+23
| | | | | | | * lib/irb.rb (IRB::Irb#eval_input): update `_` after exception. [ruby-core:86989] [Bug #14749] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix TestInputMethodnobu2018-05-121-3/+3
| | | | | | | * test/irb/test_context.rb (TestInputMethod#initialize): fix typos and increment `line_no` only when not reaching the end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* irb.rb: restore the last errornobu2018-04-141-0/+9
| | | | | | | | | | * lib/irb.rb (eval_input): restore the last error `$!`, as the previous result. [Feature #14684] * lib/irb/context.rb (evaluate): add `exception` keyword argument to set the last error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* irb/{context,workspace}.rb: use local_variable_setnobu2018-04-141-0/+44
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* skip some tests so that no failure occurs in root privilegemame2018-01-101-0/+1
| | | | | | | | | | | | Some tests had failed on `sudo make test-all`, mainly because root can access any files regardless of permission. This change adds `skip` guards into such tests. Note that almost all tests in which `skip` guards is added, already have "windows" guard. This is because there is no support to avoid read access by owner on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* irb/test_init.rb: add test to ensure $0k0kubun2017-12-121-0/+6
| | | | | | | | | | | | is not changed. At first `ARGV.unshift('something')` was suggested for r61149, but it wasn't sufficient because it modifies $0. Not only to preserve ARGV, but also r61149 intends to preserve $0. This test prevents future breakage of the behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e