summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-24 07:39:37 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-24 07:39:37 +0000
commitdf3e22ce84c2b19de9833f3b642098ee5abd826a (patch)
treeac513707b2dfc108f844d6338dc5e1933d189819 /lib
parent0f081edf7e2459dc22672cfa8f27c00fea5e24ad (diff)
Update rdoc-5.1.0
* Details of changes are following url. https://github.com/rdoc/rdoc/blob/master/History.rdoc#510--2017-02-24 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rdoc.rb2
-rw-r--r--lib/rdoc/context.rb12
-rw-r--r--lib/rdoc/generator/json_index.rb2
-rw-r--r--lib/rdoc/i18n/locale.rb2
-rw-r--r--lib/rdoc/parser.rb6
-rw-r--r--lib/rdoc/parser/ruby.rb3
-rw-r--r--lib/rdoc/rd/block_parser.rb4
-rw-r--r--lib/rdoc/rd/inline_parser.rb6
8 files changed, 26 insertions, 11 deletions
diff --git a/lib/rdoc.rb b/lib/rdoc.rb
index 18b8fcb9f3..9d66201fc7 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -65,7 +65,7 @@ module RDoc
##
# RDoc version you are using
- VERSION = '5.0.0'
+ VERSION = '5.1.0'
##
# Method visibilities
diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb
index dc34c3f34b..7cfd9a89b4 100644
--- a/lib/rdoc/context.rb
+++ b/lib/rdoc/context.rb
@@ -99,6 +99,11 @@ class RDoc::Context < RDoc::CodeObject
attr_accessor :visibility
##
+ # Current visibility of this line
+
+ attr_writer :current_line_visibility
+
+ ##
# Hash of registered methods. Attributes are also registered here,
# twice if they are RW.
@@ -148,6 +153,7 @@ class RDoc::Context < RDoc::CodeObject
@extends = []
@constants = []
@external_aliases = []
+ @current_line_visibility = nil
# This Hash maps a method name to a list of unmatched aliases (aliases of
# a method not yet encountered).
@@ -478,7 +484,11 @@ class RDoc::Context < RDoc::CodeObject
end
else
@methods_hash[key] = method
- method.visibility = @visibility
+ if @current_line_visibility
+ method.visibility, @current_line_visibility = @current_line_visibility, nil
+ else
+ method.visibility = @visibility
+ end
add_to @method_list, method
resolve_aliases method
end
diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb
index 931438b3c3..ea9384e6d3 100644
--- a/lib/rdoc/generator/json_index.rb
+++ b/lib/rdoc/generator/json_index.rb
@@ -170,7 +170,7 @@ class RDoc::Generator::JsonIndex
outfile = out_dir + "#{search_index_file}.gz"
debug_msg "Reading the JSON index file from %s" % search_index_file
- search_index = search_index_file.read
+ search_index = search_index_file.read(mode: 'r:utf-8')
debug_msg "Writing gzipped search index to %s" % outfile
diff --git a/lib/rdoc/i18n/locale.rb b/lib/rdoc/i18n/locale.rb
index 735a271bf3..4d55f6965d 100644
--- a/lib/rdoc/i18n/locale.rb
+++ b/lib/rdoc/i18n/locale.rb
@@ -92,7 +92,7 @@ class RDoc::I18n::Locale
end
##
- # Translates the +message+ into locale. If there is no tranlsation
+ # Translates the +message+ into locale. If there is no translation
# messages for +message+ in locale, +message+ itself is returned.
def translate(message)
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index 5abc374bf7..ead96b3f50 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -78,7 +78,7 @@ class RDoc::Parser
return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00")
- mode = "r"
+ mode = 'r:utf-8' # default source encoding has been chagened to utf-8
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
mode = "rb:#{encoding}" if encoding
@@ -180,7 +180,9 @@ class RDoc::Parser
return nil if /coding:/i =~ type
type.downcase
- rescue ArgumentError # invalid byte sequence, etc.
+ rescue ArgumentError
+ rescue Encoding::InvalidByteSequenceError # invalid byte sequence
+
end
##
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index c30dbf0f4e..9562ddbd7a 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -1666,6 +1666,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
unget_tk tk
keep_comment = true
+ container.current_line_visibility = nil
when TkCLASS then
parse_class container, single, tk, comment
@@ -1888,6 +1889,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
#
when TkNL, TkUNLESS_MOD, TkIF_MOD, TkSEMICOLON then
container.ongoing_visibility = vis
+ when TkDEF
+ container.current_line_visibility = vis
else
update_visibility container, vis_type, vis, singleton
end
diff --git a/lib/rdoc/rd/block_parser.rb b/lib/rdoc/rd/block_parser.rb
index fc4af97c1a..954e708495 100644
--- a/lib/rdoc/rd/block_parser.rb
+++ b/lib/rdoc/rd/block_parser.rb
@@ -1,7 +1,7 @@
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.14
-# from Racc grammer file "".
+# from Racc grammar file "".
#
require 'racc/parser.rb'
@@ -253,7 +253,7 @@ def next_token # :nodoc:
[:STRINGLINE, line]
end
else
- raise "[BUG] parsing error may occured."
+ raise "[BUG] parsing error may occurred."
end
end
diff --git a/lib/rdoc/rd/inline_parser.rb b/lib/rdoc/rd/inline_parser.rb
index cc63ea6f70..a2792973ab 100644
--- a/lib/rdoc/rd/inline_parser.rb
+++ b/lib/rdoc/rd/inline_parser.rb
@@ -1,7 +1,7 @@
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.14
-# from Racc grammer file "".
+# from Racc grammar file "".
#
require 'racc/parser.rb'
@@ -704,9 +704,9 @@ Racc_token_to_s_table = [
"ref_subst_strings_q",
"ref_subst_strings_first",
"ref_subst_ele2",
- "ref_subst_eles",
+ "ref_subst_eels",
"ref_subst_str_ele_first",
- "ref_subst_eles_q",
+ "ref_subst_eels_q",
"ref_subst_ele",
"ref_subst_ele_q",
"ref_subst_str_ele",