aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/mod.rs')
-rw-r--r--src/parser/mod.rs34
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);
+}