From 2de72cbb34140f9613c2118238189573497ed2e1 Mon Sep 17 00:00:00 2001 From: Ben King <9087625+benfdking@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:15:05 +0100 Subject: [PATCH] update [ci skip] --- crates/lib-dialects/src/databricks.rs | 85 ++++++++++----------------- 1 file changed, 31 insertions(+), 54 deletions(-) diff --git a/crates/lib-dialects/src/databricks.rs b/crates/lib-dialects/src/databricks.rs index faa643dd..a0aace0b 100644 --- a/crates/lib-dialects/src/databricks.rs +++ b/crates/lib-dialects/src/databricks.rs @@ -2,7 +2,11 @@ use sqruff_lib_core::{ dialects::{base::Dialect, init::DialectKind, syntax::SyntaxKind}, helpers::{Config, ToMatchable}, parser::{ - grammar::{anyof::one_of, base::Ref, sequence::Sequence}, + grammar::{ + anyof::one_of, + base::Ref, + sequence::{Bracketed, Sequence}, + }, lexer::Matcher, }, vec_of_erased, @@ -127,59 +131,28 @@ pub fn dialect() -> Dialect { .to_matchable() .into(), ), - // ( - // "ForeignKeyOptionGrammar".into(), - // Sequence::new(vec_of_erased![ - // Sequence::new(vec_of_erased![Ref::keyword("MATCH"), Ref::keyword("FULL"),]) - // .config(|config| { config.optional() }), - // Sequence::new(vec_of_erased![ - // Ref::keyword("ON"), - // Ref::keyword("UPDATE"), - // Ref::keyword("NO"), - // Ref::keyword("ACTION"), - // ]) - // .config(|config| { config.optional() }), - // Sequence::new(vec_of_erased![ - // Ref::keyword("ON"), - // Ref::keyword("DELETE"), - // Ref::keyword("NO"), - // Ref::keyword("ACTION"), - // ]), - // ]), - // ), - // // DropConstraintGrammar=Sequence( - // // "DROP", - // // OneOf( - // // Sequence( - // // Ref("PrimaryKeyGrammar"), - // // Ref("IfExistsGrammar", optional=True), - // // OneOf( - // // "RESTRICT", - // // "CASCADE", - // // optional=True, - // // ), - // // ), - // // Sequence( - // // Ref("ForeignKeyGrammar"), - // // Ref("IfExistsGrammar", optional=True), - // // Bracketed( - // // Delimited( - // // Ref("ColumnReferenceSegment"), - // // ) - // // ), - // // ), - // // Sequence( - // // "CONSTRAINT", - // // Ref("IfExistsGrammar", optional=True), - // // Ref("ObjectReferenceSegment"), - // // OneOf( - // // "RESTRICT", - // // "CASCADE", - // // optional=True, - // // ), - // // ), - // // ), - // // ), + ( + "ForeignKeyOptionGrammar".into(), + Sequence::new(vec_of_erased![ + Sequence::new(vec_of_erased![Ref::keyword("MATCH"), Ref::keyword("FULL"),]) + .config(|config| { config.optional() }), + Sequence::new(vec_of_erased![ + Ref::keyword("ON"), + Ref::keyword("UPDATE"), + Ref::keyword("NO"), + Ref::keyword("ACTION"), + ]) + .config(|config| { config.optional() }), + Sequence::new(vec_of_erased![ + Ref::keyword("ON"), + Ref::keyword("DELETE"), + Ref::keyword("NO"), + Ref::keyword("ACTION"), + ]), + ]) + .to_matchable() + .into(), + ), // ( // "DropConstraintGrammar".into(), // one_of(vec_of_erased![ @@ -227,6 +200,10 @@ pub fn dialect() -> Dialect { // // ), // // ), // // ), + // ( + // "AlterPropertyGrammar".into(), + // Bracketed + // ) // // RowFilterClauseGrammar=Sequence( // // "ROW", // // "FILTER",