rdoc 6.1.2 → 6.2.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73777cbf4f90279462007235f76d885844d7fa2128a6bd3d5ff20f3688400004
4
- data.tar.gz: 689567dfcd26429cc9812e3a80064d561e6c033e3ef355763565ae0249b280ee
3
+ metadata.gz: c71da0922078855b23bba9eb9f3671d5f04abb40c690eab20382c812b1b6aacc
4
+ data.tar.gz: bf58da8ba529883aa44e4ddc5e7c88a9671e508993bfd62142813cc661bbe62c
5
5
  SHA512:
6
- metadata.gz: 2170224475906ee7f83b07923887fa08eb1b1c9c06b7f1fc85b8a2003efdc5b22f08c39d7e0e1fff28a20cc0821e4c00242955dd425d496cc787ce27c1e8173d
7
- data.tar.gz: 3f92e3e5b1de041dabe871c3b9323bd3d39ca0c1775e8967f32da86eaf8bbda7fb24f7311d0251979489f85ebf4a99bca8ec6e8e022d7ea3a721ee869a7b40df
6
+ metadata.gz: f343d3101a0fbd05fc6d8675d9a72cc2aed5ff794258fc3fbe9f8658032857d61a68350ea09e29b84c02789cec3f0f8a6e83faf29faf41d2a00e6cbad07435c5
7
+ data.tar.gz: f0f506c54e2ebc80b69d0d26104c44ae3ecc5cefcaa90a6cd4364f8e4660fc8021e6c7426bd63363519a217728a8c3ac0be217f4d28b6b3f1c4e9b1ff6f34c26
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.rbc
2
2
  *.swp
3
+ /coverage
3
4
  .DS_Store
4
5
  /.rdoc
5
6
  /.rvmrc
data/Gemfile CHANGED
@@ -1,3 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :development do
6
+ gem "rake"
7
+ gem "racc", "> 1.4.10"
8
+ gem "kpeg"
9
+ gem "test-unit"
10
+ gem "minitest" # for test_rdoc_rubygems_hook.rb
11
+ gem "rubocop"
12
+ end
@@ -3,7 +3,6 @@
3
3
  home :: https://github.com/ruby/rdoc
4
4
  rdoc :: https://ruby.github.io/rdoc
5
5
  bugs :: https://github.com/ruby/rdoc/issues
