Skip to content

Commit fe00093

Browse files
Merge pull request taozhi8833998#398 from taozhi8833998/bug-new-type
fix new type bug
2 parents 9b6ecb5 + 1aba7c0 commit fe00093

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

ast/postgresql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ export type multiplicative_expr = binary_expr;
645645

646646
export type multiplicative_operator = "*" | "/" | "%";
647647

648-
export type primary = cast_expr | literal | aggr_func | func_call | case_expr | interval_expr | column_ref | param | expr | expr_list | var_decl;
648+
export type primary = cast_expr | literal | aggr_func | func_call | case_expr | interval_expr | column_ref | param | expr | expr_list | var_decl | { type: 'origin'; value: string; };
649649

650650

651651

pegjs/postgresql.pegjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,6 +2139,7 @@ primary
21392139
}
21402140
/ var_decl
21412141
/ __ prepared_symbol:'$'n:literal_numeric {
2142+
// => { type: 'origin'; value: string; }
21422143
return {
21432144
type: 'origin',
21442145
value: `$${n.value}`,

typegen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const ast = peg.parser.parse(syntax);
77

88

99
const built = [];
10-
function checkCode(r) {
10+
function checkCode(r, onName) {
1111
const simple = /^[\s$]*\/\/\s*=>\s*([^$\r\n]+)$/m.exec(r.code);
1212
if (simple) return simple[1].trim();
1313
const complex = /^[\s$]*\/\*([^§]+)\*\//m.exec(r.code);
@@ -20,7 +20,7 @@ function checkCode(r) {
2020
return typecode.substr(at + 2).trim();
2121
}
2222
function buildExpression(r, onName) {
23-
if (r.code) return checkCode(r)
23+
if (r.code) return checkCode(r, onName)
2424
switch (r.type) {
2525
case 'choice':
2626
const ret = r.alternatives

0 commit comments

Comments
 (0)