rdoc 6.2.0 → 6.2.1

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.

@@ -244,6 +244,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
244
244
  comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
245
245
  first_line = true
246
246
  first_comment_tk_kind = nil
247
+ line_no = nil
247
248
 
248
249
  tk = get_tk
249
250
 
@@ -260,6 +261,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
260
261
  break if first_comment_tk_kind and not first_comment_tk_kind === tk[:kind]
261
262
  first_comment_tk_kind = tk[:kind]
262
263
 
264
+ line_no = tk[:line_no] if first_line
263
265
  first_line = false
264
266
  comment << comment_body
265
267
  tk = get_tk
@@ -273,7 +275,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
273
275
 
274
276
  unget_tk tk
275
277
 
276
- new_comment comment
278
+ new_comment comment, line_no
277
279
  end
278
280
 
279
281
  ##
@@ -376,7 +378,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
376
378
  record_location container
377
379
 
378
380
  get_tk
379
- skip_tkspace_without_nl
381
+ skip_tkspace
382
+ if :on_lparen == peek_tk[:kind] # ProcObjectInConstant::()
383
+ parse_method_or_yield_parameters
384
+ break
385
+ end
380
386
  name_t = get_tk
381
387
  unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]
382
388
  raise RDoc::Error, "Invalid class or module definition: #{given_name}"
@@ -666,8 +672,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
666
672
  ##
667
673
  # Creates a comment with the correct format
668
674
 
669
- def new_comment comment
675
+ def new_comment comment, line_no = nil
670
676
  c = RDoc::Comment.new comment, @top_level, :ruby
677
+ c.line = line_no
671
678
  c.format = @markup
672
679
  c
673
680
  end
@@ -1058,13 +1065,14 @@ class RDoc::Parser::Ruby < RDoc::Parser
1058
1065
  def parse_comment container, tk, comment
1059
1066
  return parse_comment_tomdoc container, tk, comment if @markup == 'tomdoc'
1060
1067
  column = tk[:char_no]
1061
- line_no = tk[:line_no]
1068
+ line_no = comment.line.nil? ? tk[:line_no] : comment.line
1062
1069
 
1063
1070
  comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
1064
1071
  singleton = !!$~
1065
1072
 
1066
1073
  co =
