rdoc 6.0.4 → 6.1.0.beta1

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.

@@ -8,8 +8,6 @@
8
8
  # by Keiju ISHITSUKA (Nippon Rational Inc.)
9
9
  #
10
10
 
11
- $TOKEN_DEBUG ||= nil
12
-
13
11
  ##
14
12
  # Extracts code elements from a source file returning a TopLevel object
15
13
  # containing the constituent file elements.
@@ -141,6 +139,7 @@ $TOKEN_DEBUG ||= nil
141
139
  # standard rdocable item following it.
142
140
 
143
141
  require 'ripper'
142
+ require_relative 'ripper_state_lex'
144
143
 
145
144
  class RDoc::Parser::Ruby < RDoc::Parser
146
145
 
@@ -178,7 +177,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
178
177
  @size = 0
179
178
  @token_listeners = nil
180
179
  content = RDoc::Encoding.remove_magic_comment content
181
- @scanner = RDoc::RipperStateLex.parse(content)
180
+ @scanner = RDoc::Parser::RipperStateLex.parse(content)
182
181
  @content = content
183
182
  @scanner_point = 0
184
183
  @prev_seek = nil
@@ -249,10 +248,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
249
248
  tk = get_tk
250
249
 
251
250
  while tk && (:on_comment == tk[:kind] or :on_embdoc == tk[:kind])
252
- if first_line and tk[:text] =~ /\A#!/ then
251
+ comment_body = retrieve_comment_body(tk)
252
+ if first_line and comment_body =~ /\A#!/ then
253
253
  skip_tkspace
254
254
  tk = get_tk
255
- elsif first_line and tk[:text] =~ /\A#\s*-\*-/ then
255
+ elsif first_line and comment_body =~ /\A#\s*-\*-/ then
256
256
  first_line = false
257
257
  skip_tkspace
258
258
  tk = get_tk
@@ -261,11 +261,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
261
261
  first_comment_tk_kind = tk[:kind]
262
262
 
263
263
  first_line = false
264
- comment << tk[:text]
264
+ comment << comment_body
265
265
  tk = get_tk
266
266
 
267
267
  if :on_nl === tk then
268
- skip_tkspace false
268
+ skip_tkspace_without_nl
269
269
  tk = get_tk
270
270
  end
271
271
  end
@@ -280,7 +280,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
280
280
  # Consumes trailing whitespace from the token stream
281
281
 
282
282
  def consume_trailing_spaces # :nodoc:
283
- skip_tkspace false
283
+ skip_tkspace_without_nl
284
284
  end
285
285
 
286
286
  ##
@@ -352,7 +352,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
352
352
  given_name << '::'
353
353
  end
354
354
 
355
- skip_tkspace false
355
+ skip_tkspace_without_nl
356
356
  given_name << name_t[:text]
357
357
 
358
358
  is_self = name_t[:kind] == :on_op && name_t[:text] == '<<'
@@ -376,7 +376,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
376
376
  record_location container
377
377
 
378
378
  get_tk
379
- skip_tkspace false
379
+ skip_tkspace_without_nl
380
380
  name_t = get_tk
381
381
  unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]
382
382
  raise RDoc::Error, "Invalid class or module definition: #{given_name}"
@@ -388,7 +388,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
388
388
  end
389
389
  end
390
390
 
391
- skip_tkspace false
391
+ skip_tkspace_without_nl
392
392
 
393
393
  return [container, name_t, given_name, new_modules]
394
394
  end
@@ -408,7 +408,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
408
408
 
409
409
  res = get_constant
410
410
 
411
- skip_tkspace false
411
+ skip_tkspace_without_nl
412
412
 
413
413
  get_tkread # empty out read buffer
414
414
 
@@ -431,7 +431,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
431
431
 
432
432
  def get_constant
433
433
  res = ""
434
- skip_tkspace false
434
+ skip_tkspace_without_nl
435
435
  tk = get_tk
436
436
 
437
437
  while tk && ((:on_op == tk[:kind] && '::' == tk[:text]) || :on_const == tk[:kind]) do
@@ -444,28 +444,83 @@ class RDoc::Parser::Ruby < RDoc::Parser
444
444
  end
