libsyntax: change Parser::unexpected_last to take &Token
This commit is contained in:
parent
28691a0852
commit
34c02a6c0e
2 changed files with 4 additions and 4 deletions
|
@ -51,12 +51,12 @@ pub fn token_to_str(reader: reader, token: &token::Token) -> ~str {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub impl Parser {
|
pub impl Parser {
|
||||||
fn unexpected_last(t: token::Token) -> ! {
|
fn unexpected_last(t: &token::Token) -> ! {
|
||||||
self.span_fatal(
|
self.span_fatal(
|
||||||
*self.last_span,
|
*self.last_span,
|
||||||
fmt!(
|
fmt!(
|
||||||
"unexpected token: `%s`",
|
"unexpected token: `%s`",
|
||||||
token_to_str(self.reader, &t)
|
token_to_str(self.reader, t)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -634,7 +634,7 @@ pub impl Parser {
|
||||||
|p| p.parse_ty_field()
|
|p| p.parse_ty_field()
|
||||||
);
|
);
|
||||||
if elems.len() == 0 {
|
if elems.len() == 0 {
|
||||||
self.unexpected_last(token::RBRACE);
|
self.unexpected_last(&token::RBRACE);
|
||||||
}
|
}
|
||||||
ty_rec(elems)
|
ty_rec(elems)
|
||||||
} else if *self.token == token::LBRACKET {
|
} else if *self.token == token::LBRACKET {
|
||||||
|
@ -868,7 +868,7 @@ pub impl Parser {
|
||||||
lit_float_unsuffixed(self.id_to_str(s)),
|
lit_float_unsuffixed(self.id_to_str(s)),
|
||||||
token::LIT_STR(s) => lit_str(self.id_to_str(s)),
|
token::LIT_STR(s) => lit_str(self.id_to_str(s)),
|
||||||
token::LPAREN => { self.expect(&token::RPAREN); lit_nil },
|
token::LPAREN => { self.expect(&token::RPAREN); lit_nil },
|
||||||
_ => { self.unexpected_last(*tok); }
|
_ => { self.unexpected_last(tok); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue