02_test_paragraph.md 16.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16


Test of parser: "paragraph"
===========================


Match-test "1"
--------------

### Test-code:
    Im allgemeinen werden die Bewohner Göttingens eingeteilt in Studenten,
    Professoren, Philister und Vieh; welche vier Stände doch nichts weniger
    als streng geschieden sind. Der Viehstand ist der bedeutendste.

### AST
    (paragraph
17
18
19
20
        (text
            "Im allgemeinen werden die Bewohner Göttingens eingeteilt in Studenten,"
            "Professoren, Philister und Vieh; welche vier Stände doch nichts weniger"
            "als streng geschieden sind. Der Viehstand ist der bedeutendste."
21
        )
eckhart's avatar
eckhart committed
22
23
24
        (:Whitespace
            " "
        )
25
26
27
28
29
30
31
32
33
34
35
    )

Match-test "2"
--------------

### Test-code:
    Paragraphs may contain {\em inline blocks} as well as \emph{inline commands}
    and also special \& characters.

### AST
    (paragraph
36
37
        (text
            "Paragraphs may contain"
38
39
40
41
        )
        (:Whitespace
            " "
        )
42
        (block
eckhart's avatar
eckhart committed
43
44
45
            (:Whitespace
                " "
            )
46
47
48
            (generic_command
                (CMDNAME
                    "\em"
49
50
                )
            )
eckhart's avatar
eckhart committed
51
52
53
            (:Whitespace
                " "
            )
54
55
56
            (text
                "inline blocks"
            )
eckhart's avatar
eckhart committed
57
58
59
            (:Whitespace
                " "
            )
60
61
62
63
        )
        (:Whitespace
            " "
        )
64
65
        (text
            "as well as"
66
67
68
69
        )
        (:Whitespace
            " "
        )
70
71
72
73
        (generic_command
            (CMDNAME
                "\emph"
            )
eckhart's avatar
eckhart committed
74
75
76
77
78
79
80
81
82
83
84
85
86
            (:Whitespace
                " "
            )
            (block
                (:Whitespace
                    " "
                )
                (text
                    "inline commands"
                )
                (:Whitespace
                    " "
                )
87
88
89
90
91
92
            )
        )
        (:Whitespace
            ""
            ""
        )
93
94
        (text
            "and also special"
95
96
97
98
        )
        (:Whitespace
            " "
        )
99
100
101
        (text_command
            (ESCAPED
                "&"
102
103
104
105
106
            )
        )
        (:Whitespace
            " "
        )
107
108
        (text
            "characters."
109
        )
eckhart's avatar
eckhart committed
110
111
112
        (:Whitespace
            " "
        )
113
114
115
116
117
118
119
120
121
122
123
124
    )

Match-test "3"
--------------

### Test-code:
    Paragraphs are separated only by at least one blank line.
    Therefore,
    this line still belongs to the same paragraph.

### AST
    (paragraph
125
126
127
128
        (text
            "Paragraphs are separated only by at least one blank line."
            "Therefore,"
            "this line still belongs to the same paragraph."
129
        )
eckhart's avatar
eckhart committed
130
131
132
        (:Whitespace
            " "
        )
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    )

Match-test "4"
--------------

### Test-code:
    Paragraphs   % may contain comments
    like the comment above
    % or like thist comment.
    Comment lines do not break paragraphs.
    % There can even be several comment lines,
    % even indented comment lines,
    in sequence.

### AST
    (paragraph
149
150
151
152
153
        (text
            "Paragraphs"
            "like the comment above"
            "Comment lines do not break paragraphs."
            "in sequence."
154
        )
eckhart's avatar
eckhart committed
155
156
157
        (:Whitespace
            " "
        )
158
159
160
161
162
163
164
165
166
167
168
169
    )

Match-test "5"
--------------

### Test-code:
    Paragraphs may contain {\em emphasized} or {\bf bold} text.
    Most of these commands can have different forms as, for example:
    \begin{small} small \end{small} or {\large large}.

