1
1
use nom:: {
2
2
alt, call, complete, many0, map, named, one_of, opt, separated_nonempty_list, tag, terminated,
3
- value , IResult ,
3
+ IResult ,
4
4
} ;
5
5
6
6
use super :: ident:: * ;
@@ -84,14 +84,12 @@ macro_rules! bin_ltr_expr {
84
84
} ;
85
85
}
86
86
87
- macro_rules! bin_rtl_expr {
87
+ macro_rules! assign_rtl_expr {
88
88
( $cur: ident, $op_parser: ident, $lower: ident) => {
89
89
pub fn $cur( input: & str ) -> IResult <& str , Expr > {
90
90
dbg!( input) ;
91
91
let ( sliced, init) = $lower( input) ?;
92
92
93
- use nom:: fold_many0;
94
-
95
93
let ( left, terms) = many0!( sliced, complete!( mrws!( tuple!( $op_parser, $lower) ) ) ) ?;
96
94
97
95
let ret = match terms
@@ -101,15 +99,15 @@ macro_rules! bin_rtl_expr {
101
99
None => Some ( ( op, term) ) ,
102
100
Some ( ( cop, dec) ) => Some ( (
103
101
op,
104
- Expr :: BinaryOp {
102
+ Expr :: Assign {
105
103
op: cop. into( ) ,
106
104
lhs: Box :: new( term) ,
107
105
rhs: Box :: new( dec) ,
108
106
} ,
109
107
) ) ,
110
108
} ) {
111
109
None => init,
112
- Some ( ( cop, dec) ) => Expr :: BinaryOp {
110
+ Some ( ( cop, dec) ) => Expr :: Assign {
113
111
op: cop. into( ) ,
114
112
lhs: Box :: new( init) ,
115
113
rhs: Box :: new( dec) ,
@@ -133,7 +131,7 @@ bin_ltr_expr!(logical_t3_expr, logical_op_t3, logical_t2_expr);
133
131
134
132
// logical_t3_expr falls through compound_assign_expr
135
133
named ! ( pub t8_expr<& str , Expr >, call!( compound_assign_expr) ) ;
136
- bin_rtl_expr ! ( compound_assign_expr, compound_assign, logical_t3_expr) ;
134
+ assign_rtl_expr ! ( compound_assign_expr, compound_assign, logical_t3_expr) ;
137
135
138
136
named ! ( pub expr_without_block<& str , Expr >, alt!(
139
137
cont_expr
0 commit comments