Commit graph

12086 commits

Author SHA1 Message Date
Nobuyoshi Nakada
4a31c1e45d
parse.y: continue after heredoc error
* parse.y: continue parsing the rest of the here-document starting
  line, after the terminator was not found.
2019-05-30 12:38:50 +09:00
Nobuyoshi Nakada
5b64d7ac6e
Colorize errors more
* lib/irb/color.rb (IRB::Color.colorize_code): colorize
  `compile_error` part as same as `on_parse_error`.
2019-05-29 22:09:54 +09:00
Nobuyoshi Nakada
1da5c73932
parse.y: fix state after ivar/cvar
* parse.y (parse_atmark): return EXPR_END or EXPR_ENDFN, depending
  on the previous state, even incomplete names consistently.
2019-05-29 21:42:58 +09:00
Nobuyoshi Nakada
068d327595
Colorize compile_error as same as on_parse_error 2019-05-29 13:34:19 +09:00
Nobuyoshi Nakada
cc66272e50
parse.y: flush invalid char 2019-05-29 13:24:24 +09:00
Yusuke Endoh
e04d10b28f test/rubygems/test_gem_stream_ui.rb (test_ask_for_password): extend the timeout
for Solaris.

20190528T191908Z.fail.html.gz
2019-05-29 13:01:53 +09:00
aycabta
3f13297923 Remove extra items because Reline::HISTORY is a sized queue 2019-05-29 10:04:58 +09:00
Takashi Kokubun
98ba116d40
Revert 3b7862c8e8 causing various CI hangs
and dependent commits c67934b1c3 and
f0d1dc5cee.

RubyCI and ci.rvm.jp are almost dead by timeout since this commit.

---

Revert "Skip a reline test hanging on Wercker since 3b7862c8e8"

This reverts commit f0d1dc5cee.

Revert "Remove extra items because Reline::HISTORY is a sized queue"

This reverts commit c67934b1c3.

Revert "Use existing instances for LineEditor and Config"

This reverts commit 3b7862c8e8.
2019-05-29 09:05:26 +09:00
Takashi Kokubun
f0d1dc5cee
Skip a reline test hanging on Wercker since 3b7862c8e8
like 5cedad1110
2019-05-29 08:08:54 +09:00
aycabta
c67934b1c3 Remove extra items because Reline::HISTORY is a sized queue 2019-05-29 05:58:33 +09:00
aycabta
3b7862c8e8 Use existing instances for LineEditor and Config 2019-05-29 05:53:44 +09:00
Nobuyoshi Nakada
c730c25354
parse.y: warn escaped whitespace
* parse.y (warn_space_char_code): warn whitespace characters
  escaped with meta/control prefix.
2019-05-29 00:00:26 +09:00
Yusuke Endoh
ae2a904ce9 Update the certificate files to make the test pass on Debian 10
The old certificate files (for example, test/rubygems/ca_cert.pem) were
signed by SHA1.  This message digest is considered too weak and rejected
by OpenSSL 1.1.1 or later.  Because of this, the test suite does not
pass on Debian 10.

20190527T123003Z.fail.html.gz#test%2Frubygems

This change regenerates the files.
A shell script for the regeneration (util/create_certs.sh) is also
added.
2019-05-28 10:07:29 +09:00
Nobuyoshi Nakada
1cdaa17a06
parse.y: numbered parameter symbol
* parse.y (parse_atmark): numbered parameter name is not allowed
  as a symbol regardless the context.
2019-05-28 09:00:02 +09:00
aycabta
57b4df07bc Use Reline.completer_quote_characters to complete 2019-05-28 08:38:55 +09:00
Nobuyoshi Nakada
8a2a5822ca
Colorize error part 2019-05-27 23:08:51 +09:00
Nobuyoshi Nakada
b4365e75fd
Do not make an incomplete escape a valid char 2019-05-27 23:08:48 +09:00
Nobuyoshi Nakada
c40003da25
Ripper#token
* parse.y (ripper_token): added Ripper#token which returns the
  current token string.  [EXPERIMENTAL]
2019-05-27 23:08:45 +09:00
Yusuke Endoh
43730256e8 open-uri: Regenerate server certificates for tests
OpenSSL 1.1.1 requires 2048 bits or more.  This change will fix:
20190527T003004Z.fail.html.gz#test%2Fopen-uri
2019-05-27 12:58:08 +09:00
Nobuyoshi Nakada
0aa9b003de
context.rb: hide wrapping lines
* 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.
2019-05-27 11:05:51 +09:00
Takashi Kokubun
64ee8900c8
Highlight global variable on IRB 2019-05-26 11:32:23 -07:00
Jeremy Evans
39eadca76b Add FrozenError#receiver
Similar to NameError#receiver, this returns the object on which
the modification was attempted.  This is useful as it can pinpoint
exactly what is frozen.  In many cases when a FrozenError is
raised, you cannot determine from the context which object is
frozen that you attempted to modify.

Users of the current rb_error_frozen C function will have to switch
to using rb_error_frozen_object or the new rb_frozen_error_raise
in order to set the receiver of the FrozenError.

To allow the receiver to be set from Ruby, support an optional
second argument to FrozenError#initialize.

