fn parse_type(&mut self) -> PResult<ast::Type> {
        trace!("parse_type");
        // Grammar:
        //
        // Type      = TypeName | TypeLit | "(" Type ")" .
        // TypeName  = identifier | QualifiedIdent .
        // TypeLit   = ArrayType | StructType | PointerType | FunctionType | InterfaceType |
        // 	    SliceType | MapType | ChannelType .

        // TypeName = a (potentially qualified with a module path) identifier
        // TypeLit = more complex type, this is where it gets interesting

        match self.token.kind {
            // A Type may be surrounded in parentheses, in which case we simply eat the
            // parentheses and recurse.
            TokenKind::LParen => {
                try!(self.eat(TokenKind::LParen));
                let typ = try!(self.parse_type());
                try!(self.eat(TokenKind::RParen));
                Ok(typ)
            }
            // If a Type starts with an identifier, it can only be a TypeName.
            TokenKind::Ident => {
                let id = try!(self.parse_maybe_qualified_ident());
                Ok(ast::Type::Plain(id))
            }
            _ => unimplemented!(),
        }
    }
/// Parse a single type (e.g. `[]string`).
// XXX: type declarations can be very complex; this function needs attention.
Parse a single type .
XXX: type declarations can be very complex; this function needs attention.
Parse a single type . XXX : type declarations can be very complex ; this function needs attention .
fn parse_type(&mut self) -> PResult<ast::Type> {
        trace!("parse_type");
        // Grammar:
        //
        // Type      = TypeName | TypeLit | "(" Type ")" .
        // TypeName  = identifier | QualifiedIdent .
        // TypeLit   = ArrayType | StructType | PointerType | FunctionType | InterfaceType |
        // 	    SliceType | MapType | ChannelType .
        // TypeName = a (potentially qualified with a module path) identifier
        // TypeLit = more complex type, this is where it gets interesting
        match self.token.kind {
            // A Type may be surrounded in parentheses, in which case we simply eat the
            // parentheses and recurse.
            TokenKind::LParen => {
                try!(self.eat(TokenKind::LParen));
                let typ = try!(self.parse_type());
                try!(self.eat(TokenKind::RParen));
                Ok(typ)
            }
            // If a Type starts with an identifier, it can only be a TypeName.
            TokenKind::Ident => {
                let id = try!(self.parse_maybe_qualified_ident());
                Ok(ast::Type::Plain(id))
            }
            _ => unimplemented!(),
        }
    }
fn parse_type ( & mut self ) -> PResult < ast :: Type > { trace ! ( " " ) ; // Grammar: // // Type      = TypeName | TypeLit | "(" Type ")" . // TypeName  = identifier | QualifiedIdent . // TypeLit   = ArrayType | StructType | PointerType | FunctionType | InterfaceType | // 	    SliceType | MapType | ChannelType . // TypeName = a (potentially qualified with a module path) identifier // TypeLit = more complex type, this is where it gets interesting match self . token . kind { // A Type may be surrounded in parentheses, in which case we simply eat the // parentheses and recurse. TokenKind :: LParen => { try ! ( self eat ( TokenKind LParen ) ) ; let typ = try ! ( self parse_type ( ) ) ; try ! ( self eat ( TokenKind RParen ) ) ; Ok ( typ ) } // If a Type starts with an identifier, it can only be a TypeName. TokenKind :: Ident => { let id = try ! ( self parse_maybe_qualified_ident ( ) ) ; Ok ( ast :: Type :: Plain ( id ) ) } _ => unimplemented ! ( ) , } }
Parse a single type (e.g.
Parse a single type ( e . g .
&mut self