summaryrefslogtreecommitdiff
path: root/dhall_syntax/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_syntax/src/parser.rs')
-rw-r--r--dhall_syntax/src/parser.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs
index fac6ecc..b1e429b 100644
--- a/dhall_syntax/src/parser.rs
+++ b/dhall_syntax/src/parser.rs
@@ -30,7 +30,7 @@ pub type ParseResult<T> = Result<T, ParseError>;
#[derive(Debug, Clone)]
struct ParseInput<'input, Rule>
where
- Rule: std::fmt::Debug + Copy + std::hash::Hash + Ord,
+ Rule: pest::RuleType,
{
pair: Pair<'input, Rule>,
original_input_str: Rc<str>,
@@ -70,6 +70,11 @@ impl<'input> ParseInput<'input, Rule> {
}
}
+// Used to retrieve the `Rule` enum associated with the `Self` type in `parse_children`.
+trait PestConsumer {
+ type RuleEnum: pest::RuleType;
+}
+
fn debug_pair(pair: Pair<Rule>) -> String {
use std::fmt::Write;
let mut s = String::new();
@@ -226,7 +231,7 @@ lazy_static::lazy_static! {
struct Parsers;
-#[make_parser]
+#[make_parser(Rule)]
impl Parsers {
fn EOI(_: ParseInput<Rule>) -> ParseResult<()> {
Ok(())