rdoc 3.9.5 → 3.10.pre.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (183) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +6 -3
  3. data/History.txt +63 -13
  4. data/LICENSE.rdoc +57 -0
  5. data/Manifest.txt +60 -6
  6. data/Rakefile +24 -12
  7. data/TODO.rdoc +30 -0
  8. data/bin/rdoc +0 -2
  9. data/lib/rdoc.rb +55 -2
  10. data/lib/rdoc/alias.rb +0 -2
  11. data/lib/rdoc/anon_class.rb +0 -2
  12. data/lib/rdoc/any_method.rb +0 -3
  13. data/lib/rdoc/attr.rb +0 -2
  14. data/lib/rdoc/class_module.rb +40 -7
  15. data/lib/rdoc/code_object.rb +1 -3
  16. data/lib/rdoc/code_objects.rb +3 -21
  17. data/lib/rdoc/comment.rb +225 -0
  18. data/lib/rdoc/constant.rb +0 -2
  19. data/lib/rdoc/context.rb +37 -120
  20. data/lib/rdoc/context/section.rb +114 -0
  21. data/lib/rdoc/cross_reference.rb +16 -7
  22. data/lib/rdoc/encoding.rb +0 -2
  23. data/lib/rdoc/gauntlet.rb +1 -1
  24. data/lib/rdoc/generator.rb +7 -2
  25. data/lib/rdoc/generator/darkfish.rb +126 -20
  26. data/lib/rdoc/generator/json_index.rb +240 -0
  27. data/lib/rdoc/generator/markup.rb +17 -54
  28. data/lib/rdoc/generator/ri.rb +0 -3
  29. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  30. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -0
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +18 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +9 -0
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +8 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +16 -0
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +12 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +7 -0
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +12 -0
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +10 -0
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +10 -0
  40. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +10 -0
  41. data/lib/rdoc/generator/template/darkfish/class.rhtml +161 -0
  42. data/lib/rdoc/generator/template/darkfish/fileinfo.rhtml +32 -0
  43. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  44. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/index.rhtml +16 -61
  48. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +99 -64
  49. data/lib/rdoc/generator/template/darkfish/js/jquery.js +15 -29
  50. data/lib/rdoc/generator/template/darkfish/js/search.js +94 -0
  51. data/lib/rdoc/generator/template/darkfish/page.rhtml +16 -0
  52. data/lib/rdoc/generator/template/darkfish/rdoc.css +126 -286
  53. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +50 -0
  54. data/lib/rdoc/generator/template/json_index/js/navigation.js +142 -0
  55. data/lib/rdoc/generator/template/json_index/js/searcher.js +228 -0
  56. data/lib/rdoc/ghost_method.rb +0 -2
  57. data/lib/rdoc/include.rb +0 -2
  58. data/lib/rdoc/markup.rb +204 -43
  59. data/lib/rdoc/markup/attr_changer.rb +25 -0
  60. data/lib/rdoc/markup/attr_span.rb +29 -0
  61. data/lib/rdoc/markup/attribute.rb +51 -0
  62. data/lib/rdoc/markup/document.rb +22 -1
  63. data/lib/rdoc/markup/formatter.rb +4 -11
  64. data/lib/rdoc/markup/formatter_test_case.rb +1 -2
  65. data/lib/rdoc/markup/heading.rb +44 -0
  66. data/lib/rdoc/markup/include.rb +42 -0
  67. data/lib/rdoc/markup/inline.rb +1 -144
  68. data/lib/rdoc/markup/list.rb +2 -1
  69. data/lib/rdoc/markup/parser.rb +6 -16
  70. data/lib/rdoc/markup/pre_process.rb +64 -10
  71. data/lib/rdoc/markup/raw.rb +1 -1
  72. data/lib/rdoc/markup/special.rb +40 -0
  73. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -2
  74. data/lib/rdoc/markup/to_ansi.rb +0 -2
  75. data/lib/rdoc/markup/to_bs.rb +0 -2
  76. data/lib/rdoc/markup/to_html.rb +102 -34
  77. data/lib/rdoc/markup/to_html_crossref.rb +36 -5
  78. data/lib/rdoc/markup/to_html_snippet.rb +270 -0
  79. data/lib/rdoc/markup/to_label.rb +55 -0
  80. data/lib/rdoc/markup/to_rdoc.rb +0 -3
  81. data/lib/rdoc/markup/to_table_of_contents.rb +62 -0
  82. data/lib/rdoc/markup/to_test.rb +0 -3
  83. data/lib/rdoc/markup/to_tt_only.rb +0 -3
  84. data/lib/rdoc/markup/verbatim.rb +18 -0
  85. data/lib/rdoc/meta_method.rb +0 -2
  86. data/lib/rdoc/method_attr.rb +17 -1
  87. data/lib/rdoc/normal_class.rb +0 -2
  88. data/lib/rdoc/normal_module.rb +0 -2
  89. data/lib/rdoc/options.rb +18 -3
  90. data/lib/rdoc/parser.rb +74 -42
  91. data/lib/rdoc/parser/c.rb +79 -118
  92. data/lib/rdoc/parser/rd.rb +22 -0
  93. data/lib/rdoc/parser/ruby.rb +86 -54
  94. data/lib/rdoc/parser/simple.rb +21 -9
  95. data/lib/rdoc/parser/text.rb +11 -0
  96. data/lib/rdoc/rd.rb +95 -0
  97. data/lib/rdoc/rd/block_parser.ry +638 -0
  98. data/lib/rdoc/rd/inline.rb +71 -0
  99. data/lib/rdoc/rd/inline_parser.ry +575 -0
  100. data/lib/rdoc/rdoc.rb +8 -23
  101. data/lib/rdoc/require.rb +0 -2
  102. data/lib/rdoc/ri.rb +4 -2
  103. data/lib/rdoc/ri/driver.rb +2 -6
  104. data/lib/rdoc/ri/store.rb +0 -1
  105. data/lib/rdoc/ruby_lex.rb +43 -20
  106. data/lib/rdoc/ruby_token.rb +44 -2
  107. data/lib/rdoc/single_class.rb +0 -2
  108. data/lib/rdoc/stats.rb +0 -5
  109. data/lib/rdoc/task.rb +2 -6
  110. data/lib/rdoc/test_case.rb +59 -0
  111. data/lib/rdoc/text.rb +42 -30
  112. data/lib/rdoc/token_stream.rb +45 -0
  113. data/lib/rdoc/tom_doc.rb +232 -0
  114. data/lib/rdoc/top_level.rb +36 -4
  115. data/test/test_attribute_manager.rb +26 -29
  116. data/test/test_rdoc_any_method.rb +2 -26
  117. data/test/test_rdoc_attr.rb +4 -4
  118. data/test/test_rdoc_class_module.rb +95 -12
  119. data/test/test_rdoc_code_object.rb +10 -3
  120. data/test/test_rdoc_comment.rb +504 -0
  121. data/test/test_rdoc_context.rb +60 -11
  122. data/test/test_rdoc_context_section.rb +16 -17
  123. data/test/test_rdoc_cross_reference.rb +17 -2
  124. data/test/test_rdoc_encoding.rb +4 -7
  125. data/test/test_rdoc_generator_darkfish.rb +12 -11
  126. data/test/test_rdoc_generator_json_index.rb +255 -0
  127. data/test/test_rdoc_generator_markup.rb +56 -0
  128. data/test/test_rdoc_generator_ri.rb +8 -11
  129. data/test/test_rdoc_markup.rb +9 -5
  130. data/test/test_rdoc_markup_attribute_manager.rb +5 -8
  131. data/test/test_rdoc_markup_document.rb +34 -6
  132. data/test/test_rdoc_markup_formatter.rb +11 -13
  133. data/test/test_rdoc_markup_heading.rb +20 -0
  134. data/test/test_rdoc_markup_include.rb +19 -0
  135. data/test/test_rdoc_markup_indented_paragraph.rb +4 -5
  136. data/test/test_rdoc_markup_paragraph.rb +2 -5
  137. data/test/test_rdoc_markup_parser.rb +87 -7
  138. data/test/test_rdoc_markup_pre_process.rb +60 -9
  139. data/test/test_rdoc_markup_raw.rb +4 -6
  140. data/test/test_rdoc_markup_to_ansi.rb +1 -4
  141. data/test/test_rdoc_markup_to_bs.rb +1 -4
  142. data/test/test_rdoc_markup_to_html.rb +170 -31
  143. data/test/test_rdoc_markup_to_html_crossref.rb +89 -11
  144. data/test/test_rdoc_markup_to_html_snippet.rb +668 -0
  145. data/test/test_rdoc_markup_to_label.rb +50 -0
  146. data/test/test_rdoc_markup_to_rdoc.rb +1 -4
  147. data/test/test_rdoc_markup_to_table_of_contents.rb +90 -0
  148. data/test/test_rdoc_markup_to_tt_only.rb +1 -4
  149. data/test/test_rdoc_markup_verbatim.rb +16 -0
  150. data/test/test_rdoc_method_attr.rb +16 -1
  151. data/test/test_rdoc_options.rb +17 -7
  152. data/test/test_rdoc_parser.rb +75 -6
  153. data/test/test_rdoc_parser_c.rb +56 -104
  154. data/test/test_rdoc_parser_rd.rb +52 -0
  155. data/test/test_rdoc_parser_ruby.rb +264 -323
  156. data/test/test_rdoc_parser_simple.rb +33 -17
  157. data/test/test_rdoc_rd.rb +30 -0
  158. data/test/test_rdoc_rd_block_parser.rb +527 -0
  159. data/test/test_rdoc_rd_inline.rb +63 -0
  160. data/test/test_rdoc_rd_inline_parser.rb +173 -0
  161. data/test/test_rdoc_rdoc.rb +7 -9
  162. data/test/test_rdoc_ri_driver.rb +10 -15
  163. data/test/test_rdoc_ri_paths.rb +6 -6
  164. data/test/test_rdoc_ri_store.rb +6 -13
  165. data/test/test_rdoc_ruby_lex.rb +53 -5
  166. data/test/test_rdoc_rubygems_hook.rb +2 -1
  167. data/test/test_rdoc_stats.rb +83 -103
  168. data/test/test_rdoc_task.rb +5 -4
  169. data/test/test_rdoc_text.rb +156 -11
  170. data/test/test_rdoc_token_stream.rb +42 -0
  171. data/test/test_rdoc_tom_doc.rb +458 -0
  172. data/test/test_rdoc_top_level.rb +49 -2
  173. data/test/xref_test_case.rb +4 -8
  174. metadata +217 -111
  175. metadata.gz.sig +0 -0
  176. checksums.yaml +0 -7
  177. checksums.yaml.gz.sig +0 -0
  178. data/CVE-2013-0256.rdoc +0 -49
  179. data/LICENSE.txt +0 -57
  180. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -321
  181. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -124
  182. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
  183. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