445
445
 
446
446
  ##
447
- # Get a constant that may be surrounded by parens
447
+ # Get an included module that may be surrounded by parens
448
448
 
449
- def get_constant_with_optional_parens
450
- skip_tkspace false
449
+ def get_included_module_with_optional_parens
450
+ skip_tkspace_without_nl
451
+ get_tkread
452
+ tk = get_tk
453
+ end_token = get_end_token tk
454
+ return '' unless end_token
451
455
 
452
456
  nest = 0
457
+ continue = false
458
+ only_constant = true
453
459
 
454
- while :on_lparen == (tk = peek_tk)[:kind] do
455
- get_tk
456
- skip_tkspace
457
- nest += 1
458
- end
459
-
460
- name = get_constant
461
-
462
- while nest > 0
463
- skip_tkspace
460
+ while tk != nil do
461
+ is_element_of_constant = false
462
+ case tk[:kind]
463
+ when :on_semicolon then
464
+ break if nest == 0
465
+ when :on_lbracket then
466
+ nest += 1
467
+ when :on_rbracket then
468
+ nest -= 1
469
+ when :on_lbrace then
470
+ nest += 1
471
+ when :on_rbrace then
472
+ nest -= 1
473
+ if nest <= 0
474
+ # we might have a.each { |i| yield i }
475
+ unget_tk(tk) if nest < 0
476
+ break
477
+ end
478
+ when :on_lparen then
479
+ nest += 1
480
+ when end_token[:kind] then
481
+ if end_token[:kind] == :on_rparen
482
+ nest -= 1
483
+ break if nest <= 0
484
+ else
485
+ break if nest <= 0
486
+ end
487
+ when :on_rparen then
488
+ nest -= 1
489
+ when :on_comment, :on_embdoc then
490
+ @read.pop
491
+ if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
492
+ (!continue or (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0) then
493
+ break if !continue and nest <= 0
494
+ end
495
+ when :on_comma then
496
+ continue = true
497
+ when :on_ident then
498
+ continue = false if continue
499
+ when :on_kw then
500
+ case tk[:text]
501
+ when 'def', 'do', 'case', 'for', 'begin', 'class', 'module'
502
+ nest += 1
503
+ when 'if', 'unless', 'while', 'until', 'rescue'
504
+ # postfix if/unless/while/until/rescue must be EXPR_LABEL
505
+ nest += 1 unless (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0
506
+ when 'end'
507
+ nest -= 1
508
+ break if nest == 0
509
+ end
510
+ when :on_const then
511
+ is_element_of_constant = true
512
+ when :on_op then
513
+ is_element_of_constant = true if '::' == tk[:text]
514
+ end
515
+ only_constant = false unless is_element_of_constant
464
516
  tk = get_tk
465
- nest -= 1 if :on_rparen == tk[:kind]
466
517
  end
467
518
 
468
- name
519
+ if only_constant
520
+ get_tkread_clean(/\s+/, ' ')
521
+ else
522
+ ''
523
+ end
469
524
  end
470
525
 
471
526
  ##
@@ -479,17 +534,17 @@ class RDoc::Parser::Ruby < RDoc::Parser
479
534
  def get_end_token tk # :nodoc:
480
535
  case tk[:kind]
481
536
  when :on_lparen
482
- {
483
- :kind => :on_rparen,
484
- :text => ')'
485
- }
537
+ token = RDoc::Parser::RipperStateLex::Token.new
538
+ token[:kind] = :on_rparen
539
+ token[:text] = ')'
540
+ token
486
541
  when :on_rparen
487
542
  nil
488
543
  else
489
- {
490
- :kind => :on_nl,
491
- :text => "\n"
492
- }
544
+ token = RDoc::Parser::RipperStateLex::Token.new
545
+ token[:kind] = :on_nl
546
+ token[:text] = "\n"
547
+ token
493
548
  end
494
549
  end
495
550
 
@@ -628,7 +683,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
628
683
  if args.size > 0 then
629
684
  name = args[0]
630
685
  rw = "R"
631
- skip_tkspace false
686
+ skip_tkspace_without_nl
632
687
  tk = get_tk
633
688
 
634
689
  if :on_comma == tk[:kind] then
@@ -739,9 +794,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
739
794
  when end_token
740
795
  if end_token == :on_rparen
741
796
  nest -= 1
742
- break if RDoc::RipperStateLex.end?(tk) and nest <= 0
797
+ break if RDoc::Parser::RipperStateLex.end?(tk) and nest <= 0
743
798
  else
744
- break if RDoc::RipperStateLex.end?(tk)
799
+ break if RDoc::Parser::RipperStateLex.end?(tk)
745
800
  end
746
801
  when :on_comment, :on_embdoc
747
802
  unget_tk(tk)
@@ -878,7 +933,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
878
933
  line_no = tk[:line_no]
879
934
 
880
935
  name = tk[:text]
881
- skip_tkspace false
936
+ skip_tkspace_without_nl
882
937
 
883
938
  return unless name =~ /^\w+$/
884
939
 
@@ -904,7 +959,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
904
959
  break if nest == 0
905
960
  end
906
961
  end
907
- skip_tkspace false
962
+ skip_tkspace_without_nl
908
963
  is_array_or_hash = true
909
964
  end
910
965
 
@@ -959,7 +1014,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
959
1014
  elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then
960
1015
  nest += 1
961
1016
  elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then
962
- if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
1017
+ if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0
963
1018
  nest += 1
964
1019
  end
965
1020
  elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) ||
@@ -967,7 +1022,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
967
1022
  nest -= 1
968
1023
  elsif (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) then
969
1024
  unget_tk tk
970
- if nest <= 0 and RDoc::RipperStateLex.end?(tk) then
1025
+ if nest <= 0 and RDoc::Parser::RipperStateLex.end?(tk) then
971
1026
  body = get_tkread_clean(/^[ \t]+/, '')
972
1027
  read_documentation_modifiers constant, RDoc::CONSTANT_MODIFIERS
973
1028
  break
@@ -983,7 +1038,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
983
1038
  break
984
1039
  end
985
1040
  elsif :on_nl == tk[:kind] then
986
- if nest <= 0 and RDoc::RipperStateLex.end?(tk) then
1041
+ if nest <= 0 and RDoc::Parser::RipperStateLex.end?(tk) then
987
1042
  unget_tk tk
988
1043
  break
989
1044
  end
@@ -1047,10 +1102,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
1047
1102
  record_location meth
1048
1103
 
1049
1104
  meth.start_collecting_tokens
1050
- indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column }
1051
- position_comment = { :line_no => line_no, :char_no => 1, :kind => :on_comment }
1105
+ indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column)
1106
+ position_comment = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment)
1052
1107
  position_comment[:text] = "# File #{@top_level.relative_name}, line #{line_no}"
