From b1ab67e9afd76e57040dc58966a2ef191053938b Mon Sep 17 00:00:00 2001 From: Cedric Vangout Date: Tue, 30 Jan 2024 03:02:38 +0100 Subject: [PATCH] fix: statement start token maps --- crates/codegen/src/get_node_properties.rs | 1 + crates/parser/src/codegen.rs | 1 + crates/parser/src/parse/statement_start.rs | 67 ++++--- .../tests/data/statements/valid/0046.sql | 2 +- .../snapshots/statements/valid/0046@1.snap | 40 +++- .../snapshots/statements/valid/0046@2.snap | 161 ++++++++++++++-- .../snapshots/statements/valid/0046@3.snap | 96 +++++++--- .../snapshots/statements/valid/0046@7.snap | 155 +++++++++++++--- .../snapshots/statements/valid/0046@8.snap | 175 +++++++++++++++--- 9 files changed, 568 insertions(+), 130 deletions(-) diff --git a/crates/codegen/src/get_node_properties.rs b/crates/codegen/src/get_node_properties.rs index a26c6b40..e16a090e 100644 --- a/crates/codegen/src/get_node_properties.rs +++ b/crates/codegen/src/get_node_properties.rs @@ -817,6 +817,7 @@ fn custom_handlers(node: &Node) -> TokenStream { "CompositeTypeStmt" => quote! { tokens.push(TokenProperty::from(Token::Create)); tokens.push(TokenProperty::from(Token::TypeP)); + tokens.push(TokenProperty::from(Token::As)); }, "CreatedbStmt" => quote! { tokens.push(TokenProperty::from(Token::Create)); diff --git a/crates/parser/src/codegen.rs b/crates/parser/src/codegen.rs index 56f8ac4b..0dd1cbad 100644 --- a/crates/parser/src/codegen.rs +++ b/crates/parser/src/codegen.rs @@ -291,6 +291,7 @@ mod tests { vec![ TokenProperty::from(SyntaxKind::Create), TokenProperty::from(SyntaxKind::TypeP), + TokenProperty::from(SyntaxKind::As), ], ) } diff --git a/crates/parser/src/parse/statement_start.rs b/crates/parser/src/parse/statement_start.rs index 1baca2b9..05c2076c 100644 --- a/crates/parser/src/parse/statement_start.rs +++ b/crates/parser/src/parse/statement_start.rs @@ -191,25 +191,57 @@ pub static STATEMENT_START_TOKEN_MAPS: LazyLock