54#define fprintf(file, fmt, msg) fprintf_to_ereport(fmt, msg)
78#define PG_KEYWORD(kwname, value, category, collabel) value,
89#define YYSTYPE core_YYSTYPE
98#define SET_YYLLOC() (*(yylloc) = yytext - yyextra->scanbuf)
103#define ADVANCE_YYLLOC(delta) ( *(yylloc) += (delta) )
114#define PUSH_YYLLOC() (yyextra->save_yylloc = *(yylloc))
115#define POP_YYLLOC() (*(yylloc) = yyextra->save_yylloc)
117#define startlit() ( yyextra->literallen = 0 )
125#define yyerror(msg) scanner_yyerror(msg, yyscanner)
127#define lexer_errposition() scanner_errposition(*(yylloc), yyscanner)
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
@ BACKSLASH_QUOTE_SAFE_ENCODING
static void addlitchar(unsigned char ychar, core_yyscan_t yyscanner)
static int process_integer_literal(const char *token, YYSTYPE *lval, int base)
static char * litbufdup(core_yyscan_t yyscanner)
static void fprintf_to_ereport(const char *fmt, const char *msg)
static void addlit(char *ytext, int yleng, core_yyscan_t yyscanner)
static unsigned char unescape_single_char(unsigned char c, core_yyscan_t yyscanner)
static void addunicode(char32_t c, yyscan_t yyscanner)
const uint16 ScanKeywordTokens[]
133%option bison-locations
135%option never-interactive
144%option prefix="core_yy"
145%option extra-type="core_yy_extra_type *"
205non_newline_space [ \t\f\v]
209comment ("--"{non_newline}*)
211whitespace ({space}+|{comment})
220special_whitespace ({space}+|{comment}{newline})
221non_newline_whitespace ({non_newline_space}|{comment})
222whitespace_with_newline ({non_newline_whitespace}*{newline}{special_whitespace}*)
226quotecontinue {whitespace_with_newline}{quote}
235quotecontinuefail {whitespace}*"-"?
260xeoctesc [\\][0-7]{1,3}
261xehexesc [\\]x[0-9A-Fa-f]{1,2}
262xeunicode [\\](u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})
263xeunicodefail [\\](u[0-9A-Fa-f]{0,3}|U[0-9A-Fa-f]{0,7})
269xqdouble {quote}{quote}
281dolq_start [A-Za-z\200-\377_]
282dolq_cont [A-Za-z\200-\377_0-9]
283dolqdelim \$({dolq_start}{dolq_cont}*)?\$
284dolqfailed \${dolq_start}{dolq_cont}*
293xddouble {dquote}{dquote}
297xuistart [uU]&{dquote}
324xcstart \/\*{op_chars}*
328ident_start [A-Za-z\200-\377_]
329ident_cont [A-Za-z\200-\377_0-9\$]
331identifier {ident_start}{ident_cont}*
364self [,()\[\].;\:\|\+\-\*\/\%\^<>\=]
365op_chars [\~\!\@\#\^\&\|\`\?\+\-\*\/\%<>\=]
384decinteger {decdigit}(_?{decdigit})*
385hexinteger 0[xX](_?{hexdigit})+
386octinteger 0[oO](_?{octdigit})+
387bininteger 0[bB](_?{bindigit})+
393numeric (({decinteger}\.{decinteger}?)|(\.{decinteger}))
394numericfail {decinteger}\.\.
396real ({decinteger}|{numeric})[Ee][-+]?{decinteger}
397realfail ({decinteger}|{numeric})[Ee][-+]
419integer_junk {decinteger}{identifier}
420numeric_junk {numeric}{identifier}
421real_junk {real}{identifier}
422param_junk \${decdigit}+{identifier}
481 yyerror(
"unterminated /* comment");
501<xb><<EOF>> {
yyerror(
"unterminated bit string literal"); }
515<xh><<EOF>> {
yyerror(
"unterminated hexadecimal string literal"); }
int ScanKeywordLookup(const char *str, const ScanKeywordList *keywords)
static const char * GetScanKeyword(int n, const ScanKeywordList *keywords)
char * pstrdup(const char *in)
544 yyextra->saw_non_ascii =
false;
550 yyextra->saw_non_ascii =
false;
561<xb,xh,xq,xe,xus>{quote} {
573<xqs>{quotecontinue} {
581<xqs>{quotecontinuefail} |
592 switch (
yyextra->state_before_str_stop)
616 yyerror(
"unhandled previous state in xqs");
bool pg_verifymbstr(const char *mbstr, int len, bool noError)
620<xq,xe,xus>{xqdouble} {
643 yyerror(
"invalid Unicode surrogate pair");
static bool is_utf16_surrogate_first(char32_t c)
static bool is_utf16_surrogate_second(char32_t c)
659 yyerror(
"invalid Unicode surrogate pair");
static char32_t surrogate_pair_to_codepoint(char16_t first, char16_t second)
675 yyerror(
"invalid Unicode surrogate pair");
677<xe,xeu>{xeunicodefail} {
682 errmsg(
"invalid Unicode escape"),
683 errhint(
"Unicode escapes must be \\uXXXX or \\UXXXXXXXX."),
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
#define lexer_errposition()
694 errmsg(
"unsafe use of \\' in a string literal"),
695 errhint(
"Use '' to write quotes in strings. \\' is insecure in client-only encodings."),
int pg_get_client_encoding(void)
#define PG_ENCODING_IS_CLIENT_ONLY(_enc)
#define IS_HIGHBIT_SET(ch)
719<xq,xe,xus><<EOF>> {
yyerror(
"unterminated quoted string"); }
void pfree(void *pointer)
764<xdolq><<EOF>> {
yyerror(
"unterminated dollar-quoted string"); }
781 yyerror(
"zero-length delimited identifier");
void truncate_identifier(char *ident, int len, bool warn)
791 yyerror(
"zero-length delimited identifier");
802<xd,xui><<EOF>> {
yyerror(
"unterminated quoted identifier"); }
char * downcase_truncate_identifier(const char *ident, int len, bool warn)
899 (
yytext[nchars - 1] ==
'+' ||
900 yytext[nchars - 1] ==
'-'))
904 for (
ic = nchars - 2;
ic >= 0;
ic--)
907 if (
c ==
'~' ||
c ==
'!' ||
c ==
'@' ||
908 c ==
'#' ||
c ==
'^' ||
c ==
'&' ||
909 c ==
'|' ||
c ==
'`' ||
c ==
'?' ||
921 }
while (nchars > 1 &&
922 (
yytext[nchars - 1] ==
'+' ||
923 yytext[nchars - 1] ==
'-'));
985 yyerror(
"parameter number too large");
int32 pg_strtoint32_safe(const char *s, Node *escontext)
991 yyerror(
"trailing junk after parameter");
1012 yyerror(
"invalid hexadecimal integer");
1016 yyerror(
"invalid octal integer");
1020 yyerror(
"invalid binary integer");
1040 yyerror(
"trailing junk after numeric literal");
1044 yyerror(
"trailing junk after numeric literal");
1048 yyerror(
"trailing junk after numeric literal");
1052 yyerror(
"trailing junk after numeric literal");
1102#define yyextra (((struct yyguts_t *) yyscanner)->yyextra_r)
1106#define yylloc (((struct yyguts_t *) yyscanner)->yylloc_r)
1108#define yyleng (((struct yyguts_t *) yyscanner)->yyleng_r)
1215 errmsg(
"%s at end of input",
_(message)),
1223 errmsg(
"%s at or near \"%s\"",
_(message), loc),
1236 const uint16 *keyword_tokens)
1246 yyext->keywordlist = keywordlist;
1247 yyext->keyword_tokens = keyword_tokens;
1261 yyext->literalalloc = 1024;
1263 yyext->literallen = 0;
1285 if (
yyextra->scanbuflen >= 8192)
1287 if (
yyextra->literalalloc >= 8192)
1367 yyerror(
"invalid Unicode escape value");
1399 yyextra->saw_non_ascii =
true;
ErrorContextCallback * error_context_stack
int errposition(int cursorpos)
int pg_mbstrlen_with_len(const char *mbstr, int limit)
void pg_unicode_to_server(char32_t c, unsigned char *s)
void * repalloc(void *pointer, Size size)
static uint32 pg_nextpower2_32(uint32 num)
static char buf[DEFAULT_XLOG_SEG_SIZE]
#define MAX_UNICODE_EQUIVALENT_STRING
static bool is_valid_unicode_codepoint(char32_t c)
int scanner_errposition(int location, core_yyscan_t yyscanner)
core_yyscan_t scanner_init(const char *str, core_yy_extra_type *yyext, const ScanKeywordList *keywordlist, const uint16 *keyword_tokens)
void * core_yyrealloc(void *ptr, yy_size_t bytes, core_yyscan_t yyscanner)
static void scb_error_callback(void *arg)
void setup_scanner_errposition_callback(ScannerCallbackState *scbstate, core_yyscan_t yyscanner, int location)
void scanner_finish(core_yyscan_t yyscanner)
void cancel_scanner_errposition_callback(ScannerCallbackState *scbstate)
void * core_yyalloc(yy_size_t bytes, core_yyscan_t yyscanner)
void core_yyfree(void *ptr, core_yyscan_t yyscanner)
void scanner_yyerror(const char *message, core_yyscan_t yyscanner)
struct ErrorContextCallback * previous