rdoc 4.0.1 → 4.1.0.preview.3

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 (140) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +1 -3
  5. data/{DEVELOPERS.rdoc → CONTRIBUTING.rdoc} +28 -3
  6. data/ExampleMarkdown.md +37 -0
  7. data/ExampleRDoc.rdoc +208 -0
  8. data/History.rdoc +81 -0
  9. data/Manifest.txt +11 -2
  10. data/README.rdoc +5 -5
  11. data/Rakefile +34 -4
  12. data/lib/rdoc.rb +4 -3
  13. data/lib/rdoc/any_method.rb +48 -4
  14. data/lib/rdoc/class_module.rb +16 -2
  15. data/lib/rdoc/code_object.rb +85 -24
  16. data/lib/rdoc/comment.rb +0 -3
  17. data/lib/rdoc/constant.rb +9 -1
  18. data/lib/rdoc/context.rb +20 -2
  19. data/lib/rdoc/cross_reference.rb +1 -1
  20. data/lib/rdoc/extend.rb +4 -112
  21. data/lib/rdoc/generator/darkfish.rb +46 -7
  22. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +4 -4
  23. data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -8
  24. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +4 -3
  25. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +3 -3
  26. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +3 -4
  27. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +4 -3
  28. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +3 -4
  29. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +3 -3
  30. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +4 -4
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +9 -5
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -3
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +12 -7
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +5 -4
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +6 -7
  37. data/lib/rdoc/generator/template/darkfish/class.rhtml +36 -41
  38. data/lib/rdoc/generator/template/darkfish/fonts.css +167 -0
  39. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  40. data/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  41. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  42. data/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  43. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  44. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  48. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  49. data/lib/rdoc/generator/template/darkfish/index.rhtml +11 -7
  50. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -15
  51. data/lib/rdoc/generator/template/darkfish/js/search.js +12 -4
  52. data/lib/rdoc/generator/template/darkfish/page.rhtml +9 -9
  53. data/lib/rdoc/generator/template/darkfish/rdoc.css +226 -241
  54. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +5 -5
  55. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +13 -6
  56. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +17 -14
  57. data/lib/rdoc/include.rb +4 -114
  58. data/lib/rdoc/known_classes.rb +1 -0
  59. data/lib/rdoc/markdown.kpeg +126 -117
  60. data/lib/rdoc/markdown.rb +404 -389
  61. data/lib/rdoc/markdown/literals_1_8.kpeg +1 -1
  62. data/lib/rdoc/markdown/literals_1_8.rb +15 -12
  63. data/lib/rdoc/markdown/literals_1_9.kpeg +1 -1
  64. data/lib/rdoc/markdown/literals_1_9.rb +15 -12
  65. data/lib/rdoc/markup.rb +10 -13
  66. data/lib/rdoc/markup/attribute_manager.rb +3 -2
  67. data/lib/rdoc/markup/formatter.rb +3 -3
  68. data/lib/rdoc/markup/heading.rb +13 -0
  69. data/lib/rdoc/markup/parser.rb +10 -3
  70. data/lib/rdoc/markup/pre_process.rb +1 -1
  71. data/lib/rdoc/markup/to_html.rb +46 -31
  72. data/lib/rdoc/markup/to_html_crossref.rb +3 -0
  73. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  74. data/lib/rdoc/markup/to_markdown.rb +7 -5
  75. data/lib/rdoc/markup/verbatim.rb +1 -1
  76. data/lib/rdoc/method_attr.rb +13 -1
  77. data/lib/rdoc/mixin.rb +120 -0
  78. data/lib/rdoc/normal_class.rb +4 -0
  79. data/lib/rdoc/normal_module.rb +4 -0
  80. data/lib/rdoc/options.rb +42 -8
  81. data/lib/rdoc/parser.rb +4 -2
  82. data/lib/rdoc/parser/c.rb +13 -7
  83. data/lib/rdoc/parser/ruby.rb +683 -480
  84. data/lib/rdoc/rdoc.rb +4 -3
  85. data/lib/rdoc/ri/driver.rb +174 -103
  86. data/lib/rdoc/ri/paths.rb +6 -6
  87. data/lib/rdoc/ruby_lex.rb +125 -102
  88. data/lib/rdoc/ruby_token.rb +41 -40
  89. data/lib/rdoc/servlet.rb +16 -6
  90. data/lib/rdoc/stats.rb +61 -48
  91. data/lib/rdoc/store.rb +5 -3
  92. data/lib/rdoc/test_case.rb +39 -0
  93. data/lib/rdoc/tom_doc.rb +28 -4
  94. data/lib/rdoc/top_level.rb +2 -2
  95. data/test/test_rdoc_any_method.rb +104 -1
  96. data/test/test_rdoc_class_module.rb +9 -15
  97. data/test/test_rdoc_code_object.rb +133 -8
  98. data/test/test_rdoc_context.rb +17 -0
  99. data/test/test_rdoc_context_section.rb +0 -7
  100. data/test/test_rdoc_cross_reference.rb +4 -3
  101. data/test/test_rdoc_generator_darkfish.rb +61 -19
  102. data/test/test_rdoc_generator_json_index.rb +0 -11
  103. data/test/test_rdoc_generator_ri.rb +0 -8
  104. data/test/test_rdoc_markdown.rb +15 -12
  105. data/test/test_rdoc_markdown_test.rb +0 -7
  106. data/test/test_rdoc_markup_attribute_manager.rb +121 -0
  107. data/test/test_rdoc_markup_document.rb +0 -7
  108. data/test/test_rdoc_markup_formatter.rb +29 -3
  109. data/test/test_rdoc_markup_heading.rb +9 -0
  110. data/test/test_rdoc_markup_parser.rb +0 -7
  111. data/test/test_rdoc_markup_pre_process.rb +15 -3
  112. data/test/test_rdoc_markup_raw.rb +0 -7
  113. data/test/test_rdoc_markup_to_html.rb +50 -8
  114. data/test/test_rdoc_markup_to_html_crossref.rb +7 -0
  115. data/test/test_rdoc_markup_to_html_snippet.rb +4 -4
  116. data/test/test_rdoc_markup_to_markdown.rb +6 -0
  117. data/test/test_rdoc_method_attr.rb +8 -0
  118. data/test/test_rdoc_normal_class.rb +5 -0
  119. data/test/test_rdoc_normal_module.rb +5 -0
  120. data/test/test_rdoc_options.rb +61 -22
  121. data/test/test_rdoc_parser.rb +10 -0
  122. data/test/test_rdoc_parser_c.rb +17 -5
  123. data/test/test_rdoc_parser_changelog.rb +0 -7
  124. data/test/test_rdoc_parser_rd.rb +0 -7
  125. data/test/test_rdoc_parser_ruby.rb +305 -28
  126. data/test/test_rdoc_rd_block_parser.rb +0 -8
  127. data/test/test_rdoc_rd_inline_parser.rb +0 -1
  128. data/test/test_rdoc_rdoc.rb +27 -1
  129. data/test/test_rdoc_ri_driver.rb +19 -7
  130. data/test/test_rdoc_ruby_lex.rb +116 -9
  131. data/test/test_rdoc_rubygems_hook.rb +1 -1
  132. data/test/test_rdoc_servlet.rb +44 -6
  133. data/test/test_rdoc_stats.rb +161 -141
  134. data/test/test_rdoc_store.rb +11 -19
  135. data/test/test_rdoc_text.rb +0 -7
  136. data/test/test_rdoc_tom_doc.rb +44 -16
  137. data/test/xref_test_case.rb +2 -0
  138. metadata +28 -27
  139. metadata.gz.sig +0 -0
  140. data/test/test_attribute_manager.rb +0 -120
