static const char * expr_source
static bool last_was_newline
static int expr_start_offset
static const char * expr_command
55%option never-interactive
61%option prefix="expr_yy"
64alpha [a-zA-Z\200-\377_]
66alnum [A-Za-z\200-\377_0-9]
69nonspace [^ \t\r\f\v\n]
73continuation \\\r?{newline}
85false [Ff][Aa][Ll][Ss][Ee]
88isnull [Ii][Ss][Nn][Uu][Ll][Ll]
89notnull [Nn][Oo][Tt][Nn][Uu][Ll][Ll]
98 PsqlScanState cur_state =
yyextra;
107 BEGIN(cur_state->start_state);
110 last_was_newline =
false;
void psqlscan_emit(PsqlScanState state, const char *txt, int len)
125{nonspace}+{continuation} {
128 if (yytext[wordlen] ==
'\r')
130 Assert(yytext[wordlen] ==
'\\');
#define Assert(condition)
155"<>" {
return NE_OP; }
156"!=" {
return NE_OP; }
157"<=" {
return LE_OP; }
158">=" {
return GE_OP; }
159"<<" {
return LS_OP; }
160">>" {
return RS_OP; }
172{and} {
return AND_OP; }
173{or} {
return OR_OP; }
174{not} {
return NOT_OP; }
175{is} {
return IS_OP; }
176{isnull} {
return ISNULL_OP; }
177{notnull} {
return NOTNULL_OP; }
179{case} {
return CASE_KW; }
180{when} {
return WHEN_KW; }
181{then} {
return THEN_KW; }
182{else} {
return ELSE_KW; }
183{end} {
return END_KW; }
char * pg_strdup(const char *in)
190{null} {
return NULL_CONST; }
193 return BOOLEAN_CONST;
196 yylval->bval =
false;
197 return BOOLEAN_CONST;
199"9223372036854775808" {
206 return MAXINT_PLUS_ONE_CONST;
212 return INTEGER_CONST;
void expr_yyerror_more(yyscan_t yyscanner, const char *message, const char *more)
bool strtoint64(const char *str, bool errorOK, int64 *result)
214{digit}+(\.{digit}*)?([eE][-+]?{digit}+)? {
bool strtodouble(const char *str, bool errorOK, double *dv)
220\.{digit}+([eE][-+]?{digit}+)? {
255 if (cur_state->buffer_stack == NULL)
void psqlscan_select_top_buffer(PsqlScanState state)
void psqlscan_pop_buffer_stack(PsqlScanState state)
285 while (
yylex(&lval, yyscanner))
324 state->output_buf = word_buf;
328 if (
state->buffer_stack != NULL)
329 yy_switch_to_buffer(
state->buffer_stack->buf,
state->scanner);
331 yy_switch_to_buffer(
state->scanbufhandle,
state->scanner);
334 state->start_state = INITIAL;
354 return (
bool) lexresult;
365 const char *
source,
int lineno,
int start_offset,
378 state->output_buf = NULL;
381 if (
state->buffer_stack != NULL)
382 yy_switch_to_buffer(
state->buffer_stack->buf,
state->scanner);
384 yy_switch_to_buffer(
state->scanbufhandle,
state->scanner);
387 state->start_state = EXPR;
389 return state->scanner;
417 return strlen(
state->scanbuf);
427 int start_offset,
int end_offset,
431 const char *scanptr =
state->scanbuf + start_offset;
432 int slen = end_offset - start_offset;
440 (scanptr[slen - 1] ==
'\n' || scanptr[slen - 1] ==
'\r'))
445 memcpy(result, scanptr, slen);
459 const char *p =
state->scanbuf;
461 while (*p && offset > 0)
int expr_scanner_offset(PsqlScanState state)
char * expr_scanner_get_substring(PsqlScanState state, int start_offset, int end_offset, bool chomp)
bool expr_lex_one_word(PsqlScanState state, PQExpBuffer word_buf, int *offset)
int expr_scanner_get_lineno(PsqlScanState state, int offset)
void expr_yyerror(PgBenchExpr **expr_parse_result_p, yyscan_t yyscanner, const char *message)
int yylex(YYSTYPE *yylval_param, yyscan_t yyscanner)
void expr_scanner_finish(yyscan_t yyscanner)
yyscan_t expr_scanner_init(PsqlScanState state, const char *source, int lineno, int start_offset, const char *command)
void * pg_malloc(size_t size)
static rewind_source * source
void syntax_error(const char *source, int lineno, const char *line, const char *command, const char *msg, const char *more, int column)
void resetPQExpBuffer(PQExpBuffer str)
void psql_scan_reselect_sql_lexer(PsqlScanState state)