1053
- newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" }
1108
+ newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n")
1054
1109
  meth.add_tokens [position_comment, newline, indent]
1055
1110
 
1056
1111
  meth.params =
@@ -1090,10 +1145,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
1090
1145
  meth.line = line_no
1091
1146
 
1092
1147
  meth.start_collecting_tokens
1093
- indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column }
1094
- position_comment = { :line_no => line_no, :char_no => 1, :kind => :on_comment }
1148
+ indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column)
1149
+ position_comment = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment)
1095
1150
  position_comment[:text] = "# File #{@top_level.relative_name}, line #{line_no}"
1096
- newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" }
1151
+ newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n")
1097
1152
  meth.add_tokens [position_comment, newline, indent]
1098
1153
 
1099
1154
  meth.call_seq = signature
@@ -1117,7 +1172,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1117
1172
  loop do
1118
1173
  skip_tkspace_comment
1119
1174
 
1120
- name = get_constant_with_optional_parens
1175
+ name = get_included_module_with_optional_parens
1121
1176
 
1122
1177
  unless name.empty? then
1123
1178
  obj = container.add klass, name, comment
@@ -1241,7 +1296,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1241
1296
  add_token tk
1242
1297
  add_token_listener self
1243
1298
 
1244
- skip_tkspace false
1299
+ skip_tkspace_without_nl
1245
1300
 