@@ -1,16 +1,5 @@
1
1
  require 'rdoc'
2
2
 
3
- require 'rdoc/encoding'
4
- require 'rdoc/parser'
5
-
6
- # Simple must come first
7
- require 'rdoc/parser/simple'
8
- require 'rdoc/parser/ruby'
9
- require 'rdoc/parser/c'
10
-
11
- require 'rdoc/stats'
12
- require 'rdoc/options'
13
-
14
3
  require 'find'
15
4
  require 'fileutils'
16
5
  require 'time'
@@ -96,7 +85,7 @@ class RDoc::RDoc
96
85
  ##
97
86
  # Sets the active RDoc::RDoc instance
98
87
 
99
- def self.current=(rdoc)
88
+ def self.current= rdoc
100
89
  @current = rdoc
101
90
  end
102
91
 
@@ -106,6 +95,7 @@ class RDoc::RDoc
106
95
  def self.reset
107
96
  RDoc::TopLevel.reset
108
97
  RDoc::Parser::C.reset
98
+ RDoc::RDoc.current = nil
109
99
  end
110
100
 
111
101
  ##
@@ -409,6 +399,7 @@ The internal error was:
409
399
 
410
400
  def document options
411
401
  RDoc::RDoc.reset
402
+ RDoc::RDoc.current = self
412
403
 
