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