Skip to content

Commit

Permalink
move phrases from reserved to oneline
Browse files Browse the repository at this point in the history
  • Loading branch information
DerTimonius committed Dec 6, 2023
1 parent d9db4ca commit c33c509
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/languages/bigquery/bigquery.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const reservedClauses = expandPhrases([
'UPDATE SET',
// Data definition, https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language
'CREATE [OR REPLACE] [MATERIALIZED] VIEW [IF NOT EXISTS]',
'CREATE [OR REPLACE] [TEMP|TEMPORARY|SNAPSHOT|EXTERNAL] TABLE [IF NOT EXISTS]',

'CLUSTER BY',
'FOR SYSTEM_TIME AS OF', // CREATE SNAPSHOT TABLE
Expand All @@ -42,6 +41,8 @@ const reservedClauses = expandPhrases([
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [OR REPLACE] [TEMP|TEMPORARY|SNAPSHOT|EXTERNAL] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE',
// - delete:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/db2/db2.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ const reservedClauses = expandPhrases([
'INSERT',
// Data definition
'CREATE [OR REPLACE] VIEW',
'CREATE [GLOBAL TEMPORARY | EXTERNAL] TABLE [IF NOT EXISTS]',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [GLOBAL TEMPORARY | EXTERNAL] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE',
'WHERE CURRENT OF',
Expand Down
3 changes: 2 additions & 1 deletion src/languages/db2i/db2i.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ const reservedClauses = expandPhrases([
'DELETE',
'INSERT',
// Data definition - table
'CREATE [OR REPLACE] TABLE',
'FOR SYSTEM NAME',
// Data definition - view
'CREATE [OR REPLACE] [RECURSIVE] VIEW',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [OR REPLACE] TABLE',
// - update:
'UPDATE',
'WHERE CURRENT OF',
Expand Down
3 changes: 2 additions & 1 deletion src/languages/hive/hive.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ const reservedClauses = expandPhrases([
'[OVERWRITE] INTO TABLE',
// Data definition
'CREATE [MATERIALIZED] VIEW [IF NOT EXISTS]',
'CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS]',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE',
// - delete:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/mariadb/mariadb.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ const reservedClauses = expandPhrases([
'SET',
// Data definition
'CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]',
'CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]',
// other
'RETURNING',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE [LOW_PRIORITY] [IGNORE]',
// - delete:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/mysql/mysql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ const reservedClauses = expandPhrases([
'SET',
// Data definition
'CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]',
'CREATE [TEMPORARY] TABLE [IF NOT EXISTS]',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [TEMPORARY] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE [LOW_PRIORITY] [IGNORE]',
// - delete:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/plsql/plsql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ const reservedClauses = expandPhrases([
// Data definition
'CREATE [OR REPLACE] [NO FORCE | FORCE] [EDITIONING | EDITIONABLE | EDITIONABLE EDITIONING | NONEDITIONABLE] VIEW',
'CREATE MATERIALIZED VIEW',
'CREATE [GLOBAL TEMPORARY | PRIVATE TEMPORARY | SHARDED | DUPLICATED | IMMUTABLE BLOCKCHAIN | BLOCKCHAIN | IMMUTABLE] TABLE',
// other
'RETURNING',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [GLOBAL TEMPORARY | PRIVATE TEMPORARY | SHARDED | DUPLICATED | IMMUTABLE BLOCKCHAIN | BLOCKCHAIN | IMMUTABLE] TABLE',
// - update:
'UPDATE [ONLY]',
// - delete:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/postgresql/postgresql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ const reservedClauses = expandPhrases([
// Data definition
'CREATE [OR REPLACE] [TEMP | TEMPORARY] [RECURSIVE] VIEW',
'CREATE MATERIALIZED VIEW [IF NOT EXISTS]',
'CREATE [GLOBAL | LOCAL] [TEMPORARY | TEMP | UNLOGGED] TABLE [IF NOT EXISTS]',
// other
'RETURNING',
]);

const onelineClauses = expandPhrases([
// - create
'CREATE [GLOBAL | LOCAL] [TEMPORARY | TEMP | UNLOGGED] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE [ONLY]',
'WHERE CURRENT OF',
Expand Down
3 changes: 2 additions & 1 deletion src/languages/redshift/redshift.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ const reservedClauses = expandPhrases([
'SET',
// Data definition
'CREATE [OR REPLACE | MATERIALIZED] VIEW',
'CREATE [TEMPORARY | TEMP | LOCAL TEMPORARY | LOCAL TEMP] TABLE [IF NOT EXISTS]',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [TEMPORARY | TEMP | LOCAL TEMPORARY | LOCAL TEMP] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE',
// - delete:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/singlestoredb/singlestoredb.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ const reservedClauses = expandPhrases([
'SET',
// Data definition
'CREATE VIEW',
'CREATE [ROWSTORE] [REFERENCE | TEMPORARY | GLOBAL TEMPORARY] TABLE [IF NOT EXISTS]',
'CREATE [OR REPLACE] [TEMPORARY] PROCEDURE [IF NOT EXISTS]',
'CREATE [OR REPLACE] [EXTERNAL] FUNCTION',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [ROWSTORE] [REFERENCE | TEMPORARY | GLOBAL TEMPORARY] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE',
// - delete:
Expand Down
5 changes: 3 additions & 2 deletions src/languages/snowflake/snowflake.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ const reservedClauses = expandPhrases([
// - view
'CREATE [OR REPLACE] [SECURE] [RECURSIVE] VIEW [IF NOT EXISTS]',
// - create/drop/merge table
'CREATE [OR REPLACE] [VOLATILE] TABLE [IF NOT EXISTS]',
'CREATE [OR REPLACE] [LOCAL | GLOBAL] {TEMP|TEMPORARY} TABLE [IF NOT EXISTS]',
'CLUSTER BY',
'[WITH] {MASKING POLICY | TAG | ROW ACCESS POLICY}',
'COPY GRANTS',
Expand All @@ -42,6 +40,9 @@ const reservedClauses = expandPhrases([
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [OR REPLACE] [VOLATILE] TABLE [IF NOT EXISTS]',
'CREATE [OR REPLACE] [LOCAL | GLOBAL] {TEMP|TEMPORARY} TABLE [IF NOT EXISTS]',
// - update:
'UPDATE',
// - delete:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/spark/spark.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ const reservedClauses = expandPhrases([
'[OVERWRITE] INTO TABLE',
// Data definition
'CREATE [OR REPLACE] [GLOBAL TEMPORARY | TEMPORARY] VIEW [IF NOT EXISTS]',
'CREATE [EXTERNAL] TABLE [IF NOT EXISTS]',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [EXTERNAL] TABLE [IF NOT EXISTS]',
// - drop table:
'DROP TABLE [IF EXISTS]',
// - alter table:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/sql/sql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ const reservedClauses = expandPhrases([
'SET',
// Data definition
'CREATE [RECURSIVE] VIEW',
'CREATE [GLOBAL TEMPORARY | LOCAL TEMPORARY] TABLE',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [GLOBAL TEMPORARY | LOCAL TEMPORARY] TABLE',
// - update:
'UPDATE',
'WHERE CURRENT OF',
Expand Down
3 changes: 2 additions & 1 deletion src/languages/sqlite/sqlite.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ const reservedClauses = expandPhrases([
'SET',
// Data definition
'CREATE [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]',
'CREATE [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]',
// - update:
'UPDATE [OR ABORT | OR FAIL | OR IGNORE | OR REPLACE | OR ROLLBACK]',
// - insert:
Expand Down
3 changes: 2 additions & 1 deletion src/languages/transactsql/transactsql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ const reservedClauses = expandPhrases([
'UPDATE SET',
// Data definition
'CREATE [OR ALTER] [MATERIALIZED] VIEW',
'CREATE TABLE',
'CREATE [OR ALTER] {PROC | PROCEDURE}',
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE TABLE',
// - update:
'UPDATE',
'WHERE CURRENT OF',
Expand Down
3 changes: 2 additions & 1 deletion src/languages/trino/trino.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const reservedClauses = expandPhrases([
'SET',
// Data definition
'CREATE [OR REPLACE] [MATERIALIZED] VIEW',
'CREATE TABLE [IF NOT EXISTS]',
// MATCH_RECOGNIZE
'MATCH_RECOGNIZE',
'MEASURES',
Expand All @@ -40,6 +39,8 @@ const reservedClauses = expandPhrases([
]);

const onelineClauses = expandPhrases([
// - create:
'CREATE TABLE [IF NOT EXISTS]',
// - update:
'UPDATE',
// - delete:
Expand Down

0 comments on commit c33c509

Please sign in to comment.