Skip to content

Commit b04197b

Browse files
committed
refactor: upgrade version
1 parent 60ae757 commit b04197b

4 files changed

Lines changed: 24 additions & 13 deletions

File tree

ast/postgresql.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,11 @@ export interface select_stmt_node extends select_stmt_nake {
459459
parentheses_symbol: true;
460460
}
461461

462-
export type select_stmt = select_stmt_nake | select_stmt_node;
462+
export type select_stmt = { type: 'select'; } | select_stmt_nake | select_stmt_node;
463463

464464
export type with_clause = cte_definition[] | [cte_definition & {recursive: true; }];
465465

466-
export type cte_definition = { name: { type: 'default'; value: string; }; stmt: union_stmt; columns?: cte_column_definition; };
466+
export type cte_definition = { name: { type: 'default'; value: string; }; stmt: crud_stmt; columns?: cte_column_definition; };
467467

468468
export type cte_column_definition = column[];
469469

@@ -478,6 +478,7 @@ export type select_stmt_nake = {
478478
distinct?: {type: string; columns?: column_list; };
479479
columns: column_clause;
480480
from?: from_clause;
481+
into?: into_clause;
481482
where?: where_clause;
482483
groupby?: group_by_clause;
483484
having?: having_clause;
@@ -500,10 +501,16 @@ export type column_list_item = { expr: expr; as: null; } | { type: 'cast'; expr:
500501

501502

502503

504+
export type value_alias_clause = alias_ident;
505+
506+
507+
503508

504509

505510
export type alias_clause = alias_ident | ident;
506511

512+
export type into_clause = { keyword: 'var'; type: 'into'; expr: var_decl_list; } | { keyword: 'var'; type: 'into'; expr: literal_string | ident; };
513+
507514

508515

509516
export type from_clause = table_ref_list;
@@ -1228,6 +1235,8 @@ type KW_VAR__PRE_AT_AT = never;
12281235

12291236
type KW_VAR_PRE_DOLLAR = never;
12301237

1238+
type KW_VAR_PRE_DOLLAR_DOUBLE = never;
1239+
12311240
type KW_VAR_PRE = never;
12321241

12331242
type KW_RETURN = never;
@@ -1356,7 +1365,9 @@ export type proc_primary_list = proc_primary[];
13561365

13571366
export type proc_array = { type: 'array'; value: proc_primary_list };
13581367

1359-
export type var_decl = without_prefix_var_decl & { type: 'var'; prefix: string; };;
1368+
export type var_decl_list = var_decl[];
1369+
1370+
export type var_decl = { type: 'var'; name: string; prefix: string; suffix: string; }; | without_prefix_var_decl & { type: 'var'; prefix: string; };;
13601371

13611372
export type without_prefix_var_decl = { type: 'var'; prefix: string; name: ident_name; members: mem_chain; };
13621373

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-sql-parser",
3-
"version": "4.1.1",
3+
"version": "4.2.0",
44
"description": "simple node sql parser",
55
"main": "index.js",
66
"types": "types.d.ts",

pegjs/postgresql.pegjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3796,7 +3796,7 @@ var_decl_list
37963796

37973797
var_decl
37983798
= p: KW_VAR_PRE_DOLLAR_DOUBLE d:[^$]* s:KW_VAR_PRE_DOLLAR_DOUBLE {
3799-
// { type: 'var'; name: string; prefix: string; suffix: string; };
3799+
// => { type: 'var'; name: string; prefix: string; suffix: string; };
38003800
return {
38013801
type: 'var',
38023802
name: d.join(''),
@@ -3805,7 +3805,7 @@ var_decl
38053805
};
38063806
}
38073807
/ KW_VAR_PRE_DOLLAR f:ident KW_VAR_PRE_DOLLAR d:[^$]* KW_VAR_PRE_DOLLAR s:ident !{ if (f !== s) return true } KW_VAR_PRE_DOLLAR {
3808-
// { type: 'var'; name: string; prefix: string; suffix: string; };
3808+
// => { type: 'var'; name: string; prefix: string; suffix: string; };
38093809
return {
38103810
type: 'var',
38113811
name: d.join(''),
@@ -3815,7 +3815,7 @@ var_decl
38153815
}
38163816
/ p: KW_VAR_PRE d: without_prefix_var_decl {
38173817
// => without_prefix_var_decl & { type: 'var'; prefix: string; };
3818-
//push for analysis
3818+
// push for analysis
38193819
return {
38203820
type: 'var',
38213821
...d,

webpack.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ const getPlugins = (parserName, target, plugins) => [
8989
...getDbFile(),
9090
...getSrcFile(),
9191
],
92-
delete: [
93-
`${outputPath}/*.umd.d.ts`,
94-
`${outputPath}/*.umd.js`,
95-
`${outputPath}/*.umd.js.map`,
96-
`${outputPath}/index.d.ts`
97-
]
92+
// delete: [
93+
// `${outputPath}/*.umd.d.ts`,
94+
// `${outputPath}/*.umd.js`,
95+
// `${outputPath}/*.umd.js.map`,
96+
// `${outputPath}/index.d.ts`
97+
// ]
9898
}
9999
})
100100
] : [

0 commit comments

Comments
 (0)