|
k-dot-p 0.1
|
00001 00002 #line 3 "kdotp/structspec_lexer.c++" 00003 00004 #define YY_INT_ALIGNED short int 00005 00006 /* A lexical scanner generated by flex */ 00007 00008 #define FLEX_SCANNER 00009 #define YY_FLEX_MAJOR_VERSION 2 00010 #define YY_FLEX_MINOR_VERSION 5 00011 #define YY_FLEX_SUBMINOR_VERSION 35 00012 #if YY_FLEX_SUBMINOR_VERSION > 0 00013 #define FLEX_BETA 00014 #endif 00015 00016 /* First, we deal with platform-specific or compiler-specific issues. */ 00017 00018 /* begin standard C headers. */ 00019 #include <stdio.h> 00020 #include <string.h> 00021 #include <errno.h> 00022 #include <stdlib.h> 00023 00024 /* end standard C headers. */ 00025 00026 /* flex integer type definitions */ 00027 00028 #ifndef FLEXINT_H 00029 #define FLEXINT_H 00030 00031 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 00032 00033 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 00034 00035 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 00036 * if you want the limit (max/min) macros for int types. 00037 */ 00038 #ifndef __STDC_LIMIT_MACROS 00039 #define __STDC_LIMIT_MACROS 1 00040 #endif 00041 00042 #include <inttypes.h> 00043 typedef int8_t flex_int8_t; 00044 typedef uint8_t flex_uint8_t; 00045 typedef int16_t flex_int16_t; 00046 typedef uint16_t flex_uint16_t; 00047 typedef int32_t flex_int32_t; 00048 typedef uint32_t flex_uint32_t; 00049 #else 00050 typedef signed char flex_int8_t; 00051 typedef short int flex_int16_t; 00052 typedef int flex_int32_t; 00053 typedef unsigned char flex_uint8_t; 00054 typedef unsigned short int flex_uint16_t; 00055 typedef unsigned int flex_uint32_t; 00056 00057 /* Limits of integral types. */ 00058 #ifndef INT8_MIN 00059 #define INT8_MIN (-128) 00060 #endif 00061 #ifndef INT16_MIN 00062 #define INT16_MIN (-32767-1) 00063 #endif 00064 #ifndef INT32_MIN 00065 #define INT32_MIN (-2147483647-1) 00066 #endif 00067 #ifndef INT8_MAX 00068 #define INT8_MAX (127) 00069 #endif 00070 #ifndef INT16_MAX 00071 #define INT16_MAX (32767) 00072 #endif 00073 #ifndef INT32_MAX 00074 #define INT32_MAX (2147483647) 00075 #endif 00076 #ifndef UINT8_MAX 00077 #define UINT8_MAX (255U) 00078 #endif 00079 #ifndef UINT16_MAX 00080 #define UINT16_MAX (65535U) 00081 #endif 00082 #ifndef UINT32_MAX 00083 #define UINT32_MAX (4294967295U) 00084 #endif 00085 00086 #endif /* ! C99 */ 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 /* Enter a start condition. This macro really ought to take a parameter, 00122 * but we do it the disgusting crufty way forced on us by the ()-less 00123 * definition of BEGIN. 00124 */ 00125 #define BEGIN (yy_start) = 1 + 2 * 00126 00127 /* Translate the current start state into a value that can be later handed 00128 * to BEGIN to return to the state. The YYSTATE alias is for lex 00129 * compatibility. 00130 */ 00131 #define YY_START (((yy_start) - 1) / 2) 00132 #define YYSTATE YY_START 00133 00134 /* Action number for EOF rule of a given start state. */ 00135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 00136 00137 /* Special action meaning "start processing a new file". */ 00138 #define YY_NEW_FILE yyrestart(yyin ) 00139 00140 #define YY_END_OF_BUFFER_CHAR 0 00141 00142 /* Size of default input buffer. */ 00143 #ifndef YY_BUF_SIZE 00144 #ifdef __ia64__ 00145 /* On IA-64, the buffer size is 16k, not 8k. 00146 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 00147 * Ditto for the __ia64__ case accordingly. 00148 */ 00149 #define YY_BUF_SIZE 32768 00150 #else 00151 #define YY_BUF_SIZE 16384 00152 #endif /* __ia64__ */ 00153 #endif 00154 00155 /* The state buf must be large enough to hold one state per character in the main buffer. 00156 */ 00157 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 00158 00159 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 00160 #define YY_TYPEDEF_YY_BUFFER_STATE 00161 typedef struct yy_buffer_state *YY_BUFFER_STATE; 00162 #endif 00163 00164 extern int yyleng; 00165 00166 extern FILE *yyin, *yyout; 00167 00168 #define EOB_ACT_CONTINUE_SCAN 0 00169 #define EOB_ACT_END_OF_FILE 1 00170 #define EOB_ACT_LAST_MATCH 2 00171 00172 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires 00173 * access to the local variable yy_act. Since yyless() is a macro, it would break 00174 * existing scanners that call yyless() from OUTSIDE yylex. 00175 * One obvious solution it to make yy_act a global. I tried that, and saw 00176 * a 5% performance hit in a non-yylineno scanner, because yy_act is 00177 * normally declared as a register variable-- so it is not worth it. 00178 */ 00179 #define YY_LESS_LINENO(n) \ 00180 do { \ 00181 int yyl;\ 00182 for ( yyl = n; yyl < yyleng; ++yyl )\ 00183 if ( yytext[yyl] == '\n' )\ 00184 --yylineno;\ 00185 }while(0) 00186 00187 /* Return all but the first "n" matched characters back to the input stream. */ 00188 #define yyless(n) \ 00189 do \ 00190 { \ 00191 /* Undo effects of setting up yytext. */ \ 00192 int yyless_macro_arg = (n); \ 00193 YY_LESS_LINENO(yyless_macro_arg);\ 00194 *yy_cp = (yy_hold_char); \ 00195 YY_RESTORE_YY_MORE_OFFSET \ 00196 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 00197 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 00198 } \ 00199 while ( 0 ) 00200 00201 #define unput(c) yyunput( c, (yytext_ptr) ) 00202 00203 #ifndef YY_TYPEDEF_YY_SIZE_T 00204 #define YY_TYPEDEF_YY_SIZE_T 00205 typedef size_t yy_size_t; 00206 #endif 00207 00208 #ifndef YY_STRUCT_YY_BUFFER_STATE 00209 #define YY_STRUCT_YY_BUFFER_STATE 00210 struct yy_buffer_state 00211 { 00212 FILE *yy_input_file; 00213 00214 char *yy_ch_buf; /* input buffer */ 00215 char *yy_buf_pos; /* current position in input buffer */ 00216 00217 /* Size of input buffer in bytes, not including room for EOB 00218 * characters. 00219 */ 00220 yy_size_t yy_buf_size; 00221 00222 /* Number of characters read into yy_ch_buf, not including EOB 00223 * characters. 00224 */ 00225 int yy_n_chars; 00226 00227 /* Whether we "own" the buffer - i.e., we know we created it, 00228 * and can realloc() it to grow it, and should free() it to 00229 * delete it. 00230 */ 00231 int yy_is_our_buffer; 00232 00233 /* Whether this is an "interactive" input source; if so, and 00234 * if we're using stdio for input, then we want to use getc() 00235 * instead of fread(), to make sure we stop fetching input after 00236 * each newline. 00237 */ 00238 int yy_is_interactive; 00239 00240 /* Whether we're considered to be at the beginning of a line. 00241 * If so, '^' rules will be active on the next match, otherwise 00242 * not. 00243 */ 00244 int yy_at_bol; 00245 00246 int yy_bs_lineno; /**< The line count. */ 00247 int yy_bs_column; /**< The column count. */ 00248 00249 /* Whether to try to fill the input buffer when we reach the 00250 * end of it. 00251 */ 00252 int yy_fill_buffer; 00253 00254 int yy_buffer_status; 00255 00256 #define YY_BUFFER_NEW 0 00257 #define YY_BUFFER_NORMAL 1 00258 /* When an EOF's been seen but there's still some text to process 00259 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 00260 * shouldn't try reading from the input source any more. We might 00261 * still have a bunch of tokens to match, though, because of 00262 * possible backing-up. 00263 * 00264 * When we actually see the EOF, we change the status to "new" 00265 * (via yyrestart()), so that the user can continue scanning by 00266 * just pointing yyin at a new input file. 00267 */ 00268 #define YY_BUFFER_EOF_PENDING 2 00269 00270 }; 00271 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 00272 00273 /* Stack of input buffers. */ 00274 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 00275 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 00276 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 00277 00278 /* We provide macros for accessing buffer states in case in the 00279 * future we want to put the buffer states in a more general 00280 * "scanner state". 00281 * 00282 * Returns the top of the stack, or NULL. 00283 */ 00284 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 00285 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 00286 : NULL) 00287 00288 /* Same as previous macro, but useful when we know that the buffer stack is not 00289 * NULL or when we need an lvalue. For internal use only. 00290 */ 00291 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 00292 00293 /* yy_hold_char holds the character lost when yytext is formed. */ 00294 static char yy_hold_char; 00295 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 00296 int yyleng; 00297 00298 /* Points to current character in buffer. */ 00299 static char *yy_c_buf_p = (char *) 0; 00300 static int yy_init = 0; /* whether we need to initialize */ 00301 static int yy_start = 0; /* start state number */ 00302 00303 /* Flag which is used to allow yywrap()'s to do buffer switches 00304 * instead of setting up a fresh yyin. A bit of a hack ... 00305 */ 00306 static int yy_did_buffer_switch_on_eof; 00307 00308 void yyrestart (FILE *input_file ); 00309 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 00310 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 00311 void yy_delete_buffer (YY_BUFFER_STATE b ); 00312 void yy_flush_buffer (YY_BUFFER_STATE b ); 00313 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 00314 void yypop_buffer_state (void ); 00315 00316 static void yyensure_buffer_stack (void ); 00317 static void yy_load_buffer_state (void ); 00318 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 00319 00320 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 00321 00322 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 00323 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 00324 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); 00325 00326 void *yyalloc (yy_size_t ); 00327 void *yyrealloc (void *,yy_size_t ); 00328 void yyfree (void * ); 00329 00330 #define yy_new_buffer yy_create_buffer 00331 00332 #define yy_set_interactive(is_interactive) \ 00333 { \ 00334 if ( ! YY_CURRENT_BUFFER ){ \ 00335 yyensure_buffer_stack (); \ 00336 YY_CURRENT_BUFFER_LVALUE = \ 00337 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 00338 } \ 00339 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 00340 } 00341 00342 #define yy_set_bol(at_bol) \ 00343 { \ 00344 if ( ! YY_CURRENT_BUFFER ){\ 00345 yyensure_buffer_stack (); \ 00346 YY_CURRENT_BUFFER_LVALUE = \ 00347 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 00348 } \ 00349 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 00350 } 00351 00352 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 00353 00354 /* Begin user sect3 */ 00355 00356 #define yywrap(n) 1 00357 #define YY_SKIP_YYWRAP 00358 00359 typedef unsigned char YY_CHAR; 00360 00361 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 00362 00363 typedef int yy_state_type; 00364 00365 extern int yylineno; 00366 00367 int yylineno = 1; 00368 00369 extern char *yytext; 00370 #define yytext_ptr yytext 00371 00372 static yy_state_type yy_get_previous_state (void ); 00373 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 00374 static int yy_get_next_buffer (void ); 00375 static void yy_fatal_error (yyconst char msg[] ); 00376 00377 /* Done after the current pattern has been matched and before the 00378 * corresponding action - sets up yytext. 00379 */ 00380 #define YY_DO_BEFORE_ACTION \ 00381 (yytext_ptr) = yy_bp; \ 00382 yyleng = (size_t) (yy_cp - yy_bp); \ 00383 (yy_hold_char) = *yy_cp; \ 00384 *yy_cp = '\0'; \ 00385 (yy_c_buf_p) = yy_cp; 00386 00387 #define YY_NUM_RULES 29 00388 #define YY_END_OF_BUFFER 30 00389 /* This struct is not used in this scanner, 00390 but its presence is necessary. */ 00391 struct yy_trans_info 00392 { 00393 flex_int32_t yy_verify; 00394 flex_int32_t yy_nxt; 00395 }; 00396 static yyconst flex_int16_t yy_accept[101] = 00397 { 0, 00398 0, 0, 0, 0, 0, 0, 30, 28, 26, 27, 00399 7, 13, 28, 4, 5, 25, 25, 6, 25, 25, 00400 25, 25, 25, 25, 25, 25, 25, 25, 8, 8, 00401 11, 12, 15, 14, 3, 1, 4, 0, 25, 6, 00402 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 00403 8, 9, 10, 0, 1, 0, 2, 25, 25, 25, 00404 25, 25, 25, 25, 25, 0, 3, 25, 25, 25, 00405 17, 25, 25, 25, 25, 25, 21, 25, 25, 25, 00406 19, 25, 25, 25, 23, 25, 18, 25, 25, 25, 00407 25, 25, 25, 22, 25, 25, 20, 24, 16, 0 00408 00409 } ; 00410 00411 static yyconst flex_int32_t yy_ec[256] = 00412 { 0, 00413 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 00414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00416 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, 00417 1, 1, 6, 1, 6, 7, 1, 8, 8, 8, 00418 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 00419 1, 1, 1, 1, 9, 10, 10, 10, 11, 10, 00420 10, 10, 10, 12, 10, 10, 10, 10, 10, 10, 00421 10, 10, 10, 10, 10, 13, 10, 10, 10, 10, 00422 1, 14, 1, 1, 10, 1, 15, 10, 16, 17, 00423 00424 18, 10, 19, 20, 21, 10, 10, 22, 23, 24, 00425 25, 26, 10, 27, 28, 29, 30, 10, 10, 10, 00426 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 00427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00434 00435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00439 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00440 1, 1, 1, 1, 1 00441 } ; 00442 00443 static yyconst flex_int32_t yy_meta[31] = 00444 { 0, 00445 1, 1, 1, 2, 1, 1, 1, 3, 3, 3, 00446 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 00447 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 00448 } ; 00449 00450 static yyconst flex_int16_t yy_base[105] = 00451 { 0, 00452 0, 0, 28, 30, 128, 127, 129, 132, 132, 132, 00453 132, 132, 120, 28, 0, 0, 107, 0, 22, 101, 00454 25, 98, 101, 100, 97, 103, 20, 97, 0, 0, 00455 132, 37, 132, 132, 37, 42, 50, 48, 0, 0, 00456 92, 94, 91, 97, 94, 0, 85, 94, 97, 84, 00457 0, 132, 132, 56, 55, 102, 101, 79, 79, 85, 00458 88, 86, 82, 76, 71, 92, 91, 80, 68, 72, 00459 0, 71, 69, 75, 76, 63, 75, 70, 59, 63, 00460 0, 57, 64, 60, 0, 62, 0, 51, 57, 42, 00461 55, 42, 43, 0, 43, 41, 0, 0, 0, 132, 00462 00463 73, 76, 40, 79 00464 } ; 00465 00466 static yyconst flex_int16_t yy_def[105] = 00467 { 0, 00468 100, 1, 101, 101, 102, 102, 100, 100, 100, 100, 00469 100, 100, 100, 100, 103, 103, 103, 103, 103, 103, 00470 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 00471 100, 100, 100, 100, 100, 100, 100, 100, 103, 103, 00472 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 00473 104, 100, 100, 100, 100, 100, 100, 103, 103, 103, 00474 103, 103, 103, 103, 103, 100, 100, 103, 103, 103, 00475 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 00476 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 00477 103, 103, 103, 103, 103, 103, 103, 103, 103, 0, 00478 00479 100, 100, 100, 100 00480 } ; 00481 00482 static yyconst flex_int16_t yy_nxt[163] = 00483 { 0, 00484 8, 9, 10, 11, 12, 8, 13, 14, 15, 16, 00485 17, 18, 16, 8, 16, 19, 20, 21, 22, 16, 00486 16, 16, 23, 24, 16, 25, 26, 27, 16, 28, 00487 30, 31, 30, 31, 36, 37, 41, 40, 38, 49, 00488 52, 32, 39, 32, 35, 38, 42, 54, 50, 55, 00489 53, 44, 38, 56, 54, 57, 36, 37, 99, 38, 00490 38, 66, 55, 67, 98, 38, 97, 38, 96, 95, 00491 94, 93, 38, 29, 29, 29, 33, 33, 33, 51, 00492 92, 51, 91, 90, 89, 88, 87, 86, 85, 84, 00493 83, 82, 81, 80, 79, 78, 77, 76, 67, 67, 00494 00495 75, 74, 73, 72, 71, 70, 69, 68, 57, 57, 00496 65, 64, 63, 62, 61, 40, 60, 59, 58, 46, 00497 48, 47, 46, 46, 45, 43, 40, 35, 100, 34, 00498 34, 7, 100, 100, 100, 100, 100, 100, 100, 100, 00499 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 00500 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 00501 100, 100 00502 } ; 00503 00504 static yyconst flex_int16_t yy_chk[163] = 00505 { 0, 00506 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00509 3, 3, 4, 4, 14, 14, 19, 21, 14, 27, 00510 32, 3, 103, 4, 35, 14, 19, 35, 27, 36, 00511 32, 21, 36, 38, 35, 38, 37, 37, 96, 36, 00512 37, 54, 55, 54, 95, 55, 93, 37, 92, 91, 00513 90, 89, 55, 101, 101, 101, 102, 102, 102, 104, 00514 88, 104, 86, 84, 83, 82, 80, 79, 78, 77, 00515 76, 75, 74, 73, 72, 70, 69, 68, 67, 66, 00516 00517 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 00518 50, 49, 48, 47, 45, 44, 43, 42, 41, 28, 00519 26, 25, 24, 23, 22, 20, 17, 13, 7, 6, 00520 5, 100, 100, 100, 100, 100, 100, 100, 100, 100, 00521 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 00522 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 00523 100, 100 00524 } ; 00525 00526 /* Table of booleans, true if rule could match eol. */ 00527 static yyconst flex_int32_t yy_rule_can_match_eol[30] = 00528 { 0, 00529 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 00530 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, }; 00531 00532 static yy_state_type yy_last_accepting_state; 00533 static char *yy_last_accepting_cpos; 00534 00535 extern int yy_flex_debug; 00536 int yy_flex_debug = 0; 00537 00538 /* The intent behind this definition is that it'll catch 00539 * any uses of REJECT which flex missed. 00540 */ 00541 #define REJECT reject_used_but_not_detected 00542 #define yymore() yymore_used_but_not_detected 00543 #define YY_MORE_ADJ 0 00544 #define YY_RESTORE_YY_MORE_OFFSET 00545 char *yytext; 00546 #line 1 "structspec_lexer.l++" 00547 #line 3 "structspec_lexer.l++" 00548 /* 00549 * 00550 00551 Copyright (C) 2009 Joseph Pingenot 00552 00553 This program is free software: you can redistribute it and/or modify 00554 it under the terms of the GNU Affero General Public License as published by 00555 the Free Software Foundation, either version 3 of the License, or 00556 (at your option) any later version. 00557 00558 This program is distributed in the hope that it will be useful, 00559 but WITHOUT ANY WARRANTY; without even the implied warranty of 00560 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00561 GNU Affero General Public License for more details. 00562 00563 You should have received a copy of the GNU Affero General Public License 00564 along with this program. If not, see <http://www.gnu.org/licenses/>. 00565 00566 */ 00567 00568 #include <string.h> 00569 #include <stdlib.h> 00570 #include <glib.h> 00571 #include <gio/gio.h> 00572 #include <libmodelxx/grid.h++> 00573 #include <libmodelxx/continuous_structure.h++> 00574 #include "lexer_parser_enums.h++" 00575 #include "structspec_parser.h" 00576 00577 GString *gstr; 00578 int oldstate; 00579 00580 GInputStream* instream; 00581 00582 void gio_yy_input(char* buf, int* result, int max_size) { 00583 GError *err = NULL; 00584 gssize got_chars = g_input_stream_read(instream, buf, max_size, NULL, &err); 00585 if(err != NULL) { 00586 fprintf(stderr, "structspec_lexer: ERROR reading from file: %s", err->message); 00587 *result = -1; 00588 } 00589 *result = got_chars; 00590 } 00591 00592 #define YY_INPUT(buf, result, max_size) (gio_yy_input(buf, &result, max_size)) 00593 00594 using namespace kdotp::libmodelxx::continuous_structure; 00595 using namespace kdotp::libmodelxx::grid; 00596 /*Start states*/ 00597 00598 00599 /*Definitions*/ 00600 #line 601 "kdotp/structspec_lexer.c++" 00601 00602 #define INITIAL 0 00603 #define STRINGREAD 1 00604 #define COMMENT 2 00605 00606 #ifndef YY_NO_UNISTD_H 00607 /* Special case for "unistd.h", since it is non-ANSI. We include it way 00608 * down here because we want the user's section 1 to have been scanned first. 00609 * The user has a chance to override it with an option. 00610 */ 00611 #include <unistd.h> 00612 #endif 00613 00614 #ifndef YY_EXTRA_TYPE 00615 #define YY_EXTRA_TYPE void * 00616 #endif 00617 00618 static int yy_init_globals (void ); 00619 00620 /* Accessor methods to globals. 00621 These are made visible to non-reentrant scanners for convenience. */ 00622 00623 int yylex_destroy (void ); 00624 00625 int yyget_debug (void ); 00626 00627 void yyset_debug (int debug_flag ); 00628 00629 YY_EXTRA_TYPE yyget_extra (void ); 00630 00631 void yyset_extra (YY_EXTRA_TYPE user_defined ); 00632 00633 FILE *yyget_in (void ); 00634 00635 void yyset_in (FILE * in_str ); 00636 00637 FILE *yyget_out (void ); 00638 00639 void yyset_out (FILE * out_str ); 00640 00641 int yyget_leng (void ); 00642 00643 char *yyget_text (void ); 00644 00645 int yyget_lineno (void ); 00646 00647 void yyset_lineno (int line_number ); 00648 00649 /* Macros after this point can all be overridden by user definitions in 00650 * section 1. 00651 */ 00652 00653 #ifndef YY_SKIP_YYWRAP 00654 #ifdef __cplusplus 00655 extern "C" int yywrap (void ); 00656 #else 00657 extern int yywrap (void ); 00658 #endif 00659 #endif 00660 00661 static void yyunput (int c,char *buf_ptr ); 00662 00663 #ifndef yytext_ptr 00664 static void yy_flex_strncpy (char *,yyconst char *,int ); 00665 #endif 00666 00667 #ifdef YY_NEED_STRLEN 00668 static int yy_flex_strlen (yyconst char * ); 00669 #endif 00670 00671 #ifndef YY_NO_INPUT 00672 00673 #ifdef __cplusplus 00674 static int yyinput (void ); 00675 #else 00676 static int input (void ); 00677 #endif 00678 00679 #endif 00680 00681 /* Amount of stuff to slurp up with each read. */ 00682 #ifndef YY_READ_BUF_SIZE 00683 #ifdef __ia64__ 00684 /* On IA-64, the buffer size is 16k, not 8k */ 00685 #define YY_READ_BUF_SIZE 16384 00686 #else 00687 #define YY_READ_BUF_SIZE 8192 00688 #endif /* __ia64__ */ 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 do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 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 size_t 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 ) 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 (void); 00762 00763 #define YY_DECL int yylex (void) 00764 #endif /* !YY_DECL */ 00765 00766 /* Code executed at the beginning of each rule, after yytext and yyleng 00767 * have been set up. 00768 */ 00769 #ifndef YY_USER_ACTION 00770 #define YY_USER_ACTION 00771 #endif 00772 00773 /* Code executed at the end of each rule. */ 00774 #ifndef YY_BREAK 00775 #define YY_BREAK break; 00776 #endif 00777 00778 #define YY_RULE_SETUP \ 00779 YY_USER_ACTION 00780 00781 /** The main scanner function which does all the work. 00782 */ 00783 YY_DECL 00784 { 00785 register yy_state_type yy_current_state; 00786 register char *yy_cp, *yy_bp; 00787 register int yy_act; 00788 00789 #line 62 "structspec_lexer.l++" 00790 00791 #line 792 "kdotp/structspec_lexer.c++" 00792 00793 if ( !(yy_init) ) 00794 { 00795 (yy_init) = 1; 00796 00797 #ifdef YY_USER_INIT 00798 YY_USER_INIT; 00799 #endif 00800 00801 if ( ! (yy_start) ) 00802 (yy_start) = 1; /* first start state */ 00803 00804 if ( ! yyin ) 00805 yyin = stdin; 00806 00807 if ( ! yyout ) 00808 yyout = stdout; 00809 00810 if ( ! YY_CURRENT_BUFFER ) { 00811 yyensure_buffer_stack (); 00812 YY_CURRENT_BUFFER_LVALUE = 00813 yy_create_buffer(yyin,YY_BUF_SIZE ); 00814 } 00815 00816 yy_load_buffer_state( ); 00817 } 00818 00819 while ( 1 ) /* loops until end-of-file is reached */ 00820 { 00821 yy_cp = (yy_c_buf_p); 00822 00823 /* Support of yytext. */ 00824 *yy_cp = (yy_hold_char); 00825 00826 /* yy_bp points to the position in yy_ch_buf of the start of 00827 * the current run. 00828 */ 00829 yy_bp = yy_cp; 00830 00831 yy_current_state = (yy_start); 00832 yy_match: 00833 do 00834 { 00835 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 00836 if ( yy_accept[yy_current_state] ) 00837 { 00838 (yy_last_accepting_state) = yy_current_state; 00839 (yy_last_accepting_cpos) = yy_cp; 00840 } 00841 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 00842 { 00843 yy_current_state = (int) yy_def[yy_current_state]; 00844 if ( yy_current_state >= 101 ) 00845 yy_c = yy_meta[(unsigned int) yy_c]; 00846 } 00847 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 00848 ++yy_cp; 00849 } 00850 while ( yy_base[yy_current_state] != 132 ); 00851 00852 yy_find_action: 00853 yy_act = yy_accept[yy_current_state]; 00854 if ( yy_act == 0 ) 00855 { /* have to back up */ 00856 yy_cp = (yy_last_accepting_cpos); 00857 yy_current_state = (yy_last_accepting_state); 00858 yy_act = yy_accept[yy_current_state]; 00859 } 00860 00861 YY_DO_BEFORE_ACTION; 00862 00863 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 00864 { 00865 int yyl; 00866 for ( yyl = 0; yyl < yyleng; ++yyl ) 00867 if ( yytext[yyl] == '\n' ) 00868 00869 yylineno++; 00870 ; 00871 } 00872 00873 do_action: /* This label is used only to access EOF actions. */ 00874 00875 switch ( yy_act ) 00876 { /* beginning of action switch */ 00877 case 0: /* must back up */ 00878 /* undo the effects of YY_DO_BEFORE_ACTION */ 00879 *yy_cp = (yy_hold_char); 00880 yy_cp = (yy_last_accepting_cpos); 00881 yy_current_state = (yy_last_accepting_state); 00882 goto yy_find_action; 00883 00884 case 1: 00885 #line 64 "structspec_lexer.l++" 00886 case 2: 00887 #line 65 "structspec_lexer.l++" 00888 case 3: 00889 YY_RULE_SETUP 00890 #line 65 "structspec_lexer.l++" 00891 {yylval.fval = atof(yytext); 00892 /* 00893 fprintf(stderr, "float: %g\n", yylval.fval); 00894 */ 00895 return TOK_FLOAT;} 00896 YY_BREAK 00897 case 4: 00898 YY_RULE_SETUP 00899 #line 70 "structspec_lexer.l++" 00900 {yylval.ival = atoi(yytext); 00901 /* 00902 fprintf(stderr, "int: %d", yylval.ival); 00903 */ 00904 return TOK_INT;} 00905 YY_BREAK 00906 case 5: 00907 YY_RULE_SETUP 00908 #line 75 "structspec_lexer.l++" 00909 {yylval.len=length_from_str(yytext); return TOK_LENGTH;} 00910 YY_BREAK 00911 case 6: 00912 YY_RULE_SETUP 00913 #line 76 "structspec_lexer.l++" 00914 {yylval.energy=energy_from_str(yytext); return TOK_ENERGY;} 00915 YY_BREAK 00916 case 7: 00917 YY_RULE_SETUP 00918 #line 77 "structspec_lexer.l++" 00919 {oldstate=YY_START; BEGIN(STRINGREAD); gstr=g_string_new(""); 00920 fprintf(stderr, "BEGIN(STRINGREAD)\n"); 00921 } 00922 YY_BREAK 00923 case 8: 00924 /* rule 8 can match eol */ 00925 YY_RULE_SETUP 00926 #line 80 "structspec_lexer.l++" 00927 {gstr = g_string_append(gstr, yytext); 00928 fprintf(stderr, "got string piece %s\n", gstr->str); 00929 } 00930 YY_BREAK 00931 case 9: 00932 YY_RULE_SETUP 00933 #line 83 "structspec_lexer.l++" 00934 {gstr = g_string_append(gstr, "\""); fprintf(stderr, "Got escaped quote\n");} 00935 YY_BREAK 00936 case 10: 00937 YY_RULE_SETUP 00938 #line 84 "structspec_lexer.l++" 00939 {gstr = g_string_append(gstr, "\\"); fprintf(stderr, "Got escaped backslash.\n");} 00940 YY_BREAK 00941 case 11: 00942 YY_RULE_SETUP 00943 #line 85 "structspec_lexer.l++" 00944 {BEGIN(oldstate); yylval.str = gstr->str; g_string_free(gstr, FALSE); fprintf(stderr, "Got total string: (%s)\n", gstr->str); return TOK_STRING;} 00945 YY_BREAK 00946 case 12: 00947 YY_RULE_SETUP 00948 #line 86 "structspec_lexer.l++" 00949 {fprintf(stderr, "STRUCTSPEC PARSING ERROR: while reading in a string, couldn't recognize characters \"%s\"\n", yytext); return 1;} 00950 YY_BREAK 00951 case 13: 00952 YY_RULE_SETUP 00953 #line 87 "structspec_lexer.l++" 00954 {oldstate=YY_START; BEGIN(COMMENT);} 00955 YY_BREAK 00956 case 14: 00957 /* rule 14 can match eol */ 00958 YY_RULE_SETUP 00959 #line 88 "structspec_lexer.l++" 00960 {BEGIN(oldstate); yylineno++;} 00961 YY_BREAK 00962 case 15: 00963 YY_RULE_SETUP 00964 #line 89 "structspec_lexer.l++" 00965 {} 00966 YY_BREAK 00967 case 16: 00968 YY_RULE_SETUP 00969 #line 90 "structspec_lexer.l++" 00970 {return TOK_STRUCTURE;} 00971 YY_BREAK 00972 case 17: 00973 YY_RULE_SETUP 00974 #line 91 "structspec_lexer.l++" 00975 {return TOK_GRID;} 00976 YY_BREAK 00977 case 18: 00978 YY_RULE_SETUP 00979 #line 92 "structspec_lexer.l++" 00980 {return TOK_REGION;} 00981 YY_BREAK 00982 case 19: 00983 YY_RULE_SETUP 00984 #line 93 "structspec_lexer.l++" 00985 {return TOK_SHAPE;} 00986 YY_BREAK 00987 case 20: 00988 YY_RULE_SETUP 00989 #line 94 "structspec_lexer.l++" 00990 {yylval.gt = CARTESIAN; return TOK_GRID_TYPE;} 00991 YY_BREAK 00992 case 21: 00993 YY_RULE_SETUP 00994 #line 95 "structspec_lexer.l++" 00995 {return TOK_CONST;} 00996 YY_BREAK 00997 case 22: 00998 YY_RULE_SETUP 00999 #line 96 "structspec_lexer.l++" 01000 {return TOK_CONST;} 01001 YY_BREAK 01002 case 23: 01003 YY_RULE_SETUP 01004 #line 97 "structspec_lexer.l++" 01005 {return TOK_DOPING;} 01006 YY_BREAK 01007 case 24: 01008 YY_RULE_SETUP 01009 #line 98 "structspec_lexer.l++" 01010 {return TOK_POTENTIAL;} 01011 YY_BREAK 01012 case 25: 01013 YY_RULE_SETUP 01014 #line 99 "structspec_lexer.l++" 01015 { 01016 fprintf(stderr, "identifier=%s\n", yytext); 01017 yylval.str = strdup(yytext); 01018 return TOK_IDENTIFIER; 01019 } 01020 YY_BREAK 01021 case 26: 01022 YY_RULE_SETUP 01023 #line 104 "structspec_lexer.l++" 01024 {} 01025 YY_BREAK 01026 case 27: 01027 /* rule 27 can match eol */ 01028 YY_RULE_SETUP 01029 #line 105 "structspec_lexer.l++" 01030 {yylineno++;} 01031 YY_BREAK 01032 case 28: 01033 YY_RULE_SETUP 01034 #line 106 "structspec_lexer.l++" 01035 { 01036 /* 01037 fprintf(stderr, "char=%c\n", yytext[0]); 01038 */ 01039 return yytext[0];} 01040 YY_BREAK 01041 case 29: 01042 YY_RULE_SETUP 01043 #line 111 "structspec_lexer.l++" 01044 ECHO; 01045 YY_BREAK 01046 #line 1047 "kdotp/structspec_lexer.c++" 01047 case YY_STATE_EOF(INITIAL): 01048 case YY_STATE_EOF(STRINGREAD): 01049 case YY_STATE_EOF(COMMENT): 01050 yyterminate(); 01051 01052 case YY_END_OF_BUFFER: 01053 { 01054 /* Amount of text matched not including the EOB char. */ 01055 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 01056 01057 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 01058 *yy_cp = (yy_hold_char); 01059 YY_RESTORE_YY_MORE_OFFSET 01060 01061 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 01062 { 01063 /* We're scanning a new file or input source. It's 01064 * possible that this happened because the user 01065 * just pointed yyin at a new source and called 01066 * yylex(). If so, then we have to assure 01067 * consistency between YY_CURRENT_BUFFER and our 01068 * globals. Here is the right place to do so, because 01069 * this is the first action (other than possibly a 01070 * back-up) that will match for the new input source. 01071 */ 01072 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 01073 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 01074 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 01075 } 01076 01077 /* Note that here we test for yy_c_buf_p "<=" to the position 01078 * of the first EOB in the buffer, since yy_c_buf_p will 01079 * already have been incremented past the NUL character 01080 * (since all states make transitions on EOB to the 01081 * end-of-buffer state). Contrast this with the test 01082 * in input(). 01083 */ 01084 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 01085 { /* This was really a NUL. */ 01086 yy_state_type yy_next_state; 01087 01088 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 01089 01090 yy_current_state = yy_get_previous_state( ); 01091 01092 /* Okay, we're now positioned to make the NUL 01093 * transition. We couldn't have 01094 * yy_get_previous_state() go ahead and do it 01095 * for us because it doesn't know how to deal 01096 * with the possibility of jamming (and we don't 01097 * want to build jamming into it because then it 01098 * will run more slowly). 01099 */ 01100 01101 yy_next_state = yy_try_NUL_trans( yy_current_state ); 01102 01103 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 01104 01105 if ( yy_next_state ) 01106 { 01107 /* Consume the NUL. */ 01108 yy_cp = ++(yy_c_buf_p); 01109 yy_current_state = yy_next_state; 01110 goto yy_match; 01111 } 01112 01113 else 01114 { 01115 yy_cp = (yy_c_buf_p); 01116 goto yy_find_action; 01117 } 01118 } 01119 01120 else switch ( yy_get_next_buffer( ) ) 01121 { 01122 case EOB_ACT_END_OF_FILE: 01123 { 01124 (yy_did_buffer_switch_on_eof) = 0; 01125 01126 if ( yywrap( ) ) 01127 { 01128 /* Note: because we've taken care in 01129 * yy_get_next_buffer() to have set up 01130 * yytext, we can now set up 01131 * yy_c_buf_p so that if some total 01132 * hoser (like flex itself) wants to 01133 * call the scanner after we return the 01134 * YY_NULL, it'll still work - another 01135 * YY_NULL will get returned. 01136 */ 01137 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 01138 01139 yy_act = YY_STATE_EOF(YY_START); 01140 goto do_action; 01141 } 01142 01143 else 01144 { 01145 if ( ! (yy_did_buffer_switch_on_eof) ) 01146 YY_NEW_FILE; 01147 } 01148 break; 01149 } 01150 01151 case EOB_ACT_CONTINUE_SCAN: 01152 (yy_c_buf_p) = 01153 (yytext_ptr) + yy_amount_of_matched_text; 01154 01155 yy_current_state = yy_get_previous_state( ); 01156 01157 yy_cp = (yy_c_buf_p); 01158 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 01159 goto yy_match; 01160 01161 case EOB_ACT_LAST_MATCH: 01162 (yy_c_buf_p) = 01163 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 01164 01165 yy_current_state = yy_get_previous_state( ); 01166 01167 yy_cp = (yy_c_buf_p); 01168 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 01169 goto yy_find_action; 01170 } 01171 break; 01172 } 01173 01174 default: 01175 YY_FATAL_ERROR( 01176 "fatal flex scanner internal error--no action found" ); 01177 } /* end of action switch */ 01178 } /* end of scanning one token */ 01179 } /* end of yylex */ 01180 01181 /* yy_get_next_buffer - try to read in a new buffer 01182 * 01183 * Returns a code representing an action: 01184 * EOB_ACT_LAST_MATCH - 01185 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 01186 * EOB_ACT_END_OF_FILE - end of file 01187 */ 01188 static int yy_get_next_buffer (void) 01189 { 01190 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 01191 register char *source = (yytext_ptr); 01192 register int number_to_move, i; 01193 int ret_val; 01194 01195 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 01196 YY_FATAL_ERROR( 01197 "fatal flex scanner internal error--end of buffer missed" ); 01198 01199 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 01200 { /* Don't try to fill the buffer, so this is an EOF. */ 01201 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 01202 { 01203 /* We matched a single character, the EOB, so 01204 * treat this as a final EOF. 01205 */ 01206 return EOB_ACT_END_OF_FILE; 01207 } 01208 01209 else 01210 { 01211 /* We matched some text prior to the EOB, first 01212 * process it. 01213 */ 01214 return EOB_ACT_LAST_MATCH; 01215 } 01216 } 01217 01218 /* Try to read more data. */ 01219 01220 /* First move last chars to start of buffer. */ 01221 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 01222 01223 for ( i = 0; i < number_to_move; ++i ) 01224 *(dest++) = *(source++); 01225 01226 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 01227 /* don't do the read, it's not guaranteed to return an EOF, 01228 * just force an EOF 01229 */ 01230 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 01231 01232 else 01233 { 01234 int num_to_read = 01235 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 01236 01237 while ( num_to_read <= 0 ) 01238 { /* Not enough room in the buffer - grow it. */ 01239 01240 /* just a shorter name for the current buffer */ 01241 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 01242 01243 int yy_c_buf_p_offset = 01244 (int) ((yy_c_buf_p) - b->yy_ch_buf); 01245 01246 if ( b->yy_is_our_buffer ) 01247 { 01248 int new_size = b->yy_buf_size * 2; 01249 01250 if ( new_size <= 0 ) 01251 b->yy_buf_size += b->yy_buf_size / 8; 01252 else 01253 b->yy_buf_size *= 2; 01254 01255 b->yy_ch_buf = (char *) 01256 /* Include room in for 2 EOB chars. */ 01257 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 01258 } 01259 else 01260 /* Can't grow it, we don't own it. */ 01261 b->yy_ch_buf = 0; 01262 01263 if ( ! b->yy_ch_buf ) 01264 YY_FATAL_ERROR( 01265 "fatal error - scanner input buffer overflow" ); 01266 01267 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 01268 01269 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 01270 number_to_move - 1; 01271 01272 } 01273 01274 if ( num_to_read > YY_READ_BUF_SIZE ) 01275 num_to_read = YY_READ_BUF_SIZE; 01276 01277 /* Read in more data. */ 01278 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 01279 (yy_n_chars), (size_t) num_to_read ); 01280 01281 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01282 } 01283 01284 if ( (yy_n_chars) == 0 ) 01285 { 01286 if ( number_to_move == YY_MORE_ADJ ) 01287 { 01288 ret_val = EOB_ACT_END_OF_FILE; 01289 yyrestart(yyin ); 01290 } 01291 01292 else 01293 { 01294 ret_val = EOB_ACT_LAST_MATCH; 01295 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 01296 YY_BUFFER_EOF_PENDING; 01297 } 01298 } 01299 01300 else 01301 ret_val = EOB_ACT_CONTINUE_SCAN; 01302 01303 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 01304 /* Extend the array by 50%, plus the number we really need. */ 01305 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 01306 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 01307 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 01308 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 01309 } 01310 01311 (yy_n_chars) += number_to_move; 01312 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 01313 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 01314 01315 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 01316 01317 return ret_val; 01318 } 01319 01320 /* yy_get_previous_state - get the state just before the EOB char was reached */ 01321 01322 static yy_state_type yy_get_previous_state (void) 01323 { 01324 register yy_state_type yy_current_state; 01325 register char *yy_cp; 01326 01327 yy_current_state = (yy_start); 01328 01329 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 01330 { 01331 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 01332 if ( yy_accept[yy_current_state] ) 01333 { 01334 (yy_last_accepting_state) = yy_current_state; 01335 (yy_last_accepting_cpos) = yy_cp; 01336 } 01337 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01338 { 01339 yy_current_state = (int) yy_def[yy_current_state]; 01340 if ( yy_current_state >= 101 ) 01341 yy_c = yy_meta[(unsigned int) yy_c]; 01342 } 01343 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01344 } 01345 01346 return yy_current_state; 01347 } 01348 01349 /* yy_try_NUL_trans - try to make a transition on the NUL character 01350 * 01351 * synopsis 01352 * next_state = yy_try_NUL_trans( current_state ); 01353 */ 01354 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 01355 { 01356 register int yy_is_jam; 01357 register char *yy_cp = (yy_c_buf_p); 01358 01359 register YY_CHAR yy_c = 1; 01360 if ( yy_accept[yy_current_state] ) 01361 { 01362 (yy_last_accepting_state) = yy_current_state; 01363 (yy_last_accepting_cpos) = yy_cp; 01364 } 01365 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01366 { 01367 yy_current_state = (int) yy_def[yy_current_state]; 01368 if ( yy_current_state >= 101 ) 01369 yy_c = yy_meta[(unsigned int) yy_c]; 01370 } 01371 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01372 yy_is_jam = (yy_current_state == 100); 01373 01374 return yy_is_jam ? 0 : yy_current_state; 01375 } 01376 01377 static void yyunput (int c, register char * yy_bp ) 01378 { 01379 register char *yy_cp; 01380 01381 yy_cp = (yy_c_buf_p); 01382 01383 /* undo effects of setting up yytext */ 01384 *yy_cp = (yy_hold_char); 01385 01386 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 01387 { /* need to shift things up to make room */ 01388 /* +2 for EOB chars. */ 01389 register int number_to_move = (yy_n_chars) + 2; 01390 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 01391 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 01392 register char *source = 01393 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 01394 01395 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 01396 *--dest = *--source; 01397 01398 yy_cp += (int) (dest - source); 01399 yy_bp += (int) (dest - source); 01400 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 01401 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 01402 01403 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 01404 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 01405 } 01406 01407 *--yy_cp = (char) c; 01408 01409 if ( c == '\n' ){ 01410 --yylineno; 01411 } 01412 01413 (yytext_ptr) = yy_bp; 01414 (yy_hold_char) = *yy_cp; 01415 (yy_c_buf_p) = yy_cp; 01416 } 01417 01418 #ifndef YY_NO_INPUT 01419 #ifdef __cplusplus 01420 static int yyinput (void) 01421 #else 01422 static int input (void) 01423 #endif 01424 01425 { 01426 int c; 01427 01428 *(yy_c_buf_p) = (yy_hold_char); 01429 01430 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 01431 { 01432 /* yy_c_buf_p now points to the character we want to return. 01433 * If this occurs *before* the EOB characters, then it's a 01434 * valid NUL; if not, then we've hit the end of the buffer. 01435 */ 01436 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 01437 /* This was really a NUL. */ 01438 *(yy_c_buf_p) = '\0'; 01439 01440 else 01441 { /* need more input */ 01442 int offset = (yy_c_buf_p) - (yytext_ptr); 01443 ++(yy_c_buf_p); 01444 01445 switch ( yy_get_next_buffer( ) ) 01446 { 01447 case EOB_ACT_LAST_MATCH: 01448 /* This happens because yy_g_n_b() 01449 * sees that we've accumulated a 01450 * token and flags that we need to 01451 * try matching the token before 01452 * proceeding. But for input(), 01453 * there's no matching to consider. 01454 * So convert the EOB_ACT_LAST_MATCH 01455 * to EOB_ACT_END_OF_FILE. 01456 */ 01457 01458 /* Reset buffer status. */ 01459 yyrestart(yyin ); 01460 01461 /*FALLTHROUGH*/ 01462 01463 case EOB_ACT_END_OF_FILE: 01464 { 01465 if ( yywrap( ) ) 01466 return EOF; 01467 01468 if ( ! (yy_did_buffer_switch_on_eof) ) 01469 YY_NEW_FILE; 01470 #ifdef __cplusplus 01471 return yyinput(); 01472 #else 01473 return input(); 01474 #endif 01475 } 01476 01477 case EOB_ACT_CONTINUE_SCAN: 01478 (yy_c_buf_p) = (yytext_ptr) + offset; 01479 break; 01480 } 01481 } 01482 } 01483 01484 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 01485 *(yy_c_buf_p) = '\0'; /* preserve yytext */ 01486 (yy_hold_char) = *++(yy_c_buf_p); 01487 01488 if ( c == '\n' ) 01489 01490 yylineno++; 01491 ; 01492 01493 return c; 01494 } 01495 #endif /* ifndef YY_NO_INPUT */ 01496 01497 /** Immediately switch to a different input stream. 01498 * @param input_file A readable stream. 01499 * 01500 * @note This function does not reset the start condition to @c INITIAL . 01501 */ 01502 void yyrestart (FILE * input_file ) 01503 { 01504 01505 if ( ! YY_CURRENT_BUFFER ){ 01506 yyensure_buffer_stack (); 01507 YY_CURRENT_BUFFER_LVALUE = 01508 yy_create_buffer(yyin,YY_BUF_SIZE ); 01509 } 01510 01511 yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 01512 yy_load_buffer_state( ); 01513 } 01514 01515 /** Switch to a different input buffer. 01516 * @param new_buffer The new input buffer. 01517 * 01518 */ 01519 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 01520 { 01521 01522 /* TODO. We should be able to replace this entire function body 01523 * with 01524 * yypop_buffer_state(); 01525 * yypush_buffer_state(new_buffer); 01526 */ 01527 yyensure_buffer_stack (); 01528 if ( YY_CURRENT_BUFFER == new_buffer ) 01529 return; 01530 01531 if ( YY_CURRENT_BUFFER ) 01532 { 01533 /* Flush out information for old buffer. */ 01534 *(yy_c_buf_p) = (yy_hold_char); 01535 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 01536 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01537 } 01538 01539 YY_CURRENT_BUFFER_LVALUE = new_buffer; 01540 yy_load_buffer_state( ); 01541 01542 /* We don't actually know whether we did this switch during 01543 * EOF (yywrap()) processing, but the only time this flag 01544 * is looked at is after yywrap() is called, so it's safe 01545 * to go ahead and always set it. 01546 */ 01547 (yy_did_buffer_switch_on_eof) = 1; 01548 } 01549 01550 static void yy_load_buffer_state (void) 01551 { 01552 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 01553 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 01554 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 01555 (yy_hold_char) = *(yy_c_buf_p); 01556 } 01557 01558 /** Allocate and initialize an input buffer state. 01559 * @param file A readable stream. 01560 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 01561 * 01562 * @return the allocated buffer state. 01563 */ 01564 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 01565 { 01566 YY_BUFFER_STATE b; 01567 01568 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 01569 if ( ! b ) 01570 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01571 01572 b->yy_buf_size = size; 01573 01574 /* yy_ch_buf has to be 2 characters longer than the size given because 01575 * we need to put in 2 end-of-buffer characters. 01576 */ 01577 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 01578 if ( ! b->yy_ch_buf ) 01579 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01580 01581 b->yy_is_our_buffer = 1; 01582 01583 yy_init_buffer(b,file ); 01584 01585 return b; 01586 } 01587 01588 /** Destroy the buffer. 01589 * @param b a buffer created with yy_create_buffer() 01590 * 01591 */ 01592 void yy_delete_buffer (YY_BUFFER_STATE b ) 01593 { 01594 01595 if ( ! b ) 01596 return; 01597 01598 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 01599 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 01600 01601 if ( b->yy_is_our_buffer ) 01602 yyfree((void *) b->yy_ch_buf ); 01603 01604 yyfree((void *) b ); 01605 } 01606 01607 #ifndef __cplusplus 01608 extern int isatty (int ); 01609 #endif /* __cplusplus */ 01610 01611 /* Initializes or reinitializes a buffer. 01612 * This function is sometimes called more than once on the same buffer, 01613 * such as during a yyrestart() or at EOF. 01614 */ 01615 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 01616 01617 { 01618 int oerrno = errno; 01619 01620 yy_flush_buffer(b ); 01621 01622 b->yy_input_file = file; 01623 b->yy_fill_buffer = 1; 01624 01625 /* If b is the current buffer, then yy_init_buffer was _probably_ 01626 * called from yyrestart() or through yy_get_next_buffer. 01627 * In that case, we don't want to reset the lineno or column. 01628 */ 01629 if (b != YY_CURRENT_BUFFER){ 01630 b->yy_bs_lineno = 1; 01631 b->yy_bs_column = 0; 01632 } 01633 01634 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 01635 01636 errno = oerrno; 01637 } 01638 01639 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 01640 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 01641 * 01642 */ 01643 void yy_flush_buffer (YY_BUFFER_STATE b ) 01644 { 01645 if ( ! b ) 01646 return; 01647 01648 b->yy_n_chars = 0; 01649 01650 /* We always need two end-of-buffer characters. The first causes 01651 * a transition to the end-of-buffer state. The second causes 01652 * a jam in that state. 01653 */ 01654 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 01655 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 01656 01657 b->yy_buf_pos = &b->yy_ch_buf[0]; 01658 01659 b->yy_at_bol = 1; 01660 b->yy_buffer_status = YY_BUFFER_NEW; 01661 01662 if ( b == YY_CURRENT_BUFFER ) 01663 yy_load_buffer_state( ); 01664 } 01665 01666 /** Pushes the new state onto the stack. The new state becomes 01667 * the current state. This function will allocate the stack 01668 * if necessary. 01669 * @param new_buffer The new state. 01670 * 01671 */ 01672 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 01673 { 01674 if (new_buffer == NULL) 01675 return; 01676 01677 yyensure_buffer_stack(); 01678 01679 /* This block is copied from yy_switch_to_buffer. */ 01680 if ( YY_CURRENT_BUFFER ) 01681 { 01682 /* Flush out information for old buffer. */ 01683 *(yy_c_buf_p) = (yy_hold_char); 01684 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 01685 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01686 } 01687 01688 /* Only push if top exists. Otherwise, replace top. */ 01689 if (YY_CURRENT_BUFFER) 01690 (yy_buffer_stack_top)++; 01691 YY_CURRENT_BUFFER_LVALUE = new_buffer; 01692 01693 /* copied from yy_switch_to_buffer. */ 01694 yy_load_buffer_state( ); 01695 (yy_did_buffer_switch_on_eof) = 1; 01696 } 01697 01698 /** Removes and deletes the top of the stack, if present. 01699 * The next element becomes the new top. 01700 * 01701 */ 01702 void yypop_buffer_state (void) 01703 { 01704 if (!YY_CURRENT_BUFFER) 01705 return; 01706 01707 yy_delete_buffer(YY_CURRENT_BUFFER ); 01708 YY_CURRENT_BUFFER_LVALUE = NULL; 01709 if ((yy_buffer_stack_top) > 0) 01710 --(yy_buffer_stack_top); 01711 01712 if (YY_CURRENT_BUFFER) { 01713 yy_load_buffer_state( ); 01714 (yy_did_buffer_switch_on_eof) = 1; 01715 } 01716 } 01717 01718 /* Allocates the stack if it does not exist. 01719 * Guarantees space for at least one push. 01720 */ 01721 static void yyensure_buffer_stack (void) 01722 { 01723 int num_to_alloc; 01724 01725 if (!(yy_buffer_stack)) { 01726 01727 /* First allocation is just for 2 elements, since we don't know if this 01728 * scanner will even need a stack. We use 2 instead of 1 to avoid an 01729 * immediate realloc on the next call. 01730 */ 01731 num_to_alloc = 1; 01732 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 01733 (num_to_alloc * sizeof(struct yy_buffer_state*) 01734 ); 01735 if ( ! (yy_buffer_stack) ) 01736 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 01737 01738 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 01739 01740 (yy_buffer_stack_max) = num_to_alloc; 01741 (yy_buffer_stack_top) = 0; 01742 return; 01743 } 01744 01745 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 01746 01747 /* Increase the buffer to prepare for a possible push. */ 01748 int grow_size = 8 /* arbitrary grow size */; 01749 01750 num_to_alloc = (yy_buffer_stack_max) + grow_size; 01751 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 01752 ((yy_buffer_stack), 01753 num_to_alloc * sizeof(struct yy_buffer_state*) 01754 ); 01755 if ( ! (yy_buffer_stack) ) 01756 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 01757 01758 /* zero only the new slots.*/ 01759 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 01760 (yy_buffer_stack_max) = num_to_alloc; 01761 } 01762 } 01763 01764 /** Setup the input buffer state to scan directly from a user-specified character buffer. 01765 * @param base the character buffer 01766 * @param size the size in bytes of the character buffer 01767 * 01768 * @return the newly allocated buffer state object. 01769 */ 01770 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 01771 { 01772 YY_BUFFER_STATE b; 01773 01774 if ( size < 2 || 01775 base[size-2] != YY_END_OF_BUFFER_CHAR || 01776 base[size-1] != YY_END_OF_BUFFER_CHAR ) 01777 /* They forgot to leave room for the EOB's. */ 01778 return 0; 01779 01780 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 01781 if ( ! b ) 01782 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 01783 01784 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 01785 b->yy_buf_pos = b->yy_ch_buf = base; 01786 b->yy_is_our_buffer = 0; 01787 b->yy_input_file = 0; 01788 b->yy_n_chars = b->yy_buf_size; 01789 b->yy_is_interactive = 0; 01790 b->yy_at_bol = 1; 01791 b->yy_fill_buffer = 0; 01792 b->yy_buffer_status = YY_BUFFER_NEW; 01793 01794 yy_switch_to_buffer(b ); 01795 01796 return b; 01797 } 01798 01799 /** Setup the input buffer state to scan a string. The next call to yylex() will 01800 * scan from a @e copy of @a str. 01801 * @param yystr a NUL-terminated string to scan 01802 * 01803 * @return the newly allocated buffer state object. 01804 * @note If you want to scan bytes that may contain NUL values, then use 01805 * yy_scan_bytes() instead. 01806 */ 01807 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) 01808 { 01809 01810 return yy_scan_bytes(yystr,strlen(yystr) ); 01811 } 01812 01813 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 01814 * scan from a @e copy of @a bytes. 01815 * @param yybytes the byte buffer to scan 01816 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 01817 * 01818 * @return the newly allocated buffer state object. 01819 */ 01820 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) 01821 { 01822 YY_BUFFER_STATE b; 01823 char *buf; 01824 yy_size_t n; 01825 int i; 01826 01827 /* Get memory for full buffer, including space for trailing EOB's. */ 01828 n = _yybytes_len + 2; 01829 buf = (char *) yyalloc(n ); 01830 if ( ! buf ) 01831 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 01832 01833 for ( i = 0; i < _yybytes_len; ++i ) 01834 buf[i] = yybytes[i]; 01835 01836 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 01837 01838 b = yy_scan_buffer(buf,n ); 01839 if ( ! b ) 01840 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 01841 01842 /* It's okay to grow etc. this buffer, and we should throw it 01843 * away when we're done. 01844 */ 01845 b->yy_is_our_buffer = 1; 01846 01847 return b; 01848 } 01849 01850 #ifndef YY_EXIT_FAILURE 01851 #define YY_EXIT_FAILURE 2 01852 #endif 01853 01854 static void yy_fatal_error (yyconst char* msg ) 01855 { 01856 (void) fprintf( stderr, "%s\n", msg ); 01857 exit( YY_EXIT_FAILURE ); 01858 } 01859 01860 /* Redefine yyless() so it works in section 3 code. */ 01861 01862 #undef yyless 01863 #define yyless(n) \ 01864 do \ 01865 { \ 01866 /* Undo effects of setting up yytext. */ \ 01867 int yyless_macro_arg = (n); \ 01868 YY_LESS_LINENO(yyless_macro_arg);\ 01869 yytext[yyleng] = (yy_hold_char); \ 01870 (yy_c_buf_p) = yytext + yyless_macro_arg; \ 01871 (yy_hold_char) = *(yy_c_buf_p); \ 01872 *(yy_c_buf_p) = '\0'; \ 01873 yyleng = yyless_macro_arg; \ 01874 } \ 01875 while ( 0 ) 01876 01877 /* Accessor methods (get/set functions) to struct members. */ 01878 01879 /** Get the current line number. 01880 * 01881 */ 01882 int yyget_lineno (void) 01883 { 01884 01885 return yylineno; 01886 } 01887 01888 /** Get the input stream. 01889 * 01890 */ 01891 FILE *yyget_in (void) 01892 { 01893 return yyin; 01894 } 01895 01896 /** Get the output stream. 01897 * 01898 */ 01899 FILE *yyget_out (void) 01900 { 01901 return yyout; 01902 } 01903 01904 /** Get the length of the current token. 01905 * 01906 */ 01907 int yyget_leng (void) 01908 { 01909 return yyleng; 01910 } 01911 01912 /** Get the current token. 01913 * 01914 */ 01915 01916 char *yyget_text (void) 01917 { 01918 return yytext; 01919 } 01920 01921 /** Set the current line number. 01922 * @param line_number 01923 * 01924 */ 01925 void yyset_lineno (int line_number ) 01926 { 01927 01928 yylineno = line_number; 01929 } 01930 01931 /** Set the input stream. This does not discard the current 01932 * input buffer. 01933 * @param in_str A readable stream. 01934 * 01935 * @see yy_switch_to_buffer 01936 */ 01937 void yyset_in (FILE * in_str ) 01938 { 01939 yyin = in_str ; 01940 } 01941 01942 void yyset_out (FILE * out_str ) 01943 { 01944 yyout = out_str ; 01945 } 01946 01947 int yyget_debug (void) 01948 { 01949 return yy_flex_debug; 01950 } 01951 01952 void yyset_debug (int bdebug ) 01953 { 01954 yy_flex_debug = bdebug ; 01955 } 01956 01957 static int yy_init_globals (void) 01958 { 01959 /* Initialization is the same as for the non-reentrant scanner. 01960 * This function is called from yylex_destroy(), so don't allocate here. 01961 */ 01962 01963 /* We do not touch yylineno unless the option is enabled. */ 01964 yylineno = 1; 01965 01966 (yy_buffer_stack) = 0; 01967 (yy_buffer_stack_top) = 0; 01968 (yy_buffer_stack_max) = 0; 01969 (yy_c_buf_p) = (char *) 0; 01970 (yy_init) = 0; 01971 (yy_start) = 0; 01972 01973 /* Defined in main.c */ 01974 #ifdef YY_STDINIT 01975 yyin = stdin; 01976 yyout = stdout; 01977 #else 01978 yyin = (FILE *) 0; 01979 yyout = (FILE *) 0; 01980 #endif 01981 01982 /* For future reference: Set errno on error, since we are called by 01983 * yylex_init() 01984 */ 01985 return 0; 01986 } 01987 01988 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 01989 int yylex_destroy (void) 01990 { 01991 01992 /* Pop the buffer stack, destroying each element. */ 01993 while(YY_CURRENT_BUFFER){ 01994 yy_delete_buffer(YY_CURRENT_BUFFER ); 01995 YY_CURRENT_BUFFER_LVALUE = NULL; 01996 yypop_buffer_state(); 01997 } 01998 01999 /* Destroy the stack itself. */ 02000 yyfree((yy_buffer_stack) ); 02001 (yy_buffer_stack) = NULL; 02002 02003 /* Reset the globals. This is important in a non-reentrant scanner so the next time 02004 * yylex() is called, initialization will occur. */ 02005 yy_init_globals( ); 02006 02007 return 0; 02008 } 02009 02010 /* 02011 * Internal utility routines. 02012 */ 02013 02014 #ifndef yytext_ptr 02015 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 02016 { 02017 register int i; 02018 for ( i = 0; i < n; ++i ) 02019 s1[i] = s2[i]; 02020 } 02021 #endif 02022 02023 #ifdef YY_NEED_STRLEN 02024 static int yy_flex_strlen (yyconst char * s ) 02025 { 02026 register int n; 02027 for ( n = 0; s[n]; ++n ) 02028 ; 02029 02030 return n; 02031 } 02032 #endif 02033 02034 void *yyalloc (yy_size_t size ) 02035 { 02036 return (void *) malloc( size ); 02037 } 02038 02039 void *yyrealloc (void * ptr, yy_size_t size ) 02040 { 02041 /* The cast to (char *) in the following accommodates both 02042 * implementations that use char* generic pointers, and those 02043 * that use void* generic pointers. It works with the latter 02044 * because both ANSI C and C++ allow castless assignment from 02045 * any pointer type to void*, and deal with argument conversions 02046 * as though doing an assignment. 02047 */ 02048 return (void *) realloc( (char *) ptr, size ); 02049 } 02050 02051 void yyfree (void * ptr ) 02052 { 02053 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 02054 } 02055 02056 #define YYTABLES_NAME "yytables" 02057 02058 #line 111 "structspec_lexer.l++" 02059 02060 02061 02062 /*I think the purpose of this function is pretty self-explanatory 02063 *Is easier to throw this in here than to try to disable it from autotools. 02064 */ 02065 void remove_yyinput_not_used_error(void){yyunput(0, (char*)"bugmenot");} 02066