summaryrefslogtreecommitdiff
path: root/pest_consume_macros
diff options
context:
space:
mode:
authorNadrieril2019-09-11 22:42:15 +0200
committerNadrieril2019-09-11 22:42:15 +0200
commit80bd718677080227f7b2e26744456cb13debca27 (patch)
tree5ec397012fbfe65192c07c16c7fd20a6bd73e2db /pest_consume_macros
parentf4f83af7831c309923feaf453069a6a75e181084 (diff)
Various tweaks
Diffstat (limited to 'pest_consume_macros')
-rw-r--r--pest_consume_macros/src/make_parser.rs18
-rw-r--r--pest_consume_macros/src/match_nodes.rs6
2 files changed, 12 insertions, 12 deletions
diff --git a/pest_consume_macros/src/make_parser.rs b/pest_consume_macros/src/make_parser.rs
index 2ed3271..c30b12f 100644
--- a/pest_consume_macros/src/make_parser.rs
+++ b/pest_consume_macros/src/make_parser.rs
@@ -261,7 +261,7 @@ fn apply_special_attrs(f: &mut ParsedFn, rule_enum: &Path) -> Result<()> {
// 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_ty::allows_shortcut(#input_arg.as_rule()) {
- if let Some(child) = #input_arg.single_child() {
+ if let ::std::option::Option::Some(child) = #input_arg.single_child() {
if child.as_aliased_rule::<Self>() == #self_ty::AliasedRule::#fn_name {
#input_arg = child;
continue;
@@ -273,9 +273,9 @@ fn apply_special_attrs(f: &mut ParsedFn, rule_enum: &Path) -> Result<()> {
match #input_arg.as_rule() {
#(#rule_enum::#aliases => Self::#aliases(#input_arg),)*
#rule_enum::#fn_name => #block,
- r => unreachable!(
+ r => ::std::unreachable!(
"make_parser: called {} on {:?}",
- stringify!(#fn_name),
+ ::std::stringify!(#fn_name),
r
)
}
@@ -349,14 +349,14 @@ pub fn make_parser(
#(#rule_enum::#srcs => Self::#srcs(#input_arg),)*
// We can't match on #rule_enum::#tgt since `tgt` might be an arbitrary
// identifier.
- r if &format!("{:?}", r) == stringify!(#tgt) =>
- return Err(#input_arg.error(format!(
+ r if &::std::format!("{:?}", r) == ::std::stringify!(#tgt) =>
+ return ::std::result::Result::Err(#input_arg.error(::std::format!(
"make_parser: missing method for rule {}",
- stringify!(#tgt),
+ ::std::stringify!(#tgt),
))),
- r => unreachable!(
+ r => ::std::unreachable!(
"make_parser: called {} on {:?}",
- stringify!(#tgt),
+ ::std::stringify!(#tgt),
r
)
}
@@ -383,7 +383,7 @@ pub fn make_parser(
match rule {
#(#rule_alias_branches)*
// TODO: return a proper error ?
- r => unreachable!("Rule {:?} does not have a corresponding parsing method", r),
+ r => ::std::unreachable!("Rule {:?} does not have a corresponding parsing method", r),
}
}
fn allows_shortcut(rule: Self::Rule) -> bool {
diff --git a/pest_consume_macros/src/match_nodes.rs b/pest_consume_macros/src/match_nodes.rs
index 251b7ef..4d9fd52 100644
--- a/pest_consume_macros/src/match_nodes.rs
+++ b/pest_consume_macros/src/match_nodes.rs
@@ -173,7 +173,7 @@ fn make_parser_branch(
parses.push(quote!(
let #binder = #i_inputs
.map(|i| #parser::#rule_name(i))
- .collect::<Result<Vec<_>, _>>()?
+ .collect::<::std::result::Result<::std::vec::Vec<_>, _>>()?
.into_iter();
))
}
@@ -210,8 +210,8 @@ pub fn match_nodes(
#[allow(unreachable_code)]
match #i_input_rules.as_slice() {
#(#branches,)*
- [..] => return Err(#i_inputs.error(
- format!("Unexpected children: {:?}", #i_input_rules)
+ [..] => return ::std::result::Result::Err(#i_inputs.error(
+ std::format!("Unexpected children: {:?}", #i_input_rules)
)),
}
}))