Mon Mar 19 11:30:22 2012

Asterisk developer's documentation


ast_expr2f.c

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

Generated on Mon Mar 19 11:30:22 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7