Rename _nopanic methods to remove the suffix.
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
This commit is contained in:
@@ -79,7 +79,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
cx.span_err(sp, "malformed inline assembly");
|
||||
return DummyResult::expr(sp);
|
||||
}
|
||||
let (s, style) = match expr_to_string(cx, panictry!(p.parse_expr_nopanic()),
|
||||
let (s, style) = match expr_to_string(cx, panictry!(p.parse_expr()),
|
||||
"inline assembly must be a string literal") {
|
||||
Some((s, st)) => (s, st),
|
||||
// let compilation continue
|
||||
@@ -102,7 +102,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
let span = p.last_span;
|
||||
|
||||
panictry!(p.expect(&token::OpenDelim(token::Paren)));
|
||||
let out = panictry!(p.parse_expr_nopanic());
|
||||
let out = panictry!(p.parse_expr());
|
||||
panictry!(p.expect(&token::CloseDelim(token::Paren)));
|
||||
|
||||
// Expands a read+write operand into two operands.
|
||||
@@ -146,7 +146,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
}
|
||||
|
||||
panictry!(p.expect(&token::OpenDelim(token::Paren)));
|
||||
let input = panictry!(p.parse_expr_nopanic());
|
||||
let input = panictry!(p.parse_expr());
|
||||
panictry!(p.expect(&token::CloseDelim(token::Paren)));
|
||||
|
||||
inputs.push((constraint, input));
|
||||
|
||||
@@ -809,7 +809,7 @@ pub fn get_single_str_from_tts(cx: &mut ExtCtxt,
|
||||
cx.span_err(sp, &format!("{} takes 1 argument", name));
|
||||
return None
|
||||
}
|
||||
let ret = cx.expander().fold_expr(panictry!(p.parse_expr_nopanic()));
|
||||
let ret = cx.expander().fold_expr(panictry!(p.parse_expr()));
|
||||
if p.token != token::Eof {
|
||||
cx.span_err(sp, &format!("{} takes 1 argument", name));
|
||||
}
|
||||
@@ -826,7 +826,7 @@ pub fn get_exprs_from_tts(cx: &mut ExtCtxt,
|
||||
let mut p = cx.new_parser_from_tts(tts);
|
||||
let mut es = Vec::new();
|
||||
while p.token != token::Eof {
|
||||
es.push(cx.expander().fold_expr(panictry!(p.parse_expr_nopanic())));
|
||||
es.push(cx.expander().fold_expr(panictry!(p.parse_expr())));
|
||||
if panictry!(p.eat(&token::Comma)){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
ecx.span_err(sp, "requires at least a format string argument");
|
||||
return None;
|
||||
}
|
||||
let fmtstr = panictry!(p.parse_expr_nopanic());
|
||||
let fmtstr = panictry!(p.parse_expr());
|
||||
let mut named = false;
|
||||
while p.token != token::Eof {
|
||||
if !panictry!(p.eat(&token::Comma)) {
|
||||
@@ -124,7 +124,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
let name: &str = &ident.name.as_str();
|
||||
|
||||
panictry!(p.expect(&token::Eq));
|
||||
let e = panictry!(p.parse_expr_nopanic());
|
||||
let e = panictry!(p.parse_expr());
|
||||
match names.get(name) {
|
||||
None => {}
|
||||
Some(prev) => {
|
||||
@@ -138,7 +138,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
order.push(name.to_string());
|
||||
names.insert(name.to_string(), e);
|
||||
} else {
|
||||
args.push(panictry!(p.parse_expr_nopanic()));
|
||||
args.push(panictry!(p.parse_expr()));
|
||||
}
|
||||
}
|
||||
Some((fmtstr, args, order, names))
|
||||
|
||||
@@ -701,7 +701,7 @@ fn parse_arguments_to_quote(cx: &ExtCtxt, tts: &[TokenTree])
|
||||
let mut p = cx.new_parser_from_tts(tts);
|
||||
p.quote_depth += 1;
|
||||
|
||||
let cx_expr = panictry!(p.parse_expr_nopanic());
|
||||
let cx_expr = panictry!(p.parse_expr());
|
||||
if !panictry!(p.eat(&token::Comma)) {
|
||||
panic!(p.fatal("expected token `,`"));
|
||||
}
|
||||
|
||||
@@ -109,13 +109,13 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree
|
||||
}
|
||||
impl<'a> base::MacResult for ExpandResult<'a> {
|
||||
fn make_expr(mut self: Box<ExpandResult<'a>>) -> Option<P<ast::Expr>> {
|
||||
Some(panictry!(self.p.parse_expr_nopanic()))
|
||||
Some(panictry!(self.p.parse_expr()))
|
||||
}
|
||||
fn make_items(mut self: Box<ExpandResult<'a>>)
|
||||
-> Option<SmallVector<P<ast::Item>>> {
|
||||
let mut ret = SmallVector::zero();
|
||||
while self.p.token != token::Eof {
|
||||
match panictry!(self.p.parse_item_nopanic()) {
|
||||
match panictry!(self.p.parse_item()) {
|
||||
Some(item) => ret.push(item),
|
||||
None => panic!(self.p.span_fatal(
|
||||
self.p.span,
|
||||
|
||||
@@ -501,18 +501,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 panictry!(p.parse_item_nopanic()) {
|
||||
"item" => match panictry!(p.parse_item()) {
|
||||
Some(i) => token::NtItem(i),
|
||||
None => panic!(p.fatal("expected an item keyword"))
|
||||
},
|
||||
"block" => token::NtBlock(panictry!(p.parse_block())),
|
||||
"stmt" => match panictry!(p.parse_stmt_nopanic()) {
|
||||
"stmt" => match panictry!(p.parse_stmt()) {
|
||||
Some(s) => token::NtStmt(s),
|
||||
None => panic!(p.fatal("expected a statement"))
|
||||
},
|
||||
"pat" => token::NtPat(panictry!(p.parse_pat_nopanic())),
|
||||
"expr" => token::NtExpr(panictry!(p.parse_expr_nopanic())),
|
||||
"ty" => token::NtTy(panictry!(p.parse_ty_nopanic())),
|
||||
"pat" => token::NtPat(panictry!(p.parse_pat())),
|
||||
"expr" => token::NtExpr(panictry!(p.parse_expr())),
|
||||
"ty" => token::NtTy(panictry!(p.parse_ty())),
|
||||
// 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) }
|
||||
|
||||
@@ -67,18 +67,18 @@ impl<'a> ParserAnyMacro<'a> {
|
||||
|
||||
impl<'a> MacResult for ParserAnyMacro<'a> {
|
||||
fn make_expr(self: Box<ParserAnyMacro<'a>>) -> Option<P<ast::Expr>> {
|
||||
let ret = panictry!(self.parser.borrow_mut().parse_expr_nopanic());
|
||||
let ret = panictry!(self.parser.borrow_mut().parse_expr());
|
||||
self.ensure_complete_parse(true);
|
||||
Some(ret)
|
||||
}
|
||||
fn make_pat(self: Box<ParserAnyMacro<'a>>) -> Option<P<ast::Pat>> {
|
||||
let ret = panictry!(self.parser.borrow_mut().parse_pat_nopanic());
|
||||
let ret = panictry!(self.parser.borrow_mut().parse_pat());
|
||||
self.ensure_complete_parse(false);
|
||||
Some(ret)
|
||||
}
|
||||
fn make_items(self: Box<ParserAnyMacro<'a>>) -> Option<SmallVector<P<ast::Item>>> {
|
||||
let mut ret = SmallVector::zero();
|
||||
while let Some(item) = panictry!(self.parser.borrow_mut().parse_item_nopanic()) {
|
||||
while let Some(item) = panictry!(self.parser.borrow_mut().parse_item()) {
|
||||
ret.push(item);
|
||||
}
|
||||
self.ensure_complete_parse(false);
|
||||
@@ -106,7 +106,7 @@ impl<'a> MacResult for ParserAnyMacro<'a> {
|
||||
let mut parser = self.parser.borrow_mut();
|
||||
match parser.token {
|
||||
token::Eof => break,
|
||||
_ => match parser.parse_stmt_nopanic() {
|
||||
_ => match parser.parse_stmt() {
|
||||
Ok(maybe_stmt) => match maybe_stmt {
|
||||
Some(stmt) => ret.push(stmt),
|
||||
None => (),
|
||||
@@ -120,7 +120,7 @@ impl<'a> MacResult for ParserAnyMacro<'a> {
|
||||
}
|
||||
|
||||
fn make_ty(self: Box<ParserAnyMacro<'a>>) -> Option<P<ast::Ty>> {
|
||||
let ret = panictry!(self.parser.borrow_mut().parse_ty_nopanic());
|
||||
let ret = panictry!(self.parser.borrow_mut().parse_ty());
|
||||
self.ensure_complete_parse(true);
|
||||
Some(ret)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user