1246
1301
  comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
1247
1302
  singleton = !!$~
@@ -1258,10 +1313,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
1258
1313
  remove_token_listener self
1259
1314
 
1260
1315
  meth.start_collecting_tokens
1261
- indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column }
1262
- position_comment = { :line_no => line_no, :char_no => 1, :kind => :on_comment }
1316
+ indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column)
1317
+ position_comment = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment)
1263
1318
  position_comment[:text] = "# File #{@top_level.relative_name}, line #{line_no}"
1264
- newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" }
1319
+ newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n")
1265
1320
  meth.add_tokens [position_comment, newline, indent]
1266
1321
  meth.add_tokens @token_stream
1267
1322
 
@@ -1361,10 +1416,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
1361
1416
  meth.line = line_no
1362
1417
 
1363
1418
  meth.start_collecting_tokens
1364
- indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column }
1365
- token = { :line_no => line_no, :char_no => 1, :kind => :on_comment }
1419
+ indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column)
1420
+ token = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment)
1366
1421
  token[:text] = "# File #{@top_level.relative_name}, line #{line_no}"
1367
- newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" }
1422
+ newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n")
1368
1423
  meth.add_tokens [token, newline, indent]
1369
1424
  meth.add_tokens @token_stream
1370
1425
 
@@ -1430,7 +1485,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1430
1485
  def parse_method_name container # :nodoc:
1431
1486
  skip_tkspace
1432
1487
  name_t = get_tk
1433
- back_tk = skip_tkspace(false)
1488
+ back_tk = skip_tkspace_without_nl
1434
1489
  singleton = false
1435
1490
 
1436
1491
  dot = get_tk
@@ -1518,7 +1573,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1518
1573
 
1519
1574
  def parse_method_or_yield_parameters(method = nil,
1520
1575
  modifiers = RDoc::METHOD_MODIFIERS)
1521
- skip_tkspace false
1576
+ skip_tkspace_without_nl
1522
1577
  tk = get_tk
1523
1578
  end_token = get_end_token tk
1524
1579
  return '' unless end_token
@@ -1530,6 +1585,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
1530
1585
  case tk[:kind]
1531
1586
  when :on_semicolon then
1532
1587
  break if nest == 0
1588
+ when :on_lbracket then
1589
+ nest += 1
1590
+ when :on_rbracket then
1591
+ nest -= 1
1533
1592
  when :on_lbrace then
1534
1593
  nest += 1
1535
1594
  when :on_rbrace then
@@ -1553,7 +1612,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1553
1612
  when :on_comment, :on_embdoc then
1554
1613
  @read.pop
1555
1614
  if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
