(https://github.com/ruby/irb/pull/569)
We don't have to load another file to define the legacy encoding aliases
map because there's only one definition of it. We can define it in
locale.rb directly.
Also add --script option to turn the option back on.
Previously there wasn't a way to get an interactive IRB session
and access arguments provided on the command line.
Additionally, handle `-` as script as stdin. In Unix-like tools, `-`
means to take standard input instead of a file. This doesn't
result in exactly the same output for:
```
echo 'p ARGV' > args.rb; irb args.rb a b c
```
and
```
echo 'p ARGV' | irb - a b c
```
Due to how irb handles whether stdin is a tty.
However, this change allows use of `-` as a argument, instead of
giving an unrecognized switch error. This required some small
changes to context.rb (to handle `-` as standard input) and
input-method.rb (to have FileInputMethod accept IO arguments in
addition to strings).
Implements [Feature #15371]
https://github.com/ruby/irb/commit/4192683ba2
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
line options. [ruby-dev:37161]. Fixes#711.
improved long optinos.
* lib/irb/init.rb (IRB.set_encoding): new subroutine for IRB.opt_parse
* lib/irb/input-method.rb (IRB::StdioInputMethod): (M17N) regards
scripts that user types as encoded in the external_encoding.
* lib/irb/input-method.rb (IRB::ReadlineInputMethod): ditto.
* lib/irb/input-method.rb (IRB::FileInputMethod): (M17N) respects
magic comment.
* lib/irb/help.rb (IRB.print_usage): (M17N) respects magic comment
in the resource file.
* lib/irb/lc/help-message: adds -U and -E.
* lib/irb/lc/ja/help-message: ditto. re-encoded from ISO-2022-JP into UTF-8.
* lib/irb/lc/ja/encoding_aliases.rb: new file. provides Japanese specific
character encoding name table for backward compatibility.
* lib/irb/lc/ja/error.rb: re-eoncoded from ISO-2022-JP into UTF-8.
magic comment.
* lib/irb/locale.rb: integrated with Ruby 1.9's M17N support.
* lib/irb/magic-file.rb: new file. utility to handle files with magic
comment and opens in the correct encoding.
* lib/irb/ruby-lex.rb (RubyLex#each_top_level_statement): recovers
character encoding for a statement after it lexed so that irb can
eval the statement in correct encoding.
* lib/irb/src_encoding.rb: new file. utility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
change "illegal" to "invalid" in a context which doesn' t against
a law.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
irb. [ruby-dev:39243]
* sprintf.c (rb_f_sprintf): sign bit extension should not be done
if FPLUS flag is specified. [ruby-list:39224]
* sprintf.c (rb_f_sprintf): do not prepend dots for negative
numbers if FZERO is specified. [ruby-dev:39218]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e