60 #include "pl_reserved_kwlist_d.h"
61 #include "pl_unreserved_kwlist_d.h"
64 #define PG_KEYWORD(kwname, value) value,
82 #define AT_STMT_START(prev_token) \
83 ((prev_token) == ';' || \
84 (prev_token) == K_BEGIN || \
85 (prev_token) == K_THEN || \
86 (prev_token) == K_ELSE || \
87 (prev_token) == K_LOOP)
119 #define MAX_PUSHBACKS 4
153 if (tok1 == IDENT || tok1 == PARAM)
226 else if (!aux1.
lval.word.quoted &&
228 &UnreservedPLKeywords)) >= 0)
231 &UnreservedPLKeywords);
263 (tok2 ==
'=' || tok2 == COLON_EQUALS ||
268 else if (!aux1.
lval.word.quoted &&
270 &UnreservedPLKeywords)) >= 0)
273 &UnreservedPLKeywords);
294 plpgsql_yylval = aux1.
lval;
295 plpgsql_yylloc = aux1.
lloc;
327 auxdata->
leng = strlen(yytext);
332 if (strcmp(auxdata->
lval.str,
"<<") == 0)
334 else if (strcmp(auxdata->
lval.str,
">>") == 0)
335 token = GREATER_GREATER;
336 else if (strcmp(auxdata->
lval.str,
"#") == 0)
341 else if (
token == PARAM)
357 elog(
ERROR,
"too many tokens pushed back");
374 auxdata.
lval = plpgsql_yylval;
375 auxdata.
lloc = plpgsql_yylloc;
405 int startlocation,
int endlocation)
407 Assert(startlocation <= endlocation);
409 endlocation - startlocation);
451 *tok1_loc = aux1.
lloc;
454 *tok2_loc = aux2.
lloc;
476 if (location < 0 ||
scanorig == NULL)
506 (
errcode(ERRCODE_SYNTAX_ERROR),
508 errmsg(
"%s at end of input",
_(message)),
522 (
errcode(ERRCODE_SYNTAX_ERROR),
524 errmsg(
"%s at or near \"%s\"",
_(message), yytext),
542 if (location < 0 ||
scanorig == NULL)
elog(ERROR, "%s: %s", p2, msg)
int internalerrquery(const char *query)
int internalerrposition(int cursorpos)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int ScanKeywordLookup(const char *str, const ScanKeywordList *keywords)
static const char * GetScanKeyword(int n, const ScanKeywordList *keywords)
Assert(fmt[strlen(fmt) - 1] !='\n')
int pg_mbstrlen_with_len(const char *mbstr, int limit)
char * pstrdup(const char *in)
bool plpgsql_parse_dblword(char *word1, char *word2, PLwdatum *wdatum, PLcword *cword)
bool plpgsql_parse_word(char *word1, const char *yytxt, bool lookup, PLwdatum *wdatum, PLword *word)
bool plpgsql_parse_tripword(char *word1, char *word2, char *word3, PLwdatum *wdatum, PLcword *cword)
void plpgsql_scanner_finish(void)
static TokenAuxData pushback_auxdata[MAX_PUSHBACKS]
int plpgsql_scanner_errposition(int location)
#define AT_STMT_START(prev_token)
static void push_back_token(int token, TokenAuxData *auxdata)
static const char * scanorig
static core_yyscan_t yyscanner
static int plpgsql_yytoken
void plpgsql_yyerror(const char *message)
static int plpgsql_yyleng
int plpgsql_location_to_lineno(int location)
static const uint16 UnreservedPLKeywordTokens[]
IdentifierLookup plpgsql_IdentifierLookup
bool plpgsql_token_is_unreserved_keyword(int token)
void plpgsql_append_source_text(StringInfo buf, int startlocation, int endlocation)
static const uint16 ReservedPLKeywordTokens[]
static int pushback_token[MAX_PUSHBACKS]
void plpgsql_peek2(int *tok1_p, int *tok2_p, int *tok1_loc, int *tok2_loc)
int plpgsql_latest_lineno(void)
static int internal_yylex(TokenAuxData *auxdata)
static const char * cur_line_end
static core_yy_extra_type core_yy
static void location_lineno_init(void)
void plpgsql_scanner_init(const char *str)
void plpgsql_push_back_token(int token)
static const char * cur_line_start
@ IDENTIFIER_LOOKUP_NORMAL
core_yyscan_t scanner_init(const char *str, core_yy_extra_type *yyext, const ScanKeywordList *keywordlist, const uint16 *keyword_tokens)
void scanner_finish(core_yyscan_t yyscanner)
int core_yylex(core_YYSTYPE *yylval_param, YYLTYPE *yylloc_param, core_yyscan_t yyscanner)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)