LCOV - code coverage report
Current view: top level - src/bin/pgbench - exprscan.c (source / functions) Hit Total Coverage
Test: PostgreSQL Lines: 79 434 18.2 %
Date: 2017-09-21 23:18:17 Functions: 6 41 14.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11