413
404
  if RDoc::Options === options then
414
405
  @options = options
@@ -468,18 +459,12 @@ The internal error was:
468
459
 
469
460
  def generate file_info
470
461
  Dir.chdir @options.op_dir do
471
- begin
472
- self.class.current = self
473
-
474
- unless @options.quiet then
475
- $stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
476
- end
477
-
478
- @generator.generate file_info
479
- update_output_dir '.', @start_time, @last_modified
480
- ensure
481
- self.class.current = nil
462
+ unless @options.quiet then
463
+ $stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
482
464
  end
465
+
466
+ @generator.generate file_info
467
+ update_output_dir '.', @start_time, @last_modified
483
468
  end
484
469
  end
485
470
 
@@ -1,5 +1,3 @@
1
- require 'rdoc/code_object'
2
-
3
1
  ##
4
2
  # A file loaded by \#require
5
3
 
@@ -12,7 +12,9 @@ module RDoc::RI
12
12
 
13
13
  class Error < RDoc::Error; end
14
14
 
15
- end
15
+ autoload :Driver, 'rdoc/ri/driver'
16
+ autoload :Paths, 'rdoc/ri/paths'
17
+ autoload :Store, 'rdoc/ri/store'
16
18
 
17
- require 'rdoc/ri/store'
19
+ end
18
20
 
