diff options
author | Nadrieril | 2019-09-06 18:17:36 +0200 |
---|---|---|
committer | Nadrieril | 2019-09-09 12:50:11 +0200 |
commit | 0388d9858627693bab2433f134eb4ed1d6e9b164 (patch) | |
tree | 6684345ef23870eee47bc737cd3b65ddc6fb579e /dhall_proc_macros | |
parent | 2f6f21c52e60c560eb4c5fff9441b7d20c8c1d9a (diff) |
Make ParseInput independent from dhall-specific types
Diffstat (limited to 'dhall_proc_macros')
-rw-r--r-- | dhall_proc_macros/src/make_parser.rs | 8 | ||||
-rw-r--r-- | dhall_proc_macros/src/parse_children.rs | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/dhall_proc_macros/src/make_parser.rs b/dhall_proc_macros/src/make_parser.rs index a17ab61..c0594a5 100644 --- a/dhall_proc_macros/src/make_parser.rs +++ b/dhall_proc_macros/src/make_parser.rs @@ -179,7 +179,7 @@ fn apply_special_attrs(f: &mut ParsedFn, rule_enum: &Ident) -> Result<()> { #function #climber.climb( - #input_arg.pair.clone().into_inner(), + #input_arg.as_pair().clone().into_inner(), |p| Self::#child_rule(#input_arg.with_pair(p)), |l, op, r| { #fn_name(#input_arg.clone(), l?, op, r?) @@ -207,9 +207,9 @@ fn apply_special_attrs(f: &mut ParsedFn, rule_enum: &Ident) -> Result<()> { let mut #input_arg = #input_arg; // While the current rule allows shortcutting, and there is a single child, and the // child can still be parsed by the current function, then skip to that child. - while <Self as PestConsumer>::allows_shortcut(#input_arg.as_rule()) { + while <Self as pest_consume::PestConsumer>::allows_shortcut(#input_arg.as_rule()) { if let Some(child) = #input_arg.single_child() { - if &<Self as PestConsumer>::rule_alias(child.as_rule()) + if &<Self as pest_consume::PestConsumer>::rule_alias(child.as_rule()) == stringify!(#fn_name) { #input_arg = child; continue; @@ -313,7 +313,7 @@ pub fn make_parser( let ty = &imp.self_ty; let (impl_generics, _, where_clause) = imp.generics.split_for_impl(); Ok(quote!( - impl #impl_generics PestConsumer for #ty #where_clause { + impl #impl_generics pest_consume::PestConsumer for #ty #where_clause { type Rule = #rule_enum; fn rule_alias(rule: Self::Rule) -> String { match rule { diff --git a/dhall_proc_macros/src/parse_children.rs b/dhall_proc_macros/src/parse_children.rs index a35c03f..d6474a7 100644 --- a/dhall_proc_macros/src/parse_children.rs +++ b/dhall_proc_macros/src/parse_children.rs @@ -186,11 +186,11 @@ pub fn parse_children( .collect::<Result<Vec<_>>>()?; Ok(quote!({ - let #i_children_rules: Vec<_> = #input_expr.pair + let #i_children_rules: Vec<_> = #input_expr.as_pair() .clone() .into_inner() .map(|p| p.as_rule()) - .map(<Self as PestConsumer>::rule_alias) + .map(<Self as pest_consume::PestConsumer>::rule_alias) .collect(); let #i_children_rules: Vec<&str> = #i_children_rules .iter() @@ -199,7 +199,7 @@ pub fn parse_children( #[allow(unused_mut)] let mut #i_inputs = #input_expr - .pair + .as_pair() .clone() .into_inner() .map(|p| #input_expr.with_pair(p)); |