mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge rdoc-6.1.0.beta2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2a59b579fe
commit
1b43644edc
38 changed files with 602 additions and 528 deletions
|
@ -23,8 +23,8 @@ class RDoc::CrossReference
|
||||||
|
|
||||||
##
|
##
|
||||||
# Regular expressions matching text that should potentially have
|
# Regular expressions matching text that should potentially have
|
||||||
# cross-reference links generated are passed to add_special. Note that
|
# cross-reference links generated are passed to add_regexp_handling. Note
|
||||||
# these expressions are meant to pick up text for which cross-references
|
# that these expressions are meant to pick up text for which cross-references
|
||||||
# have been suppressed, since the suppression characters are removed by the
|
# have been suppressed, since the suppression characters are removed by the
|
||||||
# code that is triggered.
|
# code that is triggered.
|
||||||
|
|
||||||
|
|
|
@ -65,17 +65,16 @@
|
||||||
# puts h.convert(input_string)
|
# puts h.convert(input_string)
|
||||||
#
|
#
|
||||||
# You can extend the RDoc::Markup parser to recognize new markup
|
# You can extend the RDoc::Markup parser to recognize new markup
|
||||||
# sequences, and to add special processing for text that matches a
|
# sequences, and to add regexp handling. Here we make WikiWords significant to
|
||||||
# regular expression. Here we make WikiWords significant to the parser,
|
# the parser, and also make the sequences {word} and \<no>text...</no> signify
|
||||||
# and also make the sequences {word} and \<no>text...</no> signify
|
|
||||||
# strike-through text. We then subclass the HTML output class to deal
|
# strike-through text. We then subclass the HTML output class to deal
|
||||||
# with these:
|
# with these:
|
||||||
#
|
#
|
||||||
# require 'rdoc'
|
# require 'rdoc'
|
||||||
#
|
#
|
||||||
# class WikiHtml < RDoc::Markup::ToHtml
|
# class WikiHtml < RDoc::Markup::ToHtml
|
||||||
# def handle_special_WIKIWORD(special)
|
# def handle_regexp_WIKIWORD(target)
|
||||||
# "<font color=red>" + special.text + "</font>"
|
# "<font color=red>" + target.text + "</font>"
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
@ -83,7 +82,7 @@
|
||||||
# markup.add_word_pair("{", "}", :STRIKE)
|
# markup.add_word_pair("{", "}", :STRIKE)
|
||||||
# markup.add_html("no", :STRIKE)
|
# markup.add_html("no", :STRIKE)
|
||||||
#
|
#
|
||||||
# markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
# markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
||||||
#
|
#
|
||||||
# wh = WikiHtml.new RDoc::Options.new, markup
|
# wh = WikiHtml.new RDoc::Options.new, markup
|
||||||
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
|
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
|
||||||
|
@ -800,13 +799,12 @@ https://github.com/ruby/rdoc/issues
|
||||||
# Add to other inline sequences. For example, we could add WikiWords using
|
# Add to other inline sequences. For example, we could add WikiWords using
|
||||||
# something like:
|
# something like:
|
||||||
#
|
#
|
||||||
# parser.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
# parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
||||||
#
|
#
|
||||||
# Each wiki word will be presented to the output formatter via the
|
# Each wiki word will be presented to the output formatter.
|
||||||
# accept_special method.
|
|
||||||
|
|
||||||
def add_special(pattern, name)
|
def add_regexp_handling(pattern, name)
|
||||||
@attribute_manager.add_special(pattern, name)
|
@attribute_manager.add_regexp_handling(pattern, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -832,7 +830,7 @@ https://github.com/ruby/rdoc/issues
|
||||||
autoload :AttrSpan, 'rdoc/markup/attr_span'
|
autoload :AttrSpan, 'rdoc/markup/attr_span'
|
||||||
autoload :Attributes, 'rdoc/markup/attributes'
|
autoload :Attributes, 'rdoc/markup/attributes'
|
||||||
autoload :AttributeManager, 'rdoc/markup/attribute_manager'
|
autoload :AttributeManager, 'rdoc/markup/attribute_manager'
|
||||||
autoload :Special, 'rdoc/markup/special'
|
autoload :RegexpHandling, 'rdoc/markup/regexp_handling'
|
||||||
|
|
||||||
# RDoc::Markup AST
|
# RDoc::Markup AST
|
||||||
autoload :BlankLine, 'rdoc/markup/blank_line'
|
autoload :BlankLine, 'rdoc/markup/blank_line'
|
||||||
|
|
|
@ -53,10 +53,10 @@ class RDoc::Markup::AttributeManager
|
||||||
attr_reader :protectable
|
attr_reader :protectable
|
||||||
|
|
||||||
##
|
##
|
||||||
# And this maps _special_ sequences to a name. A special sequence is
|
# And this maps _regexp handling_ sequences to a name. A regexp handling
|
||||||
# something like a WikiWord
|
# sequence is something like a WikiWord
|
||||||
|
|
||||||
attr_reader :special
|
attr_reader :regexp_handlings
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new attribute manager that understands bold, emphasized and
|
# Creates a new attribute manager that understands bold, emphasized and
|
||||||
|
@ -66,7 +66,7 @@ class RDoc::Markup::AttributeManager
|
||||||
@html_tags = {}
|
@html_tags = {}
|
||||||
@matching_word_pairs = {}
|
@matching_word_pairs = {}
|
||||||
@protectable = %w[<]
|
@protectable = %w[<]
|
||||||
@special = []
|
@regexp_handlings = []
|
||||||
@word_pair_map = {}
|
@word_pair_map = {}
|
||||||
@attributes = RDoc::Markup::Attributes.new
|
@attributes = RDoc::Markup::Attributes.new
|
||||||
|
|
||||||
|
@ -166,22 +166,22 @@ class RDoc::Markup::AttributeManager
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Converts special sequences to RDoc attributes
|
# Converts regexp handling sequences to RDoc attributes
|
||||||
|
|
||||||
def convert_specials str, attrs
|
def convert_regexp_handlings str, attrs
|
||||||
@special.each do |regexp, attribute|
|
@regexp_handlings.each do |regexp, attribute|
|
||||||
str.scan(regexp) do
|
str.scan(regexp) do
|
||||||
capture = $~.size == 1 ? 0 : 1
|
capture = $~.size == 1 ? 0 : 1
|
||||||
|
|
||||||
s, e = $~.offset capture
|
s, e = $~.offset capture
|
||||||
|
|
||||||
attrs.set_attrs s, e - s, attribute | @attributes.special
|
attrs.set_attrs s, e - s, attribute | @attributes.regexp_handling
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Escapes special sequences of text to prevent conversion to RDoc
|
# Escapes regexp handling sequences of text to prevent conversion to RDoc
|
||||||
|
|
||||||
def mask_protected_sequences
|
def mask_protected_sequences
|
||||||
# protect __send__, __FILE__, etc.
|
# protect __send__, __FILE__, etc.
|
||||||
|
@ -193,7 +193,7 @@ class RDoc::Markup::AttributeManager
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Unescapes special sequences of text
|
# Unescapes regexp handling sequences of text
|
||||||
|
|
||||||
def unmask_protected_sequences
|
def unmask_protected_sequences
|
||||||
@str.gsub!(/(.)#{PROTECT_ATTR}/, "\\1\000")
|
@str.gsub!(/(.)#{PROTECT_ATTR}/, "\\1\000")
|
||||||
|
@ -233,17 +233,17 @@ class RDoc::Markup::AttributeManager
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Adds a special handler for +pattern+ with +name+. A simple URL handler
|
# Adds a regexp handling for +pattern+ with +name+. A simple URL handler
|
||||||
# would be:
|
# would be:
|
||||||
#
|
#
|
||||||
# @am.add_special(/((https?:)\S+\w)/, :HYPERLINK)
|
# @am.add_regexp_handling(/((https?:)\S+\w)/, :HYPERLINK)
|
||||||
|
|
||||||
def add_special pattern, name
|
def add_regexp_handling pattern, name
|
||||||
@special << [pattern, @attributes.bitmap_for(name)]
|
@regexp_handlings << [pattern, @attributes.bitmap_for(name)]
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Processes +str+ converting attributes, HTML and specials
|
# Processes +str+ converting attributes, HTML and regexp handlings
|
||||||
|
|
||||||
def flow str
|
def flow str
|
||||||
@str = str.dup
|
@str = str.dup
|
||||||
|
@ -254,7 +254,7 @@ class RDoc::Markup::AttributeManager
|
||||||
|
|
||||||
convert_attrs @str, @attrs
|
convert_attrs @str, @attrs
|
||||||
convert_html @str, @attrs
|
convert_html @str, @attrs
|
||||||
convert_specials @str, @attrs
|
convert_regexp_handlings @str, @attrs
|
||||||
|
|
||||||
unmask_protected_sequences
|
unmask_protected_sequences
|
||||||
|
|
||||||
|
@ -312,11 +312,11 @@ class RDoc::Markup::AttributeManager
|
||||||
res << change_attribute(current_attr, new_attr)
|
res << change_attribute(current_attr, new_attr)
|
||||||
current_attr = new_attr
|
current_attr = new_attr
|
||||||
|
|
||||||
if (current_attr & @attributes.special) != 0 then
|
if (current_attr & @attributes.regexp_handling) != 0 then
|
||||||
i += 1 while
|
i += 1 while
|
||||||
i < str_len and (@attrs[i] & @attributes.special) != 0
|
i < str_len and (@attrs[i] & @attributes.regexp_handling) != 0
|
||||||
|
|
||||||
res << RDoc::Markup::Special.new(current_attr,
|
res << RDoc::Markup::RegexpHandling.new(current_attr,
|
||||||
copy_string(start_pos, i))
|
copy_string(start_pos, i))
|
||||||
start_pos = i
|
start_pos = i
|
||||||
next
|
next
|
||||||
|
|
|
@ -6,21 +6,21 @@
|
||||||
class RDoc::Markup::Attributes
|
class RDoc::Markup::Attributes
|
||||||
|
|
||||||
##
|
##
|
||||||
# The special attribute type. See RDoc::Markup#add_special
|
# The regexp handling attribute type. See RDoc::Markup#add_regexp_handling
|
||||||
|
|
||||||
attr_reader :special
|
attr_reader :regexp_handling
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new attributes set.
|
# Creates a new attributes set.
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@special = 1
|
@regexp_handling = 1
|
||||||
|
|
||||||
@name_to_bitmap = [
|
@name_to_bitmap = [
|
||||||
[:_SPECIAL_, @special],
|
[:_REGEXP_HANDLING_, @regexp_handling],
|
||||||
]
|
]
|
||||||
|
|
||||||
@next_bitmap = @special << 1
|
@next_bitmap = @regexp_handling << 1
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -61,7 +61,7 @@ class RDoc::Markup::Attributes
|
||||||
return enum_for __method__, bitmap unless block_given?
|
return enum_for __method__, bitmap unless block_given?
|
||||||
|
|
||||||
@name_to_bitmap.each do |name, bit|
|
@name_to_bitmap.each do |name, bit|
|
||||||
next if bit == @special
|
next if bit == @regexp_handling
|
||||||
|
|
||||||
yield name.to_s if (bitmap & bit) != 0
|
yield name.to_s if (bitmap & bit) != 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,7 +50,7 @@ class RDoc::Markup::Formatter
|
||||||
|
|
||||||
@markup = markup || RDoc::Markup.new
|
@markup = markup || RDoc::Markup.new
|
||||||
@am = @markup.attribute_manager
|
@am = @markup.attribute_manager
|
||||||
@am.add_special(/<br>/, :HARD_BREAK)
|
@am.add_regexp_handling(/<br>/, :HARD_BREAK)
|
||||||
|
|
||||||
@attributes = @am.attributes
|
@attributes = @am.attributes
|
||||||
|
|
||||||
|
@ -78,17 +78,18 @@ class RDoc::Markup::Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Adds a special for links of the form rdoc-...:
|
# Adds a regexp handling for links of the form rdoc-...:
|
||||||
|
|
||||||
def add_special_RDOCLINK
|
def add_regexp_handling_RDOCLINK
|
||||||
@markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
|
@markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Adds a special for links of the form {<text>}[<url>] and <word>[<url>]
|
# Adds a regexp handling for links of the form {<text>}[<url>] and
|
||||||
|
# <word>[<url>]
|
||||||
|
|
||||||
def add_special_TIDYLINK
|
def add_regexp_handling_TIDYLINK
|
||||||
@markup.add_special(/(?:
|
@markup.add_regexp_handling(/(?:
|
||||||
\{.*?\} | # multi-word label
|
\{.*?\} | # multi-word label
|
||||||
\b[^\s{}]+? # single-word label
|
\b[^\s{}]+? # single-word label
|
||||||
)
|
)
|
||||||
|
@ -133,8 +134,8 @@ class RDoc::Markup::Formatter
|
||||||
when RDoc::Markup::AttrChanger then
|
when RDoc::Markup::AttrChanger then
|
||||||
off_tags res, item
|
off_tags res, item
|
||||||
on_tags res, item
|
on_tags res, item
|
||||||
when RDoc::Markup::Special then
|
when RDoc::Markup::RegexpHandling then
|
||||||
res << convert_special(item)
|
res << convert_regexp_handling(item)
|
||||||
else
|
else
|
||||||
raise "Unknown flow element: #{item.inspect}"
|
raise "Unknown flow element: #{item.inspect}"
|
||||||
end
|
end
|
||||||
|
@ -144,29 +145,29 @@ class RDoc::Markup::Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Converts added specials. See RDoc::Markup#add_special
|
# Converts added regexp handlings. See RDoc::Markup#add_regexp_handling
|
||||||
|
|
||||||
def convert_special special
|
def convert_regexp_handling target
|
||||||
return special.text if in_tt?
|
return target.text if in_tt?
|
||||||
|
|
||||||
handled = false
|
handled = false
|
||||||
|
|
||||||
@attributes.each_name_of special.type do |name|
|
@attributes.each_name_of target.type do |name|
|
||||||
method_name = "handle_special_#{name}"
|
method_name = "handle_regexp_#{name}"
|
||||||
|
|
||||||
if respond_to? method_name then
|
if respond_to? method_name then
|
||||||
special.text = send method_name, special
|
target.text = send method_name, target
|
||||||
handled = true
|
handled = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless handled then
|
unless handled then
|
||||||
special_name = @attributes.as_string special.type
|
target_name = @attributes.as_string target.type
|
||||||
|
|
||||||
raise RDoc::Error, "Unhandled special #{special_name}: #{special}"
|
raise RDoc::Error, "Unhandled regexp handling #{target_name}: #{target}"
|
||||||
end
|
end
|
||||||
|
|
||||||
special.text
|
target.text
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -23,12 +23,12 @@ RDoc::Markup::Heading =
|
||||||
return @to_html if @to_html
|
return @to_html if @to_html
|
||||||
|
|
||||||
markup = RDoc::Markup.new
|
markup = RDoc::Markup.new
|
||||||
markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
|
markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
|
||||||
|
|
||||||
@to_html = RDoc::Markup::ToHtml.new nil
|
@to_html = RDoc::Markup::ToHtml.new nil
|
||||||
|
|
||||||
def @to_html.handle_special_CROSSREF special
|
def @to_html.handle_regexp_CROSSREF target
|
||||||
special.text.sub(/^\\/, '')
|
target.text.sub(/^\\/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
@to_html
|
@to_html
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w
|
|
41
lib/rdoc/markup/regexp_handling.rb
Normal file
41
lib/rdoc/markup/regexp_handling.rb
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
##
|
||||||
|
# Hold details of a regexp handling sequence
|
||||||
|
|
||||||
|
class RDoc::Markup::RegexpHandling
|
||||||
|
|
||||||
|
##
|
||||||
|
# Regexp handling type
|
||||||
|
|
||||||
|
attr_reader :type
|
||||||
|
|
||||||
|
##
|
||||||
|
# Regexp handling text
|
||||||
|
|
||||||
|
attr_accessor :text
|
||||||
|
|
||||||
|
##
|
||||||
|
# Creates a new regexp handling sequence of +type+ with +text+
|
||||||
|
|
||||||
|
def initialize(type, text)
|
||||||
|
@type, @text = type, text
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Regexp handlings are equal when the have the same text and type
|
||||||
|
|
||||||
|
def ==(o)
|
||||||
|
self.text == o.text && self.type == o.type
|
||||||
|
end
|
||||||
|
|
||||||
|
def inspect # :nodoc:
|
||||||
|
"#<RDoc::Markup::RegexpHandling:0x%x @type=%p, @text=%p>" % [
|
||||||
|
object_id, @type, text.dump]
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_s # :nodoc:
|
||||||
|
"RegexpHandling: type=#{type} text=#{text.dump}"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
##
|
|
||||||
# Hold details of a special sequence
|
|
||||||
|
|
||||||
class RDoc::Markup::Special
|
|
||||||
|
|
||||||
##
|
|
||||||
# Special type
|
|
||||||
|
|
||||||
attr_reader :type
|
|
||||||
|
|
||||||
##
|
|
||||||
# Special text
|
|
||||||
|
|
||||||
attr_accessor :text
|
|
||||||
|
|
||||||
##
|
|
||||||
# Creates a new special sequence of +type+ with +text+
|
|
||||||
|
|
||||||
def initialize(type, text)
|
|
||||||
@type, @text = type, text
|
|
||||||
end
|
|
||||||
|
|
||||||
##
|
|
||||||
# Specials are equal when the have the same text and type
|
|
||||||
|
|
||||||
def ==(o)
|
|
||||||
self.text == o.text && self.type == o.type
|
|
||||||
end
|
|
||||||
|
|
||||||
def inspect # :nodoc:
|
|
||||||
"#<RDoc::Markup::Special:0x%x @type=%p, @text=%p>" % [
|
|
||||||
object_id, @type, text.dump]
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s # :nodoc:
|
|
||||||
"Special: type=#{type} text=#{text.dump}"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Turns on or off special handling for +convert_string+
|
# Turns on or off regexp handling for +convert_string+
|
||||||
|
|
||||||
def annotate tag
|
def annotate tag
|
||||||
case tag
|
case tag
|
||||||
|
@ -54,9 +54,9 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Calls convert_string on the result of convert_special
|
# Calls convert_string on the result of convert_regexp_handling
|
||||||
|
|
||||||
def convert_special special
|
def convert_regexp_handling target
|
||||||
convert_string super
|
convert_string super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -53,18 +53,18 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||||
@hard_break = "<br>\n"
|
@hard_break = "<br>\n"
|
||||||
|
|
||||||
# external links
|
# external links
|
||||||
@markup.add_special(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
|
@markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
|
||||||
:HYPERLINK)
|
:HYPERLINK)
|
||||||
|
|
||||||
add_special_RDOCLINK
|
add_regexp_handling_RDOCLINK
|
||||||
add_special_TIDYLINK
|
add_regexp_handling_TIDYLINK
|
||||||
|
|
||||||
init_tags
|
init_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
# :section: Special Handling
|
# :section: Regexp Handling
|
||||||
#
|
#
|
||||||
# These methods handle special markup added by RDoc::Markup#add_special.
|
# These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling.
|
||||||
|
|
||||||
def handle_RDOCLINK url # :nodoc:
|
def handle_RDOCLINK url # :nodoc:
|
||||||
case url
|
case url
|
||||||
|
@ -91,14 +91,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# +special+ is a <code><br></code>
|
# +target+ is a <code><br></code>
|
||||||
|
|
||||||
def handle_special_HARD_BREAK special
|
def handle_regexp_HARD_BREAK target
|
||||||
'<br>'
|
'<br>'
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# +special+ is a potential link. The following schemes are handled:
|
# +target+ is a potential link. The following schemes are handled:
|
||||||
#
|
#
|
||||||
# <tt>mailto:</tt>::
|
# <tt>mailto:</tt>::
|
||||||
# Inserted as-is.
|
# Inserted as-is.
|
||||||
|
@ -109,14 +109,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||||
# <tt>link:</tt>::
|
# <tt>link:</tt>::
|
||||||
# Reference to a local file relative to the output directory.
|
# Reference to a local file relative to the output directory.
|
||||||
|
|
||||||
def handle_special_HYPERLINK(special)
|
def handle_regexp_HYPERLINK(target)
|
||||||
url = special.text
|
url = target.text
|
||||||
|
|
||||||
gen_url url, url
|
gen_url url, url
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# +special+ is an rdoc-schemed link that will be converted into a hyperlink.
|
# +target+ is an rdoc-schemed link that will be converted into a hyperlink.
|
||||||
#
|
#
|
||||||
# For the +rdoc-ref+ scheme the named reference will be returned without
|
# For the +rdoc-ref+ scheme the named reference will be returned without
|
||||||
# creating a link.
|
# creating a link.
|
||||||
|
@ -124,16 +124,16 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||||
# For the +rdoc-label+ scheme the footnote and label prefixes are stripped
|
# For the +rdoc-label+ scheme the footnote and label prefixes are stripped
|
||||||
# when creating a link. All other contents will be linked verbatim.
|
# when creating a link. All other contents will be linked verbatim.
|
||||||
|
|
||||||
def handle_special_RDOCLINK special
|
def handle_regexp_RDOCLINK target
|
||||||
handle_RDOCLINK special.text
|
handle_RDOCLINK target.text
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# This +special+ is a link where the label is different from the URL
|
# This +target+ is a link where the label is different from the URL
|
||||||
# <tt>label[url]</tt> or <tt>{long label}[url]</tt>
|
# <tt>label[url]</tt> or <tt>{long label}[url]</tt>
|
||||||
|
|
||||||
def handle_special_TIDYLINK(special)
|
def handle_regexp_TIDYLINK(target)
|
||||||
text = special.text
|
text = target.text
|
||||||
|
|
||||||
return text unless
|
return text unless
|
||||||
text =~ /^\{(.*)\}\[(.*?)\]$/ or text =~ /^(\S+)\[(.*?)\]$/
|
text =~ /^\{(.*)\}\[(.*?)\]$/ or text =~ /^(\S+)\[(.*?)\]$/
|
||||||
|
@ -186,7 +186,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||||
@res << "\n<p>"
|
@res << "\n<p>"
|
||||||
text = paragraph.text @hard_break
|
text = paragraph.text @hard_break
|
||||||
text = text.gsub(/\r?\n/, ' ')
|
text = text.gsub(/\r?\n/, ' ')
|
||||||
@res << wrap(to_html(text))
|
@res << to_html(text)
|
||||||
@res << "</p>\n"
|
@res << "</p>\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||||
|
|
||||||
##
|
##
|
||||||
# Generate a link to +url+ with content +text+. Handles the special cases
|
# Generate a link to +url+ with content +text+. Handles the special cases
|
||||||
# for img: and link: described under handle_special_HYPERLINK
|
# for img: and link: described under handle_regexp_HYPERLINK
|
||||||
|
|
||||||
def gen_url url, text
|
def gen_url url, text
|
||||||
scheme, url, id = parse_url url
|
scheme, url, id = parse_url url
|
||||||
|
|
|
@ -40,7 +40,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
@show_hash = @options.show_hash
|
@show_hash = @options.show_hash
|
||||||
|
|
||||||
crossref_re = @hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
|
crossref_re = @hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
|
||||||
@markup.add_special crossref_re, :CROSSREF
|
@markup.add_regexp_handling crossref_re, :CROSSREF
|
||||||
|
|
||||||
@cross_reference = RDoc::CrossReference.new @context
|
@cross_reference = RDoc::CrossReference.new @context
|
||||||
end
|
end
|
||||||
|
@ -68,8 +68,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
# example, ToHtml is found, even without the <tt>RDoc::Markup::</tt> prefix,
|
# example, ToHtml is found, even without the <tt>RDoc::Markup::</tt> prefix,
|
||||||
# because we look for it in module Markup first.
|
# because we look for it in module Markup first.
|
||||||
|
|
||||||
def handle_special_CROSSREF(special)
|
def handle_regexp_CROSSREF(target)
|
||||||
name = special.text
|
name = target.text
|
||||||
|
|
||||||
return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails
|
return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails
|
||||||
|
|
||||||
|
@ -87,22 +87,22 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
# Handles <tt>rdoc-ref:</tt> scheme links and allows RDoc::Markup::ToHtml to
|
# Handles <tt>rdoc-ref:</tt> scheme links and allows RDoc::Markup::ToHtml to
|
||||||
# handle other schemes.
|
# handle other schemes.
|
||||||
|
|
||||||
def handle_special_HYPERLINK special
|
def handle_regexp_HYPERLINK target
|
||||||
return cross_reference $' if special.text =~ /\Ardoc-ref:/
|
return cross_reference $' if target.text =~ /\Ardoc-ref:/
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# +special+ is an rdoc-schemed link that will be converted into a hyperlink.
|
# +target+ is an rdoc-schemed link that will be converted into a hyperlink.
|
||||||
# For the rdoc-ref scheme the cross-reference will be looked up and the
|
# For the rdoc-ref scheme the cross-reference will be looked up and the
|
||||||
# given name will be used.
|
# given name will be used.
|
||||||
#
|
#
|
||||||
# All other contents are handled by
|
# All other contents are handled by
|
||||||
# {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_special_RDOCLINK]
|
# {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_regexp_RDOCLINK]
|
||||||
|
|
||||||
def handle_special_RDOCLINK special
|
def handle_regexp_RDOCLINK target
|
||||||
url = special.text
|
url = target.text
|
||||||
|
|
||||||
case url
|
case url
|
||||||
when /\Ardoc-ref:/ then
|
when /\Ardoc-ref:/ then
|
||||||
|
@ -126,8 +126,6 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
# Creates an HTML link to +name+ with the given +text+.
|
# Creates an HTML link to +name+ with the given +text+.
|
||||||
|
|
||||||
def link name, text
|
def link name, text
|
||||||
original_name = name
|
|
||||||
|
|
||||||
if name =~ /(.*[^#:])@/ then
|
if name =~ /(.*[^#:])@/ then
|
||||||
name = $1
|
name = $1
|
||||||
label = $'
|
label = $'
|
||||||
|
|
|
@ -44,7 +44,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
|
||||||
@mask = 0
|
@mask = 0
|
||||||
@paragraphs = 0
|
@paragraphs = 0
|
||||||
|
|
||||||
@markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
|
@markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -71,7 +71,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
|
||||||
|
|
||||||
text = paragraph.text @hard_break
|
text = paragraph.text @hard_break
|
||||||
|
|
||||||
@res << "#{para}#{wrap to_html text}\n"
|
@res << "#{para}#{to_html text}\n"
|
||||||
|
|
||||||
add_paragraph
|
add_paragraph
|
||||||
end
|
end
|
||||||
|
@ -123,16 +123,16 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Removes escaping from the cross-references in +special+
|
# Removes escaping from the cross-references in +target+
|
||||||
|
|
||||||
def handle_special_CROSSREF special
|
def handle_regexp_CROSSREF target
|
||||||
special.text.sub(/\A\\/, '')
|
target.text.sub(/\A\\/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# +special+ is a <code><br></code>
|
# +target+ is a <code><br></code>
|
||||||
|
|
||||||
def handle_special_HARD_BREAK special
|
def handle_regexp_HARD_BREAK target
|
||||||
@characters -= 4
|
@characters -= 4
|
||||||
'<br>'
|
'<br>'
|
||||||
end
|
end
|
||||||
|
@ -226,8 +226,8 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
|
||||||
when String then
|
when String then
|
||||||
text = convert_string item
|
text = convert_string item
|
||||||
res << truncate(text)
|
res << truncate(text)
|
||||||
when RDoc::Markup::Special then
|
when RDoc::Markup::RegexpHandling then
|
||||||
text = convert_special item
|
text = convert_regexp_handling item
|
||||||
res << truncate(text)
|
res << truncate(text)
|
||||||
else
|
else
|
||||||
raise "Unknown flow element: #{item.inspect}"
|
raise "Unknown flow element: #{item.inspect}"
|
||||||
|
|
|
@ -16,8 +16,8 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
|
||||||
def initialize markup = nil
|
def initialize markup = nil
|
||||||
super nil, markup
|
super nil, markup
|
||||||
|
|
||||||
@markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
|
@markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
|
||||||
@markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
|
@markup.add_regexp_handling(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
|
||||||
|
|
||||||
add_tag :BOLD, '', ''
|
add_tag :BOLD, '', ''
|
||||||
add_tag :TT, '', ''
|
add_tag :TT, '', ''
|
||||||
|
@ -36,20 +36,20 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Converts the CROSSREF +special+ to plain text, removing the suppression
|
# Converts the CROSSREF +target+ to plain text, removing the suppression
|
||||||
# marker, if any
|
# marker, if any
|
||||||
|
|
||||||
def handle_special_CROSSREF special
|
def handle_regexp_CROSSREF target
|
||||||
text = special.text
|
text = target.text
|
||||||
|
|
||||||
text.sub(/^\\/, '')
|
text.sub(/^\\/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Converts the TIDYLINK +special+ to just the text part
|
# Converts the TIDYLINK +target+ to just the text part
|
||||||
|
|
||||||
def handle_special_TIDYLINK special
|
def handle_regexp_TIDYLINK target
|
||||||
text = special.text
|
text = target.text
|
||||||
|
|
||||||
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
|
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
|
||||||
alias accept_rule ignore
|
alias accept_rule ignore
|
||||||
alias accept_verbatim ignore
|
alias accept_verbatim ignore
|
||||||
alias end_accepting ignore
|
alias end_accepting ignore
|
||||||
alias handle_special_HARD_BREAK ignore
|
alias handle_regexp_HARD_BREAK ignore
|
||||||
alias start_accepting ignore
|
alias start_accepting ignore
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,8 +19,8 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
||||||
@headings[5] = ['##### ', '']
|
@headings[5] = ['##### ', '']
|
||||||
@headings[6] = ['###### ', '']
|
@headings[6] = ['###### ', '']
|
||||||
|
|
||||||
add_special_RDOCLINK
|
add_regexp_handling_RDOCLINK
|
||||||
add_special_TIDYLINK
|
add_regexp_handling_TIDYLINK
|
||||||
|
|
||||||
@hard_break = " \n"
|
@hard_break = " \n"
|
||||||
end
|
end
|
||||||
|
@ -37,7 +37,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
||||||
##
|
##
|
||||||
# Adds a newline to the output
|
# Adds a newline to the output
|
||||||
|
|
||||||
def handle_special_HARD_BREAK special
|
def handle_regexp_HARD_BREAK target
|
||||||
" \n"
|
" \n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
||||||
##
|
##
|
||||||
# Converts the RDoc markup tidylink into a Markdown.style link.
|
# Converts the RDoc markup tidylink into a Markdown.style link.
|
||||||
|
|
||||||
def handle_special_TIDYLINK special
|
def handle_regexp_TIDYLINK target
|
||||||
text = special.text
|
text = target.text
|
||||||
|
|
||||||
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
|
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
|
||||||
|
|
||||||
|
@ -184,8 +184,8 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
||||||
##
|
##
|
||||||
# Converts the rdoc-...: links into a Markdown.style links.
|
# Converts the rdoc-...: links into a Markdown.style links.
|
||||||
|
|
||||||
def handle_special_RDOCLINK special
|
def handle_regexp_RDOCLINK target
|
||||||
handle_rdoc_link special.text
|
handle_rdoc_link target.text
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,7 +45,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
||||||
def initialize markup = nil
|
def initialize markup = nil
|
||||||
super nil, markup
|
super nil, markup
|
||||||
|
|
||||||
@markup.add_special(/\\\S/, :SUPPRESSED_CROSSREF)
|
@markup.add_regexp_handling(/\\\S/, :SUPPRESSED_CROSSREF)
|
||||||
@width = 78
|
@width = 78
|
||||||
init_tags
|
init_tags
|
||||||
|
|
||||||
|
@ -253,10 +253,10 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Removes preceding \\ from the suppressed crossref +special+
|
# Removes preceding \\ from the suppressed crossref +target+
|
||||||
|
|
||||||
def handle_special_SUPPRESSED_CROSSREF special
|
def handle_regexp_SUPPRESSED_CROSSREF target
|
||||||
text = special.text
|
text = target.text
|
||||||
text = text.sub('\\', '') unless in_tt?
|
text = text.sub('\\', '') unless in_tt?
|
||||||
text
|
text
|
||||||
end
|
end
|
||||||
|
@ -264,7 +264,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
||||||
##
|
##
|
||||||
# Adds a newline to the output
|
# Adds a newline to the output
|
||||||
|
|
||||||
def handle_special_HARD_BREAK special
|
def handle_regexp_HARD_BREAK target
|
||||||
"\n"
|
"\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,8 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
|
||||||
when RDoc::Markup::AttrChanger then
|
when RDoc::Markup::AttrChanger then
|
||||||
off_tags res, item
|
off_tags res, item
|
||||||
on_tags res, item
|
on_tags res, item
|
||||||
when RDoc::Markup::Special then
|
when RDoc::Markup::RegexpHandling then
|
||||||
@res << convert_special(item) if in_tt? # TODO can this happen?
|
@res << convert_regexp_handling(item) if in_tt? # TODO can this happen?
|
||||||
else
|
else
|
||||||
raise "Unknown flow element: #{item.inspect}"
|
raise "Unknown flow element: #{item.inspect}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,7 +50,7 @@ class RDoc::Parser::RipperStateLex
|
||||||
@continue = false
|
@continue = false
|
||||||
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
||||||
end
|
end
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_ignored_nl(tok, data)
|
def on_ignored_nl(tok, data)
|
||||||
|
@ -61,7 +61,7 @@ class RDoc::Parser::RipperStateLex
|
||||||
@continue = false
|
@continue = false
|
||||||
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
||||||
end
|
end
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_op(tok, data)
|
def on_op(tok, data)
|
||||||
|
@ -103,7 +103,7 @@ class RDoc::Parser::RipperStateLex
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_kw(tok, data)
|
def on_kw(tok, data)
|
||||||
|
@ -132,54 +132,54 @@ class RDoc::Parser::RipperStateLex
|
||||||
@lex_state = EXPR_END
|
@lex_state = EXPR_END
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_tstring_beg(tok, data)
|
def on_tstring_beg(tok, data)
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_tstring_end(tok, data)
|
def on_tstring_end(tok, data)
|
||||||
@lex_state = EXPR_END | EXPR_ENDARG
|
@lex_state = EXPR_END | EXPR_ENDARG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_CHAR(tok, data)
|
def on_CHAR(tok, data)
|
||||||
@lex_state = EXPR_END
|
@lex_state = EXPR_END
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_period(tok, data)
|
def on_period(tok, data)
|
||||||
@lex_state = EXPR_DOT
|
@lex_state = EXPR_DOT
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_int(tok, data)
|
def on_int(tok, data)
|
||||||
@lex_state = EXPR_END | EXPR_ENDARG
|
@lex_state = EXPR_END | EXPR_ENDARG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_float(tok, data)
|
def on_float(tok, data)
|
||||||
@lex_state = EXPR_END | EXPR_ENDARG
|
@lex_state = EXPR_END | EXPR_ENDARG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_rational(tok, data)
|
def on_rational(tok, data)
|
||||||
@lex_state = EXPR_END | EXPR_ENDARG
|
@lex_state = EXPR_END | EXPR_ENDARG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_imaginary(tok, data)
|
def on_imaginary(tok, data)
|
||||||
@lex_state = EXPR_END | EXPR_ENDARG
|
@lex_state = EXPR_END | EXPR_ENDARG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_symbeg(tok, data)
|
def on_symbeg(tok, data)
|
||||||
@lex_state = EXPR_FNAME
|
@lex_state = EXPR_FNAME
|
||||||
@continue = true
|
@continue = true
|
||||||
@in_fname = true
|
@in_fname = true
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
private def on_variables(event, tok, data)
|
private def on_variables(event, tok, data)
|
||||||
|
@ -198,7 +198,7 @@ class RDoc::Parser::RipperStateLex
|
||||||
else
|
else
|
||||||
@lex_state = EXPR_CMDARG
|
@lex_state = EXPR_CMDARG
|
||||||
end
|
end
|
||||||
@callback.call(Token.new(lineno, column, event, tok, @lex_state))
|
data << Token.new(lineno, column, event, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_ident(tok, data)
|
def on_ident(tok, data)
|
||||||
|
@ -227,32 +227,32 @@ class RDoc::Parser::RipperStateLex
|
||||||
|
|
||||||
def on_lparen(tok, data)
|
def on_lparen(tok, data)
|
||||||
@lex_state = EXPR_LABEL | EXPR_BEG
|
@lex_state = EXPR_LABEL | EXPR_BEG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_rparen(tok, data)
|
def on_rparen(tok, data)
|
||||||
@lex_state = EXPR_ENDFN
|
@lex_state = EXPR_ENDFN
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_lbrace(tok, data)
|
def on_lbrace(tok, data)
|
||||||
@lex_state = EXPR_LABEL | EXPR_BEG
|
@lex_state = EXPR_LABEL | EXPR_BEG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_rbrace(tok, data)
|
def on_rbrace(tok, data)
|
||||||
@lex_state = EXPR_ENDARG
|
@lex_state = EXPR_ENDARG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_lbracket(tok, data)
|
def on_lbracket(tok, data)
|
||||||
@lex_state = EXPR_LABEL | EXPR_BEG
|
@lex_state = EXPR_LABEL | EXPR_BEG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_rbracket(tok, data)
|
def on_rbracket(tok, data)
|
||||||
@lex_state = EXPR_ENDARG
|
@lex_state = EXPR_ENDARG
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_const(tok, data)
|
def on_const(tok, data)
|
||||||
|
@ -264,41 +264,43 @@ class RDoc::Parser::RipperStateLex
|
||||||
else
|
else
|
||||||
@lex_state = EXPR_CMDARG
|
@lex_state = EXPR_CMDARG
|
||||||
end
|
end
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_sp(tok, data)
|
def on_sp(tok, data)
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_comma(tok, data)
|
def on_comma(tok, data)
|
||||||
@lex_state = EXPR_BEG | EXPR_LABEL if (EXPR_ARG_ANY & @lex_state) != 0
|
@lex_state = EXPR_BEG | EXPR_LABEL if (EXPR_ARG_ANY & @lex_state) != 0
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_comment(tok, data)
|
def on_comment(tok, data)
|
||||||
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_ignored_sp(tok, data)
|
def on_ignored_sp(tok, data)
|
||||||
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_heredoc_beg(tok, data)
|
||||||
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
|
@lex_state = EXPR_END
|
||||||
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_heredoc_end(tok, data)
|
def on_heredoc_end(tok, data)
|
||||||
@callback.call(Token.new(lineno, column, __method__, tok, @lex_state))
|
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_default(event, tok, data)
|
def on_default(event, tok, data)
|
||||||
reset
|
reset
|
||||||
@callback.call(Token.new(lineno, column, event, tok, @lex_state))
|
data << Token.new(lineno, column, event, tok, @lex_state)
|
||||||
end
|
|
||||||
|
|
||||||
def each(&block)
|
|
||||||
@callback = block
|
|
||||||
parse
|
|
||||||
end
|
end
|
||||||
end unless RIPPER_HAS_LEX_STATE
|
end unless RIPPER_HAS_LEX_STATE
|
||||||
|
|
||||||
|
@ -308,21 +310,17 @@ class RDoc::Parser::RipperStateLex
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_default(event, tok, data)
|
def on_default(event, tok, data)
|
||||||
@callback.call(Token.new(lineno, column, event, tok, state))
|
data << Token.new(lineno, column, event, tok, state)
|
||||||
end
|
|
||||||
|
|
||||||
def each(&block)
|
|
||||||
@callback = block
|
|
||||||
parse
|
|
||||||
end
|
end
|
||||||
end if RIPPER_HAS_LEX_STATE
|
end if RIPPER_HAS_LEX_STATE
|
||||||
|
|
||||||
def get_squashed_tk
|
def get_squashed_tk
|
||||||
if @buf.empty?
|
if @buf.empty?
|
||||||
tk = @inner_lex_enumerator.next
|
tk = @tokens.shift
|
||||||
else
|
else
|
||||||
tk = @buf.shift
|
tk = @buf.shift
|
||||||
end
|
end
|
||||||
|
return nil if tk.nil?
|
||||||
case tk[:kind]
|
case tk[:kind]
|
||||||
when :on_symbeg then
|
when :on_symbeg then
|
||||||
tk = get_symbol_tk(tk)
|
tk = get_symbol_tk(tk)
|
||||||
|
@ -472,7 +470,7 @@ class RDoc::Parser::RipperStateLex
|
||||||
string = ''
|
string = ''
|
||||||
start_tk = nil
|
start_tk = nil
|
||||||
prev_tk = nil
|
prev_tk = nil
|
||||||
until heredoc_end?(heredoc_name, indent, tk = @inner_lex_enumerator.next) do
|
until heredoc_end?(heredoc_name, indent, tk = @tokens.shift) do
|
||||||
start_tk = tk unless start_tk
|
start_tk = tk unless start_tk
|
||||||
if (prev_tk.nil? or "\n" == prev_tk[:text][-1]) and 0 != tk[:char_no]
|
if (prev_tk.nil? or "\n" == prev_tk[:text][-1]) and 0 != tk[:char_no]
|
||||||
string = string + (' ' * tk[:char_no])
|
string = string + (' ' * tk[:char_no])
|
||||||
|
@ -555,6 +553,10 @@ class RDoc::Parser::RipperStateLex
|
||||||
tk[:text] += tk_ahead[:text]
|
tk[:text] += tk_ahead[:text]
|
||||||
tk[:kind] = tk_ahead[:kind]
|
tk[:kind] = tk_ahead[:kind]
|
||||||
tk[:state] = tk_ahead[:state]
|
tk[:state] = tk_ahead[:state]
|
||||||
|
when :on_heredoc_beg, :on_tstring, :on_dstring # frozen/non-frozen string literal
|
||||||
|
tk[:text] += tk_ahead[:text]
|
||||||
|
tk[:kind] = tk_ahead[:kind]
|
||||||
|
tk[:state] = tk_ahead[:state]
|
||||||
else
|
else
|
||||||
@buf.unshift tk_ahead
|
@buf.unshift tk_ahead
|
||||||
end
|
end
|
||||||
|
@ -566,11 +568,7 @@ class RDoc::Parser::RipperStateLex
|
||||||
@buf = []
|
@buf = []
|
||||||
@heredoc_queue = []
|
@heredoc_queue = []
|
||||||
@inner_lex = InnerStateLex.new(code)
|
@inner_lex = InnerStateLex.new(code)
|
||||||
@inner_lex_enumerator = Enumerator.new do |y|
|
@tokens = @inner_lex.parse([])
|
||||||
@inner_lex.each do |tk|
|
|
||||||
y << tk
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.parse(code)
|
def self.parse(code)
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
# by Keiju ISHITSUKA (Nippon Rational Inc.)
|
# by Keiju ISHITSUKA (Nippon Rational Inc.)
|
||||||
#
|
#
|
||||||
|
|
||||||
$TOKEN_DEBUG ||= nil
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Extracts code elements from a source file returning a TopLevel object
|
# Extracts code elements from a source file returning a TopLevel object
|
||||||
# containing the constituent file elements.
|
# containing the constituent file elements.
|
||||||
|
@ -267,7 +265,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
|
|
||||||
if :on_nl === tk then
|
if :on_nl === tk then
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -282,7 +280,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# Consumes trailing whitespace from the token stream
|
# Consumes trailing whitespace from the token stream
|
||||||
|
|
||||||
def consume_trailing_spaces # :nodoc:
|
def consume_trailing_spaces # :nodoc:
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -354,7 +352,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
given_name << '::'
|
given_name << '::'
|
||||||
end
|
end
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
given_name << name_t[:text]
|
given_name << name_t[:text]
|
||||||
|
|
||||||
is_self = name_t[:kind] == :on_op && name_t[:text] == '<<'
|
is_self = name_t[:kind] == :on_op && name_t[:text] == '<<'
|
||||||
|
@ -378,7 +376,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
record_location container
|
record_location container
|
||||||
|
|
||||||
get_tk
|
get_tk
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
name_t = get_tk
|
name_t = get_tk
|
||||||
unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]
|
unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]
|
||||||
raise RDoc::Error, "Invalid class or module definition: #{given_name}"
|
raise RDoc::Error, "Invalid class or module definition: #{given_name}"
|
||||||
|
@ -390,7 +388,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
return [container, name_t, given_name, new_modules]
|
return [container, name_t, given_name, new_modules]
|
||||||
end
|
end
|
||||||
|
@ -410,7 +408,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
res = get_constant
|
res = get_constant
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
get_tkread # empty out read buffer
|
get_tkread # empty out read buffer
|
||||||
|
|
||||||
|
@ -433,7 +431,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
def get_constant
|
def get_constant
|
||||||
res = ""
|
res = ""
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
|
|
||||||
while tk && ((:on_op == tk[:kind] && '::' == tk[:text]) || :on_const == tk[:kind]) do
|
while tk && ((:on_op == tk[:kind] && '::' == tk[:text]) || :on_const == tk[:kind]) do
|
||||||
|
@ -449,7 +447,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# Get an included module that may be surrounded by parens
|
# Get an included module that may be surrounded by parens
|
||||||
|
|
||||||
def get_included_module_with_optional_parens
|
def get_included_module_with_optional_parens
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
get_tkread
|
get_tkread
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
end_token = get_end_token tk
|
end_token = get_end_token tk
|
||||||
|
@ -685,7 +683,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
if args.size > 0 then
|
if args.size > 0 then
|
||||||
name = args[0]
|
name = args[0]
|
||||||
rw = "R"
|
rw = "R"
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
|
|
||||||
if :on_comma == tk[:kind] then
|
if :on_comma == tk[:kind] then
|
||||||
|
@ -935,7 +933,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
line_no = tk[:line_no]
|
line_no = tk[:line_no]
|
||||||
|
|
||||||
name = tk[:text]
|
name = tk[:text]
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
return unless name =~ /^\w+$/
|
return unless name =~ /^\w+$/
|
||||||
|
|
||||||
|
@ -961,7 +959,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
break if nest == 0
|
break if nest == 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
is_array_or_hash = true
|
is_array_or_hash = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1298,7 +1296,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
add_token tk
|
add_token tk
|
||||||
add_token_listener self
|
add_token_listener self
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
||||||
singleton = !!$~
|
singleton = !!$~
|
||||||
|
@ -1487,7 +1485,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
def parse_method_name container # :nodoc:
|
def parse_method_name container # :nodoc:
|
||||||
skip_tkspace
|
skip_tkspace
|
||||||
name_t = get_tk
|
name_t = get_tk
|
||||||
back_tk = skip_tkspace(false)
|
back_tk = skip_tkspace_without_nl
|
||||||
singleton = false
|
singleton = false
|
||||||
|
|
||||||
dot = get_tk
|
dot = get_tk
|
||||||
|
@ -1575,7 +1573,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
def parse_method_or_yield_parameters(method = nil,
|
def parse_method_or_yield_parameters(method = nil,
|
||||||
modifiers = RDoc::METHOD_MODIFIERS)
|
modifiers = RDoc::METHOD_MODIFIERS)
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
end_token = get_end_token tk
|
end_token = get_end_token tk
|
||||||
return '' unless end_token
|
return '' unless end_token
|
||||||
|
@ -1648,7 +1646,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
return if method.block_params
|
return if method.block_params
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
read_documentation_modifiers method, RDoc::METHOD_MODIFIERS
|
read_documentation_modifiers method, RDoc::METHOD_MODIFIERS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1699,19 +1697,19 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# Parses a rescue
|
# Parses a rescue
|
||||||
|
|
||||||
def parse_rescue
|
def parse_rescue
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
while tk = get_tk
|
while tk = get_tk
|
||||||
case tk[:kind]
|
case tk[:kind]
|
||||||
when :on_nl, :on_semicolon, :on_comment then
|
when :on_nl, :on_semicolon, :on_comment then
|
||||||
break
|
break
|
||||||
when :on_comma then
|
when :on_comma then
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
get_tk if :on_nl == peek_tk[:kind]
|
get_tk if :on_nl == peek_tk[:kind]
|
||||||
end
|
end
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1784,7 +1782,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
comment += "\n" unless "\n" == comment_body.chars.to_a.last
|
comment += "\n" unless "\n" == comment_body.chars.to_a.last
|
||||||
|
|
||||||
if comment_body.size > 1 && "\n" == comment_body.chars.to_a.last then
|
if comment_body.size > 1 && "\n" == comment_body.chars.to_a.last then
|
||||||
skip_tkspace false # leading spaces
|
skip_tkspace_without_nl # leading spaces
|
||||||
end
|
end
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
end
|
end
|
||||||
|
@ -1968,7 +1966,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
end
|
end
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
tk1 = get_tk
|
tk1 = get_tk
|
||||||
if tk1.nil? || :on_comma != tk1[:kind] then
|
if tk1.nil? || :on_comma != tk1[:kind] then
|
||||||
|
@ -2117,7 +2115,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# See also RDoc::Markup::PreProcess#handle_directive
|
# See also RDoc::Markup::PreProcess#handle_directive
|
||||||
|
|
||||||
def read_documentation_modifiers context, allowed
|
def read_documentation_modifiers context, allowed
|
||||||
skip_tkspace(false)
|
skip_tkspace_without_nl
|
||||||
directive, value = read_directive allowed
|
directive, value = read_directive allowed
|
||||||
|
|
||||||
return unless directive
|
return unless directive
|
||||||
|
@ -2195,7 +2193,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# while, until, and for have an optional do
|
# while, until, and for have an optional do
|
||||||
|
|
||||||
def skip_optional_do_after_expression
|
def skip_optional_do_after_expression
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
|
|
||||||
b_nest = 0
|
b_nest = 0
|
||||||
|
@ -2227,7 +2225,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
|
|
||||||
get_tk if peek_tk && :on_kw == peek_tk[:kind] && 'do' == peek_tk[:text]
|
get_tk if peek_tk && :on_kw == peek_tk[:kind] && 'do' == peek_tk[:text]
|
||||||
end
|
end
|
||||||
|
@ -2236,9 +2234,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# skip the var [in] part of a 'for' statement
|
# skip the var [in] part of a 'for' statement
|
||||||
|
|
||||||
def skip_for_variable
|
def skip_for_variable
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
get_tk
|
get_tk
|
||||||
skip_tkspace false
|
skip_tkspace_without_nl
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
unget_tk(tk) unless :on_kw == tk[:kind] and 'in' == tk[:text]
|
unget_tk(tk) unless :on_kw == tk[:kind] and 'in' == tk[:text]
|
||||||
end
|
end
|
||||||
|
@ -2257,7 +2255,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
def skip_tkspace_comment(skip_nl = true)
|
def skip_tkspace_comment(skip_nl = true)
|
||||||
loop do
|
loop do
|
||||||
skip_tkspace skip_nl
|
skip_nl ? skip_tkspace : skip_tkspace_without_nl
|
||||||
next_tk = peek_tk
|
next_tk = peek_tk
|
||||||
return if next_tk.nil? || (:on_comment != next_tk[:kind] and :on_embdoc != next_tk[:kind])
|
return if next_tk.nil? || (:on_comment != next_tk[:kind] and :on_embdoc != next_tk[:kind])
|
||||||
get_tk
|
get_tk
|
||||||
|
|
|
@ -25,12 +25,10 @@ module RDoc::Parser::RubyTools
|
||||||
tk = @scanner[@scanner_point]
|
tk = @scanner[@scanner_point]
|
||||||
@scanner_point += 1
|
@scanner_point += 1
|
||||||
@read.push tk[:text]
|
@read.push tk[:text]
|
||||||
puts "get_tk1 => #{tk.inspect}" if $TOKEN_DEBUG
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@read.push @unget_read.shift
|
@read.push @unget_read.shift
|
||||||
tk = @tokens.shift
|
tk = @tokens.shift
|
||||||
puts "get_tk2 => #{tk.inspect}" if $TOKEN_DEBUG
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if tk == nil || :on___end__ == tk[:kind]
|
if tk == nil || :on___end__ == tk[:kind]
|
||||||
|
@ -111,17 +109,27 @@ module RDoc::Parser::RubyTools
|
||||||
@scanner_point = 0
|
@scanner_point = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def tk_nl?(tk)
|
##
|
||||||
:on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]
|
# Skips whitespace tokens including newlines
|
||||||
|
|
||||||
|
def skip_tkspace
|
||||||
|
tokens = []
|
||||||
|
|
||||||
|
while (tk = get_tk) and (:on_sp == tk[:kind] or :on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]) do
|
||||||
|
tokens.push(tk)
|
||||||
|
end
|
||||||
|
|
||||||
|
unget_tk(tk)
|
||||||
|
tokens
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Skips whitespace tokens including newlines if +skip_nl+ is true
|
# Skips whitespace tokens excluding newlines
|
||||||
|
|
||||||
def skip_tkspace(skip_nl = true)
|
def skip_tkspace_without_nl
|
||||||
tokens = []
|
tokens = []
|
||||||
|
|
||||||
while (tk = get_tk) and (:on_sp == tk[:kind] or (skip_nl and tk_nl?(tk))) do
|
while (tk = get_tk) and :on_sp == tk[:kind] do
|
||||||
tokens.push(tk)
|
tokens.push(tk)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -420,52 +420,52 @@ end
|
||||||
|
|
||||||
racc_action_table = [
|
racc_action_table = [
|
||||||
34, 35, 30, 33, 40, 34, 35, 30, 33, 40,
|
34, 35, 30, 33, 40, 34, 35, 30, 33, 40,
|
||||||
65, 34, 35, 30, 33, 14, 73, 14, 54, 76,
|
65, 34, 35, 30, 33, 14, 73, 36, 38, 34,
|
||||||
15, 88, 34, 35, 30, 33, 14, 73, 77, 33,
|
15, 88, 34, 35, 30, 33, 14, 9, 10, 11,
|
||||||
54, 15, 34, 35, 30, 33, 14, 73, 81, 38,
|
12, 15, 34, 35, 30, 33, 14, 9, 10, 11,
|
||||||
38, 15, 34, 35, 30, 33, 14, 73, 40, 36,
|
12, 15, 34, 35, 30, 33, 35, 47, 30, 54,
|
||||||
83, 15, 34, 35, 30, 33, 54, 47, 30, 35,
|
33, 15, 34, 35, 30, 33, 54, 47, 14, 14,
|
||||||
34, 15, 34, 35, 30, 33, 14, 73, 38, 67,
|
59, 15, 34, 35, 30, 33, 14, 73, 67, 76,
|
||||||
59, 15, 34, 35, 30, 33, 14, 9, 10, 11,
|
77, 15, 34, 35, 30, 33, 14, 73, 54, 81,
|
||||||
12, 15, 34, 35, 30, 33, 14, 73, 14, nil,
|
38, 15, 34, 35, 30, 33, 14, 73, 38, 40,
|
||||||
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
83, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
||||||
nil, 15, 34, 35, 30, 33, nil, 47, nil, nil,
|
|
||||||
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
||||||
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
||||||
nil, 15, 34, 35, 30, 33, 14, 9, 10, 11,
|
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
||||||
12, 15, 34, 35, 30, 33, 14, 73, 61, 63,
|
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
||||||
|
nil, 15, 34, 35, 30, 33, 14, 73, 61, 63,
|
||||||
nil, 15, 14, 62, 60, 61, 63, 79, 61, 63,
|
nil, 15, 14, 62, 60, 61, 63, 79, 61, 63,
|
||||||
62, 87, nil, 62, 34, 35, 30, 33 ]
|
62, 87, nil, 62, 34, 35, 30, 33 ]
|
||||||
|
|
||||||
racc_action_check = [
|
racc_action_check = [
|
||||||
41, 41, 41, 41, 41, 15, 15, 15, 15, 15,
|
41, 41, 41, 41, 41, 15, 15, 15, 15, 15,
|
||||||
41, 86, 86, 86, 86, 86, 86, 34, 33, 49,
|
41, 86, 86, 86, 86, 86, 86, 1, 13, 22,
|
||||||
86, 86, 85, 85, 85, 85, 85, 85, 51, 31,
|
86, 86, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
54, 85, 79, 79, 79, 79, 79, 79, 56, 57,
|
0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
58, 79, 78, 78, 78, 78, 78, 78, 62, 1,
|
2, 2, 24, 24, 24, 24, 25, 24, 28, 30,
|
||||||
66, 78, 24, 24, 24, 24, 30, 24, 28, 25,
|
31, 24, 27, 27, 27, 27, 33, 27, 34, 35,
|
||||||
22, 24, 75, 75, 75, 75, 75, 75, 13, 44,
|
36, 27, 45, 45, 45, 45, 45, 45, 44, 49,
|
||||||
36, 75, 2, 2, 2, 2, 2, 2, 2, 2,
|
51, 45, 46, 46, 46, 46, 46, 46, 54, 56,
|
||||||
2, 2, 46, 46, 46, 46, 46, 46, 35, nil,
|
57, 46, 47, 47, 47, 47, 47, 47, 58, 62,
|
||||||
nil, 46, 45, 45, 45, 45, 45, 45, nil, nil,
|
66, 47, 68, 68, 68, 68, 68, 68, nil, nil,
|
||||||
nil, 45, 27, 27, 27, 27, nil, 27, nil, nil,
|
nil, 68, 74, 74, 74, 74, 74, 74, nil, nil,
|
||||||
nil, 27, 74, 74, 74, 74, 74, 74, nil, nil,
|
nil, 74, 75, 75, 75, 75, 75, 75, nil, nil,
|
||||||
nil, 74, 68, 68, 68, 68, 68, 68, nil, nil,
|
nil, 75, 78, 78, 78, 78, 78, 78, nil, nil,
|
||||||
nil, 68, 0, 0, 0, 0, 0, 0, 0, 0,
|
nil, 78, 79, 79, 79, 79, 79, 79, nil, nil,
|
||||||
0, 0, 47, 47, 47, 47, 47, 47, 39, 39,
|
nil, 79, 85, 85, 85, 85, 85, 85, 39, 39,
|
||||||
nil, 47, 52, 39, 39, 82, 82, 52, 64, 64,
|
nil, 85, 52, 39, 39, 82, 82, 52, 64, 64,
|
||||||
82, 82, nil, 64, 20, 20, 20, 20 ]
|
82, 82, nil, 64, 20, 20, 20, 20 ]
|
||||||
|
|
||||||
racc_action_pointer = [
|
racc_action_pointer = [
|
||||||
129, 49, 69, nil, nil, nil, nil, nil, nil, nil,
|
19, 17, 29, nil, nil, nil, nil, nil, nil, nil,
|
||||||
nil, nil, nil, 61, nil, 2, nil, nil, nil, nil,
|
nil, nil, nil, 11, nil, 2, nil, nil, nil, nil,
|
||||||
161, nil, 57, nil, 49, 55, nil, 99, 53, nil,
|
161, nil, 16, nil, 39, 42, nil, 49, 43, nil,
|
||||||
48, 23, nil, 10, 10, 81, 70, nil, nil, 141,
|
41, 44, nil, 48, 51, 52, 60, nil, nil, 141,
|
||||||
nil, -3, nil, nil, 56, 89, 79, 139, nil, 6,
|
nil, -3, nil, nil, 55, 59, 69, 79, nil, 56,
|
||||||
nil, 15, 145, nil, 22, nil, 25, 32, 33, nil,
|
nil, 57, 145, nil, 70, nil, 66, 73, 81, nil,
|
||||||
nil, nil, 41, nil, 151, nil, 37, nil, 119, nil,
|
nil, nil, 82, nil, 151, nil, 77, nil, 89, nil,
|
||||||
nil, nil, nil, nil, 109, 59, nil, nil, 39, 29,
|
nil, nil, nil, nil, 99, 109, nil, nil, 119, 129,
|
||||||
nil, nil, 148, nil, nil, 19, 8, nil, nil ]
|
nil, nil, 148, nil, nil, 139, 8, nil, nil ]
|
||||||
|
|
||||||
racc_action_default = [
|
racc_action_default = [
|
||||||
-2, -73, -1, -4, -5, -6, -7, -8, -9, -10,
|
-2, -73, -1, -4, -5, -6, -7, -8, -9, -10,
|
||||||
|
@ -479,26 +479,26 @@ racc_action_default = [
|
||||||
-60, -47, -73, -29, -52, -48, -73, -20, -50 ]
|
-60, -47, -73, -29, -52, -48, -73, -20, -50 ]
|
||||||
|
|
||||||
racc_goto_table = [
|
racc_goto_table = [
|
||||||
4, 39, 4, 68, 74, 75, 6, 5, 6, 5,
|
4, 39, 4, 68, 74, 75, 5, 6, 5, 6,
|
||||||
44, 42, 51, 49, 3, 56, 37, 57, 58, 80,
|
44, 42, 51, 49, 3, 56, 37, 57, 58, 1,
|
||||||
2, 66, 84, 41, 43, 48, 50, 64, 84, 84,
|
2, 66, 84, 41, 43, 48, 50, 64, 84, 84,
|
||||||
46, 45, 42, 46, 45, 55, 85, 86, 1, 84,
|
45, 46, 42, 45, 46, 55, 85, 86, 80, 84,
|
||||||
84, nil, nil, nil, nil, nil, nil, nil, 82, nil,
|
84, nil, nil, nil, nil, nil, nil, nil, 82, nil,
|
||||||
nil, nil, 78 ]
|
nil, nil, 78 ]
|
||||||
|
|
||||||
racc_goto_check = [
|
racc_goto_check = [
|
||||||
4, 10, 4, 31, 31, 31, 6, 5, 6, 5,
|
4, 10, 4, 31, 31, 31, 5, 6, 5, 6,
|
||||||
21, 12, 27, 21, 3, 27, 3, 9, 9, 33,
|
21, 12, 27, 21, 3, 27, 3, 9, 9, 1,
|
||||||
2, 11, 32, 17, 19, 23, 26, 10, 32, 32,
|
2, 11, 32, 17, 19, 23, 26, 10, 32, 32,
|
||||||
6, 5, 12, 6, 5, 29, 31, 31, 1, 32,
|
5, 6, 12, 5, 6, 29, 31, 31, 33, 32,
|
||||||
32, nil, nil, nil, nil, nil, nil, nil, 10, nil,
|
32, nil, nil, nil, nil, nil, nil, nil, 10, nil,
|
||||||
nil, nil, 4 ]
|
nil, nil, 4 ]
|
||||||
|
|
||||||
racc_goto_pointer = [
|
racc_goto_pointer = [
|
||||||
nil, 38, 20, 14, 0, 7, 6, nil, nil, -17,
|
nil, 19, 20, 14, 0, 6, 7, nil, nil, -17,
|
||||||
-14, -20, -9, nil, nil, nil, nil, 8, nil, 2,
|
-14, -20, -9, nil, nil, nil, nil, 8, nil, 2,
|
||||||
nil, -14, nil, 0, nil, nil, -2, -18, nil, 4,
|
nil, -14, nil, 0, nil, nil, -2, -18, nil, 4,
|
||||||
nil, -42, -46, -35 ]
|
nil, -42, -46, -16 ]
|
||||||
|
|
||||||
racc_goto_default = [
|
racc_goto_default = [
|
||||||
nil, nil, nil, nil, 70, 71, 72, 7, 8, 13,
|
nil, nil, nil, nil, 70, 71, 72, 7, 8, 13,
|
||||||
|
|
|
@ -244,23 +244,34 @@ end
|
||||||
##### State transition tables begin ###
|
##### State transition tables begin ###
|
||||||
|
|
||||||
racc_action_table = [
|
racc_action_table = [
|
||||||
104, 103, 102, 100, 101, 99, 115, 116, 117, 86,
|
104, 103, 102, 100, 101, 99, 115, 116, 117, 29,
|
||||||
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
|
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
|
||||||
164, 118, 119, 104, 103, 102, 100, 101, 99, 115,
|
84, 118, 119, 63, 64, 65, 61, 81, 62, 76,
|
||||||
116, 117, 175, 105, 106, 107, 108, 109, 110, 111,
|
78, 79, 85, 66, 67, 68, 69, 70, 71, 72,
|
||||||
112, 113, 114, 85, 118, 119, 63, 64, 65, 61,
|
73, 74, 75, 77, 80, 149, 63, 64, 65, 153,
|
||||||
81, 62, 76, 78, 79, 84, 66, 67, 68, 69,
|
81, 62, 76, 78, 79, 86, 66, 67, 68, 69,
|
||||||
70, 71, 72, 73, 74, 75, 77, 80, 149, 104,
|
70, 71, 72, 73, 74, 75, 77, 80, 152, 104,
|
||||||
103, 102, 100, 101, 99, 115, 116, 117, 29, 105,
|
103, 102, 100, 101, 99, 115, 116, 117, 87, 105,
|
||||||
106, 107, 108, 109, 110, 111, 112, 113, 114, 173,
|
106, 107, 108, 109, 110, 111, 112, 113, 114, 88,
|
||||||
118, 119, 104, 103, 102, 100, 101, 99, 115, 116,
|
118, 119, 104, 103, 102, 100, 101, 99, 115, 116,
|
||||||
117, 137, 105, 106, 107, 108, 109, 110, 111, 112,
|
117, 89, 105, 106, 107, 108, 109, 110, 111, 112,
|
||||||
113, 114, 177, 118, 119, 63, 64, 65, 153, 81,
|
113, 114, 96, 118, 119, 104, 103, 102, 100, 101,
|
||||||
62, 76, 78, 79, 148, 66, 67, 68, 69, 70,
|
99, 115, 116, 117, 124, 105, 106, 107, 108, 109,
|
||||||
71, 72, 73, 74, 75, 77, 80, 152, 22, 23,
|
110, 111, 112, 113, 114, 137, 118, 119, 22, 23,
|
||||||
24, 25, 26, 21, 18, 19, 176, 177, 13, 124,
|
24, 25, 26, 21, 18, 19, 176, 177, 13, 148,
|
||||||
14, 96, 15, 89, 16, 154, 17, 88, 137, 20,
|
14, 154, 15, 137, 16, 161, 17, 164, 173, 20,
|
||||||
22, 23, 24, 25, 26, 21, 18, 19, 87, 161,
|
22, 23, 24, 25, 26, 21, 18, 19, 175, 177,
|
||||||
|
13, nil, 14, nil, 15, nil, 16, nil, 17, nil,
|
||||||
|
nil, 20, 22, 23, 24, 25, 26, 21, 18, 19,
|
||||||
|
nil, nil, 13, nil, 14, nil, 15, nil, 16, nil,
|
||||||
|
17, nil, nil, 20, 22, 23, 24, 25, 26, 21,
|
||||||
|
18, 19, nil, nil, 13, nil, 14, nil, 15, nil,
|
||||||
|
16, nil, 17, nil, nil, 20, 22, 23, 24, 25,
|
||||||
|
26, 21, 18, 19, nil, nil, 13, nil, 14, nil,
|
||||||
|
15, nil, 16, nil, 17, nil, nil, 20, 22, 23,
|
||||||
|
24, 25, 26, 21, 18, 19, nil, nil, 13, nil,
|
||||||
|
14, nil, 15, nil, 16, nil, 17, nil, nil, 20,
|
||||||
|
22, 23, 24, 25, 26, 21, 18, 19, nil, nil,
|
||||||
13, nil, 14, nil, 15, nil, 16, nil, 17, 42,
|
13, nil, 14, nil, 15, nil, 16, nil, 17, 42,
|
||||||
nil, 20, 54, 38, 53, 55, 56, 57, nil, 13,
|
nil, 20, 54, 38, 53, 55, 56, 57, nil, 13,
|
||||||
nil, 14, nil, 15, nil, 16, nil, 17, nil, nil,
|
nil, 14, nil, 15, nil, 16, nil, 17, nil, nil,
|
||||||
|
@ -268,63 +279,63 @@ racc_action_table = [
|
||||||
nil, 13, nil, 14, nil, 15, nil, 16, nil, 17,
|
nil, 13, nil, 14, nil, 15, nil, 16, nil, 17,
|
||||||
nil, nil, 20, 63, 64, 65, 61, 81, 62, 76,
|
nil, nil, 20, 63, 64, 65, 61, 81, 62, 76,
|
||||||
78, 79, nil, 66, 67, 68, 69, 70, 71, 72,
|
78, 79, nil, 66, 67, 68, 69, 70, 71, 72,
|
||||||
73, 74, 75, 77, 80, 145, nil, nil, 54, 133,
|
73, 74, 75, 77, 80, 122, nil, nil, 54, nil,
|
||||||
53, 55, 56, 57, nil, 13, nil, 14, nil, 15,
|
53, 55, 56, 57, nil, 13, nil, 14, nil, 15,
|
||||||
nil, 16, nil, 17, 145, nil, 20, 54, 133, 53,
|
nil, 16, nil, 17, 145, nil, 20, 54, 133, 53,
|
||||||
55, 56, 57, nil, 13, nil, 14, nil, 15, nil,
|
55, 56, 57, nil, 13, nil, 14, nil, 15, nil,
|
||||||
16, nil, 17, nil, nil, 20, 22, 23, 24, 25,
|
16, nil, 17, 145, nil, 20, 54, 133, 53, 55,
|
||||||
26, 21, 18, 19, nil, nil, 13, nil, 14, nil,
|
56, 57, nil, 13, nil, 14, nil, 15, nil, 16,
|
||||||
15, nil, 16, nil, 17, 145, nil, 20, 54, 133,
|
nil, 17, 145, nil, 20, 54, 133, 53, 55, 56,
|
||||||
53, 55, 56, 57, nil, 13, nil, 14, nil, 15,
|
57, nil, 13, nil, 14, nil, 15, nil, 16, nil,
|
||||||
nil, 16, nil, 17, 145, nil, 20, 54, 133, 53,
|
17, 145, nil, 20, 54, 133, 53, 55, 56, 57,
|
||||||
55, 56, 57, nil, 13, nil, 14, nil, 15, nil,
|
|
||||||
16, nil, 17, nil, nil, 20, 22, 23, 24, 25,
|
|
||||||
26, 21, 18, 19, nil, nil, 13, nil, 14, nil,
|
|
||||||
15, nil, 16, nil, 17, nil, nil, 20, 22, 23,
|
|
||||||
24, 25, 26, 21, 18, 19, nil, nil, 13, nil,
|
|
||||||
14, nil, 15, nil, 16, nil, 17, nil, nil, 20,
|
|
||||||
22, 23, 24, 25, 26, 21, 18, 19, nil, nil,
|
|
||||||
13, nil, 14, nil, 15, nil, 16, nil, 17, nil,
|
|
||||||
nil, 20, 22, 23, 24, 25, 26, 21, 18, 19,
|
|
||||||
nil, nil, 13, nil, 14, nil, 15, nil, 16, 122,
|
|
||||||
17, nil, 54, 20, 53, 55, 56, 57, nil, 13,
|
|
||||||
nil, 14, nil, 15, nil, 16, nil, 17, nil, nil,
|
|
||||||
20, 135, 136, 54, 133, 53, 55, 56, 57, nil,
|
|
||||||
13, nil, 14, nil, 15, nil, 16, nil, 17, nil,
|
|
||||||
nil, 20, 135, 136, 54, 133, 53, 55, 56, 57,
|
|
||||||
nil, 13, nil, 14, nil, 15, nil, 16, nil, 17,
|
nil, 13, nil, 14, nil, 15, nil, 16, nil, 17,
|
||||||
nil, nil, 20, 135, 136, 54, 133, 53, 55, 56,
|
nil, nil, 20, 135, 136, 54, 133, 53, 55, 56,
|
||||||
57, nil, 13, nil, 14, nil, 15, nil, 16, 158,
|
57, nil, 13, nil, 14, nil, 15, nil, 16, nil,
|
||||||
17, nil, 54, 20, 53, 55, 56, 57, 95, nil,
|
17, nil, nil, 20, 135, 136, 54, 133, 53, 55,
|
||||||
nil, 54, 91, 53, 55, 56, 57, 145, nil, nil,
|
56, 57, nil, 13, nil, 14, nil, 15, nil, 16,
|
||||||
54, 133, 53, 55, 56, 57, 165, 135, 136, 54,
|
nil, 17, nil, nil, 20, 135, 136, 54, 133, 53,
|
||||||
133, 53, 55, 56, 57, 145, nil, nil, 54, 133,
|
55, 56, 57, nil, 13, nil, 14, nil, 15, nil,
|
||||||
53, 55, 56, 57, 172, 135, 136, 54, 133, 53,
|
16, nil, 17, 95, nil, 20, 54, 91, 53, 55,
|
||||||
55, 56, 57, 174, 135, 136, 54, 133, 53, 55,
|
56, 57, 145, nil, nil, 54, 133, 53, 55, 56,
|
||||||
56, 57, 178, 135, 136, 54, 133, 53, 55, 56,
|
57, 158, nil, nil, 54, nil, 53, 55, 56, 57,
|
||||||
57, 135, 136, 54, 133, 53, 55, 56, 57, 135,
|
165, 135, 136, 54, 133, 53, 55, 56, 57, 145,
|
||||||
136, 54, 133, 53, 55, 56, 57, 135, 136, 54,
|
nil, nil, 54, 133, 53, 55, 56, 57, 172, 135,
|
||||||
133, 53, 55, 56, 57, 22, 23, 24, 25, 26,
|
136, 54, 133, 53, 55, 56, 57, 174, 135, 136,
|
||||||
21 ]
|
54, 133, 53, 55, 56, 57, 178, 135, 136, 54,
|
||||||
|
133, 53, 55, 56, 57, 135, 136, 54, 133, 53,
|
||||||
|
55, 56, 57, 135, 136, 54, 133, 53, 55, 56,
|
||||||
|
57, 135, 136, 54, 133, 53, 55, 56, 57, 22,
|
||||||
|
23, 24, 25, 26, 21 ]
|
||||||
|
|
||||||
racc_action_check = [
|
racc_action_check = [
|
||||||
38, 38, 38, 38, 38, 38, 38, 38, 38, 32,
|
38, 38, 38, 38, 38, 38, 38, 38, 38, 1,
|
||||||
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
|
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
|
||||||
125, 38, 38, 97, 97, 97, 97, 97, 97, 97,
|
29, 38, 38, 59, 59, 59, 59, 59, 59, 59,
|
||||||
97, 97, 164, 97, 97, 97, 97, 97, 97, 97,
|
59, 59, 31, 59, 59, 59, 59, 59, 59, 59,
|
||||||
97, 97, 97, 31, 97, 97, 59, 59, 59, 59,
|
59, 59, 59, 59, 59, 59, 61, 61, 61, 61,
|
||||||
59, 59, 59, 59, 59, 29, 59, 59, 59, 59,
|
61, 61, 61, 61, 61, 32, 61, 61, 61, 61,
|
||||||
59, 59, 59, 59, 59, 59, 59, 59, 59, 91,
|
61, 61, 61, 61, 61, 61, 61, 61, 61, 91,
|
||||||
91, 91, 91, 91, 91, 91, 91, 91, 1, 91,
|
91, 91, 91, 91, 91, 91, 91, 91, 33, 91,
|
||||||
91, 91, 91, 91, 91, 91, 91, 91, 91, 162,
|
91, 91, 91, 91, 91, 91, 91, 91, 91, 34,
|
||||||
91, 91, 155, 155, 155, 155, 155, 155, 155, 155,
|
91, 91, 97, 97, 97, 97, 97, 97, 97, 97,
|
||||||
155, 43, 155, 155, 155, 155, 155, 155, 155, 155,
|
97, 35, 97, 97, 97, 97, 97, 97, 97, 97,
|
||||||
155, 155, 172, 155, 155, 61, 61, 61, 61, 61,
|
97, 97, 37, 97, 97, 155, 155, 155, 155, 155,
|
||||||
61, 61, 61, 61, 58, 61, 61, 61, 61, 61,
|
155, 155, 155, 155, 41, 155, 155, 155, 155, 155,
|
||||||
61, 61, 61, 61, 61, 61, 61, 61, 16, 16,
|
155, 155, 155, 155, 155, 43, 155, 155, 0, 0,
|
||||||
16, 16, 16, 16, 16, 16, 165, 165, 16, 41,
|
0, 0, 0, 0, 0, 0, 165, 165, 0, 58,
|
||||||
16, 37, 16, 35, 16, 90, 16, 34, 94, 16,
|
0, 90, 0, 94, 0, 100, 0, 125, 162, 0,
|
||||||
17, 17, 17, 17, 17, 17, 17, 17, 33, 100,
|
2, 2, 2, 2, 2, 2, 2, 2, 164, 172,
|
||||||
|
2, nil, 2, nil, 2, nil, 2, nil, 2, nil,
|
||||||
|
nil, 2, 13, 13, 13, 13, 13, 13, 13, 13,
|
||||||
|
nil, nil, 13, nil, 13, nil, 13, nil, 13, nil,
|
||||||
|
13, nil, nil, 13, 14, 14, 14, 14, 14, 14,
|
||||||
|
14, 14, nil, nil, 14, nil, 14, nil, 14, nil,
|
||||||
|
14, nil, 14, nil, nil, 14, 15, 15, 15, 15,
|
||||||
|
15, 15, 15, 15, nil, nil, 15, nil, 15, nil,
|
||||||
|
15, nil, 15, nil, 15, nil, nil, 15, 16, 16,
|
||||||
|
16, 16, 16, 16, 16, 16, nil, nil, 16, nil,
|
||||||
|
16, nil, 16, nil, 16, nil, 16, nil, nil, 16,
|
||||||
|
17, 17, 17, 17, 17, 17, 17, 17, nil, nil,
|
||||||
17, nil, 17, nil, 17, nil, 17, nil, 17, 18,
|
17, nil, 17, nil, 17, nil, 17, nil, 17, 18,
|
||||||
nil, 17, 18, 18, 18, 18, 18, 18, nil, 18,
|
nil, 17, 18, 18, 18, 18, 18, 18, nil, 18,
|
||||||
nil, 18, nil, 18, nil, 18, nil, 18, nil, nil,
|
nil, 18, nil, 18, nil, 18, nil, 18, nil, nil,
|
||||||
|
@ -332,64 +343,53 @@ racc_action_check = [
|
||||||
nil, 19, nil, 19, nil, 19, nil, 19, nil, 19,
|
nil, 19, nil, 19, nil, 19, nil, 19, nil, 19,
|
||||||
nil, nil, 19, 20, 20, 20, 20, 20, 20, 20,
|
nil, nil, 19, 20, 20, 20, 20, 20, 20, 20,
|
||||||
20, 20, nil, 20, 20, 20, 20, 20, 20, 20,
|
20, 20, nil, 20, 20, 20, 20, 20, 20, 20,
|
||||||
20, 20, 20, 20, 20, 146, nil, nil, 146, 146,
|
20, 20, 20, 20, 20, 39, nil, nil, 39, nil,
|
||||||
146, 146, 146, 146, nil, 146, nil, 146, nil, 146,
|
39, 39, 39, 39, nil, 39, nil, 39, nil, 39,
|
||||||
nil, 146, nil, 146, 138, nil, 146, 138, 138, 138,
|
nil, 39, nil, 39, 44, nil, 39, 44, 44, 44,
|
||||||
138, 138, 138, nil, 138, nil, 138, nil, 138, nil,
|
|
||||||
138, nil, 138, nil, nil, 138, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, nil, nil, 0, nil, 0, nil,
|
|
||||||
0, nil, 0, nil, 0, 45, nil, 0, 45, 45,
|
|
||||||
45, 45, 45, 45, nil, 45, nil, 45, nil, 45,
|
|
||||||
nil, 45, nil, 45, 44, nil, 45, 44, 44, 44,
|
|
||||||
44, 44, 44, nil, 44, nil, 44, nil, 44, nil,
|
44, 44, 44, nil, 44, nil, 44, nil, 44, nil,
|
||||||
44, nil, 44, nil, nil, 44, 2, 2, 2, 2,
|
44, nil, 44, 45, nil, 44, 45, 45, 45, 45,
|
||||||
2, 2, 2, 2, nil, nil, 2, nil, 2, nil,
|
45, 45, nil, 45, nil, 45, nil, 45, nil, 45,
|
||||||
2, nil, 2, nil, 2, nil, nil, 2, 13, 13,
|
nil, 45, 138, nil, 45, 138, 138, 138, 138, 138,
|
||||||
13, 13, 13, 13, 13, 13, nil, nil, 13, nil,
|
138, nil, 138, nil, 138, nil, 138, nil, 138, nil,
|
||||||
13, nil, 13, nil, 13, nil, 13, nil, nil, 13,
|
138, 146, nil, 138, 146, 146, 146, 146, 146, 146,
|
||||||
14, 14, 14, 14, 14, 14, 14, 14, nil, nil,
|
nil, 146, nil, 146, nil, 146, nil, 146, nil, 146,
|
||||||
14, nil, 14, nil, 14, nil, 14, nil, 14, nil,
|
nil, nil, 146, 42, 42, 42, 42, 42, 42, 42,
|
||||||
nil, 14, 15, 15, 15, 15, 15, 15, 15, 15,
|
|
||||||
nil, nil, 15, nil, 15, nil, 15, nil, 15, 39,
|
|
||||||
15, nil, 39, 15, 39, 39, 39, 39, nil, 39,
|
|
||||||
nil, 39, nil, 39, nil, 39, nil, 39, nil, nil,
|
|
||||||
39, 42, 42, 42, 42, 42, 42, 42, 42, nil,
|
|
||||||
42, nil, 42, nil, 42, nil, 42, nil, 42, nil,
|
42, nil, 42, nil, 42, nil, 42, nil, 42, nil,
|
||||||
nil, 42, 127, 127, 127, 127, 127, 127, 127, 127,
|
42, nil, nil, 42, 122, 122, 122, 122, 122, 122,
|
||||||
nil, 127, nil, 127, nil, 127, nil, 127, nil, 127,
|
122, 122, nil, 122, nil, 122, nil, 122, nil, 122,
|
||||||
nil, nil, 127, 122, 122, 122, 122, 122, 122, 122,
|
nil, 122, nil, nil, 122, 127, 127, 127, 127, 127,
|
||||||
122, nil, 122, nil, 122, nil, 122, nil, 122, 92,
|
127, 127, 127, nil, 127, nil, 127, nil, 127, nil,
|
||||||
122, nil, 92, 122, 92, 92, 92, 92, 36, nil,
|
127, nil, 127, 36, nil, 127, 36, 36, 36, 36,
|
||||||
nil, 36, 36, 36, 36, 36, 36, 52, nil, nil,
|
36, 36, 52, nil, nil, 52, 52, 52, 52, 52,
|
||||||
52, 52, 52, 52, 52, 52, 126, 126, 126, 126,
|
52, 92, nil, nil, 92, nil, 92, 92, 92, 92,
|
||||||
126, 126, 126, 126, 126, 142, nil, nil, 142, 142,
|
126, 126, 126, 126, 126, 126, 126, 126, 126, 142,
|
||||||
142, 142, 142, 142, 159, 159, 159, 159, 159, 159,
|
nil, nil, 142, 142, 142, 142, 142, 142, 159, 159,
|
||||||
159, 159, 159, 163, 163, 163, 163, 163, 163, 163,
|
159, 159, 159, 159, 159, 159, 159, 163, 163, 163,
|
||||||
163, 163, 171, 171, 171, 171, 171, 171, 171, 171,
|
163, 163, 163, 163, 163, 163, 171, 171, 171, 171,
|
||||||
171, 95, 95, 95, 95, 95, 95, 95, 95, 158,
|
171, 171, 171, 171, 171, 95, 95, 95, 95, 95,
|
||||||
158, 158, 158, 158, 158, 158, 158, 168, 168, 168,
|
95, 95, 95, 158, 158, 158, 158, 158, 158, 158,
|
||||||
168, 168, 168, 168, 168, 27, 27, 27, 27, 27,
|
158, 168, 168, 168, 168, 168, 168, 168, 168, 27,
|
||||||
27 ]
|
27, 27, 27, 27, 27 ]
|
||||||
|
|
||||||
racc_action_pointer = [
|
racc_action_pointer = [
|
||||||
283, 78, 343, nil, nil, nil, nil, nil, nil, nil,
|
135, 9, 157, nil, nil, nil, nil, nil, nil, nil,
|
||||||
nil, nil, nil, 365, 387, 409, 135, 157, 176, 198,
|
nil, nil, nil, 179, 201, 223, 245, 267, 286, 308,
|
||||||
220, nil, nil, nil, nil, nil, nil, 602, nil, 55,
|
330, nil, nil, nil, nil, nil, nil, 606, nil, 20,
|
||||||
nil, 29, -7, 150, 137, 131, 515, 128, -3, 426,
|
nil, 18, 39, 60, 69, 79, 510, 89, -3, 352,
|
||||||
nil, 145, 447, 96, 321, 302, nil, nil, nil, nil,
|
nil, 120, 449, 130, 371, 390, nil, nil, nil, nil,
|
||||||
nil, nil, 524, nil, nil, nil, nil, nil, 113, 43,
|
nil, nil, 519, nil, nil, nil, nil, nil, 138, 20,
|
||||||
nil, 112, nil, nil, nil, nil, nil, nil, nil, nil,
|
nil, 43, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||||
132, 66, 506, nil, 153, 577, nil, 20, nil, nil,
|
128, 66, 528, nil, 148, 581, nil, 89, nil, nil,
|
||||||
163, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
149, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||||
nil, nil, 489, nil, nil, 17, 533, 468, nil, nil,
|
nil, nil, 470, nil, nil, 154, 537, 491, nil, nil,
|
||||||
nil, nil, nil, nil, nil, nil, nil, nil, 261, nil,
|
nil, nil, nil, nil, nil, nil, nil, nil, 409, nil,
|
||||||
nil, nil, 542, nil, nil, nil, 242, nil, nil, nil,
|
nil, nil, 546, nil, nil, nil, 428, nil, nil, nil,
|
||||||
nil, nil, nil, nil, nil, 89, nil, nil, 585, 551,
|
nil, nil, nil, nil, nil, 112, nil, nil, 589, 555,
|
||||||
nil, nil, 86, 560, 28, 142, nil, nil, 593, nil,
|
nil, nil, 155, 564, 164, 142, nil, nil, 597, nil,
|
||||||
nil, 569, 107, nil, nil, nil, nil, nil, nil ]
|
nil, 573, 164, nil, nil, nil, nil, nil, nil ]
|
||||||
|
|
||||||
racc_action_default = [
|
racc_action_default = [
|
||||||
-138, -138, -1, -3, -4, -5, -6, -7, -8, -9,
|
-138, -138, -1, -3, -4, -5, -6, -7, -8, -9,
|
||||||
|
@ -412,15 +412,15 @@ racc_action_default = [
|
||||||
-60, -138, -34, -36, -37, -29, -30, -32, -34 ]
|
-60, -138, -34, -36, -37, -29, -30, -32, -34 ]
|
||||||
|
|
||||||
racc_goto_table = [
|
racc_goto_table = [
|
||||||
126, 44, 125, 52, 144, 144, 160, 93, 97, 43,
|
126, 44, 125, 43, 144, 144, 160, 93, 97, 52,
|
||||||
166, 82, 144, 41, 40, 39, 138, 146, 169, 90,
|
166, 82, 144, 40, 41, 39, 138, 146, 169, 30,
|
||||||
36, 52, 44, 1, 52, 129, 169, 94, 59, 83,
|
36, 94, 44, 1, 123, 129, 169, 52, 90, 37,
|
||||||
123, 30, 151, 92, 121, 120, 31, 32, 33, 34,
|
52, 167, 147, 92, 120, 121, 31, 32, 33, 34,
|
||||||
35, 170, 58, 166, 167, 147, 170, 166, 37, nil,
|
35, 170, 58, 166, 59, 83, 170, 166, 151, nil,
|
||||||
150, nil, 166, 159, 4, 166, 4, nil, nil, nil,
|
150, nil, 166, 159, 4, 166, 4, nil, nil, nil,
|
||||||
nil, 155, nil, 156, 160, nil, nil, 4, 4, 4,
|
nil, 155, nil, 156, 160, nil, nil, 4, 4, 4,
|
||||||
4, 4, nil, 4, 5, nil, 5, 52, nil, nil,
|
4, 4, nil, 4, 5, nil, 5, 157, nil, nil,
|
||||||
163, nil, 162, 157, nil, 168, nil, 5, 5, 5,
|
163, nil, 162, 52, nil, 168, nil, 5, 5, 5,
|
||||||
5, 5, nil, 5, nil, nil, nil, nil, 144, nil,
|
5, 5, nil, 5, nil, nil, nil, nil, 144, nil,
|
||||||
nil, nil, 144, nil, nil, 129, 144, 144, nil, 6,
|
nil, nil, 144, nil, nil, 129, 144, 144, nil, 6,
|
||||||
129, 6, nil, nil, nil, nil, 171, 7, nil, 7,
|
129, 6, nil, nil, nil, nil, 171, 7, nil, 7,
|
||||||
|
@ -430,15 +430,15 @@ racc_goto_table = [
|
||||||
11, 11, 11, nil, 11 ]
|
11, 11, 11, nil, 11 ]
|
||||||
|
|
||||||
racc_goto_check = [
|
racc_goto_check = [
|
||||||
22, 24, 21, 34, 36, 36, 37, 18, 16, 23,
|
22, 24, 21, 23, 36, 36, 37, 18, 16, 34,
|
||||||
35, 41, 36, 20, 19, 17, 25, 25, 28, 14,
|
35, 41, 36, 19, 20, 17, 25, 25, 28, 3,
|
||||||
13, 34, 24, 1, 34, 24, 28, 23, 38, 39,
|
13, 23, 24, 1, 23, 24, 28, 34, 14, 15,
|
||||||
23, 3, 42, 17, 20, 19, 1, 1, 1, 1,
|
34, 29, 32, 17, 19, 20, 1, 1, 1, 1,
|
||||||
1, 33, 1, 35, 29, 32, 33, 35, 15, nil,
|
1, 33, 1, 35, 38, 39, 33, 35, 42, nil,
|
||||||
41, nil, 35, 22, 4, 35, 4, nil, nil, nil,
|
41, nil, 35, 22, 4, 35, 4, nil, nil, nil,
|
||||||
nil, 16, nil, 18, 37, nil, nil, 4, 4, 4,
|
nil, 16, nil, 18, 37, nil, nil, 4, 4, 4,
|
||||||
4, 4, nil, 4, 5, nil, 5, 34, nil, nil,
|
4, 4, nil, 4, 5, nil, 5, 23, nil, nil,
|
||||||
22, nil, 21, 23, nil, 22, nil, 5, 5, 5,
|
22, nil, 21, 34, nil, 22, nil, 5, 5, 5,
|
||||||
5, 5, nil, 5, nil, nil, nil, nil, 36, nil,
|
5, 5, nil, 5, nil, nil, nil, nil, 36, nil,
|
||||||
nil, nil, 36, nil, nil, 24, 36, 36, nil, 6,
|
nil, nil, 36, nil, nil, 24, 36, 36, nil, 6,
|
||||||
24, 6, nil, nil, nil, nil, 22, 7, nil, 7,
|
24, 6, nil, nil, nil, nil, 22, 7, nil, 7,
|
||||||
|
@ -448,11 +448,11 @@ racc_goto_check = [
|
||||||
11, 11, 11, nil, 11 ]
|
11, 11, 11, nil, 11 ]
|
||||||
|
|
||||||
racc_goto_pointer = [
|
racc_goto_pointer = [
|
||||||
nil, 23, nil, 29, 54, 74, 109, 117, 127, nil,
|
nil, 23, nil, 17, 54, 74, 109, 117, 127, nil,
|
||||||
nil, 135, nil, 2, -17, 30, -30, -3, -29, -4,
|
nil, 135, nil, 2, -8, 11, -30, -3, -29, -5,
|
||||||
-5, -40, -42, -9, -17, -28, nil, nil, -120, -83,
|
-4, -40, -42, -15, -17, -28, nil, nil, -120, -96,
|
||||||
nil, nil, -7, -101, -15, -116, -40, -91, 8, 2,
|
nil, nil, -20, -101, -9, -116, -40, -91, 24, 18,
|
||||||
nil, -9, -29 ]
|
nil, -9, -13 ]
|
||||||
|
|
||||||
racc_goto_default = [
|
racc_goto_default = [
|
||||||
nil, nil, 2, 3, 46, 47, 48, 49, 50, 9,
|
nil, nil, 2, 3, 46, 47, 48, 49, 50, 9,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -355,7 +355,7 @@ option)
|
||||||
relative_path.relative_path_from @options.page_dir
|
relative_path.relative_path_from @options.page_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
top_level = @store.add_file filename, relative_path.to_s
|
top_level = @store.add_file filename, relative_name: relative_path.to_s
|
||||||
|
|
||||||
parser = RDoc::Parser.for top_level, filename, content, @options, @stats
|
parser = RDoc::Parser.for top_level, filename, content, @options, @stats
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ class RDoc::Store
|
||||||
@classes_hash = {}
|
@classes_hash = {}
|
||||||
@modules_hash = {}
|
@modules_hash = {}
|
||||||
@files_hash = {}
|
@files_hash = {}
|
||||||
|
@text_files_hash = {}
|
||||||
|
|
||||||
@c_enclosure_classes = {}
|
@c_enclosure_classes = {}
|
||||||
@c_enclosure_names = {}
|
@c_enclosure_names = {}
|
||||||
|
@ -184,16 +185,24 @@ class RDoc::Store
|
||||||
# Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the
|
# Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the
|
||||||
# created RDoc::TopLevel.
|
# created RDoc::TopLevel.
|
||||||
|
|
||||||
def add_file absolute_name, relative_name = absolute_name
|
def add_file absolute_name, relative_name: absolute_name, parser: nil
|
||||||
unless top_level = @files_hash[relative_name] then
|
unless top_level = @files_hash[relative_name] then
|
||||||
top_level = RDoc::TopLevel.new absolute_name, relative_name
|
top_level = RDoc::TopLevel.new absolute_name, relative_name
|
||||||
|
top_level.parser = parser if parser
|
||||||
top_level.store = self
|
top_level.store = self
|
||||||
@files_hash[relative_name] = top_level
|
@files_hash[relative_name] = top_level
|
||||||
|
@text_files_hash[relative_name] = top_level if top_level.text?
|
||||||
end
|
end
|
||||||
|
|
||||||
top_level
|
top_level
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_parser_of_file(absolute_name, parser)
|
||||||
|
if top_level = @files_hash[absolute_name] then
|
||||||
|
@text_files_hash[absolute_name] = top_level if top_level.text?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Returns all classes discovered by RDoc
|
# Returns all classes discovered by RDoc
|
||||||
|
|
||||||
|
@ -428,8 +437,8 @@ class RDoc::Store
|
||||||
# +file_name+
|
# +file_name+
|
||||||
|
|
||||||
def find_text_page file_name
|
def find_text_page file_name
|
||||||
@files_hash.each_value.find do |file|
|
@text_files_hash.each_value.find do |file|
|
||||||
file.text? and file.full_name == file_name
|
file.full_name == file_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -537,6 +546,7 @@ class RDoc::Store
|
||||||
@cache[:pages].each do |page_name|
|
@cache[:pages].each do |page_name|
|
||||||
page = load_page page_name
|
page = load_page page_name
|
||||||
@files_hash[page_name] = page
|
@files_hash[page_name] = page
|
||||||
|
@text_files_hash[page_name] = page if page.text?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -712,8 +722,8 @@ class RDoc::Store
|
||||||
# Returns the RDoc::TopLevel that is a text file and has the given +name+
|
# Returns the RDoc::TopLevel that is a text file and has the given +name+
|
||||||
|
|
||||||
def page name
|
def page name
|
||||||
@files_hash.each_value.find do |file|
|
@text_files_hash.each_value.find do |file|
|
||||||
file.text? and file.page_name == name
|
file.page_name == name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class RDoc::TopLevel < RDoc::Context
|
||||||
##
|
##
|
||||||
# The parser class that processed this file
|
# The parser class that processed this file
|
||||||
|
|
||||||
attr_accessor :parser
|
attr_reader :parser
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new TopLevel for the file at +absolute_name+. If documentation
|
# Creates a new TopLevel for the file at +absolute_name+. If documentation
|
||||||
|
@ -52,6 +52,12 @@ class RDoc::TopLevel < RDoc::Context
|
||||||
@classes_or_modules = []
|
@classes_or_modules = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parser=(val)
|
||||||
|
@parser = val
|
||||||
|
@store.update_parser_of_file(absolute_name, val) if @store
|
||||||
|
@parser
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# An RDoc::TopLevel is equal to another with the same relative_name
|
# An RDoc::TopLevel is equal to another with the same relative_name
|
||||||
|
|
||||||
|
@ -272,7 +278,7 @@ class RDoc::TopLevel < RDoc::Context
|
||||||
# Is this TopLevel from a text file instead of a source code file?
|
# Is this TopLevel from a text file instead of a source code file?
|
||||||
|
|
||||||
def text?
|
def text?
|
||||||
@parser and @parser.ancestors.include? RDoc::Parser::Text
|
@parser and @parser.include? RDoc::Parser::Text
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s # :nodoc:
|
def to_s # :nodoc:
|
||||||
|
|
|
@ -3,6 +3,6 @@ module RDoc
|
||||||
##
|
##
|
||||||
# RDoc version you are using
|
# RDoc version you are using
|
||||||
|
|
||||||
VERSION = '6.1.0.beta1'
|
VERSION = '6.1.0.beta2'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -162,8 +162,7 @@ class TestRDocCrossReference < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_resolve_page
|
def test_resolve_page
|
||||||
page = @store.add_file 'README.txt'
|
page = @store.add_file 'README.txt', parser: RDoc::Parser::Simple
|
||||||
page.parser = RDoc::Parser::Simple
|
|
||||||
|
|
||||||
assert_ref page, 'README'
|
assert_ref page, 'README'
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,12 +36,12 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def crossref(text)
|
def crossref(text)
|
||||||
crossref_bitmap = @am.attributes.bitmap_for(:_SPECIAL_) |
|
crossref_bitmap = @am.attributes.bitmap_for(:_REGEXP_HANDLING_) |
|
||||||
@am.attributes.bitmap_for(:CROSSREF)
|
@am.attributes.bitmap_for(:CROSSREF)
|
||||||
|
|
||||||
[ @am.changed_attribute_by_name([], [:CROSSREF, :_SPECIAL_]),
|
[ @am.changed_attribute_by_name([], [:CROSSREF, :_REGEXP_HANDLING_]),
|
||||||
RDoc::Markup::Special.new(crossref_bitmap, text),
|
RDoc::Markup::RegexpHandling.new(crossref_bitmap, text),
|
||||||
@am.changed_attribute_by_name([:CROSSREF, :_SPECIAL_], [])
|
@am.changed_attribute_by_name([:CROSSREF, :_REGEXP_HANDLING_], [])
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,12 +58,12 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
|
||||||
assert(tags.has_key?("test"))
|
assert(tags.has_key?("test"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_special
|
def test_add_regexp_handling
|
||||||
@am.add_special "WikiWord", :WIKIWORD
|
@am.add_regexp_handling "WikiWord", :WIKIWORD
|
||||||
specials = @am.special
|
regexp_handlings = @am.regexp_handlings
|
||||||
|
|
||||||
assert_equal 1, specials.size
|
assert_equal 1, regexp_handlings.size
|
||||||
assert specials.assoc "WikiWord"
|
assert regexp_handlings.assoc "WikiWord"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_word_pair
|
def test_add_word_pair
|
||||||
|
@ -340,8 +340,8 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
|
||||||
@am.flow(str))
|
@am.flow(str))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_special
|
def test_regexp_handling
|
||||||
@am.add_special(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF)
|
@am.add_regexp_handling(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF)
|
||||||
|
|
||||||
#
|
#
|
||||||
# The apostrophes in "cats'" and "dogs'" suppress the flagging of these
|
# The apostrophes in "cats'" and "dogs'" suppress the flagging of these
|
||||||
|
|
|
@ -20,9 +20,9 @@ class TestRDocMarkupAttributes < RDoc::TestCase
|
||||||
@as.bitmap_for 'three'
|
@as.bitmap_for 'three'
|
||||||
|
|
||||||
assert_equal 'none', @as.as_string(0)
|
assert_equal 'none', @as.as_string(0)
|
||||||
assert_equal '_SPECIAL_', @as.as_string(1)
|
assert_equal '_REGEXP_HANDLING_', @as.as_string(1)
|
||||||
assert_equal 'two', @as.as_string(2)
|
assert_equal 'two', @as.as_string(2)
|
||||||
assert_equal '_SPECIAL_,two', @as.as_string(3)
|
assert_equal '_REGEXP_HANDLING_,two', @as.as_string(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_each_name_of
|
def test_each_name_of
|
||||||
|
|
|
@ -19,8 +19,8 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
convert_flow @am.flow text.dup
|
convert_flow @am.flow text.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_special_CAPS special
|
def handle_regexp_CAPS target
|
||||||
"handled #{special.text}"
|
"handled #{target.text}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_accepting
|
def start_accepting
|
||||||
|
@ -37,7 +37,7 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
super
|
super
|
||||||
|
|
||||||
@markup = @RM.new
|
@markup = @RM.new
|
||||||
@markup.add_special(/[A-Z]+/, :CAPS)
|
@markup.add_regexp_handling(/[A-Z]+/, :CAPS)
|
||||||
|
|
||||||
@attribute_manager = @markup.attribute_manager
|
@attribute_manager = @markup.attribute_manager
|
||||||
@attributes = @attribute_manager.attributes
|
@attributes = @attribute_manager.attributes
|
||||||
|
@ -45,7 +45,7 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
@to = ToTest.new @markup
|
@to = ToTest.new @markup
|
||||||
|
|
||||||
@caps = @attributes.bitmap_for :CAPS
|
@caps = @attributes.bitmap_for :CAPS
|
||||||
@special = @attributes.bitmap_for :_SPECIAL_
|
@regexp_handling = @attributes.bitmap_for :_REGEXP_HANDLING_
|
||||||
@tt = @attributes.bitmap_for :TT
|
@tt = @attributes.bitmap_for :TT
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,19 +62,19 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
assert_equal 'a/c.html', gen('a.html', 'a/c.html')
|
assert_equal 'a/c.html', gen('a.html', 'a/c.html')
|
||||||
end
|
end
|
||||||
|
|
||||||
def special_names
|
def regexp_handling_names
|
||||||
@attribute_manager.special.map do |_, mask|
|
@attribute_manager.regexp_handlings.map do |_, mask|
|
||||||
@attributes.as_string mask
|
@attributes.as_string mask
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_special_RDOCLINK
|
def test_add_regexp_handling_RDOCLINK
|
||||||
@to.add_special_RDOCLINK
|
@to.add_regexp_handling_RDOCLINK
|
||||||
|
|
||||||
assert_includes special_names, 'RDOCLINK'
|
assert_includes regexp_handling_names, 'RDOCLINK'
|
||||||
|
|
||||||
def @to.handle_special_RDOCLINK special
|
def @to.handle_regexp_RDOCLINK target
|
||||||
"<#{special.text}>"
|
"<#{target.text}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
document = doc(para('{foo}[rdoc-label:bar].'))
|
document = doc(para('{foo}[rdoc-label:bar].'))
|
||||||
|
@ -84,13 +84,13 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
assert_equal '{foo}[<rdoc-label:bar>].', formatted
|
assert_equal '{foo}[<rdoc-label:bar>].', formatted
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_special_TIDYLINK
|
def test_add_regexp_handling_TIDYLINK
|
||||||
@to.add_special_TIDYLINK
|
@to.add_regexp_handling_TIDYLINK
|
||||||
|
|
||||||
assert_includes special_names, 'TIDYLINK'
|
assert_includes regexp_handling_names, 'TIDYLINK'
|
||||||
|
|
||||||
def @to.handle_special_TIDYLINK special
|
def @to.handle_regexp_TIDYLINK target
|
||||||
"<#{special.text}>"
|
"<#{target.text}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
document = doc(para('foo[rdoc-label:bar].'))
|
document = doc(para('foo[rdoc-label:bar].'))
|
||||||
|
@ -166,7 +166,7 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
assert_nil id
|
assert_nil id
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_convert_tt_special
|
def test_convert_tt_regexp_handling
|
||||||
converted = @to.convert '<code>AAA</code>'
|
converted = @to.convert '<code>AAA</code>'
|
||||||
|
|
||||||
assert_equal '<code>AAA</code>', converted
|
assert_equal '<code>AAA</code>', converted
|
||||||
|
|
|
@ -395,7 +395,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
@to.accept_paragraph para("hello\n", "world\n")
|
@to.accept_paragraph para("hello\n", "world\n")
|
||||||
|
|
||||||
assert_equal "\n<p>hello world</p>\n", @to.res.join
|
assert_equal "\n<p>hello world </p>\n", @to.res.join
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_accept_heading_output_decoration
|
def test_accept_heading_output_decoration
|
||||||
|
@ -727,18 +727,18 @@ EXPECTED
|
||||||
assert_equal '<img src="https://example.com/image.png" />', @to.gen_url('https://example.com/image.png', 'ignored')
|
assert_equal '<img src="https://example.com/image.png" />', @to.gen_url('https://example.com/image.png', 'ignored')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_HYPERLINK_link
|
def test_handle_regexp_HYPERLINK_link
|
||||||
special = RDoc::Markup::Special.new 0, 'link:README.txt'
|
target = RDoc::Markup::RegexpHandling.new 0, 'link:README.txt'
|
||||||
|
|
||||||
link = @to.handle_special_HYPERLINK special
|
link = @to.handle_regexp_HYPERLINK target
|
||||||
|
|
||||||
assert_equal '<a href="README.txt">README.txt</a>', link
|
assert_equal '<a href="README.txt">README.txt</a>', link
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_HYPERLINK_irc
|
def test_handle_regexp_HYPERLINK_irc
|
||||||
special = RDoc::Markup::Special.new 0, 'irc://irc.freenode.net/#ruby-lang'
|
target = RDoc::Markup::RegexpHandling.new 0, 'irc://irc.freenode.net/#ruby-lang'
|
||||||
|
|
||||||
link = @to.handle_special_HYPERLINK special
|
link = @to.handle_regexp_HYPERLINK target
|
||||||
|
|
||||||
assert_equal '<a href="irc://irc.freenode.net/#ruby-lang">irc.freenode.net/#ruby-lang</a>', link
|
assert_equal '<a href="irc://irc.freenode.net/#ruby-lang">irc.freenode.net/#ruby-lang</a>', link
|
||||||
end
|
end
|
||||||
|
|
|
@ -116,66 +116,66 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
|
||||||
@to.gen_url('http://example', 'HTTP example')
|
@to.gen_url('http://example', 'HTTP example')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_CROSSREF
|
def test_handle_regexp_CROSSREF
|
||||||
assert_equal "<a href=\"C2/C3.html\">C2::C3</a>", SPECIAL('C2::C3')
|
assert_equal "<a href=\"C2/C3.html\">C2::C3</a>", REGEXP_HANDLING('C2::C3')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_CROSSREF_label
|
def test_handle_regexp_CROSSREF_label
|
||||||
assert_equal "<a href=\"C1.html#method-i-m-label-foo\">foo at C1#m</a>",
|
assert_equal "<a href=\"C1.html#method-i-m-label-foo\">foo at C1#m</a>",
|
||||||
SPECIAL('C1#m@foo')
|
REGEXP_HANDLING('C1#m@foo')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_CROSSREF_show_hash_false
|
def test_handle_regexp_CROSSREF_show_hash_false
|
||||||
@to.show_hash = false
|
@to.show_hash = false
|
||||||
|
|
||||||
assert_equal "<a href=\"C1.html#method-i-m\">m</a>",
|
assert_equal "<a href=\"C1.html#method-i-m\">m</a>",
|
||||||
SPECIAL('#m')
|
REGEXP_HANDLING('#m')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_HYPERLINK_rdoc
|
def test_handle_regexp_HYPERLINK_rdoc
|
||||||
readme = @store.add_file 'README.txt'
|
readme = @store.add_file 'README.txt'
|
||||||
readme.parser = RDoc::Parser::Simple
|
readme.parser = RDoc::Parser::Simple
|
||||||
|
|
||||||
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
|
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
|
||||||
|
|
||||||
link = @to.handle_special_HYPERLINK hyper 'C2::C3'
|
link = @to.handle_regexp_HYPERLINK hyper 'C2::C3'
|
||||||
|
|
||||||
assert_equal '<a href="C2/C3.html">C2::C3</a>', link
|
assert_equal '<a href="C2/C3.html">C2::C3</a>', link
|
||||||
|
|
||||||
link = @to.handle_special_HYPERLINK hyper 'C4'
|
link = @to.handle_regexp_HYPERLINK hyper 'C4'
|
||||||
|
|
||||||
assert_equal '<a href="C4.html">C4</a>', link
|
assert_equal '<a href="C4.html">C4</a>', link
|
||||||
|
|
||||||
link = @to.handle_special_HYPERLINK hyper 'README.txt'
|
link = @to.handle_regexp_HYPERLINK hyper 'README.txt'
|
||||||
|
|
||||||
assert_equal '<a href="README_txt.html">README.txt</a>', link
|
assert_equal '<a href="README_txt.html">README.txt</a>', link
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_TIDYLINK_rdoc
|
def test_handle_regexp_TIDYLINK_rdoc
|
||||||
readme = @store.add_file 'README.txt'
|
readme = @store.add_file 'README.txt'
|
||||||
readme.parser = RDoc::Parser::Simple
|
readme.parser = RDoc::Parser::Simple
|
||||||
|
|
||||||
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
|
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
|
||||||
|
|
||||||
link = @to.handle_special_TIDYLINK tidy 'C2::C3'
|
link = @to.handle_regexp_TIDYLINK tidy 'C2::C3'
|
||||||
|
|
||||||
assert_equal '<a href="C2/C3.html">tidy</a>', link
|
assert_equal '<a href="C2/C3.html">tidy</a>', link
|
||||||
|
|
||||||
link = @to.handle_special_TIDYLINK tidy 'C4'
|
link = @to.handle_regexp_TIDYLINK tidy 'C4'
|
||||||
|
|
||||||
assert_equal '<a href="C4.html">tidy</a>', link
|
assert_equal '<a href="C4.html">tidy</a>', link
|
||||||
|
|
||||||
link = @to.handle_special_TIDYLINK tidy 'C1#m'
|
link = @to.handle_regexp_TIDYLINK tidy 'C1#m'
|
||||||
|
|
||||||
assert_equal '<a href="C1.html#method-i-m">tidy</a>', link
|
assert_equal '<a href="C1.html#method-i-m">tidy</a>', link
|
||||||
|
|
||||||
link = @to.handle_special_TIDYLINK tidy 'README.txt'
|
link = @to.handle_regexp_TIDYLINK tidy 'README.txt'
|
||||||
|
|
||||||
assert_equal '<a href="README_txt.html">tidy</a>', link
|
assert_equal '<a href="README_txt.html">tidy</a>', link
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_TIDYLINK_label
|
def test_handle_regexp_TIDYLINK_label
|
||||||
link = @to.handle_special_TIDYLINK tidy 'C1#m@foo'
|
link = @to.handle_regexp_TIDYLINK tidy 'C1#m@foo'
|
||||||
|
|
||||||
assert_equal "<a href=\"C1.html#method-i-m-label-foo\">tidy</a>",
|
assert_equal "<a href=\"C1.html#method-i-m-label-foo\">tidy</a>",
|
||||||
link, 'C1#m@foo'
|
link, 'C1#m@foo'
|
||||||
|
@ -217,20 +217,20 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
|
||||||
"\n<p>#{text}</p>\n"
|
"\n<p>#{text}</p>\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def SPECIAL text
|
def REGEXP_HANDLING text
|
||||||
@to.handle_special_CROSSREF special text
|
@to.handle_regexp_CROSSREF regexp_handling text
|
||||||
end
|
end
|
||||||
|
|
||||||
def hyper reference
|
def hyper reference
|
||||||
RDoc::Markup::Special.new 0, "rdoc-ref:#{reference}"
|
RDoc::Markup::RegexpHandling.new 0, "rdoc-ref:#{reference}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def special text
|
def regexp_handling text
|
||||||
RDoc::Markup::Special.new 0, text
|
RDoc::Markup::RegexpHandling.new 0, text
|
||||||
end
|
end
|
||||||
|
|
||||||
def tidy reference
|
def tidy reference
|
||||||
RDoc::Markup::Special.new 0, "{tidy}[rdoc-ref:#{reference}]"
|
RDoc::Markup::RegexpHandling.new 0, "{tidy}[rdoc-ref:#{reference}]"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -458,8 +458,7 @@ So there you have it
|
||||||
|
|
||||||
expected = <<-EXPECTED
|
expected = <<-EXPECTED
|
||||||
<p>Hello
|
<p>Hello
|
||||||
<p>This is some text, it <strong>will</strong> be cut off after 100 characters
|
<p>This is some text, it <strong>will</strong> be cut off after 100 characters and an ellipsis must follow
|
||||||
and an ellipsis must follow
|
|
||||||
<p>So there you #{@ellipsis}
|
<p>So there you #{@ellipsis}
|
||||||
EXPECTED
|
EXPECTED
|
||||||
|
|
||||||
|
@ -563,8 +562,7 @@ NOTE: Given Foo::Bar, Bar is considered a class even though it may be a
|
||||||
RDOC
|
RDOC
|
||||||
|
|
||||||
expected = <<-EXPECTED
|
expected = <<-EXPECTED
|
||||||
<p>Extracts the class, selector and method name parts from <code>name</code>
|
<p>Extracts the class, selector and method name parts from <code>name</code> like Foo::Bar#baz.
|
||||||
like Foo::Bar#baz.
|
|
||||||
<p>NOTE: Given Foo::Bar, #{@ellipsis}
|
<p>NOTE: Given Foo::Bar, #{@ellipsis}
|
||||||
EXPECTED
|
EXPECTED
|
||||||
|
|
||||||
|
@ -652,10 +650,10 @@ This routine modifies its +comment+ parameter.
|
||||||
assert_equal 3, @to.characters
|
assert_equal 3, @to.characters
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_HYPERLINK_link
|
def test_handle_regexp_HYPERLINK_link
|
||||||
special = RDoc::Markup::Special.new 0, 'link:README.txt'
|
target = RDoc::Markup::RegexpHandling.new 0, 'link:README.txt'
|
||||||
|
|
||||||
link = @to.handle_special_HYPERLINK special
|
link = @to.handle_regexp_HYPERLINK target
|
||||||
|
|
||||||
assert_equal 'README.txt', link
|
assert_equal 'README.txt', link
|
||||||
end
|
end
|
||||||
|
|
|
@ -495,6 +495,43 @@ ruby
|
||||||
assert_equal 'my attr', bar.comment.text
|
assert_equal 'my attr', bar.comment.text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_parse_attr_accessor_with_newline
|
||||||
|
klass = RDoc::NormalClass.new 'Foo'
|
||||||
|
klass.parent = @top_level
|
||||||
|
|
||||||
|
comment = RDoc::Comment.new "##\n# my attr\n", @top_level
|
||||||
|
|
||||||
|
util_parser "attr_accessor :foo, :bar,\n :baz,\n :qux"
|
||||||
|
|
||||||
|
tk = @parser.get_tk
|
||||||
|
|
||||||
|
@parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment
|
||||||
|
|
||||||
|
assert_equal 4, klass.attributes.length
|
||||||
|
|
||||||
|
foo = klass.attributes[0]
|
||||||
|
assert_equal 'foo', foo.name
|
||||||
|
assert_equal 'RW', foo.rw
|
||||||
|
assert_equal 'my attr', foo.comment.text
|
||||||
|
assert_equal @top_level, foo.file
|
||||||
|
assert_equal 1, foo.line
|
||||||
|
|
||||||
|
bar = klass.attributes[1]
|
||||||
|
assert_equal 'bar', bar.name
|
||||||
|
assert_equal 'RW', bar.rw
|
||||||
|
assert_equal 'my attr', bar.comment.text
|
||||||
|
|
||||||
|
bar = klass.attributes[2]
|
||||||
|
assert_equal 'baz', bar.name
|
||||||
|
assert_equal 'RW', bar.rw
|
||||||
|
assert_equal 'my attr', bar.comment.text
|
||||||
|
|
||||||
|
bar = klass.attributes[3]
|
||||||
|
assert_equal 'qux', bar.name
|
||||||
|
assert_equal 'RW', bar.rw
|
||||||
|
assert_equal 'my attr', bar.comment.text
|
||||||
|
end
|
||||||
|
|
||||||
def test_parse_attr_accessor_nodoc
|
def test_parse_attr_accessor_nodoc
|
||||||
klass = RDoc::NormalClass.new 'Foo'
|
klass = RDoc::NormalClass.new 'Foo'
|
||||||
klass.parent = @top_level
|
klass.parent = @top_level
|
||||||
|
@ -2848,6 +2885,35 @@ EXPECTED
|
||||||
assert_equal expected, markup_code
|
assert_equal expected, markup_code
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_parse_mutable_heredocbeg
|
||||||
|
@filename = 'file.rb'
|
||||||
|
util_parser <<RUBY
|
||||||
|
class Foo
|
||||||
|
def blah()
|
||||||
|
@str = -<<-EOM
|
||||||
|
EOM
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
expected = <<EXPECTED
|
||||||
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">blah</span>()
|
||||||
|
<span class="ruby-ivar">@str</span> = <span class="ruby-identifier">-<<-EOM</span>
|
||||||
|
<span class="ruby-value"></span><span class="ruby-identifier"> EOM</span>
|
||||||
|
<span class="ruby-keyword">end</span>
|
||||||
|
EXPECTED
|
||||||
|
expected = expected.rstrip
|
||||||
|
|
||||||
|
@parser.scan
|
||||||
|
|
||||||
|
foo = @top_level.classes.first
|
||||||
|
assert_equal 'Foo', foo.full_name
|
||||||
|
|
||||||
|
blah = foo.method_list.first
|
||||||
|
markup_code = blah.markup_code.sub(/^.*\n/, '')
|
||||||
|
assert_equal expected, markup_code
|
||||||
|
end
|
||||||
|
|
||||||
def test_parse_statements_method_oneliner_with_regexp
|
def test_parse_statements_method_oneliner_with_regexp
|
||||||
util_parser <<RUBY
|
util_parser <<RUBY
|
||||||
class Foo
|
class Foo
|
||||||
|
|
|
@ -224,8 +224,7 @@ class TestRDocServlet < RDoc::TestCase
|
||||||
|
|
||||||
generator = @s.generator_for store
|
generator = @s.generator_for store
|
||||||
|
|
||||||
readme = store.add_file 'README.rdoc'
|
readme = store.add_file 'README.rdoc', parser: RDoc::Parser::Simple
|
||||||
readme.parser = RDoc::Parser::Simple
|
|
||||||
|
|
||||||
@s.documentation_page store, generator, 'README_rdoc.html', @req, @res
|
@s.documentation_page store, generator, 'README_rdoc.html', @req, @res
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
@top_level = @s.add_file 'file.rb'
|
@top_level = @s.add_file 'file.rb'
|
||||||
|
|
||||||
@page = @s.add_file 'README.txt'
|
@page = @s.add_file 'README.txt', parser: RDoc::Parser::Simple
|
||||||
@page.parser = RDoc::Parser::Simple
|
|
||||||
@page.comment = RDoc::Comment.new 'This is a page', @page
|
@page.comment = RDoc::Comment.new 'This is a page', @page
|
||||||
|
|
||||||
@klass = @top_level.add_class RDoc::NormalClass, 'Object'
|
@klass = @top_level.add_class RDoc::NormalClass, 'Object'
|
||||||
|
@ -146,7 +145,7 @@ class TestRDocStore < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_file_relative
|
def test_add_file_relative
|
||||||
top_level = @store.add_file 'path/file.rb', 'file.rb'
|
top_level = @store.add_file 'path/file.rb', relative_name: 'file.rb'
|
||||||
|
|
||||||
assert_kind_of RDoc::TopLevel, top_level
|
assert_kind_of RDoc::TopLevel, top_level
|
||||||
assert_equal @store, top_level.store
|
assert_equal @store, top_level.store
|
||||||
|
@ -310,8 +309,7 @@ class TestRDocStore < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_text_page
|
def test_find_text_page
|
||||||
page = @store.add_file 'PAGE.txt'
|
page = @store.add_file 'PAGE.txt', parser: RDoc::Parser::Simple
|
||||||
page.parser = RDoc::Parser::Simple
|
|
||||||
|
|
||||||
assert_nil @store.find_text_page 'no such page'
|
assert_nil @store.find_text_page 'no such page'
|
||||||
|
|
||||||
|
@ -601,8 +599,7 @@ class TestRDocStore < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_page
|
def test_page
|
||||||
page = @store.add_file 'PAGE.txt'
|
page = @store.add_file 'PAGE.txt', parser: RDoc::Parser::Simple
|
||||||
page.parser = RDoc::Parser::Simple
|
|
||||||
|
|
||||||
assert_nil @store.page 'no such page'
|
assert_nil @store.page 'no such page'
|
||||||
|
|
||||||
|
|
|
@ -259,8 +259,7 @@ paragraph will be cut off some point after the one-hundredth character.
|
||||||
TEXT
|
TEXT
|
||||||
|
|
||||||
expected = <<-EXPECTED
|
expected = <<-EXPECTED
|
||||||
<p>This is one-hundred characters or more of text in a single paragraph. This
|
<p>This is one-hundred characters or more of text in a single paragraph. This paragraph will be cut off …
|
||||||
paragraph will be cut off …
|
|
||||||
EXPECTED
|
EXPECTED
|
||||||
|
|
||||||
assert_equal expected, snippet(text)
|
assert_equal expected, snippet(text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue