YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/build/debugcov-clang-dynamic-arm64-ninja/postgres_build/src/bin/pgbench/exprscan.c
Line
Count
Source (jump to first uncovered line)
1
#line 1 "exprscan.c"
2
3
#line 3 "exprscan.c"
4
5
#define  YY_INT_ALIGNED short int
6
7
/* A lexical scanner generated by flex */
8
9
#define FLEX_SCANNER
10
#define YY_FLEX_MAJOR_VERSION 2
11
#define YY_FLEX_MINOR_VERSION 6
12
#define YY_FLEX_SUBMINOR_VERSION 3
13
#if YY_FLEX_SUBMINOR_VERSION > 0
14
#define FLEX_BETA
15
#endif
16
17
    #define yy_create_buffer expr_yy_create_buffer
18
19
    #define yy_delete_buffer expr_yy_delete_buffer
20
21
    #define yy_scan_buffer expr_yy_scan_buffer
22
23
    #define yy_scan_string expr_yy_scan_string
24
25
    #define yy_scan_bytes expr_yy_scan_bytes
26
27
    #define yy_init_buffer expr_yy_init_buffer
28
29
    #define yy_flush_buffer expr_yy_flush_buffer
30
31
    #define yy_load_buffer_state expr_yy_load_buffer_state
32
33
0
    #define yy_switch_to_buffer expr_yy_switch_to_buffer
34
35
    #define yypush_buffer_state expr_yypush_buffer_state
36
37
    #define yypop_buffer_state expr_yypop_buffer_state
38
39
    #define yyensure_buffer_stack expr_yyensure_buffer_stack
40
41
0
    #define yylex expr_yylex
42
43
    #define yyrestart expr_yyrestart
44
45
    #define yylex_init expr_yylex_init
46
47
    #define yylex_init_extra expr_yylex_init_extra
48
49
    #define yylex_destroy expr_yylex_destroy
50
51
    #define yyget_debug expr_yyget_debug
52
53
    #define yyset_debug expr_yyset_debug
54
55
0
    #define yyget_extra expr_yyget_extra
56
57
    #define yyset_extra expr_yyset_extra
58
59
    #define yyget_in expr_yyget_in
60
61
    #define yyset_in expr_yyset_in
62
63
    #define yyget_out expr_yyget_out
64
65
    #define yyset_out expr_yyset_out
66
67
    #define yyget_leng expr_yyget_leng
68
69
    #define yyget_text expr_yyget_text
70
71
    #define yyget_lineno expr_yyget_lineno
72
73
    #define yyset_lineno expr_yyset_lineno
74
75
        #define yyget_column expr_yyget_column
76
77
        #define yyset_column expr_yyset_column
78
79
    #define yywrap expr_yywrap
80
81
    #define yyget_lval expr_yyget_lval
82
83
    #define yyset_lval expr_yyset_lval
84
85
    #define yyalloc expr_yyalloc
86
87
    #define yyrealloc expr_yyrealloc
88
89
    #define yyfree expr_yyfree
90
91
/* First, we deal with  platform-specific or compiler-specific issues. */
92
93
/* begin standard C headers. */
94
#include <stdio.h>
95
#include <string.h>
96
#include <errno.h>
97
#include <stdlib.h>
98
99
/* end standard C headers. */
100
101
/* flex integer type definitions */
102
103
#ifndef FLEXINT_H
104
#define FLEXINT_H
105
106
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
107
108
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
109
110
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
111
 * if you want the limit (max/min) macros for int types. 
112
 */
113
#ifndef __STDC_LIMIT_MACROS
114
#define __STDC_LIMIT_MACROS 1
115
#endif
116
117
#include <inttypes.h>
118
typedef int8_t flex_int8_t;
119
typedef uint8_t flex_uint8_t;
120
typedef int16_t flex_int16_t;
121
typedef uint16_t flex_uint16_t;
122
typedef int32_t flex_int32_t;
123
typedef uint32_t flex_uint32_t;
124
#else
125
typedef signed char flex_int8_t;
126
typedef short int flex_int16_t;
127
typedef int flex_int32_t;
128
typedef unsigned char flex_uint8_t; 
129
typedef unsigned short int flex_uint16_t;
130
typedef unsigned int flex_uint32_t;
131
132
/* Limits of integral types. */
133
#ifndef INT8_MIN
134
#define INT8_MIN               (-128)
135
#endif
136
#ifndef INT16_MIN
137
#define INT16_MIN              (-32767-1)
138
#endif
139
#ifndef INT32_MIN
140
#define INT32_MIN              (-2147483647-1)
141
#endif
142
#ifndef INT8_MAX
143
#define INT8_MAX               (127)
144
#endif
145
#ifndef INT16_MAX
146
#define INT16_MAX              (32767)
147
#endif
148
#ifndef INT32_MAX
149
#define INT32_MAX              (2147483647)
150
#endif
151
#ifndef UINT8_MAX
152
#define UINT8_MAX              (255U)
153
#endif
154
#ifndef UINT16_MAX
155
#define UINT16_MAX             (65535U)
156
#endif
157
#ifndef UINT32_MAX
158
#define UINT32_MAX             (4294967295U)
159
#endif
160
161
#endif /* ! C99 */
162
163
#endif /* ! FLEXINT_H */
164
165
/* TODO: this is always defined, so inline it */
166
#define yyconst const
167
168
#if defined(__GNUC__) && __GNUC__ >= 3
169
#define yynoreturn __attribute__((__noreturn__))
170
#else
171
#define yynoreturn
172
#endif
173
174
/* Returned upon end-of-file. */
175
#define YY_NULL 0
176
177
/* Promotes a possibly negative, possibly signed char to an
178
 *   integer in range [0..255] for use as an array index.
179
 */
180
0
#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
181
182
/* An opaque pointer. */
183
#ifndef YY_TYPEDEF_YY_SCANNER_T
184
#define YY_TYPEDEF_YY_SCANNER_T
185
typedef void* yyscan_t;
186
#endif
187
188
/* For convenience, these vars (plus the bison vars far below)
189
   are macros in the reentrant scanner. */
190
0
#define yyin yyg->yyin_r
191
0
#define yyout yyg->yyout_r
192
0
#define yyextra yyg->yyextra_r
193
0
#define yyleng yyg->yyleng_r
194
0
#define yytext yyg->yytext_r
195
0
#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
196
0
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
197
0
#define yy_flex_debug yyg->yy_flex_debug_r
198
199
/* Enter a start condition.  This macro really ought to take a parameter,
200
 * but we do it the disgusting crufty way forced on us by the ()-less
201
 * definition of BEGIN.
202
 */
203
0
#define BEGIN yyg->yy_start = 1 + 2 *
204
/* Translate the current start state into a value that can be later handed
205
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
206
 * compatibility.
207
 */
208
#define YY_START ((yyg->yy_start - 1) / 2)
209
#define YYSTATE YY_START
210
/* Action number for EOF rule of a given start state. */
211
0
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
212
/* Special action meaning "start processing a new file". */
213
0
#define YY_NEW_FILE expr_yyrestart(yyin ,yyscanner )
214
0
#define YY_END_OF_BUFFER_CHAR 0
215
216
/* Size of default input buffer. */
217
#ifndef YY_BUF_SIZE
218
#ifdef __ia64__
219
/* On IA-64, the buffer size is 16k, not 8k.
220
 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
221
 * Ditto for the __ia64__ case accordingly.
222
 */
223
#define YY_BUF_SIZE 32768
224
#else
225
0
#define YY_BUF_SIZE 16384
226
#endif /* __ia64__ */
227
#endif
228
229
/* The state buf must be large enough to hold one state per character in the main buffer.
230
 */
231
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
232
233
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
234
#define YY_TYPEDEF_YY_BUFFER_STATE
235
typedef struct yy_buffer_state *YY_BUFFER_STATE;
236
#endif
237
238
#ifndef YY_TYPEDEF_YY_SIZE_T
239
#define YY_TYPEDEF_YY_SIZE_T
240
typedef size_t yy_size_t;
241
#endif
242
243
0
#define EOB_ACT_CONTINUE_SCAN 0
244
0
#define EOB_ACT_END_OF_FILE 1
245
0
#define EOB_ACT_LAST_MATCH 2
246
    
247
    #define YY_LESS_LINENO(n)
248
    #define YY_LINENO_REWIND_TO(ptr)
249
    
250
/* Return all but the first "n" matched characters back to the input stream. */
251
#define yyless(n) \
252
  do \
253
    { \
254
    /* Undo effects of setting up yytext. */ \
255
        int yyless_macro_arg = (n); \
256
        YY_LESS_LINENO(yyless_macro_arg);\
257
    *yy_cp = yyg->yy_hold_char; \
258
    YY_RESTORE_YY_MORE_OFFSET \
259
    yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
260
    YY_DO_BEFORE_ACTION; /* set up yytext again */ \
261
    } \
262
  while ( 0 )
263
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
264
265
#ifndef YY_STRUCT_YY_BUFFER_STATE
266
#define YY_STRUCT_YY_BUFFER_STATE
267
struct yy_buffer_state
268
  {
269
  FILE *yy_input_file;
270
271
  char *yy_ch_buf;    /* input buffer */
272
  char *yy_buf_pos;   /* current position in input buffer */
273
274
  /* Size of input buffer in bytes, not including room for EOB
275
   * characters.
276
   */
277
  int yy_buf_size;
278
279
  /* Number of characters read into yy_ch_buf, not including EOB
280
   * characters.
281
   */
282
  int yy_n_chars;
283
284
  /* Whether we "own" the buffer - i.e., we know we created it,
285
   * and can realloc() it to grow it, and should free() it to
286
   * delete it.
287
   */
288
  int yy_is_our_buffer;
289
290
  /* Whether this is an "interactive" input source; if so, and
291
   * if we're using stdio for input, then we want to use getc()
292
   * instead of fread(), to make sure we stop fetching input after
293
   * each newline.
294
   */
295
  int yy_is_interactive;
296
297
  /* Whether we're considered to be at the beginning of a line.
298
   * If so, '^' rules will be active on the next match, otherwise
299
   * not.
300
   */
301
  int yy_at_bol;
302
303
    int yy_bs_lineno; /**< The line count. */
304
    int yy_bs_column; /**< The column count. */
305
306
  /* Whether to try to fill the input buffer when we reach the
307
   * end of it.
308
   */
309
  int yy_fill_buffer;
310
311
  int yy_buffer_status;
312
313
0
#define YY_BUFFER_NEW 0
314
0
#define YY_BUFFER_NORMAL 1
315
  /* When an EOF's been seen but there's still some text to process
316
   * then we mark the buffer as YY_EOF_PENDING, to indicate that we
317
   * shouldn't try reading from the input source any more.  We might
318
   * still have a bunch of tokens to match, though, because of
319
   * possible backing-up.
320
   *
321
   * When we actually see the EOF, we change the status to "new"
322
   * (via expr_yyrestart()), so that the user can continue scanning by
323
   * just pointing yyin at a new input file.
324
   */
325
0
#define YY_BUFFER_EOF_PENDING 2
326
327
  };
328
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
329
330
/* We provide macros for accessing buffer states in case in the
331
 * future we want to put the buffer states in a more general
332
 * "scanner state".
333
 *
334
 * Returns the top of the stack, or NULL.
335
 */
336
0
#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
337
0
                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
338
0
                          : NULL)
339
/* Same as previous macro, but useful when we know that the buffer stack is not
340
 * NULL or when we need an lvalue. For internal use only.
341
 */
