mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rdoc: Import RDoc 2.5.2
* lib/rdoc/parser/ruby.rb (RDoc::Parser::Ruby): Don't parse rdoc files, reverts r24976 in favor of include directive support in C parser. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ce2b574017
commit
1325437297
33 changed files with 395 additions and 162 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Sat Apr 10 15:18:26 2010 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* lib/rdoc: Import RDoc 2.5.2
|
||||||
|
* lib/rdoc/parser/ruby.rb (RDoc::Parser::Ruby): Don't parse rdoc
|
||||||
|
files, reverts r24976 in favor of include directive support in C
|
||||||
|
parser.
|
||||||
|
|
||||||
Sat Apr 10 13:14:22 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
Sat Apr 10 13:14:22 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* ext/openssl/ossl_ssl.c (Init_ossl_ssl): add SSLContext#ssl_timeout=,
|
* ext/openssl/ossl_ssl.c (Init_ossl_ssl): add SSLContext#ssl_timeout=,
|
||||||
|
|
4
NEWS
4
NEWS
|
@ -199,6 +199,10 @@ with all sufficient information, see the ChangeLog file.
|
||||||
|
|
||||||
http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/
|
http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/
|
||||||
|
|
||||||
|
* RDoc
|
||||||
|
|
||||||
|
* Updated to RDoc 2.5.2
|
||||||
|
|
||||||
* logger
|
* logger
|
||||||
|
|
||||||
* imported upstream version (logger/1.2.7)
|
* imported upstream version (logger/1.2.7)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
|
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
|
||||||
=begin rdoc
|
|
||||||
|
|
||||||
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
||||||
contents of a string. They're used for testing whether a string contains a
|
contents of a string. They're used for testing whether a string contains a
|
||||||
|
@ -580,5 +579,4 @@ backtracking needed.
|
||||||
|
|
||||||
Regexp.new('\A' 'a?' * 29 + 'a' * 29).match('a' * 29)
|
Regexp.new('\A' 'a?' * 29 + 'a' * 29).match('a' * 29)
|
||||||
#=> #<MatchData "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa">
|
#=> #<MatchData "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa">
|
||||||
=end
|
|
||||||
class Regexp; end
|
|
||||||
|
|
|
@ -383,7 +383,7 @@ module RDoc
|
||||||
##
|
##
|
||||||
# RDoc version you are using
|
# RDoc version you are using
|
||||||
|
|
||||||
VERSION = '2.5'
|
VERSION = '2.5.2'
|
||||||
|
|
||||||
##
|
##
|
||||||
# Name of the dotfile that contains the description of files to be processed
|
# Name of the dotfile that contains the description of files to be processed
|
||||||
|
|
|
@ -6,7 +6,7 @@ require 'rdoc/tokenstream'
|
||||||
|
|
||||||
class RDoc::AnyMethod < RDoc::CodeObject
|
class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
|
|
||||||
MARSHAL_VERSION = 0 # :nodoc:
|
MARSHAL_VERSION = 1 # :nodoc:
|
||||||
|
|
||||||
include Comparable
|
include Comparable
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
##
|
##
|
||||||
# Parameters for this method
|
# Parameters for this method
|
||||||
|
|
||||||
attr_overridable :params, :param, :parameters, :parameter
|
attr_accessor :params
|
||||||
|
|
||||||
##
|
##
|
||||||
# Different ways to call this method
|
# Different ways to call this method
|
||||||
|
@ -87,6 +87,7 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
@call_seq = nil
|
@call_seq = nil
|
||||||
@dont_rename_initialize = false
|
@dont_rename_initialize = false
|
||||||
@is_alias_for = nil
|
@is_alias_for = nil
|
||||||
|
@params = nil
|
||||||
@parent_name = nil
|
@parent_name = nil
|
||||||
@singleton = nil
|
@singleton = nil
|
||||||
@token_stream = nil
|
@token_stream = nil
|
||||||
|
@ -110,6 +111,19 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
@aliases << method
|
@aliases << method
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# The call_seq or the param_seq with method name, if there is no call_seq.
|
||||||
|
#
|
||||||
|
# Use this for displaying a method's argument lists.
|
||||||
|
|
||||||
|
def arglists
|
||||||
|
if @call_seq then
|
||||||
|
@call_seq
|
||||||
|
elsif @params then
|
||||||
|
"#{name}#{param_seq}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# HTML id-friendly method name
|
# HTML id-friendly method name
|
||||||
|
|
||||||
|
@ -151,6 +165,7 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
@call_seq,
|
@call_seq,
|
||||||
@block_params,
|
@block_params,
|
||||||
aliases,
|
aliases,
|
||||||
|
@params,
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -162,7 +177,6 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
# * #parent_name
|
# * #parent_name
|
||||||
|
|
||||||
def marshal_load(array)
|
def marshal_load(array)
|
||||||
@aliases = []
|
|
||||||
@dont_rename_initialize = nil
|
@dont_rename_initialize = nil
|
||||||
@is_alias_for = nil
|
@is_alias_for = nil
|
||||||
@token_stream = nil
|
@token_stream = nil
|
||||||
|
@ -174,6 +188,8 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
@comment = array[5]
|
@comment = array[5]
|
||||||
@call_seq = array[6]
|
@call_seq = array[6]
|
||||||
@block_params = array[7]
|
@block_params = array[7]
|
||||||
|
@aliases = array[8]
|
||||||
|
@params = array[9]
|
||||||
|
|
||||||
@parent_name = if @full_name =~ /#/ then
|
@parent_name = if @full_name =~ /#/ then
|
||||||
$`
|
$`
|
||||||
|
@ -201,16 +217,16 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
# Pretty parameter list for this method
|
# Pretty parameter list for this method
|
||||||
|
|
||||||
def param_seq
|
def param_seq
|
||||||
params = params.gsub(/\s*\#.*/, '')
|
params = @params.gsub(/\s*\#.*/, '')
|
||||||
params = params.tr("\n", " ").squeeze(" ")
|
params = params.tr("\n", " ").squeeze(" ")
|
||||||
params = "(#{params})" unless p[0] == ?(
|
params = "(#{params})" unless params[0] == ?(
|
||||||
|
|
||||||
if block = block_params then # yes, =
|
if @block_params then
|
||||||
# If this method has explicit block parameters, remove any explicit
|
# If this method has explicit block parameters, remove any explicit
|
||||||
# &block
|
# &block
|
||||||
params.sub!(/,?\s*&\w+/)
|
params.sub!(/,?\s*&\w+/, '')
|
||||||
|
|
||||||
block.gsub!(/\s*\#.*/, '')
|
block = @block_params.gsub(/\s*\#.*/, '')
|
||||||
block = block.tr("\n", " ").squeeze(" ")
|
block = block.tr("\n", " ").squeeze(" ")
|
||||||
if block[0] == ?(
|
if block[0] == ?(
|
||||||
block.sub!(/^\(/, '').sub!(/\)/, '')
|
block.sub!(/^\(/, '').sub!(/\)/, '')
|
||||||
|
|
|
@ -56,6 +56,12 @@ class RDoc::Attr < RDoc::CodeObject
|
||||||
##
|
##
|
||||||
# Returns nil, for duck typing with RDoc::AnyMethod
|
# Returns nil, for duck typing with RDoc::AnyMethod
|
||||||
|
|
||||||
|
def arglists
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Returns nil, for duck typing with RDoc::AnyMethod
|
||||||
|
|
||||||
def block_params
|
def block_params
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -132,6 +138,13 @@ class RDoc::Attr < RDoc::CodeObject
|
||||||
@parent_name || super
|
@parent_name || super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# For duck typing with RDoc::AnyMethod, returns nil
|
||||||
|
|
||||||
|
def params
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# URL path for this attribute
|
# URL path for this attribute
|
||||||
|
|
||||||
|
|
|
@ -146,10 +146,11 @@ class RDoc::ClassModule < RDoc::Context
|
||||||
|
|
||||||
def merge class_module
|
def merge class_module
|
||||||
comment = class_module.comment
|
comment = class_module.comment
|
||||||
|
|
||||||
if comment then
|
if comment then
|
||||||
document = parse @comment
|
document = parse @comment
|
||||||
|
|
||||||
comment.parts.concat(document.parts)
|
comment.parts.concat document.parts
|
||||||
|
|
||||||
@comment = comment
|
@comment = comment
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,25 +53,6 @@ class RDoc::CodeObject
|
||||||
|
|
||||||
attr_accessor :viewer
|
attr_accessor :viewer
|
||||||
|
|
||||||
##
|
|
||||||
# There's a wee trick we pull. Comment blocks can have directives that
|
|
||||||
# override the stuff we extract during the parse. So, we have a special
|
|
||||||
# class method, attr_overridable, that lets code objects list those
|
|
||||||
# directives. When a comment is assigned, we then extract out any matching
|
|
||||||
# directives and update our object
|
|
||||||
|
|
||||||
def self.attr_overridable(name, *aliases)
|
|
||||||
@overridables ||= {}
|
|
||||||
|
|
||||||
attr_accessor name
|
|
||||||
|
|
||||||
aliases.unshift name
|
|
||||||
|
|
||||||
aliases.each do |directive_name|
|
|
||||||
@overridables[directive_name.to_s] = name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new CodeObject that will document itself and its children
|
# Creates a new CodeObject that will document itself and its children
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-
|
# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-
|
||||||
# vim: noet ts=2 sts=8 sw=2
|
# vim: noet ts=2 sts=8 sw=2
|
||||||
|
|
||||||
require 'pp'
|
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'erb'
|
require 'erb'
|
||||||
|
|
|
@ -463,7 +463,7 @@ class RDoc::Markup::Parser
|
||||||
token
|
token
|
||||||
when s.scan(/ +/) then
|
when s.scan(/ +/) then
|
||||||
[:INDENT, s.matched_size, *token_pos(pos)]
|
[:INDENT, s.matched_size, *token_pos(pos)]
|
||||||
when s.scan(/(=+)\s+/) then
|
when s.scan(/(=+)\s*/) then
|
||||||
level = s[1].length
|
level = s[1].length
|
||||||
level = 6 if level > 6
|
level = 6 if level > 6
|
||||||
@tokens << [:HEADER, level, *token_pos(pos)]
|
@tokens << [:HEADER, level, *token_pos(pos)]
|
||||||
|
|
|
@ -41,14 +41,13 @@ class RDoc::Markup::PreProcess
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Include a file, indenting it correctly.
|
# Include a file, indenting it correctly.
|
||||||
|
|
||||||
def include_file(name, indent)
|
def include_file(name, indent)
|
||||||
if full_name = find_include_file(name) then
|
if full_name = find_include_file(name) then
|
||||||
content = File.read full_name
|
content = File.read full_name
|
||||||
|
content = content.sub(/\A# .*coding[=:].*$/, '').lstrip
|
||||||
|
|
||||||
# strip leading '#'s, but only if all lines start with them
|
# strip leading '#'s, but only if all lines start with them
|
||||||
if content =~ /^[^#]/ then
|
if content =~ /^[^#]/ then
|
||||||
|
@ -57,7 +56,7 @@ class RDoc::Markup::PreProcess
|
||||||
content.gsub(/^#?/, indent)
|
content.gsub(/^#?/, indent)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
$stderr.puts "Couldn't find file to include '#{name}' from #{@input_file_name}"
|
warn "Couldn't find file to include '#{name}' from #{@input_file_name}"
|
||||||
''
|
''
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,10 +73,10 @@ class RDoc::Parser
|
||||||
true
|
true
|
||||||
elsif file =~ /erb\.rb$/ then
|
elsif file =~ /erb\.rb$/ then
|
||||||
false
|
false
|
||||||
elsif s.scan(/<%|%>/).length >= 4 then
|
elsif s.scan(/<%|%>/).length >= 4 || s.index("\x00") then
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
s.count("^ -~\t\r\n").fdiv(s.size) > 0.3 || s.index("\x00")
|
s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,7 +102,9 @@ class RDoc::Parser
|
||||||
return if parser == RDoc::Parser::Simple and zip? file_name
|
return if parser == RDoc::Parser::Simple and zip? file_name
|
||||||
|
|
||||||
# The default parser must not parse binary files
|
# The default parser must not parse binary files
|
||||||
return if parser == RDoc::Parser::Simple and file_name !~ /\.(txt|rdoc)$/
|
ext_name = File.extname file_name
|
||||||
|
return parser if ext_name.empty?
|
||||||
|
return if parser == RDoc::Parser::Simple and ext_name !~ /txt|rdoc/
|
||||||
|
|
||||||
parser
|
parser
|
||||||
end
|
end
|
||||||
|
|
|
@ -227,8 +227,8 @@ class RDoc::Parser::C < RDoc::Parser
|
||||||
next if var_name == "argf" # it'd be nice to handle this one
|
next if var_name == "argf" # it'd be nice to handle this one
|
||||||
|
|
||||||
var_name = "rb_cObject" if var_name == "rb_mKernel"
|
var_name = "rb_cObject" if var_name == "rb_mKernel"
|
||||||
handle_method(type, var_name, meth_name,
|
handle_method(type, var_name, meth_name, meth_body, param_count,
|
||||||
meth_body, param_count, source_file)
|
source_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
@content.scan(%r{rb_define_attr\(
|
@content.scan(%r{rb_define_attr\(
|
||||||
|
@ -397,7 +397,13 @@ class RDoc::Parser::C < RDoc::Parser
|
||||||
comment = $1
|
comment = $1
|
||||||
end
|
end
|
||||||
|
|
||||||
class_mod.comment = strip_stars comment if comment
|
return unless comment
|
||||||
|
|
||||||
|
comment = strip_stars comment
|
||||||
|
|
||||||
|
comment = look_for_directives_in class_mod, comment
|
||||||
|
|
||||||
|
class_mod.comment = comment
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -479,7 +485,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||||
end
|
end
|
||||||
|
|
||||||
unless enclosure then
|
unless enclosure then
|
||||||
warn("Enclosing class/module '#{in_module}' for #{type} #{class_name} not known")
|
warn "Enclosing class/module '#{in_module}' for #{type} #{class_name} not known"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -601,9 +607,9 @@ class RDoc::Parser::C < RDoc::Parser
|
||||||
meth_obj = RDoc::AnyMethod.new '', meth_name
|
meth_obj = RDoc::AnyMethod.new '', meth_name
|
||||||
meth_obj.singleton = %w[singleton_method module_function].include? type
|
meth_obj.singleton = %w[singleton_method module_function].include? type
|
||||||
|
|
||||||
p_count = (Integer(param_count) rescue -1)
|
p_count = Integer(param_count) rescue -1
|
||||||
|
|
||||||
if p_count < 0
|
if p_count < 0 then
|
||||||
meth_obj.params = "(...)"
|
meth_obj.params = "(...)"
|
||||||
elsif p_count == 0
|
elsif p_count == 0
|
||||||
meth_obj.params = "()"
|
meth_obj.params = "()"
|
||||||
|
@ -611,10 +617,14 @@ class RDoc::Parser::C < RDoc::Parser
|
||||||
meth_obj.params = "(" + (1..p_count).map{|i| "p#{i}"}.join(", ") + ")"
|
meth_obj.params = "(" + (1..p_count).map{|i| "p#{i}"}.join(", ") + ")"
|
||||||
end
|
end
|
||||||
|
|
||||||
if source_file and File.exist?(file_name = File.join(@file_dir, source_file)) then
|
if source_file then
|
||||||
body = (@@known_bodies[source_file] ||= File.read(file_name))
|
file_name = File.join @file_dir, source_file
|
||||||
elsif source_file then
|
|
||||||
warn "unknown source file #{source_file}"
|
if File.exist? file_name then
|
||||||
|
body = (@@known_bodies[file_name] ||= File.read(file_name))
|
||||||
|
else
|
||||||
|
warn "unknown source #{source_file} for #{meth_name} in #{@file_name}"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
body = @content
|
body = @content
|
||||||
end
|
end
|
||||||
|
@ -639,6 +649,34 @@ class RDoc::Parser::C < RDoc::Parser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Look for directives in a normal comment block:
|
||||||
|
#
|
||||||
|
# /*
|
||||||
|
# * :title: My Awesome Project
|
||||||
|
# */
|
||||||
|
#
|
||||||
|
# This routine modifies it's parameter
|
||||||
|
|
||||||
|
def look_for_directives_in(context, comment)
|
||||||
|
preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
|
||||||
|
|
||||||
|
preprocess.handle comment do |directive, param|
|
||||||
|
case directive
|
||||||
|
when 'main' then
|
||||||
|
@options.main_page = param
|
||||||
|
''
|
||||||
|
when 'title' then
|
||||||
|
@options.title = param
|
||||||
|
''
|
||||||
|
else
|
||||||
|
warn "Unrecognized directive :#{directive}:"
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
comment
|
||||||
|
end
|
||||||
##
|
##
|
||||||
# Removes lines that are commented out that might otherwise get picked up
|
# Removes lines that are commented out that might otherwise get picked up
|
||||||
# when scanning for classes and methods
|
# when scanning for classes and methods
|
||||||
|
|
|
@ -146,7 +146,7 @@ $TOKEN_DEBUG ||= nil
|
||||||
|
|
||||||
class RDoc::Parser::Ruby < RDoc::Parser
|
class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
parse_files_matching(/\.(?:rbw?|rdoc)\z/)
|
parse_files_matching(/\.rbw?$/)
|
||||||
|
|
||||||
include RDoc::RubyToken
|
include RDoc::RubyToken
|
||||||
include RDoc::TokenStream
|
include RDoc::TokenStream
|
||||||
|
@ -212,7 +212,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
def error(msg)
|
def error(msg)
|
||||||
msg = make_message msg
|
msg = make_message msg
|
||||||
$stderr.puts msg
|
$stderr.puts msg
|
||||||
exit(false)
|
exit false
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -377,10 +377,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# This routine modifies it's parameter
|
# This routine modifies it's parameter
|
||||||
|
|
||||||
def look_for_directives_in(context, comment)
|
def look_for_directives_in(context, comment)
|
||||||
preprocess = RDoc::Markup::PreProcess.new(@file_name,
|
preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
|
||||||
@options.rdoc_include)
|
|
||||||
|
|
||||||
preprocess.handle(comment) do |directive, param|
|
preprocess.handle comment do |directive, param|
|
||||||
case directive
|
case directive
|
||||||
when 'enddoc' then
|
when 'enddoc' then
|
||||||
throw :enddoc
|
throw :enddoc
|
||||||
|
@ -391,7 +390,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then
|
'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then
|
||||||
false # handled elsewhere
|
false # handled elsewhere
|
||||||
when 'section' then
|
when 'section' then
|
||||||
context.set_current_section(param, comment)
|
context.set_current_section param, comment
|
||||||
comment.replace ''
|
comment.replace ''
|
||||||
break
|
break
|
||||||
when 'startdoc' then
|
when 'startdoc' then
|
||||||
|
@ -405,7 +404,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
@options.title = param
|
@options.title = param
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
warn "Unrecognized directive '#{directive}'"
|
warn "Unrecognized directive :#{directive}:"
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1405,16 +1404,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_yield_parameters
|
|
||||||
parse_method_or_yield_parameters
|
|
||||||
end
|
|
||||||
|
|
||||||
def parse_yield(context, single, tk, method)
|
def parse_yield(context, single, tk, method)
|
||||||
if method.block_params.nil?
|
return if method.block_params
|
||||||
|
|
||||||
get_tkread
|
get_tkread
|
||||||
@scanner.instance_eval { @continue = false }
|
@scanner.instance_eval { @continue = false }
|
||||||
method.block_params = parse_yield_parameters
|
method.block_params = parse_method_or_yield_parameters
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -24,7 +24,10 @@ class RDoc::Parser::Simple < RDoc::Parser
|
||||||
# Extract the file contents and attach them to the TopLevel as a comment
|
# Extract the file contents and attach them to the TopLevel as a comment
|
||||||
|
|
||||||
def scan
|
def scan
|
||||||
@top_level.comment = remove_private_comments(@content)
|
comment = remove_coding_comment @content
|
||||||
|
comment = remove_private_comments comment
|
||||||
|
|
||||||
|
@top_level.comment = comment
|
||||||
@top_level.parser = self.class
|
@top_level.parser = self.class
|
||||||
@top_level
|
@top_level
|
||||||
end
|
end
|
||||||
|
@ -33,5 +36,9 @@ class RDoc::Parser::Simple < RDoc::Parser
|
||||||
comment.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
|
comment.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_coding_comment text
|
||||||
|
text.sub(/\A# .*coding[=:].*$/, '')
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -135,17 +135,17 @@ class RDoc::RDoc
|
||||||
def setup_output_dir(op_dir, force)
|
def setup_output_dir(op_dir, force)
|
||||||
flag_file = output_flag_file op_dir
|
flag_file = output_flag_file op_dir
|
||||||
|
|
||||||
last = @last_created
|
last = {}
|
||||||
|
|
||||||
if File.exist? op_dir then
|
if File.exist? op_dir then
|
||||||
unless File.directory? op_dir then
|
unless File.directory? op_dir then
|
||||||
error "'#{op_dir}' exists, and is not a directory"
|
error "'#{op_dir}' exists, and is not a directory"
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
open(flag_file) do |f|
|
open flag_file do |io|
|
||||||
unless force
|
unless force
|
||||||
Time.parse(f.gets)
|
Time.parse f.gets
|
||||||
f.each do |line|
|
io.each do |line|
|
||||||
file, time = line.split(/\t/, 2)
|
file, time = line.split(/\t/, 2)
|
||||||
time = Time.parse(time) rescue next
|
time = Time.parse(time) rescue next
|
||||||
last[file] = time
|
last[file] = time
|
||||||
|
@ -225,19 +225,20 @@ class RDoc::RDoc
|
||||||
stat = File.stat rel_file_name rescue next
|
stat = File.stat rel_file_name rescue next
|
||||||
|
|
||||||
case type = stat.ftype
|
case type = stat.ftype
|
||||||
when "file"
|
when "file" then
|
||||||
next if last_created = @last_created[rel_file_name] and stat.mtime <= last_created
|
next if last_created = @last_created[rel_file_name] and
|
||||||
|
stat.mtime <= last_created
|
||||||
|
|
||||||
if force_doc or RDoc::Parser.can_parse(rel_file_name) then
|
if force_doc or RDoc::Parser.can_parse(rel_file_name) then
|
||||||
file_list << rel_file_name.sub(/^\.\//, '')
|
file_list << rel_file_name.sub(/^\.\//, '')
|
||||||
@last_created[rel_file_name] = stat.mtime
|
@last_created[rel_file_name] = stat.mtime
|
||||||
end
|
end
|
||||||
when "directory"
|
when "directory" then
|
||||||
next if rel_file_name == "CVS" || rel_file_name == ".svn"
|
next if rel_file_name == "CVS" || rel_file_name == ".svn"
|
||||||
|
|
||||||
dot_doc = File.join rel_file_name, RDoc::DOT_DOC_FILENAME
|
dot_doc = File.join rel_file_name, RDoc::DOT_DOC_FILENAME
|
||||||
|
|
||||||
if File.file?(dot_doc) then
|
if File.file? dot_doc then
|
||||||
file_list << parse_dot_doc_file(rel_file_name, dot_doc)
|
file_list << parse_dot_doc_file(rel_file_name, dot_doc)
|
||||||
else
|
else
|
||||||
file_list << list_files_in_directory(rel_file_name)
|
file_list << list_files_in_directory(rel_file_name)
|
||||||
|
@ -355,7 +356,7 @@ The internal error was:
|
||||||
|
|
||||||
@exclude = @options.exclude
|
@exclude = @options.exclude
|
||||||
|
|
||||||
setup_output_dir @options.op_dir, @options.force_update
|
@last_created = setup_output_dir @options.op_dir, @options.force_update
|
||||||
|
|
||||||
start_time = Time.now
|
start_time = Time.now
|
||||||
|
|
||||||
|
|
|
@ -657,21 +657,13 @@ Options may also be set in the 'RI' environment variable.
|
||||||
end
|
end
|
||||||
out << RDoc::Markup::Rule.new(1)
|
out << RDoc::Markup::Rule.new(1)
|
||||||
|
|
||||||
if method.call_seq then
|
if method.arglists then
|
||||||
call_seq = method.call_seq.chomp.split "\n"
|
arglists = method.arglists.chomp.split "\n"
|
||||||
call_seq = call_seq.map { |line| [' ', line, "\n"] }
|
arglists = arglists.map { |line| [' ', line, "\n"] }
|
||||||
out << RDoc::Markup::Verbatim.new(*call_seq.flatten)
|
out << RDoc::Markup::Verbatim.new(*arglists.flatten)
|
||||||
|
out << RDoc::Markup::Rule.new(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if method.block_params then
|
|
||||||
out << RDoc::Markup::BlankLine.new if method.call_seq
|
|
||||||
params = "yields: #{method.block_params}"
|
|
||||||
out << RDoc::Markup::Verbatim.new(' ', params, "\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
out << RDoc::Markup::Rule.new(1) if
|
|
||||||
method.call_seq or method.block_params
|
|
||||||
|
|
||||||
out << RDoc::Markup::BlankLine.new
|
out << RDoc::Markup::BlankLine.new
|
||||||
out << method.comment
|
out << method.comment
|
||||||
out << RDoc::Markup::BlankLine.new
|
out << RDoc::Markup::BlankLine.new
|
||||||
|
@ -793,7 +785,7 @@ Options may also be set in the 'RI' environment variable.
|
||||||
end
|
end
|
||||||
|
|
||||||
methods.each do |item|
|
methods.each do |item|
|
||||||
yield(*item)
|
yield(*item) # :yields: store, klass, ancestor, types, method
|
||||||
end
|
end
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|
|
@ -13,8 +13,7 @@ module RDoc::RI::Paths
|
||||||
base = File.join RbConfig::CONFIG['ridir'], version
|
base = File.join RbConfig::CONFIG['ridir'], version
|
||||||
SYSDIR = File.join base, "system"
|
SYSDIR = File.join base, "system"
|
||||||
SITEDIR = File.join base, "site"
|
SITEDIR = File.join base, "site"
|
||||||
HOMEDIR = (File.expand_path("~/.rdoc") rescue nil)
|
HOMEDIR = (File.expand_path('~/.rdoc') rescue nil)
|
||||||
|
|
||||||
#:startdoc:
|
#:startdoc:
|
||||||
|
|
||||||
@gemdirs = nil
|
@gemdirs = nil
|
||||||
|
|
|
@ -359,6 +359,8 @@ class RDoc::RubyLex
|
||||||
"(" => ")"
|
"(" => ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PERCENT_PAREN_REV = PERCENT_PAREN.invert
|
||||||
|
|
||||||
Ltype2Token = {
|
Ltype2Token = {
|
||||||
"\'" => TkSTRING,
|
"\'" => TkSTRING,
|
||||||
"\"" => TkSTRING,
|
"\"" => TkSTRING,
|
||||||
|
@ -1120,7 +1122,12 @@ class RDoc::RubyLex
|
||||||
def identify_string(ltype, quoted = ltype)
|
def identify_string(ltype, quoted = ltype)
|
||||||
@ltype = ltype
|
@ltype = ltype
|
||||||
@quoted = quoted
|
@quoted = quoted
|
||||||
str = @ltype.dup
|
|
||||||
|
str = if ltype == quoted then
|
||||||
|
ltype.dup
|
||||||
|
else
|
||||||
|
"%#{PERCENT_PAREN_REV[quoted]}"
|
||||||
|
end
|
||||||
|
|
||||||
subtype = nil
|
subtype = nil
|
||||||
begin
|
begin
|
||||||
|
@ -1136,6 +1143,7 @@ class RDoc::RubyLex
|
||||||
subtype = true
|
subtype = true
|
||||||
if ch == "{" then
|
if ch == "{" then
|
||||||
str << ch << skip_inner_expression
|
str << ch << skip_inner_expression
|
||||||
|
next
|
||||||
else
|
else
|
||||||
ungetc
|
ungetc
|
||||||
end
|
end
|
||||||
|
@ -1179,7 +1187,7 @@ class RDoc::RubyLex
|
||||||
def skip_inner_expression
|
def skip_inner_expression
|
||||||
res = ""
|
res = ""
|
||||||
nest = 0
|
nest = 0
|
||||||
while (ch = getc)
|
while ch = getc
|
||||||
res << ch
|
res << ch
|
||||||
if ch == '}'
|
if ch == '}'
|
||||||
break if nest.zero?
|
break if nest.zero?
|
||||||
|
|
|
@ -160,24 +160,28 @@ class RDoc::Task < Rake::TaskLib
|
||||||
# Create the tasks defined by this task lib.
|
# Create the tasks defined by this task lib.
|
||||||
|
|
||||||
def define
|
def define
|
||||||
desc "Build the RDoc HTML files"
|
desc "Build RDoc HTML files"
|
||||||
task rdoc_task_name
|
task rdoc_task_name
|
||||||
|
|
||||||
desc "Force rebuild RDoc HTML files"
|
desc "Rebuild RDoc HTML files"
|
||||||
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
|
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
|
||||||
|
|
||||||
desc "Remove RDoc HTML files"
|
desc "Remove RDoc HTML files"
|
||||||
task clobber_task_name do
|
task clobber_task_name do
|
||||||
rm_r rdoc_dir rescue nil
|
rm_r @rdoc_dir rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
task :clobber => [clobber_task_name]
|
task :clobber => [clobber_task_name]
|
||||||
|
|
||||||
directory @rdoc_dir
|
directory @rdoc_dir
|
||||||
|
|
||||||
|
rdoc_target_deps = [
|
||||||
|
@rdoc_files,
|
||||||
|
Rake.application.rakefile
|
||||||
|
].flatten.compact
|
||||||
|
|
||||||
task rdoc_task_name => [rdoc_target]
|
task rdoc_task_name => [rdoc_target]
|
||||||
file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
|
file rdoc_target => rdoc_target_deps do
|
||||||
rm_r @rdoc_dir rescue nil
|
|
||||||
@before_running_rdoc.call if @before_running_rdoc
|
@before_running_rdoc.call if @before_running_rdoc
|
||||||
args = option_list + @rdoc_files
|
args = option_list + @rdoc_files
|
||||||
|
|
||||||
|
|
4
re.c
4
re.c
|
@ -3456,9 +3456,7 @@ re_warn(const char *s)
|
||||||
* <code>%r{...}</code> literals, and by the <code>Regexp::new</code>
|
* <code>%r{...}</code> literals, and by the <code>Regexp::new</code>
|
||||||
* constructor.
|
* constructor.
|
||||||
*
|
*
|
||||||
* A comprehensive reference for regexp syntax and usage is available as
|
* :include: doc/re.rdoc
|
||||||
* +Doc::Regexp+.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
1
test/rdoc/README
Normal file
1
test/rdoc/README
Normal file
|
@ -0,0 +1 @@
|
||||||
|
you don't have to
|
|
@ -2,13 +2,28 @@ require File.expand_path '../xref_test_case', __FILE__
|
||||||
|
|
||||||
class RDocAnyMethodTest < XrefTestCase
|
class RDocAnyMethodTest < XrefTestCase
|
||||||
|
|
||||||
def test_full_name
|
def test_arglists
|
||||||
assert_equal 'C1::m', @c1.method_list.first.full_name
|
m = RDoc::AnyMethod.new nil, 'method'
|
||||||
|
|
||||||
|
assert_nil m.arglists
|
||||||
|
|
||||||
|
m.params = "(a, b)"
|
||||||
|
m.block_params = "c, d"
|
||||||
|
|
||||||
|
assert_equal "method(a, b) { |c, d| ... }", m.arglists
|
||||||
|
|
||||||
|
call_seq = <<-SEQ
|
||||||
|
method(a) { |c| ... }
|
||||||
|
method(a, b) { |c, d| ... }
|
||||||
|
SEQ
|
||||||
|
|
||||||
|
m.call_seq = call_seq.dup
|
||||||
|
|
||||||
|
assert_equal call_seq, m.arglists
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parent_name
|
def test_full_name
|
||||||
assert_equal 'C1', @c1.method_list.first.parent_name
|
assert_equal 'C1::m', @c1.method_list.first.full_name
|
||||||
assert_equal 'C1', @c1.method_list.last.parent_name
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_marshal_load
|
def test_marshal_load
|
||||||
|
@ -16,11 +31,13 @@ class RDocAnyMethodTest < XrefTestCase
|
||||||
|
|
||||||
assert_equal 'C1#m', instance_method.full_name
|
assert_equal 'C1#m', instance_method.full_name
|
||||||
assert_equal 'C1', instance_method.parent_name
|
assert_equal 'C1', instance_method.parent_name
|
||||||
|
assert_equal '(foo)', instance_method.params
|
||||||
|
|
||||||
class_method = Marshal.load Marshal.dump(@c1.method_list.first)
|
class_method = Marshal.load Marshal.dump(@c1.method_list.first)
|
||||||
|
|
||||||
assert_equal 'C1::m', class_method.full_name
|
assert_equal 'C1::m', class_method.full_name
|
||||||
assert_equal 'C1', class_method.parent_name
|
assert_equal 'C1', class_method.parent_name
|
||||||
|
assert_equal '()', class_method.params
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_name
|
def test_name
|
||||||
|
@ -29,5 +46,30 @@ class RDocAnyMethodTest < XrefTestCase
|
||||||
assert_nil m.name
|
assert_nil m.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_param_seq
|
||||||
|
m = RDoc::AnyMethod.new nil, 'method'
|
||||||
|
m.parent = @c1
|
||||||
|
m.params = 'a'
|
||||||
|
|
||||||
|
assert_equal '(a)', m.param_seq
|
||||||
|
|
||||||
|
m.params = '(a)'
|
||||||
|
|
||||||
|
assert_equal '(a)', m.param_seq
|
||||||
|
|
||||||
|
m.params = "(a,\n b)"
|
||||||
|
|
||||||
|
assert_equal '(a, b)', m.param_seq
|
||||||
|
|
||||||
|
m.block_params = "c,\n d"
|
||||||
|
|
||||||
|
assert_equal '(a, b) { |c, d| ... }', m.param_seq
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_parent_name
|
||||||
|
assert_equal 'C1', @c1.method_list.first.parent_name
|
||||||
|
assert_equal 'C1', @c1.method_list.last.parent_name
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ class TestRDocAttr < MiniTest::Unit::TestCase
|
||||||
@a = RDoc::Attr.new nil, 'attr', 'RW', ''
|
@a = RDoc::Attr.new nil, 'attr', 'RW', ''
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_arglists
|
||||||
|
assert_nil @a.arglists
|
||||||
|
end
|
||||||
|
|
||||||
def test_block_params
|
def test_block_params
|
||||||
assert_nil @a.block_params
|
assert_nil @a.block_params
|
||||||
end
|
end
|
||||||
|
@ -20,6 +24,10 @@ class TestRDocAttr < MiniTest::Unit::TestCase
|
||||||
assert_equal '(unknown)#attr', @a.full_name
|
assert_equal '(unknown)#attr', @a.full_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_params
|
||||||
|
assert_nil @a.params
|
||||||
|
end
|
||||||
|
|
||||||
def test_singleton
|
def test_singleton
|
||||||
refute @a.singleton
|
refute @a.singleton
|
||||||
end
|
end
|
||||||
|
|
|
@ -1004,6 +1004,24 @@ the time
|
||||||
assert_equal expected, @RMP.tokenize(str)
|
assert_equal expected, @RMP.tokenize(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_tokenize_heading_no_space
|
||||||
|
str = <<-STR
|
||||||
|
=Heading
|
||||||
|
==Heading 2
|
||||||
|
STR
|
||||||
|
|
||||||
|
expected = [
|
||||||
|
[:HEADER, 1, 0, 0],
|
||||||
|
[:TEXT, 'Heading', 1, 0],
|
||||||
|
[:NEWLINE, "\n", 8, 0],
|
||||||
|
[:HEADER, 2, 0, 1],
|
||||||
|
[:TEXT, 'Heading 2', 2, 1],
|
||||||
|
[:NEWLINE, "\n", 11, 1],
|
||||||
|
]
|
||||||
|
|
||||||
|
assert_equal expected, @RMP.tokenize(str)
|
||||||
|
end
|
||||||
|
|
||||||
def test_tokenize_label
|
def test_tokenize_label
|
||||||
str = <<-STR
|
str = <<-STR
|
||||||
[cat] l1
|
[cat] l1
|
||||||
|
|
42
test/rdoc/test_rdoc_markup_pre_process.rb
Normal file
42
test/rdoc/test_rdoc_markup_pre_process.rb
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
require 'tempfile'
|
||||||
|
require 'rubygems'
|
||||||
|
require 'minitest/autorun'
|
||||||
|
require 'rdoc/markup/preprocess'
|
||||||
|
|
||||||
|
class TestRDocMarkupPreProcess < MiniTest::Unit::TestCase
|
||||||
|
|
||||||
|
def setup
|
||||||
|
@tempfile = Tempfile.new 'test_rdoc_markup_pre_process'
|
||||||
|
@name = File.basename @tempfile.path
|
||||||
|
@dir = File.dirname @tempfile.path
|
||||||
|
|
||||||
|
@pp = RDoc::Markup::PreProcess.new __FILE__, [@dir]
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
@tempfile.close
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_include_file
|
||||||
|
@tempfile.write <<-INCLUDE
|
||||||
|
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
|
||||||
|
|
||||||
|
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
||||||
|
contents of a string.
|
||||||
|
INCLUDE
|
||||||
|
|
||||||
|
@tempfile.flush
|
||||||
|
@tempfile.rewind
|
||||||
|
|
||||||
|
content = @pp.include_file @name, ''
|
||||||
|
|
||||||
|
expected = <<-EXPECTED
|
||||||
|
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
||||||
|
contents of a string.
|
||||||
|
EXPECTED
|
||||||
|
|
||||||
|
assert_equal expected, content
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -55,7 +55,10 @@ class TestRDocParser < MiniTest::Unit::TestCase
|
||||||
assert_equal @RP::Simple, @RP.can_parse(jtest_file_name)
|
assert_equal @RP::Simple, @RP.can_parse(jtest_file_name)
|
||||||
|
|
||||||
jtest_rdoc_file_name = File.expand_path '../test.ja.rdoc', __FILE__
|
jtest_rdoc_file_name = File.expand_path '../test.ja.rdoc', __FILE__
|
||||||
assert_equal @RP::Ruby, @RP.can_parse(jtest_rdoc_file_name)
|
assert_equal @RP::Simple, @RP.can_parse(jtest_rdoc_file_name)
|
||||||
|
|
||||||
|
readme_file_name = File.expand_path '../README', __FILE__
|
||||||
|
assert_equal @RP::Simple, @RP.can_parse(readme_file_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -201,6 +201,26 @@ Multiline comment goes here because this comment spans multiple lines.
|
||||||
assert constants.empty?, constants.inspect
|
assert constants.empty?, constants.inspect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_find_class_comment_include
|
||||||
|
@options.rdoc_include << File.dirname(__FILE__)
|
||||||
|
|
||||||
|
content = <<-EOF
|
||||||
|
/*
|
||||||
|
* a comment for class Foo
|
||||||
|
*
|
||||||
|
* :include: test.txt
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Init_Foo(void) {
|
||||||
|
VALUE foo = rb_define_class("Foo", rb_cObject);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
klass = util_get_class content, 'foo'
|
||||||
|
|
||||||
|
assert_equal "a comment for class Foo\n\ntest file", klass.comment
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_class_comment_init
|
def test_find_class_comment_init
|
||||||
content = <<-EOF
|
content = <<-EOF
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1246,11 +1246,19 @@ end
|
||||||
|
|
||||||
# If you're writing code like this you're doing it wrong
|
# If you're writing code like this you're doing it wrong
|
||||||
|
|
||||||
def x_test_sanity_interpolation_crazy
|
def test_sanity_interpolation_crazy
|
||||||
last_tk = nil
|
last_tk = nil
|
||||||
util_parser '"#{"#{"a")}" if b}"'
|
util_parser '"#{"#{"a")}" if b}"'
|
||||||
|
|
||||||
assert_equal RDoc::RubyToken::TkDSTRING, tk.class
|
assert_equal '"#{"#{"a")}" if b}"', @parser.get_tk.text
|
||||||
|
assert_equal RDoc::RubyToken::TkNL, @parser.get_tk.class
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_sanity_interpolation_curly
|
||||||
|
last_tk = nil
|
||||||
|
util_parser '%{ #{} }'
|
||||||
|
|
||||||
|
assert_equal '%{ #{} }', @parser.get_tk.text
|
||||||
assert_equal RDoc::RubyToken::TkNL, @parser.get_tk.class
|
assert_equal RDoc::RubyToken::TkNL, @parser.get_tk.class
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,25 @@ class TestRDocParserSimple < MiniTest::Unit::TestCase
|
||||||
@tempfile.close
|
@tempfile.close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_remove_coding_comment
|
||||||
|
parser = util_parser <<-TEXT
|
||||||
|
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
|
||||||
|
|
||||||
|
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
||||||
|
contents of a string.
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
parser.scan
|
||||||
|
|
||||||
|
expected = <<-TEXT.strip
|
||||||
|
|
||||||
|
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
||||||
|
contents of a string.
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
assert_equal expected, @top_level.comment
|
||||||
|
end
|
||||||
|
|
||||||
def test_remove_private_comments
|
def test_remove_private_comments
|
||||||
parser = util_parser ''
|
parser = util_parser ''
|
||||||
text = "foo\n\n--\nbar\n++\n\nbaz\n"
|
text = "foo\n\n--\nbar\n++\n\nbaz\n"
|
||||||
|
|
|
@ -15,8 +15,8 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gather_files
|
def test_gather_files
|
||||||
file = File.expand_path("../../../lib/rdoc.rb", __FILE__)
|
file = File.expand_path __FILE__
|
||||||
assert_equal([file], @rdoc.gather_files([file, file]))
|
assert_equal [file], @rdoc.gather_files([file, file])
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_file_contents
|
def test_read_file_contents
|
||||||
|
|
|
@ -366,7 +366,6 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
|
||||||
assert_match %r%Foo::Bar#blah%, out
|
assert_match %r%Foo::Bar#blah%, out
|
||||||
assert_match %r%blah.5%, out
|
assert_match %r%blah.5%, out
|
||||||
assert_match %r%blah.6%, out
|
assert_match %r%blah.6%, out
|
||||||
assert_match %r%yields: stuff%, out
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_display_method_attribute
|
def test_display_method_attribute
|
||||||
|
@ -425,6 +424,16 @@ Foo::Bar#bother
|
||||||
assert_equal expected, out
|
assert_equal expected, out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_display_method_params
|
||||||
|
util_store
|
||||||
|
|
||||||
|
out, err = capture_io do
|
||||||
|
@driver.display_method 'Foo::Bar#bother'
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_match %r%things.*stuff%, out
|
||||||
|
end
|
||||||
|
|
||||||
def test_expand_class
|
def test_expand_class
|
||||||
util_store
|
util_store
|
||||||
|
|
||||||
|
@ -675,7 +684,7 @@ Foo::Bar#bother
|
||||||
def test_setup_pager
|
def test_setup_pager
|
||||||
@driver.use_stdout = false
|
@driver.use_stdout = false
|
||||||
|
|
||||||
pager = with_dummy_pager {@driver.setup_pager}
|
pager = with_dummy_pager do @driver.setup_pager end
|
||||||
|
|
||||||
skip "couldn't find a standard pager" unless pager
|
skip "couldn't find a standard pager" unless pager
|
||||||
|
|
||||||
|
@ -776,9 +785,10 @@ Foo::Bar#bother
|
||||||
|
|
||||||
@blah = RDoc::AnyMethod.new nil, 'blah'
|
@blah = RDoc::AnyMethod.new nil, 'blah'
|
||||||
@blah.call_seq = "blah(5) => 5\nblah(6) => 6\n"
|
@blah.call_seq = "blah(5) => 5\nblah(6) => 6\n"
|
||||||
@blah.block_params = "stuff"
|
|
||||||
|
|
||||||
@bother = RDoc::AnyMethod.new nil, 'bother'
|
@bother = RDoc::AnyMethod.new nil, 'bother'
|
||||||
|
@bother.params = "(things)"
|
||||||
|
@bother.block_params = "stuff"
|
||||||
|
|
||||||
@new = RDoc::AnyMethod.new nil, 'new'
|
@new = RDoc::AnyMethod.new nil, 'new'
|
||||||
@new.singleton = true
|
@new.singleton = true
|
||||||
|
|
|
@ -11,7 +11,7 @@ class C1
|
||||||
def self.m
|
def self.m
|
||||||
end
|
end
|
||||||
|
|
||||||
def m
|
def m foo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue