File tree 1 file changed +9
-9
lines changed 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -552,8 +552,9 @@ impl Parser {
552
552
let mut columns = vec ! [ ] ;
553
553
if self . consume_token ( & Token :: LParen ) {
554
554
loop {
555
- if let Some ( Token :: SQLWord ( column_name) ) = self . next_token ( ) {
556
- if let Ok ( data_type) = self . parse_data_type ( ) {
555
+ match self . next_token ( ) {
556
+ Some ( Token :: SQLWord ( column_name) ) => {
557
+ let data_type = self . parse_data_type ( ) ?;
557
558
let is_primary = self . parse_keywords ( vec ! [ "PRIMARY" , "KEY" ] ) ;
558
559
let is_unique = self . parse_keyword ( "UNIQUE" ) ;
559
560
let default = if self . parse_keyword ( "DEFAULT" ) {
@@ -586,18 +587,17 @@ impl Parser {
586
587
}
587
588
other => {
588
589
return parser_err ! (
589
- format!( "Expected ',' or ')' after column definition but found {:?}" , other)
590
- ) ;
590
+ format!( "Expected ',' or ')' after column definition but found {:?}" , other)
591
+ ) ;
591
592
}
592
593
}
593
- } else {
594
+ }
595
+ unexpected => {
594
596
return parser_err ! ( format!(
595
- "Error parsing data type in column definition near: {:?}" ,
596
- self . peek_token ( )
597
+ "Expected column name, got {:?}" ,
598
+ unexpected
597
599
) ) ;
598
600
}
599
- } else {
600
- return parser_err ! ( "Error parsing column name" ) ;
601
601
}
602
602
}
603
603
}
You can’t perform that action at this time.
0 commit comments