rdoc 6.2.0 → 6.2.1

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c71da0922078855b23bba9eb9f3671d5f04abb40c690eab20382c812b1b6aacc
4
- data.tar.gz: bf58da8ba529883aa44e4ddc5e7c88a9671e508993bfd62142813cc661bbe62c
3
+ metadata.gz: 0ed13122ed21f8a23f92864685b11e29d15bded252571e52a16ca87318c84063
4
+ data.tar.gz: 96904ccc1312e72b6418b55132b810f52a5ace7004ad9c12ac4d37be258cae14
5
5
  SHA512:
6
- metadata.gz: f343d3101a0fbd05fc6d8675d9a72cc2aed5ff794258fc3fbe9f8658032857d61a68350ea09e29b84c02789cec3f0f8a6e83faf29faf41d2a00e6cbad07435c5
7
- data.tar.gz: f0f506c54e2ebc80b69d0d26104c44ae3ecc5cefcaa90a6cd4364f8e4660fc8021e6c7426bd63363519a217728a8c3ac0be217f4d28b6b3f1c4e9b1ff6f34c26
6
+ metadata.gz: ee977c75f90e1ec1b928fef68a78c737bface67434386ad6dda066e873d3da6b5c19bdfa8719614367be5a54fc0e9e89f342bd0766bbb067cf33eaf3fd06c7f9
7
+ data.tar.gz: 1434f635ecd255f3ab22bd90d1397f9c90189810c5d251e7f0557728239ce0aa4f967d21c49623a67459244c041fa4b2c38cc4504ed509ad6522f244a8eeece8
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/testtask'
5
5
  require 'rubocop/rake_task'
6
6
 
7
7
  task :docs => :generate
8
- task :test => :generate
8
+ task :test => [:normal_test, :rubygems_test]
9
9
 
