diff options
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/parser/scan.l | 5 | ||||
| -rw-r--r-- | src/backend/parser/scansup.c | 25 | ||||
| -rw-r--r-- | src/backend/utils/misc/guc.c | 6 |
3 files changed, 31 insertions, 5 deletions
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index c97c9e6ada3..303350fac9a 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -24,7 +24,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.137 2006/09/03 03:19:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.138 2006/09/22 21:39:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -145,6 +145,9 @@ static unsigned char unescape_single_char(unsigned char c); * did not end with a newline. * * XXX perhaps \f (formfeed) should be treated as a newline as well? + * + * XXX if you change the set of whitespace characters, fix scanner_isspace() + * to agree, and see also the plpgsql lexer. */ space [ \t\n\r\f] diff --git a/src/backend/parser/scansup.c b/src/backend/parser/scansup.c index c326ef0e3ab..807338652b4 100644 --- a/src/backend/parser/scansup.c +++ b/src/backend/parser/scansup.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/scansup.c,v 1.33 2006/07/14 14:52:22 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/scansup.c,v 1.34 2006/09/22 21:39:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -183,3 +183,26 @@ truncate_identifier(char *ident, int len, bool warn) ident[len] = '\0'; } } + +/* + * scanner_isspace() --- return TRUE if flex scanner considers char whitespace + * + * This should be used instead of the potentially locale-dependent isspace() + * function when it's important to match the lexer's behavior. + * + * In principle we might need similar functions for isalnum etc, but for the + * moment only isspace seems needed. + */ +bool +scanner_isspace(char ch) +{ + /* This must match scan.l's list of {space} characters */ + /* and plpgsql's scan.l as well */ + if (ch == ' ' || + ch == '\t' || + ch == '\n' || + ch == '\r' || + ch == '\f') + return true; + return false; +} diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 7f7ded9e6a5..9467e6412c6 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.351 2006/09/22 17:41:21 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.352 2006/09/22 21:39:57 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -6155,7 +6155,7 @@ assign_custom_variable_classes(const char *newval, bool doit, GucSource source) initStringInfo(&buf); while ((c = *cp++) != 0) { - if (isspace(c)) + if (isspace((unsigned char) c)) { if (symLen > 0) hasSpaceAfterToken = true; @@ -6173,7 +6173,7 @@ assign_custom_variable_classes(const char *newval, bool doit, GucSource source) continue; } - if (hasSpaceAfterToken || !isalnum(c)) + if (hasSpaceAfterToken || !isalnum((unsigned char) c)) { /* * Syntax error due to token following space after token or non |
