PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pgbench.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pgbench.h
4  *
5  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
6  * Portions Copyright (c) 1994, Regents of the University of California
7  *
8  *-------------------------------------------------------------------------
9  */
10 
11 #ifndef PGBENCH_H
12 #define PGBENCH_H
13 
14 #include "fe_utils/psqlscan.h"
15 
16 /*
17  * This file is included outside exprscan.l, in places where we can't see
18  * flex's definition of typedef yyscan_t. Fortunately, it's documented as
19  * being "void *", so we can use a macro to keep the function declarations
20  * here looking like the definitions in exprscan.l. exprparse.y and
21  * pgbench.c also use this to be able to declare things as "yyscan_t".
22  */
23 #define yyscan_t void *
24 
25 /*
26  * Likewise, we can't see exprparse.y's definition of union YYSTYPE here,
27  * but for now there's no need to know what the union contents are.
28  */
29 union YYSTYPE;
30 
31 /*
32  * Variable types used in parser.
33  */
34 typedef enum
35 {
38  /* add other types here */
40 
41 typedef struct
42 {
44  union
45  {
46  int64 ival;
47  double dval;
48  /* add other types here */
49  } u;
50 } PgBenchValue;
51 
52 /* Types of expression nodes */
53 typedef enum PgBenchExprType
54 {
59 
60 /* List of operators and callable functions */
61 typedef enum PgBenchFunction
62 {
80 
81 typedef struct PgBenchExpr PgBenchExpr;
84 
86 {
88  union
89  {
91  struct
92  {
93  char *varname;
94  } variable;
95  struct
96  {
97  PgBenchFunction function;
99  } function;
100  } u;
101 };
102 
103 /* List of expression nodes */
105 {
108 };
109 
111 {
114 };
115 
117 
118 extern int expr_yyparse(yyscan_t yyscanner);
119 extern int expr_yylex(union YYSTYPE *lvalp, yyscan_t yyscanner);
120 extern void expr_yyerror(yyscan_t yyscanner, const char *str) pg_attribute_noreturn();
121 extern void expr_yyerror_more(yyscan_t yyscanner, const char *str,
122  const char *more) pg_attribute_noreturn();
123 extern bool expr_lex_one_word(PsqlScanState state, PQExpBuffer word_buf,
124  int *offset);
126  const char *source, int lineno, int start_offset,
127  const char *command);
131  int start_offset, int end_offset);
132 extern int expr_scanner_get_lineno(PsqlScanState state, int offset);
133 
134 extern void syntax_error(const char *source, int lineno, const char *line,
135  const char *cmd, const char *msg,
136  const char *more, int col) pg_attribute_noreturn();
137 
138 extern int64 strtoint64(const char *str);
139 
140 #endif /* PGBENCH_H */
PgBenchExprLink * args
Definition: pgbench.h:98
PgBenchValueType
Definition: pgbench.h:34
PgBenchValue constant
Definition: pgbench.h:90
void expr_scanner_finish(yyscan_t yyscanner)
int expr_yyparse(yyscan_t yyscanner)
void syntax_error(const char *source, int lineno, const char *line, const char *cmd, const char *msg, const char *more, int col) pg_attribute_noreturn()
Definition: pgbench.c:2920
yyscan_t expr_scanner_init(PsqlScanState state, const char *source, int lineno, int start_offset, const char *command)
char * varname
Definition: pgbench.h:93
#define pg_attribute_noreturn()
Definition: c.h:648
int expr_scanner_get_lineno(PsqlScanState state, int offset)
void expr_yyerror_more(yyscan_t yyscanner, const char *str, const char *more) pg_attribute_noreturn()
PgBenchExpr * expr_parse_result
int expr_scanner_offset(PsqlScanState state)
PgBenchExprType
Definition: pgbench.h:53
char * expr_scanner_get_substring(PsqlScanState state, int start_offset, int end_offset)
PgBenchExprLink * head
Definition: pgbench.h:112
double dval
Definition: pgbench.h:47
PgBenchExprLink * tail
Definition: pgbench.h:113
void * yyscan_t
Definition: psqlscan_int.h:60
Definition: regguts.h:298
static core_yyscan_t yyscanner
Definition: pl_scanner.c:208
PgBenchValueType type
Definition: pgbench.h:43
PgBenchFunction
Definition: pgbench.h:61
int64 ival
Definition: pgbench.h:46
bool expr_lex_one_word(PsqlScanState state, PQExpBuffer word_buf, int *offset)
int64 strtoint64(const char *str)
Definition: pgbench.c:564
struct PgBenchExpr::@33::@34 variable
void expr_yyerror(yyscan_t yyscanner, const char *str) pg_attribute_noreturn()
union PgBenchExpr::@33 u
PgBenchExprType etype
Definition: pgbench.h:87
int expr_yylex(union YYSTYPE *lvalp, yyscan_t yyscanner)