@@ -11,11 +11,7 @@ begin
11
11
  rescue LoadError
12
12
  end
13
13
 
14
- require 'rdoc/ri'
15
- require 'rdoc/ri/paths'
16
- require 'rdoc/markup'
17
- require 'rdoc/markup/formatter'
18
- require 'rdoc/text'
14
+ require 'rdoc'
19
15
 
20
16
  ##
21
17
  # For RubyGems backwards compatibility
@@ -1101,7 +1097,7 @@ Options may also be set in the 'RI' environment variable.
1101
1097
  # Foo::Bar#baz.
1102
1098
  #
1103
1099
  # NOTE: Given Foo::Bar, Bar is considered a class even though it may be a
1104
- # method
1100
+ # method
1105
1101
 
1106
1102
  def parse_name name
1107
1103
  parts = name.split(/(::|#|\.)/)
@@ -1,4 +1,3 @@
1
- require 'rdoc/code_objects'
2
1
  require 'fileutils'
3
2
 
4
3
  ##
@@ -11,7 +11,6 @@
11
11
 
12
12
  require "e2mmap"
13
13
  require "irb/slex"
14
- require "rdoc/ruby_token"
15
14
  require "stringio"
16
15
 
17
16
  ##
@@ -23,6 +22,12 @@ class RDoc::RubyLex
23
22
 
24
23
  # :stopdoc:
25
24
 
25
+ ##
26
+ # Raised upon invalid input
27
+
28
+ class Error < RDoc::Error
29
+ end
30
+
26
31
  extend Exception2MessageMapper
27
32
 
28
33
  def_exception(:AlreadyDefinedToken, "Already defined token(%s)")
@@ -51,6 +56,19 @@ class RDoc::RubyLex
51
56
 
52
57
  self.debug_level = 0
53
58
 
59
+ def self.tokenize text, options
60
+ tokens = []
61
+
62
+ scanner = RDoc::RubyLex.new text, options
63
+ scanner.exception_on_syntax_error = true
64
+
65
+ while token = scanner.token do
66
+ tokens << token
67
+ end
68
+
69
+ tokens
70
+ end
71
+
54
72
  def initialize(content, options)
55
73
  lex_init
56
74
 
@@ -91,6 +109,7 @@ class RDoc::RubyLex
91
109
 
92
110
  @prompt = nil
93
111
  @prev_seek = nil
112
+ @ltype = nil
94
113
  end
95
114
 
96
115
  def inspect # :nodoc:
@@ -122,8 +141,8 @@ class RDoc::RubyLex
122
141
  end
123
142
 
124
143
  def get_readed
125
- if idx = @readed.reverse.index("\n")
126
- @base_char_no = idx
144
+ if idx = @readed.rindex("\n")
145
+ @base_char_no = @readed.size - (idx + 1)
127
146
  else
128
147
  @base_char_no += @readed.size
129
148
  end
@@ -188,8 +207,8 @@ class RDoc::RubyLex
188
207
  @seek -= 1
189
208
  if c == "\n"
190
209
  @line_no -= 1
191
- if idx = @readed.reverse.index("\n")
192
- @char_no = @readed.size - idx
210
+ if idx = @readed.rindex("\n")
211
+ @char_no = idx + 1
193
212
  else
194
213
  @char_no = @base_char_no + @readed.size
195
214
  end
@@ -323,7 +342,7 @@ class RDoc::RubyLex
323
342
  tk = @OP.match(self)
324
343
  @space_seen = tk.kind_of?(TkSPACE)
325
344
  rescue SyntaxError => e
326
- raise RDoc::Error, "syntax error: #{e.message}" if
345
+ raise Error, "syntax error: #{e.message}" if
327
346
  @exception_on_syntax_error
328
347
 
329
348
  tk = TkError.new(@seek, @line_no, @char_no)
@@ -413,7 +432,7 @@ class RDoc::RubyLex
413
432
  gets # consume =end
414
433
 
415
434
  @ltype = nil
416
- Token(TkCOMMENT, res)
435
+ Token(TkRD_COMMENT, res)
417
436
  end
418
437
 
419
438
  @OP.def_rule("\n") do |op, io|
@@ -978,14 +997,15 @@ class RDoc::RubyLex
978
997
  end
979
998
 
980
999
  @here_header = false
981
- doc = ''
1000
+ doc = '"'
982
1001
  while l = gets
983
- l = l.sub(/(:?\r)?\n\z/, '')
1002
+ l = l.sub(/(:?\r)?\n\z/, "\n")
984
1003
  if (indent ? l.strip : l) == quoted
985
1004
  break
986
1005
  end
987
1006
  doc << l
988
1007
  end
1008
+ doc << '"'
989
1009
 
990
1010
  @here_header = true
991
1011
  @here_readed.concat reserve
@@ -1005,7 +1025,7 @@ class RDoc::RubyLex
1005
1025
  elsif ch =~ /\W/
1006
1026
  lt = "\""
1007
1027
  else
1008
- raise RDoc::Error, "unknown type of %string #{ch.inspect}"
1028
+ raise Error, "unknown type of %string #{ch.inspect}"
1009
1029
  end
1010
1030
  # if ch !~ /\W/
1011
1031
  # ungetc
@@ -1040,7 +1060,7 @@ class RDoc::RubyLex
1040
1060
  when /[0-7]/
1041
1061
  match = /[0-7_]/
1042
1062
  when /[89]/
1043
- raise RDoc::Error, "Illegal octal digit"
1063
+ raise Error, "Illegal octal digit"
1044
1064
  else
1045
1065
  return Token(TkINTEGER, num)
1046
1066
  end
@@ -1054,7 +1074,7 @@ class RDoc::RubyLex
1054
1074
  if match =~ ch
1055
1075
  if ch == "_"
1056
1076
  if non_digit
1057
- raise RDoc::Error, "trailing `#{ch}' in number"
1077
+ raise Error, "trailing `#{ch}' in number"
1058
1078
  else
1059
1079
  non_digit = ch
1060
1080
  end
@@ -1066,10 +1086,10 @@ class RDoc::RubyLex
1066
1086
  ungetc
1067
1087
  num[-1, 1] = ''
1068
1088
  if len0
1069
- raise RDoc::Error, "numeric literal without digits"
1089
+ raise Error, "numeric literal without digits"
1070
1090
  end
1071
1091
  if non_digit
1072
- raise RDoc::Error, "trailing `#{non_digit}' in number"
1092
+ raise Error, "trailing `#{non_digit}' in number"
1073
1093
  end
1074
1094
  break
1075
1095
  end
@@ -1090,7 +1110,7 @@ class RDoc::RubyLex
1090
1110
  non_digit = ch
1091
1111
  when allow_point && "."
1092
1112
  if non_digit
1093
- raise RDoc::Error, "trailing `#{non_digit}' in number"
1113
+ raise Error, "trailing `#{non_digit}' in number"
1094
1114
  end
1095
1115
  type = TkFLOAT
1096
1116
  if peek(0) !~ /[0-9]/
@@ -1102,7 +1122,7 @@ class RDoc::RubyLex
1102
1122
  allow_point = false
1103
1123
  when allow_e && "e", allow_e && "E"
1104
1124
  if non_digit
1105
- raise RDoc::Error, "trailing `#{non_digit}' in number"
1125
+ raise Error, "trailing `#{non_digit}' in number"
1106
1126
  end
1107
1127
  type = TkFLOAT
1108
1128
  if peek(0) =~ /[+-]/
@@ -1113,7 +1133,7 @@ class RDoc::RubyLex
1113
1133
  non_digit = ch
1114
1134
  else
1115
1135
  if non_digit
1116
- raise RDoc::Error, "trailing `#{non_digit}' in number"
1136
+ raise Error, "trailing `#{non_digit}' in number"
1117
1137
  end
1118
1138
  ungetc
1119
1139
  num[-1, 1] = ''
@@ -1125,13 +1145,16 @@ class RDoc::RubyLex
1125
1145
  end
1126
1146
 
1127
1147
  def identify_string(ltype, quoted = ltype)
1148
+ close = PERCENT_PAREN.values.include?(quoted)
1128
1149
  @ltype = ltype
1129
1150
  @quoted = quoted
1130
1151
 
1131
1152
  str = if ltype == quoted then
1132
1153
  ltype.dup
1154
+ elsif RUBY_VERSION > '1.9' then
1155
+ "%#{PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]}"
1133
1156
  else
1134
- "%#{PERCENT_PAREN_REV[quoted]}"
1157
+ "%#{PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]}"
1135
1158
  end
1136
1159
 
1137
1160
  subtype = nil
@@ -1141,7 +1164,7 @@ class RDoc::RubyLex
1141
1164
  while ch = getc
1142
1165
  str << ch
1143
1166
 
1144
- if @quoted == ch and nest == 0
1167
+ if @quoted == ch and nest <= 0
1145
1168
  break
1146
1169
  elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#"
1147
1170
  ch = getc
@@ -1162,7 +1185,7 @@ class RDoc::RubyLex
1162
1185
  str << read_escape
1163
1186
  end
1164
1187
 
1165
- if PERCENT_PAREN.values.include?(@quoted)
1188
+ if close then
1166
1189
  if PERCENT_PAREN[ch] == @quoted
1167
1190
  nest += 1
1168
1191
  elsif ch == @quoted
@@ -60,6 +60,11 @@ module RDoc::RubyToken
60
60
  self
61
61
  end
62
62
 
63
+ def inspect # :nodoc:
64
+ klass = self.class.name.split('::').last
65
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @text]
66
+ end
67
+
63
68
  end
64
69
 
65
70
  class TkNode < Token
@@ -83,6 +88,12 @@ module RDoc::RubyToken
83
88
  end
84
89
 
85
90
  alias text node
91
+
92
+ def inspect # :nodoc:
93
+ klass = self.class.name.split('::').last
94
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @node]
95
+ end
96
+
86
97
  end
