summaryrefslogtreecommitdiff
path: root/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/parser.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/parser.rs b/src/parser.rs
index a0281f4..057fce2 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -13,13 +13,9 @@ pub fn parse_expr(s: &str) -> Result<BoxExpr, ParseError> {
use pest::Parser;
use pest::error::Error;
-use pest_derive::*;
-
-#[derive(Parser)]
-#[grammar = "dhall.pest"]
-struct DhallParser;
-
use pest::iterators::Pair;
+use crate::generated_parser::{DhallParser, Rule};
+
fn debug_pair(pair: Pair<Rule>) {
fn aux(indent: usize, pair: Pair<Rule>) {
let indent_str = "| ".repeat(indent);
@@ -61,11 +57,11 @@ pub fn parse_expr_pest(s: &str) -> Result<BoxExpr, Error<Rule>> {
fn test_parse() {
use crate::core::Expr::*;
let expr = "((22 + 3) * 10)";
+ println!("{:?}", parse_expr(expr));
match parse_expr_pest(expr) {
Err(e) => println!("{}", e),
ok => println!("{:?}", ok),
}
- println!("{:?}", parse_expr(expr));
assert_eq!(parse_expr_pest(expr).unwrap(), parse_expr(expr).unwrap());
assert!(false);