Sat Aug 6 00:39:22 2011

Asterisk developer's documentation


ast_expr2f.c

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

Generated on Sat Aug 6 00:39:22 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7