87
98
 
88
99
  class TkId < Token
@@ -105,6 +116,12 @@ module RDoc::RubyToken
105
116
  end
106
117
 
107
118
  alias text name
119
+
120
+ def inspect # :nodoc:
121
+ klass = self.class.name.split('::').last
122
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name]
123
+ end
124
+
108
125
  end
109
126
 
110
127
  class TkKW < TkId
@@ -130,6 +147,12 @@ module RDoc::RubyToken
130
147
  end
131
148
 
132
149
  alias text value
150
+
151
+ def inspect # :nodoc:
152
+ klass = self.class.name.split('::').last
153
+ "{%s %s, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @value]
154
+ end
155
+
133
156
  end
134
157
 
135
158
  class TkOp < Token
@@ -153,6 +176,12 @@ module RDoc::RubyToken
153
176
  end
154
177
 
155
178
  alias text name
179
+
180
+ def inspect # :nodoc:
181
+ klass = self.class.name.split('::').last
182
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name]
183
+ end
184
+
156
185
  end
157
186
 
158
187
  class TkOPASGN < TkOp
@@ -175,6 +204,12 @@ module RDoc::RubyToken
175
204
  def text
176
205
  @text ||= "#{TkToken2Reading[op]}="
177
206
  end
207
+
208
+ def inspect # :nodoc:
209
+ klass = self.class.name.split('::').last
210
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @op]
211
+ end
212
+
178
213
  end
