rdoc 5.1.0 → 6.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CONTRIBUTING.rdoc +5 -6
- data/ExampleMarkdown.md +2 -0
- data/ExampleRDoc.rdoc +2 -0
- data/History.rdoc +68 -66
- data/LEGAL.rdoc +1 -1
- data/LICENSE.rdoc +2 -0
- data/README.rdoc +18 -6
- data/RI.md +842 -0
- data/TODO.rdoc +8 -7
- data/exe/rdoc +0 -1
- data/lib/rdoc/{alias.rb → code_object/alias.rb} +4 -12
- data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +1 -2
- data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +83 -26
- data/lib/rdoc/{attr.rb → code_object/attr.rb} +5 -9
- data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +112 -24
- data/lib/rdoc/{constant.rb → code_object/constant.rb} +4 -5
- data/lib/rdoc/{context → code_object/context}/section.rb +13 -83
- data/lib/rdoc/{context.rb → code_object/context.rb} +69 -70
- data/lib/rdoc/{extend.rb → code_object/extend.rb} +1 -2
- data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +1 -2
- data/lib/rdoc/{include.rb → code_object/include.rb} +1 -2
- data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +1 -2
- data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +22 -31
- data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +1 -2
- data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +4 -5
- data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +2 -3
- data/lib/rdoc/{require.rb → code_object/require.rb} +2 -3
- data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +6 -2
- data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +22 -32
- data/lib/rdoc/code_object.rb +8 -41
- data/lib/rdoc/code_objects.rb +2 -3
- data/lib/rdoc/comment.rb +48 -41
- data/lib/rdoc/cross_reference.rb +77 -33
- data/lib/rdoc/encoding.rb +50 -38
- data/lib/rdoc/erb_partial.rb +2 -3
- data/lib/rdoc/erbio.rb +4 -5
- data/lib/rdoc/generator/darkfish.rb +178 -125
- data/lib/rdoc/generator/json_index.rb +9 -22
- data/lib/rdoc/generator/markup.rb +6 -17
- data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
- data/lib/rdoc/generator/pot/po.rb +3 -3
- data/lib/rdoc/generator/pot/po_entry.rb +12 -12
- data/lib/rdoc/generator/pot.rb +4 -8
- data/lib/rdoc/generator/ri.rb +1 -2
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +35 -12
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
- 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 +19 -10
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +26 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -9
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +27 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +125 -78
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +430 -339
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +13 -13
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +51 -92
- data/lib/rdoc/generator/template/darkfish/js/search.js +35 -34
- data/lib/rdoc/generator/template/darkfish/page.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +10 -8
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +20 -18
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +32 -20
- data/lib/rdoc/generator/template/json_index/js/navigation.js +12 -49
- data/lib/rdoc/generator/template/json_index/js/searcher.js +6 -6
- data/lib/rdoc/generator.rb +6 -6
- data/lib/rdoc/i18n/locale.rb +1 -1
- data/lib/rdoc/i18n/text.rb +5 -5
- data/lib/rdoc/i18n.rb +4 -4
- data/lib/rdoc/known_classes.rb +6 -5
- data/lib/rdoc/markdown/entities.rb +1 -2
- data/lib/rdoc/markdown/literals.kpeg +1 -2
- data/lib/rdoc/markdown/literals.rb +99 -50
- data/lib/rdoc/markdown.kpeg +115 -58
- data/lib/rdoc/markdown.rb +1584 -902
- data/lib/rdoc/markup/attr_changer.rb +1 -2
- data/lib/rdoc/markup/attr_span.rb +9 -4
- data/lib/rdoc/markup/attribute_manager.rb +118 -57
- data/lib/rdoc/markup/attributes.rb +7 -8
- data/lib/rdoc/markup/blank_line.rb +1 -2
- data/lib/rdoc/markup/block_quote.rb +1 -2
- data/lib/rdoc/markup/document.rb +1 -2
- data/lib/rdoc/markup/formatter.rb +44 -37
- data/lib/rdoc/markup/hard_break.rb +1 -2
- data/lib/rdoc/markup/heading.rb +11 -6
- data/lib/rdoc/markup/include.rb +1 -2
- data/lib/rdoc/markup/indented_paragraph.rb +1 -2
- data/lib/rdoc/markup/list.rb +1 -2
- data/lib/rdoc/markup/list_item.rb +1 -2
- data/lib/rdoc/markup/paragraph.rb +1 -2
- data/lib/rdoc/markup/parser.rb +90 -48
- data/lib/rdoc/markup/pre_process.rb +38 -11
- data/lib/rdoc/markup/raw.rb +1 -2
- data/lib/rdoc/markup/regexp_handling.rb +40 -0
- data/lib/rdoc/markup/rule.rb +1 -2
- data/lib/rdoc/markup/table.rb +56 -0
- data/lib/rdoc/markup/to_ansi.rb +1 -2
- data/lib/rdoc/markup/to_bs.rb +30 -5
- data/lib/rdoc/markup/to_html.rb +95 -40
- data/lib/rdoc/markup/to_html_crossref.rb +108 -43
- data/lib/rdoc/markup/to_html_snippet.rb +13 -11
- data/lib/rdoc/markup/to_joined_paragraph.rb +6 -32
- data/lib/rdoc/markup/to_label.rb +11 -12
- data/lib/rdoc/markup/to_markdown.rb +13 -14
- data/lib/rdoc/markup/to_rdoc.rb +49 -31
- data/lib/rdoc/markup/to_table_of_contents.rb +2 -2
- data/lib/rdoc/markup/to_test.rb +1 -2
- data/lib/rdoc/markup/to_tt_only.rb +3 -4
- data/lib/rdoc/markup/verbatim.rb +1 -2
- data/lib/rdoc/markup.rb +64 -694
- data/lib/rdoc/options.rb +226 -44
- data/lib/rdoc/parser/c.rb +231 -246
- data/lib/rdoc/parser/changelog.rb +169 -23
- data/lib/rdoc/parser/markdown.rb +1 -3
- data/lib/rdoc/parser/prism_ruby.rb +1092 -0
- data/lib/rdoc/parser/rd.rb +1 -2
- data/lib/rdoc/parser/ripper_state_lex.rb +302 -0
- data/lib/rdoc/parser/ruby.rb +695 -478
- data/lib/rdoc/parser/ruby_tools.rb +33 -36
- data/lib/rdoc/parser/simple.rb +4 -4
- data/lib/rdoc/parser/text.rb +1 -2
- data/lib/rdoc/parser.rb +37 -42
- data/lib/rdoc/rd/block_parser.rb +708 -57
- data/lib/rdoc/rd/block_parser.ry +15 -11
- data/lib/rdoc/rd/inline.rb +5 -6
- data/lib/rdoc/rd/inline_parser.rb +787 -140
- data/lib/rdoc/rd/inline_parser.ry +1 -1
- data/lib/rdoc/rd.rb +4 -5
- data/lib/rdoc/rdoc.rb +72 -87
- data/lib/rdoc/ri/driver.rb +236 -152
- data/lib/rdoc/ri/formatter.rb +1 -1
- data/lib/rdoc/ri/paths.rb +4 -18
- data/lib/rdoc/ri/store.rb +1 -2
- data/lib/rdoc/ri/task.rb +2 -2
- data/lib/rdoc/ri.rb +5 -6
- data/lib/rdoc/rubygems_hook.rb +98 -20
- data/lib/rdoc/servlet.rb +30 -20
- data/lib/rdoc/stats/normal.rb +24 -18
- data/lib/rdoc/stats/quiet.rb +1 -2
- data/lib/rdoc/stats/verbose.rb +1 -3
- data/lib/rdoc/stats.rb +6 -7
- data/lib/rdoc/store.rb +84 -55
- data/lib/rdoc/task.rb +35 -10
- data/lib/rdoc/text.rb +40 -27
- data/lib/rdoc/token_stream.rb +56 -34
- data/lib/rdoc/tom_doc.rb +18 -19
- data/lib/rdoc/version.rb +10 -0
- data/lib/rdoc.rb +80 -56
- data/lib/rubygems_plugin.rb +23 -0
- data/man/ri.1 +247 -0
- metadata +45 -99
- data/.document +0 -5
- data/.gitignore +0 -13
- data/.travis.yml +0 -24
- data/Gemfile +0 -3
- data/RI.rdoc +0 -57
- data/Rakefile +0 -133
- data/bin/console +0 -7
- data/bin/setup +0 -6
- data/lib/gauntlet_rdoc.rb +0 -82
- data/lib/rdoc/generator/template/darkfish/.document +0 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
- data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -4
- data/lib/rdoc/generator/template/json_index/.document +0 -1
- 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/rdoc.gemspec +0 -57
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
|
#
|
@@ -123,6 +122,11 @@ class RDoc::Parser::C < RDoc::Parser
|
|
123
122
|
|
124
123
|
include RDoc::Text
|
125
124
|
|
125
|
+
# :stopdoc:
|
126
|
+
BOOL_ARG_PATTERN = /\s*+\b([01]|Q?(?:true|false)|TRUE|FALSE)\b\s*/
|
127
|
+
TRUE_VALUES = ['1', 'TRUE', 'true', 'Qtrue'].freeze
|
128
|
+
# :startdoc:
|
129
|
+
|
126
130
|
##
|
127
131
|
# Maps C variable names to names of Ruby classes or modules
|
128
132
|
|
@@ -164,7 +168,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
164
168
|
# Prepares for parsing a C file. See RDoc::Parser#initialize for details on
|
165
169
|
# the arguments.
|
166
170
|
|
167
|
-
def initialize top_level,
|
171
|
+
def initialize top_level, content, options, stats
|
168
172
|
super
|
169
173
|
|
170
174
|
@known_classes = RDoc::KNOWN_CLASSES.dup
|
@@ -174,6 +178,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|
174
178
|
@classes = load_variable_map :c_class_variables
|
175
179
|
@singleton_classes = load_variable_map :c_singleton_class_variables
|
176
180
|
|
181
|
+
@markup = @options.markup
|
182
|
+
|
177
183
|
# class_variable => { function => [method, ...] }
|
178
184
|
@methods = Hash.new { |h, f| h[f] = Hash.new { |i, m| i[m] = [] } }
|
179
185
|
|
@@ -210,47 +216,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
210
216
|
end
|
211
217
|
end
|
212
218
|
|
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
219
|
##
|
255
220
|
# Scans #content for rb_define_alias
|
256
221
|
|
@@ -269,23 +234,27 @@ class RDoc::Parser::C < RDoc::Parser
|
|
269
234
|
end
|
270
235
|
|
271
236
|
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
237
|
comment = find_alias_comment var_name, new_name, old_name
|
277
|
-
|
278
238
|
comment.normalize
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
class_obj.add_alias al
|
285
|
-
@stats.add_alias al
|
239
|
+
if comment.to_s.empty? and existing_method = class_obj.method_list.find { |m| m.name == old_name}
|
240
|
+
comment = existing_method.comment
|
241
|
+
end
|
242
|
+
add_alias(var_name, class_obj, old_name, new_name, comment)
|
286
243
|
end
|
287
244
|
end
|
288
245
|
|
246
|
+
##
|
247
|
+
# Add alias, either from a direct alias definition, or from two
|
248
|
+
# method that reference the same function.
|
249
|
+
|
250
|
+
def add_alias(var_name, class_obj, old_name, new_name, comment)
|
251
|
+
al = RDoc::Alias.new '', old_name, new_name, comment, singleton: @singleton_classes.key?(var_name)
|
252
|
+
al.record_location @top_level
|
253
|
+
class_obj.add_alias al
|
254
|
+
@stats.add_alias al
|
255
|
+
al
|
256
|
+
end
|
257
|
+
|
289
258
|
##
|
290
259
|
# Scans #content for rb_attr and rb_define_attr
|
291
260
|
|
@@ -293,18 +262,18 @@ class RDoc::Parser::C < RDoc::Parser
|
|
293
262
|
@content.scan(/rb_attr\s*\(
|
294
263
|
\s*(\w+),
|
295
264
|
\s*([\w"()]+),
|
296
|
-
|
297
|
-
|
298
|
-
\s*\w+\);/
|
265
|
+
#{BOOL_ARG_PATTERN},
|
266
|
+
#{BOOL_ARG_PATTERN},
|
267
|
+
\s*\w+\);/xmo) do |var_name, attr_name, read, write|
|
299
268
|
handle_attr var_name, attr_name, read, write
|
300
269
|
end
|
301
270
|
|
302
271
|
@content.scan(%r%rb_define_attr\(
|
303
272
|
\s*([\w\.]+),
|
304
273
|
\s*"([^"]+)",
|
305
|
-
|
306
|
-
\
|
307
|
-
%
|
274
|
+
#{BOOL_ARG_PATTERN},
|
275
|
+
#{BOOL_ARG_PATTERN}\);
|
276
|
+
%xmo) do |var_name, attr_name, read, write|
|
308
277
|
handle_attr var_name, attr_name, read, write
|
309
278
|
end
|
310
279
|
end
|
@@ -324,12 +293,98 @@ class RDoc::Parser::C < RDoc::Parser
|
|
324
293
|
# Scans #content for rb_define_class, boot_defclass, rb_define_class_under
|
325
294
|
# and rb_singleton_class
|
326
295
|
|
327
|
-
def
|
328
|
-
do_boot_defclass
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
296
|
+
def do_classes_and_modules
|
297
|
+
do_boot_defclass if @file_name == "class.c"
|
298
|
+
|
299
|
+
@content.scan(
|
300
|
+
%r(
|
301
|
+
(?<open>\s*\(\s*) {0}
|
302
|
+
(?<close>\s*\)\s*) {0}
|
303
|
+
(?<name>\s*"(?<class_name>\w+)") {0}
|
304
|
+
(?<parent>\s*(?:
|
305
|
+
(?<parent_name>[\w\*\s\(\)\.\->]+) |
|
306
|
+
rb_path2class\s*\(\s*"(?<path>[\w:]+)"\s*\)
|
307
|
+
)) {0}
|
308
|
+
(?<under>\w+) {0}
|
309
|
+
|
310
|
+
(?<var_name>[\w\.]+)\s* =
|
311
|
+
\s*rb_(?:
|
312
|
+
define_(?:
|
313
|
+
class(?: # rb_define_class(name, parent_name)
|
314
|
+
\(\s*
|
315
|
+
\g<name>,
|
316
|
+
\g<parent>
|
317
|
+
\s*\)
|
318
|
+
|
|
319
|
+
_under\g<open> # rb_define_class_under(under, name, parent_name...)
|
320
|
+
\g<under>,
|
321
|
+
\g<name>,
|
322
|
+
\g<parent>
|
323
|
+
\g<close>
|
324
|
+
)
|
325
|
+
|
|
326
|
+
(?<module>)
|
327
|
+
module(?: # rb_define_module(name)
|
328
|
+
\g<open>
|
329
|
+
\g<name>
|
330
|
+
\g<close>
|
331
|
+
|
|
332
|
+
_under\g<open> # rb_define_module_under(under, name)
|
333
|
+
\g<under>,
|
334
|
+
\g<name>
|
335
|
+
\g<close>
|
336
|
+
)
|
337
|
+
)
|
338
|
+
|
|
339
|
+
(?<attributes>(?:\s*"\w+",)*\s*NULL\s*) {0}
|
340
|
+
struct_define(?:
|
341
|
+
\g<open> # rb_struct_define(name, ...)
|
342
|
+
\g<name>,
|
343
|
+
|
|
344
|
+
_under\g<open> # rb_struct_define_under(under, name, ...)
|
345
|
+
\g<under>,
|
346
|
+
\g<name>,
|
347
|
+
|
|
348
|
+
_without_accessor(?:
|
349
|
+
\g<open> # rb_struct_define_without_accessor(name, parent_name, ...)
|
350
|
+
|
|
351
|
+
_under\g<open> # rb_struct_define_without_accessor_under(under, name, parent_name, ...)
|
352
|
+
\g<under>,
|
353
|
+
)
|
354
|
+
\g<name>,
|
355
|
+
\g<parent>,
|
356
|
+
\s*\w+, # Allocation function
|
357
|
+
)
|
358
|
+
\g<attributes>
|
359
|
+
\g<close>
|
360
|
+
|
|
361
|
+
singleton_class\g<open> # rb_singleton_class(target_class_name)
|
362
|
+
(?<target_class_name>\w+)
|
363
|
+
\g<close>
|
364
|
+
)
|
365
|
+
)mx
|
366
|
+
) do
|
367
|
+
if target_class_name = $~[:target_class_name]
|
368
|
+
# rb_singleton_class(target_class_name)
|
369
|
+
handle_singleton $~[:var_name], target_class_name
|
370
|
+
next
|
371
|
+
end
|
372
|
+
|
373
|
+
var_name = $~[:var_name]
|
374
|
+
type = $~[:module] ? :module : :class
|
375
|
+
class_name = $~[:class_name]
|
376
|
+
parent_name = $~[:parent_name] || $~[:path]
|
377
|
+
under = $~[:under]
|
378
|
+
attributes = $~[:attributes]
|
379
|
+
|
380
|
+
handle_class_module(var_name, type, class_name, parent_name, under)
|
381
|
+
if attributes and !parent_name # rb_struct_define *not* without_accessor
|
382
|
+
true_flag = 'Qtrue'
|
383
|
+
attributes.scan(/"\K\w+(?=")/) do |attr_name|
|
384
|
+
handle_attr var_name, attr_name, true_flag, true_flag
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
333
388
|
end
|
334
389
|
|
335
390
|
##
|
@@ -348,6 +403,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
348
403
|
\s*(.*?)\s*\)\s*;
|
349
404
|
%xm) do |type, var_name, const_name, definition|
|
350
405
|
var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
|
406
|
+
type = "const" if type == "global_const"
|
351
407
|
handle_constants type, var_name, const_name, definition
|
352
408
|
end
|
353
409
|
|
@@ -378,75 +434,16 @@ class RDoc::Parser::C < RDoc::Parser
|
|
378
434
|
end
|
379
435
|
end
|
380
436
|
|
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
437
|
|
441
438
|
##
|
442
439
|
# Scans #content for rb_include_module
|
443
440
|
|
444
441
|
def do_includes
|
445
|
-
@content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
|
442
|
+
@content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c, m|
|
446
443
|
next unless cls = @classes[c]
|
447
444
|
m = @known_classes[m] || m
|
448
445
|
|
449
|
-
comment =
|
446
|
+
comment = new_comment '', @top_level, :c
|
450
447
|
incl = cls.add_include RDoc::Include.new(m, comment)
|
451
448
|
incl.record_location @top_level
|
452
449
|
end
|
@@ -518,42 +515,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
518
515
|
end
|
519
516
|
end
|
520
517
|
|
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
518
|
##
|
558
519
|
# Finds the comment for an alias on +class_name+ from +new_name+ to
|
559
520
|
# +old_name+
|
@@ -564,7 +525,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
564
525
|
\s*"#{Regexp.escape new_name}"\s*,
|
565
526
|
\s*"#{Regexp.escape old_name}"\s*\);%xm
|
566
527
|
|
567
|
-
|
528
|
+
new_comment($1 || '', @top_level, :c)
|
568
529
|
end
|
569
530
|
|
570
531
|
##
|
@@ -603,7 +564,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
603
564
|
''
|
604
565
|
end
|
605
566
|
|
606
|
-
|
567
|
+
new_comment comment, @top_level, :c
|
607
568
|
end
|
608
569
|
|
609
570
|
##
|
@@ -613,19 +574,18 @@ class RDoc::Parser::C < RDoc::Parser
|
|
613
574
|
table = {}
|
614
575
|
file_content.scan(%r{
|
615
576
|
((?>/\*.*?\*/\s*)?)
|
616
|
-
((
|
617
|
-
|
618
|
-
\s*(?:\([^)]*\))(?:[^;]|$))
|
577
|
+
((?:\w+\s+){0,2} VALUE\s+(\w+)
|
578
|
+
\s*(?:\([^\)]*\))(?:[^\);]|$))
|
619
579
|
| ((?>/\*.*?\*/\s*))^\s*(\#\s*define\s+(\w+)\s+(\w+))
|
620
580
|
| ^\s*\#\s*define\s+(\w+)\s+(\w+)
|
621
581
|
}xm) do
|
622
582
|
case
|
623
|
-
when $
|
624
|
-
table[
|
625
|
-
when $
|
626
|
-
table[
|
627
|
-
when $8
|
628
|
-
table[
|
583
|
+
when name = $3
|
584
|
+
table[name] = [:func_def, $1, $2, $~.offset(2)] if !(t = table[name]) || t[0] != :func_def
|
585
|
+
when name = $6
|
586
|
+
table[name] = [:macro_def, $4, $5, $~.offset(5), $7] if !(t = table[name]) || t[0] == :macro_alias
|
587
|
+
when name = $8
|
588
|
+
table[name] ||= [:macro_alias, $9]
|
629
589
|
end
|
630
590
|
end
|
631
591
|
table
|
@@ -643,7 +603,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
643
603
|
|
644
604
|
case type
|
645
605
|
when :func_def
|
646
|
-
comment =
|
606
|
+
comment = new_comment args[0], @top_level, :c
|
647
607
|
body = args[1]
|
648
608
|
offset, = args[2]
|
649
609
|
|
@@ -666,16 +626,14 @@ class RDoc::Parser::C < RDoc::Parser
|
|
666
626
|
|
667
627
|
#meth_obj.params = params
|
668
628
|
meth_obj.start_collecting_tokens
|
669
|
-
tk =
|
670
|
-
tk.set_text body
|
629
|
+
tk = { :line_no => 1, :char_no => 1, :text => body }
|
671
630
|
meth_obj.add_token tk
|
672
631
|
meth_obj.comment = comment
|
673
|
-
meth_obj.offset = offset
|
674
632
|
meth_obj.line = file_content[0, offset].count("\n") + 1
|
675
633
|
|
676
634
|
body
|
677
635
|
when :macro_def
|
678
|
-
comment =
|
636
|
+
comment = new_comment args[0], @top_level, :c
|
679
637
|
body = args[1]
|
680
638
|
offset, = args[2]
|
681
639
|
|
@@ -685,11 +643,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|
685
643
|
find_modifiers comment, meth_obj
|
686
644
|
|
687
645
|
meth_obj.start_collecting_tokens
|
688
|
-
tk =
|
689
|
-
tk.set_text body
|
646
|
+
tk = { :line_no => 1, :char_no => 1, :text => body }
|
690
647
|
meth_obj.add_token tk
|
691
648
|
meth_obj.comment = comment
|
692
|
-
meth_obj.offset = offset
|
693
649
|
meth_obj.line = file_content[0, offset].count("\n") + 1
|
694
650
|
|
695
651
|
body
|
@@ -722,13 +678,14 @@ class RDoc::Parser::C < RDoc::Parser
|
|
722
678
|
##
|
723
679
|
# Finds a RDoc::NormalClass or RDoc::NormalModule for +raw_name+
|
724
680
|
|
725
|
-
def find_class(raw_name, name)
|
681
|
+
def find_class(raw_name, name, base_name = nil)
|
726
682
|
unless @classes[raw_name]
|
727
683
|
if raw_name =~ /^rb_m/
|
728
684
|
container = @top_level.add_module RDoc::NormalModule, name
|
729
685
|
else
|
730
686
|
container = @top_level.add_class RDoc::NormalClass, name
|
731
687
|
end
|
688
|
+
container.name = base_name if base_name
|
732
689
|
|
733
690
|
container.record_location @top_level
|
734
691
|
@classes[raw_name] = container
|
@@ -769,7 +726,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
769
726
|
((?>/\*.*?\*/\s+))
|
770
727
|
(static\s+)?
|
771
728
|
void\s+
|
772
|
-
|
729
|
+
Init(?:VM)?_(?i:#{class_name})\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)%xm then
|
773
730
|
comment = $1.sub(%r%Document-(?:class|module):\s+#{class_name}%, '')
|
774
731
|
elsif @content =~ %r%Document-(?:class|module):\s+#{class_name}\s*?
|
775
732
|
(?:<\s+[:,\w]+)?\n((?>.*?\*/))%xm then
|
@@ -784,7 +741,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
784
741
|
comment = ''
|
785
742
|
end
|
786
743
|
|
787
|
-
comment =
|
744
|
+
comment = new_comment comment, @top_level, :c
|
788
745
|
comment.normalize
|
789
746
|
|
790
747
|
look_for_directives_in class_mod, comment
|
@@ -798,17 +755,31 @@ class RDoc::Parser::C < RDoc::Parser
|
|
798
755
|
def gen_const_table file_content
|
799
756
|
table = {}
|
800
757
|
@content.scan(%r{
|
801
|
-
((?>^\s*/\*.*?\*/\s+))
|
802
|
-
rb_define_(
|
803
|
-
"(
|
758
|
+
(?<doc>(?>^\s*/\*.*?\*/\s+))
|
759
|
+
rb_define_(?<type>\w+)\(\s*(?:\w+),\s*
|
760
|
+
"(?<name>\w+)"\s*,
|
804
761
|
.*?\)\s*;
|
762
|
+
| (?<doc>(?>^\s*/\*.*?\*/\s+))
|
763
|
+
rb_define_global_(?<type>const)\(\s*
|
764
|
+
"(?<name>\w+)"\s*,
|
765
|
+
.*?\)\s*;
|
766
|
+
| (?<doc>(?>^\s*/\*.*?\*/\s+))
|
767
|
+
rb_file_(?<type>const)\(\s*
|
768
|
+
"(?<name>\w+)"\s*,
|
769
|
+
.*?\)\s*;
|
770
|
+
| (?<doc>(?>^\s*/\*.*?\*/\s+))
|
771
|
+
rb_curses_define_(?<type>const)\(\s*
|
772
|
+
(?<name>\w+)
|
773
|
+
\s*\)\s*;
|
805
774
|
| Document-(?:const|global|variable):\s
|
806
|
-
((?:\w+::)*\w+)
|
807
|
-
\s*?\n((?>.*?\*/))
|
775
|
+
(?<name>(?:\w+::)*\w+)
|
776
|
+
\s*?\n(?<doc>(?>.*?\*/))
|
808
777
|
}mxi) do
|
809
|
-
|
810
|
-
|
811
|
-
|
778
|
+
name, doc, type = $~.values_at(:name, :doc, :type)
|
779
|
+
if type
|
780
|
+
table[[type, name]] = doc
|
781
|
+
else
|
782
|
+
table[name] = "/*\n" + doc
|
812
783
|
end
|
813
784
|
end
|
814
785
|
table
|
@@ -829,7 +800,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
829
800
|
table[const_name] ||
|
830
801
|
''
|
831
802
|
|
832
|
-
|
803
|
+
new_comment comment, @top_level, :c
|
833
804
|
end
|
834
805
|
|
835
806
|
##
|
@@ -837,7 +808,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
837
808
|
|
838
809
|
def find_modifiers comment, meth_obj
|
839
810
|
comment.normalize
|
840
|
-
comment.extract_call_seq
|
811
|
+
meth_obj.call_seq = comment.extract_call_seq
|
841
812
|
|
842
813
|
look_for_directives_in meth_obj, comment
|
843
814
|
end
|
@@ -860,7 +831,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
860
831
|
|
861
832
|
return unless comment
|
862
833
|
|
863
|
-
|
834
|
+
new_comment comment, @top_level, :c
|
864
835
|
end
|
865
836
|
|
866
837
|
##
|
@@ -869,8 +840,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|
869
840
|
|
870
841
|
def handle_attr(var_name, attr_name, read, write)
|
871
842
|
rw = ''
|
872
|
-
rw
|
873
|
-
rw
|
843
|
+
rw += 'R' if TRUE_VALUES.include?(read)
|
844
|
+
rw += 'W' if TRUE_VALUES.include?(write)
|
874
845
|
|
875
846
|
class_name = @known_classes[var_name]
|
876
847
|
|
@@ -956,7 +927,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
956
927
|
# can override the C value of the comment to give a friendly definition.
|
957
928
|
#
|
958
929
|
# /* 300: The perfect score in bowling */
|
959
|
-
# rb_define_const(cFoo, "PERFECT", INT2FIX(300);
|
930
|
+
# rb_define_const(cFoo, "PERFECT", INT2FIX(300));
|
960
931
|
#
|
961
932
|
# Will override <tt>INT2FIX(300)</tt> with the value +300+ in the output
|
962
933
|
# RDoc. Values may include quotes and escaped colons (\:).
|
@@ -966,7 +937,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
966
937
|
|
967
938
|
return unless class_name
|
968
939
|
|
969
|
-
class_obj = find_class var_name, class_name
|
940
|
+
class_obj = find_class var_name, class_name, class_name[/::\K[^:]+\z/]
|
970
941
|
|
971
942
|
unless class_obj then
|
972
943
|
@options.warn 'Enclosing class or module %p is not known' % [const_name]
|
@@ -980,21 +951,20 @@ class RDoc::Parser::C < RDoc::Parser
|
|
980
951
|
# "/* definition: comment */" form. The literal ':' and '\' characters
|
981
952
|
# can be escaped with a backslash.
|
982
953
|
if type.downcase == 'const' then
|
983
|
-
|
954
|
+
if /\A(.+?)?:(?!\S)/ =~ comment.text
|
955
|
+
new_definition, new_comment = $1, $'
|
984
956
|
|
985
|
-
|
986
|
-
if new_definition.empty? then # Default to literal C definition
|
957
|
+
if !new_definition # Default to literal C definition
|
987
958
|
new_definition = definition
|
988
959
|
else
|
989
|
-
new_definition.gsub
|
990
|
-
new_definition.gsub!("\\", '\\')
|
960
|
+
new_definition = new_definition.gsub(/\\([\\:])/, '\1')
|
991
961
|
end
|
992
962
|
|
993
963
|
new_definition.sub!(/\A(\s+)/, '')
|
994
964
|
|
995
965
|
new_comment = "#{$1}#{new_comment.lstrip}"
|
996
966
|
|
997
|
-
new_comment =
|
967
|
+
new_comment = self.new_comment(new_comment, @top_level, :c)
|
998
968
|
|
999
969
|
con = RDoc::Constant.new const_name, new_definition, new_comment
|
1000
970
|
else
|
@@ -1032,6 +1002,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1032
1002
|
|
1033
1003
|
class_obj = find_class var_name, class_name
|
1034
1004
|
|
1005
|
+
if existing_method = class_obj.method_list.find { |m| m.c_function == function }
|
1006
|
+
add_alias(var_name, class_obj, existing_method.name, meth_name, existing_method.comment)
|
1007
|
+
end
|
1008
|
+
|
1035
1009
|
if class_obj then
|
1036
1010
|
if meth_name == 'initialize' then
|
1037
1011
|
meth_name = 'new'
|
@@ -1039,10 +1013,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1039
1013
|
type = 'method' # force public
|
1040
1014
|
end
|
1041
1015
|
|
1042
|
-
|
1016
|
+
singleton = singleton || %w[singleton_method module_function].include?(type)
|
1017
|
+
meth_obj = RDoc::AnyMethod.new '', meth_name, singleton: singleton
|
1043
1018
|
meth_obj.c_function = function
|
1044
|
-
meth_obj.singleton =
|
1045
|
-
singleton || %w[singleton_method module_function].include?(type)
|
1046
1019
|
|
1047
1020
|
p_count = Integer(param_count) rescue -1
|
1048
1021
|
|
@@ -1066,12 +1039,18 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1066
1039
|
elsif p_count == -1 then # argc, argv
|
1067
1040
|
rb_scan_args body
|
1068
1041
|
else
|
1069
|
-
|
1042
|
+
args = (1..p_count).map { |i| "p#{i}" }
|
1043
|
+
"(#{args.join ', '})"
|
1070
1044
|
end
|
1071
1045
|
|
1072
1046
|
|
1073
1047
|
meth_obj.record_location @top_level
|
1048
|
+
|
1049
|
+
if meth_obj.section_title
|
1050
|
+
class_obj.temporary_section = class_obj.add_section(meth_obj.section_title)
|
1051
|
+
end
|
1074
1052
|
class_obj.add_method meth_obj
|
1053
|
+
|
1075
1054
|
@stats.add_method meth_obj
|
1076
1055
|
meth_obj.visibility = :private if 'private_method' == type
|
1077
1056
|
end
|
@@ -1088,23 +1067,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1088
1067
|
@singleton_classes[sclass_var] = class_name
|
1089
1068
|
end
|
1090
1069
|
|
1091
|
-
##
|
1092
|
-
# Normalizes tabs in +body+
|
1093
|
-
|
1094
|
-
def handle_tab_width(body)
|
1095
|
-
if /\t/ =~ body
|
1096
|
-
tab_width = @options.tab_width
|
1097
|
-
body.split(/\n/).map do |line|
|
1098
|
-
1 while line.gsub!(/\t+/) do
|
1099
|
-
' ' * (tab_width * $&.length - $`.length % tab_width)
|
1100
|
-
end && $~
|
1101
|
-
line
|
1102
|
-
end.join "\n"
|
1103
|
-
else
|
1104
|
-
body
|
1105
|
-
end
|
1106
|
-
end
|
1107
|
-
|
1108
1070
|
##
|
1109
1071
|
# Loads the variable map with the given +name+ from the RDoc::Store, if
|
1110
1072
|
# present.
|
@@ -1137,15 +1099,34 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1137
1099
|
# */
|
1138
1100
|
#
|
1139
1101
|
# This method modifies the +comment+
|
1102
|
+
# Both :main: and :title: directives are deprecated and will be removed in RDoc 7.
|
1140
1103
|
|
1141
1104
|
def look_for_directives_in context, comment
|
1142
1105
|
@preprocess.handle comment, context do |directive, param|
|
1143
1106
|
case directive
|
1144
1107
|
when 'main' then
|
1145
1108
|
@options.main_page = param
|
1109
|
+
|
1110
|
+
warn <<~MSG
|
1111
|
+
The :main: directive is deprecated and will be removed in RDoc 7.
|
1112
|
+
|
1113
|
+
You can use these options to specify the initial page displayed instead:
|
1114
|
+
- `--main=#{param}` via the command line
|
1115
|
+
- `rdoc.main = "#{param}"` if you use `RDoc::Task`
|
1116
|
+
- `main_page: #{param}` in your `.rdoc_options` file
|
1117
|
+
MSG
|
1146
1118
|
''
|
1147
1119
|
when 'title' then
|
1148
1120
|
@options.default_title = param if @options.respond_to? :default_title=
|
1121
|
+
|
1122
|
+
warn <<~MSG
|
1123
|
+
The :title: directive is deprecated and will be removed in RDoc 7.
|
1124
|
+
|
1125
|
+
You can use these options to specify the title displayed instead:
|
1126
|
+
- `--title=#{param}` via the command line
|
1127
|
+
- `rdoc.title = "#{param}"` if you use `RDoc::Task`
|
1128
|
+
- `title: #{param}` in your `.rdoc_options` file
|
1129
|
+
MSG
|
1149
1130
|
''
|
1150
1131
|
end
|
1151
1132
|
end
|
@@ -1241,7 +1222,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1241
1222
|
# when scanning for classes and methods
|
1242
1223
|
|
1243
1224
|
def remove_commented_out_lines
|
1244
|
-
@content.gsub
|
1225
|
+
@content = @content.gsub(%r%//.*rb_define_%, '//')
|
1245
1226
|
end
|
1246
1227
|
|
1247
1228
|
##
|
@@ -1251,8 +1232,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1251
1232
|
def scan
|
1252
1233
|
remove_commented_out_lines
|
1253
1234
|
|
1254
|
-
|
1255
|
-
do_classes
|
1235
|
+
do_classes_and_modules
|
1256
1236
|
do_missing
|
1257
1237
|
|
1258
1238
|
do_constants
|
@@ -1261,12 +1241,17 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1261
1241
|
do_aliases
|
1262
1242
|
do_attrs
|
1263
1243
|
|
1264
|
-
deduplicate_call_seq
|
1265
|
-
|
1266
1244
|
@store.add_c_variables self
|
1267
1245
|
|
1268
1246
|
@top_level
|
1269
1247
|
end
|
1270
1248
|
|
1271
|
-
|
1249
|
+
##
|
1250
|
+
# Creates a RDoc::Comment instance.
|
1272
1251
|
|
1252
|
+
def new_comment text = nil, location = nil, language = nil
|
1253
|
+
RDoc::Comment.new(text, location, language).tap do |comment|
|
1254
|
+
comment.format = @markup
|
1255
|
+
end
|
1256
|
+
end
|
1257
|
+
end
|