[前][次][番号順一覧][スレッド一覧]

ruby-changes:25832

From: drbrain <ko1@a...>
Date: Tue, 27 Nov 2012 13:29:01 +0900 (JST)
Subject: [ruby-changes:25832] drbrain:r37889 (trunk): * lib/rdoc*: Updated to RDoc 4.0 (pre-release)

drbrain	2012-11-27 13:28:14 +0900 (Tue, 27 Nov 2012)

  New Revision: 37889

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37889

  Log:
    * lib/rdoc*:  Updated to RDoc 4.0 (pre-release)
    * bin/rdoc:  ditto
    * test/rdoc:  ditto
    * NEWS:  Updated with RDoc 4.0 information

  Added directories:
    trunk/lib/rdoc/context/
    trunk/lib/rdoc/generator/template/json_index/
    trunk/lib/rdoc/generator/template/json_index/js/
    trunk/lib/rdoc/markdown/
    trunk/lib/rdoc/rd/
    trunk/test/rdoc/MarkdownTest_1.0.3/
  Added files:
    trunk/lib/rdoc/comment.rb
    trunk/lib/rdoc/context/section.rb
    trunk/lib/rdoc/erb_partial.rb
    trunk/lib/rdoc/extend.rb
    trunk/lib/rdoc/generator/json_index.rb
    trunk/lib/rdoc/generator/template/darkfish/_footer.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_head.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
    trunk/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
    trunk/lib/rdoc/generator/template/darkfish/class.rhtml
    trunk/lib/rdoc/generator/template/darkfish/images/add.png
    trunk/lib/rdoc/generator/template/darkfish/images/arrow_up.png
    trunk/lib/rdoc/generator/template/darkfish/images/delete.png
    trunk/lib/rdoc/generator/template/darkfish/images/tag_blue.png
    trunk/lib/rdoc/generator/template/darkfish/images/transparent.png
    trunk/lib/rdoc/generator/template/darkfish/js/search.js
    trunk/lib/rdoc/generator/template/darkfish/page.rhtml
    trunk/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
    trunk/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
    trunk/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
    trunk/lib/rdoc/generator/template/json_index/js/navigation.js
    trunk/lib/rdoc/generator/template/json_index/js/searcher.js
    trunk/lib/rdoc/markdown/entities.rb
    trunk/lib/rdoc/markdown/literals_1_9.rb
    trunk/lib/rdoc/markdown.rb
    trunk/lib/rdoc/markup/attr_changer.rb
    trunk/lib/rdoc/markup/attr_span.rb
    trunk/lib/rdoc/markup/attributes.rb
    trunk/lib/rdoc/markup/block_quote.rb
    trunk/lib/rdoc/markup/hard_break.rb
    trunk/lib/rdoc/markup/include.rb
    trunk/lib/rdoc/markup/special.rb
    trunk/lib/rdoc/markup/to_html_snippet.rb
    trunk/lib/rdoc/markup/to_joined_paragraph.rb
    trunk/lib/rdoc/markup/to_label.rb
    trunk/lib/rdoc/markup/to_markdown.rb
    trunk/lib/rdoc/markup/to_table_of_contents.rb
    trunk/lib/rdoc/parser/markdown.rb
    trunk/lib/rdoc/parser/rd.rb
    trunk/lib/rdoc/parser/text.rb
    trunk/lib/rdoc/rd/block_parser.rb
    trunk/lib/rdoc/rd/inline.rb
    trunk/lib/rdoc/rd/inline_parser.rb
    trunk/lib/rdoc/rd.rb
    trunk/lib/rdoc/servlet.rb
    trunk/lib/rdoc/store.rb
    trunk/lib/rdoc/test_case.rb
    trunk/lib/rdoc/tom_doc.rb
    trunk/test/rdoc/MarkdownTest_1.0.3/Amps and angle encoding.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Auto links.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Backslash escapes.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Blockquotes with code blocks.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Code Blocks.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Code Spans.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Horizontal rules.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Advanced).text
    trunk/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Simple).text
    trunk/test/rdoc/MarkdownTest_1.0.3/Inline HTML comments.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Links, inline style.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Links, reference style.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Links, shortcut references.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Literal quotes in titles.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Nested blockquotes.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Ordered and unordered lists.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Strong and em together.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Tabs.text
    trunk/test/rdoc/MarkdownTest_1.0.3/Tidyness.text
    trunk/test/rdoc/test.ja.large.rdoc
    trunk/test/rdoc/test_rdoc_comment.rb
    trunk/test/rdoc/test_rdoc_extend.rb
    trunk/test/rdoc/test_rdoc_generator_json_index.rb
    trunk/test/rdoc/test_rdoc_generator_markup.rb
    trunk/test/rdoc/test_rdoc_markdown.rb
    trunk/test/rdoc/test_rdoc_markdown_test.rb
    trunk/test/rdoc/test_rdoc_markup_attributes.rb
    trunk/test/rdoc/test_rdoc_markup_hard_break.rb
    trunk/test/rdoc/test_rdoc_markup_heading.rb
    trunk/test/rdoc/test_rdoc_markup_include.rb
    trunk/test/rdoc/test_rdoc_markup_to_html_snippet.rb
    trunk/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb
    trunk/test/rdoc/test_rdoc_markup_to_label.rb
    trunk/test/rdoc/test_rdoc_markup_to_markdown.rb
    trunk/test/rdoc/test_rdoc_markup_to_table_of_contents.rb
    trunk/test/rdoc/test_rdoc_markup_verbatim.rb
    trunk/test/rdoc/test_rdoc_parser_markdown.rb
    trunk/test/rdoc/test_rdoc_parser_rd.rb
    trunk/test/rdoc/test_rdoc_rd.rb
    trunk/test/rdoc/test_rdoc_rd_block_parser.rb
    trunk/test/rdoc/test_rdoc_rd_inline.rb
    trunk/test/rdoc/test_rdoc_rd_inline_parser.rb
    trunk/test/rdoc/test_rdoc_ruby_token.rb
    trunk/test/rdoc/test_rdoc_servlet.rb
    trunk/test/rdoc/test_rdoc_store.rb
    trunk/test/rdoc/test_rdoc_token_stream.rb
    trunk/test/rdoc/test_rdoc_tom_doc.rb
  Removed directories:
    trunk/test/rdoc/parsers/
  Removed files:
    trunk/lib/rdoc/generator/template/darkfish/classpage.rhtml
    trunk/lib/rdoc/generator/template/darkfish/filepage.rhtml
    trunk/lib/rdoc/generator/template/darkfish/js/quicksearch.js
    trunk/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js
    trunk/test/rdoc/test.ja.largedoc
    trunk/test/rdoc/test_rdoc_ri_store.rb
  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/bin/rdoc
    trunk/ext/nkf/nkf-utf8/utf8tbl.c
    trunk/lib/rdoc/alias.rb
    trunk/lib/rdoc/anon_class.rb
    trunk/lib/rdoc/any_method.rb
    trunk/lib/rdoc/attr.rb
    trunk/lib/rdoc/class_module.rb
    trunk/lib/rdoc/code_object.rb
    trunk/lib/rdoc/code_objects.rb
    trunk/lib/rdoc/constant.rb
    trunk/lib/rdoc/context.rb
    trunk/lib/rdoc/cross_reference.rb
    trunk/lib/rdoc/encoding.rb
    trunk/lib/rdoc/generator/darkfish.rb
    trunk/lib/rdoc/generator/markup.rb
    trunk/lib/rdoc/generator/ri.rb
    trunk/lib/rdoc/generator/template/darkfish/index.rhtml
    trunk/lib/rdoc/generator/template/darkfish/js/darkfish.js
    trunk/lib/rdoc/generator/template/darkfish/js/jquery.js
    trunk/lib/rdoc/generator/template/darkfish/rdoc.css
    trunk/lib/rdoc/generator.rb
    trunk/lib/rdoc/ghost_method.rb
    trunk/lib/rdoc/include.rb
    trunk/lib/rdoc/markup/attribute_manager.rb
    trunk/lib/rdoc/markup/document.rb
    trunk/lib/rdoc/markup/formatter.rb
    trunk/lib/rdoc/markup/formatter_test_case.rb
    trunk/lib/rdoc/markup/heading.rb
    trunk/lib/rdoc/markup/indented_paragraph.rb
    trunk/lib/rdoc/markup/inline.rb
    trunk/lib/rdoc/markup/list.rb
    trunk/lib/rdoc/markup/list_item.rb
    trunk/lib/rdoc/markup/paragraph.rb
    trunk/lib/rdoc/markup/parser.rb
    trunk/lib/rdoc/markup/pre_process.rb
    trunk/lib/rdoc/markup/raw.rb
    trunk/lib/rdoc/markup/text_formatter_test_case.rb
    trunk/lib/rdoc/markup/to_ansi.rb
    trunk/lib/rdoc/markup/to_bs.rb
    trunk/lib/rdoc/markup/to_html.rb
    trunk/lib/rdoc/markup/to_html_crossref.rb
    trunk/lib/rdoc/markup/to_rdoc.rb
    trunk/lib/rdoc/markup/to_test.rb
    trunk/lib/rdoc/markup/to_tt_only.rb
    trunk/lib/rdoc/markup/verbatim.rb
    trunk/lib/rdoc/markup.rb
    trunk/lib/rdoc/meta_method.rb
    trunk/lib/rdoc/method_attr.rb
    trunk/lib/rdoc/normal_class.rb
    trunk/lib/rdoc/normal_module.rb
    trunk/lib/rdoc/options.rb
    trunk/lib/rdoc/parser/c.rb
    trunk/lib/rdoc/parser/ruby.rb
    trunk/lib/rdoc/parser/ruby_tools.rb
    trunk/lib/rdoc/parser/simple.rb
    trunk/lib/rdoc/parser.rb
    trunk/lib/rdoc/rdoc.rb
    trunk/lib/rdoc/require.rb
    trunk/lib/rdoc/ri/driver.rb
    trunk/lib/rdoc/ri/paths.rb
    trunk/lib/rdoc/ri/store.rb
    trunk/lib/rdoc/ri.rb
    trunk/lib/rdoc/ruby_lex.rb
    trunk/lib/rdoc/ruby_token.rb
    trunk/lib/rdoc/rubygems_hook.rb
    trunk/lib/rdoc/single_class.rb
    trunk/lib/rdoc/stats.rb
    trunk/lib/rdoc/task.rb
    trunk/lib/rdoc/text.rb
    trunk/lib/rdoc/token_stream.rb
    trunk/lib/rdoc/top_level.rb
    trunk/lib/rdoc.rb
    trunk/test/rdoc/test_attribute_manager.rb
    trunk/test/rdoc/test_rdoc_any_method.rb
    trunk/test/rdoc/test_rdoc_attr.rb
    trunk/test/rdoc/test_rdoc_class_module.rb
    trunk/test/rdoc/test_rdoc_code_object.rb
    trunk/test/rdoc/test_rdoc_constant.rb
    trunk/test/rdoc/test_rdoc_context.rb
    trunk/test/rdoc/test_rdoc_context_section.rb
    trunk/test/rdoc/test_rdoc_cross_reference.rb
    trunk/test/rdoc/test_rdoc_encoding.rb
    trunk/test/rdoc/test_rdoc_generator_darkfish.rb
    trunk/test/rdoc/test_rdoc_generator_ri.rb
    trunk/test/rdoc/test_rdoc_include.rb
    trunk/test/rdoc/test_rdoc_markup.rb
    trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb
    trunk/test/rdoc/test_rdoc_markup_document.rb
    trunk/test/rdoc/test_rdoc_markup_formatter.rb
    trunk/test/rdoc/test_rdoc_markup_indented_paragraph.rb
    trunk/test/rdoc/test_rdoc_markup_paragraph.rb
    trunk/test/rdoc/test_rdoc_markup_parser.rb
    trunk/test/rdoc/test_rdoc_markup_pre_process.rb
    trunk/test/rdoc/test_rdoc_markup_raw.rb
    trunk/test/rdoc/test_rdoc_markup_to_ansi.rb
    trunk/test/rdoc/test_rdoc_markup_to_bs.rb
    trunk/test/rdoc/test_rdoc_markup_to_html.rb
    trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb
    trunk/test/rdoc/test_rdoc_markup_to_rdoc.rb
    trunk/test/rdoc/test_rdoc_markup_to_tt_only.rb
    trunk/test/rdoc/test_rdoc_method_attr.rb
    trunk/test/rdoc/test_rdoc_normal_class.rb
    trunk/test/rdoc/test_rdoc_normal_module.rb
    trunk/test/rdoc/test_rdoc_options.rb
    trunk/test/rdoc/test_rdoc_parser.rb
    trunk/test/rdoc/test_rdoc_parser_c.rb
    trunk/test/rdoc/test_rdoc_parser_ruby.rb
    trunk/test/rdoc/test_rdoc_parser_simple.rb
    trunk/test/rdoc/test_rdoc_rdoc.rb
    trunk/test/rdoc/test_rdoc_ri_driver.rb
    trunk/test/rdoc/test_rdoc_ri_paths.rb
    trunk/test/rdoc/test_rdoc_ruby_lex.rb
    trunk/test/rdoc/test_rdoc_rubygems_hook.rb
    trunk/test/rdoc/test_rdoc_stats.rb
    trunk/test/rdoc/test_rdoc_task.rb
    trunk/test/rdoc/test_rdoc_text.rb
    trunk/test/rdoc/test_rdoc_top_level.rb
    trunk/test/rdoc/xref_test_case.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37888)