### AST
    (paragraph
170
171
        (text
            "Paragraphs may contain"
172
173
174
175
        )
        (:Whitespace
            " "
        )
176
        (block
eckhart's avatar
eckhart committed
177
178
179
            (:Whitespace
                " "
            )
180
181
182
            (generic_command
                (CMDNAME
                    "\em"
183
184
                )
            )
eckhart's avatar
eckhart committed
185
186
187
            (:Whitespace
                " "
            )
188
189
190
            (text
                "emphasized"
            )
eckhart's avatar
eckhart committed
191
192
193
            (:Whitespace
                " "
            )
194
195
196
197
        )
        (:Whitespace
            " "
        )
198
199
        (text
            "or"
200
201
202
203
        )
        (:Whitespace
            " "
        )
204
        (block
eckhart's avatar
eckhart committed
205
206
207
            (:Whitespace
                " "
            )
208
209
210
            (generic_command
                (CMDNAME
                    "\bf"
211
212
                )
            )
eckhart's avatar
eckhart committed
213
214
215
            (:Whitespace
                " "
            )
216
217
218
            (text
                "bold"
            )
eckhart's avatar
eckhart committed
219
220
221
            (:Whitespace
                " "
            )
222
223
224
225
        )
        (:Whitespace
            " "
        )
226
227
228
        (text
            "text."
            "Most of these commands can have different forms as, for example:"
229
230
231
232
233
        )
        (:Whitespace
            ""
            ""
        )
234
235
236
237
238
239
240
241
242
        (generic_inline_env
            (begin_environment
                "small"
            )
            (:Whitespace
                " "
            )
            (paragraph
                (text
243
244
245
246
247
                    "small"
                )
                (:Whitespace
                    " "
                )
248
249
250
            )
            (end_environment
                "small"
251
252
253
254
255
            )
        )
        (:Whitespace
            " "
        )
256
257
        (text
            "or"
258
259
260
261
        )
        (:Whitespace
            " "
        )
262
        (block
eckhart's avatar
eckhart committed
263
264
265
            (:Whitespace
                " "
            )
266
267
268
            (generic_command
                (CMDNAME
                    "\large"
269
270
                )
            )
eckhart's avatar
eckhart committed
271
272
273
            (:Whitespace
                " "
            )
274
            (text
275
                "large"
276
            )
eckhart's avatar
eckhart committed
277
278
279
280
281
282
            (:Whitespace
                " "
            )
        )
        (:Whitespace
            " "
283
        )
284
285
286
        (text
            "."
        )
eckhart's avatar
eckhart committed
287
288
289
        (:Whitespace
            " "
        )
290
291
292
293
294
295
296
297
298
299
    )

Match-test "6"
--------------

### Test-code:
    Paragraphs may also contain {\xy unknown blocks }.

### AST
    (paragraph
300
301
        (text
            "Paragraphs may also contain"
302
303
304
305
        )
        (:Whitespace
            " "
        )
306
        (block
eckhart's avatar
eckhart committed
307
308
309
            (:Whitespace
                " "
            )
310
311
312
            (generic_command
                (CMDNAME
                    "\xy"
313
314
                )
            )
eckhart's avatar
eckhart committed
315
316
317
            (:Whitespace
                " "
            )
318
            (text
319
                "unknown blocks"
320
            )
321
322
323
324
            (:Whitespace
                " "
            )
        )
eckhart's avatar
eckhart committed
325
326
327
        (:Whitespace
            " "
        )
328
329
        (text
            "."
330
        )
eckhart's avatar
eckhart committed
331
332
333
        (:Whitespace
            " "
        )
334
335
336
337
338
339
340
341
342
343
    )

Match-test "7"
--------------

### Test-code:
    Paragraphs may contain \xy[xycgf]{some {\em unbknown}} commands.

### AST
    (paragraph
344
345
        (text
            "Paragraphs may contain"
346
347
348
349
        )
        (:Whitespace
            " "
        )
350
351
352
353
        (generic_command
            (CMDNAME
                "\xy"
            )
eckhart's avatar
eckhart committed
354
355
356
            (:Whitespace
                " "
            )
357
            (config
eckhart's avatar
eckhart committed
358
359
360
361
362
363
364
365
366
                (:Whitespace
                    " "
                )
                (text
                    "xycgf"
                )
            )
            (:Whitespace
                " "
367
368
            )
            (block
eckhart's avatar
eckhart committed
369
370
371
                (:Whitespace
                    " "
                )
372
373
374
375
376
377
378
                (text
                    "some"
                )
                (:Whitespace
                    " "
                )
                (block
eckhart's avatar
eckhart committed
379
380
381
                    (:Whitespace
                        " "
                    )
382
383
384
                    (generic_command
                        (CMDNAME
                            "\em"
385
386
                        )
                    )
eckhart's avatar
eckhart committed
387
388
389
                    (:Whitespace
                        " "
                    )
390
391
                    (text
                        "unbknown"
392
                    )
eckhart's avatar
eckhart committed
393
394
395
396
397
398
                    (:Whitespace
                        " "
                    )
                )
                (:Whitespace
                    " "
399
400
401
402
403
404
                )
            )
        )
        (:Whitespace
            " "
        )
405
406
        (text
            "commands."
407
        )
eckhart's avatar
eckhart committed
408
409
410
        (:Whitespace
            " "
        )
411
412
413
414
415
416
417
418
419
420
421
    )

Match-test "8"
--------------

### Test-code:
    Unknwon \xy commands within paragraphs may be simple
    or \xy{complex}.

### AST
    (paragraph
422
423
        (text
            "Unknwon"
424
425
426
427
        )
        (:Whitespace
            " "
        )
428
429
430
        (generic_command
            (CMDNAME
                "\xy"
431
432
            )
        )
eckhart's avatar
eckhart committed
433
434
435
        (:Whitespace
            " "
        )
436
437
438
        (text
            "commands within paragraphs may be simple"
            "or"
439
440
441
442
        )
        (:Whitespace
            " "
        )
443
444
445
446
        (generic_command
            (CMDNAME
                "\xy"
            )
eckhart's avatar
eckhart committed
447
448
449
450
451
452
453
454
455
456
457
458
459
            (:Whitespace
                " "
            )
            (block
                (:Whitespace
                    " "
                )
                (text
                    "complex"
                )
                (:Whitespace
                    " "
                )
460
461
            )
        )
eckhart's avatar
eckhart committed
462
463
464
        (:Whitespace
            " "
        )
465
466
        (text
            "."
467
        )
eckhart's avatar
eckhart committed
468
469
470
        (:Whitespace
            " "
        )
471
472
473
474
475
476
477
478
479
480
481
482
483
    )

Match-test "9"
--------------

### Test-code:
    paragraphs may contain all of these: \{ escaped \} characters,
    {\bf blocks}, [ brackets ], \begin{tiny} environments \end{tiny}
    and \textbackslash text-commands or other commands like this
    \footnote{footnote}

### AST
    (paragraph
484
485
        (text
            "paragraphs may contain all of these:"
486
487
488
489
        )
        (:Whitespace
            " "
        )
490
491
492
        (text_command
            (ESCAPED
                "{"
493
494
495
496
497
            )
        )
        (:Whitespace
            " "
        )
498
499
        (text
            "escaped"
500
501
502
503
        )
        (:Whitespace
            " "
        )
504
505
506
        (text_command
            (ESCAPED
                "}"
507
508
509
510
511
            )
        )
        (:Whitespace
            " "
        )
512
513
        (text
            "characters,"
514
515
516
517
518
        )
        (:Whitespace
            ""
            ""
        )
519
        (block
eckhart's avatar
eckhart committed
520
521
522
            (:Whitespace
                " "
            )
523
524
525
            (generic_command
                (CMDNAME
                    "\bf"
526
527
                )
            )
eckhart's avatar
eckhart committed
528
529
530
            (:Whitespace
                " "
            )
531
            (text
532
                "blocks"
533
            )
eckhart's avatar
eckhart committed
534
535
536
537
538
539
            (:Whitespace
                " "
            )
        )
        (:Whitespace
            " "
540
        )
541
542
543
        (text
            ","
        )
544
545
546
        (:Whitespace
            " "
        )
547
548
549
        (text_command
            (BRACKETS
                "["
550
551
552
553
554
            )
        )
        (:Whitespace
            " "
        )
555
556
        (text
            "brackets"
557
558
559
560
        )
        (:Whitespace
            " "
        )
561
562
563
        (text_command
            (BRACKETS
                "]"
564
565
            )
        )
eckhart's avatar
eckhart committed
566
567
568
        (:Whitespace
            " "
        )
569
570
        (text
            ","
571
572
573
574
        )
        (:Whitespace
            " "
        )
575
576
577
578
579
580
581
582
583
584
        (generic_inline_env
            (begin_environment
                "tiny"
            )
            (:Whitespace
                " "
            )
            (paragraph
                (text
                    "environments"
585
586
587
588
                )
                (:Whitespace
                    " "
                )
589
590
591
            )
            (end_environment
                "tiny"
592
593
594
595
596
597
            )
        )
        (:Whitespace
            ""
            ""
        )
598
599
        (text
            "and"
600
601
602
603
        )
        (:Whitespace
            " "
        )
604
605
606
        (text_command
            (TXTCOMMAND
                "\textbackslash"
607
608
609
610
611
            )
        )
        (:Whitespace
            " "
        )
612
613
        (text
            "text-commands or other commands like this"
614
615
616
617
618
        )
        (:Whitespace
            ""
            ""
        )
619
620
        (footnote
            (block_of_paragraphs
eckhart's avatar
eckhart committed
621
622
                (text
                    "footnote"
623
                )
eckhart's avatar
eckhart committed
624
625
626
                (:Whitespace
                    " "
                )
627
628
            )
        )
eckhart's avatar
eckhart committed
629
630
631
        (:Whitespace
            " "
        )
632
633
634
635
636
637
638
639
640
641
642
    )

