summaryrefslogtreecommitdiff
path: root/dhall_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_syntax/src')
-rw-r--r--dhall_syntax/src/lib.rs1
-rw-r--r--dhall_syntax/src/parser.rs9
2 files changed, 8 insertions, 2 deletions
diff --git a/dhall_syntax/src/lib.rs b/dhall_syntax/src/lib.rs
index fb12af4..1636c8b 100644
--- a/dhall_syntax/src/lib.rs
+++ b/dhall_syntax/src/lib.rs
@@ -3,6 +3,7 @@
#![feature(try_blocks)]
#![feature(never_type)]
#![feature(proc_macro_hygiene)]
+#![feature(type_alias_enum_variants)]
#![allow(
clippy::many_single_char_names,
clippy::should_implement_trait,
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(())