src/libsphinxbase/lm/jsgf_scanner.c

00001 #line 2 "jsgf_scanner.c"
00002 
00003 #line 4 "jsgf_scanner.c"
00004 
00005 /* Silvio Moioli: Windows CE string functions added. */
00006 #if defined(_WIN32_WCE)
00007     #include "string_wce.h"
00008 #endif
00009 
00010 #define  YY_INT_ALIGNED short int
00011 
00012 /* A lexical scanner generated by flex */
00013 
00014 #define FLEX_SCANNER
00015 #define YY_FLEX_MAJOR_VERSION 2
00016 #define YY_FLEX_MINOR_VERSION 5
00017 #define YY_FLEX_SUBMINOR_VERSION 34
00018 #if YY_FLEX_SUBMINOR_VERSION > 0
00019 #define FLEX_BETA
00020 #endif
00021 
00022 /* First, we deal with  platform-specific or compiler-specific issues. */
00023 
00024 /* begin standard C headers. */
00025 #include <stdio.h>
00026 #include <string.h>
00027 #include <errno.h>
00028 #include <stdlib.h>
00029 
00030 /* end standard C headers. */
00031 
00032 /* flex integer type definitions */
00033 
00034 #ifndef FLEXINT_H
00035 #define FLEXINT_H
00036 
00037 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00038 
00039 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00040 
00041 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
00042  * if you want the limit (max/min) macros for int types. 
00043  */
00044 #ifndef __STDC_LIMIT_MACROS
00045 #define __STDC_LIMIT_MACROS 1
00046 #endif
00047 
00048 #include <inttypes.h>
00049 typedef int8_t flex_int8_t;
00050 typedef uint8_t flex_uint8_t;
00051 typedef int16_t flex_int16_t;
00052 typedef uint16_t flex_uint16_t;
00053 typedef int32_t flex_int32_t;
00054 typedef uint32_t flex_uint32_t;
00055 #else
00056 typedef signed char flex_int8_t;
00057 typedef short int flex_int16_t;
00058 typedef int flex_int32_t;
00059 typedef unsigned char flex_uint8_t; 
00060 typedef unsigned short int flex_uint16_t;
00061 typedef unsigned int flex_uint32_t;
00062 #endif /* ! C99 */
00063 
00064 /* Limits of integral types. */
00065 #ifndef INT8_MIN
00066 #define INT8_MIN               (-128)
00067 #endif
00068 #ifndef INT16_MIN
00069 #define INT16_MIN              (-32767-1)
00070 #endif
00071 #ifndef INT32_MIN
00072 #define INT32_MIN              (-2147483647-1)
00073 #endif
00074 #ifndef INT8_MAX
00075 #define INT8_MAX               (127)
00076 #endif
00077 #ifndef INT16_MAX
00078 #define INT16_MAX              (32767)
00079 #endif
00080 #ifndef INT32_MAX
00081 #define INT32_MAX              (2147483647)
00082 #endif
00083 #ifndef UINT8_MAX
00084 #define UINT8_MAX              (255U)
00085 #endif
00086 #ifndef UINT16_MAX
00087 #define UINT16_MAX             (65535U)
00088 #endif
00089 #ifndef UINT32_MAX
00090 #define UINT32_MAX             (4294967295U)
00091 #endif
00092 
00093 #endif /* ! FLEXINT_H */
00094 
00095 #ifdef __cplusplus
00096 
00097 /* The "const" storage-class-modifier is valid. */
00098 #define YY_USE_CONST
00099 
00100 #else   /* ! __cplusplus */
00101 
00102 /* C99 requires __STDC__ to be defined as 1. */
00103 #if defined (__STDC__)
00104 
00105 #define YY_USE_CONST
00106 
00107 #endif  /* defined (__STDC__) */
00108 #endif  /* ! __cplusplus */
00109 
00110 #ifdef YY_USE_CONST
00111 #define yyconst const
00112 #else
00113 #define yyconst
00114 #endif
00115 
00116 /* Returned upon end-of-file. */
00117 #define YY_NULL 0
00118 
00119 /* Promotes a possibly negative, possibly signed char to an unsigned
00120  * integer for use as an array index.  If the signed char is negative,
00121  * we want to instead treat it as an 8-bit unsigned char, hence the
00122  * double cast.
00123  */
00124 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00125 
00126 /* An opaque pointer. */
00127 #ifndef YY_TYPEDEF_YY_SCANNER_T
00128 #define YY_TYPEDEF_YY_SCANNER_T
00129 typedef void* yyscan_t;
00130 #endif
00131 
00132 /* For convenience, these vars (plus the bison vars far below)
00133    are macros in the reentrant scanner. */
00134 #define yyin yyg->yyin_r
00135 #define yyout yyg->yyout_r
00136 #define yyextra yyg->yyextra_r
00137 #define yyleng yyg->yyleng_r
00138 #define yytext yyg->yytext_r
00139 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
00140 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
00141 #define yy_flex_debug yyg->yy_flex_debug_r
00142 
00143 /* Enter a start condition.  This macro really ought to take a parameter,
00144  * but we do it the disgusting crufty way forced on us by the ()-less
00145  * definition of BEGIN.
00146  */
00147 #define BEGIN yyg->yy_start = 1 + 2 *
00148 
00149 /* Translate the current start state into a value that can be later handed
00150  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00151  * compatibility.
00152  */
00153 #define YY_START ((yyg->yy_start - 1) / 2)
00154 #define YYSTATE YY_START
00155 
00156 /* Action number for EOF rule of a given start state. */
00157 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00158 
00159 /* Special action meaning "start processing a new file". */
00160 #define YY_NEW_FILE yyrestart(yyin ,yyscanner )
00161 
00162 #define YY_END_OF_BUFFER_CHAR 0
00163 
00164 /* Size of default input buffer. */
00165 #ifndef YY_BUF_SIZE
00166 #define YY_BUF_SIZE 16384
00167 #endif
00168 
00169 /* The state buf must be large enough to hold one state per character in the main buffer.
00170  */
00171 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00172 
00173 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00174 #define YY_TYPEDEF_YY_BUFFER_STATE
00175 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00176 #endif
00177 
00178 #define EOB_ACT_CONTINUE_SCAN 0
00179 #define EOB_ACT_END_OF_FILE 1
00180 #define EOB_ACT_LAST_MATCH 2
00181 
00182     #define YY_LESS_LINENO(n)
00183     
00184 /* Return all but the first "n" matched characters back to the input stream. */
00185 #define yyless(n) \
00186         do \
00187                 { \
00188                 /* Undo effects of setting up yytext. */ \
00189         int yyless_macro_arg = (n); \
00190         YY_LESS_LINENO(yyless_macro_arg);\
00191                 *yy_cp = yyg->yy_hold_char; \
00192                 YY_RESTORE_YY_MORE_OFFSET \
00193                 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00194                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00195                 } \
00196         while ( 0 )
00197 
00198 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
00199 
00200 /* The following is because we cannot portably get our hands on size_t
00201  * (without autoconf's help, which isn't available because we want
00202  * flex-generated scanners to compile on their own).
00203  * Given that the standard has decreed that size_t exists since 1989,
00204  * I guess we can afford to depend on it. Manoj.
00205  */
00206 
00207 #ifndef YY_TYPEDEF_YY_SIZE_T
00208 #define YY_TYPEDEF_YY_SIZE_T
00209 typedef size_t yy_size_t;
00210 #endif
00211 
00212 #ifndef YY_STRUCT_YY_BUFFER_STATE
00213 #define YY_STRUCT_YY_BUFFER_STATE
00214 struct yy_buffer_state
00215         {
00216         FILE *yy_input_file;
00217 
00218         char *yy_ch_buf;                /* input buffer */
00219         char *yy_buf_pos;               /* current position in input buffer */
00220 
00221         /* Size of input buffer in bytes, not including room for EOB
00222          * characters.
00223          */
00224         yy_size_t yy_buf_size;
00225 
00226         /* Number of characters read into yy_ch_buf, not including EOB
00227          * characters.
00228          */
00229         int yy_n_chars;
00230 
00231         /* Whether we "own" the buffer - i.e., we know we created it,
00232          * and can realloc() it to grow it, and should free() it to
00233          * delete it.
00234          */
00235         int yy_is_our_buffer;
00236 
00237         /* Whether this is an "interactive" input source; if so, and
00238          * if we're using stdio for input, then we want to use getc()
00239          * instead of fread(), to make sure we stop fetching input after
00240          * each newline.
00241          */
00242         int yy_is_interactive;
00243 
00244         /* Whether we're considered to be at the beginning of a line.
00245          * If so, '^' rules will be active on the next match, otherwise
00246          * not.
00247          */
00248         int yy_at_bol;
00249 
00250     int yy_bs_lineno; 
00251     int yy_bs_column; 
00253         /* Whether to try to fill the input buffer when we reach the
00254          * end of it.
00255          */
00256         int yy_fill_buffer;
00257 
00258         int yy_buffer_status;
00259 
00260 #define YY_BUFFER_NEW 0
00261 #define YY_BUFFER_NORMAL 1
00262         /* When an EOF's been seen but there's still some text to process
00263          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00264          * shouldn't try reading from the input source any more.  We might
00265          * still have a bunch of tokens to match, though, because of
00266          * possible backing-up.
00267          *
00268          * When we actually see the EOF, we change the status to "new"
00269          * (via yyrestart()), so that the user can continue scanning by
00270          * just pointing yyin at a new input file.
00271          */
00272 #define YY_BUFFER_EOF_PENDING 2
00273 
00274         };
00275 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00276 
00277 /* We provide macros for accessing buffer states in case in the
00278  * future we want to put the buffer states in a more general
00279  * "scanner state".
00280  *
00281  * Returns the top of the stack, or NULL.
00282  */
00283 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
00284                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
00285                           : NULL)
00286 
00287 /* Same as previous macro, but useful when we know that the buffer stack is not
00288  * NULL or when we need an lvalue. For internal use only.
00289  */
00290 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
00291 
00292 void yyrestart (FILE *input_file ,yyscan_t yyscanner );
00293 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00294 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
00295 void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00296 void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00297 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00298 void yypop_buffer_state (yyscan_t yyscanner );
00299 
00300 static void yyensure_buffer_stack (yyscan_t yyscanner );
00301 static void yy_load_buffer_state (yyscan_t yyscanner );
00302 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
00303 
00304 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
00305 
00306 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
00307 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
00308 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
00309 
00310 void *yyalloc (yy_size_t ,yyscan_t yyscanner );
00311 void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
00312 void yyfree (void * ,yyscan_t yyscanner );
00313 
00314 #define yy_new_buffer yy_create_buffer
00315 
00316 #define yy_set_interactive(is_interactive) \
00317         { \
00318         if ( ! YY_CURRENT_BUFFER ){ \
00319         yyensure_buffer_stack (yyscanner); \
00320                 YY_CURRENT_BUFFER_LVALUE =    \
00321             yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00322         } \
00323         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00324         }
00325 
00326 #define yy_set_bol(at_bol) \
00327         { \
00328         if ( ! YY_CURRENT_BUFFER ){\
00329         yyensure_buffer_stack (yyscanner); \
00330                 YY_CURRENT_BUFFER_LVALUE =    \
00331             yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00332         } \
00333         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00334         }
00335 
00336 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00337 
00338 /* Begin user sect3 */
00339 
00340 #define yywrap(n) 1
00341 #define YY_SKIP_YYWRAP
00342 
00343 typedef unsigned char YY_CHAR;
00344 
00345 typedef int yy_state_type;
00346 
00347 #define yytext_ptr yytext_r
00348 
00349 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
00350 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
00351 static int yy_get_next_buffer (yyscan_t yyscanner );
00352 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
00353 
00354 /* Done after the current pattern has been matched and before the
00355  * corresponding action - sets up yytext.
00356  */
00357 #define YY_DO_BEFORE_ACTION \
00358         yyg->yytext_ptr = yy_bp; \
00359         yyleng = (size_t) (yy_cp - yy_bp); \
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 16
00365 #define YY_END_OF_BUFFER 17
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[72] =
00374     {   0,
00375         0,    0,    0,    0,   17,   12,    1,    1,   12,   12,
00376        15,   15,   15,   12,   12,   12,   15,    5,    1,    5,
00377        12,   12,    0,   12,   12,   12,    3,    0,   14,    0,
00378         0,   12,   12,   12,    0,    0,   11,    4,   13,    0,
00379        12,    0,   12,   12,   12,    0,    0,    2,   14,   10,
00380        12,   12,   12,    0,    0,   11,   13,    0,   12,   12,
00381        12,   12,    6,   12,   12,   12,   12,    8,    9,    7,
00382         0
00383     } ;
00384 
00385 static yyconst flex_int32_t yy_ec[256] =
00386     {   0,
00387         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00388         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00389         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00390         1,    2,    1,    4,    5,    1,    1,    1,    1,    6,
00391         6,    7,    6,    1,    1,    8,    9,   10,   10,   10,
00392        10,   10,   10,   10,   10,   10,   10,    1,    6,   11,
00393         6,   12,    1,    1,    1,    1,    1,    1,    1,   13,
00394        14,    1,    1,   15,    1,    1,    1,    1,    1,    1,
00395         1,    1,   16,    1,    1,    1,    1,    1,    1,    1,
00396         6,   17,    6,    1,    1,    1,   18,   19,   20,    1,
00397 
00398         1,    1,   21,    1,   22,    1,    1,   23,   24,    1,
00399        25,   26,    1,   27,    1,   28,   29,    1,    1,    1,
00400         1,    1,   30,    6,   31,    1,    1,    1,    1,    1,
00401         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00402         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00403         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00404         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00405         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00406         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00407         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00408 
00409         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00410         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00411         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00412         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00413         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00414         1,    1,    1,    1,    1
00415     } ;
00416 
00417 static yyconst flex_int32_t yy_meta[32] =
00418     {   0,
00419         1,    2,    2,    1,    1,    2,    2,    1,    2,    1,
00420         3,    3,    1,    1,    1,    1,    1,    1,    1,    1,
00421         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
00422         2
00423     } ;
00424 
00425 static yyconst flex_int16_t yy_base[82] =
00426     {   0,
00427         0,    0,   30,   32,  138,    0,  186,  186,   38,  121,
00428       186,   44,    0,  106,  103,   97,   26,  186,  186,  115,
00429         0,   68,   42,    0,   98,  107,  186,  112,  118,   52,
00430       108,  101,   92,   97,   47,   64,  186,  186,  186,   79,
00431         0,   59,    0,  128,  100,   56,  110,  186,  186,  186,
00432        84,   69,   70,   56,   86,   75,   80,  108,   78,   66,
00433        61,   64,    0,   40,   28,   28,   11,    0,    0,    0,
00434       186,  159,   35,  162,  165,  167,  170,  173,  176,  179,
00435       182
00436     } ;
00437 
00438 static yyconst flex_int16_t yy_def[82] =
00439     {   0,
00440        71,    1,   72,   72,   71,   73,   71,   71,   74,   73,
00441        71,   71,   75,   73,   73,   73,   76,   71,   71,   71,
00442        73,   74,   77,   73,   78,   73,   71,   71,   79,   71,
00443        75,   73,   73,   73,   76,   80,   71,   71,   71,   81,
00444        22,   77,   22,   78,   73,   71,   79,   71,   71,   71,
00445        73,   73,   73,   76,   80,   76,   77,   81,   73,   73,
00446        73,   73,   73,   73,   73,   73,   73,   73,   73,   73,
00447         0,   71,   71,   71,   71,   71,   71,   71,   71,   71,
00448        71
00449     } ;
00450 
00451 static yyconst flex_int16_t yy_nxt[218] =
00452     {   0,
00453         6,    7,    8,    9,   10,   11,   11,    6,   12,    6,
00454        13,   11,    6,    6,    6,    6,    6,    6,    6,    6,
00455        14,   15,    6,    6,    6,   16,    6,    6,    6,   17,
00456        11,   19,    8,   19,    8,   21,   20,   70,   20,   23,
00457        23,   24,   36,   23,   23,   39,   23,   69,   23,   23,
00458        27,   28,   29,   30,   25,   68,   37,   67,   40,   28,
00459        49,   30,   39,   36,   49,   46,   35,   23,   23,   23,
00460        23,   24,   36,   23,   23,   40,   23,   37,   23,   23,
00461        55,   23,   57,   39,   25,   66,   37,   65,   35,   64,
00462        63,   36,   62,   61,   56,   58,   40,   23,   23,   42,
00463 
00464        23,   43,   55,   42,   42,   37,   42,   60,   42,   42,
00465        23,   57,   48,   59,   44,   53,   56,   52,   51,   50,
00466        48,   46,   45,   38,   58,   34,   33,   42,   42,   42,
00467        23,   43,   32,   42,   42,   26,   42,   71,   42,   42,
00468        71,   71,   71,   71,   44,   71,   71,   71,   71,   71,
00469        71,   71,   71,   71,   71,   71,   71,   42,   42,   18,
00470        18,   18,   22,   22,   22,   31,   31,   35,   35,   35,
00471        23,   23,   23,   41,   41,   41,   47,   47,   47,   54,
00472        54,   54,   42,   42,   42,    5,   71,   71,   71,   71,
00473        71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
00474 
00475        71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
00476        71,   71,   71,   71,   71,   71,   71
00477     } ;
00478 
00479 static yyconst flex_int16_t yy_chk[218] =
00480     {   0,
00481         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00482         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00483         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00484         1,    3,    3,    4,    4,   73,    3,   67,    4,    9,
00485         9,    9,   17,    9,    9,   23,    9,   66,    9,    9,
00486        12,   12,   12,   12,    9,   65,   17,   64,   23,   30,
00487        30,   30,   42,   35,   46,   46,   36,    9,    9,   22,
00488        22,   22,   54,   22,   22,   42,   22,   35,   22,   22,
00489        36,   40,   40,   57,   22,   62,   54,   61,   55,   60,
00490        59,   56,   53,   52,   36,   40,   57,   22,   22,   25,
00491 
00492        25,   25,   55,   25,   25,   56,   25,   51,   25,   25,
00493        58,   58,   47,   45,   25,   34,   55,   33,   32,   31,
00494        29,   28,   26,   20,   58,   16,   15,   25,   25,   44,
00495        44,   44,   14,   44,   44,   10,   44,    5,   44,   44,
00496         0,    0,    0,    0,   44,    0,    0,    0,    0,    0,
00497         0,    0,    0,    0,    0,    0,    0,   44,   44,   72,
00498        72,   72,   74,   74,   74,   75,   75,   76,   76,   76,
00499        77,   77,   77,   78,   78,   78,   79,   79,   79,   80,
00500        80,   80,   81,   81,   81,   71,   71,   71,   71,   71,
00501        71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
00502 
00503        71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
00504        71,   71,   71,   71,   71,   71,   71
00505     } ;
00506 
00507 /* The intent behind this definition is that it'll catch
00508  * any uses of REJECT which flex missed.
00509  */
00510 #define REJECT reject_used_but_not_detected
00511 #define yymore() yymore_used_but_not_detected
00512 #define YY_MORE_ADJ 0
00513 #define YY_RESTORE_YY_MORE_OFFSET
00514 #line 1 "_jsgf_scanner.l"
00515 /* -*- mode: text -*- */
00516 /* ====================================================================
00517  * Copyright (c) 2007 Carnegie Mellon University.  All rights
00518  * reserved.
00519  *
00520  * Redistribution and use in source and binary forms, with or without
00521  * modification, are permitted provided that the following conditions
00522  * are met:
00523  *
00524  * 1. Redistributions of source code must retain the above copyright
00525  *    notice, this list of conditions and the following disclaimer. 
00526  *
00527  * 2. Redistributions in binary form must reproduce the above copyright
00528  *    notice, this list of conditions and the following disclaimer in
00529  *    the documentation and/or other materials provided with the
00530  *    distribution.
00531  *
00532  * This work was supported in part by funding from the Defense Advanced 
00533  * Research Projects Agency and the National Science Foundation of the 
00534  * United States of America, and the CMU Sphinx Speech Consortium.
00535  *
00536  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
00537  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00538  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00539  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
00540  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00541  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00542  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00543  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00544  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00545  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00546  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00547  *
00548  * ====================================================================
00549  *
00550  */
00551 /* YOU MUST USE FLEX 2.5.33 OR NEWER TO PROCESS THIS FILE!!! */
00552 #line 39 "_jsgf_scanner.l"
00553 
00554 #include "jsgf_internal.h"
00555 #include "jsgf_parser.h"
00556 
00557 
00558 #line 554 "jsgf_scanner.c"
00559 
00560 #define INITIAL 0
00561 #define COMMENT 1
00562 
00563 #ifndef YY_NO_UNISTD_H
00564 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00565  * down here because we want the user's section 1 to have been scanned first.
00566  * The user has a chance to override it with an option.
00567  */
00568 #include <unistd.h>
00569 #endif
00570 
00571 #ifndef YY_EXTRA_TYPE
00572 #define YY_EXTRA_TYPE void *
00573 #endif
00574 
00575 /* Holds the entire state of the reentrant scanner. */
00576 struct yyguts_t
00577     {
00578 
00579     /* User-defined. Not touched by flex. */
00580     YY_EXTRA_TYPE yyextra_r;
00581 
00582     /* The rest are the same as the globals declared in the non-reentrant scanner. */
00583     FILE *yyin_r, *yyout_r;
00584     size_t yy_buffer_stack_top; 
00585     size_t yy_buffer_stack_max; 
00586     YY_BUFFER_STATE * yy_buffer_stack; 
00587     char yy_hold_char;
00588     int yy_n_chars;
00589     int yyleng_r;
00590     char *yy_c_buf_p;
00591     int yy_init;
00592     int yy_start;
00593     int yy_did_buffer_switch_on_eof;
00594     int yy_start_stack_ptr;
00595     int yy_start_stack_depth;
00596     int *yy_start_stack;
00597     yy_state_type yy_last_accepting_state;
00598     char* yy_last_accepting_cpos;
00599 
00600     int yylineno_r;
00601     int yy_flex_debug_r;
00602 
00603     char *yytext_r;
00604     int yy_more_flag;
00605     int yy_more_len;
00606 
00607     YYSTYPE * yylval_r;
00608 
00609     }; /* end struct yyguts_t */
00610 
00611 static int yy_init_globals (yyscan_t yyscanner );
00612 
00613     /* This must go here because YYSTYPE and YYLTYPE are included
00614      * from bison output in section 1.*/
00615     #    define yylval yyg->yylval_r
00616     
00617 int yylex_init (yyscan_t* scanner);
00618 
00619 int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
00620 
00621 /* Accessor methods to globals.
00622    These are made visible to non-reentrant scanners for convenience. */
00623 
00624 int yylex_destroy (yyscan_t yyscanner );
00625 
00626 int yyget_debug (yyscan_t yyscanner );
00627 
00628 void yyset_debug (int debug_flag ,yyscan_t yyscanner );
00629 
00630 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
00631 
00632 void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
00633 
00634 FILE *yyget_in (yyscan_t yyscanner );
00635 
00636 void yyset_in  (FILE * in_str ,yyscan_t yyscanner );
00637 
00638 FILE *yyget_out (yyscan_t yyscanner );
00639 
00640 void yyset_out  (FILE * out_str ,yyscan_t yyscanner );
00641 
00642 int yyget_leng (yyscan_t yyscanner );
00643 
00644 char *yyget_text (yyscan_t yyscanner );
00645 
00646 int yyget_lineno (yyscan_t yyscanner );
00647 
00648 void yyset_lineno (int line_number ,yyscan_t yyscanner );
00649 
00650 YYSTYPE * yyget_lval (yyscan_t yyscanner );
00651 
00652 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
00653 
00654 /* Macros after this point can all be overridden by user definitions in
00655  * section 1.
00656  */
00657 
00658 #ifndef YY_SKIP_YYWRAP
00659 #ifdef __cplusplus
00660 extern "C" int yywrap (yyscan_t yyscanner );
00661 #else
00662 extern int yywrap (yyscan_t yyscanner );
00663 #endif
00664 #endif
00665 
00666     static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
00667     
00668 #ifndef yytext_ptr
00669 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
00670 #endif
00671 
00672 #ifdef YY_NEED_STRLEN
00673 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
00674 #endif
00675 
00676 #ifndef YY_NO_INPUT
00677 
00678 #ifdef __cplusplus
00679 static int yyinput (yyscan_t yyscanner );
00680 #else
00681 static int input (yyscan_t yyscanner );
00682 #endif
00683 
00684 #endif
00685 
00686 /* Amount of stuff to slurp up with each read. */
00687 #ifndef YY_READ_BUF_SIZE
00688 #define YY_READ_BUF_SIZE 8192
00689 #endif
00690 
00691 /* Copy whatever the last rule matched to the standard output. */
00692 #ifndef ECHO
00693 /* This used to be an fputs(), but since the string might contain NUL's,
00694  * we now use fwrite().
00695  */
00696 #define ECHO fwrite( yytext, yyleng, 1, yyout )
00697 #endif
00698 
00699 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00700  * is returned in "result".
00701  */
00702 #ifndef YY_INPUT
00703 #define YY_INPUT(buf,result,max_size) \
00704         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00705                 { \
00706                 int c = '*'; \
00707                 int n; \
00708                 for ( n = 0; n < max_size && \
00709                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00710                         buf[n] = (char) c; \
00711                 if ( c == '\n' ) \
00712                         buf[n++] = (char) c; \
00713                 if ( c == EOF && ferror( yyin ) ) \
00714                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
00715                 result = n; \
00716                 } \
00717         else \
00718                 { \
00719                 errno=0; \
00720                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
00721                         { \
00722                         if( errno != EINTR) \
00723                                 { \
00724                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
00725                                 break; \
00726                                 } \
00727                         errno=0; \
00728                         clearerr(yyin); \
00729                         } \
00730                 }\
00731 \
00732 
00733 #endif
00734 
00735 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00736  * we don't want an extra ';' after the "return" because that will cause
00737  * some compilers to complain about unreachable statements.
00738  */
00739 #ifndef yyterminate
00740 #define yyterminate() return YY_NULL
00741 #endif
00742 
00743 /* Number of entries by which start-condition stack grows. */
00744 #ifndef YY_START_STACK_INCR
00745 #define YY_START_STACK_INCR 25
00746 #endif
00747 
00748 /* Report a fatal error. */
00749 #ifndef YY_FATAL_ERROR
00750 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
00751 #endif
00752 
00753 /* end tables serialization structures and prototypes */
00754 
00755 /* Default declaration of generated scanner - a define so the user can
00756  * easily add parameters.
00757  */
00758 #ifndef YY_DECL
00759 #define YY_DECL_IS_OURS 1
00760 
00761 extern int yylex \
00762                (YYSTYPE * yylval_param ,yyscan_t yyscanner);
00763 
00764 #define YY_DECL int yylex \
00765                (YYSTYPE * yylval_param , yyscan_t yyscanner)
00766 #endif /* !YY_DECL */
00767 
00768 /* Code executed at the beginning of each rule, after yytext and yyleng
00769  * have been set up.
00770  */
00771 #ifndef YY_USER_ACTION
00772 #define YY_USER_ACTION
00773 #endif
00774 
00775 /* Code executed at the end of each rule. */
00776 #ifndef YY_BREAK
00777 #define YY_BREAK break;
00778 #endif
00779 
00780 #define YY_RULE_SETUP \
00781         YY_USER_ACTION
00782 
00785 YY_DECL
00786 {
00787         register yy_state_type yy_current_state;
00788         register char *yy_cp, *yy_bp;
00789         register int yy_act;
00790     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
00791 
00792 #line 56 "_jsgf_scanner.l"
00793 
00794 
00795 #line 791 "jsgf_scanner.c"
00796 
00797     yylval = yylval_param;
00798 
00799         if ( !yyg->yy_init )
00800                 {
00801                 yyg->yy_init = 1;
00802 
00803 #ifdef YY_USER_INIT
00804                 YY_USER_INIT;
00805 #endif
00806 
00807                 if ( ! yyg->yy_start )
00808                         yyg->yy_start = 1;      /* first start state */
00809 
00810                 if ( ! yyin )
00811                         yyin = stdin;
00812 
00813                 if ( ! yyout )
00814                         yyout = stdout;
00815 
00816                 if ( ! YY_CURRENT_BUFFER ) {
00817                         yyensure_buffer_stack (yyscanner);
00818                         YY_CURRENT_BUFFER_LVALUE =
00819                                 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
00820                 }
00821 
00822                 yy_load_buffer_state(yyscanner );
00823                 }
00824 
00825         while ( 1 )             /* loops until end-of-file is reached */
00826                 {
00827                 yy_cp = yyg->yy_c_buf_p;
00828 
00829                 /* Support of yytext. */
00830                 *yy_cp = yyg->yy_hold_char;
00831 
00832                 /* yy_bp points to the position in yy_ch_buf of the start of
00833                  * the current run.
00834                  */
00835                 yy_bp = yy_cp;
00836 
00837                 yy_current_state = yyg->yy_start;
00838 yy_match:
00839                 do
00840                         {
00841                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00842                         if ( yy_accept[yy_current_state] )
00843                                 {
00844                                 yyg->yy_last_accepting_state = yy_current_state;
00845                                 yyg->yy_last_accepting_cpos = yy_cp;
00846                                 }
00847                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00848                                 {
00849                                 yy_current_state = (int) yy_def[yy_current_state];
00850                                 if ( yy_current_state >= 72 )
00851                                         yy_c = yy_meta[(unsigned int) yy_c];
00852                                 }
00853                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00854                         ++yy_cp;
00855                         }
00856                 while ( yy_base[yy_current_state] != 186 );
00857 
00858 yy_find_action:
00859                 yy_act = yy_accept[yy_current_state];
00860                 if ( yy_act == 0 )
00861                         { /* have to back up */
00862                         yy_cp = yyg->yy_last_accepting_cpos;
00863                         yy_current_state = yyg->yy_last_accepting_state;
00864                         yy_act = yy_accept[yy_current_state];
00865                         }
00866 
00867                 YY_DO_BEFORE_ACTION;
00868 
00869 do_action:      /* This label is used only to access EOF actions. */
00870 
00871                 switch ( yy_act )
00872         { /* beginning of action switch */
00873                         case 0: /* must back up */
00874                         /* undo the effects of YY_DO_BEFORE_ACTION */
00875                         *yy_cp = yyg->yy_hold_char;
00876                         yy_cp = yyg->yy_last_accepting_cpos;
00877                         yy_current_state = yyg->yy_last_accepting_state;
00878                         goto yy_find_action;
00879 
00880 case 1:
00881 /* rule 1 can match eol */
00882 YY_RULE_SETUP
00883 #line 58 "_jsgf_scanner.l"
00884 ;                     /* ignore whitespace */
00885         YY_BREAK
00886 case 2:
00887 /* rule 2 can match eol */
00888 YY_RULE_SETUP
00889 #line 59 "_jsgf_scanner.l"
00890 ;        /* single-line comments */
00891         YY_BREAK
00892 case 3:
00893 YY_RULE_SETUP
00894 #line 60 "_jsgf_scanner.l"
00895 { BEGIN(COMMENT); } /* C-style comments */
00896         YY_BREAK
00897 case 4:
00898 YY_RULE_SETUP
00899 #line 61 "_jsgf_scanner.l"
00900 { BEGIN(INITIAL); }
00901         YY_BREAK
00902 case 5:
00903 YY_RULE_SETUP
00904 #line 62 "_jsgf_scanner.l"
00905 ;               /* Ignore stuff in comment mode */
00906         YY_BREAK
00907 case 6:
00908 YY_RULE_SETUP
00909 #line 64 "_jsgf_scanner.l"
00910 return HEADER;
00911         YY_BREAK
00912 case 7:
00913 YY_RULE_SETUP
00914 #line 65 "_jsgf_scanner.l"
00915 return GRAMMAR;
00916         YY_BREAK
00917 case 8:
00918 YY_RULE_SETUP
00919 #line 66 "_jsgf_scanner.l"
00920 return IMPORT;
00921         YY_BREAK
00922 case 9:
00923 YY_RULE_SETUP
00924 #line 67 "_jsgf_scanner.l"
00925 return PUBLIC;
00926         YY_BREAK
00927 case 10:
00928 /* rule 10 can match eol */
00929 YY_RULE_SETUP
00930 #line 69 "_jsgf_scanner.l"
00931 { yylval->name = strdup(yytext); return RULENAME; }
00932         YY_BREAK
00933 case 11:
00934 /* rule 11 can match eol */
00935 YY_RULE_SETUP
00936 #line 70 "_jsgf_scanner.l"
00937 { yylval->name = strdup(yytext); return TAG; }
00938         YY_BREAK
00939 case 12:
00940 YY_RULE_SETUP
00941 #line 71 "_jsgf_scanner.l"
00942 { yylval->name = strdup(yytext); return TOKEN; }
00943         YY_BREAK
00944 case 13:
00945 /* rule 13 can match eol */
00946 YY_RULE_SETUP
00947 #line 72 "_jsgf_scanner.l"
00948 { yylval->name = strdup(yytext); return TOKEN; }
00949         YY_BREAK
00950 case 14:
00951 YY_RULE_SETUP
00952 #line 73 "_jsgf_scanner.l"
00953 { yylval->weight = atof_c(yytext+1); return WEIGHT; }
00954         YY_BREAK
00955 case 15:
00956 YY_RULE_SETUP
00957 #line 75 "_jsgf_scanner.l"
00958 return yytext[0];        /* Single-character tokens */
00959         YY_BREAK
00960 case 16:
00961 YY_RULE_SETUP
00962 #line 77 "_jsgf_scanner.l"
00963 ECHO;
00964         YY_BREAK
00965 #line 961 "jsgf_scanner.c"
00966 case YY_STATE_EOF(INITIAL):
00967 case YY_STATE_EOF(COMMENT):
00968         yyterminate();
00969 
00970         case YY_END_OF_BUFFER:
00971                 {
00972                 /* Amount of text matched not including the EOB char. */
00973                 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
00974 
00975                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
00976                 *yy_cp = yyg->yy_hold_char;
00977                 YY_RESTORE_YY_MORE_OFFSET
00978 
00979                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
00980                         {
00981                         /* We're scanning a new file or input source.  It's
00982                          * possible that this happened because the user
00983                          * just pointed yyin at a new source and called
00984                          * yylex().  If so, then we have to assure
00985                          * consistency between YY_CURRENT_BUFFER and our
00986                          * globals.  Here is the right place to do so, because
00987                          * this is the first action (other than possibly a
00988                          * back-up) that will match for the new input source.
00989                          */
00990                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
00991                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
00992                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
00993                         }
00994 
00995                 /* Note that here we test for yy_c_buf_p "<=" to the position
00996                  * of the first EOB in the buffer, since yy_c_buf_p will
00997                  * already have been incremented past the NUL character
00998                  * (since all states make transitions on EOB to the
00999                  * end-of-buffer state).  Contrast this with the test
01000                  * in input().
01001                  */
01002                 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01003                         { /* This was really a NUL. */
01004                         yy_state_type yy_next_state;
01005 
01006                         yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
01007 
01008                         yy_current_state = yy_get_previous_state( yyscanner );
01009 
01010                         /* Okay, we're now positioned to make the NUL
01011                          * transition.  We couldn't have
01012                          * yy_get_previous_state() go ahead and do it
01013                          * for us because it doesn't know how to deal
01014                          * with the possibility of jamming (and we don't
01015                          * want to build jamming into it because then it
01016                          * will run more slowly).
01017                          */
01018 
01019                         yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
01020 
01021                         yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01022 
01023                         if ( yy_next_state )
01024                                 {
01025                                 /* Consume the NUL. */
01026                                 yy_cp = ++yyg->yy_c_buf_p;
01027                                 yy_current_state = yy_next_state;
01028                                 goto yy_match;
01029                                 }
01030 
01031                         else
01032                                 {
01033                                 yy_cp = yyg->yy_c_buf_p;
01034                                 goto yy_find_action;
01035                                 }
01036                         }
01037 
01038                 else switch ( yy_get_next_buffer( yyscanner ) )
01039                         {
01040                         case EOB_ACT_END_OF_FILE:
01041                                 {
01042                                 yyg->yy_did_buffer_switch_on_eof = 0;
01043 
01044                                 if ( yywrap(yyscanner ) )
01045                                         {
01046                                         /* Note: because we've taken care in
01047                                          * yy_get_next_buffer() to have set up
01048                                          * yytext, we can now set up
01049                                          * yy_c_buf_p so that if some total
01050                                          * hoser (like flex itself) wants to
01051                                          * call the scanner after we return the
01052                                          * YY_NULL, it'll still work - another
01053                                          * YY_NULL will get returned.
01054                                          */
01055                                         yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
01056 
01057                                         yy_act = YY_STATE_EOF(YY_START);
01058                                         goto do_action;
01059                                         }
01060 
01061                                 else
01062                                         {
01063                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
01064                                                 YY_NEW_FILE;
01065                                         }
01066                                 break;
01067                                 }
01068 
01069                         case EOB_ACT_CONTINUE_SCAN:
01070                                 yyg->yy_c_buf_p =
01071                                         yyg->yytext_ptr + yy_amount_of_matched_text;
01072 
01073                                 yy_current_state = yy_get_previous_state( yyscanner );
01074 
01075                                 yy_cp = yyg->yy_c_buf_p;
01076                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01077                                 goto yy_match;
01078 
01079                         case EOB_ACT_LAST_MATCH:
01080                                 yyg->yy_c_buf_p =
01081                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
01082 
01083                                 yy_current_state = yy_get_previous_state( yyscanner );
01084 
01085                                 yy_cp = yyg->yy_c_buf_p;
01086                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01087                                 goto yy_find_action;
01088                         }
01089                 break;
01090                 }
01091 
01092         default:
01093                 YY_FATAL_ERROR(
01094                         "fatal flex scanner internal error--no action found" );
01095         } /* end of action switch */
01096                 } /* end of scanning one token */
01097 } /* end of yylex */
01098 
01099 /* yy_get_next_buffer - try to read in a new buffer
01100  *
01101  * Returns a code representing an action:
01102  *      EOB_ACT_LAST_MATCH -
01103  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01104  *      EOB_ACT_END_OF_FILE - end of file
01105  */
01106 static int yy_get_next_buffer (yyscan_t yyscanner)
01107 {
01108     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01109         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
01110         register char *source = yyg->yytext_ptr;
01111         register int number_to_move, i;
01112         int ret_val;
01113 
01114         if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
01115                 YY_FATAL_ERROR(
01116                 "fatal flex scanner internal error--end of buffer missed" );
01117 
01118         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
01119                 { /* Don't try to fill the buffer, so this is an EOF. */
01120                 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
01121                         {
01122                         /* We matched a single character, the EOB, so
01123                          * treat this as a final EOF.
01124                          */
01125                         return EOB_ACT_END_OF_FILE;
01126                         }
01127 
01128                 else
01129                         {
01130                         /* We matched some text prior to the EOB, first
01131                          * process it.
01132                          */
01133                         return EOB_ACT_LAST_MATCH;
01134                         }
01135                 }
01136 
01137         /* Try to read more data. */
01138 
01139         /* First move last chars to start of buffer. */
01140         number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
01141 
01142         for ( i = 0; i < number_to_move; ++i )
01143                 *(dest++) = *(source++);
01144 
01145         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01146                 /* don't do the read, it's not guaranteed to return an EOF,
01147                  * just force an EOF
01148                  */
01149                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
01150 
01151         else
01152                 {
01153                         int num_to_read =
01154                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01155 
01156                 while ( num_to_read <= 0 )
01157                         { /* Not enough room in the buffer - grow it. */
01158 
01159                         /* just a shorter name for the current buffer */
01160                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01161 
01162                         int yy_c_buf_p_offset =
01163                                 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
01164 
01165                         if ( b->yy_is_our_buffer )
01166                                 {
01167                                 int new_size = b->yy_buf_size * 2;
01168 
01169                                 if ( new_size <= 0 )
01170                                         b->yy_buf_size += b->yy_buf_size / 8;
01171                                 else
01172                                         b->yy_buf_size *= 2;
01173 
01174                                 b->yy_ch_buf = (char *)
01175                                         /* Include room in for 2 EOB chars. */
01176                                         yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
01177                                 }
01178                         else
01179                                 /* Can't grow it, we don't own it. */
01180                                 b->yy_ch_buf = 0;
01181 
01182                         if ( ! b->yy_ch_buf )
01183                                 YY_FATAL_ERROR(
01184                                 "fatal error - scanner input buffer overflow" );
01185 
01186                         yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
01187 
01188                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01189                                                 number_to_move - 1;
01190 
01191                         }
01192 
01193                 if ( num_to_read > YY_READ_BUF_SIZE )
01194                         num_to_read = YY_READ_BUF_SIZE;
01195 
01196                 /* Read in more data. */
01197                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01198                         yyg->yy_n_chars, (size_t) num_to_read );
01199 
01200                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01201                 }
01202 
01203         if ( yyg->yy_n_chars == 0 )
01204                 {
01205                 if ( number_to_move == YY_MORE_ADJ )
01206                         {
01207                         ret_val = EOB_ACT_END_OF_FILE;
01208                         yyrestart(yyin  ,yyscanner);
01209                         }
01210 
01211                 else
01212                         {
01213                         ret_val = EOB_ACT_LAST_MATCH;
01214                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01215                                 YY_BUFFER_EOF_PENDING;
01216                         }
01217                 }
01218 
01219         else
01220                 ret_val = EOB_ACT_CONTINUE_SCAN;
01221 
01222         if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
01223                 /* Extend the array by 50%, plus the number we really need. */
01224                 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
01225                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
01226                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01227                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
01228         }
01229 
01230         yyg->yy_n_chars += number_to_move;
01231         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
01232         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
01233 
01234         yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01235 
01236         return ret_val;
01237 }
01238 
01239 /* yy_get_previous_state - get the state just before the EOB char was reached */
01240 
01241     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
01242 {
01243         register yy_state_type yy_current_state;
01244         register char *yy_cp;
01245     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01246 
01247         yy_current_state = yyg->yy_start;
01248 
01249         for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
01250                 {
01251                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01252                 if ( yy_accept[yy_current_state] )
01253                         {
01254                         yyg->yy_last_accepting_state = yy_current_state;
01255                         yyg->yy_last_accepting_cpos = yy_cp;
01256                         }
01257                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01258                         {
01259                         yy_current_state = (int) yy_def[yy_current_state];
01260                         if ( yy_current_state >= 72 )
01261                                 yy_c = yy_meta[(unsigned int) yy_c];
01262                         }
01263                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01264                 }
01265 
01266         return yy_current_state;
01267 }
01268 
01269 /* yy_try_NUL_trans - try to make a transition on the NUL character
01270  *
01271  * synopsis
01272  *      next_state = yy_try_NUL_trans( current_state );
01273  */
01274     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
01275 {
01276         register int yy_is_jam;
01277     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
01278         register char *yy_cp = yyg->yy_c_buf_p;
01279 
01280         register YY_CHAR yy_c = 1;
01281         if ( yy_accept[yy_current_state] )
01282                 {
01283                 yyg->yy_last_accepting_state = yy_current_state;
01284                 yyg->yy_last_accepting_cpos = yy_cp;
01285                 }
01286         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01287                 {
01288                 yy_current_state = (int) yy_def[yy_current_state];
01289                 if ( yy_current_state >= 72 )
01290                         yy_c = yy_meta[(unsigned int) yy_c];
01291                 }
01292         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01293         yy_is_jam = (yy_current_state == 71);
01294 
01295         return yy_is_jam ? 0 : yy_current_state;
01296 }
01297 
01298     static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
01299 {
01300         register char *yy_cp;
01301     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01302 
01303     yy_cp = yyg->yy_c_buf_p;
01304 
01305         /* undo effects of setting up yytext */
01306         *yy_cp = yyg->yy_hold_char;
01307 
01308         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01309                 { /* need to shift things up to make room */
01310                 /* +2 for EOB chars. */
01311                 register int number_to_move = yyg->yy_n_chars + 2;
01312                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
01313                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
01314                 register char *source =
01315                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
01316 
01317                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01318                         *--dest = *--source;
01319 
01320                 yy_cp += (int) (dest - source);
01321                 yy_bp += (int) (dest - source);
01322                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
01323                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
01324 
01325                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01326                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
01327                 }
01328 
01329         *--yy_cp = (char) c;
01330 
01331         yyg->yytext_ptr = yy_bp;
01332         yyg->yy_hold_char = *yy_cp;
01333         yyg->yy_c_buf_p = yy_cp;
01334 }
01335 
01336 #ifndef YY_NO_INPUT
01337 #ifdef __cplusplus
01338     static int yyinput (yyscan_t yyscanner)
01339 #else
01340     static int input  (yyscan_t yyscanner)
01341 #endif
01342 
01343 {
01344         int c;
01345     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01346 
01347         *yyg->yy_c_buf_p = yyg->yy_hold_char;
01348 
01349         if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
01350                 {
01351                 /* yy_c_buf_p now points to the character we want to return.
01352                  * If this occurs *before* the EOB characters, then it's a
01353                  * valid NUL; if not, then we've hit the end of the buffer.
01354                  */
01355                 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01356                         /* This was really a NUL. */
01357                         *yyg->yy_c_buf_p = '\0';
01358 
01359                 else
01360                         { /* need more input */
01361                         int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
01362                         ++yyg->yy_c_buf_p;
01363 
01364                         switch ( yy_get_next_buffer( yyscanner ) )
01365                                 {
01366                                 case EOB_ACT_LAST_MATCH:
01367                                         /* This happens because yy_g_n_b()
01368                                          * sees that we've accumulated a
01369                                          * token and flags that we need to
01370                                          * try matching the token before
01371                                          * proceeding.  But for input(),
01372                                          * there's no matching to consider.
01373                                          * So convert the EOB_ACT_LAST_MATCH
01374                                          * to EOB_ACT_END_OF_FILE.
01375                                          */
01376 
01377                                         /* Reset buffer status. */
01378                                         yyrestart(yyin ,yyscanner);
01379 
01380                                         /*FALLTHROUGH*/
01381 
01382                                 case EOB_ACT_END_OF_FILE:
01383                                         {
01384                                         if ( yywrap(yyscanner ) )
01385                                                 return EOF;
01386 
01387                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
01388                                                 YY_NEW_FILE;
01389 #ifdef __cplusplus
01390                                         return yyinput(yyscanner);
01391 #else
01392                                         return input(yyscanner);
01393 #endif
01394                                         }
01395 
01396                                 case EOB_ACT_CONTINUE_SCAN:
01397                                         yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
01398                                         break;
01399                                 }
01400                         }
01401                 }
01402 
01403         c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
01404         *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
01405         yyg->yy_hold_char = *++yyg->yy_c_buf_p;
01406 
01407         return c;
01408 }
01409 #endif  /* ifndef YY_NO_INPUT */
01410 
01416     void yyrestart  (FILE * input_file , yyscan_t yyscanner)
01417 {
01418     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01419 
01420         if ( ! YY_CURRENT_BUFFER ){
01421         yyensure_buffer_stack (yyscanner);
01422                 YY_CURRENT_BUFFER_LVALUE =
01423             yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
01424         }
01425 
01426         yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
01427         yy_load_buffer_state(yyscanner );
01428 }
01429 
01434     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
01435 {
01436     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01437 
01438         /* TODO. We should be able to replace this entire function body
01439          * with
01440          *              yypop_buffer_state();
01441          *              yypush_buffer_state(new_buffer);
01442      */
01443         yyensure_buffer_stack (yyscanner);
01444         if ( YY_CURRENT_BUFFER == new_buffer )
01445                 return;
01446 
01447         if ( YY_CURRENT_BUFFER )
01448                 {
01449                 /* Flush out information for old buffer. */
01450                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
01451                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01452                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01453                 }
01454 
01455         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01456         yy_load_buffer_state(yyscanner );
01457 
01458         /* We don't actually know whether we did this switch during
01459          * EOF (yywrap()) processing, but the only time this flag
01460          * is looked at is after yywrap() is called, so it's safe
01461          * to go ahead and always set it.
01462          */
01463         yyg->yy_did_buffer_switch_on_eof = 1;
01464 }
01465 
01466 static void yy_load_buffer_state  (yyscan_t yyscanner)
01467 {
01468     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01469         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01470         yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01471         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01472         yyg->yy_hold_char = *yyg->yy_c_buf_p;
01473 }
01474 
01481     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
01482 {
01483         YY_BUFFER_STATE b;
01484     
01485         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01486         if ( ! b )
01487                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01488 
01489         b->yy_buf_size = size;
01490 
01491         /* yy_ch_buf has to be 2 characters longer than the size given because
01492          * we need to put in 2 end-of-buffer characters.
01493          */
01494         b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
01495         if ( ! b->yy_ch_buf )
01496                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01497 
01498         b->yy_is_our_buffer = 1;
01499 
01500         yy_init_buffer(b,file ,yyscanner);
01501 
01502         return b;
01503 }
01504 
01509     void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01510 {
01511     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01512 
01513         if ( ! b )
01514                 return;
01515 
01516         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01517                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01518 
01519         if ( b->yy_is_our_buffer )
01520                 yyfree((void *) b->yy_ch_buf ,yyscanner );
01521 
01522         yyfree((void *) b ,yyscanner );
01523 }
01524 
01525 #ifndef __cplusplus
01526 extern int isatty (int );
01527 #endif /* __cplusplus */
01528     
01529 /* Initializes or reinitializes a buffer.
01530  * This function is sometimes called more than once on the same buffer,
01531  * such as during a yyrestart() or at EOF.
01532  */
01533     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
01534 
01535 {
01536         int oerrno = errno;
01537     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01538 
01539         yy_flush_buffer(b ,yyscanner);
01540 
01541         b->yy_input_file = file;
01542         b->yy_fill_buffer = 1;
01543 
01544     /* If b is the current buffer, then yy_init_buffer was _probably_
01545      * called from yyrestart() or through yy_get_next_buffer.
01546      * In that case, we don't want to reset the lineno or column.
01547      */
01548     if (b != YY_CURRENT_BUFFER){
01549         b->yy_bs_lineno = 1;
01550         b->yy_bs_column = 0;
01551     }
01552 
01553         #if !defined(_WIN32_WCE)
01554       b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01555     #else
01556       b->yy_is_interactive = 0;
01557     #endif
01558 
01559         errno = oerrno;
01560 }
01561 
01566     void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01567 {
01568     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01569         if ( ! b )
01570                 return;
01571 
01572         b->yy_n_chars = 0;
01573 
01574         /* We always need two end-of-buffer characters.  The first causes
01575          * a transition to the end-of-buffer state.  The second causes
01576          * a jam in that state.
01577          */
01578         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01579         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01580 
01581         b->yy_buf_pos = &b->yy_ch_buf[0];
01582 
01583         b->yy_at_bol = 1;
01584         b->yy_buffer_status = YY_BUFFER_NEW;
01585 
01586         if ( b == YY_CURRENT_BUFFER )
01587                 yy_load_buffer_state(yyscanner );
01588 }
01589 
01596 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
01597 {
01598     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01599         if (new_buffer == NULL)
01600                 return;
01601 
01602         yyensure_buffer_stack(yyscanner);
01603 
01604         /* This block is copied from yy_switch_to_buffer. */
01605         if ( YY_CURRENT_BUFFER )
01606                 {
01607                 /* Flush out information for old buffer. */
01608                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
01609                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01610                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01611                 }
01612 
01613         /* Only push if top exists. Otherwise, replace top. */
01614         if (YY_CURRENT_BUFFER)
01615                 yyg->yy_buffer_stack_top++;
01616         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01617 
01618         /* copied from yy_switch_to_buffer. */
01619         yy_load_buffer_state(yyscanner );
01620         yyg->yy_did_buffer_switch_on_eof = 1;
01621 }
01622 
01627 void yypop_buffer_state (yyscan_t yyscanner)
01628 {
01629     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01630         if (!YY_CURRENT_BUFFER)
01631                 return;
01632 
01633         yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
01634         YY_CURRENT_BUFFER_LVALUE = NULL;
01635         if (yyg->yy_buffer_stack_top > 0)
01636                 --yyg->yy_buffer_stack_top;
01637 
01638         if (YY_CURRENT_BUFFER) {
01639                 yy_load_buffer_state(yyscanner );
01640                 yyg->yy_did_buffer_switch_on_eof = 1;
01641         }
01642 }
01643 
01644 /* Allocates the stack if it does not exist.
01645  *  Guarantees space for at least one push.
01646  */
01647 static void yyensure_buffer_stack (yyscan_t yyscanner)
01648 {
01649         int num_to_alloc;
01650     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01651 
01652         if (!yyg->yy_buffer_stack) {
01653 
01654                 /* First allocation is just for 2 elements, since we don't know if this
01655                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
01656                  * immediate realloc on the next call.
01657          */
01658                 num_to_alloc = 1;
01659                 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
01660                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01661                                                                 , yyscanner);
01662                 if ( ! yyg->yy_buffer_stack )
01663                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
01664                                                                   
01665                 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01666                                 
01667                 yyg->yy_buffer_stack_max = num_to_alloc;
01668                 yyg->yy_buffer_stack_top = 0;
01669                 return;
01670         }
01671 
01672         if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
01673 
01674                 /* Increase the buffer to prepare for a possible push. */
01675                 int grow_size = 8 /* arbitrary grow size */;
01676 
01677                 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
01678                 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
01679                                                                 (yyg->yy_buffer_stack,
01680                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
01681                                                                 , yyscanner);
01682                 if ( ! yyg->yy_buffer_stack )
01683                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
01684 
01685                 /* zero only the new slots.*/
01686                 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
01687                 yyg->yy_buffer_stack_max = num_to_alloc;
01688         }
01689 }
01690 
01697 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
01698 {
01699         YY_BUFFER_STATE b;
01700     
01701         if ( size < 2 ||
01702              base[size-2] != YY_END_OF_BUFFER_CHAR ||
01703              base[size-1] != YY_END_OF_BUFFER_CHAR )
01704                 /* They forgot to leave room for the EOB's. */
01705                 return 0;
01706 
01707         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01708         if ( ! b )
01709                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
01710 
01711         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
01712         b->yy_buf_pos = b->yy_ch_buf = base;
01713         b->yy_is_our_buffer = 0;
01714         b->yy_input_file = 0;
01715         b->yy_n_chars = b->yy_buf_size;
01716         b->yy_is_interactive = 0;
01717         b->yy_at_bol = 1;
01718         b->yy_fill_buffer = 0;
01719         b->yy_buffer_status = YY_BUFFER_NEW;
01720 
01721         yy_switch_to_buffer(b ,yyscanner );
01722 
01723         return b;
01724 }
01725 
01734 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
01735 {
01736     
01737         return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
01738 }
01739 
01747 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
01748 {
01749         YY_BUFFER_STATE b;
01750         char *buf;
01751         yy_size_t n;
01752         int i;
01753     
01754         /* Get memory for full buffer, including space for trailing EOB's. */
01755         n = _yybytes_len + 2;
01756         buf = (char *) yyalloc(n ,yyscanner );
01757         if ( ! buf )
01758                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
01759 
01760         for ( i = 0; i < _yybytes_len; ++i )
01761                 buf[i] = yybytes[i];
01762 
01763         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
01764 
01765         b = yy_scan_buffer(buf,n ,yyscanner);
01766         if ( ! b )
01767                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
01768 
01769         /* It's okay to grow etc. this buffer, and we should throw it
01770          * away when we're done.
01771          */
01772         b->yy_is_our_buffer = 1;
01773 
01774         return b;
01775 }
01776 
01777 #ifndef YY_EXIT_FAILURE
01778 #define YY_EXIT_FAILURE 2
01779 #endif
01780 
01781 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
01782 {
01783         (void) fprintf( stderr, "%s\n", msg );
01784         exit( YY_EXIT_FAILURE );
01785 }
01786 
01787 /* Redefine yyless() so it works in section 3 code. */
01788 
01789 #undef yyless
01790 #define yyless(n) \
01791         do \
01792                 { \
01793                 /* Undo effects of setting up yytext. */ \
01794         int yyless_macro_arg = (n); \
01795         YY_LESS_LINENO(yyless_macro_arg);\
01796                 yytext[yyleng] = yyg->yy_hold_char; \
01797                 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
01798                 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
01799                 *yyg->yy_c_buf_p = '\0'; \
01800                 yyleng = yyless_macro_arg; \
01801                 } \
01802         while ( 0 )
01803 
01804 /* Accessor  methods (get/set functions) to struct members. */
01805 
01809 YY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)
01810 {
01811     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01812     return yyextra;
01813 }
01814 
01818 int yyget_lineno  (yyscan_t yyscanner)
01819 {
01820     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01821     
01822         if (! YY_CURRENT_BUFFER)
01823             return 0;
01824     
01825     return yylineno;
01826 }
01827 
01831 int yyget_column  (yyscan_t yyscanner)
01832 {
01833     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01834     
01835         if (! YY_CURRENT_BUFFER)
01836             return 0;
01837     
01838     return yycolumn;
01839 }
01840 
01844 FILE *yyget_in  (yyscan_t yyscanner)
01845 {
01846     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01847     return yyin;
01848 }
01849 
01853 FILE *yyget_out  (yyscan_t yyscanner)
01854 {
01855     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01856     return yyout;
01857 }
01858 
01862 int yyget_leng  (yyscan_t yyscanner)
01863 {
01864     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01865     return yyleng;
01866 }
01867 
01872 char *yyget_text  (yyscan_t yyscanner)
01873 {
01874     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01875     return yytext;
01876 }
01877 
01882 void yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
01883 {
01884     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01885     yyextra = user_defined ;
01886 }
01887 
01892 void yyset_lineno (int  line_number , yyscan_t yyscanner)
01893 {
01894     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01895 
01896         /* lineno is only valid if an input buffer exists. */
01897         if (! YY_CURRENT_BUFFER )
01898            yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); 
01899     
01900     yylineno = line_number;
01901 }
01902 
01907 void yyset_column (int  column_no , yyscan_t yyscanner)
01908 {
01909     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01910 
01911         /* column is only valid if an input buffer exists. */
01912         if (! YY_CURRENT_BUFFER )
01913            yy_fatal_error( "yyset_column called with no buffer" , yyscanner); 
01914     
01915     yycolumn = column_no;
01916 }
01917 
01924 void yyset_in (FILE *  in_str , yyscan_t yyscanner)
01925 {
01926     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01927     yyin = in_str ;
01928 }
01929 
01930 void yyset_out (FILE *  out_str , yyscan_t yyscanner)
01931 {
01932     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01933     yyout = out_str ;
01934 }
01935 
01936 int yyget_debug  (yyscan_t yyscanner)
01937 {
01938     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01939     return yy_flex_debug;
01940 }
01941 
01942 void yyset_debug (int  bdebug , yyscan_t yyscanner)
01943 {
01944     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01945     yy_flex_debug = bdebug ;
01946 }
01947 
01948 /* Accessor methods for yylval and yylloc */
01949 
01950 YYSTYPE * yyget_lval  (yyscan_t yyscanner)
01951 {
01952     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01953     return yylval;
01954 }
01955 
01956 void yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
01957 {
01958     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01959     yylval = yylval_param;
01960 }
01961 
01962 /* User-visible API */
01963 
01964 /* yylex_init is special because it creates the scanner itself, so it is
01965  * the ONLY reentrant function that doesn't take the scanner as the last argument.
01966  * That's why we explicitly handle the declaration, instead of using our macros.
01967  */
01968 
01969 int yylex_init(yyscan_t* ptr_yy_globals)
01970 
01971 {
01972     if (ptr_yy_globals == NULL){
01973         errno = EINVAL;
01974         return 1;
01975     }
01976 
01977     *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
01978 
01979     if (*ptr_yy_globals == NULL){
01980         errno = ENOMEM;
01981         return 1;
01982     }
01983 
01984     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
01985     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
01986 
01987     return yy_init_globals ( *ptr_yy_globals );
01988 }
01989 
01990 /* yylex_init_extra has the same functionality as yylex_init, but follows the
01991  * convention of taking the scanner as the last argument. Note however, that
01992  * this is a *pointer* to a scanner, as it will be allocated by this call (and
01993  * is the reason, too, why this function also must handle its own declaration).
01994  * The user defined value in the first argument will be available to yyalloc in
01995  * the yyextra field.
01996  */
01997 
01998 int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
01999 
02000 {
02001     struct yyguts_t dummy_yyguts;
02002 
02003     yyset_extra (yy_user_defined, &dummy_yyguts);
02004 
02005     if (ptr_yy_globals == NULL){
02006         errno = EINVAL;
02007         return 1;
02008     }
02009         
02010     *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
02011         
02012     if (*ptr_yy_globals == NULL){
02013         errno = ENOMEM;
02014         return 1;
02015     }
02016     
02017     /* By setting to 0xAA, we expose bugs in
02018     yy_init_globals. Leave at 0x00 for releases. */
02019     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02020     
02021     yyset_extra (yy_user_defined, *ptr_yy_globals);
02022     
02023     return yy_init_globals ( *ptr_yy_globals );
02024 }
02025 
02026 static int yy_init_globals (yyscan_t yyscanner)
02027 {
02028     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02029     /* Initialization is the same as for the non-reentrant scanner.
02030      * This function is called from yylex_destroy(), so don't allocate here.
02031      */
02032 
02033     yyg->yy_buffer_stack = 0;
02034     yyg->yy_buffer_stack_top = 0;
02035     yyg->yy_buffer_stack_max = 0;
02036     yyg->yy_c_buf_p = (char *) 0;
02037     yyg->yy_init = 0;
02038     yyg->yy_start = 0;
02039 
02040     yyg->yy_start_stack_ptr = 0;
02041     yyg->yy_start_stack_depth = 0;
02042     yyg->yy_start_stack =  NULL;
02043 
02044 /* Defined in main.c */
02045 #ifdef YY_STDINIT
02046     yyin = stdin;
02047     yyout = stdout;
02048 #else
02049     yyin = (FILE *) 0;
02050     yyout = (FILE *) 0;
02051 #endif
02052 
02053     /* For future reference: Set errno on error, since we are called by
02054      * yylex_init()
02055      */
02056     return 0;
02057 }
02058 
02059 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
02060 int yylex_destroy  (yyscan_t yyscanner)
02061 {
02062     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02063 
02064     /* Pop the buffer stack, destroying each element. */
02065         while(YY_CURRENT_BUFFER){
02066                 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
02067                 YY_CURRENT_BUFFER_LVALUE = NULL;
02068                 yypop_buffer_state(yyscanner);
02069         }
02070 
02071         /* Destroy the stack itself. */
02072         yyfree(yyg->yy_buffer_stack ,yyscanner);
02073         yyg->yy_buffer_stack = NULL;
02074 
02075     /* Destroy the start condition stack. */
02076         yyfree(yyg->yy_start_stack ,yyscanner );
02077         yyg->yy_start_stack = NULL;
02078 
02079     /* Reset the globals. This is important in a non-reentrant scanner so the next time
02080      * yylex() is called, initialization will occur. */
02081     yy_init_globals( yyscanner);
02082 
02083     /* Destroy the main struct (reentrant only). */
02084     yyfree ( yyscanner , yyscanner );
02085     yyscanner = NULL;
02086     return 0;
02087 }
02088 
02089 /*
02090  * Internal utility routines.
02091  */
02092 
02093 #ifndef yytext_ptr
02094 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
02095 {
02096         register int i;
02097         for ( i = 0; i < n; ++i )
02098                 s1[i] = s2[i];
02099 }
02100 #endif
02101 
02102 #ifdef YY_NEED_STRLEN
02103 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
02104 {
02105         register int n;
02106         for ( n = 0; s[n]; ++n )
02107                 ;
02108 
02109         return n;
02110 }
02111 #endif
02112 
02113 void *yyalloc (yy_size_t  size , yyscan_t yyscanner)
02114 {
02115         return (void *) malloc( size );
02116 }
02117 
02118 void *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
02119 {
02120         /* The cast to (char *) in the following accommodates both
02121          * implementations that use char* generic pointers, and those
02122          * that use void* generic pointers.  It works with the latter
02123          * because both ANSI C and C++ allow castless assignment from
02124          * any pointer type to void*, and deal with argument conversions
02125          * as though doing an assignment.
02126          */
02127         return (void *) realloc( (char *) ptr, size );
02128 }
02129 
02130 void yyfree (void * ptr , yyscan_t yyscanner)
02131 {
02132         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
02133 }
02134 
02135 #define YYTABLES_NAME "yytables"
02136 
02137 #line 77 "_jsgf_scanner.l"
02138 
02139 
02140 

Generated on Mon Jan 24 21:36:19 2011 for SphinxBase by  doxygen 1.4.7