nora_mark 0.2beta3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3422 @@
1
+ require 'kpeg/compiled_parser'
2
+
3
+ class NoraMark::Parser < KPeg::CompiledParser
4
+ # :stopdoc:
5
+
6
+ # eof = !.
7
+ def _eof
8
+ _save = self.pos
9
+ _tmp = get_byte
10
+ _tmp = _tmp ? nil : true
11
+ self.pos = _save
12
+ set_failed_rule :_eof unless _tmp
13
+ return _tmp
14
+ end
15
+
16
+ # space = (" " | "\\t")
17
+ def _space
18
+
19
+ _save = self.pos
20
+ while true # choice
21
+ _tmp = match_string(" ")
22
+ break if _tmp
23
+ self.pos = _save
24
+ _tmp = match_string("\\t")
25
+ break if _tmp
26
+ self.pos = _save
27
+ break
28
+ end # end choice
29
+
30
+ set_failed_rule :_space unless _tmp
31
+ return _tmp
32
+ end
33
+
34
+ # eof_comment = lh space* "#" (!eof .)*
35
+ def _eof_comment
36
+
37
+ _save = self.pos
38
+ while true # sequence
39
+ _tmp = apply(:_lh)
40
+ unless _tmp
41
+ self.pos = _save
42
+ break
43
+ end
44
+ while true
45
+ _tmp = apply(:_space)
46
+ break unless _tmp
47
+ end
48
+ _tmp = true
49
+ unless _tmp
50
+ self.pos = _save
51
+ break
52
+ end
53
+ _tmp = match_string("#")
54
+ unless _tmp
55
+ self.pos = _save
56
+ break
57
+ end
58
+ while true
59
+
60
+ _save3 = self.pos
61
+ while true # sequence
62
+ _save4 = self.pos
63
+ _tmp = apply(:_eof)
64
+ _tmp = _tmp ? nil : true
65
+ self.pos = _save4
66
+ unless _tmp
67
+ self.pos = _save3
68
+ break
69
+ end
70
+ _tmp = get_byte
71
+ unless _tmp
72
+ self.pos = _save3
73
+ end
74
+ break
75
+ end # end sequence
76
+
77
+ break unless _tmp
78
+ end
79
+ _tmp = true
80
+ unless _tmp
81
+ self.pos = _save
82
+ end
83
+ break
84
+ end # end sequence
85
+
86
+ set_failed_rule :_eof_comment unless _tmp
87
+ return _tmp
88
+ end
89
+
90
+ # comment = lh space* "#" (!nl .)* nl empty_line*
91
+ def _comment
92
+
93
+ _save = self.pos
94
+ while true # sequence
95
+ _tmp = apply(:_lh)
96
+ unless _tmp
97
+ self.pos = _save
98
+ break
99
+ end
100
+ while true
101
+ _tmp = apply(:_space)
102
+ break unless _tmp
103
+ end
104
+ _tmp = true
105
+ unless _tmp
106
+ self.pos = _save
107
+ break
108
+ end
109
+ _tmp = match_string("#")
110
+ unless _tmp
111
+ self.pos = _save
112
+ break
113
+ end
114
+ while true
115
+
116
+ _save3 = self.pos
117
+ while true # sequence
118
+ _save4 = self.pos
119
+ _tmp = apply(:_nl)
120
+ _tmp = _tmp ? nil : true
121
+ self.pos = _save4
122
+ unless _tmp
123
+ self.pos = _save3
124
+ break
125
+ end
126
+ _tmp = get_byte
127
+ unless _tmp
128
+ self.pos = _save3
129
+ end
130
+ break
131
+ end # end sequence
132
+
133
+ break unless _tmp
134
+ end
135
+ _tmp = true
136
+ unless _tmp
137
+ self.pos = _save
138
+ break
139
+ end
140
+ _tmp = apply(:_nl)
141
+ unless _tmp
142
+ self.pos = _save
143
+ break
144
+ end
145
+ while true
146
+ _tmp = apply(:_empty_line)
147
+ break unless _tmp
148
+ end
149
+ _tmp = true
150
+ unless _tmp
151
+ self.pos = _save
152
+ end
153
+ break
154
+ end # end sequence
155
+
156
+ set_failed_rule :_comment unless _tmp
157
+ return _tmp
158
+ end
159
+
160
+ # - = (space | comment)*
161
+ def __hyphen_
162
+ while true
163
+
164
+ _save1 = self.pos
165
+ while true # choice
166
+ _tmp = apply(:_space)
167
+ break if _tmp
168
+ self.pos = _save1
169
+ _tmp = apply(:_comment)
170
+ break if _tmp
171
+ self.pos = _save1
172
+ break
173
+ end # end choice
174
+
175
+ break unless _tmp
176
+ end
177
+ _tmp = true
178
+ set_failed_rule :__hyphen_ unless _tmp
179
+ return _tmp
180
+ end
181
+
182
+ # empty_line = lh - nl
183
+ def _empty_line
184
+
185
+ _save = self.pos
186
+ while true # sequence
187
+ _tmp = apply(:_lh)
188
+ unless _tmp
189
+ self.pos = _save
190
+ break
191
+ end
192
+ _tmp = apply(:__hyphen_)
193
+ unless _tmp
194
+ self.pos = _save
195
+ break
196
+ end
197
+ _tmp = apply(:_nl)
198
+ unless _tmp
199
+ self.pos = _save
200
+ end
201
+ break
202
+ end # end sequence
203
+
204
+ set_failed_rule :_empty_line unless _tmp
205
+ return _tmp
206
+ end
207
+
208
+ # nl = /\r?\n/
209
+ def _nl
210
+ _tmp = scan(/\A(?-mix:\r?\n)/)
211
+ set_failed_rule :_nl unless _tmp
212
+ return _tmp
213
+ end
214
+
215
+ # lh = /^/
216
+ def _lh
217
+ _tmp = scan(/\A(?-mix:^)/)
218
+ set_failed_rule :_lh unless _tmp
219
+ return _tmp
220
+ end
221
+
222
+ # le = (nl | eof)
223
+ def _le
224
+
225
+ _save = self.pos
226
+ while true # choice
227
+ _tmp = apply(:_nl)
228
+ break if _tmp
229
+ self.pos = _save
230
+ _tmp = apply(:_eof)
231
+ break if _tmp
232
+ self.pos = _save
233
+ break
234
+ end # end choice
235
+
236
+ set_failed_rule :_le unless _tmp
237
+ return _tmp
238
+ end
239
+
240
+ # word = < /[\w0-9]/ ("-" | /[\w0-9]/)* > { text }
241
+ def _word
242
+
243
+ _save = self.pos
244
+ while true # sequence
245
+ _text_start = self.pos
246
+
247
+ _save1 = self.pos
248
+ while true # sequence
249
+ _tmp = scan(/\A(?-mix:[\w0-9])/)
250
+ unless _tmp
251
+ self.pos = _save1
252
+ break
253
+ end
254
+ while true
255
+
256
+ _save3 = self.pos
257
+ while true # choice
258
+ _tmp = match_string("-")
259
+ break if _tmp
260
+ self.pos = _save3
261
+ _tmp = scan(/\A(?-mix:[\w0-9])/)
262
+ break if _tmp
263
+ self.pos = _save3
264
+ break
265
+ end # end choice
266
+
267
+ break unless _tmp
268
+ end
269
+ _tmp = true
270
+ unless _tmp
271
+ self.pos = _save1
272
+ end
273
+ break
274
+ end # end sequence
275
+
276
+ if _tmp
277
+ text = get_text(_text_start)
278
+ end
279
+ unless _tmp
280
+ self.pos = _save
281
+ break
282
+ end
283
+ @result = begin; text ; end
284
+ _tmp = true
285
+ unless _tmp
286
+ self.pos = _save
287
+ end
288
+ break
289
+ end # end sequence
290
+
291
+ set_failed_rule :_word unless _tmp
292
+ return _tmp
293
+ end
294
+
295
+ # num = < [0-9]+ > { text.to_i }
296
+ def _num
297
+
298
+ _save = self.pos
299
+ while true # sequence
300
+ _text_start = self.pos
301
+ _save1 = self.pos
302
+ _save2 = self.pos
303
+ _tmp = get_byte
304
+ if _tmp
305
+ unless _tmp >= 48 and _tmp <= 57
306
+ self.pos = _save2
307
+ _tmp = nil
308
+ end
309
+ end
310
+ if _tmp
311
+ while true
312
+ _save3 = self.pos
313
+ _tmp = get_byte
314
+ if _tmp
315
+ unless _tmp >= 48 and _tmp <= 57
316
+ self.pos = _save3
317
+ _tmp = nil
318
+ end
319
+ end
320
+ break unless _tmp
321
+ end
322
+ _tmp = true
323
+ else
324
+ self.pos = _save1
325
+ end
326
+ if _tmp
327
+ text = get_text(_text_start)
328
+ end
329
+ unless _tmp
330
+ self.pos = _save
331
+ break
332
+ end
333
+ @result = begin; text.to_i ; end
334
+ _tmp = true
335
+ unless _tmp
336
+ self.pos = _save
337
+ end
338
+ break
339
+ end # end sequence
340
+
341
+ set_failed_rule :_num unless _tmp
342
+ return _tmp
343
+ end
344
+
345
+ # classname = "." word:classname { classname }
346
+ def _classname
347
+
348
+ _save = self.pos
349
+ while true # sequence
350
+ _tmp = match_string(".")
351
+ unless _tmp
352
+ self.pos = _save
353
+ break
354
+ end
355
+ _tmp = apply(:_word)
356
+ classname = @result
357
+ unless _tmp
358
+ self.pos = _save
359
+ break
360
+ end
361
+ @result = begin; classname ; end
362
+ _tmp = true
363
+ unless _tmp
364
+ self.pos = _save
365
+ end
366
+ break
367
+ end # end sequence
368
+
369
+ set_failed_rule :_classname unless _tmp
370
+ return _tmp
371
+ end
372
+
373
+ # classnames = classname*:classnames { classnames }
374
+ def _classnames
375
+
376
+ _save = self.pos
377
+ while true # sequence
378
+ _ary = []
379
+ while true
380
+ _tmp = apply(:_classname)
381
+ _ary << @result if _tmp
382
+ break unless _tmp
383
+ end
384
+ _tmp = true
385
+ @result = _ary
386
+ classnames = @result
387
+ unless _tmp
388
+ self.pos = _save
389
+ break
390
+ end
391
+ @result = begin; classnames ; end
392
+ _tmp = true
393
+ unless _tmp
394
+ self.pos = _save
395
+ end
396
+ break
397
+ end # end sequence
398
+
399
+ set_failed_rule :_classnames unless _tmp
400
+ return _tmp
401
+ end
402
+
403
+ # idname = "#" word:idname { idname }
404
+ def _idname
405
+
406
+ _save = self.pos
407
+ while true # sequence
408
+ _tmp = match_string("#")
409
+ unless _tmp
410
+ self.pos = _save
411
+ break
412
+ end
413
+ _tmp = apply(:_word)
414
+ idname = @result
415
+ unless _tmp
416
+ self.pos = _save
417
+ break
418
+ end
419
+ @result = begin; idname ; end
420
+ _tmp = true
421
+ unless _tmp
422
+ self.pos = _save
423
+ end
424
+ break
425
+ end # end sequence
426
+
427
+ set_failed_rule :_idname unless _tmp
428
+ return _tmp
429
+ end
430
+
431
+ # idnames = idname*:idnames { idnames }
432
+ def _idnames
433
+
434
+ _save = self.pos
435
+ while true # sequence
436
+ _ary = []
437
+ while true
438
+ _tmp = apply(:_idname)
439
+ _ary << @result if _tmp
440
+ break unless _tmp
441
+ end
442
+ _tmp = true
443
+ @result = _ary
444
+ idnames = @result
445
+ unless _tmp
446
+ self.pos = _save
447
+ break
448
+ end
449
+ @result = begin; idnames ; end
450
+ _tmp = true
451
+ unless _tmp
452
+ self.pos = _save
453
+ end
454
+ break
455
+ end # end sequence
456
+
457
+ set_failed_rule :_idnames unless _tmp
458
+ return _tmp
459
+ end
460
+
461
+ # commandname = word:name idnames?:idnames classnames?:classes { {:name => name, :ids => idnames, :classes => classes} }
462
+ def _commandname
463
+
464
+ _save = self.pos
465
+ while true # sequence
466
+ _tmp = apply(:_word)
467
+ name = @result
468
+ unless _tmp
469
+ self.pos = _save
470
+ break
471
+ end
472
+ _save1 = self.pos
473
+ _tmp = apply(:_idnames)
474
+ @result = nil unless _tmp
475
+ unless _tmp
476
+ _tmp = true
477
+ self.pos = _save1
478
+ end
479
+ idnames = @result
480
+ unless _tmp
481
+ self.pos = _save
482
+ break
483
+ end
484
+ _save2 = self.pos
485
+ _tmp = apply(:_classnames)
486
+ @result = nil unless _tmp
487
+ unless _tmp
488
+ _tmp = true
489
+ self.pos = _save2
490
+ end
491
+ classes = @result
492
+ unless _tmp
493
+ self.pos = _save
494
+ break
495
+ end
496
+ @result = begin; {:name => name, :ids => idnames, :classes => classes} ; end
497
+ _tmp = true
498
+ unless _tmp
499
+ self.pos = _save
500
+ end
501
+ break
502
+ end # end sequence
503
+
504
+ set_failed_rule :_commandname unless _tmp
505
+ return _tmp
506
+ end
507
+
508
+ # parameter = < (/[^,)]/* | "\"" /[^"]/* "\"" | "'" /[^']/* "'") > { text }
509
+ def _parameter
510
+
511
+ _save = self.pos
512
+ while true # sequence
513
+ _text_start = self.pos
514
+
515
+ _save1 = self.pos
516
+ while true # choice
517
+ while true
518
+ _tmp = scan(/\A(?-mix:[^,)])/)
519
+ break unless _tmp
520
+ end
521
+ _tmp = true
522
+ break if _tmp
523
+ self.pos = _save1
524
+
525
+ _save3 = self.pos
526
+ while true # sequence
527
+ _tmp = match_string("\"")
528
+ unless _tmp
529
+ self.pos = _save3
530
+ break
531
+ end
532
+ while true
533
+ _tmp = scan(/\A(?-mix:[^"])/)
534
+ break unless _tmp
535
+ end
536
+ _tmp = true
537
+ unless _tmp
538
+ self.pos = _save3
539
+ break
540
+ end
541
+ _tmp = match_string("\"")
542
+ unless _tmp
543
+ self.pos = _save3
544
+ end
545
+ break
546
+ end # end sequence
547
+
548
+ break if _tmp
549
+ self.pos = _save1
550
+
551
+ _save5 = self.pos
552
+ while true # sequence
553
+ _tmp = match_string("'")
554
+ unless _tmp
555
+ self.pos = _save5
556
+ break
557
+ end
558
+ while true
559
+ _tmp = scan(/\A(?-mix:[^'])/)
560
+ break unless _tmp
561
+ end
562
+ _tmp = true
563
+ unless _tmp
564
+ self.pos = _save5
565
+ break
566
+ end
567
+ _tmp = match_string("'")
568
+ unless _tmp
569
+ self.pos = _save5
570
+ end
571
+ break
572
+ end # end sequence
573
+
574
+ break if _tmp
575
+ self.pos = _save1
576
+ break
577
+ end # end choice
578
+
579
+ if _tmp
580
+ text = get_text(_text_start)
581
+ end
582
+ unless _tmp
583
+ self.pos = _save
584
+ break
585
+ end
586
+ @result = begin; text ; end
587
+ _tmp = true
588
+ unless _tmp
589
+ self.pos = _save
590
+ end
591
+ break
592
+ end # end sequence
593
+
594
+ set_failed_rule :_parameter unless _tmp
595
+ return _tmp
596
+ end
597
+
598
+ # parameters = < parameter ("," parameter)* > { text }
599
+ def _parameters
600
+
601
+ _save = self.pos
602
+ while true # sequence
603
+ _text_start = self.pos
604
+
605
+ _save1 = self.pos
606
+ while true # sequence
607
+ _tmp = apply(:_parameter)
608
+ unless _tmp
609
+ self.pos = _save1
610
+ break
611
+ end
612
+ while true
613
+
614
+ _save3 = self.pos
615
+ while true # sequence
616
+ _tmp = match_string(",")
617
+ unless _tmp
618
+ self.pos = _save3
619
+ break
620
+ end
621
+ _tmp = apply(:_parameter)
622
+ unless _tmp
623
+ self.pos = _save3
624
+ end
625
+ break
626
+ end # end sequence
627
+
628
+ break unless _tmp
629
+ end
630
+ _tmp = true
631
+ unless _tmp
632
+ self.pos = _save1
633
+ end
634
+ break
635
+ end # end sequence
636
+
637
+ if _tmp
638
+ text = get_text(_text_start)
639
+ end
640
+ unless _tmp
641
+ self.pos = _save
642
+ break
643
+ end
644
+ @result = begin; text ; end
645
+ _tmp = true
646
+ unless _tmp
647
+ self.pos = _save
648
+ end
649
+ break
650
+ end # end sequence
651
+
652
+ set_failed_rule :_parameters unless _tmp
653
+ return _tmp
654
+ end
655
+
656
+ # command = commandname:cn ("(" - parameters:arg - ")")? { arg ||= ''; cn.merge({ :args => arg.split(',') }) }
657
+ def _command
658
+
659
+ _save = self.pos
660
+ while true # sequence
661
+ _tmp = apply(:_commandname)
662
+ cn = @result
663
+ unless _tmp
664
+ self.pos = _save
665
+ break
666
+ end
667
+ _save1 = self.pos
668
+
669
+ _save2 = self.pos
670
+ while true # sequence
671
+ _tmp = match_string("(")
672
+ unless _tmp
673
+ self.pos = _save2
674
+ break
675
+ end
676
+ _tmp = apply(:__hyphen_)
677
+ unless _tmp
678
+ self.pos = _save2
679
+ break
680
+ end
681
+ _tmp = apply(:_parameters)
682
+ arg = @result
683
+ unless _tmp
684
+ self.pos = _save2
685
+ break
686
+ end
687
+ _tmp = apply(:__hyphen_)
688
+ unless _tmp
689
+ self.pos = _save2
690
+ break
691
+ end
692
+ _tmp = match_string(")")
693
+ unless _tmp
694
+ self.pos = _save2
695
+ end
696
+ break
697
+ end # end sequence
698
+
699
+ unless _tmp
700
+ _tmp = true
701
+ self.pos = _save1
702
+ end
703
+ unless _tmp
704
+ self.pos = _save
705
+ break
706
+ end
707
+ @result = begin; arg ||= ''; cn.merge({ :args => arg.split(',') }) ; end
708
+ _tmp = true
709
+ unless _tmp
710
+ self.pos = _save
711
+ end
712
+ break
713
+ end # end sequence
714
+
715
+ set_failed_rule :_command unless _tmp
716
+ return _tmp
717
+ end
718
+
719
+ # implicit_paragraph = < !paragraph_delimiter - documentline:p - > { create_item(:paragraph, nil, p, raw: text) }
720
+ def _implicit_paragraph
721
+
722
+ _save = self.pos
723
+ while true # sequence
724
+ _text_start = self.pos
725
+
726
+ _save1 = self.pos
727
+ while true # sequence
728
+ _save2 = self.pos
729
+ _tmp = apply(:_paragraph_delimiter)
730
+ _tmp = _tmp ? nil : true
731
+ self.pos = _save2
732
+ unless _tmp
733
+ self.pos = _save1
734
+ break
735
+ end
736
+ _tmp = apply(:__hyphen_)
737
+ unless _tmp
738
+ self.pos = _save1
739
+ break
740
+ end
741
+ _tmp = apply(:_documentline)
742
+ p = @result
743
+ unless _tmp
744
+ self.pos = _save1
745
+ break
746
+ end
747
+ _tmp = apply(:__hyphen_)
748
+ unless _tmp
749
+ self.pos = _save1
750
+ end
751
+ break
752
+ end # end sequence
753
+
754
+ if _tmp
755
+ text = get_text(_text_start)
756
+ end
757
+ unless _tmp
758
+ self.pos = _save
759
+ break
760
+ end
761
+ @result = begin; create_item(:paragraph, nil, p, raw: text) ; end
762
+ _tmp = true
763
+ unless _tmp
764
+ self.pos = _save
765
+ end
766
+ break
767
+ end # end sequence
768
+
769
+ set_failed_rule :_implicit_paragraph unless _tmp
770
+ return _tmp
771
+ end
772
+
773
+ # paragraph = (explicit_paragraph | implicit_paragraph)
774
+ def _paragraph
775
+
776
+ _save = self.pos
777
+ while true # choice
778
+ _tmp = apply(:_explicit_paragraph)
779
+ break if _tmp
780
+ self.pos = _save
781
+ _tmp = apply(:_implicit_paragraph)
782
+ break if _tmp
783
+ self.pos = _save
784
+ break
785
+ end # end choice
786
+
787
+ set_failed_rule :_paragraph unless _tmp
788
+ return _tmp
789
+ end
790
+
791
+ # paragraph_group = < paragraph+:p empty_line* > { create_item(:paragraph_group, nil, p, raw: text) }
792
+ def _paragraph_group
793
+
794
+ _save = self.pos
795
+ while true # sequence
796
+ _text_start = self.pos
797
+
798
+ _save1 = self.pos
799
+ while true # sequence
800
+ _save2 = self.pos
801
+ _ary = []
802
+ _tmp = apply(:_paragraph)
803
+ if _tmp
804
+ _ary << @result
805
+ while true
806
+ _tmp = apply(:_paragraph)
807
+ _ary << @result if _tmp
808
+ break unless _tmp
809
+ end
810
+ _tmp = true
811
+ @result = _ary
812
+ else
813
+ self.pos = _save2
814
+ end
815
+ p = @result
816
+ unless _tmp
817
+ self.pos = _save1
818
+ break
819
+ end
820
+ while true
821
+ _tmp = apply(:_empty_line)
822
+ break unless _tmp
823
+ end
824
+ _tmp = true
825
+ unless _tmp
826
+ self.pos = _save1
827
+ end
828
+ break
829
+ end # end sequence
830
+
831
+ if _tmp
832
+ text = get_text(_text_start)
833
+ end
834
+ unless _tmp
835
+ self.pos = _save
836
+ break
837
+ end
838
+ @result = begin; create_item(:paragraph_group, nil, p, raw: text) ; end
839
+ _tmp = true
840
+ unless _tmp
841
+ self.pos = _save
842
+ end
843
+ break
844
+ end # end sequence
845
+
846
+ set_failed_rule :_paragraph_group unless _tmp
847
+ return _tmp
848
+ end
849
+
850
+ # blockhead = lh - command:command - "{" - nl empty_line* { command }
851
+ def _blockhead
852
+
853
+ _save = self.pos
854
+ while true # sequence
855
+ _tmp = apply(:_lh)
856
+ unless _tmp
857
+ self.pos = _save
858
+ break
859
+ end
860
+ _tmp = apply(:__hyphen_)
861
+ unless _tmp
862
+ self.pos = _save
863
+ break
864
+ end
865
+ _tmp = apply(:_command)
866
+ command = @result
867
+ unless _tmp
868
+ self.pos = _save
869
+ break
870
+ end
871
+ _tmp = apply(:__hyphen_)
872
+ unless _tmp
873
+ self.pos = _save
874
+ break
875
+ end
876
+ _tmp = match_string("{")
877
+ unless _tmp
878
+ self.pos = _save
879
+ break
880
+ end
881
+ _tmp = apply(:__hyphen_)
882
+ unless _tmp
883
+ self.pos = _save
884
+ break
885
+ end
886
+ _tmp = apply(:_nl)
887
+ unless _tmp
888
+ self.pos = _save
889
+ break
890
+ end
891
+ while true
892
+ _tmp = apply(:_empty_line)
893
+ break unless _tmp
894
+ end
895
+ _tmp = true
896
+ unless _tmp
897
+ self.pos = _save
898
+ break
899
+ end
900
+ @result = begin; command ; end
901
+ _tmp = true
902
+ unless _tmp
903
+ self.pos = _save
904
+ end
905
+ break
906
+ end # end sequence
907
+
908
+ set_failed_rule :_blockhead unless _tmp
909
+ return _tmp
910
+ end
911
+
912
+ # blockend = lh - "}" - le empty_line*
913
+ def _blockend
914
+
915
+ _save = self.pos
916
+ while true # sequence
917
+ _tmp = apply(:_lh)
918
+ unless _tmp
919
+ self.pos = _save
920
+ break
921
+ end
922
+ _tmp = apply(:__hyphen_)
923
+ unless _tmp
924
+ self.pos = _save
925
+ break
926
+ end
927
+ _tmp = match_string("}")
928
+ unless _tmp
929
+ self.pos = _save
930
+ break
931
+ end
932
+ _tmp = apply(:__hyphen_)
933
+ unless _tmp
934
+ self.pos = _save
935
+ break
936
+ end
937
+ _tmp = apply(:_le)
938
+ unless _tmp
939
+ self.pos = _save
940
+ break
941
+ end
942
+ while true
943
+ _tmp = apply(:_empty_line)
944
+ break unless _tmp
945
+ end
946
+ _tmp = true
947
+ unless _tmp
948
+ self.pos = _save
949
+ end
950
+ break
951
+ end # end sequence
952
+
953
+ set_failed_rule :_blockend unless _tmp
954
+ return _tmp
955
+ end
956
+
957
+ # blockbody = (!blockend block)+:body { body }
958
+ def _blockbody
959
+
960
+ _save = self.pos
961
+ while true # sequence
962
+ _save1 = self.pos
963
+ _ary = []
964
+
965
+ _save2 = self.pos
966
+ while true # sequence
967
+ _save3 = self.pos
968
+ _tmp = apply(:_blockend)
969
+ _tmp = _tmp ? nil : true
970
+ self.pos = _save3
971
+ unless _tmp
972
+ self.pos = _save2
973
+ break
974
+ end
975
+ _tmp = apply(:_block)
976
+ unless _tmp
977
+ self.pos = _save2
978
+ end
979
+ break
980
+ end # end sequence
981
+
982
+ if _tmp
983
+ _ary << @result
984
+ while true
985
+
986
+ _save4 = self.pos
987
+ while true # sequence
988
+ _save5 = self.pos
989
+ _tmp = apply(:_blockend)
990
+ _tmp = _tmp ? nil : true
991
+ self.pos = _save5
992
+ unless _tmp
993
+ self.pos = _save4
994
+ break
995
+ end
996
+ _tmp = apply(:_block)
997
+ unless _tmp
998
+ self.pos = _save4
999
+ end
1000
+ break
1001
+ end # end sequence
1002
+
1003
+ _ary << @result if _tmp
1004
+ break unless _tmp
1005
+ end
1006
+ _tmp = true
1007
+ @result = _ary
1008
+ else
1009
+ self.pos = _save1
1010
+ end
1011
+ body = @result
1012
+ unless _tmp
1013
+ self.pos = _save
1014
+ break
1015
+ end
1016
+ @result = begin; body ; end
1017
+ _tmp = true
1018
+ unless _tmp
1019
+ self.pos = _save
1020
+ end
1021
+ break
1022
+ end # end sequence
1023
+
1024
+ set_failed_rule :_blockbody unless _tmp
1025
+ return _tmp
1026
+ end
1027
+
1028
+ # explicit_block = < blockhead:head - blockbody:body - blockend > { create_item(:block, head, body, raw: text) }
1029
+ def _explicit_block
1030
+
1031
+ _save = self.pos
1032
+ while true # sequence
1033
+ _text_start = self.pos
1034
+
1035
+ _save1 = self.pos
1036
+ while true # sequence
1037
+ _tmp = apply(:_blockhead)
1038
+ head = @result
1039
+ unless _tmp
1040
+ self.pos = _save1
1041
+ break
1042
+ end
1043
+ _tmp = apply(:__hyphen_)
1044
+ unless _tmp
1045
+ self.pos = _save1
1046
+ break
1047
+ end
1048
+ _tmp = apply(:_blockbody)
1049
+ body = @result
1050
+ unless _tmp
1051
+ self.pos = _save1
1052
+ break
1053
+ end
1054
+ _tmp = apply(:__hyphen_)
1055
+ unless _tmp
1056
+ self.pos = _save1
1057
+ break
1058
+ end
1059
+ _tmp = apply(:_blockend)
1060
+ unless _tmp
1061
+ self.pos = _save1
1062
+ end
1063
+ break
1064
+ end # end sequence
1065
+
1066
+ if _tmp
1067
+ text = get_text(_text_start)
1068
+ end
1069
+ unless _tmp
1070
+ self.pos = _save
1071
+ break
1072
+ end
1073
+ @result = begin; create_item(:block, head, body, raw: text) ; end
1074
+ _tmp = true
1075
+ unless _tmp
1076
+ self.pos = _save
1077
+ end
1078
+ break
1079
+ end # end sequence
1080
+
1081
+ set_failed_rule :_explicit_block unless _tmp
1082
+ return _tmp
1083
+ end
1084
+
1085
+ # preformatted_command = command:command &{ ['pre', 'precode'].include? command[:name] }
1086
+ def _preformatted_command
1087
+
1088
+ _save = self.pos
1089
+ while true # sequence
1090
+ _tmp = apply(:_command)
1091
+ command = @result
1092
+ unless _tmp
1093
+ self.pos = _save
1094
+ break
1095
+ end
1096
+ _save1 = self.pos
1097
+ _tmp = begin; ['pre', 'precode'].include? command[:name] ; end
1098
+ self.pos = _save1
1099
+ unless _tmp
1100
+ self.pos = _save
1101
+ end
1102
+ break
1103
+ end # end sequence
1104
+
1105
+ set_failed_rule :_preformatted_command unless _tmp
1106
+ return _tmp
1107
+ end
1108
+
1109
+ # preformatted_command_head = lh - preformatted_command:command - "<<" &/[\w0-9]/ { command }
1110
+ def _preformatted_command_head
1111
+
1112
+ _save = self.pos
1113
+ while true # sequence
1114
+ _tmp = apply(:_lh)
1115
+ unless _tmp
1116
+ self.pos = _save
1117
+ break
1118
+ end
1119
+ _tmp = apply(:__hyphen_)
1120
+ unless _tmp
1121
+ self.pos = _save
1122
+ break
1123
+ end
1124
+ _tmp = apply(:_preformatted_command)
1125
+ command = @result
1126
+ unless _tmp
1127
+ self.pos = _save
1128
+ break
1129
+ end
1130
+ _tmp = apply(:__hyphen_)
1131
+ unless _tmp
1132
+ self.pos = _save
1133
+ break
1134
+ end
1135
+ _tmp = match_string("<<")
1136
+ unless _tmp
1137
+ self.pos = _save
1138
+ break
1139
+ end
1140
+ _save1 = self.pos
1141
+ _tmp = scan(/\A(?-mix:[\w0-9])/)
1142
+ self.pos = _save1
1143
+ unless _tmp
1144
+ self.pos = _save
1145
+ break
1146
+ end
1147
+ @result = begin; command ; end
1148
+ _tmp = true
1149
+ unless _tmp
1150
+ self.pos = _save
1151
+ end
1152
+ break
1153
+ end # end sequence
1154
+
1155
+ set_failed_rule :_preformatted_command_head unless _tmp
1156
+ return _tmp
1157
+ end
1158
+
1159
+ # preformat_end = lh word:delimiter &{ delimiter == start }
1160
+ def _preformat_end(start)
1161
+
1162
+ _save = self.pos
1163
+ while true # sequence
1164
+ _tmp = apply(:_lh)
1165
+ unless _tmp
1166
+ self.pos = _save
1167
+ break
1168
+ end
1169
+ _tmp = apply(:_word)
1170
+ delimiter = @result
1171
+ unless _tmp
1172
+ self.pos = _save
1173
+ break
1174
+ end
1175
+ _save1 = self.pos
1176
+ _tmp = begin; delimiter == start ; end
1177
+ self.pos = _save1
1178
+ unless _tmp
1179
+ self.pos = _save
1180
+ end
1181
+ break
1182
+ end # end sequence
1183
+
1184
+ set_failed_rule :_preformat_end unless _tmp
1185
+ return _tmp
1186
+ end
1187
+
1188
+ # preformatted_block = < lh - preformatted_command_head:command !nl word:delimiter nl (!preformat_end(delimiter) lh charstring nl)+:content preformat_end(delimiter) > { create_item(:preformatted, command, content, raw: text) }
1189
+ def _preformatted_block
1190
+
1191
+ _save = self.pos
1192
+ while true # sequence
1193
+ _text_start = self.pos
1194
+
1195
+ _save1 = self.pos
1196
+ while true # sequence
1197
+ _tmp = apply(:_lh)
1198
+ unless _tmp
1199
+ self.pos = _save1
1200
+ break
1201
+ end
1202
+ _tmp = apply(:__hyphen_)
1203
+ unless _tmp
1204
+ self.pos = _save1
1205
+ break
1206
+ end
1207
+ _tmp = apply(:_preformatted_command_head)
1208
+ command = @result
1209
+ unless _tmp
1210
+ self.pos = _save1
1211
+ break
1212
+ end
1213
+ _save2 = self.pos
1214
+ _tmp = apply(:_nl)
1215
+ _tmp = _tmp ? nil : true
1216
+ self.pos = _save2
1217
+ unless _tmp
1218
+ self.pos = _save1
1219
+ break
1220
+ end
1221
+ _tmp = apply(:_word)
1222
+ delimiter = @result
1223
+ unless _tmp
1224
+ self.pos = _save1
1225
+ break
1226
+ end
1227
+ _tmp = apply(:_nl)
1228
+ unless _tmp
1229
+ self.pos = _save1
1230
+ break
1231
+ end
1232
+ _save3 = self.pos
1233
+ _ary = []
1234
+
1235
+ _save4 = self.pos
1236
+ while true # sequence
1237
+ _save5 = self.pos
1238
+ _tmp = apply_with_args(:_preformat_end, delimiter)
1239
+ _tmp = _tmp ? nil : true
1240
+ self.pos = _save5
1241
+ unless _tmp
1242
+ self.pos = _save4
1243
+ break
1244
+ end
1245
+ _tmp = apply(:_lh)
1246
+ unless _tmp
1247
+ self.pos = _save4
1248
+ break
1249
+ end
1250
+ _tmp = apply(:_charstring)
1251
+ unless _tmp
1252
+ self.pos = _save4
1253
+ break
1254
+ end
1255
+ _tmp = apply(:_nl)
1256
+ unless _tmp
1257
+ self.pos = _save4
1258
+ end
1259
+ break
1260
+ end # end sequence
1261
+
1262
+ if _tmp
1263
+ _ary << @result
1264
+ while true
1265
+
1266
+ _save6 = self.pos
1267
+ while true # sequence
1268
+ _save7 = self.pos
1269
+ _tmp = apply_with_args(:_preformat_end, delimiter)
1270
+ _tmp = _tmp ? nil : true
1271
+ self.pos = _save7
1272
+ unless _tmp
1273
+ self.pos = _save6
1274
+ break
1275
+ end
1276
+ _tmp = apply(:_lh)
1277
+ unless _tmp
1278
+ self.pos = _save6
1279
+ break
1280
+ end
1281
+ _tmp = apply(:_charstring)
1282
+ unless _tmp
1283
+ self.pos = _save6
1284
+ break
1285
+ end
1286
+ _tmp = apply(:_nl)
1287
+ unless _tmp
1288
+ self.pos = _save6
1289
+ end
1290
+ break
1291
+ end # end sequence
1292
+
1293
+ _ary << @result if _tmp
1294
+ break unless _tmp
1295
+ end
1296
+ _tmp = true
1297
+ @result = _ary
1298
+ else
1299
+ self.pos = _save3
1300
+ end
1301
+ content = @result
1302
+ unless _tmp
1303
+ self.pos = _save1
1304
+ break
1305
+ end
1306
+ _tmp = apply_with_args(:_preformat_end, delimiter)
1307
+ unless _tmp
1308
+ self.pos = _save1
1309
+ end
1310
+ break
1311
+ end # end sequence
1312
+
1313
+ if _tmp
1314
+ text = get_text(_text_start)
1315
+ end
1316
+ unless _tmp
1317
+ self.pos = _save
1318
+ break
1319
+ end
1320
+ @result = begin; create_item(:preformatted, command, content, raw: text) ; end
1321
+ _tmp = true
1322
+ unless _tmp
1323
+ self.pos = _save
1324
+ end
1325
+ break
1326
+ end # end sequence
1327
+
1328
+ set_failed_rule :_preformatted_block unless _tmp
1329
+ return _tmp
1330
+ end
1331
+
1332
+ # inline = (img_inline | common_inline)
1333
+ def _inline
1334
+
1335
+ _save = self.pos
1336
+ while true # choice
1337
+ _tmp = apply(:_img_inline)
1338
+ break if _tmp
1339
+ self.pos = _save
1340
+ _tmp = apply(:_common_inline)
1341
+ break if _tmp
1342
+ self.pos = _save
1343
+ break
1344
+ end # end choice
1345
+
1346
+ set_failed_rule :_inline unless _tmp
1347
+ return _tmp
1348
+ end
1349
+
1350
+ # common_inline = < "[" command:c "{" documentcontent_except('}'):content "}" "]" > { create_item(:inline, c, content, raw: text) }
1351
+ def _common_inline
1352
+
1353
+ _save = self.pos
1354
+ while true # sequence
1355
+ _text_start = self.pos
1356
+
1357
+ _save1 = self.pos
1358
+ while true # sequence
1359
+ _tmp = match_string("[")
1360
+ unless _tmp
1361
+ self.pos = _save1
1362
+ break
1363
+ end
1364
+ _tmp = apply(:_command)
1365
+ c = @result
1366
+ unless _tmp
1367
+ self.pos = _save1
1368
+ break
1369
+ end
1370
+ _tmp = match_string("{")
1371
+ unless _tmp
1372
+ self.pos = _save1
1373
+ break
1374
+ end
1375
+ _tmp = apply_with_args(:_documentcontent_except, '}')
1376
+ content = @result
1377
+ unless _tmp
1378
+ self.pos = _save1
1379
+ break
1380
+ end
1381
+ _tmp = match_string("}")
1382
+ unless _tmp
1383
+ self.pos = _save1
1384
+ break
1385
+ end
1386
+ _tmp = match_string("]")
1387
+ unless _tmp
1388
+ self.pos = _save1
1389
+ end
1390
+ break
1391
+ end # end sequence
1392
+
1393
+ if _tmp
1394
+ text = get_text(_text_start)
1395
+ end
1396
+ unless _tmp
1397
+ self.pos = _save
1398
+ break
1399
+ end
1400
+ @result = begin; create_item(:inline, c, content, raw: text) ; end
1401
+ _tmp = true
1402
+ unless _tmp
1403
+ self.pos = _save
1404
+ end
1405
+ break
1406
+ end # end sequence
1407
+
1408
+ set_failed_rule :_common_inline unless _tmp
1409
+ return _tmp
1410
+ end
1411
+
1412
+ # img_command = command:c &{ c[:name] == 'img' && c[:args].size == 2}
1413
+ def _img_command
1414
+
1415
+ _save = self.pos
1416
+ while true # sequence
1417
+ _tmp = apply(:_command)
1418
+ c = @result
1419
+ unless _tmp
1420
+ self.pos = _save
1421
+ break
1422
+ end
1423
+ _save1 = self.pos
1424
+ _tmp = begin; c[:name] == 'img' && c[:args].size == 2; end
1425
+ self.pos = _save1
1426
+ unless _tmp
1427
+ self.pos = _save
1428
+ end
1429
+ break
1430
+ end # end sequence
1431
+
1432
+ set_failed_rule :_img_command unless _tmp
1433
+ return _tmp
1434
+ end
1435
+
1436
+ # img_inline = < "[" img_command:c "]" > { create_item(:inline, c, nil, raw: text) }
1437
+ def _img_inline
1438
+
1439
+ _save = self.pos
1440
+ while true # sequence
1441
+ _text_start = self.pos
1442
+
1443
+ _save1 = self.pos
1444
+ while true # sequence
1445
+ _tmp = match_string("[")
1446
+ unless _tmp
1447
+ self.pos = _save1
1448
+ break
1449
+ end
1450
+ _tmp = apply(:_img_command)
1451
+ c = @result
1452
+ unless _tmp
1453
+ self.pos = _save1
1454
+ break
1455
+ end
1456
+ _tmp = match_string("]")
1457
+ unless _tmp
1458
+ self.pos = _save1
1459
+ end
1460
+ break
1461
+ end # end sequence
1462
+
1463
+ if _tmp
1464
+ text = get_text(_text_start)
1465
+ end
1466
+ unless _tmp
1467
+ self.pos = _save
1468
+ break
1469
+ end
1470
+ @result = begin; create_item(:inline, c, nil, raw: text) ; end
1471
+ _tmp = true
1472
+ unless _tmp
1473
+ self.pos = _save
1474
+ end
1475
+ break
1476
+ end # end sequence
1477
+
1478
+ set_failed_rule :_img_inline unless _tmp
1479
+ return _tmp
1480
+ end
1481
+
1482
+ # commandname_for_special_line_command = (newpage_command | explicit_paragraph_command)
1483
+ def _commandname_for_special_line_command
1484
+
1485
+ _save = self.pos
1486
+ while true # choice
1487
+ _tmp = apply(:_newpage_command)
1488
+ break if _tmp
1489
+ self.pos = _save
1490
+ _tmp = apply(:_explicit_paragraph_command)
1491
+ break if _tmp
1492
+ self.pos = _save
1493
+ break
1494
+ end # end choice
1495
+
1496
+ set_failed_rule :_commandname_for_special_line_command unless _tmp
1497
+ return _tmp
1498
+ end
1499
+
1500
+ # newpage_command = command:command &{ command[:name] == 'newpage' }
1501
+ def _newpage_command
1502
+
1503
+ _save = self.pos
1504
+ while true # sequence
1505
+ _tmp = apply(:_command)
1506
+ command = @result
1507
+ unless _tmp
1508
+ self.pos = _save
1509
+ break
1510
+ end
1511
+ _save1 = self.pos
1512
+ _tmp = begin; command[:name] == 'newpage' ; end
1513
+ self.pos = _save1
1514
+ unless _tmp
1515
+ self.pos = _save
1516
+ end
1517
+ break
1518
+ end # end sequence
1519
+
1520
+ set_failed_rule :_newpage_command unless _tmp
1521
+ return _tmp
1522
+ end
1523
+
1524
+ # newpage = < lh - newpage_command:c ":" documentcontent?:content - nl > { create_item(:newpage, c, content, raw:text) }
1525
+ def _newpage
1526
+
1527
+ _save = self.pos
1528
+ while true # sequence
1529
+ _text_start = self.pos
1530
+
1531
+ _save1 = self.pos
1532
+ while true # sequence
1533
+ _tmp = apply(:_lh)
1534
+ unless _tmp
1535
+ self.pos = _save1
1536
+ break
1537
+ end
1538
+ _tmp = apply(:__hyphen_)
1539
+ unless _tmp
1540
+ self.pos = _save1
1541
+ break
1542
+ end
1543
+ _tmp = apply(:_newpage_command)
1544
+ c = @result
1545
+ unless _tmp
1546
+ self.pos = _save1
1547
+ break
1548
+ end
1549
+ _tmp = match_string(":")
1550
+ unless _tmp
1551
+ self.pos = _save1
1552
+ break
1553
+ end
1554
+ _save2 = self.pos
1555
+ _tmp = apply(:_documentcontent)
1556
+ @result = nil unless _tmp
1557
+ unless _tmp
1558
+ _tmp = true
1559
+ self.pos = _save2
1560
+ end
1561
+ content = @result
1562
+ unless _tmp
1563
+ self.pos = _save1
1564
+ break
1565
+ end
1566
+ _tmp = apply(:__hyphen_)
1567
+ unless _tmp
1568
+ self.pos = _save1
1569
+ break
1570
+ end
1571
+ _tmp = apply(:_nl)
1572
+ unless _tmp
1573
+ self.pos = _save1
1574
+ end
1575
+ break
1576
+ end # end sequence
1577
+
1578
+ if _tmp
1579
+ text = get_text(_text_start)
1580
+ end
1581
+ unless _tmp
1582
+ self.pos = _save
1583
+ break
1584
+ end
1585
+ @result = begin; create_item(:newpage, c, content, raw:text) ; end
1586
+ _tmp = true
1587
+ unless _tmp
1588
+ self.pos = _save
1589
+ end
1590
+ break
1591
+ end # end sequence
1592
+
1593
+ set_failed_rule :_newpage unless _tmp
1594
+ return _tmp
1595
+ end
1596
+
1597
+ # explicit_paragraph_command = command:c &{ c[:name] == 'p' }
1598
+ def _explicit_paragraph_command
1599
+
1600
+ _save = self.pos
1601
+ while true # sequence
1602
+ _tmp = apply(:_command)
1603
+ c = @result
1604
+ unless _tmp
1605
+ self.pos = _save
1606
+ break
1607
+ end
1608
+ _save1 = self.pos
1609
+ _tmp = begin; c[:name] == 'p' ; end
1610
+ self.pos = _save1
1611
+ unless _tmp
1612
+ self.pos = _save
1613
+ end
1614
+ break
1615
+ end # end sequence
1616
+
1617
+ set_failed_rule :_explicit_paragraph_command unless _tmp
1618
+ return _tmp
1619
+ end
1620
+
1621
+ # explicit_paragraph = < lh - explicit_paragraph_command:c ":" documentcontent?:content le empty_line* > { create_item(:paragraph, c, content, raw:text) }
1622
+ def _explicit_paragraph
1623
+
1624
+ _save = self.pos
1625
+ while true # sequence
1626
+ _text_start = self.pos
1627
+
1628
+ _save1 = self.pos
1629
+ while true # sequence
1630
+ _tmp = apply(:_lh)
1631
+ unless _tmp
1632
+ self.pos = _save1
1633
+ break
1634
+ end
1635
+ _tmp = apply(:__hyphen_)
1636
+ unless _tmp
1637
+ self.pos = _save1
1638
+ break
1639
+ end
1640
+ _tmp = apply(:_explicit_paragraph_command)
1641
+ c = @result
1642
+ unless _tmp
1643
+ self.pos = _save1
1644
+ break
1645
+ end
1646
+ _tmp = match_string(":")
1647
+ unless _tmp
1648
+ self.pos = _save1
1649
+ break
1650
+ end
1651
+ _save2 = self.pos
1652
+ _tmp = apply(:_documentcontent)
1653
+ @result = nil unless _tmp
1654
+ unless _tmp
1655
+ _tmp = true
1656
+ self.pos = _save2
1657
+ end
1658
+ content = @result
1659
+ unless _tmp
1660
+ self.pos = _save1
1661
+ break
1662
+ end
1663
+ _tmp = apply(:_le)
1664
+ unless _tmp
1665
+ self.pos = _save1
1666
+ break
1667
+ end
1668
+ while true
1669
+ _tmp = apply(:_empty_line)
1670
+ break unless _tmp
1671
+ end
1672
+ _tmp = true
1673
+ unless _tmp
1674
+ self.pos = _save1
1675
+ end
1676
+ break
1677
+ end # end sequence
1678
+
1679
+ if _tmp
1680
+ text = get_text(_text_start)
1681
+ end
1682
+ unless _tmp
1683
+ self.pos = _save
1684
+ break
1685
+ end
1686
+ @result = begin; create_item(:paragraph, c, content, raw:text) ; end
1687
+ _tmp = true
1688
+ unless _tmp
1689
+ self.pos = _save
1690
+ end
1691
+ break
1692
+ end # end sequence
1693
+
1694
+ set_failed_rule :_explicit_paragraph unless _tmp
1695
+ return _tmp
1696
+ end
1697
+
1698
+ # unordered_list = < unordered_item+:items > { create_item(:ul, nil, items, raw: text) }
1699
+ def _unordered_list
1700
+
1701
+ _save = self.pos
1702
+ while true # sequence
1703
+ _text_start = self.pos
1704
+ _save1 = self.pos
1705
+ _ary = []
1706
+ _tmp = apply(:_unordered_item)
1707
+ if _tmp
1708
+ _ary << @result
1709
+ while true
1710
+ _tmp = apply(:_unordered_item)
1711
+ _ary << @result if _tmp
1712
+ break unless _tmp
1713
+ end
1714
+ _tmp = true
1715
+ @result = _ary
1716
+ else
1717
+ self.pos = _save1
1718
+ end
1719
+ items = @result
1720
+ if _tmp
1721
+ text = get_text(_text_start)
1722
+ end
1723
+ unless _tmp
1724
+ self.pos = _save
1725
+ break
1726
+ end
1727
+ @result = begin; create_item(:ul, nil, items, raw: text) ; end
1728
+ _tmp = true
1729
+ unless _tmp
1730
+ self.pos = _save
1731
+ end
1732
+ break
1733
+ end # end sequence
1734
+
1735
+ set_failed_rule :_unordered_list unless _tmp
1736
+ return _tmp
1737
+ end
1738
+
1739
+ # unordered_item = < lh "*:" documentcontent:content le > { create_item(:li, nil, content, raw: text) }
1740
+ def _unordered_item
1741
+
1742
+ _save = self.pos
1743
+ while true # sequence
1744
+ _text_start = self.pos
1745
+
1746
+ _save1 = self.pos
1747
+ while true # sequence
1748
+ _tmp = apply(:_lh)
1749
+ unless _tmp
1750
+ self.pos = _save1
1751
+ break
1752
+ end
1753
+ _tmp = match_string("*:")
1754
+ unless _tmp
1755
+ self.pos = _save1
1756
+ break
1757
+ end
1758
+ _tmp = apply(:_documentcontent)
1759
+ content = @result
1760
+ unless _tmp
1761
+ self.pos = _save1
1762
+ break
1763
+ end
1764
+ _tmp = apply(:_le)
1765
+ unless _tmp
1766
+ self.pos = _save1
1767
+ end
1768
+ break
1769
+ end # end sequence
1770
+
1771
+ if _tmp
1772
+ text = get_text(_text_start)
1773
+ end
1774
+ unless _tmp
1775
+ self.pos = _save
1776
+ break
1777
+ end
1778
+ @result = begin; create_item(:li, nil, content, raw: text) ; end
1779
+ _tmp = true
1780
+ unless _tmp
1781
+ self.pos = _save
1782
+ end
1783
+ break
1784
+ end # end sequence
1785
+
1786
+ set_failed_rule :_unordered_item unless _tmp
1787
+ return _tmp
1788
+ end
1789
+
1790
+ # ordered_list = < ordered_item+:items > { create_item(:ol, nil, items, raw: text) }
1791
+ def _ordered_list
1792
+
1793
+ _save = self.pos
1794
+ while true # sequence
1795
+ _text_start = self.pos
1796
+ _save1 = self.pos
1797
+ _ary = []
1798
+ _tmp = apply(:_ordered_item)
1799
+ if _tmp
1800
+ _ary << @result
1801
+ while true
1802
+ _tmp = apply(:_ordered_item)
1803
+ _ary << @result if _tmp
1804
+ break unless _tmp
1805
+ end
1806
+ _tmp = true
1807
+ @result = _ary
1808
+ else
1809
+ self.pos = _save1
1810
+ end
1811
+ items = @result
1812
+ if _tmp
1813
+ text = get_text(_text_start)
1814
+ end
1815
+ unless _tmp
1816
+ self.pos = _save
1817
+ break
1818
+ end
1819
+ @result = begin; create_item(:ol, nil, items, raw: text) ; end
1820
+ _tmp = true
1821
+ unless _tmp
1822
+ self.pos = _save
1823
+ end
1824
+ break
1825
+ end # end sequence
1826
+
1827
+ set_failed_rule :_ordered_list unless _tmp
1828
+ return _tmp
1829
+ end
1830
+
1831
+ # ordered_item = < lh num ":" documentcontent:content le > { create_item(:li, nil, content, raw: text) }
1832
+ def _ordered_item
1833
+
1834
+ _save = self.pos
1835
+ while true # sequence
1836
+ _text_start = self.pos
1837
+
1838
+ _save1 = self.pos
1839
+ while true # sequence
1840
+ _tmp = apply(:_lh)
1841
+ unless _tmp
1842
+ self.pos = _save1
1843
+ break
1844
+ end
1845
+ _tmp = apply(:_num)
1846
+ unless _tmp
1847
+ self.pos = _save1
1848
+ break
1849
+ end
1850
+ _tmp = match_string(":")
1851
+ unless _tmp
1852
+ self.pos = _save1
1853
+ break
1854
+ end
1855
+ _tmp = apply(:_documentcontent)
1856
+ content = @result
1857
+ unless _tmp
1858
+ self.pos = _save1
1859
+ break
1860
+ end
1861
+ _tmp = apply(:_le)
1862
+ unless _tmp
1863
+ self.pos = _save1
1864
+ end
1865
+ break
1866
+ end # end sequence
1867
+
1868
+ if _tmp
1869
+ text = get_text(_text_start)
1870
+ end
1871
+ unless _tmp
1872
+ self.pos = _save
1873
+ break
1874
+ end
1875
+ @result = begin; create_item(:li, nil, content, raw: text) ; end
1876
+ _tmp = true
1877
+ unless _tmp
1878
+ self.pos = _save
1879
+ end
1880
+ break
1881
+ end # end sequence
1882
+
1883
+ set_failed_rule :_ordered_item unless _tmp
1884
+ return _tmp
1885
+ end
1886
+
1887
+ # definition_list = < definition_item+:items > { create_item(:dl, nil, items, raw: text) }
1888
+ def _definition_list
1889
+
1890
+ _save = self.pos
1891
+ while true # sequence
1892
+ _text_start = self.pos
1893
+ _save1 = self.pos
1894
+ _ary = []
1895
+ _tmp = apply(:_definition_item)
1896
+ if _tmp
1897
+ _ary << @result
1898
+ while true
1899
+ _tmp = apply(:_definition_item)
1900
+ _ary << @result if _tmp
1901
+ break unless _tmp
1902
+ end
1903
+ _tmp = true
1904
+ @result = _ary
1905
+ else
1906
+ self.pos = _save1
1907
+ end
1908
+ items = @result
1909
+ if _tmp
1910
+ text = get_text(_text_start)
1911
+ end
1912
+ unless _tmp
1913
+ self.pos = _save
1914
+ break
1915
+ end
1916
+ @result = begin; create_item(:dl, nil, items, raw: text) ; end
1917
+ _tmp = true
1918
+ unless _tmp
1919
+ self.pos = _save
1920
+ end
1921
+ break
1922
+ end # end sequence
1923
+
1924
+ set_failed_rule :_definition_list unless _tmp
1925
+ return _tmp
1926
+ end
1927
+
1928
+ # definition_item = < lh ";:" - documentcontent_except(':'):term ":" - documentcontent:definition le > { create_item(:dtdd, {:args => [term, definition]}, nil, raw: text) }
1929
+ def _definition_item
1930
+
1931
+ _save = self.pos
1932
+ while true # sequence
1933
+ _text_start = self.pos
1934
+
1935
+ _save1 = self.pos
1936
+ while true # sequence
1937
+ _tmp = apply(:_lh)
1938
+ unless _tmp
1939
+ self.pos = _save1
1940
+ break
1941
+ end
1942
+ _tmp = match_string(";:")
1943
+ unless _tmp
1944
+ self.pos = _save1
1945
+ break
1946
+ end
1947
+ _tmp = apply(:__hyphen_)
1948
+ unless _tmp
1949
+ self.pos = _save1
1950
+ break
1951
+ end
1952
+ _tmp = apply_with_args(:_documentcontent_except, ':')
1953
+ term = @result
1954
+ unless _tmp
1955
+ self.pos = _save1
1956
+ break
1957
+ end
1958
+ _tmp = match_string(":")
1959
+ unless _tmp
1960
+ self.pos = _save1
1961
+ break
1962
+ end
1963
+ _tmp = apply(:__hyphen_)
1964
+ unless _tmp
1965
+ self.pos = _save1
1966
+ break
1967
+ end
1968
+ _tmp = apply(:_documentcontent)
1969
+ definition = @result
1970
+ unless _tmp
1971
+ self.pos = _save1
1972
+ break
1973
+ end
1974
+ _tmp = apply(:_le)
1975
+ unless _tmp
1976
+ self.pos = _save1
1977
+ end
1978
+ break
1979
+ end # end sequence
1980
+
1981
+ if _tmp
1982
+ text = get_text(_text_start)
1983
+ end
1984
+ unless _tmp
1985
+ self.pos = _save
1986
+ break
1987
+ end
1988
+ @result = begin; create_item(:dtdd, {:args => [term, definition]}, nil, raw: text) ; end
1989
+ _tmp = true
1990
+ unless _tmp
1991
+ self.pos = _save
1992
+ end
1993
+ break
1994
+ end # end sequence
1995
+
1996
+ set_failed_rule :_definition_item unless _tmp
1997
+ return _tmp
1998
+ end
1999
+
2000
+ # items_list = (unordered_list | ordered_list | definition_list)
2001
+ def _items_list
2002
+
2003
+ _save = self.pos
2004
+ while true # choice
2005
+ _tmp = apply(:_unordered_list)
2006
+ break if _tmp
2007
+ self.pos = _save
2008
+ _tmp = apply(:_ordered_list)
2009
+ break if _tmp
2010
+ self.pos = _save
2011
+ _tmp = apply(:_definition_list)
2012
+ break if _tmp
2013
+ self.pos = _save
2014
+ break
2015
+ end # end choice
2016
+
2017
+ set_failed_rule :_items_list unless _tmp
2018
+ return _tmp
2019
+ end
2020
+
2021
+ # line_command = < lh - !commandname_for_special_line_command command:c ":" documentcontent?:content - le empty_line* > { create_item(:line_command, c, content, raw: text) }
2022
+ def _line_command
2023
+
2024
+ _save = self.pos
2025
+ while true # sequence
2026
+ _text_start = self.pos
2027
+
2028
+ _save1 = self.pos
2029
+ while true # sequence
2030
+ _tmp = apply(:_lh)
2031
+ unless _tmp
2032
+ self.pos = _save1
2033
+ break
2034
+ end
2035
+ _tmp = apply(:__hyphen_)
2036
+ unless _tmp
2037
+ self.pos = _save1
2038
+ break
2039
+ end
2040
+ _save2 = self.pos
2041
+ _tmp = apply(:_commandname_for_special_line_command)
2042
+ _tmp = _tmp ? nil : true
2043
+ self.pos = _save2
2044
+ unless _tmp
2045
+ self.pos = _save1
2046
+ break
2047
+ end
2048
+ _tmp = apply(:_command)
2049
+ c = @result
2050
+ unless _tmp
2051
+ self.pos = _save1
2052
+ break
2053
+ end
2054
+ _tmp = match_string(":")
2055
+ unless _tmp
2056
+ self.pos = _save1
2057
+ break
2058
+ end
2059
+ _save3 = self.pos
2060
+ _tmp = apply(:_documentcontent)
2061
+ @result = nil unless _tmp
2062
+ unless _tmp
2063
+ _tmp = true
2064
+ self.pos = _save3
2065
+ end
2066
+ content = @result
2067
+ unless _tmp
2068
+ self.pos = _save1
2069
+ break
2070
+ end
2071
+ _tmp = apply(:__hyphen_)
2072
+ unless _tmp
2073
+ self.pos = _save1
2074
+ break
2075
+ end
2076
+ _tmp = apply(:_le)
2077
+ unless _tmp
2078
+ self.pos = _save1
2079
+ break
2080
+ end
2081
+ while true
2082
+ _tmp = apply(:_empty_line)
2083
+ break unless _tmp
2084
+ end
2085
+ _tmp = true
2086
+ unless _tmp
2087
+ self.pos = _save1
2088
+ end
2089
+ break
2090
+ end # end sequence
2091
+
2092
+ if _tmp
2093
+ text = get_text(_text_start)
2094
+ end
2095
+ unless _tmp
2096
+ self.pos = _save
2097
+ break
2098
+ end
2099
+ @result = begin; create_item(:line_command, c, content, raw: text) ; end
2100
+ _tmp = true
2101
+ unless _tmp
2102
+ self.pos = _save
2103
+ end
2104
+ break
2105
+ end # end sequence
2106
+
2107
+ set_failed_rule :_line_command unless _tmp
2108
+ return _tmp
2109
+ end
2110
+
2111
+ # line_block = (items_list | line_command)
2112
+ def _line_block
2113
+
2114
+ _save = self.pos
2115
+ while true # choice
2116
+ _tmp = apply(:_items_list)
2117
+ break if _tmp
2118
+ self.pos = _save
2119
+ _tmp = apply(:_line_command)
2120
+ break if _tmp
2121
+ self.pos = _save
2122
+ break
2123
+ end # end choice
2124
+
2125
+ set_failed_rule :_line_block unless _tmp
2126
+ return _tmp
2127
+ end
2128
+
2129
+ # block = (preformatted_block | headed_section | line_block | explicit_block | paragraph_group):block empty_line* {block}
2130
+ def _block
2131
+
2132
+ _save = self.pos
2133
+ while true # sequence
2134
+
2135
+ _save1 = self.pos
2136
+ while true # choice
2137
+ _tmp = apply(:_preformatted_block)
2138
+ break if _tmp
2139
+ self.pos = _save1
2140
+ _tmp = apply(:_headed_section)
2141
+ break if _tmp
2142
+ self.pos = _save1
2143
+ _tmp = apply(:_line_block)
2144
+ break if _tmp
2145
+ self.pos = _save1
2146
+ _tmp = apply(:_explicit_block)
2147
+ break if _tmp
2148
+ self.pos = _save1
2149
+ _tmp = apply(:_paragraph_group)
2150
+ break if _tmp
2151
+ self.pos = _save1
2152
+ break
2153
+ end # end choice
2154
+
2155
+ block = @result
2156
+ unless _tmp
2157
+ self.pos = _save
2158
+ break
2159
+ end
2160
+ while true
2161
+ _tmp = apply(:_empty_line)
2162
+ break unless _tmp
2163
+ end
2164
+ _tmp = true
2165
+ unless _tmp
2166
+ self.pos = _save
2167
+ break
2168
+ end
2169
+ @result = begin; block; end
2170
+ _tmp = true
2171
+ unless _tmp
2172
+ self.pos = _save
2173
+ end
2174
+ break
2175
+ end # end sequence
2176
+
2177
+ set_failed_rule :_block unless _tmp
2178
+ return _tmp
2179
+ end
2180
+
2181
+ # block_delimiter = (blockhead | blockend)
2182
+ def _block_delimiter
2183
+
2184
+ _save = self.pos
2185
+ while true # choice
2186
+ _tmp = apply(:_blockhead)
2187
+ break if _tmp
2188
+ self.pos = _save
2189
+ _tmp = apply(:_blockend)
2190
+ break if _tmp
2191
+ self.pos = _save
2192
+ break
2193
+ end # end choice
2194
+
2195
+ set_failed_rule :_block_delimiter unless _tmp
2196
+ return _tmp
2197
+ end
2198
+
2199
+ # paragraph_delimiter = (block_delimiter | preformatted_command_head | line_block | newpage | headed_start)
2200
+ def _paragraph_delimiter
2201
+
2202
+ _save = self.pos
2203
+ while true # choice
2204
+ _tmp = apply(:_block_delimiter)
2205
+ break if _tmp
2206
+ self.pos = _save
2207
+ _tmp = apply(:_preformatted_command_head)
2208
+ break if _tmp
2209
+ self.pos = _save
2210
+ _tmp = apply(:_line_block)
2211
+ break if _tmp
2212
+ self.pos = _save
2213
+ _tmp = apply(:_newpage)
2214
+ break if _tmp
2215
+ self.pos = _save
2216
+ _tmp = apply(:_headed_start)
2217
+ break if _tmp
2218
+ self.pos = _save
2219
+ break
2220
+ end # end choice
2221
+
2222
+ set_failed_rule :_paragraph_delimiter unless _tmp
2223
+ return _tmp
2224
+ end
2225
+
2226
+ # h_start_mark = < "="+ ":" > &{ text.length - 1 == n }
2227
+ def _h_start_mark(n)
2228
+
2229
+ _save = self.pos
2230
+ while true # sequence
2231
+ _text_start = self.pos
2232
+
2233
+ _save1 = self.pos
2234
+ while true # sequence
2235
+ _save2 = self.pos
2236
+ _tmp = match_string("=")
2237
+ if _tmp
2238
+ while true
2239
+ _tmp = match_string("=")
2240
+ break unless _tmp
2241
+ end
2242
+ _tmp = true
2243
+ else
2244
+ self.pos = _save2
2245
+ end
2246
+ unless _tmp
2247
+ self.pos = _save1
2248
+ break
2249
+ end
2250
+ _tmp = match_string(":")
2251
+ unless _tmp
2252
+ self.pos = _save1
2253
+ end
2254
+ break
2255
+ end # end sequence
2256
+
2257
+ if _tmp
2258
+ text = get_text(_text_start)
2259
+ end
2260
+ unless _tmp
2261
+ self.pos = _save
2262
+ break
2263
+ end
2264
+ _save3 = self.pos
2265
+ _tmp = begin; text.length - 1 == n ; end
2266
+ self.pos = _save3
2267
+ unless _tmp
2268
+ self.pos = _save
2269
+ end
2270
+ break
2271
+ end # end sequence
2272
+
2273
+ set_failed_rule :_h_start_mark unless _tmp
2274
+ return _tmp
2275
+ end
2276
+
2277
+ # h_markup_terminator = lh - < "="+ ":" > &{ text.length - 1 <= n }
2278
+ def _h_markup_terminator(n)
2279
+
2280
+ _save = self.pos
2281
+ while true # sequence
2282
+ _tmp = apply(:_lh)
2283
+ unless _tmp
2284
+ self.pos = _save
2285
+ break
2286
+ end
2287
+ _tmp = apply(:__hyphen_)
2288
+ unless _tmp
2289
+ self.pos = _save
2290
+ break
2291
+ end
2292
+ _text_start = self.pos
2293
+
2294
+ _save1 = self.pos
2295
+ while true # sequence
2296
+ _save2 = self.pos
2297
+ _tmp = match_string("=")
2298
+ if _tmp
2299
+ while true
2300
+ _tmp = match_string("=")
2301
+ break unless _tmp
2302
+ end
2303
+ _tmp = true
2304
+ else
2305
+ self.pos = _save2
2306
+ end
2307
+ unless _tmp
2308
+ self.pos = _save1
2309
+ break
2310
+ end
2311
+ _tmp = match_string(":")
2312
+ unless _tmp
2313
+ self.pos = _save1
2314
+ end
2315
+ break
2316
+ end # end sequence
2317
+
2318
+ if _tmp
2319
+ text = get_text(_text_start)
2320
+ end
2321
+ unless _tmp
2322
+ self.pos = _save
2323
+ break
2324
+ end
2325
+ _save3 = self.pos
2326
+ _tmp = begin; text.length - 1 <= n ; end
2327
+ self.pos = _save3
2328
+ unless _tmp
2329
+ self.pos = _save
2330
+ end
2331
+ break
2332
+ end # end sequence
2333
+
2334
+ set_failed_rule :_h_markup_terminator unless _tmp
2335
+ return _tmp
2336
+ end
2337
+
2338
+ # h_start = lh - h_start_mark(n) charstring:s le { { level: n, heading: s } }
2339
+ def _h_start(n)
2340
+
2341
+ _save = self.pos
2342
+ while true # sequence
2343
+ _tmp = apply(:_lh)
2344
+ unless _tmp
2345
+ self.pos = _save
2346
+ break
2347
+ end
2348
+ _tmp = apply(:__hyphen_)
2349
+ unless _tmp
2350
+ self.pos = _save
2351
+ break
2352
+ end
2353
+ _tmp = apply_with_args(:_h_start_mark, n)
2354
+ unless _tmp
2355
+ self.pos = _save
2356
+ break
2357
+ end
2358
+ _tmp = apply(:_charstring)
2359
+ s = @result
2360
+ unless _tmp
2361
+ self.pos = _save
2362
+ break
2363
+ end
2364
+ _tmp = apply(:_le)
2365
+ unless _tmp
2366
+ self.pos = _save
2367
+ break
2368
+ end
2369
+ @result = begin; { level: n, heading: s } ; end
2370
+ _tmp = true
2371
+ unless _tmp
2372
+ self.pos = _save
2373
+ end
2374
+ break
2375
+ end # end sequence
2376
+
2377
+ set_failed_rule :_h_start unless _tmp
2378
+ return _tmp
2379
+ end
2380
+
2381
+ # h_section = < h_start(n):h (!h_markup_terminator(n) !eof block)+:content > { create_item(:h_section, h, content, raw: text) }
2382
+ def _h_section(n)
2383
+
2384
+ _save = self.pos
2385
+ while true # sequence
2386
+ _text_start = self.pos
2387
+
2388
+ _save1 = self.pos
2389
+ while true # sequence
2390
+ _tmp = apply_with_args(:_h_start, n)
2391
+ h = @result
2392
+ unless _tmp
2393
+ self.pos = _save1
2394
+ break
2395
+ end
2396
+ _save2 = self.pos
2397
+ _ary = []
2398
+
2399
+ _save3 = self.pos
2400
+ while true # sequence
2401
+ _save4 = self.pos
2402
+ _tmp = apply_with_args(:_h_markup_terminator, n)
2403
+ _tmp = _tmp ? nil : true
2404
+ self.pos = _save4
2405
+ unless _tmp
2406
+ self.pos = _save3
2407
+ break
2408
+ end
2409
+ _save5 = self.pos
2410
+ _tmp = apply(:_eof)
2411
+ _tmp = _tmp ? nil : true
2412
+ self.pos = _save5
2413
+ unless _tmp
2414
+ self.pos = _save3
2415
+ break
2416
+ end
2417
+ _tmp = apply(:_block)
2418
+ unless _tmp
2419
+ self.pos = _save3
2420
+ end
2421
+ break
2422
+ end # end sequence
2423
+
2424
+ if _tmp
2425
+ _ary << @result
2426
+ while true
2427
+
2428
+ _save6 = self.pos
2429
+ while true # sequence
2430
+ _save7 = self.pos
2431
+ _tmp = apply_with_args(:_h_markup_terminator, n)
2432
+ _tmp = _tmp ? nil : true
2433
+ self.pos = _save7
2434
+ unless _tmp
2435
+ self.pos = _save6
2436
+ break
2437
+ end
2438
+ _save8 = self.pos
2439
+ _tmp = apply(:_eof)
2440
+ _tmp = _tmp ? nil : true
2441
+ self.pos = _save8
2442
+ unless _tmp
2443
+ self.pos = _save6
2444
+ break
2445
+ end
2446
+ _tmp = apply(:_block)
2447
+ unless _tmp
2448
+ self.pos = _save6
2449
+ end
2450
+ break
2451
+ end # end sequence
2452
+
2453
+ _ary << @result if _tmp
2454
+ break unless _tmp
2455
+ end
2456
+ _tmp = true
2457
+ @result = _ary
2458
+ else
2459
+ self.pos = _save2
2460
+ end
2461
+ content = @result
2462
+ unless _tmp
2463
+ self.pos = _save1
2464
+ end
2465
+ break
2466
+ end # end sequence
2467
+
2468
+ if _tmp
2469
+ text = get_text(_text_start)
2470
+ end
2471
+ unless _tmp
2472
+ self.pos = _save
2473
+ break
2474
+ end
2475
+ @result = begin; create_item(:h_section, h, content, raw: text) ; end
2476
+ _tmp = true
2477
+ unless _tmp
2478
+ self.pos = _save
2479
+ end
2480
+ break
2481
+ end # end sequence
2482
+
2483
+ set_failed_rule :_h_section unless _tmp
2484
+ return _tmp
2485
+ end
2486
+
2487
+ # headed_start = (h_start(1) | h_start(2) | h_start(3) | h_start(4) | h_start(5) | h_start(6))
2488
+ def _headed_start
2489
+
2490
+ _save = self.pos
2491
+ while true # choice
2492
+ _tmp = apply_with_args(:_h_start, 1)
2493
+ break if _tmp
2494
+ self.pos = _save
2495
+ _tmp = apply_with_args(:_h_start, 2)
2496
+ break if _tmp
2497
+ self.pos = _save
2498
+ _tmp = apply_with_args(:_h_start, 3)
2499
+ break if _tmp
2500
+ self.pos = _save
2501
+ _tmp = apply_with_args(:_h_start, 4)
2502
+ break if _tmp
2503
+ self.pos = _save
2504
+ _tmp = apply_with_args(:_h_start, 5)
2505
+ break if _tmp
2506
+ self.pos = _save
2507
+ _tmp = apply_with_args(:_h_start, 6)
2508
+ break if _tmp
2509
+ self.pos = _save
2510
+ break
2511
+ end # end choice
2512
+
2513
+ set_failed_rule :_headed_start unless _tmp
2514
+ return _tmp
2515
+ end
2516
+
2517
+ # headed_section = (h_section(1) | h_section(2) | h_section(3) | h_section(4) | h_section(5) | h_section(6))
2518
+ def _headed_section
2519
+
2520
+ _save = self.pos
2521
+ while true # choice
2522
+ _tmp = apply_with_args(:_h_section, 1)
2523
+ break if _tmp
2524
+ self.pos = _save
2525
+ _tmp = apply_with_args(:_h_section, 2)
2526
+ break if _tmp
2527
+ self.pos = _save
2528
+ _tmp = apply_with_args(:_h_section, 3)
2529
+ break if _tmp
2530
+ self.pos = _save
2531
+ _tmp = apply_with_args(:_h_section, 4)
2532
+ break if _tmp
2533
+ self.pos = _save
2534
+ _tmp = apply_with_args(:_h_section, 5)
2535
+ break if _tmp
2536
+ self.pos = _save
2537
+ _tmp = apply_with_args(:_h_section, 6)
2538
+ break if _tmp
2539
+ self.pos = _save
2540
+ break
2541
+ end # end choice
2542
+
2543
+ set_failed_rule :_headed_section unless _tmp
2544
+ return _tmp
2545
+ end
2546
+
2547
+ # stylesheets = < lh - "stylesheets:" !le charstring:s nl > { create_item(:stylesheets, {:stylesheets => s.split(',').map(&:strip)}, nil, raw:text) }
2548
+ def _stylesheets
2549
+
2550
+ _save = self.pos
2551
+ while true # sequence
2552
+ _text_start = self.pos
2553
+
2554
+ _save1 = self.pos
2555
+ while true # sequence
2556
+ _tmp = apply(:_lh)
2557
+ unless _tmp
2558
+ self.pos = _save1
2559
+ break
2560
+ end
2561
+ _tmp = apply(:__hyphen_)
2562
+ unless _tmp
2563
+ self.pos = _save1
2564
+ break
2565
+ end
2566
+ _tmp = match_string("stylesheets:")
2567
+ unless _tmp
2568
+ self.pos = _save1
2569
+ break
2570
+ end
2571
+ _save2 = self.pos
2572
+ _tmp = apply(:_le)
2573
+ _tmp = _tmp ? nil : true
2574
+ self.pos = _save2
2575
+ unless _tmp
2576
+ self.pos = _save1
2577
+ break
2578
+ end
2579
+ _tmp = apply(:_charstring)
2580
+ s = @result
2581
+ unless _tmp
2582
+ self.pos = _save1
2583
+ break
2584
+ end
2585
+ _tmp = apply(:_nl)
2586
+ unless _tmp
2587
+ self.pos = _save1
2588
+ end
2589
+ break
2590
+ end # end sequence
2591
+
2592
+ if _tmp
2593
+ text = get_text(_text_start)
2594
+ end
2595
+ unless _tmp
2596
+ self.pos = _save
2597
+ break
2598
+ end
2599
+ @result = begin; create_item(:stylesheets, {:stylesheets => s.split(',').map(&:strip)}, nil, raw:text) ; end
2600
+ _tmp = true
2601
+ unless _tmp
2602
+ self.pos = _save
2603
+ end
2604
+ break
2605
+ end # end sequence
2606
+
2607
+ set_failed_rule :_stylesheets unless _tmp
2608
+ return _tmp
2609
+ end
2610
+
2611
+ # title = < lh - "title:" !le charstring:t nl > { create_item(:title, {:title => t }, nil, raw:text) }
2612
+ def _title
2613
+
2614
+ _save = self.pos
2615
+ while true # sequence
2616
+ _text_start = self.pos
2617
+
2618
+ _save1 = self.pos
2619
+ while true # sequence
2620
+ _tmp = apply(:_lh)
2621
+ unless _tmp
2622
+ self.pos = _save1
2623
+ break
2624
+ end
2625
+ _tmp = apply(:__hyphen_)
2626
+ unless _tmp
2627
+ self.pos = _save1
2628
+ break
2629
+ end
2630
+ _tmp = match_string("title:")
2631
+ unless _tmp
2632
+ self.pos = _save1
2633
+ break
2634
+ end
2635
+ _save2 = self.pos
2636
+ _tmp = apply(:_le)
2637
+ _tmp = _tmp ? nil : true
2638
+ self.pos = _save2
2639
+ unless _tmp
2640
+ self.pos = _save1
2641
+ break
2642
+ end
2643
+ _tmp = apply(:_charstring)
2644
+ t = @result
2645
+ unless _tmp
2646
+ self.pos = _save1
2647
+ break
2648
+ end
2649
+ _tmp = apply(:_nl)
2650
+ unless _tmp
2651
+ self.pos = _save1
2652
+ end
2653
+ break
2654
+ end # end sequence
2655
+
2656
+ if _tmp
2657
+ text = get_text(_text_start)
2658
+ end
2659
+ unless _tmp
2660
+ self.pos = _save
2661
+ break
2662
+ end
2663
+ @result = begin; create_item(:title, {:title => t }, nil, raw:text) ; end
2664
+ _tmp = true
2665
+ unless _tmp
2666
+ self.pos = _save
2667
+ end
2668
+ break
2669
+ end # end sequence
2670
+
2671
+ set_failed_rule :_title unless _tmp
2672
+ return _tmp
2673
+ end
2674
+
2675
+ # lang = < lh - "lang:" !le charstring:l nl > { create_item(:lang, {:lang => l }, nil, raw:text) }
2676
+ def _lang
2677
+
2678
+ _save = self.pos
2679
+ while true # sequence
2680
+ _text_start = self.pos
2681
+
2682
+ _save1 = self.pos
2683
+ while true # sequence
2684
+ _tmp = apply(:_lh)
2685
+ unless _tmp
2686
+ self.pos = _save1
2687
+ break
2688
+ end
2689
+ _tmp = apply(:__hyphen_)
2690
+ unless _tmp
2691
+ self.pos = _save1
2692
+ break
2693
+ end
2694
+ _tmp = match_string("lang:")
2695
+ unless _tmp
2696
+ self.pos = _save1
2697
+ break
2698
+ end
2699
+ _save2 = self.pos
2700
+ _tmp = apply(:_le)
2701
+ _tmp = _tmp ? nil : true
2702
+ self.pos = _save2
2703
+ unless _tmp
2704
+ self.pos = _save1
2705
+ break
2706
+ end
2707
+ _tmp = apply(:_charstring)
2708
+ l = @result
2709
+ unless _tmp
2710
+ self.pos = _save1
2711
+ break
2712
+ end
2713
+ _tmp = apply(:_nl)
2714
+ unless _tmp
2715
+ self.pos = _save1
2716
+ end
2717
+ break
2718
+ end # end sequence
2719
+
2720
+ if _tmp
2721
+ text = get_text(_text_start)
2722
+ end
2723
+ unless _tmp
2724
+ self.pos = _save
2725
+ break
2726
+ end
2727
+ @result = begin; create_item(:lang, {:lang => l }, nil, raw:text) ; end
2728
+ _tmp = true
2729
+ unless _tmp
2730
+ self.pos = _save
2731
+ end
2732
+ break
2733
+ end # end sequence
2734
+
2735
+ set_failed_rule :_lang unless _tmp
2736
+ return _tmp
2737
+ end
2738
+
2739
+ # paragraph_style = < lh - "paragraph-style:" !le charstring:l nl > { create_item(:paragraph_style, {:paragraph_style => l }, nil, raw:text) }
2740
+ def _paragraph_style
2741
+
2742
+ _save = self.pos
2743
+ while true # sequence
2744
+ _text_start = self.pos
2745
+
2746
+ _save1 = self.pos
2747
+ while true # sequence
2748
+ _tmp = apply(:_lh)
2749
+ unless _tmp
2750
+ self.pos = _save1
2751
+ break
2752
+ end
2753
+ _tmp = apply(:__hyphen_)
2754
+ unless _tmp
2755
+ self.pos = _save1
2756
+ break
2757
+ end
2758
+ _tmp = match_string("paragraph-style:")
2759
+ unless _tmp
2760
+ self.pos = _save1
2761
+ break
2762
+ end
2763
+ _save2 = self.pos
2764
+ _tmp = apply(:_le)
2765
+ _tmp = _tmp ? nil : true
2766
+ self.pos = _save2
2767
+ unless _tmp
2768
+ self.pos = _save1
2769
+ break
2770
+ end
2771
+ _tmp = apply(:_charstring)
2772
+ l = @result
2773
+ unless _tmp
2774
+ self.pos = _save1
2775
+ break
2776
+ end
2777
+ _tmp = apply(:_nl)
2778
+ unless _tmp
2779
+ self.pos = _save1
2780
+ end
2781
+ break
2782
+ end # end sequence
2783
+
2784
+ if _tmp
2785
+ text = get_text(_text_start)
2786
+ end
2787
+ unless _tmp
2788
+ self.pos = _save
2789
+ break
2790
+ end
2791
+ @result = begin; create_item(:paragraph_style, {:paragraph_style => l }, nil, raw:text) ; end
2792
+ _tmp = true
2793
+ unless _tmp
2794
+ self.pos = _save
2795
+ end
2796
+ break
2797
+ end # end sequence
2798
+
2799
+ set_failed_rule :_paragraph_style unless _tmp
2800
+ return _tmp
2801
+ end
2802
+
2803
+ # header = (stylesheets | title | lang | paragraph_style) empty_line*
2804
+ def _header
2805
+
2806
+ _save = self.pos
2807
+ while true # sequence
2808
+
2809
+ _save1 = self.pos
2810
+ while true # choice
2811
+ _tmp = apply(:_stylesheets)
2812
+ break if _tmp
2813
+ self.pos = _save1
2814
+ _tmp = apply(:_title)
2815
+ break if _tmp
2816
+ self.pos = _save1
2817
+ _tmp = apply(:_lang)
2818
+ break if _tmp
2819
+ self.pos = _save1
2820
+ _tmp = apply(:_paragraph_style)
2821
+ break if _tmp
2822
+ self.pos = _save1
2823
+ break
2824
+ end # end choice
2825
+
2826
+ unless _tmp
2827
+ self.pos = _save
2828
+ break
2829
+ end
2830
+ while true
2831
+ _tmp = apply(:_empty_line)
2832
+ break unless _tmp
2833
+ end
2834
+ _tmp = true
2835
+ unless _tmp
2836
+ self.pos = _save
2837
+ end
2838
+ break
2839
+ end # end sequence
2840
+
2841
+ set_failed_rule :_header unless _tmp
2842
+ return _tmp
2843
+ end
2844
+
2845
+ # char = < /[[:print:]]/ > { text }
2846
+ def _char
2847
+
2848
+ _save = self.pos
2849
+ while true # sequence
2850
+ _text_start = self.pos
2851
+ _tmp = scan(/\A(?-mix:[[:print:]])/)
2852
+ if _tmp
2853
+ text = get_text(_text_start)
2854
+ end
2855
+ unless _tmp
2856
+ self.pos = _save
2857
+ break
2858
+ end
2859
+ @result = begin; text ; end
2860
+ _tmp = true
2861
+ unless _tmp
2862
+ self.pos = _save
2863
+ end
2864
+ break
2865
+ end # end sequence
2866
+
2867
+ set_failed_rule :_char unless _tmp
2868
+ return _tmp
2869
+ end
2870
+
2871
+ # charstring = < char* > { text }
2872
+ def _charstring
2873
+
2874
+ _save = self.pos
2875
+ while true # sequence
2876
+ _text_start = self.pos
2877
+ while true
2878
+ _tmp = apply(:_char)
2879
+ break unless _tmp
2880
+ end
2881
+ _tmp = true
2882
+ if _tmp
2883
+ text = get_text(_text_start)
2884
+ end
2885
+ unless _tmp
2886
+ self.pos = _save
2887
+ break
2888
+ end
2889
+ @result = begin; text ; end
2890
+ _tmp = true
2891
+ unless _tmp
2892
+ self.pos = _save
2893
+ end
2894
+ break
2895
+ end # end sequence
2896
+
2897
+ set_failed_rule :_charstring unless _tmp
2898
+ return _tmp
2899
+ end
2900
+
2901
+ # char_except = char:c &{ c != e }
2902
+ def _char_except(e)
2903
+
2904
+ _save = self.pos
2905
+ while true # sequence
2906
+ _tmp = apply(:_char)
2907
+ c = @result
2908
+ unless _tmp
2909
+ self.pos = _save
2910
+ break
2911
+ end
2912
+ _save1 = self.pos
2913
+ _tmp = begin; c != e ; end
2914
+ self.pos = _save1
2915
+ unless _tmp
2916
+ self.pos = _save
2917
+ end
2918
+ break
2919
+ end # end sequence
2920
+
2921
+ set_failed_rule :_char_except unless _tmp
2922
+ return _tmp
2923
+ end
2924
+
2925
+ # charstring_except = < char_except(e)* > { text }
2926
+ def _charstring_except(e)
2927
+
2928
+ _save = self.pos
2929
+ while true # sequence
2930
+ _text_start = self.pos
2931
+ while true
2932
+ _tmp = apply_with_args(:_char_except, e)
2933
+ break unless _tmp
2934
+ end
2935
+ _tmp = true
2936
+ if _tmp
2937
+ text = get_text(_text_start)
2938
+ end
2939
+ unless _tmp
2940
+ self.pos = _save
2941
+ break
2942
+ end
2943
+ @result = begin; text ; end
2944
+ _tmp = true
2945
+ unless _tmp
2946
+ self.pos = _save
2947
+ end
2948
+ break
2949
+ end # end sequence
2950
+
2951
+ set_failed_rule :_charstring_except unless _tmp
2952
+ return _tmp
2953
+ end
2954
+
2955
+ # documentcontent_except = (inline | !inline char_except(e))+:content {parse_text(content)}
2956
+ def _documentcontent_except(e)
2957
+
2958
+ _save = self.pos
2959
+ while true # sequence
2960
+ _save1 = self.pos
2961
+ _ary = []
2962
+
2963
+ _save2 = self.pos
2964
+ while true # choice
2965
+ _tmp = apply(:_inline)
2966
+ break if _tmp
2967
+ self.pos = _save2
2968
+
2969
+ _save3 = self.pos
2970
+ while true # sequence
2971
+ _save4 = self.pos
2972
+ _tmp = apply(:_inline)
2973
+ _tmp = _tmp ? nil : true
2974
+ self.pos = _save4
2975
+ unless _tmp
2976
+ self.pos = _save3
2977
+ break
2978
+ end
2979
+ _tmp = apply_with_args(:_char_except, e)
2980
+ unless _tmp
2981
+ self.pos = _save3
2982
+ end
2983
+ break
2984
+ end # end sequence
2985
+
2986
+ break if _tmp
2987
+ self.pos = _save2
2988
+ break
2989
+ end # end choice
2990
+
2991
+ if _tmp
2992
+ _ary << @result
2993
+ while true
2994
+
2995
+ _save5 = self.pos
2996
+ while true # choice
2997
+ _tmp = apply(:_inline)
2998
+ break if _tmp
2999
+ self.pos = _save5
3000
+
3001
+ _save6 = self.pos
3002
+ while true # sequence
3003
+ _save7 = self.pos
3004
+ _tmp = apply(:_inline)
3005
+ _tmp = _tmp ? nil : true
3006
+ self.pos = _save7
3007
+ unless _tmp
3008
+ self.pos = _save6
3009
+ break
3010
+ end
3011
+ _tmp = apply_with_args(:_char_except, e)
3012
+ unless _tmp
3013
+ self.pos = _save6
3014
+ end
3015
+ break
3016
+ end # end sequence
3017
+
3018
+ break if _tmp
3019
+ self.pos = _save5
3020
+ break
3021
+ end # end choice
3022
+
3023
+ _ary << @result if _tmp
3024
+ break unless _tmp
3025
+ end
3026
+ _tmp = true
3027
+ @result = _ary
3028
+ else
3029
+ self.pos = _save1
3030
+ end
3031
+ content = @result
3032
+ unless _tmp
3033
+ self.pos = _save
3034
+ break
3035
+ end
3036
+ @result = begin; parse_text(content); end
3037
+ _tmp = true
3038
+ unless _tmp
3039
+ self.pos = _save
3040
+ end
3041
+ break
3042
+ end # end sequence
3043
+
3044
+ set_failed_rule :_documentcontent_except unless _tmp
3045
+ return _tmp
3046
+ end
3047
+
3048
+ # documentcontent = (inline | !inline char)+:content {parse_text(content)}
3049
+ def _documentcontent
3050
+
3051
+ _save = self.pos
3052
+ while true # sequence
3053
+ _save1 = self.pos
3054
+ _ary = []
3055
+
3056
+ _save2 = self.pos
3057
+ while true # choice
3058
+ _tmp = apply(:_inline)
3059
+ break if _tmp
3060
+ self.pos = _save2
3061
+
3062
+ _save3 = self.pos
3063
+ while true # sequence
3064
+ _save4 = self.pos
3065
+ _tmp = apply(:_inline)
3066
+ _tmp = _tmp ? nil : true
3067
+ self.pos = _save4
3068
+ unless _tmp
3069
+ self.pos = _save3
3070
+ break
3071
+ end
3072
+ _tmp = apply(:_char)
3073
+ unless _tmp
3074
+ self.pos = _save3
3075
+ end
3076
+ break
3077
+ end # end sequence
3078
+
3079
+ break if _tmp
3080
+ self.pos = _save2
3081
+ break
3082
+ end # end choice
3083
+
3084
+ if _tmp
3085
+ _ary << @result
3086
+ while true
3087
+
3088
+ _save5 = self.pos
3089
+ while true # choice
3090
+ _tmp = apply(:_inline)
3091
+ break if _tmp
3092
+ self.pos = _save5
3093
+
3094
+ _save6 = self.pos
3095
+ while true # sequence
3096
+ _save7 = self.pos
3097
+ _tmp = apply(:_inline)
3098
+ _tmp = _tmp ? nil : true
3099
+ self.pos = _save7
3100
+ unless _tmp
3101
+ self.pos = _save6
3102
+ break
3103
+ end
3104
+ _tmp = apply(:_char)
3105
+ unless _tmp
3106
+ self.pos = _save6
3107
+ end
3108
+ break
3109
+ end # end sequence
3110
+
3111
+ break if _tmp
3112
+ self.pos = _save5
3113
+ break
3114
+ end # end choice
3115
+
3116
+ _ary << @result if _tmp
3117
+ break unless _tmp
3118
+ end
3119
+ _tmp = true
3120
+ @result = _ary
3121
+ else
3122
+ self.pos = _save1
3123
+ end
3124
+ content = @result
3125
+ unless _tmp
3126
+ self.pos = _save
3127
+ break
3128
+ end
3129
+ @result = begin; parse_text(content); end
3130
+ _tmp = true
3131
+ unless _tmp
3132
+ self.pos = _save
3133
+ end
3134
+ break
3135
+ end # end sequence
3136
+
3137
+ set_failed_rule :_documentcontent unless _tmp
3138
+ return _tmp
3139
+ end
3140
+
3141
+ # documentline = lh documentcontent:content le { content }
3142
+ def _documentline
3143
+
3144
+ _save = self.pos
3145
+ while true # sequence
3146
+ _tmp = apply(:_lh)
3147
+ unless _tmp
3148
+ self.pos = _save
3149
+ break
3150
+ end
3151
+ _tmp = apply(:_documentcontent)
3152
+ content = @result
3153
+ unless _tmp
3154
+ self.pos = _save
3155
+ break
3156
+ end
3157
+ _tmp = apply(:_le)
3158
+ unless _tmp
3159
+ self.pos = _save
3160
+ break
3161
+ end
3162
+ @result = begin; content ; end
3163
+ _tmp = true
3164
+ unless _tmp
3165
+ self.pos = _save
3166
+ end
3167
+ break
3168
+ end # end sequence
3169
+
3170
+ set_failed_rule :_documentline unless _tmp
3171
+ return _tmp
3172
+ end
3173
+
3174
+ # headers = header*:headers { create_item(:headers, nil, headers) }
3175
+ def _headers
3176
+
3177
+ _save = self.pos
3178
+ while true # sequence
3179
+ _ary = []
3180
+ while true
3181
+ _tmp = apply(:_header)
3182
+ _ary << @result if _tmp
3183
+ break unless _tmp
3184
+ end
3185
+ _tmp = true
3186
+ @result = _ary
3187
+ headers = @result
3188
+ unless _tmp
3189
+ self.pos = _save
3190
+ break
3191
+ end
3192
+ @result = begin; create_item(:headers, nil, headers) ; end
3193
+ _tmp = true
3194
+ unless _tmp
3195
+ self.pos = _save
3196
+ end
3197
+ break
3198
+ end # end sequence
3199
+
3200
+ set_failed_rule :_headers unless _tmp
3201
+ return _tmp
3202
+ end
3203
+
3204
+ # page = headers:headers - (!newpage block)*:blocks { create_item(:page, nil, [headers] + blocks.select{ |x| !x.nil?}) }
3205
+ def _page
3206
+
3207
+ _save = self.pos
3208
+ while true # sequence
3209
+ _tmp = apply(:_headers)
3210
+ headers = @result
3211
+ unless _tmp
3212
+ self.pos = _save
3213
+ break
3214
+ end
3215
+ _tmp = apply(:__hyphen_)
3216
+ unless _tmp
3217
+ self.pos = _save
3218
+ break
3219
+ end
3220
+ _ary = []
3221
+ while true
3222
+
3223
+ _save2 = self.pos
3224
+ while true # sequence
3225
+ _save3 = self.pos
3226
+ _tmp = apply(:_newpage)
3227
+ _tmp = _tmp ? nil : true
3228
+ self.pos = _save3
3229
+ unless _tmp
3230
+ self.pos = _save2
3231
+ break
3232
+ end
3233
+ _tmp = apply(:_block)
3234
+ unless _tmp
3235
+ self.pos = _save2
3236
+ end
3237
+ break
3238
+ end # end sequence
3239
+
3240
+ _ary << @result if _tmp
3241
+ break unless _tmp
3242
+ end
3243
+ _tmp = true
3244
+ @result = _ary
3245
+ blocks = @result
3246
+ unless _tmp
3247
+ self.pos = _save
3248
+ break
3249
+ end
3250
+ @result = begin; create_item(:page, nil, [headers] + blocks.select{ |x| !x.nil?}) ; end
3251
+ _tmp = true
3252
+ unless _tmp
3253
+ self.pos = _save
3254
+ end
3255
+ break
3256
+ end # end sequence
3257
+
3258
+ set_failed_rule :_page unless _tmp
3259
+ return _tmp
3260
+ end
3261
+
3262
+ # newpaged_page = newpage:newpage page:page { page[:children] = page[:children].unshift newpage; page }
3263
+ def _newpaged_page
3264
+
3265
+ _save = self.pos
3266
+ while true # sequence
3267
+ _tmp = apply(:_newpage)
3268
+ newpage = @result
3269
+ unless _tmp
3270
+ self.pos = _save
3271
+ break
3272
+ end
3273
+ _tmp = apply(:_page)
3274
+ page = @result
3275
+ unless _tmp
3276
+ self.pos = _save
3277
+ break
3278
+ end
3279
+ @result = begin; page[:children] = page[:children].unshift newpage; page ; end
3280
+ _tmp = true
3281
+ unless _tmp
3282
+ self.pos = _save
3283
+ end
3284
+ break
3285
+ end # end sequence
3286
+
3287
+ set_failed_rule :_newpaged_page unless _tmp
3288
+ return _tmp
3289
+ end
3290
+
3291
+ # root = page:page newpaged_page*:pages - eof_comment? eof { [ page ] + pages }
3292
+ def _root
3293
+
3294
+ _save = self.pos
3295
+ while true # sequence
3296
+ _tmp = apply(:_page)
3297
+ page = @result
3298
+ unless _tmp
3299
+ self.pos = _save
3300
+ break
3301
+ end
3302
+ _ary = []
3303
+ while true
3304
+ _tmp = apply(:_newpaged_page)
3305
+ _ary << @result if _tmp
3306
+ break unless _tmp
3307
+ end
3308
+ _tmp = true
3309
+ @result = _ary
3310
+ pages = @result
3311
+ unless _tmp
3312
+ self.pos = _save
3313
+ break
3314
+ end
3315
+ _tmp = apply(:__hyphen_)
3316
+ unless _tmp
3317
+ self.pos = _save
3318
+ break
3319
+ end
3320
+ _save2 = self.pos
3321
+ _tmp = apply(:_eof_comment)
3322
+ unless _tmp
3323
+ _tmp = true
3324
+ self.pos = _save2
3325
+ end
3326
+ unless _tmp
3327
+ self.pos = _save
3328
+ break
3329
+ end
3330
+ _tmp = apply(:_eof)
3331
+ unless _tmp
3332
+ self.pos = _save
3333
+ break
3334
+ end
3335
+ @result = begin; [ page ] + pages ; end
3336
+ _tmp = true
3337
+ unless _tmp
3338
+ self.pos = _save
3339
+ end
3340
+ break
3341
+ end # end sequence
3342
+
3343
+ set_failed_rule :_root unless _tmp
3344
+ return _tmp
3345
+ end
3346
+
3347
+ Rules = {}
3348
+ Rules[:_eof] = rule_info("eof", "!.")
3349
+ Rules[:_space] = rule_info("space", "(\" \" | \"\\\\t\")")
3350
+ Rules[:_eof_comment] = rule_info("eof_comment", "lh space* \"\#\" (!eof .)*")
3351
+ Rules[:_comment] = rule_info("comment", "lh space* \"\#\" (!nl .)* nl empty_line*")
3352
+ Rules[:__hyphen_] = rule_info("-", "(space | comment)*")
3353
+ Rules[:_empty_line] = rule_info("empty_line", "lh - nl")
3354
+ Rules[:_nl] = rule_info("nl", "/\\r?\\n/")
3355
+ Rules[:_lh] = rule_info("lh", "/^/")
3356
+ Rules[:_le] = rule_info("le", "(nl | eof)")
3357
+ Rules[:_word] = rule_info("word", "< /[\\w0-9]/ (\"-\" | /[\\w0-9]/)* > { text }")
3358
+ Rules[:_num] = rule_info("num", "< [0-9]+ > { text.to_i }")
3359
+ Rules[:_classname] = rule_info("classname", "\".\" word:classname { classname }")
3360
+ Rules[:_classnames] = rule_info("classnames", "classname*:classnames { classnames }")
3361
+ Rules[:_idname] = rule_info("idname", "\"\#\" word:idname { idname }")
3362
+ Rules[:_idnames] = rule_info("idnames", "idname*:idnames { idnames }")
3363
+ Rules[:_commandname] = rule_info("commandname", "word:name idnames?:idnames classnames?:classes { {:name => name, :ids => idnames, :classes => classes} }")
3364
+ Rules[:_parameter] = rule_info("parameter", "< (/[^,)]/* | \"\\\"\" /[^\"]/* \"\\\"\" | \"'\" /[^']/* \"'\") > { text }")
3365
+ Rules[:_parameters] = rule_info("parameters", "< parameter (\",\" parameter)* > { text }")
3366
+ Rules[:_command] = rule_info("command", "commandname:cn (\"(\" - parameters:arg - \")\")? { arg ||= ''; cn.merge({ :args => arg.split(',') }) }")
3367
+ Rules[:_implicit_paragraph] = rule_info("implicit_paragraph", "< !paragraph_delimiter - documentline:p - > { create_item(:paragraph, nil, p, raw: text) }")
3368
+ Rules[:_paragraph] = rule_info("paragraph", "(explicit_paragraph | implicit_paragraph)")
3369
+ Rules[:_paragraph_group] = rule_info("paragraph_group", "< paragraph+:p empty_line* > { create_item(:paragraph_group, nil, p, raw: text) }")
3370
+ Rules[:_blockhead] = rule_info("blockhead", "lh - command:command - \"{\" - nl empty_line* { command }")
3371
+ Rules[:_blockend] = rule_info("blockend", "lh - \"}\" - le empty_line*")
3372
+ Rules[:_blockbody] = rule_info("blockbody", "(!blockend block)+:body { body }")
3373
+ Rules[:_explicit_block] = rule_info("explicit_block", "< blockhead:head - blockbody:body - blockend > { create_item(:block, head, body, raw: text) }")
3374
+ Rules[:_preformatted_command] = rule_info("preformatted_command", "command:command &{ ['pre', 'precode'].include? command[:name] }")
3375
+ Rules[:_preformatted_command_head] = rule_info("preformatted_command_head", "lh - preformatted_command:command - \"<<\" &/[\\w0-9]/ { command }")
3376
+ Rules[:_preformat_end] = rule_info("preformat_end", "lh word:delimiter &{ delimiter == start }")
3377
+ Rules[:_preformatted_block] = rule_info("preformatted_block", "< lh - preformatted_command_head:command !nl word:delimiter nl (!preformat_end(delimiter) lh charstring nl)+:content preformat_end(delimiter) > { create_item(:preformatted, command, content, raw: text) }")
3378
+ Rules[:_inline] = rule_info("inline", "(img_inline | common_inline)")
3379
+ Rules[:_common_inline] = rule_info("common_inline", "< \"[\" command:c \"{\" documentcontent_except('}'):content \"}\" \"]\" > { create_item(:inline, c, content, raw: text) }")
3380
+ Rules[:_img_command] = rule_info("img_command", "command:c &{ c[:name] == 'img' && c[:args].size == 2}")
3381
+ Rules[:_img_inline] = rule_info("img_inline", "< \"[\" img_command:c \"]\" > { create_item(:inline, c, nil, raw: text) }")
3382
+ Rules[:_commandname_for_special_line_command] = rule_info("commandname_for_special_line_command", "(newpage_command | explicit_paragraph_command)")
3383
+ Rules[:_newpage_command] = rule_info("newpage_command", "command:command &{ command[:name] == 'newpage' }")
3384
+ Rules[:_newpage] = rule_info("newpage", "< lh - newpage_command:c \":\" documentcontent?:content - nl > { create_item(:newpage, c, content, raw:text) }")
3385
+ Rules[:_explicit_paragraph_command] = rule_info("explicit_paragraph_command", "command:c &{ c[:name] == 'p' }")
3386
+ Rules[:_explicit_paragraph] = rule_info("explicit_paragraph", "< lh - explicit_paragraph_command:c \":\" documentcontent?:content le empty_line* > { create_item(:paragraph, c, content, raw:text) }")
3387
+ Rules[:_unordered_list] = rule_info("unordered_list", "< unordered_item+:items > { create_item(:ul, nil, items, raw: text) }")
3388
+ Rules[:_unordered_item] = rule_info("unordered_item", "< lh \"*:\" documentcontent:content le > { create_item(:li, nil, content, raw: text) }")
3389
+ Rules[:_ordered_list] = rule_info("ordered_list", "< ordered_item+:items > { create_item(:ol, nil, items, raw: text) }")
3390
+ Rules[:_ordered_item] = rule_info("ordered_item", "< lh num \":\" documentcontent:content le > { create_item(:li, nil, content, raw: text) }")
3391
+ Rules[:_definition_list] = rule_info("definition_list", "< definition_item+:items > { create_item(:dl, nil, items, raw: text) }")
3392
+ Rules[:_definition_item] = rule_info("definition_item", "< lh \";:\" - documentcontent_except(':'):term \":\" - documentcontent:definition le > { create_item(:dtdd, {:args => [term, definition]}, nil, raw: text) }")
3393
+ Rules[:_items_list] = rule_info("items_list", "(unordered_list | ordered_list | definition_list)")
3394
+ Rules[:_line_command] = rule_info("line_command", "< lh - !commandname_for_special_line_command command:c \":\" documentcontent?:content - le empty_line* > { create_item(:line_command, c, content, raw: text) }")
3395
+ Rules[:_line_block] = rule_info("line_block", "(items_list | line_command)")
3396
+ Rules[:_block] = rule_info("block", "(preformatted_block | headed_section | line_block | explicit_block | paragraph_group):block empty_line* {block}")
3397
+ Rules[:_block_delimiter] = rule_info("block_delimiter", "(blockhead | blockend)")
3398
+ Rules[:_paragraph_delimiter] = rule_info("paragraph_delimiter", "(block_delimiter | preformatted_command_head | line_block | newpage | headed_start)")
3399
+ Rules[:_h_start_mark] = rule_info("h_start_mark", "< \"=\"+ \":\" > &{ text.length - 1 == n }")
3400
+ Rules[:_h_markup_terminator] = rule_info("h_markup_terminator", "lh - < \"=\"+ \":\" > &{ text.length - 1 <= n }")
3401
+ Rules[:_h_start] = rule_info("h_start", "lh - h_start_mark(n) charstring:s le { { level: n, heading: s } }")
3402
+ Rules[:_h_section] = rule_info("h_section", "< h_start(n):h (!h_markup_terminator(n) !eof block)+:content > { create_item(:h_section, h, content, raw: text) }")
3403
+ Rules[:_headed_start] = rule_info("headed_start", "(h_start(1) | h_start(2) | h_start(3) | h_start(4) | h_start(5) | h_start(6))")
3404
+ Rules[:_headed_section] = rule_info("headed_section", "(h_section(1) | h_section(2) | h_section(3) | h_section(4) | h_section(5) | h_section(6))")
3405
+ Rules[:_stylesheets] = rule_info("stylesheets", "< lh - \"stylesheets:\" !le charstring:s nl > { create_item(:stylesheets, {:stylesheets => s.split(',').map(&:strip)}, nil, raw:text) }")
3406
+ Rules[:_title] = rule_info("title", "< lh - \"title:\" !le charstring:t nl > { create_item(:title, {:title => t }, nil, raw:text) }")
3407
+ Rules[:_lang] = rule_info("lang", "< lh - \"lang:\" !le charstring:l nl > { create_item(:lang, {:lang => l }, nil, raw:text) }")
3408
+ Rules[:_paragraph_style] = rule_info("paragraph_style", "< lh - \"paragraph-style:\" !le charstring:l nl > { create_item(:paragraph_style, {:paragraph_style => l }, nil, raw:text) }")
3409
+ Rules[:_header] = rule_info("header", "(stylesheets | title | lang | paragraph_style) empty_line*")
3410
+ Rules[:_char] = rule_info("char", "< /[[:print:]]/ > { text }")
3411
+ Rules[:_charstring] = rule_info("charstring", "< char* > { text }")
3412
+ Rules[:_char_except] = rule_info("char_except", "char:c &{ c != e }")
3413
+ Rules[:_charstring_except] = rule_info("charstring_except", "< char_except(e)* > { text }")
3414
+ Rules[:_documentcontent_except] = rule_info("documentcontent_except", "(inline | !inline char_except(e))+:content {parse_text(content)}")
3415
+ Rules[:_documentcontent] = rule_info("documentcontent", "(inline | !inline char)+:content {parse_text(content)}")
3416
+ Rules[:_documentline] = rule_info("documentline", "lh documentcontent:content le { content }")
3417
+ Rules[:_headers] = rule_info("headers", "header*:headers { create_item(:headers, nil, headers) }")
3418
+ Rules[:_page] = rule_info("page", "headers:headers - (!newpage block)*:blocks { create_item(:page, nil, [headers] + blocks.select{ |x| !x.nil?}) }")
3419
+ Rules[:_newpaged_page] = rule_info("newpaged_page", "newpage:newpage page:page { page[:children] = page[:children].unshift newpage; page }")
3420
+ Rules[:_root] = rule_info("root", "page:page newpaged_page*:pages - eof_comment? eof { [ page ] + pages }")
3421
+ # :startdoc:
3422
+ end