Skip to content

Commit

Permalink
fix!: Consider WITH a top level reserved word
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero authored and shssoichiro committed Jan 24, 2025
1 parent e205542 commit 7142a12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,8 @@ mod tests {
};
let expected = indoc! {
"
WITH a AS (
WITH
a AS (
SELECT a, b, c
FROM t
WHERE a > 100
Expand Down
2 changes: 1 addition & 1 deletion src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ fn get_top_level_reserved_token_no_indent<'i>(input: &mut &'i str) -> PResult<To
terminated("MINUS", end_of_word),
terminated("UNION", end_of_word),
terminated("UNION ALL", end_of_word),
terminated("WITH", end_of_word),
terminated("$$", end_of_word),
))
.parse_next(&mut uc_input);
Expand Down Expand Up @@ -987,7 +988,6 @@ fn get_plain_reserved_one_token<'i>(input: &mut &'i str) -> PResult<Token<'i>> {

'W' => alt((
terminated("WHEN", end_of_word),
terminated("WITH", end_of_word),
terminated("WORK", end_of_word),
terminated("WRITE", end_of_word),
))
Expand Down

0 comments on commit 7142a12

Please sign in to comment.