6
- build status :: {<img src="https://travis-ci.org/ruby/rdoc.svg?branch=master" alt="Build Status on Travis CI" />}[https://travis-ci.org/ruby/rdoc] {<img src="https://ci.appveyor.com/api/projects/status/github/ruby/rdoc?branch=master&svg=true" alt="Build Status on AppVeyor" />}[https://ci.appveyor.com/project/ruby/rdoc]
7
6
  code quality :: {<img src="https://codeclimate.com/github/ruby/rdoc/badges/gpa.svg" alt="Code Climate">}[https://codeclimate.com/github/ruby/rdoc]
8
7
 
9
8
  == Description
data/Rakefile CHANGED
@@ -35,7 +35,7 @@ task ghpages: :rdoc do
35
35
  end
36
36
 
37
37
  Rake::TestTask.new(:test) do |t|
38
- t.libs << "test"
38
+ t.libs << "test/rdoc"
39
39
  t.verbose = true
40
40
  t.test_files = FileList['test/**/test_*.rb']
41
41
  end
@@ -210,7 +210,7 @@ class RDoc::ClassModule < RDoc::Context
210
210
  normalize_comment comment
211
211
  end
212
212
 
213
- comment = "#{@comment}\n---\n#{comment}" unless @comment.empty?
213
+ comment = "#{@comment.to_s}\n---\n#{comment.to_s}" unless @comment.empty?
214
214
 
215
215
  super comment
216
216
  end
@@ -33,6 +33,11 @@ class RDoc::Comment
33
33
 
34
34
  attr_reader :text
35
35
 
36
+ ##
37
+ # Alias for text
38
+
39
+ alias to_s text
40
+
36
41
  ##
37
42
  # Overrides the content returned by #parse. Use when there is no #text
38
43
  # source for this comment
@@ -43,9 +48,10 @@ class RDoc::Comment
43
48
  # Creates a new comment with +text+ that is found in the RDoc::TopLevel
44
49
  # +location+.
45
50
 
46
- def initialize text = nil, location = nil
51
+ def initialize text = nil, location = nil, language = nil
47
52
  @location = location
48
53
  @text = text.nil? ? nil : text.dup
54
+ @language = language
49
55
 
50
56
  @document = nil
51
57
  @format = 'rdoc'
@@ -74,6 +74,9 @@ h6:target {
74
74
  code,
75
75
  pre {
76
76
  font-family: "Source Code Pro", Monaco, monospace;
77
+ background-color: rgba(27,31,35,0.05);
78
+ padding: 0em 0.2em;
79
+ border-radius: 0.2em;
77
80
  }
78
81
 
79
82
  /* @group Generic Classes */
@@ -103,7 +106,7 @@ pre {
103
106
 
104
107
  .missing-docs {
105
108
  font-size: 120%;
106
- background: white url(images/wrench_orange.png) no-repeat 4px center;
109
+ background: white url(../images/wrench_orange.png) no-repeat 4px center;
107
110
  color: #ccc;
108
111
  line-height: 2em;
109
112
  border: 1px solid #d00;
@@ -147,11 +150,11 @@ pre {
147
150
  .table-of-contents li .toc-toggle {
148
151
  width: 16px;
149
152
  height: 16px;
150
- background: url(images/add.png) no-repeat;
153
+ background: url(../images/add.png) no-repeat;
151
154
  }
152
155
 
153
156
  .table-of-contents li .toc-toggle.open {
154
- background: url(images/delete.png) no-repeat;
157
+ background: url(../images/delete.png) no-repeat;
155
158
  }
156
159
 
157
160
  /* @end */
@@ -273,8 +276,13 @@ ul.link-list .type {
273
276
  -webkit-border-radius: 5px;
274
277
  }
275
278
 
279
+ dl.label-list dt {
280
+ float: left;
281
+ margin-right: 1em;
282
+ }
283
+
276
284
  .calls-super {
277
- background: url(images/arrow_up.png) no-repeat right center;
285
+ background: url(../images/arrow_up.png) no-repeat right center;
278
286
  }
279
287
 
280
288
  /* @end */
@@ -500,7 +508,7 @@ main .method-click-advice {
500
508
  visibility: hidden;
501
509
  padding-right: 20px;
502
510
  line-height: 20px;
503
- background: url(images/zoom.png) no-repeat right top;
511
+ background: url(../images/zoom.png) no-repeat right top;
504
512
  }
505
513
  main .method-heading:hover .method-click-advice {
506
514
  visibility: visible;
@@ -72,7 +72,6 @@ function hookSearch() {
72
72
  }
73
73
 
74
74
  search.select = function(result) {
75
- console.log(result);
76
75
  window.location.href = result.firstChild.firstChild.href;
77
76
  }
78
77
 
@@ -849,8 +849,6 @@ https://github.com/ruby/rdoc/issues
849
849
 
850
850
  # Formatters
851
851
  autoload :Formatter, 'rdoc/markup/formatter'
852
- autoload :FormatterTestCase, 'rdoc/markup/formatter_test_case'
853
- autoload :TextFormatterTestCase, 'rdoc/markup/text_formatter_test_case'
854
852
 
855
853
  autoload :ToAnsi, 'rdoc/markup/to_ansi'
856
854
  autoload :ToBs, 'rdoc/markup/to_bs'
@@ -80,10 +80,6 @@ class RDoc::Markup::Parser
80
80
  @binary_input = nil
81
81
  @current_token = nil
82
82
  @debug = false
83
- @input = nil
84
- @input_encoding = nil
85
- @line = 0
86
- @line_pos = 0
87
83
  @s = nil
88
84
  @tokens = []
89
85
  end
@@ -319,13 +315,6 @@ class RDoc::Markup::Parser
319
315
  verbatim
320
316
  end
321
317
 
322
- ##
323
- # The character offset for the input string at the given +byte_offset+
324
-
325
- def char_pos byte_offset
326
- @input.byteslice(0, byte_offset).length
327
- end
328
-
329
318
  ##
330
319
  # Pulls the next token from the stream.
331
320
 
@@ -424,15 +413,53 @@ class RDoc::Markup::Parser
424
413
  token
425
414
  end
426
415
 
416
+ ##
417
+ # A simple wrapper of StringScanner that is aware of the current column and lineno
418
+
419
+ class MyStringScanner
420
+ def initialize(input)
421
+ @line = @column = 0
422
+ @s = StringScanner.new input
423
+ end
424
+
425
+ def scan(re)
426
+ ret = @s.scan(re)
427
+ @column += ret.length if ret
428
+ ret
429
+ end
430
+
431
+ def unscan(s)
432
+ @s.pos -= s.bytesize
433
+ @column -= s.length
434
+ end
435
+
436
+ def pos
437
+ [@column, @line]
438
+ end
439
+
440
+ def newline!
441
+ @column = 0
442
+ @line += 1
443
+ end
444
+
445
+ def eos?
446
+ @s.eos?
447
+ end
448
+
449
+ def matched
450
+ @s.matched
451
+ end
452
+
453
+ def [](i)
454
+ @s[i]
455
+ end
456
+ end
457
+
427
458
  ##
428
459
  # Creates the StringScanner
429
460
 
430
461
  def setup_scanner input
431
- @line = 0
432
- @line_pos = 0
433
- @input = input.dup
434
-
435
- @s = StringScanner.new input
462
+ @s = MyStringScanner.new input
436
463
  end
437
464
 
438
465
  ##
@@ -467,31 +494,30 @@ class RDoc::Markup::Parser
467
494
  @tokens << case
468
495
  # [CR]LF => :NEWLINE
469
496
  when @s.scan(/\r?\n/) then
470
- token = [:NEWLINE, @s.matched, *token_pos(pos)]
471
- @line_pos = char_pos @s.pos
472
- @line += 1
497
+ token = [:NEWLINE, @s.matched, *pos]
498
+ @s.newline!
473
499
  token
474
500
  # === text => :HEADER then :TEXT
475
501
  when @s.scan(/(=+)(\s*)/) then
476
502
  level = @s[1].length
477
- header = [:HEADER, level, *token_pos(pos)]
503
+ header = [:HEADER, level, *pos]
478
504
 
479
505
  if @s[2] =~ /^\r?\n/ then
480
- @s.pos -= @s[2].length
506
+ @s.unscan(@s[2])
481
507
  header
482
508
  else
483
509
  pos = @s.pos
484
510
  @s.scan(/.*/)
485
511
  @tokens << header
486
- [:TEXT, @s.matched.sub(/\r$/, ''), *token_pos(pos)]
512
+ [:TEXT, @s.matched.sub(/\r$/, ''), *pos]
487
513
  end
488
514
  # --- (at least 3) and nothing else on the line => :RULE
489
515
  when @s.scan(/(-{3,}) *\r?$/) then
490
- [:RULE, @s[1].length - 2, *token_pos(pos)]
516
+ [:RULE, @s[1].length - 2, *pos]
491
517
  # * or - followed by white space and text => :BULLET
492
518
  when @s.scan(/([*-]) +(\S)/) then
493
- @s.pos -= @s[2].bytesize # unget \S
494
- [:BULLET, @s[1], *token_pos(pos)]
519
+ @s.unscan(@s[2])
520
+ [:BULLET, @s[1], *pos]
495
521
  # A. text, a. text, 12. text => :UALPHA, :LALPHA, :NUMBER
496
522
  when @s.scan(/([a-z]|\d+)\. +(\S)/i) then
497
523
  # FIXME if tab(s), the column will be wrong
@@ -500,7 +526,7 @@ class RDoc::Markup::Parser
500
526
  # before (and provide a check for that at least in debug
501
527
  # mode)
502
528
  list_label = @s[1]
503
- @s.pos -= @s[2].bytesize # unget \S
529
+ @s.unscan(@s[2])
504
530
  list_type =
505
531
  case list_label
506
532
  when /[a-z]/ then :LALPHA
@@ -509,24 +535,24 @@ class RDoc::Markup::Parser
509
535
  else
510
536
  raise ParseError, "BUG token #{list_label}"
511
537
  end
512
- [list_type, list_label, *token_pos(pos)]
538
+ [list_type, list_label, *pos]
513
539
  # [text] followed by spaces or end of line => :LABEL
514
540
  when @s.scan(/\[(.*?)\]( +|\r?$)/) then
515
- [:LABEL, @s[1], *token_pos(pos)]
541
+ [:LABEL, @s[1], *pos]
516
542
  # text:: followed by spaces or end of line => :NOTE
517
543
  when @s.scan(/(.*?)::( +|\r?$)/) then
518
- [:NOTE, @s[1], *token_pos(pos)]
544
+ [:NOTE, @s[1], *pos]
519
545
  # >>> followed by end of line => :BLOCKQUOTE
520
546
  when @s.scan(/>>> *(\w+)?$/) then
521
- [:BLOCKQUOTE, @s[1], *token_pos(pos)]
547
+ [:BLOCKQUOTE, @s[1], *pos]
522
548
  # anything else: :TEXT
523
549
  else
524
550
  @s.scan(/(.*?)( )?\r?$/)
525
- token = [:TEXT, @s[1], *token_pos(pos)]
551
+ token = [:TEXT, @s[1], *pos]
526
552
 
527
553
  if @s[2] then
528
554
  @tokens << token
529
- [:BREAK, @s[2], *token_pos(pos + @s[1].length)]
555
+ [:BREAK, @s[2], pos[0] + @s[1].length, pos[1]]
530
556
  else
531
557
  token
532
558
  end
@@ -536,16 +562,6 @@ class RDoc::Markup::Parser
536
562
  self
537
563
  end
538
564
 
539
- ##
540
- # Calculates the column (by character) and line of the current token based
541
- # on +byte_offset+.
542
-
543
- def token_pos byte_offset
544
- offset = char_pos byte_offset
545
-
546
- [offset - @line_pos, @line]
547
- end
548
-
549
565
  ##
550
566
  # Returns the current token to the token stream
551
567
 
@@ -153,7 +153,11 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
153
153
  ref.sections.any? { |section| label == section.title } then
154
154
  path << "##{label}"
155
155
  else
156
- path << "#label-#{label}"
156
+ if ref.respond_to?(:aref)
157
+ path << "##{ref.aref}-label-#{label}"
158
+ else
159
+ path << "#label-#{label}"
160
+ end
157
161
  end if label
158
162
 
159
163
  "<a href=\"#{path}\">#{text}</a>"
@@ -344,7 +344,10 @@ class RDoc::Options
344
344
 
345
345
  def init_ivars # :nodoc:
346
346
  @dry_run = false
347
- @exclude = []
347
+ @exclude = %w[
348
+ ~\z \.orig\z \.rej\z \.bak\z
349
+ \.gemspec\z
350
+ ]
348
351
  @files = nil
349
352
  @force_output = false
350
353
  @force_update = true
@@ -3,15 +3,15 @@ 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: <tt>rb_define_class,
7
- # rb_define_method</tt> and so on. It tries to find the corresponding
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
- # <tt>rb_define_method</tt> call. For example, you might write:
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. It will then use the comment from that
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: +method_name+]
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: <tt>ClassName::method_name<tt>]
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: <tt>ClassName#method_name<tt>]
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
  #
@@ -325,12 +324,100 @@ class RDoc::Parser::C < RDoc::Parser
325
324
  # Scans #content for rb_define_class, boot_defclass, rb_define_class_under
326
325
  # and rb_singleton_class
327
326
 
328
- def do_classes
329
- do_boot_defclass
330
- do_define_class
331
- do_define_class_under
332
- do_singleton_class
333
- do_struct_define_without_accessor
327
+ def do_classes_and_modules
328
+ do_boot_defclass if @file_name == "class.c"
329
+
330
+ @content.scan(
331
+ %r(
332
+ (?<var_name>[\w\.]+)\s* =
333
+ \s*rb_(?:
334
+ define_(?:
335
+ class(?: # rb_define_class(class_name_1, parent_name_1)
336
+ \s*\(
337
+ \s*"(?<class_name_1>\w+)",
338
+ \s*(?<parent_name_1>\w+)\s*
339
+ \)
340
+ |
341
+ _under\s*\( # rb_define_class_under(class_under, class_name2, parent_name2...)
342
+ \s* (?<class_under>\w+),
343
+ \s* "(?<class_name_2>\w+)",
344
+ \s*
345
+ (?:
346
+ (?<parent_name_2>[\w\*\s\(\)\.\->]+) |
347
+ rb_path2class\("(?<path>[\w:]+)"\)
348
+ )
349
+ \s*\)
350
+ )
351
+ |
352
+ module(?: # rb_define_module(module_name_1)
353
+ \s*\(
354
+ \s*"(?<module_name_1>\w+)"\s*
355
+ \)
356
+ |
357
+ _under\s*\( # rb_define_module_under(module_under, module_name_1)
358
+ \s*(?<module_under>\w+),
359
+ \s*"(?<module_name_2>\w+)"
360
+ \s*\)
361
+ )
362
+ )
363
+ |
364
+ struct_define_without_accessor\s*\( # rb_struct_define_without_accessor(class_name_3, parent_name_3, ...)
365
+ \s*"(?<class_name_3>\w+)",
366
+ \s*(?<parent_name_3>\w+),
367
+ \s*\w+, # Allocation function
368
+ (?:\s*"\w+",)* # Attributes
369
+ \s*NULL
370
+ \)
371
+ |
372
+ singleton_class\s*\( # rb_singleton_class(target_class_name)
373
+ \s*(?<target_class_name>\w+)
374
+ \)
375
+ )
376
+ )mx
377
+ ) do
378
+ class_name = $~[:class_name_1]
379
+ type = :class
380
+ if class_name
381
+ # rb_define_class(class_name_1, parent_name_1)
382
+ parent_name = $~[:parent_name_1]
383
+ #under = nil
384
+ else
385
+ class_name = $~[:class_name_2]
386
+ if class_name
387
+ # rb_define_class_under(class_under, class_name2, parent_name2...)
388
+ parent_name = $~[:parent_name_2] || $~[:path]
389
+ under = $~[:class_under]
390
+ else
391
+ class_name = $~[:class_name_3]
392
+ if class_name
393
+ # rb_struct_define_without_accessor(class_name_3, parent_name_3, ...)
394
+ parent_name = $~[:parent_name_3]
395
+ #under = nil
396
+ else
397
+ type = :module
398
+ class_name = $~[:module_name_1]
399
+ #parent_name = nil
400
+ if class_name
401
+ # rb_define_module(module_name_1)
402
+ #under = nil
403
+ else
404
+ class_name = $~[:module_name_2]
405
+ if class_name
406
+ # rb_define_module_under(module_under, module_name_1)
407
+ under = $~[:module_under]
408
+ else
409
+ # rb_singleton_class(target_class_name)
410
+ target_class_name = $~[:target_class_name]
411
+ handle_singleton $~[:var_name], target_class_name
412
+ next
413
+ end
414
+ end
415
+ end
416
+ end
417
+ end
418
+
419
+ handle_class_module($~[:var_name], type, class_name, parent_name, under)
420
+ end
334
421
  end
335
422
 
336
423
  ##
@@ -379,65 +466,6 @@ class RDoc::Parser::C < RDoc::Parser
379
466
  end
380
467
  end
381
468
 
382
- ##
383
- # Scans #content for rb_define_class
384
-
385
- def do_define_class
386
- # The '.' lets us handle SWIG-generated files
387
- @content.scan(/([\w\.]+)\s* = \s*rb_define_class\s*
388
- \(
389
- \s*"(\w+)",
390
- \s*(\w+)\s*
391
- \)/mx) do |var_name, class_name, parent|
392
- handle_class_module(var_name, :class, class_name, parent, nil)
393
- end
394
- end
395
-
396
- ##
397
- # Scans #content for rb_define_class_under
398
-
399
- def do_define_class_under
400
- @content.scan(/([\w\.]+)\s* = # var_name
401
- \s*rb_define_class_under\s*
402
- \(
403
- \s* (\w+), # under
404
- \s* "(\w+)", # class_name
405
- \s*
406
- (?:
407
- ([\w\*\s\(\)\.\->]+) | # parent_name
408
- rb_path2class\("([\w:]+)"\) # path
409
- )
410
- \s*
411
- \)
412
- /mx) do |var_name, under, class_name, parent_name, path|
413
- parent = path || parent_name
414
-
415
- handle_class_module var_name, :class, class_name, parent, under
416
- end
417
- end
418
-
419
- ##
420
- # Scans #content for rb_define_module
421
-
422
- def do_define_module
423
- @content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
424
- |var_name, class_name|
425
- handle_class_module(var_name, :module, class_name, nil, nil)
426
- end
427
- end
428
-
429
- ##
430
- # Scans #content for rb_define_module_under
431
-
432
- def do_define_module_under
433
- @content.scan(/(\w+)\s* = \s*rb_define_module_under\s*
434
- \(
435
- \s*(\w+),
436
- \s*"(\w+)"
437
- \s*\)/mx) do |var_name, in_module, class_name|
438
- handle_class_module(var_name, :module, class_name, nil, in_module)
439
- end
440
- end
441
469
 
442
470
  ##
443
471
  # Scans #content for rb_include_module
@@ -447,7 +475,7 @@ class RDoc::Parser::C < RDoc::Parser
447
475
  next unless cls = @classes[c]
448
476
  m = @known_classes[m] || m
449
477
 
450
- comment = RDoc::Comment.new '', @top_level
478
+ comment = RDoc::Comment.new '', @top_level, :c
451
479
  incl = cls.add_include RDoc::Include.new(m, comment)
452
480
  incl.record_location @top_level
453
481
  end
@@ -519,42 +547,6 @@ class RDoc::Parser::C < RDoc::Parser
519
547
  end
520
548
  end
521
549
 
522
- ##
523
- # Scans #content for rb_define_module and rb_define_module_under
524
-
525
- def do_modules
526
- do_define_module
527
- do_define_module_under
528
- end
529
-
530
- ##
531
- # Scans #content for rb_singleton_class
532
-
533
- def do_singleton_class
534
- @content.scan(/([\w\.]+)\s* = \s*rb_singleton_class\s*
535
- \(
536
- \s*(\w+)
537
- \s*\)/mx) do |sclass_var, class_var|
538
- handle_singleton sclass_var, class_var
539
- end
540
- end
541
-
542
- ##
543
- # Scans #content for struct_define_without_accessor
544
-
545
- def do_struct_define_without_accessor
546
- @content.scan(/([\w\.]+)\s* = \s*rb_struct_define_without_accessor\s*
547
- \(
548
- \s*"(\w+)", # Class name
549
- \s*(\w+), # Parent class
550
- \s*\w+, # Allocation function
551
- (\s*"\w+",)* # Attributes
552
- \s*NULL
553
- \)/mx) do |var_name, class_name, parent|
554
- handle_class_module(var_name, :class, class_name, parent, nil)
555
- end
556
- end
557
-
558
550
  ##
559
551
  # Finds the comment for an alias on +class_name+ from +new_name+ to
560
552
  # +old_name+
@@ -565,7 +557,7 @@ class RDoc::Parser::C < RDoc::Parser
565
557
  \s*"#{Regexp.escape new_name}"\s*,
566
558
  \s*"#{Regexp.escape old_name}"\s*\);%xm
567
559
 
568
- RDoc::Comment.new($1 || '', @top_level)
560
+ RDoc::Comment.new($1 || '', @top_level, :c)
569
561
  end
570
562
 
571
563
  ##
@@ -604,7 +596,7 @@ class RDoc::Parser::C < RDoc::Parser
604
596
  ''
605
597
  end
606
598
 
607
- RDoc::Comment.new comment, @top_level
599
+ RDoc::Comment.new comment, @top_level, :c
608
600
  end
609
601
 
610
602
  ##
@@ -644,7 +636,7 @@ class RDoc::Parser::C < RDoc::Parser
644
636
 
645
637
  case type
646
638
  when :func_def
647
- comment = RDoc::Comment.new args[0], @top_level
639
+ comment = RDoc::Comment.new args[0], @top_level, :c
648
640
  body = args[1]
649
641
  offset, = args[2]
650
642
 
@@ -674,7 +666,7 @@ class RDoc::Parser::C < RDoc::Parser
674
666
 
675
667
  body
676
668
  when :macro_def
677
- comment = RDoc::Comment.new args[0], @top_level
669
+ comment = RDoc::Comment.new args[0], @top_level, :c
678
670
  body = args[1]
679
671
  offset, = args[2]
680
672
 
@@ -781,7 +773,7 @@ class RDoc::Parser::C < RDoc::Parser
781
773
  comment = ''
782
774
  end
783
775
 
784
- comment = RDoc::Comment.new comment, @top_level
776
+ comment = RDoc::Comment.new comment, @top_level, :c
785
777
  comment.normalize
786
778
 
787
779
  look_for_directives_in class_mod, comment
@@ -826,7 +818,7 @@ class RDoc::Parser::C < RDoc::Parser
826
818
  table[const_name] ||
827
819
  ''
828
820
 
829
- RDoc::Comment.new comment, @top_level
821
+ RDoc::Comment.new comment, @top_level, :c
830
822
  end
831
823
 
832
824
  ##
@@ -857,7 +849,7 @@ class RDoc::Parser::C < RDoc::Parser
857
849
 
858
850
  return unless comment
859
851
 
860
- RDoc::Comment.new comment, @top_level
852
+ RDoc::Comment.new comment, @top_level, :c
861
853
  end
862
854
 
863
855
  ##
@@ -953,7 +945,7 @@ class RDoc::Parser::C < RDoc::Parser
953
945
  # can override the C value of the comment to give a friendly definition.
954
946
  #
955
947
  # /* 300: The perfect score in bowling */
956
- # rb_define_const(cFoo, "PERFECT", INT2FIX(300);
948
+ # rb_define_const(cFoo, "PERFECT", INT2FIX(300));
957
949
  #
958
950
  # Will override <tt>INT2FIX(300)</tt> with the value +300+ in the output
959
951
  # RDoc. Values may include quotes and escaped colons (\:).
@@ -991,7 +983,7 @@ class RDoc::Parser::C < RDoc::Parser
991
983
 
992
984
  new_comment = "#{$1}#{new_comment.lstrip}"
993
985
 
994
- new_comment = RDoc::Comment.new new_comment, @top_level
986
+ new_comment = RDoc::Comment.new new_comment, @top_level, :c
995
987
 
996
988
  con = RDoc::Constant.new const_name, new_definition, new_comment
997
989
  else
@@ -1248,8 +1240,7 @@ class RDoc::Parser::C < RDoc::Parser
1248
1240
  def scan
1249
1241
  remove_commented_out_lines
1250
1242
 
1251
- do_modules
1252
- do_classes
1243
+ do_classes_and_modules
1253
1244
  do_missing
1254
1245
 
1255
1246
  do_constants
@@ -1266,4 +1257,3 @@ class RDoc::Parser::C < RDoc::Parser
1266
1257
  end
1267
1258
 
1268
1259
  end
1269
-