342
0
#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
343
344
void expr_yyrestart ( FILE *input_file , yyscan_t yyscanner );
345
void expr_yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
346
YY_BUFFER_STATE expr_yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
347
void expr_yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
348
void expr_yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
349
void expr_yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
350
void expr_yypop_buffer_state ( yyscan_t yyscanner );
351
352
static void expr_yyensure_buffer_stack ( yyscan_t yyscanner );
353
static void expr_yy_load_buffer_state ( yyscan_t yyscanner );
354
static void expr_yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
355
#define YY_FLUSH_BUFFER expr_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
356
357
YY_BUFFER_STATE expr_yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
358
YY_BUFFER_STATE expr_yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
359
YY_BUFFER_STATE expr_yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
360
361
void *expr_yyalloc ( yy_size_t , yyscan_t yyscanner );
362
void *expr_yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
363
void expr_yyfree ( void * , yyscan_t yyscanner );
364
365
#define yy_new_buffer expr_yy_create_buffer
366
#define yy_set_interactive(is_interactive) \
367
  { \
368
  if ( ! YY_CURRENT_BUFFER ){ \
369
        expr_yyensure_buffer_stack (yyscanner); \
370
    YY_CURRENT_BUFFER_LVALUE =    \
371
            expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
372
  } \
373
  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
374
  }
375
#define yy_set_bol(at_bol) \
376
  { \
377
  if ( ! YY_CURRENT_BUFFER ){\
378
        expr_yyensure_buffer_stack (yyscanner); \
379
    YY_CURRENT_BUFFER_LVALUE =    \
380
            expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
381
  } \
382
  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
383
  }
384
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
385
386
/* Begin user sect3 */
387
388
0
#define expr_yywrap(yyscanner) (/*CONSTCOND*/1)
389
#define YY_SKIP_YYWRAP
390
typedef flex_uint8_t YY_CHAR;
391
392
typedef int yy_state_type;
393
394
0
#define yytext_ptr yytext_r
395
396
static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
397
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);
398
static int yy_get_next_buffer ( yyscan_t yyscanner );
399
static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
400
401
/* Done after the current pattern has been matched and before the
402
 * corresponding action - sets up yytext.
403
 */
404
#define YY_DO_BEFORE_ACTION \
405
0
  yyg->yytext_ptr = yy_bp; \
406
0
  yyleng = (int) (yy_cp - yy_bp); \
407
0
  yyg->yy_hold_char = *yy_cp; \
408
0
  *yy_cp = '\0'; \
409
0
  yyg->yy_c_buf_p = yy_cp;
410
#define YY_NUM_RULES 50
411
0
#define YY_END_OF_BUFFER 51
412
/* This struct is not used in this scanner,
413
   but its presence is necessary. */
414
struct yy_trans_info
415
  {
416
  flex_int32_t yy_verify;
417
  flex_int32_t yy_nxt;
418
  };
419
static const flex_int16_t yy_accept[110] =
420
    {   0,
421
        0,    0,    0,    0,   51,    1,    3,    5,    1,   49,
422
       46,   48,   49,   22,   10,   21,   24,   25,    8,    6,
423
       26,    7,   49,    9,   42,   49,   18,   11,   19,   45,
424
       45,   45,   45,   45,   45,   45,   45,   45,   45,   49,
425
       20,   23,    1,    1,    3,    4,    0,   46,   13,   44,
426
       43,   42,    0,   38,   16,   14,   12,   15,   17,   45,
427
       45,   45,   45,   45,   45,   30,   45,   45,   28,   45,
428
       45,   45,   47,    0,    2,    0,    0,   43,    0,   43,
429
       27,   45,   45,   37,   45,   45,   29,   45,   45,   45,
430
       45,    0,   44,   33,   36,   45,   45,   45,   39,   35,
431
432
       40,   34,   41,   45,   45,   31,   45,   32,    0
433
    } ;
434
435
static const YY_CHAR yy_ec[256] =
436
    {   0,
437
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
438
        2,    2,    4,    1,    1,    1,    1,    1,    1,    1,
439
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
440
        1,    2,    5,    1,    6,    1,    7,    8,    1,    9,
441
       10,   11,   12,   13,   14,   15,   16,   17,   17,   17,
442
       17,   17,   17,   17,   17,   17,   17,   18,    1,   19,
443
       20,   21,    1,    1,   22,   23,   24,   25,   26,   27,
444
       23,   28,   29,   23,   23,   30,   23,   31,   32,   23,
445
       23,   33,   34,   35,   36,   23,   37,   23,   23,   23,
446
        1,   38,    1,    1,   23,    1,   22,   23,   24,   25,
447
448
       26,   27,   23,   28,   29,   23,   23,   30,   23,   31,
449
       32,   23,   23,   33,   34,   35,   36,   23,   37,   23,
450
       23,   23,    1,   39,    1,   40,    1,   23,   23,   23,
451
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
452
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
453
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
454
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
455
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
456
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
457
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
458
459
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
460
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
461
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
462
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
463
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
464
       23,   23,   23,   23,   23
465
    } ;
466
467
static const YY_CHAR yy_meta[41] =
468
    {   0,
469
        1,    2,    2,    2,    1,    1,    1,    1,    1,    1,
470
        1,    1,    1,    1,    1,    1,    3,    1,    1,    1,
471
        1,    3,    3,    3,    3,    3,    3,    3,    3,    3,
472
        3,    3,    3,    3,    3,    3,    3,    1,    1,    1
473
    } ;
474
475
static const flex_int16_t yy_base[114] =
476
    {   0,
477
        0,    3,   41,    0,  146,  107,    6,  147,   79,  147,
478
        7,  147,  124,  147,  147,  147,  147,  147,  147,  147,
479
      147,  147,  126,  147,    0,    0,    0,  147,    2,  111,
480
        0,  119,    0,  118,  105,    0,  105,    0,  109,    9,
481
      147,  147,   98,   81,   12,  147,  132,   23,  147,   69,
482
       70,   73,   23,    0,  147,  147,  147,  147,  147,    0,
483
      109,   99,   98,  106,  100,   98,   93,   97,    0,  100,
484
       88,   92,  147,  113,  147,  112,   77,   75,   97,   96,
485
        0,   86,   85,    0,   76,   73,   77,   77,   75,   79,
486
       73,   86,   85,    0,    0,   74,   68,   61,    0,    0,
487
488
        0,    0,    0,   63,    9,    0,    4,    0,  147,  119,
489
      122,   21,   15
490
    } ;
491
492
static const flex_int16_t yy_def[114] =
493
    {   0,
494
      110,  110,  109,    3,  109,  111,  109,  109,  111,  109,
495
      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,
496
      109,  109,  109,  109,  109,  112,  109,  109,  109,  113,
497
      113,  113,  113,  113,  113,  113,  113,  113,  113,  109,
498
      109,  109,  111,  111,  109,  109,  109,  109,  109,  109,
499
      109,  109,  109,  112,  109,  109,  109,  109,  109,  113,
500
      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,
501
      113,  113,  109,  109,  109,  109,  109,  109,  109,  109,
502
      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,
503
      113,  109,  109,  113,  113,  113,  113,  113,  113,  113,
504
505
      113,  113,  113,  113,  113,  113,  113,  113,    0,  109,
506
      109,  109,  109
507
    } ;
508
509
static const flex_int16_t yy_nxt[188] =
510
    {   0,
511
      109,    7,    8,    7,    7,    8,    7,   45,   48,   45,
512
       48,   73,   74,   45,   51,   45,   52,   60,   55,   56,
513
       57,   58,   59,   54,   48,   53,   48,   70,  109,   63,
514
       64,   67,   71,  108,   79,   68,   79,    9,  107,   80,
515
        9,   10,   11,   12,   11,   13,   14,   15,   16,   17,
516
       18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
517
       28,   29,   30,   31,   32,   31,   33,   34,   31,   35,
518
       31,   36,   37,   31,   31,   38,   31,   39,   40,   41,
519
       42,   46,   47,   75,   76,   50,   78,   51,   92,   52,
520
       92,   78,  106,   93,   77,   53,  105,  104,   53,  103,
521
522
       53,   93,   93,  102,  101,  100,   99,   98,   97,   96,
523
       95,   94,   80,   80,   75,   73,   44,   91,   44,    6,
524
        6,    6,   43,   90,   43,   89,   88,   87,   86,   85,
525
       84,   83,   82,   81,   46,   44,   72,   69,   66,   65,
526
       62,   61,   50,   49,   44,  109,    5,  109,  109,  109,
527
      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,
528
      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,
529
      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,
530
      109,  109,  109,  109,  109,  109,  109
531
    } ;
532
533
static const flex_int16_t yy_chk[188] =
534
    {   0,
535
        0,    1,    1,    1,    2,    2,    2,    7,   11,    7,
536
       11,   40,   40,   45,   25,   45,   25,  113,   27,   27,
537
       27,   29,   29,  112,   48,   25,   48,   38,    0,   33,
538
       33,   36,   38,  107,   53,   36,   53,    1,  105,   53,
539
        2,    3,    3,    3,    3,    3,    3,    3,    3,    3,
540
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
541
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
542
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
543
        3,    9,    9,   44,   44,   50,   51,   52,   77,   52,
544
       77,   78,  104,   77,   50,   51,   98,   97,   52,   96,
545
546
       78,   93,   92,   91,   90,   89,   88,   87,   86,   85,
547
       83,   82,   80,   79,   76,   74,    9,   72,   44,  110,
548
      110,  110,  111,   71,  111,   70,   68,   67,   66,   65,
549
       64,   63,   62,   61,   47,   43,   39,   37,   35,   34,
550
       32,   30,   23,   13,    6,    5,  109,  109,  109,  109,
551
      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,
552
      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,
553
      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,
554
      109,  109,  109,  109,  109,  109,  109
555
    } ;
556
557
/* The intent behind this definition is that it'll catch
558
 * any uses of REJECT which flex missed.
559
 */
560
#define REJECT reject_used_but_not_detected
561
#define yymore() yymore_used_but_not_detected
562
0
#define YY_MORE_ADJ 0
563
#define YY_RESTORE_YY_MORE_OFFSET
564
#line 1 "exprscan.l"
565
#line 2 "exprscan.l"
566
/*-------------------------------------------------------------------------
567
 *
568
 * exprscan.l
569
 *    lexical scanner for pgbench backslash commands
570
 *
571
 * This lexer supports two operating modes:
572
 *
573
 * In INITIAL state, just parse off whitespace-separated words (this mode
574
 * is basically equivalent to strtok(), which is what we used to use).
575
 *
576
 * In EXPR state, lex for the simple expression syntax of exprparse.y.
577
 *
578
 * In either mode, stop upon hitting newline or end of string.
579
 *
580
 * Note that this lexer operates within the framework created by psqlscan.l,
581
 *
582
 * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
583
 * Portions Copyright (c) 1994, Regents of the University of California
584
 *
585
 * src/bin/pgbench/exprscan.l
586
 *
587
 *-------------------------------------------------------------------------
588
 */
589
590
#include "fe_utils/psqlscan_int.h"
591
592
/* context information for reporting errors in expressions */
593
static const char *expr_source = NULL;
594
static int  expr_lineno = 0;
595
static int  expr_start_offset = 0;
596
static const char *expr_command = NULL;
597
598
/* indicates whether last yylex() call read a newline */
599
static bool last_was_newline = false;
600
601
/*
602
 * Work around a bug in flex 2.5.35: it emits a couple of functions that
603
 * it forgets to emit declarations for.  Since we use -Wmissing-prototypes,
604
 * this would cause warnings.  Providing our own declarations should be
605
 * harmless even when the bug gets fixed.
606
 */
