From afe5fe75f12fe422993ee354023792114a2f6c82 Mon Sep 17 00:00:00 2001 From: wangfeihuo Date: Thu, 10 Oct 2024 19:22:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D"=E4=B8=8D=E8=83=BD=E8=A2=AB?= =?UTF-8?q?=E8=BD=AC=E4=B9=89=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/psql/psqlscan.l | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/bin/psql/psqlscan.l b/src/bin/psql/psqlscan.l index 6aafa2af8..6fa2154d0 100644 --- a/src/bin/psql/psqlscan.l +++ b/src/bin/psql/psqlscan.l @@ -386,9 +386,11 @@ dolqinside [^$]+ */ dquote \" xdstart {dquote} +xdescape [\\]{dquote} xdstop {dquote} xddouble {dquote}{dquote} -xdinside [^"]+ +xdinside [^"\\]+ +xdinside2 [\\][^"] /* Unicode escapes */ uescape [uU][eE][sS][cC][aA][pP][eE]{whitespace}*{quote}[^']{quote} @@ -772,6 +774,19 @@ other . {xddouble} { ECHO; } +{xdescape} { + if (cur_state->is_b_format) { + ECHO; + } else { + BEGIN(INITIAL); + ECHO; + if (cur_state->is_end_state) { + RESET_XP_STATUS() ; + cur_state->is_end_state = false; + return LEXRES_SEMI; + } + } + } {xdinside} { ECHO; if ((lex_param->begin_state == BEGIN_CURSOR || @@ -781,7 +796,15 @@ other . cur_state->is_end_state = true; } } - +{xdinside2} { + ECHO; + if ((lex_param->begin_state == BEGIN_CURSOR || + ( !lex_param->declare_encountered && cur_state->paren_depth == 0)) + && judge_end_state(yytext)) + { + cur_state->is_end_state = true; + } + } {xufailed} { /* throw back all but the initial u/U */ yyless(1);