ruby-changes:44007
From: hsbt <ko1@a...>
Date: Wed, 7 Sep 2016 11:51:22 +0900 (JST)
Subject: [ruby-changes:44007] hsbt:r56079 (trunk): * lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0.beta1
hsbt 2016-09-07 11:51:12 +0900 (Wed, 07 Sep 2016) New Revision: 56079 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56079 Log: * lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0.beta1 This version is mostly same as r56072. It contains to remove code for Ruby 1.8 Added files: trunk/lib/rdoc/markdown/literals.rb Removed files: trunk/lib/rdoc/markdown/literals_1_9.rb Modified files: trunk/ChangeLog trunk/lib/rdoc/markdown.rb trunk/lib/rdoc/markup/formatter_test_case.rb trunk/lib/rdoc/rdoc.gemspec trunk/lib/rdoc/ruby_lex.rb trunk/lib/rdoc/store.rb trunk/lib/rdoc/test_case.rb trunk/lib/rdoc.rb trunk/test/rdoc/test_rdoc_markup_to_bs.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 56078) +++ ChangeLog (revision 56079) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Sep 7 11:51:06 2016 SHIBATA Hiroshi <hsbt@r...> + + * lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0.beta1 + This version is mostly same as r56072. It contains to remove code + for Ruby 1.8 + Tue Sep 6 09:23:06 2016 SHIBATA Hiroshi <hsbt@r...> * lib/rdoc/rdoc.gemspec: partly reverted for default gem installer. Index: lib/rdoc/ruby_lex.rb =================================================================== --- lib/rdoc/ruby_lex.rb (revision 56078) +++ lib/rdoc/ruby_lex.rb (revision 56079) @@ -1180,10 +1180,8 @@ class RDoc::RubyLex https://github.com/ruby/ruby/blob/trunk/lib/rdoc/ruby_lex.rb#L1180 str = if ltype == quoted and %w[" ' /].include? ltype then ltype.dup - elsif RUBY_VERSION > '1.9' then - "%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}" else - "%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]||quoted}" + "%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}" end subtype = nil @@ -1371,4 +1369,3 @@ class RDoc::RubyLex https://github.com/ruby/ruby/blob/trunk/lib/rdoc/ruby_lex.rb#L1369 end #RDoc::RubyLex.debug_level = 1 - Index: lib/rdoc/rdoc.gemspec =================================================================== --- lib/rdoc/rdoc.gemspec (revision 56078) +++ lib/rdoc/rdoc.gemspec (revision 56079) @@ -1,7 +1,60 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rdoc.gemspec#L1 +# -*- encoding: utf-8 -*- +$:.unshift File.expand_path("../lib", __FILE__) +require 'rdoc' + Gem::Specification.new do |s| s.name = "rdoc" - s.version = "4.2.3" - s.summary = "This rdoc is bundled with Ruby" + s.version = RDoc::VERSION + + s.required_rubygems_version = Gem::Requirement.new(">= 1.3") if + s.respond_to? :required_rubygems_version= + + s.require_paths = ["lib"] + s.authors = [ + "Eric Hodel", + "Dave Thomas", + "Phil Hagelberg", + "Tony Strauss", + "Zachary Scott", + "Hiroshi SHIBATA" + ] + + s.description = <<-DESCRIPTION +RDoc produces HTML and command-line documentation for Ruby projects. +RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentation from the command-line. + DESCRIPTION + + s.email = ["drbrain@s...", "mail@z...", "hsbt@r..."] + + s.bindir = "exe" s.executables = ["rdoc", "ri"] - s.files = ["rdoc.rb", "rdoc/alias.rb", "rdoc/anon_class.rb", "rdoc/any_method.rb", "rdoc/attr.rb", "rdoc/class_module.rb", "rdoc/code_object.rb", "rdoc/code_objects.rb", "rdoc/comment.rb", "rdoc/constant.rb", "rdoc/context.rb", "rdoc/context/section.rb", "rdoc/cross_reference.rb", "rdoc/encoding.rb", "rdoc/erb_partial.rb", "rdoc/erbio.rb", "rdoc/extend.rb", "rdoc/generator.rb", "rdoc/generator/darkfish.rb", "rdoc/generator/json_index.rb", "rdoc/generator/markup.rb", "rdoc/generator/pot.rb", "rdoc/generator/pot/message_extractor.rb", "rdoc/generator/pot/po.rb", "rdoc/generator/pot/po_entry.rb", "rdoc/generator/ri.rb", "rdoc/ghost_method.rb", "rdoc/i18n.rb", "rdoc/i18n/locale.rb", "rdoc/i18n/text.rb", "rdoc/include.rb", "rdoc/known_classes.rb", "rdoc/markdown.rb", "rdoc/markdown/entities.rb", "rdoc/markdown/literals_1_9.rb", "rdoc/markup.rb", "rdoc/markup/attr_changer.rb", "rdoc/markup/attr_span.rb", "rdoc/markup/attribute_manager.rb", "rdoc/markup/attributes.rb", "rdoc/mark up/blank_line.rb", "rdoc/markup/block_quote.rb", "rdoc/markup/document.rb", "rdoc/markup/formatter.rb", "rdoc/markup/formatter_test_case.rb", "rdoc/markup/hard_break.rb", "rdoc/markup/heading.rb", "rdoc/markup/include.rb", "rdoc/markup/indented_paragraph.rb", "rdoc/markup/inline.rb", "rdoc/markup/list.rb", "rdoc/markup/list_item.rb", "rdoc/markup/paragraph.rb", "rdoc/markup/parser.rb", "rdoc/markup/pre_process.rb", "rdoc/markup/raw.rb", "rdoc/markup/rule.rb", "rdoc/markup/special.rb", "rdoc/markup/text_formatter_test_case.rb", "rdoc/markup/to_ansi.rb", "rdoc/markup/to_bs.rb", "rdoc/markup/to_html.rb", "rdoc/markup/to_html_crossref.rb", "rdoc/markup/to_html_snippet.rb", "rdoc/markup/to_joined_paragraph.rb", "rdoc/markup/to_label.rb", "rdoc/markup/to_markdown.rb", "rdoc/markup/to_rdoc.rb", "rdoc/markup/to_table_of_contents.rb", "rdoc/markup/to_test.rb", "rdoc/markup/to_tt_only.rb", "rdoc/markup/verbatim.rb", "rdoc/meta_method.rb", "rdoc/method_attr.rb", "rdoc/mixin.rb", "rdoc/ normal_class.rb", "rdoc/normal_module.rb", "rdoc/options.rb", "rdoc/parser.rb", "rdoc/parser/c.rb", "rdoc/parser/changelog.rb", "rdoc/parser/markdown.rb", "rdoc/parser/rd.rb", "rdoc/parser/ruby.rb", "rdoc/parser/ruby_tools.rb", "rdoc/parser/simple.rb", "rdoc/parser/text.rb", "rdoc/rd.rb", "rdoc/rd/block_parser.rb", "rdoc/rd/inline.rb", "rdoc/rd/inline_parser.rb", "rdoc/rdoc.rb", "rdoc/require.rb", "rdoc/ri.rb", "rdoc/ri/driver.rb", "rdoc/ri/formatter.rb", "rdoc/ri/paths.rb", "rdoc/ri/store.rb", "rdoc/ri/task.rb", "rdoc/ruby_lex.rb", "rdoc/ruby_token.rb", "rdoc/rubygems_hook.rb", "rdoc/servlet.rb", "rdoc/single_class.rb", "rdoc/stats.rb", "rdoc/stats/normal.rb", "rdoc/stats/quiet.rb", "rdoc/stats/verbose.rb", "rdoc/store.rb", "rdoc/task.rb", "rdoc/test_case.rb", "rdoc/text.rb", "rdoc/token_stream.rb", "rdoc/tom_doc.rb", "rdoc/top_level.rb"] + + s.extra_rdoc_files += %w[ + CVE-2013-0256.rdoc + CONTRIBUTING.rdoc + ExampleMarkdown.md + ExampleRDoc.rdoc + History.rdoc + LEGAL.rdoc + LICENSE.rdoc + README.rdoc + RI.rdoc + TODO.rdoc + ] + + s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" + + s.homepage = "http://docs.seattlerb.org/rdoc" + s.licenses = ["Ruby"] + + s.rdoc_options = ["--main", "README.rdoc"] + s.required_ruby_version = Gem::Requirement.new(">= 1.9.3") + s.rubygems_version = "2.5.2" + s.summary = "RDoc produces HTML and command-line documentation for Ruby projects" + + s.add_development_dependency("rake", "~> 10.5") + s.add_development_dependency("racc", "~> 1.4", "> 1.4.10") + s.add_development_dependency("kpeg", "~> 0.9") + s.add_development_dependency("minitest", "~> 4") end Index: lib/rdoc/test_case.rb =================================================================== --- lib/rdoc/test_case.rb (revision 56078) +++ lib/rdoc/test_case.rb (revision 56079) @@ -177,8 +177,6 @@ class RDoc::TestCase < MiniTest::Unit::T https://github.com/ruby/ruby/blob/trunk/lib/rdoc/test_case.rb#L177 # Depends upon Dir.mktmpdir def temp_dir - skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir - Dir.mktmpdir do |temp_dir| Dir.chdir temp_dir do yield temp_dir @@ -208,11 +206,3 @@ class RDoc::TestCase < MiniTest::Unit::T https://github.com/ruby/ruby/blob/trunk/lib/rdoc/test_case.rb#L206 end end end - -# This hack allows autoload to work when Dir.pwd is changed for Ruby 1.8 since -# -I paths are not expanded. -$LOAD_PATH.each do |load_path| - break if load_path[0] == ?/ - load_path.replace File.expand_path load_path -end if RUBY_VERSION < '1.9' - Index: lib/rdoc/markdown.rb =================================================================== --- lib/rdoc/markdown.rb (revision 56078) +++ lib/rdoc/markdown.rb (revision 56079) @@ -526,11 +526,7 @@ class RDoc::Markdown https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown.rb#L526 require 'rdoc/markup/to_joined_paragraph' require 'rdoc/markdown/entities' - if RUBY_VERSION > '1.9' then - require 'rdoc/markdown/literals_1_9' - else - require 'rdoc/markdown/literals_1_8' - end + require 'rdoc/markdown/literals' ## # Supported extensions Index: lib/rdoc/store.rb =================================================================== --- lib/rdoc/store.rb (revision 56078) +++ lib/rdoc/store.rb (revision 56079) @@ -450,18 +450,12 @@ class RDoc::Store https://github.com/ruby/ruby/blob/trunk/lib/rdoc/store.rb#L450 # inherit from Object, we have the above wrong inheritance. # # We fix BasicObject right away if we are running in a Ruby - # version >= 1.9. If not, we may be documenting 1.9 source - # while running under 1.8: we search the files of BasicObject - # for "object.c", and fix the inheritance if we find it. + # version >= 1.9. def fix_basic_object_inheritance basic = classes_hash['BasicObject'] return unless basic - if RUBY_VERSION >= '1.9' - basic.superclass = nil - elsif basic.in_files.any? { |f| File.basename(f.full_name) == 'object.c' } - basic.superclass = nil - end + basic.superclass = nil end ## @@ -977,4 +971,3 @@ class RDoc::Store https://github.com/ruby/ruby/blob/trunk/lib/rdoc/store.rb#L971 end end - Index: lib/rdoc/markup/formatter_test_case.rb =================================================================== --- lib/rdoc/markup/formatter_test_case.rb (revision 56078) +++ lib/rdoc/markup/formatter_test_case.rb (revision 56079) @@ -177,9 +177,6 @@ class RDoc::Markup::FormatterTestCase < https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/formatter_test_case.rb#L177 # Calls accept_heading_3 with a level 3 RDoc::Markup::Heading def test_accept_heading_3 - # HACK this doesn't belong here - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars - @to.start_accepting @to.accept_heading @RM::Heading.new(3, 'Hello') @@ -765,4 +762,3 @@ class RDoc::Markup::FormatterTestCase < https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/formatter_test_case.rb#L762 end end - Index: lib/rdoc/markdown/literals_1_9.rb =================================================================== --- lib/rdoc/markdown/literals_1_9.rb (revision 56078) +++ lib/rdoc/markdown/literals_1_9.rb (revision 56079) @@ -1,421 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown/literals_1_9.rb#L0 -# coding: UTF-8 -# frozen_string_literal: false -# :markup: markdown - -## -#-- -# This set of literals is for Ruby 1.9 regular expressions and gives full -# unicode support. -# -# Unlike peg-markdown, this set of literals recognizes Unicode alphanumeric -# characters, newlines and spaces. -class RDoc::Markdown::Literals - # :stopdoc: - - # This is distinct from setup_parser so that a standalone parser - # can redefine #initialize and still have access to the proper - # parser setup code. - def initialize(str, debug=false) - setup_parser(str, debug) - end - - - - # Prepares for parsing +str+. If you define a custom initialize you must - # call this method before #parse - def setup_parser(str, debug=false) - set_string str, 0 - @memoizations = Hash.new { |h,k| h[k] = {} } - @result = nil - @failed_rule = nil - @failing_rule_offset = -1 - - setup_foreign_grammar - end - - attr_reader :string - attr_reader :failing_rule_offset - attr_accessor :result, :pos - - def current_column(target=pos) - if c = string.rindex("\n", target-1) - return target - c - 1 - end - - target + 1 - end - - def current_line(target=pos) - cur_offset = 0 - cur_line = 0 - - string.each_line do |line| - cur_line += 1 - cur_offset += line.size - return cur_line if cur_offset >= target - end - - -1 - end - - def lines - lines = [] - string.each_line { |l| lines << l } - lines - end - - - - def get_text(start) - @string[start..@pos-1] - end - - # Sets the string and current parsing position for the parser. - def set_string string, pos - @string = string - @string_size = string ? string.size : 0 - @pos = pos - end - - def show_pos - width = 10 - if @pos < width - "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")" - else - "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")" - end - end - - def failure_info - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - - if @failed_rule.kind_of? Symbol - info = self.class::Rules[@failed_rule] - "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'" - else - "line #{l}, column #{c}: failed rule '#{@failed_rule}'" - end - end - - def failure_caret - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - - line = lines[l-1] - "#{line}\n#{' ' * (c - 1)}^" - end - - def failure_character - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - lines[l-1][c-1, 1] - end - - def failure_oneline - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - - char = lines[l-1][c-1, 1] - - if @failed_rule.kind_of? Symbol - info = self.class::Rules[@failed_rule] - "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'" - else - "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'" - end - end - - class ParseError < RuntimeError - end - - def raise_error - raise ParseError, failure_oneline - end - - def show_error(io=STDOUT) - error_pos = @failing_rule_offset - line_no = current_line(error_pos) - col_no = current_column(error_pos) - - io.puts "On line #{line_no}, column #{col_no}:" - - if @failed_rule.kind_of? Symbol - info = self.class::Rules[@failed_rule] - io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')" - else - io.puts "Failed to match rule '#{@failed_rule}'" - end - - io.puts "Got: #{string[error_pos,1].inspect}" - line = lines[line_no-1] - io.puts "=> #{line}" - io.print(" " * (col_no + 3)) - io.puts "^" - end - - def set_failed_rule(name) - if @pos > @failing_rule_offset - @failed_rule = name - @failing_rule_offset = @pos - end - end - - attr_reader :failed_rule - - def match_string(str) - len = str.size - if @string[pos,len] == str - @pos += len - return str - end - - return nil - end - - def scan(reg) - if m = reg.match(@string[@pos..-1]) - width = m.end(0) - @pos += width - return true - end - - return nil - end - - if "".respond_to? :ord - def get_byte - if @pos >= @string_size - return nil - end - - s = @string[@pos].ord - @pos += 1 - s - end - else - def get_byte - if @pos >= @string_size - return nil - end - - s = @string[@pos] - @pos += 1 - s - end - end - - def parse(rule=nil) - # We invoke the rules indirectly via apply - # instead of by just calling them as methods because - # if the rules use left recursion, apply needs to - # manage that. - - if !rule - apply(:_root) - else - method = rule.gsub("-","_hyphen_") - apply :"_#{method}" - end - end - - class MemoEntry - def initialize(ans, pos) - @ans = ans - @pos = pos - @result = nil - @set = false - @left_rec = false - end - - attr_reader :ans, :pos, :result, :set - attr_accessor :left_rec - - def move!(ans, pos, result) - @ans = ans - @pos = pos - @result = result - @set = true - @left_rec = false - end - end - - def external_invoke(other, rule, *args) - old_pos = @pos - old_string = @string - - set_string other.string, other.pos - - begin - if val = __send__(rule, *args) - other.pos = @pos - other.result = @result - else - other.set_failed_rule "#{self.class}##{rule}" - end - val - ensure - set_string old_string, old_pos - end - end - - def apply_with_args(rule, *args) - memo_key = [rule, args] - if m = @memoizations[memo_key][@pos] - @pos = m.pos - if !m.set - m.left_rec = true - return nil - end - - @result = m.result - - return m.ans - else - m = MemoEntry.new(nil, @pos) - @memoizations[memo_key][@pos] = m - start_pos = @pos - - ans = __send__ rule, *args - - lr = m.left_rec - - m.move! ans, @pos, @result - - # Don't bother trying to grow the left recursion - # if it's failing straight away (thus there is no seed) - if ans and lr - return grow_lr(rule, args, start_pos, m) - else - return ans - end - - return ans - end - end - - def apply(rule) - if m = @memoizations[rule][@pos] - @pos = m.pos - if !m.set - m.left_rec = true - return nil - end - - @result = m.result - - return m.ans - else - m = MemoEntry.new(nil, @pos) - @memoizations[rule][@pos] = m - start_pos = @pos - - ans = __send__ rule - - lr = m.left_rec - - m.move! ans, @pos, @result - - # Don't bother trying to grow the left recursion - # if it's failing straight away (thus there is no seed) - if ans and lr - return grow_lr(rule, nil, start_pos, m) - else - return ans - end - - return ans - end - end - - def grow_lr(rule, args, start_pos, m) - while true - @pos = start_pos - @result = m.result - - if args - ans = __send__ rule, *args - else - ans = __send__ rule - end - return nil unless ans - - break if @pos <= m.pos - - m.move! ans, @pos, @result - end - - @result = m.result - @pos = m.pos - return m.ans - end - - class RuleInfo - def initialize(name, rendered) - @name = name - @rendered = rendered - end - - attr_reader :name, :rendered - end - - def self.rule_info(name, rendered) - RuleInfo.new(name, rendered) - end - - - # :startdoc: - # :stopdoc: - def setup_foreign_grammar; end - - # Alphanumeric = /\p{Word}/ - def _Alphanumeric - _tmp = scan(/\A(?-mix:\p{Word})/) - set_failed_rule :_Alphanumeric unless _tmp - return _tmp - end - - # AlphanumericAscii = /[A-Za-z0-9]/ - def _AlphanumericAscii - _tmp = scan(/\A(?-mix:[A-Za-z0-9])/) - set_failed_rule :_AlphanumericAscii unless _tmp - return _tmp - end - - # BOM = "uFEFF" - def _BOM - _tmp = match_string("uFEFF") - set_failed_rule :_BOM unless _tmp - return _tmp - end - - # Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/ - def _Newline - _tmp = scan(/\A(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/) - set_failed_rule :_Newline unless _tmp - return _tmp - end - - # NonAlphanumeric = /\p{^Word}/ - def _NonAlphanumeric - _tmp = scan(/\A(?-mix:\p{^Word})/) - set_failed_rule :_NonAlphanumeric unless _tmp - return _tmp - end - - # Spacechar = /\t|\p{Zs}/ - def _Spacechar - _tmp = scan(/\A(?-mix:\t|\p{Zs})/) - set_failed_rule :_Spacechar unless _tmp - return _tmp - end - - Rules = {} - Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/\\p{Word}/") - Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/") - Rules[:_BOM] = rule_info("BOM", "\"uFEFF\"") - Rules[:_Newline] = rule_info("Newline", "/\\n|\\r\\n?|\\p{Zl}|\\p{Zp}/") - Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "/\\p{^Word}/") - Rules[:_Spacechar] = rule_info("Spacechar", "/\\t|\\p{Zs}/") - # :startdoc: -end Index: lib/rdoc/markdown/literals.rb ===================================================== (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/