irb 1.1.0.pre.3 → 1.1.0.pre.4
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 +4 -4
- data/Gemfile +10 -0
- data/Rakefile +10 -0
- data/bin/console +6 -0
- data/bin/setup +6 -0
- data/doc/irb/irb-tools.rd.ja +184 -0
- data/doc/irb/irb.rd.ja +411 -0
- data/irb.gemspec +56 -1
- data/lib/irb.rb +31 -16
- data/lib/irb/color.rb +27 -12
- data/lib/irb/context.rb +36 -37
- data/lib/irb/ext/history.rb +45 -8
- data/lib/irb/init.rb +9 -9
- data/lib/irb/lc/help-message +7 -5
- data/lib/irb/lc/ja/help-message +6 -3
- data/lib/irb/ruby-lex.rb +11 -4
- data/lib/irb/ruby_logo.aa +38 -0
- data/lib/irb/version.rb +1 -1
- data/lib/irb/workspace.rb +3 -12
- data/man/irb.1 +207 -0
- metadata +11 -4
- data/lib/irb/ruby-token.rb +0 -267
data/lib/irb/init.rb
CHANGED
@@ -43,7 +43,7 @@ module IRB # :nodoc:
|
|
43
43
|
@CONF[:LOAD_MODULES] = []
|
44
44
|
@CONF[:IRB_RC] = nil
|
45
45
|
|
46
|
-
@CONF[:
|
46
|
+
@CONF[:USE_SINGLELINE] = false unless defined?(ReadlineInputMethod)
|
47
47
|
@CONF[:USE_COLORIZE] = true
|
48
48
|
@CONF[:INSPECT_MODE] = true
|
49
49
|
@CONF[:USE_TRACER] = false
|
@@ -161,14 +161,14 @@ module IRB # :nodoc:
|
|
161
161
|
end
|
162
162
|
when "--noinspect"
|
163
163
|
@CONF[:INSPECT_MODE] = false
|
164
|
-
when "--readline"
|
165
|
-
@CONF[:
|
166
|
-
when "--noreadline"
|
167
|
-
@CONF[:
|
168
|
-
when "--reidline"
|
169
|
-
@CONF[:
|
170
|
-
when "--noreidline"
|
171
|
-
@CONF[:
|
164
|
+
when "--singleline", "--readline"
|
165
|
+
@CONF[:USE_SINGLELINE] = true
|
166
|
+
when "--nosingleline", "--noreadline"
|
167
|
+
@CONF[:USE_SINGLELINE] = false
|
168
|
+
when "--multiline", "--reidline"
|
169
|
+
@CONF[:USE_MULTILINE] = true
|
170
|
+
when "--nomultiline", "--noreidline"
|
171
|
+
@CONF[:USE_MULTILINE] = false
|
172
172
|
when "--echo"
|
173
173
|
@CONF[:ECHO] = true
|
174
174
|
when "--noecho"
|
data/lib/irb/lc/help-message
CHANGED
@@ -22,17 +22,19 @@ Usage: irb.rb [options] [programfile] [arguments]
|
|
22
22
|
when new workspace was created
|
23
23
|
--echo Show result(default)
|
24
24
|
--noecho Don't show result
|
25
|
-
--inspect
|
26
|
-
--noinspect
|
27
|
-
--
|
28
|
-
--
|
25
|
+
--inspect Use `inspect' for output
|
26
|
+
--noinspect Don't use inspect for output
|
27
|
+
--multiline Use multiline editor module
|
28
|
+
--nomultiline Don't use multiline editor module
|
29
|
+
--singleline Use singleline editor module
|
30
|
+
--nosingleline Don't use singleline editor module
|
29
31
|
--colorize Use colorization
|
30
32
|
--nocolorize Don't use colorization
|
31
33
|
--prompt prompt-mode/--prompt-mode prompt-mode
|
32
34
|
Switch prompt mode. Pre-defined prompt modes are
|
33
35
|
`default', `simple', `xmp' and `inf-ruby'
|
34
36
|
--inf-ruby-mode Use prompt appropriate for inf-ruby-mode on emacs.
|
35
|
-
|
37
|
+
Suppresses --multiline and --singleline.
|
36
38
|
--sample-book-mode/--simple-prompt
|
37
39
|
Simple prompt mode
|
38
40
|
--noprompt No prompt mode
|
data/lib/irb/lc/ja/help-message
CHANGED
@@ -23,8 +23,10 @@ Usage: irb.rb [options] [programfile] [arguments]
|
|
23
23
|
--noecho 実行結果を表示しない.
|
24
24
|
--inspect 結果出力にinspectを用いる.
|
25
25
|
--noinspect 結果出力にinspectを用いない.
|
26
|
-
--
|
27
|
-
--
|
26
|
+
--multiline マルチラインエディタを利用する.
|
27
|
+
--nomultiline マルチラインエディタを利用しない.
|
28
|
+
--singleline シングルラインエディタを利用する.
|
29
|
+
--nosingleline シングルラインエディタを利用しない.
|
28
30
|
--colorize 色付けを利用する.
|
29
31
|
--nocolorize 色付けを利用しない.
|
30
32
|
--prompt prompt-mode/--prompt-mode prompt-mode
|
@@ -32,7 +34,8 @@ Usage: irb.rb [options] [programfile] [arguments]
|
|
32
34
|
ロンプトモードは, default, simple, xmp, inf-rubyが
|
33
35
|
用意されています.
|
34
36
|
--inf-ruby-mode emacsのinf-ruby-mode用のプロンプト表示を行なう. 特
|
35
|
-
|
37
|
+
に指定がない限り, シングルラインエディタとマルチラ
|
38
|
+
インエディタは使わなくなる.
|
36
39
|
--sample-book-mode/--simple-prompt
|
37
40
|
非常にシンプルなプロンプトを用いるモードです.
|
38
41
|
--noprompt プロンプト表示を行なわない.
|
data/lib/irb/ruby-lex.rb
CHANGED
@@ -71,20 +71,27 @@ class RubyLex
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
def ripper_lex_without_warning(code)
|
75
|
+
verbose, $VERBOSE = $VERBOSE, nil
|
76
|
+
tokens = Ripper.lex(code)
|
77
|
+
$VERBOSE = verbose
|
78
|
+
tokens
|
79
|
+
end
|
80
|
+
|
74
81
|
def set_auto_indent(context)
|
75
82
|
if @io.respond_to?(:auto_indent) and context.auto_indent_mode
|
76
83
|
@io.auto_indent do |lines, line_index, byte_pointer, is_newline|
|
77
84
|
if is_newline
|
78
85
|
md = lines[line_index - 1].match(/(\A +)/)
|
79
86
|
prev_spaces = md.nil? ? 0 : md[1].count(' ')
|
80
|
-
@tokens =
|
87
|
+
@tokens = ripper_lex_without_warning(lines[0..line_index].join("\n"))
|
81
88
|
depth_difference = check_newline_depth_difference
|
82
89
|
prev_spaces + depth_difference * 2
|
83
90
|
else
|
84
91
|
code = line_index.zero? ? '' : lines[0..(line_index - 1)].map{ |l| l + "\n" }.join
|
85
92
|
last_line = lines[line_index]&.byteslice(0, byte_pointer)
|
86
93
|
code += last_line if last_line
|
87
|
-
@tokens =
|
94
|
+
@tokens = ripper_lex_without_warning(code)
|
88
95
|
corresponding_token_depth = check_corresponding_token_depth
|
89
96
|
if corresponding_token_depth
|
90
97
|
corresponding_token_depth
|
@@ -97,7 +104,7 @@ class RubyLex
|
|
97
104
|
end
|
98
105
|
|
99
106
|
def check_state(code)
|
100
|
-
@tokens =
|
107
|
+
@tokens = ripper_lex_without_warning(code)
|
101
108
|
ltype = process_literal_type
|
102
109
|
indent = process_nesting_level
|
103
110
|
continue = process_continue
|
@@ -160,7 +167,7 @@ class RubyLex
|
|
160
167
|
end
|
161
168
|
code = @line + (line.nil? ? '' : line)
|
162
169
|
code.gsub!(/\s*\z/, '').concat("\n")
|
163
|
-
@tokens =
|
170
|
+
@tokens = ripper_lex_without_warning(code)
|
164
171
|
@continue = process_continue
|
165
172
|
@code_block_open = check_code_block(code)
|
166
173
|
@indent = process_nesting_level
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
-+smJYYN?mm-
|
3
|
+
HB"BBYT TQg NggT
|
4
|
+
9Q+g Nm,T 8g NJW
|
5
|
+
YS+ N2NJ"Sg N?
|
6
|
+
BQg #( gT Nggggk J
|
7
|
+
5j NJ NJ NNge
|
8
|
+
#Q #JJ NgT N(
|
9
|
+
@j bj mT J
|
10
|
+
Bj @/d NJ (
|
11
|
+
#q #(( NgT #J
|
12
|
+
5d #(t mT $d
|
13
|
+
#q @(@J NJB;
|
14
|
+
@( 5d ? HHH H HQmgggggggmN qD
|
15
|
+
5d #uN 2QdH E O
|
16
|
+
5 5JSd Nd NJH @d j
|
17
|
+
Fd @J4d s NQH #d (
|
18
|
+
#( #o6d Nd NgH #d #d
|
19
|
+
4 B&Od v NgT #d F
|
20
|
+
#( 9JGd NH NgUd F
|
21
|
+
#d #GJQ d NP $
|
22
|
+
#J #U+#Q N Q # j
|
23
|
+
j /W BQ+ BQ d NJ NJ
|
24
|
+
- NjJH HBIjTQggPJQgW N W k #J
|
25
|
+
#J b HYWgggN j s Nag d NN b #d
|
26
|
+
#J 5- D s Ngg N d Nd F
|
27
|
+
Fd BKH2 #+ s NNgg J Q J ]
|
28
|
+
F H @ J N y K(d P I
|
29
|
+
F4 E N? #d y #Q NJ E j
|
30
|
+
F W Nd q m Bg NxW N(H-
|
31
|
+
F d b @ m Hd gW vKJ
|
32
|
+
NJ d K d s Bg aT FDd
|
33
|
+
b # d N m BQ mV N>
|
34
|
+
e5 Nd #d NggggggQWH HHHH NJ -
|
35
|
+
m7 NW H N HSVO1z=?11-
|
36
|
+
NgTH bB kH WBHWWHBHWmQgg&gggggNNN
|
37
|
+
NNggggggNN
|
38
|
+
|
data/lib/irb/version.rb
CHANGED
data/lib/irb/workspace.rb
CHANGED
@@ -124,21 +124,12 @@ EOF
|
|
124
124
|
|
125
125
|
# error message manipulator
|
126
126
|
def filter_backtrace(bt)
|
127
|
+
return nil if bt =~ /irb\/.*\.rb/
|
128
|
+
return nil if bt =~ /irb\.rb/
|
127
129
|
case IRB.conf[:CONTEXT_MODE]
|
128
|
-
when 0
|
129
|
-
return nil if bt =~ /\(irb_local_binding\)/
|
130
130
|
when 1
|
131
|
-
if
|
132
|
-
bt =~ %r!irb/.*\.rb! or
|
133
|
-
bt =~ /irb\.rb/)
|
134
|
-
return nil
|
135
|
-
end
|
136
|
-
when 2
|
137
|
-
return nil if bt =~ /irb\/.*\.rb/
|
138
|
-
return nil if bt =~ /irb\.rb/
|
131
|
+
return nil if bt =~ %r!/tmp/irb-binding!
|
139
132
|
when 3
|
140
|
-
return nil if bt =~ /irb\/.*\.rb/
|
141
|
-
return nil if bt =~ /irb\.rb/
|
142
133
|
bt = bt.sub(/:\s*in `irb_binding'/, '')
|
143
134
|
end
|
144
135
|
bt
|
data/man/irb.1
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
.Dd August 11, 2019
|
3
|
+
.Dt IRB \&1 "Ruby Programmer's Reference Guide"
|
4
|
+
.Os UNIX
|
5
|
+
.Sh NAME
|
6
|
+
.Nm irb
|
7
|
+
.Nd Interactive Ruby Shell
|
8
|
+
.Sh SYNOPSIS
|
9
|
+
.Nm
|
10
|
+
.Op Fl -version
|
11
|
+
.Op Fl dfUw
|
12
|
+
.Op Fl I Ar directory
|
13
|
+
.Op Fl r Ar library
|
14
|
+
.Op Fl E Ar external Ns Op : Ns Ar internal
|
15
|
+
.Op Fl W Ns Op Ar level
|
16
|
+
.Op Fl - Ns Oo no Oc Ns inspect
|
17
|
+
.Op Fl - Ns Oo no Oc Ns multiline
|
18
|
+
.Op Fl - Ns Oo no Oc Ns singleline
|
19
|
+
.Op Fl - Ns Oo no Oc Ns echo
|
20
|
+
.Op Fl - Ns Oo no Oc Ns colorize
|
21
|
+
.Op Fl - Ns Oo no Oc Ns verbose
|
22
|
+
.Op Fl -prompt Ar mode
|
23
|
+
.Op Fl -prompt-mode Ar mode
|
24
|
+
.Op Fl -inf-ruby-mode
|
25
|
+
.Op Fl -simple-prompt
|
26
|
+
.Op Fl -noprompt
|
27
|
+
.Op Fl -tracer
|
28
|
+
.Op Fl -back-trace-limit Ar n
|
29
|
+
.Op Fl -
|
30
|
+
.Op program_file
|
31
|
+
.Op argument ...
|
32
|
+
.Pp
|
33
|
+
.Sh DESCRIPTION
|
34
|
+
.Nm
|
35
|
+
is the REPL(read-eval-print loop) environment for Ruby programs.
|
36
|
+
.Pp
|
37
|
+
.Sh OPTIONS
|
38
|
+
.Bl -tag -width "1234567890123" -compact
|
39
|
+
.Pp
|
40
|
+
.It Fl -version
|
41
|
+
Prints the version of
|
42
|
+
.Nm .
|
43
|
+
.Pp
|
44
|
+
.It Fl E Ar external Ns Op : Ns Ar internal
|
45
|
+
.It Fl -encoding Ar external Ns Op : Ns Ar internal
|
46
|
+
Same as `ruby -E' .
|
47
|
+
Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:).
|
48
|
+
.Pp
|
49
|
+
You can omit the one for internal encodings, then the value
|
50
|
+
.Pf ( Li "Encoding.default_internal" ) will be nil.
|
51
|
+
.Pp
|
52
|
+
.It Fl I Ar path
|
53
|
+
Same as `ruby -I' .
|
54
|
+
Specifies
|
55
|
+
.Li $LOAD_PATH
|
56
|
+
directory
|
57
|
+
.Pp
|
58
|
+
.It Fl U
|
59
|
+
Same as `ruby -U' .
|
60
|
+
Sets the default value for internal encodings
|
61
|
+
.Pf ( Li "Encoding.default_internal" ) to UTF-8.
|
62
|
+
.Pp
|
63
|
+
.It Fl d
|
64
|
+
Same as `ruby -d' .
|
65
|
+
Sets
|
66
|
+
.Li $DEBUG
|
67
|
+
to true.
|
68
|
+
.Pp
|
69
|
+
.It Fl f
|
70
|
+
Suppresses read of
|
71
|
+
.Pa ~/.irbrc .
|
72
|
+
.Pp
|
73
|
+
.It Fl w
|
74
|
+
Same as `ruby -w' .
|
75
|
+
.Pp
|
76
|
+
.Pp
|
77
|
+
.It Fl W
|
78
|
+
Same as `ruby -W' .
|
79
|
+
.Pp
|
80
|
+
.It Fl h
|
81
|
+
.It Fl -help
|
82
|
+
Prints a summary of the options.
|
83
|
+
.Pp
|
84
|
+
.It Fl r Ar library
|
85
|
+
Same as `ruby -r'.
|
86
|
+
Causes irb to load the library using require.
|
87
|
+
.Pp
|
88
|
+
.It Fl -inspect
|
89
|
+
Uses `inspect' for output (default except for bc mode)
|
90
|
+
.Pp
|
91
|
+
.It Fl -noinspect
|
92
|
+
Doesn't use inspect for output
|
93
|
+
.Pp
|
94
|
+
.It Fl -multiline
|
95
|
+
Uses multiline editor module.
|
96
|
+
.Pp
|
97
|
+
.It Fl -nomultiline
|
98
|
+
Doesn't use multiline editor module.
|
99
|
+
.Pp
|
100
|
+
.It Fl -singleline
|
101
|
+
Uses singleline editor module.
|
102
|
+
.Pp
|
103
|
+
.It Fl -nosingleline
|
104
|
+
Doesn't use singleline editor module.
|
105
|
+
.Pp
|
106
|
+
.Pp
|
107
|
+
.It Fl -echo
|
108
|
+
Show result(default).
|
109
|
+
.Pp
|
110
|
+
.It Fl -noecho
|
111
|
+
Don't show result.
|
112
|
+
.Pp
|
113
|
+
.Pp
|
114
|
+
.It Fl -colorize
|
115
|
+
Use colorization.
|
116
|
+
.Pp
|
117
|
+
.It Fl -nocolorize
|
118
|
+
Don't use colorization.
|
119
|
+
.Pp
|
120
|
+
.Pp
|
121
|
+
.It Fl -verbose
|
122
|
+
Show details.
|
123
|
+
.Pp
|
124
|
+
.It Fl -noverbose
|
125
|
+
Don't show details.
|
126
|
+
.Pp
|
127
|
+
.It Fl -prompt Ar mode
|
128
|
+
.It Fl -prompt-mode Ar mode
|
129
|
+
Switch prompt mode. Pre-defined prompt modes are
|
130
|
+
`default', `simple', `xmp' and `inf-ruby'.
|
131
|
+
.Pp
|
132
|
+
.It Fl -inf-ruby-mode
|
133
|
+
Uses prompt appropriate for inf-ruby-mode on emacs.
|
134
|
+
Suppresses --multiline and --singleline.
|
135
|
+
.Pp
|
136
|
+
.It Fl -simple-prompt
|
137
|
+
Makes prompts simple.
|
138
|
+
.Pp
|
139
|
+
.It Fl -noprompt
|
140
|
+
No prompt mode.
|
141
|
+
.Pp
|
142
|
+
.It Fl -tracer
|
143
|
+
Displays trace for each execution of commands.
|
144
|
+
.Pp
|
145
|
+
.It Fl -back-trace-limit Ar n
|
146
|
+
Displays backtrace top
|
147
|
+
.Ar n
|
148
|
+
and tail
|
149
|
+
.Ar n Ns .
|
150
|
+
The default value is 16.
|
151
|
+
.El
|
152
|
+
.Pp
|
153
|
+
.Sh ENVIRONMENT
|
154
|
+
.Bl -tag -compact
|
155
|
+
.It Ev IRBRC
|
156
|
+
.Pp
|
157
|
+
.El
|
158
|
+
.Pp
|
159
|
+
Also
|
160
|
+
.Nm
|
161
|
+
depends on same variables as
|
162
|
+
.Xr ruby 1 .
|
163
|
+
.Pp
|
164
|
+
.Sh FILES
|
165
|
+
.Bl -tag -compact
|
166
|
+
.It Pa ~/.irbrc
|
167
|
+
Personal irb initialization.
|
168
|
+
.Pp
|
169
|
+
.El
|
170
|
+
.Pp
|
171
|
+
.Sh EXAMPLES
|
172
|
+
.Dl % irb
|
173
|
+
.Dl irb(main):001:0> Ic 1 + 1
|
174
|
+
.Dl 2
|
175
|
+
.Dl irb(main):002:0> Ic def t(x)
|
176
|
+
.Dl irb(main):003:1> Ic x + 1
|
177
|
+
.Dl irb(main):004:1> Ic end
|
178
|
+
.Dl => :t
|
179
|
+
.Dl irb(main):005:0> Ic t(3)
|
180
|
+
.Dl => 4
|
181
|
+
.Dl irb(main):006:0> Ic if t(3) == 4
|
182
|
+
.Dl irb(main):007:1> Ic p :ok
|
183
|
+
.Dl irb(main):008:1> Ic end
|
184
|
+
.Dl :ok
|
185
|
+
.Dl => :ok
|
186
|
+
.Dl irb(main):009:0> Ic quit
|
187
|
+
.Dl %
|
188
|
+
.Pp
|
189
|
+
.Sh SEE ALSO
|
190
|
+
.Xr ruby 1 .
|
191
|
+
.Pp
|
192
|
+
.Sh REPORTING BUGS
|
193
|
+
.Bl -bullet
|
194
|
+
.It
|
195
|
+
Security vulnerabilities should be reported via an email to
|
196
|
+
.Mt security@ruby-lang.org .
|
197
|
+
Reported problems will be published after being fixed.
|
198
|
+
.Pp
|
199
|
+
.It
|
200
|
+
Other bugs and feature requests can be reported via the
|
201
|
+
Ruby Issue Tracking System
|
202
|
+
.Pq Lk https://bugs.ruby-lang.org/ .
|
203
|
+
Do not report security vulnerabilities
|
204
|
+
via this system because it publishes the vulnerabilities immediately.
|
205
|
+
.El
|
206
|
+
.Sh AUTHORS
|
207
|
+
Written by Keiju ISHITSUKA.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.pre.
|
4
|
+
version: 1.1.0.pre.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiju ISHITSUKA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reline
|
@@ -60,8 +60,14 @@ executables:
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- Gemfile
|
63
64
|
- LICENSE.txt
|
64
65
|
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- bin/console
|
68
|
+
- bin/setup
|
69
|
+
- doc/irb/irb-tools.rd.ja
|
70
|
+
- doc/irb/irb.rd.ja
|
65
71
|
- exe/irb
|
66
72
|
- irb.gemspec
|
67
73
|
- lib/irb.rb
|
@@ -100,13 +106,14 @@ files:
|
|
100
106
|
- lib/irb/notifier.rb
|
101
107
|
- lib/irb/output-method.rb
|
102
108
|
- lib/irb/ruby-lex.rb
|
103
|
-
- lib/irb/
|
109
|
+
- lib/irb/ruby_logo.aa
|
104
110
|
- lib/irb/slex.rb
|
105
111
|
- lib/irb/src_encoding.rb
|
106
112
|
- lib/irb/version.rb
|
107
113
|
- lib/irb/workspace.rb
|
108
114
|
- lib/irb/ws-for-case-2.rb
|
109
115
|
- lib/irb/xmp.rb
|
116
|
+
- man/irb.1
|
110
117
|
homepage: https://github.com/ruby/irb
|
111
118
|
licenses:
|
112
119
|
- BSD-2-Clause
|
@@ -126,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
133
|
- !ruby/object:Gem::Version
|
127
134
|
version: 1.3.1
|
128
135
|
requirements: []
|
129
|
-
rubygems_version: 3.0.
|
136
|
+
rubygems_version: 3.0.6
|
130
137
|
signing_key:
|
131
138
|
specification_version: 4
|
132
139
|
summary: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
|