Work towards a non-panicing parser (libsyntax)
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
This commit is contained in:
parent
f73f3233f1
commit
b2bcb7229a
23 changed files with 1412 additions and 1315 deletions
|
@ -117,11 +117,11 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree
|
|||
while self.p.token != token::Eof {
|
||||
match self.p.parse_item() {
|
||||
Some(item) => ret.push(item),
|
||||
None => self.p.span_fatal(
|
||||
None => panic!(self.p.span_fatal(
|
||||
self.p.span,
|
||||
&format!("expected item, found `{}`",
|
||||
self.p.this_token_to_string())
|
||||
)
|
||||
))
|
||||
}
|
||||
}
|
||||
Some(ret)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue