pub fn parse_prefix_expr(&mut self,
                             already_parsed_attrs: Option<ThinAttributes>)
                             -> PResult<'a, P<Expr>> {
        let attrs = try!(self.parse_or_use_outer_attributes(already_parsed_attrs));
        let lo = self.span.lo;
        let hi;
        // Note: when adding new unary operators, don't forget to adjust Token::can_begin_expr()
        let ex = match self.token {
            token::Not => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                self.mk_unary(UnOp::Not, e)
            }
            token::BinOp(token::Minus) => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                self.mk_unary(UnOp::Neg, e)
            }
            token::BinOp(token::Star) => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                self.mk_unary(UnOp::Deref, e)
            }
            token::BinOp(token::And) | token::AndAnd => {
                try!(self.expect_and());
                let m = try!(self.parse_mutability());
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                ExprKind::AddrOf(m, e)
            }
            token::Ident(..) if self.token.is_keyword(keywords::In) => {
                self.bump();
                let place = try!(self.parse_expr_res(
                    Restrictions::RESTRICTION_NO_STRUCT_LITERAL,
                    None,
                ));
                let blk = try!(self.parse_block());
                let span = blk.span;
                hi = span.hi;
                let blk_expr = self.mk_expr(span.lo, span.hi, ExprKind::Block(blk),
                                            None);
                ExprKind::InPlace(place, blk_expr)
            }
            token::Ident(..) if self.token.is_keyword(keywords::Box) => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                ExprKind::Box(e)
            }
            _ => return self.parse_dot_or_call_expr(Some(attrs))
        };
        return Ok(self.mk_expr(lo, hi, ex, attrs));
    }
/// Parse a prefix-unary-operator expr
Parse a prefix-unary-operator expr
Parse a prefix - unary - operator expr
pub fn parse_prefix_expr(&mut self,
                             already_parsed_attrs: Option<ThinAttributes>)
                             -> PResult<'a, P<Expr>> {
        let attrs = try!(self.parse_or_use_outer_attributes(already_parsed_attrs));
        let lo = self.span.lo;
        let hi;
        // Note: when adding new unary operators, don't forget to adjust Token::can_begin_expr()
        let ex = match self.token {
            token::Not => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                self.mk_unary(UnOp::Not, e)
            }
            token::BinOp(token::Minus) => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                self.mk_unary(UnOp::Neg, e)
            }
            token::BinOp(token::Star) => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                self.mk_unary(UnOp::Deref, e)
            }
            token::BinOp(token::And) | token::AndAnd => {
                try!(self.expect_and());
                let m = try!(self.parse_mutability());
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                ExprKind::AddrOf(m, e)
            }
            token::Ident(..) if self.token.is_keyword(keywords::In) => {
                self.bump();
                let place = try!(self.parse_expr_res(
                    Restrictions::RESTRICTION_NO_STRUCT_LITERAL,
                    None,
                ));
                let blk = try!(self.parse_block());
                let span = blk.span;
                hi = span.hi;
                let blk_expr = self.mk_expr(span.lo, span.hi, ExprKind::Block(blk),
                                            None);
                ExprKind::InPlace(place, blk_expr)
            }
            token::Ident(..) if self.token.is_keyword(keywords::Box) => {
                self.bump();
                let e = self.parse_prefix_expr(None);
                let (span, e) = try!(self.interpolated_or_expr_span(e));
                hi = span.hi;
                ExprKind::Box(e)
            }
            _ => return self.parse_dot_or_call_expr(Some(attrs))
        };
        return Ok(self.mk_expr(lo, hi, ex, attrs));
    }
pub fn parse_prefix_expr ( & mut self , already_parsed_attrs : Option < ThinAttributes > ) -> PResult < ' a , P < Expr > > { let attrs = try ! ( self parse_or_use_outer_attributes ( already_parsed_attrs ) ) ; let lo = self . span . lo ; let hi ; // Note: when adding new unary operators, don't forget to adjust Token::can_begin_expr() let ex = match self . token { token :: Not => { self . bump ( ) ; let e = self . parse_prefix_expr ( None ) ; let ( span , e ) = try ! ( self interpolated_or_expr_span ( e ) ) ; hi = span . hi ; self . mk_unary ( UnOp :: Not , e ) } token :: BinOp ( token :: Minus ) => { self . bump ( ) ; let e = self . parse_prefix_expr ( None ) ; let ( span , e ) = try ! ( self interpolated_or_expr_span ( e ) ) ; hi = span . hi ; self . mk_unary ( UnOp :: Neg , e ) } token :: BinOp ( token :: Star ) => { self . bump ( ) ; let e = self . parse_prefix_expr ( None ) ; let ( span , e ) = try ! ( self interpolated_or_expr_span ( e ) ) ; hi = span . hi ; self . mk_unary ( UnOp :: Deref , e ) } token :: BinOp ( token :: And ) | token :: AndAnd => { try ! ( self expect_and ( ) ) ; let m = try ! ( self parse_mutability ( ) ) ; let e = self . parse_prefix_expr ( None ) ; let ( span , e ) = try ! ( self interpolated_or_expr_span ( e ) ) ; hi = span . hi ; ExprKind :: AddrOf ( m , e ) } token :: Ident ( .. ) if self . token . is_keyword ( keywords :: In ) => { self . bump ( ) ; let place = try ! ( self parse_expr_res ( Restrictions RESTRICTION_NO_STRUCT_LITERAL None ) ) ; let blk = try ! ( self parse_block ( ) ) ; let span = blk . span ; hi = span . hi ; let blk_expr = self . mk_expr ( span . lo , span . hi , ExprKind :: Block ( blk ) , None ) ; ExprKind :: InPlace ( place , blk_expr ) } token :: Ident ( .. ) if self . token . is_keyword ( keywords :: Box ) => { self . bump ( ) ; let e = self . parse_prefix_expr ( None ) ; let ( span , e ) = try ! ( self interpolated_or_expr_span ( e ) ) ; hi = span . hi ; ExprKind :: Box ( e ) } _ => return self . parse_dot_or_call_expr ( Some ( attrs ) ) } ; return Ok ( self . mk_expr ( lo , hi , ex , attrs ) ) ; }
Parse a prefix-unary-operator expr
Parse a prefix - unary - operator expr
&mut self
already_parsed_attrs
Option<ThinAttributes>
&mut self
already_parsed_attrs
Option<ThinAttributes>