diff options
| author | bors <bors@rust-lang.org> | 2016-01-06 20:30:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-01-06 20:30:55 +0000 |
| commit | 5daa75373d870f255923aed37d99db73a661bd51 (patch) | |
| tree | b710e88ec637e966bd24234e357ccb7ec68f5f45 /src/libsyntax/ext | |
| parent | e8c337b5ca883285e6215f1f669d5556842d1520 (diff) | |
| parent | 9023c659af8a43dd5e284d7b311e5f19721c9bd8 (diff) | |
Auto merge of #30654 - nrc:panictry, r=brson
The motivation (other than removing boilerplate) is that this is a baby step towards a parser with error recovery. [breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index fc0f1925207..107626c54cc 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -826,7 +826,7 @@ pub fn get_exprs_from_tts(cx: &mut ExtCtxt, let mut es = Vec::new(); while p.token != token::Eof { es.push(cx.expander().fold_expr(panictry!(p.parse_expr()))); - if panictry!(p.eat(&token::Comma)){ + if p.eat(&token::Comma) { continue; } if p.token != token::Eof { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 7a1a207a562..bc7dc67e1ba 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -801,7 +801,7 @@ fn parse_arguments_to_quote(cx: &ExtCtxt, tts: &[TokenTree]) p.quote_depth += 1; let cx_expr = panictry!(p.parse_expr()); - if !panictry!(p.eat(&token::Comma)) { + if !p.eat(&token::Comma) { let _ = p.diagnostic().fatal("expected token `,`"); } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 166d32a8cc6..ae8ab054105 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -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) } _ => { diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 38e6c21375c..c61b91df092 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -47,7 +47,7 @@ impl<'a> ParserAnyMacro<'a> { fn ensure_complete_parse(&self, allow_semi: bool, context: &str) { let mut parser = self.parser.borrow_mut(); if allow_semi && parser.token == token::Semi { - panictry!(parser.bump()) + parser.bump(); } if parser.token != token::Eof { let token_str = parser.this_token_to_string(); @@ -194,7 +194,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, imported_from, rhs); let mut p = Parser::new(cx.parse_sess(), cx.cfg(), Box::new(trncbr)); - panictry!(p.check_unknown_macro_variable()); + p.check_unknown_macro_variable(); // Let the context choose how to interpret the result. // Weird, but useful for X-macros. return Box::new(ParserAnyMacro { |
