diff options
author | Nadrieril | 2019-08-16 10:39:15 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-26 21:24:54 +0200 |
commit | 0fa94400492c08c3a38ae6798a0caeab23da5287 (patch) | |
tree | 573010ce302e6bec592d9542a548e45e05b47657 | |
parent | 8eb169713ea1220f2d515391c08d34509d75ab73 (diff) |
Remove rule_group macro
Diffstat (limited to '')
-rw-r--r-- | dhall_syntax/src/parser.rs | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs index 366103e..b443656 100644 --- a/dhall_syntax/src/parser.rs +++ b/dhall_syntax/src/parser.rs @@ -120,13 +120,6 @@ fn debug_pair(pair: Pair<Rule>) -> String { } macro_rules! make_parser { - (@pattern, rule, $name:ident) => (Rule::$name); - (@pattern, token_rule, $name:ident) => (Rule::$name); - (@pattern, rule_group, $name:ident) => (_); - (@filter, rule) => (true); - (@filter, token_rule) => (true); - (@filter, rule_group) => (false); - (@child_pattern, $varpat:ident, ($($acc:tt)*), @@ -193,9 +186,6 @@ macro_rules! make_parser { ) => ({ Rule::$name }); - (@rule_alias, rule_group!( $name:ident<$o:ty> )) => ( - unreachable!() - ); (@body, ($climbers:expr, $input:expr, $pair:expr), @@ -330,9 +320,6 @@ macro_rules! make_parser { ) => ({ Ok(ParsedValue::$name(())) }); - (@body, ($($things:tt)*), rule_group!( $name:ident<$o:ty> )) => ( - unreachable!() - ); (@construct_climber, ($map:expr), @@ -381,11 +368,9 @@ macro_rules! make_parser { fn rule_alias(r: Rule) -> Rule { match r { $( - make_parser!(@pattern, $submac, $name) - if make_parser!(@filter, $submac) - => make_parser!(@rule_alias, - $submac!( $name<$o> $($args)* )) - , + Rule::$name => { + make_parser!(@rule_alias, $submac!($name<$o> $($args)*)) + } )* r => r, } @@ -417,10 +402,7 @@ macro_rules! make_parser { match pair.as_rule() { $( - make_parser!(@pattern, $submac, $name) - if make_parser!(@filter, $submac) - => Parsers::$name(climbers, input, pair) - , + Rule::$name => Parsers::$name(climbers, input, pair), )* r => Err(custom_parse_error(&pair, format!("Unexpected {:?}", r))), } |