Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 172b125

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 parent 034b065 commit 172b125

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/backend/parser/scan.l

+14-14
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 implements SQL92 embedded 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, which start with -- and extend to the
214-
* next newline, are treated as equivalent to a single whitespace character.
212+
* any problems. Comments that start 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 the SQL92-standard
248+
* Embedded single-quotes are implemented both in the SQL standard
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-
* For SQL92 compatibility, '+' and '-' cannot be the
451+
* For SQL compatibility, '+' and '-' cannot be the
452452
* last char of a multi-char operator unless the operator
453-
* contains chars that are not in SQL92 operators.
453+
* contains chars that are not in SQL operators.
454454
* The idea is to lex '=-' as two operators, but not
455455
* to forbid operator names like '?-' that could not be
456-
* sequences of SQL92 operators.
456+
* sequences of SQL 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 under SQL99 rules, whereas
550+
* which seems appropriate under standard SQL rules, whereas
551551
* the keyword comparison was NOT locale-dependent.
552552
*/
553553
ident = pstrdup(yytext);

0 commit comments

Comments
 (0)