这篇文章主要介绍“postgresql中Declarations的作用是什么”,在日常操作中,相信很多人在Postgresql中Declarations的作用是什么问题上存在疑惑,小编查阅了各式资料,整理出
这篇文章主要介绍“postgresql中Declarations的作用是什么”,在日常操作中,相信很多人在Postgresql中Declarations的作用是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”PostgreSQL中Declarations的作用是什么”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
Flex输入文件由四部分组成:
%{
Declarations
%}
Definitions
%%
Rules
%%
User subroutines
由%{和%}包含的部分为Declarations部分,这一部分都是C代码,会原封不动的copy到lex.yy.c文件中.
比较重要的定义包括:
YYSTYPE-Bison使用一个uNIOn联合体来存储所有可能类型的值,全局变量yyvalue的类型是YYSTYPE.
%top{
#include "postgres.h"
#include <ctype.h>
#include <unistd.h>
#include "common/string.h"
#include "parser/gramparse.h"
#include "parser/parser.h"
#include "parser/scansup.h"
#include "mb/pg_wchar.h"
}
//------------------ 声明部分
%{
//在扫描器出现致命错误时,避免调用exit()直接退出
#undef fprintf
#define fprintf(file, fmt, msg) fprintf_to_ereport(fmt, msg)
static void
fprintf_to_ereport(const char *fmt, const char *msg)
{
ereport(ERROR, (errmsg_internal("%s", msg)));
}
int backslash_quote = BACKSLASH_QUOTE_SAFE_ENcoding;
bool escape_string_warning = true;
bool standard_confORMing_strings = true;
#define YYSTYPE core_YYSTYPE
#define YY_EXTRA_TYPE core_yy_extra_type *
#define SET_YYLLOC() (*(yylloc) = yytext - yyextra->scanbuf)
#define ADVANCE_YYLLOC(delta) ( *(yylloc) += (delta) )
#define startlit() ( yyextra->literallen = 0 )
static void addlit(char *ytext, int yleng, core_yyscan_t yyscanner);
static void addlitchar(unsigned char ychar, core_yyscan_t yyscanner);
static char *litbufdup(core_yyscan_t yyscanner);
static char *litbuf_udeescape(unsigned char escape, core_yyscan_t yyscanner);
static unsigned char unescape_single_char(unsigned char c, core_yyscan_t yyscanner);
static int process_integer_literal(const char *token, YYSTYPE *lval);
static bool is_utf16_surrogate_first(pg_wchar c);
static bool is_utf16_surrogate_second(pg_wchar c);
static pg_wchar surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second);
static void addunicode(pg_wchar c, yyscan_t yyscanner);
static bool check_uescapechar(unsigned char escape);
#define yyerror(msg) scanner_yyerror(msg, yyscanner)
#define lexer_errposition() scanner_errposition(*(yylloc), yyscanner)
static void check_string_escape_warning(unsigned char ychar, core_yyscan_t yyscanner);
static void check_escape_warning(core_yyscan_t yyscanner);
extern int core_yyget_column(yyscan_t yyscanner);
extern void core_yyset_column(int column_no, yyscan_t yyscanner);
%}
到此,关于“PostgreSQL中Declarations的作用是什么”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注编程网网站,小编会继续努力为大家带来更多实用的文章!
--结束END--
本文标题: PostgreSQL中Declarations的作用是什么
本文链接: https://www.lsjlt.com/news/64064.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-02
2024-05-02
2024-05-02
2024-05-02
2024-05-02
2024-05-02
2024-05-02
2024-05-02
2024-05-02
2024-05-02
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0