| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 | pub mod token;
#[allow(unused_imports)]
use pest::consumes_to;
#[allow(unused_imports)]
use pest::parses_to;
use pest_derive::*;
#[derive(Parser)]
#[grammar = "rst.pest"]
pub struct RstParser;
#[test]
fn plain() {
    parses_to! {
        parser: RstParser,
        input:  "line\n",
        rule:   Rule::plain,
        tokens: [
            plain(0, 5, [
                inlines(0, 5, [
                    inline(0, 4, [str(0, 4)]),
                    EOI(5, 5)
                ])
            ])
        ]
    };
}
#[test]
fn title() {
    parses_to! {
        parser: RstParser,
        input:  "\
Title
=====
",
        rule:   Rule::heading,
        tokens: [
            heading(0, 12, [
                inline(0, 5, [str(0, 5)]),
                setext_bottom(6, 12),
            ])
        ]
    };
}
#[test]
fn heading_title() {
    parses_to! {
        parser: RstParser,
        input:  "\
-----
Title
-----
",
        rule:   Rule::heading_title,
        tokens: [
            heading_title(0, 18, [
                setext_bottom(0, 6),
                inline(6, 11, [str(6, 11)]),
                setext_bottom(12, 18),
            ])
        ]
    };
}
 |