@@ -1654,10 +1654,10 @@ fn json_key_value(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker {
16541654}
16551655
16561656fn named_arg ( p : & mut Parser < ' _ > , lhs : CompletedMarker ) -> CompletedMarker {
1657- assert ! ( p. at( FAT_ARROW ) || p. at( COLONEQ ) ) ;
1657+ assert ! ( p. at( FAT_ARROW ) || p. at( COLON_EQ ) ) ;
16581658 let m = lhs. precede ( p) ;
1659- if p. at ( COLONEQ ) {
1660- p. bump ( COLONEQ ) ;
1659+ if p. at ( COLON_EQ ) {
1660+ p. bump ( COLON_EQ ) ;
16611661 } else {
16621662 p. bump ( FAT_ARROW ) ;
16631663 }
@@ -1668,9 +1668,9 @@ fn named_arg(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker {
16681668}
16691669
16701670fn cast_expr ( p : & mut Parser < ' _ > , lhs : CompletedMarker ) -> CompletedMarker {
1671- assert ! ( p. at( COLON2 ) ) ;
1671+ assert ! ( p. at( COLON_COLON ) ) ;
16721672 let m = lhs. precede ( p) ;
1673- p. bump ( COLON2 ) ;
1673+ p. bump ( COLON_COLON ) ;
16741674 type_name ( p) ;
16751675 m. complete ( p, CAST_EXPR )
16761676}
@@ -2089,9 +2089,9 @@ fn current_op(p: &Parser<'_>, r: &Restrictions) -> (u8, SyntaxKind, Associativit
20892089 MINUS if p. next_not_joined_op ( 0 ) => ( 8 , MINUS , Left ) , // symbol
20902090 // Later on we return a NAMED_ARG for this instead of BIN_EXPR
20912091 // :=
2092- COLON if p. at ( COLONEQ ) => ( 5 , COLONEQ , Right ) , // symbol
2092+ COLON if p. at ( COLON_EQ ) => ( 5 , COLON_EQ , Right ) , // symbol
20932093 // ::
2094- COLON if p. at ( COLON2 ) => ( 15 , COLON2 , Left ) , // symbol
2094+ COLON if p. at ( COLON_COLON ) => ( 15 , COLON_COLON , Left ) , // symbol
20952095 // Only used in json_object, like json_object('a' value 1) instead of json_object('a': 1)
20962096 // value
20972097 VALUE_KW if r. json_field_arg_allowed => ( 7 , VALUE_KW , Right ) ,
@@ -2159,11 +2159,11 @@ fn expr_bp(p: &mut Parser<'_>, bp: u8, r: &Restrictions) -> Option<CompletedMark
21592159 break ;
21602160 }
21612161 match op {
2162- COLON2 => {
2162+ COLON_COLON => {
21632163 lhs = cast_expr ( p, lhs) ;
21642164 continue ;
21652165 }
2166- FAT_ARROW | COLONEQ => {
2166+ FAT_ARROW | COLON_EQ => {
21672167 lhs = named_arg ( p, lhs) ;
21682168 continue ;
21692169 }
@@ -2740,15 +2740,15 @@ fn data_source(p: &mut Parser<'_>) {
27402740
27412741// USING data_source ON join_condition
27422742fn merge_using_clause ( p : & mut Parser < ' _ > ) {
2743- let m1 = p. start ( ) ;
2743+ let m = p. start ( ) ;
27442744 p. expect ( USING_KW ) ;
27452745 data_source ( p) ;
27462746 p. expect ( ON_KW ) ;
27472747 // join_condition
27482748 if expr ( p) . is_none ( ) {
27492749 p. error ( "expected an expression" ) ;
27502750 }
2751- m1 . complete ( p, USING_CLAUSE ) ;
2751+ m . complete ( p, USING_CLAUSE ) ;
27522752}
27532753
27542754// where from_item can be one of:
@@ -3119,8 +3119,7 @@ fn opt_with_params(p: &mut Parser<'_>) -> Option<CompletedMarker> {
31193119// [ INCLUDE ( column_name [, ... ] ) ]
31203120// [ WITH ( storage_parameter [= value] [, ... ] ) ]
31213121// [ USING INDEX TABLESPACE tablespace_name ]
3122- #[ must_use]
3123- fn opt_index_parameters ( p : & mut Parser < ' _ > ) -> bool {
3122+ fn opt_index_parameters ( p : & mut Parser < ' _ > ) {
31243123 opt_include_columns ( p) ;
31253124 opt_with_params ( p) ;
31263125 if p. at ( USING_KW ) {
@@ -3131,7 +3130,6 @@ fn opt_index_parameters(p: &mut Parser<'_>) -> bool {
31313130 name_ref ( p) ;
31323131 m. complete ( p, CONSTRAINT_INDEX_TABLESPACE ) ;
31333132 }
3134- true
31353133}
31363134
31373135// referential_action in a FOREIGN KEY/REFERENCES constraint is:
@@ -3293,18 +3291,14 @@ fn opt_constraint_inner(p: &mut Parser<'_>) -> Option<SyntaxKind> {
32933291 p. eat ( NOT_KW ) ;
32943292 p. expect ( DISTINCT_KW ) ;
32953293 }
3296- if !opt_index_parameters ( p) {
3297- p. error ( "expected index parameters" ) ;
3298- }
3294+ opt_index_parameters ( p) ;
32993295 UNIQUE_CONSTRAINT
33003296 }
33013297 // PRIMARY KEY index_parameters
33023298 PRIMARY_KW => {
33033299 p. bump ( PRIMARY_KW ) ;
33043300 p. expect ( KEY_KW ) ;
3305- if !opt_index_parameters ( p) {
3306- p. error ( "expected index parameters" ) ;
3307- }
3301+ opt_index_parameters ( p) ;
33083302 PRIMARY_KEY_CONSTRAINT
33093303 }
33103304 // REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
@@ -3506,9 +3500,7 @@ fn table_constraint(p: &mut Parser<'_>) -> CompletedMarker {
35063500 p. eat ( DISTINCT_KW ) ;
35073501 }
35083502 column_list ( p) ;
3509- if !opt_index_parameters ( p) {
3510- p. error ( "expected index parameters" ) ;
3511- }
3503+ opt_index_parameters ( p) ;
35123504 }
35133505 UNIQUE_CONSTRAINT
35143506 }
@@ -3523,9 +3515,7 @@ fn table_constraint(p: &mut Parser<'_>) -> CompletedMarker {
35233515 // ( column_name [, ... ] ) index_parameters
35243516 } else {
35253517 column_list ( p) ;
3526- if !opt_index_parameters ( p) {
3527- p. error ( "expected index parameters" ) ;
3528- }
3518+ opt_index_parameters ( p) ;
35293519 }
35303520 PRIMARY_KEY_CONSTRAINT
35313521 }
@@ -3553,9 +3543,7 @@ fn table_constraint(p: &mut Parser<'_>) -> CompletedMarker {
35533543 }
35543544 p. expect ( R_PAREN ) ;
35553545 m. complete ( p, CONSTRAINT_EXCLUSIONS ) ;
3556- if !opt_index_parameters ( p) {
3557- p. error ( "expected index parameters" ) ;
3558- }
3546+ opt_index_parameters ( p) ;
35593547 if p. at ( WHERE_KW ) {
35603548 let m = p. start ( ) ;
35613549 p. bump ( WHERE_KW ) ;
@@ -3637,7 +3625,7 @@ fn opt_initally_constraint_option(p: &mut Parser<'_>) -> Option<CompletedMarker>
36373625 ( INITIALLY_KW , DEFERRED_KW ) => {
36383626 p. bump ( INITIALLY_KW ) ;
36393627 p. bump ( DEFERRED_KW ) ;
3640- INITALLY_DEFERRED_CONSTRAINT_OPTION
3628+ INITIALLY_DEFERRED_CONSTRAINT_OPTION
36413629 }
36423630 ( INITIALLY_KW , IMMEDIATE_KW ) => {
36433631 p. bump ( INITIALLY_KW ) ;
@@ -3665,7 +3653,7 @@ fn opt_constraint_options(p: &mut Parser<'_>) {
36653653 }
36663654 ( Some ( deferrable) , Some ( initially) ) => {
36673655 if deferrable. kind ( ) == NOT_DEFERRABLE_CONSTRAINT_OPTION
3668- && initially. kind ( ) == INITALLY_DEFERRED_CONSTRAINT_OPTION
3656+ && initially. kind ( ) == INITIALLY_DEFERRED_CONSTRAINT_OPTION
36693657 {
36703658 p. error ( "constraint declared INITIALLY DEFERRED must be DEFERRABLE" ) ;
36713659 }
@@ -4176,9 +4164,8 @@ fn opt_target_el(p: &mut Parser) -> Option<CompletedMarker> {
41764164 return None ;
41774165 } else if p. at ( STAR ) && !p. nth_at_ts ( 1 , OPERATOR_FIRST ) {
41784166 p. bump ( STAR ) ;
4179- true
41804167 } else if expr ( p) . is_some ( ) {
4181- opt_as_col_label ( p) || p . at ( COMMA )
4168+ opt_as_col_label ( p) ;
41824169 } else {
41834170 m. abandon ( p) ;
41844171 p. error ( format ! (
@@ -4562,7 +4549,7 @@ fn commit_stmt(p: &mut Parser<'_>) -> CompletedMarker {
45624549 p. expect ( CHAIN_KW ) ;
45634550 }
45644551 }
4565- m. complete ( p, COMMIT_STMT )
4552+ m. complete ( p, COMMIT )
45664553}
45674554
45684555const TRANSACTION_MODE_FIRST : TokenSet =
@@ -4635,7 +4622,7 @@ fn begin_stmt(p: &mut Parser<'_>) -> CompletedMarker {
46354622 p. expect ( TRANSACTION_KW ) ;
46364623 opt_transaction_mode_list ( p) ;
46374624 }
4638- m. complete ( p, BEGIN_STMT )
4625+ m. complete ( p, BEGIN )
46394626}
46404627
46414628// Sconst
@@ -9179,7 +9166,7 @@ fn drop_aggregate_stmt(p: &mut Parser<'_>) -> CompletedMarker {
91799166 aggregate ( p) ;
91809167 }
91819168 opt_cascade_or_restrict ( p) ;
9182- m. complete ( p, DROP_AGGREGATE_STMT )
9169+ m. complete ( p, DROP_AGGREGATE )
91839170}
91849171
91859172fn source_type_as_target_type ( p : & mut Parser < ' _ > ) {
@@ -10554,6 +10541,18 @@ fn set_session_auth_stmt(p: &mut Parser<'_>) -> CompletedMarker {
1055410541 m. complete ( p, SET_SESSION_AUTH_STMT )
1055510542}
1055610543
10544+ fn transaction_mode_list ( p : & mut Parser < ' _ > ) {
10545+ // TODO: generalize
10546+ // transaction_mode [, ...]
10547+ while !p. at ( EOF ) && p. at_ts ( TRANSACTION_MODE_FIRST ) {
10548+ if !opt_transaction_mode ( p) {
10549+ p. error ( "expected transaction mode" ) ;
10550+ }
10551+ // historical pg syntax doesn't require commas
10552+ p. eat ( COMMA ) ;
10553+ }
10554+ }
10555+
1055710556// SET TRANSACTION transaction_mode [, ...]
1055810557// SET TRANSACTION SNAPSHOT snapshot_id
1055910558// SET SESSION CHARACTERISTICS AS TRANSACTION transaction_mode [, ...]
@@ -10570,32 +10569,14 @@ fn set_transaction_stmt(p: &mut Parser<'_>) -> CompletedMarker {
1057010569 p. expect ( CHARACTERISTICS_KW ) ;
1057110570 p. expect ( AS_KW ) ;
1057210571 p. expect ( TRANSACTION_KW ) ;
10573- // TODO: generalize
10574- // transaction_mode [, ...]
10575- while !p. at ( EOF ) {
10576- if !opt_transaction_mode ( p) {
10577- p. error ( "expected transaction mode" ) ;
10578- }
10579- if !p. eat ( COMMA ) {
10580- break ;
10581- }
10582- }
10572+ transaction_mode_list ( p) ;
1058310573 } else {
1058410574 p. expect ( TRANSACTION_KW ) ;
1058510575 // [ SNAPSHOT snapshot_id ]
1058610576 if p. eat ( SNAPSHOT_KW ) {
1058710577 string_literal ( p) ;
1058810578 } else {
10589- // TODO: generalize
10590- // transaction_mode [, ...]
10591- while !p. at ( EOF ) {
10592- if !opt_transaction_mode ( p) {
10593- break ;
10594- }
10595- if !p. eat ( COMMA ) {
10596- break ;
10597- }
10598- }
10579+ transaction_mode_list ( p) ;
1059910580 }
1060010581 }
1060110582 m. complete ( p, SET_TRANSACTION_STMT )
@@ -12017,7 +11998,7 @@ fn create_index_stmt(p: &mut Parser<'_>) -> CompletedMarker {
1201711998 }
1201811999 // [ WHERE predicate ]
1201912000 opt_where_clause ( p) ;
12020- m. complete ( p, CREATE_INDEX_STMT )
12001+ m. complete ( p, CREATE_INDEX )
1202112002}
1202212003
1202312004// (
@@ -12060,7 +12041,7 @@ fn opt_param_mode(p: &mut Parser<'_>) -> Option<CompletedMarker> {
1206012041 IN_KW => {
1206112042 p. bump ( IN_KW ) ;
1206212043 if p. eat ( OUT_KW ) {
12063- PARAM_INOUT
12044+ PARAM_IN_OUT
1206412045 } else {
1206512046 PARAM_IN
1206612047 }
@@ -12071,7 +12052,7 @@ fn opt_param_mode(p: &mut Parser<'_>) -> Option<CompletedMarker> {
1207112052 }
1207212053 INOUT_KW => {
1207312054 p. bump ( INOUT_KW ) ;
12074- PARAM_INOUT
12055+ PARAM_IN_OUT
1207512056 }
1207612057 _ => {
1207712058 m. abandon ( p) ;
0 commit comments