diff options
| author | Philipp A | 2018-10-29 11:19:47 +0100 |
|---|---|---|
| committer | Philipp A | 2018-10-29 11:19:47 +0100 |
| commit | 08c373c48fed56d99759d54588081aefa297af3c (patch) | |
| tree | 0c1e80c86ee2f8b8b69d6be26e2a8a65a1420088 /src/parser/mod.rs | |
| parent | 11050075b4a97a51714c61f4e174d6ea85b793e5 (diff) | |
| download | rust-rst-08c373c48fed56d99759d54588081aefa297af3c.tar.bz2 | |
added parser module
Diffstat (limited to 'src/parser/mod.rs')
| -rw-r--r-- | src/parser/mod.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 79c66ba..07a2278 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -1 +1,35 @@ pub mod token; + +#[derive(Parser)] +#[grammar = "rst.pest"] +pub struct RstParser; + + + +#[test] +fn line() { + use pest::Parser; + let result = RstParser::parse(Rule::plain, &"line\n").expect("unsuccessful parse").next().unwrap(); + eprintln!("{}", result); +} + +#[test] +fn title() { + use pest::Parser; + let result = RstParser::parse(Rule::heading, &"\ +Title +===== +").expect("unsuccessful parse").next().unwrap(); + eprintln!("{}", result); +} + +#[test] +fn heading_title() { + use pest::Parser; + let result = RstParser::parse(Rule::heading_title, &"\ +----- +Title +----- +").expect("unsuccessful parse").next().unwrap(); + eprintln!("{}", result); +} |
