mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* {lib,test}/rdoc: removed trailing spaces. reapplied r22784.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0c216c32dc
commit
2553a96f9e
18 changed files with 83 additions and 83 deletions
12
lib/rdoc.rb
12
lib/rdoc.rb
|
@ -88,7 +88,7 @@ $DEBUG_RDOC = nil
|
||||||
#
|
#
|
||||||
# =begin rdoc
|
# =begin rdoc
|
||||||
# Documentation to be processed by RDoc.
|
# Documentation to be processed by RDoc.
|
||||||
#
|
#
|
||||||
# ...
|
# ...
|
||||||
# =end
|
# =end
|
||||||
#
|
#
|
||||||
|
@ -104,7 +104,7 @@ $DEBUG_RDOC = nil
|
||||||
# # FIXME: fails if the birthday falls on February 29th
|
# # FIXME: fails if the birthday falls on February 29th
|
||||||
# #++
|
# #++
|
||||||
# # The DOB is returned as a Time object.
|
# # The DOB is returned as a Time object.
|
||||||
#
|
#
|
||||||
# def get_dob(person)
|
# def get_dob(person)
|
||||||
# # ...
|
# # ...
|
||||||
# end
|
# end
|
||||||
|
@ -130,7 +130,7 @@ $DEBUG_RDOC = nil
|
||||||
#
|
#
|
||||||
# def fred # :yields: index, position
|
# def fred # :yields: index, position
|
||||||
# # ...
|
# # ...
|
||||||
#
|
#
|
||||||
# yield line, address
|
# yield line, address
|
||||||
#
|
#
|
||||||
# which will get documented as
|
# which will get documented as
|
||||||
|
@ -256,12 +256,12 @@ $DEBUG_RDOC = nil
|
||||||
# module also will be omitted. By default, though, modules and
|
# module also will be omitted. By default, though, modules and
|
||||||
# classes within that class of module _will_ be documented. This is
|
# classes within that class of module _will_ be documented. This is
|
||||||
# turned off by adding the +all+ modifier.
|
# turned off by adding the +all+ modifier.
|
||||||
#
|
#
|
||||||
# module MyModule # :nodoc:
|
# module MyModule # :nodoc:
|
||||||
# class Input
|
# class Input
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# module OtherModule # :nodoc: all
|
# module OtherModule # :nodoc: all
|
||||||
# class Output
|
# class Output
|
||||||
# end
|
# end
|
||||||
|
@ -295,7 +295,7 @@ $DEBUG_RDOC = nil
|
||||||
# comment block may have one or more lines before the :section: directive.
|
# comment block may have one or more lines before the :section: directive.
|
||||||
# These will be removed, and any identical lines at the end of the block are
|
# These will be removed, and any identical lines at the end of the block are
|
||||||
# also removed. This allows you to add visual cues such as:
|
# also removed. This allows you to add visual cues such as:
|
||||||
#
|
#
|
||||||
# # ----------------------------------------
|
# # ----------------------------------------
|
||||||
# # :section: My Section
|
# # :section: My Section
|
||||||
# # This is the section that I wrote.
|
# # This is the section that I wrote.
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Darkfish Page Functions
|
* Darkfish Page Functions
|
||||||
* $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
|
* $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
|
||||||
*
|
*
|
||||||
* Author: Michael Granger <mgranger@laika.com>
|
* Author: Michael Granger <mgranger@laika.com>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Provide console simulation for firebug-less environments */
|
/* Provide console simulation for firebug-less environments */
|
||||||
|
@ -58,7 +58,7 @@ function hookQuickSearch() {
|
||||||
var toggle = $(this).parents('.section').find('h3 .search-toggle');
|
var toggle = $(this).parents('.section').find('h3 .search-toggle');
|
||||||
// console.debug( "Toggle is: %o", toggle );
|
// console.debug( "Toggle is: %o", toggle );
|
||||||
var qsbox = $(this).parents('form').get( 0 );
|
var qsbox = $(this).parents('form').get( 0 );
|
||||||
|
|
||||||
$(this).quicksearch( this, searchElems, {
|
$(this).quicksearch( this, searchElems, {
|
||||||
noSearchResultsIndicator: 'no-class-search-results',
|
noSearchResultsIndicator: 'no-class-search-results',
|
||||||
focusOnLoad: false
|
focusOnLoad: false
|
||||||
|
@ -87,7 +87,7 @@ function highlightTarget( anchor ) {
|
||||||
function highlightLocationTarget() {
|
function highlightLocationTarget() {
|
||||||
console.debug( "Location hash: %s", window.location.hash );
|
console.debug( "Location hash: %s", window.location.hash );
|
||||||
if ( ! window.location.hash || window.location.hash.length == 0 ) return;
|
if ( ! window.location.hash || window.location.hash.length == 0 ) return;
|
||||||
|
|
||||||
var anchor = window.location.hash.substring(1);
|
var anchor = window.location.hash.substring(1);
|
||||||
console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
|
console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* JQuery QuickSearch - Hook up a form field to hide non-matching elements.
|
* JQuery QuickSearch - Hook up a form field to hide non-matching elements.
|
||||||
* $Id: quicksearch.js 53 2009-01-07 02:52:03Z deveiant $
|
* $Id: quicksearch.js 53 2009-01-07 02:52:03Z deveiant $
|
||||||
*
|
*
|
||||||
* Author: Michael Granger <mgranger@laika.com>
|
* Author: Michael Granger <mgranger@laika.com>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
jQuery.fn.quicksearch = function( target, searchElems, options ) {
|
jQuery.fn.quicksearch = function( target, searchElems, options ) {
|
||||||
// console.debug( "Quicksearch fn" );
|
// console.debug( "Quicksearch fn" );
|
||||||
|
@ -17,7 +17,7 @@ jQuery.fn.quicksearch = function( target, searchElems, options ) {
|
||||||
noSearchResultsIndicator: null
|
noSearchResultsIndicator: null
|
||||||
};
|
};
|
||||||
if ( options ) $.extend( settings, options );
|
if ( options ) $.extend( settings, options );
|
||||||
|
|
||||||
return jQuery(this).each( function() {
|
return jQuery(this).each( function() {
|
||||||
// console.debug( "Creating a new quicksearch on %o for %o", this, searchElems );
|
// console.debug( "Creating a new quicksearch on %o for %o", this, searchElems );
|
||||||
new jQuery.quicksearch( this, searchElems, settings );
|
new jQuery.quicksearch( this, searchElems, settings );
|
||||||
|
@ -56,7 +56,7 @@ jQuery.quicksearch = function( searchBox, searchElems, settings ) {
|
||||||
case 8:
|
case 8:
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Only allow valid search characters
|
// Only allow valid search characters
|
||||||
default:
|
default:
|
||||||
return validQSChar( e.charCode );
|
return validQSChar( e.charCode );
|
||||||
|
@ -88,7 +88,7 @@ jQuery.quicksearch = function( searchBox, searchElems, settings ) {
|
||||||
var searchText = searchBox.value;
|
var searchText = searchBox.value;
|
||||||
var pat = new RegExp( searchText, "im" );
|
var pat = new RegExp( searchText, "im" );
|
||||||
var shownCount = 0;
|
var shownCount = 0;
|
||||||
|
|
||||||
if ( settings.noSearchResultsIndicator ) {
|
if ( settings.noSearchResultsIndicator ) {
|
||||||
$('#' + settings.noSearchResultsIndicator).hide();
|
$('#' + settings.noSearchResultsIndicator).hide();
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ jQuery.quicksearch = function( searchBox, searchElems, settings ) {
|
||||||
// All elements start out hidden
|
// All elements start out hidden
|
||||||
$(searchElems).each( function(index) {
|
$(searchElems).each( function(index) {
|
||||||
var str = $(this).text();
|
var str = $(this).text();
|
||||||
|
|
||||||
if ( pat.test(str) ) {
|
if ( pat.test(str) ) {
|
||||||
shownCount += 1;
|
shownCount += 1;
|
||||||
$(this).fadeIn();
|
$(this).fadeIn();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* "Darkfish" Rdoc CSS
|
* "Darkfish" Rdoc CSS
|
||||||
* $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $
|
* $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $
|
||||||
*
|
*
|
||||||
* Author: Michael Granger <ged@FaerieMUD.org>
|
* Author: Michael Granger <ged@FaerieMUD.org>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Base Green is: #6C8C22 */
|
/* Base Green is: #6C8C22 */
|
||||||
|
|
|
@ -27,9 +27,9 @@ require 'rdoc'
|
||||||
# convert multiple input strings.
|
# convert multiple input strings.
|
||||||
#
|
#
|
||||||
# require 'rdoc/markup/to_html'
|
# require 'rdoc/markup/to_html'
|
||||||
#
|
#
|
||||||
# h = RDoc::Markup::ToHtml.new
|
# h = RDoc::Markup::ToHtml.new
|
||||||
#
|
#
|
||||||
# puts h.convert(input_string)
|
# puts h.convert(input_string)
|
||||||
#
|
#
|
||||||
# You can extend the RDoc::Markup parser to recognise new markup
|
# You can extend the RDoc::Markup parser to recognise new markup
|
||||||
|
@ -41,22 +41,22 @@ require 'rdoc'
|
||||||
#
|
#
|
||||||
# require 'rdoc/markup'
|
# require 'rdoc/markup'
|
||||||
# require 'rdoc/markup/to_html'
|
# require 'rdoc/markup/to_html'
|
||||||
#
|
#
|
||||||
# class WikiHtml < RDoc::Markup::ToHtml
|
# class WikiHtml < RDoc::Markup::ToHtml
|
||||||
# def handle_special_WIKIWORD(special)
|
# def handle_special_WIKIWORD(special)
|
||||||
# "<font color=red>" + special.text + "</font>"
|
# "<font color=red>" + special.text + "</font>"
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# m = RDoc::Markup.new
|
# m = RDoc::Markup.new
|
||||||
# m.add_word_pair("{", "}", :STRIKE)
|
# m.add_word_pair("{", "}", :STRIKE)
|
||||||
# m.add_html("no", :STRIKE)
|
# m.add_html("no", :STRIKE)
|
||||||
#
|
#
|
||||||
# m.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
# m.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
||||||
#
|
#
|
||||||
# wh = WikiHtml.new
|
# wh = WikiHtml.new
|
||||||
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
|
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
|
||||||
#
|
#
|
||||||
# puts "<body>#{wh.convert ARGF.read}</body>"
|
# puts "<body>#{wh.convert ARGF.read}</body>"
|
||||||
#
|
#
|
||||||
#--
|
#--
|
||||||
|
|
|
@ -290,7 +290,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||||
# Determins the HTML list element for +list_type+ and +open_tag+
|
# Determins the HTML list element for +list_type+ and +open_tag+
|
||||||
|
|
||||||
def html_list_name(list_type, open_tag)
|
def html_list_name(list_type, open_tag)
|
||||||
tags = LIST_TYPE_TO_HTML[list_type]
|
tags = LIST_TYPE_TO_HTML[list_type]
|
||||||
raise RDoc::Error, "Invalid list type: #{list_type.inspect}" unless tags
|
raise RDoc::Error, "Invalid list type: #{list_type.inspect}" unless tags
|
||||||
annotate tags[open_tag ? 0 : 1]
|
annotate tags[open_tag ? 0 : 1]
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,14 +22,14 @@ require 'rdoc/stats'
|
||||||
# following incantation
|
# following incantation
|
||||||
#
|
#
|
||||||
# require "rdoc/parser"
|
# require "rdoc/parser"
|
||||||
#
|
#
|
||||||
# class RDoc::Parser::Xyz < RDoc::Parser
|
# class RDoc::Parser::Xyz < RDoc::Parser
|
||||||
# parse_files_matching /\.xyz$/ # <<<<
|
# parse_files_matching /\.xyz$/ # <<<<
|
||||||
#
|
#
|
||||||
# def initialize(file_name, body, options)
|
# def initialize(file_name, body, options)
|
||||||
# ...
|
# ...
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# def scan
|
# def scan
|
||||||
# ...
|
# ...
|
||||||
# end
|
# end
|
||||||
|
|
|
@ -76,7 +76,7 @@ require 'rdoc/known_classes'
|
||||||
# * Encapsulate the writing and reading of the configuration
|
# * Encapsulate the writing and reading of the configuration
|
||||||
# * file. ...
|
# * file. ...
|
||||||
# */
|
# */
|
||||||
#
|
#
|
||||||
# /*
|
# /*
|
||||||
# * Document-method: read_value
|
# * Document-method: read_value
|
||||||
# *
|
# *
|
||||||
|
|
|
@ -15,7 +15,7 @@ require 'rdoc/parser'
|
||||||
#
|
#
|
||||||
# We would like to support all the markup the POD provides
|
# We would like to support all the markup the POD provides
|
||||||
# so that it will convert happily to HTML. At the moment
|
# so that it will convert happily to HTML. At the moment
|
||||||
# I don't think I can do that: time constraints.
|
# I don't think I can do that: time constraints.
|
||||||
#
|
#
|
||||||
|
|
||||||
class RDoc::Parser::PerlPOD < RDoc::Parser
|
class RDoc::Parser::PerlPOD < RDoc::Parser
|
||||||
|
@ -45,39 +45,39 @@ class RDoc::Parser::PerlPOD < RDoc::Parser
|
||||||
# but I think it would obscure the intent, scatter the
|
# but I think it would obscure the intent, scatter the
|
||||||
# code all over tha place. This machine is necessary
|
# code all over tha place. This machine is necessary
|
||||||
# because POD requires that directives be preceded by
|
# because POD requires that directives be preceded by
|
||||||
# blank lines, so reading line by line is necessary,
|
# blank lines, so reading line by line is necessary,
|
||||||
# and preserving state about what is seen is necesary.
|
# and preserving state about what is seen is necesary.
|
||||||
|
|
||||||
def scan
|
def scan
|
||||||
|
|
||||||
@top_level.comment ||= ""
|
@top_level.comment ||= ""
|
||||||
state=:code_blank
|
state=:code_blank
|
||||||
line_number = 0
|
line_number = 0
|
||||||
line = nil
|
line = nil
|
||||||
|
|
||||||
# This started out as a really long nested case statement,
|
# This started out as a really long nested case statement,
|
||||||
# which also led to repetitive code. I'd like to avoid that
|
# which also led to repetitive code. I'd like to avoid that
|
||||||
# so I'm using a "table" instead.
|
# so I'm using a "table" instead.
|
||||||
|
|
||||||
# Firstly we need some procs to do the transition and processing
|
# Firstly we need some procs to do the transition and processing
|
||||||
# work. Because these are procs they are closures, and they can
|
# work. Because these are procs they are closures, and they can
|
||||||
# use variables in the local scope.
|
# use variables in the local scope.
|
||||||
#
|
#
|
||||||
# First, the "nothing to see here" stuff.
|
# First, the "nothing to see here" stuff.
|
||||||
code_noop = lambda do
|
code_noop = lambda do
|
||||||
if line =~ /^\s+$/
|
if line =~ /^\s+$/
|
||||||
state = :code_blank
|
state = :code_blank
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pod_noop = lambda do
|
pod_noop = lambda do
|
||||||
if line =~ /^\s+$/
|
if line =~ /^\s+$/
|
||||||
state = :pod_blank
|
state = :pod_blank
|
||||||
end
|
end
|
||||||
@top_level.comment += filter(line)
|
@top_level.comment += filter(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
begin_noop = lambda do
|
begin_noop = lambda do
|
||||||
if line =~ /^\s+$/
|
if line =~ /^\s+$/
|
||||||
state = :begin_blank
|
state = :begin_blank
|
||||||
end
|
end
|
||||||
|
@ -151,7 +151,7 @@ class RDoc::Parser::PerlPOD < RDoc::Parser
|
||||||
def filter(comment)
|
def filter(comment)
|
||||||
return '' if comment =~ /^=pod\s*$/
|
return '' if comment =~ /^=pod\s*$/
|
||||||
comment.gsub!(/^=pod/, '==')
|
comment.gsub!(/^=pod/, '==')
|
||||||
comment.gsub!(/^=head(\d+)/) do
|
comment.gsub!(/^=head(\d+)/) do
|
||||||
"=" * $1.to_i
|
"=" * $1.to_i
|
||||||
end
|
end
|
||||||
comment.gsub!(/=item/, '');
|
comment.gsub!(/=item/, '');
|
||||||
|
|
|
@ -50,7 +50,7 @@ $TOKEN_DEBUG ||= nil
|
||||||
#
|
#
|
||||||
# ##
|
# ##
|
||||||
# # This method tries over and over until it is tired
|
# # This method tries over and over until it is tired
|
||||||
#
|
#
|
||||||
# def go_go_go(thing_to_try, tries = 10) # :args: thing_to_try
|
# def go_go_go(thing_to_try, tries = 10) # :args: thing_to_try
|
||||||
# puts thing_to_try
|
# puts thing_to_try
|
||||||
# go_go_go thing_to_try, tries - 1
|
# go_go_go thing_to_try, tries - 1
|
||||||
|
@ -70,7 +70,7 @@ $TOKEN_DEBUG ||= nil
|
||||||
# # :call-seq:
|
# # :call-seq:
|
||||||
# # my_method(Range)
|
# # my_method(Range)
|
||||||
# # my_method(offset, length)
|
# # my_method(offset, length)
|
||||||
#
|
#
|
||||||
# def my_method(*args)
|
# def my_method(*args)
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
@ -81,7 +81,7 @@ $TOKEN_DEBUG ||= nil
|
||||||
#
|
#
|
||||||
# ##
|
# ##
|
||||||
# # My method is awesome
|
# # My method is awesome
|
||||||
#
|
#
|
||||||
# def my_method(&block) # :yields: happy, times
|
# def my_method(&block) # :yields: happy, times
|
||||||
# block.call 1, 2
|
# block.call 1, 2
|
||||||
# end
|
# end
|
||||||
|
@ -93,7 +93,7 @@ $TOKEN_DEBUG ||= nil
|
||||||
#
|
#
|
||||||
# ##
|
# ##
|
||||||
# # This is a meta-programmed method!
|
# # This is a meta-programmed method!
|
||||||
#
|
#
|
||||||
# add_my_method :meta_method, :arg1, :arg2
|
# add_my_method :meta_method, :arg1, :arg2
|
||||||
#
|
#
|
||||||
# The parser looks at the token after the identifier to determine the name, in
|
# The parser looks at the token after the identifier to determine the name, in
|
||||||
|
@ -131,14 +131,14 @@ $TOKEN_DEBUG ||= nil
|
||||||
# ##
|
# ##
|
||||||
# # :attr_writer: ghost_writer
|
# # :attr_writer: ghost_writer
|
||||||
# # There is an attribute here, but you can't see it!
|
# # There is an attribute here, but you can't see it!
|
||||||
#
|
#
|
||||||
# ##
|
# ##
|
||||||
# # :method: ghost_method
|
# # :method: ghost_method
|
||||||
# # There is a method here, but you can't see it!
|
# # There is a method here, but you can't see it!
|
||||||
#
|
#
|
||||||
# ##
|
# ##
|
||||||
# # this is a comment for a regular method
|
# # this is a comment for a regular method
|
||||||
#
|
#
|
||||||
# def regular_method() end
|
# def regular_method() end
|
||||||
#
|
#
|
||||||
# Note that by default, the :method: directive will be ignored if there is a
|
# Note that by default, the :method: directive will be ignored if there is a
|
||||||
|
@ -737,27 +737,27 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
# To create foo and bar attributes on class C with comment "My attributes":
|
# To create foo and bar attributes on class C with comment "My attributes":
|
||||||
#
|
#
|
||||||
# class C
|
# class C
|
||||||
#
|
#
|
||||||
# ##
|
# ##
|
||||||
# # :attr:
|
# # :attr:
|
||||||
# #
|
# #
|
||||||
# # My attributes
|
# # My attributes
|
||||||
#
|
#
|
||||||
# my_attr :foo, :bar
|
# my_attr :foo, :bar
|
||||||
#
|
#
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# To create a foo attribute on class C with comment "My attribute":
|
# To create a foo attribute on class C with comment "My attribute":
|
||||||
#
|
#
|
||||||
# class C
|
# class C
|
||||||
#
|
#
|
||||||
# ##
|
# ##
|
||||||
# # :attr: foo
|
# # :attr: foo
|
||||||
# #
|
# #
|
||||||
# # My attribute
|
# # My attribute
|
||||||
#
|
#
|
||||||
# my_attr :foo, :bar
|
# my_attr :foo, :bar
|
||||||
#
|
#
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def parse_meta_attr(context, single, tk, comment)
|
def parse_meta_attr(context, single, tk, comment)
|
||||||
|
|
|
@ -532,7 +532,7 @@ Options may also be set in the 'RI' environment variable.
|
||||||
elsif selector then
|
elsif selector then
|
||||||
# replace Foo with Foo:: as given
|
# replace Foo with Foo:: as given
|
||||||
completions.delete klass
|
completions.delete klass
|
||||||
completions << "#{klass}#{selector}"
|
completions << "#{klass}#{selector}"
|
||||||
end
|
end
|
||||||
|
|
||||||
completions.push(*methods)
|
completions.push(*methods)
|
||||||
|
|
|
@ -144,7 +144,7 @@ class RDoc::RubyLex
|
||||||
end
|
end
|
||||||
@seek += 1
|
@seek += 1
|
||||||
if c == "\n"
|
if c == "\n"
|
||||||
@line_no += 1
|
@line_no += 1
|
||||||
@char_no = 0
|
@char_no = 0
|
||||||
else
|
else
|
||||||
@char_no += 1
|
@char_no += 1
|
||||||
|
@ -181,10 +181,10 @@ class RDoc::RubyLex
|
||||||
c2 = @here_readed.pop
|
c2 = @here_readed.pop
|
||||||
end
|
end
|
||||||
c = c2 unless c
|
c = c2 unless c
|
||||||
@rests.unshift c #c =
|
@rests.unshift c #c =
|
||||||
@seek -= 1
|
@seek -= 1
|
||||||
if c == "\n"
|
if c == "\n"
|
||||||
@line_no -= 1
|
@line_no -= 1
|
||||||
if idx = @readed.reverse.index("\n")
|
if idx = @readed.reverse.index("\n")
|
||||||
@char_no = @readed.size - idx
|
@char_no = @readed.size - idx
|
||||||
else
|
else
|
||||||
|
@ -394,7 +394,7 @@ class RDoc::RubyLex
|
||||||
end
|
end
|
||||||
|
|
||||||
@OP.def_rule("=begin",
|
@OP.def_rule("=begin",
|
||||||
proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do
|
proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do
|
||||||
|op, io|
|
|op, io|
|
||||||
@ltype = "="
|
@ltype = "="
|
||||||
res = ''
|
res = ''
|
||||||
|
@ -415,8 +415,8 @@ class RDoc::RubyLex
|
||||||
else
|
else
|
||||||
@continue = false
|
@continue = false
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
until (@indent_stack.empty? ||
|
until (@indent_stack.empty? ||
|
||||||
[TkLPAREN, TkLBRACK, TkLBRACE,
|
[TkLPAREN, TkLBRACK, TkLBRACE,
|
||||||
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
|
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
|
||||||
@indent_stack.pop
|
@indent_stack.pop
|
||||||
end
|
end
|
||||||
|
@ -427,7 +427,7 @@ class RDoc::RubyLex
|
||||||
end
|
end
|
||||||
|
|
||||||
@OP.def_rules("*", "**",
|
@OP.def_rules("*", "**",
|
||||||
"=", "==", "===",
|
"=", "==", "===",
|
||||||
"=~", "<=>",
|
"=~", "<=>",
|
||||||
"<", "<=",
|
"<", "<=",
|
||||||
">", ">=", ">>") do
|
">", ">=", ">>") do
|
||||||
|
@ -641,8 +641,8 @@ class RDoc::RubyLex
|
||||||
@OP.def_rules(";") do
|
@OP.def_rules(";") do
|
||||||
|op, io|
|
|op, io|
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
until (@indent_stack.empty? ||
|
until (@indent_stack.empty? ||
|
||||||
[TkLPAREN, TkLBRACK, TkLBRACE,
|
[TkLPAREN, TkLBRACK, TkLBRACE,
|
||||||
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
|
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
|
||||||
@indent_stack.pop
|
@indent_stack.pop
|
||||||
end
|
end
|
||||||
|
@ -761,7 +761,7 @@ class RDoc::RubyLex
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
|
# @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
|
||||||
# |op, io|
|
# |op, io|
|
||||||
# @indent += 1
|
# @indent += 1
|
||||||
# @lex_state = EXPR_FNAME
|
# @lex_state = EXPR_FNAME
|
||||||
|
@ -1149,7 +1149,7 @@ class RDoc::RubyLex
|
||||||
str << read_escape
|
str << read_escape
|
||||||
end
|
end
|
||||||
|
|
||||||
if PERCENT_PAREN.values.include?(@quoted)
|
if PERCENT_PAREN.values.include?(@quoted)
|
||||||
if PERCENT_PAREN[ch] == @quoted
|
if PERCENT_PAREN[ch] == @quoted
|
||||||
nest += 1
|
nest += 1
|
||||||
elsif ch == @quoted
|
elsif ch == @quoted
|
||||||
|
@ -1270,7 +1270,7 @@ class RDoc::RubyLex
|
||||||
escape << ch << read_escape
|
escape << ch << read_escape
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# other characters
|
# other characters
|
||||||
end
|
end
|
||||||
|
|
||||||
escape
|
escape
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#--
|
#--
|
||||||
# irb/ruby-token.rb - ruby tokens
|
# irb/ruby-token.rb - ruby tokens
|
||||||
# $Release Version: 0.9.5$
|
# $Release Version: 0.9.5$
|
||||||
# $Revision: 11708 $
|
# $Revision: 11708 $
|
||||||
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
|
||||||
|
@ -211,7 +211,7 @@ module RDoc::RubyToken
|
||||||
IRB.fail TkReading2TokenNoKey, token
|
IRB.fail TkReading2TokenNoKey, token
|
||||||
end
|
end
|
||||||
|
|
||||||
tk = Token(tk[0], value)
|
tk = Token(tk[0], value)
|
||||||
|
|
||||||
if tk.kind_of?(TkOp) then
|
if tk.kind_of?(TkOp) then
|
||||||
tk.name = token
|
tk.name = token
|
||||||
|
@ -221,8 +221,8 @@ module RDoc::RubyToken
|
||||||
IRB.fail TkSymbol2TokenNoKey, token
|
IRB.fail TkSymbol2TokenNoKey, token
|
||||||
end
|
end
|
||||||
|
|
||||||
tk = Token(tk[0], value)
|
tk = Token(tk[0], value)
|
||||||
else
|
else
|
||||||
if token.instance_method(:initialize).arity == 3 then
|
if token.instance_method(:initialize).arity == 3 then
|
||||||
tk = token.new(@prev_seek, @prev_line_no, @prev_char_no)
|
tk = token.new(@prev_seek, @prev_line_no, @prev_char_no)
|
||||||
tk.set_text value
|
tk.set_text value
|
||||||
|
|
|
@ -9,7 +9,7 @@ class TestRDocMarkupToAnsi < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
||||||
@to = RDoc::Markup::ToAnsi.new
|
@to = RDoc::Markup::ToAnsi.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class TestRDocMarkupToRdoc < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
||||||
@to = RDoc::Markup::ToRdoc.new
|
@to = RDoc::Markup::ToRdoc.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1240,7 +1240,7 @@ end
|
||||||
util_parser 'class A; B = "#{c}"; end'
|
util_parser 'class A; B = "#{c}"; end'
|
||||||
|
|
||||||
while tk = @parser.get_tk do last_tk = tk end
|
while tk = @parser.get_tk do last_tk = tk end
|
||||||
|
|
||||||
assert_equal "\n", last_tk.text
|
assert_equal "\n", last_tk.text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -502,7 +502,7 @@ Foo::Bar#bother
|
||||||
util_store
|
util_store
|
||||||
|
|
||||||
out, err = capture_io do
|
out, err = capture_io do
|
||||||
@driver.list_known_classes
|
@driver.list_known_classes
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal "Ambiguous\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
|
assert_equal "Ambiguous\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
|
||||||
|
|
|
@ -3,18 +3,18 @@ require 'minitest/autorun'
|
||||||
require 'rdoc/task'
|
require 'rdoc/task'
|
||||||
|
|
||||||
class TestRDocTask < MiniTest::Unit::TestCase
|
class TestRDocTask < MiniTest::Unit::TestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
Rake::Task.clear
|
Rake::Task.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tasks_creation
|
def test_tasks_creation
|
||||||
RDoc::Task.new
|
RDoc::Task.new
|
||||||
assert Rake::Task[:rdoc]
|
assert Rake::Task[:rdoc]
|
||||||
assert Rake::Task[:clobber_rdoc]
|
assert Rake::Task[:clobber_rdoc]
|
||||||
assert Rake::Task[:rerdoc]
|
assert Rake::Task[:rerdoc]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tasks_creation_with_custom_name_symbol
|
def test_tasks_creation_with_custom_name_symbol
|
||||||
rd = RDoc::Task.new(:rdoc_dev)
|
rd = RDoc::Task.new(:rdoc_dev)
|
||||||
assert Rake::Task[:rdoc_dev]
|
assert Rake::Task[:rdoc_dev]
|
||||||
|
@ -22,7 +22,7 @@ class TestRDocTask < MiniTest::Unit::TestCase
|
||||||
assert Rake::Task[:rerdoc_dev]
|
assert Rake::Task[:rerdoc_dev]
|
||||||
assert_equal :rdoc_dev, rd.name
|
assert_equal :rdoc_dev, rd.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tasks_creation_with_custom_name_string
|
def test_tasks_creation_with_custom_name_string
|
||||||
rd = RDoc::Task.new("rdoc_dev")
|
rd = RDoc::Task.new("rdoc_dev")
|
||||||
assert Rake::Task[:rdoc_dev]
|
assert Rake::Task[:rdoc_dev]
|
||||||
|
@ -30,7 +30,7 @@ class TestRDocTask < MiniTest::Unit::TestCase
|
||||||
assert Rake::Task[:rerdoc_dev]
|
assert Rake::Task[:rerdoc_dev]
|
||||||
assert_equal "rdoc_dev", rd.name
|
assert_equal "rdoc_dev", rd.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tasks_creation_with_custom_name_hash
|
def test_tasks_creation_with_custom_name_hash
|
||||||
options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" }
|
options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" }
|
||||||
rd = RDoc::Task.new(options)
|
rd = RDoc::Task.new(options)
|
||||||
|
@ -40,25 +40,25 @@ class TestRDocTask < MiniTest::Unit::TestCase
|
||||||
assert_raises(RuntimeError) { Rake::Task[:clobber_rdoc] }
|
assert_raises(RuntimeError) { Rake::Task[:clobber_rdoc] }
|
||||||
assert_equal options, rd.name
|
assert_equal options, rd.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
|
def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
|
||||||
rd = RDoc::Task.new(:clobber_rdoc => "rdoc:clean")
|
rd = RDoc::Task.new(:clobber_rdoc => "rdoc:clean")
|
||||||
assert Rake::Task[:rdoc]
|
assert Rake::Task[:rdoc]
|
||||||
assert Rake::Task[:"rdoc:clean"]
|
assert Rake::Task[:"rdoc:clean"]
|
||||||
assert Rake::Task[:rerdoc]
|
assert Rake::Task[:rerdoc]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
|
def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
|
||||||
assert_raises(ArgumentError) do
|
assert_raises(ArgumentError) do
|
||||||
RDoc::Task.new(:foo => "bar")
|
RDoc::Task.new(:foo => "bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
RDoc::Task.new(:foo => "bar")
|
RDoc::Task.new(:foo => "bar")
|
||||||
rescue ArgumentError => e
|
rescue ArgumentError => e
|
||||||
assert_match(/foo/, e.message)
|
assert_match(/foo/, e.message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue