cint_c.lex.c (85038B)
1 /* 2 This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 4 Copyright 2007-2019 Broadcom Inc. All rights reserved. 5 */ 6 7 #line 2 "cint_c.lex.c" 8 #line 20 "cint_scanner.l" 9 10 #include "cint_config.h" 11 #include "cint_yy.h" 12 #include "cint_parser.h" 13 14 15 16 17 #line 12 "cint_c.lex.c" 18 19 #define YY_INT_ALIGNED short int 20 21 /* A lexical scanner generated by flex */ 22 23 #define FLEX_SCANNER 24 #define YY_FLEX_MAJOR_VERSION 2 25 #define YY_FLEX_MINOR_VERSION 5 26 #define YY_FLEX_SUBMINOR_VERSION 31 27 #if YY_FLEX_SUBMINOR_VERSION > 0 28 #define FLEX_BETA 29 #endif 30 31 /* First, we deal with platform-specific or compiler-specific issues. */ 32 33 /* begin standard C headers. */ 34 #include <stdio.h> 35 #include <string.h> 36 #include <errno.h> 37 #include <stdlib.h> 38 39 /* end standard C headers. */ 40 41 /* flex integer type definitions */ 42 43 #ifndef FLEXINT_H 44 #define FLEXINT_H 45 46 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 47 48 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 49 #include <inttypes.h> 50 typedef int8_t flex_int8_t; 51 typedef uint8_t flex_uint8_t; 52 typedef int16_t flex_int16_t; 53 typedef uint16_t flex_uint16_t; 54 typedef int32_t flex_int32_t; 55 typedef uint32_t flex_uint32_t; 56 #else 57 typedef signed char flex_int8_t; 58 typedef short int flex_int16_t; 59 typedef int flex_int32_t; 60 typedef unsigned char flex_uint8_t; 61 typedef unsigned short int flex_uint16_t; 62 typedef unsigned int flex_uint32_t; 63 #endif /* ! C99 */ 64 65 /* Limits of integral types. */ 66 #ifndef INT8_MIN 67 #define INT8_MIN (-128) 68 #endif 69 #ifndef INT16_MIN 70 #define INT16_MIN (-32767-1) 71 #endif 72 #ifndef INT32_MIN 73 #define INT32_MIN (-2147483647-1) 74 #endif 75 #ifndef INT8_MAX 76 #define INT8_MAX (127) 77 #endif 78 #ifndef INT16_MAX 79 #define INT16_MAX (32767) 80 #endif 81 #ifndef INT32_MAX 82 #define INT32_MAX (2147483647) 83 #endif 84 #ifndef UINT8_MAX 85 #define UINT8_MAX (255U) 86 #endif 87 #ifndef UINT16_MAX 88 #define UINT16_MAX (65535U) 89 #endif 90 #ifndef UINT32_MAX 91 #define UINT32_MAX (4294967295U) 92 #endif 93 94 #endif /* ! FLEXINT_H */ 95 96 #ifdef __cplusplus 97 98 /* The "const" storage-class-modifier is valid. */ 99 #define YY_USE_CONST 100 101 #else /* ! __cplusplus */ 102 103 #if __STDC__ 104 105 #define YY_USE_CONST 106 107 #endif /* __STDC__ */ 108 #endif /* ! __cplusplus */ 109 110 #ifdef YY_USE_CONST 111 #define yyconst const 112 #else 113 #define yyconst 114 #endif 115 116 /* Returned upon end-of-file. */ 117 #define YY_NULL 0 118 119 /* Promotes a possibly negative, possibly signed char to an unsigned 120 * integer for use as an array index. If the signed char is negative, 121 * we want to instead treat it as an 8-bit unsigned char, hence the 122 * double cast. 123 */ 124 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 125 126 /* An opaque pointer. */ 127 #ifndef YY_TYPEDEF_YY_SCANNER_T 128 #define YY_TYPEDEF_YY_SCANNER_T 129 typedef void* yyscan_t; 130 #endif 131 132 /* For convenience, these vars (plus the bison vars far below) 133 are macros in the reentrant scanner. */ 134 #define yyin yyg->yyin_r 135 #define yyout yyg->yyout_r 136 #define yyextra yyg->yyextra_r 137 #define yyleng yyg->yyleng_r 138 #define yytext yyg->yytext_r 139 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 140 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 141 #define yy_flex_debug yyg->yy_flex_debug_r 142 143 int cint_c_lex_init (yyscan_t* scanner); 144 145 /* Enter a start condition. This macro really ought to take a parameter, 146 * but we do it the disgusting crufty way forced on us by the ()-less 147 * definition of BEGIN. 148 */ 149 #define BEGIN yyg->yy_start = 1 + 2 * 150 151 /* Translate the current start state into a value that can be later handed 152 * to BEGIN to return to the state. The YYSTATE alias is for lex 153 * compatibility. 154 */ 155 #define YY_START ((yyg->yy_start - 1) / 2) 156 #define YYSTATE YY_START 157 158 /* Action number for EOF rule of a given start state. */ 159 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 160 161 /* Special action meaning "start processing a new file". */ 162 #define YY_NEW_FILE cint_c_restart(yyin ,yyscanner ) 163 164 #define YY_END_OF_BUFFER_CHAR 0 165 166 /* Size of default input buffer. */ 167 #ifndef YY_BUF_SIZE 168 #define YY_BUF_SIZE 16384 169 #endif 170 171 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 172 #define YY_TYPEDEF_YY_BUFFER_STATE 173 typedef struct yy_buffer_state *YY_BUFFER_STATE; 174 #endif 175 176 #define EOB_ACT_CONTINUE_SCAN 0 177 #define EOB_ACT_END_OF_FILE 1 178 #define EOB_ACT_LAST_MATCH 2 179 180 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires 181 * access to the local variable yy_act. Since yyless() is a macro, it would break 182 * existing scanners that call yyless() from OUTSIDE cint_c_lex. 183 * One obvious solution it to make yy_act a global. I tried that, and saw 184 * a 5% performance hit in a non-yylineno scanner, because yy_act is 185 * normally declared as a register variable-- so it is not worth it. 186 */ 187 #define YY_LESS_LINENO(n) \ 188 do { \ 189 int yyl;\ 190 for ( yyl = n; yyl < yyleng; ++yyl )\ 191 if ( yytext[yyl] == '\n' )\ 192 --yylineno;\ 193 }while(0) 194 195 /* Return all but the first "n" matched characters back to the input stream. */ 196 #define yyless(n) \ 197 do \ 198 { \ 199 /* Undo effects of setting up yytext. */ \ 200 int yyless_macro_arg = (n); \ 201 YY_LESS_LINENO(yyless_macro_arg);\ 202 *yy_cp = yyg->yy_hold_char; \ 203 YY_RESTORE_YY_MORE_OFFSET \ 204 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 205 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 206 } \ 207 while ( 0 ) 208 209 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 210 211 /* The following is because we cannot portably get our hands on size_t 212 * (without autoconf's help, which isn't available because we want 213 * flex-generated scanners to compile on their own). 214 */ 215 216 #ifndef YY_TYPEDEF_YY_SIZE_T 217 #define YY_TYPEDEF_YY_SIZE_T 218 typedef unsigned int yy_size_t; 219 #endif 220 221 #ifndef YY_STRUCT_YY_BUFFER_STATE 222 #define YY_STRUCT_YY_BUFFER_STATE 223 struct yy_buffer_state 224 { 225 FILE *yy_input_file; 226 227 char *yy_ch_buf; /* input buffer */ 228 char *yy_buf_pos; /* current position in input buffer */ 229 230 /* Size of input buffer in bytes, not including room for EOB 231 * characters. 232 */ 233 yy_size_t yy_buf_size; 234 235 /* Number of characters read into yy_ch_buf, not including EOB 236 * characters. 237 */ 238 int yy_n_chars; 239 240 /* Whether we "own" the buffer - i.e., we know we created it, 241 * and can realloc() it to grow it, and should free() it to 242 * delete it. 243 */ 244 int yy_is_our_buffer; 245 246 /* Whether this is an "interactive" input source; if so, and 247 * if we're using stdio for input, then we want to use getc() 248 * instead of fread(), to make sure we stop fetching input after 249 * each newline. 250 */ 251 int yy_is_interactive; 252 253 /* Whether we're considered to be at the beginning of a line. 254 * If so, '^' rules will be active on the next match, otherwise 255 * not. 256 */ 257 int yy_at_bol; 258 259 int yy_bs_lineno; /**< The line count. */ 260 int yy_bs_column; /**< The column count. */ 261 262 /* Whether to try to fill the input buffer when we reach the 263 * end of it. 264 */ 265 int yy_fill_buffer; 266 267 int yy_buffer_status; 268 269 #define YY_BUFFER_NEW 0 270 #define YY_BUFFER_NORMAL 1 271 /* When an EOF's been seen but there's still some text to process 272 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 273 * shouldn't try reading from the input source any more. We might 274 * still have a bunch of tokens to match, though, because of 275 * possible backing-up. 276 * 277 * When we actually see the EOF, we change the status to "new" 278 * (via cint_c_restart()), so that the user can continue scanning by 279 * just pointing yyin at a new input file. 280 */ 281 #define YY_BUFFER_EOF_PENDING 2 282 283 }; 284 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 285 286 /* We provide macros for accessing buffer states in case in the 287 * future we want to put the buffer states in a more general 288 * "scanner state". 289 * 290 * Returns the top of the stack, or NULL. 291 */ 292 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ 293 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ 294 : NULL) 295 296 /* Same as previous macro, but useful when we know that the buffer stack is not 297 * NULL or when we need an lvalue. For internal use only. 298 */ 299 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] 300 301 void cint_c_restart (FILE *input_file ,yyscan_t yyscanner ); 302 void cint_c__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 303 YY_BUFFER_STATE cint_c__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); 304 void cint_c__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 305 void cint_c__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 306 void cint_c_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 307 void cint_c_pop_buffer_state (yyscan_t yyscanner ); 308 309 static void cint_c_ensure_buffer_stack (yyscan_t yyscanner ); 310 static void cint_c__load_buffer_state (yyscan_t yyscanner ); 311 static void cint_c__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 312 313 #define YY_FLUSH_BUFFER cint_c__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) 314 315 YY_BUFFER_STATE cint_c__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 316 YY_BUFFER_STATE cint_c__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 317 YY_BUFFER_STATE cint_c__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); 318 319 void *cint_c_alloc (yy_size_t ,yyscan_t yyscanner ); 320 void *cint_c_realloc (void *,yy_size_t ,yyscan_t yyscanner ); 321 void cint_c_free (void * ,yyscan_t yyscanner ); 322 323 #define yy_new_buffer cint_c__create_buffer 324 325 #define yy_set_interactive(is_interactive) \ 326 { \ 327 if ( ! YY_CURRENT_BUFFER ){ \ 328 cint_c_ensure_buffer_stack (yyscanner); \ 329 YY_CURRENT_BUFFER_LVALUE = \ 330 cint_c__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 331 } \ 332 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 333 } 334 335 #define yy_set_bol(at_bol) \ 336 { \ 337 if ( ! YY_CURRENT_BUFFER ){\ 338 cint_c_ensure_buffer_stack (yyscanner); \ 339 YY_CURRENT_BUFFER_LVALUE = \ 340 cint_c__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 341 } \ 342 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 343 } 344 345 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 346 347 /* Begin user sect3 */ 348 349 typedef unsigned char YY_CHAR; 350 351 typedef int yy_state_type; 352 353 #define yytext_ptr yytext_r 354 355 static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 356 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); 357 static int yy_get_next_buffer (yyscan_t yyscanner ); 358 359 /* Done after the current pattern has been matched and before the 360 * corresponding action - sets up yytext. 361 */ 362 #define YY_DO_BEFORE_ACTION \ 363 yyg->yytext_ptr = yy_bp; \ 364 yyleng = (size_t) (yy_cp - yy_bp); \ 365 yyg->yy_hold_char = *yy_cp; \ 366 *yy_cp = '\0'; \ 367 yyg->yy_c_buf_p = yy_cp; 368 369 #define YY_NUM_RULES 103 370 #define YY_END_OF_BUFFER 104 371 /* This struct is not used in this scanner, 372 but its presence is necessary. */ 373 struct yy_trans_info 374 { 375 flex_int32_t yy_verify; 376 flex_int32_t yy_nxt; 377 }; 378 static yyconst flex_int16_t yy_accept[279] = 379 { 0, 380 0, 0, 0, 0, 0, 0, 104, 102, 100, 101, 381 88, 102, 102, 94, 87, 102, 82, 83, 92, 91, 382 79, 90, 86, 93, 48, 48, 80, 76, 95, 81, 383 96, 99, 45, 45, 84, 85, 97, 45, 45, 45, 384 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 385 45, 45, 45, 77, 98, 78, 89, 3, 2, 103, 386 5, 8, 9, 9, 100, 101, 75, 0, 53, 0, 387 0, 61, 78, 70, 62, 0, 0, 59, 67, 57, 388 68, 58, 69, 0, 51, 4, 0, 60, 52, 47, 389 0, 48, 0, 48, 85, 77, 84, 66, 72, 74, 390 391 73, 65, 45, 0, 0, 63, 45, 45, 45, 45, 392 45, 45, 45, 18, 45, 45, 45, 45, 45, 45, 393 26, 45, 45, 45, 45, 45, 45, 45, 45, 45, 394 45, 45, 45, 64, 71, 3, 2, 5, 6, 7, 395 0, 49, 54, 0, 51, 0, 10, 51, 0, 52, 396 47, 0, 50, 46, 56, 55, 45, 45, 45, 45, 397 45, 45, 45, 45, 45, 45, 45, 45, 24, 45, 398 27, 45, 45, 45, 45, 45, 45, 45, 45, 45, 399 45, 45, 45, 45, 45, 45, 45, 0, 0, 51, 400 0, 51, 0, 52, 50, 46, 11, 45, 13, 14, 401 402 44, 45, 45, 45, 45, 20, 21, 45, 45, 25, 403 28, 45, 45, 45, 45, 45, 45, 45, 45, 45, 404 45, 45, 45, 40, 45, 45, 0, 0, 51, 12, 405 15, 45, 45, 45, 45, 23, 43, 45, 45, 31, 406 45, 45, 45, 45, 45, 45, 38, 45, 45, 42, 407 0, 45, 45, 19, 22, 45, 30, 32, 33, 34, 408 35, 36, 45, 45, 45, 0, 45, 17, 45, 37, 409 45, 45, 1, 16, 29, 39, 41, 0 410 } ; 411 412 static yyconst flex_int32_t yy_ec[256] = 413 { 0, 414 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 415 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 417 1, 2, 5, 6, 7, 1, 8, 9, 10, 11, 418 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 419 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, 420 24, 25, 26, 1, 27, 27, 27, 27, 28, 29, 421 30, 30, 30, 30, 30, 31, 30, 30, 30, 30, 422 30, 30, 30, 30, 32, 30, 30, 33, 30, 30, 423 34, 35, 36, 37, 30, 1, 38, 39, 40, 41, 424 425 42, 43, 44, 45, 46, 30, 47, 48, 49, 50, 426 51, 52, 30, 53, 54, 55, 56, 57, 58, 59, 427 60, 61, 62, 63, 64, 65, 1, 1, 1, 1, 428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 435 436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 439 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 440 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 441 1, 1, 1, 1, 1 442 } ; 443 444 static yyconst flex_int32_t yy_meta[66] = 445 { 0, 446 1, 2, 3, 1, 1, 1, 1, 1, 1, 4, 447 1, 1, 5, 1, 1, 1, 1, 5, 6, 6, 448 1, 1, 1, 1, 1, 1, 6, 6, 6, 7, 449 7, 7, 7, 1, 1, 1, 1, 6, 6, 6, 450 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 451 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 452 7, 1, 1, 1, 1 453 } ; 454 455 static yyconst flex_int16_t yy_base[288] = 456 { 0, 457 0, 0, 64, 66, 67, 68, 447, 448, 70, 443, 458 421, 67, 398, 51, 68, 408, 448, 448, 418, 64, 459 448, 66, 76, 76, 86, 93, 416, 448, 99, 416, 460 59, 448, 0, 91, 448, 448, 415, 382, 384, 92, 461 57, 81, 85, 385, 61, 384, 381, 391, 101, 372, 462 381, 379, 384, 448, 63, 448, 448, 0, 426, 448, 463 0, 448, 409, 413, 146, 422, 448, 92, 448, 421, 464 373, 448, 448, 448, 448, 122, 106, 448, 448, 448, 465 448, 448, 448, 405, 132, 448, 418, 448, 148, 153, 466 173, 151, 0, 183, 448, 448, 448, 396, 448, 448, 467 468 448, 395, 0, 109, 383, 448, 362, 374, 361, 376, 469 363, 362, 368, 354, 355, 352, 352, 355, 352, 349, 470 0, 348, 352, 355, 109, 349, 110, 159, 353, 346, 471 112, 140, 351, 448, 448, 0, 394, 0, 448, 448, 472 355, 448, 448, 202, 448, 391, 448, 204, 222, 448, 473 195, 185, 225, 218, 448, 448, 342, 354, 349, 337, 474 334, 165, 350, 348, 344, 336, 342, 345, 0, 331, 475 0, 337, 330, 333, 322, 324, 326, 333, 319, 317, 476 317, 329, 319, 323, 327, 329, 318, 317, 209, 238, 477 245, 448, 243, 251, 448, 244, 0, 317, 0, 0, 478 479 0, 299, 306, 289, 296, 0, 0, 284, 256, 0, 480 0, 255, 255, 255, 251, 263, 253, 257, 262, 261, 481 257, 247, 252, 0, 236, 248, 233, 258, 264, 0, 482 0, 238, 239, 243, 229, 0, 0, 217, 210, 0, 483 214, 210, 208, 185, 192, 192, 0, 180, 171, 0, 484 172, 154, 153, 0, 0, 164, 0, 0, 0, 0, 485 0, 0, 155, 152, 130, 127, 123, 0, 109, 0, 486 114, 97, 448, 0, 0, 0, 0, 448, 312, 319, 487 326, 333, 335, 342, 349, 356, 73 488 } ; 489 490 static yyconst flex_int16_t yy_def[288] = 491 { 0, 492 278, 1, 279, 279, 280, 280, 278, 278, 278, 278, 493 278, 281, 278, 278, 278, 282, 278, 278, 278, 278, 494 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 495 278, 278, 283, 283, 278, 278, 278, 283, 283, 283, 496 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 497 283, 283, 283, 278, 278, 278, 278, 284, 278, 278, 498 285, 278, 278, 278, 278, 278, 278, 281, 278, 281, 499 278, 278, 278, 278, 278, 282, 282, 278, 278, 278, 500 278, 278, 278, 278, 278, 278, 286, 278, 278, 278, 501 278, 278, 287, 278, 278, 278, 278, 278, 278, 278, 502 503 278, 278, 283, 281, 282, 278, 283, 283, 283, 283, 504 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 505 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 506 283, 283, 283, 278, 278, 284, 278, 285, 278, 278, 507 278, 278, 278, 278, 278, 286, 278, 278, 278, 278, 508 278, 278, 278, 287, 278, 278, 283, 283, 283, 283, 509 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 510 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 511 283, 283, 283, 283, 283, 283, 283, 278, 278, 278, 512 278, 278, 278, 278, 278, 278, 283, 283, 283, 283, 513 514 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 515 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 516 283, 283, 283, 283, 283, 283, 278, 278, 278, 283, 517 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 518 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 519 278, 283, 283, 283, 283, 283, 283, 283, 283, 283, 520 283, 283, 283, 283, 283, 278, 283, 283, 283, 283, 521 283, 283, 278, 283, 283, 283, 283, 0, 278, 278, 522 278, 278, 278, 278, 278, 278, 278 523 } ; 524 525 static yyconst flex_int16_t yy_nxt[514] = 526 { 0, 527 8, 9, 10, 9, 11, 12, 13, 14, 15, 16, 528 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 529 27, 28, 29, 30, 31, 32, 33, 33, 33, 33, 530 34, 33, 33, 35, 8, 36, 37, 38, 39, 40, 531 41, 42, 43, 44, 33, 45, 33, 46, 33, 33, 532 33, 47, 48, 49, 50, 51, 52, 53, 33, 33, 533 33, 54, 55, 56, 57, 59, 60, 59, 60, 62, 534 62, 65, 69, 65, 72, 73, 74, 79, 154, 63, 535 63, 81, 101, 102, 64, 64, 134, 80, 86, 82, 536 83, 75, 84, 87, 85, 85, 104, 69, 113, 88, 537 538 105, 70, 89, 121, 90, 90, 96, 114, 278, 89, 539 122, 94, 94, 91, 69, 76, 92, 92, 93, 97, 540 91, 98, 99, 92, 92, 135, 70, 91, 115, 109, 541 116, 142, 118, 92, 91, 119, 110, 111, 277, 117, 542 92, 92, 112, 70, 93, 126, 127, 65, 92, 65, 543 85, 85, 174, 177, 276, 128, 77, 183, 129, 144, 544 145, 275, 145, 175, 274, 184, 148, 148, 273, 89, 545 178, 90, 90, 144, 145, 149, 150, 272, 150, 145, 546 91, 92, 92, 151, 151, 185, 152, 186, 152, 149, 547 150, 153, 153, 271, 91, 150, 179, 270, 92, 89, 548 549 151, 94, 94, 153, 153, 269, 92, 268, 151, 267, 550 91, 180, 266, 92, 92, 189, 265, 189, 202, 203, 551 190, 190, 148, 148, 91, 151, 151, 190, 190, 264, 552 92, 191, 192, 263, 192, 193, 262, 193, 92, 261, 553 194, 194, 151, 153, 153, 191, 192, 260, 196, 196, 554 151, 192, 259, 195, 258, 195, 190, 190, 228, 257, 555 228, 194, 194, 229, 229, 196, 145, 195, 145, 194, 556 194, 256, 195, 196, 196, 196, 229, 229, 255, 150, 557 145, 150, 229, 229, 254, 145, 253, 252, 251, 250, 558 249, 196, 192, 150, 192, 248, 247, 246, 150, 196, 559 560 245, 244, 243, 242, 241, 240, 192, 239, 238, 237, 561 236, 192, 58, 58, 58, 58, 58, 58, 58, 61, 562 61, 61, 61, 61, 61, 61, 68, 68, 68, 68, 563 68, 68, 68, 76, 76, 76, 235, 76, 76, 76, 564 103, 103, 136, 234, 233, 136, 136, 136, 136, 138, 565 138, 232, 138, 231, 138, 138, 146, 146, 146, 146, 566 146, 146, 146, 230, 227, 226, 225, 224, 223, 222, 567 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 568 211, 210, 209, 208, 207, 206, 205, 204, 201, 200, 569 199, 198, 197, 147, 188, 137, 187, 182, 181, 176, 570 571 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 572 163, 162, 161, 160, 159, 158, 157, 77, 156, 155, 573 147, 143, 141, 278, 66, 140, 139, 137, 133, 132, 574 131, 130, 125, 124, 123, 120, 108, 107, 106, 100, 575 95, 78, 77, 71, 67, 66, 278, 7, 278, 278, 576 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 577 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 578 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 579 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 580 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 581 582 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 583 278, 278, 278 584 } ; 585 586 static yyconst flex_int16_t yy_chk[514] = 587 { 0, 588 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 589 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 590 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 591 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 592 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 593 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 594 1, 1, 1, 1, 1, 3, 3, 4, 4, 5, 595 6, 9, 12, 9, 14, 14, 15, 20, 287, 5, 596 6, 22, 31, 31, 5, 6, 55, 20, 24, 22, 597 22, 15, 23, 24, 23, 23, 34, 68, 41, 24, 598 599 34, 12, 25, 45, 25, 25, 29, 41, 77, 26, 600 45, 26, 26, 25, 104, 77, 25, 25, 25, 29, 601 26, 29, 29, 26, 26, 55, 68, 25, 42, 40, 602 42, 76, 43, 25, 26, 43, 40, 40, 272, 42, 603 26, 25, 40, 104, 25, 49, 49, 65, 26, 65, 604 85, 85, 125, 127, 271, 49, 76, 131, 49, 85, 605 85, 269, 85, 125, 267, 131, 89, 89, 266, 90, 606 127, 90, 90, 85, 85, 89, 89, 265, 89, 85, 607 90, 92, 92, 90, 90, 132, 91, 132, 91, 89, 608 89, 91, 91, 264, 90, 89, 128, 263, 92, 94, 609 610 90, 94, 94, 152, 152, 256, 92, 253, 90, 252, 611 94, 128, 251, 94, 94, 144, 249, 144, 162, 162, 612 144, 144, 148, 148, 94, 151, 151, 189, 189, 248, 613 94, 148, 148, 246, 148, 149, 245, 149, 94, 244, 614 149, 149, 151, 153, 153, 148, 148, 243, 154, 154, 615 151, 148, 242, 153, 241, 153, 190, 190, 191, 239, 616 191, 193, 193, 191, 191, 154, 190, 153, 190, 194, 617 194, 238, 153, 154, 196, 196, 228, 228, 235, 194, 618 190, 194, 229, 229, 234, 190, 233, 232, 227, 226, 619 225, 196, 229, 194, 229, 223, 222, 221, 194, 196, 620 621 220, 219, 218, 217, 216, 215, 229, 214, 213, 212, 622 209, 229, 279, 279, 279, 279, 279, 279, 279, 280, 623 280, 280, 280, 280, 280, 280, 281, 281, 281, 281, 624 281, 281, 281, 282, 282, 282, 208, 282, 282, 282, 625 283, 283, 284, 205, 204, 284, 284, 284, 284, 285, 626 285, 203, 285, 202, 285, 285, 286, 286, 286, 286, 627 286, 286, 286, 198, 188, 187, 186, 185, 184, 183, 628 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 629 172, 170, 168, 167, 166, 165, 164, 163, 161, 160, 630 159, 158, 157, 146, 141, 137, 133, 130, 129, 126, 631 632 124, 123, 122, 120, 119, 118, 117, 116, 115, 114, 633 113, 112, 111, 110, 109, 108, 107, 105, 102, 98, 634 87, 84, 71, 70, 66, 64, 63, 59, 53, 52, 635 51, 50, 48, 47, 46, 44, 39, 38, 37, 30, 636 27, 19, 16, 13, 11, 10, 7, 278, 278, 278, 637 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 638 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 639 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 640 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 641 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 642 643 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 644 278, 278, 278 645 } ; 646 647 /* Table of booleans, true if rule could match eol. */ 648 static yyconst flex_int32_t yy_rule_can_match_eol[104] = 649 { 0, 650 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 651 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 653 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 654 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 655 0, 1, 0, 0, }; 656 657 /* The intent behind this definition is that it'll catch 658 * any uses of REJECT which flex missed. 659 */ 660 #define REJECT reject_used_but_not_detected 661 #define yymore() yymore_used_but_not_detected 662 #define YY_MORE_ADJ 0 663 #define YY_RESTORE_YY_MORE_OFFSET 664 #line 1 "cint_scanner.l" 665 /* 666 * 667 * $Copyright: (c) 2009 Broadcom Corp. 668 * All Rights Reserved.$ 669 * 670 * File: cint_scanner.l 671 * Purpose: CINT Flex input file 672 */ 673 674 #line 28 "cint_scanner.l" 675 676 #include "cint_config.h" 677 678 #ifdef FILENAME_MAX 679 #define __INCLUDE_MAX_FILENAME FILENAME_MAX 680 #else 681 #define __INCLUDE_MAX_FILENAME 128 682 #endif 683 684 #ifndef CINT_MAX_INCLUDE_DEPTH 685 #define CINT_MAX_INCLUDE_DEPTH 64 686 #endif 687 688 struct cint_extra_type_s { 689 char currentFileName[__INCLUDE_MAX_FILENAME+1]; 690 char *includedFromFile; 691 int includedFromLine; 692 }; 693 694 #define YY_EXTRA_TYPE struct cint_extra_type_s * 695 696 #define YY_NO_INPUT 697 698 #if CINT_CONFIG_INCLUDE_PARSER == 1 699 700 #include <stdio.h> 701 #include "cint_ast.h" 702 #include "cint_c.tab.h" 703 #include "cint_interpreter.h" 704 #include "cint_porting.h" 705 #include <string.h> 706 707 int check_type(yyscan_t scanner); 708 709 int cint_scanner_prompt = 1; 710 int cint_scanner_echo = 0; 711 712 #define NOPROMPT() cint_scanner_prompt=0 713 714 struct yyguts_t; 715 void __yy_input(char* buf, int* result, int max_size, yyscan_t scanner); 716 717 #define YY_INPUT(buf, result, max_size) __yy_input((buf), &(result), (max_size), yyscanner) 718 719 /* Rentrant Scanner */ 720 /* Exclusive condition while processing an include directive */ 721 722 #line 719 "cint_c.lex.c" 723 724 #define INITIAL 0 725 #define incl 1 726 #define comment 2 727 728 #ifndef YY_EXTRA_TYPE 729 #define YY_EXTRA_TYPE void * 730 #endif 731 732 /* Holds the entire state of the reentrant scanner. */ 733 struct yyguts_t 734 { 735 736 /* User-defined. Not touched by flex. */ 737 YY_EXTRA_TYPE yyextra_r; 738 739 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 740 FILE *yyin_r, *yyout_r; 741 size_t yy_buffer_stack_top; /**< index of top of stack. */ 742 size_t yy_buffer_stack_max; /**< capacity of stack. */ 743 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 744 char yy_hold_char; 745 int yy_n_chars; 746 int yyleng_r; 747 char *yy_c_buf_p; 748 int yy_init; 749 int yy_start; 750 int yy_did_buffer_switch_on_eof; 751 int yy_start_stack_ptr; 752 int yy_start_stack_depth; 753 int *yy_start_stack; 754 yy_state_type yy_last_accepting_state; 755 char* yy_last_accepting_cpos; 756 757 int yylineno_r; 758 int yy_flex_debug_r; 759 760 char *yytext_r; 761 int yy_more_flag; 762 int yy_more_len; 763 764 YYSTYPE * yylval_r; 765 766 YYLTYPE * yylloc_r; 767 768 }; /* end struct yyguts_t */ 769 770 /* This must go here because YYSTYPE and YYLTYPE are included 771 * from bison output in section 1.*/ 772 # define yylval yyg->yylval_r 773 774 # define yylloc yyg->yylloc_r 775 776 /* Accessor methods to globals. 777 These are made visible to non-reentrant scanners for convenience. */ 778 779 int cint_c_lex_destroy (yyscan_t yyscanner ); 780 781 int cint_c_get_debug (yyscan_t yyscanner ); 782 783 void cint_c_set_debug (int debug_flag ,yyscan_t yyscanner ); 784 785 YY_EXTRA_TYPE cint_c_get_extra (yyscan_t yyscanner ); 786 787 void cint_c_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 788 789 FILE *cint_c_get_in (yyscan_t yyscanner ); 790 791 void cint_c_set_in (FILE * in_str ,yyscan_t yyscanner ); 792 793 FILE *cint_c_get_out (yyscan_t yyscanner ); 794 795 void cint_c_set_out (FILE * out_str ,yyscan_t yyscanner ); 796 797 int cint_c_get_leng (yyscan_t yyscanner ); 798 799 char *cint_c_get_text (yyscan_t yyscanner ); 800 801 int cint_c_get_lineno (yyscan_t yyscanner ); 802 803 void cint_c_set_lineno (int line_number ,yyscan_t yyscanner ); 804 805 YYSTYPE * cint_c_get_lval (yyscan_t yyscanner ); 806 807 void cint_c_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); 808 809 YYLTYPE *cint_c_get_lloc (yyscan_t yyscanner ); 810 811 void cint_c_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); 812 813 /* Macros after this point can all be overridden by user definitions in 814 * section 1. 815 */ 816 817 #ifndef YY_SKIP_YYWRAP 818 #ifdef __cplusplus 819 extern "C" int cint_c_wrap (yyscan_t yyscanner ); 820 #else 821 extern int cint_c_wrap (yyscan_t yyscanner ); 822 #endif 823 #endif 824 825 #ifndef yytext_ptr 826 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 827 #endif 828 829 #ifdef YY_NEED_STRLEN 830 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 831 #endif 832 833 #ifndef YY_NO_INPUT 834 835 #ifdef __cplusplus 836 static int yyinput (yyscan_t yyscanner ); 837 #else 838 static int input (yyscan_t yyscanner ); 839 #endif 840 841 #endif 842 843 /* Amount of stuff to slurp up with each read. */ 844 #ifndef YY_READ_BUF_SIZE 845 #define YY_READ_BUF_SIZE 8192 846 #endif 847 848 /* Copy whatever the last rule matched to the standard output. */ 849 #ifndef ECHO 850 /* This used to be an fputs(), but since the string might contain NUL's, 851 * we now use fwrite(). 852 */ 853 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) 854 #endif 855 856 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 857 * is returned in "result". 858 */ 859 #ifndef YY_INPUT 860 #define YY_INPUT(buf,result,max_size) \ 861 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 862 { \ 863 int c = '*'; \ 864 size_t n; \ 865 for ( n = 0; n < max_size && \ 866 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 867 buf[n] = (char) c; \ 868 if ( c == '\n' ) \ 869 buf[n++] = (char) c; \ 870 if ( c == EOF && ferror( yyin ) ) \ 871 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 872 result = n; \ 873 } \ 874 else \ 875 { \ 876 errno=0; \ 877 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 878 { \ 879 if( errno != EINTR) \ 880 { \ 881 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 882 break; \ 883 } \ 884 errno=0; \ 885 clearerr(yyin); \ 886 } \ 887 }\ 888 \ 889 890 #endif 891 892 /* No semi-colon after return; correct usage is to write "yyterminate();" - 893 * we don't want an extra ';' after the "return" because that will cause 894 * some compilers to complain about unreachable statements. 895 */ 896 #ifndef yyterminate 897 #define yyterminate() return YY_NULL 898 #endif 899 900 /* Number of entries by which start-condition stack grows. */ 901 #ifndef YY_START_STACK_INCR 902 #define YY_START_STACK_INCR 25 903 #endif 904 905 /* end tables serialization structures and prototypes */ 906 907 /* Default declaration of generated scanner - a define so the user can 908 * easily add parameters. 909 */ 910 #ifndef YY_DECL 911 #define YY_DECL_IS_OURS 1 912 913 extern int cint_c_lex (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); 914 915 #define YY_DECL int cint_c_lex (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) 916 #endif /* !YY_DECL */ 917 918 /* Code executed at the beginning of each rule, after yytext and yyleng 919 * have been set up. 920 */ 921 #ifndef YY_USER_ACTION 922 #define YY_USER_ACTION 923 #endif 924 925 /* Code executed at the end of each rule. */ 926 #ifndef YY_BREAK 927 #define YY_BREAK break; 928 #endif 929 930 #define YY_RULE_SETUP \ 931 YY_USER_ACTION 932 933 /* 934 * BRCM: Check buffer stack 935 */ 936 #ifndef YY_CHECK_BUFFER_STACK 937 #define YY_CHECK_BUFFER_STACK if (!yyg->yy_buffer_stack) YY_FATAL_ERROR("buffer error") 938 #endif 939 940 /** The main scanner function which does all the work. 941 */ 942 YY_DECL 943 { 944 register yy_state_type yy_current_state; 945 register char *yy_cp, *yy_bp; 946 register int yy_act; 947 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 948 949 #line 90 "cint_scanner.l" 950 951 int commentNesting = 0; 952 953 #line 948 "cint_c.lex.c" 954 955 yylval = yylval_param; 956 957 yylloc = yylloc_param; 958 959 if ( yyg->yy_init ) 960 { 961 yyg->yy_init = 0; 962 963 #ifdef YY_USER_INIT 964 YY_USER_INIT; 965 #endif 966 YY_CHECK_BUFFER_STACK; 967 968 if ( ! yyg->yy_start ) 969 yyg->yy_start = 1; /* first start state */ 970 971 if ( ! yyin ) 972 yyin = stdin; 973 974 if ( ! yyout ) 975 yyout = stdout; 976 977 if ( ! YY_CURRENT_BUFFER ) { 978 cint_c_ensure_buffer_stack (yyscanner); 979 YY_CURRENT_BUFFER_LVALUE = 980 cint_c__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 981 } 982 983 cint_c__load_buffer_state(yyscanner ); 984 } 985 986 while ( 1 ) /* loops until end-of-file is reached */ 987 { 988 yy_cp = yyg->yy_c_buf_p; 989 990 /* Support of yytext. */ 991 *yy_cp = yyg->yy_hold_char; 992 993 /* yy_bp points to the position in yy_ch_buf of the start of 994 * the current run. 995 */ 996 yy_bp = yy_cp; 997 998 yy_current_state = yyg->yy_start; 999 yy_match: 1000 do 1001 { 1002 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 1003 if ( yy_accept[yy_current_state] ) 1004 { 1005 yyg->yy_last_accepting_state = yy_current_state; 1006 yyg->yy_last_accepting_cpos = yy_cp; 1007 } 1008 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1009 { 1010 yy_current_state = (int) yy_def[yy_current_state]; 1011 if ( yy_current_state >= 279 ) 1012 yy_c = yy_meta[(unsigned int) yy_c]; 1013 } 1014 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1015 ++yy_cp; 1016 } 1017 while ( yy_base[yy_current_state] != 448 ); 1018 1019 yy_find_action: 1020 yy_act = yy_accept[yy_current_state]; 1021 if ( yy_act == 0 ) 1022 { /* have to back up */ 1023 yy_cp = yyg->yy_last_accepting_cpos; 1024 yy_current_state = yyg->yy_last_accepting_state; 1025 yy_act = yy_accept[yy_current_state]; 1026 } 1027 1028 YY_DO_BEFORE_ACTION; 1029 1030 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 1031 { 1032 int yyl; 1033 for ( yyl = 0; yyl < yyleng; ++yyl ) 1034 if ( yytext[yyl] == '\n' ) 1035 1036 do{ yylineno++; 1037 yycolumn=0; 1038 }while(0) 1039 ; 1040 } 1041 1042 do_action: /* This label is used only to access EOF actions. */ 1043 1044 switch ( yy_act ) 1045 { /* beginning of action switch */ 1046 case 0: /* must back up */ 1047 /* undo the effects of YY_DO_BEFORE_ACTION */ 1048 *yy_cp = yyg->yy_hold_char; 1049 yy_cp = yyg->yy_last_accepting_cpos; 1050 yy_current_state = yyg->yy_last_accepting_state; 1051 goto yy_find_action; 1052 1053 case 1: 1054 YY_RULE_SETUP 1055 #line 93 "cint_scanner.l" 1056 BEGIN(incl); 1057 YY_BREAK 1058 case 2: 1059 YY_RULE_SETUP 1060 #line 95 "cint_scanner.l" 1061 /* Eat whitespace between include and filename */ 1062 YY_BREAK 1063 case 3: 1064 YY_RULE_SETUP 1065 #line 96 "cint_scanner.l" 1066 { 1067 /* yytext is now the include filename */ 1068 1069 #if CINT_CONFIG_INCLUDE_XINCLUDE == 0 1070 1071 CINT_PRINTF 1072 ("Cannot include '%s': #include support is not available in this configuration\n", 1073 yytext); 1074 BEGIN(INITIAL); 1075 1076 #else 1077 1078 FILE *cyyin = yyin; /* Save current input file. */ 1079 int len; 1080 char* fpath = NULL; 1081 char fname[__INCLUDE_MAX_FILENAME]; 1082 1083 fname[sizeof(fname) - 1] = 0; 1084 1085 /* Allow quotes and angle brackets in include path */ 1086 if (yytext[0] == '\"' || yytext[0] == '<') { 1087 CINT_STRNCPY(fname, yytext + 1, sizeof(fname) - 1); 1088 } else { 1089 CINT_STRNCPY(fname, yytext, sizeof(fname) - 1); 1090 } 1091 len = CINT_STRLEN(fname); 1092 if (fname[len - 1] == '\"' || fname[len - 1] == '>') { 1093 fname[len - 1] = 0; 1094 } 1095 /* 1096 * The scanner will allow us to push new files onto the stack until 1097 * we run out of memory. In reality, we'll probably reach the process 1098 * limit for maximum opened files first. In either case this way more 1099 * open files than makes sense. It's more likely that we're run into 1100 * some sort of recursive include condition. That being the case, we'll 1101 * check against an abitrary maximum include depth here. 1102 */ 1103 if ((CINT_MAX_INCLUDE_DEPTH - 1) > yyg->yy_buffer_stack_top) { 1104 if (cint_interpreter_include_get(fname, &fpath) == CINT_E_NONE) { 1105 if (fpath) { 1106 yyin = CINT_FOPEN(fpath, "r"); 1107 } else { 1108 yyin = CINT_FOPEN(fname, "r"); 1109 } 1110 (void)cint_cparser_include(1); 1111 } else { 1112 yyin = 0; 1113 } 1114 1115 if (yyin == 0) { 1116 CINT_PRINTF("Cannot open include file '%s'\n", fpath ? fpath : fname); 1117 yyin = cyyin; 1118 } else { 1119 struct cint_extra_type_s *extra = cint_c_get_extra(yyscanner); 1120 1121 if (extra) { 1122 struct cint_extra_type_s *lastInclude = &extra[yyg->yy_buffer_stack_top]; 1123 struct cint_extra_type_s *newInclude = &extra[yyg->yy_buffer_stack_top + 1]; 1124 CINT_STRNCPY(newInclude->currentFileName, fname, 1125 __INCLUDE_MAX_FILENAME); 1126 newInclude->includedFromFile = lastInclude->currentFileName; 1127 newInclude->includedFromLine = cint_c_get_lineno(yyscanner); 1128 } 1129 cint_c_push_buffer_state(cint_c__create_buffer(yyin,YY_BUF_SIZE,yyscanner),yyscanner); 1130 cint_c_set_lineno(1, yyscanner); 1131 YY_CURRENT_BUFFER->yy_is_interactive = 0; 1132 } 1133 1134 if (fpath) { 1135 CINT_FREE(fpath); 1136 } 1137 } else { 1138 CINT_PRINTF("Exceeded maximum include file depth of %d at include file '%s'\n", 1139 CINT_MAX_INCLUDE_DEPTH, fname); 1140 } 1141 1142 /* All success and error condition should reset to INITIAL state */ 1143 BEGIN(INITIAL); 1144 1145 #endif /* CINT_CONFIG_INCLUDE_XINCLUDE */ 1146 1147 } 1148 YY_BREAK 1149 case 4: 1150 YY_RULE_SETUP 1151 #line 180 "cint_scanner.l" 1152 { commentNesting = 0; BEGIN(comment); } 1153 YY_BREAK 1154 case 5: 1155 YY_RULE_SETUP 1156 #line 181 "cint_scanner.l" 1157 { /* Swallow stuff inside comments */ } 1158 YY_BREAK 1159 case 6: 1160 YY_RULE_SETUP 1161 #line 182 "cint_scanner.l" 1162 { if (commentNesting-- == 0) { BEGIN(INITIAL); } } 1163 YY_BREAK 1164 case 7: 1165 YY_RULE_SETUP 1166 #line 183 "cint_scanner.l" 1167 { commentNesting++; } 1168 YY_BREAK 1169 case 8: 1170 /* rule 8 can match eol */ 1171 YY_RULE_SETUP 1172 #line 184 "cint_scanner.l" 1173 { /* Swallow newlines */ } 1174 YY_BREAK 1175 case 9: 1176 YY_RULE_SETUP 1177 #line 185 "cint_scanner.l" 1178 { /* Swallow lone "*" and "/" */ } 1179 YY_BREAK 1180 case YY_STATE_EOF(comment): 1181 #line 186 "cint_scanner.l" 1182 { CINT_PRINTF("EOF encountered while processing comment.\n"); yyterminate(); } 1183 YY_BREAK 1184 case YY_STATE_EOF(INITIAL): 1185 case YY_STATE_EOF(incl): 1186 #line 188 "cint_scanner.l" 1187 { 1188 if (yyg->yy_buffer_stack_top) { 1189 if (yyin) { 1190 #if CINT_CONFIG_FILE_IO == 1 1191 CINT_FCLOSE(yyin); 1192 #endif 1193 (void)cint_cparser_include(-1); 1194 yyin = 0; 1195 } 1196 cint_c_pop_buffer_state(yyscanner); 1197 } else { 1198 yyterminate(); 1199 } 1200 } 1201 YY_BREAK 1202 case 10: 1203 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ 1204 yyg->yy_c_buf_p = yy_cp -= 1; 1205 YY_DO_BEFORE_ACTION; /* set up yytext again */ 1206 YY_RULE_SETUP 1207 #line 203 "cint_scanner.l" 1208 { /* Swallow C++ style comments */ } 1209 YY_BREAK 1210 case 11: 1211 YY_RULE_SETUP 1212 #line 205 "cint_scanner.l" 1213 { NOPROMPT(); return(AUTO); } 1214 YY_BREAK 1215 case 12: 1216 YY_RULE_SETUP 1217 #line 206 "cint_scanner.l" 1218 { NOPROMPT(); return(BREAK); } 1219 YY_BREAK 1220 case 13: 1221 YY_RULE_SETUP 1222 #line 207 "cint_scanner.l" 1223 { NOPROMPT(); return(CASE); } 1224 YY_BREAK 1225 case 14: 1226 YY_RULE_SETUP 1227 #line 208 "cint_scanner.l" 1228 { NOPROMPT(); return(CHAR); } 1229 YY_BREAK 1230 case 15: 1231 YY_RULE_SETUP 1232 #line 209 "cint_scanner.l" 1233 { NOPROMPT(); return(CONST); } 1234 YY_BREAK 1235 case 16: 1236 YY_RULE_SETUP 1237 #line 210 "cint_scanner.l" 1238 { NOPROMPT(); return(CONTINUE); } 1239 YY_BREAK 1240 case 17: 1241 YY_RULE_SETUP 1242 #line 211 "cint_scanner.l" 1243 { NOPROMPT(); return(DEFAULT); } 1244 YY_BREAK 1245 case 18: 1246 YY_RULE_SETUP 1247 #line 212 "cint_scanner.l" 1248 { NOPROMPT(); return(DO); } 1249 YY_BREAK 1250 case 19: 1251 YY_RULE_SETUP 1252 #line 213 "cint_scanner.l" 1253 { NOPROMPT(); return(DOUBLE); } 1254 YY_BREAK 1255 case 20: 1256 YY_RULE_SETUP 1257 #line 214 "cint_scanner.l" 1258 { NOPROMPT(); return(ELSE); } 1259 YY_BREAK 1260 case 21: 1261 YY_RULE_SETUP 1262 #line 215 "cint_scanner.l" 1263 { NOPROMPT(); return(ENUM); } 1264 YY_BREAK 1265 case 22: 1266 YY_RULE_SETUP 1267 #line 216 "cint_scanner.l" 1268 { NOPROMPT(); return(EXTERN); } 1269 YY_BREAK 1270 case 23: 1271 YY_RULE_SETUP 1272 #line 217 "cint_scanner.l" 1273 { NOPROMPT(); return(FLOAT); } 1274 YY_BREAK 1275 case 24: 1276 YY_RULE_SETUP 1277 #line 218 "cint_scanner.l" 1278 { NOPROMPT(); return(FOR); } 1279 YY_BREAK 1280 case 25: 1281 YY_RULE_SETUP 1282 #line 219 "cint_scanner.l" 1283 { NOPROMPT(); return(GOTO); } 1284 YY_BREAK 1285 case 26: 1286 YY_RULE_SETUP 1287 #line 220 "cint_scanner.l" 1288 { NOPROMPT(); return(IF); } 1289 YY_BREAK 1290 case 27: 1291 YY_RULE_SETUP 1292 #line 221 "cint_scanner.l" 1293 { NOPROMPT(); return(INT); } 1294 YY_BREAK 1295 case 28: 1296 YY_RULE_SETUP 1297 #line 222 "cint_scanner.l" 1298 { NOPROMPT(); return(LONG); } 1299 YY_BREAK 1300 case 29: 1301 YY_RULE_SETUP 1302 #line 223 "cint_scanner.l" 1303 { NOPROMPT(); return(REGISTER); } 1304 YY_BREAK 1305 case 30: 1306 YY_RULE_SETUP 1307 #line 224 "cint_scanner.l" 1308 { NOPROMPT(); return(RETURN); } 1309 YY_BREAK 1310 case 31: 1311 YY_RULE_SETUP 1312 #line 225 "cint_scanner.l" 1313 { NOPROMPT(); return(SHORT); } 1314 YY_BREAK 1315 case 32: 1316 YY_RULE_SETUP 1317 #line 226 "cint_scanner.l" 1318 { NOPROMPT(); return(SIGNED); } 1319 YY_BREAK 1320 case 33: 1321 YY_RULE_SETUP 1322 #line 227 "cint_scanner.l" 1323 { NOPROMPT(); return(SIZEOF); } 1324 YY_BREAK 1325 case 34: 1326 YY_RULE_SETUP 1327 #line 228 "cint_scanner.l" 1328 { NOPROMPT(); return(STATIC); } 1329 YY_BREAK 1330 case 35: 1331 YY_RULE_SETUP 1332 #line 229 "cint_scanner.l" 1333 { NOPROMPT(); return(STRUCT); } 1334 YY_BREAK 1335 case 36: 1336 YY_RULE_SETUP 1337 #line 230 "cint_scanner.l" 1338 { NOPROMPT(); return(SWITCH); } 1339 YY_BREAK 1340 case 37: 1341 YY_RULE_SETUP 1342 #line 231 "cint_scanner.l" 1343 { NOPROMPT(); return(TYPEDEF); } 1344 YY_BREAK 1345 case 38: 1346 YY_RULE_SETUP 1347 #line 232 "cint_scanner.l" 1348 { NOPROMPT(); return(UNION); } 1349 YY_BREAK 1350 case 39: 1351 YY_RULE_SETUP 1352 #line 233 "cint_scanner.l" 1353 { NOPROMPT(); return(UNSIGNED); } 1354 YY_BREAK 1355 case 40: 1356 YY_RULE_SETUP 1357 #line 234 "cint_scanner.l" 1358 { NOPROMPT(); return(T_VOID); } 1359 YY_BREAK 1360 case 41: 1361 YY_RULE_SETUP 1362 #line 235 "cint_scanner.l" 1363 { NOPROMPT(); return(VOLATILE); } 1364 YY_BREAK 1365 case 42: 1366 YY_RULE_SETUP 1367 #line 236 "cint_scanner.l" 1368 { NOPROMPT(); return(WHILE); } 1369 YY_BREAK 1370 case 43: 1371 YY_RULE_SETUP 1372 #line 237 "cint_scanner.l" 1373 { NOPROMPT(); return(PRINT); } 1374 YY_BREAK 1375 case 44: 1376 YY_RULE_SETUP 1377 #line 238 "cint_scanner.l" 1378 { NOPROMPT(); return(CINT); } 1379 YY_BREAK 1380 case 45: 1381 YY_RULE_SETUP 1382 #line 240 "cint_scanner.l" 1383 { NOPROMPT(); return(check_type(yyscanner)); } 1384 YY_BREAK 1385 case 46: 1386 YY_RULE_SETUP 1387 #line 242 "cint_scanner.l" 1388 { *yylval = cint_ast_constant(yytext, cintAstConstHex); 1389 NOPROMPT(); return(CONSTANT); } 1390 YY_BREAK 1391 case 47: 1392 YY_RULE_SETUP 1393 #line 244 "cint_scanner.l" 1394 { *yylval = cint_ast_constant(yytext, cintAstConstOctal); 1395 NOPROMPT(); return(CONSTANT); } 1396 YY_BREAK 1397 case 48: 1398 YY_RULE_SETUP 1399 #line 246 "cint_scanner.l" 1400 { *yylval = cint_ast_constant(yytext, cintAstConstDecimal); 1401 NOPROMPT(); return(CONSTANT); } 1402 YY_BREAK 1403 case 49: 1404 /* rule 49 can match eol */ 1405 YY_RULE_SETUP 1406 #line 248 "cint_scanner.l" 1407 { *yylval = cint_ast_constant(yytext, cintAstConstChar); 1408 NOPROMPT(); return(CONSTANT); } 1409 YY_BREAK 1410 case 50: 1411 YY_RULE_SETUP 1412 #line 251 "cint_scanner.l" 1413 { *yylval = cint_ast_constant(yytext, cintAstConstFloat); 1414 NOPROMPT(); return(CONSTANT); } 1415 YY_BREAK 1416 case 51: 1417 YY_RULE_SETUP 1418 #line 253 "cint_scanner.l" 1419 { *yylval = cint_ast_constant(yytext, cintAstConstFloat); 1420 NOPROMPT(); return(CONSTANT); } 1421 YY_BREAK 1422 case 52: 1423 YY_RULE_SETUP 1424 #line 255 "cint_scanner.l" 1425 { *yylval = cint_ast_constant(yytext, cintAstConstFloat); 1426 NOPROMPT(); return(CONSTANT); } 1427 YY_BREAK 1428 case 53: 1429 /* rule 53 can match eol */ 1430 YY_RULE_SETUP 1431 #line 258 "cint_scanner.l" 1432 { *yylval = cint_ast_string(yytext); NOPROMPT(); return(STRING_LITERAL); } 1433 YY_BREAK 1434 case 54: 1435 YY_RULE_SETUP 1436 #line 260 "cint_scanner.l" 1437 { NOPROMPT(); return(ELLIPSIS); } 1438 YY_BREAK 1439 case 55: 1440 YY_RULE_SETUP 1441 #line 261 "cint_scanner.l" 1442 { NOPROMPT(); return(RIGHT_ASSIGN); } 1443 YY_BREAK 1444 case 56: 1445 YY_RULE_SETUP 1446 #line 262 "cint_scanner.l" 1447 { NOPROMPT(); return(LEFT_ASSIGN); } 1448 YY_BREAK 1449 case 57: 1450 YY_RULE_SETUP 1451 #line 263 "cint_scanner.l" 1452 { NOPROMPT(); return(ADD_ASSIGN); } 1453 YY_BREAK 1454 case 58: 1455 YY_RULE_SETUP 1456 #line 264 "cint_scanner.l" 1457 { NOPROMPT(); return(SUB_ASSIGN); } 1458 YY_BREAK 1459 case 59: 1460 YY_RULE_SETUP 1461 #line 265 "cint_scanner.l" 1462 { NOPROMPT(); return(MUL_ASSIGN); } 1463 YY_BREAK 1464 case 60: 1465 YY_RULE_SETUP 1466 #line 266 "cint_scanner.l" 1467 { NOPROMPT(); return(DIV_ASSIGN); } 1468 YY_BREAK 1469 case 61: 1470 YY_RULE_SETUP 1471 #line 267 "cint_scanner.l" 1472 { NOPROMPT(); return(MOD_ASSIGN); } 1473 YY_BREAK 1474 case 62: 1475 YY_RULE_SETUP 1476 #line 268 "cint_scanner.l" 1477 { NOPROMPT(); return(AND_ASSIGN); } 1478 YY_BREAK 1479 case 63: 1480 YY_RULE_SETUP 1481 #line 269 "cint_scanner.l" 1482 { NOPROMPT(); return(XOR_ASSIGN); } 1483 YY_BREAK 1484 case 64: 1485 YY_RULE_SETUP 1486 #line 270 "cint_scanner.l" 1487 { NOPROMPT(); return(OR_ASSIGN); } 1488 YY_BREAK 1489 case 65: 1490 YY_RULE_SETUP 1491 #line 271 "cint_scanner.l" 1492 { NOPROMPT(); return(RIGHT_OP); } 1493 YY_BREAK 1494 case 66: 1495 YY_RULE_SETUP 1496 #line 272 "cint_scanner.l" 1497 { NOPROMPT(); return(LEFT_OP); } 1498 YY_BREAK 1499 case 67: 1500 YY_RULE_SETUP 1501 #line 273 "cint_scanner.l" 1502 { NOPROMPT(); return(INC_OP); } 1503 YY_BREAK 1504 case 68: 1505 YY_RULE_SETUP 1506 #line 274 "cint_scanner.l" 1507 { NOPROMPT(); return(DEC_OP); } 1508 YY_BREAK 1509 case 69: 1510 YY_RULE_SETUP 1511 #line 275 "cint_scanner.l" 1512 { NOPROMPT(); return(PTR_OP); } 1513 YY_BREAK 1514 case 70: 1515 YY_RULE_SETUP 1516 #line 276 "cint_scanner.l" 1517 { NOPROMPT(); return(AND_OP); } 1518 YY_BREAK 1519 case 71: 1520 YY_RULE_SETUP 1521 #line 277 "cint_scanner.l" 1522 { NOPROMPT(); return(OR_OP); } 1523 YY_BREAK 1524 case 72: 1525 YY_RULE_SETUP 1526 #line 278 "cint_scanner.l" 1527 { NOPROMPT(); return(LE_OP); } 1528 YY_BREAK 1529 case 73: 1530 YY_RULE_SETUP 1531 #line 279 "cint_scanner.l" 1532 { NOPROMPT(); return(GE_OP); } 1533 YY_BREAK 1534 case 74: 1535 YY_RULE_SETUP 1536 #line 280 "cint_scanner.l" 1537 { NOPROMPT(); return(EQ_OP); } 1538 YY_BREAK 1539 case 75: 1540 YY_RULE_SETUP 1541 #line 281 "cint_scanner.l" 1542 { NOPROMPT(); return(NE_OP); } 1543 YY_BREAK 1544 case 76: 1545 YY_RULE_SETUP 1546 #line 282 "cint_scanner.l" 1547 { NOPROMPT(); return(';'); } 1548 YY_BREAK 1549 case 77: 1550 YY_RULE_SETUP 1551 #line 283 "cint_scanner.l" 1552 { NOPROMPT(); return('{'); } 1553 YY_BREAK 1554 case 78: 1555 YY_RULE_SETUP 1556 #line 284 "cint_scanner.l" 1557 { NOPROMPT(); return('}'); } 1558 YY_BREAK 1559 case 79: 1560 YY_RULE_SETUP 1561 #line 285 "cint_scanner.l" 1562 { NOPROMPT(); return(','); } 1563 YY_BREAK 1564 case 80: 1565 YY_RULE_SETUP 1566 #line 286 "cint_scanner.l" 1567 { NOPROMPT(); return(':'); } 1568 YY_BREAK 1569 case 81: 1570 YY_RULE_SETUP 1571 #line 287 "cint_scanner.l" 1572 { NOPROMPT(); return('='); } 1573 YY_BREAK 1574 case 82: 1575 YY_RULE_SETUP 1576 #line 288 "cint_scanner.l" 1577 { NOPROMPT(); return('('); } 1578 YY_BREAK 1579 case 83: 1580 YY_RULE_SETUP 1581 #line 289 "cint_scanner.l" 1582 { NOPROMPT(); return(')'); } 1583 YY_BREAK 1584 case 84: 1585 YY_RULE_SETUP 1586 #line 290 "cint_scanner.l" 1587 { NOPROMPT(); return('['); } 1588 YY_BREAK 1589 case 85: 1590 YY_RULE_SETUP 1591 #line 291 "cint_scanner.l" 1592 { NOPROMPT(); return(']'); } 1593 YY_BREAK 1594 case 86: 1595 YY_RULE_SETUP 1596 #line 292 "cint_scanner.l" 1597 { NOPROMPT(); return('.'); } 1598 YY_BREAK 1599 case 87: 1600 YY_RULE_SETUP 1601 #line 293 "cint_scanner.l" 1602 { NOPROMPT(); return('&'); } 1603 YY_BREAK 1604 case 88: 1605 YY_RULE_SETUP 1606 #line 294 "cint_scanner.l" 1607 { NOPROMPT(); return('!'); } 1608 YY_BREAK 1609 case 89: 1610 YY_RULE_SETUP 1611 #line 295 "cint_scanner.l" 1612 { NOPROMPT(); return('~'); } 1613 YY_BREAK 1614 case 90: 1615 YY_RULE_SETUP 1616 #line 296 "cint_scanner.l" 1617 { NOPROMPT(); return('-'); } 1618 YY_BREAK 1619 case 91: 1620 YY_RULE_SETUP 1621 #line 297 "cint_scanner.l" 1622 { NOPROMPT(); return('+'); } 1623 YY_BREAK 1624 case 92: 1625 YY_RULE_SETUP 1626 #line 298 "cint_scanner.l" 1627 { NOPROMPT(); return('*'); } 1628 YY_BREAK 1629 case 93: 1630 YY_RULE_SETUP 1631 #line 299 "cint_scanner.l" 1632 { NOPROMPT(); return('/'); } 1633 YY_BREAK 1634 case 94: 1635 YY_RULE_SETUP 1636 #line 300 "cint_scanner.l" 1637 { NOPROMPT(); return('%'); } 1638 YY_BREAK 1639 case 95: 1640 YY_RULE_SETUP 1641 #line 301 "cint_scanner.l" 1642 { NOPROMPT(); return('<'); } 1643 YY_BREAK 1644 case 96: 1645 YY_RULE_SETUP 1646 #line 302 "cint_scanner.l" 1647 { NOPROMPT(); return('>'); } 1648 YY_BREAK 1649 case 97: 1650 YY_RULE_SETUP 1651 #line 303 "cint_scanner.l" 1652 { NOPROMPT(); return('^'); } 1653 YY_BREAK 1654 case 98: 1655 YY_RULE_SETUP 1656 #line 304 "cint_scanner.l" 1657 { NOPROMPT(); return('|'); } 1658 YY_BREAK 1659 case 99: 1660 YY_RULE_SETUP 1661 #line 305 "cint_scanner.l" 1662 { NOPROMPT(); return('?'); } 1663 YY_BREAK 1664 case 100: 1665 YY_RULE_SETUP 1666 #line 307 "cint_scanner.l" 1667 { /* Ignore white space */ } 1668 YY_BREAK 1669 case 101: 1670 /* rule 101 can match eol */ 1671 YY_RULE_SETUP 1672 #line 308 "cint_scanner.l" 1673 { /* Swallow newlines, scanner will count them */ } 1674 YY_BREAK 1675 case 102: 1676 YY_RULE_SETUP 1677 #line 309 "cint_scanner.l" 1678 { /* Swallow unknown characters [DEFAULT RULE] */ } 1679 YY_BREAK 1680 case 103: 1681 YY_RULE_SETUP 1682 #line 311 "cint_scanner.l" 1683 ECHO; 1684 YY_BREAK 1685 #line 1679 "cint_c.lex.c" 1686 1687 case YY_END_OF_BUFFER: 1688 { 1689 /* Amount of text matched not including the EOB char. */ 1690 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1691 1692 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1693 *yy_cp = yyg->yy_hold_char; 1694 YY_RESTORE_YY_MORE_OFFSET 1695 YY_CHECK_BUFFER_STACK; 1696 1697 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1698 { 1699 /* We're scanning a new file or input source. It's 1700 * possible that this happened because the user 1701 * just pointed yyin at a new source and called 1702 * cint_c_lex(). If so, then we have to assure 1703 * consistency between YY_CURRENT_BUFFER and our 1704 * globals. Here is the right place to do so, because 1705 * this is the first action (other than possibly a 1706 * back-up) that will match for the new input source. 1707 */ 1708 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1709 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1710 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1711 } 1712 1713 /* Note that here we test for yy_c_buf_p "<=" to the position 1714 * of the first EOB in the buffer, since yy_c_buf_p will 1715 * already have been incremented past the NUL character 1716 * (since all states make transitions on EOB to the 1717 * end-of-buffer state). Contrast this with the test 1718 * in input(). 1719 */ 1720 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1721 { /* This was really a NUL. */ 1722 yy_state_type yy_next_state; 1723 1724 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1725 1726 yy_current_state = yy_get_previous_state( yyscanner ); 1727 1728 /* Okay, we're now positioned to make the NUL 1729 * transition. We couldn't have 1730 * yy_get_previous_state() go ahead and do it 1731 * for us because it doesn't know how to deal 1732 * with the possibility of jamming (and we don't 1733 * want to build jamming into it because then it 1734 * will run more slowly). 1735 */ 1736 1737 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1738 1739 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1740 1741 if ( yy_next_state ) 1742 { 1743 /* Consume the NUL. */ 1744 yy_cp = ++yyg->yy_c_buf_p; 1745 yy_current_state = yy_next_state; 1746 goto yy_match; 1747 } 1748 1749 else 1750 { 1751 yy_cp = yyg->yy_c_buf_p; 1752 goto yy_find_action; 1753 } 1754 } 1755 1756 else switch ( yy_get_next_buffer( yyscanner ) ) 1757 { 1758 case EOB_ACT_END_OF_FILE: 1759 { 1760 yyg->yy_did_buffer_switch_on_eof = 0; 1761 1762 if ( cint_c_wrap(yyscanner ) ) 1763 { 1764 /* Note: because we've taken care in 1765 * yy_get_next_buffer() to have set up 1766 * yytext, we can now set up 1767 * yy_c_buf_p so that if some total 1768 * hoser (like flex itself) wants to 1769 * call the scanner after we return the 1770 * YY_NULL, it'll still work - another 1771 * YY_NULL will get returned. 1772 */ 1773 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1774 1775 yy_act = YY_STATE_EOF(YY_START); 1776 goto do_action; 1777 } 1778 1779 else 1780 { 1781 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1782 YY_NEW_FILE; 1783 } 1784 break; 1785 } 1786 1787 case EOB_ACT_CONTINUE_SCAN: 1788 yyg->yy_c_buf_p = 1789 yyg->yytext_ptr + yy_amount_of_matched_text; 1790 1791 yy_current_state = yy_get_previous_state( yyscanner ); 1792 1793 yy_cp = yyg->yy_c_buf_p; 1794 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1795 goto yy_match; 1796 1797 case EOB_ACT_LAST_MATCH: 1798 yyg->yy_c_buf_p = 1799 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 1800 1801 yy_current_state = yy_get_previous_state( yyscanner ); 1802 1803 yy_cp = yyg->yy_c_buf_p; 1804 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1805 goto yy_find_action; 1806 } 1807 break; 1808 } 1809 1810 default: 1811 YY_FATAL_ERROR( 1812 "fatal flex scanner internal error--no action found" ); 1813 } /* end of action switch */ 1814 } /* end of scanning one token */ 1815 } /* end of cint_c_lex */ 1816 1817 /* yy_get_next_buffer - try to read in a new buffer 1818 * 1819 * Returns a code representing an action: 1820 * EOB_ACT_LAST_MATCH - 1821 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1822 * EOB_ACT_END_OF_FILE - end of file 1823 */ 1824 static int yy_get_next_buffer (yyscan_t yyscanner) 1825 { 1826 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1827 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1828 register char *source = yyg->yytext_ptr; 1829 register int number_to_move, i; 1830 int ret_val; 1831 1832 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 1833 YY_FATAL_ERROR( 1834 "fatal flex scanner internal error--end of buffer missed" ); 1835 1836 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1837 { /* Don't try to fill the buffer, so this is an EOF. */ 1838 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 1839 { 1840 /* We matched a single character, the EOB, so 1841 * treat this as a final EOF. 1842 */ 1843 return EOB_ACT_END_OF_FILE; 1844 } 1845 1846 else 1847 { 1848 /* We matched some text prior to the EOB, first 1849 * process it. 1850 */ 1851 return EOB_ACT_LAST_MATCH; 1852 } 1853 } 1854 1855 /* Try to read more data. */ 1856 1857 /* First move last chars to start of buffer. */ 1858 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 1859 1860 for ( i = 0; i < number_to_move; ++i ) 1861 *(dest++) = *(source++); 1862 1863 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1864 /* don't do the read, it's not guaranteed to return an EOF, 1865 * just force an EOF 1866 */ 1867 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 1868 1869 else 1870 { 1871 /* coverity[check_after_deref] */ 1872 size_t num_to_read = 1873 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1874 1875 while ( num_to_read <= 0 ) 1876 { /* Not enough room in the buffer - grow it. */ 1877 1878 /* just a shorter name for the current buffer */ 1879 /* coverity[check_after_deref] */ 1880 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1881 1882 int yy_c_buf_p_offset = 1883 (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 1884 1885 if ( b->yy_is_our_buffer ) 1886 { 1887 int new_size = b->yy_buf_size * 2; 1888 1889 if ( new_size <= 0 ) 1890 b->yy_buf_size += b->yy_buf_size / 8; 1891 else 1892 b->yy_buf_size *= 2; 1893 1894 b->yy_ch_buf = (char *) 1895 /* Include room in for 2 EOB chars. */ 1896 cint_c_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 1897 } 1898 else 1899 /* Can't grow it, we don't own it. */ 1900 b->yy_ch_buf = 0; 1901 1902 if ( ! b->yy_ch_buf ) 1903 YY_FATAL_ERROR( 1904 "fatal error - scanner input buffer overflow" ); 1905 1906 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 1907 1908 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1909 number_to_move - 1; 1910 1911 } 1912 1913 if ( num_to_read > YY_READ_BUF_SIZE ) 1914 num_to_read = YY_READ_BUF_SIZE; 1915 1916 /* Read in more data. */ 1917 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1918 yyg->yy_n_chars, num_to_read ); 1919 1920 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1921 } 1922 1923 if ( yyg->yy_n_chars == 0 ) 1924 { 1925 if ( number_to_move == YY_MORE_ADJ ) 1926 { 1927 ret_val = EOB_ACT_END_OF_FILE; 1928 cint_c_restart(yyin ,yyscanner); 1929 } 1930 1931 else 1932 { 1933 ret_val = EOB_ACT_LAST_MATCH; 1934 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1935 YY_BUFFER_EOF_PENDING; 1936 } 1937 } 1938 1939 else 1940 ret_val = EOB_ACT_CONTINUE_SCAN; 1941 1942 yyg->yy_n_chars += number_to_move; 1943 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 1944 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 1945 1946 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1947 1948 return ret_val; 1949 } 1950 1951 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1952 1953 static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 1954 { 1955 register yy_state_type yy_current_state; 1956 register char *yy_cp; 1957 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1958 1959 yy_current_state = yyg->yy_start; 1960 1961 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 1962 { 1963 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1964 if ( yy_accept[yy_current_state] ) 1965 { 1966 yyg->yy_last_accepting_state = yy_current_state; 1967 yyg->yy_last_accepting_cpos = yy_cp; 1968 } 1969 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1970 { 1971 yy_current_state = (int) yy_def[yy_current_state]; 1972 if ( yy_current_state >= 279 ) 1973 yy_c = yy_meta[(unsigned int) yy_c]; 1974 } 1975 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1976 } 1977 1978 return yy_current_state; 1979 } 1980 1981 /* yy_try_NUL_trans - try to make a transition on the NUL character 1982 * 1983 * synopsis 1984 * next_state = yy_try_NUL_trans( current_state ); 1985 */ 1986 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 1987 { 1988 register int yy_is_jam; 1989 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1990 register char *yy_cp = yyg->yy_c_buf_p; 1991 1992 register YY_CHAR yy_c = 1; 1993 if ( yy_accept[yy_current_state] ) 1994 { 1995 yyg->yy_last_accepting_state = yy_current_state; 1996 yyg->yy_last_accepting_cpos = yy_cp; 1997 } 1998 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1999 { 2000 yy_current_state = (int) yy_def[yy_current_state]; 2001 if ( yy_current_state >= 279 ) 2002 yy_c = yy_meta[(unsigned int) yy_c]; 2003 } 2004 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2005 yy_is_jam = (yy_current_state == 278); 2006 2007 return yy_is_jam ? 0 : yy_current_state; 2008 } 2009 2010 #ifndef YY_NO_INPUT 2011 #ifdef __cplusplus 2012 static int yyinput (yyscan_t yyscanner) 2013 #else 2014 static int input (yyscan_t yyscanner) 2015 #endif 2016 2017 { 2018 int c; 2019 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2020 2021 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2022 2023 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 2024 { 2025 /* yy_c_buf_p now points to the character we want to return. 2026 * If this occurs *before* the EOB characters, then it's a 2027 * valid NUL; if not, then we've hit the end of the buffer. 2028 */ 2029 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 2030 /* This was really a NUL. */ 2031 *yyg->yy_c_buf_p = '\0'; 2032 2033 else 2034 { /* need more input */ 2035 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 2036 ++yyg->yy_c_buf_p; 2037 2038 switch ( yy_get_next_buffer( yyscanner ) ) 2039 { 2040 case EOB_ACT_LAST_MATCH: 2041 /* This happens because yy_g_n_b() 2042 * sees that we've accumulated a 2043 * token and flags that we need to 2044 * try matching the token before 2045 * proceeding. But for input(), 2046 * there's no matching to consider. 2047 * So convert the EOB_ACT_LAST_MATCH 2048 * to EOB_ACT_END_OF_FILE. 2049 */ 2050 2051 /* Reset buffer status. */ 2052 cint_c_restart(yyin ,yyscanner); 2053 2054 /*FALLTHROUGH*/ 2055 2056 case EOB_ACT_END_OF_FILE: 2057 { 2058 if ( cint_c_wrap(yyscanner ) ) 2059 return EOF; 2060 2061 if ( ! yyg->yy_did_buffer_switch_on_eof ) 2062 YY_NEW_FILE; 2063 #ifdef __cplusplus 2064 return yyinput(yyscanner); 2065 #else 2066 return input(yyscanner); 2067 #endif 2068 } 2069 2070 case EOB_ACT_CONTINUE_SCAN: 2071 yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 2072 break; 2073 } 2074 } 2075 } 2076 2077 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 2078 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 2079 yyg->yy_hold_char = *++yyg->yy_c_buf_p; 2080 2081 if ( c == '\n' ) 2082 2083 do{ yylineno++; 2084 yycolumn=0; 2085 }while(0) 2086 ; 2087 2088 return c; 2089 } 2090 #endif /* ifndef YY_NO_INPUT */ 2091 2092 /** Immediately switch to a different input stream. 2093 * @param input_file A readable stream. 2094 * @param yyscanner The scanner object. 2095 * @note This function does not reset the start condition to @c INITIAL . 2096 */ 2097 void cint_c_restart (FILE * input_file , yyscan_t yyscanner) 2098 { 2099 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2100 2101 if ( ! YY_CURRENT_BUFFER ){ 2102 /* coverity[var_deref_op] */ 2103 cint_c_ensure_buffer_stack (yyscanner); 2104 YY_CHECK_BUFFER_STACK; 2105 YY_CURRENT_BUFFER_LVALUE = 2106 cint_c__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 2107 } 2108 2109 cint_c__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 2110 cint_c__load_buffer_state(yyscanner ); 2111 } 2112 2113 /** Switch to a different input buffer. 2114 * @param new_buffer The new input buffer. 2115 * @param yyscanner The scanner object. 2116 */ 2117 void cint_c__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2118 { 2119 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2120 2121 2122 cint_c_ensure_buffer_stack (yyscanner); 2123 if ( YY_CURRENT_BUFFER == new_buffer ) 2124 return; 2125 2126 if ( YY_CURRENT_BUFFER ) 2127 { 2128 /* Flush out information for old buffer. */ 2129 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2130 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2131 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2132 } 2133 2134 YY_CHECK_BUFFER_STACK; 2135 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2136 cint_c__load_buffer_state(yyscanner ); 2137 2138 /* We don't actually know whether we did this switch during 2139 * EOF (cint_c_wrap()) processing, but the only time this flag 2140 * is looked at is after cint_c_wrap() is called, so it's safe 2141 * to go ahead and always set it. 2142 */ 2143 yyg->yy_did_buffer_switch_on_eof = 1; 2144 } 2145 2146 static void cint_c__load_buffer_state (yyscan_t yyscanner) 2147 { 2148 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2149 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 2150 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 2151 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 2152 yyg->yy_hold_char = *yyg->yy_c_buf_p; 2153 } 2154 2155 /** Allocate and initialize an input buffer state. 2156 * @param file A readable stream. 2157 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2158 * @param yyscanner The scanner object. 2159 * @return the allocated buffer state. 2160 */ 2161 YY_BUFFER_STATE cint_c__create_buffer (FILE * file, int size , yyscan_t yyscanner) 2162 { 2163 YY_BUFFER_STATE b; 2164 2165 b = (YY_BUFFER_STATE) cint_c_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2166 if ( ! b ) 2167 YY_FATAL_ERROR( "out of dynamic memory in cint_c__create_buffer()" ); 2168 2169 b->yy_buf_size = size; 2170 2171 /* yy_ch_buf has to be 2 characters longer than the size given because 2172 * we need to put in 2 end-of-buffer characters. 2173 */ 2174 b->yy_ch_buf = (char *) cint_c_alloc(b->yy_buf_size + 2 ,yyscanner ); 2175 if ( ! b->yy_ch_buf ) 2176 YY_FATAL_ERROR( "out of dynamic memory in cint_c__create_buffer()" ); 2177 2178 b->yy_is_our_buffer = 1; 2179 2180 cint_c__init_buffer(b,file ,yyscanner); 2181 2182 return b; 2183 } 2184 2185 /** Destroy the buffer. 2186 * @param b a buffer created with cint_c__create_buffer() 2187 * @param yyscanner The scanner object. 2188 */ 2189 void cint_c__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2190 { 2191 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2192 2193 if ( ! b ) 2194 return; 2195 2196 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 2197 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 2198 2199 if ( b->yy_is_our_buffer ) 2200 cint_c_free((void *) b->yy_ch_buf ,yyscanner ); 2201 2202 cint_c_free((void *) b ,yyscanner ); 2203 } 2204 2205 /* Initializes or reinitializes a buffer. 2206 * This function is sometimes called more than once on the same buffer, 2207 * such as during a cint_c_restart() or at EOF. 2208 */ 2209 static void cint_c__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 2210 2211 { 2212 int oerrno = errno; 2213 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2214 2215 cint_c__flush_buffer(b ,yyscanner); 2216 2217 b->yy_input_file = file; 2218 b->yy_fill_buffer = 1; 2219 2220 /* If b is the current buffer, then cint_c__init_buffer was _probably_ 2221 * called from cint_c_restart() or through yy_get_next_buffer. 2222 * In that case, we don't want to reset the lineno or column. 2223 */ 2224 if (b != YY_CURRENT_BUFFER){ 2225 b->yy_bs_lineno = 1; 2226 b->yy_bs_column = 0; 2227 } 2228 2229 b->yy_is_interactive = 1; 2230 2231 errno = oerrno; 2232 } 2233 2234 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 2235 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 2236 * @param yyscanner The scanner object. 2237 */ 2238 void cint_c__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2239 { 2240 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2241 if ( ! b ) 2242 return; 2243 2244 b->yy_n_chars = 0; 2245 2246 /* We always need two end-of-buffer characters. The first causes 2247 * a transition to the end-of-buffer state. The second causes 2248 * a jam in that state. 2249 */ 2250 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 2251 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 2252 2253 b->yy_buf_pos = &b->yy_ch_buf[0]; 2254 2255 b->yy_at_bol = 1; 2256 b->yy_buffer_status = YY_BUFFER_NEW; 2257 2258 if ( b == YY_CURRENT_BUFFER ) 2259 cint_c__load_buffer_state(yyscanner ); 2260 } 2261 2262 /** Pushes the new state onto the stack. The new state becomes 2263 * the current state. This function will allocate the stack 2264 * if necessary. 2265 * @param new_buffer The new state. 2266 * @param yyscanner The scanner object. 2267 */ 2268 void cint_c_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2269 { 2270 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2271 if (new_buffer == NULL) 2272 return; 2273 2274 cint_c_ensure_buffer_stack(yyscanner); 2275 2276 /* This block is copied from cint_c__switch_to_buffer. */ 2277 if ( YY_CURRENT_BUFFER ) 2278 { 2279 /* Flush out information for old buffer. */ 2280 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2281 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2282 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2283 } 2284 2285 /* Only push if top exists. Otherwise, replace top. */ 2286 if (YY_CURRENT_BUFFER) 2287 yyg->yy_buffer_stack_top++; 2288 YY_CHECK_BUFFER_STACK; 2289 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2290 2291 /* copied from cint_c__switch_to_buffer. */ 2292 cint_c__load_buffer_state(yyscanner ); 2293 yyg->yy_did_buffer_switch_on_eof = 1; 2294 } 2295 2296 /** Removes and deletes the top of the stack, if present. 2297 * The next element becomes the new top. 2298 * @param yyscanner The scanner object. 2299 */ 2300 void cint_c_pop_buffer_state (yyscan_t yyscanner) 2301 { 2302 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2303 if (!YY_CURRENT_BUFFER) 2304 return; 2305 2306 cint_c__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 2307 YY_CURRENT_BUFFER_LVALUE = NULL; 2308 if (yyg->yy_buffer_stack_top > 0) 2309 --yyg->yy_buffer_stack_top; 2310 2311 /* coverity[check_after_deref] */ 2312 if (YY_CURRENT_BUFFER) { 2313 cint_c__load_buffer_state(yyscanner ); 2314 yyg->yy_did_buffer_switch_on_eof = 1; 2315 } 2316 } 2317 2318 /* Allocates the stack if it does not exist. 2319 * Guarantees space for at least one push. 2320 */ 2321 static void cint_c_ensure_buffer_stack (yyscan_t yyscanner) 2322 { 2323 int num_to_alloc; 2324 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2325 2326 if (!yyg->yy_buffer_stack) { 2327 2328 /* First allocation is just for 2 elements, since we don't know if this 2329 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2330 * immediate realloc on the next call. 2331 */ 2332 num_to_alloc = 1; 2333 yyg->yy_buffer_stack = (struct yy_buffer_state**)cint_c_realloc 2334 (NULL, num_to_alloc * sizeof(struct yy_buffer_state*) 2335 , yyscanner); 2336 2337 cint_cparser_memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2338 2339 yyg->yy_buffer_stack_max = num_to_alloc; 2340 yyg->yy_buffer_stack_top = 0; 2341 return; 2342 } 2343 2344 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 2345 2346 /* Increase the buffer to prepare for a possible push. */ 2347 int grow_size = 8 /* arbitrary grow size */; 2348 2349 num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 2350 yyg->yy_buffer_stack = (struct yy_buffer_state**)cint_c_realloc 2351 (yyg->yy_buffer_stack, 2352 num_to_alloc * sizeof(struct yy_buffer_state*) 2353 , yyscanner); 2354 2355 /* zero only the new slots.*/ 2356 cint_cparser_memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 2357 yyg->yy_buffer_stack_max = num_to_alloc; 2358 } 2359 } 2360 2361 /** Setup the input buffer state to scan directly from a user-specified character buffer. 2362 * @param base the character buffer 2363 * @param size the size in bytes of the character buffer 2364 * @param yyscanner The scanner object. 2365 * @return the newly allocated buffer state object. 2366 */ 2367 YY_BUFFER_STATE cint_c__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 2368 { 2369 YY_BUFFER_STATE b; 2370 2371 if ( size < 2 || 2372 base[size-2] != YY_END_OF_BUFFER_CHAR || 2373 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2374 /* They forgot to leave room for the EOB's. */ 2375 return 0; 2376 2377 b = (YY_BUFFER_STATE) cint_c_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2378 if ( ! b ) 2379 YY_FATAL_ERROR( "out of dynamic memory in cint_c__scan_buffer()" ); 2380 2381 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 2382 b->yy_buf_pos = b->yy_ch_buf = base; 2383 b->yy_is_our_buffer = 0; 2384 b->yy_input_file = 0; 2385 b->yy_n_chars = b->yy_buf_size; 2386 b->yy_is_interactive = 0; 2387 b->yy_at_bol = 1; 2388 b->yy_fill_buffer = 0; 2389 b->yy_buffer_status = YY_BUFFER_NEW; 2390 2391 cint_c__switch_to_buffer(b ,yyscanner ); 2392 2393 return b; 2394 } 2395 2396 /** Setup the input buffer state to scan the given bytes. The next call to cint_c_lex() will 2397 * scan from a @e copy of @a bytes. 2398 * @param bytes the byte buffer to scan 2399 * @param len the number of bytes in the buffer pointed to by @a bytes. 2400 * @param yyscanner The scanner object. 2401 * @return the newly allocated buffer state object. 2402 */ 2403 YY_BUFFER_STATE cint_c__scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner) 2404 { 2405 YY_BUFFER_STATE b; 2406 char *buf; 2407 yy_size_t n; 2408 int i; 2409 2410 /* Get memory for full buffer, including space for trailing EOB's. */ 2411 n = len + 2; 2412 buf = (char *) cint_c_alloc(n ,yyscanner ); 2413 if ( ! buf ) 2414 YY_FATAL_ERROR( "out of dynamic memory in cint_c__scan_bytes()" ); 2415 2416 for ( i = 0; i < len; ++i ) 2417 buf[i] = bytes[i]; 2418 2419 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; 2420 2421 b = cint_c__scan_buffer(buf,n ,yyscanner); 2422 if ( ! b ) 2423 YY_FATAL_ERROR( "bad buffer in cint_c__scan_bytes()" ); 2424 2425 /* It's okay to grow etc. this buffer, and we should throw it 2426 * away when we're done. 2427 */ 2428 b->yy_is_our_buffer = 1; 2429 2430 return b; 2431 } 2432 2433 /* Redefine yyless() so it works in section 3 code. */ 2434 2435 #undef yyless 2436 #define yyless(n) \ 2437 do \ 2438 { \ 2439 /* Undo effects of setting up yytext. */ \ 2440 int yyless_macro_arg = (n); \ 2441 YY_LESS_LINENO(yyless_macro_arg);\ 2442 yytext[yyleng] = yyg->yy_hold_char; \ 2443 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 2444 yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 2445 *yyg->yy_c_buf_p = '\0'; \ 2446 yyleng = yyless_macro_arg; \ 2447 } \ 2448 while ( 0 ) 2449 2450 /* Accessor methods (get/set functions) to struct members. */ 2451 2452 /** Get the user-defined data for this scanner. 2453 * @param yyscanner The scanner object. 2454 */ 2455 YY_EXTRA_TYPE cint_c_get_extra (yyscan_t yyscanner) 2456 { 2457 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2458 return yyextra; 2459 } 2460 2461 /** Get the current line number. 2462 * @param yyscanner The scanner object. 2463 */ 2464 int cint_c_get_lineno (yyscan_t yyscanner) 2465 { 2466 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2467 2468 if (! YY_CURRENT_BUFFER) 2469 return 0; 2470 2471 return yylineno; 2472 } 2473 2474 /** Get the current column number. 2475 * @param yyscanner The scanner object. 2476 */ 2477 int cint_c_get_column (yyscan_t yyscanner) 2478 { 2479 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2480 2481 if (! YY_CURRENT_BUFFER) 2482 return 0; 2483 2484 return yycolumn; 2485 } 2486 2487 /** Get the input stream. 2488 * @param yyscanner The scanner object. 2489 */ 2490 FILE *cint_c_get_in (yyscan_t yyscanner) 2491 { 2492 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2493 return yyin; 2494 } 2495 2496 /** Get the output stream. 2497 * @param yyscanner The scanner object. 2498 */ 2499 FILE *cint_c_get_out (yyscan_t yyscanner) 2500 { 2501 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2502 return yyout; 2503 } 2504 2505 /** Get the length of the current token. 2506 * @param yyscanner The scanner object. 2507 */ 2508 int cint_c_get_leng (yyscan_t yyscanner) 2509 { 2510 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2511 return yyleng; 2512 } 2513 2514 /** Get the current token. 2515 * @param yyscanner The scanner object. 2516 */ 2517 2518 char *cint_c_get_text (yyscan_t yyscanner) 2519 { 2520 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2521 return yytext; 2522 } 2523 2524 /** Set the user-defined data. This data is never touched by the scanner. 2525 * @param user_defined The data to be associated with this scanner. 2526 * @param yyscanner The scanner object. 2527 */ 2528 void cint_c_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 2529 { 2530 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2531 yyextra = user_defined ; 2532 } 2533 2534 /** Set the current line number. 2535 * @param line_number 2536 * @param yyscanner The scanner object. 2537 */ 2538 void cint_c_set_lineno (int line_number , yyscan_t yyscanner) 2539 { 2540 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2541 2542 /* lineno is only valid if an input buffer exists. */ 2543 /* coverity[var_deref_op] */ 2544 if (! YY_CURRENT_BUFFER ) 2545 YY_FATAL_ERROR( "cint_c_set_lineno called with no buffer" ); 2546 2547 yylineno = line_number; 2548 } 2549 2550 /** Set the current column. 2551 * @param line_number 2552 * @param yyscanner The scanner object. 2553 */ 2554 void cint_c_set_column (int column_no , yyscan_t yyscanner) 2555 { 2556 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2557 2558 /* column is only valid if an input buffer exists. */ 2559 if (! YY_CURRENT_BUFFER ) 2560 YY_FATAL_ERROR( "cint_c_set_column called with no buffer" ); 2561 2562 yycolumn = column_no; 2563 } 2564 2565 /** Set the input stream. This does not discard the current 2566 * input buffer. 2567 * @param in_str A readable stream. 2568 * @param yyscanner The scanner object. 2569 * @see cint_c__switch_to_buffer 2570 */ 2571 void cint_c_set_in (FILE * in_str , yyscan_t yyscanner) 2572 { 2573 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2574 yyin = in_str ; 2575 } 2576 2577 void cint_c_set_out (FILE * out_str , yyscan_t yyscanner) 2578 { 2579 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2580 yyout = out_str ; 2581 } 2582 2583 int cint_c_get_debug (yyscan_t yyscanner) 2584 { 2585 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2586 return yy_flex_debug; 2587 } 2588 2589 void cint_c_set_debug (int bdebug , yyscan_t yyscanner) 2590 { 2591 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2592 yy_flex_debug = bdebug ; 2593 } 2594 2595 /* Accessor methods for yylval and yylloc */ 2596 2597 YYSTYPE * cint_c_get_lval (yyscan_t yyscanner) 2598 { 2599 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2600 return yylval; 2601 } 2602 2603 void cint_c_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) 2604 { 2605 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2606 yylval = yylval_param; 2607 } 2608 2609 YYLTYPE *cint_c_get_lloc (yyscan_t yyscanner) 2610 { 2611 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2612 return yylloc; 2613 } 2614 2615 void cint_c_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) 2616 { 2617 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2618 yylloc = yylloc_param; 2619 } 2620 2621 static int yy_init_globals (yyscan_t yyscanner) 2622 { 2623 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2624 /* Initialization is the same as for the non-reentrant scanner. 2625 This function is called once per scanner lifetime. */ 2626 2627 yyg->yy_buffer_stack = 0; 2628 yyg->yy_buffer_stack_top = 0; 2629 yyg->yy_buffer_stack_max = 0; 2630 yyg->yy_c_buf_p = (char *) 0; 2631 yyg->yy_init = 1; 2632 yyg->yy_start = 0; 2633 yyg->yy_start_stack_ptr = 0; 2634 yyg->yy_start_stack_depth = 0; 2635 yyg->yy_start_stack = (int *) 0; 2636 2637 /* Defined in main.c */ 2638 #ifdef YY_STDINIT 2639 yyin = stdin; 2640 yyout = stdout; 2641 #else 2642 yyin = (FILE *) 0; 2643 yyout = (FILE *) 0; 2644 #endif 2645 2646 /* For future reference: Set errno on error, since we are called by 2647 * cint_c_lex_init() 2648 */ 2649 return 0; 2650 } 2651 2652 /* User-visible API */ 2653 2654 /* cint_c_lex_init is special because it creates the scanner itself, so it is 2655 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2656 * That's why we explicitly handle the declaration, instead of using our macros. 2657 */ 2658 2659 int cint_c_lex_init(yyscan_t* ptr_yy_globals) 2660 2661 { 2662 if (ptr_yy_globals == NULL){ 2663 errno = EINVAL; 2664 return 1; 2665 } 2666 2667 *ptr_yy_globals = (yyscan_t) cint_c_alloc ( sizeof( struct yyguts_t ), NULL ); 2668 2669 if (*ptr_yy_globals == NULL){ 2670 errno = ENOMEM; 2671 return 1; 2672 } 2673 2674 cint_cparser_memset(*ptr_yy_globals,0,sizeof(struct yyguts_t)); 2675 2676 return yy_init_globals ( *ptr_yy_globals ); 2677 } 2678 2679 /* cint_c_lex_destroy is for both reentrant and non-reentrant scanners. */ 2680 int cint_c_lex_destroy (yyscan_t yyscanner) 2681 { 2682 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2683 2684 /* Pop the buffer stack, destroying each element. */ 2685 while(YY_CURRENT_BUFFER){ 2686 cint_c__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 2687 YY_CURRENT_BUFFER_LVALUE = NULL; 2688 cint_c_pop_buffer_state(yyscanner); 2689 } 2690 2691 /* Destroy the stack itself. */ 2692 cint_c_free(yyg->yy_buffer_stack ,yyscanner); 2693 yyg->yy_buffer_stack = NULL; 2694 2695 /* Destroy the start condition stack. */ 2696 cint_c_free(yyg->yy_start_stack ,yyscanner ); 2697 yyg->yy_start_stack = NULL; 2698 2699 /* Destroy the main struct (reentrant only). */ 2700 cint_c_free ( yyscanner , yyscanner ); 2701 return 0; 2702 } 2703 2704 /* 2705 * Internal utility routines. 2706 */ 2707 2708 #ifndef yytext_ptr 2709 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 2710 { 2711 register int i; 2712 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2713 for ( i = 0; i < n; ++i ) 2714 s1[i] = s2[i]; 2715 } 2716 #endif 2717 2718 #ifdef YY_NEED_STRLEN 2719 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 2720 { 2721 register int n; 2722 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2723 for ( n = 0; s[n]; ++n ) 2724 ; 2725 2726 return n; 2727 } 2728 #endif 2729 2730 #define YYTABLES_NAME "yytables" 2731 2732 #undef YY_NEW_FILE 2733 #undef YY_FLUSH_BUFFER 2734 #undef yy_set_bol 2735 #undef yy_new_buffer 2736 #undef yy_set_interactive 2737 #undef yytext_ptr 2738 #undef YY_DO_BEFORE_ACTION 2739 2740 #ifdef YY_DECL_IS_OURS 2741 #undef YY_DECL_IS_OURS 2742 #undef YY_DECL 2743 #endif 2744 #line 311 "cint_scanner.l" 2745 2746 2747 2748 #include "cint_error.h" 2749 2750 int cint_c_wrap(yyscan_t yyscanner) 2751 { 2752 cint_errno = CINT_E_EXIT; 2753 return(1); 2754 } 2755 2756 void cpp_comment(void) 2757 { 2758 2759 } 2760 2761 /* cint_current_line() 2762 * 2763 * Get current input line from the scanner. Used to construct error messages 2764 * issued from the parser. 2765 * 2766 * Inputs: 2767 * yyscanner: Pointer to scanner control block. 2768 * lineBuffer: Character buffer to receive current scan line. 2769 * lineLen: Size of character buffer. 2770 * column: Pointer to integer that will receive starting column of current 2771 * token in scan line. 2772 * tokLen: Pointer to integer that will receive length of current token. 2773 * 2774 * If current scan line doesn't fit into lineBuffer, trailing characters 2775 * are truncated. If current token is beyond the truncated buffer, column 2776 * and tokLen are set to zero. 2777 */ 2778 char * 2779 cint_current_line(yyscan_t yyscanner, char *const lineBuffer, const int lineLen, 2780 int *column, int *tokLen, char **curFile, int *curLine) 2781 { 2782 struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; 2783 struct cint_extra_type_s *extraInfo = cint_c_get_extra(yyscanner); 2784 const char *buffStart = yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_ch_buf; 2785 const char *buffEnd = &buffStart[yyg->yy_n_chars]; 2786 const char *copyEnd = &lineBuffer[lineLen - 1]; /* Leave room for terminator */ 2787 char *copy = lineBuffer; 2788 char *strPtr; 2789 int tokenLen; 2790 2791 *column = 0; 2792 *tokLen = 0; 2793 tokenLen = 0; 2794 2795 if (*(yyg->yytext_r)) { 2796 /* Back up to start of current line */ 2797 for (strPtr = yyg->yytext_r; (strPtr >= buffStart) && (*strPtr != '\n'); 2798 strPtr--); 2799 strPtr++; 2800 /* Copy current line. */ 2801 for (; (strPtr < buffEnd) && (copy < copyEnd) && (*strPtr != '\n'); strPtr++) { 2802 if (*strPtr) { 2803 *copy++ = *strPtr; 2804 if (strPtr < yyg->yytext_r) { 2805 /* Count columns before current token. */ 2806 if (*strPtr == '\t') { 2807 /* Deal with tabs */ 2808 *column = ((*column + 8) / 8) * 8; 2809 } else { 2810 *column += 1; 2811 } 2812 } else { 2813 /* else count token characters */ 2814 tokenLen++; 2815 } 2816 } else { 2817 /* 2818 * Scanner puts a null terminator at end of current token in 2819 * current line. The saved character is held in "yy_hold_char". 2820 */ 2821 *tokLen = tokenLen; 2822 if (yyg->yy_hold_char == '\n') { 2823 /* Held character is the EOL character */ 2824 break; 2825 } 2826 *copy++ = yyg->yy_hold_char; 2827 } 2828 } 2829 } 2830 *copy = 0; /* Null terminate */ 2831 2832 if (cint_cparser_interactive()) { 2833 *curLine = 0; 2834 *curFile = NULL; 2835 } else { 2836 *curLine = cint_c_get_lineno(yyscanner); 2837 *curFile = 2838 (extraInfo && extraInfo[yyg->yy_buffer_stack_top].currentFileName[0]) ? 2839 extraInfo[yyg->yy_buffer_stack_top].currentFileName : NULL; 2840 } 2841 return lineBuffer; 2842 } 2843 2844 int check_type(yyscan_t scanner) 2845 { 2846 int rv; 2847 struct yyguts_t* yyg = (struct yyguts_t*)scanner; 2848 2849 char* _yytext = cint_c_get_text(scanner); 2850 2851 if(cint_interpreter_is_type(_yytext)) { 2852 rv = TYPE_NAME; 2853 *yylval = cint_ast_type(_yytext); 2854 } 2855 else if(cint_interpreter_is_iterator(_yytext, yylval)) { 2856 rv = ITERATOR; 2857 } 2858 else if(cint_interpreter_is_macro(_yytext, yylval)) { 2859 rv = MACRO; 2860 2861 } 2862 else { 2863 rv = IDENTIFIER; 2864 *yylval = cint_ast_identifier(_yytext); 2865 } 2866 return rv; 2867 } 2868 2869 2870 /******************************************************************************* 2871 * 2872 * YY_INPUT Functions 2873 */ 2874 2875 #if CINT_CONFIG_INCLUDE_PARSER_READLINE == 1 2876 2877 /* YY_INPUT behavior using READLINE */ 2878 void 2879 __yy_input_readline(char* buf, int* result, int max_size, yyscan_t yyscanner) 2880 { 2881 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2882 int rv; 2883 2884 rv = cint_cparser_input_readline(yyin, buf, result, max_size, 2885 cint_scanner_prompt); 2886 if (rv < 0) { 2887 YY_FATAL_ERROR( "input in flex scanner failed" ); 2888 } 2889 } 2890 2891 #define CINT_YY_INPUT __yy_input_readline 2892 2893 #else 2894 2895 /* The default YY_INPUT behavior */ 2896 void 2897 __yy_input_default(char* buf, int* result, int max_size, yyscan_t yyscanner) 2898 { 2899 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2900 int rv; 2901 2902 rv = cint_cparser_input_default(yyin, buf, result, max_size, 2903 cint_scanner_prompt); 2904 if (rv < 0) { 2905 YY_FATAL_ERROR( "input in flex scanner failed" ); 2906 } 2907 } 2908 2909 /* The default YY_INPUT behavior with optional character echo */ 2910 void 2911 __yy_input_default_echo(char* buf, int* result, int max_size, yyscan_t yyscanner) 2912 { 2913 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2914 int rv; 2915 2916 rv = cint_cparser_input_default_echo(yyin, buf, result, max_size, 2917 cint_scanner_prompt, 2918 cint_scanner_echo); 2919 if (rv < 0) { 2920 YY_FATAL_ERROR( "input in flex scanner failed" ); 2921 } 2922 } 2923 2924 #define CINT_YY_INPUT __yy_input_default 2925 2926 #endif /* CINT_CONFIG_INCLUDE_PARSER_READLINE */ 2927 2928 /* 2929 * This is the YY_INPUT function called by the scanner. 2930 */ 2931 2932 void 2933 __yy_input(char* buf, int* result, int max_size, yyscan_t scanner) 2934 { 2935 CINT_YY_INPUT(buf, result, max_size, scanner); 2936 } 2937 2938 2939 void 2940 cint_c_scanner_start(FILE* handle, void* scanner) 2941 { 2942 struct cint_extra_type_s *extraInfo; 2943 2944 if (handle == 0) { 2945 /* Defaults to standard in */ 2946 handle = stdin; 2947 } 2948 cint_c_restart(handle, scanner); 2949 extraInfo = cint_c_get_extra(scanner); 2950 if (extraInfo == 0) { 2951 extraInfo = 2952 cint_c_alloc(sizeof(struct cint_extra_type_s) * CINT_MAX_INCLUDE_DEPTH, 2953 scanner); 2954 extraInfo->currentFileName[0] = 0; 2955 extraInfo->includedFromFile = NULL; 2956 extraInfo->includedFromLine = -1; 2957 cint_c_set_extra(extraInfo, scanner); 2958 } 2959 } 2960 2961 int 2962 cint_c_scanner_finish(void *scanner) 2963 { 2964 struct cint_extra_type_s *extraInfo = cint_c_get_extra(scanner); 2965 2966 if (extraInfo) { 2967 cint_c_free(extraInfo, scanner); 2968 } 2969 return cint_c_lex_destroy(scanner); 2970 } 2971 2972 #else /* CINT_CONFIG_INCLUDE_PARSER */ 2973 int cint_lexer_c_not_empty; 2974 #endif 2975 2976