fn parse_columns(&mut self) -> Result<(Vec<ColumnDef>, Vec<TableConstraint>), ParserError> {
        let mut columns = vec![];
        let mut constraints = vec![];
        if !self.parser.consume_token(&Token::LParen) || self.parser.consume_token(&Token::RParen) {
            return Ok((columns, constraints));
        }

        loop {
            if let Some(constraint) = self.parser.parse_optional_table_constraint()? {
                constraints.push(constraint);
            } else if let Token::Word(_) = self.parser.peek_token() {
                let column_def = self.parse_column_def()?;
                columns.push(column_def);
            } else {
                return self.expected(
                    "column name or constraint definition",
                    self.parser.peek_token(),
                );
            }
            let comma = self.parser.consume_token(&Token::Comma);
            if self.parser.consume_token(&Token::RParen) {
                // allow a trailing comma, even though it's not in standard
                break;
            } else if !comma {
                return self.expected(
                    "',' or ')' after column definition",
                    self.parser.peek_token(),
                );
            }
        }

        Ok((columns, constraints))
    }
// This is a copy of the equivalent implementation in sqlparser.
This is a copy of the equivalent implementation in sqlparser.
This is a copy of the equivalent implementation in sqlparser .
fn parse_columns(&mut self) -> Result<(Vec<ColumnDef>, Vec<TableConstraint>), ParserError> {
        let mut columns = vec![];
        let mut constraints = vec![];
        if !self.parser.consume_token(&Token::LParen) || self.parser.consume_token(&Token::RParen) {
            return Ok((columns, constraints));
        }
        loop {
            if let Some(constraint) = self.parser.parse_optional_table_constraint()? {
                constraints.push(constraint);
            } else if let Token::Word(_) = self.parser.peek_token() {
                let column_def = self.parse_column_def()?;
                columns.push(column_def);
            } else {
                return self.expected(
                    "column name or constraint definition",
                    self.parser.peek_token(),
                );
            }
            let comma = self.parser.consume_token(&Token::Comma);
            if self.parser.consume_token(&Token::RParen) {
                // allow a trailing comma, even though it's not in standard
                break;
            } else if !comma {
                return self.expected(
                    "',' or ')' after column definition",
                    self.parser.peek_token(),
                );
            }
        }
        Ok((columns, constraints))
    }
fn parse_columns ( & mut self ) -> Result < ( Vec < ColumnDef > , Vec < TableConstraint > ) , ParserError > { let mut columns = vec ! [ ] ; let mut constraints = vec ! [ ] ; if ! self . parser . consume_token ( & Token :: LParen ) || self . parser . consume_token ( & Token :: RParen ) { return Ok ( ( columns , constraints ) ) ; } loop { if let Some ( constraint ) = self . parser . parse_optional_table_constraint ( ) ? { constraints . push ( constraint ) ; } else if let Token :: Word ( _ ) = self . parser . peek_token ( ) { let column_def = self . parse_column_def ( ) ? ; columns . push ( column_def ) ; } else { return self . expected ( " " , self . parser . peek_token ( ) , ) ; } let comma = self . parser . consume_token ( & Token :: Comma ) ; if self . parser . consume_token ( & Token :: RParen ) { // allow a trailing comma, even though it's not in standard break ; } else if ! comma { return self . expected ( " " , self . parser . peek_token ( ) , ) ; } } Ok ( ( columns , constraints ) ) }
This is a copy of the equivalent implementation in sqlparser.
This is a copy of the equivalent implementation in sqlparser .
&mut self