Match-test "10"
---------------

### Test-code:
    \begin{generic}inline environment\end{generic}
    

### AST
    (paragraph
643
644
645
646
        (generic_inline_env
            (begin_environment
                "generic"
            )
eckhart's avatar
eckhart committed
647
648
649
            (:Whitespace
                " "
            )
650
651
652
            (paragraph
                (text
                    "inline environment"
653
                )
eckhart's avatar
eckhart committed
654
655
656
                (:Whitespace
                    " "
                )
657
            )
658
659
660
            (end_environment
                "generic"
            )
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
        )
        (:Whitespace
            ""
            ""
        )
    )

Match-test "11"
---------------

### Test-code:
    \begin{generic}inline environment
    \end{generic}
    

### AST
    (paragraph
678
679
680
681
        (generic_inline_env
            (begin_environment
                "generic"
            )
eckhart's avatar
eckhart committed
682
683
684
            (:Whitespace
                " "
            )
685
686
687
            (paragraph
                (text
                    "inline environment"
688
                )
689
690
691
                (:Whitespace
                    ""
                    ""
692
693
                )
            )
694
695
696
            (end_environment
                "generic"
            )
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
        )
        (:Whitespace
            ""
            ""
        )
    )

Fail-test "20"
--------------

### Test-code:
    Paragraphs are separated by gaps.
    
    Like this one.

Fail-test "21"
--------------

### Test-code:
    \begin{enumerate}

Fail-test "22"
--------------

### Test-code:
    \item

Fail-test "23"
--------------

### Test-code:
    und Vieh; \paragraph

Fail-test "24"
--------------

### Test-code:
    Paragraphs will end
    \begin{quotation}
    at block environments
    \end{quotation}
    like block quotes.


Test of parser: "sequence"
==========================


Match-test "1"
--------------

### Test-code:
    Paragraphs are separated by gaps.
    
    Like this one.

### AST
    (sequence
        (paragraph
756
757
            (text
                "Paragraphs are separated by gaps."
758
            )
eckhart's avatar
eckhart committed
759
760
761
            (:Whitespace
                " "
            )
762
763
        )
        (paragraph
764
765
            (text
                "Like this one."
766
            )
eckhart's avatar
eckhart committed
767
768
769
            (:Whitespace
                " "
            )
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
        )
    )

Match-test "2"
--------------

### Test-code:
    The second paragraph follows after a long gap.
    
    
    The parser should accept this, too.

### AST
    (sequence
        (paragraph
785
786
            (text
                "The second paragraph follows after a long gap."
787
            )
eckhart's avatar
eckhart committed
788
789
790
            (:Whitespace
                " "
            )
791
792
        )
        (paragraph
793
794
            (text
                "The parser should accept this, too."
795
            )
eckhart's avatar
eckhart committed
796
797
798
            (:Whitespace
                " "
            )
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
        )
    )

Match-test "3"
--------------

### Test-code:
    Paragraphs can be delimited by  % comment
    
    % sequences of separators
    
    % and comments
    % or sequences of comment lines
    
    In the end such a sequence counts
    % merely as one comment

### AST
    (sequence
        (paragraph
819
820
            (text
                "Paragraphs can be delimited by"
821
822
823
824
825
826
827
            )
            (:Whitespace
                ""
                ""
            )
        )
        (paragraph
828
829
            (text
                "In the end such a sequence counts"
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
            )
            (:Whitespace
                ""
                ""
            )
        )
    )

Match-test "4"
--------------

### Test-code:
    Sequences of paragraphs may
    \begin{quotation}
    include block environments
    \end{quotation}
    like block quotes.

### AST
    (sequence
        (paragraph
851
852
            (text
                "Sequences of paragraphs may"
853
854
855
856
857
858
859
            )
            (:Whitespace
                ""
                ""
            )
        )
        (quotation
eckhart's avatar
eckhart committed
860
861
862
863
864
865
866
            (paragraph
                (text
                    "include block environments"
                )
                (:Whitespace
                    ""
                    ""
867
868
869
870
                )
            )
        )
        (paragraph
871
872
            (text
                "like block quotes."
873
            )
eckhart's avatar
eckhart committed
874
875
876
            (:Whitespace
                " "
            )
877
878
        )
    )