607
extern int  expr_yyget_column(yyscan_t yyscanner);
608
extern void expr_yyset_column(int column_no, yyscan_t yyscanner);
609
610
/* LCOV_EXCL_START */
611
612
#line 612 "exprscan.c"
613
/* Except for the prefix, these options should match psqlscan.l */
614
#define YY_NO_INPUT 1
615
/* Character classes */
616
/* {space} + {nonspace} + {newline} should cover all characters */
617
/* Line continuation marker */
618
/* case insensitive keywords */
619
/* Exclusive states */
620
621
#line 621 "exprscan.c"
622
623
0
#define INITIAL 0
624
0
#define EXPR 1
625
626
#ifndef YY_NO_UNISTD_H
627
/* Special case for "unistd.h", since it is non-ANSI. We include it way
628
 * down here because we want the user's section 1 to have been scanned first.
629
 * The user has a chance to override it with an option.
630
 */
631
#include <unistd.h>
632
#endif
633
634
#ifndef YY_EXTRA_TYPE
635
#define YY_EXTRA_TYPE void *
636
#endif
637
638
/* Holds the entire state of the reentrant scanner. */
639
struct yyguts_t
640
    {
641
642
    /* User-defined. Not touched by flex. */
643
    YY_EXTRA_TYPE yyextra_r;
644
645
    /* The rest are the same as the globals declared in the non-reentrant scanner. */
646
    FILE *yyin_r, *yyout_r;
647
    size_t yy_buffer_stack_top; /**< index of top of stack. */
648
    size_t yy_buffer_stack_max; /**< capacity of stack. */
649
    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
650
    char yy_hold_char;
651
    int yy_n_chars;
652
    int yyleng_r;
653
    char *yy_c_buf_p;
654
    int yy_init;
655
    int yy_start;
656
    int yy_did_buffer_switch_on_eof;
657
    int yy_start_stack_ptr;
658
    int yy_start_stack_depth;
659
    int *yy_start_stack;
660
    yy_state_type yy_last_accepting_state;
661
    char* yy_last_accepting_cpos;
662
663
    int yylineno_r;
664
    int yy_flex_debug_r;
665
666
    char *yytext_r;
667
    int yy_more_flag;
668
    int yy_more_len;
669
670
    YYSTYPE * yylval_r;
671
672
    }; /* end struct yyguts_t */
673
674
static int yy_init_globals ( yyscan_t yyscanner );
675
676
    /* This must go here because YYSTYPE and YYLTYPE are included
677
     * from bison output in section 1.*/
678
0
    #    define yylval yyg->yylval_r
679
    
680
int expr_yylex_init (yyscan_t* scanner);
681
682
int expr_yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
683
684
/* Accessor methods to globals.
685
   These are made visible to non-reentrant scanners for convenience. */
686
687
int expr_yylex_destroy ( yyscan_t yyscanner );
688
689
int expr_yyget_debug ( yyscan_t yyscanner );
690
691
void expr_yyset_debug ( int debug_flag , yyscan_t yyscanner );
692
693
YY_EXTRA_TYPE expr_yyget_extra ( yyscan_t yyscanner );
694
695
void expr_yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
696
697
FILE *expr_yyget_in ( yyscan_t yyscanner );
698
699
void expr_yyset_in  ( FILE * _in_str , yyscan_t yyscanner );
700
701
FILE *expr_yyget_out ( yyscan_t yyscanner );
702
703
void expr_yyset_out  ( FILE * _out_str , yyscan_t yyscanner );
704
705
      int expr_yyget_leng ( yyscan_t yyscanner );
706
707
char *expr_yyget_text ( yyscan_t yyscanner );
708
709
int expr_yyget_lineno ( yyscan_t yyscanner );
710
711
void expr_yyset_lineno ( int _line_number , yyscan_t yyscanner );
712
713
int expr_yyget_column  ( yyscan_t yyscanner );
714
715
void expr_yyset_column ( int _column_no , yyscan_t yyscanner );
716
717
YYSTYPE * expr_yyget_lval ( yyscan_t yyscanner );
718
719
void expr_yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
720
721
/* Macros after this point can all be overridden by user definitions in
722
 * section 1.
723
 */
724
725
#ifndef YY_SKIP_YYWRAP
726
#ifdef __cplusplus
727
extern "C" int expr_yywrap ( yyscan_t yyscanner );
728
#else
729
extern int expr_yywrap ( yyscan_t yyscanner );
730
#endif
731
#endif
732
733
#ifndef YY_NO_UNPUT
734
    
735
#endif
736
737
#ifndef yytext_ptr
738
static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
739
#endif
740
741
#ifdef YY_NEED_STRLEN
742
static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
743
#endif
744
745
#ifndef YY_NO_INPUT
746
#ifdef __cplusplus
747
static int yyinput ( yyscan_t yyscanner );
748
#else
749
static int input ( yyscan_t yyscanner );
750
#endif
751
752
#endif
753
754
/* Amount of stuff to slurp up with each read. */
755
#ifndef YY_READ_BUF_SIZE
756
#ifdef __ia64__
757
/* On IA-64, the buffer size is 16k, not 8k */
758
#define YY_READ_BUF_SIZE 16384
759
#else
760
0
#define YY_READ_BUF_SIZE 8192
761
#endif /* __ia64__ */
762
#endif
763
764
/* Copy whatever the last rule matched to the standard output. */
765
#ifndef ECHO
766
/* This used to be an fputs(), but since the string might contain NUL's,
767
 * we now use fwrite().
768
 */
769
#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
770
#endif
771
772
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
773
 * is returned in "result".
774
 */
775
#ifndef YY_INPUT
776
#define YY_INPUT(buf,result,max_size) \
777
0
  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
778
0
    { \
779
0
    int c = '*'; \
780
0
    int n; \
781
0
    for ( n = 0; n < max_size && \
782
0
           (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
783
0
      buf[n] = (char) c; \
784
0
    if ( c == '\n' ) \
785
0
      buf[n++] = (char) c; \
786
0
    if ( c == EOF && ferror( yyin ) ) \
787
0
      YY_FATAL_ERROR( "input in flex scanner failed" ); \
788
0
    result = n; \
789
0
    } \
790
0
  else \
791
0
    { \
792
0
    errno=0; \
793
0
    while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
794
0
      { \
795
0
      if( errno != EINTR) \
796
0
        { \
797
0
        YY_FATAL_ERROR( "input in flex scanner failed" ); \
798
0
        break; \
799
0
        } \
800
0
      errno=0; \
801
0
      clearerr(yyin); \
802
0
      } \
803
0
    }\
804
\
805
806
#endif
807
808
/* No semi-colon after return; correct usage is to write "yyterminate();" -
809
 * we don't want an extra ';' after the "return" because that will cause
810
 * some compilers to complain about unreachable statements.
811
 */
812
#ifndef yyterminate
813
#define yyterminate() return YY_NULL
814
#endif
815
816
/* Number of entries by which start-condition stack grows. */
817
#ifndef YY_START_STACK_INCR
818
#define YY_START_STACK_INCR 25
819
#endif
820
821
/* Report a fatal error. */
822
#ifndef YY_FATAL_ERROR
823
0
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
824
#endif
825
826
/* end tables serialization structures and prototypes */
827
828
/* Default declaration of generated scanner - a define so the user can
829
 * easily add parameters.
830
 */
831
#ifndef YY_DECL
832
#define YY_DECL_IS_OURS 1
833
834
extern int expr_yylex \
835
               (YYSTYPE * yylval_param , yyscan_t yyscanner);
836
837
#define YY_DECL int expr_yylex \
838
               (YYSTYPE * yylval_param , yyscan_t yyscanner)
839
#endif /* !YY_DECL */
840
841
/* Code executed at the beginning of each rule, after yytext and yyleng
842
 * have been set up.
843
 */
844
#ifndef YY_USER_ACTION
845
#define YY_USER_ACTION
846
#endif
847
848
/* Code executed at the end of each rule. */
849
#ifndef YY_BREAK
850
0
#define YY_BREAK /*LINTED*/break;
851
#endif
852
853
#define YY_RULE_SETUP \
854
  YY_USER_ACTION
855
856
/** The main scanner function which does all the work.
857
 */
858
YY_DECL
859
0
{
860
0
  yy_state_type yy_current_state;
861
0
  char *yy_cp, *yy_bp;
862
0
  int yy_act;
863
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
864
865
0
    yylval = yylval_param;
866
867
0
  if ( !yyg->yy_init )
868
0
    {
869
0
    yyg->yy_init = 1;
870
871
#ifdef YY_USER_INIT
872
    YY_USER_INIT;
873
#endif
874
875
0
    if ( ! yyg->yy_start )
876
0
      yyg->yy_start = 1; /* first start state */
877
878
0
    if ( ! yyin )
879
0
      yyin = stdin;
880
881
0
    if ( ! yyout )
882
0
      yyout = stdout;
883
884
0
    if ( ! YY_CURRENT_BUFFER ) {
885
0
      expr_yyensure_buffer_stack (yyscanner);
886
0
      YY_CURRENT_BUFFER_LVALUE =
887
0
        expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
888
0
    }
889
890
0
    expr_yy_load_buffer_state(yyscanner );
891
0
    }
892
893
0
  {
894
0
#line 93 "exprscan.l"
895
896
897
898
0
#line 97 "exprscan.l"
899
    /* Declare some local variables inside yylex(), for convenience */
900
0
    PsqlScanState cur_state = yyextra;
901
902
    /*
903
     * Force flex into the state indicated by start_state.  This has a
904
     * couple of purposes: it lets some of the functions below set a new
905
     * starting state without ugly direct access to flex variables, and it
906
     * allows us to transition from one flex lexer to another so that we
907
     * can lex different parts of the source string using separate lexers.
908
     */
909
0
    BEGIN(cur_state->start_state);
910
911
    /* Reset was-newline flag */
912
0
    last_was_newline = false;
913
914
915
  /* INITIAL state */
916
917
0
#line 917 "exprscan.c"
918
919
0
  while ( /*CONSTCOND*/1 )    /* loops until end-of-file is reached */
920
0
    {
921
0
    yy_cp = yyg->yy_c_buf_p;
922
923
    /* Support of yytext. */
924
0
    *yy_cp = yyg->yy_hold_char;
925
926
    /* yy_bp points to the position in yy_ch_buf of the start of
927
     * the current run.
928
     */
929
0
    yy_bp = yy_cp;
930
931
0
    yy_current_state = yyg->yy_start;
932
0
yy_match:
933
0
    do
934
0
      {
935
0
      YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
936
0
      if ( yy_accept[yy_current_state] )
937
0
        {
938
0
        yyg->yy_last_accepting_state = yy_current_state;
939
0
        yyg->yy_last_accepting_cpos = yy_cp;
940
0
        }
941
0
      while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
942
0
        {
943
0
        yy_current_state = (int) yy_def[yy_current_state];
944
0
        if ( yy_current_state >= 110 )
945
0
          yy_c = yy_meta[yy_c];
946
0
        }
947
0
      yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
948
0
      ++yy_cp;
949
0
      }
950
0
    while ( yy_current_state != 109 );
951
0
    yy_cp = yyg->yy_last_accepting_cpos;
952
0
    yy_current_state = yyg->yy_last_accepting_state;
953
954
0
yy_find_action:
955
0
    yy_act = yy_accept[yy_current_state];
956
957
0
    YY_DO_BEFORE_ACTION;
958
959
0
do_action:  /* This label is used only to access EOF actions. */
960
961
0
    switch ( yy_act )
962
0
  { /* beginning of action switch */
963
0
      case 0: /* must back up */
964
      /* undo the effects of YY_DO_BEFORE_ACTION */
965
0
      *yy_cp = yyg->yy_hold_char;
966
0
      yy_cp = yyg->yy_last_accepting_cpos;
967
0
      yy_current_state = yyg->yy_last_accepting_state;
968
0
      goto yy_find_action;
969
970
0
case 1:
971
0
YY_RULE_SETUP
972
0
#line 115 "exprscan.l"
973
0
{
974
          /* Found a word, emit and return it */
975
0
          psqlscan_emit(cur_state, yytext, yyleng);
976
0
          return 1;
977
0
        }
978
0
  YY_BREAK
979
/*
980
   * We need this rule to avoid returning "word\" instead of recognizing
981
   * a continuation marker just after a word:
982
   */
983
0
case 2:
984
/* rule 2 can match eol */
985
0
YY_RULE_SETUP
986
0
#line 125 "exprscan.l"
987
0
{
988
          /* Found "word\\\r?\n", emit and return just "word" */
989
0
          int   wordlen = yyleng - 2;
990
0
          if (yytext[wordlen] == '\r')
991
0
            wordlen--;
992
0
          Assert(yytext[wordlen] == '\\');
993
0
          psqlscan_emit(cur_state, yytext, wordlen);
994
0
          return 1;
995
0
        }
996
0
  YY_BREAK
997
0
case 3:
998
0
YY_RULE_SETUP
999
0
#line 135 "exprscan.l"
1000
0
{ /* ignore */ }
1001
0
  YY_BREAK
1002
0
case 4:
1003
/* rule 4 can match eol */
1004
0
YY_RULE_SETUP
1005
0
#line 137 "exprscan.l"
1006
0
{ /* ignore */ }
1007
0
  YY_BREAK
1008
0
case 5:
1009
/* rule 5 can match eol */
1010
0
YY_RULE_SETUP
1011
0
#line 139 "exprscan.l"
1012
0
{
1013
          /* report end of command */
1014
0
          last_was_newline = true;
1015
0
          return 0;
1016
0
        }
1017
0
  YY_BREAK
1018
/* EXPR state */
1019
1020
0
case 6:
1021
0
YY_RULE_SETUP
1022
0
#line 149 "exprscan.l"
1023
0
{ return '+'; }
1024
0
  YY_BREAK
1025
0
case 7:
1026
0
YY_RULE_SETUP
1027
0
#line 150 "exprscan.l"
1028
0
{ return '-'; }
1029
0
  YY_BREAK
1030
0
case 8:
1031
0
YY_RULE_SETUP
1032
0
#line 151 "exprscan.l"
1033
0
{ return '*'; }
1034
0
  YY_BREAK
1035
0
case 9:
1036
0
YY_RULE_SETUP
1037
0
#line 152 "exprscan.l"
1038
0
{ return '/'; }
1039
0
  YY_BREAK
1040
0
case 10:
1041
0
YY_RULE_SETUP
1042
0
#line 153 "exprscan.l"
1043
0
{ return '%'; } /* C version, also in Pg SQL */
1044
0
  YY_BREAK
1045
0
case 11:
1046
0
YY_RULE_SETUP
1047
0
#line 154 "exprscan.l"
1048
0
{ return '='; }
1049
0
  YY_BREAK
1050
0
case 12:
1051
0
YY_RULE_SETUP
1052
0
#line 155 "exprscan.l"
1053
0
{ return NE_OP; }
1054
0
  YY_BREAK
1055
0
case 13:
1056
0
YY_RULE_SETUP
1057
0
#line 156 "exprscan.l"
1058
0
{ return NE_OP; } /* C version, also in Pg SQL */
1059
0
  YY_BREAK
1060
0
case 14:
1061
0
YY_RULE_SETUP
1062
0
#line 157 "exprscan.l"
1063
0
{ return LE_OP; }
1064
0
  YY_BREAK
1065
0
case 15:
1066
0
YY_RULE_SETUP
1067
0
#line 158 "exprscan.l"
1068
0
{ return GE_OP; }
1069
0
  YY_BREAK
1070
0
case 16:
1071
0
YY_RULE_SETUP
1072
0
#line 159 "exprscan.l"
1073
0
{ return LS_OP; }
1074
0
  YY_BREAK
1075
0
case 17:
1076
0
YY_RULE_SETUP
1077
0
#line 160 "exprscan.l"
1078
0
{ return RS_OP; }
1079
0
  YY_BREAK
1080
0
case 18:
1081
0
YY_RULE_SETUP
1082
0
#line 161 "exprscan.l"
1083
0
{ return '<'; }
1084
0
  YY_BREAK
1085
0
case 19:
1086
0
YY_RULE_SETUP
1087
0
#line 162 "exprscan.l"
1088
0
{ return '>'; }
1089
0
  YY_BREAK
1090
0
case 20:
1091
0
YY_RULE_SETUP
1092
0
#line 163 "exprscan.l"
1093
0
{ return '|'; }
1094
0
  YY_BREAK
1095
0
case 21:
1096
0
YY_RULE_SETUP
1097
0
#line 164 "exprscan.l"
1098
0
{ return '&'; }
1099
0
  YY_BREAK
1100
0
case 22:
1101
0
YY_RULE_SETUP
1102
0
#line 165 "exprscan.l"
1103
0
{ return '#'; }
1104
0
  YY_BREAK
1105
0
case 23:
1106
0
YY_RULE_SETUP
1107
0
#line 166 "exprscan.l"
1108
0
{ return '~'; }
1109
0
  YY_BREAK
1110
0
case 24:
1111
0
YY_RULE_SETUP
1112
0
#line 168 "exprscan.l"
1113
0
{ return '('; }
1114
0
  YY_BREAK
1115
0
case 25:
1116
0
YY_RULE_SETUP
1117
0
#line 169 "exprscan.l"
1118
0
{ return ')'; }
1119
0
  YY_BREAK
1120
0
case 26:
1121
0
YY_RULE_SETUP
1122
0
#line 170 "exprscan.l"
1123
0
{ return ','; }
1124
0
  YY_BREAK
1125
0
case 27:
1126
0
YY_RULE_SETUP
1127
0
#line 172 "exprscan.l"
1128
0
{ return AND_OP; }
1129
0
  YY_BREAK
1130
0
case 28:
1131
0
YY_RULE_SETUP
1132
0
#line 173 "exprscan.l"
1133
0
{ return OR_OP; }
1134
0
  YY_BREAK
1135
0
case 29:
1136
0
YY_RULE_SETUP
1137
0
#line 174 "exprscan.l"
1138
0
{ return NOT_OP; }
1139
0
  YY_BREAK
1140
0
case 30:
1141
0
YY_RULE_SETUP
1142
0
#line 175 "exprscan.l"
1143
0
{ return IS_OP; }
1144
0
  YY_BREAK
1145
0
case 31:
1146
0
YY_RULE_SETUP
1147
0
#line 176 "exprscan.l"
1148
0
{ return ISNULL_OP; }
1149
0
  YY_BREAK
1150
0
case 32:
1151
0
YY_RULE_SETUP
1152
0
#line 177 "exprscan.l"
1153
0
{ return NOTNULL_OP; }
1154
0
  YY_BREAK
1155
0
case 33:
1156
0
YY_RULE_SETUP
1157
0
#line 179 "exprscan.l"
1158
0
{ return CASE_KW; }
1159
0
  YY_BREAK
1160
0
case 34:
1161
0
YY_RULE_SETUP
1162
0
#line 180 "exprscan.l"
1163
0
{ return WHEN_KW; }
1164
0
  YY_BREAK
1165
0
case 35:
1166
0
YY_RULE_SETUP
1167
0
#line 181 "exprscan.l"
1168
0
{ return THEN_KW; }
1169
0
  YY_BREAK
1170
0
case 36:
1171
0
YY_RULE_SETUP
1172
0
#line 182 "exprscan.l"
1173
0
{ return ELSE_KW; }
1174
0
  YY_BREAK
1175
0
case 37:
1176
0
YY_RULE_SETUP
1177
0
#line 183 "exprscan.l"
1178
0
{ return END_KW; }
1179
0
  YY_BREAK
1180
0
case 38:
1181
0
YY_RULE_SETUP
1182
0
#line 185 "exprscan.l"
1183
0
{
1184
0
          yylval->str = pg_strdup(yytext + 1);
1185
0
          return VARIABLE;
1186
0
        }
1187
0
  YY_BREAK
1188
0
case 39:
1189
0
YY_RULE_SETUP
1190
0
#line 190 "exprscan.l"
1191
0
{ return NULL_CONST; }
1192
0
  YY_BREAK
1193
0
case 40:
1194
0
YY_RULE_SETUP
1195
0
#line 191 "exprscan.l"
1196
0
{
1197
0
          yylval->bval = true;
1198
0
          return BOOLEAN_CONST;
1199
0
        }
1200
0
  YY_BREAK
1201
0
case 41:
1202
0
YY_RULE_SETUP
1203
0
#line 195 "exprscan.l"
1204
0
{
1205
0
          yylval->bval = false;
1206
0
          return BOOLEAN_CONST;
1207
0
        }
1208
0
  YY_BREAK
1209
0
case 42:
1210
0
YY_RULE_SETUP
1211
0
#line 199 "exprscan.l"
1212
0
{
1213
0
          yylval->ival = strtoint64(yytext);
1214
0
          return INTEGER_CONST;
1215
0
        }
1216
0
  YY_BREAK
1217
0
case 43:
1218
0
YY_RULE_SETUP
1219
0
#line 203 "exprscan.l"
1220
0
{
1221
0
          yylval->dval = atof(yytext);
1222
0
          return DOUBLE_CONST;
1223
0
        }
1224
0
  YY_BREAK
1225
0
case 44:
1226
0
YY_RULE_SETUP
1227
0
#line 207 "exprscan.l"
1228
0
{
1229
0
          yylval->dval = atof(yytext);
1230
0
          return DOUBLE_CONST;
1231
0
        }
1232
0
  YY_BREAK
1233
0
case 45:
1234
0
YY_RULE_SETUP
1235
0
#line 211 "exprscan.l"
1236
0
{
1237
0
          yylval->str = pg_strdup(yytext);
1238
0
          return FUNCTION;
1239
0
        }
1240
0
  YY_BREAK
1241
0
case 46:
1242
0
YY_RULE_SETUP
1243
0
#line 216 "exprscan.l"
1244
0
{ /* ignore */ }
1245
0
  YY_BREAK
1246
0
case 47:
1247
/* rule 47 can match eol */
1248
0
YY_RULE_SETUP
1249
0
#line 218 "exprscan.l"
1250
0
{ /* ignore */ }
1251
0
  YY_BREAK
1252
0
case 48:
1253
/* rule 48 can match eol */
1254
0
YY_RULE_SETUP
1255
0
#line 220 "exprscan.l"
1256
0
{
1257
          /* report end of command */
1258
0
          last_was_newline = true;
1259
0
          return 0;
1260
0
        }
1261
0
  YY_BREAK
1262
0
case 49:
1263
0
YY_RULE_SETUP
1264
0
#line 226 "exprscan.l"
1265
0
{
1266
          /*
1267
           * must strdup yytext so that expr_yyerror_more doesn't
1268
           * change it while finding end of line
1269
           */
1270
0
          expr_yyerror_more(yyscanner, "unexpected character",
1271
0
                    pg_strdup(yytext));
1272
          /* NOTREACHED, syntax_error calls exit() */
1273
0
          return 0;
1274
0
        }
1275
0
  YY_BREAK
1276
1277
0
case YY_STATE_EOF(INITIAL):
1278
0
case YY_STATE_EOF(EXPR):
1279
0
#line 239 "exprscan.l"
1280
0
{
1281
0
          if (cur_state->buffer_stack == NULL)
1282
0
            return 0;     /* end of input reached */
1283
1284
          /*
1285
           * We were expanding a variable, so pop the inclusion
1286
           * stack and keep lexing
1287
           */
1288
0
          psqlscan_pop_buffer_stack(cur_state);
1289
0
          psqlscan_select_top_buffer(cur_state);
1290
0
        }
1291
0
  YY_BREAK
1292
0
case 50:
1293
0
YY_RULE_SETUP
1294
0
#line 251 "exprscan.l"
1295
0
YY_FATAL_ERROR( "flex scanner jammed" );
1296
0
  YY_BREAK
1297
0
#line 1297 "exprscan.c"
1298
1299
0
  case YY_END_OF_BUFFER:
1300
0
    {
1301
    /* Amount of text matched not including the EOB char. */
1302
0
    int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1303
1304
    /* Undo the effects of YY_DO_BEFORE_ACTION. */
1305
0
    *yy_cp = yyg->yy_hold_char;
1306
0
    YY_RESTORE_YY_MORE_OFFSET
1307
1308
0
    if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1309
0
      {
1310
      /* We're scanning a new file or input source.  It's
1311
       * possible that this happened because the user
1312
       * just pointed yyin at a new source and called
1313
       * expr_yylex().  If so, then we have to assure
1314
       * consistency between YY_CURRENT_BUFFER and our
1315
       * globals.  Here is the right place to do so, because
1316
       * this is the first action (other than possibly a
1317
       * back-up) that will match for the new input source.
1318
       */
1319
0
      yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1320
0
      YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1321
0
      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1322
0
      }
1323
1324
    /* Note that here we test for yy_c_buf_p "<=" to the position
1325
     * of the first EOB in the buffer, since yy_c_buf_p will
1326
     * already have been incremented past the NUL character
1327
     * (since all states make transitions on EOB to the
1328
     * end-of-buffer state).  Contrast this with the test
1329
     * in input().
1330
     */
1331
0
    if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1332
0
      { /* This was really a NUL. */
1333
0
      yy_state_type yy_next_state;
1334
1335
0
      yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1336
1337
0
      yy_current_state = yy_get_previous_state( yyscanner );
1338
1339
      /* Okay, we're now positioned to make the NUL
1340
       * transition.  We couldn't have
1341
       * yy_get_previous_state() go ahead and do it
1342
       * for us because it doesn't know how to deal
1343
       * with the possibility of jamming (and we don't
1344
       * want to build jamming into it because then it
1345
       * will run more slowly).
1346
       */
1347
1348
0
      yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1349
1350
0
      yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1351
1352
0
      if ( yy_next_state )
1353
0
        {
1354
        /* Consume the NUL. */
1355
0
        yy_cp = ++yyg->yy_c_buf_p;
1356
0
        yy_current_state = yy_next_state;
1357
0
        goto yy_match;
1358
0
        }
1359
1360
0
      else
1361
0
        {
1362
0
        yy_cp = yyg->yy_last_accepting_cpos;
1363
0
        yy_current_state = yyg->yy_last_accepting_state;
1364
0
        goto yy_find_action;
1365
0
        }
1366
0
      }
1367
1368
0
    else switch ( yy_get_next_buffer( yyscanner ) )
1369
0
      {
1370
0
      case EOB_ACT_END_OF_FILE:
1371
0
        {
1372
0
        yyg->yy_did_buffer_switch_on_eof = 0;
1373
1374
0
        if ( expr_yywrap(yyscanner ) )
1375
0
          {
1376
          /* Note: because we've taken care in
1377
           * yy_get_next_buffer() to have set up
1378
           * yytext, we can now set up
1379
           * yy_c_buf_p so that if some total
1380
           * hoser (like flex itself) wants to
1381
           * call the scanner after we return the
1382
           * YY_NULL, it'll still work - another
1383
           * YY_NULL will get returned.
1384
           */
1385
0
          yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1386
1387
0
          yy_act = YY_STATE_EOF(YY_START);
1388
0
          goto do_action;
1389
0
          }
1390
1391
0
        else
1392
0
          {
1393
0
          if ( ! yyg->yy_did_buffer_switch_on_eof )
1394
0
            YY_NEW_FILE;
1395
0
          }
1396
0
        break;
1397
0
        }
1398
1399
0
      case EOB_ACT_CONTINUE_SCAN:
1400
0
        yyg->yy_c_buf_p =
1401
0
          yyg->yytext_ptr + yy_amount_of_matched_text;
1402
1403
0
        yy_current_state = yy_get_previous_state( yyscanner );
1404
1405
0
        yy_cp = yyg->yy_c_buf_p;
1406
0
        yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1407
0
        goto yy_match;
1408
1409
0
      case EOB_ACT_LAST_MATCH:
1410
0
        yyg->yy_c_buf_p =
1411
0
        &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1412
1413
0
        yy_current_state = yy_get_previous_state( yyscanner );
1414
1415
0
        yy_cp = yyg->yy_c_buf_p;
1416
0
        yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1417
0
        goto yy_find_action;
1418
0
      }
1419
0
    break;
1420
0
    }
1421
1422
0
  default:
1423
0
    YY_FATAL_ERROR(
1424
0
      "fatal flex scanner internal error--no action found" );
1425
0
  } /* end of action switch */
1426
0
    } /* end of scanning one token */
1427
0
  } /* end of user's declarations */
1428
0
} /* end of expr_yylex */
1429
1430
/* yy_get_next_buffer - try to read in a new buffer
1431
 *
1432
 * Returns a code representing an action:
1433
 *  EOB_ACT_LAST_MATCH -
1434
 *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1435
 *  EOB_ACT_END_OF_FILE - end of file
1436
 */
1437
static int yy_get_next_buffer (yyscan_t yyscanner)
1438
0
{
1439
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1440
0
  char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1441
0
  char *source = yyg->yytext_ptr;
1442
0
  int number_to_move, i;
1443
0
  int ret_val;
1444
1445
0
  if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1446
0
    YY_FATAL_ERROR(
1447
0
    "fatal flex scanner internal error--end of buffer missed" );
1448
1449
0
  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1450
0
    { /* Don't try to fill the buffer, so this is an EOF. */
1451
0
    if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1452
0
      {
1453
      /* We matched a single character, the EOB, so
1454
       * treat this as a final EOF.
1455
       */
1456
0
      return EOB_ACT_END_OF_FILE;
1457
0
      }
1458
1459
0
    else
1460
0
      {
1461
      /* We matched some text prior to the EOB, first
1462
       * process it.
1463
       */
1464
0
      return EOB_ACT_LAST_MATCH;
1465
0
      }
1466
0
    }
1467
1468
  /* Try to read more data. */
1469
1470
  /* First move last chars to start of buffer. */
1471
0
  number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
1472
1473
0
  for ( i = 0; i < number_to_move; ++i )
1474
0
    *(dest++) = *(source++);
1475
1476
0
  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1477
    /* don't do the read, it's not guaranteed to return an EOF,
1478
     * just force an EOF
1479
     */
1480
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1481
1482
0
  else
1483
0
    {
1484
0
      int num_to_read =
1485
0
      YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1486
1487
0
    while ( num_to_read <= 0 )
1488
0
      { /* Not enough room in the buffer - grow it. */
1489
1490
      /* just a shorter name for the current buffer */
1491
0
      YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1492
1493
0
      int yy_c_buf_p_offset =
1494
0
        (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1495
1496
0
      if ( b->yy_is_our_buffer )
1497
0
        {
1498
0
        int new_size = b->yy_buf_size * 2;
1499
1500
0
        if ( new_size <= 0 )
1501
0
          b->yy_buf_size += b->yy_buf_size / 8;
1502
0
        else
1503
0
          b->yy_buf_size *= 2;
1504
1505
0
        b->yy_ch_buf = (char *)
1506
          /* Include room in for 2 EOB chars. */
1507
0
          expr_yyrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ,yyscanner );
1508
0
        }
1509
0
      else
1510
        /* Can't grow it, we don't own it. */
1511
0
        b->yy_ch_buf = NULL;
1512
1513
0
      if ( ! b->yy_ch_buf )
1514
0
        YY_FATAL_ERROR(
1515
0
        "fatal error - scanner input buffer overflow" );
1516
1517
0
      yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1518
1519
0
      num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1520
0
            number_to_move - 1;
1521
1522
0
      }
1523
1524
0
    if ( num_to_read > YY_READ_BUF_SIZE )
1525
0
      num_to_read = YY_READ_BUF_SIZE;
1526
1527
    /* Read in more data. */
1528
0
    YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1529
0
      yyg->yy_n_chars, num_to_read );
1530
1531
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1532
0
    }
1533
1534
0
  if ( yyg->yy_n_chars == 0 )
1535
0
    {
1536
0
    if ( number_to_move == YY_MORE_ADJ )
1537
0
      {
1538
0
      ret_val = EOB_ACT_END_OF_FILE;
1539
0
      expr_yyrestart(yyin  ,yyscanner);
1540
0
      }
1541
1542
0
    else
1543
0
      {
1544
0
      ret_val = EOB_ACT_LAST_MATCH;
1545
0
      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1546
0
        YY_BUFFER_EOF_PENDING;
1547
0
      }
1548
0
    }
1549
1550
0
  else
1551
0
    ret_val = EOB_ACT_CONTINUE_SCAN;
1552
1553
0
  if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1554
    /* Extend the array by 50%, plus the number we really need. */
1555
0
    int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1556
0
    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) expr_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size ,yyscanner );