+++ ChangeLog	(revision 37889)
@@ -1,3 +1,10 @@
+Tue Nov 27 13:27:46 2012  Eric Hodel  <drbrain@s...>
+
+	* lib/rdoc*:  Updated to RDoc 4.0 (pre-release)
+	* bin/rdoc:  ditto
+	* test/rdoc*:  ditto
+	* NEWS:  Updated with RDoc 4.0 information
+
 Tue Nov 27 12:17:11 2012  Koichi Sasada  <ko1@a...>
 
 	* thread.c (rb_thread_terminate_all): retry broadcast only when
Index: lib/rdoc.rb
===================================================================
--- lib/rdoc.rb	(revision 37888)
+++ lib/rdoc.rb	(revision 37889)
@@ -1,86 +1,55 @@
 $DEBUG_RDOC = nil
 
-# :main: README.txt
+# :main: README.rdoc
 
 ##
-# RDoc is a Ruby documentation system which contains RDoc::RDoc for generating
-# documentation, RDoc::RI for interactive documentation and RDoc::Markup for
-# text markup.
+# RDoc produces documentation for Ruby source files by parsing the source and
+# extracting the definition for classes, modules, methods, includes and
+# requires.  It associates these with optional documentation contained in an
+# immediately preceding comment block then renders the result using an output
+# formatter.
 #
