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)
232 else if (!aux1.
lval.word.quoted &&
234 &UnreservedPLKeywords)) >= 0)
237 &UnreservedPLKeywords);
269 (tok2 ==
'=' || tok2 == COLON_EQUALS ||
274 else if (!aux1.
lval.word.quoted &&
276 &UnreservedPLKeywords)) >= 0)
279 &UnreservedPLKeywords);
300 plpgsql_yylval = aux1.
lval;
301 plpgsql_yylloc = aux1.
lloc;
344 auxdata->
leng = strlen(yytext);
349 if (strcmp(auxdata->
lval.str,
"<<") == 0)
351 else if (strcmp(auxdata->
lval.str,
">>") == 0)
352 token = GREATER_GREATER;
353 else if (strcmp(auxdata->
lval.str,
"#") == 0)
358 else if (
token == PARAM)
374 elog(
ERROR,
"too many tokens pushed back");
391 auxdata.
lval = plpgsql_yylval;
392 auxdata.
lloc = plpgsql_yylloc;
422 int startlocation,
int endlocation)
424 Assert(startlocation <= endlocation);
426 endlocation - startlocation);
468 *tok1_loc = aux1.
lloc;
471 *tok2_loc = aux2.
lloc;
493 if (location < 0 ||
scanorig == NULL)
523 (
errcode(ERRCODE_SYNTAX_ERROR),
525 errmsg(
"%s at end of input",
_(message)),
539 (
errcode(ERRCODE_SYNTAX_ERROR),
541 errmsg(
"%s at or near \"%s\"",
_(message), yytext),
559 if (location < 0 ||
scanorig == NULL)
#define Assert(condition)
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)
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)
int plpgsql_token_length(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)