From d8f62f684d6aad9fb080fde3547177a4c7ec4e4e Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Thu, 8 Jan 2026 22:32:40 -0700 Subject: [PATCH] docs: update site index & minor parser changes --- .../src/generated/syntax_kind.rs | 1 + crates/squawk_parser/src/grammar.rs | 21 +- .../tests__alter_materialized_view_ok.snap | 23 ++- .../snapshots/tests__alter_table_ok.snap | 48 +++-- .../squawk_syntax/src/ast/generated/nodes.rs | 195 +++++++++++++++++- crates/squawk_syntax/src/postgresql.ungram | 144 +++++++------ docs/docs/quick_start.md | 3 + docs/src/pages/index.js | 21 +- 8 files changed, 337 insertions(+), 119 deletions(-) diff --git a/crates/squawk_parser/src/generated/syntax_kind.rs b/crates/squawk_parser/src/generated/syntax_kind.rs index b62f24d8..85b5369f 100644 --- a/crates/squawk_parser/src/generated/syntax_kind.rs +++ b/crates/squawk_parser/src/generated/syntax_kind.rs @@ -967,6 +967,7 @@ pub enum SyntaxKind { OR_REPLACE, OVERLAY_FN, OVER_CLAUSE, + OWNED_BY_ROLES, OWNER_TO, PARALLEL_FUNC_OPTION, PARAM, diff --git a/crates/squawk_parser/src/grammar.rs b/crates/squawk_parser/src/grammar.rs index f3a5c9a5..ffdee05a 100644 --- a/crates/squawk_parser/src/grammar.rs +++ b/crates/squawk_parser/src/grammar.rs @@ -6435,10 +6435,7 @@ fn alter_materialized_view(p: &mut Parser<'_>) -> CompletedMarker { p.expect(IN_KW); p.expect(TABLESPACE_KW); name_ref(p); - if p.eat(OWNED_KW) { - p.expect(BY_KW); - role_list(p); - } + opt_owned_by_roles(p); p.expect(SET_KW); p.expect(TABLESPACE_KW); name(p); @@ -13717,14 +13714,24 @@ fn alter_table(p: &mut Parser<'_>) -> CompletedMarker { relation_name(p); // ALTER TABLE ALL IN TABLESPACE name [ OWNED BY role_name [, ... ] ] // SET TABLESPACE new_tablespace [ NOWAIT ] - if all_in_tablespace && p.eat(OWNED_KW) { - p.expect(BY_KW); - name_ref_list(p); + if all_in_tablespace { + opt_owned_by_roles(p); } opt_alter_table_action_list(p); m.complete(p, ALTER_TABLE) } +fn opt_owned_by_roles(p: &mut Parser<'_>) { + if !p.at(OWNED_KW) { + return; + } + let m = p.start(); + p.bump(OWNED_KW); + p.expect(BY_KW); + role_list(p); + m.complete(p, OWNED_BY_ROLES); +} + const ALTER_TABLE_ACTION_FIRST: TokenSet = TokenSet::new(&[ VALIDATE_KW, REPLICA_KW, diff --git a/crates/squawk_parser/tests/snapshots/tests__alter_materialized_view_ok.snap b/crates/squawk_parser/tests/snapshots/tests__alter_materialized_view_ok.snap index fd62763f..85d85e6a 100644 --- a/crates/squawk_parser/tests/snapshots/tests__alter_materialized_view_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__alter_materialized_view_ok.snap @@ -260,18 +260,19 @@ SOURCE_FILE NAME_REF IDENT "t" WHITESPACE "\n " - OWNED_KW "owned" - WHITESPACE " " - BY_KW "by" - WHITESPACE " " - ROLE_LIST - ROLE - CURRENT_USER_KW "current_user" - COMMA "," + OWNED_BY_ROLES + OWNED_KW "owned" WHITESPACE " " - ROLE - NAME_REF - IDENT "u" + BY_KW "by" + WHITESPACE " " + ROLE_LIST + ROLE + CURRENT_USER_KW "current_user" + COMMA "," + WHITESPACE " " + ROLE + NAME_REF + IDENT "u" WHITESPACE "\n " SET_KW "set" WHITESPACE " " diff --git a/crates/squawk_parser/tests/snapshots/tests__alter_table_ok.snap b/crates/squawk_parser/tests/snapshots/tests__alter_table_ok.snap index 38003817..40c58746 100644 --- a/crates/squawk_parser/tests/snapshots/tests__alter_table_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__alter_table_ok.snap @@ -3517,20 +3517,25 @@ SOURCE_FILE NAME_REF IDENT "foo" WHITESPACE " " - OWNED_KW "owned" - WHITESPACE " " - BY_KW "by" - WHITESPACE " " - NAME_REF - IDENT "a" - COMMA "," - WHITESPACE " " - NAME_REF - IDENT "b" - COMMA "," - WHITESPACE " " - NAME_REF - IDENT "c" + OWNED_BY_ROLES + OWNED_KW "owned" + WHITESPACE " " + BY_KW "by" + WHITESPACE " " + ROLE_LIST + ROLE + NAME_REF + IDENT "a" + COMMA "," + WHITESPACE " " + ROLE + NAME_REF + IDENT "b" + COMMA "," + WHITESPACE " " + ROLE + NAME_REF + IDENT "c" WHITESPACE " \n" SET_TABLESPACE SET_KW "set" @@ -3562,12 +3567,15 @@ SOURCE_FILE NAME_REF IDENT "foo" WHITESPACE " " - OWNED_KW "owned" - WHITESPACE " " - BY_KW "by" - WHITESPACE " " - NAME_REF - IDENT "bar" + OWNED_BY_ROLES + OWNED_KW "owned" + WHITESPACE " " + BY_KW "by" + WHITESPACE " " + ROLE_LIST + ROLE + NAME_REF + IDENT "bar" WHITESPACE "\n" SET_TABLESPACE SET_KW "set" diff --git a/crates/squawk_syntax/src/ast/generated/nodes.rs b/crates/squawk_syntax/src/ast/generated/nodes.rs index 8c00105c..c791d0d3 100644 --- a/crates/squawk_syntax/src/ast/generated/nodes.rs +++ b/crates/squawk_syntax/src/ast/generated/nodes.rs @@ -668,22 +668,54 @@ pub struct AlterIndex { pub(crate) syntax: SyntaxNode, } impl AlterIndex { + #[inline] + pub fn alter_index_action(&self) -> Option { + support::child(&self.syntax) + } #[inline] pub fn if_exists(&self) -> Option { support::child(&self.syntax) } #[inline] + pub fn name_ref(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn owned_by_roles(&self) -> Option { + support::child(&self.syntax) + } + #[inline] pub fn path(&self) -> Option { support::child(&self.syntax) } #[inline] + pub fn all_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::ALL_KW) + } + #[inline] pub fn alter_token(&self) -> Option { support::token(&self.syntax, SyntaxKind::ALTER_KW) } #[inline] + pub fn in_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IN_KW) + } + #[inline] pub fn index_token(&self) -> Option { support::token(&self.syntax, SyntaxKind::INDEX_KW) } + #[inline] + pub fn nowait_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::NOWAIT_KW) + } + #[inline] + pub fn set_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::SET_KW) + } + #[inline] + pub fn tablespace_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::TABLESPACE_KW) + } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -754,11 +786,11 @@ impl AlterMaterializedView { support::child(&self.syntax) } #[inline] - pub fn path(&self) -> Option { + pub fn owned_by_roles(&self) -> Option { support::child(&self.syntax) } #[inline] - pub fn role_list(&self) -> Option { + pub fn path(&self) -> Option { support::child(&self.syntax) } #[inline] @@ -770,10 +802,6 @@ impl AlterMaterializedView { support::token(&self.syntax, SyntaxKind::ALTER_KW) } #[inline] - pub fn by_token(&self) -> Option { - support::token(&self.syntax, SyntaxKind::BY_KW) - } - #[inline] pub fn in_token(&self) -> Option { support::token(&self.syntax, SyntaxKind::IN_KW) } @@ -786,10 +814,6 @@ impl AlterMaterializedView { support::token(&self.syntax, SyntaxKind::NOWAIT_KW) } #[inline] - pub fn owned_token(&self) -> Option { - support::token(&self.syntax, SyntaxKind::OWNED_KW) - } - #[inline] pub fn set_token(&self) -> Option { support::token(&self.syntax, SyntaxKind::SET_KW) } @@ -11579,6 +11603,25 @@ impl OverlayFn { } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct OwnedByRoles { + pub(crate) syntax: SyntaxNode, +} +impl OwnedByRoles { + #[inline] + pub fn role_list(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn by_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::BY_KW) + } + #[inline] + pub fn owned_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::OWNED_KW) + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct OwnerTo { pub(crate) syntax: SyntaxNode, @@ -16547,6 +16590,18 @@ pub enum AlterDomainAction { ValidateConstraint(ValidateConstraint), } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AlterIndexAction { + AlterSetStatistics(AlterSetStatistics), + AttachPartition(AttachPartition), + DependsOnExtension(DependsOnExtension), + NoDependsOnExtension(NoDependsOnExtension), + RenameTo(RenameTo), + ResetOptions(ResetOptions), + SetOptions(SetOptions), + SetTablespace(SetTablespace), +} + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum AlterMaterializedViewAction { DependsOnExtension(DependsOnExtension), @@ -24628,6 +24683,24 @@ impl AstNode for OverlayFn { &self.syntax } } +impl AstNode for OwnedByRoles { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::OWNED_BY_ROLES + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} impl AstNode for OwnerTo { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -28816,6 +28889,108 @@ impl From for AlterDomainAction { AlterDomainAction::ValidateConstraint(node) } } +impl AstNode for AlterIndexAction { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + matches!( + kind, + SyntaxKind::ALTER_SET_STATISTICS + | SyntaxKind::ATTACH_PARTITION + | SyntaxKind::DEPENDS_ON_EXTENSION + | SyntaxKind::NO_DEPENDS_ON_EXTENSION + | SyntaxKind::RENAME_TO + | SyntaxKind::RESET_OPTIONS + | SyntaxKind::SET_OPTIONS + | SyntaxKind::SET_TABLESPACE + ) + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + let res = match syntax.kind() { + SyntaxKind::ALTER_SET_STATISTICS => { + AlterIndexAction::AlterSetStatistics(AlterSetStatistics { syntax }) + } + SyntaxKind::ATTACH_PARTITION => { + AlterIndexAction::AttachPartition(AttachPartition { syntax }) + } + SyntaxKind::DEPENDS_ON_EXTENSION => { + AlterIndexAction::DependsOnExtension(DependsOnExtension { syntax }) + } + SyntaxKind::NO_DEPENDS_ON_EXTENSION => { + AlterIndexAction::NoDependsOnExtension(NoDependsOnExtension { syntax }) + } + SyntaxKind::RENAME_TO => AlterIndexAction::RenameTo(RenameTo { syntax }), + SyntaxKind::RESET_OPTIONS => AlterIndexAction::ResetOptions(ResetOptions { syntax }), + SyntaxKind::SET_OPTIONS => AlterIndexAction::SetOptions(SetOptions { syntax }), + SyntaxKind::SET_TABLESPACE => AlterIndexAction::SetTablespace(SetTablespace { syntax }), + _ => { + return None; + } + }; + Some(res) + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + match self { + AlterIndexAction::AlterSetStatistics(it) => &it.syntax, + AlterIndexAction::AttachPartition(it) => &it.syntax, + AlterIndexAction::DependsOnExtension(it) => &it.syntax, + AlterIndexAction::NoDependsOnExtension(it) => &it.syntax, + AlterIndexAction::RenameTo(it) => &it.syntax, + AlterIndexAction::ResetOptions(it) => &it.syntax, + AlterIndexAction::SetOptions(it) => &it.syntax, + AlterIndexAction::SetTablespace(it) => &it.syntax, + } + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: AlterSetStatistics) -> AlterIndexAction { + AlterIndexAction::AlterSetStatistics(node) + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: AttachPartition) -> AlterIndexAction { + AlterIndexAction::AttachPartition(node) + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: DependsOnExtension) -> AlterIndexAction { + AlterIndexAction::DependsOnExtension(node) + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: NoDependsOnExtension) -> AlterIndexAction { + AlterIndexAction::NoDependsOnExtension(node) + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: RenameTo) -> AlterIndexAction { + AlterIndexAction::RenameTo(node) + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: ResetOptions) -> AlterIndexAction { + AlterIndexAction::ResetOptions(node) + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: SetOptions) -> AlterIndexAction { + AlterIndexAction::SetOptions(node) + } +} +impl From for AlterIndexAction { + #[inline] + fn from(node: SetTablespace) -> AlterIndexAction { + AlterIndexAction::SetTablespace(node) + } +} impl AstNode for AlterMaterializedViewAction { #[inline] fn can_cast(kind: SyntaxKind) -> bool { diff --git a/crates/squawk_syntax/src/postgresql.ungram b/crates/squawk_syntax/src/postgresql.ungram index d1e8a46b..350c0bc8 100644 --- a/crates/squawk_syntax/src/postgresql.ungram +++ b/crates/squawk_syntax/src/postgresql.ungram @@ -92,7 +92,7 @@ CallExpr = | ExistsFn JsonArrayFn = - 'json_array' '(' + 'json_array' '(' ( (JsonSelectFormat (',' JsonSelectFormat)*) JsonNullClause? | (JsonExprFormat (',' JsonExprFormat)*) @@ -115,17 +115,17 @@ JsonExprFormat = JsonEncodingClause = 'encoding' NameRef -SomeFn = +SomeFn = 'some' '(' SelectVariant | Expr ')' -AnyFn = +AnyFn = 'any' '(' SelectVariant | Expr ')' AllFn = 'all' '(' SelectVariant | Expr ')' ExtractFn = - 'extract' '(' + 'extract' '(' ('#ident' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | '@string') 'from' Expr @@ -144,12 +144,12 @@ JsonExistsFn = JsonObjectFn = 'json_object' '(' (JsonReturningClause - | (JsonKeyValue (',' JsonKeyValue)*) + | (JsonKeyValue (',' JsonKeyValue)*) JsonNullClause? JsonKeysUniqueClause? JsonReturningClause? ) - + ')' JsonObjectAggFn = @@ -183,7 +183,7 @@ JsonQueryFn = XmlTable = 'xmltable' - '(' + '(' ('xmlnamespaces' XmlNamespaceList ',') XmlRowPassingClause XmlTableColumnList @@ -192,7 +192,7 @@ XmlTable = XmlRowPassingClause = Expr 'passing' XmlPassingMech? Expr XmlPassingMech? -XmlNamespaceList = +XmlNamespaceList = '(' (XmlNamespace (',' XmlNamespace )*) ')' XmlNamespace = @@ -204,7 +204,7 @@ XmlPassingMech = | 'by' 'value' JsonTable = - 'json_table' '(' + 'json_table' '(' Expr JsonFormatClause? ',' @@ -261,7 +261,7 @@ TrimFn = XmlRootFn = 'xmlroot' '(' - Expr ',' + Expr ',' ('version' 'no' 'value' | 'version' Expr) ( ',' 'standalone' 'yes' @@ -283,8 +283,8 @@ XmlElementFn = 'xmlelement' '(' 'name' Name - ( - ',' 'xmlattributes' '(' + ( + ',' 'xmlattributes' '(' XmlAttributeList ')' (',' (Expr (',' Expr)*))? @@ -516,7 +516,7 @@ DoubleType = 'double' 'precision' Timezone = - WithTimezone + WithTimezone | WithoutTimezone TimeType = @@ -567,8 +567,8 @@ ExprType = Role = 'group'? NameRef -| 'current_role' -| 'current_user' +| 'current_role' +| 'current_user' | 'session_user' RoleList = @@ -794,7 +794,7 @@ Truncate = ('cascade' | 'restrict')? LikeOption = - ('including' | 'excluding') + ('including' | 'excluding') ('comments' | 'compression' | 'constraints' @@ -830,7 +830,7 @@ GroupingRollup = GroupingSets = 'grouping' 'sets' '(' Expr ')' -GroupingCube = +GroupingCube = 'cube' Expr GroupingExpr = @@ -851,8 +851,8 @@ LimitClause = FetchClause = 'fetch' ('first' | 'next') - Expr? - ('row' | 'rows') + Expr? + ('row' | 'rows') ('only' | 'with' 'ties') OffsetClause = @@ -1017,9 +1017,9 @@ NotDeferrable = 'not' 'deferrable' TransactionMode = - Serializable -| RepeatableRead -| ReadCommitted + Serializable +| RepeatableRead +| ReadCommitted | ReadUncommitted | ReadWrite | ReadOnly @@ -1100,14 +1100,14 @@ UsingMethod = PartitionBy = 'partition' 'by' ( - 'range' + 'range' | '#ident' // list | hash ) PartitionItemList CreateTable = - 'create' + 'create' (('global' | 'local')? ('temporary' | 'temp' | 'unlogged' ))? - 'table' IfNotExists? Path + 'table' IfNotExists? Path PartitionOf? OfType? TableArgList @@ -1119,7 +1119,7 @@ CreateTable = Tablespace? CreateIndex = - 'create' 'unique'? 'index' 'concurrently'? (IfNotExists? Name)? 'on' RelationName + 'create' 'unique'? 'index' 'concurrently'? (IfNotExists? Name)? 'on' RelationName UsingMethod? PartitionItemList ConstraintIncludeClause? @@ -1315,14 +1315,14 @@ SetColumn = SetSingleColumn | SetMultipleColumns -SetSingleColumn = +SetSingleColumn = Column '=' SetExpr SetMultipleColumns = - ColumnList - '=' + ColumnList + '=' (SetExprList | ParenSelect) SetExprList = @@ -1369,15 +1369,15 @@ Notify = 'notify' NameRef (',' Literal)? MergeWhenMatched = - 'when' 'matched' + 'when' 'matched' ('and' Expr)? 'then' MergeAction MergeWhenNotMatchedSource = - 'when' 'not' 'matched' 'by' 'source' + 'when' 'not' 'matched' 'by' 'source' ('and' Expr)? 'then' MergeAction MergeWhenNotMatchedTarget = - 'when' 'not' 'matched' ('by' 'target')? + 'when' 'not' 'matched' ('by' 'target')? ('and' Expr)? 'then' MergeAction MergeWhenClause = @@ -1407,7 +1407,7 @@ MergeAction = Merge = WithClause? - 'merge' 'into' RelationName Alias? + 'merge' 'into' RelationName Alias? UsingOnClause MergeWhenClause* ReturningClause? @@ -1447,11 +1447,11 @@ CreateTableAs = (WithData | WithNoData)? CreateMaterializedView = - 'create' 'materialized' 'view' IfNotExists? Path ColumnList? + 'create' 'materialized' 'view' IfNotExists? Path ColumnList? UsingMethod? WithParams? Tablespace? - 'as' + 'as' query:SelectVariant (WithData | WithNoData)? @@ -1584,13 +1584,13 @@ WithoutTimezone = 'without' 'time' 'zone' AttributeOption = - (Name | Name '.' Name) + (Name | Name '.' Name) ('=' AttributeValue)? AttributeValue = Literal -| 'none' -| 'operator' '(' Op ')' +| 'none' +| 'operator' '(' Op ')' | Op | Type @@ -1715,7 +1715,7 @@ FromClause = XmlTableColumnList = (XmlTableColumn (',' XmlTableColumn)*) -XmlTableColumn = +XmlTableColumn = Name Type XmlColumnOptionList? | Name 'for' 'ordinality' @@ -1735,7 +1735,7 @@ ConstraintIndexMethod = ConstraintExclusionList = '(' (ConstraintExclusion (',' ConstraintExclusion)*) ')' -ConstraintExclusion = +ConstraintExclusion = Expr 'with' Op WhereConditionClause = @@ -1811,8 +1811,8 @@ AlterPolicy = 'alter' 'policy' NameRef OnTable (RenameTo | 'to' RoleList - | 'using' '(' Expr ')' - | 'with' 'check' '(' Expr ')' + | 'using' '(' Expr ')' + | 'with' 'check' '(' Expr ')' )? AlterOperatorFamily = @@ -1876,7 +1876,7 @@ DependsOnExtension = AlterMaterializedView = 'alter' 'materialized' 'view' ( - 'all' 'in' 'tablespace' NameRef ('owned' 'by' RoleList)? 'set' 'tablespace' Name 'nowait'? + 'all' 'in' 'tablespace' NameRef OwnedByRoles? 'set' 'tablespace' Name 'nowait'? | IfExists? Path action:AlterMaterializedViewAction* ) @@ -1888,7 +1888,23 @@ AlterLanguage = (RenameTo | OwnerTo)? AlterIndex = - 'alter' 'index' IfExists? Path + 'alter' 'index' ( + 'all' 'in' 'tablespace' Path OwnedByRoles? 'set' 'tablespace' NameRef 'nowait'? +| IfExists? Path AlterIndexAction +) + +OwnedByRoles = + 'owned' 'by' RoleList + +AlterIndexAction = + AttachPartition +| DependsOnExtension +| NoDependsOnExtension +| ResetOptions +| RenameTo +| SetTablespace +| SetOptions +| AlterSetStatistics AlterGroup = 'alter' 'group' Role @@ -1911,10 +1927,10 @@ AlterFunction = 'restrict'? AlterForeignTable = - 'alter' 'foreign' 'table' IfExists? RelationName - (RenameTo - | RenameColumn - | SetSchema + 'alter' 'foreign' 'table' IfExists? RelationName + (RenameTo + | RenameColumn + | SetSchema | AlterTableAction* ) @@ -1932,8 +1948,8 @@ FdwOption = 'options' AlterOptionList | 'handler' Path | 'validator' Path -| 'no' 'handler' -| 'no' 'validator' +| 'no' 'handler' +| 'no' 'validator' AlterEventTrigger = 'alter' 'event' 'trigger' NameRef @@ -1957,7 +1973,7 @@ GrantDefaultPrivileges = RevokeDefaultPrivileges = 'revoke' ('grant' 'option' 'for')? Privileges 'on' PrivilegeTarget 'from' RoleList ('cascade' | 'restrict')? -Privileges = +Privileges = 'all' 'privileges'? ColumnList? | RevokeCommandList ColumnList? @@ -2020,7 +2036,7 @@ AlterCollation = | SetSchema ) -RefreshVersion = +RefreshVersion = 'refresh' 'version' AlterAggregate = @@ -2103,14 +2119,14 @@ CommentOn = ('null' | Literal) Cluster = - 'cluster' - ('verbose' | OptionItemList)? + 'cluster' + ('verbose' | OptionItemList)? Path? UsingMethod? CreateAccessMethod = 'create' 'access' 'method' name:Path - 'type' ('table' | 'index') + 'type' ('table' | 'index') HandlerClause HandlerClause = @@ -2129,8 +2145,8 @@ CreateCollation = 'create' 'collation' Path CreateConversion = - 'create' 'default'? 'conversion' Path - 'for' Literal + 'create' 'default'? 'conversion' Path + 'for' Literal 'to' Literal 'from' Path @@ -2184,7 +2200,7 @@ CreateLanguage = ('handler' Path ('inline' Path)? ('validator' Path)?)? CreateOperator = - 'create' 'operator' + 'create' 'operator' Path? Op AttributeList @@ -2195,7 +2211,7 @@ CreateOperatorClass = 'as' OperatorClassOptionList -OperatorClassOptionList = +OperatorClassOptionList = (OpClassOption (',' OpClassOption)*) CreateOperatorFamily = @@ -2477,10 +2493,10 @@ ImportForeignSchema = IntoSchema AlterOptionList? -LimitToTables = +LimitToTables = 'limit' 'to' (NameRef (',' NameRef)*) -ExceptTables = +ExceptTables = 'except' (NameRef (',' NameRef)*) IntoSchema = @@ -2497,7 +2513,7 @@ Refresh = (WithData | WithNoData)? Grant = - 'grant' + 'grant' (('all' 'privileges'?) | RevokeCommandList) 'on' ('table' (Path (',' Path)*) | 'all' 'tables' 'in' 'schema' (NameRef (',' NameRef)*)) 'to' RoleList @@ -2647,10 +2663,10 @@ VacuumOption = Literal? Copy = - 'copy' + 'copy' ('(' PreparableStmt ')' | 'binary'? Path ColumnList?) ( - ('from' ('stdin' | 'program'? Literal)) + ('from' ('stdin' | 'program'? Literal)) | ('to' ('stdout' | 'program'? Literal)) ) 'with'? diff --git a/docs/docs/quick_start.md b/docs/docs/quick_start.md index f6d0396f..f9d0f1ff 100644 --- a/docs/docs/quick_start.md +++ b/docs/docs/quick_start.md @@ -10,6 +10,9 @@ slug: / ```shell npm install -g squawk-cli +# or +pip install squawk-cli + # or install binaries directly via the releases page https://github.com/sbdchd/squawk/releases ``` diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js index 251ebec1..4803cb1b 100644 --- a/docs/src/pages/index.js +++ b/docs/src/pages/index.js @@ -23,11 +23,10 @@ const features = [ ), }, { - title: "Open Source", + title: "VSCode Support", description: ( <> - squawk is open source and written in Rust. Install it with{" "} - npm install squawk-cli. + Squawk's language server and VSCode extension provides linting in your editor. ), }, @@ -215,17 +214,25 @@ function Home() {

Squawk

- A linter for Postgres migrations & SQL + A linter and language server for Postgres migrations & SQL

-
+
+
+ + npm install -g squawk-cli + +
- Get Started + style={{minWidth: "400px"}} + to="https://marketplace.visualstudio.com/items?itemName=squawk.squawk-vscode"> + Install VSCode Extension + + See other install methods