@@ -150,6 +150,48 @@ stmt
150150 / create_domain_stmt
151151 / drop_domain_stmt
152152 / commit_stmt
153+ / create_squence_stmt
154+
155+ create_squence_stmt
156+ = operation :KW_CREATE _
157+ object :KW_SEQUENCE _
158+ if_not_exists :if_not_exists ? _
159+ name :schema_object _
160+ sharing :sharing_clause ? _
161+ settings :sequence_settings ? _
162+ SEMI_COLON {
163+ return {
164+ operation,
165+ object,
166+ if_not_exists,
167+ name,
168+ sharing,
169+ settings,
170+ };
171+ }
172+
173+ sequence_settings
174+ = clauses :(x :(
175+ increment_clause /
176+ maxvalue_clause /
177+ minvalue_clause /
178+ cycle_clause /
179+ cache_clause /
180+ order_clause /
181+ keep_clause /
182+ scale_clause /
183+ session :(KW_SESSION / KW_GLOBAL ) { return { session }; }
184+ ) _ { return x; })* {
185+ return clauses .reduce ((acc , clause ) => ({ ... acc, ... clause }), {});
186+ }
187+
188+ scale_clause
189+ = KW_SCALE _ x :(KW_EXTEND / KW_NOEXTEND ) { return { scale: ` scale ${ x .toLowerCase ()} ` }; }
190+ / scale :KW_NOSCALE { return { scale }; }
191+
192+ shared_clause
193+ = KW_SHARED _ x :(KW_EXTEND / KW_NOEXTEND ) { return { shared: ` shared ${ x .toLowerCase ()} ` }; }
194+ / shared :KW_NOSHARED { return { shared }; }
153195
154196commit_stmt
155197 = operation :KW_COMMIT _
@@ -258,7 +300,7 @@ create_table_stmt
258300 object :KW_TABLE _
259301 type :table_type ? _
260302 name :schema_object _
261- sharing :table_sharing_clause ?
303+ sharing :sharing_clause ?
262304 table :(relational_table / object_table / XMLType_table )
263305 memoptimize_for :table_memoptimize_clauses ? _
264306 parent :table_parent_clause ? _ SEMI_COLON {
@@ -281,7 +323,7 @@ table_type
281323 / immutable :KW_IMMUTABLE ? _ blockchain :KW_BLOCKCHAIN { return { immutable, blockchain }; }
282324 / immutable :KW_IMMUTABLE { return { immutable }; }
283325
284- table_sharing_clause
326+ sharing_clause
285327 = sharing :KW_SHARING _ EQ _ attribute :(KW_METADATA / KW_DATA / KW_NONE / KW_EXTENDED _ KW_DATA ) {
286328 return {
287329 sharing,
@@ -1975,6 +2017,9 @@ maxvalue_clause
19752017increment_clause
19762018 = KW_INCREMENT _ KW_BY _ value :integer { return { increment_by: value }; }
19772019
2020+ keep_clause
2021+ = keep :(KW_KEEP / KW_NOKEEP ) { return { keep }; }
2022+
19782023start_clause
19792024 = KW_START _ KW_WITH _ value :(integer / KW_LIMIT _ KW_VALUE { return ' limit value' ; }) {
19802025 return { start_with: value };
@@ -2903,6 +2948,14 @@ KW_COMMENT = 'comment'i !ident_start { return '
29032948KW_WAIT = 'wait'i !ident_start { return 'wait'; }
29042949KW_NOWAIT = 'nowait'i !ident_start { return 'nowait'; }
29052950KW_BATCH = 'batch'i !ident_start { return 'batch'; }
2951+ KW_SEQUENCE = 'sequence'i !ident_start { return 'sequence'; }
2952+ KW_SESSION = 'session'i !ident_start { return 'session'; }
2953+ KW_NOKEEP = 'nokeep'i !ident_start { return 'nokeep'; }
2954+ KW_SCALE = 'scale'i !ident_start { return 'scale'; }
2955+ KW_NOSCALE = 'noscale'i !ident_start { return 'noscale'; }
2956+ KW_EXTEND = 'extend'i !ident_start { return 'extend'; }
2957+ KW_NOEXTEND = 'noextend'i !ident_start { return 'noextend'; }
2958+ KW_NOSHARED = 'noshared'i !ident_start { return 'noshared'; }
29062959
29072960KW_VARYING = 'varying'i !ident_start { return 'varying'; }
29082961KW_VARCHAR = 'varchar'i !ident_start { return 'varchar'; }
0 commit comments