Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c2338a

Browse files
committed
Fix lexing of U& sequences just before EOF.
Commita5ff502 was a brick shy of a loadin the backend lexer too, not just psql. Per further testing of bug #9068.In passing, improve related comments.
1 parent0def257 commit0c2338a

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

‎src/backend/parser/scan.l

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ extern void core_yyset_column(int column_no, yyscan_t yyscanner);
155155
* <xus> quoted string with Unicode escapes
156156
* <xusend> end of a quoted string with Unicode escapes, UESCAPE can follow
157157
* <xeu> Unicode surrogate pair in extended quoted string
158+
*
159+
* Remember to add an <<EOF>> case whenever you add a new exclusive state!
160+
* The default one is probably not the right thing.
158161
*/
159162

160163
%xxb
@@ -545,12 +548,13 @@ other.
545548
<xus>{quotefail} {
546549
/* throw back all but the quote */
547550
yyless(1);
548-
/*handle possible UESCAPE in xusend mode */
551+
/*xusend state looks for possible UESCAPE */
549552
BEGIN(xusend);
550553
}
551-
<xusend>{whitespace}
554+
<xusend>{whitespace} {/* stay in xusend state over whitespace */ }
552555
<xusend>{other} |
553-
<xusend>{xustop1} {
556+
<xusend>{xustop1} |
557+
<xusend><<EOF>>{
554558
/* no UESCAPE after the quote, throw back everything */
555559
yyless(0);
556560
BEGIN(INITIAL);
@@ -725,12 +729,13 @@ other.
725729
}
726730
<xui>{dquote} {
727731
yyless(1);
728-
/*handle possible UESCAPE in xuiend mode */
732+
/*xuiend state looks for possible UESCAPE */
729733
BEGIN(xuiend);
730734
}
731-
<xuiend>{whitespace} { }
735+
<xuiend>{whitespace} {/* stay in xuiend state over whitespace */}
732736
<xuiend>{other} |
733-
<xuiend>{xustop1} {
737+
<xuiend>{xustop1} |
738+
<xuiend><<EOF>>{
734739
/* no UESCAPE after the quote, throw back everything */
735740
char *ident;
736741

‎src/bin/psql/psqlscan.l

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ static void escape_variable(bool as_ident);
166166
* <xe> extended quoted strings (support backslash escape sequences)
167167
* <xdolq> $foo$ quoted strings
168168
* <xui> quoted identifier with Unicode escapes
169-
* <xuiend> end of a quoted identifier with Unicode escapes, UESCAPE can follow * <xus> quoted string with Unicode escapes
169+
* <xuiend> end of a quoted identifier with Unicode escapes, UESCAPE can follow
170+
* <xus> quoted string with Unicode escapes
170171
* <xusend> end of a quoted string with Unicode escapes, UESCAPE can follow
171172
*
172173
* Note: we intentionally don't mimic the backend's <xeu> state; we have

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp