arti_mark 0.0.1.beta4 → 0.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2533 @@
1
+ require 'kpeg/compiled_parser'
2
+
3
+ class ArtiMark::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
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
+ end
144
+ break
145
+ end # end sequence
146
+
147
+ set_failed_rule :_comment unless _tmp
148
+ return _tmp
149
+ end
150
+
151
+ # - = (space | comment)*
152
+ def __hyphen_
153
+ while true
154
+
155
+ _save1 = self.pos
156
+ while true # choice
157
+ _tmp = apply(:_space)
158
+ break if _tmp
159
+ self.pos = _save1
160
+ _tmp = apply(:_comment)
161
+ break if _tmp
162
+ self.pos = _save1
163
+ break
164
+ end # end choice
165
+
166
+ break unless _tmp
167
+ end
168
+ _tmp = true
169
+ set_failed_rule :__hyphen_ unless _tmp
170
+ return _tmp
171
+ end
172
+
173
+ # empty_line = lh - nl
174
+ def _empty_line
175
+
176
+ _save = self.pos
177
+ while true # sequence
178
+ _tmp = apply(:_lh)
179
+ unless _tmp
180
+ self.pos = _save
181
+ break
182
+ end
183
+ _tmp = apply(:__hyphen_)
184
+ unless _tmp
185
+ self.pos = _save
186
+ break
187
+ end
188
+ _tmp = apply(:_nl)
189
+ unless _tmp
190
+ self.pos = _save
191
+ end
192
+ break
193
+ end # end sequence
194
+
195
+ set_failed_rule :_empty_line unless _tmp
196
+ return _tmp
197
+ end
198
+
199
+ # nl = /\r?\n/
200
+ def _nl
201
+ _tmp = scan(/\A(?-mix:\r?\n)/)
202
+ set_failed_rule :_nl unless _tmp
203
+ return _tmp
204
+ end
205
+
206
+ # lh = /^/
207
+ def _lh
208
+ _tmp = scan(/\A(?-mix:^)/)
209
+ set_failed_rule :_lh unless _tmp
210
+ return _tmp
211
+ end
212
+
213
+ # le = (nl | /$/)
214
+ def _le
215
+
216
+ _save = self.pos
217
+ while true # choice
218
+ _tmp = apply(:_nl)
219
+ break if _tmp
220
+ self.pos = _save
221
+ _tmp = scan(/\A(?-mix:$)/)
222
+ break if _tmp
223
+ self.pos = _save
224
+ break
225
+ end # end choice
226
+
227
+ set_failed_rule :_le unless _tmp
228
+ return _tmp
229
+ end
230
+
231
+ # word = < /[\w0-9]/ ("-" | /[\w0-9]/)* > { text }
232
+ def _word
233
+
234
+ _save = self.pos
235
+ while true # sequence
236
+ _text_start = self.pos
237
+
238
+ _save1 = self.pos
239
+ while true # sequence
240
+ _tmp = scan(/\A(?-mix:[\w0-9])/)
241
+ unless _tmp
242
+ self.pos = _save1
243
+ break
244
+ end
245
+ while true
246
+
247
+ _save3 = self.pos
248
+ while true # choice
249
+ _tmp = match_string("-")
250
+ break if _tmp
251
+ self.pos = _save3
252
+ _tmp = scan(/\A(?-mix:[\w0-9])/)
253
+ break if _tmp
254
+ self.pos = _save3
255
+ break
256
+ end # end choice
257
+
258
+ break unless _tmp
259
+ end
260
+ _tmp = true
261
+ unless _tmp
262
+ self.pos = _save1
263
+ end
264
+ break
265
+ end # end sequence
266
+
267
+ if _tmp
268
+ text = get_text(_text_start)
269
+ end
270
+ unless _tmp
271
+ self.pos = _save
272
+ break
273
+ end
274
+ @result = begin; text ; end
275
+ _tmp = true
276
+ unless _tmp
277
+ self.pos = _save
278
+ end
279
+ break
280
+ end # end sequence
281
+
282
+ set_failed_rule :_word unless _tmp
283
+ return _tmp
284
+ end
285
+
286
+ # num = < [0-9]+ > { text.to_i }
287
+ def _num
288
+
289
+ _save = self.pos
290
+ while true # sequence
291
+ _text_start = self.pos
292
+ _save1 = self.pos
293
+ _save2 = self.pos
294
+ _tmp = get_byte
295
+ if _tmp
296
+ unless _tmp >= 48 and _tmp <= 57
297
+ self.pos = _save2
298
+ _tmp = nil
299
+ end
300
+ end
301
+ if _tmp
302
+ while true
303
+ _save3 = self.pos
304
+ _tmp = get_byte
305
+ if _tmp
306
+ unless _tmp >= 48 and _tmp <= 57
307
+ self.pos = _save3
308
+ _tmp = nil
309
+ end
310
+ end
311
+ break unless _tmp
312
+ end
313
+ _tmp = true
314
+ else
315
+ self.pos = _save1
316
+ end
317
+ if _tmp
318
+ text = get_text(_text_start)
319
+ end
320
+ unless _tmp
321
+ self.pos = _save
322
+ break
323
+ end
324
+ @result = begin; text.to_i ; end
325
+ _tmp = true
326
+ unless _tmp
327
+ self.pos = _save
328
+ end
329
+ break
330
+ end # end sequence
331
+
332
+ set_failed_rule :_num unless _tmp
333
+ return _tmp
334
+ end
335
+
336
+ # classname = "." word:classname { classname }
337
+ def _classname
338
+
339
+ _save = self.pos
340
+ while true # sequence
341
+ _tmp = match_string(".")
342
+ unless _tmp
343
+ self.pos = _save
344
+ break
345
+ end
346
+ _tmp = apply(:_word)
347
+ classname = @result
348
+ unless _tmp
349
+ self.pos = _save
350
+ break
351
+ end
352
+ @result = begin; classname ; end
353
+ _tmp = true
354
+ unless _tmp
355
+ self.pos = _save
356
+ end
357
+ break
358
+ end # end sequence
359
+
360
+ set_failed_rule :_classname unless _tmp
361
+ return _tmp
362
+ end
363
+
364
+ # classnames = classname*:classnames { classnames }
365
+ def _classnames
366
+
367
+ _save = self.pos
368
+ while true # sequence
369
+ _ary = []
370
+ while true
371
+ _tmp = apply(:_classname)
372
+ _ary << @result if _tmp
373
+ break unless _tmp
374
+ end
375
+ _tmp = true
376
+ @result = _ary
377
+ classnames = @result
378
+ unless _tmp
379
+ self.pos = _save
380
+ break
381
+ end
382
+ @result = begin; classnames ; end
383
+ _tmp = true
384
+ unless _tmp
385
+ self.pos = _save
386
+ end
387
+ break
388
+ end # end sequence
389
+
390
+ set_failed_rule :_classnames unless _tmp
391
+ return _tmp
392
+ end
393
+
394
+ # idname = "#" word:idname { idname }
395
+ def _idname
396
+
397
+ _save = self.pos
398
+ while true # sequence
399
+ _tmp = match_string("#")
400
+ unless _tmp
401
+ self.pos = _save
402
+ break
403
+ end
404
+ _tmp = apply(:_word)
405
+ idname = @result
406
+ unless _tmp
407
+ self.pos = _save
408
+ break
409
+ end
410
+ @result = begin; idname ; end
411
+ _tmp = true
412
+ unless _tmp
413
+ self.pos = _save
414
+ end
415
+ break
416
+ end # end sequence
417
+
418
+ set_failed_rule :_idname unless _tmp
419
+ return _tmp
420
+ end
421
+
422
+ # idnames = idname*:idnames { idnames }
423
+ def _idnames
424
+
425
+ _save = self.pos
426
+ while true # sequence
427
+ _ary = []
428
+ while true
429
+ _tmp = apply(:_idname)
430
+ _ary << @result if _tmp
431
+ break unless _tmp
432
+ end
433
+ _tmp = true
434
+ @result = _ary
435
+ idnames = @result
436
+ unless _tmp
437
+ self.pos = _save
438
+ break
439
+ end
440
+ @result = begin; idnames ; end
441
+ _tmp = true
442
+ unless _tmp
443
+ self.pos = _save
444
+ end
445
+ break
446
+ end # end sequence
447
+
448
+ set_failed_rule :_idnames unless _tmp
449
+ return _tmp
450
+ end
451
+
452
+ # commandname = word:name idnames?:idnames classnames?:classes { {:name => name, :ids => idnames, :classes => classes} }
453
+ def _commandname
454
+
455
+ _save = self.pos
456
+ while true # sequence
457
+ _tmp = apply(:_word)
458
+ name = @result
459
+ unless _tmp
460
+ self.pos = _save
461
+ break
462
+ end
463
+ _save1 = self.pos
464
+ _tmp = apply(:_idnames)
465
+ @result = nil unless _tmp
466
+ unless _tmp
467
+ _tmp = true
468
+ self.pos = _save1
469
+ end
470
+ idnames = @result
471
+ unless _tmp
472
+ self.pos = _save
473
+ break
474
+ end
475
+ _save2 = self.pos
476
+ _tmp = apply(:_classnames)
477
+ @result = nil unless _tmp
478
+ unless _tmp
479
+ _tmp = true
480
+ self.pos = _save2
481
+ end
482
+ classes = @result
483
+ unless _tmp
484
+ self.pos = _save
485
+ break
486
+ end
487
+ @result = begin; {:name => name, :ids => idnames, :classes => classes} ; end
488
+ _tmp = true
489
+ unless _tmp
490
+ self.pos = _save
491
+ end
492
+ break
493
+ end # end sequence
494
+
495
+ set_failed_rule :_commandname unless _tmp
496
+ return _tmp
497
+ end
498
+
499
+ # parameter = < (/[^,)]/* | "\"" /[^"]/* "\"" | "'" /[^']/* "'") > { text }
500
+ def _parameter
501
+
502
+ _save = self.pos
503
+ while true # sequence
504
+ _text_start = self.pos
505
+
506
+ _save1 = self.pos
507
+ while true # choice
508
+ while true
509
+ _tmp = scan(/\A(?-mix:[^,)])/)
510
+ break unless _tmp
511
+ end
512
+ _tmp = true
513
+ break if _tmp
514
+ self.pos = _save1
515
+
516
+ _save3 = self.pos
517
+ while true # sequence
518
+ _tmp = match_string("\"")
519
+ unless _tmp
520
+ self.pos = _save3
521
+ break
522
+ end
523
+ while true
524
+ _tmp = scan(/\A(?-mix:[^"])/)
525
+ break unless _tmp
526
+ end
527
+ _tmp = true
528
+ unless _tmp
529
+ self.pos = _save3
530
+ break
531
+ end
532
+ _tmp = match_string("\"")
533
+ unless _tmp
534
+ self.pos = _save3
535
+ end
536
+ break
537
+ end # end sequence
538
+
539
+ break if _tmp
540
+ self.pos = _save1
541
+
542
+ _save5 = self.pos
543
+ while true # sequence
544
+ _tmp = match_string("'")
545
+ unless _tmp
546
+ self.pos = _save5
547
+ break
548
+ end
549
+ while true
550
+ _tmp = scan(/\A(?-mix:[^'])/)
551
+ break unless _tmp
552
+ end
553
+ _tmp = true
554
+ unless _tmp
555
+ self.pos = _save5
556
+ break
557
+ end
558
+ _tmp = match_string("'")
559
+ unless _tmp
560
+ self.pos = _save5
561
+ end
562
+ break
563
+ end # end sequence
564
+
565
+ break if _tmp
566
+ self.pos = _save1
567
+ break
568
+ end # end choice
569
+
570
+ if _tmp
571
+ text = get_text(_text_start)
572
+ end
573
+ unless _tmp
574
+ self.pos = _save
575
+ break
576
+ end
577
+ @result = begin; text ; end
578
+ _tmp = true
579
+ unless _tmp
580
+ self.pos = _save
581
+ end
582
+ break
583
+ end # end sequence
584
+
585
+ set_failed_rule :_parameter unless _tmp
586
+ return _tmp
587
+ end
588
+
589
+ # parameters = < parameter ("," parameter)* > { text }
590
+ def _parameters
591
+
592
+ _save = self.pos
593
+ while true # sequence
594
+ _text_start = self.pos
595
+
596
+ _save1 = self.pos
597
+ while true # sequence
598
+ _tmp = apply(:_parameter)
599
+ unless _tmp
600
+ self.pos = _save1
601
+ break
602
+ end
603
+ while true
604
+
605
+ _save3 = self.pos
606
+ while true # sequence
607
+ _tmp = match_string(",")
608
+ unless _tmp
609
+ self.pos = _save3
610
+ break
611
+ end
612
+ _tmp = apply(:_parameter)
613
+ unless _tmp
614
+ self.pos = _save3
615
+ end
616
+ break
617
+ end # end sequence
618
+
619
+ break unless _tmp
620
+ end
621
+ _tmp = true
622
+ unless _tmp
623
+ self.pos = _save1
624
+ end
625
+ break
626
+ end # end sequence
627
+
628
+ if _tmp
629
+ text = get_text(_text_start)
630
+ end
631
+ unless _tmp
632
+ self.pos = _save
633
+ break
634
+ end
635
+ @result = begin; text ; end
636
+ _tmp = true
637
+ unless _tmp
638
+ self.pos = _save
639
+ end
640
+ break
641
+ end # end sequence
642
+
643
+ set_failed_rule :_parameters unless _tmp
644
+ return _tmp
645
+ end
646
+
647
+ # command = commandname:commandname ("(" - parameters:arg - ")")? { arg ||= ''; commandname.merge({ :args => arg.split(',') }) }
648
+ def _command
649
+
650
+ _save = self.pos
651
+ while true # sequence
652
+ _tmp = apply(:_commandname)
653
+ commandname = @result
654
+ unless _tmp
655
+ self.pos = _save
656
+ break
657
+ end
658
+ _save1 = self.pos
659
+
660
+ _save2 = self.pos
661
+ while true # sequence
662
+ _tmp = match_string("(")
663
+ unless _tmp
664
+ self.pos = _save2
665
+ break
666
+ end
667
+ _tmp = apply(:__hyphen_)
668
+ unless _tmp
669
+ self.pos = _save2
670
+ break
671
+ end
672
+ _tmp = apply(:_parameters)
673
+ arg = @result
674
+ unless _tmp
675
+ self.pos = _save2
676
+ break
677
+ end
678
+ _tmp = apply(:__hyphen_)
679
+ unless _tmp
680
+ self.pos = _save2
681
+ break
682
+ end
683
+ _tmp = match_string(")")
684
+ unless _tmp
685
+ self.pos = _save2
686
+ end
687
+ break
688
+ end # end sequence
689
+
690
+ unless _tmp
691
+ _tmp = true
692
+ self.pos = _save1
693
+ end
694
+ unless _tmp
695
+ self.pos = _save
696
+ break
697
+ end
698
+ @result = begin; arg ||= ''; commandname.merge({ :args => arg.split(',') }) ; end
699
+ _tmp = true
700
+ unless _tmp
701
+ self.pos = _save
702
+ end
703
+ break
704
+ end # end sequence
705
+
706
+ set_failed_rule :_command unless _tmp
707
+ return _tmp
708
+ end
709
+
710
+ # implicit_paragraph = < (!paragraph_delimiter - documentline -):paragraph > { create_item(:paragraph, nil, paragraph, raw: text) }
711
+ def _implicit_paragraph
712
+
713
+ _save = self.pos
714
+ while true # sequence
715
+ _text_start = self.pos
716
+
717
+ _save1 = self.pos
718
+ while true # sequence
719
+ _save2 = self.pos
720
+ _tmp = apply(:_paragraph_delimiter)
721
+ _tmp = _tmp ? nil : true
722
+ self.pos = _save2
723
+ unless _tmp
724
+ self.pos = _save1
725
+ break
726
+ end
727
+ _tmp = apply(:__hyphen_)
728
+ unless _tmp
729
+ self.pos = _save1
730
+ break
731
+ end
732
+ _tmp = apply(:_documentline)
733
+ unless _tmp
734
+ self.pos = _save1
735
+ break
736
+ end
737
+ _tmp = apply(:__hyphen_)
738
+ unless _tmp
739
+ self.pos = _save1
740
+ end
741
+ break
742
+ end # end sequence
743
+
744
+ paragraph = @result
745
+ if _tmp
746
+ text = get_text(_text_start)
747
+ end
748
+ unless _tmp
749
+ self.pos = _save
750
+ break
751
+ end
752
+ @result = begin; create_item(:paragraph, nil, paragraph, raw: text) ; end
753
+ _tmp = true
754
+ unless _tmp
755
+ self.pos = _save
756
+ end
757
+ break
758
+ end # end sequence
759
+
760
+ set_failed_rule :_implicit_paragraph unless _tmp
761
+ return _tmp
762
+ end
763
+
764
+ # paragraph = (explicit_paragraph | implicit_paragraph)
765
+ def _paragraph
766
+
767
+ _save = self.pos
768
+ while true # choice
769
+ _tmp = apply(:_explicit_paragraph)
770
+ break if _tmp
771
+ self.pos = _save
772
+ _tmp = apply(:_implicit_paragraph)
773
+ break if _tmp
774
+ self.pos = _save
775
+ break
776
+ end # end choice
777
+
778
+ set_failed_rule :_paragraph unless _tmp
779
+ return _tmp
780
+ end
781
+
782
+ # paragraph_group = < (paragraph nl | paragraph)+:paragraphs empty_line* > { create_item(:paragraph_group, nil, paragraphs, raw: text) }
783
+ def _paragraph_group
784
+
785
+ _save = self.pos
786
+ while true # sequence
787
+ _text_start = self.pos
788
+
789
+ _save1 = self.pos
790
+ while true # sequence
791
+ _save2 = self.pos
792
+ _ary = []
793
+
794
+ _save3 = self.pos
795
+ while true # choice
796
+
797
+ _save4 = self.pos
798
+ while true # sequence
799
+ _tmp = apply(:_paragraph)
800
+ unless _tmp
801
+ self.pos = _save4
802
+ break
803
+ end
804
+ _tmp = apply(:_nl)
805
+ unless _tmp
806
+ self.pos = _save4
807
+ end
808
+ break
809
+ end # end sequence
810
+
811
+ break if _tmp
812
+ self.pos = _save3
813
+ _tmp = apply(:_paragraph)
814
+ break if _tmp
815
+ self.pos = _save3
816
+ break
817
+ end # end choice
818
+
819
+ if _tmp
820
+ _ary << @result
821
+ while true
822
+
823
+ _save5 = self.pos
824
+ while true # choice
825
+
826
+ _save6 = self.pos
827
+ while true # sequence
828
+ _tmp = apply(:_paragraph)
829
+ unless _tmp
830
+ self.pos = _save6
831
+ break
832
+ end
833
+ _tmp = apply(:_nl)
834
+ unless _tmp
835
+ self.pos = _save6
836
+ end
837
+ break
838
+ end # end sequence
839
+
840
+ break if _tmp
841
+ self.pos = _save5
842
+ _tmp = apply(:_paragraph)
843
+ break if _tmp
844
+ self.pos = _save5
845
+ break
846
+ end # end choice
847
+
848
+ _ary << @result if _tmp
849
+ break unless _tmp
850
+ end
851
+ _tmp = true
852
+ @result = _ary
853
+ else
854
+ self.pos = _save2
855
+ end
856
+ paragraphs = @result
857
+ unless _tmp
858
+ self.pos = _save1
859
+ break
860
+ end
861
+ while true
862
+ _tmp = apply(:_empty_line)
863
+ break unless _tmp
864
+ end
865
+ _tmp = true
866
+ unless _tmp
867
+ self.pos = _save1
868
+ end
869
+ break
870
+ end # end sequence
871
+
872
+ if _tmp
873
+ text = get_text(_text_start)
874
+ end
875
+ unless _tmp
876
+ self.pos = _save
877
+ break
878
+ end
879
+ @result = begin; create_item(:paragraph_group, nil, paragraphs, raw: text) ; end
880
+ _tmp = true
881
+ unless _tmp
882
+ self.pos = _save
883
+ end
884
+ break
885
+ end # end sequence
886
+
887
+ set_failed_rule :_paragraph_group unless _tmp
888
+ return _tmp
889
+ end
890
+
891
+ # blockhead = lh - command:command - "{" - le { command }
892
+ def _blockhead
893
+
894
+ _save = self.pos
895
+ while true # sequence
896
+ _tmp = apply(:_lh)
897
+ unless _tmp
898
+ self.pos = _save
899
+ break
900
+ end
901
+ _tmp = apply(:__hyphen_)
902
+ unless _tmp
903
+ self.pos = _save
904
+ break
905
+ end
906
+ _tmp = apply(:_command)
907
+ command = @result
908
+ unless _tmp
909
+ self.pos = _save
910
+ break
911
+ end
912
+ _tmp = apply(:__hyphen_)
913
+ unless _tmp
914
+ self.pos = _save
915
+ break
916
+ end
917
+ _tmp = match_string("{")
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 = apply(:_le)
928
+ unless _tmp
929
+ self.pos = _save
930
+ break
931
+ end
932
+ @result = begin; command ; end
933
+ _tmp = true
934
+ unless _tmp
935
+ self.pos = _save
936
+ end
937
+ break
938
+ end # end sequence
939
+
940
+ set_failed_rule :_blockhead unless _tmp
941
+ return _tmp
942
+ end
943
+
944
+ # blockend = lh - "}" - le
945
+ def _blockend
946
+
947
+ _save = self.pos
948
+ while true # sequence
949
+ _tmp = apply(:_lh)
950
+ unless _tmp
951
+ self.pos = _save
952
+ break
953
+ end
954
+ _tmp = apply(:__hyphen_)
955
+ unless _tmp
956
+ self.pos = _save
957
+ break
958
+ end
959
+ _tmp = match_string("}")
960
+ unless _tmp
961
+ self.pos = _save
962
+ break
963
+ end
964
+ _tmp = apply(:__hyphen_)
965
+ unless _tmp
966
+ self.pos = _save
967
+ break
968
+ end
969
+ _tmp = apply(:_le)
970
+ unless _tmp
971
+ self.pos = _save
972
+ end
973
+ break
974
+ end # end sequence
975
+
976
+ set_failed_rule :_blockend unless _tmp
977
+ return _tmp
978
+ end
979
+
980
+ # blockbody = (!blockend block)+:body { body }
981
+ def _blockbody
982
+
983
+ _save = self.pos
984
+ while true # sequence
985
+ _save1 = self.pos
986
+ _ary = []
987
+
988
+ _save2 = self.pos
989
+ while true # sequence
990
+ _save3 = self.pos
991
+ _tmp = apply(:_blockend)
992
+ _tmp = _tmp ? nil : true
993
+ self.pos = _save3
994
+ unless _tmp
995
+ self.pos = _save2
996
+ break
997
+ end
998
+ _tmp = apply(:_block)
999
+ unless _tmp
1000
+ self.pos = _save2
1001
+ end
1002
+ break
1003
+ end # end sequence
1004
+
1005
+ if _tmp
1006
+ _ary << @result
1007
+ while true
1008
+
1009
+ _save4 = self.pos
1010
+ while true # sequence
1011
+ _save5 = self.pos
1012
+ _tmp = apply(:_blockend)
1013
+ _tmp = _tmp ? nil : true
1014
+ self.pos = _save5
1015
+ unless _tmp
1016
+ self.pos = _save4
1017
+ break
1018
+ end
1019
+ _tmp = apply(:_block)
1020
+ unless _tmp
1021
+ self.pos = _save4
1022
+ end
1023
+ break
1024
+ end # end sequence
1025
+
1026
+ _ary << @result if _tmp
1027
+ break unless _tmp
1028
+ end
1029
+ _tmp = true
1030
+ @result = _ary
1031
+ else
1032
+ self.pos = _save1
1033
+ end
1034
+ body = @result
1035
+ unless _tmp
1036
+ self.pos = _save
1037
+ break
1038
+ end
1039
+ @result = begin; body ; end
1040
+ _tmp = true
1041
+ unless _tmp
1042
+ self.pos = _save
1043
+ end
1044
+ break
1045
+ end # end sequence
1046
+
1047
+ set_failed_rule :_blockbody unless _tmp
1048
+ return _tmp
1049
+ end
1050
+
1051
+ # explicit_block = < blockhead:head blockbody:body blockend > { create_item(:block, head, body, raw: text) }
1052
+ def _explicit_block
1053
+
1054
+ _save = self.pos
1055
+ while true # sequence
1056
+ _text_start = self.pos
1057
+
1058
+ _save1 = self.pos
1059
+ while true # sequence
1060
+ _tmp = apply(:_blockhead)
1061
+ head = @result
1062
+ unless _tmp
1063
+ self.pos = _save1
1064
+ break
1065
+ end
1066
+ _tmp = apply(:_blockbody)
1067
+ body = @result
1068
+ unless _tmp
1069
+ self.pos = _save1
1070
+ break
1071
+ end
1072
+ _tmp = apply(:_blockend)
1073
+ unless _tmp
1074
+ self.pos = _save1
1075
+ end
1076
+ break
1077
+ end # end sequence
1078
+
1079
+ if _tmp
1080
+ text = get_text(_text_start)
1081
+ end
1082
+ unless _tmp
1083
+ self.pos = _save
1084
+ break
1085
+ end
1086
+ @result = begin; create_item(:block, head, body, raw: text) ; end
1087
+ _tmp = true
1088
+ unless _tmp
1089
+ self.pos = _save
1090
+ end
1091
+ break
1092
+ end # end sequence
1093
+
1094
+ set_failed_rule :_explicit_block unless _tmp
1095
+ return _tmp
1096
+ end
1097
+
1098
+ # inline = (img_inline | common_inline)
1099
+ def _inline
1100
+
1101
+ _save = self.pos
1102
+ while true # choice
1103
+ _tmp = apply(:_img_inline)
1104
+ break if _tmp
1105
+ self.pos = _save
1106
+ _tmp = apply(:_common_inline)
1107
+ break if _tmp
1108
+ self.pos = _save
1109
+ break
1110
+ end # end choice
1111
+
1112
+ set_failed_rule :_inline unless _tmp
1113
+ return _tmp
1114
+ end
1115
+
1116
+ # common_inline = < "[" command:command "{" documentcontent_except('}'):content "}" "]" > { create_item(:inline, command, content, raw: text) }
1117
+ def _common_inline
1118
+
1119
+ _save = self.pos
1120
+ while true # sequence
1121
+ _text_start = self.pos
1122
+
1123
+ _save1 = self.pos
1124
+ while true # sequence
1125
+ _tmp = match_string("[")
1126
+ unless _tmp
1127
+ self.pos = _save1
1128
+ break
1129
+ end
1130
+ _tmp = apply(:_command)
1131
+ command = @result
1132
+ unless _tmp
1133
+ self.pos = _save1
1134
+ break
1135
+ end
1136
+ _tmp = match_string("{")
1137
+ unless _tmp
1138
+ self.pos = _save1
1139
+ break
1140
+ end
1141
+ _tmp = apply_with_args(:_documentcontent_except, '}')
1142
+ content = @result
1143
+ unless _tmp
1144
+ self.pos = _save1
1145
+ break
1146
+ end
1147
+ _tmp = match_string("}")
1148
+ unless _tmp
1149
+ self.pos = _save1
1150
+ break
1151
+ end
1152
+ _tmp = match_string("]")
1153
+ unless _tmp
1154
+ self.pos = _save1
1155
+ end
1156
+ break
1157
+ end # end sequence
1158
+
1159
+ if _tmp
1160
+ text = get_text(_text_start)
1161
+ end
1162
+ unless _tmp
1163
+ self.pos = _save
1164
+ break
1165
+ end
1166
+ @result = begin; create_item(:inline, command, content, raw: text) ; end
1167
+ _tmp = true
1168
+ unless _tmp
1169
+ self.pos = _save
1170
+ end
1171
+ break
1172
+ end # end sequence
1173
+
1174
+ set_failed_rule :_common_inline unless _tmp
1175
+ return _tmp
1176
+ end
1177
+
1178
+ # img_command = command:command &{ command[:name] == 'img' && command[:args].size == 2}
1179
+ def _img_command
1180
+
1181
+ _save = self.pos
1182
+ while true # sequence
1183
+ _tmp = apply(:_command)
1184
+ command = @result
1185
+ unless _tmp
1186
+ self.pos = _save
1187
+ break
1188
+ end
1189
+ _save1 = self.pos
1190
+ _tmp = begin; command[:name] == 'img' && command[:args].size == 2; end
1191
+ self.pos = _save1
1192
+ unless _tmp
1193
+ self.pos = _save
1194
+ end
1195
+ break
1196
+ end # end sequence
1197
+
1198
+ set_failed_rule :_img_command unless _tmp
1199
+ return _tmp
1200
+ end
1201
+
1202
+ # img_inline = < "[" img_command:command "]" > { create_item(:inline, command, nil, raw: text) }
1203
+ def _img_inline
1204
+
1205
+ _save = self.pos
1206
+ while true # sequence
1207
+ _text_start = self.pos
1208
+
1209
+ _save1 = self.pos
1210
+ while true # sequence
1211
+ _tmp = match_string("[")
1212
+ unless _tmp
1213
+ self.pos = _save1
1214
+ break
1215
+ end
1216
+ _tmp = apply(:_img_command)
1217
+ command = @result
1218
+ unless _tmp
1219
+ self.pos = _save1
1220
+ break
1221
+ end
1222
+ _tmp = match_string("]")
1223
+ unless _tmp
1224
+ self.pos = _save1
1225
+ end
1226
+ break
1227
+ end # end sequence
1228
+
1229
+ if _tmp
1230
+ text = get_text(_text_start)
1231
+ end
1232
+ unless _tmp
1233
+ self.pos = _save
1234
+ break
1235
+ end
1236
+ @result = begin; create_item(:inline, command, nil, raw: text) ; end
1237
+ _tmp = true
1238
+ unless _tmp
1239
+ self.pos = _save
1240
+ end
1241
+ break
1242
+ end # end sequence
1243
+
1244
+ set_failed_rule :_img_inline unless _tmp
1245
+ return _tmp
1246
+ end
1247
+
1248
+ # newpage = line_command:item &{ item[:name] == 'newpage' }
1249
+ def _newpage
1250
+
1251
+ _save = self.pos
1252
+ while true # sequence
1253
+ _tmp = apply(:_line_command)
1254
+ item = @result
1255
+ unless _tmp
1256
+ self.pos = _save
1257
+ break
1258
+ end
1259
+ _save1 = self.pos
1260
+ _tmp = begin; item[:name] == 'newpage' ; end
1261
+ self.pos = _save1
1262
+ unless _tmp
1263
+ self.pos = _save
1264
+ end
1265
+ break
1266
+ end # end sequence
1267
+
1268
+ set_failed_rule :_newpage unless _tmp
1269
+ return _tmp
1270
+ end
1271
+
1272
+ # explicit_paragraph_command = command:command &{ command[:name] == 'p' }
1273
+ def _explicit_paragraph_command
1274
+
1275
+ _save = self.pos
1276
+ while true # sequence
1277
+ _tmp = apply(:_command)
1278
+ command = @result
1279
+ unless _tmp
1280
+ self.pos = _save
1281
+ break
1282
+ end
1283
+ _save1 = self.pos
1284
+ _tmp = begin; command[:name] == 'p' ; end
1285
+ self.pos = _save1
1286
+ unless _tmp
1287
+ self.pos = _save
1288
+ end
1289
+ break
1290
+ end # end sequence
1291
+
1292
+ set_failed_rule :_explicit_paragraph_command unless _tmp
1293
+ return _tmp
1294
+ end
1295
+
1296
+ # explicit_paragraph = < lh - explicit_paragraph_command:command ":" documentcontent?:content le > { create_item(:paragraph, command, content, raw:text) }
1297
+ def _explicit_paragraph
1298
+
1299
+ _save = self.pos
1300
+ while true # sequence
1301
+ _text_start = self.pos
1302
+
1303
+ _save1 = self.pos
1304
+ while true # sequence
1305
+ _tmp = apply(:_lh)
1306
+ unless _tmp
1307
+ self.pos = _save1
1308
+ break
1309
+ end
1310
+ _tmp = apply(:__hyphen_)
1311
+ unless _tmp
1312
+ self.pos = _save1
1313
+ break
1314
+ end
1315
+ _tmp = apply(:_explicit_paragraph_command)
1316
+ command = @result
1317
+ unless _tmp
1318
+ self.pos = _save1
1319
+ break
1320
+ end
1321
+ _tmp = match_string(":")
1322
+ unless _tmp
1323
+ self.pos = _save1
1324
+ break
1325
+ end
1326
+ _save2 = self.pos
1327
+ _tmp = apply(:_documentcontent)
1328
+ @result = nil unless _tmp
1329
+ unless _tmp
1330
+ _tmp = true
1331
+ self.pos = _save2
1332
+ end
1333
+ content = @result
1334
+ unless _tmp
1335
+ self.pos = _save1
1336
+ break
1337
+ end
1338
+ _tmp = apply(:_le)
1339
+ unless _tmp
1340
+ self.pos = _save1
1341
+ end
1342
+ break
1343
+ end # end sequence
1344
+
1345
+ if _tmp
1346
+ text = get_text(_text_start)
1347
+ end
1348
+ unless _tmp
1349
+ self.pos = _save
1350
+ break
1351
+ end
1352
+ @result = begin; create_item(:paragraph, command, content, raw:text) ; end
1353
+ _tmp = true
1354
+ unless _tmp
1355
+ self.pos = _save
1356
+ end
1357
+ break
1358
+ end # end sequence
1359
+
1360
+ set_failed_rule :_explicit_paragraph unless _tmp
1361
+ return _tmp
1362
+ end
1363
+
1364
+ # unordered_list = < unordered_item+:items > { create_item(:ul, nil, items, raw: text) }
1365
+ def _unordered_list
1366
+
1367
+ _save = self.pos
1368
+ while true # sequence
1369
+ _text_start = self.pos
1370
+ _save1 = self.pos
1371
+ _ary = []
1372
+ _tmp = apply(:_unordered_item)
1373
+ if _tmp
1374
+ _ary << @result
1375
+ while true
1376
+ _tmp = apply(:_unordered_item)
1377
+ _ary << @result if _tmp
1378
+ break unless _tmp
1379
+ end
1380
+ _tmp = true
1381
+ @result = _ary
1382
+ else
1383
+ self.pos = _save1
1384
+ end
1385
+ items = @result
1386
+ if _tmp
1387
+ text = get_text(_text_start)
1388
+ end
1389
+ unless _tmp
1390
+ self.pos = _save
1391
+ break
1392
+ end
1393
+ @result = begin; create_item(:ul, nil, items, raw: text) ; end
1394
+ _tmp = true
1395
+ unless _tmp
1396
+ self.pos = _save
1397
+ end
1398
+ break
1399
+ end # end sequence
1400
+
1401
+ set_failed_rule :_unordered_list unless _tmp
1402
+ return _tmp
1403
+ end
1404
+
1405
+ # unordered_item = < lh "*:" documentcontent:content le > { create_item(:li, nil, content, raw: text) }
1406
+ def _unordered_item
1407
+
1408
+ _save = self.pos
1409
+ while true # sequence
1410
+ _text_start = self.pos
1411
+
1412
+ _save1 = self.pos
1413
+ while true # sequence
1414
+ _tmp = apply(:_lh)
1415
+ unless _tmp
1416
+ self.pos = _save1
1417
+ break
1418
+ end
1419
+ _tmp = match_string("*:")
1420
+ unless _tmp
1421
+ self.pos = _save1
1422
+ break
1423
+ end
1424
+ _tmp = apply(:_documentcontent)
1425
+ content = @result
1426
+ unless _tmp
1427
+ self.pos = _save1
1428
+ break
1429
+ end
1430
+ _tmp = apply(:_le)
1431
+ unless _tmp
1432
+ self.pos = _save1
1433
+ end
1434
+ break
1435
+ end # end sequence
1436
+
1437
+ if _tmp
1438
+ text = get_text(_text_start)
1439
+ end
1440
+ unless _tmp
1441
+ self.pos = _save
1442
+ break
1443
+ end
1444
+ @result = begin; create_item(:li, nil, content, raw: text) ; end
1445
+ _tmp = true
1446
+ unless _tmp
1447
+ self.pos = _save
1448
+ end
1449
+ break
1450
+ end # end sequence
1451
+
1452
+ set_failed_rule :_unordered_item unless _tmp
1453
+ return _tmp
1454
+ end
1455
+
1456
+ # ordered_list = < ordered_item+:items > { create_item(:ol, nil, items, raw: text) }
1457
+ def _ordered_list
1458
+
1459
+ _save = self.pos
1460
+ while true # sequence
1461
+ _text_start = self.pos
1462
+ _save1 = self.pos
1463
+ _ary = []
1464
+ _tmp = apply(:_ordered_item)
1465
+ if _tmp
1466
+ _ary << @result
1467
+ while true
1468
+ _tmp = apply(:_ordered_item)
1469
+ _ary << @result if _tmp
1470
+ break unless _tmp
1471
+ end
1472
+ _tmp = true
1473
+ @result = _ary
1474
+ else
1475
+ self.pos = _save1
1476
+ end
1477
+ items = @result
1478
+ if _tmp
1479
+ text = get_text(_text_start)
1480
+ end
1481
+ unless _tmp
1482
+ self.pos = _save
1483
+ break
1484
+ end
1485
+ @result = begin; create_item(:ol, nil, items, raw: text) ; end
1486
+ _tmp = true
1487
+ unless _tmp
1488
+ self.pos = _save
1489
+ end
1490
+ break
1491
+ end # end sequence
1492
+
1493
+ set_failed_rule :_ordered_list unless _tmp
1494
+ return _tmp
1495
+ end
1496
+
1497
+ # ordered_item = < lh num ":" documentcontent:content le > { create_item(:li, nil, content, raw: text) }
1498
+ def _ordered_item
1499
+
1500
+ _save = self.pos
1501
+ while true # sequence
1502
+ _text_start = self.pos
1503
+
1504
+ _save1 = self.pos
1505
+ while true # sequence
1506
+ _tmp = apply(:_lh)
1507
+ unless _tmp
1508
+ self.pos = _save1
1509
+ break
1510
+ end
1511
+ _tmp = apply(:_num)
1512
+ unless _tmp
1513
+ self.pos = _save1
1514
+ break
1515
+ end
1516
+ _tmp = match_string(":")
1517
+ unless _tmp
1518
+ self.pos = _save1
1519
+ break
1520
+ end
1521
+ _tmp = apply(:_documentcontent)
1522
+ content = @result
1523
+ unless _tmp
1524
+ self.pos = _save1
1525
+ break
1526
+ end
1527
+ _tmp = apply(:_le)
1528
+ unless _tmp
1529
+ self.pos = _save1
1530
+ end
1531
+ break
1532
+ end # end sequence
1533
+
1534
+ if _tmp
1535
+ text = get_text(_text_start)
1536
+ end
1537
+ unless _tmp
1538
+ self.pos = _save
1539
+ break
1540
+ end
1541
+ @result = begin; create_item(:li, nil, content, raw: text) ; end
1542
+ _tmp = true
1543
+ unless _tmp
1544
+ self.pos = _save
1545
+ end
1546
+ break
1547
+ end # end sequence
1548
+
1549
+ set_failed_rule :_ordered_item unless _tmp
1550
+ return _tmp
1551
+ end
1552
+
1553
+ # definition_list = < definition_item+:items > { create_item(:dl, nil, items, raw: text) }
1554
+ def _definition_list
1555
+
1556
+ _save = self.pos
1557
+ while true # sequence
1558
+ _text_start = self.pos
1559
+ _save1 = self.pos
1560
+ _ary = []
1561
+ _tmp = apply(:_definition_item)
1562
+ if _tmp
1563
+ _ary << @result
1564
+ while true
1565
+ _tmp = apply(:_definition_item)
1566
+ _ary << @result if _tmp
1567
+ break unless _tmp
1568
+ end
1569
+ _tmp = true
1570
+ @result = _ary
1571
+ else
1572
+ self.pos = _save1
1573
+ end
1574
+ items = @result
1575
+ if _tmp
1576
+ text = get_text(_text_start)
1577
+ end
1578
+ unless _tmp
1579
+ self.pos = _save
1580
+ break
1581
+ end
1582
+ @result = begin; create_item(:dl, nil, items, raw: text) ; end
1583
+ _tmp = true
1584
+ unless _tmp
1585
+ self.pos = _save
1586
+ end
1587
+ break
1588
+ end # end sequence
1589
+
1590
+ set_failed_rule :_definition_list unless _tmp
1591
+ return _tmp
1592
+ end
1593
+
1594
+ # definition_item = < lh ";:" - documentcontent_except(':'):term ":" - documentcontent:definition le > { create_item(:dtdd, {:args => [term, definition]}, nil, raw: text) }
1595
+ def _definition_item
1596
+
1597
+ _save = self.pos
1598
+ while true # sequence
1599
+ _text_start = self.pos
1600
+
1601
+ _save1 = self.pos
1602
+ while true # sequence
1603
+ _tmp = apply(:_lh)
1604
+ unless _tmp
1605
+ self.pos = _save1
1606
+ break
1607
+ end
1608
+ _tmp = match_string(";:")
1609
+ unless _tmp
1610
+ self.pos = _save1
1611
+ break
1612
+ end
1613
+ _tmp = apply(:__hyphen_)
1614
+ unless _tmp
1615
+ self.pos = _save1
1616
+ break
1617
+ end
1618
+ _tmp = apply_with_args(:_documentcontent_except, ':')
1619
+ term = @result
1620
+ unless _tmp
1621
+ self.pos = _save1
1622
+ break
1623
+ end
1624
+ _tmp = match_string(":")
1625
+ unless _tmp
1626
+ self.pos = _save1
1627
+ break
1628
+ end
1629
+ _tmp = apply(:__hyphen_)
1630
+ unless _tmp
1631
+ self.pos = _save1
1632
+ break
1633
+ end
1634
+ _tmp = apply(:_documentcontent)
1635
+ definition = @result
1636
+ unless _tmp
1637
+ self.pos = _save1
1638
+ break
1639
+ end
1640
+ _tmp = apply(:_le)
1641
+ unless _tmp
1642
+ self.pos = _save1
1643
+ end
1644
+ break
1645
+ end # end sequence
1646
+
1647
+ if _tmp
1648
+ text = get_text(_text_start)
1649
+ end
1650
+ unless _tmp
1651
+ self.pos = _save
1652
+ break
1653
+ end
1654
+ @result = begin; create_item(:dtdd, {:args => [term, definition]}, nil, raw: text) ; end
1655
+ _tmp = true
1656
+ unless _tmp
1657
+ self.pos = _save
1658
+ end
1659
+ break
1660
+ end # end sequence
1661
+
1662
+ set_failed_rule :_definition_item unless _tmp
1663
+ return _tmp
1664
+ end
1665
+
1666
+ # items_list = (unordered_list | ordered_list | definition_list)
1667
+ def _items_list
1668
+
1669
+ _save = self.pos
1670
+ while true # choice
1671
+ _tmp = apply(:_unordered_list)
1672
+ break if _tmp
1673
+ self.pos = _save
1674
+ _tmp = apply(:_ordered_list)
1675
+ break if _tmp
1676
+ self.pos = _save
1677
+ _tmp = apply(:_definition_list)
1678
+ break if _tmp
1679
+ self.pos = _save
1680
+ break
1681
+ end # end choice
1682
+
1683
+ set_failed_rule :_items_list unless _tmp
1684
+ return _tmp
1685
+ end
1686
+
1687
+ # line_command = < lh - (!explicit_paragraph_command command):command ":" documentcontent?:content le > { create_item(:line_command, command, content, raw: text) }
1688
+ def _line_command
1689
+
1690
+ _save = self.pos
1691
+ while true # sequence
1692
+ _text_start = self.pos
1693
+
1694
+ _save1 = self.pos
1695
+ while true # sequence
1696
+ _tmp = apply(:_lh)
1697
+ unless _tmp
1698
+ self.pos = _save1
1699
+ break
1700
+ end
1701
+ _tmp = apply(:__hyphen_)
1702
+ unless _tmp
1703
+ self.pos = _save1
1704
+ break
1705
+ end
1706
+
1707
+ _save2 = self.pos
1708
+ while true # sequence
1709
+ _save3 = self.pos
1710
+ _tmp = apply(:_explicit_paragraph_command)
1711
+ _tmp = _tmp ? nil : true
1712
+ self.pos = _save3
1713
+ unless _tmp
1714
+ self.pos = _save2
1715
+ break
1716
+ end
1717
+ _tmp = apply(:_command)
1718
+ unless _tmp
1719
+ self.pos = _save2
1720
+ end
1721
+ break
1722
+ end # end sequence
1723
+
1724
+ command = @result
1725
+ unless _tmp
1726
+ self.pos = _save1
1727
+ break
1728
+ end
1729
+ _tmp = match_string(":")
1730
+ unless _tmp
1731
+ self.pos = _save1
1732
+ break
1733
+ end
1734
+ _save4 = self.pos
1735
+ _tmp = apply(:_documentcontent)
1736
+ @result = nil unless _tmp
1737
+ unless _tmp
1738
+ _tmp = true
1739
+ self.pos = _save4
1740
+ end
1741
+ content = @result
1742
+ unless _tmp
1743
+ self.pos = _save1
1744
+ break
1745
+ end
1746
+ _tmp = apply(:_le)
1747
+ unless _tmp
1748
+ self.pos = _save1
1749
+ end
1750
+ break
1751
+ end # end sequence
1752
+
1753
+ if _tmp
1754
+ text = get_text(_text_start)
1755
+ end
1756
+ unless _tmp
1757
+ self.pos = _save
1758
+ break
1759
+ end
1760
+ @result = begin; create_item(:line_command, command, content, raw: text) ; end
1761
+ _tmp = true
1762
+ unless _tmp
1763
+ self.pos = _save
1764
+ end
1765
+ break
1766
+ end # end sequence
1767
+
1768
+ set_failed_rule :_line_command unless _tmp
1769
+ return _tmp
1770
+ end
1771
+
1772
+ # block = (items_list | line_command | explicit_block | paragraph_group | empty_line+)
1773
+ def _block
1774
+
1775
+ _save = self.pos
1776
+ while true # choice
1777
+ _tmp = apply(:_items_list)
1778
+ break if _tmp
1779
+ self.pos = _save
1780
+ _tmp = apply(:_line_command)
1781
+ break if _tmp
1782
+ self.pos = _save
1783
+ _tmp = apply(:_explicit_block)
1784
+ break if _tmp
1785
+ self.pos = _save
1786
+ _tmp = apply(:_paragraph_group)
1787
+ break if _tmp
1788
+ self.pos = _save
1789
+ _save1 = self.pos
1790
+ _tmp = apply(:_empty_line)
1791
+ if _tmp
1792
+ while true
1793
+ _tmp = apply(:_empty_line)
1794
+ break unless _tmp
1795
+ end
1796
+ _tmp = true
1797
+ else
1798
+ self.pos = _save1
1799
+ end
1800
+ break if _tmp
1801
+ self.pos = _save
1802
+ break
1803
+ end # end choice
1804
+
1805
+ set_failed_rule :_block unless _tmp
1806
+ return _tmp
1807
+ end
1808
+
1809
+ # block_delimiter = (blockhead | blockend | newpage)
1810
+ def _block_delimiter
1811
+
1812
+ _save = self.pos
1813
+ while true # choice
1814
+ _tmp = apply(:_blockhead)
1815
+ break if _tmp
1816
+ self.pos = _save
1817
+ _tmp = apply(:_blockend)
1818
+ break if _tmp
1819
+ self.pos = _save
1820
+ _tmp = apply(:_newpage)
1821
+ break if _tmp
1822
+ self.pos = _save
1823
+ break
1824
+ end # end choice
1825
+
1826
+ set_failed_rule :_block_delimiter unless _tmp
1827
+ return _tmp
1828
+ end
1829
+
1830
+ # paragraph_delimiter = (block | block_delimiter)
1831
+ def _paragraph_delimiter
1832
+
1833
+ _save = self.pos
1834
+ while true # choice
1835
+ _tmp = apply(:_block)
1836
+ break if _tmp
1837
+ self.pos = _save
1838
+ _tmp = apply(:_block_delimiter)
1839
+ break if _tmp
1840
+ self.pos = _save
1841
+ break
1842
+ end # end choice
1843
+
1844
+ set_failed_rule :_paragraph_delimiter unless _tmp
1845
+ return _tmp
1846
+ end
1847
+
1848
+ # char = < /[[:print:]]/ > { text }
1849
+ def _char
1850
+
1851
+ _save = self.pos
1852
+ while true # sequence
1853
+ _text_start = self.pos
1854
+ _tmp = scan(/\A(?-mix:[[:print:]])/)
1855
+ if _tmp
1856
+ text = get_text(_text_start)
1857
+ end
1858
+ unless _tmp
1859
+ self.pos = _save
1860
+ break
1861
+ end
1862
+ @result = begin; text ; end
1863
+ _tmp = true
1864
+ unless _tmp
1865
+ self.pos = _save
1866
+ end
1867
+ break
1868
+ end # end sequence
1869
+
1870
+ set_failed_rule :_char unless _tmp
1871
+ return _tmp
1872
+ end
1873
+
1874
+ # charstring = < char* > { text }
1875
+ def _charstring
1876
+
1877
+ _save = self.pos
1878
+ while true # sequence
1879
+ _text_start = self.pos
1880
+ while true
1881
+ _tmp = apply(:_char)
1882
+ break unless _tmp
1883
+ end
1884
+ _tmp = true
1885
+ if _tmp
1886
+ text = get_text(_text_start)
1887
+ end
1888
+ unless _tmp
1889
+ self.pos = _save
1890
+ break
1891
+ end
1892
+ @result = begin; text ; end
1893
+ _tmp = true
1894
+ unless _tmp
1895
+ self.pos = _save
1896
+ end
1897
+ break
1898
+ end # end sequence
1899
+
1900
+ set_failed_rule :_charstring unless _tmp
1901
+ return _tmp
1902
+ end
1903
+
1904
+ # char_except = char:c &{ c != e }
1905
+ def _char_except(e)
1906
+
1907
+ _save = self.pos
1908
+ while true # sequence
1909
+ _tmp = apply(:_char)
1910
+ c = @result
1911
+ unless _tmp
1912
+ self.pos = _save
1913
+ break
1914
+ end
1915
+ _save1 = self.pos
1916
+ _tmp = begin; c != e ; end
1917
+ self.pos = _save1
1918
+ unless _tmp
1919
+ self.pos = _save
1920
+ end
1921
+ break
1922
+ end # end sequence
1923
+
1924
+ set_failed_rule :_char_except unless _tmp
1925
+ return _tmp
1926
+ end
1927
+
1928
+ # charstring_except = < char_except(e)* > { text }
1929
+ def _charstring_except(e)
1930
+
1931
+ _save = self.pos
1932
+ while true # sequence
1933
+ _text_start = self.pos
1934
+ while true
1935
+ _tmp = apply_with_args(:_char_except, e)
1936
+ break unless _tmp
1937
+ end
1938
+ _tmp = true
1939
+ if _tmp
1940
+ text = get_text(_text_start)
1941
+ end
1942
+ unless _tmp
1943
+ self.pos = _save
1944
+ break
1945
+ end
1946
+ @result = begin; text ; end
1947
+ _tmp = true
1948
+ unless _tmp
1949
+ self.pos = _save
1950
+ end
1951
+ break
1952
+ end # end sequence
1953
+
1954
+ set_failed_rule :_charstring_except unless _tmp
1955
+ return _tmp
1956
+ end
1957
+
1958
+ # documentcontent_except = (inline | !inline char_except(e))+:content {parse_text(content)}
1959
+ def _documentcontent_except(e)
1960
+
1961
+ _save = self.pos
1962
+ while true # sequence
1963
+ _save1 = self.pos
1964
+ _ary = []
1965
+
1966
+ _save2 = self.pos
1967
+ while true # choice
1968
+ _tmp = apply(:_inline)
1969
+ break if _tmp
1970
+ self.pos = _save2
1971
+
1972
+ _save3 = self.pos
1973
+ while true # sequence
1974
+ _save4 = self.pos
1975
+ _tmp = apply(:_inline)
1976
+ _tmp = _tmp ? nil : true
1977
+ self.pos = _save4
1978
+ unless _tmp
1979
+ self.pos = _save3
1980
+ break
1981
+ end
1982
+ _tmp = apply_with_args(:_char_except, e)
1983
+ unless _tmp
1984
+ self.pos = _save3
1985
+ end
1986
+ break
1987
+ end # end sequence
1988
+
1989
+ break if _tmp
1990
+ self.pos = _save2
1991
+ break
1992
+ end # end choice
1993
+
1994
+ if _tmp
1995
+ _ary << @result
1996
+ while true
1997
+
1998
+ _save5 = self.pos
1999
+ while true # choice
2000
+ _tmp = apply(:_inline)
2001
+ break if _tmp
2002
+ self.pos = _save5
2003
+
2004
+ _save6 = self.pos
2005
+ while true # sequence
2006
+ _save7 = self.pos
2007
+ _tmp = apply(:_inline)
2008
+ _tmp = _tmp ? nil : true
2009
+ self.pos = _save7
2010
+ unless _tmp
2011
+ self.pos = _save6
2012
+ break
2013
+ end
2014
+ _tmp = apply_with_args(:_char_except, e)
2015
+ unless _tmp
2016
+ self.pos = _save6
2017
+ end
2018
+ break
2019
+ end # end sequence
2020
+
2021
+ break if _tmp
2022
+ self.pos = _save5
2023
+ break
2024
+ end # end choice
2025
+
2026
+ _ary << @result if _tmp
2027
+ break unless _tmp
2028
+ end
2029
+ _tmp = true
2030
+ @result = _ary
2031
+ else
2032
+ self.pos = _save1
2033
+ end
2034
+ content = @result
2035
+ unless _tmp
2036
+ self.pos = _save
2037
+ break
2038
+ end
2039
+ @result = begin; parse_text(content); end
2040
+ _tmp = true
2041
+ unless _tmp
2042
+ self.pos = _save
2043
+ end
2044
+ break
2045
+ end # end sequence
2046
+
2047
+ set_failed_rule :_documentcontent_except unless _tmp
2048
+ return _tmp
2049
+ end
2050
+
2051
+ # documentcontent = (inline | !inline char)+:content {parse_text(content)}
2052
+ def _documentcontent
2053
+
2054
+ _save = self.pos
2055
+ while true # sequence
2056
+ _save1 = self.pos
2057
+ _ary = []
2058
+
2059
+ _save2 = self.pos
2060
+ while true # choice
2061
+ _tmp = apply(:_inline)
2062
+ break if _tmp
2063
+ self.pos = _save2
2064
+
2065
+ _save3 = self.pos
2066
+ while true # sequence
2067
+ _save4 = self.pos
2068
+ _tmp = apply(:_inline)
2069
+ _tmp = _tmp ? nil : true
2070
+ self.pos = _save4
2071
+ unless _tmp
2072
+ self.pos = _save3
2073
+ break
2074
+ end
2075
+ _tmp = apply(:_char)
2076
+ unless _tmp
2077
+ self.pos = _save3
2078
+ end
2079
+ break
2080
+ end # end sequence
2081
+
2082
+ break if _tmp
2083
+ self.pos = _save2
2084
+ break
2085
+ end # end choice
2086
+
2087
+ if _tmp
2088
+ _ary << @result
2089
+ while true
2090
+
2091
+ _save5 = self.pos
2092
+ while true # choice
2093
+ _tmp = apply(:_inline)
2094
+ break if _tmp
2095
+ self.pos = _save5
2096
+
2097
+ _save6 = self.pos
2098
+ while true # sequence
2099
+ _save7 = self.pos
2100
+ _tmp = apply(:_inline)
2101
+ _tmp = _tmp ? nil : true
2102
+ self.pos = _save7
2103
+ unless _tmp
2104
+ self.pos = _save6
2105
+ break
2106
+ end
2107
+ _tmp = apply(:_char)
2108
+ unless _tmp
2109
+ self.pos = _save6
2110
+ end
2111
+ break
2112
+ end # end sequence
2113
+
2114
+ break if _tmp
2115
+ self.pos = _save5
2116
+ break
2117
+ end # end choice
2118
+
2119
+ _ary << @result if _tmp
2120
+ break unless _tmp
2121
+ end
2122
+ _tmp = true
2123
+ @result = _ary
2124
+ else
2125
+ self.pos = _save1
2126
+ end
2127
+ content = @result
2128
+ unless _tmp
2129
+ self.pos = _save
2130
+ break
2131
+ end
2132
+ @result = begin; parse_text(content); end
2133
+ _tmp = true
2134
+ unless _tmp
2135
+ self.pos = _save
2136
+ end
2137
+ break
2138
+ end # end sequence
2139
+
2140
+ set_failed_rule :_documentcontent unless _tmp
2141
+ return _tmp
2142
+ end
2143
+
2144
+ # documentline = lh documentcontent:content /$/ { content }
2145
+ def _documentline
2146
+
2147
+ _save = self.pos
2148
+ while true # sequence
2149
+ _tmp = apply(:_lh)
2150
+ unless _tmp
2151
+ self.pos = _save
2152
+ break
2153
+ end
2154
+ _tmp = apply(:_documentcontent)
2155
+ content = @result
2156
+ unless _tmp
2157
+ self.pos = _save
2158
+ break
2159
+ end
2160
+ _tmp = scan(/\A(?-mix:$)/)
2161
+ unless _tmp
2162
+ self.pos = _save
2163
+ break
2164
+ end
2165
+ @result = begin; content ; end
2166
+ _tmp = true
2167
+ unless _tmp
2168
+ self.pos = _save
2169
+ end
2170
+ break
2171
+ end # end sequence
2172
+
2173
+ set_failed_rule :_documentline unless _tmp
2174
+ return _tmp
2175
+ end
2176
+
2177
+ # stylesheets = < lh - "stylesheets:" (!le charstring):stylesheets le > { create_item(:stylesheets, {:stylesheets => stylesheets.split(',').map(&:strip)}, nil, raw:text) }
2178
+ def _stylesheets
2179
+
2180
+ _save = self.pos
2181
+ while true # sequence
2182
+ _text_start = self.pos
2183
+
2184
+ _save1 = self.pos
2185
+ while true # sequence
2186
+ _tmp = apply(:_lh)
2187
+ unless _tmp
2188
+ self.pos = _save1
2189
+ break
2190
+ end
2191
+ _tmp = apply(:__hyphen_)
2192
+ unless _tmp
2193
+ self.pos = _save1
2194
+ break
2195
+ end
2196
+ _tmp = match_string("stylesheets:")
2197
+ unless _tmp
2198
+ self.pos = _save1
2199
+ break
2200
+ end
2201
+
2202
+ _save2 = self.pos
2203
+ while true # sequence
2204
+ _save3 = self.pos
2205
+ _tmp = apply(:_le)
2206
+ _tmp = _tmp ? nil : true
2207
+ self.pos = _save3
2208
+ unless _tmp
2209
+ self.pos = _save2
2210
+ break
2211
+ end
2212
+ _tmp = apply(:_charstring)
2213
+ unless _tmp
2214
+ self.pos = _save2
2215
+ end
2216
+ break
2217
+ end # end sequence
2218
+
2219
+ stylesheets = @result
2220
+ unless _tmp
2221
+ self.pos = _save1
2222
+ break
2223
+ end
2224
+ _tmp = apply(:_le)
2225
+ unless _tmp
2226
+ self.pos = _save1
2227
+ end
2228
+ break
2229
+ end # end sequence
2230
+
2231
+ if _tmp
2232
+ text = get_text(_text_start)
2233
+ end
2234
+ unless _tmp
2235
+ self.pos = _save
2236
+ break
2237
+ end
2238
+ @result = begin; create_item(:stylesheets, {:stylesheets => stylesheets.split(',').map(&:strip)}, nil, raw:text) ; end
2239
+ _tmp = true
2240
+ unless _tmp
2241
+ self.pos = _save
2242
+ end
2243
+ break
2244
+ end # end sequence
2245
+
2246
+ set_failed_rule :_stylesheets unless _tmp
2247
+ return _tmp
2248
+ end
2249
+
2250
+ # title = < lh - "title:" (!le charstring):title le > { create_item(:title, {:title => title }, nil, raw:text) }
2251
+ def _title
2252
+
2253
+ _save = self.pos
2254
+ while true # sequence
2255
+ _text_start = self.pos
2256
+
2257
+ _save1 = self.pos
2258
+ while true # sequence
2259
+ _tmp = apply(:_lh)
2260
+ unless _tmp
2261
+ self.pos = _save1
2262
+ break
2263
+ end
2264
+ _tmp = apply(:__hyphen_)
2265
+ unless _tmp
2266
+ self.pos = _save1
2267
+ break
2268
+ end
2269
+ _tmp = match_string("title:")
2270
+ unless _tmp
2271
+ self.pos = _save1
2272
+ break
2273
+ end
2274
+
2275
+ _save2 = self.pos
2276
+ while true # sequence
2277
+ _save3 = self.pos
2278
+ _tmp = apply(:_le)
2279
+ _tmp = _tmp ? nil : true
2280
+ self.pos = _save3
2281
+ unless _tmp
2282
+ self.pos = _save2
2283
+ break
2284
+ end
2285
+ _tmp = apply(:_charstring)
2286
+ unless _tmp
2287
+ self.pos = _save2
2288
+ end
2289
+ break
2290
+ end # end sequence
2291
+
2292
+ title = @result
2293
+ unless _tmp
2294
+ self.pos = _save1
2295
+ break
2296
+ end
2297
+ _tmp = apply(:_le)
2298
+ unless _tmp
2299
+ self.pos = _save1
2300
+ end
2301
+ break
2302
+ end # end sequence
2303
+
2304
+ if _tmp
2305
+ text = get_text(_text_start)
2306
+ end
2307
+ unless _tmp
2308
+ self.pos = _save
2309
+ break
2310
+ end
2311
+ @result = begin; create_item(:title, {:title => title }, nil, raw:text) ; end
2312
+ _tmp = true
2313
+ unless _tmp
2314
+ self.pos = _save
2315
+ end
2316
+ break
2317
+ end # end sequence
2318
+
2319
+ set_failed_rule :_title unless _tmp
2320
+ return _tmp
2321
+ end
2322
+
2323
+ # lang = < lh - "lang:" (!le charstring):lang le > { create_item(:lang, {:lang => lang }, nil, raw:text) }
2324
+ def _lang
2325
+
2326
+ _save = self.pos
2327
+ while true # sequence
2328
+ _text_start = self.pos
2329
+
2330
+ _save1 = self.pos
2331
+ while true # sequence
2332
+ _tmp = apply(:_lh)
2333
+ unless _tmp
2334
+ self.pos = _save1
2335
+ break
2336
+ end
2337
+ _tmp = apply(:__hyphen_)
2338
+ unless _tmp
2339
+ self.pos = _save1
2340
+ break
2341
+ end
2342
+ _tmp = match_string("lang:")
2343
+ unless _tmp
2344
+ self.pos = _save1
2345
+ break
2346
+ end
2347
+
2348
+ _save2 = self.pos
2349
+ while true # sequence
2350
+ _save3 = self.pos
2351
+ _tmp = apply(:_le)
2352
+ _tmp = _tmp ? nil : true
2353
+ self.pos = _save3
2354
+ unless _tmp
2355
+ self.pos = _save2
2356
+ break
2357
+ end
2358
+ _tmp = apply(:_charstring)
2359
+ unless _tmp
2360
+ self.pos = _save2
2361
+ end
2362
+ break
2363
+ end # end sequence
2364
+
2365
+ lang = @result
2366
+ unless _tmp
2367
+ self.pos = _save1
2368
+ break
2369
+ end
2370
+ _tmp = apply(:_le)
2371
+ unless _tmp
2372
+ self.pos = _save1
2373
+ end
2374
+ break
2375
+ end # end sequence
2376
+
2377
+ if _tmp
2378
+ text = get_text(_text_start)
2379
+ end
2380
+ unless _tmp
2381
+ self.pos = _save
2382
+ break
2383
+ end
2384
+ @result = begin; create_item(:lang, {:lang => lang }, nil, raw:text) ; end
2385
+ _tmp = true
2386
+ unless _tmp
2387
+ self.pos = _save
2388
+ end
2389
+ break
2390
+ end # end sequence
2391
+
2392
+ set_failed_rule :_lang unless _tmp
2393
+ return _tmp
2394
+ end
2395
+
2396
+ # header = (stylesheets | title | lang)
2397
+ def _header
2398
+
2399
+ _save = self.pos
2400
+ while true # choice
2401
+ _tmp = apply(:_stylesheets)
2402
+ break if _tmp
2403
+ self.pos = _save
2404
+ _tmp = apply(:_title)
2405
+ break if _tmp
2406
+ self.pos = _save
2407
+ _tmp = apply(:_lang)
2408
+ break if _tmp
2409
+ self.pos = _save
2410
+ break
2411
+ end # end choice
2412
+
2413
+ set_failed_rule :_header unless _tmp
2414
+ return _tmp
2415
+ end
2416
+
2417
+ # root = header*:headers block*:blocks eof_comment? eof { headers + blocks }
2418
+ def _root
2419
+
2420
+ _save = self.pos
2421
+ while true # sequence
2422
+ _ary = []
2423
+ while true
2424
+ _tmp = apply(:_header)
2425
+ _ary << @result if _tmp
2426
+ break unless _tmp
2427
+ end
2428
+ _tmp = true
2429
+ @result = _ary
2430
+ headers = @result
2431
+ unless _tmp
2432
+ self.pos = _save
2433
+ break
2434
+ end
2435
+ _ary = []
2436
+ while true
2437
+ _tmp = apply(:_block)
2438
+ _ary << @result if _tmp
2439
+ break unless _tmp
2440
+ end
2441
+ _tmp = true
2442
+ @result = _ary
2443
+ blocks = @result
2444
+ unless _tmp
2445
+ self.pos = _save
2446
+ break
2447
+ end
2448
+ _save3 = self.pos
2449
+ _tmp = apply(:_eof_comment)
2450
+ unless _tmp
2451
+ _tmp = true
2452
+ self.pos = _save3
2453
+ end
2454
+ unless _tmp
2455
+ self.pos = _save
2456
+ break
2457
+ end
2458
+ _tmp = apply(:_eof)
2459
+ unless _tmp
2460
+ self.pos = _save
2461
+ break
2462
+ end
2463
+ @result = begin; headers + blocks ; end
2464
+ _tmp = true
2465
+ unless _tmp
2466
+ self.pos = _save
2467
+ end
2468
+ break
2469
+ end # end sequence
2470
+
2471
+ set_failed_rule :_root unless _tmp
2472
+ return _tmp
2473
+ end
2474
+
2475
+ Rules = {}
2476
+ Rules[:_eof] = rule_info("eof", "!.")
2477
+ Rules[:_space] = rule_info("space", "(\" \" | \"\\\\t\")")
2478
+ Rules[:_eof_comment] = rule_info("eof_comment", "lh space* \"\#\" (!eof .)*")
2479
+ Rules[:_comment] = rule_info("comment", "lh space* \"\#\" (!nl .)* nl")
2480
+ Rules[:__hyphen_] = rule_info("-", "(space | comment)*")
2481
+ Rules[:_empty_line] = rule_info("empty_line", "lh - nl")
2482
+ Rules[:_nl] = rule_info("nl", "/\\r?\\n/")
2483
+ Rules[:_lh] = rule_info("lh", "/^/")
2484
+ Rules[:_le] = rule_info("le", "(nl | /$/)")
2485
+ Rules[:_word] = rule_info("word", "< /[\\w0-9]/ (\"-\" | /[\\w0-9]/)* > { text }")
2486
+ Rules[:_num] = rule_info("num", "< [0-9]+ > { text.to_i }")
2487
+ Rules[:_classname] = rule_info("classname", "\".\" word:classname { classname }")
2488
+ Rules[:_classnames] = rule_info("classnames", "classname*:classnames { classnames }")
2489
+ Rules[:_idname] = rule_info("idname", "\"\#\" word:idname { idname }")
2490
+ Rules[:_idnames] = rule_info("idnames", "idname*:idnames { idnames }")
2491
+ Rules[:_commandname] = rule_info("commandname", "word:name idnames?:idnames classnames?:classes { {:name => name, :ids => idnames, :classes => classes} }")
2492
+ Rules[:_parameter] = rule_info("parameter", "< (/[^,)]/* | \"\\\"\" /[^\"]/* \"\\\"\" | \"'\" /[^']/* \"'\") > { text }")
2493
+ Rules[:_parameters] = rule_info("parameters", "< parameter (\",\" parameter)* > { text }")
2494
+ Rules[:_command] = rule_info("command", "commandname:commandname (\"(\" - parameters:arg - \")\")? { arg ||= ''; commandname.merge({ :args => arg.split(',') }) }")
2495
+ Rules[:_implicit_paragraph] = rule_info("implicit_paragraph", "< (!paragraph_delimiter - documentline -):paragraph > { create_item(:paragraph, nil, paragraph, raw: text) }")
2496
+ Rules[:_paragraph] = rule_info("paragraph", "(explicit_paragraph | implicit_paragraph)")
2497
+ Rules[:_paragraph_group] = rule_info("paragraph_group", "< (paragraph nl | paragraph)+:paragraphs empty_line* > { create_item(:paragraph_group, nil, paragraphs, raw: text) }")
2498
+ Rules[:_blockhead] = rule_info("blockhead", "lh - command:command - \"{\" - le { command }")
2499
+ Rules[:_blockend] = rule_info("blockend", "lh - \"}\" - le")
2500
+ Rules[:_blockbody] = rule_info("blockbody", "(!blockend block)+:body { body }")
2501
+ Rules[:_explicit_block] = rule_info("explicit_block", "< blockhead:head blockbody:body blockend > { create_item(:block, head, body, raw: text) }")
2502
+ Rules[:_inline] = rule_info("inline", "(img_inline | common_inline)")
2503
+ Rules[:_common_inline] = rule_info("common_inline", "< \"[\" command:command \"{\" documentcontent_except('}'):content \"}\" \"]\" > { create_item(:inline, command, content, raw: text) }")
2504
+ Rules[:_img_command] = rule_info("img_command", "command:command &{ command[:name] == 'img' && command[:args].size == 2}")
2505
+ Rules[:_img_inline] = rule_info("img_inline", "< \"[\" img_command:command \"]\" > { create_item(:inline, command, nil, raw: text) }")
2506
+ Rules[:_newpage] = rule_info("newpage", "line_command:item &{ item[:name] == 'newpage' }")
2507
+ Rules[:_explicit_paragraph_command] = rule_info("explicit_paragraph_command", "command:command &{ command[:name] == 'p' }")
2508
+ Rules[:_explicit_paragraph] = rule_info("explicit_paragraph", "< lh - explicit_paragraph_command:command \":\" documentcontent?:content le > { create_item(:paragraph, command, content, raw:text) }")
2509
+ Rules[:_unordered_list] = rule_info("unordered_list", "< unordered_item+:items > { create_item(:ul, nil, items, raw: text) }")
2510
+ Rules[:_unordered_item] = rule_info("unordered_item", "< lh \"*:\" documentcontent:content le > { create_item(:li, nil, content, raw: text) }")
2511
+ Rules[:_ordered_list] = rule_info("ordered_list", "< ordered_item+:items > { create_item(:ol, nil, items, raw: text) }")
2512
+ Rules[:_ordered_item] = rule_info("ordered_item", "< lh num \":\" documentcontent:content le > { create_item(:li, nil, content, raw: text) }")
2513
+ Rules[:_definition_list] = rule_info("definition_list", "< definition_item+:items > { create_item(:dl, nil, items, raw: text) }")
2514
+ Rules[:_definition_item] = rule_info("definition_item", "< lh \";:\" - documentcontent_except(':'):term \":\" - documentcontent:definition le > { create_item(:dtdd, {:args => [term, definition]}, nil, raw: text) }")
2515
+ Rules[:_items_list] = rule_info("items_list", "(unordered_list | ordered_list | definition_list)")
2516
+ Rules[:_line_command] = rule_info("line_command", "< lh - (!explicit_paragraph_command command):command \":\" documentcontent?:content le > { create_item(:line_command, command, content, raw: text) }")
2517
+ Rules[:_block] = rule_info("block", "(items_list | line_command | explicit_block | paragraph_group | empty_line+)")
2518
+ Rules[:_block_delimiter] = rule_info("block_delimiter", "(blockhead | blockend | newpage)")
2519
+ Rules[:_paragraph_delimiter] = rule_info("paragraph_delimiter", "(block | block_delimiter)")
2520
+ Rules[:_char] = rule_info("char", "< /[[:print:]]/ > { text }")
2521
+ Rules[:_charstring] = rule_info("charstring", "< char* > { text }")
2522
+ Rules[:_char_except] = rule_info("char_except", "char:c &{ c != e }")
2523
+ Rules[:_charstring_except] = rule_info("charstring_except", "< char_except(e)* > { text }")
2524
+ Rules[:_documentcontent_except] = rule_info("documentcontent_except", "(inline | !inline char_except(e))+:content {parse_text(content)}")
2525
+ Rules[:_documentcontent] = rule_info("documentcontent", "(inline | !inline char)+:content {parse_text(content)}")
2526
+ Rules[:_documentline] = rule_info("documentline", "lh documentcontent:content /$/ { content }")
2527
+ Rules[:_stylesheets] = rule_info("stylesheets", "< lh - \"stylesheets:\" (!le charstring):stylesheets le > { create_item(:stylesheets, {:stylesheets => stylesheets.split(',').map(&:strip)}, nil, raw:text) }")
2528
+ Rules[:_title] = rule_info("title", "< lh - \"title:\" (!le charstring):title le > { create_item(:title, {:title => title }, nil, raw:text) }")
2529
+ Rules[:_lang] = rule_info("lang", "< lh - \"lang:\" (!le charstring):lang le > { create_item(:lang, {:lang => lang }, nil, raw:text) }")
2530
+ Rules[:_header] = rule_info("header", "(stylesheets | title | lang)")
2531
+ Rules[:_root] = rule_info("root", "header*:headers block*:blocks eof_comment? eof { headers + blocks }")
2532
+ # :startdoc:
2533
+ end