-# RDoc::RDoc produces documentation for Ruby source files.  It works similarly
-# to JavaDoc, parsing the source and extracting the definition for classes,
-# modules, methods, includes and requires.  It associates these with optional
-# documentation contained in an immediately preceding comment block then
-# renders the result using an output formatter.
+# For a simple introduction to writing or generating documentation using RDoc
+# see the README.
 #
-# RDoc::Markup that converts plain text into various output formats.  The
-# markup library is used to interpret the comment blocks that RDoc uses to
-# document methods, classes, and so on.
-#
-# RDoc::RI implements the +ri+ command-line tool which displays on-line
-# documentation for ruby classes, methods, etc.  +ri+ features several output
-# formats and an interactive mode (<tt>ri -i</tt>).  See <tt>ri --help</tt>
-# for further details.
-#
 # == Roadmap
 #
-# * If you want to use RDoc to create documentation for your Ruby source files,
-#   see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line
-#   usage.
-# * If you want to write documentation for Ruby files see RDoc::Parser::Ruby
-# * If you want to write documentation for extensions written in C see
-#   RDoc::Parser::C
-# * If you want to generate documentation using <tt>rake</tt> see RDoc::Task.
-# * If you want to drive RDoc programmatically, see RDoc::RDoc.
-# * If you want to use the library to format text blocks into HTML, look at
-#   RDoc::Markup.
-# * If you want to make an RDoc plugin such as a generator or directive
-#   handler see RDoc::RDoc.
-# * If you want to write your own output generator see RDoc::Generator.
+# If you think you found a bug in RDoc see DEVELOPERS@Bugs
 #
