rdoc 6.7.0 → 6.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ExampleMarkdown.md +2 -0
- data/ExampleRDoc.rdoc +2 -0
- data/History.rdoc +64 -62
- data/LICENSE.rdoc +2 -0
- data/README.rdoc +13 -0
- data/RI.md +842 -0
- data/TODO.rdoc +8 -7
- data/lib/rdoc/{alias.rb → code_object/alias.rb} +1 -1
- data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +54 -0
- data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +3 -3
- data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +4 -4
- data/lib/rdoc/code_object.rb +6 -0
- data/lib/rdoc/generator/darkfish.rb +45 -3
- data/lib/rdoc/generator/pot/message_extractor.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +23 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +3 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +69 -43
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +367 -392
- data/lib/rdoc/generator/template/darkfish/index.rhtml +7 -6
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +18 -1
- 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 +5 -2
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +11 -0
- data/lib/rdoc/markdown.kpeg +1 -1
- data/lib/rdoc/markdown.rb +21 -11
- data/lib/rdoc/markup/attribute_manager.rb +2 -2
- data/lib/rdoc/markup/pre_process.rb +9 -6
- data/lib/rdoc/markup/to_bs.rb +1 -1
- data/lib/rdoc/markup/to_rdoc.rb +4 -4
- data/lib/rdoc/markup.rb +18 -13
- data/lib/rdoc/options.rb +22 -5
- data/lib/rdoc/parser/c.rb +1 -1
- data/lib/rdoc/parser/changelog.rb +2 -2
- data/lib/rdoc/parser/ripper_state_lex.rb +7 -305
- data/lib/rdoc/parser/ruby.rb +15 -6
- data/lib/rdoc/parser.rb +2 -1
- data/lib/rdoc/rdoc.rb +3 -2
- data/lib/rdoc/ri/driver.rb +10 -6
- data/lib/rdoc/task.rb +2 -3
- data/lib/rdoc/tom_doc.rb +1 -7
- data/lib/rdoc/version.rb +1 -1
- data/lib/rdoc.rb +22 -22
- metadata +28 -24
- data/RI.rdoc +0 -57
- /data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +0 -0
- /data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +0 -0
- /data/lib/rdoc/{attr.rb → code_object/attr.rb} +0 -0
- /data/lib/rdoc/{constant.rb → code_object/constant.rb} +0 -0
- /data/lib/rdoc/{context → code_object/context}/section.rb +0 -0
- /data/lib/rdoc/{context.rb → code_object/context.rb} +0 -0
- /data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -0
- /data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +0 -0
- /data/lib/rdoc/{include.rb → code_object/include.rb} +0 -0
- /data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +0 -0
- /data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +0 -0
- /data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +0 -0
- /data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +0 -0
- /data/lib/rdoc/{require.rb → code_object/require.rb} +0 -0
- /data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +0 -0
@@ -7,307 +7,12 @@ require 'ripper'
|
|
7
7
|
class RDoc::Parser::RipperStateLex
|
8
8
|
# :stopdoc:
|
9
9
|
|
10
|
-
# TODO: Remove this constants after Ruby 2.4 EOL
|
11
|
-
RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state)
|
12
|
-
|
13
10
|
Token = Struct.new(:line_no, :char_no, :kind, :text, :state)
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
EXPR_ENDFN = 8
|
20
|
-
EXPR_ARG = 16
|
21
|
-
EXPR_CMDARG = 32
|
22
|
-
EXPR_MID = 64
|
23
|
-
EXPR_FNAME = 128
|
24
|
-
EXPR_DOT = 256
|
25
|
-
EXPR_CLASS = 512
|
26
|
-
EXPR_LABEL = 1024
|
27
|
-
EXPR_LABELED = 2048
|
28
|
-
EXPR_FITEM = 4096
|
29
|
-
EXPR_VALUE = EXPR_BEG
|
30
|
-
EXPR_BEG_ANY = (EXPR_BEG | EXPR_MID | EXPR_CLASS)
|
31
|
-
EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG)
|
32
|
-
EXPR_END_ANY = (EXPR_END | EXPR_ENDARG | EXPR_ENDFN)
|
33
|
-
|
34
|
-
class InnerStateLex < Ripper::Filter
|
35
|
-
attr_accessor :lex_state
|
36
|
-
|
37
|
-
def initialize(code)
|
38
|
-
@lex_state = EXPR_BEG
|
39
|
-
@in_fname = false
|
40
|
-
@continue = false
|
41
|
-
reset
|
42
|
-
super(code)
|
43
|
-
end
|
44
|
-
|
45
|
-
def reset
|
46
|
-
@command_start = false
|
47
|
-
@cmd_state = @command_start
|
48
|
-
end
|
49
|
-
|
50
|
-
def on_nl(tok, data)
|
51
|
-
case @lex_state
|
52
|
-
when EXPR_FNAME, EXPR_DOT
|
53
|
-
@continue = true
|
54
|
-
else
|
55
|
-
@continue = false
|
56
|
-
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
57
|
-
end
|
58
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
59
|
-
end
|
60
|
-
|
61
|
-
def on_ignored_nl(tok, data)
|
62
|
-
case @lex_state
|
63
|
-
when EXPR_FNAME, EXPR_DOT
|
64
|
-
@continue = true
|
65
|
-
else
|
66
|
-
@continue = false
|
67
|
-
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
68
|
-
end
|
69
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
70
|
-
end
|
71
|
-
|
72
|
-
def on_op(tok, data)
|
73
|
-
case tok
|
74
|
-
when '&', '|', '!', '!=', '!~'
|
75
|
-
case @lex_state
|
76
|
-
when EXPR_FNAME, EXPR_DOT
|
77
|
-
@lex_state = EXPR_ARG
|
78
|
-
else
|
79
|
-
@lex_state = EXPR_BEG
|
80
|
-
end
|
81
|
-
when '<<'
|
82
|
-
# TODO next token?
|
83
|
-
case @lex_state
|
84
|
-
when EXPR_FNAME, EXPR_DOT
|
85
|
-
@lex_state = EXPR_ARG
|
86
|
-
else
|
87
|
-
@lex_state = EXPR_BEG
|
88
|
-
end
|
89
|
-
when '?'
|
90
|
-
@lex_state = EXPR_BEG
|
91
|
-
when '&&', '||', '+=', '-=', '*=', '**=',
|
92
|
-
'&=', '|=', '^=', '<<=', '>>=', '||=', '&&='
|
93
|
-
@lex_state = EXPR_BEG
|
94
|
-
when '::'
|
95
|
-
case @lex_state
|
96
|
-
when EXPR_ARG, EXPR_CMDARG
|
97
|
-
@lex_state = EXPR_DOT
|
98
|
-
when EXPR_FNAME, EXPR_DOT
|
99
|
-
@lex_state = EXPR_ARG
|
100
|
-
else
|
101
|
-
@lex_state = EXPR_BEG
|
102
|
-
end
|
103
|
-
else
|
104
|
-
case @lex_state
|
105
|
-
when EXPR_FNAME, EXPR_DOT
|
106
|
-
@lex_state = EXPR_ARG
|
107
|
-
else
|
108
|
-
@lex_state = EXPR_BEG
|
109
|
-
end
|
110
|
-
end
|
111
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
112
|
-
end
|
113
|
-
|
114
|
-
def on_kw(tok, data)
|
115
|
-
case tok
|
116
|
-
when 'class'
|
117
|
-
@lex_state = EXPR_CLASS
|
118
|
-
@in_fname = true
|
119
|
-
when 'def'
|
120
|
-
@lex_state = EXPR_FNAME
|
121
|
-
@continue = true
|
122
|
-
@in_fname = true
|
123
|
-
when 'if', 'unless', 'while', 'until'
|
124
|
-
if ((EXPR_MID | EXPR_END | EXPR_ENDARG | EXPR_ENDFN | EXPR_ARG | EXPR_CMDARG) & @lex_state) != 0 # postfix if
|
125
|
-
@lex_state = EXPR_BEG | EXPR_LABEL
|
126
|
-
else
|
127
|
-
@lex_state = EXPR_BEG
|
128
|
-
end
|
129
|
-
when 'begin', 'case', 'when'
|
130
|
-
@lex_state = EXPR_BEG
|
131
|
-
when 'return', 'break'
|
132
|
-
@lex_state = EXPR_MID
|
133
|
-
else
|
134
|
-
if @lex_state == EXPR_FNAME
|
135
|
-
@lex_state = EXPR_END
|
136
|
-
else
|
137
|
-
@lex_state = EXPR_END
|
138
|
-
end
|
139
|
-
end
|
140
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
141
|
-
end
|
142
|
-
|
143
|
-
def on_tstring_beg(tok, data)
|
144
|
-
@lex_state = EXPR_BEG
|
145
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
146
|
-
end
|
147
|
-
|
148
|
-
def on_tstring_end(tok, data)
|
149
|
-
@lex_state = EXPR_END | EXPR_ENDARG
|
150
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
151
|
-
end
|
152
|
-
|
153
|
-
def on_CHAR(tok, data)
|
154
|
-
@lex_state = EXPR_END
|
155
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
156
|
-
end
|
157
|
-
|
158
|
-
def on_period(tok, data)
|
159
|
-
@lex_state = EXPR_DOT
|
160
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
161
|
-
end
|
162
|
-
|
163
|
-
def on_int(tok, data)
|
164
|
-
@lex_state = EXPR_END | EXPR_ENDARG
|
165
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
166
|
-
end
|
167
|
-
|
168
|
-
def on_float(tok, data)
|
169
|
-
@lex_state = EXPR_END | EXPR_ENDARG
|
170
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
171
|
-
end
|
172
|
-
|
173
|
-
def on_rational(tok, data)
|
174
|
-
@lex_state = EXPR_END | EXPR_ENDARG
|
175
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
176
|
-
end
|
177
|
-
|
178
|
-
def on_imaginary(tok, data)
|
179
|
-
@lex_state = EXPR_END | EXPR_ENDARG
|
180
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
181
|
-
end
|
182
|
-
|
183
|
-
def on_symbeg(tok, data)
|
184
|
-
@lex_state = EXPR_FNAME
|
185
|
-
@continue = true
|
186
|
-
@in_fname = true
|
187
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
188
|
-
end
|
189
|
-
|
190
|
-
private def on_variables(event, tok, data)
|
191
|
-
if @in_fname
|
192
|
-
@lex_state = EXPR_ENDFN
|
193
|
-
@in_fname = false
|
194
|
-
@continue = false
|
195
|
-
elsif @continue
|
196
|
-
case @lex_state
|
197
|
-
when EXPR_DOT
|
198
|
-
@lex_state = EXPR_ARG
|
199
|
-
else
|
200
|
-
@lex_state = EXPR_ENDFN
|
201
|
-
@continue = false
|
202
|
-
end
|
203
|
-
else
|
204
|
-
@lex_state = EXPR_CMDARG
|
205
|
-
end
|
206
|
-
data << Token.new(lineno, column, event, tok, @lex_state)
|
207
|
-
end
|
208
|
-
|
209
|
-
def on_ident(tok, data)
|
210
|
-
on_variables(__method__, tok, data)
|
211
|
-
end
|
212
|
-
|
213
|
-
def on_ivar(tok, data)
|
214
|
-
@lex_state = EXPR_END
|
215
|
-
on_variables(__method__, tok, data)
|
216
|
-
end
|
217
|
-
|
218
|
-
def on_cvar(tok, data)
|
219
|
-
@lex_state = EXPR_END
|
220
|
-
on_variables(__method__, tok, data)
|
221
|
-
end
|
222
|
-
|
223
|
-
def on_gvar(tok, data)
|
224
|
-
@lex_state = EXPR_END
|
225
|
-
on_variables(__method__, tok, data)
|
226
|
-
end
|
227
|
-
|
228
|
-
def on_backref(tok, data)
|
229
|
-
@lex_state = EXPR_END
|
230
|
-
on_variables(__method__, tok, data)
|
231
|
-
end
|
232
|
-
|
233
|
-
def on_lparen(tok, data)
|
234
|
-
@lex_state = EXPR_LABEL | EXPR_BEG
|
235
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
236
|
-
end
|
237
|
-
|
238
|
-
def on_rparen(tok, data)
|
239
|
-
@lex_state = EXPR_ENDFN
|
240
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
241
|
-
end
|
242
|
-
|
243
|
-
def on_lbrace(tok, data)
|
244
|
-
@lex_state = EXPR_LABEL | EXPR_BEG
|
245
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
246
|
-
end
|
247
|
-
|
248
|
-
def on_rbrace(tok, data)
|
249
|
-
@lex_state = EXPR_ENDARG
|
250
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
251
|
-
end
|
252
|
-
|
253
|
-
def on_lbracket(tok, data)
|
254
|
-
@lex_state = EXPR_LABEL | EXPR_BEG
|
255
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
256
|
-
end
|
257
|
-
|
258
|
-
def on_rbracket(tok, data)
|
259
|
-
@lex_state = EXPR_ENDARG
|
260
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
261
|
-
end
|
262
|
-
|
263
|
-
def on_const(tok, data)
|
264
|
-
case @lex_state
|
265
|
-
when EXPR_FNAME
|
266
|
-
@lex_state = EXPR_ENDFN
|
267
|
-
when EXPR_CLASS, EXPR_CMDARG, EXPR_MID
|
268
|
-
@lex_state = EXPR_ARG
|
269
|
-
else
|
270
|
-
@lex_state = EXPR_CMDARG
|
271
|
-
end
|
272
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
273
|
-
end
|
274
|
-
|
275
|
-
def on_sp(tok, data)
|
276
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
277
|
-
end
|
278
|
-
|
279
|
-
def on_comma(tok, data)
|
280
|
-
@lex_state = EXPR_BEG | EXPR_LABEL if (EXPR_ARG_ANY & @lex_state) != 0
|
281
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
282
|
-
end
|
283
|
-
|
284
|
-
def on_comment(tok, data)
|
285
|
-
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
286
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
287
|
-
end
|
288
|
-
|
289
|
-
def on_ignored_sp(tok, data)
|
290
|
-
@lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
|
291
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
292
|
-
end
|
293
|
-
|
294
|
-
def on_heredoc_beg(tok, data)
|
295
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
296
|
-
@lex_state = EXPR_END
|
297
|
-
data
|
298
|
-
end
|
299
|
-
|
300
|
-
def on_heredoc_end(tok, data)
|
301
|
-
data << Token.new(lineno, column, __method__, tok, @lex_state)
|
302
|
-
@lex_state = EXPR_BEG
|
303
|
-
data
|
304
|
-
end
|
305
|
-
|
306
|
-
def on_default(event, tok, data)
|
307
|
-
reset
|
308
|
-
data << Token.new(lineno, column, event, tok, @lex_state)
|
309
|
-
end
|
310
|
-
end unless RIPPER_HAS_LEX_STATE
|
12
|
+
EXPR_END = Ripper::EXPR_END
|
13
|
+
EXPR_ENDFN = Ripper::EXPR_ENDFN
|
14
|
+
EXPR_ARG = Ripper::EXPR_ARG
|
15
|
+
EXPR_FNAME = Ripper::EXPR_FNAME
|
311
16
|
|
312
17
|
class InnerStateLex < Ripper::Filter
|
313
18
|
def initialize(code)
|
@@ -317,7 +22,7 @@ class RDoc::Parser::RipperStateLex
|
|
317
22
|
def on_default(event, tok, data)
|
318
23
|
data << Token.new(lineno, column, event, tok, state)
|
319
24
|
end
|
320
|
-
end
|
25
|
+
end
|
321
26
|
|
322
27
|
def get_squashed_tk
|
323
28
|
if @buf.empty?
|
@@ -333,9 +38,8 @@ class RDoc::Parser::RipperStateLex
|
|
333
38
|
tk = get_string_tk(tk)
|
334
39
|
when :on_backtick then
|
335
40
|
if (tk[:state] & (EXPR_FNAME | EXPR_ENDFN)) != 0
|
336
|
-
@inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE
|
337
41
|
tk[:kind] = :on_ident
|
338
|
-
tk[:state] = Ripper::Lexer
|
42
|
+
tk[:state] = Ripper::Lexer::State.new(EXPR_ARG)
|
339
43
|
else
|
340
44
|
tk = get_string_tk(tk)
|
341
45
|
end
|
@@ -345,7 +49,6 @@ class RDoc::Parser::RipperStateLex
|
|
345
49
|
tk = get_embdoc_tk(tk)
|
346
50
|
when :on_heredoc_beg then
|
347
51
|
@heredoc_queue << retrieve_heredoc_info(tk)
|
348
|
-
@inner_lex.lex_state = EXPR_END unless RIPPER_HAS_LEX_STATE
|
349
52
|
when :on_nl, :on_ignored_nl, :on_comment, :on_heredoc_end then
|
350
53
|
if !@heredoc_queue.empty?
|
351
54
|
get_heredoc_tk(*@heredoc_queue.shift)
|
@@ -549,8 +252,7 @@ class RDoc::Parser::RipperStateLex
|
|
549
252
|
private def get_op_tk(tk)
|
550
253
|
redefinable_operators = %w[! != !~ % & * ** + +@ - -@ / < << <= <=> == === =~ > >= >> [] []= ^ ` | ~]
|
551
254
|
if redefinable_operators.include?(tk[:text]) and tk[:state] == EXPR_ARG then
|
552
|
-
|
553
|
-
tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG
|
255
|
+
tk[:state] = Ripper::Lexer::State.new(EXPR_ARG)
|
554
256
|
tk[:kind] = :on_ident
|
555
257
|
elsif tk[:text] =~ /^[-+]$/ then
|
556
258
|
tk_ahead = get_squashed_tk
|
data/lib/rdoc/parser/ruby.rb
CHANGED
@@ -8,6 +8,15 @@
|
|
8
8
|
# by Keiju ISHITSUKA (Nippon Rational Inc.)
|
9
9
|
#
|
10
10
|
|
11
|
+
if ENV['RDOC_USE_PRISM_PARSER']
|
12
|
+
require 'rdoc/parser/prism_ruby'
|
13
|
+
RDoc::Parser.const_set(:Ruby, RDoc::Parser::PrismRuby)
|
14
|
+
puts "========================================================================="
|
15
|
+
puts "RDoc is using the experimental Prism parser to generate the documentation"
|
16
|
+
puts "========================================================================="
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
11
20
|
require 'ripper'
|
12
21
|
require_relative 'ripper_state_lex'
|
13
22
|
|
@@ -513,7 +522,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
513
522
|
when :on_comment, :on_embdoc then
|
514
523
|
@read.pop
|
515
524
|
if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
|
516
|
-
(!continue or (tk[:state] &
|
525
|
+
(!continue or (tk[:state] & Ripper::EXPR_LABEL) != 0) then
|
517
526
|
break if !continue and nest <= 0
|
518
527
|
end
|
519
528
|
when :on_comma then
|
@@ -526,7 +535,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
526
535
|
nest += 1
|
527
536
|
when 'if', 'unless', 'while', 'until', 'rescue'
|
528
537
|
# postfix if/unless/while/until/rescue must be EXPR_LABEL
|
529
|
-
nest += 1 unless (tk[:state] &
|
538
|
+
nest += 1 unless (tk[:state] & Ripper::EXPR_LABEL) != 0
|
530
539
|
when 'end'
|
531
540
|
nest -= 1
|
532
541
|
break if nest == 0
|
@@ -1041,7 +1050,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1041
1050
|
elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then
|
1042
1051
|
nest += 1
|
1043
1052
|
elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then
|
1044
|
-
if (tk[:state] &
|
1053
|
+
if (tk[:state] & Ripper::EXPR_LABEL) == 0
|
1045
1054
|
nest += 1
|
1046
1055
|
end
|
1047
1056
|
elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) ||
|
@@ -1662,7 +1671,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1662
1671
|
when :on_comment, :on_embdoc then
|
1663
1672
|
@read.pop
|
1664
1673
|
if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
|
1665
|
-
(!continue or (tk[:state] &
|
1674
|
+
(!continue or (tk[:state] & Ripper::EXPR_LABEL) != 0) then
|
1666
1675
|
if method && method.block_params.nil? then
|
1667
1676
|
unget_tk tk
|
1668
1677
|
read_documentation_modifiers method, modifiers
|
@@ -1882,7 +1891,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1882
1891
|
end
|
1883
1892
|
|
1884
1893
|
when 'until', 'while' then
|
1885
|
-
if (tk[:state] &
|
1894
|
+
if (tk[:state] & Ripper::EXPR_LABEL) == 0
|
1886
1895
|
nest += 1
|
1887
1896
|
skip_optional_do_after_expression
|
1888
1897
|
end
|
@@ -1898,7 +1907,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1898
1907
|
skip_optional_do_after_expression
|
1899
1908
|
|
1900
1909
|
when 'case', 'do', 'if', 'unless', 'begin' then
|
1901
|
-
if (tk[:state] &
|
1910
|
+
if (tk[:state] & Ripper::EXPR_LABEL) == 0
|
1902
1911
|
nest += 1
|
1903
1912
|
end
|
1904
1913
|
|
data/lib/rdoc/parser.rb
CHANGED
@@ -166,7 +166,8 @@ class RDoc::Parser
|
|
166
166
|
# Finds and instantiates the correct parser for the given +file_name+ and
|
167
167
|
# +content+.
|
168
168
|
|
169
|
-
def self.for top_level,
|
169
|
+
def self.for top_level, content, options, stats
|
170
|
+
file_name = top_level.absolute_name
|
170
171
|
return if binary? file_name
|
171
172
|
|
172
173
|
parser = use_markup content
|
data/lib/rdoc/rdoc.rb
CHANGED
@@ -356,7 +356,7 @@ option)
|
|
356
356
|
|
357
357
|
top_level = @store.add_file filename, relative_name: relative_path.to_s
|
358
358
|
|
359
|
-
parser = RDoc::Parser.for top_level,
|
359
|
+
parser = RDoc::Parser.for top_level, content, @options, @stats
|
360
360
|
|
361
361
|
return unless parser
|
362
362
|
|
@@ -520,6 +520,7 @@ The internal error was:
|
|
520
520
|
Dir.chdir @options.op_dir do
|
521
521
|
unless @options.quiet then
|
522
522
|
$stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
|
523
|
+
$stderr.puts "\nYou can visit the home page at: \e]8;;file://#{Dir.pwd}/index.html\e\\file://#{Dir.pwd}/index.html\e]8;;\e\\"
|
523
524
|
end
|
524
525
|
|
525
526
|
@generator.generate
|
@@ -544,7 +545,7 @@ end
|
|
544
545
|
begin
|
545
546
|
require 'rubygems'
|
546
547
|
|
547
|
-
rdoc_extensions = Gem.
|
548
|
+
rdoc_extensions = Gem.find_latest_files 'rdoc/discover'
|
548
549
|
|
549
550
|
rdoc_extensions.each do |extension|
|
550
551
|
begin
|
data/lib/rdoc/ri/driver.rb
CHANGED
@@ -110,10 +110,6 @@ class RDoc::RI::Driver
|
|
110
110
|
options = default_options
|
111
111
|
|
112
112
|
opts = OptionParser.new do |opt|
|
113
|
-
opt.accept File do |file,|
|
114
|
-
File.readable?(file) and not File.directory?(file) and file
|
115
|
-
end
|
116
|
-
|
117
113
|
opt.program_name = File.basename $0
|
118
114
|
opt.version = RDoc::VERSION
|
119
115
|
opt.release = nil
|
@@ -345,9 +341,17 @@ or the PAGER environment variable.
|
|
345
341
|
|
346
342
|
opt.separator nil
|
347
343
|
|
348
|
-
opt.on("--dump=CACHE",
|
344
|
+
opt.on("--dump=CACHE",
|
349
345
|
"Dump data from an ri cache or data file.") do |value|
|
350
|
-
|
346
|
+
unless File.readable?(value)
|
347
|
+
abort "#{value.inspect} is not readable"
|
348
|
+
end
|
349
|
+
|
350
|
+
if File.directory?(value)
|
351
|
+
abort "#{value.inspect} is a directory"
|
352
|
+
end
|
353
|
+
|
354
|
+
options[:dump_path] = File.new(value)
|
351
355
|
end
|
352
356
|
end
|
353
357
|
|
data/lib/rdoc/task.rb
CHANGED
@@ -104,9 +104,8 @@ class RDoc::Task < Rake::TaskLib
|
|
104
104
|
attr_accessor :name
|
105
105
|
|
106
106
|
##
|
107
|
-
#
|
108
|
-
#
|
109
|
-
|
107
|
+
# The markup format; one of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
|
108
|
+
# See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
|
110
109
|
attr_accessor :markup
|
111
110
|
|
112
111
|
##
|
data/lib/rdoc/tom_doc.rb
CHANGED
@@ -3,13 +3,7 @@
|
|
3
3
|
|
4
4
|
# A parser for TomDoc based on TomDoc 1.0.0-rc1 (02adef9b5a)
|
5
5
|
#
|
6
|
-
# The TomDoc specification can be found at
|
7
|
-
#
|
8
|
-
# http://tomdoc.org
|
9
|
-
#
|
10
|
-
# The latest version of the TomDoc specification can be found at:
|
11
|
-
#
|
12
|
-
# https://github.com/mojombo/tomdoc/blob/master/tomdoc.md
|
6
|
+
# The TomDoc specification can be found at http://tomdoc.org.
|
13
7
|
#
|
14
8
|
# To choose TomDoc as your only default format see RDoc::Options@Saved+Options
|
15
9
|
# for instructions on setting up a <code>.rdoc_options</code> file to store
|
data/lib/rdoc/version.rb
CHANGED
data/lib/rdoc.rb
CHANGED
@@ -21,7 +21,7 @@ $DEBUG_RDOC = nil
|
|
21
21
|
# see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line usage.
|
22
22
|
#
|
23
23
|
# If you want to set the default markup format see
|
24
|
-
# RDoc::Markup@
|
24
|
+
# RDoc::Markup@Markup+Formats
|
25
25
|
#
|
26
26
|
# If you want to store rdoc configuration in your gem (such as the default
|
27
27
|
# markup format) see RDoc::Options@Saved+Options
|
@@ -188,26 +188,26 @@ module RDoc
|
|
188
188
|
# programs: classes, modules, methods, and so on.
|
189
189
|
autoload :CodeObject, "#{__dir__}/rdoc/code_object"
|
190
190
|
|
191
|
-
autoload :Context, "#{__dir__}/rdoc/context"
|
192
|
-
autoload :TopLevel, "#{__dir__}/rdoc/top_level"
|
193
|
-
|
194
|
-
autoload :AnonClass, "#{__dir__}/rdoc/anon_class"
|
195
|
-
autoload :ClassModule, "#{__dir__}/rdoc/class_module"
|
196
|
-
autoload :NormalClass, "#{__dir__}/rdoc/normal_class"
|
197
|
-
autoload :NormalModule, "#{__dir__}/rdoc/normal_module"
|
198
|
-
autoload :SingleClass, "#{__dir__}/rdoc/single_class"
|
199
|
-
|
200
|
-
autoload :Alias, "#{__dir__}/rdoc/alias"
|
201
|
-
autoload :AnyMethod, "#{__dir__}/rdoc/any_method"
|
202
|
-
autoload :MethodAttr, "#{__dir__}/rdoc/method_attr"
|
203
|
-
autoload :GhostMethod, "#{__dir__}/rdoc/ghost_method"
|
204
|
-
autoload :MetaMethod, "#{__dir__}/rdoc/meta_method"
|
205
|
-
autoload :Attr, "#{__dir__}/rdoc/attr"
|
206
|
-
|
207
|
-
autoload :Constant, "#{__dir__}/rdoc/constant"
|
208
|
-
autoload :Mixin, "#{__dir__}/rdoc/mixin"
|
209
|
-
autoload :Include, "#{__dir__}/rdoc/include"
|
210
|
-
autoload :Extend, "#{__dir__}/rdoc/extend"
|
211
|
-
autoload :Require, "#{__dir__}/rdoc/require"
|
191
|
+
autoload :Context, "#{__dir__}/rdoc/code_object/context"
|
192
|
+
autoload :TopLevel, "#{__dir__}/rdoc/code_object/top_level"
|
193
|
+
|
194
|
+
autoload :AnonClass, "#{__dir__}/rdoc/code_object/anon_class"
|
195
|
+
autoload :ClassModule, "#{__dir__}/rdoc/code_object/class_module"
|
196
|
+
autoload :NormalClass, "#{__dir__}/rdoc/code_object/normal_class"
|
197
|
+
autoload :NormalModule, "#{__dir__}/rdoc/code_object/normal_module"
|
198
|
+
autoload :SingleClass, "#{__dir__}/rdoc/code_object/single_class"
|
199
|
+
|
200
|
+
autoload :Alias, "#{__dir__}/rdoc/code_object/alias"
|
201
|
+
autoload :AnyMethod, "#{__dir__}/rdoc/code_object/any_method"
|
202
|
+
autoload :MethodAttr, "#{__dir__}/rdoc/code_object/method_attr"
|
203
|
+
autoload :GhostMethod, "#{__dir__}/rdoc/code_object/ghost_method"
|
204
|
+
autoload :MetaMethod, "#{__dir__}/rdoc/code_object/meta_method"
|
205
|
+
autoload :Attr, "#{__dir__}/rdoc/code_object/attr"
|
206
|
+
|
207
|
+
autoload :Constant, "#{__dir__}/rdoc/code_object/constant"
|
208
|
+
autoload :Mixin, "#{__dir__}/rdoc/code_object/mixin"
|
209
|
+
autoload :Include, "#{__dir__}/rdoc/code_object/include"
|
210
|
+
autoload :Extend, "#{__dir__}/rdoc/code_object/extend"
|
211
|
+
autoload :Require, "#{__dir__}/rdoc/code_object/require"
|
212
212
|
|
213
213
|
end
|