Don't use panicking helpers in Parser.
This commit is contained in:
parent
f7172490f8
commit
1dd87dcfea
9 changed files with 26 additions and 25 deletions
|
@ -503,18 +503,18 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal {
|
|||
// check at the beginning and the parser checks after each bump
|
||||
panictry!(p.check_unknown_macro_variable());
|
||||
match name {
|
||||
"item" => match p.parse_item() {
|
||||
"item" => match panictry!(p.parse_item_nopanic()) {
|
||||
Some(i) => token::NtItem(i),
|
||||
None => panic!(p.fatal("expected an item keyword"))
|
||||
},
|
||||
"block" => token::NtBlock(panictry!(p.parse_block())),
|
||||
"stmt" => match p.parse_stmt() {
|
||||
"stmt" => match panictry!(p.parse_stmt_nopanic()) {
|
||||
Some(s) => token::NtStmt(s),
|
||||
None => panic!(p.fatal("expected a statement"))
|
||||
},
|
||||
"pat" => token::NtPat(p.parse_pat()),
|
||||
"expr" => token::NtExpr(p.parse_expr()),
|
||||
"ty" => token::NtTy(p.parse_ty()),
|
||||
"pat" => token::NtPat(panictry!(p.parse_pat_nopanic())),
|
||||
"expr" => token::NtExpr(panictry!(p.parse_expr_nopanic())),
|
||||
"ty" => token::NtTy(panictry!(p.parse_ty_nopanic())),
|
||||
// this could be handled like a token, since it is one
|
||||
"ident" => match p.token {
|
||||
token::Ident(sn,b) => { panictry!(p.bump()); token::NtIdent(Box::new(sn),b) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue