mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merged my changes from HEAD
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40ca06cb4b
commit
09ac765b2f
10 changed files with 1841 additions and 75 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
Mon Jul 10 10:54:14 2006 Ryan Davis <ryand@zenspider.com>
|
||||||
|
|
||||||
|
* lib/rdoc/parsers/parse_f95.rb: massive overhaul from Yasuhiro
|
||||||
|
Morikawa including new file suffixes, function support, public
|
||||||
|
variables and constants, derived-types, defined operators and
|
||||||
|
assignments, namelists, and subroutine and function
|
||||||
|
arguments. Truly massive.
|
||||||
|
|
||||||
|
* lib/rdoc/diagram.rb: diagrams are now cached.
|
||||||
|
|
||||||
|
* lib/irb/completion.rb: fixed a crasher when completing against
|
||||||
|
an unnamed class/module.
|
||||||
|
|
||||||
|
* lib/rdoc/parsers/parse_c.rb: private comment (--/++) support in
|
||||||
|
C-file rdoc.
|
||||||
|
|
||||||
|
* lib/debug.rb: minor clarification in help.
|
||||||
|
|
||||||
|
* lib/pp.rb: minor clarification on exception.
|
||||||
|
|
||||||
Mon Jul 10 09:29:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Jul 10 09:29:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_clear_cache_for_undef): clear entries for included
|
* eval.c (rb_clear_cache_for_undef): clear entries for included
|
||||||
|
|
|
@ -26,6 +26,7 @@ matrix.rb
|
||||||
observer.rb
|
observer.rb
|
||||||
optparse.rb
|
optparse.rb
|
||||||
pathname.rb
|
pathname.rb
|
||||||
|
pp.rb
|
||||||
pstore.rb
|
pstore.rb
|
||||||
rational.rb
|
rational.rb
|
||||||
rinda
|
rinda
|
||||||
|
|
10
lib/debug.rb
10
lib/debug.rb
|
@ -255,6 +255,9 @@ class Context
|
||||||
|
|
||||||
def debug_command(file, line, id, binding)
|
def debug_command(file, line, id, binding)
|
||||||
MUTEX.lock
|
MUTEX.lock
|
||||||
|
unless defined?($debugger_restart) and $debugger_restart
|
||||||
|
callcc{|c| $debugger_restart = c}
|
||||||
|
end
|
||||||
set_last_thread(Thread.current)
|
set_last_thread(Thread.current)
|
||||||
frame_pos = 0
|
frame_pos = 0
|
||||||
binding_file = file
|
binding_file = file
|
||||||
|
@ -524,6 +527,9 @@ class Context
|
||||||
when /^\s*p\s+/
|
when /^\s*p\s+/
|
||||||
stdout.printf "%s\n", debug_eval($', binding).inspect
|
stdout.printf "%s\n", debug_eval($', binding).inspect
|
||||||
|
|
||||||
|
when /^\s*r(?:estart)?$/
|
||||||
|
$debugger_restart.call
|
||||||
|
|
||||||
when /^\s*h(?:elp)?$/
|
when /^\s*h(?:elp)?$/
|
||||||
debug_print_help()
|
debug_print_help()
|
||||||
|
|
||||||
|
@ -541,11 +547,11 @@ class Context
|
||||||
stdout.print <<EOHELP
|
stdout.print <<EOHELP
|
||||||
Debugger help v.-0.002b
|
Debugger help v.-0.002b
|
||||||
Commands
|
Commands
|
||||||
b[reak] [file|class:]<line|method>
|
b[reak] [file:|class:]<line|method>
|
||||||
b[reak] [class.]<line|method>
|
b[reak] [class.]<line|method>
|
||||||
set breakpoint to some position
|
set breakpoint to some position
|
||||||
wat[ch] <expression> set watchpoint to some expression
|
wat[ch] <expression> set watchpoint to some expression
|
||||||
cat[ch] <an Exception> set catchpoint to an exception
|
cat[ch] (<exception>|off) set catchpoint to an exception
|
||||||
b[reak] list breakpoints
|
b[reak] list breakpoints
|
||||||
cat[ch] show catchpoint
|
cat[ch] show catchpoint
|
||||||
del[ete][ nnn] delete some or all breakpoints
|
del[ete][ nnn] delete some or all breakpoints
|
||||||
|
|
|
@ -832,7 +832,7 @@ module DRb
|
||||||
begin
|
begin
|
||||||
Socket::gethostbyname(host)[0]
|
Socket::gethostbyname(host)[0]
|
||||||
rescue
|
rescue
|
||||||
host
|
'localhost'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -137,9 +137,10 @@ module IRB
|
||||||
else
|
else
|
||||||
# func1.func2
|
# func1.func2
|
||||||
candidates = []
|
candidates = []
|
||||||
|
name = m.name rescue ""
|
||||||
ObjectSpace.each_object(Module){|m|
|
ObjectSpace.each_object(Module){|m|
|
||||||
next if m.name != "IRB::Context" and
|
next if name != "IRB::Context" and
|
||||||
/^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name
|
/^(IRB|SLex|RubyLex|RubyToken)/ =~ name
|
||||||
candidates.concat m.instance_methods(false)
|
candidates.concat m.instance_methods(false)
|
||||||
}
|
}
|
||||||
candidates.sort!
|
candidates.sort!
|
||||||
|
|
|
@ -290,7 +290,7 @@ class PP < PrettyPrint
|
||||||
# implement #pretty_print, or a RuntimeError will be raised.
|
# implement #pretty_print, or a RuntimeError will be raised.
|
||||||
def pretty_print_inspect
|
def pretty_print_inspect
|
||||||
if /\(PP::ObjectMixin\)#/ =~ method(:pretty_print).inspect
|
if /\(PP::ObjectMixin\)#/ =~ method(:pretty_print).inspect
|
||||||
raise "pretty_print is not overridden."
|
raise "pretty_print is not overridden for #{self.class}"
|
||||||
end
|
end
|
||||||
PP.singleline_pp(self, '')
|
PP.singleline_pp(self, '')
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,6 +38,7 @@ module RDoc
|
||||||
@options = options
|
@options = options
|
||||||
@counter = 0
|
@counter = 0
|
||||||
File.makedirs(DOT_PATH)
|
File.makedirs(DOT_PATH)
|
||||||
|
@diagram_cache = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Draw the diagrams. We traverse the files, drawing a diagram for
|
# Draw the diagrams. We traverse the files, drawing a diagram for
|
||||||
|
@ -55,7 +56,6 @@ module RDoc
|
||||||
@local_names = find_names(i)
|
@local_names = find_names(i)
|
||||||
@global_names = []
|
@global_names = []
|
||||||
@global_graph = graph = DOT::DOTDigraph.new('name' => 'TopLevel',
|
@global_graph = graph = DOT::DOTDigraph.new('name' => 'TopLevel',
|
||||||
'label' => i.file_absolute_name,
|
|
||||||
'fontname' => FONT,
|
'fontname' => FONT,
|
||||||
'fontsize' => '8',
|
'fontsize' => '8',
|
||||||
'bgcolor' => 'lightcyan1',
|
'bgcolor' => 'lightcyan1',
|
||||||
|
@ -73,7 +73,7 @@ module RDoc
|
||||||
end
|
end
|
||||||
add_classes(i, graph, i.file_relative_name)
|
add_classes(i, graph, i.file_relative_name)
|
||||||
|
|
||||||
i.diagram = convert_to_png("f_#{file_count}", graph, i.name)
|
i.diagram = convert_to_png("f_#{file_count}", graph)
|
||||||
|
|
||||||
# now go through and document each top level class and
|
# now go through and document each top level class and
|
||||||
# module independently
|
# module independently
|
||||||
|
@ -83,7 +83,6 @@ module RDoc
|
||||||
@global_names = []
|
@global_names = []
|
||||||
|
|
||||||
@global_graph = graph = DOT::DOTDigraph.new('name' => 'TopLevel',
|
@global_graph = graph = DOT::DOTDigraph.new('name' => 'TopLevel',
|
||||||
'label' => i.full_name,
|
|
||||||
'fontname' => FONT,
|
'fontname' => FONT,
|
||||||
'fontsize' => '8',
|
'fontsize' => '8',
|
||||||
'bgcolor' => 'lightcyan1',
|
'bgcolor' => 'lightcyan1',
|
||||||
|
@ -95,8 +94,7 @@ module RDoc
|
||||||
'fontsize' => 8)
|
'fontsize' => 8)
|
||||||
draw_module(mod, graph, true)
|
draw_module(mod, graph, true)
|
||||||
mod.diagram = convert_to_png("m_#{file_count}_#{count}",
|
mod.diagram = convert_to_png("m_#{file_count}_#{count}",
|
||||||
graph,
|
graph)
|
||||||
"Module: #{mod.name}")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
$stderr.puts unless @options.quiet
|
$stderr.puts unless @options.quiet
|
||||||
|
@ -280,7 +278,9 @@ module RDoc
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def convert_to_png(file_base, graph, name)
|
def convert_to_png(file_base, graph)
|
||||||
|
str = graph.to_s
|
||||||
|
return @diagram_cache[str] if @diagram_cache[str]
|
||||||
op_type = Options.instance.image_format
|
op_type = Options.instance.image_format
|
||||||
dotfile = File.join(DOT_PATH, file_base)
|
dotfile = File.join(DOT_PATH, file_base)
|
||||||
src = dotfile + ".dot"
|
src = dotfile + ".dot"
|
||||||
|
@ -292,7 +292,7 @@ module RDoc
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(src, 'w+' ) do |f|
|
File.open(src, 'w+' ) do |f|
|
||||||
f << graph.to_s << "\n"
|
f << str << "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
system "dot", "-T#{op_type}", src, "-o", dot
|
system "dot", "-T#{op_type}", src, "-o", dot
|
||||||
|
@ -300,7 +300,9 @@ module RDoc
|
||||||
# Now construct the imagemap wrapper around
|
# Now construct the imagemap wrapper around
|
||||||
# that png
|
# that png
|
||||||
|
|
||||||
return wrap_in_image_map(src, dot, name)
|
ret = wrap_in_image_map(src, dot)
|
||||||
|
@diagram_cache[str] = ret
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
# Extract the client-side image map from dot, and use it
|
# Extract the client-side image map from dot, and use it
|
||||||
|
@ -308,7 +310,7 @@ module RDoc
|
||||||
# <map>..<img> combination, suitable for inclusion on
|
# <map>..<img> combination, suitable for inclusion on
|
||||||
# the page
|
# the page
|
||||||
|
|
||||||
def wrap_in_image_map(src, dot, name)
|
def wrap_in_image_map(src, dot)
|
||||||
res = %{<map id="map" name="map">\n}
|
res = %{<map id="map" name="map">\n}
|
||||||
dot_map = `dot -Tismap #{src}`
|
dot_map = `dot -Tismap #{src}`
|
||||||
dot_map.each do |area|
|
dot_map.each do |area|
|
||||||
|
@ -326,7 +328,7 @@ module RDoc
|
||||||
res << "</map>\n"
|
res << "</map>\n"
|
||||||
# map_file = src.sub(/.dot/, '.map')
|
# map_file = src.sub(/.dot/, '.map')
|
||||||
# system("dot -Timap #{src} -o #{map_file}")
|
# system("dot -Timap #{src} -o #{map_file}")
|
||||||
res << %{<img src="#{dot}" usemap="#map" border="0" alt="#{name}" />}
|
res << %{<img src="#{dot}" usemap="#map" border="0" alt="#{dot}">}
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -114,7 +114,12 @@ module Generators
|
||||||
lookup = name
|
lookup = name
|
||||||
end
|
end
|
||||||
|
|
||||||
if /([A-Z].*)[.\#](.*)/ =~ lookup
|
# Find class, module, or method in class or module.
|
||||||
|
if /([A-Z]\w*)[.\#](\w+[!?=]?)/ =~ lookup
|
||||||
|
container = $1
|
||||||
|
method = $2
|
||||||
|
ref = @context.find_symbol(container, method)
|
||||||
|
elsif /([A-Za-z]\w*)[.\#](\w+(\([\.\w+\*\/\+\-\=\<\>]+\))?)/ =~ lookup
|
||||||
container = $1
|
container = $1
|
||||||
method = $2
|
method = $2
|
||||||
ref = @context.find_symbol(container, method)
|
ref = @context.find_symbol(container, method)
|
||||||
|
@ -206,12 +211,14 @@ module Generators
|
||||||
unless defined? @markup
|
unless defined? @markup
|
||||||
@markup = SM::SimpleMarkup.new
|
@markup = SM::SimpleMarkup.new
|
||||||
|
|
||||||
# class names, variable names, file names, or instance variables
|
# class names, variable names, or instance variables
|
||||||
@markup.add_special(/(
|
@markup.add_special(/(
|
||||||
\b([A-Z]\w*(::\w+)*[.\#]\w+) # A::B.meth
|
\w+(::\w+)*[.\#]\w+(\([\.\w+\*\/\+\-\=\<\>]+\))? # A::B.meth(**) (for operator in Fortran95)
|
||||||
|
| \#\w+(\([.\w\*\/\+\-\=\<\>]+\))? # meth(**) (for operator in Fortran95)
|
||||||
|
| \b([A-Z]\w*(::\w+)*[.\#]\w+) # A::B.meth
|
||||||
| \b([A-Z]\w+(::\w+)*) # A::B..
|
| \b([A-Z]\w+(::\w+)*) # A::B..
|
||||||
| \#\w+[!?=]? # #meth_name
|
| \#\w+[!?=]? # #meth_name
|
||||||
| \b\w+([_\/\.]+\w+)+[!?=]? # meth_name
|
| \b\w+([_\/\.]+\w+)*[!?=]? # meth_name
|
||||||
)/x,
|
)/x,
|
||||||
:CROSSREF)
|
:CROSSREF)
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,11 @@ module RDoc
|
||||||
$stderr.flush
|
$stderr.flush
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_private_comments(comment)
|
||||||
|
comment.gsub!(/\/?\*--(.*?)\/?\*\+\+/m, '')
|
||||||
|
comment.sub!(/\/?\*--.*/m, '')
|
||||||
|
end
|
||||||
|
|
||||||
# remove lines that are commented out that might otherwise get
|
# remove lines that are commented out that might otherwise get
|
||||||
# picked up when scanning for classes and methods
|
# picked up when scanning for classes and methods
|
||||||
|
|
||||||
|
@ -552,6 +557,8 @@ module RDoc
|
||||||
comment, params = $1, $2
|
comment, params = $1, $2
|
||||||
body_text = $&
|
body_text = $&
|
||||||
|
|
||||||
|
remove_private_comments(comment) if comment
|
||||||
|
|
||||||
# see if we can find the whole body
|
# see if we can find the whole body
|
||||||
|
|
||||||
re = Regexp.escape(body_text) + '[^(]*^\{.*?^\}'
|
re = Regexp.escape(body_text) + '[^(]*^\{.*?^\}'
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue