Skip to content

Commit

Permalink
fix: binary_expr type
Browse files Browse the repository at this point in the history
  • Loading branch information
DemonHa committed Apr 16, 2024
1 parent 28b3764 commit 3bb0f64
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 11 deletions.
36 changes: 30 additions & 6 deletions ast/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,36 @@ export type join_op = 'LEFT JOIN' | 'RIGHT JOIN' | 'FULL JOIN' | 'CROSS JOIN' |

export type table_name = { db?: ident; schema?: ident, table: ident | '*'; };

export type binary_expr = {
type: 'binary_expr';
operator: string;
left: string;
right: string;
}
export type BINARY_OPERATORS =
| LOGIC_OPERATOR
| "OR"
| "AND"
| multiplicative_operator
| additive_operator
| arithmetic_comparison_operator
| "IN"
| "NOT IN"
| "BETWEEN"
| "NOT BETWEEN"
| "IS"
| "IS NOT"
| "LIKE"
| "@>"
| "<@"
| OPERATOR_CONCATENATION
| DOUBLE_WELL_ARROW
| WELL_ARROW
| "?"
| "?|"
| "?&"
| "#-";

export type binary_expr = {
type: "binary_expr";
operator: BINARY_OPERATORS;
left: expr;
right: expr;
};

export type or_and_expr = binary_expr;

Expand Down
34 changes: 29 additions & 5 deletions pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -3188,12 +3188,36 @@ table_name
or_and_expr
= head:expr tail:(__ (KW_AND / KW_OR) __ expr)* {
/*
export type BINARY_OPERATORS =
| LOGIC_OPERATOR
| "OR"
| "AND"
| multiplicative_operator
| additive_operator
| arithmetic_comparison_operator
| "IN"
| "NOT IN"
| "BETWEEN"
| "NOT BETWEEN"
| "IS"
| "IS NOT"
| "LIKE"
| "@>"
| "<@"
| OPERATOR_CONCATENATION
| DOUBLE_WELL_ARROW
| WELL_ARROW
| "?"
| "?|"
| "?&"
| "#-";
export type binary_expr = {
type: 'binary_expr';
operator: string;
left: string;
right: string;
}
type: "binary_expr";
operator: BINARY_OPERATORS;
left: expr;
right: expr;
};
=> binary_expr
*/
const len = tail.length
Expand Down

0 comments on commit 3bb0f64

Please sign in to comment.