Cut out a bunch of Result and panictry! boilerplate from libsyntax.

[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
This commit is contained in:
Nick Cameron 2015-12-31 12:11:53 +13:00
parent efb5a9a9f0
commit 9023c659af
12 changed files with 318 additions and 313 deletions

View file

@ -512,7 +512,7 @@ pub fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal {
_ => {}
}
// check at the beginning and the parser checks after each bump
panictry!(p.check_unknown_macro_variable());
p.check_unknown_macro_variable();
match name {
"item" => match panictry!(p.parse_item()) {
Some(i) => token::NtItem(i),
@ -535,7 +535,7 @@ pub fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal {
// this could be handled like a token, since it is one
"ident" => match p.token {
token::Ident(sn,b) => {
panictry!(p.bump());
p.bump();
token::NtIdent(Box::new(Spanned::<Ident>{node: sn, span: p.span}),b)
}
_ => {