-# == Summary
+# If you want to use RDoc to create documentation for your Ruby source files,
+# see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line usage.
 #
-# Once installed, you can create documentation using the +rdoc+ command
+# If you want to set the default markup format see
+# RDoc::Markup@Supported+Formats
 #
-#   % rdoc [options] [names...]
+# If you want to store rdoc configuration in your gem (such as the default
+# markup format) see RDoc::Options@Saved+Options
 #
-# For an up-to-date option summary, type
+# If you want to write documentation for Ruby files see RDoc::Parser::Ruby
 #
-#   % rdoc --help
+# If you want to write documentation for extensions written in C see
+# RDoc::Parser::C
 #
-# A typical use might be to generate documentation for a package of Ruby
-# source (such as RDoc itself).
+# If you want to generate documentation using <tt>rake</tt> see RDoc::Task.
 #
-#   % rdoc
+# If you want to drive RDoc programmatically, see RDoc::RDoc.
 #
-# This command generates documentation for all the Ruby and C source
-# files in and below the current directory.  These will be stored in a
-# documentation tree starting in the subdirectory +doc+.
+# If you want to use the library to format text blocks into HTML or other
+# formats, look at RDoc::Markup.
 #
-# You can make this slightly more useful for your readers by having the
-# index page contain the documentation for the primary file.  In our
-# case, we could type
+# If you want to make an RDoc plugin such as a generator or directive handler
+# see RDoc::RDoc.
 #