179
214
 
180
215
  class TkUnknownChar < Token
@@ -197,6 +232,12 @@ module RDoc::RubyToken
197
232
  end
198
233
 
199
234
  alias text name
235
+
236
+ def inspect # :nodoc:
237
+ klass = self.class.name.split('::').last
238
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name]
239
+ end
240
+
200
241
  end
201
242
 
202
243
  class TkError < Token
@@ -360,7 +401,6 @@ module RDoc::RubyToken
360
401
  [:TkSEMICOLON, Token, ";"],
361
402
 
362
403
  [:TkCOMMENT, TkVal],
363
- [:TkRD_COMMENT],
364
404
  [:TkSPACE, Token, " "],
365
405
  [:TkNL, Token, "\n"],
366
406
  [:TkEND_OF_SCRIPT],
@@ -401,7 +441,9 @@ module RDoc::RubyToken
401
441
  def_token(*defs)
402
442
  end
403
443
 
404
- NEWLINE_TOKEN = TkNL.new nil, 0, 0, "\n"
444
+ def_token :TkRD_COMMENT, TkCOMMENT
445
+
446
+ NEWLINE_TOKEN = TkNL.new 0, 0, 0, "\n"
405
447
 
406
448
  class TkSYMBOL
407
449
 
@@ -1,5 +1,3 @@
1
- require 'rdoc/class_module'
2
-
3
1
  ##
