aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser/mod.rs
diff options
context:
space:
mode:
authorPhilipp A2018-10-29 11:19:47 +0100
committerPhilipp A2018-10-29 11:19:47 +0100
commit08c373c48fed56d99759d54588081aefa297af3c (patch)
tree0c1e80c86ee2f8b8b69d6be26e2a8a65a1420088 /src/parser/mod.rs
parent11050075b4a97a51714c61f4e174d6ea85b793e5 (diff)
downloadrust-rst-08c373c48fed56d99759d54588081aefa297af3c.tar.bz2
added parser module
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);
+}