-#   % rdoc --main README.txt
+# If you want to write your own output generator see RDoc::Generator.
 #
-# You'll find information on the various formatting tricks you can use
-# in comment blocks in the documentation this generates.
+# If you want an overview of how RDoc works see DEVELOPERS
 #
-# RDoc uses file extensions to determine how to process each file.  File names
-# ending +.rb+ and +.rbw+ are assumed to be Ruby source.  Files
-# ending +.c+ are parsed as C files.  All other files are assumed to
-# contain just Markup-style markup (with or without leading '#' comment
-# markers).  If directory names are passed to RDoc, they are scanned
-# recursively for C and Ruby source files only.
+# == Credits
 #
-# == Other stuff
-#
 # RDoc is currently being maintained by Eric Hodel <drbrain@s...>.
 #
 # Dave Thomas <dave@p...> is the original author of RDoc.
 #
-# == Credits
-#
 # * The Ruby parser in rdoc/parse.rb is based heavily on the outstanding
 #   work of Keiju ISHITSUKA of Nippon Rational Inc, who produced the Ruby
 #   parser for irb and the rtags package.
@@ -92,19 +61,10 @@
 
   class Error < RuntimeError; end
 
-  def self.const_missing const_name # :nodoc:
-    if const_name.to_s == 'RDocError' then
-      warn "RDoc::RDocError is deprecated"
-      return Error
-    end
-
-    super
-  end
-
   ##
   # RDoc version you are using
 
-  VERSION = '3.9.4'
+  VERSION = '4.0'
 
   ##
   # Method visibilities
@@ -143,5 +103,80 @@
   METHOD_MODIFIERS = GENERAL_MODIFIERS +
     %w[arg args yield yields notnew not-new not_new doc]
 
