ast_expr2f.c

Go to the documentation of this file.
00001 #define WRAP_LIBC_MALLOC
00002 #include "asterisk.h"
00003 
00004 #line 2 "ast_expr2f.c"
00005 
00006 #line 4 "ast_expr2f.c"
00007 
00008 #define  YY_INT_ALIGNED short int
00009 
00010 /* A lexical scanner generated by flex */
00011 
00012 #define FLEX_SCANNER
00013 #define YY_FLEX_MAJOR_VERSION 2
00014 #define YY_FLEX_MINOR_VERSION 5
00015 #define YY_FLEX_SUBMINOR_VERSION 35
00016 #if YY_FLEX_SUBMINOR_VERSION > 0
00017 #define FLEX_BETA
00018 #endif
00019 
00020 /* First, we deal with  platform-specific or compiler-specific issues. */
00021 
00022 /* begin standard C headers. */
00023 #include <stdio.h>
00024 #include <string.h>
00025 #include <errno.h>
00026 #include <stdlib.h>
00027 
00028 /* end standard C headers. */
00029 
00030 /* flex integer type definitions */
00031 
00032 #ifndef FLEXINT_H
00033 #define FLEXINT_H
00034 
00035 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00036 
00037 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00038 
00039 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
00040  * if you want the limit (max/min) macros for int types. 
00041  */
00042 #ifndef __STDC_LIMIT_MACROS
00043 #define __STDC_LIMIT_MACROS 1
00044 #endif
00045 
00046 #include <inttypes.h>
00047 typedef int8_t flex_int8_t;
00048 typedef uint8_t flex_uint8_t;
00049 typedef int16_t flex_int16_t;
00050 typedef uint16_t flex_uint16_t;
00051 typedef int32_t flex_int32_t;
00052 typedef uint32_t flex_uint32_t;
00053 #else
00054 typedef signed char flex_int8_t;
00055 typedef short int flex_int16_t;
00056 typedef int flex_int32_t;
00057 typedef unsigned char flex_uint8_t; 
00058 typedef unsigned short int flex_uint16_t;
00059 typedef unsigned int flex_uint32_t;
00060 
00061 /* Limits of integral types. */
00062 #ifndef INT8_MIN
00063 #define INT8_MIN               (-128)
00064 #endif
00065 #ifndef INT16_MIN
00066 #define INT16_MIN              (-32767-1)
00067 #endif
00068 #ifndef INT32_MIN
00069 #define INT32_MIN              (-2147483647-1)
00070 #endif
00071 #ifndef INT8_MAX
00072 #define INT8_MAX               (127)
00073 #endif
00074 #ifndef INT16_MAX
00075 #define INT16_MAX              (32767)
00076 #endif
00077 #ifndef INT32_MAX
00078 #define INT32_MAX              (2147483647)
00079 #endif
00080 #ifndef UINT8_MAX
00081 #define UINT8_MAX              (255U)
00082 #endif
00083 #ifndef UINT16_MAX
00084 #define UINT16_MAX             (65535U)
00085 #endif
00086 #ifndef UINT32_MAX
00087 #define UINT32_MAX             (4294967295U)
00088 #endif
00089 
00090 #endif /* ! C99 */
00091 
00092 #endif /* ! FLEXINT_H */
00093 
00094 #ifdef __cplusplus
00095 
00096 /* The "const" storage-class-modifier is valid. */
00097 #define YY_USE_CONST
00098 
00099 #else /* ! __cplusplus */
00100 
00101 /* C99 requires __STDC__ to be defined as 1. */
00102 #if defined (__STDC__)
00103 
00104 #define YY_USE_CONST
00105 
00106 #endif   /* defined (__STDC__) */
00107 #endif   /* ! __cplusplus */
00108 
00109 #ifdef YY_USE_CONST
00110 #define yyconst const
00111 #else
00112 #define yyconst
00113 #endif
00114 
00115 /* Returned upon end-of-file. */
00116 #define YY_NULL 0
00117 
00118 /* Promotes a possibly negative, possibly signed char to an unsigned
00119  * integer for use as an array index.  If the signed char is negative,
00120  * we want to instead treat it as an 8-bit unsigned char, hence the
00121  * double cast.
00122  */
00123 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00124 
00125 /* An opaque pointer. */
00126 #ifndef YY_TYPEDEF_YY_SCANNER_T
00127 #define YY_TYPEDEF_YY_SCANNER_T
00128 typedef void* yyscan_t;
00129 #endif
00130 
00131 /* For convenience, these vars (plus the bison vars far below)
00132    are macros in the reentrant scanner. */
00133 #define yyin yyg->yyin_r
00134 #define yyout yyg->yyout_r
00135 #define yyextra yyg->yyextra_r
00136 #define yyleng yyg->yyleng_r
00137 #define yytext yyg->yytext_r
00138 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
00139 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
00140 #define yy_flex_debug yyg->yy_flex_debug_r
00141 
00142 /* Enter a start condition.  This macro really ought to take a parameter,
00143  * but we do it the disgusting crufty way forced on us by the ()-less
00144  * definition of BEGIN.
00145  */
00146 #define BEGIN yyg->yy_start = 1 + 2 *
00147 
00148 /* Translate the current start state into a value that can be later handed
00149  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00150  * compatibility.
00151  */
00152 #define YY_START ((yyg->yy_start - 1) / 2)
00153 #define YYSTATE YY_START
00154 
00155 /* Action number for EOF rule of a given start state. */
00156 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00157 
00158 /* Special action meaning "start processing a new file". */
00159 #define YY_NEW_FILE ast_yyrestart(yyin ,yyscanner )
00160 
00161 #define YY_END_OF_BUFFER_CHAR 0
00162 
00163 /* Size of default input buffer. */
00164 #ifndef YY_BUF_SIZE
00165 #ifdef __ia64__
00166 /* On IA-64, the buffer size is 16k, not 8k.
00167  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
00168  * Ditto for the __ia64__ case accordingly.
00169  */
00170 #define YY_BUF_SIZE 32768
00171 #else
00172 #define YY_BUF_SIZE 16384
00173 #endif /* __ia64__ */
00174 #endif
00175 
00176 /* The state buf must be large enough to hold one state per character in the main buffer.
00177  */
00178 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00179 
00180 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00181 #define YY_TYPEDEF_YY_BUFFER_STATE
00182 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00183 #endif
00184 
00185 #define EOB_ACT_CONTINUE_SCAN 0
00186 #define EOB_ACT_END_OF_FILE 1
00187 #define EOB_ACT_LAST_MATCH 2
00188 
00189     #define YY_LESS_LINENO(n)
00190     
00191 /* Return all but the first "n" matched characters back to the input stream. */
00192 #define yyless(n) \
00193    do \
00194       { \
00195       /* Undo effects of setting up yytext. */ \
00196         int yyless_macro_arg = (n); \
00197         YY_LESS_LINENO(yyless_macro_arg);\
00198       *yy_cp = yyg->yy_hold_char; \
00199       YY_RESTORE_YY_MORE_OFFSET \
00200       yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00201       YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00202       } \
00203    while ( 0 )
00204 
00205 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
00206 
00207 #ifndef YY_TYPEDEF_YY_SIZE_T
00208 #define YY_TYPEDEF_YY_SIZE_T
00209 typedef size_t yy_size_t;
00210 #endif
00211 
00212 #ifndef YY_STRUCT_YY_BUFFER_STATE
00213 #define YY_STRUCT_YY_BUFFER_STATE
00214 struct yy_buffer_state
00215    {
00216    FILE *yy_input_file;
00217 
00218    char *yy_ch_buf;     /* input buffer */
00219    char *yy_buf_pos;    /* current position in input buffer */
00220 
00221    /* Size of input buffer in bytes, not including room for EOB
00222     * characters.
00223     */
00224    yy_size_t yy_buf_size;
00225 
00226    /* Number of characters read into yy_ch_buf, not including EOB
00227     * characters.
00228     */
00229    int yy_n_chars;
00230 
00231    /* Whether we "own" the buffer - i.e., we know we created it,
00232     * and can realloc() it to grow it, and should free() it to
00233     * delete it.
00234     */
00235    int yy_is_our_buffer;
00236 
00237    /* Whether this is an "interactive" input source; if so, and
00238     * if we're using stdio for input, then we want to use getc()
00239     * instead of fread(), to make sure we stop fetching input after
00240     * each newline.
00241     */
00242    int yy_is_interactive;
00243 
00244    /* Whether we're considered to be at the beginning of a line.
00245     * If so, '^' rules will be active on the next match, otherwise
00246     * not.
00247     */
00248    int yy_at_bol;
00249 
00250     int yy_bs_lineno; /**< The line count. */
00251     int yy_bs_column; /**< The column count. */
00252     
00253    /* Whether to try to fill the input buffer when we reach the
00254     * end of it.
00255     */
00256    int yy_fill_buffer;
00257 
00258    int yy_buffer_status;
00259 
00260 #define YY_BUFFER_NEW 0
00261 #define YY_BUFFER_NORMAL 1
00262    /* When an EOF's been seen but there's still some text to process
00263     * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00264     * shouldn't try reading from the input source any more.  We might
00265     * still have a bunch of tokens to match, though, because of
00266     * possible backing-up.
00267     *
00268     * When we actually see the EOF, we change the status to "new"
00269     * (via ast_yyrestart()), so that the user can continue scanning by
00270     * just pointing yyin at a new input file.
00271     */
00272 #define YY_BUFFER_EOF_PENDING 2
00273 
00274    };
00275 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00276 
00277 /* We provide macros for accessing buffer states in case in the
00278  * future we want to put the buffer states in a more general
00279  * "scanner state".
00280  *
00281  * Returns the top of the stack, or NULL.
00282  */
00283 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
00284                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
00285                           : NULL)
00286 
00287 /* Same as previous macro, but useful when we know that the buffer stack is not
00288  * NULL or when we need an lvalue. For internal use only.
00289  */
00290 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
00291 
00292 void ast_yyrestart (FILE *input_file ,yyscan_t yyscanner );
00293 void ast_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00294 YY_BUFFER_STATE ast_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
00295 void ast_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00296 void ast_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00297 void ast_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00298 void ast_yypop_buffer_state (yyscan_t yyscanner );
00299 
00300 static void ast_yyensure_buffer_stack (yyscan_t yyscanner );
00301 static void ast_yy_load_buffer_state (yyscan_t yyscanner );
00302 static void ast_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
00303 
00304 #define YY_FLUSH_BUFFER ast_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
00305 
00306 YY_BUFFER_STATE ast_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
00307 YY_BUFFER_STATE ast_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
00308 YY_BUFFER_STATE ast_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
00309 
00310 void *ast_yyalloc (yy_size_t ,yyscan_t yyscanner );
00311 void *ast_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
00312 void ast_yyfree (void * ,yyscan_t yyscanner );
00313 
00314 #define yy_new_buffer ast_yy_create_buffer
00315 
00316 #define yy_set_interactive(is_interactive) \
00317    { \
00318    if ( ! YY_CURRENT_BUFFER ){ \
00319         ast_yyensure_buffer_stack (yyscanner); \
00320       YY_CURRENT_BUFFER_LVALUE =    \
00321             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00322    } \
00323    YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00324    }
00325 
00326 #define yy_set_bol(at_bol) \
00327    { \
00328    if ( ! YY_CURRENT_BUFFER ){\
00329         ast_yyensure_buffer_stack (yyscanner); \
00330       YY_CURRENT_BUFFER_LVALUE =    \
00331             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00332    } \
00333    YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00334    }
00335 
00336 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00337 
00338 /* Begin user sect3 */
00339 
00340 #define ast_yywrap(n) 1
00341 #define YY_SKIP_YYWRAP
00342 
00343 typedef unsigned char YY_CHAR;
00344 
00345 typedef int yy_state_type;
00346 
00347 #define yytext_ptr yytext_r
00348 
00349 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
00350 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
00351 static int yy_get_next_buffer (yyscan_t yyscanner );
00352 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
00353 
00354 /* Done after the current pattern has been matched and before the
00355  * corresponding action - sets up yytext.
00356  */
00357 #define YY_DO_BEFORE_ACTION \
00358    yyg->yytext_ptr = yy_bp; \
00359    yyg->yytext_ptr -= yyg->yy_more_len; \
00360    yyleng = (size_t) (yy_cp - yyg->yytext_ptr); \
00361    yyg->yy_hold_char = *yy_cp; \
00362    *yy_cp = '\0'; \
00363    yyg->yy_c_buf_p = yy_cp;
00364 
00365 #define YY_NUM_RULES 38
00366 #define YY_END_OF_BUFFER 39
00367 /* This struct is not used in this scanner,
00368    but its presence is necessary. */
00369 struct yy_trans_info
00370    {
00371    flex_int32_t yy_verify;
00372    flex_int32_t yy_nxt;
00373    };
00374 static yyconst flex_int16_t yy_accept[63] =
00375     {   0,
00376         0,    0,    0,    0,   35,   35,   39,   38,   27,   29,
00377        21,   38,   31,   38,   19,    2,   24,   25,   17,   14,
00378        15,   16,   18,   30,   22,   10,    3,    9,   20,    1,
00379        38,   38,   34,   33,   35,   37,   37,   13,    0,   28,
00380        31,    0,   26,    5,   31,   30,   23,   12,    6,    7,
00381        11,    4,    8,    0,   34,   33,   35,    0,   36,   32,
00382        30,    0
00383     } ;
00384 
00385 static yyconst flex_int32_t yy_ec[256] =
00386     {   0,
00387         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00388         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
00389         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00390         1,    2,    4,    5,    6,    7,    8,    9,    6,   10,
00391        11,   12,   13,   14,   15,   16,   17,   18,   18,   18,
00392        18,   18,   18,   18,   18,   18,   18,   19,    6,   20,
00393        21,   22,   23,    6,    6,    6,    6,    6,    6,    6,
00394         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00395         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00396         1,    6,    1,    6,    6,    1,    6,    6,    6,    6,
00397 
00398         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00399         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00400         6,    6,   24,   25,   26,   27,    1,   28,   28,   28,
00401        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00402        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00403        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00404        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00405        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00406        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00407        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00408 
00409        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00410        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00411        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00412        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00413        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00414        28,   28,   28,   28,   28
00415     } ;
00416 
00417 static yyconst flex_int32_t yy_meta[29] =
00418     {   0,
00419         1,    2,    2,    2,    1,    3,    3,    2,    2,    2,
00420         2,    2,    2,    1,    2,    3,    2,    3,    2,    2,
00421         2,    2,    2,    1,    2,    1,    1,    3
00422     } ;
00423 
00424 static yyconst flex_int16_t yy_base[70] =
00425     {   0,
00426         0,    0,    5,    6,   32,   60,   73,  130,  130,  130,
00427        51,   66,   63,   45,  130,   59,  130,  130,  130,  130,
00428       130,  130,  130,   83,   45,   42,   13,   41,  130,   32,
00429        28,   17,  130,  130,   47,  130,   29,  130,   47,  130,
00430        44,   25,  130,  130,   29,    0,  130,  130,  130,  130,
00431       130,  130,  130,   18,  130,  130,   38,   12,  130,  130,
00432         0,  130,  111,  114,  117,   32,  120,  123,  126
00433     } ;
00434 
00435 static yyconst flex_int16_t yy_def[70] =
00436     {   0,
00437        62,    1,   63,   63,   64,   64,   62,   62,   62,   62,
00438        62,   65,   66,   67,   62,   62,   62,   62,   62,   62,
00439        62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
00440        62,   68,   62,   62,   69,   62,   62,   62,   65,   62,
00441        66,   67,   62,   62,   41,   24,   62,   62,   62,   62,
00442        62,   62,   62,   68,   62,   62,   69,   62,   62,   62,
00443        45,    0,   62,   62,   62,   62,   62,   62,   62
00444     } ;
00445 
00446 static yyconst flex_int16_t yy_nxt[159] =
00447     {   0,
00448         8,    9,   10,   11,   12,   13,   14,   15,   16,   17,
00449        18,   19,   20,   21,   22,   13,   23,   24,   25,   26,
00450        27,   28,   29,    8,   30,    8,   31,   13,   33,   33,
00451        34,   34,   35,   49,   41,   59,   35,   35,   37,   50,
00452        55,   55,   56,   56,   58,   35,   61,   35,   60,   35,
00453        42,   40,   59,   58,   53,   35,   52,   35,   35,   35,
00454        35,   51,   48,   47,   35,   35,   37,   44,   43,   42,
00455        40,   38,   62,   35,   62,   35,   62,   35,   62,   62,
00456        62,   62,   62,   35,   62,   35,   35,   35,   41,   42,
00457        62,   62,   62,   62,   62,   62,   62,   62,   45,   62,
00458 
00459        46,   62,   62,   62,   62,   62,   62,   62,   62,   62,
00460        41,   32,   32,   32,   36,   36,   36,   39,   39,   39,
00461        41,   41,   41,   54,   54,   54,   57,   62,   57,    7,
00462        62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
00463        62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
00464        62,   62,   62,   62,   62,   62,   62,   62
00465     } ;
00466 
00467 static yyconst flex_int16_t yy_chk[159] =
00468     {   0,
00469         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00470         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00471         1,    1,    1,    1,    1,    1,    1,    1,    3,    4,
00472         3,    4,    5,   27,   66,   58,    5,    5,    5,   27,
00473        32,   54,   32,   54,   57,    5,   45,    5,   42,    5,
00474        41,   39,   37,   35,   31,    5,   30,    5,    5,    5,
00475         6,   28,   26,   25,    6,    6,    6,   16,   14,   13,
00476        12,   11,    7,    6,    0,    6,    0,    6,    0,    0,
00477         0,    0,    0,    6,    0,    6,    6,    6,   24,   24,
00478         0,    0,    0,    0,    0,    0,    0,    0,   24,    0,
00479 
00480        24,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00481        24,   63,   63,   63,   64,   64,   64,   65,   65,   65,
00482        67,   67,   67,   68,   68,   68,   69,    0,   69,   62,
00483        62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
00484        62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
00485        62,   62,   62,   62,   62,   62,   62,   62
00486     } ;
00487 
00488 /* The intent behind this definition is that it'll catch
00489  * any uses of REJECT which flex missed.
00490  */
00491 #define REJECT reject_used_but_not_detected
00492 #define yymore() (yyg->yy_more_flag = 1)
00493 #define YY_MORE_ADJ yyg->yy_more_len
00494 #define YY_RESTORE_YY_MORE_OFFSET
00495 #line 1 "ast_expr2.fl"
00496 #line 2 "ast_expr2.fl"
00497 /*
00498  * Asterisk -- An open source telephony toolkit.
00499  *
00500  * Copyright (C) 1999 - 2006, Digium, Inc.
00501  *
00502  * Mark Spencer <markster@digium.com>
00503  *
00504  * See http://www.asterisk.org for more information about
00505  * the Asterisk project. Please do not directly contact
00506  * any of the maintainers of this project for assistance;
00507  * the project provides a web site, mailing lists and IRC
00508  * channels for your use.
00509  *
00510  * This program is free software, distributed under the terms of
00511  * the GNU General Public License Version 2. See the LICENSE file
00512  * at the top of the source tree.
00513  */
00514 
00515 /*! \file
00516  *
00517  * \brief Dialplan Expression Lexical Scanner
00518  */
00519 
00520 #include <sys/types.h>
00521 #include <stdio.h>
00522 
00523 #if !defined(STANDALONE)
00524 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 423978 $")
00525 #else
00526 #ifndef __USE_ISOC99
00527 #define __USE_ISOC99 1
00528 #endif
00529 #endif
00530 
00531 #ifdef __USE_ISOC99
00532 #define FP___PRINTF "%.18Lg"
00533 #define FP___FMOD   fmodl
00534 #define FP___STRTOD  strtold
00535 #define FP___TYPE    long double
00536 #else
00537 #define FP___PRINTF "%.16g"
00538 #define FP___FMOD   fmod
00539 #define FP___STRTOD  strtod
00540 #define FP___TYPE    double
00541 #endif
00542 
00543 #include <stdlib.h>
00544 #include <string.h>
00545 #include <locale.h>
00546 #include <ctype.h>
00547 #if !defined(SOLARIS) && !defined(__CYGWIN__)
00548 /* #include <err.h> */
00549 #else
00550 #define quad_t int64_t
00551 #endif
00552 #include <errno.h>
00553 #include <regex.h>
00554 #include <limits.h>
00555 
00556 #include "asterisk/ast_expr.h"
00557 #include "asterisk/logger.h"
00558 #ifndef STANDALONE
00559 #include "asterisk/strings.h"
00560 #include "asterisk/channel.h"
00561 #endif
00562 
00563 /* Conditionally redefine the macro from flex 2.5.35, in case someone uses flex <2.5.35 to regenerate this file. */
00564 #ifndef ECHO
00565 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
00566 #endif
00567 
00568 enum valtype {
00569    AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string
00570 } ;
00571 
00572 struct val {
00573    enum valtype type;
00574    union {
00575       char *s;
00576       FP___TYPE i; /* long double or just double if it's a bad day */
00577    } u;
00578 } ;
00579 
00580 #include "ast_expr2.h" /* the o/p of the bison on ast_expr2.y */
00581 
00582 #define SET_COLUMNS  do {     \
00583    yylloc_param->first_column = (int)(yyg->yytext_r - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); \
00584    yylloc_param->last_column += yyleng - 1; \
00585    yylloc_param->first_line = yylloc_param->last_line = 1; \
00586    } while (0)
00587 
00588 #define SET_STRING   do {     \
00589    yylval_param->val = calloc(1, sizeof(struct val)); \
00590    yylval_param->val->type = AST_EXPR_string;      \
00591    yylval_param->val->u.s = strdup(yytext);     \
00592    } while (0)
00593 
00594 #define SET_NUMERIC_STRING do {  \
00595    yylval_param->val = calloc(1, sizeof(struct val)); \
00596    yylval_param->val->type = AST_EXPR_numeric_string; \
00597    yylval_param->val->u.s = strdup(yytext);  \
00598    } while (0)
00599 
00600 struct parse_io
00601 {
00602    char *string;
00603    struct val *val;
00604    yyscan_t scanner;
00605    struct ast_channel *chan;
00606 };
00607  
00608 void ast_yyset_column(int column_no, yyscan_t yyscanner);
00609 int ast_yyget_column(yyscan_t yyscanner);
00610 static int curlycount = 0;
00611 static char *expr2_token_subst(const char *mess);
00612 
00613 #line 611 "ast_expr2f.c"
00614 
00615 #define INITIAL 0
00616 #define var 1
00617 #define trail 2
00618 
00619 #ifndef YY_NO_UNISTD_H
00620 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00621  * down here because we want the user's section 1 to have been scanned first.
00622  * The user has a chance to override it with an option.
00623  */
00624 #include <unistd.h>
00625 #endif
00626 
00627 #ifndef YY_EXTRA_TYPE
00628 #define YY_EXTRA_TYPE void *
00629 #endif
00630 
00631 /* Holds the entire state of the reentrant scanner. */
00632 struct yyguts_t
00633     {
00634 
00635     /* User-defined. Not touched by flex. */
00636     YY_EXTRA_TYPE yyextra_r;
00637 
00638     /* The rest are the same as the globals declared in the non-reentrant scanner. */
00639     FILE *yyin_r, *yyout_r;
00640     size_t yy_buffer_stack_top; /**< index of top of stack. */
00641     size_t yy_buffer_stack_max; /**< capacity of stack. */
00642     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
00643     char yy_hold_char;
00644     int yy_n_chars;
00645     int yyleng_r;
00646     char *yy_c_buf_p;
00647     int yy_init;
00648     int yy_start;
00649     int yy_did_buffer_switch_on_eof;
00650     int yy_start_stack_ptr;
00651     int yy_start_stack_depth;
00652     int *yy_start_stack;
00653     yy_state_type yy_last_accepting_state;
00654     char* yy_last_accepting_cpos;
00655 
00656     int yylineno_r;
00657     int yy_flex_debug_r;
00658 
00659     char *yytext_r;
00660     int yy_more_flag;
00661     int yy_more_len;
00662 
00663     YYSTYPE * yylval_r;
00664 
00665     YYLTYPE * yylloc_r;
00666 
00667     }; /* end struct yyguts_t */
00668 
00669 static int yy_init_globals (yyscan_t yyscanner );
00670 
00671     /* This must go here because YYSTYPE and YYLTYPE are included
00672      * from bison output in section 1.*/
00673     #    define yylval yyg->yylval_r
00674     
00675     #    define yylloc yyg->yylloc_r
00676     
00677 int ast_yylex_init (yyscan_t* scanner);
00678 
00679 int ast_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
00680 
00681 /* Accessor methods to globals.
00682    These are made visible to non-reentrant scanners for convenience. */
00683 
00684 int ast_yylex_destroy (yyscan_t yyscanner );
00685 
00686 int ast_yyget_debug (yyscan_t yyscanner );
00687 
00688 void ast_yyset_debug (int debug_flag ,yyscan_t yyscanner );
00689 
00690 YY_EXTRA_TYPE ast_yyget_extra (yyscan_t yyscanner );
00691 
00692 void ast_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
00693 
00694 FILE *ast_yyget_in (yyscan_t yyscanner );
00695 
00696 void ast_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
00697 
00698 FILE *ast_yyget_out (yyscan_t yyscanner );
00699 
00700 void ast_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
00701 
00702 int ast_yyget_leng (yyscan_t yyscanner );
00703 
00704 char *ast_yyget_text (yyscan_t yyscanner );
00705 
00706 int ast_yyget_lineno (yyscan_t yyscanner );
00707 
00708 void ast_yyset_lineno (int line_number ,yyscan_t yyscanner );
00709 
00710 YYSTYPE * ast_yyget_lval (yyscan_t yyscanner );
00711 
00712 void ast_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
00713 
00714        YYLTYPE *ast_yyget_lloc (yyscan_t yyscanner );
00715     
00716         void ast_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
00717     
00718 /* Macros after this point can all be overridden by user definitions in
00719  * section 1.
00720  */
00721 
00722 #ifndef YY_SKIP_YYWRAP
00723 #ifdef __cplusplus
00724 extern "C" int ast_yywrap (yyscan_t yyscanner );
00725 #else
00726 extern int ast_yywrap (yyscan_t yyscanner );
00727 #endif
00728 #endif
00729 
00730     static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
00731     
00732 #ifndef yytext_ptr
00733 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
00734 #endif
00735 
00736 #ifdef YY_NEED_STRLEN
00737 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
00738 #endif
00739 
00740 #ifndef YY_NO_INPUT
00741 
00742 #ifdef __cplusplus
00743 static int yyinput (yyscan_t yyscanner );
00744 #else
00745 static int input (yyscan_t yyscanner );
00746 #endif
00747 
00748 #endif
00749 
00750 /* Amount of stuff to slurp up with each read. */
00751 #ifndef YY_READ_BUF_SIZE
00752 #ifdef __ia64__
00753 /* On IA-64, the buffer size is 16k, not 8k */
00754 #define YY_READ_BUF_SIZE 16384
00755 #else
00756 #define YY_READ_BUF_SIZE 8192
00757 #endif /* __ia64__ */
00758 #endif
00759 
00760 /* Copy whatever the last rule matched to the standard output. */
00761 #ifndef ECHO
00762 /* This used to be an fputs(), but since the string might contain NUL's,
00763  * we now use fwrite().
00764  */
00765 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
00766 #endif
00767 
00768 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00769  * is returned in "result".
00770  */
00771 #ifndef YY_INPUT
00772 #define YY_INPUT(buf,result,max_size) \
00773    if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00774       { \
00775       int c = '*'; \
00776       size_t n; \
00777       for ( n = 0; n < max_size && \
00778               (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00779          buf[n] = (char) c; \
00780       if ( c == '\n' ) \
00781          buf[n++] = (char) c; \
00782       if ( c == EOF && ferror( yyin ) ) \
00783          YY_FATAL_ERROR( "input in flex scanner failed" ); \
00784       result = n; \
00785       } \
00786    else \
00787       { \
00788       errno=0; \
00789       while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
00790          { \
00791          if( errno != EINTR) \
00792             { \
00793             YY_FATAL_ERROR( "input in flex scanner failed" ); \
00794             break; \
00795             } \
00796          errno=0; \
00797          clearerr(yyin); \
00798          } \
00799       }\
00800 \
00801 
00802 #endif
00803 
00804 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00805  * we don't want an extra ';' after the "return" because that will cause
00806  * some compilers to complain about unreachable statements.
00807  */
00808 #ifndef yyterminate
00809 #define yyterminate() return YY_NULL
00810 #endif
00811 
00812 /* Number of entries by which start-condition stack grows. */
00813 #ifndef YY_START_STACK_INCR
00814 #define YY_START_STACK_INCR 25
00815 #endif
00816 
00817 /* Report a fatal error. */
00818 #ifndef YY_FATAL_ERROR
00819 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
00820 #endif
00821 
00822 /* end tables serialization structures and prototypes */
00823 
00824 /* Default declaration of generated scanner - a define so the user can
00825  * easily add parameters.
00826  */
00827 #ifndef YY_DECL
00828 #define YY_DECL_IS_OURS 1
00829 
00830 extern int ast_yylex \
00831                (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
00832 
00833 #define YY_DECL int ast_yylex \
00834                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
00835 #endif /* !YY_DECL */
00836 
00837 /* Code executed at the beginning of each rule, after yytext and yyleng
00838  * have been set up.
00839  */
00840 #ifndef YY_USER_ACTION
00841 #define YY_USER_ACTION
00842 #endif
00843 
00844 /* Code executed at the end of each rule. */
00845 #ifndef YY_BREAK
00846 #define YY_BREAK break;
00847 #endif
00848 
00849 #define YY_RULE_SETUP \
00850    YY_USER_ACTION
00851 
00852 /** The main scanner function which does all the work.
00853  */
00854 YY_DECL
00855 {
00856    register yy_state_type yy_current_state;
00857    register char *yy_cp, *yy_bp;
00858    register int yy_act;
00859     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
00860 
00861 #line 130 "ast_expr2.fl"
00862 
00863 
00864 #line 862 "ast_expr2f.c"
00865 
00866     yylval = yylval_param;
00867 
00868     yylloc = yylloc_param;
00869 
00870    if ( !yyg->yy_init )
00871       {
00872       yyg->yy_init = 1;
00873 
00874 #ifdef YY_USER_INIT
00875       YY_USER_INIT;
00876 #endif
00877 
00878       if ( ! yyg->yy_start )
00879          yyg->yy_start = 1;   /* first start state */
00880 
00881       if ( ! yyin )
00882          yyin = stdin;
00883 
00884       if ( ! yyout )
00885          yyout = stdout;
00886 
00887       if ( ! YY_CURRENT_BUFFER ) {
00888          ast_yyensure_buffer_stack (yyscanner);
00889          YY_CURRENT_BUFFER_LVALUE =
00890             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
00891       }
00892 
00893       ast_yy_load_buffer_state(yyscanner );
00894       }
00895 
00896    while ( 1 )    /* loops until end-of-file is reached */
00897       {
00898       yyg->yy_more_len = 0;
00899       if ( yyg->yy_more_flag )
00900          {
00901          yyg->yy_more_len = yyg->yy_c_buf_p - yyg->yytext_ptr;
00902          yyg->yy_more_flag = 0;
00903          }
00904       yy_cp = yyg->yy_c_buf_p;
00905 
00906       /* Support of yytext. */
00907       *yy_cp = yyg->yy_hold_char;
00908 
00909       /* yy_bp points to the position in yy_ch_buf of the start of
00910        * the current run.
00911        */
00912       yy_bp = yy_cp;
00913 
00914       yy_current_state = yyg->yy_start;
00915 yy_match:
00916       do
00917          {
00918          register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00919          if ( yy_accept[yy_current_state] )
00920             {
00921             yyg->yy_last_accepting_state = yy_current_state;
00922             yyg->yy_last_accepting_cpos = yy_cp;
00923             }
00924          while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00925             {
00926             yy_current_state = (int) yy_def[yy_current_state];
00927             if ( yy_current_state >= 63 )
00928                yy_c = yy_meta[(unsigned int) yy_c];
00929             }
00930          yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00931          ++yy_cp;
00932          }
00933       while ( yy_current_state != 62 );
00934       yy_cp = yyg->yy_last_accepting_cpos;
00935       yy_current_state = yyg->yy_last_accepting_state;
00936 
00937 yy_find_action:
00938       yy_act = yy_accept[yy_current_state];
00939 
00940       YY_DO_BEFORE_ACTION;
00941 
00942 do_action:  /* This label is used only to access EOF actions. */
00943 
00944       switch ( yy_act )
00945    { /* beginning of action switch */
00946          case 0: /* must back up */
00947          /* undo the effects of YY_DO_BEFORE_ACTION */
00948          *yy_cp = yyg->yy_hold_char;
00949          yy_cp = yyg->yy_last_accepting_cpos;
00950          yy_current_state = yyg->yy_last_accepting_state;
00951          goto yy_find_action;
00952 
00953 case 1:
00954 YY_RULE_SETUP
00955 #line 132 "ast_expr2.fl"
00956 { SET_COLUMNS; SET_STRING; return TOK_OR;}
00957    YY_BREAK
00958 case 2:
00959 YY_RULE_SETUP
00960 #line 133 "ast_expr2.fl"
00961 { SET_COLUMNS; SET_STRING; return TOK_AND;}
00962    YY_BREAK
00963 case 3:
00964 YY_RULE_SETUP
00965 #line 134 "ast_expr2.fl"
00966 { SET_COLUMNS; SET_STRING; return TOK_EQ;}
00967    YY_BREAK
00968 case 4:
00969 YY_RULE_SETUP
00970 #line 135 "ast_expr2.fl"
00971 { SET_COLUMNS; SET_STRING; return TOK_OR;}
00972    YY_BREAK
00973 case 5:
00974 YY_RULE_SETUP
00975 #line 136 "ast_expr2.fl"
00976 { SET_COLUMNS; SET_STRING; return TOK_AND;}
00977    YY_BREAK
00978 case 6:
00979 YY_RULE_SETUP
00980 #line 137 "ast_expr2.fl"
00981 { SET_COLUMNS; SET_STRING; return TOK_EQ;}
00982    YY_BREAK
00983 case 7:
00984 YY_RULE_SETUP
00985 #line 138 "ast_expr2.fl"
00986 { SET_COLUMNS; SET_STRING; return TOK_EQTILDE;}
00987    YY_BREAK
00988 case 8:
00989 YY_RULE_SETUP
00990 #line 139 "ast_expr2.fl"
00991 { SET_COLUMNS; SET_STRING; return TOK_TILDETILDE;}
00992    YY_BREAK
00993 case 9:
00994 YY_RULE_SETUP
00995 #line 140 "ast_expr2.fl"
00996 { SET_COLUMNS; SET_STRING; return TOK_GT;}
00997    YY_BREAK
00998 case 10:
00999 YY_RULE_SETUP
01000 #line 141 "ast_expr2.fl"
01001 { SET_COLUMNS; SET_STRING; return TOK_LT;}
01002    YY_BREAK
01003 case 11:
01004 YY_RULE_SETUP
01005 #line 142 "ast_expr2.fl"
01006 { SET_COLUMNS; SET_STRING; return TOK_GE;}
01007    YY_BREAK
01008 case 12:
01009 YY_RULE_SETUP
01010 #line 143 "ast_expr2.fl"
01011 { SET_COLUMNS; SET_STRING; return TOK_LE;}
01012    YY_BREAK
01013 case 13:
01014 YY_RULE_SETUP
01015 #line 144 "ast_expr2.fl"
01016 { SET_COLUMNS; SET_STRING; return TOK_NE;}
01017    YY_BREAK
01018 case 14:
01019 YY_RULE_SETUP
01020 #line 145 "ast_expr2.fl"
01021 { SET_COLUMNS; SET_STRING; return TOK_PLUS;}
01022    YY_BREAK
01023 case 15:
01024 YY_RULE_SETUP
01025 #line 146 "ast_expr2.fl"
01026 { SET_COLUMNS; SET_STRING; return TOK_COMMA;}
01027    YY_BREAK
01028 case 16:
01029 YY_RULE_SETUP
01030 #line 147 "ast_expr2.fl"
01031 { SET_COLUMNS; SET_STRING; return TOK_MINUS;}
01032    YY_BREAK
01033 case 17:
01034 YY_RULE_SETUP
01035 #line 148 "ast_expr2.fl"
01036 { SET_COLUMNS; SET_STRING; return TOK_MULT;}
01037    YY_BREAK
01038 case 18:
01039 YY_RULE_SETUP
01040 #line 149 "ast_expr2.fl"
01041 { SET_COLUMNS; SET_STRING; return TOK_DIV;}
01042    YY_BREAK
01043 case 19:
01044 YY_RULE_SETUP
01045 #line 150 "ast_expr2.fl"
01046 { SET_COLUMNS; SET_STRING; return TOK_MOD;}
01047    YY_BREAK
01048 case 20:
01049 YY_RULE_SETUP
01050 #line 151 "ast_expr2.fl"
01051 { SET_COLUMNS; SET_STRING; return TOK_COND;}
01052    YY_BREAK
01053 case 21:
01054 YY_RULE_SETUP
01055 #line 152 "ast_expr2.fl"
01056 { SET_COLUMNS; SET_STRING; return TOK_COMPL;}
01057    YY_BREAK
01058 case 22:
01059 YY_RULE_SETUP
01060 #line 153 "ast_expr2.fl"
01061 { SET_COLUMNS; SET_STRING; return TOK_COLON;}
01062    YY_BREAK
01063 case 23:
01064 YY_RULE_SETUP
01065 #line 154 "ast_expr2.fl"
01066 { SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
01067    YY_BREAK
01068 case 24:
01069 YY_RULE_SETUP
01070 #line 155 "ast_expr2.fl"
01071 { SET_COLUMNS; SET_STRING; return TOK_LP;}
01072    YY_BREAK
01073 case 25:
01074 YY_RULE_SETUP
01075 #line 156 "ast_expr2.fl"
01076 { SET_COLUMNS; SET_STRING; return TOK_RP;}
01077    YY_BREAK
01078 case 26:
01079 YY_RULE_SETUP
01080 #line 157 "ast_expr2.fl"
01081 {
01082       /* gather the contents of ${} expressions, with trailing stuff,
01083        * into a single TOKEN.
01084        * They are much more complex now than they used to be
01085        */
01086       curlycount = 0;
01087       BEGIN(var);
01088       yymore();
01089    }
01090    YY_BREAK
01091 case 27:
01092 YY_RULE_SETUP
01093 #line 167 "ast_expr2.fl"
01094 {}
01095    YY_BREAK
01096 case 28:
01097 /* rule 28 can match eol */
01098 YY_RULE_SETUP
01099 #line 168 "ast_expr2.fl"
01100 {SET_COLUMNS; SET_STRING; return TOKEN;}
01101    YY_BREAK
01102 case 29:
01103 /* rule 29 can match eol */
01104 YY_RULE_SETUP
01105 #line 170 "ast_expr2.fl"
01106 {/* what to do with eol */}
01107    YY_BREAK
01108 case 30:
01109 YY_RULE_SETUP
01110 #line 171 "ast_expr2.fl"
01111 {
01112       SET_COLUMNS;
01113       /* the original behavior of the expression parser was
01114        * to bring in numbers as a numeric string
01115        */
01116       SET_NUMERIC_STRING;
01117       return TOKEN;
01118    }
01119    YY_BREAK
01120 case 31:
01121 /* rule 31 can match eol */
01122 YY_RULE_SETUP
01123 #line 180 "ast_expr2.fl"
01124 {
01125       SET_COLUMNS;
01126       SET_STRING;
01127       return TOKEN;
01128    }
01129    YY_BREAK
01130 case 32:
01131 /* rule 32 can match eol */
01132 YY_RULE_SETUP
01133 #line 186 "ast_expr2.fl"
01134 {
01135       curlycount = 0;
01136       BEGIN(var);
01137       yymore();
01138    }
01139    YY_BREAK
01140 case 33:
01141 /* rule 33 can match eol */
01142 YY_RULE_SETUP
01143 #line 192 "ast_expr2.fl"
01144 {
01145       curlycount--;
01146       if (curlycount < 0) {
01147          BEGIN(trail);
01148          yymore();
01149       } else {
01150          yymore();
01151       }
01152    }
01153    YY_BREAK
01154 case 34:
01155 /* rule 34 can match eol */
01156 YY_RULE_SETUP
01157 #line 202 "ast_expr2.fl"
01158 {
01159       curlycount++;
01160       yymore();
01161    }
01162    YY_BREAK
01163 case 35:
01164 YY_RULE_SETUP
01165 #line 208 "ast_expr2.fl"
01166 {
01167       BEGIN(0);
01168       SET_COLUMNS;
01169       SET_STRING;
01170       return TOKEN;
01171    }
01172    YY_BREAK
01173 case 36:
01174 YY_RULE_SETUP
01175 #line 215 "ast_expr2.fl"
01176 {
01177       curlycount = 0;
01178       BEGIN(var);
01179       yymore();
01180    }
01181    YY_BREAK
01182 case 37:
01183 /* rule 37 can match eol */
01184 YY_RULE_SETUP
01185 #line 221 "ast_expr2.fl"
01186 {
01187       char c = yytext[yyleng-1];
01188       BEGIN(0);
01189       unput(c);
01190       SET_COLUMNS;
01191       SET_STRING;
01192       return TOKEN;
01193    }
01194    YY_BREAK
01195 case YY_STATE_EOF(trail):
01196 #line 230 "ast_expr2.fl"
01197 {
01198       BEGIN(0);
01199       SET_COLUMNS;
01200       SET_STRING;
01201       return TOKEN;
01202       /*actually, if an expr is only a variable ref, this could happen a LOT */
01203    }
01204    YY_BREAK
01205 case 38:
01206 YY_RULE_SETUP
01207 #line 238 "ast_expr2.fl"
01208 ECHO;
01209    YY_BREAK
01210 #line 1208 "ast_expr2f.c"
01211 case YY_STATE_EOF(INITIAL):
01212 case YY_STATE_EOF(var):
01213    yyterminate();
01214 
01215    case YY_END_OF_BUFFER:
01216       {
01217       /* Amount of text matched not including the EOB char. */
01218       int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
01219 
01220       /* Undo the effects of YY_DO_BEFORE_ACTION. */
01221       *yy_cp = yyg->yy_hold_char;
01222       YY_RESTORE_YY_MORE_OFFSET
01223 
01224       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
01225          {
01226          /* We're scanning a new file or input source.  It's
01227           * possible that this happened because the user
01228           * just pointed yyin at a new source and called
01229           * ast_yylex().  If so, then we have to assure
01230           * consistency between YY_CURRENT_BUFFER and our
01231           * globals.  Here is the right place to do so, because
01232           * this is the first action (other than possibly a
01233           * back-up) that will match for the new input source.
01234           */
01235          yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01236          YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
01237          YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
01238          }
01239 
01240       /* Note that here we test for yy_c_buf_p "<=" to the position
01241        * of the first EOB in the buffer, since yy_c_buf_p will
01242        * already have been incremented past the NUL character
01243        * (since all states make transitions on EOB to the
01244        * end-of-buffer state).  Contrast this with the test
01245        * in input().
01246        */
01247       if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01248          { /* This was really a NUL. */
01249          yy_state_type yy_next_state;
01250 
01251          yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
01252 
01253          yy_current_state = yy_get_previous_state( yyscanner );
01254 
01255          /* Okay, we're now positioned to make the NUL
01256           * transition.  We couldn't have
01257           * yy_get_previous_state() go ahead and do it
01258           * for us because it doesn't know how to deal
01259           * with the possibility of jamming (and we don't
01260           * want to build jamming into it because then it
01261           * will run more slowly).
01262           */
01263 
01264          yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
01265 
01266          yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01267 
01268          if ( yy_next_state )
01269             {
01270             /* Consume the NUL. */
01271             yy_cp = ++yyg->yy_c_buf_p;
01272             yy_current_state = yy_next_state;
01273             goto yy_match;
01274             }
01275 
01276          else
01277             {
01278             yy_cp = yyg->yy_last_accepting_cpos;
01279             yy_current_state = yyg->yy_last_accepting_state;
01280             goto yy_find_action;
01281             }
01282          }
01283 
01284       else switch ( yy_get_next_buffer( yyscanner ) )
01285          {
01286          case EOB_ACT_END_OF_FILE:
01287             {
01288             yyg->yy_did_buffer_switch_on_eof = 0;
01289 
01290             if ( ast_yywrap(yyscanner ) )
01291                {
01292                /* Note: because we've taken care in
01293                 * yy_get_next_buffer() to have set up
01294                 * yytext, we can now set up
01295                 * yy_c_buf_p so that if some total
01296                 * hoser (like flex itself) wants to
01297                 * call the scanner after we return the
01298                 * YY_NULL, it'll still work - another
01299                 * YY_NULL will get returned.
01300                 */
01301                yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
01302 
01303                yy_act = YY_STATE_EOF(YY_START);
01304                goto do_action;
01305                }
01306 
01307             else
01308                {
01309                if ( ! yyg->yy_did_buffer_switch_on_eof )
01310                   YY_NEW_FILE;
01311                }
01312             break;
01313             }
01314 
01315          case EOB_ACT_CONTINUE_SCAN:
01316             yyg->yy_c_buf_p =
01317                yyg->yytext_ptr + yy_amount_of_matched_text;
01318 
01319             yy_current_state = yy_get_previous_state( yyscanner );
01320 
01321             yy_cp = yyg->yy_c_buf_p;
01322             yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01323             goto yy_match;
01324 
01325          case EOB_ACT_LAST_MATCH:
01326             yyg->yy_c_buf_p =
01327             &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
01328 
01329             yy_current_state = yy_get_previous_state( yyscanner );
01330 
01331             yy_cp = yyg->yy_c_buf_p;
01332             yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01333             goto yy_find_action;
01334          }
01335       break;
01336       }
01337 
01338    default:
01339       YY_FATAL_ERROR(
01340          "fatal flex scanner internal error--no action found" );
01341    } /* end of action switch */
01342       } /* end of scanning one token */
01343 } /* end of ast_yylex */
01344 
01345 /* yy_get_next_buffer - try to read in a new buffer
01346  *
01347  * Returns a code representing an action:
01348  * EOB_ACT_LAST_MATCH -
01349  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01350  * EOB_ACT_END_OF_FILE - end of file
01351  */
01352 static int yy_get_next_buffer (yyscan_t yyscanner)
01353 {
01354     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01355    register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
01356    register char *source = yyg->yytext_ptr;
01357    register int number_to_move, i;
01358    int ret_val;
01359 
01360    if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
01361       YY_FATAL_ERROR(
01362       "fatal flex scanner internal error--end of buffer missed" );
01363 
01364    if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
01365       { /* Don't try to fill the buffer, so this is an EOF. */
01366       if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
01367          {
01368          /* We matched a single character, the EOB, so
01369           * treat this as a final EOF.
01370           */
01371          return EOB_ACT_END_OF_FILE;
01372          }
01373 
01374       else
01375          {
01376          /* We matched some text prior to the EOB, first
01377           * process it.
01378           */
01379          return EOB_ACT_LAST_MATCH;
01380          }
01381       }
01382 
01383    /* Try to read more data. */
01384 
01385    /* First move last chars to start of buffer. */
01386    number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
01387 
01388    for ( i = 0; i < number_to_move; ++i )
01389       *(dest++) = *(source++);
01390 
01391    if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01392       /* don't do the read, it's not guaranteed to return an EOF,
01393        * just force an EOF
01394        */
01395       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
01396 
01397    else
01398       {
01399          int num_to_read =
01400          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01401 
01402       while ( num_to_read <= 0 )
01403          { /* Not enough room in the buffer - grow it. */
01404 
01405          /* just a shorter name for the current buffer */
01406          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01407 
01408          int yy_c_buf_p_offset =
01409             (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
01410 
01411          if ( b->yy_is_our_buffer )
01412             {
01413             int new_size = b->yy_buf_size * 2;
01414 
01415             if ( new_size <= 0 )
01416                b->yy_buf_size += b->yy_buf_size / 8;
01417             else
01418                b->yy_buf_size *= 2;
01419 
01420             b->yy_ch_buf = (char *)
01421                /* Include room in for 2 EOB chars. */
01422                ast_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
01423             }
01424          else
01425             /* Can't grow it, we don't own it. */
01426             b->yy_ch_buf = 0;
01427 
01428          if ( ! b->yy_ch_buf )
01429             YY_FATAL_ERROR(
01430             "fatal error - scanner input buffer overflow" );
01431 
01432          yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
01433 
01434          num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01435                   number_to_move - 1;
01436 
01437          }
01438 
01439       if ( num_to_read > YY_READ_BUF_SIZE )
01440          num_to_read = YY_READ_BUF_SIZE;
01441 
01442       /* Read in more data. */
01443       YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01444          yyg->yy_n_chars, (size_t) num_to_read );
01445 
01446       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01447       }
01448 
01449    if ( yyg->yy_n_chars == 0 )
01450       {
01451       if ( number_to_move == YY_MORE_ADJ )
01452          {
01453          ret_val = EOB_ACT_END_OF_FILE;
01454          ast_yyrestart(yyin  ,yyscanner);
01455          }
01456 
01457       else
01458          {
01459          ret_val = EOB_ACT_LAST_MATCH;
01460          YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01461             YY_BUFFER_EOF_PENDING;
01462          }
01463       }
01464 
01465    else
01466       ret_val = EOB_ACT_CONTINUE_SCAN;
01467 
01468    if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
01469       /* Extend the array by 50%, plus the number we really need. */
01470       yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
01471       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ast_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
01472       if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01473          YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
01474    }
01475 
01476    yyg->yy_n_chars += number_to_move;
01477    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
01478    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
01479 
01480    yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01481 
01482    return ret_val;
01483 }
01484 
01485 /* yy_get_previous_state - get the state just before the EOB char was reached */
01486 
01487     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
01488 {
01489    register yy_state_type yy_current_state;
01490    register char *yy_cp;
01491     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01492 
01493    yy_current_state = yyg->yy_start;
01494 
01495    for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
01496       {
01497       register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01498       if ( yy_accept[yy_current_state] )
01499          {
01500          yyg->yy_last_accepting_state = yy_current_state;
01501          yyg->yy_last_accepting_cpos = yy_cp;
01502          }
01503       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01504          {
01505          yy_current_state = (int) yy_def[yy_current_state];
01506          if ( yy_current_state >= 63 )
01507             yy_c = yy_meta[(unsigned int) yy_c];
01508          }
01509       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01510       }
01511 
01512    return yy_current_state;
01513 }
01514 
01515 /* yy_try_NUL_trans - try to make a transition on the NUL character
01516  *
01517  * synopsis
01518  * next_state = yy_try_NUL_trans( current_state );
01519  */
01520     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
01521 {
01522    register int yy_is_jam;
01523     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
01524    register char *yy_cp = yyg->yy_c_buf_p;
01525 
01526    register YY_CHAR yy_c = 1;
01527    if ( yy_accept[yy_current_state] )
01528       {
01529       yyg->yy_last_accepting_state = yy_current_state;
01530       yyg->yy_last_accepting_cpos = yy_cp;
01531       }
01532    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01533       {
01534       yy_current_state = (int) yy_def[yy_current_state];
01535       if ( yy_current_state >= 63 )
01536          yy_c = yy_meta[(unsigned int) yy_c];
01537       }
01538    yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01539    yy_is_jam = (yy_current_state == 62);
01540 
01541    return yy_is_jam ? 0 : yy_current_state;
01542 }
01543 
01544     static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
01545 {
01546    register char *yy_cp;
01547     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01548 
01549     yy_cp = yyg->yy_c_buf_p;
01550 
01551    /* undo effects of setting up yytext */
01552    *yy_cp = yyg->yy_hold_char;
01553 
01554    if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01555       { /* need to shift things up to make room */
01556       /* +2 for EOB chars. */
01557       register int number_to_move = yyg->yy_n_chars + 2;
01558       register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
01559                YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
01560       register char *source =
01561             &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
01562 
01563       while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01564          *--dest = *--source;
01565 
01566       yy_cp += (int) (dest - source);
01567       yy_bp += (int) (dest - source);
01568       YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
01569          yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
01570 
01571       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01572          YY_FATAL_ERROR( "flex scanner push-back overflow" );
01573       }
01574 
01575    *--yy_cp = (char) c;
01576 
01577    yyg->yytext_ptr = yy_bp;
01578    yyg->yy_hold_char = *yy_cp;
01579    yyg->yy_c_buf_p = yy_cp;
01580 }
01581 
01582 #ifndef YY_NO_INPUT
01583 #ifdef __cplusplus
01584     static int yyinput (yyscan_t yyscanner)
01585 #else
01586     static int input  (yyscan_t yyscanner)
01587 #endif
01588 
01589 {
01590    int c;
01591     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01592 
01593    *yyg->yy_c_buf_p = yyg->yy_hold_char;
01594 
01595    if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
01596       {
01597       /* yy_c_buf_p now points to the character we want to return.
01598        * If this occurs *before* the EOB characters, then it's a
01599        * valid NUL; if not, then we've hit the end of the buffer.
01600        */
01601       if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01602          /* This was really a NUL. */
01603          *yyg->yy_c_buf_p = '\0';
01604 
01605       else
01606          { /* need more input */
01607          int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
01608          ++yyg->yy_c_buf_p;
01609 
01610          switch ( yy_get_next_buffer( yyscanner ) )
01611             {
01612             case EOB_ACT_LAST_MATCH:
01613                /* This happens because yy_g_n_b()
01614                 * sees that we've accumulated a
01615                 * token and flags that we need to
01616                 * try matching the token before
01617                 * proceeding.  But for input(),
01618                 * there's no matching to consider.
01619                 * So convert the EOB_ACT_LAST_MATCH
01620                 * to EOB_ACT_END_OF_FILE.
01621                 */
01622 
01623                /* Reset buffer status. */
01624                ast_yyrestart(yyin ,yyscanner);
01625 
01626                /*FALLTHROUGH*/
01627 
01628             case EOB_ACT_END_OF_FILE:
01629                {
01630                if ( ast_yywrap(yyscanner ) )
01631                   return EOF;
01632 
01633                if ( ! yyg->yy_did_buffer_switch_on_eof )
01634                   YY_NEW_FILE;
01635 #ifdef __cplusplus
01636                return yyinput(yyscanner);
01637 #else
01638                return input(yyscanner);
01639 #endif
01640                }
01641 
01642             case EOB_ACT_CONTINUE_SCAN:
01643                yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
01644                break;
01645             }
01646          }
01647       }
01648 
01649    c = *(unsigned char *) yyg->yy_c_buf_p;   /* cast for 8-bit char's */
01650    *yyg->yy_c_buf_p = '\0';   /* preserve yytext */
01651    yyg->yy_hold_char = *++yyg->yy_c_buf_p;
01652 
01653    return c;
01654 }
01655 #endif   /* ifndef YY_NO_INPUT */
01656 
01657 /** Immediately switch to a different input stream.
01658  * @param input_file A readable stream.
01659  * @param yyscanner The scanner object.
01660  * @note This function does not reset the start condition to @c INITIAL .
01661  */
01662     void ast_yyrestart  (FILE * input_file , yyscan_t yyscanner)
01663 {
01664     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01665 
01666    if ( ! YY_CURRENT_BUFFER ){
01667         ast_yyensure_buffer_stack (yyscanner);
01668       YY_CURRENT_BUFFER_LVALUE =
01669             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
01670    }
01671 
01672    ast_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
01673    ast_yy_load_buffer_state(yyscanner );
01674 }
01675 
01676 /** Switch to a different input buffer.
01677  * @param new_buffer The new input buffer.
01678  * @param yyscanner The scanner object.
01679  */
01680     void ast_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
01681 {
01682     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01683 
01684    /* TODO. We should be able to replace this entire function body
01685     * with
01686     *    ast_yypop_buffer_state();
01687     *    ast_yypush_buffer_state(new_buffer);
01688      */
01689    ast_yyensure_buffer_stack (yyscanner);
01690    if ( YY_CURRENT_BUFFER == new_buffer )
01691       return;
01692 
01693    if ( YY_CURRENT_BUFFER )
01694       {
01695       /* Flush out information for old buffer. */
01696       *yyg->yy_c_buf_p = yyg->yy_hold_char;
01697       YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01698       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01699       }
01700 
01701    YY_CURRENT_BUFFER_LVALUE = new_buffer;
01702    ast_yy_load_buffer_state(yyscanner );
01703 
01704    /* We don't actually know whether we did this switch during
01705     * EOF (ast_yywrap()) processing, but the only time this flag
01706     * is looked at is after ast_yywrap() is called, so it's safe
01707     * to go ahead and always set it.
01708     */
01709    yyg->yy_did_buffer_switch_on_eof = 1;
01710 }
01711 
01712 static void ast_yy_load_buffer_state  (yyscan_t yyscanner)
01713 {
01714     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01715    yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01716    yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01717    yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01718    yyg->yy_hold_char = *yyg->yy_c_buf_p;
01719 }
01720 
01721 /** Allocate and initialize an input buffer state.
01722  * @param file A readable stream.
01723  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
01724  * @param yyscanner The scanner object.
01725  * @return the allocated buffer state.
01726  */
01727     YY_BUFFER_STATE ast_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
01728 {
01729    YY_BUFFER_STATE b;
01730     
01731    b = (YY_BUFFER_STATE) ast_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01732    if ( ! b )
01733       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_create_buffer()" );
01734 
01735    b->yy_buf_size = size;
01736 
01737    /* yy_ch_buf has to be 2 characters longer than the size given because
01738     * we need to put in 2 end-of-buffer characters.
01739     */
01740    b->yy_ch_buf = (char *) ast_yyalloc(b->yy_buf_size + 2 ,yyscanner );
01741    if ( ! b->yy_ch_buf )
01742       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_create_buffer()" );
01743 
01744    b->yy_is_our_buffer = 1;
01745 
01746    ast_yy_init_buffer(b,file ,yyscanner);
01747 
01748    return b;
01749 }
01750 
01751 /** Destroy the buffer.
01752  * @param b a buffer created with ast_yy_create_buffer()
01753  * @param yyscanner The scanner object.
01754  */
01755     void ast_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01756 {
01757     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01758 
01759    if ( ! b )
01760       return;
01761 
01762    if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01763       YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01764 
01765    if ( b->yy_is_our_buffer )
01766       ast_yyfree((void *) b->yy_ch_buf ,yyscanner );
01767 
01768    ast_yyfree((void *) b ,yyscanner );
01769 }
01770 
01771 #ifndef __cplusplus
01772 extern int isatty (int );
01773 #endif /* __cplusplus */
01774     
01775 /* Initializes or reinitializes a buffer.
01776  * This function is sometimes called more than once on the same buffer,
01777  * such as during a ast_yyrestart() or at EOF.
01778  */
01779     static void ast_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
01780 
01781 {
01782    int oerrno = errno;
01783     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01784 
01785    ast_yy_flush_buffer(b ,yyscanner);
01786 
01787    b->yy_input_file = file;
01788    b->yy_fill_buffer = 1;
01789 
01790     /* If b is the current buffer, then ast_yy_init_buffer was _probably_
01791      * called from ast_yyrestart() or through yy_get_next_buffer.
01792      * In that case, we don't want to reset the lineno or column.
01793      */
01794     if (b != YY_CURRENT_BUFFER){
01795         b->yy_bs_lineno = 1;
01796         b->yy_bs_column = 0;
01797     }
01798 
01799         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01800     
01801    errno = oerrno;
01802 }
01803 
01804 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
01805  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
01806  * @param yyscanner The scanner object.
01807  */
01808     void ast_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01809 {
01810     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01811    if ( ! b )
01812       return;
01813 
01814    b->yy_n_chars = 0;
01815 
01816    /* We always need two end-of-buffer characters.  The first causes
01817     * a transition to the end-of-buffer state.  The second causes
01818     * a jam in that state.
01819     */
01820    b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01821    b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01822 
01823    b->yy_buf_pos = &b->yy_ch_buf[0];
01824 
01825    b->yy_at_bol = 1;
01826    b->yy_buffer_status = YY_BUFFER_NEW;
01827 
01828    if ( b == YY_CURRENT_BUFFER )
01829       ast_yy_load_buffer_state(yyscanner );
01830 }
01831 
01832 /** Pushes the new state onto the stack. The new state becomes
01833  *  the current state. This function will allocate the stack
01834  *  if necessary.
01835  *  @param new_buffer The new state.
01836  *  @param yyscanner The scanner object.
01837  */
01838 void ast_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
01839 {
01840     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01841    if (new_buffer == NULL)
01842       return;
01843 
01844    ast_yyensure_buffer_stack(yyscanner);
01845 
01846    /* This block is copied from ast_yy_switch_to_buffer. */
01847    if ( YY_CURRENT_BUFFER )
01848       {
01849       /* Flush out information for old buffer. */
01850       *yyg->yy_c_buf_p = yyg->yy_hold_char;
01851       YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01852       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01853       }
01854 
01855    /* Only push if top exists. Otherwise, replace top. */
01856    if (YY_CURRENT_BUFFER)
01857       yyg->yy_buffer_stack_top++;
01858    YY_CURRENT_BUFFER_LVALUE = new_buffer;
01859 
01860    /* copied from ast_yy_switch_to_buffer. */
01861    ast_yy_load_buffer_state(yyscanner );
01862    yyg->yy_did_buffer_switch_on_eof = 1;
01863 }
01864 
01865 /** Removes and deletes the top of the stack, if present.
01866  *  The next element becomes the new top.
01867  *  @param yyscanner The scanner object.
01868  */
01869 void ast_yypop_buffer_state (yyscan_t yyscanner)
01870 {
01871     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01872    if (!YY_CURRENT_BUFFER)
01873       return;
01874 
01875    ast_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
01876    YY_CURRENT_BUFFER_LVALUE = NULL;
01877    if (yyg->yy_buffer_stack_top > 0)
01878       --yyg->yy_buffer_stack_top;
01879 
01880    if (YY_CURRENT_BUFFER) {
01881       ast_yy_load_buffer_state(yyscanner );
01882       yyg->yy_did_buffer_switch_on_eof = 1;
01883    }
01884 }
01885 
01886 /* Allocates the stack if it does not exist.
01887  *  Guarantees space for at least one push.
01888  */
01889 static void ast_yyensure_buffer_stack (yyscan_t yyscanner)
01890 {
01891    int num_to_alloc;
01892     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01893 
01894    if (!yyg->yy_buffer_stack) {
01895 
01896       /* First allocation is just for 2 elements, since we don't know if this
01897        * scanner will even need a stack. We use 2 instead of 1 to avoid an
01898        * immediate realloc on the next call.
01899          */
01900       num_to_alloc = 1;
01901       yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyalloc
01902                         (num_to_alloc * sizeof(struct yy_buffer_state*)
01903                         , yyscanner);
01904       if ( ! yyg->yy_buffer_stack )
01905          YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
01906                           
01907       memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01908             
01909       yyg->yy_buffer_stack_max = num_to_alloc;
01910       yyg->yy_buffer_stack_top = 0;
01911       return;
01912    }
01913 
01914    if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
01915 
01916       /* Increase the buffer to prepare for a possible push. */
01917       int grow_size = 8 /* arbitrary grow size */;
01918 
01919       num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
01920       yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyrealloc
01921                         (yyg->yy_buffer_stack,
01922                         num_to_alloc * sizeof(struct yy_buffer_state*)
01923                         , yyscanner);
01924       if ( ! yyg->yy_buffer_stack )
01925          YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
01926 
01927       /* zero only the new slots.*/
01928       memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
01929       yyg->yy_buffer_stack_max = num_to_alloc;
01930    }
01931 }
01932 
01933 /** Setup the input buffer state to scan directly from a user-specified character buffer.
01934  * @param base the character buffer
01935  * @param size the size in bytes of the character buffer
01936  * @param yyscanner The scanner object.
01937  * @return the newly allocated buffer state object. 
01938  */
01939 YY_BUFFER_STATE ast_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
01940 {
01941    YY_BUFFER_STATE b;
01942     
01943    if ( size < 2 ||
01944         base[size-2] != YY_END_OF_BUFFER_CHAR ||
01945         base[size-1] != YY_END_OF_BUFFER_CHAR )
01946       /* They forgot to leave room for the EOB's. */
01947       return 0;
01948 
01949    b = (YY_BUFFER_STATE) ast_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01950    if ( ! b )
01951       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_scan_buffer()" );
01952 
01953    b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
01954    b->yy_buf_pos = b->yy_ch_buf = base;
01955    b->yy_is_our_buffer = 0;
01956    b->yy_input_file = 0;
01957    b->yy_n_chars = b->yy_buf_size;
01958    b->yy_is_interactive = 0;
01959    b->yy_at_bol = 1;
01960    b->yy_fill_buffer = 0;
01961    b->yy_buffer_status = YY_BUFFER_NEW;
01962 
01963    ast_yy_switch_to_buffer(b ,yyscanner );
01964 
01965    return b;
01966 }
01967 
01968 /** Setup the input buffer state to scan a string. The next call to ast_yylex() will
01969  * scan from a @e copy of @a str.
01970  * @param yystr a NUL-terminated string to scan
01971  * @param yyscanner The scanner object.
01972  * @return the newly allocated buffer state object.
01973  * @note If you want to scan bytes that may contain NUL values, then use
01974  *       ast_yy_scan_bytes() instead.
01975  */
01976 YY_BUFFER_STATE ast_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
01977 {
01978     
01979    return ast_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
01980 }
01981 
01982 /** Setup the input buffer state to scan the given bytes. The next call to ast_yylex() will
01983  * scan from a @e copy of @a bytes.
01984  * @param yybytes the byte buffer to scan
01985  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
01986  * @param yyscanner The scanner object.
01987  * @return the newly allocated buffer state object.
01988  */
01989 YY_BUFFER_STATE ast_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
01990 {
01991    YY_BUFFER_STATE b;
01992    char *buf;
01993    yy_size_t n;
01994    int i;
01995     
01996    /* Get memory for full buffer, including space for trailing EOB's. */
01997    n = _yybytes_len + 2;
01998    buf = (char *) ast_yyalloc(n ,yyscanner );
01999    if ( ! buf )
02000       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_scan_bytes()" );
02001 
02002    for ( i = 0; i < _yybytes_len; ++i )
02003       buf[i] = yybytes[i];
02004 
02005    buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
02006 
02007    b = ast_yy_scan_buffer(buf,n ,yyscanner);
02008    if ( ! b )
02009       YY_FATAL_ERROR( "bad buffer in ast_yy_scan_bytes()" );
02010 
02011    /* It's okay to grow etc. this buffer, and we should throw it
02012     * away when we're done.
02013     */
02014    b->yy_is_our_buffer = 1;
02015 
02016    return b;
02017 }
02018 
02019 #ifndef YY_EXIT_FAILURE
02020 #define YY_EXIT_FAILURE 2
02021 #endif
02022 
02023 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
02024 {
02025       (void) fprintf( stderr, "%s\n", msg );
02026    exit( YY_EXIT_FAILURE );
02027 }
02028 
02029 /* Redefine yyless() so it works in section 3 code. */
02030 
02031 #undef yyless
02032 #define yyless(n) \
02033    do \
02034       { \
02035       /* Undo effects of setting up yytext. */ \
02036         int yyless_macro_arg = (n); \
02037         YY_LESS_LINENO(yyless_macro_arg);\
02038       yytext[yyleng] = yyg->yy_hold_char; \
02039       yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
02040       yyg->yy_hold_char = *yyg->yy_c_buf_p; \
02041       *yyg->yy_c_buf_p = '\0'; \
02042       yyleng = yyless_macro_arg; \
02043       } \
02044    while ( 0 )
02045 
02046 /* Accessor  methods (get/set functions) to struct members. */
02047 
02048 /** Get the user-defined data for this scanner.
02049  * @param yyscanner The scanner object.
02050  */
02051 YY_EXTRA_TYPE ast_yyget_extra  (yyscan_t yyscanner)
02052 {
02053     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02054     return yyextra;
02055 }
02056 
02057 /** Get the current line number.
02058  * @param yyscanner The scanner object.
02059  */
02060 int ast_yyget_lineno  (yyscan_t yyscanner)
02061 {
02062     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02063     
02064         if (! YY_CURRENT_BUFFER)
02065             return 0;
02066     
02067     return yylineno;
02068 }
02069 
02070 /** Get the current column number.
02071  * @param yyscanner The scanner object.
02072  */
02073 int ast_yyget_column  (yyscan_t yyscanner)
02074 {
02075     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02076     
02077         if (! YY_CURRENT_BUFFER)
02078             return 0;
02079     
02080     return yycolumn;
02081 }
02082 
02083 /** Get the input stream.
02084  * @param yyscanner The scanner object.
02085  */
02086 FILE *ast_yyget_in  (yyscan_t yyscanner)
02087 {
02088     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02089     return yyin;
02090 }
02091 
02092 /** Get the output stream.
02093  * @param yyscanner The scanner object.
02094  */
02095 FILE *ast_yyget_out  (yyscan_t yyscanner)
02096 {
02097     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02098     return yyout;
02099 }
02100 
02101 /** Get the length of the current token.
02102  * @param yyscanner The scanner object.
02103  */
02104 int ast_yyget_leng  (yyscan_t yyscanner)
02105 {
02106     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02107     return yyleng;
02108 }
02109 
02110 /** Get the current token.
02111  * @param yyscanner The scanner object.
02112  */
02113 
02114 char *ast_yyget_text  (yyscan_t yyscanner)
02115 {
02116     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02117     return yytext;
02118 }
02119 
02120 /** Set the user-defined data. This data is never touched by the scanner.
02121  * @param user_defined The data to be associated with this scanner.
02122  * @param yyscanner The scanner object.
02123  */
02124 void ast_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
02125 {
02126     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02127     yyextra = user_defined ;
02128 }
02129 
02130 /** Set the current line number.
02131  * @param line_number
02132  * @param yyscanner The scanner object.
02133  */
02134 void ast_yyset_lineno (int  line_number , yyscan_t yyscanner)
02135 {
02136     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02137 
02138         /* lineno is only valid if an input buffer exists. */
02139         if (! YY_CURRENT_BUFFER )
02140            yy_fatal_error( "ast_yyset_lineno called with no buffer" , yyscanner); 
02141     
02142     yylineno = line_number;
02143 }
02144 
02145 /** Set the current column.
02146  * \param column_no line_number
02147  * \param yyscanner The scanner object.
02148  */
02149 void ast_yyset_column (int  column_no , yyscan_t yyscanner)
02150 {
02151     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02152 
02153         /* column is only valid if an input buffer exists. */
02154         if (! YY_CURRENT_BUFFER )
02155            yy_fatal_error( "ast_yyset_column called with no buffer" , yyscanner); 
02156     
02157     yycolumn = column_no;
02158 }
02159 
02160 /** Set the input stream. This does not discard the current
02161  * input buffer.
02162  * @param in_str A readable stream.
02163  * @param yyscanner The scanner object.
02164  * @see ast_yy_switch_to_buffer
02165  */
02166 void ast_yyset_in (FILE *  in_str , yyscan_t yyscanner)
02167 {
02168     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02169     yyin = in_str ;
02170 }
02171 
02172 void ast_yyset_out (FILE *  out_str , yyscan_t yyscanner)
02173 {
02174     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02175     yyout = out_str ;
02176 }
02177 
02178 int ast_yyget_debug  (yyscan_t yyscanner)
02179 {
02180     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02181     return yy_flex_debug;
02182 }
02183 
02184 void ast_yyset_debug (int  bdebug , yyscan_t yyscanner)
02185 {
02186     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02187     yy_flex_debug = bdebug ;
02188 }
02189 
02190 /* Accessor methods for yylval and yylloc */
02191 
02192 YYSTYPE * ast_yyget_lval  (yyscan_t yyscanner)
02193 {
02194     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02195     return yylval;
02196 }
02197 
02198 void ast_yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
02199 {
02200     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02201     yylval = yylval_param;
02202 }
02203 
02204 YYLTYPE *ast_yyget_lloc  (yyscan_t yyscanner)
02205 {
02206     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02207     return yylloc;
02208 }
02209     
02210 void ast_yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
02211 {
02212     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02213     yylloc = yylloc_param;
02214 }
02215     
02216 /* User-visible API */
02217 
02218 /* ast_yylex_init is special because it creates the scanner itself, so it is
02219  * the ONLY reentrant function that doesn't take the scanner as the last argument.
02220  * That's why we explicitly handle the declaration, instead of using our macros.
02221  */
02222 
02223 int ast_yylex_init(yyscan_t* ptr_yy_globals)
02224 
02225 {
02226     if (ptr_yy_globals == NULL){
02227         errno = EINVAL;
02228         return 1;
02229     }
02230 
02231     *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), NULL );
02232 
02233     if (*ptr_yy_globals == NULL){
02234         errno = ENOMEM;
02235         return 1;
02236     }
02237 
02238     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
02239     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02240 
02241     return yy_init_globals ( *ptr_yy_globals );
02242 }
02243 
02244 /* ast_yylex_init_extra has the same functionality as ast_yylex_init, but follows the
02245  * convention of taking the scanner as the last argument. Note however, that
02246  * this is a *pointer* to a scanner, as it will be allocated by this call (and
02247  * is the reason, too, why this function also must handle its own declaration).
02248  * The user defined value in the first argument will be available to ast_yyalloc in
02249  * the yyextra field.
02250  */
02251 
02252 int ast_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
02253 
02254 {
02255     struct yyguts_t dummy_yyguts;
02256 
02257     ast_yyset_extra (yy_user_defined, &dummy_yyguts);
02258 
02259     if (ptr_yy_globals == NULL){
02260         errno = EINVAL;
02261         return 1;
02262     }
02263    
02264     *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
02265    
02266     if (*ptr_yy_globals == NULL){
02267         errno = ENOMEM;
02268         return 1;
02269     }
02270     
02271     /* By setting to 0xAA, we expose bugs in
02272     yy_init_globals. Leave at 0x00 for releases. */
02273     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02274     
02275     ast_yyset_extra (yy_user_defined, *ptr_yy_globals);
02276     
02277     return yy_init_globals ( *ptr_yy_globals );
02278 }
02279 
02280 static int yy_init_globals (yyscan_t yyscanner)
02281 {
02282     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02283     /* Initialization is the same as for the non-reentrant scanner.
02284      * This function is called from ast_yylex_destroy(), so don't allocate here.
02285      */
02286 
02287     yyg->yy_buffer_stack = 0;
02288     yyg->yy_buffer_stack_top = 0;
02289     yyg->yy_buffer_stack_max = 0;
02290     yyg->yy_c_buf_p = (char *) 0;
02291     yyg->yy_init = 0;
02292     yyg->yy_start = 0;
02293 
02294     yyg->yy_start_stack_ptr = 0;
02295     yyg->yy_start_stack_depth = 0;
02296     yyg->yy_start_stack =  NULL;
02297 
02298 /* Defined in main.c */
02299 #ifdef YY_STDINIT
02300     yyin = stdin;
02301     yyout = stdout;
02302 #else
02303     yyin = (FILE *) 0;
02304     yyout = (FILE *) 0;
02305 #endif
02306 
02307     /* For future reference: Set errno on error, since we are called by
02308      * ast_yylex_init()
02309      */
02310     return 0;
02311 }
02312 
02313 /* ast_yylex_destroy is for both reentrant and non-reentrant scanners. */
02314 int ast_yylex_destroy  (yyscan_t yyscanner)
02315 {
02316     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02317 
02318     /* Pop the buffer stack, destroying each element. */
02319    while(YY_CURRENT_BUFFER){
02320       ast_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
02321       YY_CURRENT_BUFFER_LVALUE = NULL;
02322       ast_yypop_buffer_state(yyscanner);
02323    }
02324 
02325    /* Destroy the stack itself. */
02326    ast_yyfree(yyg->yy_buffer_stack ,yyscanner);
02327    yyg->yy_buffer_stack = NULL;
02328 
02329     /* Destroy the start condition stack. */
02330         ast_yyfree(yyg->yy_start_stack ,yyscanner );
02331         yyg->yy_start_stack = NULL;
02332 
02333     /* Reset the globals. This is important in a non-reentrant scanner so the next time
02334      * ast_yylex() is called, initialization will occur. */
02335     yy_init_globals( yyscanner);
02336 
02337     /* Destroy the main struct (reentrant only). */
02338     ast_yyfree ( yyscanner , yyscanner );
02339     yyscanner = NULL;
02340     return 0;
02341 }
02342 
02343 /*
02344  * Internal utility routines.
02345  */
02346 
02347 #ifndef yytext_ptr
02348 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
02349 {
02350    register int i;
02351    for ( i = 0; i < n; ++i )
02352       s1[i] = s2[i];
02353 }
02354 #endif
02355 
02356 #ifdef YY_NEED_STRLEN
02357 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
02358 {
02359    register int n;
02360    for ( n = 0; s[n]; ++n )
02361       ;
02362 
02363    return n;
02364 }
02365 #endif
02366 
02367 void *ast_yyalloc (yy_size_t  size , yyscan_t yyscanner)
02368 {
02369    return (void *) malloc( size );
02370 }
02371 
02372 void *ast_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
02373 {
02374    /* The cast to (char *) in the following accommodates both
02375     * implementations that use char* generic pointers, and those
02376     * that use void* generic pointers.  It works with the latter
02377     * because both ANSI C and C++ allow castless assignment from
02378     * any pointer type to void*, and deal with argument conversions
02379     * as though doing an assignment.
02380     */
02381    return (void *) realloc( (char *) ptr, size );
02382 }
02383 
02384 #define YYTABLES_NAME "yytables"
02385 
02386 #line 238 "ast_expr2.fl"
02387 
02388 
02389 
02390 /* I'm putting the interface routine to the whole parse here in the flexer input file
02391    mainly because of all the flexer initialization that has to be done. Shouldn't matter
02392    where it is, as long as it's somewhere. I didn't want to define a prototype for the
02393    ast_yy_scan_string in the .y file, because then, I'd have to define YY_BUFFER_STATE there...
02394    UGH! that would be inappropriate. */
02395 
02396 int ast_yyparse(void *); /* need to/should define this prototype for the call to yyparse */
02397 int ast_yyerror(const char *, YYLTYPE *, struct parse_io *); /* likewise */
02398 
02399 void ast_yyfree(void *ptr, yyscan_t yyscanner)
02400 {
02401     /* the normal generated ast_yyfree func just frees its first arg;
02402      this get complaints on some systems, as sometimes this
02403      arg is a nil ptr! It's usually not fatal, but is irritating! */
02404    free( (char *) ptr );
02405 }
02406 
02407 int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
02408 {
02409    struct parse_io io = { .string = expr, .chan = chan };
02410    int return_value = 0;
02411 
02412    ast_yylex_init(&io.scanner);
02413 
02414    ast_yy_scan_string(expr, io.scanner);
02415 
02416    ast_yyparse ((void *) &io);
02417 
02418    ast_yylex_destroy(io.scanner);
02419 
02420    if (!io.val) {
02421       if (length > 1) {
02422          strcpy(buf, "0");
02423          return_value = 1;
02424       }
02425    } else {
02426       if (io.val->type == AST_EXPR_number) {
02427          int res_length;
02428 
02429          res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
02430          return_value = (res_length <= length) ? res_length : length;
02431       } else {
02432          if (io.val->u.s)
02433 #if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE)
02434             strncpy(buf, io.val->u.s, length - 1);
02435 #else /* !STANDALONE && !LOW_MEMORY */
02436             ast_copy_string(buf, io.val->u.s, length);
02437 #endif /* STANDALONE || LOW_MEMORY */
02438          else
02439             buf[0] = 0;
02440          return_value = strlen(buf);
02441          free(io.val->u.s);
02442       }
02443       free(io.val);
02444    }
02445    return return_value;
02446 }
02447 
02448 #ifndef STANDALONE
02449 int ast_str_expr(struct ast_str **str, ssize_t maxlen, struct ast_channel *chan, char *expr)
02450 {
02451    struct parse_io io = { .string = expr, .chan = chan };
02452 
02453    ast_yylex_init(&io.scanner);
02454    ast_yy_scan_string(expr, io.scanner);
02455    ast_yyparse ((void *) &io);
02456    ast_yylex_destroy(io.scanner);
02457 
02458    if (!io.val) {
02459       ast_str_set(str, maxlen, "0");
02460    } else {
02461       if (io.val->type == AST_EXPR_number) {
02462          ast_str_set(str, maxlen, FP___PRINTF, io.val->u.i);
02463       } else if (io.val->u.s) {
02464          ast_str_set(str, maxlen, "%s", io.val->u.s);
02465          free(io.val->u.s);
02466       }
02467       free(io.val);
02468    }
02469    return ast_str_strlen(*str);
02470 }
02471 #endif
02472 
02473 
02474 char extra_error_message[4095];
02475 int extra_error_message_supplied = 0;
02476 void  ast_expr_register_extra_error_info(char *message);
02477 void  ast_expr_clear_extra_error_info(void);
02478 
02479 void  ast_expr_register_extra_error_info(char *message)
02480 {
02481        extra_error_message_supplied=1;
02482        strcpy(extra_error_message, message);
02483 }
02484 
02485 void  ast_expr_clear_extra_error_info(void)
02486 {
02487        extra_error_message_supplied=0;
02488        extra_error_message[0] = 0;
02489 }
02490 
02491 static const char * const expr2_token_equivs1[] = 
02492 {
02493    "TOKEN",
02494    "TOK_COND",
02495    "TOK_COLONCOLON",
02496    "TOK_OR",
02497    "TOK_AND",
02498    "TOK_EQ",
02499    "TOK_GT",
02500    "TOK_LT",
02501    "TOK_GE",
02502    "TOK_LE",
02503    "TOK_NE",
02504    "TOK_PLUS",
02505    "TOK_MINUS",
02506    "TOK_MULT",
02507    "TOK_DIV",
02508    "TOK_MOD",
02509    "TOK_COMPL",
02510    "TOK_COLON",
02511    "TOK_EQTILDE",
02512    "TOK_COMMA",
02513    "TOK_RP",
02514    "TOK_LP"
02515 };
02516 
02517 static const char * const expr2_token_equivs2[] = 
02518 {
02519    "<token>",
02520    "?",
02521    "::",
02522    "|",
02523    "&",
02524    "=",
02525    ">",
02526    "<",
02527    ">=",
02528    "<=",
02529    "!=",
02530    "+",
02531    "-",
02532    "*",
02533    "/",
02534    "%",
02535    "!",
02536    ":",
02537    "=~",
02538    ",",
02539    ")",
02540    "("
02541 };
02542 
02543 
02544 static char *expr2_token_subst(const char *mess)
02545 {
02546    /* calc a length, malloc, fill, and return; yyerror had better free it! */
02547    int len=0,i;
02548    const char *p;
02549    char *res, *s;
02550    const char *t;
02551    int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*);
02552 
02553    for (p=mess; *p; p++) {
02554       for (i=0; i<expr2_token_equivs_entries; i++) {
02555          if ( strncmp(p,expr2_token_equivs1[i],strlen(expr2_token_equivs1[i])) == 0 )
02556          {
02557             len+=strlen(expr2_token_equivs2[i])+2;
02558             p += strlen(expr2_token_equivs1[i])-1;
02559             break;
02560          }
02561       }
02562       len++;
02563    }
02564    res = (char*)malloc(len+1);
02565    res[0] = 0;
02566    s = res;
02567    for (p=mess; *p;) {
02568       int found = 0;
02569       for (i=0; i<expr2_token_equivs_entries; i++) {
02570          if ( strncmp(p,expr2_token_equivs1[i],strlen(expr2_token_equivs1[i])) == 0 ) {
02571             *s++ = '\'';
02572             for (t=expr2_token_equivs2[i]; *t;) {
02573                *s++ = *t++;
02574             }
02575             *s++ = '\'';
02576             p += strlen(expr2_token_equivs1[i]);
02577             found = 1;
02578             break;
02579          }
02580       }
02581       if( !found )
02582          *s++ = *p++;
02583    }
02584    *s++ = 0;
02585    return res;
02586 }
02587 
02588 int ast_yyerror (const char *s,  yyltype *loc, struct parse_io *parseio )
02589 {
02590    struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
02591    char spacebuf[8000]; /* best safe than sorry */
02592    int i=0;
02593    char *s2 = expr2_token_subst(s);
02594    spacebuf[0] = 0;
02595 
02596    for (i = 0; i < (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); i++) {
02597       spacebuf[i] = ' ';
02598    }
02599    /* uh... assuming yyg is defined, then I can use the yycolumn macro,
02600    which is the same thing as... get this:
02601    yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
02602    I was tempted to just use yy_buf_pos in the STATE, but..., well:
02603    a. the yy_buf_pos is the current position in the buffer, which
02604       may not relate to the entire string/buffer because of the
02605       buffering.
02606    b. but, analysis of the situation is that when you use the
02607       ast_yy_scan_string func, it creates a single buffer the size of
02608       string, so the two would be the same...
02609       so, in the end, the yycolumn macro is available, shorter, therefore easier. */
02610 
02611    spacebuf[i++] = '^';
02612    spacebuf[i] = 0;
02613 
02614 #ifdef STANDALONE3
02615    /* easier to read in the standalone version */
02616    printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
02617          (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
02618 #else
02619    ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
02620          (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
02621 #endif
02622 #ifndef STANDALONE
02623    ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");
02624 #endif
02625    free(s2);
02626    return(0);
02627 }
02628 

Generated on Thu Apr 16 06:27:14 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6