rubysl-irb 1.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/lib/irb/cmd/chws.rb +6 -6
- data/lib/irb/cmd/fork.rb +10 -10
- data/lib/irb/cmd/help.rb +24 -14
- data/lib/irb/cmd/load.rb +8 -7
- data/lib/irb/cmd/nop.rb +8 -8
- data/lib/irb/cmd/pushws.rb +6 -5
- data/lib/irb/cmd/subirb.rb +6 -7
- data/lib/irb/completion.rb +90 -58
- data/lib/irb/context.rb +197 -30
- data/lib/irb/ext/change-ws.rb +17 -10
- data/lib/irb/ext/history.rb +20 -10
- data/lib/irb/ext/loader.rb +22 -12
- data/lib/irb/ext/math-mode.rb +16 -6
- data/lib/irb/ext/multi-irb.rb +69 -24
- data/lib/irb/ext/save-history.rb +87 -37
- data/lib/irb/ext/tracer.rb +17 -7
- data/lib/irb/ext/use-loader.rb +14 -6
- data/lib/irb/ext/workspaces.rb +16 -6
- data/lib/irb/extend-command.rb +92 -34
- data/lib/irb/frame.rb +18 -5
- data/lib/irb/help.rb +20 -19
- data/lib/irb/init.rb +156 -104
- data/lib/irb/input-method.rb +96 -23
- data/lib/irb/inspector.rb +145 -0
- data/lib/irb/lc/.document +4 -0
- data/lib/irb/lc/error.rb +8 -7
- data/lib/irb/lc/{help-message.rb → help-message} +14 -11
- data/lib/irb/lc/ja/encoding_aliases.rb +10 -0
- data/lib/irb/lc/ja/error.rb +19 -16
- data/lib/irb/lc/ja/help-message +33 -28
- data/lib/irb/locale.rb +83 -85
- data/lib/irb/magic-file.rb +37 -0
- data/lib/irb/notifier.rb +101 -15
- data/lib/irb/output-method.rb +38 -32
- data/lib/irb/ruby-lex.rb +143 -81
- data/lib/irb/ruby-token.rb +13 -19
- data/lib/irb/slex.rb +26 -27
- data/lib/irb/src_encoding.rb +4 -0
- data/lib/irb/version.rb +6 -7
- data/lib/irb/workspace.rb +22 -15
- data/lib/irb/ws-for-case-2.rb +5 -6
- data/lib/irb/xmp.rb +91 -4
- data/lib/rubysl/irb/irb.rb +523 -175
- data/lib/rubysl/irb/version.rb +1 -1
- data/rubysl-irb.gemspec +7 -6
- metadata +35 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cc1caf272f42cf9753a854bfb67e228ba92fb34
|
4
|
+
data.tar.gz: dfc3cb9d5b6fdb2646931ad5eb34d772f1cd51e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb75aa61c78a8e7c60f57799901589ed62a1902286a21472fc2cca4add5aa30e317000e1f366ae63c98694b430247785425de66bf912130155bf1b46fc9465aa
|
7
|
+
data.tar.gz: ba69200e216aa59c3955ba9f1956d3eddb0d0bfd6531d2fb2522eb215e61e1ad4be02cafc8d8bbc3edb9b0497658bfa80207331e1781076beecf3c832652104b
|
data/.travis.yml
CHANGED
data/lib/irb/cmd/chws.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
#
|
2
|
-
# change-ws.rb -
|
3
|
-
# $Release Version: 0.9.
|
4
|
-
# $Revision
|
5
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
2
|
+
# change-ws.rb -
|
3
|
+
# $Release Version: 0.9.6$
|
4
|
+
# $Revision$
|
6
5
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
6
|
#
|
8
7
|
# --
|
9
8
|
#
|
10
|
-
#
|
9
|
+
#
|
11
10
|
#
|
12
11
|
|
13
12
|
require "irb/cmd/nop.rb"
|
14
13
|
require "irb/ext/change-ws.rb"
|
15
14
|
|
15
|
+
# :stopdoc:
|
16
16
|
module IRB
|
17
17
|
module ExtendCommand
|
18
18
|
|
@@ -30,4 +30,4 @@ module IRB
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
# :startdoc:
|
data/lib/irb/cmd/fork.rb
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
#
|
2
|
-
# fork.rb -
|
3
|
-
# $Release Version: 0.9.
|
4
|
-
# $Revision
|
5
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
2
|
+
# fork.rb -
|
3
|
+
# $Release Version: 0.9.6 $
|
4
|
+
# $Revision$
|
6
5
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
6
|
#
|
8
7
|
# --
|
9
8
|
#
|
10
|
-
#
|
9
|
+
#
|
11
10
|
#
|
12
11
|
|
13
|
-
@RCS_ID='-$Id
|
14
|
-
|
12
|
+
@RCS_ID='-$Id$-'
|
15
13
|
|
14
|
+
# :stopdoc:
|
16
15
|
module IRB
|
17
16
|
module ExtendCommand
|
18
17
|
class Fork<Nop
|
19
|
-
def execute
|
18
|
+
def execute
|
20
19
|
pid = send ExtendCommand.irb_original_method_name("fork")
|
21
|
-
unless pid
|
22
|
-
class<<self
|
20
|
+
unless pid
|
21
|
+
class << self
|
23
22
|
alias_method :exit, ExtendCommand.irb_original_method_name('exit')
|
24
23
|
end
|
25
24
|
if iterator?
|
@@ -35,5 +34,6 @@ module IRB
|
|
35
34
|
end
|
36
35
|
end
|
37
36
|
end
|
37
|
+
# :startdoc:
|
38
38
|
|
39
39
|
|
data/lib/irb/cmd/help.rb
CHANGED
@@ -1,31 +1,41 @@
|
|
1
1
|
#
|
2
2
|
# help.rb - helper using ri
|
3
|
-
# $Release Version: 0.9.
|
4
|
-
# $Revision
|
5
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
3
|
+
# $Release Version: 0.9.6$
|
4
|
+
# $Revision$
|
6
5
|
#
|
7
6
|
# --
|
8
7
|
#
|
9
|
-
#
|
8
|
+
#
|
10
9
|
#
|
11
10
|
|
12
11
|
require 'rdoc/ri/driver'
|
13
12
|
|
13
|
+
require "irb/cmd/nop.rb"
|
14
|
+
|
15
|
+
# :stopdoc:
|
14
16
|
module IRB
|
15
17
|
module ExtendCommand
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
class Help<Nop
|
19
|
+
begin
|
20
|
+
Ri = RDoc::RI::Driver.new
|
21
|
+
rescue SystemExit
|
22
|
+
else
|
23
|
+
def execute(*names)
|
24
|
+
if names.empty?
|
25
|
+
Ri.interactive
|
26
|
+
return
|
27
|
+
end
|
28
|
+
names.each do |name|
|
29
|
+
begin
|
30
|
+
Ri.display_name(name.to_s)
|
31
|
+
rescue RDoc::RI::Error
|
32
|
+
puts $!.message
|
33
|
+
end
|
25
34
|
end
|
35
|
+
nil
|
26
36
|
end
|
27
|
-
nil
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
31
40
|
end
|
41
|
+
# :startdoc:
|
data/lib/irb/cmd/load.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
#
|
2
|
-
# load.rb -
|
3
|
-
# $Release Version: 0.9.
|
4
|
-
# $Revision
|
5
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
2
|
+
# load.rb -
|
3
|
+
# $Release Version: 0.9.6$
|
4
|
+
# $Revision$
|
6
5
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
6
|
#
|
8
7
|
# --
|
9
8
|
#
|
10
|
-
#
|
9
|
+
#
|
11
10
|
#
|
12
11
|
|
13
12
|
require "irb/cmd/nop.rb"
|
14
13
|
require "irb/ext/loader"
|
15
14
|
|
15
|
+
# :stopdoc:
|
16
16
|
module IRB
|
17
17
|
module ExtendCommand
|
18
18
|
class Load<Nop
|
@@ -26,7 +26,7 @@ module IRB
|
|
26
26
|
|
27
27
|
class Require<Nop
|
28
28
|
include IrbLoader
|
29
|
-
|
29
|
+
|
30
30
|
def execute(file_name)
|
31
31
|
# return ruby_require(file_name) unless IRB.conf[:USE_LOADER]
|
32
32
|
|
@@ -45,7 +45,7 @@ module IRB
|
|
45
45
|
when /\.(so|o|sl)$/
|
46
46
|
return ruby_require(file_name)
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
begin
|
50
50
|
irb_load(f = file_name + ".rb")
|
51
51
|
$".push f
|
@@ -65,3 +65,4 @@ module IRB
|
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
68
|
+
# :startdoc:
|
data/lib/irb/cmd/nop.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
#
|
2
|
-
# nop.rb -
|
3
|
-
# $Release Version: 0.9.
|
4
|
-
# $Revision
|
5
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
2
|
+
# nop.rb -
|
3
|
+
# $Release Version: 0.9.6$
|
4
|
+
# $Revision$
|
6
5
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
6
|
#
|
8
7
|
# --
|
9
8
|
#
|
10
|
-
#
|
11
9
|
#
|
10
|
+
#
|
11
|
+
# :stopdoc:
|
12
12
|
module IRB
|
13
13
|
module ExtendCommand
|
14
14
|
class Nop
|
15
|
-
|
16
|
-
@RCS_ID='-$Id
|
15
|
+
|
16
|
+
@RCS_ID='-$Id$-'
|
17
17
|
|
18
18
|
def self.execute(conf, *opts)
|
19
19
|
command = new(conf)
|
@@ -36,4 +36,4 @@ module IRB
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
# :startdoc:
|
data/lib/irb/cmd/pushws.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
#
|
2
|
-
# change-ws.rb -
|
3
|
-
# $Release Version: 0.9.
|
4
|
-
# $Revision
|
5
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
2
|
+
# change-ws.rb -
|
3
|
+
# $Release Version: 0.9.6$
|
4
|
+
# $Revision$
|
6
5
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
6
|
#
|
8
7
|
# --
|
9
8
|
#
|
10
|
-
#
|
9
|
+
#
|
11
10
|
#
|
12
11
|
|
13
12
|
require "irb/cmd/nop.rb"
|
14
13
|
require "irb/ext/workspaces.rb"
|
15
14
|
|
15
|
+
# :stopdoc:
|
16
16
|
module IRB
|
17
17
|
module ExtendCommand
|
18
18
|
class Workspaces<Nop
|
@@ -36,4 +36,5 @@ module IRB
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
+
# :startdoc:
|
39
40
|
|
data/lib/irb/cmd/subirb.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# $Release Version: 0.9.5$
|
5
|
-
# $Revision: 11708 $
|
6
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
1
|
+
# multi.rb -
|
2
|
+
# $Release Version: 0.9.6$
|
3
|
+
# $Revision$
|
7
4
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
8
5
|
#
|
9
6
|
# --
|
10
7
|
#
|
11
|
-
#
|
8
|
+
#
|
12
9
|
#
|
13
10
|
|
14
11
|
require "irb/cmd/nop.rb"
|
15
12
|
require "irb/ext/multi-irb"
|
16
13
|
|
14
|
+
# :stopdoc:
|
17
15
|
module IRB
|
18
16
|
module ExtendCommand
|
19
17
|
class IrbCommand<Nop
|
@@ -41,3 +39,4 @@ module IRB
|
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
42
|
+
# :startdoc:
|
data/lib/irb/completion.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
#
|
2
|
-
# irb/completor.rb -
|
2
|
+
# irb/completor.rb -
|
3
3
|
# $Release Version: 0.9$
|
4
|
-
# $Revision
|
5
|
-
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
4
|
+
# $Revision$
|
6
5
|
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
7
6
|
# From Original Idea of shugo@ruby-lang.org
|
8
7
|
#
|
@@ -10,22 +9,24 @@
|
|
10
9
|
require "readline"
|
11
10
|
|
12
11
|
module IRB
|
13
|
-
module InputCompletor
|
12
|
+
module InputCompletor # :nodoc:
|
14
13
|
|
15
|
-
@RCS_ID='-$Id
|
14
|
+
@RCS_ID='-$Id$-'
|
16
15
|
|
16
|
+
# Set of reserved words used by Ruby, you should not use these for
|
17
|
+
# constants or variables
|
17
18
|
ReservedWords = [
|
18
19
|
"BEGIN", "END",
|
19
|
-
"alias", "and",
|
20
|
-
"begin", "break",
|
20
|
+
"alias", "and",
|
21
|
+
"begin", "break",
|
21
22
|
"case", "class",
|
22
23
|
"def", "defined", "do",
|
23
24
|
"else", "elsif", "end", "ensure",
|
24
|
-
"false", "for",
|
25
|
-
"if", "in",
|
26
|
-
"module",
|
25
|
+
"false", "for",
|
26
|
+
"if", "in",
|
27
|
+
"module",
|
27
28
|
"next", "nil", "not",
|
28
|
-
"or",
|
29
|
+
"or",
|
29
30
|
"redo", "rescue", "retry", "return",
|
30
31
|
"self", "super",
|
31
32
|
"then", "true",
|
@@ -33,19 +34,27 @@ module IRB
|
|
33
34
|
"when", "while",
|
34
35
|
"yield",
|
35
36
|
]
|
36
|
-
|
37
|
+
|
37
38
|
CompletionProc = proc { |input|
|
38
39
|
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding
|
39
|
-
|
40
|
+
|
40
41
|
# puts "input: #{input}"
|
41
42
|
|
42
43
|
case input
|
44
|
+
when /^((["'`]).*\2)\.([^.]*)$/
|
45
|
+
# String
|
46
|
+
receiver = $1
|
47
|
+
message = Regexp.quote($3)
|
48
|
+
|
49
|
+
candidates = String.instance_methods.collect{|m| m.to_s}
|
50
|
+
select_message(receiver, message, candidates)
|
51
|
+
|
43
52
|
when /^(\/[^\/]*\/)\.([^.]*)$/
|
44
53
|
# Regexp
|
45
54
|
receiver = $1
|
46
55
|
message = Regexp.quote($2)
|
47
56
|
|
48
|
-
candidates = Regexp.instance_methods
|
57
|
+
candidates = Regexp.instance_methods.collect{|m| m.to_s}
|
49
58
|
select_message(receiver, message, candidates)
|
50
59
|
|
51
60
|
when /^([^\]]*\])\.([^.]*)$/
|
@@ -53,7 +62,7 @@ module IRB
|
|
53
62
|
receiver = $1
|
54
63
|
message = Regexp.quote($2)
|
55
64
|
|
56
|
-
candidates = Array.instance_methods
|
65
|
+
candidates = Array.instance_methods.collect{|m| m.to_s}
|
57
66
|
select_message(receiver, message, candidates)
|
58
67
|
|
59
68
|
when /^([^\}]*\})\.([^.]*)$/
|
@@ -61,15 +70,16 @@ module IRB
|
|
61
70
|
receiver = $1
|
62
71
|
message = Regexp.quote($2)
|
63
72
|
|
64
|
-
candidates = Proc.instance_methods
|
73
|
+
candidates = Proc.instance_methods.collect{|m| m.to_s}
|
74
|
+
candidates |= Hash.instance_methods.collect{|m| m.to_s}
|
65
75
|
select_message(receiver, message, candidates)
|
66
|
-
|
76
|
+
|
67
77
|
when /^(:[^:.]*)$/
|
68
78
|
# Symbol
|
69
79
|
if Symbol.respond_to?(:all_symbols)
|
70
80
|
sym = $1
|
71
81
|
candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name}
|
72
|
-
candidates.grep(/^#{sym}/)
|
82
|
+
candidates.grep(/^#{Regexp.quote(sym)}/)
|
73
83
|
else
|
74
84
|
[]
|
75
85
|
end
|
@@ -77,72 +87,88 @@ module IRB
|
|
77
87
|
when /^::([A-Z][^:\.\(]*)$/
|
78
88
|
# Absolute Constant or class methods
|
79
89
|
receiver = $1
|
80
|
-
candidates = Object.constants
|
90
|
+
candidates = Object.constants.collect{|m| m.to_s}
|
81
91
|
candidates.grep(/^#{receiver}/).collect{|e| "::" + e}
|
82
92
|
|
83
|
-
when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/
|
93
|
+
# when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/
|
94
|
+
when /^([A-Z].*)::([^:.]*)$/
|
84
95
|
# Constant or class methods
|
85
96
|
receiver = $1
|
86
|
-
message = Regexp.quote($
|
97
|
+
message = Regexp.quote($2)
|
87
98
|
begin
|
88
|
-
candidates = eval("#{receiver}.constants
|
99
|
+
candidates = eval("#{receiver}.constants.collect{|m| m.to_s}", bind)
|
100
|
+
candidates |= eval("#{receiver}.methods.collect{|m| m.to_s}", bind)
|
89
101
|
rescue Exception
|
90
102
|
candidates = []
|
91
103
|
end
|
92
|
-
|
104
|
+
select_message(receiver, message, candidates, "::")
|
93
105
|
|
94
|
-
when /^(:[^:.]+)
|
106
|
+
when /^(:[^:.]+)(\.|::)([^.]*)$/
|
95
107
|
# Symbol
|
96
108
|
receiver = $1
|
97
|
-
|
109
|
+
sep = $2
|
110
|
+
message = Regexp.quote($3)
|
98
111
|
|
99
|
-
candidates = Symbol.instance_methods
|
100
|
-
select_message(receiver, message, candidates)
|
112
|
+
candidates = Symbol.instance_methods.collect{|m| m.to_s}
|
113
|
+
select_message(receiver, message, candidates, sep)
|
101
114
|
|
102
|
-
when /^(-?(0[dbo])?[0-9_]+(\.[0-9_]+)?([eE]-?[0-9]+)?)
|
115
|
+
when /^(-?(0[dbo])?[0-9_]+(\.[0-9_]+)?([eE]-?[0-9]+)?)(\.|::)([^.]*)$/
|
103
116
|
# Numeric
|
104
117
|
receiver = $1
|
105
|
-
|
118
|
+
sep = $5
|
119
|
+
message = Regexp.quote($6)
|
106
120
|
|
107
121
|
begin
|
108
|
-
candidates = eval(receiver, bind).methods
|
122
|
+
candidates = eval(receiver, bind).methods.collect{|m| m.to_s}
|
109
123
|
rescue Exception
|
110
124
|
candidates = []
|
111
125
|
end
|
112
|
-
select_message(receiver, message, candidates)
|
126
|
+
select_message(receiver, message, candidates, sep)
|
113
127
|
|
114
|
-
when /^(-?0x[0-9a-fA-F_]+)
|
128
|
+
when /^(-?0x[0-9a-fA-F_]+)(\.|::)([^.]*)$/
|
115
129
|
# Numeric(0xFFFF)
|
116
130
|
receiver = $1
|
117
|
-
|
131
|
+
sep = $2
|
132
|
+
message = Regexp.quote($3)
|
118
133
|
|
119
134
|
begin
|
120
|
-
candidates = eval(receiver, bind).methods
|
135
|
+
candidates = eval(receiver, bind).methods.collect{|m| m.to_s}
|
121
136
|
rescue Exception
|
122
137
|
candidates = []
|
123
138
|
end
|
124
|
-
select_message(receiver, message, candidates)
|
139
|
+
select_message(receiver, message, candidates, sep)
|
125
140
|
|
126
141
|
when /^(\$[^.]*)$/
|
127
|
-
|
142
|
+
# global var
|
143
|
+
regmessage = Regexp.new(Regexp.quote($1))
|
144
|
+
candidates = global_variables.collect{|m| m.to_s}.grep(regmessage)
|
128
145
|
|
129
146
|
# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/
|
130
|
-
when /^((\.?[^.]+)+)\.([^.]*)$/
|
131
|
-
|
147
|
+
# when /^((\.?[^.]+)+)\.([^.]*)$/
|
148
|
+
# when /^([^."].*)\.([^.]*)$/
|
149
|
+
when /^([^."].*)(\.|::)([^.]*)$/
|
150
|
+
# variable.func or func.func
|
132
151
|
receiver = $1
|
152
|
+
sep = $2
|
133
153
|
message = Regexp.quote($3)
|
134
154
|
|
135
|
-
gv = eval("global_variables", bind)
|
136
|
-
lv = eval("local_variables", bind)
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
155
|
+
gv = eval("global_variables", bind).collect{|m| m.to_s}
|
156
|
+
lv = eval("local_variables", bind).collect{|m| m.to_s}
|
157
|
+
iv = eval("instance_variables", bind).collect{|m| m.to_s}
|
158
|
+
cv = eval("self.class.constants", bind).collect{|m| m.to_s}
|
159
|
+
|
160
|
+
if (gv | lv | iv | cv).include?(receiver) or /^[A-Z]/ =~ receiver && /\./ !~ receiver
|
161
|
+
# foo.func and foo is var. OR
|
162
|
+
# foo::func and foo is var. OR
|
163
|
+
# foo::Const and foo is var. OR
|
143
164
|
# Foo::Bar.func
|
144
165
|
begin
|
145
|
-
candidates =
|
166
|
+
candidates = []
|
167
|
+
rec = eval(receiver, bind)
|
168
|
+
if sep == "::" and rec.kind_of?(Module)
|
169
|
+
candidates = rec.constants.collect{|m| m.to_s}
|
170
|
+
end
|
171
|
+
candidates |= rec.methods.collect{|m| m.to_s}
|
146
172
|
rescue Exception
|
147
173
|
candidates = []
|
148
174
|
end
|
@@ -155,14 +181,18 @@ module IRB
|
|
155
181
|
rescue Exception
|
156
182
|
name = ""
|
157
183
|
end
|
158
|
-
|
159
|
-
|
160
|
-
|
184
|
+
begin
|
185
|
+
next if name != "IRB::Context" and
|
186
|
+
/^(IRB|SLex|RubyLex|RubyToken)/ =~ name
|
187
|
+
rescue Exception
|
188
|
+
next
|
189
|
+
end
|
190
|
+
candidates.concat m.instance_methods(false).collect{|x| x.to_s}
|
161
191
|
}
|
162
192
|
candidates.sort!
|
163
193
|
candidates.uniq!
|
164
194
|
end
|
165
|
-
select_message(receiver, message, candidates)
|
195
|
+
select_message(receiver, message, candidates, sep)
|
166
196
|
|
167
197
|
when /^\.([^.]*)$/
|
168
198
|
# unknown(maybe String)
|
@@ -170,25 +200,26 @@ module IRB
|
|
170
200
|
receiver = ""
|
171
201
|
message = Regexp.quote($1)
|
172
202
|
|
173
|
-
candidates = String.instance_methods(true)
|
203
|
+
candidates = String.instance_methods(true).collect{|m| m.to_s}
|
174
204
|
select_message(receiver, message, candidates)
|
175
205
|
|
176
206
|
else
|
177
|
-
candidates = eval("methods | private_methods | local_variables | self.class.constants", bind)
|
178
|
-
|
207
|
+
candidates = eval("methods | private_methods | local_variables | instance_variables | self.class.constants", bind).collect{|m| m.to_s}
|
208
|
+
|
179
209
|
(candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/)
|
180
210
|
end
|
181
211
|
}
|
182
212
|
|
213
|
+
# Set of available operators in Ruby
|
183
214
|
Operators = ["%", "&", "*", "**", "+", "-", "/",
|
184
215
|
"<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
|
185
|
-
"[]", "[]=", "^",]
|
216
|
+
"[]", "[]=", "^", "!", "!=", "!~"]
|
186
217
|
|
187
|
-
def self.select_message(receiver, message, candidates)
|
218
|
+
def self.select_message(receiver, message, candidates, sep = ".")
|
188
219
|
candidates.grep(/^#{message}/).collect do |e|
|
189
220
|
case e
|
190
221
|
when /^[a-zA-Z_]/
|
191
|
-
receiver +
|
222
|
+
receiver + sep + e
|
192
223
|
when /^[0-9]/
|
193
224
|
when *Operators
|
194
225
|
#receiver + " " + e
|
@@ -199,7 +230,8 @@ module IRB
|
|
199
230
|
end
|
200
231
|
|
201
232
|
if Readline.respond_to?("basic_word_break_characters=")
|
202
|
-
Readline.basic_word_break_characters= " \t\n\"\\'`><=;|&{("
|
233
|
+
# Readline.basic_word_break_characters= " \t\n\"\\'`><=;|&{("
|
234
|
+
Readline.basic_word_break_characters= " \t\n`><=;|&{("
|
203
235
|
end
|
204
236
|
Readline.completion_append_character = nil
|
205
237
|
Readline.completion_proc = IRB::InputCompletor::CompletionProc
|