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 errmsg_internal(const char *fmt,...)
#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}*
362self [,()\[\].;\:\+\-\*\/\%\^<>\=]
363op_chars [\~\!\@\#\^\&\|\`\?\+\-\*\/\%<>\=]
382decinteger {decdigit}(_?{decdigit})*
383hexinteger 0[xX](_?{hexdigit})+
384octinteger 0[oO](_?{octdigit})+
385bininteger 0[bB](_?{bindigit})+
391numeric (({decinteger}\.{decinteger}?)|(\.{decinteger}))
392numericfail {decinteger}\.\.
394real ({decinteger}|{numeric})[Ee][-+]?{decinteger}
395realfail ({decinteger}|{numeric})[Ee][-+]
417integer_junk {decinteger}{identifier}
418numeric_junk {numeric}{identifier}
419real_junk {real}{identifier}
420param_junk \${decdigit}+{identifier}
479 yyerror(
"unterminated /* comment");
499<xb><<EOF>> {
yyerror(
"unterminated bit string literal"); }
513<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)
542 yyextra->saw_non_ascii =
false;
548 yyextra->saw_non_ascii =
false;
559<xb,xh,xq,xe,xus>{quote} {
571<xqs>{quotecontinue} {
579<xqs>{quotecontinuefail} |
590 switch (
yyextra->state_before_str_stop)
614 yyerror(
"unhandled previous state in xqs");
bool pg_verifymbstr(const char *mbstr, int len, bool noError)
618<xq,xe,xus>{xqdouble} {
641 yyerror(
"invalid Unicode surrogate pair");
static bool is_utf16_surrogate_first(char32_t c)
static bool is_utf16_surrogate_second(char32_t c)
657 yyerror(
"invalid Unicode surrogate pair");
static char32_t surrogate_pair_to_codepoint(char16_t first, char16_t second)
673 yyerror(
"invalid Unicode surrogate pair");
675<xe,xeu>{xeunicodefail} {
680 errmsg(
"invalid Unicode escape"),
681 errhint(
"Unicode escapes must be \\uXXXX or \\UXXXXXXXX."),
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define lexer_errposition()
692 errmsg(
"unsafe use of \\' in a string literal"),
693 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)
717<xq,xe,xus><<EOF>> {
yyerror(
"unterminated quoted string"); }
void pfree(void *pointer)
762<xdolq><<EOF>> {
yyerror(
"unterminated dollar-quoted string"); }
779 yyerror(
"zero-length delimited identifier");
void truncate_identifier(char *ident, int len, bool warn)
789 yyerror(
"zero-length delimited identifier");
800<xd,xui><<EOF>> {
yyerror(
"unterminated quoted identifier"); }
char * downcase_truncate_identifier(const char *ident, int len, bool warn)
892 (
yytext[nchars - 1] ==
'+' ||
893 yytext[nchars - 1] ==
'-'))
897 for (
ic = nchars - 2;
ic >= 0;
ic--)
900 if (
c ==
'~' ||
c ==
'!' ||
c ==
'@' ||
901 c ==
'#' ||
c ==
'^' ||
c ==
'&' ||
902 c ==
'|' ||
c ==
'`' ||
c ==
'?' ||
914 }
while (nchars > 1 &&
915 (
yytext[nchars - 1] ==
'+' ||
916 yytext[nchars - 1] ==
'-'));
976 yyerror(
"parameter number too large");
int32 pg_strtoint32_safe(const char *s, Node *escontext)
982 yyerror(
"trailing junk after parameter");
1003 yyerror(
"invalid hexadecimal integer");
1007 yyerror(
"invalid octal integer");
1011 yyerror(
"invalid binary integer");
1031 yyerror(
"trailing junk after numeric literal");
1035 yyerror(
"trailing junk after numeric literal");
1039 yyerror(
"trailing junk after numeric literal");
1043 yyerror(
"trailing junk after numeric literal");
1093#define yyextra (((struct yyguts_t *) yyscanner)->yyextra_r)
1097#define yylloc (((struct yyguts_t *) yyscanner)->yylloc_r)
1099#define yyleng (((struct yyguts_t *) yyscanner)->yyleng_r)
1206 errmsg(
"%s at end of input",
_(message)),
1214 errmsg(
"%s at or near \"%s\"",
_(message), loc),
1227 const uint16 *keyword_tokens)
1237 yyext->keywordlist = keywordlist;
1238 yyext->keyword_tokens = keyword_tokens;
1252 yyext->literalalloc = 1024;
1254 yyext->literallen = 0;
1276 if (
yyextra->scanbuflen >= 8192)
1278 if (
yyextra->literalalloc >= 8192)
1358 yyerror(
"invalid Unicode escape value");
1390 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