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); debug!("default: {:?}", default);
match self.peek_token() { columns.push(SQLColumnDef {
Some(Token::Comma) => { name: column_name.as_sql_ident(),
self.next_token(); data_type: data_type,
columns.push(SQLColumnDef { allow_null,
name: column_name.as_sql_ident(), is_primary,
data_type: data_type, is_unique,
allow_null, default,
is_primary, });
is_unique, match self.next_token() {
default, Some(Token::Comma) => {}
});
}
Some(Token::RParen) => { 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; break;
} }
other => { other => {