Implements [Feature #15751]
2019-05-26 11:09:21 -07:00
Takashi Kokubun
897901283c
Refactor IRB color dispatch
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.
2019-05-26 11:03:57 -07:00
aycabta
1226791368 Support :@@cvar and : on colorize 2019-05-27 02:56:05 +09:00
Takashi Kokubun
e50aa359de
Make the imaginary color on IRB close to pry
and sorted the token names alphabetically.
2019-05-26 10:23:04 -07:00
Nobuyoshi Nakada
a43c637660
parse.y: broke the terminator condition down
* parse.y (here_document): broke the terminator condition down
  into each piece, the positional condition, resetting the
  dedented here-document indentation, and matching identifier.
  suppress a false warning by icc.
2019-05-27 00:40:30 +09:00
Nobuyoshi Nakada
4f2a7b8001
Colorize imaginary and rational literals 2019-05-26 23:46:14 +09:00
Nobuyoshi Nakada
2ce6365f9c
parse.y: adjust error indicator
* parse.y (parser_yylex): adjust the error indicator of unexpected
  fraction part.

before:
~~~
1.2.3
^~~
~~~

after:
~~~
1.2.3
   ^~
~~~
2019-05-26 18:47:52 +09:00
Nobuyoshi Nakada
5830889915
test/ruby/test_notimp.rb: Use EnvUtil.timeout for timeout scale factor 2019-05-26 18:24:06 +09:00
Yusuke Endoh
2df2cdcff0 test/ruby/test_process.rb: Use EnvUtil.timeout for timeout scale factor
20190526T052508Z.fail.html.gz
2019-05-26 17:25:16 +09:00
Yusuke Endoh
4668a3a9da test/lib/envutil.rb (EnvUtil.timeout): added.
It is a wrapper for Timeout.timeout with the scale factor applied.
2019-05-26 17:23:14 +09:00
Nobuyoshi Nakada
02b39daef8
Fix scanner event at invalid syntax
* parse.y (parser_yyerror, parser_compile_error): revert
  r67224 (e5d10cda07) "Flush erred
  token".
2019-05-26 16:24:33 +09:00
Yusuke Endoh
f20af9543f test/rubygems/test_gem_stream_ui.rb (test_ask): extend the timeout
for Solaris.

20190525T211908Z.fail.html.gz
2019-05-26 15:23:21 +09:00
Takashi Kokubun
aaf6c678d2
Handle keyword symbol in IRB::Color::SymbolState 2019-05-25 22:32:28 -07:00
Takashi Kokubun
52b09fcee1
Deal with more syntax highlight edge cases
Please refer to the tests again.
2019-05-25 22:29:16 -07:00
Takashi Kokubun
8aba3b7a04
Fix more unintended syntax highlights
See tests for what kind of things are fixed.
2019-05-25 22:07:32 -07:00
Takashi Kokubun
13f58eccda
Always color Symbol as Yellow on IRB::Color
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.
2019-05-25 20:47:33 -07:00
Yusuke Endoh
a516834b47 test/ruby/test_rubyoptions.rb (test_script_from_stdin): scale timeout
for Solaris.

20190525T131909Z.fail.html.gz
2019-05-26 09:48:38 +09:00
Takashi Kokubun
208ed56e57
Colorize empty embexpr more on IRB::Color 2019-05-25 14:15:08 -07:00
Takashi Kokubun
98be203704
Support some unhandled syntax highlight
Heredoc, %i, :Foo, { 'a': ... }, ...

:'a' is still half-broken.
2019-05-25 08:19:15 -07:00
Takashi Kokubun
ada64aa9e7
Clear IRB::Color escape sequence before newline
because otherwise prompt and other things could be polluted.
2019-05-25 07:49:15 -07:00
Takashi Kokubun
e2db9f4cc3
Add and use Reline::Unicode.escape_for_print 2019-05-25 07:10:09 -07:00
Takashi Kokubun
b83119be9e
Incremental syntax highlight for IRB source lines
Closes: https://github.com/ruby/ruby/pull/2202
2019-05-24 23:54:52 -07:00
Hiroshi SHIBATA
3c6e1a8cf9
Avoid to show warning message with unused variable. 2019-05-25 11:28:07 +09:00
aycabta
eb4e774711 Support Meta key in Reline 2019-05-24 23:38:40 +09:00
Nobuyoshi Nakada
2893550452
Mixed encoding error can continue to parse 2019-05-24 16:12:17 +09:00
Yusuke Endoh
498113d5d3 test/ruby/test_gc.rb (test_gc_stress_at_startup): extend time timeout
It fails on some CI environments.
20190524T003006Z.fail.html.gz
20190523T002505Z.fail.html.gz
2019-05-24 11:20:12 +09:00
Takashi Kokubun
1ee1e8fccd
Test GC.compact with MJIT again 2019-05-23 09:03:34 -07:00
manga_osyo
f5415a95ce
Add Time#ceil.
Closes: https://github.com/ruby/ruby/pull/2133
2019-05-23 22:30:19 +09:00
Takashi Kokubun
65637dae30
Test GC.compact on MJIT again 2019-05-23 00:07:16 -07:00