1557
0
    if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1558
0
      YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1559
0
  }
1560
1561
0
  yyg->yy_n_chars += number_to_move;
1562
0
  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1563
0
  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1564
1565
0
  yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1566
1567
0
  return ret_val;
1568
0
}
1569
1570
/* yy_get_previous_state - get the state just before the EOB char was reached */
1571
1572
    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1573
0
{
1574
0
  yy_state_type yy_current_state;
1575
0
  char *yy_cp;
1576
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1577
1578
0
  yy_current_state = yyg->yy_start;
1579
1580
0
  for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1581
0
    {
1582
0
    YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1583
0
    if ( yy_accept[yy_current_state] )
1584
0
      {
1585
0
      yyg->yy_last_accepting_state = yy_current_state;
1586
0
      yyg->yy_last_accepting_cpos = yy_cp;
1587
0
      }
1588
0
    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1589
0
      {
1590
0
      yy_current_state = (int) yy_def[yy_current_state];
1591
0
      if ( yy_current_state >= 110 )
1592
0
        yy_c = yy_meta[yy_c];
1593
0
      }
1594
0
    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1595
0
    }
1596
1597
0
  return yy_current_state;
1598
0
}
1599
1600
/* yy_try_NUL_trans - try to make a transition on the NUL character
1601
 *
1602
 * synopsis
1603
 *  next_state = yy_try_NUL_trans( current_state );
1604
 */
1605
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
1606
0
{
1607
0
  int yy_is_jam;
1608
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1609
0
  char *yy_cp = yyg->yy_c_buf_p;
1610
1611
0
  YY_CHAR yy_c = 1;
1612
0
  if ( yy_accept[yy_current_state] )
1613
0
    {
1614
0
    yyg->yy_last_accepting_state = yy_current_state;
1615
0
    yyg->yy_last_accepting_cpos = yy_cp;
1616
0
    }
1617
0
  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1618
0
    {
1619
0
    yy_current_state = (int) yy_def[yy_current_state];
1620
0
    if ( yy_current_state >= 110 )
1621
0
      yy_c = yy_meta[yy_c];
1622
0
    }
1623
0
  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1624
0
  yy_is_jam = (yy_current_state == 109);
1625
1626
0
  (void)yyg;
1627
0
  return yy_is_jam ? 0 : yy_current_state;
1628
0
}
1629
1630
#ifndef YY_NO_UNPUT
1631
1632
#endif
1633
1634
#ifndef YY_NO_INPUT
1635
#ifdef __cplusplus
1636
    static int yyinput (yyscan_t yyscanner)
