#match -> @match for errors

This commit is contained in:
Wim Looman 2016-02-10 11:47:22 +01:00
parent f35707cce0
commit 1d23d5f4c1

View file

@ -334,7 +334,7 @@ impl<'cx, 'i> Parser<'cx, 'i> {
self.shift(1); self.shift(1);
match_var.push(tt.clone()); match_var.push(tt.clone());
}, },
[] => parse_error!(self, sp, "expected body for this #match"), [] => parse_error!(self, sp, "expected body for this @match"),
}} }}
let match_var = try!(self.with_rust_parser(match_var, RustParser::parse_expr)); let match_var = try!(self.with_rust_parser(match_var, RustParser::parse_expr));
self.render.emit_match(match_var, match_bodies); self.render.emit_match(match_var, match_bodies);
@ -370,7 +370,7 @@ impl<'cx, 'i> Parser<'cx, 'i> {
self.shift(1); self.shift(1);
body.push(tt.clone()); body.push(tt.clone());
}, },
_ => parse_error!(self, sp, "invalid #match pattern"), _ => parse_error!(self, sp, "invalid @match pattern"),
}} }}
let mut expr = Vec::new(); let mut expr = Vec::new();
loop { match self.input { loop { match self.input {
@ -386,7 +386,7 @@ impl<'cx, 'i> Parser<'cx, 'i> {
}, },
[comma!(), ..] | [] => { [comma!(), ..] | [] => {
if expr.is_empty() { if expr.is_empty() {
parse_error!(self, sp, "expected body for this #match arm"); parse_error!(self, sp, "expected body for this @match arm");
} else { } else {
expr = try!(self.block(sp, &expr)).to_tokens(self.render.cx); expr = try!(self.block(sp, &expr)).to_tokens(self.render.cx);
break; break;