Skip to content

Commit

Permalink
refactor: upgrade version
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhi8833998 committed Mar 20, 2022
1 parent 60ae757 commit b04197b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
17 changes: 14 additions & 3 deletions ast/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,11 @@ export interface select_stmt_node extends select_stmt_nake {
parentheses_symbol: true;
}

export type select_stmt = select_stmt_nake | select_stmt_node;
export type select_stmt = { type: 'select'; } | select_stmt_nake | select_stmt_node;

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

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

export type cte_column_definition = column[];

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



export type value_alias_clause = alias_ident;





export type alias_clause = alias_ident | ident;

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



export type from_clause = table_ref_list;
Expand Down Expand Up @@ -1228,6 +1235,8 @@ type KW_VAR__PRE_AT_AT = never;

type KW_VAR_PRE_DOLLAR = never;

type KW_VAR_PRE_DOLLAR_DOUBLE = never;

type KW_VAR_PRE = never;

type KW_RETURN = never;
Expand Down Expand Up @@ -1356,7 +1365,9 @@ export type proc_primary_list = proc_primary[];

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

export type var_decl = without_prefix_var_decl & { type: 'var'; prefix: string; };;
export type var_decl_list = var_decl[];

export type var_decl = { type: 'var'; name: string; prefix: string; suffix: string; }; | without_prefix_var_decl & { type: 'var'; prefix: string; };;

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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-sql-parser",
"version": "4.1.1",
"version": "4.2.0",
"description": "simple node sql parser",
"main": "index.js",
"types": "types.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -3796,7 +3796,7 @@ var_decl_list

var_decl
= p: KW_VAR_PRE_DOLLAR_DOUBLE d:[^$]* s:KW_VAR_PRE_DOLLAR_DOUBLE {
// { type: 'var'; name: string; prefix: string; suffix: string; };
// => { type: 'var'; name: string; prefix: string; suffix: string; };
return {
type: 'var',
name: d.join(''),
Expand All @@ -3805,7 +3805,7 @@ var_decl
};
}
/ 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 {
// { type: 'var'; name: string; prefix: string; suffix: string; };
// => { type: 'var'; name: string; prefix: string; suffix: string; };
return {
type: 'var',
name: d.join(''),
Expand All @@ -3815,7 +3815,7 @@ var_decl
}
/ p: KW_VAR_PRE d: without_prefix_var_decl {
// => without_prefix_var_decl & { type: 'var'; prefix: string; };
//push for analysis
// push for analysis
return {
type: 'var',
...d,
Expand Down
12 changes: 6 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ const getPlugins = (parserName, target, plugins) => [
...getDbFile(),
...getSrcFile(),
],
delete: [
`${outputPath}/*.umd.d.ts`,
`${outputPath}/*.umd.js`,
`${outputPath}/*.umd.js.map`,
`${outputPath}/index.d.ts`
]
// delete: [
// `${outputPath}/*.umd.d.ts`,
// `${outputPath}/*.umd.js`,
// `${outputPath}/*.umd.js.map`,
// `${outputPath}/index.d.ts`
// ]
}
})
] : [
Expand Down

0 comments on commit b04197b

Please sign in to comment.