yyextra->warn_on_first_escape = true;
yyextra->saw_non_ascii = false;
SET_YYLLOC();
- if (standard_conforming_strings)
+ if (yyextra->standard_conforming_strings)
BEGIN(xq);
else
BEGIN(xe);
}
{xusstart} {
SET_YYLLOC();
- if (!standard_conforming_strings)
+ if (!yyextra->standard_conforming_strings)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unsafe use of string constant with Unicode escapes"),
<xe>{xeescape} {
if (yytext[1] == '\'')
{
- if (backslash_quote == BACKSLASH_QUOTE_OFF ||
- (backslash_quote == BACKSLASH_QUOTE_SAFE_ENCODING &&
+ if (yyextra->backslash_quote == BACKSLASH_QUOTE_OFF ||
+ (yyextra->backslash_quote == BACKSLASH_QUOTE_SAFE_ENCODING &&
PG_ENCODING_IS_CLIENT_ONLY(pg_get_client_encoding())))
ereport(ERROR,
(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
yyext->keywords = keywords;
yyext->num_keywords = num_keywords;
+ yyext->backslash_quote = backslash_quote;
+ yyext->escape_string_warning = escape_string_warning;
+ yyext->standard_conforming_strings = standard_conforming_strings;
+
/*
* Make a scan buffer with special termination needed by flex.
*/
{
if (ychar == '\'')
{
- if (yyextra->warn_on_first_escape && escape_string_warning)
+ if (yyextra->warn_on_first_escape && yyextra->escape_string_warning)
ereport(WARNING,
(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
errmsg("nonstandard use of \\' in a string literal"),
}
else if (ychar == '\\')
{
- if (yyextra->warn_on_first_escape && escape_string_warning)
+ if (yyextra->warn_on_first_escape && yyextra->escape_string_warning)
ereport(WARNING,
(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
errmsg("nonstandard use of \\\\ in a string literal"),
static void
check_escape_warning(core_yyscan_t yyscanner)
{
- if (yyextra->warn_on_first_escape && escape_string_warning)
+ if (yyextra->warn_on_first_escape && yyextra->escape_string_warning)
ereport(WARNING,
(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
errmsg("nonstandard use of escape in a string literal"),
const ScanKeyword *keywords;
int num_keywords;
+ /*
+ * Scanner settings to use. These are initialized from the corresponding
+ * GUC variables by scanner_init(). Callers can modify them after
+ * scanner_init() if they don't want the scanner's behavior to follow the
+ * prevailing GUC settings.
+ */
+ int backslash_quote;
+ bool escape_string_warning;
+ bool standard_conforming_strings;
+
/*
* literalbuf is used to accumulate literal values when multiple rules are
* needed to parse a single literal. Call startlit() to reset buffer to