rdoc 5.0.0 → 6.3.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.
- checksums.yaml +5 -5
- data/CONTRIBUTING.rdoc +4 -4
- data/Gemfile +9 -0
- data/History.rdoc +12 -2
- data/README.rdoc +5 -6
- data/Rakefile +35 -65
- data/lib/rdoc/alias.rb +1 -1
- data/lib/rdoc/anon_class.rb +1 -1
- data/lib/rdoc/any_method.rb +59 -15
- data/lib/rdoc/attr.rb +1 -1
- data/lib/rdoc/class_module.rb +5 -3
- data/lib/rdoc/code_object.rb +2 -9
- data/lib/rdoc/code_objects.rb +1 -1
- data/lib/rdoc/comment.rb +32 -11
- data/lib/rdoc/constant.rb +3 -3
- data/lib/rdoc/context/section.rb +1 -14
- data/lib/rdoc/context.rb +74 -21
- data/lib/rdoc/cross_reference.rb +33 -15
- data/lib/rdoc/encoding.rb +58 -30
- data/lib/rdoc/erb_partial.rb +2 -2
- data/lib/rdoc/erbio.rb +8 -4
- data/lib/rdoc/extend.rb +1 -1
- data/lib/rdoc/generator/darkfish.rb +60 -29
- data/lib/rdoc/generator/json_index.rb +7 -4
- data/lib/rdoc/generator/markup.rb +3 -13
- data/lib/rdoc/generator/pot/message_extractor.rb +1 -1
- data/lib/rdoc/generator/pot/po.rb +3 -3
- data/lib/rdoc/generator/pot/po_entry.rb +11 -11
- data/lib/rdoc/generator/pot.rb +4 -4
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +9 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/class.rhtml +45 -47
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +55 -6
- data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +22 -99
- data/lib/rdoc/generator/template/darkfish/js/search.js +32 -31
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
- data/lib/rdoc/generator/template/json_index/js/navigation.js +4 -41
- data/lib/rdoc/generator/template/json_index/js/searcher.js +6 -6
- data/lib/rdoc/generator.rb +1 -1
- data/lib/rdoc/ghost_method.rb +1 -1
- data/lib/rdoc/i18n/locale.rb +2 -2
- data/lib/rdoc/i18n/text.rb +5 -5
- data/lib/rdoc/i18n.rb +3 -3
- data/lib/rdoc/include.rb +1 -1
- data/lib/rdoc/known_classes.rb +1 -1
- data/lib/rdoc/markdown/entities.rb +1 -1
- data/lib/rdoc/markdown/literals.kpeg +1 -0
- data/lib/rdoc/markdown/literals.rb +19 -7
- data/lib/rdoc/markdown.kpeg +92 -44
- data/lib/rdoc/markdown.rb +1171 -610
- data/lib/rdoc/markup/attr_changer.rb +1 -1
- data/lib/rdoc/markup/attr_span.rb +9 -3
- data/lib/rdoc/markup/attribute_manager.rb +115 -50
- data/lib/rdoc/markup/attributes.rb +7 -7
- data/lib/rdoc/markup/blank_line.rb +1 -1
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +1 -1
- data/lib/rdoc/markup/formatter.rb +25 -24
- data/lib/rdoc/markup/hard_break.rb +1 -1
- data/lib/rdoc/markup/heading.rb +4 -4
- data/lib/rdoc/markup/include.rb +1 -1
- data/lib/rdoc/markup/indented_paragraph.rb +1 -1
- data/lib/rdoc/markup/list.rb +1 -1
- data/lib/rdoc/markup/list_item.rb +1 -1
- data/lib/rdoc/markup/paragraph.rb +1 -1
- data/lib/rdoc/markup/parser.rb +79 -47
- data/lib/rdoc/markup/pre_process.rb +11 -6
- data/lib/rdoc/markup/raw.rb +1 -1
- data/lib/rdoc/markup/regexp_handling.rb +41 -0
- data/lib/rdoc/markup/rule.rb +1 -1
- data/lib/rdoc/markup/to_ansi.rb +1 -1
- data/lib/rdoc/markup/to_bs.rb +4 -4
- data/lib/rdoc/markup/to_html.rb +71 -26
- data/lib/rdoc/markup/to_html_crossref.rb +41 -26
- data/lib/rdoc/markup/to_html_snippet.rb +10 -10
- data/lib/rdoc/markup/to_joined_paragraph.rb +7 -32
- data/lib/rdoc/markup/to_label.rb +10 -10
- data/lib/rdoc/markup/to_markdown.rb +9 -9
- data/lib/rdoc/markup/to_rdoc.rb +35 -7
- data/lib/rdoc/markup/to_table_of_contents.rb +2 -1
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +3 -3
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/markup.rb +14 -17
- data/lib/rdoc/meta_method.rb +1 -1
- data/lib/rdoc/method_attr.rb +2 -2
- data/lib/rdoc/mixin.rb +1 -1
- data/lib/rdoc/normal_class.rb +3 -3
- data/lib/rdoc/normal_module.rb +1 -1
- data/lib/rdoc/options.rb +79 -21
- data/lib/rdoc/parser/c.rb +147 -194
- data/lib/rdoc/parser/changelog.rb +150 -19
- data/lib/rdoc/parser/markdown.rb +1 -1
- data/lib/rdoc/parser/rd.rb +1 -1
- data/lib/rdoc/parser/ripper_state_lex.rb +590 -0
- data/lib/rdoc/parser/ruby.rb +634 -465
- data/lib/rdoc/parser/ruby_tools.rb +33 -34
- data/lib/rdoc/parser/simple.rb +3 -3
- data/lib/rdoc/parser/text.rb +1 -1
- data/lib/rdoc/parser.rb +12 -35
- data/lib/rdoc/rd/block_parser.rb +109 -108
- data/lib/rdoc/rd/block_parser.ry +3 -3
- data/lib/rdoc/rd/inline.rb +5 -5
- data/lib/rdoc/rd/inline_parser.rb +186 -185
- data/lib/rdoc/rd/inline_parser.ry +1 -1
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +54 -41
- data/lib/rdoc/require.rb +1 -1
- data/lib/rdoc/ri/driver.rb +132 -42
- data/lib/rdoc/ri/formatter.rb +1 -1
- data/lib/rdoc/ri/paths.rb +4 -18
- data/lib/rdoc/ri/store.rb +1 -1
- data/lib/rdoc/ri/task.rb +2 -2
- data/lib/rdoc/ri.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +3 -3
- data/lib/rdoc/servlet.rb +21 -12
- data/lib/rdoc/single_class.rb +1 -1
- data/lib/rdoc/stats/normal.rb +24 -18
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +1 -1
- data/lib/rdoc/stats.rb +1 -1
- data/lib/rdoc/store.rb +38 -27
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +16 -21
- data/lib/rdoc/token_stream.rb +56 -33
- data/lib/rdoc/tom_doc.rb +17 -12
- data/lib/rdoc/top_level.rb +9 -3
- data/lib/rdoc/version.rb +8 -0
- data/lib/rdoc.rb +24 -10
- data/man/ri.1 +247 -0
- data/rdoc.gemspec +206 -15
- metadata +15 -64
- data/.document +0 -5
- data/.gitignore +0 -13
- data/.travis.yml +0 -23
- data/lib/gauntlet_rdoc.rb +0 -82
- data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -4
- data/lib/rdoc/markup/formatter_test_case.rb +0 -764
- data/lib/rdoc/markup/inline.rb +0 -2
- data/lib/rdoc/markup/special.rb +0 -41
- data/lib/rdoc/markup/text_formatter_test_case.rb +0 -115
- data/lib/rdoc/ruby_lex.rb +0 -1367
- data/lib/rdoc/ruby_token.rb +0 -461
- data/lib/rdoc/test_case.rb +0 -204
data/lib/rdoc/markup/to_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# Extracts sections of text enclosed in plus, tt or code. Used to discover
|
4
4
|
# undocumented parameters.
|
@@ -91,8 +91,8 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
|
|
91
91
|
when RDoc::Markup::AttrChanger then
|
92
92
|
off_tags res, item
|
93
93
|
on_tags res, item
|
94
|
-
when RDoc::Markup::
|
95
|
-
@res <<
|
94
|
+
when RDoc::Markup::RegexpHandling then
|
95
|
+
@res << convert_regexp_handling(item) if in_tt? # TODO can this happen?
|
96
96
|
else
|
97
97
|
raise "Unknown flow element: #{item.inspect}"
|
98
98
|
end
|
data/lib/rdoc/markup/verbatim.rb
CHANGED
data/lib/rdoc/markup.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# RDoc::Markup parses plain text documents and attempts to decompose them into
|
4
4
|
# their constituent parts. Some of these parts are high-level: paragraphs,
|
@@ -65,17 +65,16 @@
|
|
65
65
|
# puts h.convert(input_string)
|
66
66
|
#
|
67
67
|
# You can extend the RDoc::Markup parser to recognize new markup
|
68
|
-
# sequences, and to add
|
69
|
-
#
|
70
|
-
# and also make the sequences {word} and \<no>text...</no> signify
|
68
|
+
# sequences, and to add regexp handling. Here we make WikiWords significant to
|
69
|
+
# the parser, and also make the sequences {word} and \<no>text...</no> signify
|
71
70
|
# strike-through text. We then subclass the HTML output class to deal
|
72
71
|
# with these:
|
73
72
|
#
|
74
73
|
# require 'rdoc'
|
75
74
|
#
|
76
75
|
# class WikiHtml < RDoc::Markup::ToHtml
|
77
|
-
# def
|
78
|
-
# "<font color=red>" +
|
76
|
+
# def handle_regexp_WIKIWORD(target)
|
77
|
+
# "<font color=red>" + target.text + "</font>"
|
79
78
|
# end
|
80
79
|
# end
|
81
80
|
#
|
@@ -83,7 +82,7 @@
|
|
83
82
|
# markup.add_word_pair("{", "}", :STRIKE)
|
84
83
|
# markup.add_html("no", :STRIKE)
|
85
84
|
#
|
86
|
-
# markup.
|
85
|
+
# markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
87
86
|
#
|
88
87
|
# wh = WikiHtml.new RDoc::Options.new, markup
|
89
88
|
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
|
@@ -377,7 +376,7 @@
|
|
377
376
|
#
|
378
377
|
# Example links:
|
379
378
|
#
|
380
|
-
# https://github.com/
|
379
|
+
# https://github.com/ruby/rdoc
|
381
380
|
# mailto:user@example.com
|
382
381
|
# {RDoc Documentation}[http://rdoc.rubyforge.org]
|
383
382
|
# {RDoc Markup}[rdoc-ref:RDoc::Markup]
|
@@ -764,7 +763,7 @@ Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
|
|
764
763
|
|
765
764
|
Please file a bug report with the above information at:
|
766
765
|
|
767
|
-
https://github.com/
|
766
|
+
https://github.com/ruby/rdoc/issues
|
768
767
|
|
769
768
|
EOF
|
770
769
|
raise
|
@@ -800,13 +799,12 @@ https://github.com/rdoc/rdoc/issues
|
|
800
799
|
# Add to other inline sequences. For example, we could add WikiWords using
|
801
800
|
# something like:
|
802
801
|
#
|
803
|
-
# parser.
|
802
|
+
# parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
804
803
|
#
|
805
|
-
# Each wiki word will be presented to the output formatter
|
806
|
-
# accept_special method.
|
804
|
+
# Each wiki word will be presented to the output formatter.
|
807
805
|
|
808
|
-
def
|
809
|
-
@attribute_manager.
|
806
|
+
def add_regexp_handling(pattern, name)
|
807
|
+
@attribute_manager.add_regexp_handling(pattern, name)
|
810
808
|
end
|
811
809
|
|
812
810
|
##
|
@@ -832,7 +830,7 @@ https://github.com/rdoc/rdoc/issues
|
|
832
830
|
autoload :AttrSpan, 'rdoc/markup/attr_span'
|
833
831
|
autoload :Attributes, 'rdoc/markup/attributes'
|
834
832
|
autoload :AttributeManager, 'rdoc/markup/attribute_manager'
|
835
|
-
autoload :
|
833
|
+
autoload :RegexpHandling, 'rdoc/markup/regexp_handling'
|
836
834
|
|
837
835
|
# RDoc::Markup AST
|
838
836
|
autoload :BlankLine, 'rdoc/markup/blank_line'
|
@@ -845,14 +843,13 @@ https://github.com/rdoc/rdoc/issues
|
|
845
843
|
autoload :List, 'rdoc/markup/list'
|
846
844
|
autoload :ListItem, 'rdoc/markup/list_item'
|
847
845
|
autoload :Paragraph, 'rdoc/markup/paragraph'
|
846
|
+
autoload :Table, 'rdoc/markup/table'
|
848
847
|
autoload :Raw, 'rdoc/markup/raw'
|
849
848
|
autoload :Rule, 'rdoc/markup/rule'
|
850
849
|
autoload :Verbatim, 'rdoc/markup/verbatim'
|
851
850
|
|
852
851
|
# Formatters
|
853
852
|
autoload :Formatter, 'rdoc/markup/formatter'
|
854
|
-
autoload :FormatterTestCase, 'rdoc/markup/formatter_test_case'
|
855
|
-
autoload :TextFormatterTestCase, 'rdoc/markup/text_formatter_test_case'
|
856
853
|
|
857
854
|
autoload :ToAnsi, 'rdoc/markup/to_ansi'
|
858
855
|
autoload :ToBs, 'rdoc/markup/to_bs'
|
data/lib/rdoc/meta_method.rb
CHANGED
data/lib/rdoc/method_attr.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# Abstract class representing either a method or an attribute.
|
4
4
|
|
@@ -188,7 +188,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
188
188
|
next if String === ancestor
|
189
189
|
next if parent == ancestor
|
190
190
|
|
191
|
-
other = ancestor.find_method_named('#'
|
191
|
+
other = ancestor.find_method_named('#' + name) ||
|
192
192
|
ancestor.find_attribute_named(name)
|
193
193
|
|
194
194
|
return other if other
|
data/lib/rdoc/mixin.rb
CHANGED
data/lib/rdoc/normal_class.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# A normal class, neither singleton nor anonymous
|
4
4
|
|
@@ -47,9 +47,9 @@ class RDoc::NormalClass < RDoc::ClassModule
|
|
47
47
|
def to_s # :nodoc:
|
48
48
|
display = "#{self.class.name} #{self.full_name}"
|
49
49
|
if superclass
|
50
|
-
display
|
50
|
+
display += ' < ' + (superclass.is_a?(String) ? superclass : superclass.full_name)
|
51
51
|
end
|
52
|
-
display
|
52
|
+
display += ' -> ' + is_alias_for.to_s if is_alias_for
|
53
53
|
display
|
54
54
|
end
|
55
55
|
|
data/lib/rdoc/normal_module.rb
CHANGED
data/lib/rdoc/options.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'optparse'
|
3
3
|
require 'pathname'
|
4
4
|
|
@@ -164,7 +164,7 @@ class RDoc::Options
|
|
164
164
|
##
|
165
165
|
# Files matching this pattern will be excluded
|
166
166
|
|
167
|
-
|
167
|
+
attr_writer :exclude
|
168
168
|
|
169
169
|
##
|
170
170
|
# The list of files to be processed
|
@@ -338,13 +338,17 @@ class RDoc::Options
|
|
338
338
|
|
339
339
|
attr_reader :visibility
|
340
340
|
|
341
|
-
def initialize # :nodoc:
|
341
|
+
def initialize loaded_options = nil # :nodoc:
|
342
342
|
init_ivars
|
343
|
+
override loaded_options if loaded_options
|
343
344
|
end
|
344
345
|
|
345
346
|
def init_ivars # :nodoc:
|
346
347
|
@dry_run = false
|
347
|
-
@exclude = [
|
348
|
+
@exclude = %w[
|
349
|
+
~\z \.orig\z \.rej\z \.bak\z
|
350
|
+
\.gemspec\z
|
351
|
+
]
|
348
352
|
@files = nil
|
349
353
|
@force_output = false
|
350
354
|
@force_update = true
|
@@ -414,6 +418,37 @@ class RDoc::Options
|
|
414
418
|
init_with map
|
415
419
|
end
|
416
420
|
|
421
|
+
def override map # :nodoc:
|
422
|
+
if map.has_key?('encoding')
|
423
|
+
encoding = map['encoding']
|
424
|
+
@encoding = encoding ? Encoding.find(encoding) : encoding
|
425
|
+
end
|
426
|
+
|
427
|
+
@charset = map['charset'] if map.has_key?('charset')
|
428
|
+
@exclude = map['exclude'] if map.has_key?('exclude')
|
429
|
+
@generator_name = map['generator_name'] if map.has_key?('generator_name')
|
430
|
+
@hyperlink_all = map['hyperlink_all'] if map.has_key?('hyperlink_all')
|
431
|
+
@line_numbers = map['line_numbers'] if map.has_key?('line_numbers')
|
432
|
+
@locale_name = map['locale_name'] if map.has_key?('locale_name')
|
433
|
+
@locale_dir = map['locale_dir'] if map.has_key?('locale_dir')
|
434
|
+
@main_page = map['main_page'] if map.has_key?('main_page')
|
435
|
+
@markup = map['markup'] if map.has_key?('markup')
|
436
|
+
@op_dir = map['op_dir'] if map.has_key?('op_dir')
|
437
|
+
@show_hash = map['show_hash'] if map.has_key?('show_hash')
|
438
|
+
@tab_width = map['tab_width'] if map.has_key?('tab_width')
|
439
|
+
@template_dir = map['template_dir'] if map.has_key?('template_dir')
|
440
|
+
@title = map['title'] if map.has_key?('title')
|
441
|
+
@visibility = map['visibility'] if map.has_key?('visibility')
|
442
|
+
@webcvs = map['webcvs'] if map.has_key?('webcvs')
|
443
|
+
|
444
|
+
if map.has_key?('rdoc_include')
|
445
|
+
@rdoc_include = sanitize_path map['rdoc_include']
|
446
|
+
end
|
447
|
+
if map.has_key?('static_path')
|
448
|
+
@static_path = sanitize_path map['static_path']
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
417
452
|
def == other # :nodoc:
|
418
453
|
self.class === other and
|
419
454
|
@encoding == other.encoding and
|
@@ -493,6 +528,20 @@ class RDoc::Options
|
|
493
528
|
end
|
494
529
|
end
|
495
530
|
|
531
|
+
##
|
532
|
+
# Create a regexp for #exclude
|
533
|
+
|
534
|
+
def exclude
|
535
|
+
if @exclude.nil? or Regexp === @exclude then
|
536
|
+
# done, #finish is being re-run
|
537
|
+
@exclude
|
538
|
+
elsif @exclude.empty? then
|
539
|
+
nil
|
540
|
+
else
|
541
|
+
Regexp.new(@exclude.join("|"))
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
496
545
|
##
|
497
546
|
# Completes any unfinished option setup business such as filtering for
|
498
547
|
# existent files, creating a regexp for #exclude and setting a default
|
@@ -505,13 +554,7 @@ class RDoc::Options
|
|
505
554
|
root = @root.to_s
|
506
555
|
@rdoc_include << root unless @rdoc_include.include?(root)
|
507
556
|
|
508
|
-
|
509
|
-
# done, #finish is being re-run
|
510
|
-
elsif @exclude.empty? then
|
511
|
-
@exclude = nil
|
512
|
-
else
|
513
|
-
@exclude = Regexp.new(@exclude.join("|"))
|
514
|
-
end
|
557
|
+
@exclude = self.exclude
|
515
558
|
|
516
559
|
finish_page_dir
|
517
560
|
|
@@ -544,7 +587,13 @@ class RDoc::Options
|
|
544
587
|
|
545
588
|
@files << @page_dir.to_s
|
546
589
|
|
547
|
-
page_dir =
|
590
|
+
page_dir = nil
|
591
|
+
begin
|
592
|
+
page_dir = @page_dir.expand_path.relative_path_from @root
|
593
|
+
rescue ArgumentError
|
594
|
+
# On Windows, sometimes crosses different drive letters.
|
595
|
+
page_dir = @page_dir.expand_path
|
596
|
+
end
|
548
597
|
|
549
598
|
@page_dir = page_dir
|
550
599
|
end
|
@@ -624,16 +673,16 @@ Usage: #{opt.program_name} [options] [names...]
|
|
624
673
|
end
|
625
674
|
|
626
675
|
parsers.sort.each do |parser, regexp|
|
627
|
-
opt.banner
|
676
|
+
opt.banner += " - #{parser}: #{regexp.join ', '}\n"
|
628
677
|
end
|
629
|
-
opt.banner
|
678
|
+
opt.banner += " - TomDoc: Only in ruby files\n"
|
630
679
|
|
631
|
-
opt.banner
|
680
|
+
opt.banner += "\n The following options are deprecated:\n\n"
|
632
681
|
|
633
682
|
name_length = DEPRECATED.keys.sort_by { |k| k.length }.last.length
|
634
683
|
|
635
684
|
DEPRECATED.sort_by { |k,| k }.each do |name, reason|
|
636
|
-
opt.banner
|
685
|
+
opt.banner += " %*1$2$s %3$s\n" % [-name_length, name, reason]
|
637
686
|
end
|
638
687
|
|
639
688
|
opt.accept Template do |template|
|
@@ -738,7 +787,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
738
787
|
|
739
788
|
opt.on("--[no-]force-update", "-U",
|
740
789
|
"Forces rdoc to scan all sources even if",
|
741
|
-
"newer than the flag file.") do |value|
|
790
|
+
"no files are newer than the flag file.") do |value|
|
742
791
|
@force_update = value
|
743
792
|
end
|
744
793
|
|
@@ -1087,7 +1136,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
1087
1136
|
|
1088
1137
|
unless quiet then
|
1089
1138
|
deprecated.each do |opt|
|
1090
|
-
$stderr.puts 'option '
|
1139
|
+
$stderr.puts 'option ' + opt + ' is deprecated: ' + DEPRECATED[opt]
|
1091
1140
|
end
|
1092
1141
|
end
|
1093
1142
|
|
@@ -1143,8 +1192,17 @@ Usage: #{opt.program_name} [options] [names...]
|
|
1143
1192
|
|
1144
1193
|
path.reject do |item|
|
1145
1194
|
path = Pathname.new(item).expand_path
|
1146
|
-
|
1147
|
-
relative
|
1195
|
+
is_reject = nil
|
1196
|
+
relative = nil
|
1197
|
+
begin
|
1198
|
+
relative = path.relative_path_from(dot).to_s
|
1199
|
+
rescue ArgumentError
|
1200
|
+
# On Windows, sometimes crosses different drive letters.
|
1201
|
+
is_reject = true
|
1202
|
+
else
|
1203
|
+
is_reject = relative.start_with? '..'
|
1204
|
+
end
|
1205
|
+
is_reject
|
1148
1206
|
end
|
1149
1207
|
end
|
1150
1208
|
|
@@ -1217,7 +1275,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
1217
1275
|
def write_options
|
1218
1276
|
RDoc.load_yaml
|
1219
1277
|
|
1220
|
-
open '.rdoc_options', 'w' do |io|
|
1278
|
+
File.open '.rdoc_options', 'w' do |io|
|
1221
1279
|
io.set_encoding Encoding::UTF_8
|
1222
1280
|
|
1223
1281
|
YAML.dump self, io
|
data/lib/rdoc/parser/c.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'tsort'
|
3
3
|
|
4
4
|
##
|
5
5
|
# RDoc::Parser::C attempts to parse C extension files. It looks for
|
6
|
-
# the standard patterns that you find in extensions:
|
7
|
-
# rb_define_method
|
6
|
+
# the standard patterns that you find in extensions: +rb_define_class+,
|
7
|
+
# +rb_define_method+ and so on. It tries to find the corresponding
|
8
8
|
# C source for the methods and extract comments, but if we fail
|
9
9
|
# we don't worry too much.
|
10
10
|
#
|
11
11
|
# The comments associated with a Ruby method are extracted from the C
|
12
12
|
# comment block associated with the routine that _implements_ that
|
13
13
|
# method, that is to say the method whose name is given in the
|
14
|
-
#
|
14
|
+
# +rb_define_method+ call. For example, you might write:
|
15
15
|
#
|
16
16
|
# /*
|
17
17
|
# * Returns a new array that is a one-dimensional flattening of this
|
@@ -24,8 +24,7 @@ require 'tsort'
|
|
24
24
|
# * a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
25
25
|
# */
|
26
26
|
# static VALUE
|
27
|
-
# rb_ary_flatten(ary)
|
28
|
-
# VALUE ary;
|
27
|
+
# rb_ary_flatten(VALUE ary)
|
29
28
|
# {
|
30
29
|
# ary = rb_obj_dup(ary);
|
31
30
|
# rb_ary_flatten_bang(ary);
|
@@ -35,16 +34,16 @@ require 'tsort'
|
|
35
34
|
# ...
|
36
35
|
#
|
37
36
|
# void
|
38
|
-
# Init_Array()
|
37
|
+
# Init_Array(void)
|
39
38
|
# {
|
40
39
|
# ...
|
41
40
|
# rb_define_method(rb_cArray, "flatten", rb_ary_flatten, 0);
|
42
41
|
#
|
43
|
-
# Here RDoc will determine from the rb_define_method line that there's a
|
42
|
+
# Here RDoc will determine from the +rb_define_method+ line that there's a
|
44
43
|
# method called "flatten" in class Array, and will look for the implementation
|
45
|
-
# in the method rb_ary_flatten
|
44
|
+
# in the method +rb_ary_flatten+. It will then use the comment from that
|
46
45
|
# method in the HTML output. This method must be in the same source file
|
47
|
-
# as the rb_define_method
|
46
|
+
# as the +rb_define_method+.
|
48
47
|
#
|
49
48
|
# The comment blocks may include special directives:
|
50
49
|
#
|
@@ -70,15 +69,15 @@ require 'tsort'
|
|
70
69
|
# [Document-variable: +name+]
|
71
70
|
# Documentation for the named +rb_define_variable+
|
72
71
|
#
|
73
|
-
# [Document-method
|
72
|
+
# [Document-method\: +method_name+]
|
74
73
|
# Documentation for the named method. Use this when the method name is
|
75
74
|
# unambiguous.
|
76
75
|
#
|
77
|
-
# [Document-method
|
76
|
+
# [Document-method\: <tt>ClassName::method_name</tt>]
|
78
77
|
# Documentation for a singleton method in the given class. Use this when
|
79
78
|
# the method name alone is ambiguous.
|
80
79
|
#
|
81
|
-
# [Document-method
|
80
|
+
# [Document-method\: <tt>ClassName#method_name</tt>]
|
82
81
|
# Documentation for a instance method in the given class. Use this when the
|
83
82
|
# method name alone is ambiguous.
|
84
83
|
#
|
@@ -210,47 +209,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
210
209
|
end
|
211
210
|
end
|
212
211
|
|
213
|
-
##
|
214
|
-
# Removes duplicate call-seq entries for methods using the same
|
215
|
-
# implementation.
|
216
|
-
|
217
|
-
def deduplicate_call_seq
|
218
|
-
@methods.each do |var_name, functions|
|
219
|
-
class_name = @known_classes[var_name]
|
220
|
-
class_obj = find_class var_name, class_name
|
221
|
-
|
222
|
-
functions.each_value do |method_names|
|
223
|
-
next if method_names.length == 1
|
224
|
-
|
225
|
-
method_names.each do |method_name|
|
226
|
-
deduplicate_method_name class_obj, method_name
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
##
|
233
|
-
# If two ruby methods share a C implementation (and comment) this
|
234
|
-
# deduplicates the examples in the call_seq for the method to reduce
|
235
|
-
# confusion in the output.
|
236
|
-
|
237
|
-
def deduplicate_method_name class_obj, method_name # :nodoc:
|
238
|
-
return unless
|
239
|
-
method = class_obj.method_list.find { |m| m.name == method_name }
|
240
|
-
return unless call_seq = method.call_seq
|
241
|
-
|
242
|
-
method_name = method_name[0, 1] if method_name =~ /\A\[/
|
243
|
-
|
244
|
-
entries = call_seq.split "\n"
|
245
|
-
|
246
|
-
matching = entries.select do |entry|
|
247
|
-
entry =~ /^\w*\.?#{Regexp.escape method_name}/ or
|
248
|
-
entry =~ /\s#{Regexp.escape method_name}\s/
|
249
|
-
end
|
250
|
-
|
251
|
-
method.call_seq = matching.join "\n"
|
252
|
-
end
|
253
|
-
|
254
212
|
##
|
255
213
|
# Scans #content for rb_define_alias
|
256
214
|
|
@@ -269,23 +227,29 @@ class RDoc::Parser::C < RDoc::Parser
|
|
269
227
|
end
|
270
228
|
|
271
229
|
class_obj = find_class var_name, class_name
|
272
|
-
|
273
|
-
al = RDoc::Alias.new '', old_name, new_name, ''
|
274
|
-
al.singleton = @singleton_classes.key? var_name
|
275
|
-
|
276
230
|
comment = find_alias_comment var_name, new_name, old_name
|
277
|
-
|
278
231
|
comment.normalize
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
class_obj.add_alias al
|
285
|
-
@stats.add_alias al
|
232
|
+
if comment.to_s.empty? and existing_method = class_obj.method_list.find { |m| m.name == old_name}
|
233
|
+
comment = existing_method.comment
|
234
|
+
end
|
235
|
+
add_alias(var_name, class_obj, old_name, new_name, comment)
|
286
236
|
end
|
287
237
|
end
|
288
238
|
|
239
|
+
##
|
240
|
+
# Add alias, either from a direct alias definition, or from two
|
241
|
+
# method that reference the same function.
|
242
|
+
|
243
|
+
def add_alias(var_name, class_obj, old_name, new_name, comment)
|
244
|
+
al = RDoc::Alias.new '', old_name, new_name, ''
|
245
|
+
al.singleton = @singleton_classes.key? var_name
|
246
|
+
al.comment = comment
|
247
|
+
al.record_location @top_level
|
248
|
+
class_obj.add_alias al
|
249
|
+
@stats.add_alias al
|
250
|
+
al
|
251
|
+
end
|
252
|
+
|
289
253
|
##
|
290
254
|
# Scans #content for rb_attr and rb_define_attr
|
291
255
|
|
@@ -324,12 +288,100 @@ class RDoc::Parser::C < RDoc::Parser
|
|
324
288
|
# Scans #content for rb_define_class, boot_defclass, rb_define_class_under
|
325
289
|
# and rb_singleton_class
|
326
290
|
|
327
|
-
def
|
328
|
-
do_boot_defclass
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
291
|
+
def do_classes_and_modules
|
292
|
+
do_boot_defclass if @file_name == "class.c"
|
293
|
+
|
294
|
+
@content.scan(
|
295
|
+
%r(
|
296
|
+
(?<var_name>[\w\.]+)\s* =
|
297
|
+
\s*rb_(?:
|
298
|
+
define_(?:
|
299
|
+
class(?: # rb_define_class(class_name_1, parent_name_1)
|
300
|
+
\s*\(
|
301
|
+
\s*"(?<class_name_1>\w+)",
|
302
|
+
\s*(?<parent_name_1>\w+)\s*
|
303
|
+
\)
|
304
|
+
|
|
305
|
+
_under\s*\( # rb_define_class_under(class_under, class_name2, parent_name2...)
|
306
|
+
\s* (?<class_under>\w+),
|
307
|
+
\s* "(?<class_name_2>\w+)",
|
308
|
+
\s*
|
309
|
+
(?:
|
310
|
+
(?<parent_name_2>[\w\*\s\(\)\.\->]+) |
|
311
|
+
rb_path2class\("(?<path>[\w:]+)"\)
|
312
|
+
)
|
313
|
+
\s*\)
|
314
|
+
)
|
315
|
+
|
|
316
|
+
module(?: # rb_define_module(module_name_1)
|
317
|
+
\s*\(
|
318
|
+
\s*"(?<module_name_1>\w+)"\s*
|
319
|
+
\)
|
320
|
+
|
|
321
|
+
_under\s*\( # rb_define_module_under(module_under, module_name_2)
|
322
|
+
\s*(?<module_under>\w+),
|
323
|
+
\s*"(?<module_name_2>\w+)"
|
324
|
+
\s*\)
|
325
|
+
)
|
326
|
+
)
|
327
|
+
|
|
328
|
+
struct_define_without_accessor\s*\( # rb_struct_define_without_accessor(class_name_3, parent_name_3, ...)
|
329
|
+
\s*"(?<class_name_3>\w+)",
|
330
|
+
\s*(?<parent_name_3>\w+),
|
331
|
+
\s*\w+, # Allocation function
|
332
|
+
(?:\s*"\w+",)* # Attributes
|
333
|
+
\s*NULL
|
334
|
+
\)
|
335
|
+
|
|
336
|
+
singleton_class\s*\( # rb_singleton_class(target_class_name)
|
337
|
+
\s*(?<target_class_name>\w+)
|
338
|
+
\)
|
339
|
+
)
|
340
|
+
)mx
|
341
|
+
) do
|
342
|
+
class_name = $~[:class_name_1]
|
343
|
+
type = :class
|
344
|
+
if class_name
|
345
|
+
# rb_define_class(class_name_1, parent_name_1)
|
346
|
+
parent_name = $~[:parent_name_1]
|
347
|
+
#under = nil
|
348
|
+
else
|
349
|
+
class_name = $~[:class_name_2]
|
350
|
+
if class_name
|
351
|
+
# rb_define_class_under(class_under, class_name2, parent_name2...)
|
352
|
+
parent_name = $~[:parent_name_2] || $~[:path]
|
353
|
+
under = $~[:class_under]
|
354
|
+
else
|
355
|
+
class_name = $~[:class_name_3]
|
356
|
+
if class_name
|
357
|
+
# rb_struct_define_without_accessor(class_name_3, parent_name_3, ...)
|
358
|
+
parent_name = $~[:parent_name_3]
|
359
|
+
#under = nil
|
360
|
+
else
|
361
|
+
type = :module
|
362
|
+
class_name = $~[:module_name_1]
|
363
|
+
#parent_name = nil
|
364
|
+
if class_name
|
365
|
+
# rb_define_module(module_name_1)
|
366
|
+
#under = nil
|
367
|
+
else
|
368
|
+
class_name = $~[:module_name_2]
|
369
|
+
if class_name
|
370
|
+
# rb_define_module_under(module_under, module_name_1)
|
371
|
+
under = $~[:module_under]
|
372
|
+
else
|
373
|
+
# rb_singleton_class(target_class_name)
|
374
|
+
target_class_name = $~[:target_class_name]
|
375
|
+
handle_singleton $~[:var_name], target_class_name
|
376
|
+
next
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
handle_class_module($~[:var_name], type, class_name, parent_name, under)
|
384
|
+
end
|
333
385
|
end
|
334
386
|
|
335
387
|
##
|
@@ -378,65 +430,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
378
430
|
end
|
379
431
|
end
|
380
432
|
|
381
|
-
##
|
382
|
-
# Scans #content for rb_define_class
|
383
|
-
|
384
|
-
def do_define_class
|
385
|
-
# The '.' lets us handle SWIG-generated files
|
386
|
-
@content.scan(/([\w\.]+)\s* = \s*rb_define_class\s*
|
387
|
-
\(
|
388
|
-
\s*"(\w+)",
|
389
|
-
\s*(\w+)\s*
|
390
|
-
\)/mx) do |var_name, class_name, parent|
|
391
|
-
handle_class_module(var_name, :class, class_name, parent, nil)
|
392
|
-
end
|
393
|
-
end
|
394
|
-
|
395
|
-
##
|
396
|
-
# Scans #content for rb_define_class_under
|
397
|
-
|
398
|
-
def do_define_class_under
|
399
|
-
@content.scan(/([\w\.]+)\s* = # var_name
|
400
|
-
\s*rb_define_class_under\s*
|
401
|
-
\(
|
402
|
-
\s* (\w+), # under
|
403
|
-
\s* "(\w+)", # class_name
|
404
|
-
\s*
|
405
|
-
(?:
|
406
|
-
([\w\*\s\(\)\.\->]+) | # parent_name
|
407
|
-
rb_path2class\("([\w:]+)"\) # path
|
408
|
-
)
|
409
|
-
\s*
|
410
|
-
\)
|
411
|
-
/mx) do |var_name, under, class_name, parent_name, path|
|
412
|
-
parent = path || parent_name
|
413
|
-
|
414
|
-
handle_class_module var_name, :class, class_name, parent, under
|
415
|
-
end
|
416
|
-
end
|
417
|
-
|
418
|
-
##
|
419
|
-
# Scans #content for rb_define_module
|
420
|
-
|
421
|
-
def do_define_module
|
422
|
-
@content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
|
423
|
-
|var_name, class_name|
|
424
|
-
handle_class_module(var_name, :module, class_name, nil, nil)
|
425
|
-
end
|
426
|
-
end
|
427
|
-
|
428
|
-
##
|
429
|
-
# Scans #content for rb_define_module_under
|
430
|
-
|
431
|
-
def do_define_module_under
|
432
|
-
@content.scan(/(\w+)\s* = \s*rb_define_module_under\s*
|
433
|
-
\(
|
434
|
-
\s*(\w+),
|
435
|
-
\s*"(\w+)"
|
436
|
-
\s*\)/mx) do |var_name, in_module, class_name|
|
437
|
-
handle_class_module(var_name, :module, class_name, nil, in_module)
|
438
|
-
end
|
439
|
-
end
|
440
433
|
|
441
434
|
##
|
442
435
|
# Scans #content for rb_include_module
|
@@ -446,7 +439,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
446
439
|
next unless cls = @classes[c]
|
447
440
|
m = @known_classes[m] || m
|
448
441
|
|
449
|
-
comment = RDoc::Comment.new '', @top_level
|
442
|
+
comment = RDoc::Comment.new '', @top_level, :c
|
450
443
|
incl = cls.add_include RDoc::Include.new(m, comment)
|
451
444
|
incl.record_location @top_level
|
452
445
|
end
|
@@ -518,42 +511,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
518
511
|
end
|
519
512
|
end
|
520
513
|
|
521
|
-
##
|
522
|
-
# Scans #content for rb_define_module and rb_define_module_under
|
523
|
-
|
524
|
-
def do_modules
|
525
|
-
do_define_module
|
526
|
-
do_define_module_under
|
527
|
-
end
|
528
|
-
|
529
|
-
##
|
530
|
-
# Scans #content for rb_singleton_class
|
531
|
-
|
532
|
-
def do_singleton_class
|
533
|
-
@content.scan(/([\w\.]+)\s* = \s*rb_singleton_class\s*
|
534
|
-
\(
|
535
|
-
\s*(\w+)
|
536
|
-
\s*\)/mx) do |sclass_var, class_var|
|
537
|
-
handle_singleton sclass_var, class_var
|
538
|
-
end
|
539
|
-
end
|
540
|
-
|
541
|
-
##
|
542
|
-
# Scans #content for struct_define_without_accessor
|
543
|
-
|
544
|
-
def do_struct_define_without_accessor
|
545
|
-
@content.scan(/([\w\.]+)\s* = \s*rb_struct_define_without_accessor\s*
|
546
|
-
\(
|
547
|
-
\s*"(\w+)", # Class name
|
548
|
-
\s*(\w+), # Parent class
|
549
|
-
\s*\w+, # Allocation function
|
550
|
-
(\s*"\w+",)* # Attributes
|
551
|
-
\s*NULL
|
552
|
-
\)/mx) do |var_name, class_name, parent|
|
553
|
-
handle_class_module(var_name, :class, class_name, parent, nil)
|
554
|
-
end
|
555
|
-
end
|
556
|
-
|
557
514
|
##
|
558
515
|
# Finds the comment for an alias on +class_name+ from +new_name+ to
|
559
516
|
# +old_name+
|
@@ -564,7 +521,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
564
521
|
\s*"#{Regexp.escape new_name}"\s*,
|
565
522
|
\s*"#{Regexp.escape old_name}"\s*\);%xm
|
566
523
|
|
567
|
-
RDoc::Comment.new($1 || '', @top_level)
|
524
|
+
RDoc::Comment.new($1 || '', @top_level, :c)
|
568
525
|
end
|
569
526
|
|
570
527
|
##
|
@@ -603,7 +560,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
603
560
|
''
|
604
561
|
end
|
605
562
|
|
606
|
-
RDoc::Comment.new comment, @top_level
|
563
|
+
RDoc::Comment.new comment, @top_level, :c
|
607
564
|
end
|
608
565
|
|
609
566
|
##
|
@@ -615,7 +572,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
615
572
|
((?>/\*.*?\*/\s*)?)
|
616
573
|
((?:(?:\w+)\s+)?
|
617
574
|
(?:intern\s+)?VALUE\s+(\w+)
|
618
|
-
\s*(?:\([^)]*\))(?:[
|
575
|
+
\s*(?:\([^)]*\))(?:[^\);]|$))
|
619
576
|
| ((?>/\*.*?\*/\s*))^\s*(\#\s*define\s+(\w+)\s+(\w+))
|
620
577
|
| ^\s*\#\s*define\s+(\w+)\s+(\w+)
|
621
578
|
}xm) do
|
@@ -643,7 +600,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
643
600
|
|
644
601
|
case type
|
645
602
|
when :func_def
|
646
|
-
comment = RDoc::Comment.new args[0], @top_level
|
603
|
+
comment = RDoc::Comment.new args[0], @top_level, :c
|
647
604
|
body = args[1]
|
648
605
|
offset, = args[2]
|
649
606
|
|
@@ -666,16 +623,14 @@ class RDoc::Parser::C < RDoc::Parser
|
|
666
623
|
|
667
624
|
#meth_obj.params = params
|
668
625
|
meth_obj.start_collecting_tokens
|
669
|
-
tk =
|
670
|
-
tk.set_text body
|
626
|
+
tk = { :line_no => 1, :char_no => 1, :text => body }
|
671
627
|
meth_obj.add_token tk
|
672
628
|
meth_obj.comment = comment
|
673
|
-
meth_obj.offset = offset
|
674
629
|
meth_obj.line = file_content[0, offset].count("\n") + 1
|
675
630
|
|
676
631
|
body
|
677
632
|
when :macro_def
|
678
|
-
comment = RDoc::Comment.new args[0], @top_level
|
633
|
+
comment = RDoc::Comment.new args[0], @top_level, :c
|
679
634
|
body = args[1]
|
680
635
|
offset, = args[2]
|
681
636
|
|
@@ -685,11 +640,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|
685
640
|
find_modifiers comment, meth_obj
|
686
641
|
|
687
642
|
meth_obj.start_collecting_tokens
|
688
|
-
tk =
|
689
|
-
tk.set_text body
|
643
|
+
tk = { :line_no => 1, :char_no => 1, :text => body }
|
690
644
|
meth_obj.add_token tk
|
691
645
|
meth_obj.comment = comment
|
692
|
-
meth_obj.offset = offset
|
693
646
|
meth_obj.line = file_content[0, offset].count("\n") + 1
|
694
647
|
|
695
648
|
body
|
@@ -784,7 +737,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
784
737
|
comment = ''
|
785
738
|
end
|
786
739
|
|
787
|
-
comment = RDoc::Comment.new comment, @top_level
|
740
|
+
comment = RDoc::Comment.new comment, @top_level, :c
|
788
741
|
comment.normalize
|
789
742
|
|
790
743
|
look_for_directives_in class_mod, comment
|
@@ -829,7 +782,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
829
782
|
table[const_name] ||
|
830
783
|
''
|
831
784
|
|
832
|
-
RDoc::Comment.new comment, @top_level
|
785
|
+
RDoc::Comment.new comment, @top_level, :c
|
833
786
|
end
|
834
787
|
|
835
788
|
##
|
@@ -860,7 +813,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
860
813
|
|
861
814
|
return unless comment
|
862
815
|
|
863
|
-
RDoc::Comment.new comment, @top_level
|
816
|
+
RDoc::Comment.new comment, @top_level, :c
|
864
817
|
end
|
865
818
|
|
866
819
|
##
|
@@ -869,8 +822,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|
869
822
|
|
870
823
|
def handle_attr(var_name, attr_name, read, write)
|
871
824
|
rw = ''
|
872
|
-
rw
|
873
|
-
rw
|
825
|
+
rw += 'R' if '1' == read
|
826
|
+
rw += 'W' if '1' == write
|
874
827
|
|
875
828
|
class_name = @known_classes[var_name]
|
876
829
|
|
@@ -956,7 +909,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
956
909
|
# can override the C value of the comment to give a friendly definition.
|
957
910
|
#
|
958
911
|
# /* 300: The perfect score in bowling */
|
959
|
-
# rb_define_const(cFoo, "PERFECT", INT2FIX(300);
|
912
|
+
# rb_define_const(cFoo, "PERFECT", INT2FIX(300));
|
960
913
|
#
|
961
914
|
# Will override <tt>INT2FIX(300)</tt> with the value +300+ in the output
|
962
915
|
# RDoc. Values may include quotes and escaped colons (\:).
|
@@ -986,15 +939,15 @@ class RDoc::Parser::C < RDoc::Parser
|
|
986
939
|
if new_definition.empty? then # Default to literal C definition
|
987
940
|
new_definition = definition
|
988
941
|
else
|
989
|
-
new_definition.gsub
|
990
|
-
new_definition.gsub
|
942
|
+
new_definition = new_definition.gsub("\:", ":")
|
943
|
+
new_definition = new_definition.gsub("\\", '\\')
|
991
944
|
end
|
992
945
|
|
993
946
|
new_definition.sub!(/\A(\s+)/, '')
|
994
947
|
|
995
948
|
new_comment = "#{$1}#{new_comment.lstrip}"
|
996
949
|
|
997
|
-
new_comment = RDoc::Comment.new new_comment, @top_level
|
950
|
+
new_comment = RDoc::Comment.new new_comment, @top_level, :c
|
998
951
|
|
999
952
|
con = RDoc::Constant.new const_name, new_definition, new_comment
|
1000
953
|
else
|
@@ -1032,6 +985,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1032
985
|
|
1033
986
|
class_obj = find_class var_name, class_name
|
1034
987
|
|
988
|
+
if existing_method = class_obj.method_list.find { |m| m.c_function == function }
|
989
|
+
add_alias(var_name, class_obj, existing_method.name, meth_name, existing_method.comment)
|
990
|
+
end
|
991
|
+
|
1035
992
|
if class_obj then
|
1036
993
|
if meth_name == 'initialize' then
|
1037
994
|
meth_name = 'new'
|
@@ -1241,7 +1198,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1241
1198
|
# when scanning for classes and methods
|
1242
1199
|
|
1243
1200
|
def remove_commented_out_lines
|
1244
|
-
@content.gsub
|
1201
|
+
@content = @content.gsub(%r%//.*rb_define_%, '//')
|
1245
1202
|
end
|
1246
1203
|
|
1247
1204
|
##
|
@@ -1251,8 +1208,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1251
1208
|
def scan
|
1252
1209
|
remove_commented_out_lines
|
1253
1210
|
|
1254
|
-
|
1255
|
-
do_classes
|
1211
|
+
do_classes_and_modules
|
1256
1212
|
do_missing
|
1257
1213
|
|
1258
1214
|
do_constants
|
@@ -1261,12 +1217,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1261
1217
|
do_aliases
|
1262
1218
|
do_attrs
|
1263
1219
|
|
1264
|
-
deduplicate_call_seq
|
1265
|
-
|
1266
1220
|
@store.add_c_variables self
|
1267
1221
|
|
1268
1222
|
@top_level
|
1269
1223
|
end
|
1270
1224
|
|
1271
1225
|
end
|
1272
|
-
|