rdoc 6.0.0.beta3 → 6.0.0.beta4
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/Rakefile +5 -2
- data/lib/rdoc.rb +2 -3
- data/lib/rdoc/alias.rb +1 -1
- data/lib/rdoc/anon_class.rb +1 -1
- data/lib/rdoc/any_method.rb +7 -7
- data/lib/rdoc/attr.rb +1 -1
- data/lib/rdoc/class_module.rb +4 -2
- data/lib/rdoc/code_object.rb +2 -2
- data/lib/rdoc/code_objects.rb +1 -1
- data/lib/rdoc/comment.rb +20 -10
- data/lib/rdoc/constant.rb +1 -1
- data/lib/rdoc/context.rb +3 -3
- data/lib/rdoc/context/section.rb +2 -2
- data/lib/rdoc/cross_reference.rb +1 -1
- data/lib/rdoc/encoding.rb +40 -18
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +1 -1
- data/lib/rdoc/extend.rb +1 -1
- data/lib/rdoc/generator.rb +1 -1
- data/lib/rdoc/generator/darkfish.rb +48 -21
- data/lib/rdoc/generator/json_index.rb +2 -2
- data/lib/rdoc/generator/markup.rb +1 -1
- data/lib/rdoc/generator/pot.rb +1 -1
- 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/ri.rb +1 -1
- data/lib/rdoc/ghost_method.rb +1 -1
- data/lib/rdoc/i18n.rb +1 -1
- data/lib/rdoc/i18n/locale.rb +1 -1
- data/lib/rdoc/i18n/text.rb +5 -5
- data/lib/rdoc/include.rb +1 -1
- data/lib/rdoc/known_classes.rb +1 -1
- data/lib/rdoc/markdown.kpeg +71 -41
- data/lib/rdoc/markdown/entities.rb +1 -1
- data/lib/rdoc/markdown/literals.kpeg +1 -0
- data/lib/rdoc/markdown/literals.rb +18 -7
- data/lib/rdoc/markup.rb +1 -1
- data/lib/rdoc/markup/attr_changer.rb +1 -1
- data/lib/rdoc/markup/attr_span.rb +1 -1
- data/lib/rdoc/markup/attribute_manager.rb +2 -2
- data/lib/rdoc/markup/attributes.rb +1 -1
- 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 +1 -1
- data/lib/rdoc/markup/formatter_test_case.rb +1 -1
- data/lib/rdoc/markup/hard_break.rb +1 -1
- data/lib/rdoc/markup/heading.rb +1 -1
- data/lib/rdoc/markup/include.rb +1 -1
- data/lib/rdoc/markup/indented_paragraph.rb +1 -1
- data/lib/rdoc/markup/inline.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 +3 -3
- data/lib/rdoc/markup/pre_process.rb +9 -5
- data/lib/rdoc/markup/raw.rb +1 -1
- data/lib/rdoc/markup/rule.rb +1 -1
- data/lib/rdoc/markup/special.rb +1 -1
- data/lib/rdoc/markup/text_formatter_test_case.rb +1 -1
- data/lib/rdoc/markup/to_ansi.rb +1 -1
- data/lib/rdoc/markup/to_bs.rb +1 -1
- data/lib/rdoc/markup/to_html.rb +1 -1
- data/lib/rdoc/markup/to_html_crossref.rb +1 -1
- data/lib/rdoc/markup/to_html_snippet.rb +1 -1
- data/lib/rdoc/markup/to_joined_paragraph.rb +6 -32
- data/lib/rdoc/markup/to_label.rb +1 -1
- data/lib/rdoc/markup/to_markdown.rb +1 -1
- data/lib/rdoc/markup/to_rdoc.rb +1 -1
- data/lib/rdoc/markup/to_table_of_contents.rb +1 -1
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +1 -1
- data/lib/rdoc/markup/verbatim.rb +1 -1
- 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 +6 -6
- data/lib/rdoc/parser.rb +1 -1
- data/lib/rdoc/parser/c.rb +6 -6
- data/lib/rdoc/parser/changelog.rb +5 -5
- data/lib/rdoc/parser/markdown.rb +1 -1
- data/lib/rdoc/parser/rd.rb +1 -1
- data/lib/rdoc/parser/ripper_state_lex.rb +26 -8
- data/lib/rdoc/parser/ruby.rb +36 -42
- data/lib/rdoc/parser/ruby_tools.rb +2 -3
- data/lib/rdoc/parser/simple.rb +3 -3
- data/lib/rdoc/parser/text.rb +1 -1
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rd/block_parser.ry +2 -2
- data/lib/rdoc/rd/inline.rb +5 -5
- data/lib/rdoc/rd/inline_parser.ry +1 -1
- data/lib/rdoc/rdoc.rb +12 -7
- data/lib/rdoc/require.rb +1 -1
- data/lib/rdoc/ri.rb +1 -1
- data/lib/rdoc/ri/driver.rb +1 -1
- data/lib/rdoc/ri/formatter.rb +1 -1
- data/lib/rdoc/ri/paths.rb +1 -1
- data/lib/rdoc/ri/store.rb +1 -1
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +1 -1
- data/lib/rdoc/servlet.rb +2 -2
- data/lib/rdoc/single_class.rb +1 -1
- data/lib/rdoc/stats.rb +1 -1
- data/lib/rdoc/stats/normal.rb +2 -2
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +1 -1
- data/lib/rdoc/store.rb +1 -1
- data/lib/rdoc/task.rb +1 -1
- data/lib/rdoc/test_case.rb +3 -4
- data/lib/rdoc/text.rb +7 -7
- data/lib/rdoc/token_stream.rb +15 -7
- data/lib/rdoc/tom_doc.rb +2 -2
- data/lib/rdoc/top_level.rb +1 -1
- data/rdoc.gemspec +3 -3
- metadata +3 -3
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
|
|
@@ -624,16 +624,16 @@ Usage: #{opt.program_name} [options] [names...]
|
|
624
624
|
end
|
625
625
|
|
626
626
|
parsers.sort.each do |parser, regexp|
|
627
|
-
opt.banner
|
627
|
+
opt.banner += " - #{parser}: #{regexp.join ', '}\n"
|
628
628
|
end
|
629
|
-
opt.banner
|
629
|
+
opt.banner += " - TomDoc: Only in ruby files\n"
|
630
630
|
|
631
|
-
opt.banner
|
631
|
+
opt.banner += "\n The following options are deprecated:\n\n"
|
632
632
|
|
633
633
|
name_length = DEPRECATED.keys.sort_by { |k| k.length }.last.length
|
634
634
|
|
635
635
|
DEPRECATED.sort_by { |k,| k }.each do |name, reason|
|
636
|
-
opt.banner
|
636
|
+
opt.banner += " %*1$2$s %3$s\n" % [-name_length, name, reason]
|
637
637
|
end
|
638
638
|
|
639
639
|
opt.accept Template do |template|
|
@@ -1087,7 +1087,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
1087
1087
|
|
1088
1088
|
unless quiet then
|
1089
1089
|
deprecated.each do |opt|
|
1090
|
-
$stderr.puts 'option '
|
1090
|
+
$stderr.puts 'option ' + opt + ' is deprecated: ' + DEPRECATED[opt]
|
1091
1091
|
end
|
1092
1092
|
end
|
1093
1093
|
|
data/lib/rdoc/parser.rb
CHANGED
data/lib/rdoc/parser/c.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'tsort'
|
3
3
|
|
4
4
|
##
|
@@ -865,8 +865,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|
865
865
|
|
866
866
|
def handle_attr(var_name, attr_name, read, write)
|
867
867
|
rw = ''
|
868
|
-
rw
|
869
|
-
rw
|
868
|
+
rw += 'R' if '1' == read
|
869
|
+
rw += 'W' if '1' == write
|
870
870
|
|
871
871
|
class_name = @known_classes[var_name]
|
872
872
|
|
@@ -982,8 +982,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|
982
982
|
if new_definition.empty? then # Default to literal C definition
|
983
983
|
new_definition = definition
|
984
984
|
else
|
985
|
-
new_definition.gsub
|
986
|
-
new_definition.gsub
|
985
|
+
new_definition = new_definition.gsub("\:", ":")
|
986
|
+
new_definition = new_definition.gsub("\\", '\\')
|
987
987
|
end
|
988
988
|
|
989
989
|
new_definition.sub!(/\A(\s+)/, '')
|
@@ -1237,7 +1237,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1237
1237
|
# when scanning for classes and methods
|
1238
1238
|
|
1239
1239
|
def remove_commented_out_lines
|
1240
|
-
@content.gsub
|
1240
|
+
@content = @content.gsub(%r%//.*rb_define_%, '//')
|
1241
1241
|
end
|
1242
1242
|
|
1243
1243
|
##
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'time'
|
3
3
|
|
4
4
|
##
|
@@ -29,13 +29,13 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
29
29
|
|
30
30
|
if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then
|
31
31
|
last.sub!(/\)\s*\z/, ',')
|
32
|
-
continuation.sub
|
32
|
+
continuation = continuation.sub(/\A\(/, '')
|
33
33
|
end
|
34
34
|
|
35
35
|
if last =~ /\s\z/ then
|
36
36
|
last << continuation
|
37
37
|
else
|
38
|
-
last << ' '
|
38
|
+
last << ' ' + continuation
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -162,12 +162,12 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
162
162
|
|
163
163
|
entry_body = []
|
164
164
|
when /^(\t| {8})?\*\s*(.*)/ then # "\t* file.c (func): ..."
|
165
|
-
entry_body << $2
|
165
|
+
entry_body << $2.dup
|
166
166
|
when /^(\t| {8})?\s*(\(.*)/ then # "\t(func): ..."
|
167
167
|
entry = $2
|
168
168
|
|
169
169
|
if entry_body.last =~ /:/ then
|
170
|
-
entry_body << entry
|
170
|
+
entry_body << entry.dup
|
171
171
|
else
|
172
172
|
continue_entry_body entry_body, entry
|
173
173
|
end
|
data/lib/rdoc/parser/markdown.rb
CHANGED
data/lib/rdoc/parser/rd.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'ripper'
|
2
2
|
|
3
3
|
class RDoc::RipperStateLex
|
4
|
+
# TODO: Remove this constants after Ruby 2.4 EOL
|
5
|
+
RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state)
|
6
|
+
|
4
7
|
EXPR_NONE = 0
|
5
8
|
EXPR_BEG = 1
|
6
9
|
EXPR_END = 2
|
@@ -283,7 +286,22 @@ class RDoc::RipperStateLex
|
|
283
286
|
@callback = block
|
284
287
|
parse
|
285
288
|
end
|
286
|
-
end
|
289
|
+
end unless RIPPER_HAS_LEX_STATE
|
290
|
+
|
291
|
+
class InnerStateLex < Ripper::Filter
|
292
|
+
def initialize(code)
|
293
|
+
super(code)
|
294
|
+
end
|
295
|
+
|
296
|
+
def on_default(event, tok, data)
|
297
|
+
@callback.call({ :line_no => lineno, :char_no => column, :kind => event, :text => tok, :state => state})
|
298
|
+
end
|
299
|
+
|
300
|
+
def each(&block)
|
301
|
+
@callback = block
|
302
|
+
parse
|
303
|
+
end
|
304
|
+
end if RIPPER_HAS_LEX_STATE
|
287
305
|
|
288
306
|
def get_squashed_tk
|
289
307
|
if @buf.empty?
|
@@ -297,10 +315,10 @@ class RDoc::RipperStateLex
|
|
297
315
|
when :on_tstring_beg then
|
298
316
|
tk = get_string_tk(tk)
|
299
317
|
when :on_backtick then
|
300
|
-
if (
|
301
|
-
@inner_lex.lex_state = EXPR_ARG
|
318
|
+
if (tk[:state] & (EXPR_FNAME | EXPR_ENDFN)) != 0
|
319
|
+
@inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE
|
302
320
|
tk[:kind] = :on_ident
|
303
|
-
tk[:state] =
|
321
|
+
tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG
|
304
322
|
else
|
305
323
|
tk = get_string_tk(tk)
|
306
324
|
end
|
@@ -310,7 +328,7 @@ class RDoc::RipperStateLex
|
|
310
328
|
tk = get_embdoc_tk(tk)
|
311
329
|
when :on_heredoc_beg then
|
312
330
|
@heredoc_queue << retrieve_heredoc_info(tk)
|
313
|
-
@inner_lex.lex_state = EXPR_END
|
331
|
+
@inner_lex.lex_state = EXPR_END unless RIPPER_HAS_LEX_STATE
|
314
332
|
when :on_nl, :on_ignored_nl, :on_comment, :on_heredoc_end then
|
315
333
|
unless @heredoc_queue.empty?
|
316
334
|
get_heredoc_tk(*@heredoc_queue.shift)
|
@@ -540,10 +558,10 @@ class RDoc::RipperStateLex
|
|
540
558
|
|
541
559
|
private def get_op_tk(tk)
|
542
560
|
redefinable_operators = %w[! != !~ % & * ** + +@ - -@ / < << <= <=> == === =~ > >= >> [] []= ^ ` | ~]
|
543
|
-
if redefinable_operators.include?(tk[:text]) and
|
544
|
-
@inner_lex.lex_state = EXPR_ARG
|
561
|
+
if redefinable_operators.include?(tk[:text]) and tk[:state] == EXPR_ARG then
|
562
|
+
@inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE
|
563
|
+
tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG
|
545
564
|
tk[:kind] = :on_ident
|
546
|
-
tk[:state] = @inner_lex.lex_state
|
547
565
|
elsif tk[:text] =~ /^[-+]$/ then
|
548
566
|
tk_ahead = get_squashed_tk
|
549
567
|
case tk_ahead[:kind]
|
data/lib/rdoc/parser/ruby.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# This file contains stuff stolen outright from:
|
4
4
|
#
|
@@ -239,8 +239,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
239
239
|
|
240
240
|
def collect_first_comment
|
241
241
|
skip_tkspace
|
242
|
-
comment = ''
|
243
|
-
comment.
|
242
|
+
comment = ''.dup
|
243
|
+
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
244
244
|
first_line = true
|
245
245
|
first_comment_tk_kind = nil
|
246
246
|
|
@@ -318,8 +318,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
318
318
|
end
|
319
319
|
|
320
320
|
##
|
321
|
-
# Looks for a true or false token.
|
322
|
-
# found.
|
321
|
+
# Looks for a true or false token.
|
323
322
|
|
324
323
|
def get_bool
|
325
324
|
skip_tkspace
|
@@ -342,7 +341,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
342
341
|
def get_class_or_module container, ignore_constants = false
|
343
342
|
skip_tkspace
|
344
343
|
name_t = get_tk
|
345
|
-
given_name = ''
|
344
|
+
given_name = ''.dup
|
346
345
|
|
347
346
|
# class ::A -> A is in the top level
|
348
347
|
if :on_op == name_t[:kind] and '::' == name_t[:text] then # bug
|
@@ -379,7 +378,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
379
378
|
if prev_container == container and !ignore_constants
|
380
379
|
given_name = name_t[:text]
|
381
380
|
else
|
382
|
-
given_name << '::'
|
381
|
+
given_name << '::' + name_t[:text]
|
383
382
|
end
|
384
383
|
end
|
385
384
|
|
@@ -574,27 +573,28 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
574
573
|
#
|
575
574
|
# This routine modifies its +comment+ parameter.
|
576
575
|
|
577
|
-
def look_for_directives_in
|
578
|
-
@preprocess.handle comment,
|
576
|
+
def look_for_directives_in container, comment
|
577
|
+
@preprocess.handle comment, container do |directive, param|
|
579
578
|
case directive
|
580
579
|
when 'method', 'singleton-method',
|
581
580
|
'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then
|
582
581
|
false # handled elsewhere
|
583
582
|
when 'section' then
|
584
|
-
|
583
|
+
break unless container.kind_of?(RDoc::Context)
|
584
|
+
container.set_current_section param, comment.dup
|
585
585
|
comment.text = ''
|
586
586
|
break
|
587
587
|
end
|
588
588
|
end
|
589
589
|
|
590
|
-
|
590
|
+
comment.remove_private
|
591
591
|
end
|
592
592
|
|
593
593
|
##
|
594
594
|
# Adds useful info about the parser to +message+
|
595
595
|
|
596
596
|
def make_message message
|
597
|
-
prefix = "#{@file_name}:"
|
597
|
+
prefix = "#{@file_name}:".dup
|
598
598
|
|
599
599
|
tk = peek_tk
|
600
600
|
prefix << "#{tk[:line_no]}:#{tk[:char_no]}:" if tk
|
@@ -913,7 +913,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
913
913
|
|
914
914
|
return unless body
|
915
915
|
|
916
|
-
value
|
916
|
+
con.value = body
|
917
917
|
record_location con
|
918
918
|
con.line = line_no
|
919
919
|
read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
|
@@ -928,7 +928,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
928
928
|
|
929
929
|
def parse_constant_body container, constant, is_array_or_hash # :nodoc:
|
930
930
|
nest = 0
|
931
|
-
rhs_name = ''
|
931
|
+
rhs_name = ''.dup
|
932
932
|
|
933
933
|
get_tkread
|
934
934
|
|
@@ -944,7 +944,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
944
944
|
elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then
|
945
945
|
nest += 1
|
946
946
|
elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then
|
947
|
-
if (RDoc::RipperStateLex::EXPR_LABEL
|
947
|
+
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
|
948
948
|
nest += 1
|
949
949
|
end
|
950
950
|
elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) ||
|
@@ -990,14 +990,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
990
990
|
column = tk[:char_no]
|
991
991
|
line_no = tk[:line_no]
|
992
992
|
|
993
|
-
text = comment.text
|
994
|
-
|
995
|
-
singleton = !!text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
993
|
+
comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
994
|
+
singleton = !!$~
|
996
995
|
|
997
996
|
co =
|
998
|
-
if text.sub
|
999
|
-
parse_comment_ghost container, text, $1, column, line_no, comment
|
1000
|
-
elsif text.sub
|
997
|
+
if (comment.text = comment.text.sub(/^# +:?method: *(\S*).*?\n/i, '')) && !!$~ then
|
998
|
+
parse_comment_ghost container, comment.text, $1, column, line_no, comment
|
999
|
+
elsif (comment.text = comment.text.sub(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '')) && !!$~ then
|
1001
1000
|
parse_comment_attr container, $1, $3, comment
|
1002
1001
|
end
|
1003
1002
|
|
@@ -1194,7 +1193,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1194
1193
|
tmp = RDoc::CodeObject.new
|
1195
1194
|
read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS
|
1196
1195
|
|
1197
|
-
|
1196
|
+
regexp = /^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i
|
1197
|
+
if regexp =~ comment.text then
|
1198
|
+
comment.text = comment.text.sub(regexp, '')
|
1198
1199
|
rw = case $1
|
1199
1200
|
when 'attr_reader' then 'R'
|
1200
1201
|
when 'attr_writer' then 'W'
|
@@ -1227,7 +1228,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1227
1228
|
|
1228
1229
|
skip_tkspace false
|
1229
1230
|
|
1230
|
-
|
1231
|
+
comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
1232
|
+
singleton = !!$~
|
1231
1233
|
|
1232
1234
|
name = parse_meta_method_name comment, tk
|
1233
1235
|
|
@@ -1290,6 +1292,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1290
1292
|
token_listener meth do
|
1291
1293
|
meth.params = ''
|
1292
1294
|
|
1295
|
+
look_for_directives_in meth, comment
|
1293
1296
|
comment.normalize
|
1294
1297
|
comment.extract_call_seq meth
|
1295
1298
|
|
@@ -1336,6 +1339,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1336
1339
|
return unless name
|
1337
1340
|
|
1338
1341
|
meth = RDoc::AnyMethod.new get_tkread, name
|
1342
|
+
look_for_directives_in meth, comment
|
1339
1343
|
meth.singleton = single == SINGLE ? true : singleton
|
1340
1344
|
|
1341
1345
|
record_location meth
|
@@ -1458,8 +1462,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1458
1462
|
name_t2 = get_tk
|
1459
1463
|
|
1460
1464
|
if (:on_kw == name_t[:kind] && 'self' == name_t[:text]) || (:on_op == name_t[:kind] && '%' == name_t[:text]) then
|
1461
|
-
# NOTE: work around '[' being consumed early
|
1462
|
-
# as a TkAREF
|
1465
|
+
# NOTE: work around '[' being consumed early
|
1463
1466
|
if :on_lbracket == name_t2[:kind]
|
1464
1467
|
get_tk
|
1465
1468
|
name = '[]'
|
@@ -1535,7 +1538,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1535
1538
|
when :on_comment, :on_embdoc then
|
1536
1539
|
@read.pop
|
1537
1540
|
if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
|
1538
|
-
(!continue or (RDoc::RipperStateLex::EXPR_LABEL
|
1541
|
+
(!continue or (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) != 0) then
|
1539
1542
|
if method && method.block_params.nil? then
|
1540
1543
|
unget_tk tk
|
1541
1544
|
read_documentation_modifiers method, modifiers
|
@@ -1642,7 +1645,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1642
1645
|
def parse_statements(container, single = NORMAL, current_method = nil,
|
1643
1646
|
comment = new_comment(''))
|
1644
1647
|
raise 'no' unless RDoc::Comment === comment
|
1645
|
-
comment.
|
1648
|
+
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
1646
1649
|
|
1647
1650
|
nest = 1
|
1648
1651
|
save_visibility = container.visibility
|
@@ -1685,12 +1688,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1685
1688
|
comment.empty?
|
1686
1689
|
|
1687
1690
|
comment = ''
|
1688
|
-
comment.
|
1691
|
+
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
1689
1692
|
end
|
1690
1693
|
|
1691
1694
|
while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do
|
1692
|
-
comment
|
1693
|
-
comment
|
1695
|
+
comment += tk[:text]
|
1696
|
+
comment += "\n" unless "\n" == tk[:text].chars.to_a.last
|
1694
1697
|
|
1695
1698
|
if tk[:text].size > 1 && "\n" == tk[:text].chars.to_a.last then
|
1696
1699
|
skip_tkspace false # leading spaces
|
@@ -1740,7 +1743,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1740
1743
|
end
|
1741
1744
|
|
1742
1745
|
when 'until', 'while' then
|
1743
|
-
if (RDoc::RipperStateLex::EXPR_LABEL
|
1746
|
+
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
|
1744
1747
|
nest += 1
|
1745
1748
|
skip_optional_do_after_expression
|
1746
1749
|
end
|
@@ -1756,7 +1759,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1756
1759
|
skip_optional_do_after_expression
|
1757
1760
|
|
1758
1761
|
when 'case', 'do', 'if', 'unless', 'begin' then
|
1759
|
-
if (RDoc::RipperStateLex::EXPR_LABEL
|
1762
|
+
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
|
1760
1763
|
nest += 1
|
1761
1764
|
end
|
1762
1765
|
|
@@ -1809,7 +1812,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1809
1812
|
|
1810
1813
|
unless keep_comment then
|
1811
1814
|
comment = new_comment ''
|
1812
|
-
comment.
|
1815
|
+
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
1813
1816
|
container.params = nil
|
1814
1817
|
container.block_params = nil
|
1815
1818
|
end
|
@@ -2053,15 +2056,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2053
2056
|
container.record_location @top_level
|
2054
2057
|
end
|
2055
2058
|
|
2056
|
-
##
|
2057
|
-
# Removes private comments from +comment+
|
2058
|
-
#--
|
2059
|
-
# TODO remove
|
2060
|
-
|
2061
|
-
def remove_private_comments comment
|
2062
|
-
comment.remove_private
|
2063
|
-
end
|
2064
|
-
|
2065
2059
|
##
|
2066
2060
|
# Scans this Ruby file for Ruby constructs
|
2067
2061
|
|