fn parse_block_tail(&mut self, lo: BytePos, s: BlockCheckMode) -> PResult<'a, P<Block>> {
        let mut stmts = vec![];
        let mut expr = None;

        while !self.eat(&token::CloseDelim(token::Brace)) {
            let Spanned {node, span} = if let Some(s) = self.parse_stmt_() {
                s
            } else if self.token == token::Eof {
                break;
            } else {
                // Found only `;` or `}`.
                continue;
            };
            match node {
                StmtKind::Expr(e, _) => {
                    try!(self.handle_expression_like_statement(e, span, &mut stmts, &mut expr));
                }
                StmtKind::Mac(mac, MacStmtStyle::NoBraces, attrs) => {
                    // statement macro without braces; might be an
                    // expr depending on whether a semicolon follows
                    match self.token {
                        token::Semi => {
                            stmts.push(Spanned {
                                node: StmtKind::Mac(mac, MacStmtStyle::Semicolon, attrs),
                                span: mk_sp(span.lo, self.span.hi),
                            });
                            self.bump();
                        }
                        _ => {
                            let e = self.mk_mac_expr(span.lo, span.hi,
                                                     mac.and_then(|m| m.node),
                                                     None);
                            let lo = e.span.lo;
                            let e = try!(self.parse_dot_or_call_expr_with(e, lo, attrs));
                            let e = try!(self.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(e)));
                            try!(self.handle_expression_like_statement(
                                e,
                                span,
                                &mut stmts,
                                &mut expr));
                        }
                    }
                }
                StmtKind::Mac(m, style, attrs) => {
                    // statement macro; might be an expr
                    match self.token {
                        token::Semi => {
                            stmts.push(Spanned {
                                node: StmtKind::Mac(m, MacStmtStyle::Semicolon, attrs),
                                span: mk_sp(span.lo, self.span.hi),
                            });
                            self.bump();
                        }
                        token::CloseDelim(token::Brace) => {
                            // if a block ends in `m!(arg)` without
                            // a `;`, it must be an expr
                            expr = Some(self.mk_mac_expr(span.lo, span.hi,
                                                         m.and_then(|x| x.node),
                                                         attrs));
                        }
                        _ => {
                            stmts.push(Spanned {
                                node: StmtKind::Mac(m, style, attrs),
                                span: span
                            });
                        }
                    }
                }
                _ => { // all other kinds of statements:
                    let mut hi = span.hi;
                    if classify::stmt_ends_with_semi(&node) {
                        try!(self.commit_stmt_expecting(token::Semi));
                        hi = self.last_span.hi;
                    }

                    stmts.push(Spanned {
                        node: node,
                        span: mk_sp(span.lo, hi)
                    });
                }
            }
        }

        Ok(P(ast::Block {
            stmts: stmts,
            expr: expr,
            id: ast::DUMMY_NODE_ID,
            rules: s,
            span: mk_sp(lo, self.last_span.hi),
        }))
    }
/// Parse the rest of a block expression or function body
/// Precondition: already parsed the '{'.
Parse the rest of a block expression or function body
Precondition: already parsed the '{'.
Parse the rest of a block expression or function body Precondition : already parsed the ' { ' .
fn parse_block_tail(&mut self, lo: BytePos, s: BlockCheckMode) -> PResult<'a, P<Block>> {
        let mut stmts = vec![];
        let mut expr = None;
        while !self.eat(&token::CloseDelim(token::Brace)) {
            let Spanned {node, span} = if let Some(s) = self.parse_stmt_() {
                s
            } else if self.token == token::Eof {
                break;
            } else {
                // Found only `;` or `}`.
                continue;
            };
            match node {
                StmtKind::Expr(e, _) => {
                    try!(self.handle_expression_like_statement(e, span, &mut stmts, &mut expr));
                }
                StmtKind::Mac(mac, MacStmtStyle::NoBraces, attrs) => {
                    // statement macro without braces; might be an
                    // expr depending on whether a semicolon follows
                    match self.token {
                        token::Semi => {
                            stmts.push(Spanned {
                                node: StmtKind::Mac(mac, MacStmtStyle::Semicolon, attrs),
                                span: mk_sp(span.lo, self.span.hi),
                            });
                            self.bump();
                        }
                        _ => {
                            let e = self.mk_mac_expr(span.lo, span.hi,
                                                     mac.and_then(|m| m.node),
                                                     None);
                            let lo = e.span.lo;
                            let e = try!(self.parse_dot_or_call_expr_with(e, lo, attrs));
                            let e = try!(self.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(e)));
                            try!(self.handle_expression_like_statement(
                                e,
                                span,
                                &mut stmts,
                                &mut expr));
                        }
                    }
                }
                StmtKind::Mac(m, style, attrs) => {
                    // statement macro; might be an expr
                    match self.token {
                        token::Semi => {
                            stmts.push(Spanned {
                                node: StmtKind::Mac(m, MacStmtStyle::Semicolon, attrs),
                                span: mk_sp(span.lo, self.span.hi),
                            });
                            self.bump();
                        }
                        token::CloseDelim(token::Brace) => {
                            // if a block ends in `m!(arg)` without
                            // a `;`, it must be an expr
                            expr = Some(self.mk_mac_expr(span.lo, span.hi,
                                                         m.and_then(|x| x.node),
                                                         attrs));
                        }
                        _ => {
                            stmts.push(Spanned {
                                node: StmtKind::Mac(m, style, attrs),
                                span: span
                            });
                        }
                    }
                }
                _ => { // all other kinds of statements:
                    let mut hi = span.hi;
                    if classify::stmt_ends_with_semi(&node) {
                        try!(self.commit_stmt_expecting(token::Semi));
                        hi = self.last_span.hi;
                    }
                    stmts.push(Spanned {
                        node: node,
                        span: mk_sp(span.lo, hi)
                    });
                }
            }
        }
        Ok(P(ast::Block {
            stmts: stmts,
            expr: expr,
            id: ast::DUMMY_NODE_ID,
            rules: s,
            span: mk_sp(lo, self.last_span.hi),
        }))
    }
fn parse_block_tail ( & mut self , lo : BytePos , s : BlockCheckMode ) -> PResult < ' a , P < Block > > { let mut stmts = vec ! [ ] ; let mut expr = None ; while ! self . eat ( & token :: CloseDelim ( token :: Brace ) ) { let Spanned { node , span } = if let Some ( s ) = self . parse_stmt_ ( ) { s } else if self . token == token :: Eof { break ; } else { // Found only `;` or `}`. continue ; } ; match node { StmtKind :: Expr ( e , _ ) => { try ! ( self handle_expression_like_statement ( e span mut stmts mut expr ) ) ; } StmtKind :: Mac ( mac , MacStmtStyle :: NoBraces , attrs ) => { // statement macro without braces; might be an // expr depending on whether a semicolon follows match self . token { token :: Semi => { stmts . push ( Spanned { node : StmtKind :: Mac ( mac , MacStmtStyle :: Semicolon , attrs ) , span : mk_sp ( span . lo , self . span . hi ) , } ) ; self . bump ( ) ; } _ => { let e = self . mk_mac_expr ( span . lo , span . hi , mac . and_then ( | m | m . node ) , None ) ; let lo = e . span . lo ; let e = try ! ( self parse_dot_or_call_expr_with ( e lo attrs ) ) ; let e = try ! ( self parse_assoc_expr_with ( 0 LhsExpr AlreadyParsed ( e ) ) ) ; try ! ( self handle_expression_like_statement ( e span mut stmts mut expr ) ) ; } } } StmtKind :: Mac ( m , style , attrs ) => { // statement macro; might be an expr match self . token { token :: Semi => { stmts . push ( Spanned { node : StmtKind :: Mac ( m , MacStmtStyle :: Semicolon , attrs ) , span : mk_sp ( span . lo , self . span . hi ) , } ) ; self . bump ( ) ; } token :: CloseDelim ( token :: Brace ) => { // if a block ends in `m!(arg)` without // a `;`, it must be an expr expr = Some ( self . mk_mac_expr ( span . lo , span . hi , m . and_then ( | x | x . node ) , attrs ) ) ; } _ => { stmts . push ( Spanned { node : StmtKind :: Mac ( m , style , attrs ) , span : span } ) ; } } } _ => { // all other kinds of statements: let mut hi = span . hi ; if classify :: stmt_ends_with_semi ( & node ) { try ! ( self commit_stmt_expecting ( token Semi ) ) ; hi = self . last_span . hi ; } stmts . push ( Spanned { node : node , span : mk_sp ( span . lo , hi ) } ) ; } } } Ok ( P ( ast :: Block { stmts : stmts , expr : expr , id : ast :: DUMMY_NODE_ID , rules : s , span : mk_sp ( lo , self . last_span . hi ) , } ) ) }
Parse the rest of a block expression or function body
Precondition: already parsed the '{'.
Parse the rest of a block expression or function body Precondition : already parsed the ' { ' .
&mut self
lo
BytePos
s
BlockCheckMode
&mut self
lo
BytePos
s
BlockCheckMode