1637
#else
1638
    static int input  (yyscan_t yyscanner)
1639
#endif
1640
1641
{
1642
  int c;
1643
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1644
1645
  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1646
1647
  if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1648
    {
1649
    /* yy_c_buf_p now points to the character we want to return.
1650
     * If this occurs *before* the EOB characters, then it's a
1651
     * valid NUL; if not, then we've hit the end of the buffer.
1652
     */
1653
    if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1654
      /* This was really a NUL. */
1655
      *yyg->yy_c_buf_p = '\0';
1656
1657
    else
1658
      { /* need more input */
1659
      int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
1660
      ++yyg->yy_c_buf_p;
1661
1662
      switch ( yy_get_next_buffer( yyscanner ) )
1663
        {
1664
        case EOB_ACT_LAST_MATCH:
1665
          /* This happens because yy_g_n_b()
1666
           * sees that we've accumulated a
1667
           * token and flags that we need to
1668
           * try matching the token before
1669
           * proceeding.  But for input(),
1670
           * there's no matching to consider.
1671
           * So convert the EOB_ACT_LAST_MATCH
1672
           * to EOB_ACT_END_OF_FILE.
1673
           */
1674
1675
          /* Reset buffer status. */
1676
          expr_yyrestart(yyin ,yyscanner);
1677
1678
          /*FALLTHROUGH*/
1679
1680
        case EOB_ACT_END_OF_FILE:
1681
          {
1682
          if ( expr_yywrap(yyscanner ) )
1683
            return 0;
1684
1685
          if ( ! yyg->yy_did_buffer_switch_on_eof )
1686
            YY_NEW_FILE;
1687
#ifdef __cplusplus
1688
          return yyinput(yyscanner);
1689
#else
1690
          return input(yyscanner);
1691
#endif
1692
          }
1693
1694
        case EOB_ACT_CONTINUE_SCAN:
1695
          yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1696
          break;
1697
        }
1698
      }
1699
    }
1700
1701
  c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1702
  *yyg->yy_c_buf_p = '\0';  /* preserve yytext */
1703
  yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1704
1705
  return c;
1706
}
1707
#endif  /* ifndef YY_NO_INPUT */
1708
1709
/** Immediately switch to a different input stream.
1710
 * @param input_file A readable stream.
1711
 * @param yyscanner The scanner object.
1712
 * @note This function does not reset the start condition to @c INITIAL .
1713
 */
1714
    void expr_yyrestart  (FILE * input_file , yyscan_t yyscanner)
1715
0
{
1716
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1717
1718
0
  if ( ! YY_CURRENT_BUFFER ){
1719
0
        expr_yyensure_buffer_stack (yyscanner);
1720
0
    YY_CURRENT_BUFFER_LVALUE =
1721
0
            expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1722
0
  }
1723
1724
0
  expr_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1725
0
  expr_yy_load_buffer_state(yyscanner );
1726
0
}
1727
1728
/** Switch to a different input buffer.
1729
 * @param new_buffer The new input buffer.
1730
 * @param yyscanner The scanner object.
1731
 */
1732
    void expr_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
1733
0
{
1734
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1735
1736
  /* TODO. We should be able to replace this entire function body
1737
   * with
1738
   *    expr_yypop_buffer_state();
1739
   *    expr_yypush_buffer_state(new_buffer);
1740
     */
1741
0
  expr_yyensure_buffer_stack (yyscanner);
1742
0
  if ( YY_CURRENT_BUFFER == new_buffer )
1743
0
    return;
1744
1745
0
  if ( YY_CURRENT_BUFFER )
1746
0
    {
1747
    /* Flush out information for old buffer. */
1748
0
    *yyg->yy_c_buf_p = yyg->yy_hold_char;
1749
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1750
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1751
0
    }
1752
1753
0
  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1754
0
  expr_yy_load_buffer_state(yyscanner );
1755
1756
  /* We don't actually know whether we did this switch during
1757
   * EOF (expr_yywrap()) processing, but the only time this flag
1758
   * is looked at is after expr_yywrap() is called, so it's safe
1759
   * to go ahead and always set it.
1760
   */
1761
0
  yyg->yy_did_buffer_switch_on_eof = 1;
1762
0
}
1763
1764
static void expr_yy_load_buffer_state  (yyscan_t yyscanner)
1765
0
{
1766
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1767
0
  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1768
0
  yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1769
0
  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1770
0
  yyg->yy_hold_char = *yyg->yy_c_buf_p;
1771
0
}
1772
1773
/** Allocate and initialize an input buffer state.
1774
 * @param file A readable stream.
1775
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1776
 * @param yyscanner The scanner object.
1777
 * @return the allocated buffer state.
1778
 */
1779
    YY_BUFFER_STATE expr_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
1780
0
{
1781
0
  YY_BUFFER_STATE b;
1782
    
1783
0
  b = (YY_BUFFER_STATE) expr_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1784
0
  if ( ! b )
1785
0
    YY_FATAL_ERROR( "out of dynamic memory in expr_yy_create_buffer()" );
1786
1787
0
  b->yy_buf_size = size;
1788
1789
  /* yy_ch_buf has to be 2 characters longer than the size given because
1790
   * we need to put in 2 end-of-buffer characters.
1791
   */
1792
0
  b->yy_ch_buf = (char *) expr_yyalloc((yy_size_t) (b->yy_buf_size + 2) ,yyscanner );
1793
0
  if ( ! b->yy_ch_buf )
1794
0
    YY_FATAL_ERROR( "out of dynamic memory in expr_yy_create_buffer()" );
1795
1796
0
  b->yy_is_our_buffer = 1;
1797
1798
0
  expr_yy_init_buffer(b,file ,yyscanner);
1799
1800
0
  return b;
1801
0
}
1802
1803
/** Destroy the buffer.
1804
 * @param b a buffer created with expr_yy_create_buffer()
1805
 * @param yyscanner The scanner object.
1806
 */
1807
    void expr_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1808
0
{
1809
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1810
1811
0
  if ( ! b )
1812
0
    return;
1813
1814
0
  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1815
0
    YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1816
1817
0
  if ( b->yy_is_our_buffer )
1818
0
    expr_yyfree((void *) b->yy_ch_buf ,yyscanner );
1819
1820
0
  expr_yyfree((void *) b ,yyscanner );
1821
0
}
1822
1823
/* Initializes or reinitializes a buffer.
1824
 * This function is sometimes called more than once on the same buffer,
1825
 * such as during a expr_yyrestart() or at EOF.
1826
 */
1827
    static void expr_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
1828
1829
0
{
1830
0
  int oerrno = errno;
1831
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1832
1833
0
  expr_yy_flush_buffer(b ,yyscanner);
1834
1835
0
  b->yy_input_file = file;
1836
0
  b->yy_fill_buffer = 1;
1837
1838
    /* If b is the current buffer, then expr_yy_init_buffer was _probably_
1839
     * called from expr_yyrestart() or through yy_get_next_buffer.
1840
     * In that case, we don't want to reset the lineno or column.
1841
     */
1842
0
    if (b != YY_CURRENT_BUFFER){
1843
0
        b->yy_bs_lineno = 1;
1844
0
        b->yy_bs_column = 0;
1845
0
    }
1846
1847
0
        b->yy_is_interactive = 0;
1848
    
1849
0
  errno = oerrno;
1850
0
}
1851
1852
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1853
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1854
 * @param yyscanner The scanner object.
1855
 */
1856
    void expr_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1857
0
{
1858
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1859
0
  if ( ! b )
1860
0
    return;
1861
1862
0
  b->yy_n_chars = 0;
1863
1864
  /* We always need two end-of-buffer characters.  The first causes
1865
   * a transition to the end-of-buffer state.  The second causes
1866
   * a jam in that state.
1867
   */
1868
0
  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1869
0
  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1870
1871
0
  b->yy_buf_pos = &b->yy_ch_buf[0];
1872
1873
0
  b->yy_at_bol = 1;
1874
0
  b->yy_buffer_status = YY_BUFFER_NEW;
1875
1876
0
  if ( b == YY_CURRENT_BUFFER )
1877
0
    expr_yy_load_buffer_state(yyscanner );
1878
0
}
1879
1880
/** Pushes the new state onto the stack. The new state becomes
1881
 *  the current state. This function will allocate the stack
1882
 *  if necessary.
1883
 *  @param new_buffer The new state.
1884
 *  @param yyscanner The scanner object.
1885
 */
1886
void expr_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1887
0
{
1888
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1889
0
  if (new_buffer == NULL)
1890
0
    return;
1891
1892
0
  expr_yyensure_buffer_stack(yyscanner);
1893
1894
  /* This block is copied from expr_yy_switch_to_buffer. */
1895
0
  if ( YY_CURRENT_BUFFER )
1896
0
    {
1897
    /* Flush out information for old buffer. */
1898
0
    *yyg->yy_c_buf_p = yyg->yy_hold_char;
1899
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1900
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1901
0
    }
1902
1903
  /* Only push if top exists. Otherwise, replace top. */
1904
0
  if (YY_CURRENT_BUFFER)
1905
0
    yyg->yy_buffer_stack_top++;
1906
0
  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1907
1908
  /* copied from expr_yy_switch_to_buffer. */
1909
0
  expr_yy_load_buffer_state(yyscanner );
1910
0
  yyg->yy_did_buffer_switch_on_eof = 1;
1911
0
}
1912
1913
/** Removes and deletes the top of the stack, if present.
1914
 *  The next element becomes the new top.
1915
 *  @param yyscanner The scanner object.
1916
 */
1917
void expr_yypop_buffer_state (yyscan_t yyscanner)
1918
0
{
1919
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1920
0
  if (!YY_CURRENT_BUFFER)
1921
0
    return;
1922
1923
0
  expr_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1924
0
  YY_CURRENT_BUFFER_LVALUE = NULL;
1925
0
  if (yyg->yy_buffer_stack_top > 0)
1926
0
    --yyg->yy_buffer_stack_top;
1927
1928
0
  if (YY_CURRENT_BUFFER) {
1929
0
    expr_yy_load_buffer_state(yyscanner );
1930
0
    yyg->yy_did_buffer_switch_on_eof = 1;
1931
0
  }
1932
0
}
1933
1934
/* Allocates the stack if it does not exist.
1935
 *  Guarantees space for at least one push.
1936
 */
1937
static void expr_yyensure_buffer_stack (yyscan_t yyscanner)
1938
0
{
1939
0
  yy_size_t num_to_alloc;
1940
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1941
1942
0
  if (!yyg->yy_buffer_stack) {
1943
1944
    /* First allocation is just for 2 elements, since we don't know if this
1945
     * scanner will even need a stack. We use 2 instead of 1 to avoid an
1946
     * immediate realloc on the next call.
1947
         */
1948
0
      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1949
0
    yyg->yy_buffer_stack = (struct yy_buffer_state**)expr_yyalloc
1950
0
                (num_to_alloc * sizeof(struct yy_buffer_state*)
1951
0
                , yyscanner);
1952
0
    if ( ! yyg->yy_buffer_stack )
1953
0
      YY_FATAL_ERROR( "out of dynamic memory in expr_yyensure_buffer_stack()" );
1954
1955
0
    memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1956
1957
0
    yyg->yy_buffer_stack_max = num_to_alloc;
1958
0
    yyg->yy_buffer_stack_top = 0;
1959
0
    return;
1960
0
  }
1961
1962
0
  if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1963
1964
    /* Increase the buffer to prepare for a possible push. */
1965
0
    yy_size_t grow_size = 8 /* arbitrary grow size */;
1966
1967
0
    num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1968
0
    yyg->yy_buffer_stack = (struct yy_buffer_state**)expr_yyrealloc
1969
0
                (yyg->yy_buffer_stack,
1970
0
                num_to_alloc * sizeof(struct yy_buffer_state*)
1971
0
                , yyscanner);
1972
0
    if ( ! yyg->yy_buffer_stack )
1973
0
      YY_FATAL_ERROR( "out of dynamic memory in expr_yyensure_buffer_stack()" );
1974
1975
    /* zero only the new slots.*/
1976
0
    memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1977
0
    yyg->yy_buffer_stack_max = num_to_alloc;
1978
0
  }
1979
0
}
1980
1981
/** Setup the input buffer state to scan directly from a user-specified character buffer.
1982
 * @param base the character buffer
1983
 * @param size the size in bytes of the character buffer
1984
 * @param yyscanner The scanner object.
1985
 * @return the newly allocated buffer state object.
1986
 */
1987
YY_BUFFER_STATE expr_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
1988
0
{
1989
0
  YY_BUFFER_STATE b;
1990
    
1991
0
  if ( size < 2 ||
1992
0
       base[size-2] != YY_END_OF_BUFFER_CHAR ||
1993
0
       base[size-1] != YY_END_OF_BUFFER_CHAR )
1994
    /* They forgot to leave room for the EOB's. */
1995
0
    return NULL;
1996
1997
0
  b = (YY_BUFFER_STATE) expr_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1998
0
  if ( ! b )
1999
0
    YY_FATAL_ERROR( "out of dynamic memory in expr_yy_scan_buffer()" );
2000
2001
0
  b->yy_buf_size = (int) (size - 2);  /* "- 2" to take care of EOB's */
2002
0
  b->yy_buf_pos = b->yy_ch_buf = base;
2003
0
  b->yy_is_our_buffer = 0;
2004
0
  b->yy_input_file = NULL;
2005
0
  b->yy_n_chars = b->yy_buf_size;
2006
0
  b->yy_is_interactive = 0;
2007
0
  b->yy_at_bol = 1;
2008
0
  b->yy_fill_buffer = 0;
2009
0
  b->yy_buffer_status = YY_BUFFER_NEW;
2010
2011
0
  expr_yy_switch_to_buffer(b ,yyscanner );
2012
2013
0
  return b;
2014
0
}
2015
2016
/** Setup the input buffer state to scan a string. The next call to expr_yylex() will
2017
 * scan from a @e copy of @a str.
2018
 * @param yystr a NUL-terminated string to scan
2019
 * @param yyscanner The scanner object.
2020
 * @return the newly allocated buffer state object.
2021
 * @note If you want to scan bytes that may contain NUL values, then use
2022
 *       expr_yy_scan_bytes() instead.
2023
 */
2024
YY_BUFFER_STATE expr_yy_scan_string (const char * yystr , yyscan_t yyscanner)
2025
0
{
2026
    
2027
0
  return expr_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
2028
0
}
2029
2030
/** Setup the input buffer state to scan the given bytes. The next call to expr_yylex() will
2031
 * scan from a @e copy of @a bytes.
2032
 * @param yybytes the byte buffer to scan
2033
 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2034
 * @param yyscanner The scanner object.
2035
 * @return the newly allocated buffer state object.
2036
 */
2037
YY_BUFFER_STATE expr_yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
2038
0
{
2039
0
  YY_BUFFER_STATE b;
2040
0
  char *buf;
2041
0
  yy_size_t n;
2042
0
  int i;
2043
    
2044
  /* Get memory for full buffer, including space for trailing EOB's. */
2045
0
  n = (yy_size_t) (_yybytes_len + 2);
2046
0
  buf = (char *) expr_yyalloc(n ,yyscanner );
2047
0
  if ( ! buf )
2048
0
    YY_FATAL_ERROR( "out of dynamic memory in expr_yy_scan_bytes()" );
2049
2050
0
  for ( i = 0; i < _yybytes_len; ++i )
2051
0
    buf[i] = yybytes[i];
2052
2053
0
  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2054
2055
0
  b = expr_yy_scan_buffer(buf,n ,yyscanner);
2056
0
  if ( ! b )
2057
0
    YY_FATAL_ERROR( "bad buffer in expr_yy_scan_bytes()" );
2058
2059
  /* It's okay to grow etc. this buffer, and we should throw it
2060
   * away when we're done.
2061
   */
2062
0
  b->yy_is_our_buffer = 1;
2063
2064
0
  return b;
2065
0
}
2066
2067
#ifndef YY_EXIT_FAILURE
2068
0
#define YY_EXIT_FAILURE 2
2069
#endif
2070
2071
static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
2072
0
{
2073
0
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2074
0
  (void)yyg;
2075
0
  (void) fprintf( stderr, "%s\n", msg );
2076
0
  exit( YY_EXIT_FAILURE );
2077
0
}
2078
2079
/* Redefine yyless() so it works in section 3 code. */
2080
2081
#undef yyless
2082
#define yyless(n) \
2083
  do \
2084
    { \
2085
    /* Undo effects of setting up yytext. */ \
2086
        int yyless_macro_arg = (n); \
2087
        YY_LESS_LINENO(yyless_macro_arg);\
2088
    yytext[yyleng] = yyg->yy_hold_char; \
2089
    yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2090
    yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2091
    *yyg->yy_c_buf_p = '\0'; \
2092
    yyleng = yyless_macro_arg; \
2093
    } \
2094
  while ( 0 )
2095
2096
/* Accessor  methods (get/set functions) to struct members. */
2097
2098
/** Get the user-defined data for this scanner.
2099
 * @param yyscanner The scanner object.
2100
 */
2101
YY_EXTRA_TYPE expr_yyget_extra  (yyscan_t yyscanner)
2102
0
{
2103
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2104
0
    return yyextra;
2105
0
}
2106
2107
/** Get the current line number.
2108
 * @param yyscanner The scanner object.
2109
 */
2110
int expr_yyget_lineno  (yyscan_t yyscanner)
2111
0
{
2112
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2113
2114
0
        if (! YY_CURRENT_BUFFER)
2115
0
            return 0;
2116
    
2117
0
    return yylineno;
2118
0
}
2119
2120
/** Get the current column number.
2121
 * @param yyscanner The scanner object.
2122
 */
2123
int expr_yyget_column  (yyscan_t yyscanner)
2124
0
{
2125
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2126
2127
0
        if (! YY_CURRENT_BUFFER)
2128
0
            return 0;
2129
    
2130
0
    return yycolumn;
2131
0
}
2132
2133
/** Get the input stream.
2134
 * @param yyscanner The scanner object.
2135
 */
2136
FILE *expr_yyget_in  (yyscan_t yyscanner)
2137
0
{
2138
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2139
0
    return yyin;
2140
0
}
2141
2142
/** Get the output stream.
2143
 * @param yyscanner The scanner object.
2144
 */
2145
FILE *expr_yyget_out  (yyscan_t yyscanner)
2146
0
{
2147
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2148
0
    return yyout;
2149
0
}
2150
2151
/** Get the length of the current token.
2152
 * @param yyscanner The scanner object.
2153
 */
2154
int expr_yyget_leng  (yyscan_t yyscanner)
2155
0
{
2156
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2157
0
    return yyleng;
2158
0
}
2159
2160
/** Get the current token.
2161
 * @param yyscanner The scanner object.
2162
 */
2163
2164
char *expr_yyget_text  (yyscan_t yyscanner)
2165
0
{
2166
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2167
0
    return yytext;
2168
0
}
2169
2170
/** Set the user-defined data. This data is never touched by the scanner.
2171
 * @param user_defined The data to be associated with this scanner.
2172
 * @param yyscanner The scanner object.
2173
 */
2174
void expr_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
2175
0
{
2176
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2177
0
    yyextra = user_defined ;
2178
0
}
2179
2180
/** Set the current line number.
2181
 * @param _line_number line number
2182
 * @param yyscanner The scanner object.
2183
 */
2184
void expr_yyset_lineno (int  _line_number , yyscan_t yyscanner)
2185
0
{
2186
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2187
2188
        /* lineno is only valid if an input buffer exists. */
2189
0
        if (! YY_CURRENT_BUFFER )
2190
0
           YY_FATAL_ERROR( "expr_yyset_lineno called with no buffer" );
2191
    
2192
0
    yylineno = _line_number;
2193
0
}
2194
2195
/** Set the current column.
2196
 * @param _column_no column number
2197
 * @param yyscanner The scanner object.
2198
 */
2199
void expr_yyset_column (int  _column_no , yyscan_t yyscanner)
2200
0
{
2201
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2202
2203
        /* column is only valid if an input buffer exists. */
2204
0
        if (! YY_CURRENT_BUFFER )
2205
0
           YY_FATAL_ERROR( "expr_yyset_column called with no buffer" );
2206
    
2207
0
    yycolumn = _column_no;
2208
0
}
2209
2210
/** Set the input stream. This does not discard the current
2211
 * input buffer.
2212
 * @param _in_str A readable stream.
2213
 * @param yyscanner The scanner object.
2214
 * @see expr_yy_switch_to_buffer
2215
 */
2216
void expr_yyset_in (FILE *  _in_str , yyscan_t yyscanner)
2217
0
{
2218
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2219
0
    yyin = _in_str ;
2220
0
}
2221
2222
void expr_yyset_out (FILE *  _out_str , yyscan_t yyscanner)
2223
0
{
2224
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2225
0
    yyout = _out_str ;
2226
0
}
2227
2228
int expr_yyget_debug  (yyscan_t yyscanner)
2229
0
{
2230
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2231
0
    return yy_flex_debug;
2232
0
}
2233
2234
void expr_yyset_debug (int  _bdebug , yyscan_t yyscanner)
2235
0
{
2236
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2237
0
    yy_flex_debug = _bdebug ;
2238
0
}
2239
2240
/* Accessor methods for yylval and yylloc */
2241
2242
YYSTYPE * expr_yyget_lval  (yyscan_t yyscanner)
2243
0
{
2244
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2245
0
    return yylval;
2246
0
}
2247
2248
void expr_yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
2249
0
{
2250
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2251
0
    yylval = yylval_param;
2252
0
}
2253
2254
/* User-visible API */
2255
2256
/* expr_yylex_init is special because it creates the scanner itself, so it is
2257
 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2258
 * That's why we explicitly handle the declaration, instead of using our macros.
2259
 */
2260
int expr_yylex_init(yyscan_t* ptr_yy_globals)
2261
0
{
2262
0
    if (ptr_yy_globals == NULL){
2263
0
        errno = EINVAL;
2264
0
        return 1;
2265
0
    }
2266
2267
0
    *ptr_yy_globals = (yyscan_t) expr_yyalloc ( sizeof( struct yyguts_t ), NULL );
2268
2269
0
    if (*ptr_yy_globals == NULL){
2270
0
        errno = ENOMEM;
2271
0
        return 1;
2272
0
    }
2273
2274
    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2275
0
    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2276
2277
0
    return yy_init_globals ( *ptr_yy_globals );
2278
0
}
2279
2280
/* expr_yylex_init_extra has the same functionality as expr_yylex_init, but follows the
2281
 * convention of taking the scanner as the last argument. Note however, that
2282
 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2283
 * is the reason, too, why this function also must handle its own declaration).
2284
 * The user defined value in the first argument will be available to expr_yyalloc in
2285
 * the yyextra field.
2286
 */
