Skip to content

Commit fb7f701

Browse files
committed
Improve some comments in scanner files
Reviewed-by: John Naylor <john.naylor@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/flat/b239564c-cad0-b23e-c57e-166d883cb97d@enterprisedb.com
1 parent 75d2206 commit fb7f701

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

src/backend/parser/scan.l

+8-6
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ extern void core_yyset_column(int column_no, yyscan_t yyscanner);
174174
* <xb> bit string literal
175175
* <xc> extended C-style comments
176176
* <xd> delimited identifiers (double-quoted identifiers)
177-
* <xh> hexadecimal numeric string
177+
* <xh> hexadecimal byte string
178178
* <xq> standard quoted strings
179179
* <xqs> quote stop (detect continued strings)
180180
* <xe> extended quoted strings (support backslash escape sequences)
@@ -262,7 +262,7 @@ quotecontinuefail {whitespace}*"-"?
262262
xbstart [bB]{quote}
263263
xbinside [^']*
264264

265-
/* Hexadecimal number */
265+
/* Hexadecimal byte string */
266266
xhstart [xX]{quote}
267267
xhinside [^']*
268268

@@ -341,7 +341,6 @@ xcstart \/\*{op_chars}*
341341
xcstop \*+\/
342342
xcinside [^*/]+
343343

344-
digit [0-9]
345344
ident_start [A-Za-z\200-\377_]
346345
ident_cont [A-Za-z\200-\377_0-9\$]
347346

@@ -380,15 +379,18 @@ self [,()\[\].;\:\+\-\*\/\%\^\<\>\=]
380379
op_chars [\~\!\@\#\^\&\|\`\?\+\-\*\/\%\<\>\=]
381380
operator {op_chars}+
382381

383-
/* we no longer allow unary minus in numbers.
384-
* instead we pass it separately to parser. there it gets
385-
* coerced via doNegate() -- Leon aug 20 1999
382+
/*
383+
* Numbers
384+
*
385+
* Unary minus is not part of a number here. Instead we pass it separately to
386+
* the parser, and there it gets coerced via doNegate().
386387
*
387388
* {decimalfail} is used because we would like "1..10" to lex as 1, dot_dot, 10.
388389
*
389390
* {realfail1} and {realfail2} are added to prevent the need for scanner
390391
* backup when the {real} rule fails to match completely.
391392
*/
393+
digit [0-9]
392394

393395
integer {digit}+
394396
decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*))

src/fe_utils/psqlscan.l

+8-6
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
112112
* <xb> bit string literal
113113
* <xc> extended C-style comments
114114
* <xd> delimited identifiers (double-quoted identifiers)
115-
* <xh> hexadecimal numeric string
115+
* <xh> hexadecimal byte string
116116
* <xq> standard quoted strings
117117
* <xqs> quote stop (detect continued strings)
118118
* <xe> extended quoted strings (support backslash escape sequences)
@@ -200,7 +200,7 @@ quotecontinuefail {whitespace}*"-"?
200200
xbstart [bB]{quote}
201201
xbinside [^']*
202202

203-
/* Hexadecimal number */
203+
/* Hexadecimal byte string */
204204
xhstart [xX]{quote}
205205
xhinside [^']*
206206

@@ -279,7 +279,6 @@ xcstart \/\*{op_chars}*
279279
xcstop \*+\/
280280
xcinside [^*/]+
281281

282-
digit [0-9]
283282
ident_start [A-Za-z\200-\377_]
284283
ident_cont [A-Za-z\200-\377_0-9\$]
285284

@@ -318,15 +317,18 @@ self [,()\[\].;\:\+\-\*\/\%\^\<\>\=]
318317
op_chars [\~\!\@\#\^\&\|\`\?\+\-\*\/\%\<\>\=]
319318
operator {op_chars}+
320319

321-
/* we no longer allow unary minus in numbers.
322-
* instead we pass it separately to parser. there it gets
323-
* coerced via doNegate() -- Leon aug 20 1999
320+
/*
321+
* Numbers
322+
*
323+
* Unary minus is not part of a number here. Instead we pass it separately to
324+
* the parser, and there it gets coerced via doNegate().
324325
*
325326
* {decimalfail} is used because we would like "1..10" to lex as 1, dot_dot, 10.
326327
*
327328
* {realfail1} and {realfail2} are added to prevent the need for scanner
328329
* backup when the {real} rule fails to match completely.
329330
*/
331+
digit [0-9]
330332

331333
integer {digit}+
332334
decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*))

src/interfaces/ecpg/preproc/pgc.l

+9-7
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static struct _if_value
130130
* <xc> extended C-style comments
131131
* <xd> delimited identifiers (double-quoted identifiers)
132132
* <xdc> double-quoted strings in C
133-
* <xh> hexadecimal numeric string
133+
* <xh> hexadecimal byte string
134134
* <xn> national character quoted strings
135135
* <xq> standard quoted strings
136136
* <xqs> quote stop (detect continued strings)
@@ -223,7 +223,7 @@ quotecontinuefail {whitespace}*"-"?
223223
xbstart [bB]{quote}
224224
xbinside [^']*
225225

226-
/* Hexadecimal number */
226+
/* Hexadecimal byte string */
227227
xhstart [xX]{quote}
228228
xhinside [^']*
229229

@@ -305,7 +305,6 @@ xcstart \/\*{op_chars}*
305305
xcstop \*+\/
306306
xcinside [^*/]+
307307

308-
digit [0-9]
309308
ident_start [A-Za-z\200-\377_]
310309
ident_cont [A-Za-z\200-\377_0-9\$]
311310

@@ -346,15 +345,18 @@ self [,()\[\].;\:\+\-\*\/\%\^\<\>\=]
346345
op_chars [\~\!\@\#\^\&\|\`\?\+\-\*\/\%\<\>\=]
347346
operator {op_chars}+
348347

349-
/* we no longer allow unary minus in numbers.
350-
* instead we pass it separately to parser. there it gets
351-
* coerced via doNegate() -- Leon aug 20 1999
348+
/*
349+
* Numbers
350+
*
351+
* Unary minus is not part of a number here. Instead we pass it separately to
352+
* the parser, and there it gets coerced via doNegate().
352353
*
353354
* {decimalfail} is used because we would like "1..10" to lex as 1, dot_dot, 10.
354355
*
355356
* {realfail1} and {realfail2} are added to prevent the need for scanner
356357
* backup when the {real} rule fails to match completely.
357358
*/
359+
digit [0-9]
358360

359361
integer {digit}+
360362
decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*))
@@ -603,7 +605,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
603605
return BCONST;
604606
case xh:
605607
if (literalbuf[strspn(literalbuf, "0123456789abcdefABCDEF")] != '\0')
606-
mmerror(PARSE_ERROR, ET_ERROR, "invalid hex string literal");
608+
mmerror(PARSE_ERROR, ET_ERROR, "invalid hexadecimal string literal");
607609
base_yylval.str = psprintf("x'%s'", literalbuf);
608610
return XCONST;
609611
case xq:

0 commit comments

Comments
 (0)