+  ##
+  # Loads the best available YAML library.
+
+  def self.load_yaml
+    begin
+      gem 'psych'
+    rescue Gem::LoadError
+    end
+
+    begin
+      require 'psych'
+    rescue ::LoadError
+    ensure
+      require 'yaml'
+    end
+  end
+
+  autoload :RDoc,           'rdoc/rdoc'
+
+  autoload :TestCase,       'rdoc/test_case'
+
+  autoload :CrossReference, 'rdoc/cross_reference'
+  autoload :ERBIO,          'rdoc/erbio'
+  autoload :ERBPartial,     'rdoc/erb_partial'
+  autoload :Encoding,       'rdoc/encoding'
+  autoload :Generator,      'rdoc/generator'
+  autoload :Options,        'rdoc/options'
+  autoload :Parser,         'rdoc/parser'
+  autoload :Servlet,        'rdoc/servlet'
+  autoload :RI,             'rdoc/ri'
+  autoload :Stats,          'rdoc/stats'
+  autoload :Store,          'rdoc/store'
+  autoload :Task,           'rdoc/task'
+  autoload :Text,           'rdoc/text'
+
+  autoload :Markdown,       'rdoc/markdown'
+  autoload :Markup,         'rdoc/markup'
+  autoload :RD,             'rdoc/rd'
+  autoload :TomDoc,         'rdoc/tom_doc'
+
+  autoload :KNOWN_CLASSES,  'rdoc/known_classes'
+
+  autoload :RubyLex,        'rdoc/ruby_lex'
+  autoload :RubyToken,      'rdoc/ruby_token'
+  autoload :TokenStream,    'rdoc/token_stream'
+
+  autoload :Comment,        'rdoc/comment'
+
+  # code objects
+  #
+  # We represent the various high-level code constructs that appear in Ruby
+  # programs: classes, modules, methods, and so on.
+  autoload :CodeObject,     'rdoc/code_object'
+
+  autoload :Context,        'rdoc/context'
+  autoload :TopLevel,       'rdoc/top_level'
+
+  autoload :AnonClass,      'rdoc/anon_class'
+  autoload :ClassModule,    'rdoc/class_module'
+  autoload :NormalClass,    'rdoc/normal_class'
+  autoload :NormalModule,   'rdoc/normal_module'
+  autoload :SingleClass,    'rdoc/single_class'
+
+  autoload :Alias,          'rdoc/alias'
+  autoload :AnyMethod,      'rdoc/any_method'
+  autoload :MethodAttr,     'rdoc/method_attr'
+  autoload :GhostMethod,    'rdoc/ghost_method'
+  autoload :MetaMethod,     'rdoc/meta_method'
+  autoload :Attr,           'rdoc/attr'
+
+  autoload :Constant,       'rdoc/constant'
+  autoload :Include,        'rdoc/include'
+  autoload :Extend,         'rdoc/extend'
+  autoload :Require,        'rdoc/require'
+
 end
 
Index: lib/rdoc/anon_class.rb
===================================================================
--- lib/rdoc/anon_class.rb	(revision 37888)
+++ lib/rdoc/anon_class.rb	(revision 37889)
@@ -1,5 +1,3 @@
-require 'rdoc/class_module'
-
 ##
 # An anonymous class like:
 #
Index: lib/rdoc/markdown.rb
===================================================================
--- lib/rdoc/markdown.rb	(revision 0)
+++ lib/rdoc/markdown.rb	(revision 37889)
@@ -0,0 +1,16374 @@
+# coding: UTF-8
+# :markup: markdown
+
+##
+# RDoc::Markdown as described by the [markdown syntax][syntax].
+#
+# To choose Markdown as your only default format see
+# RDoc::Options@Saved+Options for instructions on setting up a `.doc_options`
+# file to store your project default.
+#
+# ## Extensions
+#
+# The following markdown extensions are supported by the parser, but not all
+# are used in RDoc output by default.
+#
+# ### RDoc
+#
+# The RDoc Markdown parser has the following built-in behaviors that cannot be
+# disabled.
+#
+# Underscores embedded in words are never interpreted as emphasis.  (While the
+# [markdown dingus][dingus] emphasizes in-word underscores, neither the
+# Markdown syntax nor MarkdownTest mention this behavior.)
+#
+# For HTML output, RDoc always auto-links bare URLs.
+#
+# ### Break on Newline
+#
+# The break_on_newline extension converts all newlines into hard line breaks
+# as in [Github Flavored Markdown][GFM].  This extension is disabled by
+# default.
+#
+# ### CSS
+#
+# The #css extension enables CSS blocks to be included in the output, but they
+# are not used for any built-in RDoc output format.  This extension is disabled
+# by default.
+#
+# Example:
+#
+#     <style type="text/css">
+#     h1 { font-size: 3em }
+#     </style>
+#
+# ### Definition Lists
+#
+# The definition_lists extension allows definition lists using the [PHP
+# Markdown Extra syntax][PHPE], but only one label and definition are supported
+# at this time.  This extension is enabled by default.
+#
+# Example:
+#
+# ```
+# cat
+# :   A small furry mammal
+# that seems to sleep a lot
+#
+# ant
+# :   A little insect that is known
+# to enjoy picnics
+# 
+# ```
+#
+# Produces:
+#
+# cat
+# :   A small furry mammal
+# that seems to sleep a lot
+#
+# ant
+# :   A little insect that is known
+# to enjoy picnics
+#
+# ### Github
+#
+# The #github extension enables a partial set of [Github Flavored Markdown]
+# [GFM].  This extension is enabled by default.
+#
+# Supported github extensions include:
+#
+# #### Fenced code blocks
+#
+# Use ` ``` ` around a block of code instead of indenting it four spaces.
+#
+# #### Syntax highlighting
+#
+# Use ` ``` ruby ` as the start of a code fence to add syntax highlighting.
+# (Currently only `ruby` syntax is supported).
+#
+# ### HTML
+#
+# Enables raw HTML to be included in the output.  This extension is enabled by
+# default.
+#
+# Example:
+#
+#     <table>
+#     ...
+#     </table>
+#
+# ### Notes
+#
+# The #notes extension enables footnote support.  This extension is enabled by
+# default.
+#
+# Example:
+#
+#     Here is some text[^1] including an inline footnote ^[for short footnotes]
+#
+#     ...
+#
+#     [^1]: With the footnote text down at the bottom
+#
+# Produces:
+#
+# Here is some text[^1] including an inline footnote ^[for short footnotes]
+#
+# [^1]: With the footnote text down at the bottom
+#
+# ## Limitations
+#
+# * Link titles are not used
+# * Image links are not generated correctly
+# * Footnotes are collapsed into a single paragraph
+#
+# ## Author
+#
+# This markdown parser is a port to kpeg from [peg-markdown][pegmarkdown] by
+# John MacFarlane.
+#
+# It is used under the MIT license:
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# The port to kpeg was performed by Eric Hodel and Evan Phoenix
+#
+# [dingus]: http://daringfireball.net/projects/markdown/dingus
+# [GFM]: http://github.github.com/github-flavored-markdown/
+# [pegmarkdown]: https://github.com/jgm/peg-markdown
+# [PHPE]: http://michelf.com/projects/php-markdown/extra/#def-list
+# [syntax]: http://daringfireball.net/projects/markdown/syntax
+#--
+# Last updated to jgm/peg-markdown commit 8f8fc22ef0
+class RDoc::Markdown
+  # :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)
+      @string = str
+      @pos = 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
+
+    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? :getbyte
+      def get_byte
+        if @pos >= @string.size
+          return nil
+        end
+
+        s = @string.getbyte @pos
+        @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
+
+      @pos = other.pos
+      @string = other.string
+
+      begin
+        if val = __send__(rule, *args)
+          other.pos = @pos
+          other.result = @result
+        else
+          other.set_failed_rule "#{self.class}##{rule}"
+        end
+        val
+      ensure
+        @pos = old_pos
+        @string = old_string
+      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)
+     (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]