1067
1074
  if (comment.text = comment.text.sub(/^# +:?method: *(\S*).*?\n/i, '')) && !!$~ then
1075
+ line_no += $`.count("\n")
1068
1076
  parse_comment_ghost container, comment.text, $1, column, line_no, comment
1069
1077
  elsif (comment.text = comment.text.sub(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '')) && !!$~ then
1070
1078
  parse_comment_attr container, $1, $3, comment
@@ -1776,8 +1784,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
1776
1784
  comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
1777
1785
  end
1778
1786
 
1787
+ line_no = nil
1779
1788
  while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do
1780
1789
  comment_body = retrieve_comment_body(tk)
1790
+ line_no = tk[:line_no] if comment.empty?
1781
1791
  comment += comment_body
1782
1792
  comment << "\n" unless comment_body =~ /\n\z/
1783
1793
 
@@ -1787,7 +1797,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1787
1797
  tk = get_tk
1788
1798
  end
1789
1799
 
1790
- comment = new_comment comment
1800
+ comment = new_comment comment, line_no
1791
1801
 
1792
1802
  unless comment.empty? then
1793
1803
  look_for_directives_in container, comment
@@ -0,0 +1,1056 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # DO NOT MODIFY!!!!
4
+ # This file is automatically generated by Racc 1.4.16
5
+ # from Racc grammar file "".
6
+ #
7
+
8
+ require 'racc/parser.rb'
9
+
10
+ class RDoc::RD
11
+
12
+ ##
13
+ # RD format parser for headings, paragraphs, lists, verbatim sections that
14
+ # exist as blocks.
15
+
16
+ class BlockParser < Racc::Parser
17
+
18
+
19
+ # :stopdoc:
20
+
21
+ TMPFILE = ["rdtmp", $$, 0]
22
+
23
+ MARK_TO_LEVEL = {
24
+ '=' => 1,
25
+ '==' => 2,
26
+ '===' => 3,
27
+ '====' => 4,
28
+ '+' => 5,
29
+ '++' => 6,
30
+ }
31
+
32
+ # :startdoc:
33
+
34
+ ##
35
+ # Footnotes for this document
36
+
37
+ attr_reader :footnotes
38
+
39
+ ##
40
+ # Labels for items in this document
41
+
42
+ attr_reader :labels
43
+
44
+ ##
45
+ # Path to find included files in
46
+
47
+ attr_accessor :include_path
48
+
49
+ ##
50
+ # Creates a new RDoc::RD::BlockParser. Use #parse to parse an rd-format
51
+ # document.
52
+
53
+ def initialize
54
+ @inline_parser = RDoc::RD::InlineParser.new self
55
+ @include_path = []
56
+
57
+ # for testing
58
+ @footnotes = []
59
+ @labels = {}
60
+ end
61
+
62
+ ##
63
+ # Parses +src+ and returns an RDoc::Markup::Document.
64
+
65
+ def parse src
66
+ @src = src
67
+ @src.push false
68
+
69
+ @footnotes = []
70
+ @labels = {}
71
+
72
+ # @i: index(line no.) of src
73
+ @i = 0
74
+
75
+ # stack for current indentation
76
+ @indent_stack = []
77
+
78
+ # how indented.
79
+ @current_indent = @indent_stack.join("")
80
+
81
+ # RDoc::RD::BlockParser for tmp src
82
+ @subparser = nil
83
+
84
+ # which part is in now
85
+ @in_part = nil
86
+ @part_content = []
87
+
88
+ @in_verbatim = false
89
+
90
+ @yydebug = true
91
+
92
+ document = do_parse
93
+
94
+ unless @footnotes.empty? then
95
+ blankline = document.parts.pop
96
+
97
+ document.parts << RDoc::Markup::Rule.new(1)
98
+ document.parts.concat @footnotes
99
+
100
+ document.parts.push blankline
101
+ end
102
+
103
+ document
104
+ end
105
+
106
+ ##
107
+ # Returns the next token from the document
108
+
109
+ def next_token # :nodoc:
110
+ # preprocessing
111
+ # if it is not in RD part
112
+ # => method
113
+ while @in_part != "rd"
114
+ line = @src[@i]
115
+ @i += 1 # next line
116
+
117
+ case line
118
+ # src end
119
+ when false
120
+ return [false, false]
121
+ # RD part begin
122
+ when /^=begin\s*(?:\bRD\b.*)?\s*$/
123
+ if @in_part # if in non-RD part
124
+ @part_content.push(line)
125
+ else
126
+ @in_part = "rd"
127
+ return [:WHITELINE, "=begin\n"] # <= for textblockand
128
+ end
129
+ # non-RD part begin
130
+ when /^=begin\s+(\w+)/
131
+ part = $1
132
+ if @in_part # if in non-RD part
133
+ @part_content.push(line)
134
+ else
135
+ @in_part = part if @tree.filter[part] # if filter exists
136
+ # p "BEGIN_PART: #{@in_part}" # DEBUG
137
+ end
138
+ # non-RD part end
139
+ when /^=end/
140
+ if @in_part # if in non-RD part
141
+ # p "END_PART: #{@in_part}" # DEBUG
142
+ # make Part-in object
143
+ part = RDoc::RD::Part.new(@part_content.join(""), @tree, "r")
144
+ @part_content.clear
145
+ # call filter, part_out is output(Part object)
146
+ part_out = @tree.filter[@in_part].call(part)
147
+
148
+ if @tree.filter[@in_part].mode == :rd # if output is RD formatted
149
+ subtree = parse_subtree(part_out.to_a)
150
+ else # if output is target formatted
151
+ basename = TMPFILE.join('.')
152
+ TMPFILE[-1] += 1
153
+ tmpfile = open(@tree.tmp_dir + "/" + basename + ".#{@in_part}", "w")
154
+ tmpfile.print(part_out)
155
+ tmpfile.close
156
+ subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
157
+ end
158
+ @in_part = nil
159
+ return [:SUBTREE, subtree]
160
+ end
161
+ else
162
+ if @in_part # if in non-RD part
163
+ @part_content.push(line)
164
+ end
165
+ end
166
+ end
167
+
168
+ @current_indent = @indent_stack.join("")
169
+ line = @src[@i]
170
+ case line
171
+ when false
172
+ if_current_indent_equal("") do
173
+ [false, false]
174
+ end
175
+ when /^=end/
176
+ if_current_indent_equal("") do
177
+ @in_part = nil
178
+ [:WHITELINE, "=end"] # MUST CHANGE??
179
+ end
180
+ when /^\s*$/
181
+ @i += 1 # next line
182
+ return [:WHITELINE, ':WHITELINE']
183
+ when /^\#/ # comment line
184
+ @i += 1 # next line
185
+ self.next_token()
186
+ when /^(={1,4})(?!=)\s*(?=\S)/, /^(\+{1,2})(?!\+)\s*(?=\S)/
187
+ rest = $' # '
188
+ rest.strip!
189
+ mark = $1
190
+ if_current_indent_equal("") do
191
+ return [:HEADLINE, [MARK_TO_LEVEL[mark], rest]]
192
+ end
193
+ when /^<<<\s*(\S+)/
194
+ file = $1
195
+ if_current_indent_equal("") do
196
+ suffix = file[-3 .. -1]
197
+ if suffix == ".rd" or suffix == ".rb"
198
+ subtree = parse_subtree(get_included(file))
199
+ [:SUBTREE, subtree]
200
+ else
201
+ [:INCLUDE, file]
202
+ end
203
+ end
204
+ when /^(\s*)\*(\s*)/
205
+ rest = $' # '
206
+ newIndent = $2
207
+ if_current_indent_equal($1) do
208
+ if @in_verbatim
209
+ [:STRINGLINE, line]
210
+ else
211
+ @indent_stack.push("\s" + newIndent)
212
+ [:ITEMLISTLINE, rest]
213
+ end
214
+ end
215
+ when /^(\s*)(\(\d+\))(\s*)/
216
+ rest = $' # '
217
+ mark = $2
218
+ newIndent = $3
219
+ if_current_indent_equal($1) do
220
+ if @in_verbatim
221
+ [:STRINGLINE, line]
222
+ else
223
+ @indent_stack.push("\s" * mark.size + newIndent)
224
+ [:ENUMLISTLINE, rest]
225
+ end
226
+ end
227
+ when /^(\s*):(\s*)/
228
+ rest = $' # '
229
+ newIndent = $2
230
+ if_current_indent_equal($1) do
231
+ if @in_verbatim
232
+ [:STRINGLINE, line]
233
+ else
234
+ @indent_stack.push("\s#{$2}")
235
+ [:DESCLISTLINE, rest]
236
+ end
237
+ end
238
+ when /^(\s*)---(?!-|\s*$)/
239
+ indent = $1
240
+ rest = $'
241
+ /\s*/ === rest
242
+ term = $'
243
+ new_indent = $&
244
+ if_current_indent_equal(indent) do
245
+ if @in_verbatim
246
+ [:STRINGLINE, line]
247
+ else
248
+ @indent_stack.push("\s\s\s" + new_indent)
249
+ [:METHODLISTLINE, term]
250
+ end
251
+ end
252
+ when /^(\s*)/
253
+ if_current_indent_equal($1) do
254
+ [:STRINGLINE, line]
255
+ end
256
+ else
257
+ raise "[BUG] parsing error may occurred."
258
+ end
259
+ end
260
+
261
+ ##
262
+ # Yields to the given block if +indent+ matches the current indent, otherwise
263
+ # an indentation token is processed.
264
+
265
+ def if_current_indent_equal(indent)
266
+ indent = indent.sub(/\t/, "\s" * 8)
267
+ if @current_indent == indent
268
+ @i += 1 # next line
269
+ yield
270
+ elsif indent.index(@current_indent) == 0
271
+ @indent_stack.push(indent[@current_indent.size .. -1])
272
+ [:INDENT, ":INDENT"]
273
+ else
274
+ @indent_stack.pop
275
+ [:DEDENT, ":DEDENT"]
276
+ end
277
+ end
278
+ private :if_current_indent_equal
279
+
280
+ ##
281
+ # Cuts off excess whitespace in +src+
282
+
283
+ def cut_off(src)
284
+ ret = []
285
+ whiteline_buf = []
286
+
287
+ line = src.shift
288
+ /^\s*/ =~ line
289
+
290
+ indent = Regexp.quote($&)
291
+ ret.push($')
292
+
293
+ while line = src.shift
294
+ if /^(\s*)$/ =~ line
295
+ whiteline_buf.push(line)
296
+ elsif /^#{indent}/ =~ line
297
+ unless whiteline_buf.empty?
298
+ ret.concat(whiteline_buf)
299
+ whiteline_buf.clear
300
+ end
301
+ ret.push($')
302
+ else
303
+ raise "[BUG]: probably Parser Error while cutting off.\n"
304
+ end
305
+ end
306
+ ret
307
+ end
308
+ private :cut_off
309
+
310
+ def set_term_to_element(parent, term)
311
+ # parent.set_term_under_document_struct(term, @tree.document_struct)
312
+ parent.set_term_without_document_struct(term)
313
+ end
314
+ private :set_term_to_element
315
+
316
+ ##
317
+ # Raises a ParseError when invalid formatting is found
318
+
319
+ def on_error(et, ev, _values)
320
+ prv, cur, nxt = format_line_num(@i, @i+1, @i+2)
321
+
322
+ raise ParseError, <<Msg
323
+
324
+ RD syntax error: line #{@i+1}:
325
+ #{prv} |#{@src[@i-1].chomp}
326
+ #{cur}=>|#{@src[@i].chomp}
327
+ #{nxt} |#{@src[@i+1].chomp}
328
+
329
+ Msg
330
+ end
331
+
332
+ ##
333
+ # Current line number
334
+
335
+ def line_index
336
+ @i
337
+ end
338
+
339
+ ##
340
+ # Parses subtree +src+
341
+
342
+ def parse_subtree src
343
+ @subparser ||= RDoc::RD::BlockParser.new
344
+
345
+ @subparser.parse src
346
+ end
347
+ private :parse_subtree
348
+
349
+ ##
350
+ # Retrieves the content for +file+ from the include_path
351
+
352
+ def get_included(file)
353
+ included = []
354
+
355
+ @include_path.each do |dir|
356
+ file_name = File.join dir, file
357
+
358
+ if File.exist? file_name then
359
+ included = IO.readlines file_name
360
+ break
361
+ end
362
+ end
363
+
364
+ included
365
+ end
366
+ private :get_included
367
+
368
+ ##
369
+ # Formats line numbers +line_numbers+ prettily
370
+
371
+ def format_line_num(*line_numbers)
372
+ width = line_numbers.collect{|i| i.to_s.length }.max
373
+ line_numbers.collect{|i| sprintf("%#{width}d", i) }
374
+ end
375
+ private :format_line_num
376
+
377
+ ##
378
+ # Retrieves the content of +values+ as a single String
379
+
380
+ def content values
381
+ values.map { |value| value.content }.join
382
+ end
383
+
384
+ ##
385
+ # Creates a paragraph for +value+
386
+
387
+ def paragraph value
388
+ content = cut_off(value).join(' ').rstrip
389
+ contents = @inline_parser.parse content
390
+
391
+ RDoc::Markup::Paragraph.new(*contents)
392
+ end
393
+
394
+ ##
395
+ # Adds footnote +content+ to the document
396
+
397
+ def add_footnote content
398
+ index = @footnotes.length / 2 + 1
399
+
400
+ footmark_link = "{^#{index}}[rdoc-label:footmark-#{index}:foottext-#{index}]"
401
+
402
+ @footnotes << RDoc::Markup::Paragraph.new(footmark_link, ' ', *content)
403
+ @footnotes << RDoc::Markup::BlankLine.new
404
+
405
+ index
406
+ end
407
+
408
+ ##
409
+ # Adds label +label+ to the document
410
+
411
+ def add_label label
412
+ @labels[label] = true
413
+
414
+ label
415
+ end
416
+
417
+ # :stopdoc:
418
+
419
+ ##### State transition tables begin ###
420
+
421
+ racc_action_table = [
422
+ 34, 35, 30, 33, 40, 34, 35, 30, 33, 40,
423
+ 65, 34, 35, 30, 33, 14, 73, 36, 38, 34,
424
+ 15, 88, 34, 35, 30, 33, 14, 9, 10, 11,
425
+ 12, 15, 34, 35, 30, 33, 14, 9, 10, 11,
426
+ 12, 15, 34, 35, 30, 33, 35, 47, 30, 54,
427
+ 33, 15, 34, 35, 30, 33, 54, 47, 14, 14,
428
+ 59, 15, 34, 35, 30, 33, 14, 73, 67, 76,
429
+ 77, 15, 34, 35, 30, 33, 14, 73, 54, 81,
430
+ 38, 15, 34, 35, 30, 33, 14, 73, 38, 40,
431
+ 83, 15, 34, 35, 30, 33, 14, 73, nil, nil,
432
+ nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
433
+ nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
434
+ nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
435
+ nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
436
+ nil, 15, 34, 35, 30, 33, 14, 73, 61, 63,
437
+ nil, 15, 14, 62, 60, 61, 63, 79, 61, 63,
438
+ 62, 87, nil, 62, 34, 35, 30, 33 ]
439
+
440
+ racc_action_check = [
441
+ 41, 41, 41, 41, 41, 15, 15, 15, 15, 15,
442
+ 41, 86, 86, 86, 86, 86, 86, 1, 13, 22,
443
+ 86, 86, 0, 0, 0, 0, 0, 0, 0, 0,
444
+ 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
445
+ 2, 2, 24, 24, 24, 24, 25, 24, 28, 30,
446
+ 31, 24, 27, 27, 27, 27, 33, 27, 34, 35,
447
+ 36, 27, 45, 45, 45, 45, 45, 45, 44, 49,
448
+ 51, 45, 46, 46, 46, 46, 46, 46, 54, 56,
449
+ 57, 46, 47, 47, 47, 47, 47, 47, 58, 62,
450
+ 66, 47, 68, 68, 68, 68, 68, 68, nil, nil,
451
+ nil, 68, 74, 74, 74, 74, 74, 74, nil, nil,
452
+ nil, 74, 75, 75, 75, 75, 75, 75, nil, nil,
453
+ nil, 75, 78, 78, 78, 78, 78, 78, nil, nil,
454
+ nil, 78, 79, 79, 79, 79, 79, 79, nil, nil,
455
+ nil, 79, 85, 85, 85, 85, 85, 85, 39, 39,
456
+ nil, 85, 52, 39, 39, 82, 82, 52, 64, 64,
457
+ 82, 82, nil, 64, 20, 20, 20, 20 ]
458
+
459
+ racc_action_pointer = [
460
+ 19, 17, 29, nil, nil, nil, nil, nil, nil, nil,
461
+ nil, nil, nil, 11, nil, 2, nil, nil, nil, nil,
462
+ 161, nil, 16, nil, 39, 42, nil, 49, 43, nil,
463
+ 41, 44, nil, 48, 51, 52, 60, nil, nil, 141,
464
+ nil, -3, nil, nil, 55, 59, 69, 79, nil, 56,
465
+ nil, 57, 145, nil, 70, nil, 66, 73, 81, nil,
466
+ nil, nil, 82, nil, 151, nil, 77, nil, 89, nil,
467
+ nil, nil, nil, nil, 99, 109, nil, nil, 119, 129,
468
+ nil, nil, 148, nil, nil, 139, 8, nil, nil ]
469
+
470
+ racc_action_default = [
471
+ -2, -73, -1, -4, -5, -6, -7, -8, -9, -10,
472
+ -11, -12, -13, -14, -16, -73, -23, -24, -25, -26,
473
+ -27, -31, -32, -34, -72, -36, -38, -72, -40, -42,
474
+ -59, -44, -46, -59, -63, -65, -73, -3, -15, -73,
475
+ -22, -73, -30, -33, -73, -69, -70, -71, -37, -73,
476
+ -41, -73, -51, -58, -61, -45, -73, -62, -64, 89,
477
+ -17, -19, -73, -21, -18, -28, -73, -35, -66, -53,
478
+ -54, -55, -56, -57, -67, -68, -39, -43, -49, -73,
479
+ -60, -47, -73, -29, -52, -48, -73, -20, -50 ]
480
+
481
+ racc_goto_table = [
482
+ 4, 39, 4, 68, 74, 75, 5, 6, 5, 6,
483
+ 44, 42, 51, 49, 3, 56, 37, 57, 58, 1,
484
+ 2, 66, 84, 41, 43, 48, 50, 64, 84, 84,
485
+ 45, 46, 42, 45, 46, 55, 85, 86, 80, 84,
486
+ 84, nil, nil, nil, nil, nil, nil, nil, 82, nil,
487
+ nil, nil, 78 ]
488
+
489
+ racc_goto_check = [
490
+ 4, 10, 4, 31, 31, 31, 5, 6, 5, 6,
491
+ 21, 12, 27, 21, 3, 27, 3, 9, 9, 1,
492
+ 2, 11, 32, 17, 19, 23, 26, 10, 32, 32,
493
+ 5, 6, 12, 5, 6, 29, 31, 31, 33, 32,
494
+ 32, nil, nil, nil, nil, nil, nil, nil, 10, nil,
495
+ nil, nil, 4 ]
496
+
497
+ racc_goto_pointer = [
498
+ nil, 19, 20, 14, 0, 6, 7, nil, nil, -17,
499
+ -14, -20, -9, nil, nil, nil, nil, 8, nil, 2,
500
+ nil, -14, nil, 0, nil, nil, -2, -18, nil, 4,
501
+ nil, -42, -46, -16 ]
502
+
503
+ racc_goto_default = [
504
+ nil, nil, nil, nil, 70, 71, 72, 7, 8, 13,
505
+ nil, nil, 21, 16, 17, 18, 19, 20, 22, 23,
506
+ 24, nil, 25, 26, 27, 28, 29, nil, 31, 32,
507
+ 52, nil, 69, 53 ]
508
+
509
+ racc_reduce_table = [
510
+ 0, 0, :racc_error,
511
+ 1, 15, :_reduce_1,
512
+ 0, 15, :_reduce_2,
513
+ 2, 16, :_reduce_3,
514
+ 1, 16, :_reduce_4,
515
+ 1, 17, :_reduce_5,
516
+ 1, 17, :_reduce_6,
517
+ 1, 17, :_reduce_none,
518
+ 1, 17, :_reduce_8,
519
+ 1, 17, :_reduce_9,
520
+ 1, 17, :_reduce_10,
521
+ 1, 17, :_reduce_11,
522
+ 1, 21, :_reduce_12,
523
+ 1, 22, :_reduce_13,
524
+ 1, 18, :_reduce_14,
525
+ 2, 23, :_reduce_15,
526
+ 1, 23, :_reduce_16,
527
+ 3, 19, :_reduce_17,
528
+ 1, 25, :_reduce_18,
529
+ 2, 24, :_reduce_19,
530
+ 4, 24, :_reduce_20,
531
+ 2, 24, :_reduce_21,
532
+ 1, 24, :_reduce_22,
533
+ 1, 26, :_reduce_none,
534
+ 1, 26, :_reduce_none,
535
+ 1, 26, :_reduce_none,
536
+ 1, 26, :_reduce_none,
537
+ 1, 20, :_reduce_27,
538
+ 3, 20, :_reduce_28,
539
+ 4, 20, :_reduce_29,
540
+ 2, 31, :_reduce_30,
541
+ 1, 31, :_reduce_31,
542
+ 1, 27, :_reduce_32,
543
+ 2, 32, :_reduce_33,
544
+ 1, 32, :_reduce_34,
545
+ 3, 33, :_reduce_35,
546
+ 1, 28, :_reduce_36,
547
+ 2, 36, :_reduce_37,
548
+ 1, 36, :_reduce_38,
549
+ 3, 37, :_reduce_39,
550
+ 1, 29, :_reduce_40,
551
+ 2, 39, :_reduce_41,
552
+ 1, 39, :_reduce_42,
553
+ 3, 40, :_reduce_43,
554
+ 1, 30, :_reduce_44,
555
+ 2, 42, :_reduce_45,
556
+ 1, 42, :_reduce_46,
557
+ 3, 43, :_reduce_47,
558
+ 3, 41, :_reduce_48,
559
+ 2, 41, :_reduce_49,
560
+ 4, 41, :_reduce_50,
561
+ 1, 41, :_reduce_51,
562
+ 2, 45, :_reduce_52,
563
+ 1, 45, :_reduce_none,
564
+ 1, 46, :_reduce_54,
565
+ 1, 46, :_reduce_55,
566
+ 1, 46, :_reduce_none,
567
+ 1, 46, :_reduce_57,
568
+ 1, 44, :_reduce_none,
569
+ 0, 44, :_reduce_none,
570
+ 2, 47, :_reduce_none,
571
+ 1, 47, :_reduce_none,
572
+ 2, 34, :_reduce_62,
573
+ 1, 34, :_reduce_63,
574
+ 2, 38, :_reduce_64,
575
+ 1, 38, :_reduce_65,
576
+ 2, 35, :_reduce_66,
577
+ 2, 35, :_reduce_67,
578
+ 2, 35, :_reduce_68,
579
+ 1, 35, :_reduce_69,
580
+ 1, 35, :_reduce_none,
581
+ 1, 35, :_reduce_71,
582
+ 0, 35, :_reduce_72 ]
583
+
584
+ racc_reduce_n = 73
585
+
586
+ racc_shift_n = 89
587
+
588
+ racc_token_table = {
589
+ false => 0,
590
+ :error => 1,
591
+ :DUMMY => 2,
592
+ :ITEMLISTLINE => 3,
593
+ :ENUMLISTLINE => 4,
594
+ :DESCLISTLINE => 5,
595
+ :METHODLISTLINE => 6,
596
+ :STRINGLINE => 7,
597
+ :WHITELINE => 8,
598
+ :SUBTREE => 9,
599
+ :HEADLINE => 10,
600
+ :INCLUDE => 11,
601
+ :INDENT => 12,
602
+ :DEDENT => 13 }
603
+
604
+ racc_nt_base = 14
605
+
606
+ racc_use_result_var = true
607
+
608
+ Racc_arg = [
609
+ racc_action_table,
610
+ racc_action_check,
611
+ racc_action_default,
612
+ racc_action_pointer,
613
+ racc_goto_table,
614
+ racc_goto_check,
615
+ racc_goto_default,
616
+ racc_goto_pointer,
617
+ racc_nt_base,
618
+ racc_reduce_table,
619
+ racc_token_table,
620
+ racc_shift_n,
621
+ racc_reduce_n,
622
+ racc_use_result_var ]
623
+
624
+ Racc_token_to_s_table = [
625
+ "$end",
626
+ "error",
627
+ "DUMMY",
628
+ "ITEMLISTLINE",
629
+ "ENUMLISTLINE",
630
+ "DESCLISTLINE",
631
+ "METHODLISTLINE",
632
+ "STRINGLINE",
633
+ "WHITELINE",
634
+ "SUBTREE",
635
+ "HEADLINE",
636
+ "INCLUDE",
637
+ "INDENT",
638
+ "DEDENT",
639
+ "$start",
640
+ "document",
641
+ "blocks",
642
+ "block",
643
+ "textblock",
644
+ "verbatim",
645
+ "lists",
646
+ "headline",
647
+ "include",
648
+ "textblockcontent",
649
+ "verbatimcontent",
650
+ "verbatim_after_lists",
651
+ "list",
652
+ "itemlist",
653
+ "enumlist",
654
+ "desclist",
655
+ "methodlist",
656
+ "lists2",
657
+ "itemlistitems",
658
+ "itemlistitem",
659
+ "first_textblock_in_itemlist",
660
+ "other_blocks_in_list",
661
+ "enumlistitems",
662
+ "enumlistitem",
663
+ "first_textblock_in_enumlist",
664
+ "desclistitems",
665
+ "desclistitem",
666
+ "description_part",
667
+ "methodlistitems",
668
+ "methodlistitem",
669
+ "whitelines",
670
+ "blocks_in_list",
671
+ "block_in_list",
672
+ "whitelines2" ]
673
+
674
+ Racc_debug_parser = false
675
+
676
+ ##### State transition tables end #####
677
+
678
+ # reduce 0 omitted
679
+
680
+ def _reduce_1(val, _values, result)
681
+ result = RDoc::Markup::Document.new(*val[0])
682
+ result
683
+ end
684
+
685
+ def _reduce_2(val, _values, result)
686
+ raise ParseError, "file empty"
687
+ result
688
+ end
689
+
690
+ def _reduce_3(val, _values, result)
691
+ result = val[0].concat val[1]
692
+ result
693
+ end
694
+
695
+ def _reduce_4(val, _values, result)
696
+ result = val[0]
697
+ result
698
+ end
699
+
700
+ def _reduce_5(val, _values, result)
701
+ result = val
702
+ result
703
+ end
704
+
705
+ def _reduce_6(val, _values, result)
706
+ result = val
707
+ result
708
+ end
709
+
710
+ # reduce 7 omitted
711
+
712
+ def _reduce_8(val, _values, result)
713
+ result = val
714
+ result
715
+ end
716
+
717
+ def _reduce_9(val, _values, result)
718
+ result = val
719
+ result
720
+ end
721
+
722
+ def _reduce_10(val, _values, result)
723
+ result = [RDoc::Markup::BlankLine.new]
724
+ result
725
+ end
726
+
727
+ def _reduce_11(val, _values, result)
728
+ result = val[0].parts
729
+ result
730
+ end
731
+
732
+ def _reduce_12(val, _values, result)
733
+ # val[0] is like [level, title]
734
+ title = @inline_parser.parse(val[0][1])
735
+ result = RDoc::Markup::Heading.new(val[0][0], title)
736
+
737
+ result
738
+ end
739
+
740
+ def _reduce_13(val, _values, result)
741
+ result = RDoc::Markup::Include.new val[0], @include_path
742
+
743
+ result
744
+ end
745
+
746
+ def _reduce_14(val, _values, result)
747
+ # val[0] is Array of String
748
+ result = paragraph val[0]
749
+
750
+ result
751
+ end
752
+
753
+ def _reduce_15(val, _values, result)
754
+ result << val[1].rstrip
755
+ result
756
+ end
757
+
758
+ def _reduce_16(val, _values, result)
759
+ result = [val[0].rstrip]
760
+ result
761
+ end
762
+
763
+ def _reduce_17(val, _values, result)
764
+ # val[1] is Array of String
765
+ content = cut_off val[1]
766
+ result = RDoc::Markup::Verbatim.new(*content)
767
+
768
+ # imform to lexer.
769
+ @in_verbatim = false
770
+
771
+ result
772
+ end
773
+
774
+ def _reduce_18(val, _values, result)
775
+ # val[0] is Array of String
776
+ content = cut_off val[0]
777
+ result = RDoc::Markup::Verbatim.new(*content)
778
+
779
+ # imform to lexer.
780
+ @in_verbatim = false
781
+
782
+ result
783
+ end
784
+
785
+ def _reduce_19(val, _values, result)
786
+ result << val[1]
787
+
788
+ result
789
+ end
790
+
791
+ def _reduce_20(val, _values, result)
792
+ result.concat val[2]
793
+
794
+ result
795
+ end
796
+
797
+ def _reduce_21(val, _values, result)
798
+ result << "\n"
799
+
800
+ result
801
+ end
802
+
803
+ def _reduce_22(val, _values, result)
804
+ result = val
805
+ # inform to lexer.
806
+ @in_verbatim = true
807
+
808
+ result
809
+ end
810
+
811
+ # reduce 23 omitted
812
+
813
+ # reduce 24 omitted
814
+
815
+ # reduce 25 omitted
816
+
817
+ # reduce 26 omitted
818
+
819
+ def _reduce_27(val, _values, result)
820
+ result = val[0]
821
+
822
+ result
823
+ end
824
+
825
+ def _reduce_28(val, _values, result)
826
+ result = val[1]
827
+
828
+ result
829
+ end
830
+
831
+ def _reduce_29(val, _values, result)
832
+ result = val[1].push(val[2])
833
+
834
+ result
835
+ end
836
+
837
+ def _reduce_30(val, _values, result)
838
+ result = val[0] << val[1]
839
+ result
840
+ end
841
+
842
+ def _reduce_31(val, _values, result)
843
+ result = [val[0]]
844
+ result
845
+ end
846
+
847
+ def _reduce_32(val, _values, result)
848
+ result = RDoc::Markup::List.new :BULLET, *val[0]
849
+
850
+ result
851
+ end
852
+
853
+ def _reduce_33(val, _values, result)
854
+ result.push(val[1])
855
+ result
856
+ end
857
+
858
+ def _reduce_34(val, _values, result)
859
+ result = val
860
+ result
861
+ end
862
+
863
+ def _reduce_35(val, _values, result)
864
+ result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
865
+
866
+ result
867
+ end
868
+
869
+ def _reduce_36(val, _values, result)
870
+ result = RDoc::Markup::List.new :NUMBER, *val[0]
871
+
872
+ result
873
+ end
874
+
875
+ def _reduce_37(val, _values, result)
876
+ result.push(val[1])
877
+ result
878
+ end
879
+
880
+ def _reduce_38(val, _values, result)
881
+ result = val
882
+ result
883
+ end
884
+
885
+ def _reduce_39(val, _values, result)
886
+ result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
887
+
888
+ result
889
+ end
890
+
891
+ def _reduce_40(val, _values, result)
892
+ result = RDoc::Markup::List.new :NOTE, *val[0]
893
+
894
+ result
895
+ end
896
+
897
+ def _reduce_41(val, _values, result)
898
+ result.push(val[1])
899
+ result
900
+ end
901
+
902
+ def _reduce_42(val, _values, result)
903
+ result = val
904
+ result
905
+ end
906
+
907
+ def _reduce_43(val, _values, result)
908
+ term = @inline_parser.parse val[0].strip
909
+
910
+ result = RDoc::Markup::ListItem.new term, *val[1]
911
+
912
+ result
913
+ end
914
+
915
+ def _reduce_44(val, _values, result)
916
+ result = RDoc::Markup::List.new :LABEL, *val[0]
917
+
918
+ result
919
+ end
920
+
921
+ def _reduce_45(val, _values, result)
922
+ result.push(val[1])
923
+ result
924
+ end
925
+
926
+ def _reduce_46(val, _values, result)
927
+ result = val
928
+ result
929
+ end
930
+
931
+ def _reduce_47(val, _values, result)
932
+ result = RDoc::Markup::ListItem.new "<tt>#{val[0].strip}</tt>", *val[1]
933
+
934
+ result
935
+ end
936
+
937
+ def _reduce_48(val, _values, result)
938
+ result = [val[1]].concat(val[2])
939
+
940
+ result
941
+ end
942
+
943
+ def _reduce_49(val, _values, result)
944
+ result = [val[1]]
945
+
946
+ result
947
+ end
948
+
949
+ def _reduce_50(val, _values, result)
950
+ result = val[2]
951
+
952
+ result
953
+ end
954
+
955
+ def _reduce_51(val, _values, result)
956
+ result = []
957
+
958
+ result
959
+ end
960
+
961
+ def _reduce_52(val, _values, result)
962
+ result.concat val[1]
963
+ result
964
+ end
965
+
966
+ # reduce 53 omitted
967
+
968
+ def _reduce_54(val, _values, result)
969
+ result = val
970
+ result
971
+ end
972
+
973
+ def _reduce_55(val, _values, result)
974
+ result = val
975
+ result
976
+ end
977
+
978
+ # reduce 56 omitted
979
+
980
+ def _reduce_57(val, _values, result)
981
+ result = []
982
+ result
983
+ end
984
+
985
+ # reduce 58 omitted
986
+
987
+ # reduce 59 omitted
988
+
989
+ # reduce 60 omitted
990
+
991
+ # reduce 61 omitted
992
+
993
+ def _reduce_62(val, _values, result)
994
+ result = paragraph [val[0]].concat(val[1])
995
+
996
+ result
997
+ end
998
+
999
+ def _reduce_63(val, _values, result)
1000
+ result = paragraph [val[0]]
1001
+
1002
+ result
1003
+ end
1004
+
1005
+ def _reduce_64(val, _values, result)
1006
+ result = paragraph [val[0]].concat(val[1])
1007
+
1008
+ result
1009
+ end
1010
+
1011
+ def _reduce_65(val, _values, result)
1012
+ result = paragraph [val[0]]
1013
+
1014
+ result
1015
+ end
1016
+
1017
+ def _reduce_66(val, _values, result)
1018
+ result = [val[0]].concat(val[1])
1019
+
1020
+ result
1021
+ end
1022
+
1023
+ def _reduce_67(val, _values, result)
1024
+ result.concat val[1]
1025
+ result
1026
+ end
1027
+
1028
+ def _reduce_68(val, _values, result)
1029
+ result = val[1]
1030
+ result
1031
+ end
1032
+
1033
+ def _reduce_69(val, _values, result)
1034
+ result = val
1035
+ result
1036
+ end
1037
+
1038
+ # reduce 70 omitted
1039
+
1040
+ def _reduce_71(val, _values, result)
1041
+ result = []
1042
+ result
1043
+ end
1044
+
1045
+ def _reduce_72(val, _values, result)
1046
+ result = []
1047
+ result
1048
+ end
1049
+
1050
+ def _reduce_none(val, _values, result)
1051
+ val[0]
1052
+ end
1053
+
1054
+ end # class BlockParser
1055
+
1056
+ end