2287
int expr_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2288
0
{
2289
0
    struct yyguts_t dummy_yyguts;
2290
2291
0
    expr_yyset_extra (yy_user_defined, &dummy_yyguts);
2292
2293
0
    if (ptr_yy_globals == NULL){
2294
0
        errno = EINVAL;
2295
0
        return 1;
2296
0
    }
2297
2298
0
    *ptr_yy_globals = (yyscan_t) expr_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2299
2300
0
    if (*ptr_yy_globals == NULL){
2301
0
        errno = ENOMEM;
2302
0
        return 1;
2303
0
    }
2304
2305
    /* By setting to 0xAA, we expose bugs in
2306
    yy_init_globals. Leave at 0x00 for releases. */
2307
0
    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2308
2309
0
    expr_yyset_extra (yy_user_defined, *ptr_yy_globals);
2310
2311
0
    return yy_init_globals ( *ptr_yy_globals );
2312
0
}
2313
2314
static int yy_init_globals (yyscan_t yyscanner)
2315
0
{
2316
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2317
    /* Initialization is the same as for the non-reentrant scanner.
2318
     * This function is called from expr_yylex_destroy(), so don't allocate here.
2319
     */
2320
2321
0
    yyg->yy_buffer_stack = NULL;
2322
0
    yyg->yy_buffer_stack_top = 0;
2323
0
    yyg->yy_buffer_stack_max = 0;
2324
0
    yyg->yy_c_buf_p = NULL;
2325
0
    yyg->yy_init = 0;
2326
0
    yyg->yy_start = 0;
2327
2328
0
    yyg->yy_start_stack_ptr = 0;
2329
0
    yyg->yy_start_stack_depth = 0;
2330
0
    yyg->yy_start_stack =  NULL;
2331
2332
/* Defined in main.c */
2333
#ifdef YY_STDINIT
2334
    yyin = stdin;
2335
    yyout = stdout;
2336
#else
2337
0
    yyin = NULL;
2338
0
    yyout = NULL;
2339
0
#endif
2340
2341
    /* For future reference: Set errno on error, since we are called by
2342
     * expr_yylex_init()
2343
     */
2344
0
    return 0;
2345
0
}
2346
2347
/* expr_yylex_destroy is for both reentrant and non-reentrant scanners. */
2348
int expr_yylex_destroy  (yyscan_t yyscanner)
2349
0
{
2350
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2351
2352
    /* Pop the buffer stack, destroying each element. */
2353
0
  while(YY_CURRENT_BUFFER){
2354
0
    expr_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2355
0
    YY_CURRENT_BUFFER_LVALUE = NULL;
2356
0
    expr_yypop_buffer_state(yyscanner);
2357
0
  }
2358
2359
  /* Destroy the stack itself. */
2360
0
  expr_yyfree(yyg->yy_buffer_stack ,yyscanner);
2361
0
  yyg->yy_buffer_stack = NULL;
2362
2363
    /* Destroy the start condition stack. */
2364
0
        expr_yyfree(yyg->yy_start_stack ,yyscanner );
2365
0
        yyg->yy_start_stack = NULL;
2366
2367
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2368
     * expr_yylex() is called, initialization will occur. */
2369
0
    yy_init_globals( yyscanner);
2370
2371
    /* Destroy the main struct (reentrant only). */
2372
0
    expr_yyfree ( yyscanner , yyscanner );
2373
0
    yyscanner = NULL;
2374
0
    return 0;
2375
0
}
2376
2377
/*
2378
 * Internal utility routines.
2379
 */
2380
2381
#ifndef yytext_ptr
2382
static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
2383
{
2384
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2385
  (void)yyg;
2386
2387
  int i;
2388
  for ( i = 0; i < n; ++i )
2389
    s1[i] = s2[i];
2390
}
2391
#endif
2392
2393
#ifdef YY_NEED_STRLEN
2394
static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
2395
{
2396
  int n;
2397
  for ( n = 0; s[n]; ++n )
2398
    ;
2399
2400
  return n;
2401
}
2402
#endif
2403
2404
void *expr_yyalloc (yy_size_t  size , yyscan_t yyscanner)
2405
0
{
2406
0
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2407
0
  (void)yyg;
2408
0
  return malloc(size);
2409
0
}
2410
2411
void *expr_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
2412
0
{
2413
0
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2414
0
  (void)yyg;
2415
2416
  /* The cast to (char *) in the following accommodates both
2417
   * implementations that use char* generic pointers, and those
2418
   * that use void* generic pointers.  It works with the latter
2419
   * because both ANSI C and C++ allow castless assignment from
2420
   * any pointer type to void*, and deal with argument conversions
2421
   * as though doing an assignment.
2422
   */
2423
0
  return realloc(ptr, size);
2424
0
}
2425
2426
void expr_yyfree (void * ptr , yyscan_t yyscanner)
2427
0
{
2428
0
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2429
0
  (void)yyg;
2430
0
  free( (char *) ptr ); /* see expr_yyrealloc() for (char *) cast */
2431
0
}
2432
2433
#define YYTABLES_NAME "yytables"
2434
2435
#line 251 "exprscan.l"
2436
2437
2438
/* LCOV_EXCL_STOP */
2439
2440
void
2441
expr_yyerror_more(yyscan_t yyscanner, const char *message, const char *more)
2442
0
{
2443
0
  PsqlScanState state = yyget_extra(yyscanner);
2444
0
  int     error_detection_offset = expr_scanner_offset(state) - 1;
2445
0
  YYSTYPE   lval;
2446
0
  char     *full_line;
2447
2448
  /*
2449
   * While parsing an expression, we may not have collected the whole line
2450
   * yet from the input source.  Lex till EOL so we can report whole line.
2451
   * (If we're at EOF, it's okay to call yylex() an extra time.)
2452
   */
2453
0
  if (!last_was_newline)
2454
0
  {
2455
0
    while (yylex(&lval, yyscanner))
2456
0
       /* skip */ ;
2457
0
  }
2458
2459
  /* Extract the line, trimming trailing newline if any */
2460
0
  full_line = expr_scanner_get_substring(state,
2461
0
                       expr_start_offset,
2462
0
                       expr_scanner_offset(state),
2463
0
                       true);
2464
2465
0
  syntax_error(expr_source, expr_lineno, full_line, expr_command,
2466
0
         message, more, error_detection_offset - expr_start_offset);
2467
0
}
2468
2469
void
2470
expr_yyerror(yyscan_t yyscanner, const char *message)
2471
0
{
2472
0
  expr_yyerror_more(yyscanner, message, NULL);
2473
0
}
2474
2475
/*
2476
 * Collect a space-separated word from a backslash command and return it
2477
 * in word_buf, along with its starting string offset in *offset.
2478
 * Returns true if successful, false if at end of command.
2479
 */
2480
bool
2481
expr_lex_one_word(PsqlScanState state, PQExpBuffer word_buf, int *offset)
2482
0
{
2483
0
  int     lexresult;
2484
0
  YYSTYPE   lval;
2485
2486
  /* Must be scanning already */
2487
0
  Assert(state->scanbufhandle != NULL);
2488
2489
  /* Set current output target */
2490
0
  state->output_buf = word_buf;
2491
0
  resetPQExpBuffer(word_buf);
2492
2493
  /* Set input source */
2494
0
  if (state->buffer_stack != NULL)
2495
0
    yy_switch_to_buffer(state->buffer_stack->buf, state->scanner);
2496
0
  else
2497
0
    yy_switch_to_buffer(state->scanbufhandle, state->scanner);
2498
2499
  /* Set start state */
2500
0
  state->start_state = INITIAL;
2501
2502
  /* And lex. */
2503
0
  lexresult = yylex(&lval, state->scanner);
2504
2505
  /*
2506
   * Save start offset of word, if any.  We could do this more efficiently,
2507
   * but for now this seems fine.
2508
   */
2509
0
  if (lexresult)
2510
0
    *offset = expr_scanner_offset(state) - word_buf->len;
2511
0
  else
2512
0
    *offset = -1;
2513
2514
  /*
2515
   * In case the caller returns to using the regular SQL lexer, reselect the
2516
   * appropriate initial state.
2517
   */
2518
0
  psql_scan_reselect_sql_lexer(state);
2519
2520
0
  return (bool) lexresult;
2521
0
}
2522
2523
/*
2524
 * Prepare to lex an expression via expr_yyparse().
2525
 *
2526
 * Returns the yyscan_t that is to be passed to expr_yyparse().
2527
 * (This is just state->scanner, but callers don't need to know that.)
2528
 */
2529
yyscan_t
2530
expr_scanner_init(PsqlScanState state,
2531
          const char *source, int lineno, int start_offset,
2532
          const char *command)
2533
0
{
2534
  /* Save error context info */
2535
0
  expr_source = source;
2536
0
  expr_lineno = lineno;
2537
0
  expr_start_offset = start_offset;
2538
0
  expr_command = command;
2539
2540
  /* Must be scanning already */
2541
0
  Assert(state->scanbufhandle != NULL);
2542
2543
  /* Set current output target */
2544
0
  state->output_buf = NULL;
2545
2546
  /* Set input source */
2547
0
  if (state->buffer_stack != NULL)
2548
0
    yy_switch_to_buffer(state->buffer_stack->buf, state->scanner);
2549
0
  else
2550
0
    yy_switch_to_buffer(state->scanbufhandle, state->scanner);
2551
2552
  /* Set start state */
2553
0
  state->start_state = EXPR;
2554
2555
0
  return state->scanner;
2556
0
}
2557
2558
/*
2559
 * Finish lexing an expression.
2560
 */
2561
void
2562
expr_scanner_finish(yyscan_t yyscanner)
2563
0
{
2564
0
  PsqlScanState state = yyget_extra(yyscanner);
2565
2566
  /*
2567
   * Reselect appropriate initial state for SQL lexer.
2568
   */
2569
0
  psql_scan_reselect_sql_lexer(state);
2570
0
}
2571
2572
/*
2573
 * Get offset from start of string to end of current lexer token.
2574
 *
2575
 * We rely on the knowledge that flex modifies the scan buffer by storing
2576
 * a NUL at the end of the current token (yytext).  Note that this might
2577
 * not work quite right if we were parsing a sub-buffer, but since pgbench
2578
 * never invokes that functionality, it doesn't matter.
2579
 */
2580
int
2581
expr_scanner_offset(PsqlScanState state)
2582
0
{
2583
0
  return strlen(state->scanbuf);
2584
0
}
2585
2586
/*
2587
 * Get a malloc'd copy of the lexer input string from start_offset
2588
 * to just before end_offset.  If chomp is true, drop any trailing
2589
 * newline(s).
2590
 */
2591
char *
2592
expr_scanner_get_substring(PsqlScanState state,
2593
               int start_offset, int end_offset,
2594
               bool chomp)
2595
0
{
2596
0
  char     *result;
2597
0
  const char *scanptr = state->scanbuf + start_offset;
2598
0
  int     slen = end_offset - start_offset;
2599
2600
0
  Assert(slen >= 0);
2601
0
  Assert(end_offset <= strlen(state->scanbuf));
2602
2603
0
  if (chomp)
2604
0
  {
2605
0
    while (slen > 0 &&
2606
0
         (scanptr[slen - 1] == '\n' || scanptr[slen - 1] == '\r'))
2607
0
      slen--;
2608
0
  }
2609
2610
0
  result = (char *) pg_malloc(slen + 1);
2611
0
  memcpy(result, scanptr, slen);
2612
0
  result[slen] = '\0';
2613
2614
0
  return result;
2615
0
}
2616
2617
/*
2618
 * Get the line number associated with the given string offset
2619
 * (which must not be past the end of where we've lexed to).
2620
 */
2621
int
2622
expr_scanner_get_lineno(PsqlScanState state, int offset)
2623
0
{
2624
0
  int     lineno = 1;
2625
0
  const char *p = state->scanbuf;
2626
2627
0
  while (*p && offset > 0)
2628
0
  {
2629
0
    if (*p == '\n')
2630
0
      lineno++;
2631
0
    p++, offset--;
2632
0
  }
2633
0
  return lineno;
2634
0
}
2635