mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 19:27:21 +00:00
Use self.expected() more
This commit is contained in:
parent
f18fbe5cda
commit
45c9aa1cc2
2 changed files with 4 additions and 10 deletions
|
@ -890,10 +890,7 @@ impl Parser {
|
|||
} else if self.parse_keyword("VIEW") {
|
||||
SQLObjectType::View
|
||||
} else {
|
||||
return parser_err!(format!(
|
||||
"Unexpected token after DROP: {:?}",
|
||||
self.peek_token()
|
||||
));
|
||||
return self.expected("TABLE or VIEW after DROP", self.peek_token());
|
||||
};
|
||||
let if_exists = self.parse_keywords(vec!["IF", "EXISTS"]);
|
||||
let mut names = vec![];
|
||||
|
@ -1015,10 +1012,7 @@ impl Parser {
|
|||
self.expect_token(&Token::RParen)?;
|
||||
ColumnOption::Check(expr)
|
||||
} else {
|
||||
return parser_err!(format!(
|
||||
"Unexpected token in column definition: {:?}",
|
||||
self.peek_token()
|
||||
));
|
||||
return self.expected("column option", self.peek_token());
|
||||
};
|
||||
|
||||
Ok(ColumnOptionDef { name, option })
|
||||
|
@ -1216,7 +1210,7 @@ impl Parser {
|
|||
pub fn parse_literal_string(&mut self) -> Result<String, ParserError> {
|
||||
match self.next_token() {
|
||||
Some(Token::SingleQuotedString(ref s)) => Ok(s.clone()),
|
||||
other => parser_err!(format!("Expected literal string, found {:?}", other)),
|
||||
other => self.expected("literal string", other),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -949,7 +949,7 @@ fn parse_create_table() {
|
|||
assert!(res
|
||||
.unwrap_err()
|
||||
.to_string()
|
||||
.contains("Unexpected token in column definition"));
|
||||
.contains("Expected column option, found: GARBAGE"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue