summaryrefslogtreecommitdiff
path: root/dhall_syntax/src
diff options
context:
space:
mode:
authorNadrieril2019-09-10 14:51:37 +0200
committerNadrieril2019-09-10 14:51:37 +0200
commit9f41dc5a4680cba3697c64da28855c8d4f437191 (patch)
treee190bdf29be0a6cf094b8789d0567a12c43ba5b2 /dhall_syntax/src
parent97f163475294a12f485a6c398df648ad0eeeca8c (diff)
Implement parsing in PestConsumer
Diffstat (limited to '')
-rw-r--r--dhall_syntax/src/parser.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs
index a83b8d0..a783f77 100644
--- a/dhall_syntax/src/parser.rs
+++ b/dhall_syntax/src/parser.rs
@@ -2,11 +2,10 @@ use itertools::Itertools;
use pest::iterators::Pair;
use pest::prec_climber as pcl;
use pest::prec_climber::PrecClimber;
-use pest::Parser;
use std::rc::Rc;
use dhall_generated_parser::{DhallParser, Rule};
-use pest_consume::{make_parser, match_inputs};
+use pest_consume::{make_parser, match_inputs, PestConsumer};
use crate::map::{DupTreeMap, DupTreeSet};
use crate::ExprF::*;
@@ -21,8 +20,6 @@ type ParsedText<E> = InterpolatedText<Expr<E>>;
type ParsedTextContents<E> = InterpolatedTextContents<Expr<E>>;
type ParseInput<'input, 'data> =
pest_consume::ParseInput<'input, 'data, Rule, Rc<str>>;
-type ParseInputs<'input, 'data> =
- pest_consume::ParseInputs<'input, 'data, Rule, Rc<str>>;
pub type ParseError = pest::error::Error<Rule>;
pub type ParseResult<T> = Result<T, ParseError>;
@@ -152,13 +149,16 @@ lazy_static::lazy_static! {
struct Parsers;
-#[make_parser(Rule)]
+#[make_parser(DhallParser, Rule)]
impl Parsers {
#[entrypoint]
fn entrypoint<E: Clone>(input_str: &str) -> ParseResult<Expr<E>> {
- let pairs = DhallParser::parse(Rule::final_expression, input_str)?;
let rc_input_str = input_str.to_string().into();
- let inputs = ParseInputs::new(input_str, pairs, &rc_input_str);
+ let inputs = Self::parse_with_userdata(
+ Rule::final_expression,
+ input_str,
+ &rc_input_str,
+ )?;
Ok(match_inputs!(inputs;
[expression(e)] => e,
))