1556
- (!continue or (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) != 0) then
1615
+ (!continue or (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0) then
1557
1616
  if method && method.block_params.nil? then
1558
1617
  unget_tk tk
1559
1618
  read_documentation_modifiers method, modifiers
@@ -1587,7 +1646,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1587
1646
 
1588
1647
  return if method.block_params
1589
1648
 
1590
- skip_tkspace false
1649
+ skip_tkspace_without_nl
1591
1650
  read_documentation_modifiers method, RDoc::METHOD_MODIFIERS
1592
1651
  end
1593
1652
 
@@ -1638,19 +1697,30 @@ class RDoc::Parser::Ruby < RDoc::Parser
1638
1697
  # Parses a rescue
1639
1698
 
1640
1699
  def parse_rescue
1641
- skip_tkspace false
1700
+ skip_tkspace_without_nl
1642
1701
 
1643
1702
  while tk = get_tk
1644
1703
  case tk[:kind]
1645
1704
  when :on_nl, :on_semicolon, :on_comment then
1646
1705
  break
1647
1706
  when :on_comma then
1648
- skip_tkspace false
1707
+ skip_tkspace_without_nl
1649
1708
 
1650
1709
  get_tk if :on_nl == peek_tk[:kind]
1651
1710
  end
1652
1711
 
1653
- skip_tkspace false
1712
+ skip_tkspace_without_nl
1713
+ end
1714
+ end
1715
+
1716
+ ##
1717
+ # Retrieve comment body without =begin/=end
1718
+
1719
+ def retrieve_comment_body(tk)
1720
+ if :on_embdoc == tk[:kind]
1721
+ tk[:text].gsub(/\A=begin.*\n/, '').gsub(/=end\n?\z/, '')
1722
+ else
1723
+ tk[:text]
1654
1724
  end
1655
1725
  end
1656
1726
 
@@ -1707,11 +1777,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
1707
1777
  end
1708
1778
 
1709
1779
  while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do
1710
- comment += tk[:text]
1711
- comment += "\n" unless "\n" == tk[:text].chars.to_a.last
1780
+ comment_body = retrieve_comment_body(tk)
1781
+ comment += comment_body
1782
+ comment += "\n" unless "\n" == comment_body.chars.to_a.last
1712
1783
 
1713
- if tk[:text].size > 1 && "\n" == tk[:text].chars.to_a.last then
1714
- skip_tkspace false # leading spaces
1784
+ if comment_body.size > 1 && "\n" == comment_body.chars.to_a.last then
1785
+ skip_tkspace_without_nl # leading spaces
1715
1786
  end
1716
1787
  tk = get_tk
1717
1788
  end
@@ -1758,7 +1829,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1758
1829
  end
1759
1830
 
1760
1831
  when 'until', 'while' then
1761
- if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
1832
+ if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0
1762
1833
  nest += 1
1763
1834
  skip_optional_do_after_expression
1764
1835
  end
@@ -1774,7 +1845,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1774
1845
  skip_optional_do_after_expression
1775
1846
 
1776
1847
  when 'case', 'do', 'if', 'unless', 'begin' then
1777
- if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
1848
+ if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0
1778
1849
  nest += 1
1779
1850
  end
1780
1851
 
@@ -1895,7 +1966,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1895
1966
  end
1896
1967
 
1897
1968
  loop do
1898
- skip_tkspace false
1969
+ skip_tkspace_without_nl
1899
1970
 
1900
1971
  tk1 = get_tk
1901
1972
  if tk1.nil? || :on_comma != tk1[:kind] then
@@ -2044,7 +2115,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2044
2115
  # See also RDoc::Markup::PreProcess#handle_directive
2045
2116
 
2046
2117
  def read_documentation_modifiers context, allowed
2047
- skip_tkspace(false)
2118
+ skip_tkspace_without_nl
2048
2119
  directive, value = read_directive allowed
2049
2120
 
2050
2121
  return unless directive
@@ -2122,7 +2193,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2122
2193
  # while, until, and for have an optional do
2123
2194
 
2124
2195
  def skip_optional_do_after_expression
2125
- skip_tkspace false
2196
+ skip_tkspace_without_nl
2126
2197
  tk = get_tk
2127
2198
 
2128
2199
  b_nest = 0
@@ -2154,7 +2225,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2154
2225
  tk = get_tk
2155
2226
  end
2156
2227
 
2157
- skip_tkspace false
2228
+ skip_tkspace_without_nl
2158
2229
 
2159
2230
  get_tk if peek_tk && :on_kw == peek_tk[:kind] && 'do' == peek_tk[:text]
2160
2231
  end
@@ -2163,9 +2234,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
2163
2234
  # skip the var [in] part of a 'for' statement
2164
2235
 
2165
2236
  def skip_for_variable
2166
- skip_tkspace false
2237
+ skip_tkspace_without_nl
2167
2238
  get_tk
2168
- skip_tkspace false
2239
+ skip_tkspace_without_nl
2169
2240
  tk = get_tk
2170
2241
  unget_tk(tk) unless :on_kw == tk[:kind] and 'in' == tk[:text]
2171
2242
  end
@@ -2184,7 +2255,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2184
2255
 
2185
2256
  def skip_tkspace_comment(skip_nl = true)
2186
2257
  loop do
2187
- skip_tkspace skip_nl
2258
+ skip_nl ? skip_tkspace : skip_tkspace_without_nl
2188
2259
  next_tk = peek_tk
2189
2260
  return if next_tk.nil? || (:on_comment != next_tk[:kind] and :on_embdoc != next_tk[:kind])
2190
2261
  get_tk