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

Commit172b125

Browse files
committed
Make sure that -- comments extend to the end of the line. This fixes the
misscanning of this construct:SELECT ''hello world''-- SELECT ''goodbye world''::text;
1 parent034b065 commit172b125

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

‎src/backend/parser/scan.l

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.110 2003/08/04 02:40:02 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.111 2003/10/09 19:13:23 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -129,7 +129,7 @@ xhcat{quote}{whitespace_with_newline}{quote}
129129
xnstart[nN]{quote}
130130

131131
/* Extended quote
132-
* xqdouble implementsSQL92embedded quote
132+
* xqdouble implements embedded quote
133133
* xqcat allows strings to cross input lines
134134
*/
135135
quote'
@@ -166,8 +166,7 @@ xdinside[^"]+
166166
* 2. In the operator rule, check for slash-star within the operator, and
167167
* if found throw it back with yyless(). This handles the plus-slash-star
168168
* problem.
169-
* SQL92-style comments, which start with dash-dash, have similar interactions
170-
* with the operator rule.
169+
* Dash-dash comments have similar interactions with the operator rule.
171170
*/
172171
xcstart\/\*{op_chars}*
173172
xcstop\*+\/
@@ -210,8 +209,8 @@ param\${integer}
210209
* In order to make the world safe for Windows and Mac clients as well as
211210
* Unix ones, we accept either \n or \r as a newline. A DOS-style \r\n
212211
* sequence will be seen as two successive newlines, but that doesn't cause
213-
* any problems.SQL92-style comments, whichstart with -- and extend to the
214-
*nextnewline, are treated as equivalent to a single whitespace character.
212+
* any problems.Comments thatstart with -- and extend to the next
213+
* newline are treated as equivalent to a single whitespace character.
215214
*
216215
* NOTE a fine point: if there is no newline following --, we will absorb
217216
* everything to the end of the input as a comment. This is correct. Older
@@ -231,21 +230,22 @@ comment("--"{non_newline}*)
231230
whitespace({space}+|{comment})
232231

233232
/*
234-
*SQL92 requires at least one newline in the whitespace separating
233+
*SQL requires at least one newline in the whitespace separating
235234
* string literals that are to be concatenated. Silly, but who are we
236235
* to argue? Note that {whitespace_with_newline} should not have * after
237236
* it, whereas {whitespace} should generally have a * after it...
238237
*/
239238

240-
horiz_whitespace({horiz_space}|{comment})
241-
whitespace_with_newline({horiz_whitespace}*{newline}{whitespace}*)
239+
special_whitespace({space}+|{comment}{newline})
240+
horiz_whitespace({horiz_space}|{comment})
241+
whitespace_with_newline({horiz_whitespace}*{newline}{special_whitespace}*)
242242

243243
other.
244244

245245
/*
246246
* Quoted strings must allow some special characters such as single-quote
247247
* and newline.
248-
* Embedded single-quotes are implemented both in theSQL92-standard
248+
* Embedded single-quotes are implemented both in theSQLstandard
249249
* style of two adjacent single quotes "''" and in the Postgres/Java style
250250
* of escaped-quote "\'".
251251
* Other embedded escaped characters are matched explicitly and the leading
@@ -448,12 +448,12 @@ other.
448448
nchars = slashstar - yytext;
449449

450450
/*
451-
* ForSQL92 compatibility, '+' and '-' cannot be the
451+
* ForSQL compatibility, '+' and '-' cannot be the
452452
* last char of a multi-char operator unless the operator
453-
* contains chars that are not inSQL92 operators.
453+
* contains chars that are not inSQL operators.
454454
* The idea is to lex '=-' as two operators, but not
455455
* to forbid operator names like '?-' that could not be
456-
* sequences ofSQL92 operators.
456+
* sequences ofSQL operators.
457457
*/
458458
while (nchars >1 &&
459459
(yytext[nchars-1] =='+' ||
@@ -547,7 +547,7 @@ other.
547547
* if necessary.
548548
*
549549
* Note: here we use a locale-dependent case conversion,
550-
* which seems appropriate underSQL99 rules, whereas
550+
* which seems appropriate understandard SQL rules, whereas
551551
* the keyword comparison was NOT locale-dependent.
552552
*/
553553
ident =pstrdup(yytext);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp