Skip to content

Commit ed632e8

Browse files
committed
Update names and fix typos
1 parent 2ad1621 commit ed632e8

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/parser/mod.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6484,14 +6484,6 @@ impl<'a> Parser<'a> {
64846484
}
64856485
}
64866486

6487-
pub fn parse_key_value(&mut self) -> Result<(Ident, Expr), ParserError> {
6488-
let name = self.parse_identifier(false)?;
6489-
self.expect_token(&Token::Eq)?;
6490-
let value = self.parse_expr()?;
6491-
6492-
Ok((name, value))
6493-
}
6494-
64956487
pub fn parse_sql_option(&mut self) -> Result<SqlOption, ParserError> {
64966488
let is_mssql = dialect_of!(self is MsSqlDialect|GenericDialect);
64976489

@@ -6506,7 +6498,10 @@ impl<'a> Parser<'a> {
65066498
self.parse_option_clustered()
65076499
}
65086500
_ => {
6509-
let (name, value) = self.parse_key_value()?;
6501+
let name = self.parse_identifier(false)?;
6502+
self.expect_token(&Token::Eq)?;
6503+
let value = self.parse_expr()?;
6504+
65106505
Ok(SqlOption::KeyValue { key: name, value })
65116506
}
65126507
}
@@ -6533,7 +6528,7 @@ impl<'a> Parser<'a> {
65336528

65346529
let columns = self.parse_comma_separated(|p| {
65356530
let name = p.parse_identifier(false)?;
6536-
let asc = p.parse_asc();
6531+
let asc = p.parse_asc_desc();
65376532

65386533
Ok(ClusteredIndex { name, asc })
65396534
})?;
@@ -11069,9 +11064,9 @@ impl<'a> Parser<'a> {
1106911064
})
1107011065
}
1107111066

11072-
/// Parsae ASC or DESC, returns an Option with true if ASC, false of DESC or `None` if none of
11067+
/// Parse ASC or DESC, returns an Option with true if ASC, false of DESC or `None` if none of
1107311068
/// them.
11074-
pub fn parse_asc(&mut self) -> Option<bool> {
11069+
pub fn parse_asc_desc(&mut self) -> Option<bool> {
1107511070
if self.parse_keyword(Keyword::ASC) {
1107611071
Some(true)
1107711072
} else if self.parse_keyword(Keyword::DESC) {
@@ -11085,7 +11080,7 @@ impl<'a> Parser<'a> {
1108511080
pub fn parse_order_by_expr(&mut self) -> Result<OrderByExpr, ParserError> {
1108611081
let expr = self.parse_expr()?;
1108711082

11088-
let asc = self.parse_asc();
11083+
let asc = self.parse_asc_desc();
1108911084

1109011085
let nulls_first = if self.parse_keywords(&[Keyword::NULLS, Keyword::FIRST]) {
1109111086
Some(true)

tests/sqlparser_mssql.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ fn parse_create_table_with_valid_options() {
791791

792792
for (sql, with_options) in options {
793793
assert_eq!(
794-
ms().verified_stmt(sql),
794+
ms_and_generic().verified_stmt(sql),
795795
Statement::CreateTable(CreateTable {
796796
or_replace: false,
797797
temporary: false,
@@ -900,7 +900,7 @@ fn parse_create_table_with_invalid_options() {
900900
];
901901

902902
for (sql, expected_error) in invalid_cases {
903-
let res = ms().parse_sql_statements(sql);
903+
let res = ms_and_generic().parse_sql_statements(sql);
904904
assert_eq!(
905905
format!("sql parser error: {expected_error}"),
906906
res.unwrap_err().to_string()

0 commit comments

Comments
 (0)