4
2
  # A singleton class
5
3
 
@@ -1,5 +1,3 @@
1
- require 'rdoc'
2
-
3
1
  ##
4
2
  # RDoc statistics collector which prints a summary and report of a project's
5
3
  # documentation totals.
@@ -211,9 +209,6 @@ class RDoc::Stats
211
209
 
212
210
  def report
213
211
  if @coverage_level > 0 then
214
- require 'rdoc/markup/to_tt_only'
215
- require 'rdoc/generator/markup'
216
- require 'rdoc/text'
217
212
  extend RDoc::Text
218
213
  end
219
214
 
@@ -25,12 +25,12 @@ require 'rubygems'
25
25
  begin
26
26
  gem 'rdoc'
27
27
  rescue Gem::LoadError
28
- end
28
+ end unless defined?(RDoc)
29
29
 
30
30
  begin
31
31
  gem 'rake'
32
32
  rescue Gem::LoadError
33
- end
33
+ end unless defined?(Rake)
34
34
 
35
35
  require 'rdoc'
36
36
  require 'rake'
@@ -52,7 +52,6 @@ require 'rake/tasklib'
52
52
  #
53
53
  # Simple Example:
54
54
  #
55
- # gem 'rdoc'
56
55
  # require 'rdoc/task'
57
56
  #
58
57
  # RDoc::Task.new do |rdoc|
@@ -69,7 +68,6 @@ require 'rake/tasklib'
69
68
  # generating two sets of documentation. For instance, if you want to have a
70
69
  # development set of documentation including private methods:
71
70
  #
72
- # gem 'rdoc'
73
71
  # require 'rdoc/task'
74
72
  #
75
73
  # RDoc::Task.new :rdoc_dev do |rdoc|
@@ -87,7 +85,6 @@ require 'rake/tasklib'
87
85
  #
88
86
  # For example:
89
87
  #
90
- # gem 'rdoc'
91
88
  # require 'rdoc/task'
92
89
  #
93
90
  # RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
@@ -241,7 +238,6 @@ class RDoc::Task < Rake::TaskLib
241
238
  args = option_list + @rdoc_files
242
239
 
243
240
  $stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
244
- require 'rdoc/rdoc'
245
241
  RDoc::RDoc.new.document args
246
242
  end
247
243