Rename _nopanic methods to remove the suffix.
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
This commit is contained in:
@@ -366,27 +366,27 @@ impl<'a> Parser<'a> {
|
||||
// These functions are used by the quote_*!() syntax extensions, but shouldn't
|
||||
// be used otherwise.
|
||||
pub fn parse_expr_panic(&mut self) -> P<Expr> {
|
||||
panictry!(self.parse_expr_nopanic())
|
||||
panictry!(self.parse_expr())
|
||||
}
|
||||
|
||||
pub fn parse_item_panic(&mut self) -> Option<P<Item>> {
|
||||
panictry!(self.parse_item_nopanic())
|
||||
panictry!(self.parse_item())
|
||||
}
|
||||
|
||||
pub fn parse_pat_panic(&mut self) -> P<Pat> {
|
||||
panictry!(self.parse_pat_nopanic())
|
||||
panictry!(self.parse_pat())
|
||||
}
|
||||
|
||||
pub fn parse_arm_panic(&mut self) -> Arm {
|
||||
panictry!(self.parse_arm_nopanic())
|
||||
panictry!(self.parse_arm())
|
||||
}
|
||||
|
||||
pub fn parse_ty_panic(&mut self) -> P<Ty> {
|
||||
panictry!(self.parse_ty_nopanic())
|
||||
panictry!(self.parse_ty())
|
||||
}
|
||||
|
||||
pub fn parse_stmt_panic(&mut self) -> Option<P<Stmt>> {
|
||||
panictry!(self.parse_stmt_nopanic())
|
||||
panictry!(self.parse_stmt())
|
||||
}
|
||||
|
||||
pub fn parse_attribute_panic(&mut self, permit_inner: bool) -> ast::Attribute {
|
||||
@@ -1197,7 +1197,7 @@ impl<'a> Parser<'a> {
|
||||
let ty = try!(p.parse_ty_sum());
|
||||
let default = if p.check(&token::Eq) {
|
||||
try!(p.bump());
|
||||
let expr = try!(p.parse_expr_nopanic());
|
||||
let expr = try!(p.parse_expr());
|
||||
try!(p.commit_expr_expecting(&expr, token::Semi));
|
||||
Some(expr)
|
||||
} else {
|
||||
@@ -1264,7 +1264,7 @@ impl<'a> Parser<'a> {
|
||||
/// Parse a possibly mutable type
|
||||
pub fn parse_mt(&mut self) -> PResult<MutTy> {
|
||||
let mutbl = try!(self.parse_mutability());
|
||||
let t = try!(self.parse_ty_nopanic());
|
||||
let t = try!(self.parse_ty());
|
||||
Ok(MutTy { ty: t, mutbl: mutbl })
|
||||
}
|
||||
|
||||
@@ -1274,7 +1274,7 @@ impl<'a> Parser<'a> {
|
||||
if try!(self.eat(&token::Not) ){
|
||||
Ok(NoReturn(self.last_span))
|
||||
} else {
|
||||
Ok(Return(try!(self.parse_ty_nopanic())))
|
||||
Ok(Return(try!(self.parse_ty())))
|
||||
}
|
||||
} else {
|
||||
let pos = self.span.lo;
|
||||
@@ -1285,7 +1285,7 @@ impl<'a> Parser<'a> {
|
||||
/// Parse a type in a context where `T1+T2` is allowed.
|
||||
pub fn parse_ty_sum(&mut self) -> PResult<P<Ty>> {
|
||||
let lo = self.span.lo;
|
||||
let lhs = try!(self.parse_ty_nopanic());
|
||||
let lhs = try!(self.parse_ty());
|
||||
|
||||
if !try!(self.eat(&token::BinOp(token::Plus)) ){
|
||||
return Ok(lhs);
|
||||
@@ -1308,7 +1308,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
/// Parse a type.
|
||||
pub fn parse_ty_nopanic(&mut self) -> PResult<P<Ty>> {
|
||||
pub fn parse_ty(&mut self) -> PResult<P<Ty>> {
|
||||
maybe_whole!(no_clone self, NtTy);
|
||||
|
||||
let lo = self.span.lo;
|
||||
@@ -1369,7 +1369,7 @@ impl<'a> Parser<'a> {
|
||||
// TYPEOF
|
||||
// In order to not be ambiguous, the type must be surrounded by parens.
|
||||
try!(self.expect(&token::OpenDelim(token::Paren)));
|
||||
let e = try!(self.parse_expr_nopanic());
|
||||
let e = try!(self.parse_expr());
|
||||
try!(self.expect(&token::CloseDelim(token::Paren)));
|
||||
TyTypeof(e)
|
||||
} else if try!(self.eat_lt()) {
|
||||
@@ -1429,7 +1429,7 @@ impl<'a> Parser<'a> {
|
||||
known as `*const T`");
|
||||
MutImmutable
|
||||
};
|
||||
let t = try!(self.parse_ty_nopanic());
|
||||
let t = try!(self.parse_ty());
|
||||
Ok(MutTy { ty: t, mutbl: mutbl })
|
||||
}
|
||||
|
||||
@@ -1458,7 +1458,7 @@ impl<'a> Parser<'a> {
|
||||
let pat = if require_name || self.is_named_argument() {
|
||||
debug!("parse_arg_general parse_pat (require_name:{})",
|
||||
require_name);
|
||||
let pat = try!(self.parse_pat_nopanic());
|
||||
let pat = try!(self.parse_pat());
|
||||
|
||||
try!(self.expect(&token::Colon));
|
||||
pat
|
||||
@@ -1485,7 +1485,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
/// Parse an argument in a lambda header e.g. |arg, arg|
|
||||
pub fn parse_fn_block_arg(&mut self) -> PResult<Arg> {
|
||||
let pat = try!(self.parse_pat_nopanic());
|
||||
let pat = try!(self.parse_pat());
|
||||
let t = if try!(self.eat(&token::Colon) ){
|
||||
try!(self.parse_ty_sum())
|
||||
} else {
|
||||
@@ -1505,7 +1505,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn maybe_parse_fixed_length_of_vec(&mut self) -> PResult<Option<P<ast::Expr>>> {
|
||||
if self.check(&token::Semi) {
|
||||
try!(self.bump());
|
||||
Ok(Some(try!(self.parse_expr_nopanic())))
|
||||
Ok(Some(try!(self.parse_expr())))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
@@ -1730,7 +1730,7 @@ impl<'a> Parser<'a> {
|
||||
|p| p.parse_ty_sum()));
|
||||
|
||||
let output_ty = if try!(self.eat(&token::RArrow) ){
|
||||
Some(try!(self.parse_ty_nopanic()))
|
||||
Some(try!(self.parse_ty()))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -1935,7 +1935,7 @@ impl<'a> Parser<'a> {
|
||||
let i = try!(self.parse_ident());
|
||||
let hi = self.last_span.hi;
|
||||
try!(self.expect(&token::Colon));
|
||||
let e = try!(self.parse_expr_nopanic());
|
||||
let e = try!(self.parse_expr());
|
||||
Ok(ast::Field {
|
||||
ident: spanned(lo, hi, i),
|
||||
span: mk_sp(lo, e.span.hi),
|
||||
@@ -2049,7 +2049,7 @@ impl<'a> Parser<'a> {
|
||||
let mut es = vec![];
|
||||
let mut trailing_comma = false;
|
||||
while self.token != token::CloseDelim(token::Paren) {
|
||||
es.push(try!(self.parse_expr_nopanic()));
|
||||
es.push(try!(self.parse_expr()));
|
||||
try!(self.commit_expr(&**es.last().unwrap(), &[],
|
||||
&[token::Comma, token::CloseDelim(token::Paren)]));
|
||||
if self.check(&token::Comma) {
|
||||
@@ -2095,11 +2095,11 @@ impl<'a> Parser<'a> {
|
||||
ex = ExprVec(Vec::new());
|
||||
} else {
|
||||
// Nonempty vector.
|
||||
let first_expr = try!(self.parse_expr_nopanic());
|
||||
let first_expr = try!(self.parse_expr());
|
||||
if self.check(&token::Semi) {
|
||||
// Repeating array syntax: [ 0; 512 ]
|
||||
try!(self.bump());
|
||||
let count = try!(self.parse_expr_nopanic());
|
||||
let count = try!(self.parse_expr());
|
||||
try!(self.expect(&token::CloseDelim(token::Bracket)));
|
||||
ex = ExprRepeat(first_expr, count);
|
||||
} else if self.check(&token::Comma) {
|
||||
@@ -2108,7 +2108,7 @@ impl<'a> Parser<'a> {
|
||||
let remaining_exprs = try!(self.parse_seq_to_end(
|
||||
&token::CloseDelim(token::Bracket),
|
||||
seq_sep_trailing_allowed(token::Comma),
|
||||
|p| Ok(try!(p.parse_expr_nopanic()))
|
||||
|p| Ok(try!(p.parse_expr()))
|
||||
));
|
||||
let mut exprs = vec!(first_expr);
|
||||
exprs.extend(remaining_exprs);
|
||||
@@ -2187,7 +2187,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
if try!(self.eat_keyword(keywords::Return) ){
|
||||
if self.token.can_begin_expr() {
|
||||
let e = try!(self.parse_expr_nopanic());
|
||||
let e = try!(self.parse_expr());
|
||||
hi = e.span.hi;
|
||||
ex = ExprRet(Some(e));
|
||||
} else {
|
||||
@@ -2241,7 +2241,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
while self.token != token::CloseDelim(token::Brace) {
|
||||
if try!(self.eat(&token::DotDot) ){
|
||||
base = Some(try!(self.parse_expr_nopanic()));
|
||||
base = Some(try!(self.parse_expr()));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2317,7 +2317,7 @@ impl<'a> Parser<'a> {
|
||||
&token::OpenDelim(token::Paren),
|
||||
&token::CloseDelim(token::Paren),
|
||||
seq_sep_trailing_allowed(token::Comma),
|
||||
|p| Ok(try!(p.parse_expr_nopanic()))
|
||||
|p| Ok(try!(p.parse_expr()))
|
||||
));
|
||||
hi = self.last_span.hi;
|
||||
|
||||
@@ -2394,7 +2394,7 @@ impl<'a> Parser<'a> {
|
||||
&token::OpenDelim(token::Paren),
|
||||
&token::CloseDelim(token::Paren),
|
||||
seq_sep_trailing_allowed(token::Comma),
|
||||
|p| Ok(try!(p.parse_expr_nopanic()))
|
||||
|p| Ok(try!(p.parse_expr()))
|
||||
));
|
||||
hi = self.last_span.hi;
|
||||
|
||||
@@ -2406,7 +2406,7 @@ impl<'a> Parser<'a> {
|
||||
// Could be either an index expression or a slicing expression.
|
||||
token::OpenDelim(token::Bracket) => {
|
||||
try!(self.bump());
|
||||
let ix = try!(self.parse_expr_nopanic());
|
||||
let ix = try!(self.parse_expr());
|
||||
hi = self.span.hi;
|
||||
try!(self.commit_expr_expecting(&*ix, token::CloseDelim(token::Bracket)));
|
||||
let index = self.mk_index(e, ix);
|
||||
@@ -2698,7 +2698,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
// Special cases:
|
||||
if op == AssocOp::As {
|
||||
let rhs = try!(self.parse_ty_nopanic());
|
||||
let rhs = try!(self.parse_ty());
|
||||
lhs = self.mk_expr(lhs.span.lo, rhs.span.hi, ExprCast(lhs, rhs));
|
||||
continue
|
||||
} else if op == AssocOp::DotDot {
|
||||
@@ -2851,7 +2851,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn parse_if_let_expr(&mut self) -> PResult<P<Expr>> {
|
||||
let lo = self.last_span.lo;
|
||||
try!(self.expect_keyword(keywords::Let));
|
||||
let pat = try!(self.parse_pat_nopanic());
|
||||
let pat = try!(self.parse_pat());
|
||||
try!(self.expect(&token::Eq));
|
||||
let expr = try!(self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL));
|
||||
let thn = try!(self.parse_block());
|
||||
@@ -2873,7 +2873,7 @@ impl<'a> Parser<'a> {
|
||||
DefaultReturn(_) => {
|
||||
// If no explicit return type is given, parse any
|
||||
// expr and wrap it up in a dummy block:
|
||||
let body_expr = try!(self.parse_expr_nopanic());
|
||||
let body_expr = try!(self.parse_expr());
|
||||
P(ast::Block {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
stmts: vec![],
|
||||
@@ -2909,7 +2909,7 @@ impl<'a> Parser<'a> {
|
||||
span_lo: BytePos) -> PResult<P<Expr>> {
|
||||
// Parse: `for <src_pat> in <src_expr> <src_loop_block>`
|
||||
|
||||
let pat = try!(self.parse_pat_nopanic());
|
||||
let pat = try!(self.parse_pat());
|
||||
try!(self.expect_keyword(keywords::In));
|
||||
let expr = try!(self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL));
|
||||
let loop_block = try!(self.parse_block());
|
||||
@@ -2934,7 +2934,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn parse_while_let_expr(&mut self, opt_ident: Option<ast::Ident>,
|
||||
span_lo: BytePos) -> PResult<P<Expr>> {
|
||||
try!(self.expect_keyword(keywords::Let));
|
||||
let pat = try!(self.parse_pat_nopanic());
|
||||
let pat = try!(self.parse_pat());
|
||||
try!(self.expect(&token::Eq));
|
||||
let expr = try!(self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL));
|
||||
let body = try!(self.parse_block());
|
||||
@@ -2961,21 +2961,21 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
let mut arms: Vec<Arm> = Vec::new();
|
||||
while self.token != token::CloseDelim(token::Brace) {
|
||||
arms.push(try!(self.parse_arm_nopanic()));
|
||||
arms.push(try!(self.parse_arm()));
|
||||
}
|
||||
let hi = self.span.hi;
|
||||
try!(self.bump());
|
||||
return Ok(self.mk_expr(lo, hi, ExprMatch(discriminant, arms)));
|
||||
}
|
||||
|
||||
pub fn parse_arm_nopanic(&mut self) -> PResult<Arm> {
|
||||
pub fn parse_arm(&mut self) -> PResult<Arm> {
|
||||
maybe_whole!(no_clone self, NtArm);
|
||||
|
||||
let attrs = try!(self.parse_outer_attributes());
|
||||
let pats = try!(self.parse_pats());
|
||||
let mut guard = None;
|
||||
if try!(self.eat_keyword(keywords::If) ){
|
||||
guard = Some(try!(self.parse_expr_nopanic()));
|
||||
guard = Some(try!(self.parse_expr()));
|
||||
}
|
||||
try!(self.expect(&token::FatArrow));
|
||||
let expr = try!(self.parse_expr_res(Restrictions::RESTRICTION_STMT_EXPR));
|
||||
@@ -2999,7 +2999,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
/// Parse an expression
|
||||
pub fn parse_expr_nopanic(&mut self) -> PResult<P<Expr>> {
|
||||
pub fn parse_expr(&mut self) -> PResult<P<Expr>> {
|
||||
self.parse_expr_res(Restrictions::empty())
|
||||
}
|
||||
|
||||
@@ -3025,7 +3025,7 @@ impl<'a> Parser<'a> {
|
||||
fn parse_initializer(&mut self) -> PResult<Option<P<Expr>>> {
|
||||
if self.check(&token::Eq) {
|
||||
try!(self.bump());
|
||||
Ok(Some(try!(self.parse_expr_nopanic())))
|
||||
Ok(Some(try!(self.parse_expr())))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
@@ -3035,7 +3035,7 @@ impl<'a> Parser<'a> {
|
||||
fn parse_pats(&mut self) -> PResult<Vec<P<Pat>>> {
|
||||
let mut pats = Vec::new();
|
||||
loop {
|
||||
pats.push(try!(self.parse_pat_nopanic()));
|
||||
pats.push(try!(self.parse_pat()));
|
||||
if self.check(&token::BinOp(token::Or)) { try!(self.bump());}
|
||||
else { return Ok(pats); }
|
||||
};
|
||||
@@ -3044,11 +3044,11 @@ impl<'a> Parser<'a> {
|
||||
fn parse_pat_tuple_elements(&mut self) -> PResult<Vec<P<Pat>>> {
|
||||
let mut fields = vec![];
|
||||
if !self.check(&token::CloseDelim(token::Paren)) {
|
||||
fields.push(try!(self.parse_pat_nopanic()));
|
||||
fields.push(try!(self.parse_pat()));
|
||||
if self.look_ahead(1, |t| *t != token::CloseDelim(token::Paren)) {
|
||||
while try!(self.eat(&token::Comma)) &&
|
||||
!self.check(&token::CloseDelim(token::Paren)) {
|
||||
fields.push(try!(self.parse_pat_nopanic()));
|
||||
fields.push(try!(self.parse_pat()));
|
||||
}
|
||||
}
|
||||
if fields.len() == 1 {
|
||||
@@ -3096,7 +3096,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
let subpat = try!(self.parse_pat_nopanic());
|
||||
let subpat = try!(self.parse_pat());
|
||||
if before_slice && self.check(&token::DotDot) {
|
||||
try!(self.bump());
|
||||
slice = Some(subpat);
|
||||
@@ -3144,7 +3144,7 @@ impl<'a> Parser<'a> {
|
||||
// Parsing a pattern of the form "fieldname: pat"
|
||||
let fieldname = try!(self.parse_ident());
|
||||
try!(self.bump());
|
||||
let pat = try!(self.parse_pat_nopanic());
|
||||
let pat = try!(self.parse_pat());
|
||||
hi = pat.span.hi;
|
||||
(pat, fieldname, false)
|
||||
} else {
|
||||
@@ -3215,7 +3215,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
/// Parse a pattern.
|
||||
pub fn parse_pat_nopanic(&mut self) -> PResult<P<Pat>> {
|
||||
pub fn parse_pat(&mut self) -> PResult<P<Pat>> {
|
||||
maybe_whole!(self, NtPat);
|
||||
|
||||
let lo = self.span.lo;
|
||||
@@ -3234,7 +3234,7 @@ impl<'a> Parser<'a> {
|
||||
return Err(self.fatal(&format!("unexpected lifetime `{}` in pattern", ident)));
|
||||
}
|
||||
|
||||
let subpat = try!(self.parse_pat_nopanic());
|
||||
let subpat = try!(self.parse_pat());
|
||||
pat = PatRegion(subpat, mutbl);
|
||||
}
|
||||
token::OpenDelim(token::Paren) => {
|
||||
@@ -3262,7 +3262,7 @@ impl<'a> Parser<'a> {
|
||||
pat = try!(self.parse_pat_ident(BindByRef(mutbl)));
|
||||
} else if try!(self.eat_keyword(keywords::Box)) {
|
||||
// Parse box pat
|
||||
let subpat = try!(self.parse_pat_nopanic());
|
||||
let subpat = try!(self.parse_pat());
|
||||
pat = PatBox(subpat);
|
||||
} else if self.is_path_start() {
|
||||
// Parse pattern starting with a path
|
||||
@@ -3334,7 +3334,7 @@ impl<'a> Parser<'a> {
|
||||
&token::OpenDelim(token::Paren),
|
||||
&token::CloseDelim(token::Paren),
|
||||
seq_sep_trailing_allowed(token::Comma),
|
||||
|p| p.parse_pat_nopanic()));
|
||||
|p| p.parse_pat()));
|
||||
pat = PatEnum(path, Some(args));
|
||||
}
|
||||
}
|
||||
@@ -3385,7 +3385,7 @@ impl<'a> Parser<'a> {
|
||||
let last_span = self.last_span;
|
||||
let name = codemap::Spanned{span: last_span, node: ident};
|
||||
let sub = if try!(self.eat(&token::At) ){
|
||||
Some(try!(self.parse_pat_nopanic()))
|
||||
Some(try!(self.parse_pat()))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -3409,7 +3409,7 @@ impl<'a> Parser<'a> {
|
||||
/// Parse a local variable declaration
|
||||
fn parse_local(&mut self) -> PResult<P<Local>> {
|
||||
let lo = self.span.lo;
|
||||
let pat = try!(self.parse_pat_nopanic());
|
||||
let pat = try!(self.parse_pat());
|
||||
|
||||
let mut ty = None;
|
||||
if try!(self.eat(&token::Colon) ){
|
||||
@@ -3466,7 +3466,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
/// Parse a statement. may include decl.
|
||||
pub fn parse_stmt_nopanic(&mut self) -> PResult<Option<P<Stmt>>> {
|
||||
pub fn parse_stmt(&mut self) -> PResult<Option<P<Stmt>>> {
|
||||
Ok(try!(self.parse_stmt_()).map(P))
|
||||
}
|
||||
|
||||
@@ -3897,7 +3897,7 @@ impl<'a> Parser<'a> {
|
||||
self.span_err(self.span, &msg);
|
||||
|
||||
let span_hi = self.span.hi;
|
||||
let span_hi = if self.parse_ty_nopanic().is_ok() {
|
||||
let span_hi = if self.parse_ty().is_ok() {
|
||||
self.span.hi
|
||||
} else {
|
||||
span_hi
|
||||
@@ -3941,7 +3941,7 @@ impl<'a> Parser<'a> {
|
||||
let span = p.span;
|
||||
p.span_warn(span, "whoops, no =?");
|
||||
}
|
||||
let ty = try!(p.parse_ty_nopanic());
|
||||
let ty = try!(p.parse_ty());
|
||||
let hi = ty.span.hi;
|
||||
let span = mk_sp(lo, hi);
|
||||
return Ok(P(TypeBinding{id: ast::DUMMY_NODE_ID,
|
||||
@@ -4022,7 +4022,7 @@ impl<'a> Parser<'a> {
|
||||
vec![]
|
||||
};
|
||||
|
||||
let bounded_ty = try!(self.parse_ty_nopanic());
|
||||
let bounded_ty = try!(self.parse_ty());
|
||||
|
||||
if try!(self.eat(&token::Colon) ){
|
||||
let bounds = try!(self.parse_ty_param_bounds(BoundParsingMode::Bare));
|
||||
@@ -4045,7 +4045,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
parsed_something = true;
|
||||
} else if try!(self.eat(&token::Eq) ){
|
||||
// let ty = try!(self.parse_ty_nopanic());
|
||||
// let ty = try!(self.parse_ty());
|
||||
let hi = self.last_span.hi;
|
||||
let span = mk_sp(lo, hi);
|
||||
// where_clause.predicates.push(
|
||||
@@ -4461,7 +4461,7 @@ impl<'a> Parser<'a> {
|
||||
try!(self.expect(&token::Colon));
|
||||
let typ = try!(self.parse_ty_sum());
|
||||
try!(self.expect(&token::Eq));
|
||||
let expr = try!(self.parse_expr_nopanic());
|
||||
let expr = try!(self.parse_expr());
|
||||
try!(self.commit_expr_expecting(&expr, token::Semi));
|
||||
(name, ConstImplItem(typ, expr))
|
||||
} else {
|
||||
@@ -4813,7 +4813,7 @@ impl<'a> Parser<'a> {
|
||||
/// Given a termination token, parse all of the items in a module
|
||||
fn parse_mod_items(&mut self, term: &token::Token, inner_lo: BytePos) -> PResult<Mod> {
|
||||
let mut items = vec![];
|
||||
while let Some(item) = try!(self.parse_item_nopanic()) {
|
||||
while let Some(item) = try!(self.parse_item()) {
|
||||
items.push(item);
|
||||
}
|
||||
|
||||
@@ -4839,7 +4839,7 @@ impl<'a> Parser<'a> {
|
||||
try!(self.expect(&token::Colon));
|
||||
let ty = try!(self.parse_ty_sum());
|
||||
try!(self.expect(&token::Eq));
|
||||
let e = try!(self.parse_expr_nopanic());
|
||||
let e = try!(self.parse_expr());
|
||||
try!(self.commit_expr_expecting(&*e, token::Semi));
|
||||
let item = match m {
|
||||
Some(m) => ItemStatic(ty, m, e),
|
||||
@@ -5169,7 +5169,7 @@ impl<'a> Parser<'a> {
|
||||
struct_def = VariantData::Tuple(try!(self.parse_tuple_struct_body(ParsePub::No)),
|
||||
ast::DUMMY_NODE_ID);
|
||||
} else if try!(self.eat(&token::Eq) ){
|
||||
disr_expr = Some(try!(self.parse_expr_nopanic()));
|
||||
disr_expr = Some(try!(self.parse_expr()));
|
||||
any_disr = disr_expr.as_ref().map(|expr| expr.span);
|
||||
struct_def = VariantData::Unit(ast::DUMMY_NODE_ID);
|
||||
} else {
|
||||
@@ -5601,7 +5601,7 @@ impl<'a> Parser<'a> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
pub fn parse_item_nopanic(&mut self) -> PResult<Option<P<Item>>> {
|
||||
pub fn parse_item(&mut self) -> PResult<Option<P<Item>>> {
|
||||
let attrs = try!(self.parse_outer_attributes());
|
||||
self.parse_item_(attrs, true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user