@@ -217,7 +217,7 @@ option)
217
217
  end unless @options.force_output
218
218
  else
219
219
  FileUtils.mkdir_p dir
220
- FileUtils.touch output_flag_file dir
220
+ FileUtils.touch flag_file
221
221
  end
222
222
 
223
223
  last
@@ -289,6 +289,7 @@ option)
289
289
  file_list = []
290
290
 
291
291
  relative_files.each do |rel_file_name|
292
+ next if rel_file_name.end_with? 'created.rid'
292
293
  next if exclude_pattern && exclude_pattern =~ rel_file_name
293
294
  stat = File.stat rel_file_name rescue next
294
295
 
@@ -495,7 +496,7 @@ The internal error was:
495
496
  if @options.coverage_report then
496
497
  puts
497
498
 
498
- puts @stats.report
499
+ puts @stats.report.accept RDoc::Markup::ToRdoc.new
499
500
  elsif file_info.empty? then
500
501
  $stderr.puts "\nNo newer files." unless @options.quiet
501
502
  else
@@ -508,7 +509,7 @@ The internal error was:
508
509
 
509
510
  if @stats and (@options.coverage_report or not @options.quiet) then
510
511
  puts
511
- puts @stats.summary
512
+ puts @stats.summary.accept RDoc::Markup::ToRdoc.new
512
513
  end
513
514
 
514
515
  exit @stats.fully_documented? if @options.coverage_report
@@ -197,7 +197,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
197
197
 
198
198
  opt.separator nil
199
199
 
200
- opt.on("--[no-]pager", "-T",
200
+ opt.on("--[no-]pager",
201
201
  "Send output directly to stdout,",
202
202
  "rather than to a pager.") do |use_pager|
203
203
  options[:use_stdout] = !use_pager
@@ -205,6 +205,13 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
205
205
 
206
206
  opt.separator nil
207
207
 
208
+ opt.on("-T",
209
+ "Synonym for --no-pager") do
210
+ options[:use_stdout] = true
211
+ end
212
+
213
+ opt.separator nil
214
+
208
215
  opt.on("--width=WIDTH", "-w", OptionParser::DecimalInteger,
209
216
  "Set the width of the output.") do |width|
210
217
  options[:width] = width
@@ -459,38 +466,51 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
459
466
 
460
467
  extensions.each do |modules, store|
461
468
  if modules.length == 1 then
462
- include = modules.first
463
- name = include.name
464
- path = store.friendly_path
465
- out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
466
-
467
- if include.comment then
468
- out << RDoc::Markup::BlankLine.new
469
- out << include.comment
470
- end
469
+ add_extension_modules_single out, store, modules.first
471
470
  else
472
- out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
471
+ add_extension_modules_multiple out, store, modules
472
+ end
473
+ end
474
+ end
473
475
 
474
- wout, with = modules.partition { |incl| incl.comment.empty? }
476
+ ##
477
+ # Renders multiple included +modules+ from +store+ to +out+.
475
478
 
476
- out << RDoc::Markup::BlankLine.new unless with.empty?
479
+ def add_extension_modules_multiple out, store, modules # :nodoc:
480
+ out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
477
481
 
478
- with.each do |incl|
479
- out << RDoc::Markup::Paragraph.new(incl.name)
480
- out << RDoc::Markup::BlankLine.new
481
- out << incl.comment
482
- end
482
+ wout, with = modules.partition { |incl| incl.comment.empty? }
483
483
 
484
- unless wout.empty? then
485
- verb = RDoc::Markup::Verbatim.new
484
+ out << RDoc::Markup::BlankLine.new unless with.empty?
486
485
 
487
- wout.each do |incl|
488
- verb.push incl.name, "\n"
489
- end
486
+ with.each do |incl|
487
+ out << RDoc::Markup::Paragraph.new(incl.name)
488
+ out << RDoc::Markup::BlankLine.new
489
+ out << incl.comment
490
+ end
490
491
 
491
- out << verb
492
- end
492
+ unless wout.empty? then
493
+ verb = RDoc::Markup::Verbatim.new
494
+
495
+ wout.each do |incl|
496
+ verb.push incl.name, "\n"
493
497
  end
498
+
499
+ out << verb
500
+ end
501
+ end
502
+
503
+ ##
504
+ # Adds a single extension module +include+ from +store+ to +out+
505
+
506
+ def add_extension_modules_single out, store, include # :nodoc:
507
+ name = include.name
508
+ path = store.friendly_path
509
+ out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
510
+
511
+ if include.comment then
512
+ out << RDoc::Markup::BlankLine.new
513
+ out << include.comment
494
514
  end
495
515
  end
496
516
 
@@ -596,68 +616,56 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
596
616
  add_extends out, extends
597
617
 
598
618
  found.each do |store, klass|
599
- comment = klass.comment
600
- # TODO the store's cache should always return an empty Array
601
- class_methods = store.class_methods[klass.full_name] || []
602
- instance_methods = store.instance_methods[klass.full_name] || []
603
- attributes = store.attributes[klass.full_name] || []
604
-
605
- if comment.empty? and
606
- instance_methods.empty? and class_methods.empty? then
607
- also_in << store
608
- next
609
- end
610
-
611
- add_from out, store
619
+ render_class out, store, klass, also_in
620
+ end
612
621
 
613
- unless comment.empty? then
614
- out << RDoc::Markup::Rule.new(1)
622
+ add_also_in out, also_in
615
623
 
616
- if comment.merged? then
617
- parts = comment.parts
618
- parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
619
- parts.flatten!
620
- parts.pop
624
+ out
625
+ end
621
626
 
622
- out.concat parts
623
- else
624
- out << comment
625
- end
626
- end
627
+ ##
628
+ # Adds the class +comment+ to +out+.
627
629
 
628
- if class_methods or instance_methods or not klass.constants.empty? then
629
- out << RDoc::Markup::Rule.new(1)
630
- end
630
+ def class_document_comment out, comment # :nodoc:
631
+ unless comment.empty? then
632
+ out << RDoc::Markup::Rule.new(1)
631
633
 
632
- unless klass.constants.empty? then
633
- out << RDoc::Markup::Heading.new(1, "Constants:")
634
- out << RDoc::Markup::BlankLine.new
635
- list = RDoc::Markup::List.new :NOTE
634
+ if comment.merged? then
635
+ parts = comment.parts
636
+ parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
637
+ parts.flatten!
638
+ parts.pop
636
639
 
637
- constants = klass.constants.sort_by { |constant| constant.name }
640
+ out.concat parts
641
+ else
642
+ out << comment
643
+ end
644
+ end
645
+ end
638
646
 
639
- list.items.concat constants.map { |constant|
640
- parts = constant.comment.parts if constant.comment
641
- parts << RDoc::Markup::Paragraph.new('[not documented]') if
642
- parts.empty?
647
+ ##
648
+ # Adds the constants from +klass+ to the Document +out+.
643
649
 
644
- RDoc::Markup::ListItem.new(constant.name, *parts)
645
- }
650
+ def class_document_constants out, klass # :nodoc:
651
+ return if klass.constants.empty?
646
652
 
647
- out << list
648
- out << RDoc::Markup::BlankLine.new
649
- end
653
+ out << RDoc::Markup::Heading.new(1, "Constants:")
654
+ out << RDoc::Markup::BlankLine.new
655
+ list = RDoc::Markup::List.new :NOTE
650
656
 
651
- add_method_list out, class_methods, 'Class methods'
652
- add_method_list out, instance_methods, 'Instance methods'
653
- add_method_list out, attributes, 'Attributes'
657
+ constants = klass.constants.sort_by { |constant| constant.name }
654
658
 
655
- add_method_documentation out, klass if @show_all
656
- end
659
+ list.items.concat constants.map { |constant|
660
+ parts = constant.comment.parts if constant.comment
661
+ parts << RDoc::Markup::Paragraph.new('[not documented]') if
662
+ parts.empty?
657
663
 
658
- add_also_in out, also_in
664
+ RDoc::Markup::ListItem.new(constant.name, *parts)
665
+ }
659
666
 
660
- out
667
+ out << list
668
+ out << RDoc::Markup::BlankLine.new
661
669
  end
662
670
 
663
671
  ##
@@ -709,16 +717,24 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
709
717
  # Completes +name+ based on the caches. For Readline
710
718
 
711
719
  def complete name
712
- klasses = classes.keys
713
720
  completions = []
714
721
 
715
722
  klass, selector, method = parse_name name
716
723
 
724
+ complete_klass name, klass, selector, method, completions
725
+ complete_method name, klass, selector, completions
726
+
727
+ completions.sort.uniq
728
+ end
729
+
730
+ def complete_klass name, klass, selector, method, completions # :nodoc:
731
+ klasses = classes.keys
732
+
717
733
  # may need to include Foo when given Foo::
718
734
  klass_name = method ? name : klass
719
735
 
720
736
  if name !~ /#|\./ then
721
- completions = klasses.grep(/^#{Regexp.escape klass_name}[^:]*$/)
737
+ completions.replace klasses.grep(/^#{Regexp.escape klass_name}[^:]*$/)
722
738
  completions.concat klasses.grep(/^#{Regexp.escape name}[^:]*$/) if
723
739
  name =~ /::$/
724
740
 
@@ -728,7 +744,9 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
728
744
  elsif classes.key? klass_name then
729
745
  completions << klass_name
730
746
  end
747
+ end
731
748
 
749
+ def complete_method name, klass, selector, completions # :nodoc:
732
750
  if completions.include? klass and name =~ /#|\.|::/ then
733
751
  methods = list_methods_matching name
734
752
 
@@ -743,8 +761,6 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
743
761
 
744
762
  completions.concat methods
745
763
  end
746
-
747
- completions.sort.uniq
748
764
  end
749
765
 
750
766
  ##
@@ -804,7 +820,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
804
820
  true
805
821
  rescue NotFoundError
806
822
  matches = list_methods_matching name if name =~ /::|#|\./
807
- matches = classes.keys.grep(/^#{name}/) if matches.empty?
823
+ matches = classes.keys.grep(/^#{Regexp.escape name}/) if matches.empty?
808
824
 
809
825
  raise if matches.empty?
810
826
 
@@ -1183,6 +1199,12 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
1183
1199
  return unless method
1184
1200
 
1185
1201
  store.load_method klass, "#{type}#{method}"
1202
+ rescue RDoc::Store::MissingFileError => e
1203
+ comment = RDoc::Comment.new("missing documentation at #{e.file}").parse
1204
+
1205
+ method = RDoc::AnyMethod.new nil, name
1206
+ method.comment = comment
1207
+ method
1186
1208
  end
1187
1209
 
1188
1210
  ##
@@ -1228,30 +1250,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
1228
1250
 
1229
1251
  filtered.each do |store, methods|
1230
1252
  methods.each do |method|
1231
- out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
1232
-
1233
- unless name =~ /^#{Regexp.escape method.parent_name}/ then
1234
- out << RDoc::Markup::Heading.new(3, "Implementation from #{method.parent_name}")
1235
- end
1236
-
1237
- out << RDoc::Markup::Rule.new(1)
1238
-
1239
- if method.arglists then
1240
- arglists = method.arglists.chomp.split "\n"
1241
- arglists = arglists.map { |line| line + "\n" }
1242
- out << RDoc::Markup::Verbatim.new(*arglists)
1243
- out << RDoc::Markup::Rule.new(1)
1244
- end
1245
-
1246
- if method.respond_to?(:superclass_method) and method.superclass_method
1247
- out << RDoc::Markup::BlankLine.new
1248
- out << RDoc::Markup::Heading.new(4, "(Uses superclass method #{method.superclass_method})")
1249
- out << RDoc::Markup::Rule.new(1)
1250
- end
1251
-
1252
- out << RDoc::Markup::BlankLine.new
1253
- out << method.comment
1254
- out << RDoc::Markup::BlankLine.new
1253
+ render_method out, store, method, name
1255
1254
  end
1256
1255
  end
1257
1256
 
@@ -1345,6 +1344,78 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
1345
1344
  [klass, type, meth]
1346
1345
  end
1347
1346
 
1347
+ ##
1348
+ # Renders the +klass+ from +store+ to +out+. If the klass has no
1349
+ # documentable items the class is added to +also_in+ instead.
1350
+
1351
+ def render_class out, store, klass, also_in # :nodoc:
1352
+ comment = klass.comment
1353
+ # TODO the store's cache should always return an empty Array
1354
+ class_methods = store.class_methods[klass.full_name] || []
1355
+ instance_methods = store.instance_methods[klass.full_name] || []
1356
+ attributes = store.attributes[klass.full_name] || []
1357
+
1358
+ if comment.empty? and
1359
+ instance_methods.empty? and class_methods.empty? then
1360
+ also_in << store
1361
+ return
1362
+ end
1363
+
1364
+ add_from out, store
1365
+
1366
+ class_document_comment out, comment
1367
+
1368
+ if class_methods or instance_methods or not klass.constants.empty? then
1369
+ out << RDoc::Markup::Rule.new(1)
1370
+ end
1371
+
1372
+ class_document_constants out, klass
1373
+
1374
+ add_method_list out, class_methods, 'Class methods'
1375
+ add_method_list out, instance_methods, 'Instance methods'
1376
+ add_method_list out, attributes, 'Attributes'
1377
+
1378
+ add_method_documentation out, klass if @show_all
1379
+ end
1380
+
1381
+ def render_method out, store, method, name # :nodoc:
1382
+ out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
1383
+
1384
+ unless name =~ /^#{Regexp.escape method.parent_name}/ then
1385
+ out << RDoc::Markup::Heading.new(3, "Implementation from #{method.parent_name}")
1386
+ end
1387
+
1388
+ out << RDoc::Markup::Rule.new(1)
1389
+
1390
+ render_method_arguments out, method.arglists
1391
+ render_method_superclass out, method
1392
+ render_method_comment out, method
1393
+ end
1394
+
1395
+ def render_method_arguments out, arglists # :nodoc:
1396
+ return unless arglists
1397
+
1398
+ arglists = arglists.chomp.split "\n"
1399
+ arglists = arglists.map { |line| line + "\n" }
1400
+ out << RDoc::Markup::Verbatim.new(*arglists)
1401
+ out << RDoc::Markup::Rule.new(1)
1402
+ end
1403
+
1404
+ def render_method_comment out, method # :nodoc:
1405
+ out << RDoc::Markup::BlankLine.new
1406
+ out << method.comment
1407
+ out << RDoc::Markup::BlankLine.new
1408
+ end
1409
+
1410
+ def render_method_superclass out, method # :nodoc:
1411
+ return unless
1412
+ method.respond_to?(:superclass_method) and method.superclass_method
1413
+
1414
+ out << RDoc::Markup::BlankLine.new
1415
+ out << RDoc::Markup::Heading.new(4, "(Uses superclass method #{method.superclass_method})")
1416
+ out << RDoc::Markup::Rule.new(1)
1417
+ end
1418
+
1348
1419
  ##
1349
1420
  # Looks up and displays ri data according to the options given.
1350
1421
 
@@ -162,9 +162,9 @@ module RDoc::RI::Paths
162
162
  ##
163
163
  # The location of ri data installed into the site dir.
164
164
  #
165
- # Historically this was available for documentation installed by ruby
165
+ # Historically this was available for documentation installed by Ruby
166
166
  # libraries predating RubyGems. It is unlikely to contain any content for
167
- # modern ruby installations.
167
+ # modern Ruby installations.
168
168
 
169
169
  def self.site_dir
170
170
  File.join BASE, 'site'
@@ -173,11 +173,11 @@ module RDoc::RI::Paths
173
173
  ##
174
174
  # The location of the built-in ri data.
175
175
  #
176
- # This data is built automatically when `make` is run when ruby is
177
- # installed. If you did not install ruby by hand you may need to install
176
+ # This data is built automatically when `make` is run when Ruby is
177
+ # installed. If you did not install Ruby by hand you may need to install
178
178
  # the documentation yourself. Please consult the documentation for your
179
- # package manager or ruby installer for details. You can also use the
180
- # rdoc-data gem to install system ri data for common versions of ruby.
179
+ # package manager or Ruby installer for details. You can also use the
180
+ # rdoc-data gem to install system ri data for common versions of Ruby.
181
181
 
182
182
  def self.system_dir
183
183
  File.join BASE, 'system'
@@ -42,8 +42,8 @@ class RDoc::RubyLex
42
42
  include RDoc::RubyToken
43
43
  include IRB
44
44
 
45
- attr_reader :continue
46
- attr_reader :lex_state
45
+ attr_accessor :continue
46
+ attr_accessor :lex_state
47
47
  attr_reader :reader
48
48
 
49
49
  class << self
@@ -107,7 +107,7 @@ class RDoc::RubyLex
107
107
  @here_header = false
108
108
  @indent = 0
109
109
  @indent_stack = []
110
- @lex_state = EXPR_BEG
110
+ @lex_state = :EXPR_BEG
111
111
  @space_seen = false
112
112
 
113
113
  @continue = false
@@ -280,7 +280,7 @@ class RDoc::RubyLex
280
280
  @quoted = nil
281
281
  @indent = 0
282
282
  @indent_stack = []
283
- @lex_state = EXPR_BEG
283
+ @lex_state = :EXPR_BEG
284
284
  @space_seen = false
285
285
  @here_header = false
286
286
 
@@ -450,11 +450,11 @@ class RDoc::RubyLex
450
450
  @OP.def_rule("\n") do |op, io|
451
451
  print "\\n\n" if RDoc::RubyLex.debug?
452
452
  case @lex_state
453
- when EXPR_BEG, EXPR_FNAME, EXPR_DOT
453
+ when :EXPR_BEG, :EXPR_FNAME, :EXPR_DOT
454
454
  @continue = true
455
455
  else
456
456
  @continue = false
457
- @lex_state = EXPR_BEG
457
+ @lex_state = :EXPR_BEG
458
458
  until (@indent_stack.empty? ||
459
459
  [TkLPAREN, TkLBRACK, TkLBRACE,
460
460
  TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@@ -473,25 +473,25 @@ class RDoc::RubyLex
473
473
  ">", ">=", ">>") do
474
474
  |op, io|
475
475
  case @lex_state
476
- when EXPR_FNAME, EXPR_DOT
477
- @lex_state = EXPR_ARG
476
+ when :EXPR_FNAME, :EXPR_DOT
477
+ @lex_state = :EXPR_ARG
478
478
  else
479
- @lex_state = EXPR_BEG
479
+ @lex_state = :EXPR_BEG
480
480
  end
481
481
  Token(op)
482
482
  end
483
483
 
484
484
  @OP.def_rules("!", "!=", "!~") do
485
485
  |op, io|
486
- @lex_state = EXPR_BEG
486
+ @lex_state = :EXPR_BEG
487
487
  Token(op)
488
488
  end
489
489
 
490
490
  @OP.def_rules("<<") do
491
491
  |op, io|
492
492
  tk = nil
493
- if @lex_state != EXPR_END && @lex_state != EXPR_CLASS &&
494
- (@lex_state != EXPR_ARG || @space_seen)
493
+ if @lex_state != :EXPR_END && @lex_state != :EXPR_CLASS &&
494
+ (@lex_state != :EXPR_ARG || @space_seen)
495
495
  c = peek(0)
496
496
  if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-")
497
497
  tk = identify_here_document
@@ -500,10 +500,10 @@ class RDoc::RubyLex
500
500
  unless tk
501
501
  tk = Token(op)
502
502
  case @lex_state
503
- when EXPR_FNAME, EXPR_DOT
504
- @lex_state = EXPR_ARG
503
+ when :EXPR_FNAME, :EXPR_DOT
504
+ @lex_state = :EXPR_ARG
505
505
  else
506
- @lex_state = EXPR_BEG
506
+ @lex_state = :EXPR_BEG
507
507
  end
508
508
  end
509
509
  tk
@@ -516,8 +516,8 @@ class RDoc::RubyLex
516
516
 
517
517
  @OP.def_rules("`") do
518
518
  |op, io|
519
- if @lex_state == EXPR_FNAME
520
- @lex_state = EXPR_END
519
+ if @lex_state == :EXPR_FNAME
520
+ @lex_state = :EXPR_END
521
521
  Token(op)
522
522
  else
523
523
  identify_string(op)
@@ -526,61 +526,61 @@ class RDoc::RubyLex
526
526
 
527
527
  @OP.def_rules('?') do
528
528
  |op, io|
529
- if @lex_state == EXPR_END
530
- @lex_state = EXPR_BEG
529
+ if @lex_state == :EXPR_END
530
+ @lex_state = :EXPR_BEG
531
531
  Token(TkQUESTION)
532
532
  else
533
533
  ch = getc
534
- if @lex_state == EXPR_ARG && ch =~ /\s/
534
+ if @lex_state == :EXPR_ARG && ch =~ /\s/
535
535
  ungetc
536
- @lex_state = EXPR_BEG;
536
+ @lex_state = :EXPR_BEG;
537
537
  Token(TkQUESTION)
538
538
  else
539
- @lex_state = EXPR_END
540
- Token(TkSTRING, ch)
539
+ @lex_state = :EXPR_END
540
+ Token(TkCHAR, "?#{ch}")
541
541
  end
542
542
  end
543
543
  end
544
544
 
545
545
  @OP.def_rules("&", "&&", "|", "||") do
546
546
  |op, io|
547
- @lex_state = EXPR_BEG
547
+ @lex_state = :EXPR_BEG
548
548
  Token(op)
549
549
  end
550
550
 
551
551
  @OP.def_rules("+=", "-=", "*=", "**=",
552
552
  "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
553
553
  |op, io|
554
- @lex_state = EXPR_BEG
554
+ @lex_state = :EXPR_BEG
555
555
  op =~ /^(.*)=$/
556
556
  Token(TkOPASGN, $1)
557
557
  end
558
558
 
559
- @OP.def_rule("+@", proc{|op, io| @lex_state == EXPR_FNAME}) do
559
+ @OP.def_rule("+@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
560
560
  |op, io|
561
- @lex_state = EXPR_ARG
561
+ @lex_state = :EXPR_ARG
562
562
  Token(op)
563
563
  end
564
564
 
565
- @OP.def_rule("-@", proc{|op, io| @lex_state == EXPR_FNAME}) do
565
+ @OP.def_rule("-@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
566
566
  |op, io|
567
- @lex_state = EXPR_ARG
567
+ @lex_state = :EXPR_ARG
568
568
  Token(op)
569
569
  end
570
570
 
571
571
  @OP.def_rules("+", "-") do
572
572
  |op, io|
573
573
  catch(:RET) do
574
- if @lex_state == EXPR_ARG
574
+ if @lex_state == :EXPR_ARG
575
575
  if @space_seen and peek(0) =~ /[0-9]/
576
576
  throw :RET, identify_number(op)
577
577
  else
578
- @lex_state = EXPR_BEG
578
+ @lex_state = :EXPR_BEG
579
579
  end
580
- elsif @lex_state != EXPR_END and peek(0) =~ /[0-9]/
580
+ elsif @lex_state != :EXPR_END and peek(0) =~ /[0-9]/
581
581
  throw :RET, identify_number(op)
582
582
  else
583
- @lex_state = EXPR_BEG
583
+ @lex_state = :EXPR_BEG
584
584
  end
585
585
  Token(op)
586
586
  end
@@ -588,20 +588,20 @@ class RDoc::RubyLex
588
588
 
589
589
  @OP.def_rule(".") do
590
590
  |op, io|
591
- @lex_state = EXPR_BEG
591
+ @lex_state = :EXPR_BEG
592
592
  if peek(0) =~ /[0-9]/
593
593
  ungetc
594
594
  identify_number
595
595
  else
596
596
  # for "obj.if" etc.
597
- @lex_state = EXPR_DOT
597
+ @lex_state = :EXPR_DOT
598
598
  Token(TkDOT)
599
599
  end
600
600
  end
601
601
 
602
602
  @OP.def_rules("..", "...") do
603
603
  |op, io|
604
- @lex_state = EXPR_BEG
604
+ @lex_state = :EXPR_BEG
605
605
  Token(op)
606
606
  end
607
607
 
@@ -611,7 +611,7 @@ class RDoc::RubyLex
611
611
  def lex_int2
612
612
  @OP.def_rules("]", "}", ")") do
613
613
  |op, io|
614
- @lex_state = EXPR_END
614
+ @lex_state = :EXPR_END
615
615
  @indent -= 1
616
616
  @indent_stack.pop
617
617
  Token(op)
@@ -619,11 +619,11 @@ class RDoc::RubyLex
619
619
 
620
620
  @OP.def_rule(":") do
621
621
  |op, io|
622
- if @lex_state == EXPR_END || peek(0) =~ /\s/
623
- @lex_state = EXPR_BEG
622
+ if @lex_state == :EXPR_END || peek(0) =~ /\s/
623
+ @lex_state = :EXPR_BEG
624
624
  Token(TkCOLON)
625
625
  else
626
- @lex_state = EXPR_FNAME;
626
+ @lex_state = :EXPR_FNAME;
627
627
  Token(TkSYMBEG)
628
628
  end
629
629
  end
@@ -631,51 +631,51 @@ class RDoc::RubyLex
631
631
  @OP.def_rule("::") do
632
632
  |op, io|
633
633
  # p @lex_state.id2name, @space_seen
634
- if @lex_state == EXPR_BEG or @lex_state == EXPR_ARG && @space_seen
635
- @lex_state = EXPR_BEG
634
+ if @lex_state == :EXPR_BEG or @lex_state == :EXPR_ARG && @space_seen
635
+ @lex_state = :EXPR_BEG
636
636
  Token(TkCOLON3)
637
637
  else
638
- @lex_state = EXPR_DOT
638
+ @lex_state = :EXPR_DOT
639
639
  Token(TkCOLON2)
640
640
  end
641
641
  end
642
642
 
643
643
  @OP.def_rule("/") do
644
644
  |op, io|
645
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
645
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
646
646
  identify_string(op)
647
647
  elsif peek(0) == '='
648
648
  getc
649
- @lex_state = EXPR_BEG
649
+ @lex_state = :EXPR_BEG
650
650
  Token(TkOPASGN, "/") #/)
651
- elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
651
+ elsif @lex_state == :EXPR_ARG and @space_seen and peek(0) !~ /\s/
652
652
  identify_string(op)
653
653
  else
654
- @lex_state = EXPR_BEG
654
+ @lex_state = :EXPR_BEG
655
655
  Token("/") #/)
656
656
  end
657
657
  end
658
658
 
659
659
  @OP.def_rules("^") do
660
660
  |op, io|
661
- @lex_state = EXPR_BEG
661
+ @lex_state = :EXPR_BEG
662
662
  Token("^")
663
663
  end
664
664
 
665
665
  # @OP.def_rules("^=") do
666
- # @lex_state = EXPR_BEG
666
+ # @lex_state = :EXPR_BEG
667
667
  # Token(OP_ASGN, :^)
668
668
  # end
669
669
 
670
670
  @OP.def_rules(",") do
671
671
  |op, io|
672
- @lex_state = EXPR_BEG
672
+ @lex_state = :EXPR_BEG
673
673
  Token(op)
674
674
  end
675
675
 
676
676
  @OP.def_rules(";") do
677
677
  |op, io|
678
- @lex_state = EXPR_BEG
678
+ @lex_state = :EXPR_BEG
679
679
  until (@indent_stack.empty? ||
680
680
  [TkLPAREN, TkLBRACK, TkLBRACE,
681
681
  TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@@ -686,56 +686,56 @@ class RDoc::RubyLex
686
686
 
687
687
  @OP.def_rule("~") do
688
688
  |op, io|
689
- @lex_state = EXPR_BEG
689
+ @lex_state = :EXPR_BEG
690
690
  Token("~")
691
691
  end
692
692
 
693
- @OP.def_rule("~@", proc{|op, io| @lex_state == EXPR_FNAME}) do
693
+ @OP.def_rule("~@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
694
694
  |op, io|
695
- @lex_state = EXPR_BEG
695
+ @lex_state = :EXPR_BEG
696
696
  Token("~")
697
697
  end
698
698
 
699
699
  @OP.def_rule("(") do
700
700
  |op, io|
701
701
  @indent += 1
702
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
703
- @lex_state = EXPR_BEG
702
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
703
+ @lex_state = :EXPR_BEG
704
704
  tk_c = TkfLPAREN
705
705
  else
706
- @lex_state = EXPR_BEG
706
+ @lex_state = :EXPR_BEG
707
707
  tk_c = TkLPAREN
708
708
  end
709
709
  @indent_stack.push tk_c
710
710
  Token tk_c
711
711
  end
712
712
 
713
- @OP.def_rule("[]", proc{|op, io| @lex_state == EXPR_FNAME}) do
713
+ @OP.def_rule("[]", proc{|op, io| @lex_state == :EXPR_FNAME}) do
714
714
  |op, io|
715
- @lex_state = EXPR_ARG
715
+ @lex_state = :EXPR_ARG
716
716
  Token("[]")
717
717
  end
718
718
 
719
- @OP.def_rule("[]=", proc{|op, io| @lex_state == EXPR_FNAME}) do
719
+ @OP.def_rule("[]=", proc{|op, io| @lex_state == :EXPR_FNAME}) do
720
720
  |op, io|
721
- @lex_state = EXPR_ARG
721
+ @lex_state = :EXPR_ARG
722
722
  Token("[]=")
723
723
  end
724
724
 
725
725
  @OP.def_rule("[") do
726
726
  |op, io|
727
727
  @indent += 1
728
- if @lex_state == EXPR_FNAME
728
+ if @lex_state == :EXPR_FNAME
729
729
  tk_c = TkfLBRACK
730
730
  else
731
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
731
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
732
732
  tk_c = TkLBRACK
733
- elsif @lex_state == EXPR_ARG && @space_seen
733
+ elsif @lex_state == :EXPR_ARG && @space_seen
734
734
  tk_c = TkLBRACK
735
735
  else
736
736
  tk_c = TkfLBRACK
737
737
  end
738
- @lex_state = EXPR_BEG
738
+ @lex_state = :EXPR_BEG
739
739
  end
740
740
  @indent_stack.push tk_c
741
741
  Token(tk_c)
@@ -744,12 +744,12 @@ class RDoc::RubyLex
744
744
  @OP.def_rule("{") do
745
745
  |op, io|
746
746
  @indent += 1
747
- if @lex_state != EXPR_END && @lex_state != EXPR_ARG
747
+ if @lex_state != :EXPR_END && @lex_state != :EXPR_ARG
748
748
  tk_c = TkLBRACE
749
749
  else
750
750
  tk_c = TkfLBRACE
751
751
  end
752
- @lex_state = EXPR_BEG
752
+ @lex_state = :EXPR_BEG
753
753
  @indent_stack.push tk_c
754
754
  Token(tk_c)
755
755
  end
@@ -768,15 +768,15 @@ class RDoc::RubyLex
768
768
 
769
769
  @OP.def_rule('%') do
770
770
  |op, io|
771
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
771
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
772
772
  identify_quotation
773
773
  elsif peek(0) == '='
774
774
  getc
775
775
  Token(TkOPASGN, :%)
776
- elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
776
+ elsif @lex_state == :EXPR_ARG and @space_seen and peek(0) !~ /\s/
777
777
  identify_quotation
778
778
  else
779
- @lex_state = EXPR_BEG
779
+ @lex_state = :EXPR_BEG
780
780
  Token("%") #))
781
781
  end
782
782
  end
@@ -799,15 +799,15 @@ class RDoc::RubyLex
799
799
  # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
800
800
  # |op, io|
801
801
  # @indent += 1
802
- # @lex_state = EXPR_FNAME
803
- # # @lex_state = EXPR_END
802
+ # @lex_state = :EXPR_FNAME
803
+ # # @lex_state = :EXPR_END
804
804
  # # until @rests[0] == "\n" or @rests[0] == ";"
805
805
  # # rests.shift
806
806
  # # end
807
807
  # end
808
808
 
809
809
  @OP.def_rule("_") do
810
- if peek_match?(/_END__/) and @lex_state == EXPR_BEG then
810
+ if peek_match?(/_END__/) and @lex_state == :EXPR_BEG then
811
811
  6.times { getc }
812
812
  Token(TkEND_OF_SCRIPT, '__END__')
813
813
  else
@@ -832,7 +832,7 @@ class RDoc::RubyLex
832
832
  end
833
833
 
834
834
  def identify_gvar
835
- @lex_state = EXPR_END
835
+ @lex_state = :EXPR_END
836
836
 
837
837
  case ch = getc
838
838
  when /[~_*$?!@\/\\;,=:<>".]/ #"
@@ -888,32 +888,33 @@ class RDoc::RubyLex
888
888
  when /^\$/
889
889
  return Token(TkGVAR, token)
890
890
  when /^\@\@/
891
- @lex_state = EXPR_END
891
+ @lex_state = :EXPR_END
892
892
  # p Token(TkCVAR, token)
893
893
  return Token(TkCVAR, token)
894
894
  when /^\@/
895
- @lex_state = EXPR_END
895
+ @lex_state = :EXPR_END
896
896
  return Token(TkIVAR, token)
897
897
  end
898
898
 
899
- if @lex_state != EXPR_DOT
899
+ if @lex_state != :EXPR_DOT
900
900
  print token, "\n" if RDoc::RubyLex.debug?
901
901
 
902
902
  token_c, *trans = TkReading2Token[token]
903
903
  if token_c
904
904
  # reserved word?
905
905
 
906
- if (@lex_state != EXPR_BEG &&
907
- @lex_state != EXPR_FNAME &&
906
+ if (@lex_state != :EXPR_BEG &&
907
+ @lex_state != :EXPR_FNAME &&
908
908
  trans[1])
909
909
  # modifiers
910
910
  token_c = TkSymbol2Token[trans[1]]
911
911
  @lex_state = trans[0]
912
912
  else
913
- if @lex_state != EXPR_FNAME
913
+ if @lex_state != :EXPR_FNAME
914
914
  if ENINDENT_CLAUSE.include?(token)
915
+ valid = peek(0) != ':'
916
+
915
917
  # check for ``class = val'' etc.
916
- valid = true
917
918
  case token
918
919
  when "class"
919
920
  valid = false unless peek_match?(/^\s*(<<|\w|::)/)
@@ -925,7 +926,8 @@ class RDoc::RubyLex
925
926
  valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&|\|)/)
926
927
  else
927
928
  # no nothing
928
- end
929
+ end if valid
930
+
929
931
  if valid
930
932
  if token == "do"
931
933
  if ![TkFOR, TkWHILE, TkUNTIL].include?(@indent_stack.last)
@@ -946,23 +948,23 @@ class RDoc::RubyLex
946
948
  end
947
949
  @lex_state = trans[0]
948
950
  else
949
- @lex_state = EXPR_END
951
+ @lex_state = :EXPR_END
950
952
  end
951
953
  end
952
954
  return Token(token_c, token)
953
955
  end
954
956
  end
955
957
 
956
- if @lex_state == EXPR_FNAME
957
- @lex_state = EXPR_END
958
+ if @lex_state == :EXPR_FNAME
959
+ @lex_state = :EXPR_END
958
960
  if peek(0) == '='
959
961
  token.concat getc
960
962
  end
961
- elsif @lex_state == EXPR_BEG || @lex_state == EXPR_DOT ||
962
- @lex_state == EXPR_ARG
963
- @lex_state = EXPR_ARG
963
+ elsif @lex_state == :EXPR_BEG || @lex_state == :EXPR_DOT ||
964
+ @lex_state == :EXPR_ARG
965
+ @lex_state = :EXPR_ARG
964
966
  else
965
- @lex_state = EXPR_END
967
+ @lex_state = :EXPR_END
966
968
  end
967
969
 
968
970
  if token[0, 1] =~ /[A-Z]/
@@ -1043,7 +1045,7 @@ class RDoc::RubyLex
1043
1045
 
1044
1046
  token_class = output_heredoc ? RDoc::RubyLex::TkHEREDOC : Ltype2Token[lt]
1045
1047
  @ltype = ltback
1046
- @lex_state = EXPR_END
1048
+ @lex_state = :EXPR_END
1047
1049
  Token(token_class, doc)
1048
1050
  end
1049
1051
 
@@ -1067,7 +1069,7 @@ class RDoc::RubyLex
1067
1069
  end
1068
1070
 
1069
1071
  def identify_number(op = "")
1070
- @lex_state = EXPR_END
1072
+ @lex_state = :EXPR_END
1071
1073
 
1072
1074
  num = op
1073
1075
 
@@ -1229,8 +1231,8 @@ class RDoc::RubyLex
1229
1231
  end
1230
1232
 
1231
1233
  if @ltype == "/"
1232
- if peek(0) =~ /i|m|x|o|e|s|u|n/
1233
- getc
1234
+ while peek(0) =~ /i|m|x|o|e|s|u|n/
1235
+ str << getc
1234
1236
  end
1235
1237
  end
1236
1238
 
@@ -1242,7 +1244,7 @@ class RDoc::RubyLex
1242
1244
  ensure
1243
1245
  @ltype = nil
1244
1246
  @quoted = nil
1245
- @lex_state = EXPR_END
1247
+ @lex_state = :EXPR_END
1246
1248
  end
1247
1249
  end
1248
1250
 
@@ -1285,18 +1287,19 @@ class RDoc::RubyLex
1285
1287
  def read_escape
1286
1288
  escape = ''
1287
1289
  ch = getc
1288
- escape << ch
1289
1290
 
1290
1291
  case ch
1291
1292
  when "\n", "\r", "\f"
1293
+ escape << ch
1292
1294
  when "\\", "n", "t", "r", "f", "v", "a", "e", "b", "s" #"
1295
+ escape << ch
1293
1296
  when /[0-7]/
1294
1297
  ungetc ch
1295
1298
  3.times do
1296
1299
  ch = getc
1297
- escape << ch
1298
1300
  case ch
1299
1301
  when /[0-7]/
1302
+ escape << ch
1300
1303
  when nil
1301
1304
  break
1302
1305
  else
@@ -1306,11 +1309,13 @@ class RDoc::RubyLex
1306
1309
  end
1307
1310
 
1308
1311
  when "x"
1312
+ escape << ch
1313
+
1309
1314
  2.times do
1310
1315
  ch = getc
1311
- escape << ch
1312
1316
  case ch
1313
1317
  when /[0-9a-fA-F]/
1318
+ escape << ch
1314
1319
  when nil
1315
1320
  break
1316
1321
  else
@@ -1320,26 +1325,44 @@ class RDoc::RubyLex
1320
1325
  end
1321
1326
 
1322
1327
  when "M"
1323
- ch = getc
1324
1328
  escape << ch
1329
+
1330
+ ch = getc
1325
1331
  if ch != '-'
1326
1332
  ungetc
1327
1333
  else
1328
- ch = getc
1329
1334
  escape << ch
1335
+
1336
+ ch = getc
1330
1337
  if ch == "\\" #"
1338
+ ungetc
1331
1339
  escape << read_escape
1340
+ else
1341
+ escape << ch
1332
1342
  end
1333
1343
  end
1334
1344
 
1335
1345
  when "C", "c" #, "^"
1336
- if ch == "C" and (ch = getc) != "-"
1337
- escape << ch
1338
- ungetc
1346
+ escape << ch
1347
+
1348
+ if ch == "C"
1349
+ ch = getc
1350
+
1351
+ if ch == "-"
1352
+ escape << ch
1353
+ ch = getc
1354
+ escape << ch
1355
+
1356
+ escape << read_escape if ch == "\\"
1357
+ else
1358
+ ungetc
1359
+ end
1339
1360
  elsif (ch = getc) == "\\" #"
1340
1361
  escape << ch << read_escape
1341
1362
  end
1342
1363
  else
1364
+ escape << ch
1365
+
1343
1366
  # other characters
1344
1367
  end
1345
1368