aboutsummaryrefslogtreecommitdiff
path: root/src/grammar/expressions/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/grammar/expressions/mod.rs')
-rw-r--r--src/grammar/expressions/mod.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/grammar/expressions/mod.rs b/src/grammar/expressions/mod.rs
index a94964c39..55e965ff4 100644
--- a/src/grammar/expressions/mod.rs
+++ b/src/grammar/expressions/mod.rs
@@ -92,17 +92,20 @@ fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) {
92 }; 92 };
93 93
94 loop { 94 loop {
95 let is_range = p.current() == DOTDOT;
95 let (op_bp, op) = current_op(p); 96 let (op_bp, op) = current_op(p);
96 if op_bp < bp { 97 if op_bp < bp {
97 break; 98 break;
98 } 99 }
100 let m = lhs.precede(p);
99 match op { 101 match op {
100 Op::Simple => p.bump(), 102 Op::Simple => p.bump(),
101 Op::Composite(kind, n) => { 103 Op::Composite(kind, n) => {
102 p.bump_compound(kind, n); 104 p.bump_compound(kind, n);
103 } 105 }
104 } 106 }
105 lhs = bin_expr(p, r, lhs, op_bp + 1); 107 expr_bp(p, r, op_bp + 1);
108 lhs = m.complete(p, if is_range { RANGE_EXPR } else { BIN_EXPR });
106 } 109 }
107} 110}
108 111
@@ -330,9 +333,3 @@ fn struct_lit(p: &mut Parser) {
330 } 333 }
331 p.expect(R_CURLY); 334 p.expect(R_CURLY);
332} 335}
333
334fn bin_expr(p: &mut Parser, r: Restrictions, lhs: CompletedMarker, bp: u8) -> CompletedMarker {
335 let m = lhs.precede(p);
336 expr_bp(p, r, bp);
337 m.complete(p, BIN_EXPR)
338}