From 716dffa7daa3609dbcd6eb029d9445b2f50d8aab Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 24 Feb 2017 07:39:37 +0000 Subject: 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 --- lib/rdoc.rb | 2 +- lib/rdoc/context.rb | 12 ++++++++++- lib/rdoc/generator/json_index.rb | 2 +- lib/rdoc/i18n/locale.rb | 2 +- lib/rdoc/parser.rb | 6 ++++-- lib/rdoc/parser/ruby.rb | 3 +++ lib/rdoc/rd/block_parser.rb | 4 ++-- lib/rdoc/rd/inline_parser.rb | 6 +++--- .../Markdown Documentation - Basics.text | 2 +- .../Markdown Documentation - Syntax.text | 2 +- test/rdoc/test_rdoc_context.rb | 21 ++++++++++++++++++ test/rdoc/test_rdoc_i18n_text.rb | 2 +- test/rdoc/test_rdoc_markdown_test.rb | 4 ++-- test/rdoc/test_rdoc_ri_driver.rb | 12 +++++------ test/rdoc/test_rdoc_store.rb | 4 ++-- test/rdoc/xref_data.rb | 25 ++++++++++++++++++++++ test/rdoc/xref_test_case.rb | 1 + 17 files changed, 86 insertions(+), 24 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 @@ -98,6 +98,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", diff --git a/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text index 486055ca7f..6c5a6fdb4b 100644 --- a/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +++ b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text @@ -123,7 +123,7 @@ Output: Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, `+`, and `-`) as list markers. These three markers are -interchangable; this: +interchangeable; this: * Candy. * Gum. diff --git a/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text index 57360a16c8..184018a5ac 100644 --- a/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +++ b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text @@ -298,7 +298,7 @@ Quote Level from the Text menu. Markdown supports ordered (numbered) and unordered (bulleted) lists. -Unordered lists use asterisks, pluses, and hyphens -- interchangably +Unordered lists use asterisks, pluses, and hyphens -- interchangeably -- as list markers: * Red diff --git a/test/rdoc/test_rdoc_context.rb b/test/rdoc/test_rdoc_context.rb index cc9ab3650f..9af1401f94 100644 --- a/test/rdoc/test_rdoc_context.rb +++ b/test/rdoc/test_rdoc_context.rb @@ -866,6 +866,27 @@ class TestRDocContext < XrefTestCase assert_equal [nil, 'Public', 'Internal'], titles end + def test_visibility_def + assert_equal :private, @c6.find_method_named('priv1').visibility + assert_equal :protected, @c6.find_method_named('prot1').visibility + assert_equal :public, @c6.find_method_named('pub1').visibility + assert_equal :private, @c6.find_method_named('priv2').visibility + assert_equal :protected, @c6.find_method_named('prot2').visibility + assert_equal :public, @c6.find_method_named('pub2').visibility + assert_equal :private, @c6.find_method_named('priv3').visibility + assert_equal :protected, @c6.find_method_named('prot3').visibility + assert_equal :public, @c6.find_method_named('pub3').visibility + assert_equal :private, @c6.find_method_named('priv4').visibility + assert_equal :protected, @c6.find_method_named('prot4').visibility + assert_equal :public, @c6.find_method_named('pub4').visibility + assert_equal :private, @c6.find_method_named('priv5').visibility + assert_equal :protected, @c6.find_method_named('prot5').visibility + assert_equal :public, @c6.find_method_named('pub5').visibility + assert_equal :private, @c6.find_method_named('priv6').visibility + assert_equal :protected, @c6.find_method_named('prot6').visibility + assert_equal :public, @c6.find_method_named('pub6').visibility + end + def util_visibilities @pub = RDoc::AnyMethod.new nil, 'pub' @prot = RDoc::AnyMethod.new nil, 'prot' diff --git a/test/rdoc/test_rdoc_i18n_text.rb b/test/rdoc/test_rdoc_i18n_text.rb index 61df193969..4169b92079 100644 --- a/test/rdoc/test_rdoc_i18n_text.rb +++ b/test/rdoc/test_rdoc_i18n_text.rb @@ -59,7 +59,7 @@ Paragraphe 2. assert_equal expected, translate(raw) end - def test_translate_not_transalted_message + def test_translate_not_translated_message nonexistent_paragraph = <<-PARAGRAPH.strip Nonexistent paragraph. PARAGRAPH diff --git a/test/rdoc/test_rdoc_markdown_test.rb b/test/rdoc/test_rdoc_markdown_test.rb index b80838131c..e738832fed 100644 --- a/test/rdoc/test_rdoc_markdown_test.rb +++ b/test/rdoc/test_rdoc_markdown_test.rb @@ -601,7 +601,7 @@ foo para("Unordered (bulleted) lists use asterisks, pluses, and hyphens (*,\n" + "+, and -) as list markers. These three markers are\n" + - "interchangable; this:"), + "interchangeable; this:"), verb("* Candy.\n", "* Gum.\n", @@ -1090,7 +1090,7 @@ foo para("Markdown supports ordered (numbered) and unordered (bulleted) lists."), - para("Unordered lists use asterisks, pluses, and hyphens -- interchangably\n" + + para("Unordered lists use asterisks, pluses, and hyphens -- interchangeably\n" + "-- as list markers:"), verb("* Red\n", diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 144e74f825..1aa4762f92 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -282,7 +282,7 @@ class TestRDocRIDriver < RDoc::TestCase assert_equal expected, out end - def test_add_method_overriden + def test_add_method_overridden util_multi_store out = doc @@ -646,7 +646,7 @@ class TestRDocRIDriver < RDoc::TestCase assert_match %r%^=== Implementation from Foo%, out end - def test_display_method_overriden + def test_display_method_overridden util_multi_store out, = capture_io do @@ -1455,10 +1455,10 @@ Foo::Bar#bother @inherit = @cFoo.add_method RDoc::AnyMethod.new(nil, 'inherit') @inherit.record_location @top_level - # overriden by Bar in multi_store - @overriden = @cFoo.add_method RDoc::AnyMethod.new(nil, 'override') - @overriden.comment = 'must not be displayed in Bar#override' - @overriden.record_location @top_level + # overridden by Bar in multi_store + @overridden = @cFoo.add_method RDoc::AnyMethod.new(nil, 'override') + @overridden.comment = 'must not be displayed in Bar#override' + @overridden.record_location @top_level @store1.save diff --git a/test/rdoc/test_rdoc_store.rb b/test/rdoc/test_rdoc_store.rb index 4082df71ea..2c52d109ff 100644 --- a/test/rdoc/test_rdoc_store.rb +++ b/test/rdoc/test_rdoc_store.rb @@ -162,7 +162,7 @@ class TestRDocStore < XrefTestCase def test_all_classes_and_modules expected = %w[ - C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 + C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 Child M1 M1::M2 Parent @@ -213,7 +213,7 @@ class TestRDocStore < XrefTestCase def test_classes expected = %w[ - C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 + C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 Child Parent ] diff --git a/test/rdoc/xref_data.rb b/test/rdoc/xref_data.rb index 5d3f6a9a55..44d44956ac 100644 --- a/test/rdoc/xref_data.rb +++ b/test/rdoc/xref_data.rb @@ -57,6 +57,31 @@ class C5 end end +class C6 + private def priv1() end + def pub1() end + protected def prot1() end + def pub2() end + public def pub3() end + def pub4() end + + private + private def priv2() end + def priv3() end + protected def prot2() end + def priv4() end + public def pub5() end + def priv5() end + + protected + private def priv6() end + def prot3() end + protected def prot4() end + def prot5() end + public def pub6() end + def prot6() end +end + module M1 def m end diff --git a/test/rdoc/xref_test_case.rb b/test/rdoc/xref_test_case.rb index c0b3ae5abd..ea7fe705e3 100644 --- a/test/rdoc/xref_test_case.rb +++ b/test/rdoc/xref_test_case.rb @@ -51,6 +51,7 @@ class XrefTestCase < RDoc::TestCase @c5_c1 = @xref_data.find_module_named 'C5::C1' @c3_h1 = @xref_data.find_module_named 'C3::H1' @c3_h2 = @xref_data.find_module_named 'C3::H2' + @c6 = @xref_data.find_module_named 'C6' @m1 = @xref_data.find_module_named 'M1' @m1_m = @m1.method_list.first -- cgit v1.2.3