Simplify parse_create() a little

Don't need the duplicate `columns.push()` + we advance the tokenizer,
so no need to peek first.
This commit is contained in:
Nickolay Ponomarev 2019-01-31 03:41:39 +03:00
parent 89602dc044
commit a0f625b949

View file

@ -571,28 +571,17 @@ impl Parser {
};
debug!("default: {:?}", default);
match self.peek_token() {
Some(Token::Comma) => {
self.next_token();
columns.push(SQLColumnDef {
name: column_name.as_sql_ident(),
data_type: data_type,
allow_null,
is_primary,
is_unique,
default,
});
}
columns.push(SQLColumnDef {
name: column_name.as_sql_ident(),
data_type: data_type,
allow_null,
is_primary,
is_unique,
default,
});
match self.next_token() {
Some(Token::Comma) => {}
Some(Token::RParen) => {
self.next_token();
columns.push(SQLColumnDef {
name: column_name.as_sql_ident(),
data_type: data_type,
allow_null,
is_primary,
is_unique,
default,
});
break;
}
other => {