PostgreSQL Source Code git master
bootscanner.l File Reference
#include "postgres.h"
#include "bootstrap/bootstrap.h"
#include "bootparse.h"
#include "utils/guc.h"
Include dependency graph for bootscanner.l:

Go to the source code of this file.

Macros

#define fprintf(file, fmt, msg)   fprintf_to_ereport(fmt, msg)
 

Functions

static void fprintf_to_ereport (const char *fmt, const char *msg)
 
int yylex (YYSTYPE *yylval_param, yyscan_t yyscanner)
 
void boot_yyerror (yyscan_t yyscanner, const char *message)
 
void * yyalloc (yy_size_t size, yyscan_t yyscanner)
 
void * yyrealloc (void *ptr, yy_size_t size, yyscan_t yyscanner)
 
void yyfree (void *ptr, yyscan_t yyscanner)
 

Macro Definition Documentation

◆ fprintf

#define fprintf (   file,
  fmt,
  msg 
)    fprintf_to_ereport(fmt, msg)

Definition at line 34 of file bootscanner.l.

Function Documentation

◆ boot_yyerror()

void boot_yyerror ( yyscan_t  yyscanner,
const char *  message 
)

Definition at line 132 of file bootscanner.l.

133{
134 struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yylineno
135 * macro */
136
137 elog(ERROR, "%s at line %d", message, yylineno);
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:225
138}

References elog, and ERROR.

◆ fprintf_to_ereport()

static void fprintf_to_ereport ( const char *  fmt,
const char *  msg 
)
static

Definition at line 37 of file bootscanner.l.

38{
39 ereport(ERROR, (errmsg_internal("%s", msg)));
int errmsg_internal(const char *fmt,...)
Definition: elog.c:1157
#define ereport(elevel,...)
Definition: elog.h:149
40}

References ereport, errmsg_internal(), and ERROR.

◆ yyalloc()

void * yyalloc ( yy_size_t  size,
yyscan_t  yyscanner 
)

Definition at line 146 of file bootscanner.l.

147{
148 return palloc(size);
void * palloc(Size size)
Definition: mcxt.c:1317
static pg_noinline void Size size
Definition: slab.c:607
149}

References palloc(), and size.

◆ yyfree()

void yyfree ( void *  ptr,
yyscan_t  yyscanner 
)

Definition at line 161 of file bootscanner.l.

162{
163 if (ptr)
164 pfree(ptr);
void pfree(void *pointer)
Definition: mcxt.c:1521
165}

References pfree().

◆ yylex()

int yylex ( YYSTYPE yylval_param,
yyscan_t  yyscanner 
)

Definition at line 74 of file bootscanner.l.

76 { yylval->kw = "open"; return OPEN; }
#define OPEN
Definition: _int.h:164
77
78close { yylval->kw = "close"; return XCLOSE; }
79
80create { yylval->kw = "create"; return XCREATE; }
81
82OID { yylval->kw = "OID"; return OBJ_ID; }
83bootstrap { yylval->kw = "bootstrap"; return XBOOTSTRAP; }
84shared_relation { yylval->kw = "shared_relation"; return XSHARED_RELATION; }
85rowtype_oid { yylval->kw = "rowtype_oid"; return XROWTYPE_OID; }
86
87insert { yylval->kw = "insert"; return INSERT_TUPLE; }
88
89_null_ { return NULLVAL; }
90
91"," { return COMMA; }
92"=" { return EQUALS; }
93"(" { return LPAREN; }
94")" { return RPAREN; }
95
96[\n] { yylineno++; }
97[\r\t ] ;
98
99^\#[^\n]* ; /* drop everything after "#" for comments */
100
101declare { yylval->kw = "declare"; return XDECLARE; }
102build { yylval->kw = "build"; return XBUILD; }
103indices { yylval->kw = "indices"; return INDICES; }
104unique { yylval->kw = "unique"; return UNIQUE; }
105index { yylval->kw = "index"; return INDEX; }
106on { yylval->kw = "on"; return ON; }
107using { yylval->kw = "using"; return USING; }
108toast { yylval->kw = "toast"; return XTOAST; }
109FORCE { yylval->kw = "FORCE"; return XFORCE; }
110NOT { yylval->kw = "NOT"; return XNOT; }
111NULL { yylval->kw = "NULL"; return XNULL; }
112
113{id} {
114 yylval->str = pstrdup(yytext);
115 return ID;
116 }
char * pstrdup(const char *in)
Definition: mcxt.c:1696
117{sid} {
118 /* strip quotes and escapes */
119 yylval->str = DeescapeQuotedString(yytext);
120 return ID;
121 }
char * DeescapeQuotedString(const char *s)
Definition: guc-file.l:661
122
123. {
124 elog(ERROR, "syntax error at line %d: unexpected character \"%s\"", yylineno, yytext);
125 }
126
127%%

◆ yyrealloc()

void * yyrealloc ( void *  ptr,
yy_size_t  size,
yyscan_t  yyscanner 
)

Definition at line 152 of file bootscanner.l.

153{
154 if (ptr)
155 return repalloc(ptr, size);
156 else
157 return palloc(size);
void * repalloc(void *pointer, Size size)
Definition: mcxt.c:1541
158}

References palloc(), repalloc(), and size.