10
10
  PARSER_FILES = %w[
11
11
  lib/rdoc/rd/block_parser.ry
@@ -34,10 +34,18 @@ task ghpages: :rdoc do
34
34
  FileUtils.cp_r Dir.glob("/tmp/html/*"), "."
35
35
  end
36
36
 
37
- Rake::TestTask.new(:test) do |t|
37
+ Rake::TestTask.new(:normal_test) do |t|
38
38
  t.libs << "test/rdoc"
39
39
  t.verbose = true
40
- t.test_files = FileList['test/**/test_*.rb']
40
+ t.deps = :generate
41
+ t.test_files = FileList["test/**/test_*.rb"].exclude("test/rdoc/test_rdoc_rubygems_hook.rb")
42
+ end
43
+
44
+ Rake::TestTask.new(:rubygems_test) do |t|
45
+ t.libs << "test/rdoc"
46
+ t.verbose = true
47
+ t.deps = :generate
48
+ t.pattern = "test/rdoc/test_rdoc_rubygems_hook.rb"
41
49
  end
42
50
 
43
51
  path = "pkg/#{Bundler::GemHelper.gemspec.full_name}"
@@ -23,6 +23,11 @@ class RDoc::Comment
23
23
 
24
24
  attr_accessor :location
25
25
 
26
+ ##
27
+ # Line where this Comment was written
28
+
29
+ attr_accessor :line
30
+
26
31
  ##
27
32
  # For duck-typing when merging classes at load time
28
33
 
@@ -28,7 +28,7 @@ class RDoc::CrossReference
28
28
  # have been suppressed, since the suppression characters are removed by the
29
29
  # code that is triggered.
30
30
 
31
- CROSSREF_REGEXP = /(?:^|\s)
31
+ CROSSREF_REGEXP = /(?:^|[\s()])
32
32
  (
33
33
  (?:
34
34
  # A::B::C.meth
@@ -76,7 +76,7 @@ class RDoc::CrossReference
76
76
  # Version of CROSSREF_REGEXP used when <tt>--hyperlink-all</tt> is specified.
77
77
 
78
78
  ALL_CROSSREF_REGEXP = /
79
- (?:^|\s)
79
+ (?:^|[\s()])
80
80
  (
81
81
  (?:
82
82
  # A::B::C.meth
@@ -269,7 +269,7 @@ class RDoc::Generator::Darkfish
269
269
 
270
270
  @options.static_path.each do |path|
271
271
  unless File.directory? path then
272
- FileUtils.install path, @outputdir, fu_options.merge(:mode => 0644)
272
+ FileUtils.install path, @outputdir, **fu_options.merge(:mode => 0644)
273
273
  next
274
274
  end
275
275
 
@@ -278,9 +278,9 @@ class RDoc::Generator::Darkfish
278
278
  dest_file = @outputdir + entry
279
279
 
280
280
  if File.directory? entry then
281
- FileUtils.mkdir_p entry, fu_options
281
+ FileUtils.mkdir_p entry, **fu_options
282
282
  else
283
- FileUtils.install entry, dest_file, fu_options.merge(:mode => 0644)
283
+ FileUtils.install entry, dest_file, **fu_options.merge(:mode => 0644)
284
284
  end
285
285
  end
286
286
  end
@@ -585,16 +585,16 @@ class RDoc::Generator::Darkfish
585
585
  return unless source.exist?
586
586
 
587
587
  begin
588
- FileUtils.mkdir_p File.dirname(destination), options
588
+ FileUtils.mkdir_p File.dirname(destination), **options
589
589
 
590
590
  begin
591
- FileUtils.ln source, destination, options
591
+ FileUtils.ln source, destination, **options
592
592
  rescue Errno::EEXIST
593
593
  FileUtils.rm destination
594
594
  retry
595
595
  end
596
596
  rescue
597
- FileUtils.cp source, destination, options
597
+ FileUtils.cp source, destination, **options
598
598
  end
599
599
  end
600
600
 
@@ -0,0 +1,16287 @@
1
+ # coding: UTF-8
2
+ # frozen_string_literal: true
3
+ # :markup: markdown
4
+
5
+ ##
6
+ # RDoc::Markdown as described by the [markdown syntax][syntax].
7
+ #
8
+ # To choose Markdown as your only default format see
9
+ # RDoc::Options@Saved+Options for instructions on setting up a `.doc_options`
10
+ # file to store your project default.
11
+ #
12
+ # ## Usage
13
+ #
14
+ # Here is a brief example of using this parse to read a markdown file by hand.
15
+ #
16
+ # data = File.read("README.md")
17
+ # formatter = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
18
+ # html = RDoc::Markdown.parse(data).accept(formatter)
19
+ #
20
+ # # do something with html
21
+ #
22
+ # ## Extensions
23
+ #
24
+ # The following markdown extensions are supported by the parser, but not all
25
+ # are used in RDoc output by default.
26
+ #
27
+ # ### RDoc
28
+ #
29
+ # The RDoc Markdown parser has the following built-in behaviors that cannot be
30
+ # disabled.
31
+ #
32
+ # Underscores embedded in words are never interpreted as emphasis. (While the
33
+ # [markdown dingus][dingus] emphasizes in-word underscores, neither the
34
+ # Markdown syntax nor MarkdownTest mention this behavior.)
35
+ #
36
+ # For HTML output, RDoc always auto-links bare URLs.
37
+ #
38
+ # ### Break on Newline
39
+ #
40
+ # The break_on_newline extension converts all newlines into hard line breaks
41
+ # as in [Github Flavored Markdown][GFM]. This extension is disabled by
42
+ # default.
43
+ #
44
+ # ### CSS
45
+ #
46
+ # The #css extension enables CSS blocks to be included in the output, but they
47
+ # are not used for any built-in RDoc output format. This extension is disabled
48
+ # by default.
49
+ #
50
+ # Example:
51
+ #
52
+ # <style type="text/css">
53
+ # h1 { font-size: 3em }
54
+ # </style>
55
+ #
56
+ # ### Definition Lists
57
+ #
58
+ # The definition_lists extension allows definition lists using the [PHP
59
+ # Markdown Extra syntax][PHPE], but only one label and definition are supported
60
+ # at this time. This extension is enabled by default.
61
+ #
62
+ # Example:
63
+ #
64
+ # ```
65
+ # cat
66
+ # : A small furry mammal
67
+ # that seems to sleep a lot
68
+ #
69
+ # ant
70
+ # : A little insect that is known
71
+ # to enjoy picnics
72
+ #
73
+ # ```
74
+ #
75
+ # Produces:
76
+ #
77
+ # cat
78
+ # : A small furry mammal
79
+ # that seems to sleep a lot
80
+ #
81
+ # ant
82
+ # : A little insect that is known
83
+ # to enjoy picnics
84
+ #
85
+ # ### Strike
86
+ #
87
+ # Example:
88
+ #
89
+ # ```
90
+ # This is ~~striked~~.
91
+ # ```
92
+ #
93
+ # Produces:
94
+ #
95
+ # This is ~~striked~~.
96
+ #
97
+ # ### Github
98
+ #
99
+ # The #github extension enables a partial set of [Github Flavored Markdown]
100
+ # [GFM]. This extension is enabled by default.
101
+ #
102
+ # Supported github extensions include:
103
+ #
104
+ # #### Fenced code blocks
105
+ #
106
+ # Use ` ``` ` around a block of code instead of indenting it four spaces.
107
+ #
108
+ # #### Syntax highlighting
109
+ #
110
+ # Use ` ``` ruby ` as the start of a code fence to add syntax highlighting.
111
+ # (Currently only `ruby` syntax is supported).
112
+ #
113
+ # ### HTML
114
+ #
115
+ # Enables raw HTML to be included in the output. This extension is enabled by
116
+ # default.
117
+ #
118
+ # Example:
119
+ #
120
+ # <table>
121
+ # ...
122
+ # </table>
123
+ #
124
+ # ### Notes
125
+ #
126
+ # The #notes extension enables footnote support. This extension is enabled by
127
+ # default.
128
+ #
129
+ # Example:
130
+ #
131
+ # Here is some text[^1] including an inline footnote ^[for short footnotes]
132
+ #
133
+ # ...
134
+ #
135
+ # [^1]: With the footnote text down at the bottom
136
+ #
137
+ # Produces:
138
+ #
139
+ # Here is some text[^1] including an inline footnote ^[for short footnotes]
140
+ #
141
+ # [^1]: With the footnote text down at the bottom
142
+ #
143
+ # ## Limitations
144
+ #
145
+ # * Link titles are not used
146
+ # * Footnotes are collapsed into a single paragraph
147
+ #
148
+ # ## Author
149
+ #
150
+ # This markdown parser is a port to kpeg from [peg-markdown][pegmarkdown] by
151
+ # John MacFarlane.
152
+ #
153
+ # It is used under the MIT license:
154
+ #
155
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
156
+ # of this software and associated documentation files (the "Software"), to deal
157
+ # in the Software without restriction, including without limitation the rights
158
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
159
+ # copies of the Software, and to permit persons to whom the Software is
160
+ # furnished to do so, subject to the following conditions:
161
+ #
162
+ # The above copyright notice and this permission notice shall be included in
163
+ # all copies or substantial portions of the Software.
164
+ #
165
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
168
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
169
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
170
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
171
+ # THE SOFTWARE.
172
+ #
173
+ # The port to kpeg was performed by Eric Hodel and Evan Phoenix
174
+ #
175
+ # [dingus]: http://daringfireball.net/projects/markdown/dingus
176
+ # [GFM]: http://github.github.com/github-flavored-markdown/
177
+ # [pegmarkdown]: https://github.com/jgm/peg-markdown
178
+ # [PHPE]: http://michelf.com/projects/php-markdown/extra/#def-list
179
+ # [syntax]: http://daringfireball.net/projects/markdown/syntax
180
+ #--
181
+ # Last updated to jgm/peg-markdown commit 8f8fc22ef0
182
+ class RDoc::Markdown
183
+ # :stopdoc:
184
+
185
+ # This is distinct from setup_parser so that a standalone parser
186
+ # can redefine #initialize and still have access to the proper
187
+ # parser setup code.
188
+ def initialize(str, debug=false)
189
+ setup_parser(str, debug)
190
+ end
191
+
192
+
193
+
194
+ # Prepares for parsing +str+. If you define a custom initialize you must
195
+ # call this method before #parse
196
+ def setup_parser(str, debug=false)
197
+ set_string str, 0
198
+ @memoizations = Hash.new { |h,k| h[k] = {} }
199
+ @result = nil
200
+ @failed_rule = nil
201
+ @failing_rule_offset = -1
202
+
203
+ setup_foreign_grammar
204
+ end
205
+
206
+ attr_reader :string
207
+ attr_reader :failing_rule_offset
208
+ attr_accessor :result, :pos
209
+
210
+ def current_column(target=pos)
211
+ if c = string.rindex("\n", target-1)
212
+ return target - c - 1
213
+ end
214
+
215
+ target + 1
216
+ end
217
+
218
+ def current_line(target=pos)
219
+ cur_offset = 0
220
+ cur_line = 0
221
+
222
+ string.each_line do |line|
223
+ cur_line += 1
224
+ cur_offset += line.size
225
+ return cur_line if cur_offset >= target
226
+ end
227
+
228
+ -1
229
+ end
230
+
231
+ def lines
232
+ lines = []
233
+ string.each_line { |l| lines << l }
234
+ lines
235
+ end
236
+
237
+
238
+
239
+ def get_text(start)
240
+ @string[start..@pos-1]
241
+ end
242
+
243
+ # Sets the string and current parsing position for the parser.
244
+ def set_string string, pos
245
+ @string = string
246
+ @string_size = string ? string.size : 0
247
+ @pos = pos
248
+ end
249
+
250
+ def show_pos
251
+ width = 10
252
+ if @pos < width
253
+ "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")"
254
+ else
255
+ "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")"
256
+ end
257
+ end
258
+
259
+ def failure_info
260
+ l = current_line @failing_rule_offset
261
+ c = current_column @failing_rule_offset
262
+
263
+ if @failed_rule.kind_of? Symbol
264
+ info = self.class::Rules[@failed_rule]
265
+ "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
266
+ else
267
+ "line #{l}, column #{c}: failed rule '#{@failed_rule}'"
268
+ end
269
+ end
270
+
271
+ def failure_caret
272
+ l = current_line @failing_rule_offset
273
+ c = current_column @failing_rule_offset
274
+
275
+ line = lines[l-1]
276
+ "#{line}\n#{' ' * (c - 1)}^"
277
+ end
278
+
279
+ def failure_character
280
+ l = current_line @failing_rule_offset
281
+ c = current_column @failing_rule_offset
282
+ lines[l-1][c-1, 1]
283
+ end
284
+
285
+ def failure_oneline
286
+ l = current_line @failing_rule_offset
287
+ c = current_column @failing_rule_offset
288
+
289
+ char = lines[l-1][c-1, 1]
290
+
291
+ if @failed_rule.kind_of? Symbol
292
+ info = self.class::Rules[@failed_rule]
293
+ "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
294
+ else
295
+ "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'"
296
+ end
297
+ end
298
+
299
+ class ParseError < RuntimeError
300
+ end
301
+
302
+ def raise_error
303
+ raise ParseError, failure_oneline
304
+ end
305
+
306
+ def show_error(io=STDOUT)
307
+ error_pos = @failing_rule_offset
308
+ line_no = current_line(error_pos)
309
+ col_no = current_column(error_pos)
310
+
311
+ io.puts "On line #{line_no}, column #{col_no}:"
312
+
313
+ if @failed_rule.kind_of? Symbol
314
+ info = self.class::Rules[@failed_rule]
315
+ io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
316
+ else
317
+ io.puts "Failed to match rule '#{@failed_rule}'"
318
+ end
319
+
320
+ io.puts "Got: #{string[error_pos,1].inspect}"
321
+ line = lines[line_no-1]
322
+ io.puts "=> #{line}"
323
+ io.print(" " * (col_no + 3))
324
+ io.puts "^"
325
+ end
326
+
327
+ def set_failed_rule(name)
328
+ if @pos > @failing_rule_offset
329
+ @failed_rule = name
330
+ @failing_rule_offset = @pos
331
+ end
332
+ end
333
+
334
+ attr_reader :failed_rule
335
+
336
+ def match_string(str)
337
+ len = str.size
338
+ if @string[pos,len] == str
339
+ @pos += len
340
+ return str
341
+ end
342
+
343
+ return nil
344
+ end
345
+
346
+ def scan(reg)
347
+ if m = reg.match(@string[@pos..-1])
348
+ width = m.end(0)
349
+ @pos += width
350
+ return true
351
+ end
352
+
353
+ return nil
354
+ end
355
+
356
+ if "".respond_to? :ord
357
+ def get_byte
358
+ if @pos >= @string_size
359
+ return nil
360
+ end
361
+
362
+ s = @string[@pos].ord
363
+ @pos += 1
364
+ s
365
+ end
366
+ else
367
+ def get_byte
368
+ if @pos >= @string_size
369
+ return nil
370
+ end
371
+
372
+ s = @string[@pos]
373
+ @pos += 1
374
+ s
375
+ end
376
+ end
377
+
378
+ def parse(rule=nil)
379
+ # We invoke the rules indirectly via apply
380
+ # instead of by just calling them as methods because
381
+ # if the rules use left recursion, apply needs to
382
+ # manage that.
383
+
384
+ if !rule
385
+ apply(:_root)
386
+ else
387
+ method = rule.gsub("-","_hyphen_")
388
+ apply :"_#{method}"
389
+ end
390
+ end
391
+
392
+ class MemoEntry
393
+ def initialize(ans, pos)
394
+ @ans = ans
395
+ @pos = pos
396
+ @result = nil
397
+ @set = false
398
+ @left_rec = false
399
+ end
400
+
401
+ attr_reader :ans, :pos, :result, :set
402
+ attr_accessor :left_rec
403
+
404
+ def move!(ans, pos, result)
405
+ @ans = ans
406
+ @pos = pos
407
+ @result = result
408
+ @set = true
409
+ @left_rec = false
410
+ end
411
+ end
412
+
413
+ def external_invoke(other, rule, *args)
414
+ old_pos = @pos
415
+ old_string = @string
416
+
417
+ set_string other.string, other.pos
418
+
419
+ begin
420
+ if val = __send__(rule, *args)
421
+ other.pos = @pos
422
+ other.result = @result
423
+ else
424
+ other.set_failed_rule "#{self.class}##{rule}"
425
+ end
426
+ val
427
+ ensure
428
+ set_string old_string, old_pos
429
+ end
430
+ end
431
+
432
+ def apply_with_args(rule, *args)
433
+ memo_key = [rule, args]
434
+ if m = @memoizations[memo_key][@pos]
435
+ @pos = m.pos
436
+ if !m.set
437
+ m.left_rec = true
438
+ return nil
439
+ end
440
+
441
+ @result = m.result
442
+
443
+ return m.ans
444
+ else
445
+ m = MemoEntry.new(nil, @pos)
446
+ @memoizations[memo_key][@pos] = m
447
+ start_pos = @pos
448
+
449
+ ans = __send__ rule, *args
450
+
451
+ lr = m.left_rec
452
+
453
+ m.move! ans, @pos, @result
454
+
455
+ # Don't bother trying to grow the left recursion
456
+ # if it's failing straight away (thus there is no seed)
457
+ if ans and lr
458
+ return grow_lr(rule, args, start_pos, m)
459
+ else
460
+ return ans
461
+ end
462
+ end
463
+ end
464
+
465
+ def apply(rule)
466
+ if m = @memoizations[rule][@pos]
467
+ @pos = m.pos
468
+ if !m.set
469
+ m.left_rec = true
470
+ return nil
471
+ end
472
+
473
+ @result = m.result
474
+
475
+ return m.ans
476
+ else
477
+ m = MemoEntry.new(nil, @pos)
478
+ @memoizations[rule][@pos] = m
479
+ start_pos = @pos
480
+
481
+ ans = __send__ rule
482
+
483
+ lr = m.left_rec
484
+
485
+ m.move! ans, @pos, @result
486
+
487
+ # Don't bother trying to grow the left recursion
488
+ # if it's failing straight away (thus there is no seed)
489
+ if ans and lr
490
+ return grow_lr(rule, nil, start_pos, m)
491
+ else
492
+ return ans
493
+ end
494
+ end
495
+ end
496
+
497
+ def grow_lr(rule, args, start_pos, m)
498
+ while true
499
+ @pos = start_pos
500
+ @result = m.result
501
+
502
+ if args
503
+ ans = __send__ rule, *args
504
+ else
505
+ ans = __send__ rule
506
+ end
507
+ return nil unless ans
508
+
509
+ break if @pos <= m.pos
510
+
511
+ m.move! ans, @pos, @result
512
+ end
513
+
514
+ @result = m.result
515
+ @pos = m.pos
516
+ return m.ans
517
+ end
518
+
519
+ class RuleInfo
520
+ def initialize(name, rendered)
521
+ @name = name
522
+ @rendered = rendered
523
+ end
524
+
525
+ attr_reader :name, :rendered
526
+ end
527
+
528
+ def self.rule_info(name, rendered)
529
+ RuleInfo.new(name, rendered)
530
+ end
531
+
532
+
533
+ # :startdoc:
534
+
535
+
536
+
537
+ require 'rdoc'
538
+ require 'rdoc/markup/to_joined_paragraph'
539
+ require 'rdoc/markdown/entities'
540
+
541
+ require 'rdoc/markdown/literals'
542
+
543
+ ##
544
+ # Supported extensions
545
+
546
+ EXTENSIONS = []
547
+
548
+ ##
549
+ # Extensions enabled by default
550
+
551
+ DEFAULT_EXTENSIONS = [
552
+ :definition_lists,
553
+ :github,
554
+ :html,
555
+ :notes,
556
+ :strike,
557
+ ]
558
+
559
+ # :section: Extensions
560
+
561
+ ##
562
+ # Creates extension methods for the `name` extension to enable and disable
563
+ # the extension and to query if they are active.
564
+
565
+ def self.extension name
566
+ EXTENSIONS << name
567
+
568
+ define_method "#{name}?" do
569
+ extension? name
570
+ end
571
+
572
+ define_method "#{name}=" do |enable|
573
+ extension name, enable
574
+ end
575
+ end
576
+
577
+ ##
578
+ # Converts all newlines into hard breaks
579
+
580
+ extension :break_on_newline
581
+
582
+ ##
583
+ # Allow style blocks
584
+
585
+ extension :css
586
+
587
+ ##
588
+ # Allow PHP Markdown Extras style definition lists
589
+
590
+ extension :definition_lists
591
+
592
+ ##
593
+ # Allow Github Flavored Markdown
594
+
595
+ extension :github
596
+
597
+ ##
598
+ # Allow HTML
599
+
600
+ extension :html
601
+
602
+ ##
603
+ # Enables the notes extension
604
+
605
+ extension :notes
606
+
607
+ ##
608
+ # Enables the strike extension
609
+
610
+ extension :strike
611
+
612
+ # :section:
613
+
614
+ ##
615
+ # Parses the `markdown` document into an RDoc::Document using the default
616
+ # extensions.
617
+
618
+ def self.parse markdown
619
+ parser = new
620
+
621
+ parser.parse markdown
622
+ end
623
+
624
+ # TODO remove when kpeg 0.10 is released
625
+ alias orig_initialize initialize # :nodoc:
626
+
627
+ ##
628
+ # Creates a new markdown parser that enables the given +extensions+.
629
+
630
+ def initialize extensions = DEFAULT_EXTENSIONS, debug = false
631
+ @debug = debug
632
+ @formatter = RDoc::Markup::ToJoinedParagraph.new
633
+ @extensions = extensions
634
+
635
+ @references = nil
636
+ @unlinked_references = nil
637
+
638
+ @footnotes = nil
639
+ @note_order = nil
640
+ end
641
+
642
+ ##
643
+ # Wraps `text` in emphasis for rdoc inline formatting
644
+
645
+ def emphasis text
646
+ if text =~ /\A[a-z\d.\/]+\z/i then
647
+ "_#{text}_"
648
+ else
649
+ "<em>#{text}</em>"
650
+ end
651
+ end
652
+
653
+ ##
654
+ # :category: Extensions
655
+ #
656
+ # Is the extension `name` enabled?
657
+
658
+ def extension? name
659
+ @extensions.include? name
660
+ end
661
+
662
+ ##
663
+ # :category: Extensions
664
+ #
665
+ # Enables or disables the extension with `name`
666
+
667
+ def extension name, enable
668
+ if enable then
669
+ @extensions |= [name]
670
+ else
671
+ @extensions -= [name]
672
+ end
673
+ end
674
+
675
+ ##
676
+ # Parses `text` in a clone of this parser. This is used for handling nested
677
+ # lists the same way as markdown_parser.
678
+
679
+ def inner_parse text # :nodoc:
680
+ parser = clone
681
+
682
+ parser.setup_parser text, @debug
683
+
684
+ parser.peg_parse
685
+
686
+ doc = parser.result
687
+
688
+ doc.accept @formatter
689
+
690
+ doc.parts
691
+ end
692
+
693
+ ##
694
+ # Finds a link reference for `label` and creates a new link to it with
695
+ # `content` as the link text. If `label` was not encountered in the
696
+ # reference-gathering parser pass the label and content are reconstructed
697
+ # with the linking `text` (usually whitespace).
698
+
699
+ def link_to content, label = content, text = nil
700
+ raise ParseError, 'enable notes extension' if
701
+ content.start_with? '^' and label.equal? content
702
+
703
+ if ref = @references[label] then
704
+ "{#{content}}[#{ref}]"
705
+ elsif label.equal? content then
706
+ "[#{content}]#{text}"
707
+ else
708
+ "[#{content}]#{text}[#{label}]"
709
+ end
710
+ end
711
+
712
+ ##
713
+ # Creates an RDoc::Markup::ListItem by parsing the `unparsed` content from
714
+ # the first parsing pass.
715
+
716
+ def list_item_from unparsed
717
+ parsed = inner_parse unparsed.join
718
+ RDoc::Markup::ListItem.new nil, *parsed
719
+ end
720
+
721
+ ##
722
+ # Stores `label` as a note and fills in previously unknown note references.
723
+
724
+ def note label
725
+ #foottext = "rdoc-label:foottext-#{label}:footmark-#{label}"
726
+
727
+ #ref.replace foottext if ref = @unlinked_notes.delete(label)
728
+
729
+ @notes[label] = foottext
730
+
731
+ #"{^1}[rdoc-label:footmark-#{label}:foottext-#{label}] "
732
+ end
733
+
734
+ ##
735
+ # Creates a new link for the footnote `reference` and adds the reference to
736
+ # the note order list for proper display at the end of the document.
737
+
738
+ def note_for ref
739
+ @note_order << ref
740
+
741
+ label = @note_order.length
742
+
743
+ "{*#{label}}[rdoc-label:foottext-#{label}:footmark-#{label}]"
744
+ end
745
+
746
+ ##
747
+ # The internal kpeg parse method
748
+
749
+ alias peg_parse parse # :nodoc:
750
+
751
+ ##
752
+ # Creates an RDoc::Markup::Paragraph from `parts` and including
753
+ # extension-specific behavior
754
+
755
+ def paragraph parts
756
+ parts = parts.map do |part|
757
+ if "\n" == part then
758
+ RDoc::Markup::HardBreak.new
759
+ else
760
+ part
761
+ end
762
+ end if break_on_newline?
763
+
764
+ RDoc::Markup::Paragraph.new(*parts)
765
+ end
766
+
767
+ ##
768
+ # Parses `markdown` into an RDoc::Document
769
+
770
+ def parse markdown
771
+ @references = {}
772
+ @unlinked_references = {}
773
+
774
+ markdown += "\n\n"
775
+
776
+ setup_parser markdown, @debug
777
+ peg_parse 'References'
778
+
779
+ if notes? then
780
+ @footnotes = {}
781
+
782
+ setup_parser markdown, @debug
783
+ peg_parse 'Notes'
784
+
785
+ # using note_order on the first pass would be a bug
786
+ @note_order = []
787
+ end
788
+
789
+ setup_parser markdown, @debug
790
+ peg_parse
791
+
792
+ doc = result
793
+
794
+ if notes? and not @footnotes.empty? then
795
+ doc << RDoc::Markup::Rule.new(1)
796
+
797
+ @note_order.each_with_index do |ref, index|
798
+ label = index + 1
799
+ note = @footnotes[ref]
800
+
801
+ link = "{^#{label}}[rdoc-label:footmark-#{label}:foottext-#{label}] "
802
+ note.parts.unshift link
803
+
804
+ doc << note
805
+ end
806
+ end
807
+
808
+ doc.accept @formatter
809
+
810
+ doc
811
+ end
812
+
813
+ ##
814
+ # Stores `label` as a reference to `link` and fills in previously unknown
815
+ # link references.
816
+
817
+ def reference label, link
818
+ if ref = @unlinked_references.delete(label) then
819
+ ref.replace link
820
+ end
821
+
822
+ @references[label] = link
823
+ end
824
+
825
+ ##
826
+ # Wraps `text` in strong markup for rdoc inline formatting
827
+
828
+ def strong text
829
+ if text =~ /\A[a-z\d.\/-]+\z/i then
830
+ "*#{text}*"
831
+ else
832
+ "<b>#{text}</b>"
833
+ end
834
+ end
835
+
836
+ ##
837
+ # Wraps `text` in strike markup for rdoc inline formatting
838
+
839
+ def strike text
840
+ if text =~ /\A[a-z\d.\/-]+\z/i then
841
+ "~#{text}~"
842
+ else
843
+ "<s>#{text}</s>"
844
+ end
845
+ end
846
+
847
+
848
+ # :stopdoc:
849
+ def setup_foreign_grammar
850
+ @_grammar_literals = RDoc::Markdown::Literals.new(nil)
851
+ end
852
+
853
+ # root = Doc
854
+ def _root
855
+ _tmp = apply(:_Doc)
856
+ set_failed_rule :_root unless _tmp
857
+ return _tmp
858
+ end
859
+
860
+ # Doc = BOM? Block*:a { RDoc::Markup::Document.new(*a.compact) }
861
+ def _Doc
862
+
863
+ _save = self.pos
864
+ while true # sequence
865
+ _save1 = self.pos
866
+ _tmp = apply(:_BOM)
867
+ unless _tmp
868
+ _tmp = true
869
+ self.pos = _save1
870
+ end
871
+ unless _tmp
872
+ self.pos = _save
873
+ break
874
+ end
875
+ _ary = []
876
+ while true
877
+ _tmp = apply(:_Block)
878
+ _ary << @result if _tmp
879
+ break unless _tmp
880
+ end
881
+ _tmp = true
882
+ @result = _ary
883
+ a = @result
884
+ unless _tmp
885
+ self.pos = _save
886
+ break
887
+ end
888
+ @result = begin; RDoc::Markup::Document.new(*a.compact) ; end
889
+ _tmp = true
890
+ unless _tmp
891
+ self.pos = _save
892
+ end
893
+ break
894
+ end # end sequence
895
+
896
+ set_failed_rule :_Doc unless _tmp
897
+ return _tmp
898
+ end
899
+
900
+ # Block = @BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)
901
+ def _Block
902
+
903
+ _save = self.pos
904
+ while true # sequence
905
+ while true
906
+ _tmp = _BlankLine()
907
+ break unless _tmp
908
+ end
909
+ _tmp = true
910
+ unless _tmp
911
+ self.pos = _save
912
+ break
913
+ end
914
+
915
+ _save2 = self.pos
916
+ while true # choice
917
+ _tmp = apply(:_BlockQuote)
918
+ break if _tmp
919
+ self.pos = _save2
920
+ _tmp = apply(:_Verbatim)
921
+ break if _tmp
922
+ self.pos = _save2
923
+ _tmp = apply(:_CodeFence)
924
+ break if _tmp
925
+ self.pos = _save2
926
+ _tmp = apply(:_Note)
927
+ break if _tmp
928
+ self.pos = _save2
929
+ _tmp = apply(:_Reference)
930
+ break if _tmp
931
+ self.pos = _save2
932
+ _tmp = apply(:_HorizontalRule)
933
+ break if _tmp
934
+ self.pos = _save2
935
+ _tmp = apply(:_Heading)
936
+ break if _tmp
937
+ self.pos = _save2
938
+ _tmp = apply(:_OrderedList)
939
+ break if _tmp
940
+ self.pos = _save2
941
+ _tmp = apply(:_BulletList)
942
+ break if _tmp
943
+ self.pos = _save2
944
+ _tmp = apply(:_DefinitionList)
945
+ break if _tmp
946
+ self.pos = _save2
947
+ _tmp = apply(:_HtmlBlock)
948
+ break if _tmp
949
+ self.pos = _save2
950
+ _tmp = apply(:_StyleBlock)
951
+ break if _tmp
952
+ self.pos = _save2
953
+ _tmp = apply(:_Para)
954
+ break if _tmp
955
+ self.pos = _save2
956
+ _tmp = apply(:_Plain)
957
+ break if _tmp
958
+ self.pos = _save2
959
+ break
960
+ end # end choice
961
+
962
+ unless _tmp
963
+ self.pos = _save
964
+ end
965
+ break
966
+ end # end sequence
967
+
968
+ set_failed_rule :_Block unless _tmp
969
+ return _tmp
970
+ end
971
+
972
+ # Para = @NonindentSpace Inlines:a @BlankLine+ { paragraph a }
973
+ def _Para
974
+
975
+ _save = self.pos
976
+ while true # sequence
977
+ _tmp = _NonindentSpace()
978
+ unless _tmp
979
+ self.pos = _save
980
+ break
981
+ end
982
+ _tmp = apply(:_Inlines)
983
+ a = @result
984
+ unless _tmp
985
+ self.pos = _save
986
+ break
987
+ end
988
+ _save1 = self.pos
989
+ _tmp = _BlankLine()
990
+ if _tmp
991
+ while true
992
+ _tmp = _BlankLine()
993
+ break unless _tmp
994
+ end
995
+ _tmp = true
996
+ else
997
+ self.pos = _save1
998
+ end
999
+ unless _tmp
1000
+ self.pos = _save
1001
+ break
1002
+ end
1003
+ @result = begin; paragraph a ; end
1004
+ _tmp = true
1005
+ unless _tmp
1006
+ self.pos = _save
1007
+ end
1008
+ break
1009
+ end # end sequence
1010
+
1011
+ set_failed_rule :_Para unless _tmp
1012
+ return _tmp
1013
+ end
1014
+
1015
+ # Plain = Inlines:a { paragraph a }
1016
+ def _Plain
1017
+
1018
+ _save = self.pos
1019
+ while true # sequence
1020
+ _tmp = apply(:_Inlines)
1021
+ a = @result
1022
+ unless _tmp
1023
+ self.pos = _save
1024
+ break
1025
+ end
1026
+ @result = begin; paragraph a ; end
1027
+ _tmp = true
1028
+ unless _tmp
1029
+ self.pos = _save
1030
+ end
1031
+ break
1032
+ end # end sequence
1033
+
1034
+ set_failed_rule :_Plain unless _tmp
1035
+ return _tmp
1036
+ end
1037
+
1038
+ # AtxInline = !@Newline !(@Sp /#*/ @Sp @Newline) Inline
1039
+ def _AtxInline
1040
+
1041
+ _save = self.pos
1042
+ while true # sequence
1043
+ _save1 = self.pos
1044
+ _tmp = _Newline()
1045
+ _tmp = _tmp ? nil : true
1046
+ self.pos = _save1
1047
+ unless _tmp
1048
+ self.pos = _save
1049
+ break
1050
+ end
1051
+ _save2 = self.pos
1052
+
1053
+ _save3 = self.pos
1054
+ while true # sequence
1055
+ _tmp = _Sp()
1056
+ unless _tmp
1057
+ self.pos = _save3
1058
+ break
1059
+ end
1060
+ _tmp = scan(/\A(?-mix:#*)/)
1061
+ unless _tmp
1062
+ self.pos = _save3
1063
+ break
1064
+ end
1065
+ _tmp = _Sp()
1066
+ unless _tmp
1067
+ self.pos = _save3
1068
+ break
1069
+ end
1070
+ _tmp = _Newline()
1071
+ unless _tmp
1072
+ self.pos = _save3
1073
+ end
1074
+ break
1075
+ end # end sequence
1076
+
1077
+ _tmp = _tmp ? nil : true
1078
+ self.pos = _save2
1079
+ unless _tmp
1080
+ self.pos = _save
1081
+ break
1082
+ end
1083
+ _tmp = apply(:_Inline)
1084
+ unless _tmp
1085
+ self.pos = _save
1086
+ end
1087
+ break
1088
+ end # end sequence
1089
+
1090
+ set_failed_rule :_AtxInline unless _tmp
1091
+ return _tmp
1092
+ end
1093
+
1094
+ # AtxStart = < /\#{1,6}/ > { text.length }
1095
+ def _AtxStart
1096
+
1097
+ _save = self.pos
1098
+ while true # sequence
1099
+ _text_start = self.pos
1100
+ _tmp = scan(/\A(?-mix:\#{1,6})/)
1101
+ if _tmp
1102
+ text = get_text(_text_start)
1103
+ end
1104
+ unless _tmp
1105
+ self.pos = _save
1106
+ break
1107
+ end
1108
+ @result = begin; text.length ; end
1109
+ _tmp = true
1110
+ unless _tmp
1111
+ self.pos = _save
1112
+ end
1113
+ break
1114
+ end # end sequence
1115
+
1116
+ set_failed_rule :_AtxStart unless _tmp
1117
+ return _tmp
1118
+ end
1119
+
1120
+ # AtxHeading = AtxStart:s @Sp AtxInline+:a (@Sp /#*/ @Sp)? @Newline { RDoc::Markup::Heading.new(s, a.join) }
1121
+ def _AtxHeading
1122
+
1123
+ _save = self.pos
1124
+ while true # sequence
1125
+ _tmp = apply(:_AtxStart)
1126
+ s = @result
1127
+ unless _tmp
1128
+ self.pos = _save
1129
+ break
1130
+ end
1131
+ _tmp = _Sp()
1132
+ unless _tmp
1133
+ self.pos = _save
1134
+ break
1135
+ end
1136
+ _save1 = self.pos
1137
+ _ary = []
1138
+ _tmp = apply(:_AtxInline)
1139
+ if _tmp
1140
+ _ary << @result
1141
+ while true
1142
+ _tmp = apply(:_AtxInline)
1143
+ _ary << @result if _tmp
1144
+ break unless _tmp
1145
+ end
1146
+ _tmp = true
1147
+ @result = _ary
1148
+ else
1149
+ self.pos = _save1
1150
+ end
1151
+ a = @result
1152
+ unless _tmp
1153
+ self.pos = _save
1154
+ break
1155
+ end
1156
+ _save2 = self.pos
1157
+
1158
+ _save3 = self.pos
1159
+ while true # sequence
1160
+ _tmp = _Sp()
1161
+ unless _tmp
1162
+ self.pos = _save3
1163
+ break
1164
+ end
1165
+ _tmp = scan(/\A(?-mix:#*)/)
1166
+ unless _tmp
1167
+ self.pos = _save3
1168
+ break
1169
+ end
1170
+ _tmp = _Sp()
1171
+ unless _tmp
1172
+ self.pos = _save3
1173
+ end
1174
+ break
1175
+ end # end sequence
1176
+
1177
+ unless _tmp
1178
+ _tmp = true
1179
+ self.pos = _save2
1180
+ end
1181
+ unless _tmp
1182
+ self.pos = _save
1183
+ break
1184
+ end
1185
+ _tmp = _Newline()
1186
+ unless _tmp
1187
+ self.pos = _save
1188
+ break
1189
+ end
1190
+ @result = begin; RDoc::Markup::Heading.new(s, a.join) ; end
1191
+ _tmp = true
1192
+ unless _tmp
1193
+ self.pos = _save
1194
+ end
1195
+ break
1196
+ end # end sequence
1197
+
1198
+ set_failed_rule :_AtxHeading unless _tmp
1199
+ return _tmp
1200
+ end
1201
+
1202
+ # SetextHeading = (SetextHeading1 | SetextHeading2)
1203
+ def _SetextHeading
1204
+
1205
+ _save = self.pos
1206
+ while true # choice
1207
+ _tmp = apply(:_SetextHeading1)
1208
+ break if _tmp
1209
+ self.pos = _save
1210
+ _tmp = apply(:_SetextHeading2)
1211
+ break if _tmp
1212
+ self.pos = _save
1213
+ break
1214
+ end # end choice
1215
+
1216
+ set_failed_rule :_SetextHeading unless _tmp
1217
+ return _tmp
1218
+ end
1219
+
1220
+ # SetextBottom1 = /={1,}/ @Newline
1221
+ def _SetextBottom1
1222
+
1223
+ _save = self.pos
1224
+ while true # sequence
1225
+ _tmp = scan(/\A(?-mix:={1,})/)
1226
+ unless _tmp
1227
+ self.pos = _save
1228
+ break
1229
+ end
1230
+ _tmp = _Newline()
1231
+ unless _tmp
1232
+ self.pos = _save
1233
+ end
1234
+ break
1235
+ end # end sequence
1236
+
1237
+ set_failed_rule :_SetextBottom1 unless _tmp
1238
+ return _tmp
1239
+ end
1240
+
1241
+ # SetextBottom2 = /-{1,}/ @Newline
1242
+ def _SetextBottom2
1243
+
1244
+ _save = self.pos
1245
+ while true # sequence
1246
+ _tmp = scan(/\A(?-mix:-{1,})/)
1247
+ unless _tmp
1248
+ self.pos = _save
1249
+ break
1250
+ end
1251
+ _tmp = _Newline()
1252
+ unless _tmp
1253
+ self.pos = _save
1254
+ end
1255
+ break
1256
+ end # end sequence
1257
+
1258
+ set_failed_rule :_SetextBottom2 unless _tmp
1259
+ return _tmp
1260
+ end
1261
+
1262
+ # SetextHeading1 = &(@RawLine SetextBottom1) @StartList:a (!@Endline Inline:b { a << b })+ @Sp @Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }
1263
+ def _SetextHeading1
1264
+
1265
+ _save = self.pos
1266
+ while true # sequence
1267
+ _save1 = self.pos
1268
+
1269
+ _save2 = self.pos
1270
+ while true # sequence
1271
+ _tmp = _RawLine()
1272
+ unless _tmp
1273
+ self.pos = _save2
1274
+ break
1275
+ end
1276
+ _tmp = apply(:_SetextBottom1)
1277
+ unless _tmp
1278
+ self.pos = _save2
1279
+ end
1280
+ break
1281
+ end # end sequence
1282
+
1283
+ self.pos = _save1
1284
+ unless _tmp
1285
+ self.pos = _save
1286
+ break
1287
+ end
1288
+ _tmp = _StartList()
1289
+ a = @result
1290
+ unless _tmp
1291
+ self.pos = _save
1292
+ break
1293
+ end
1294
+ _save3 = self.pos
1295
+
1296
+ _save4 = self.pos
1297
+ while true # sequence
1298
+ _save5 = self.pos
1299
+ _tmp = _Endline()
1300
+ _tmp = _tmp ? nil : true
1301
+ self.pos = _save5
1302
+ unless _tmp
1303
+ self.pos = _save4
1304
+ break
1305
+ end
1306
+ _tmp = apply(:_Inline)
1307
+ b = @result
1308
+ unless _tmp
1309
+ self.pos = _save4
1310
+ break
1311
+ end
1312
+ @result = begin; a << b ; end
1313
+ _tmp = true
1314
+ unless _tmp
1315
+ self.pos = _save4
1316
+ end
1317
+ break
1318
+ end # end sequence
1319
+
1320
+ if _tmp
1321
+ while true
1322
+
1323
+ _save6 = self.pos
1324
+ while true # sequence
1325
+ _save7 = self.pos
1326
+ _tmp = _Endline()
1327
+ _tmp = _tmp ? nil : true
1328
+ self.pos = _save7
1329
+ unless _tmp
1330
+ self.pos = _save6
1331
+ break
1332
+ end
1333
+ _tmp = apply(:_Inline)
1334
+ b = @result
1335
+ unless _tmp
1336
+ self.pos = _save6
1337
+ break
1338
+ end
1339
+ @result = begin; a << b ; end
1340
+ _tmp = true
1341
+ unless _tmp
1342
+ self.pos = _save6
1343
+ end
1344
+ break
1345
+ end # end sequence
1346
+
1347
+ break unless _tmp
1348
+ end
1349
+ _tmp = true
1350
+ else
1351
+ self.pos = _save3
1352
+ end
1353
+ unless _tmp
1354
+ self.pos = _save
1355
+ break
1356
+ end
1357
+ _tmp = _Sp()
1358
+ unless _tmp
1359
+ self.pos = _save
1360
+ break
1361
+ end
1362
+ _tmp = _Newline()
1363
+ unless _tmp
1364
+ self.pos = _save
1365
+ break
1366
+ end
1367
+ _tmp = apply(:_SetextBottom1)
1368
+ unless _tmp
1369
+ self.pos = _save
1370
+ break
1371
+ end
1372
+ @result = begin; RDoc::Markup::Heading.new(1, a.join) ; end
1373
+ _tmp = true
1374
+ unless _tmp
1375
+ self.pos = _save
1376
+ end
1377
+ break
1378
+ end # end sequence
1379
+
1380
+ set_failed_rule :_SetextHeading1 unless _tmp
1381
+ return _tmp
1382
+ end
1383
+
1384
+ # SetextHeading2 = &(@RawLine SetextBottom2) @StartList:a (!@Endline Inline:b { a << b })+ @Sp @Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }
1385
+ def _SetextHeading2
1386
+
1387
+ _save = self.pos
1388
+ while true # sequence
1389
+ _save1 = self.pos
1390
+
1391
+ _save2 = self.pos
1392
+ while true # sequence
1393
+ _tmp = _RawLine()
1394
+ unless _tmp
1395
+ self.pos = _save2
1396
+ break
1397
+ end
1398
+ _tmp = apply(:_SetextBottom2)
1399
+ unless _tmp
1400
+ self.pos = _save2
1401
+ end
1402
+ break
1403
+ end # end sequence
1404
+
1405
+ self.pos = _save1
1406
+ unless _tmp
1407
+ self.pos = _save
1408
+ break
1409
+ end
1410
+ _tmp = _StartList()
1411
+ a = @result
1412
+ unless _tmp
1413
+ self.pos = _save
1414
+ break
1415
+ end
1416
+ _save3 = self.pos
1417
+
1418
+ _save4 = self.pos
1419
+ while true # sequence
1420
+ _save5 = self.pos
1421
+ _tmp = _Endline()
1422
+ _tmp = _tmp ? nil : true
1423
+ self.pos = _save5
1424
+ unless _tmp
1425
+ self.pos = _save4
1426
+ break
1427
+ end
1428
+ _tmp = apply(:_Inline)
1429
+ b = @result
1430
+ unless _tmp
1431
+ self.pos = _save4
1432
+ break
1433
+ end
1434
+ @result = begin; a << b ; end
1435
+ _tmp = true
1436
+ unless _tmp
1437
+ self.pos = _save4
1438
+ end
1439
+ break
1440
+ end # end sequence
1441
+
1442
+ if _tmp
1443
+ while true
1444
+
1445
+ _save6 = self.pos
1446
+ while true # sequence
1447
+ _save7 = self.pos
1448
+ _tmp = _Endline()
1449
+ _tmp = _tmp ? nil : true
1450
+ self.pos = _save7
1451
+ unless _tmp
1452
+ self.pos = _save6
1453
+ break
1454
+ end
1455
+ _tmp = apply(:_Inline)
1456
+ b = @result
1457
+ unless _tmp
1458
+ self.pos = _save6
1459
+ break
1460
+ end
1461
+ @result = begin; a << b ; end
1462
+ _tmp = true
1463
+ unless _tmp
1464
+ self.pos = _save6
1465
+ end
1466
+ break
1467
+ end # end sequence
1468
+
1469
+ break unless _tmp
1470
+ end
1471
+ _tmp = true
1472
+ else
1473
+ self.pos = _save3
1474
+ end
1475
+ unless _tmp
1476
+ self.pos = _save
1477
+ break
1478
+ end
1479
+ _tmp = _Sp()
1480
+ unless _tmp
1481
+ self.pos = _save
1482
+ break
1483
+ end
1484
+ _tmp = _Newline()
1485
+ unless _tmp
1486
+ self.pos = _save
1487
+ break
1488
+ end
1489
+ _tmp = apply(:_SetextBottom2)
1490
+ unless _tmp
1491
+ self.pos = _save
1492
+ break
1493
+ end
1494
+ @result = begin; RDoc::Markup::Heading.new(2, a.join) ; end
1495
+ _tmp = true
1496
+ unless _tmp
1497
+ self.pos = _save
1498
+ end
1499
+ break
1500
+ end # end sequence
1501
+
1502
+ set_failed_rule :_SetextHeading2 unless _tmp
1503
+ return _tmp
1504
+ end
1505
+
1506
+ # Heading = (SetextHeading | AtxHeading)
1507
+ def _Heading
1508
+
1509
+ _save = self.pos
1510
+ while true # choice
1511
+ _tmp = apply(:_SetextHeading)
1512
+ break if _tmp
1513
+ self.pos = _save
1514
+ _tmp = apply(:_AtxHeading)
1515
+ break if _tmp
1516
+ self.pos = _save
1517
+ break
1518
+ end # end choice
1519
+
1520
+ set_failed_rule :_Heading unless _tmp
1521
+ return _tmp
1522
+ end
1523
+
1524
+ # BlockQuote = BlockQuoteRaw:a { RDoc::Markup::BlockQuote.new(*a) }
1525
+ def _BlockQuote
1526
+
1527
+ _save = self.pos
1528
+ while true # sequence
1529
+ _tmp = apply(:_BlockQuoteRaw)
1530
+ a = @result
1531
+ unless _tmp
1532
+ self.pos = _save
1533
+ break
1534
+ end
1535
+ @result = begin; RDoc::Markup::BlockQuote.new(*a) ; end
1536
+ _tmp = true
1537
+ unless _tmp
1538
+ self.pos = _save
1539
+ end
1540
+ break
1541
+ end # end sequence
1542
+
1543
+ set_failed_rule :_BlockQuote unless _tmp
1544
+ return _tmp
1545
+ end
1546
+
1547
+ # BlockQuoteRaw = @StartList:a (">" " "? Line:l { a << l } (!">" !@BlankLine Line:c { a << c })* (@BlankLine:n { a << n })*)+ { inner_parse a.join }
1548
+ def _BlockQuoteRaw
1549
+
1550
+ _save = self.pos
1551
+ while true # sequence
1552
+ _tmp = _StartList()
1553
+ a = @result
1554
+ unless _tmp
1555
+ self.pos = _save
1556
+ break
1557
+ end
1558
+ _save1 = self.pos
1559
+
1560
+ _save2 = self.pos
1561
+ while true # sequence
1562
+ _tmp = match_string(">")
1563
+ unless _tmp
1564
+ self.pos = _save2
1565
+ break
1566
+ end
1567
+ _save3 = self.pos
1568
+ _tmp = match_string(" ")
1569
+ unless _tmp
1570
+ _tmp = true
1571
+ self.pos = _save3
1572
+ end
1573
+ unless _tmp
1574
+ self.pos = _save2
1575
+ break
1576
+ end
1577
+ _tmp = apply(:_Line)
1578
+ l = @result
1579
+ unless _tmp
1580
+ self.pos = _save2
1581
+ break
1582
+ end
1583
+ @result = begin; a << l ; end
1584
+ _tmp = true
1585
+ unless _tmp
1586
+ self.pos = _save2
1587
+ break
1588
+ end
1589
+ while true
1590
+
1591
+ _save5 = self.pos
1592
+ while true # sequence
1593
+ _save6 = self.pos
1594
+ _tmp = match_string(">")
1595
+ _tmp = _tmp ? nil : true
1596
+ self.pos = _save6
1597
+ unless _tmp
1598
+ self.pos = _save5
1599
+ break
1600
+ end
1601
+ _save7 = self.pos
1602
+ _tmp = _BlankLine()
1603
+ _tmp = _tmp ? nil : true
1604
+ self.pos = _save7
1605
+ unless _tmp
1606
+ self.pos = _save5
1607
+ break
1608
+ end
1609
+ _tmp = apply(:_Line)
1610
+ c = @result
1611
+ unless _tmp
1612
+ self.pos = _save5
1613
+ break
1614
+ end
1615
+ @result = begin; a << c ; end
1616
+ _tmp = true
1617
+ unless _tmp
1618
+ self.pos = _save5
1619
+ end
1620
+ break
1621
+ end # end sequence
1622
+
1623
+ break unless _tmp
1624
+ end
1625
+ _tmp = true
1626
+ unless _tmp
1627
+ self.pos = _save2
1628
+ break
1629
+ end
1630
+ while true
1631
+
1632
+ _save9 = self.pos
1633
+ while true # sequence
1634
+ _tmp = _BlankLine()
1635
+ n = @result
1636
+ unless _tmp
1637
+ self.pos = _save9
1638
+ break
1639
+ end
1640
+ @result = begin; a << n ; end
1641
+ _tmp = true
1642
+ unless _tmp
1643
+ self.pos = _save9
1644
+ end
1645
+ break
1646
+ end # end sequence
1647
+
1648
+ break unless _tmp
1649
+ end
1650
+ _tmp = true
1651
+ unless _tmp
1652
+ self.pos = _save2
1653
+ end
1654
+ break
1655
+ end # end sequence
1656
+
1657
+ if _tmp
1658
+ while true
1659
+
1660
+ _save10 = self.pos
1661
+ while true # sequence
1662
+ _tmp = match_string(">")
1663
+ unless _tmp
1664
+ self.pos = _save10
1665
+ break
1666
+ end
1667
+ _save11 = self.pos
1668
+ _tmp = match_string(" ")
1669
+ unless _tmp
1670
+ _tmp = true
1671
+ self.pos = _save11
1672
+ end
1673
+ unless _tmp
1674
+ self.pos = _save10
1675
+ break
1676
+ end
1677
+ _tmp = apply(:_Line)
1678
+ l = @result
1679
+ unless _tmp
1680
+ self.pos = _save10
1681
+ break
1682
+ end
1683
+ @result = begin; a << l ; end
1684
+ _tmp = true
1685
+ unless _tmp
1686
+ self.pos = _save10
1687
+ break
1688
+ end
1689
+ while true
1690
+
1691
+ _save13 = self.pos
1692
+ while true # sequence
1693
+ _save14 = self.pos
1694
+ _tmp = match_string(">")
1695
+ _tmp = _tmp ? nil : true
1696
+ self.pos = _save14
1697
+ unless _tmp
1698
+ self.pos = _save13
1699
+ break
1700
+ end
1701
+ _save15 = self.pos
1702
+ _tmp = _BlankLine()
1703
+ _tmp = _tmp ? nil : true
1704
+ self.pos = _save15
1705
+ unless _tmp
1706
+ self.pos = _save13
1707
+ break
1708
+ end
1709
+ _tmp = apply(:_Line)
1710
+ c = @result
1711
+ unless _tmp
1712
+ self.pos = _save13
1713
+ break
1714
+ end
1715
+ @result = begin; a << c ; end
1716
+ _tmp = true
1717
+ unless _tmp
1718
+ self.pos = _save13
1719
+ end
1720
+ break
1721
+ end # end sequence
1722
+
1723
+ break unless _tmp
1724
+ end
1725
+ _tmp = true
1726
+ unless _tmp
1727
+ self.pos = _save10
1728
+ break
1729
+ end
1730
+ while true
1731
+
1732
+ _save17 = self.pos
1733
+ while true # sequence
1734
+ _tmp = _BlankLine()
1735
+ n = @result
1736
+ unless _tmp
1737
+ self.pos = _save17
1738
+ break
1739
+ end
1740
+ @result = begin; a << n ; end
1741
+ _tmp = true
1742
+ unless _tmp
1743
+ self.pos = _save17
1744
+ end
1745
+ break
1746
+ end # end sequence
1747
+
1748
+ break unless _tmp
1749
+ end
1750
+ _tmp = true
1751
+ unless _tmp
1752
+ self.pos = _save10
1753
+ end
1754
+ break
1755
+ end # end sequence
1756
+
1757
+ break unless _tmp
1758
+ end
1759
+ _tmp = true
1760
+ else
1761
+ self.pos = _save1
1762
+ end
1763
+ unless _tmp
1764
+ self.pos = _save
1765
+ break
1766
+ end
1767
+ @result = begin; inner_parse a.join ; end
1768
+ _tmp = true
1769
+ unless _tmp
1770
+ self.pos = _save
1771
+ end
1772
+ break
1773
+ end # end sequence
1774
+
1775
+ set_failed_rule :_BlockQuoteRaw unless _tmp
1776
+ return _tmp
1777
+ end
1778
+
1779
+ # NonblankIndentedLine = !@BlankLine IndentedLine
1780
+ def _NonblankIndentedLine
1781
+
1782
+ _save = self.pos
1783
+ while true # sequence
1784
+ _save1 = self.pos
1785
+ _tmp = _BlankLine()
1786
+ _tmp = _tmp ? nil : true
1787
+ self.pos = _save1
1788
+ unless _tmp
1789
+ self.pos = _save
1790
+ break
1791
+ end
1792
+ _tmp = apply(:_IndentedLine)
1793
+ unless _tmp
1794
+ self.pos = _save
1795
+ end
1796
+ break
1797
+ end # end sequence
1798
+
1799
+ set_failed_rule :_NonblankIndentedLine unless _tmp
1800
+ return _tmp
1801
+ end
1802
+
1803
+ # VerbatimChunk = @BlankLine*:a NonblankIndentedLine+:b { a.concat b }
1804
+ def _VerbatimChunk
1805
+
1806
+ _save = self.pos
1807
+ while true # sequence
1808
+ _ary = []
1809
+ while true
1810
+ _tmp = _BlankLine()
1811
+ _ary << @result if _tmp
1812
+ break unless _tmp
1813
+ end
1814
+ _tmp = true
1815
+ @result = _ary
1816
+ a = @result
1817
+ unless _tmp
1818
+ self.pos = _save
1819
+ break
1820
+ end
1821
+ _save2 = self.pos
1822
+ _ary = []
1823
+ _tmp = apply(:_NonblankIndentedLine)
1824
+ if _tmp
1825
+ _ary << @result
1826
+ while true
1827
+ _tmp = apply(:_NonblankIndentedLine)
1828
+ _ary << @result if _tmp
1829
+ break unless _tmp
1830
+ end
1831
+ _tmp = true
1832
+ @result = _ary
1833
+ else
1834
+ self.pos = _save2
1835
+ end
1836
+ b = @result
1837
+ unless _tmp
1838
+ self.pos = _save
1839
+ break
1840
+ end
1841
+ @result = begin; a.concat b ; end
1842
+ _tmp = true
1843
+ unless _tmp
1844
+ self.pos = _save
1845
+ end
1846
+ break
1847
+ end # end sequence
1848
+
1849
+ set_failed_rule :_VerbatimChunk unless _tmp
1850
+ return _tmp
1851
+ end
1852
+
1853
+ # Verbatim = VerbatimChunk+:a { RDoc::Markup::Verbatim.new(*a.flatten) }
1854
+ def _Verbatim
1855
+
1856
+ _save = self.pos
1857
+ while true # sequence
1858
+ _save1 = self.pos
1859
+ _ary = []
1860
+ _tmp = apply(:_VerbatimChunk)
1861
+ if _tmp
1862
+ _ary << @result
1863
+ while true
1864
+ _tmp = apply(:_VerbatimChunk)
1865
+ _ary << @result if _tmp
1866
+ break unless _tmp
1867
+ end
1868
+ _tmp = true
1869
+ @result = _ary
1870
+ else
1871
+ self.pos = _save1
1872
+ end
1873
+ a = @result
1874
+ unless _tmp
1875
+ self.pos = _save
1876
+ break
1877
+ end
1878
+ @result = begin; RDoc::Markup::Verbatim.new(*a.flatten) ; end
1879
+ _tmp = true
1880
+ unless _tmp
1881
+ self.pos = _save
1882
+ end
1883
+ break
1884
+ end # end sequence
1885
+
1886
+ set_failed_rule :_Verbatim unless _tmp
1887
+ return _tmp
1888
+ end
1889
+
1890
+ # HorizontalRule = @NonindentSpace ("*" @Sp "*" @Sp "*" (@Sp "*")* | "-" @Sp "-" @Sp "-" (@Sp "-")* | "_" @Sp "_" @Sp "_" (@Sp "_")*) @Sp @Newline @BlankLine+ { RDoc::Markup::Rule.new 1 }
1891
+ def _HorizontalRule
1892
+
1893
+ _save = self.pos
1894
+ while true # sequence
1895
+ _tmp = _NonindentSpace()
1896
+ unless _tmp
1897
+ self.pos = _save
1898
+ break
1899
+ end
1900
+
1901
+ _save1 = self.pos
1902
+ while true # choice
1903
+
1904
+ _save2 = self.pos
1905
+ while true # sequence
1906
+ _tmp = match_string("*")
1907
+ unless _tmp
1908
+ self.pos = _save2
1909
+ break
1910
+ end
1911
+ _tmp = _Sp()
1912
+ unless _tmp
1913
+ self.pos = _save2
1914
+ break
1915
+ end
1916
+ _tmp = match_string("*")
1917
+ unless _tmp
1918
+ self.pos = _save2
1919
+ break
1920
+ end
1921
+ _tmp = _Sp()
1922
+ unless _tmp
1923
+ self.pos = _save2
1924
+ break
1925
+ end
1926
+ _tmp = match_string("*")
1927
+ unless _tmp
1928
+ self.pos = _save2
1929
+ break
1930
+ end
1931
+ while true
1932
+
1933
+ _save4 = self.pos
1934
+ while true # sequence
1935
+ _tmp = _Sp()
1936
+ unless _tmp
1937
+ self.pos = _save4
1938
+ break
1939
+ end
1940
+ _tmp = match_string("*")
1941
+ unless _tmp
1942
+ self.pos = _save4
1943
+ end
1944
+ break
1945
+ end # end sequence
1946
+
1947
+ break unless _tmp
1948
+ end
1949
+ _tmp = true
1950
+ unless _tmp
1951
+ self.pos = _save2
1952
+ end
1953
+ break
1954
+ end # end sequence
1955
+
1956
+ break if _tmp
1957
+ self.pos = _save1
1958
+
1959
+ _save5 = self.pos
1960
+ while true # sequence
1961
+ _tmp = match_string("-")
1962
+ unless _tmp
1963
+ self.pos = _save5
1964
+ break
1965
+ end
1966
+ _tmp = _Sp()
1967
+ unless _tmp
1968
+ self.pos = _save5
1969
+ break
1970
+ end
1971
+ _tmp = match_string("-")
1972
+ unless _tmp
1973
+ self.pos = _save5
1974
+ break
1975
+ end
1976
+ _tmp = _Sp()
1977
+ unless _tmp
1978
+ self.pos = _save5
1979
+ break
1980
+ end
1981
+ _tmp = match_string("-")
1982
+ unless _tmp
1983
+ self.pos = _save5
1984
+ break
1985
+ end
1986
+ while true
1987
+
1988
+ _save7 = self.pos
1989
+ while true # sequence
1990
+ _tmp = _Sp()
1991
+ unless _tmp
1992
+ self.pos = _save7
1993
+ break
1994
+ end
1995
+ _tmp = match_string("-")
1996
+ unless _tmp
1997
+ self.pos = _save7
1998
+ end
1999
+ break
2000
+ end # end sequence
2001
+
2002
+ break unless _tmp
2003
+ end
2004
+ _tmp = true
2005
+ unless _tmp
2006
+ self.pos = _save5
2007
+ end
2008
+ break
2009
+ end # end sequence
2010
+
2011
+ break if _tmp
2012
+ self.pos = _save1
2013
+
2014
+ _save8 = self.pos
2015
+ while true # sequence
2016
+ _tmp = match_string("_")
2017
+ unless _tmp
2018
+ self.pos = _save8
2019
+ break
2020
+ end
2021
+ _tmp = _Sp()
2022
+ unless _tmp
2023
+ self.pos = _save8
2024
+ break
2025
+ end
2026
+ _tmp = match_string("_")
2027
+ unless _tmp
2028
+ self.pos = _save8
2029
+ break
2030
+ end
2031
+ _tmp = _Sp()
2032
+ unless _tmp
2033
+ self.pos = _save8
2034
+ break
2035
+ end
2036
+ _tmp = match_string("_")
2037
+ unless _tmp
2038
+ self.pos = _save8
2039
+ break
2040
+ end
2041
+ while true
2042
+
2043
+ _save10 = self.pos
2044
+ while true # sequence
2045
+ _tmp = _Sp()
2046
+ unless _tmp
2047
+ self.pos = _save10
2048
+ break
2049
+ end
2050
+ _tmp = match_string("_")
2051
+ unless _tmp
2052
+ self.pos = _save10
2053
+ end
2054
+ break
2055
+ end # end sequence
2056
+
2057
+ break unless _tmp
2058
+ end
2059
+ _tmp = true
2060
+ unless _tmp
2061
+ self.pos = _save8
2062
+ end
2063
+ break
2064
+ end # end sequence
2065
+
2066
+ break if _tmp
2067
+ self.pos = _save1
2068
+ break
2069
+ end # end choice
2070
+
2071
+ unless _tmp
2072
+ self.pos = _save
2073
+ break
2074
+ end
2075
+ _tmp = _Sp()
2076
+ unless _tmp
2077
+ self.pos = _save
2078
+ break
2079
+ end
2080
+ _tmp = _Newline()
2081
+ unless _tmp
2082
+ self.pos = _save
2083
+ break
2084
+ end
2085
+ _save11 = self.pos
2086
+ _tmp = _BlankLine()
2087
+ if _tmp
2088
+ while true
2089
+ _tmp = _BlankLine()
2090
+ break unless _tmp
2091
+ end
2092
+ _tmp = true
2093
+ else
2094
+ self.pos = _save11
2095
+ end
2096
+ unless _tmp
2097
+ self.pos = _save
2098
+ break
2099
+ end
2100
+ @result = begin; RDoc::Markup::Rule.new 1 ; end
2101
+ _tmp = true
2102
+ unless _tmp
2103
+ self.pos = _save
2104
+ end
2105
+ break
2106
+ end # end sequence
2107
+
2108
+ set_failed_rule :_HorizontalRule unless _tmp
2109
+ return _tmp
2110
+ end
2111
+
2112
+ # Bullet = !HorizontalRule @NonindentSpace /[+*-]/ @Spacechar+
2113
+ def _Bullet
2114
+
2115
+ _save = self.pos
2116
+ while true # sequence
2117
+ _save1 = self.pos
2118
+ _tmp = apply(:_HorizontalRule)
2119
+ _tmp = _tmp ? nil : true
2120
+ self.pos = _save1
2121
+ unless _tmp
2122
+ self.pos = _save
2123
+ break
2124
+ end
2125
+ _tmp = _NonindentSpace()
2126
+ unless _tmp
2127
+ self.pos = _save
2128
+ break
2129
+ end
2130
+ _tmp = scan(/\A(?-mix:[+*-])/)
2131
+ unless _tmp
2132
+ self.pos = _save
2133
+ break
2134
+ end
2135
+ _save2 = self.pos
2136
+ _tmp = _Spacechar()
2137
+ if _tmp
2138
+ while true
2139
+ _tmp = _Spacechar()
2140
+ break unless _tmp
2141
+ end
2142
+ _tmp = true
2143
+ else
2144
+ self.pos = _save2
2145
+ end
2146
+ unless _tmp
2147
+ self.pos = _save
2148
+ end
2149
+ break
2150
+ end # end sequence
2151
+
2152
+ set_failed_rule :_Bullet unless _tmp
2153
+ return _tmp
2154
+ end
2155
+
2156
+ # BulletList = &Bullet (ListTight | ListLoose):a { RDoc::Markup::List.new(:BULLET, *a) }
2157
+ def _BulletList
2158
+
2159
+ _save = self.pos
2160
+ while true # sequence
2161
+ _save1 = self.pos
2162
+ _tmp = apply(:_Bullet)
2163
+ self.pos = _save1
2164
+ unless _tmp
2165
+ self.pos = _save
2166
+ break
2167
+ end
2168
+
2169
+ _save2 = self.pos
2170
+ while true # choice
2171
+ _tmp = apply(:_ListTight)
2172
+ break if _tmp
2173
+ self.pos = _save2
2174
+ _tmp = apply(:_ListLoose)
2175
+ break if _tmp
2176
+ self.pos = _save2
2177
+ break
2178
+ end # end choice
2179
+
2180
+ a = @result
2181
+ unless _tmp
2182
+ self.pos = _save
2183
+ break
2184
+ end
2185
+ @result = begin; RDoc::Markup::List.new(:BULLET, *a) ; end
2186
+ _tmp = true
2187
+ unless _tmp
2188
+ self.pos = _save
2189
+ end
2190
+ break
2191
+ end # end sequence
2192
+
2193
+ set_failed_rule :_BulletList unless _tmp
2194
+ return _tmp
2195
+ end
2196
+
2197
+ # ListTight = ListItemTight+:a @BlankLine* !(Bullet | Enumerator) { a }
2198
+ def _ListTight
2199
+
2200
+ _save = self.pos
2201
+ while true # sequence
2202
+ _save1 = self.pos
2203
+ _ary = []
2204
+ _tmp = apply(:_ListItemTight)
2205
+ if _tmp
2206
+ _ary << @result
2207
+ while true
2208
+ _tmp = apply(:_ListItemTight)
2209
+ _ary << @result if _tmp
2210
+ break unless _tmp
2211
+ end
2212
+ _tmp = true
2213
+ @result = _ary
2214
+ else
2215
+ self.pos = _save1
2216
+ end
2217
+ a = @result
2218
+ unless _tmp
2219
+ self.pos = _save
2220
+ break
2221
+ end
2222
+ while true
2223
+ _tmp = _BlankLine()
2224
+ break unless _tmp
2225
+ end
2226
+ _tmp = true
2227
+ unless _tmp
2228
+ self.pos = _save
2229
+ break
2230
+ end
2231
+ _save3 = self.pos
2232
+
2233
+ _save4 = self.pos
2234
+ while true # choice
2235
+ _tmp = apply(:_Bullet)
2236
+ break if _tmp
2237
+ self.pos = _save4
2238
+ _tmp = apply(:_Enumerator)
2239
+ break if _tmp
2240
+ self.pos = _save4
2241
+ break
2242
+ end # end choice
2243
+
2244
+ _tmp = _tmp ? nil : true
2245
+ self.pos = _save3
2246
+ unless _tmp
2247
+ self.pos = _save
2248
+ break
2249
+ end
2250
+ @result = begin; a ; end
2251
+ _tmp = true
2252
+ unless _tmp
2253
+ self.pos = _save
2254
+ end
2255
+ break
2256
+ end # end sequence
2257
+
2258
+ set_failed_rule :_ListTight unless _tmp
2259
+ return _tmp
2260
+ end
2261
+
2262
+ # ListLoose = @StartList:a (ListItem:b @BlankLine* { a << b })+ { a }
2263
+ def _ListLoose
2264
+
2265
+ _save = self.pos
2266
+ while true # sequence
2267
+ _tmp = _StartList()
2268
+ a = @result
2269
+ unless _tmp
2270
+ self.pos = _save
2271
+ break
2272
+ end
2273
+ _save1 = self.pos
2274
+
2275
+ _save2 = self.pos
2276
+ while true # sequence
2277
+ _tmp = apply(:_ListItem)
2278
+ b = @result
2279
+ unless _tmp
2280
+ self.pos = _save2
2281
+ break
2282
+ end
2283
+ while true
2284
+ _tmp = _BlankLine()
2285
+ break unless _tmp
2286
+ end
2287
+ _tmp = true
2288
+ unless _tmp
2289
+ self.pos = _save2
2290
+ break
2291
+ end
2292
+ @result = begin; a << b ; end
2293
+ _tmp = true
2294
+ unless _tmp
2295
+ self.pos = _save2
2296
+ end
2297
+ break
2298
+ end # end sequence
2299
+
2300
+ if _tmp
2301
+ while true
2302
+
2303
+ _save4 = self.pos
2304
+ while true # sequence
2305
+ _tmp = apply(:_ListItem)
2306
+ b = @result
2307
+ unless _tmp
2308
+ self.pos = _save4
2309
+ break
2310
+ end
2311
+ while true
2312
+ _tmp = _BlankLine()
2313
+ break unless _tmp
2314
+ end
2315
+ _tmp = true
2316
+ unless _tmp
2317
+ self.pos = _save4
2318
+ break
2319
+ end
2320
+ @result = begin; a << b ; end
2321
+ _tmp = true
2322
+ unless _tmp
2323
+ self.pos = _save4
2324
+ end
2325
+ break
2326
+ end # end sequence
2327
+
2328
+ break unless _tmp
2329
+ end
2330
+ _tmp = true
2331
+ else
2332
+ self.pos = _save1
2333
+ end
2334
+ unless _tmp
2335
+ self.pos = _save
2336
+ break
2337
+ end
2338
+ @result = begin; a ; end
2339
+ _tmp = true
2340
+ unless _tmp
2341
+ self.pos = _save
2342
+ end
2343
+ break
2344
+ end # end sequence
2345
+
2346
+ set_failed_rule :_ListLoose unless _tmp
2347
+ return _tmp
2348
+ end
2349
+
2350
+ # ListItem = (Bullet | Enumerator) @StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }
2351
+ def _ListItem
2352
+
2353
+ _save = self.pos
2354
+ while true # sequence
2355
+
2356
+ _save1 = self.pos
2357
+ while true # choice
2358
+ _tmp = apply(:_Bullet)
2359
+ break if _tmp
2360
+ self.pos = _save1
2361
+ _tmp = apply(:_Enumerator)
2362
+ break if _tmp
2363
+ self.pos = _save1
2364
+ break
2365
+ end # end choice
2366
+
2367
+ unless _tmp
2368
+ self.pos = _save
2369
+ break
2370
+ end
2371
+ _tmp = _StartList()
2372
+ a = @result
2373
+ unless _tmp
2374
+ self.pos = _save
2375
+ break
2376
+ end
2377
+ _tmp = apply(:_ListBlock)
2378
+ b = @result
2379
+ unless _tmp
2380
+ self.pos = _save
2381
+ break
2382
+ end
2383
+ @result = begin; a << b ; end
2384
+ _tmp = true