/* ** Inserted at beginning of c files generated by flex ** REMEMBER: Change flex.reset too. */ /*@-allmacros@*/ /*@-pred@*/ /*@-globstate@*/ /*@-null@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macrospec@*/ /*@-macroredef@*/ /*@-exitarg@*/ /*@-compdef@*/ /*@-uniondef@*/ /*@+ignorequals@*/ /*@-noreturn@*/ /*@-mustfree@*/ /*@-compdestroy@*/ /*@-branchstate@*/ /*@-unreachable@*/ /*@-varuse@*/ /*@-fcnuse@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-redecl@*/ /*@-loopswitchbreak@*/ /*@-switchswitchbreak@*/ /*@-sizeoftype@*/ /*@-czechfcns@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-ifblock@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-elseifcomplete@*/ /*@+ptrnegate@*/ /*@-onlytrans@*/ /*@-temptrans@*/ /*@-immediatetrans@*/ /*@-namechecks@*/ /*@+matchanyintegral@*/ /*@-statictrans@*/ /*@-compmempass@*/ /*@-forempty@*/ /*@-evalorder@*/ /*@-retalias@*/ /*@-dependenttrans@*/ /*@-noeffect@*/ /*@-protoparammatch@*/ /*@-casebreak@*/ /*@-retvalother@*/ # ifdef __LCLINT__ /*@-redecl@*/ /*@-type@*/ extern int lsllex (void); /*@=redecl@*/ /*@=type@*/ /* ** Need to do this because ECHO is defined by the Posix library. ** flex shouldn't use it. */ /*@notfunction@*/ # define ECHO \ fwrite (yytext, yyleng, 1, yyout) # ifndef DEFFILENO extern /*@external@*/ int fileno (/* FILE *stream */); # define DEFFILENO # endif # endif # ifdef OSF # undef __GNUC__ # endif /*@-redecl@*/ /* < end of flex.head > */ /* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header$ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 168 #define YY_END_OF_BUFFER 169 static yyconst short int yy_accept[500] = { 0, 0, 0, 169, 167, 147, 148, 135, 167, 3, 79, 141, 134, 167, 129, 130, 139, 138, 126, 137, 133, 140, 88, 88, 127, 123, 142, 128, 143, 146, 167, 131, 166, 132, 144, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 124, 145, 125, 136, 122, 0, 42, 0, 2, 79, 108, 164, 165, 117, 109, 0, 0, 106, 114, 104, 115, 105, 116, 0, 98, 1, 107, 101, 84, 0, 90, 89, 0, 88, 113, 119, 121, 120, 112, 0, 0, 0, 110, 79, 79, 79, 79, 79, 79, 79, 79, 9, 79, 79, 79, 79, 79, 79, 79, 13, 44, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 111, 118, 0, 0, 2, 92, 4, 0, 96, 97, 98, 0, 99, 100, 86, 85, 0, 95, 91, 91, 80, 103, 102, 154, 155, 152, 157, 162, 153, 163, 158, 161, 156, 159, 160, 0, 0, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 11, 79, 79, 27, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 43, 79, 79, 79, 79, 79, 79, 74, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 0, 42, 0, 0, 98, 0, 96, 97, 0, 101, 87, 87, 93, 94, 81, 82, 151, 0, 0, 79, 79, 39, 79, 6, 29, 79, 79, 79, 79, 79, 79, 10, 25, 79, 79, 79, 79, 12, 79, 79, 79, 51, 79, 31, 79, 79, 52, 79, 79, 68, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 26, 79, 79, 79, 0, 98, 83, 83, 0, 150, 79, 79, 5, 79, 36, 79, 79, 79, 79, 79, 79, 79, 30, 79, 79, 79, 79, 79, 79, 79, 79, 79, 69, 79, 79, 79, 79, 79, 79, 79, 32, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 77, 24, 79, 79, 79, 79, 79, 18, 76, 149, 79, 79, 79, 79, 79, 79, 79, 28, 79, 38, 79, 21, 79, 54, 78, 79, 60, 79, 79, 79, 79, 79, 79, 58, 79, 14, 75, 34, 15, 79, 41, 22, 17, 79, 79, 79, 79, 79, 72, 19, 20, 79, 37, 47, 64, 79, 79, 8, 79, 59, 79, 79, 79, 62, 53, 79, 79, 45, 79, 79, 57, 79, 46, 61, 79, 23, 79, 79, 79, 79, 65, 7, 79, 73, 79, 79, 70, 16, 79, 40, 79, 55, 79, 33, 35, 79, 71, 56, 79, 79, 79, 67, 79, 79, 79, 63, 79, 79, 79, 79, 79, 79, 79, 48, 79, 79, 66, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 50, 79, 79, 49, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 30, 32, 33, 34, 8, 8, 8, 35, 36, 37, 8, 8, 8, 38, 39, 40, 41, 42, 8, 43, 44, 8, 45, 46, 47, 48, 49, 50, 1, 51, 52, 53, 54, 55, 56, 57, 58, 59, 8, 60, 61, 62, 63, 64, 65, 8, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[79] = { 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1 } ; static yyconst short int yy_base[507] = { 0, 0, 0, 641, 642, 642, 642, 615, 73, 0, 0, 55, 71, 592, 642, 642, 613, 67, 642, 68, 66, 74, 80, 85, 642, 642, 65, 612, 82, 642, 91, 642, 642, 642, 611, 585, 28, 568, 67, 40, 65, 72, 569, 88, 55, 568, 79, 101, 580, 575, 103, 90, 566, 51, 570, 568, 642, 113, 642, 642, 642, 133, 163, 623, 0, 0, 642, 642, 642, 642, 642, 100, 139, 642, 642, 642, 642, 642, 642, 607, 155, 642, 642, 162, 172, 164, 117, 141, 0, 204, 599, 642, 642, 642, 598, 245, 585, 585, 642, 567, 546, 550, 562, 549, 145, 552, 141, 545, 546, 543, 144, 550, 546, 543, 540, 0, 99, 544, 551, 544, 541, 532, 534, 540, 533, 543, 537, 529, 533, 529, 174, 538, 156, 158, 538, 162, 533, 529, 521, 524, 184, 538, 140, 528, 531, 642, 642, 242, 172, 0, 642, 642, 235, 642, 642, 251, 243, 642, 642, 192, 193, 246, 272, 642, 642, 233, 642, 642, 642, 544, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 545, 546, 518, 513, 516, 528, 523, 511, 523, 228, 524, 519, 521, 517, 509, 506, 514, 501, 516, 0, 502, 506, 509, 494, 497, 500, 503, 493, 495, 496, 501, 488, 481, 0, 498, 484, 498, 491, 214, 480, 0, 482, 481, 483, 490, 491, 475, 473, 473, 475, 484, 483, 479, 481, 471, 475, 466, 246, 478, 480, 469, 468, 215, 307, 525, 278, 283, 300, 642, 642, 302, 304, 642, 642, 642, 642, 249, 265, 642, 499, 487, 462, 451, 0, 463, 0, 0, 462, 453, 461, 450, 455, 456, 0, 0, 449, 449, 459, 445, 0, 449, 454, 449, 0, 272, 0, 454, 439, 0, 441, 451, 0, 451, 445, 439, 435, 446, 431, 433, 443, 429, 441, 431, 435, 434, 439, 438, 424, 426, 434, 432, 430, 422, 427, 428, 416, 428, 0, 412, 424, 424, 309, 314, 642, 642, 449, 642, 409, 410, 0, 281, 0, 411, 412, 418, 416, 415, 406, 405, 0, 412, 400, 404, 410, 408, 406, 400, 390, 391, 0, 407, 388, 388, 399, 393, 390, 398, 0, 397, 394, 398, 395, 379, 388, 390, 375, 388, 389, 0, 0, 378, 386, 382, 377, 378, 0, 0, 642, 368, 380, 380, 369, 363, 363, 375, 0, 375, 377, 358, 0, 375, 0, 0, 369, 0, 363, 368, 358, 360, 357, 364, 0, 357, 0, 0, 358, 0, 355, 0, 0, 0, 359, 353, 357, 352, 356, 0, 0, 0, 349, 0, 0, 342, 354, 352, 0, 343, 0, 344, 334, 330, 0, 0, 320, 327, 0, 314, 308, 0, 310, 0, 0, 311, 0, 316, 315, 313, 299, 0, 0, 298, 0, 303, 295, 0, 0, 307, 0, 293, 0, 305, 299, 0, 291, 0, 0, 283, 301, 299, 0, 290, 293, 286, 0, 292, 280, 293, 290, 276, 286, 264, 0, 280, 257, 0, 250, 204, 189, 198, 174, 178, 161, 137, 148, 100, 0, 48, 28, 0, 642, 375, 379, 383, 388, 392, 394, 399 } ; static yyconst short int yy_def[507] = { 0, 499, 1, 499, 499, 499, 499, 499, 500, 501, 502, 499, 499, 503, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 499, 499, 499, 499, 499, 500, 499, 500, 504, 502, 499, 499, 499, 499, 499, 503, 503, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 505, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 499, 499, 499, 506, 504, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 505, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 506, 499, 506, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 499, 499, 499, 499, 499, 499, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 499, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 0, 499, 499, 499, 499, 499, 499, 499 } ; static yyconst short int yy_nxt[721] = { 0, 4, 5, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 10, 43, 44, 45, 10, 46, 47, 48, 49, 50, 51, 52, 53, 54, 10, 55, 10, 56, 57, 58, 59, 62, 66, 69, 74, 498, 79, 76, 80, 80, 81, 90, 91, 100, 75, 77, 78, 106, 70, 101, 83, 82, 84, 84, 141, 83, 107, 89, 89, 93, 94, 95, 118, 150, 85, 497, 119, 142, 86, 85, 103, 96, 63, 86, 87, 111, 88, 104, 108, 87, 109, 97, 67, 105, 68, 112, 121, 85, 113, 110, 145, 62, 85, 86, 499, 122, 115, 137, 86, 72, 123, 87, 71, 116, 88, 124, 87, 117, 138, 125, 131, 163, 201, 132, 133, 139, 126, 147, 147, 202, 134, 148, 127, 135, 128, 496, 136, 80, 80, 164, 243, 161, 63, 161, 155, 155, 162, 162, 163, 152, 153, 146, 83, 154, 84, 84, 156, 157, 187, 190, 158, 238, 188, 239, 164, 495, 85, 494, 191, 221, 159, 195, 152, 153, 196, 226, 160, 223, 154, 156, 157, 244, 222, 243, 83, 158, 89, 89, 493, 85, 227, 253, 216, 217, 224, 159, 252, 218, 85, 232, 233, 492, 86, 160, 219, 234, 147, 147, 87, 491, 148, 490, 245, 235, 245, 236, 253, 246, 246, 489, 250, 85, 250, 252, 244, 251, 251, 86, 162, 162, 296, 256, 488, 155, 155, 87, 168, 257, 169, 297, 170, 171, 172, 173, 174, 247, 248, 175, 176, 249, 177, 178, 179, 323, 162, 162, 256, 268, 269, 315, 246, 246, 316, 324, 257, 246, 246, 254, 247, 248, 255, 147, 147, 487, 249, 148, 486, 321, 153, 321, 323, 154, 322, 322, 251, 251, 251, 251, 324, 343, 254, 322, 322, 485, 484, 255, 322, 322, 380, 157, 344, 153, 158, 483, 482, 381, 154, 481, 480, 248, 479, 478, 249, 477, 476, 475, 474, 473, 472, 471, 470, 469, 157, 468, 467, 466, 465, 158, 464, 463, 462, 461, 248, 460, 459, 458, 457, 249, 61, 61, 61, 61, 61, 64, 456, 455, 64, 65, 454, 65, 65, 71, 71, 453, 71, 71, 149, 452, 149, 149, 165, 165, 242, 242, 242, 242, 242, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 499, 320, 319, 318, 317, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 241, 240, 237, 231, 230, 229, 228, 225, 220, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 200, 199, 198, 197, 194, 193, 192, 189, 186, 185, 184, 183, 182, 181, 180, 167, 166, 151, 499, 144, 143, 140, 130, 129, 120, 114, 102, 99, 98, 92, 73, 72, 60, 499, 3, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499 } ; static yyconst short int yy_chk[721] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 11, 12, 17, 497, 20, 19, 20, 20, 21, 26, 26, 36, 17, 19, 19, 39, 12, 36, 22, 21, 22, 22, 53, 23, 39, 23, 23, 28, 28, 30, 44, 71, 22, 496, 44, 53, 22, 23, 38, 30, 8, 23, 22, 41, 22, 38, 40, 23, 40, 30, 11, 38, 11, 41, 46, 22, 41, 40, 57, 61, 23, 22, 72, 46, 43, 51, 23, 71, 46, 22, 72, 43, 22, 47, 23, 43, 51, 47, 50, 86, 116, 50, 50, 51, 47, 62, 62, 116, 50, 62, 47, 50, 47, 494, 50, 80, 80, 87, 148, 85, 61, 85, 83, 83, 85, 85, 86, 80, 80, 57, 84, 80, 84, 84, 83, 83, 104, 106, 83, 142, 104, 142, 87, 493, 84, 492, 106, 132, 84, 110, 80, 80, 110, 135, 84, 133, 80, 83, 83, 148, 132, 242, 89, 83, 89, 89, 491, 84, 135, 160, 130, 130, 133, 84, 159, 130, 89, 140, 140, 490, 89, 84, 130, 140, 147, 147, 89, 489, 147, 488, 152, 140, 152, 140, 160, 152, 152, 487, 156, 89, 156, 159, 242, 156, 156, 89, 161, 161, 218, 165, 486, 155, 155, 89, 95, 165, 95, 218, 95, 95, 95, 95, 95, 155, 155, 95, 95, 155, 95, 95, 95, 256, 162, 162, 165, 189, 189, 237, 245, 245, 237, 257, 165, 246, 246, 162, 155, 155, 162, 243, 243, 485, 155, 243, 483, 247, 246, 247, 256, 246, 247, 247, 250, 250, 251, 251, 257, 284, 162, 321, 321, 482, 480, 162, 322, 322, 330, 251, 284, 246, 251, 479, 478, 330, 246, 477, 476, 322, 475, 474, 322, 472, 471, 470, 468, 467, 466, 463, 461, 460, 251, 458, 456, 453, 452, 251, 450, 447, 446, 445, 322, 444, 442, 439, 437, 322, 500, 500, 500, 500, 500, 501, 436, 434, 501, 502, 433, 502, 502, 503, 503, 430, 503, 503, 504, 429, 504, 504, 505, 505, 506, 506, 506, 506, 506, 428, 426, 424, 423, 422, 419, 415, 414, 413, 412, 411, 407, 405, 402, 400, 399, 398, 397, 396, 395, 393, 390, 388, 387, 386, 384, 383, 382, 381, 380, 379, 378, 374, 373, 372, 371, 370, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 356, 355, 354, 353, 352, 351, 350, 348, 347, 346, 345, 344, 343, 342, 341, 340, 338, 337, 336, 335, 334, 333, 332, 328, 327, 325, 320, 319, 318, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 290, 289, 287, 286, 282, 281, 280, 278, 277, 276, 275, 272, 271, 270, 269, 268, 267, 264, 262, 261, 260, 259, 244, 241, 240, 239, 238, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 219, 217, 216, 215, 214, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 198, 197, 196, 195, 194, 193, 192, 191, 190, 188, 187, 186, 185, 184, 183, 182, 181, 180, 169, 144, 143, 141, 139, 138, 137, 136, 134, 131, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 114, 113, 112, 111, 109, 108, 107, 105, 103, 102, 101, 100, 99, 97, 96, 94, 90, 79, 63, 55, 54, 52, 49, 48, 45, 42, 37, 35, 34, 27, 16, 13, 7, 3, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "cscanner.l" #define INITIAL 0 /*;-*-C-*-; ** Copyright (c) Massachusetts Institute of Technology 1994-1998. ** All Rights Reserved. ** Unpublished rights reserved under the copyright laws of ** the United States. ** ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED ** OR IMPLIED. ANY USE IS AT YOUR OWN RISK. ** ** This code is distributed freely and may be used freely under the ** following conditions: ** ** 1. This notice may not be removed or altered. ** ** 2. Works derived from this code are not distributed for ** commercial gain without explicit permission from MIT ** (for permission contact lclint-request@sds.lcs.mit.edu). */ /* * Modified by Herbert 08/19/97: * - added #include for IBM's OS/2 compiler. * - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only). */ /* * Modified by Mike Smith * Corrected missing 'line' in scanf() calls in handleSpecial(). * Without this, I get an error when LCLint hits a '#line' directive * in the pre-pre-processed source files. For safety, I have made these * conditional on OS2 and MSDOS because I don't understand why noone else * has seen this problem. * * Modified by Mike Smith, 4th June 1997 * Finally resolved the #line problem. The scanf() calls have been fixed to * allow the following #line forms:- * * #line 123 "filename" * #line 123 * # 123 "filename" * # 123 * * The last two are generated by the GNU pre-processor, apparently */ #line 56 "cscanner.l" /* ** based on original C lexer by Nate Osgood ** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993 ** */ # include "lclintMacros.nf" # include "basic.h" # ifdef SANITIZER # include "sgrammar.h" # include "sgrammar_tokens.h" # else # include "cgrammar.h" # include "cgrammar_tokens.h" # endif # include "fileIdList.h" # include "portab.h" # if defined(OS2) && defined(__IBMC__) /* needed for isatty()... */ # include # endif static bool lastWasString = FALSE; static char savechar = '\0'; /*@notfunction@*/ # define yyinput() (incColumn (), getc (yyin)) /*@-noparams@*/ /*@-incondefs@*/ extern /*@external@*/ int read (); /*@=incondefs@*/ /*@=noparams@*/ static /*@owned@*/ cstring lastidprocessed = cstring_undefined; static int lminput (void); static int tokLength = 0; static bool inSpecPart = FALSE; static bool continueLine = FALSE; static int ninput (void); static char processChar (void); static double processFloat (void); static /*@only@*/ exprNode processString (void); static long processDec (void); static long processHex (void); static int processIdentifier (/*@only@*/ cstring) /*@globals undef lastidprocessed@*/ ; static bool processHashIdentifier (/*@only@*/ cstring) /*@globals undef lastidprocessed@*/ ; static int processSpec (int); static bool handleSpecial (char *); static int handleLlSpecial (void); static void handleMacro (void); static bool processMacro (void); static /*@only@*/ cstring makeIdentifier (char *); /* yes, this is exported! */ bool g_expectingTypeName = TRUE; /* beginning of file can be type name! */ static int returnInt (ctype, long); static int returnFloat (ctype, double); static int returnChar (char); static void setTokLength (int) /*@modifies g_currentloc@*/ ; static void setTokLengthT (size_t) /*@modifies g_currentloc@*/ ; static void advanceLine (void) { tokLength = 0; beginLine (); } /*@-allmacros@*/ # define RETURN_INT(c,i) \ do { lastWasString = FALSE; \ return (returnInt (c, i)); } while (FALSE) # define RETURN_FLOAT(c,f) \ do { lastWasString = FALSE; \ return (returnFloat (c, f)); \ } while (FALSE) # define RETURN_CHAR(c) \ do { lastWasString = FALSE; \ return (returnChar (c)); \ } while (FALSE) # define RETURN_TOK(t) \ do { yylval.tok = lltok_create (t, fileloc_decColumn (g_currentloc, tokLength)); \ tokLength = 0; \ lastWasString = FALSE; \ return (t); } while (FALSE) # define RETURN_TYPE(t, ct) \ do { yylval.ctyp = ct; tokLength = 0; return (t); } while (FALSE) /* don't fileloc_decColumn (g_currentloc, tokLength)); the string could have \n's in it! */ # define RETURN_STRING(c) \ do { yylval.expr = exprNode_stringLiteral (c, fileloc_decColumn (g_currentloc, tokLength)); \ tokLength = 0; \ lastWasString = TRUE; \ return (CCONSTANT); } while (FALSE) # define RETURN_EXPR(e) \ do { yylval.expr = e; \ tokLength = 0; \ lastWasString = TRUE; \ return (CCONSTANT); } while (FALSE) /*@=allmacros@*/ static void setTokLength (int len) { addColumn (len); tokLength = len; } static void setTokLengthT (size_t len) { setTokLength (size_toInt (len)); } # include "flex.head" #line 864 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 189 "cscanner.l" #line 1018 "lex.yy.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 500 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 642 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 191 "cscanner.l" { llfatalbug (cstring_makeLiteral ("Comment in pre-processor output")); } YY_BREAK case 2: YY_RULE_SETUP #line 193 "cscanner.l" { context_saveLocation (); setTokLength (longUnsigned_toInt (mstring_length (yytext))); if (processHashIdentifier (makeIdentifier (yytext + 1))) { if (lastWasString) { ; } else { RETURN_STRING (cstring_makeLiteral ("\"\"")); } } else { if (handleSpecial (yytext)) { setTokLength (1); RETURN_TOK (0); } } } YY_BREAK case 3: YY_RULE_SETUP #line 217 "cscanner.l" { if (handleSpecial (yytext)) { setTokLength (1); RETURN_TOK (0); } } YY_BREAK case 4: YY_RULE_SETUP #line 222 "cscanner.l" { setTokLength (3); RETURN_TOK (CTOK_ELIPSIS); } YY_BREAK case 5: YY_RULE_SETUP #line 223 "cscanner.l" { setTokLength (5); RETURN_TOK (BREAK); } YY_BREAK case 6: YY_RULE_SETUP #line 224 "cscanner.l" { setTokLength (4); RETURN_TOK (CASE); } YY_BREAK case 7: YY_RULE_SETUP #line 225 "cscanner.l" { setTokLength (8); RETURN_TOK (CONTINUE); } YY_BREAK case 8: YY_RULE_SETUP #line 226 "cscanner.l" { setTokLength (7); RETURN_TOK (DEFAULT); } YY_BREAK case 9: YY_RULE_SETUP #line 227 "cscanner.l" { setTokLength (2); RETURN_TOK (DO); } YY_BREAK case 10: YY_RULE_SETUP #line 228 "cscanner.l" { setTokLength (4); RETURN_TOK (CELSE); } YY_BREAK case 11: YY_RULE_SETUP #line 229 "cscanner.l" { setTokLength (3); RETURN_TOK (CFOR); } YY_BREAK case 12: YY_RULE_SETUP #line 230 "cscanner.l" { setTokLength (4); RETURN_TOK (GOTO); } YY_BREAK case 13: YY_RULE_SETUP #line 231 "cscanner.l" { setTokLength (2); RETURN_TOK (CIF); } YY_BREAK case 14: YY_RULE_SETUP #line 232 "cscanner.l" { setTokLength (6); RETURN_TOK (RETURN); } YY_BREAK case 15: YY_RULE_SETUP #line 233 "cscanner.l" { setTokLength (6); RETURN_TOK (CSIZEOF); } YY_BREAK case 16: YY_RULE_SETUP #line 234 "cscanner.l" { setTokLength (8); RETURN_TOK (COFFSETOF); } YY_BREAK case 17: YY_RULE_SETUP #line 235 "cscanner.l" { setTokLength (6); RETURN_TOK (SWITCH); } YY_BREAK case 18: YY_RULE_SETUP #line 236 "cscanner.l" { setTokLength (5); RETURN_TOK (WHILE); } YY_BREAK case 19: YY_RULE_SETUP #line 237 "cscanner.l" { setTokLength (6); RETURN_TOK (VA_ARG); } YY_BREAK case 20: YY_RULE_SETUP #line 238 "cscanner.l" { setTokLength (6); RETURN_TOK (VA_DCL); } YY_BREAK case 21: YY_RULE_SETUP #line 239 "cscanner.l" { /* gcc extension...this might not be appropriate */ setTokLength (6); RETURN_TOK (QINLINE); } YY_BREAK case 22: YY_RULE_SETUP #line 243 "cscanner.l" { setTokLength (6); RETURN_TOK (CSTRUCT); } YY_BREAK case 23: YY_RULE_SETUP #line 244 "cscanner.l" { setTokLength (7); RETURN_TOK (CTYPEDEF); } YY_BREAK case 24: YY_RULE_SETUP #line 246 "cscanner.l" { setTokLength (5); RETURN_TOK (CUNION); } YY_BREAK case 25: YY_RULE_SETUP #line 247 "cscanner.l" { setTokLength (4); RETURN_TOK (CENUM); } YY_BREAK case 26: YY_RULE_SETUP #line 249 "cscanner.l" { setTokLength (4); RETURN_TYPE (CVOID, ctype_void); } YY_BREAK case 27: YY_RULE_SETUP #line 250 "cscanner.l" { setTokLength (3); RETURN_TYPE (CINT, ctype_int); } YY_BREAK case 28: YY_RULE_SETUP #line 251 "cscanner.l" { setTokLength (6); RETURN_TYPE (CDOUBLE, ctype_double); } YY_BREAK case 29: YY_RULE_SETUP #line 252 "cscanner.l" { setTokLength (4); RETURN_TYPE (CGCHAR, ctype_char); } YY_BREAK case 30: YY_RULE_SETUP #line 253 "cscanner.l" { setTokLength (5); RETURN_TYPE (CGFLOAT, ctype_float); } YY_BREAK case 31: YY_RULE_SETUP #line 255 "cscanner.l" { setTokLength (4); RETURN_TOK (QLONG); } YY_BREAK case 32: YY_RULE_SETUP #line 256 "cscanner.l" { setTokLength (5); RETURN_TOK (QSHORT); } YY_BREAK case 33: YY_RULE_SETUP #line 257 "cscanner.l" { setTokLength (8); RETURN_TOK (QUNSIGNED); } YY_BREAK case 34: YY_RULE_SETUP #line 258 "cscanner.l" { setTokLength (6); RETURN_TOK (QSIGNED); } YY_BREAK case 35: YY_RULE_SETUP #line 260 "cscanner.l" { setTokLength (8); RETURN_TOK (QVOLATILE); } YY_BREAK case 36: YY_RULE_SETUP #line 261 "cscanner.l" { setTokLength (5); RETURN_TOK (QCONST); } YY_BREAK /* some systems expect this! [gack!] */ case 37: YY_RULE_SETUP #line 264 "cscanner.l" { setTokLength (7); RETURN_TOK (QCONST); } YY_BREAK case 38: YY_RULE_SETUP #line 266 "cscanner.l" { setTokLength (6); RETURN_TOK (QEXTERN); } YY_BREAK case 39: YY_RULE_SETUP #line 267 "cscanner.l" { setTokLength (4); RETURN_TOK (QAUTO); } YY_BREAK case 40: YY_RULE_SETUP #line 268 "cscanner.l" { setTokLength (8); RETURN_TOK (QREGISTER); } YY_BREAK case 41: YY_RULE_SETUP #line 269 "cscanner.l" { setTokLength (6); RETURN_TOK (QSTATIC); } YY_BREAK case 42: YY_RULE_SETUP #line 271 "cscanner.l" { RETURN_EXPR (processString ()); } YY_BREAK case 43: YY_RULE_SETUP #line 272 "cscanner.l" { return (processSpec (QOUT)); } YY_BREAK case 44: YY_RULE_SETUP #line 273 "cscanner.l" { return (processSpec (QIN)); } YY_BREAK case 45: YY_RULE_SETUP #line 274 "cscanner.l" { return (processSpec (QPARTIAL)); } YY_BREAK case 46: YY_RULE_SETUP #line 275 "cscanner.l" { return (processSpec (QSPECIAL)); } YY_BREAK case 47: YY_RULE_SETUP #line 276 "cscanner.l" { return (processSpec (QANYTYPE)); } YY_BREAK case 48: YY_RULE_SETUP #line 277 "cscanner.l" { return (processSpec (QINTEGRALTYPE)); } YY_BREAK case 49: YY_RULE_SETUP #line 278 "cscanner.l" { return (processSpec (QUNSIGNEDINTEGRALTYPE)); } YY_BREAK case 50: YY_RULE_SETUP #line 279 "cscanner.l" { return (processSpec (QSIGNEDINTEGRALTYPE)); } YY_BREAK case 51: YY_RULE_SETUP #line 280 "cscanner.l" { return (processSpec (QKEEP)); } YY_BREAK case 52: YY_RULE_SETUP #line 281 "cscanner.l" { return (processSpec (QNULL)); } YY_BREAK case 53: YY_RULE_SETUP #line 282 "cscanner.l" { return (processSpec (QNOTNULL)); } YY_BREAK case 54: YY_RULE_SETUP #line 283 "cscanner.l" { return (processSpec (QISNULL)); } YY_BREAK case 55: YY_RULE_SETUP #line 284 "cscanner.l" { return (processSpec (QTRUENULL)); } YY_BREAK case 56: YY_RULE_SETUP #line 285 "cscanner.l" { return (processSpec (QFALSENULL)); } YY_BREAK case 57: YY_RULE_SETUP #line 286 "cscanner.l" { return (processSpec (QRELNULL)); } YY_BREAK case 58: YY_RULE_SETUP #line 287 "cscanner.l" { return (processSpec (QRELDEF)); } YY_BREAK case 59: YY_RULE_SETUP #line 288 "cscanner.l" { return (processSpec (QEXPOSED)); } YY_BREAK case 60: YY_RULE_SETUP #line 289 "cscanner.l" { return (processSpec (QNEWREF)); } YY_BREAK case 61: YY_RULE_SETUP #line 290 "cscanner.l" { return (processSpec (QTEMPREF)); } YY_BREAK case 62: YY_RULE_SETUP #line 291 "cscanner.l" { return (processSpec (QKILLREF)); } YY_BREAK case 63: YY_RULE_SETUP #line 292 "cscanner.l" { return (processSpec (QREFCOUNTED)); } YY_BREAK case 64: YY_RULE_SETUP #line 293 "cscanner.l" { return (processSpec (QCHECKED)); } YY_BREAK case 65: YY_RULE_SETUP #line 294 "cscanner.l" { return (processSpec (QCHECKMOD)); } YY_BREAK case 66: YY_RULE_SETUP #line 295 "cscanner.l" { return (processSpec (QCHECKEDSTRICT)); } YY_BREAK case 67: YY_RULE_SETUP #line 296 "cscanner.l" { return (processSpec (QUNCHECKED)); } YY_BREAK case 68: YY_RULE_SETUP #line 297 "cscanner.l" { return (processSpec (QONLY)); } YY_BREAK case 69: YY_RULE_SETUP #line 298 "cscanner.l" { return (processSpec (QOWNED)); } YY_BREAK case 70: YY_RULE_SETUP #line 299 "cscanner.l" { return (processSpec (QOBSERVER)); } YY_BREAK case 71: YY_RULE_SETUP #line 300 "cscanner.l" { return (processSpec (QDEPENDENT)); } YY_BREAK case 72: YY_RULE_SETUP #line 301 "cscanner.l" { return (processSpec (QUNUSED)); } YY_BREAK case 73: YY_RULE_SETUP #line 302 "cscanner.l" { return (processSpec (QEXTERNAL)); } YY_BREAK case 74: YY_RULE_SETUP #line 303 "cscanner.l" { return (processSpec (QSEF)); } YY_BREAK case 75: YY_RULE_SETUP #line 304 "cscanner.l" { return (processSpec (QSHARED)); } YY_BREAK case 76: YY_RULE_SETUP #line 305 "cscanner.l" { return (processSpec (QYIELD)); } YY_BREAK case 77: YY_RULE_SETUP #line 306 "cscanner.l" { return (processSpec (QUNDEF)); } YY_BREAK case 78: YY_RULE_SETUP #line 307 "cscanner.l" { return (processSpec (QKILLED)); } YY_BREAK case 79: YY_RULE_SETUP #line 308 "cscanner.l" { int tok; context_saveLocation (); setTokLength (longUnsigned_toInt (mstring_length (yytext))); tok = processIdentifier (makeIdentifier (yytext)); if (tok != BADTOK) { return (tok); } } YY_BREAK case 80: YY_RULE_SETUP #line 317 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_uint, processHex ()); } YY_BREAK case 81: YY_RULE_SETUP #line 320 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_lint, processHex ()); } YY_BREAK case 82: YY_RULE_SETUP #line 322 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_uint, processHex ()); } YY_BREAK case 83: YY_RULE_SETUP #line 324 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_ulint, processHex ()); } YY_BREAK case 84: YY_RULE_SETUP #line 326 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_int, processDec ()); } YY_BREAK case 85: YY_RULE_SETUP #line 328 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_uint, processDec ()); } YY_BREAK case 86: YY_RULE_SETUP #line 330 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_lint, processDec ()); } YY_BREAK case 87: YY_RULE_SETUP #line 332 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_ulint, processDec ()); } YY_BREAK case 88: YY_RULE_SETUP #line 334 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_int, processDec ()); } YY_BREAK case 89: YY_RULE_SETUP #line 336 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_uint, processDec ()); } YY_BREAK case 90: YY_RULE_SETUP #line 338 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_lint, processDec ()); } YY_BREAK case 91: YY_RULE_SETUP #line 340 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_INT (ctype_ulint, processDec ()); } YY_BREAK case 92: YY_RULE_SETUP #line 342 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_CHAR (processChar ()); } YY_BREAK case 93: YY_RULE_SETUP #line 344 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_float, processFloat ()); } YY_BREAK case 94: YY_RULE_SETUP #line 346 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_ldouble, processFloat ()); } YY_BREAK case 95: YY_RULE_SETUP #line 348 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_double, processFloat ()); } YY_BREAK case 96: YY_RULE_SETUP #line 351 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_float, processFloat ()); } YY_BREAK case 97: YY_RULE_SETUP #line 353 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_ldouble, processFloat ()); } YY_BREAK case 98: YY_RULE_SETUP #line 355 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_double, processFloat ()); } YY_BREAK case 99: YY_RULE_SETUP #line 358 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_float, processFloat ()); } YY_BREAK case 100: YY_RULE_SETUP #line 360 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_ldouble, processFloat ()); } YY_BREAK case 101: YY_RULE_SETUP #line 362 "cscanner.l" { setTokLengthT (mstring_length (yytext)); RETURN_FLOAT (ctype_double, processFloat ()); } YY_BREAK case 102: YY_RULE_SETUP #line 365 "cscanner.l" { setTokLength (3); RETURN_TOK (RIGHT_ASSIGN); } YY_BREAK case 103: YY_RULE_SETUP #line 366 "cscanner.l" { setTokLength (3); RETURN_TOK (LEFT_ASSIGN); } YY_BREAK case 104: YY_RULE_SETUP #line 367 "cscanner.l" { setTokLength (2); RETURN_TOK (ADD_ASSIGN); } YY_BREAK case 105: YY_RULE_SETUP #line 368 "cscanner.l" { setTokLength (2); RETURN_TOK (SUB_ASSIGN); } YY_BREAK case 106: YY_RULE_SETUP #line 369 "cscanner.l" { setTokLength (2); RETURN_TOK (MUL_ASSIGN); } YY_BREAK case 107: YY_RULE_SETUP #line 370 "cscanner.l" { setTokLength (2); RETURN_TOK (DIV_ASSIGN); } YY_BREAK case 108: YY_RULE_SETUP #line 371 "cscanner.l" { setTokLength (2); RETURN_TOK (MOD_ASSIGN); } YY_BREAK case 109: YY_RULE_SETUP #line 372 "cscanner.l" { setTokLength (2); RETURN_TOK (AND_ASSIGN); } YY_BREAK case 110: YY_RULE_SETUP #line 373 "cscanner.l" { setTokLength (2); RETURN_TOK (XOR_ASSIGN); } YY_BREAK case 111: YY_RULE_SETUP #line 374 "cscanner.l" { setTokLength (2); RETURN_TOK (OR_ASSIGN); } YY_BREAK case 112: YY_RULE_SETUP #line 375 "cscanner.l" { setTokLength (2); RETURN_TOK (RIGHT_OP); } YY_BREAK case 113: YY_RULE_SETUP #line 376 "cscanner.l" { setTokLength (2); RETURN_TOK (LEFT_OP); } YY_BREAK case 114: YY_RULE_SETUP #line 377 "cscanner.l" { setTokLength (2); RETURN_TOK (INC_OP); } YY_BREAK case 115: YY_RULE_SETUP #line 378 "cscanner.l" { setTokLength (2); RETURN_TOK (DEC_OP); } YY_BREAK case 116: YY_RULE_SETUP #line 379 "cscanner.l" { setTokLength (2); RETURN_TOK (ARROW_OP); } YY_BREAK case 117: YY_RULE_SETUP #line 380 "cscanner.l" { setTokLength (2); RETURN_TOK (AND_OP); } YY_BREAK case 118: YY_RULE_SETUP #line 381 "cscanner.l" { setTokLength (2); RETURN_TOK (OR_OP); } YY_BREAK case 119: YY_RULE_SETUP #line 382 "cscanner.l" { setTokLength (2); RETURN_TOK (LE_OP); } YY_BREAK case 120: YY_RULE_SETUP #line 383 "cscanner.l" { setTokLength (2); RETURN_TOK (GE_OP); } YY_BREAK case 121: YY_RULE_SETUP #line 384 "cscanner.l" { setTokLength (2); RETURN_TOK (EQ_OP); } YY_BREAK case 122: YY_RULE_SETUP #line 385 "cscanner.l" { setTokLength (2); RETURN_TOK (NE_OP); } YY_BREAK case 123: YY_RULE_SETUP #line 386 "cscanner.l" { setTokLength (1); RETURN_TOK (TSEMI); } YY_BREAK case 124: YY_RULE_SETUP #line 387 "cscanner.l" { setTokLength (1); RETURN_TOK (TLBRACE); } YY_BREAK case 125: YY_RULE_SETUP #line 388 "cscanner.l" { setTokLength (1); RETURN_TOK (TRBRACE); } YY_BREAK case 126: YY_RULE_SETUP #line 389 "cscanner.l" { setTokLength (1); RETURN_TOK (TCOMMA); } YY_BREAK case 127: YY_RULE_SETUP #line 390 "cscanner.l" { setTokLength (1); RETURN_TOK (TCOLON); } YY_BREAK case 128: YY_RULE_SETUP #line 391 "cscanner.l" { setTokLength (1); RETURN_TOK (TASSIGN); } YY_BREAK case 129: YY_RULE_SETUP #line 392 "cscanner.l" { setTokLength (1); RETURN_TOK (TLPAREN); } YY_BREAK case 130: YY_RULE_SETUP #line 393 "cscanner.l" { setTokLength (1); RETURN_TOK (TRPAREN); } YY_BREAK case 131: YY_RULE_SETUP #line 394 "cscanner.l" { setTokLength (1); RETURN_TOK (TLSQBR); } YY_BREAK case 132: YY_RULE_SETUP #line 395 "cscanner.l" { setTokLength (1); RETURN_TOK (TRSQBR); } YY_BREAK case 133: YY_RULE_SETUP #line 396 "cscanner.l" { setTokLength (1); RETURN_TOK (TDOT); } YY_BREAK case 134: YY_RULE_SETUP #line 397 "cscanner.l" { setTokLength (1); RETURN_TOK (TAMPERSAND); } YY_BREAK case 135: YY_RULE_SETUP #line 398 "cscanner.l" { setTokLength (1); RETURN_TOK (TEXCL); } YY_BREAK case 136: YY_RULE_SETUP #line 401 "cscanner.l" { setTokLength (1); RETURN_TOK (TTILDE); } YY_BREAK case 137: YY_RULE_SETUP #line 402 "cscanner.l" { setTokLength (1); RETURN_TOK (TMINUS); } YY_BREAK case 138: YY_RULE_SETUP #line 403 "cscanner.l" { setTokLength (1); RETURN_TOK (TPLUS); } YY_BREAK case 139: YY_RULE_SETUP #line 404 "cscanner.l" { setTokLength (1); RETURN_TOK (TMULT); } YY_BREAK case 140: YY_RULE_SETUP #line 405 "cscanner.l" { setTokLength (1); RETURN_TOK (TDIV); } YY_BREAK case 141: YY_RULE_SETUP #line 406 "cscanner.l" { setTokLength (1); RETURN_TOK (TPERCENT); } YY_BREAK case 142: YY_RULE_SETUP #line 407 "cscanner.l" { setTokLength (1); RETURN_TOK (TLT); } YY_BREAK case 143: YY_RULE_SETUP #line 408 "cscanner.l" { setTokLength (1); RETURN_TOK (TGT); } YY_BREAK case 144: YY_RULE_SETUP #line 409 "cscanner.l" { setTokLength (1); RETURN_TOK (TCIRC); } YY_BREAK case 145: YY_RULE_SETUP #line 410 "cscanner.l" { setTokLength (1); RETURN_TOK (TBAR); } YY_BREAK case 146: YY_RULE_SETUP #line 411 "cscanner.l" { setTokLength (1); RETURN_TOK (TQUEST); } YY_BREAK case 147: YY_RULE_SETUP #line 413 "cscanner.l" { incColumn (); } YY_BREAK case 148: YY_RULE_SETUP #line 414 "cscanner.l" { context_incLineno (); if (continueLine) { continueLine = FALSE; } else { if (context_inMacro ()) { /* Don't use RETURN_TOK */ yylval.tok = lltok_create (TENDMACRO, g_currentloc); lastWasString = FALSE; return (TENDMACRO); } } } YY_BREAK case 149: YY_RULE_SETUP #line 430 "cscanner.l" { setTokLength (6); if (processMacro ()) { if (context_inIterDef ()) { RETURN_TOK (LLMACROITER); } if (context_inIterEnd ()) { RETURN_TOK (LLMACROEND); } if (context_inMacro ()) { RETURN_TOK (LLMACRO); } } } YY_BREAK case 150: YY_RULE_SETUP #line 447 "cscanner.l" { if (context_inHeader () || context_inFunction ()) { handleMacro (); } else { int nspchar = ninput (); int nspaces; /* ** This is a hack to get the column number correct. */ llassert (nspchar >= '0' && nspchar <= '9'); nspaces = nspchar - '0'; setTokLength (5 + nspaces); if (processMacro ()) { if (context_inIterDef ()) { RETURN_TOK (LLMACROITER); } if (context_inIterEnd ()) { RETURN_TOK (LLMACROEND); } if (context_inMacro ()) { RETURN_TOK (LLMACRO); } } } } YY_BREAK case 151: YY_RULE_SETUP #line 483 "cscanner.l" { setTokLength (4); lldiagmsg (ctype_unparseTable ()); } YY_BREAK case 152: YY_RULE_SETUP #line 484 "cscanner.l" { setTokLength (3); lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc))); } YY_BREAK case 153: YY_RULE_SETUP #line 487 "cscanner.l" { setTokLength (3); usymtab_printLocal (); } YY_BREAK case 154: YY_RULE_SETUP #line 488 "cscanner.l" { setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); } YY_BREAK case 155: YY_RULE_SETUP #line 489 "cscanner.l" { setTokLength (3); lldiagmsg (context_unparse ()); } YY_BREAK case 156: YY_RULE_SETUP #line 490 "cscanner.l" { setTokLength (3); lldiagmsg (context_unparseClauses ()); } YY_BREAK case 157: YY_RULE_SETUP #line 491 "cscanner.l" { setTokLength (3); usymtab_printGuards (); } YY_BREAK case 158: YY_RULE_SETUP #line 492 "cscanner.l" { setTokLength (3); usymtab_printOut (); } YY_BREAK case 159: YY_RULE_SETUP #line 493 "cscanner.l" { setTokLength (3); usymtab_printAll (); } YY_BREAK case 160: YY_RULE_SETUP #line 494 "cscanner.l" { setTokLength (3); usymtab_printComplete (); } YY_BREAK case 161: YY_RULE_SETUP #line 495 "cscanner.l" { setTokLength (3); usymtab_printTypes (); } YY_BREAK case 162: YY_RULE_SETUP #line 496 "cscanner.l" { setTokLength (3); lldiagmsg (usymtab_unparseStack ()); } YY_BREAK case 163: YY_RULE_SETUP #line 497 "cscanner.l" { setTokLength (3); lldiagmsg (message ("Can modify: %q", sRefSet_unparse (context_modList ()))); } YY_BREAK case 164: YY_RULE_SETUP #line 501 "cscanner.l" { /* BEFORE_COMMENT_MARKER */ int tok; incColumn (); incColumn (); tok = handleLlSpecial (); if (tok != BADTOK) { RETURN_TOK (tok); } } YY_BREAK case 165: YY_RULE_SETUP #line 510 "cscanner.l" { /* AFTER_COMMENT_MARKER */ setTokLength (2); inSpecPart = FALSE; RETURN_TOK (QENDMACRO); } YY_BREAK case 166: YY_RULE_SETUP #line 514 "cscanner.l" { incColumn (); continueLine = TRUE; } YY_BREAK case 167: YY_RULE_SETUP #line 515 "cscanner.l" { incColumn (); voptgenerror (FLG_SYNTAX, message ("Invalid character (ascii: %d), skipping character", (int)(*yytext)), g_currentloc); } YY_BREAK case 168: YY_RULE_SETUP #line 522 "cscanner.l" ECHO; YY_BREAK #line 2090 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 500 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 500 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 499); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 522 "cscanner.l" struct skeyword { /*@null@*/ /*@observer@*/ char *name; int token; } ; /* ** These tokens are followed by syntax that is parsed by the ** grammar proper. */ struct skeyword s_parsetable[] = { { "modifies", QMODIFIES } , { "globals", QGLOBALS } , { "alt", QALT } , { "constant", QCONSTANT } , { "function", QFUNCTION } , { "iter", QITER } , { "defines", QDEFINES } , { "uses", QUSES } , { "allocates", QALLOCATES } , { "sets", QSETS } , { "releases", QRELEASES } , { "pre", QPRECLAUSE } , { "post", QPOSTCLAUSE } , { NULL, BADTOK } } ; /* ** These tokens are either stand-alone tokens, or followed by ** token-specific text. */ struct skeyword s_keytable[] = { { "anytype", QANYTYPE } , { "integraltype", QINTEGRALTYPE } , { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } , { "signedintegraltype", QSIGNEDINTEGRALTYPE } , { "out", QOUT } , { "in", QIN } , { "only", QONLY } , { "owned", QOWNED } , { "dependent", QDEPENDENT } , { "partial", QPARTIAL } , { "special", QSPECIAL } , { "truenull", QTRUENULL } , { "falsenull", QFALSENULL } , { "keep", QKEEP } , { "kept", QKEPT } , { "notnull", QNOTNULL } , { "abstract", QABSTRACT } , { "concrete", QCONCRETE } , { "mutable", QMUTABLE } , { "immutable", QIMMUTABLE } , { "unused", QUNUSED } , { "external", QEXTERNAL } , { "sef", QSEF } , { "unique", QUNIQUE } , { "returned", QRETURNED } , { "exposed", QEXPOSED } , { "refcounted", QREFCOUNTED } , { "refs", QREFS } , { "newref", QNEWREF } , { "tempref", QTEMPREF } , { "killref", QKILLREF } , { "null", QNULL } , { "relnull", QRELNULL } , { "reldef", QRELDEF } , { "observer", QOBSERVER } , { "exits", QEXITS } , { "mayexit", QMAYEXIT } , { "trueexit", QTRUEEXIT } , { "falseexit", QFALSEEXIT } , { "neverexit", QNEVEREXIT } , { "temp", QTEMP } , { "shared", QSHARED } , { "ref", QREF } , { "unchecked", QUNCHECKED } , { "checked", QCHECKED } , { "checkmod", QCHECKMOD } , { "checkedstrict", QCHECKEDSTRICT } , { "innercontinue", QINNERCONTINUE } , { "innerbreak", QINNERBREAK } , { "loopbreak", QLOOPBREAK } , { "switchbreak", QSWITCHBREAK } , { "safebreak", QSAFEBREAK } , { "fallthrough", QFALLTHROUGH } , { "l_fallthrou", QLINTFALLTHROUGH } , { "l_fallth", QLINTFALLTHRU } , { "notreached", QNOTREACHED } , { "l_notreach", QLINTNOTREACHED } , { "printflike", QPRINTFLIKE } , { "l_printfli", QLINTPRINTFLIKE } , { "scanflike", QSCANFLIKE } , { "messagelike", QMESSAGELIKE } , { "l_argsus", QARGSUSED } , { NULL, BADTOK } } ; /* ** would be better if these weren't hard coded... */ static bool isArtificial (cstring s) { return (cstring_equalLit (s, "modifies") || cstring_equalLit (s, "globals") || cstring_equalLit (s, "alt")); } void swallowMacro (void) { int i; bool skipnext = FALSE; while ((i = lminput ()) != EOF) { char c = (char) i; if (c == '\\') { skipnext = TRUE; } else if (c == '\n') { if (skipnext) { skipnext = FALSE; } else { checkUngetc (i, yyin); return; } } } if (i != EOF) { checkUngetc (i, yyin); } } static int commentMarkerToken (cstring s) { int i = 0; while (s_parsetable[i].name != NULL) { if (cstring_equalLit (s, s_parsetable[i].name)) { return s_parsetable[i].token; } i++; } return BADTOK; } static int tokenMacroCode (cstring s) { int i = 0; while (s_keytable[i].name != NULL) { if (cstring_equalLit (s, s_keytable[i].name)) { if (s_keytable[i].token == QLINTFALLTHROUGH) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*FALLTHROUGH*/ used. " "This is interpreted by " "LCLint in the same way as most Unix lints, but it is " "preferable to replace it with the /*@fallthrough@*/ " "stylized comment"), g_currentloc); return QFALLTHROUGH; } else if (s_keytable[i].token == QLINTFALLTHRU) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*FALLTHRU*/ used. " "This is interpreted by " "LCLint in the same way as most Unix lints, but it is " "preferable to replace it with the /*@fallthrough@*/ " "stylized comment"), g_currentloc); return QFALLTHROUGH; } else if (s_keytable[i].token == QLINTNOTREACHED) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*NOTREACHED*/ used. " "This is interpreted by " "LCLint in the same way as most Unix lints, but it is " "preferable to replace it with the /*@notreached@*/ " "stylized comment."), g_currentloc); return QNOTREACHED; } else if (s_keytable[i].token == QPRINTFLIKE) { setSpecialFunction (QU_PRINTFLIKE); return SKIPTOK; } else if (s_keytable[i].token == QLINTPRINTFLIKE) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*PRINTFLIKE*/ used. " "This is interpreted by " "LCLint in the same way as most Unix lints, but it is " "preferable to replace it with either /*@printflike@*/, " "/*@scanflike@*/ or /*@messagelike@*/."), g_currentloc); setSpecialFunction (QU_PRINTFLIKE); return SKIPTOK; } else if (s_keytable[i].token == QSCANFLIKE) { setSpecialFunction (QU_SCANFLIKE); return SKIPTOK; } else if (s_keytable[i].token == QMESSAGELIKE) { setSpecialFunction (QU_MESSAGELIKE); return SKIPTOK; } else if (s_keytable[i].token == QARGSUSED) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*ARGSUSED*/ used. " "This is interpreted by " "LCLint in the same way as most Unix lints, but it is " "preferable to use /*@unused@*/ annotations on " "the unused parameters."), g_currentloc); setArgsUsed (); return SKIPTOK; } return s_keytable[i].token; } i++; } return BADTOK; } static int lminput () { if (savechar == '\0') { incColumn (); return (input ()); } else { int save = (int) savechar; savechar = '\0'; return save; } } static void lmsavechar (char c) { if (savechar == '\0') savechar = c; else { llbuglit ("lmsavechar: override"); } } static int returnFloat (ctype ct, double f) { yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext), fileloc_decColumn (g_currentloc, tokLength)); tokLength = 0; return (CCONSTANT); } static int returnInt (ctype ct, long i) { ctype c = ct; if (ctype_equal (ct, ctype_int)) { if (i == 0) { c = context_typeofZero (); } else if (i == 1) { c = context_typeofOne (); } } yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext), fileloc_decColumn (g_currentloc, tokLength), i); tokLength = 0; return (CCONSTANT); } static int returnChar (char c) { yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext), fileloc_decColumn (g_currentloc, tokLength)); tokLength = 0; return (CCONSTANT); } static int ninput () { int c = lminput (); if (c != EOF && ((char)c == '\n')) { context_incLineno (); } return c; } static char macro_nextChar () { static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE; int ic; char c; ic = lminput (); c = char_fromInt (ic); if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0])) { if (c == '\\') { while ((c = char_fromInt (lminput ())) != '\0' && c != '\n') { ; /* skip to newline */ } context_incLineno (); if (c != '\0') { return macro_nextChar (); } else { return c; } } else /* if (c == '@') */ { if (handleLlSpecial () != BADTOK) { llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax"); } return macro_nextChar (); } } else if (!in_escape && c == '\"') { in_quote = !in_quote; } else if (!in_escape && c == '\'') { in_char = !in_char; } else if ((in_quote || in_char) && c == '\\') { in_escape = !in_escape; } else if ((in_quote || in_char) && in_escape) { in_escape = FALSE; } else if (!in_quote && c == '/') { char c2; if ((c2 = char_fromInt (lminput ())) == '*') { while (c2 != '\0') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 != '\n' && c2 != '*') { ; } if (c2 == '*') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 == '*') { ; } if (c2 == '/') { goto outofcomment; } } else { llfatalerror (cstring_makeLiteral ("Macro: bad comment!")); } } outofcomment: return macro_nextChar (); } else { /*** putchar does not work! why? puts to stdio...??! ***/ lmsavechar (c2); } } return c; } /* ** keeps stylized comments */ static char macro_nextCharC () { static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE; char c; c = char_fromInt (lminput ()); if (!in_quote && !in_char && c == '\\') { while ((c = char_fromInt (lminput ())) != '\0' && c != '\n') { ; /* skip to newline */ } context_incLineno (); if (c != '\0') { return macro_nextCharC (); } else { return c; } } else if (!in_escape && c == '\"') { in_quote = !in_quote; } else if (!in_escape && c == '\'') { in_char = !in_char; } else if ((in_quote || in_char) && c == '\\') { in_escape = !in_escape; } else if ((in_quote || in_char) && in_escape) { in_escape = FALSE; } else if (!in_quote && c == '/') { char c2; if ((c2 = char_fromInt (lminput ())) == '*') { while (c2 != '\0') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 != '\n' && c2 != '*') { ; } if (c2 == '*') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 == '*') { ; } if (c2 == '/') { goto outofcomment; } } else { llfatalerror (cstring_makeLiteral ("Macro: bad comment!")); } } outofcomment: return macro_nextCharC (); } else { lmsavechar (c2); } } return c; } /* ** skips whitespace (handles line continuations) ** returns first non-whitespace character */ static char skip_whitespace () { char c; while ((c = macro_nextChar ()) == ' ' || c == '\t') { ; } return c; } static void handleMacro () { cstring mac = cstring_undefined; int macrocode; char c; while (currentColumn () > 2) { mac = cstring_appendChar (mac, ' '); setTokLength (-1); } c = macro_nextCharC (); if (c >= '0' && c <= '9') { int i; for (i = 0; i < ((c - '0') + 1); i++) { mac = cstring_appendChar (mac, ' '); } } else { BADBRANCH; } while (((c = macro_nextCharC ()) != '\0') && (c != '\n')) { mac = cstring_appendChar (mac, c); } macrocode = tokenMacroCode (mac); if (macrocode == BADTOK && !isArtificial (mac)) { DPRINTF (("Add macro: %s", mac)); context_addMacroCache (mac); } else { cstring_free (mac); } if (c == '\n') { context_incLineno (); } } static bool processMacro (void) { uentry e2; ctype ct; int noparams = 0; cstring fname = cstring_undefined; bool res = TRUE; bool isspecfcn = FALSE; bool isiter = FALSE; bool skipparam = FALSE; bool isenditer = FALSE; bool unknownm = FALSE; bool hasParams = FALSE; bool emptyMacro = FALSE; char c = skip_whitespace (); fileloc loc = fileloc_noColumn (g_currentloc); /* are both of these necessary? what do they mean? */ uentryList specparams = uentryList_undefined; uentryList pn = uentryList_undefined; context_resetMacroMissingParams (); if (c == '\0' || c == '\n') { llcontbug (cstring_makeLiteral ("Bad macro")); fileloc_free (loc); return FALSE; } fname = cstring_appendChar (fname, c); while ((c = macro_nextChar ()) != '(' && c != '\0' && c != ' ' && c != '\t' && c != '\n') { fname = cstring_appendChar (fname, c); } if (c == ' ' || c == '\t' || c == '\n') { char oldc = c; if (c != '\n') { while (c == ' ' || c == '\t') { c = macro_nextChar (); } unput (c); } if (c == '\n') { emptyMacro = TRUE; unput (c); } c = oldc; } hasParams = (c == '('); if (usymtab_exists (fname)) { e2 = usymtab_lookupExpose (fname); ct = uentry_getType (e2); if (uentry_isCodeDefined (e2) && fileloc_isUser (uentry_whereDefined (e2))) { if (optgenerror (FLG_MACROREDEF, message ("Macro %s already defined", fname), loc)) { uentry_showWhereDefined (e2); uentry_clearDefined (e2); } if (uentry_isFunction (e2)) { uentry_setType (e2, ctype_unknown); ct = ctype_unknown; unknownm = TRUE; context_enterUnknownMacro (e2); } else { context_enterConstantMacro (e2); } } else { if (uentry_isForward (e2) && uentry_isFunction (e2)) { unknownm = TRUE; voptgenerror (FLG_MACROFCNDECL, message ("Parameterized macro has no prototype or specification: %s ", fname), loc); ct = ctype_unknown; uentry_setType (e2, ctype_unknown); uentry_setFunctionDefined (e2, loc); uentry_setUsed (e2, fileloc_undefined); context_enterUnknownMacro (e2); } else { if (uentry_isIter (e2)) { isiter = TRUE; specparams = uentry_getParams (e2); noparams = uentryList_size (specparams); uentry_setDefined (e2, loc); context_enterIterDef (e2); } else if (uentry_isEndIter (e2)) { isenditer = TRUE; uentry_setDefined (e2, loc); context_enterIterEnd (e2); /* don't care about it now */ /* but should parse like an iter! */ } else if (uentry_isConstant (e2)) { if (hasParams) { voptgenerror (FLG_INCONDEFS, message ("Constant %s implemented as parameterized macro", fname), g_currentloc); uentry_showWhereSpecified (e2); uentry_setType (e2, ctype_unknown); uentry_makeVarFunction (e2); uentry_setDefined (e2, g_currentloc); uentry_setFunctionDefined (e2, g_currentloc); context_enterUnknownMacro (e2); } else { if (!uentry_isSpecified (e2)) { fileloc oloc = uentry_whereDeclared (e2); if (fileloc_isLib (oloc)) { ; } else if (fileloc_isUndefined (oloc) || fileloc_isPreproc (oloc)) { if (!emptyMacro) { voptgenerror (FLG_MACROCONSTDECL, message ("Macro constant %q not declared", uentry_getName (e2)), loc); } } else if (!fileloc_withinLines (oloc, loc, 2)) { /* bogus! will give errors if there is too much whitespace */ voptgenerror (FLG_SYNTAX, message ("Macro constant name %s does not match name in " "previous constant declaration. This constant " "is declared at %q", fname, fileloc_unparse (oloc)), loc); } } context_enterConstantMacro (e2); cstring_free (fname); fileloc_free (loc); return res; } } else if (ctype_isFunction (ct)) { isspecfcn = TRUE; specparams = ctype_argsFunction (ct); noparams = uentryList_size (specparams); uentry_setFunctionDefined (e2, loc); context_enterMacro (e2); } else if (uentry_isVar (e2)) { if (hasParams) { voptgenerror (FLG_INCONDEFS, message ("Variable %s implemented as parameterized macro", fname), loc); uentry_showWhereSpecified (e2); uentry_setType (e2, ctype_unknown); uentry_makeVarFunction (e2); uentry_setDefined (e2, g_currentloc); uentry_setFunctionDefined (e2, g_currentloc); context_enterUnknownMacro (e2); } else { uentry ucons = uentry_makeConstant (fname, ctype_unknown, loc); if (uentry_isExpandedMacro (e2)) { ; /* okay */ } else { if (optgenerror (FLG_INCONDEFS, message ("Variable %s implemented by a macro", fname), loc)) { uentry_showWhereSpecified (e2); } } uentry_setDefined (e2, loc); uentry_setUsed (ucons, loc); context_enterConstantMacro (ucons); uentry_markOwned (ucons); cstring_free (fname); return res; } } else { if (uentry_isDatatype (e2)) { vgenhinterror (FLG_SYNTAX, message ("Type implemented as macro: %x", uentry_getName (e2)), message ("A type is implemented using a macro definition. A " "typedef should be used instead."), g_currentloc); swallowMacro (); /* Must exit scope (not sure why a new scope was entered?) */ usymtab_quietExitScope (g_currentloc); uentry_setDefined (e2, g_currentloc); res = FALSE; } else { llcontbug (message ("Unexpanded macro not function or constant: %q", uentry_unparse (e2))); uentry_setType (e2, ctype_unknown); if (hasParams) { uentry_makeVarFunction (e2); uentry_setDefined (e2, g_currentloc); uentry_setFunctionDefined (e2, g_currentloc); context_enterUnknownMacro (e2); } } } } } } else { uentry ce; voptgenerror (FLG_MACROMATCHNAME, message ("Unexpanded macro %s does not match name of a constant " "or iter declaration. The name used in the control " "comment on the previous line should match. " "(Assuming macro defines a constant.)", fname), loc); ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined); uentry_setUsed (ce, loc); /* perhaps bogus? */ e2 = usymtab_supEntryReturn (ce); context_enterConstantMacro (e2); cstring_free (fname); fileloc_free (loc); return res; } /* in macros, ( must follow immediatetly after name */ if (hasParams) { int paramno = 0; c = skip_whitespace (); while (c != ')' && c != '\0') { uentry param; bool suppress = context_inSuppressRegion (); cstring paramname = cstring_undefined; /* ** save the parameter location */ decColumn (); context_saveLocation (); incColumn (); while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')') { paramname = cstring_appendChar (paramname, c); c = macro_nextChar (); } if (c == ' ' || c == '\t') c = skip_whitespace (); if (c == ',') { c = macro_nextChar (); if (c == ' ' || c == '\t') c = skip_whitespace (); } if (c == '\0') { llfatalerror (cstring_makeLiteral ("Bad macro syntax: uentryList")); } if ((isspecfcn || isiter) && (paramno < noparams) && !uentry_isElipsisMarker (uentryList_getN (specparams, paramno))) { uentry decl = uentryList_getN (specparams, paramno); sRef sr; param = uentry_nameCopy (paramname, decl); uentry_setParam (param); sr = sRef_makeParam (paramno, uentry_getType (param)); if (sRef_getNullState (sr) == NS_ABSNULL) { ctype pt = ctype_realType (uentry_getType (param)); if (ctype_isUser (pt)) { uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt)); if (uentry_isValid (te)) { sRef_setStateFromUentry (sr, te); } } else { sRef_setNullState (sr, NS_UNKNOWN, g_currentloc); } } uentry_setSref (param, sr); uentry_setDeclaredForceOnly (param, context_getSaveLocation ()); skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno)); } else { fileloc sloc = context_getSaveLocation (); param = uentry_makeVariableSrefParam (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown)); cstring_free (paramname); sRef_setPosNull (uentry_getSref (param), sloc); uentry_setDeclaredForce (param, sloc); skipparam = FALSE; fileloc_free (sloc); } if (!skipparam) { llassert (!uentry_isElipsisMarker (param)); if (!suppress) { sRef_makeUnsafe (uentry_getSref (param)); } pn = uentryList_add (pn, uentry_copy (param)); usymtab_supEntry (param); } else { /* don't add param */ uentry_free (param); } if (c == ',') { (void) macro_nextChar (); c = skip_whitespace (); } paramno++; } if (c == ')') { if (isspecfcn || isiter) { if (paramno != noparams && noparams >= 0) { advanceLine (); voptgenerror (FLG_INCONDEFS, message ("Macro %s specified with %d args, defined with %d", fname, noparams, paramno), g_currentloc); uentry_showWhereSpecified (e2); uentry_resetParams (e2, pn); } } else { uentry_resetParams (e2, pn); } } } else { /* ** the form should be: ** ** # define newname oldname ** where oldname refers to a function matching the specification ** of newname. */ if (unknownm) { sRef_setGlobalScope (); usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown)); sRef_clearGlobalScope (); } else { context_setMacroMissingParams (); } } /* context_setuentryList (pn); */ usymtab_enterScope (); fileloc_free (loc); cstring_free (fname); return res; } static bool handleSpecial (char *yyt) { char *l = mstring_create (MAX_NAME_LENGTH); static bool reportcpp = FALSE; int lineno = 0; char c; char *ol; cstring olc; strcpy (l, yyt + 1); /* Need to safe original l for deallocating. */ ol = l; l += strlen (yyt) - 1; while ((c = char_fromInt (lminput ())) != '\n' && c != '\0') { *l++ = c; } *l = '\0'; olc = cstring_fromChars (ol); if (cstring_equalPrefix (olc, "pragma")) { char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN)); char *opname = pname; char *ptr = ol + 6; /* pragma is six characters, plus space */ int len = 0; /* skip whitespace */ while (((c = *ptr) != '\0') && isspace (c)) { ptr++; } while (((c = *ptr) != '\0') && !isspace (c)) { len++; if (len > MAX_PRAGMA_LEN) { break; } ptr++; *pname++ = c; } *pname = '\0'; if (len == PRAGMA_LEN_EXPAND && mstring_equal (opname, PRAGMA_EXPAND)) { cstring exname = cstring_undefined; uentry ue; ptr++; while (((c = *ptr) != '\0') && !isspace (c)) { exname = cstring_appendChar (exname, c); ptr++; } ue = usymtab_lookupExposeGlob (exname); if (uentry_isExpandedMacro (ue)) { if (fileloc_isPreproc (uentry_whereDefined (ue))) { fileloc_setColumn (g_currentloc, 1); uentry_setDefined (ue, g_currentloc); } } cstring_free (exname); } } else if (cstring_equalPrefix (olc, "ident")) { /* Some pre-processors will leave these in the code. Ignore rest of line */ } /* ** Yuk...Win32 filenames can have spaces in them...we need to read ** to the matching end quote. */ else if ((sscanf (ol, "line %d \"", &lineno) == 1) || (sscanf (ol, " %d \"", &lineno) == 1)) { char *tmp = ol; char *fname; fileId fid; while (*tmp != '\"' && *tmp != '\0') { tmp++; } llassert (*tmp == '\"'); tmp++; fname = tmp; while (*tmp != '\"' && *tmp != '\0') { tmp++; } llassert (*tmp == '\"'); *tmp = '\0'; DPRINTF (("fname: %s", fname)); # if defined(OS2) || defined(MSDOS) || defined(WIN32) /* ** DOS-like path delimiters get delivered in pairs, something like ** \"..\\\\file.h\", so we have to make it normal again. We do NOT ** remove the pre dirs yet as we usually specify tmp paths relative ** to the current directory, so tmp files would not get found in ** the hash table. If this method fails we try it again later. */ { char *stmp = fname; /* ** Skip past the drive marker. */ DPRINTF (("stmp: %s / %s", stmp, fname)); if (strchr (stmp, ':') != NULL) { stmp = strchr (stmp, ':') + 1; } DPRINTF (("stmp: %s / %s", stmp, fname)); while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL ) { if (*(stmp+1) == CONNECTCHAR) { memmove (stmp, stmp+1, strlen (stmp)); } stmp++; DPRINTF (("stmp: %s / %s", stmp, fname)); } DPRINTF (("Now: base = %s", fname)); fid = fileTable_lookupBase (context_fileTable (), cstring_fromChars (fname)); if (!(fileId_isValid (fid))) { fname = removePreDirs (fname); fid = fileTable_lookupBase (context_fileTable (), cstring_fromChars (fname)); } } # else /* !defined(OS2) && !defined(MSDOS) */ fname = removePreDirs (fname); fid = fileTable_lookupBase (context_fileTable (), cstring_fromChars (fname)); # endif /* !defined(OS2) && !defined(MSDOS) */ if (!(fileId_isValid (fid))) { if (isHeaderFile (cstring_fromChars (fname))) { fid = fileTable_addHeaderFile (context_fileTable (), cstring_fromChars (fname)); } else { fid = fileTable_addFile (context_fileTable (), cstring_fromChars (fname)); } } setFileLine (fid, lineno); } else if ((sscanf (ol, "line %d", &lineno) == 1) || (sscanf (ol, " %d", &lineno) == 1)) { setLine (lineno); /* next line is */ } else { if (!reportcpp) { llerror (FLG_SYNTAX, message ("File contains preprocessor command: #%s. " "Check LCLINT_CPPCMD environment variable. " "(Further instances unreported)", cstring_fromChars (ol))); reportcpp = TRUE; } sfree (ol); return TRUE; } sfree (ol); return FALSE; } static int handleLlSpecial () { int ic; char c; char *s = mstring_createEmpty (); char *os; int tok; int charsread = 0; bool isstart = FALSE; while (((ic = ninput ()) != 0) && isalpha (ic)) { c = (char) ic; s = mstring_append (s, c); charsread++; } os = s; if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0]) { ic = ninput (); llassert (ic == AFTER_COMMENT_MARKER[1]); if (isProcessingGlobMods () && (*s == '\0')) { sfree (os); return QNOMODS; /* special token no modifications token */ } else { ; } } tok = commentMarkerToken (cstring_fromChars (os)); if (tok != BADTOK) { tokLength = charsread; sfree (os); inSpecPart = TRUE; return tok; } /* Add rest of the comment */ if (ic != 0 && ic != EOF) { c = (char) ic; s = mstring_append (s, c); charsread++; while (((ic = ninput ()) != 0) && (ic != EOF) && (ic != AFTER_COMMENT_MARKER[0])) { c = (char) ic; s = mstring_append (s, c); charsread++; } } if (ic == AFTER_COMMENT_MARKER[0]) { int nc = ninput (); llassert ((char) nc == AFTER_COMMENT_MARKER[1]); charsread++; } os = s; while (*s == ' ' || *s == '\t' || *s == '\n') { s++; } if (*s == '-' || *s == '+' || *s == '=') /* setting flags */ { c = *s; while (c == '-' || c == '+' || c == '=') { ynm set = ynm_fromCodeChar (c); cstring thisflag; s++; thisflag = cstring_fromChars (s); while ((c = *s) != '\0' && (c != '-') && (c != '=') && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n')) { s++; } *s = '\0'; if (!context_getFlag (FLG_NOCOMMENTS)) { cstring flagname = thisflag; flagcode fflag = identifyFlag (flagname); if (flagcode_isSkip (fflag)) { ; } else if (flagcode_isInvalid (fflag)) { if (isMode (flagname)) { if (ynm_isMaybe (set)) { llerror (FLG_BADFLAG, message ("Stylized comment attempts to restore flag %s. " "A mode flag cannot be restored.", flagname)); } else { context_setMode (flagname); } } else { llerror (FLG_BADFLAG, message ("Unrecognized option in stylized comment: %s", flagname)); } } else if (flagcode_isGlobalFlag (fflag)) { llerror (FLG_BADFLAG, message ("Stylized comment attempts to set global flag %s. " "A global flag cannot be set locally.", flagname)); } else { context_fileSetFlag (fflag, set); if (flagcode_hasArgument (fflag)) { if (ynm_isMaybe (set)) { llerror (FLG_BADFLAG, message ("Stylized comment attempts to restore flag %s. " "A flag for setting a value cannot be restored.", flagname)); } else { /* cut-and-pastied from llmain...blecch */ cstring extra = cstring_undefined; char *rest; char *orest; char rchar; *s = c; rest = mstring_copy (s); orest = rest; *s = '\0'; while ((rchar = *rest) != '\0' && (isspace (rchar))) { rest++; s++; } while ((rchar = *rest) != '\0' && !isspace (rchar)) { extra = cstring_appendChar (extra, rchar); rest++; s++; } sfree (orest); if (cstring_isUndefined (extra)) { llerror (FLG_BADFLAG, message ("Flag %s (in stylized comment) must be followed by an argument", flagcode_unparse (fflag))); } else { s--; if (flagcode_hasValue (fflag)) { setValueFlag (fflag, extra); } else if (flagcode_hasString (fflag)) { setStringFlag (fflag, extra); } else { BADEXIT; } } } } } } else { } *s = c; while ((c == ' ') || (c == '\t') || (c == '\n')) { c = *(++s); } } if (context_inHeader () && !isArtificial (cstring_fromChars (os))) { context_addComment (cstring_fromCharsNew (os)); } else { ; } } else { char *t = s; int macrocode; char tchar = '\0'; while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n') { s++; } if (*s != '\0') { tchar = *s; *s = '\0'; s++; } t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t))); macrocode = tokenMacroCode (cstring_fromChars (t)); if (macrocode != BADTOK) { tokLength = mstring_length (t); sfree (t); sfree (os); if (macrocode == SKIPTOK) { return BADTOK; } return macrocode; } if (context_inHeader ()) { if (tchar != '\0') { *(s-1) = tchar; } if ((context_inMacro () || context_inGlobalContext ()) && macrocode != SKIPTOK && !isArtificial (cstring_fromChars (os))) { context_addComment (cstring_fromCharsNew (os)); } else { ; } if (tchar != '\0') { *(s-1) = '\0'; } } if (mstring_equal (t, "ignore")) { if (!context_getFlag (FLG_NOCOMMENTS)) { context_enterSuppressRegion (); } } else if ((*t == 'i' || *t == 't') && (*(t + 1) == '\0')) { if (!context_getFlag (FLG_NOCOMMENTS) && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS))) { context_enterSuppressLine (-1); /* infinite suppression */ } } else if (((*t == 'i') || (*t == 't')) && ((*(t + 1) >= '0' && *(t + 1) <= '9'))) { bool tmpcomment = (*t == 't'); int val = -1; char *tt = t; /* don't mangle t, since it is free'd */ char lc = *(++tt); if (lc >= '0' && lc <= '9') { val = (int)(lc - '0'); lc = *(++tt); while (lc >= '0' && lc <= '9') { val *= 10; val += lc - '0'; lc = *(++tt); } } if (!context_getFlag (FLG_NOCOMMENTS) && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS))) { context_enterSuppressLine (val); } } else if (mstring_equal (t, "end")) { if (!context_getFlag (FLG_NOCOMMENTS)) { context_exitSuppressRegion (); } } else if (mstring_equal (t, "notfunction")) { ; /* handled by pcpp */ } else if (mstring_equal (t, "access")) { cstring tname; while (TRUE) { while ((c = *s) && (c == ' ' || c == '\t' || c == '\n')) { s++; } if (c == '\0') { break; } tname = cstring_fromChars (s); while ((c = *s) != '\0' && c != ' ' && c != '\t' && c != '\n' && c != ',') { s++; } *s = '\0'; if (!context_getFlag (FLG_NOCOMMENTS) && !context_getFlag (FLG_NOACCESS)) { if (usymtab_existsType (tname)) { usymId uid = usymtab_getTypeId (tname); context_addFileAccessType (uid); } else { if (!(context_inSuppressRegion () || context_inSuppressZone (g_currentloc))) { llmsg (message ("%q: Unrecognized type %s used in access comment", fileloc_unparse (g_currentloc), tname)); } } } if (c != '\0') { s++; } if (c != ',' && c != ' ') { break; } } } else if (mstring_equal (t, "noaccess")) { cstring tname; char lc; while (TRUE) { while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n')) { s++; } if (lc == '\0') { break; } tname = cstring_fromChars (s); while ((lc = *s) != '\0' && lc != ' ' && lc != '\t' && lc != '\n' && lc != ',') { s++; } *s = '\0'; if (!context_getFlag (FLG_NOCOMMENTS) && !context_getFlag (FLG_NOACCESS)) { if (usymtab_existsType (tname)) { typeId tuid = usymtab_getTypeId (tname); if (context_couldHaveAccess (tuid)) { context_removeFileAccessType (tuid); } else { if (!(context_inSuppressRegion () || context_inSuppressZone (g_currentloc))) { uentry ue = usymtab_getTypeEntry (tuid); if (uentry_isAbstractDatatype (ue)) { llmsg (message ("%q: Non-accessible abstract type %s used in noaccess comment", fileloc_unparse (g_currentloc), tname)); } else { llmsg (message ("%q: Non-abstract type %s used in noaccess comment", fileloc_unparse (g_currentloc), tname)); } } } } else { if (!(context_inSuppressRegion () || context_inSuppressZone (g_currentloc))) { llmsg (message ("%q: Unrecognized type %s used in noaccess comment", fileloc_unparse (g_currentloc), tname)); } } } if (lc != '\0') { s++; } if (lc != ',' && lc != ' ') { break; } } } else { setTokLength (- (2 + charsread)); voptgenerror (FLG_UNRECOGCOMMENTS, message ("Stylized comment unrecognized: %s", cstring_fromChars (os)), g_currentloc); } sfree (t); } sfree (os); return BADTOK; } static /*@only@*/ cstring makeIdentifier (char *s) { char *c = mstring_create (size_toInt (strlen (s)) + 1); cstring id = cstring_fromChars (c); while (isalnum (*s) || (*s == '_') || (*s == '$')) { *c++ = *s++; } *c = '\0'; return (id); } /*@observer@*/ /*@dependent@*/ uentry coerceId (ctype c) { cstring cn = LastIdentifier (); if (!(usymtab_exists (cn))) { if (ctype_isUnknown (c)) { uentry ce; fileloc loc = fileloc_createExternal (); bool infunc = sRef_modInFunction (); if (infunc) { sRef_setGlobalScope (); } ce = uentry_makeVariableLoc (cn, c); uentry_setDefined (ce, loc); fileloc_free (loc); if (!context_inIterEnd ()) { voptgenerror (FLG_SYSTEMUNRECOG, message ("Unrecognized (possibly system) identifier: %q", uentry_getName (ce)), uentry_whereLast (ce)); } uentry_setHasNameError (ce); ce = usymtab_supReturnFileEntry (ce); if (infunc) { sRef_clearGlobalScope (); } } else { llcontbug (message ("coerceId: bad call: %t", c)); return (uentry_makeVariableLoc (cn, ctype_unknown)); } } return (usymtab_lookup (cn)); } /* ** like, coerceId, but doesn't supercede for iters */ /*@observer@*/ uentry coerceIterId (ctype c) { cstring cn = LastIdentifier (); if (!(usymtab_exists (cn))) { if (ctype_isUnknown (c)) { return uentry_undefined; } else { llcontbug (message ("coerceId: bad call: %t", c)); return (uentry_makeVariableLoc (cn, ctype_unknown)); } } return (usymtab_lookup (cn)); } /*@observer@*/ cstring LastIdentifier () { return (lastidprocessed); } static int processIdentifier (cstring id) { uentry le; context_clearJustPopped (); lastidprocessed = id; if (context_inFunctionDecl ()) { int tok = commentMarkerToken (id); if (tok != BADTOK) { return tok; } else { tok = tokenMacroCode (id); if (tok != BADTOK) { return tok; } } } if (context_getFlag (FLG_GNUEXTENSIONS)) { int tok = BADTOK; if (cstring_equalLit (id, "__stdcall") || cstring_equalLit (id, "__cdecl")) { return BADTOK; } else if (cstring_equalLit (id, "__volatile__")) { tok = QVOLATILE; } else if (cstring_equalLit (id, "__signed")) { tok = QSIGNED; } else if (cstring_equalLit (id, "__unsigned")) { tok = QUNSIGNED; } else if (cstring_equalLit (id, "__const__")) { tok = QCONST; } else if (cstring_equalLit (id, "__attribute__") || cstring_equalLit (id, "__extension__") || cstring_equalLit (id, "__asm__") || cstring_equalLit (id, "_asm") || cstring_equalLit (id, "__asm") || cstring_equalLit (id, "__declspec")) { int depth = 0; bool useparens = FALSE; bool usebraces = FALSE; bool inquote = FALSE; bool inescape = FALSE; int ic; while ((ic = input ()) != EOF) { if (inescape) { inescape = FALSE; } else if (ic == '\\') { inescape = TRUE; } else if (ic == '\"') { inquote = !inquote; } else if (!inquote) { if (ic == '(') { if (!useparens) { if (!usebraces) { useparens = TRUE; } } if (useparens) { depth++; } } else if (ic == '{') { if (!usebraces) { if (!useparens) { usebraces = TRUE; } } if (usebraces) { depth++; } } else if (ic == ')' && useparens) { depth--; if (depth == 0) break; } else if (ic == '}' && usebraces) { depth--; if (depth == 0) break; } else if (ic == '}' && !usebraces && !useparens && cstring_equalLit (id, "__asm")) { /* ** We need this because some MS VC++ include files ** have __asm mov ... } ** Its a kludge, but otherwise would need to parse ** the asm code! */ return TRBRACE; } } if (ic == '\n') { context_incLineno (); if (cstring_equalLit (id, "__asm") && !useparens && !usebraces) { break; } } } llassert ((useparens && ic == ')') || (usebraces && ic == '}') || (!useparens && !usebraces)); if (cstring_equalLit (id, "__extension__")) { tokLength = 0; tok = QEXTENSION; } else { return BADTOK; } } else if (cstring_equalLit (id, "inline") || cstring_equalLit (id, "__inline") || cstring_equalLit (id, "_inline") || cstring_equalLit (id, "__inline__")) { tok = QINLINE; } if (tok != BADTOK) { RETURN_TOK (tok); } } le = usymtab_lookupSafe (id); /*@-dependenttrans@*/ if (uentry_isIter (le)) { yylval.entry = le; return (ITER_NAME); } else if (uentry_isEndIter (le)) { yylval.entry = le; return (ITER_ENDNAME); } else if (uentry_isUndefined (le)) { yylval.cname = id; /* avoid parse errors for certain system built ins */ if (g_expectingTypeName && (cstring_firstChar (id) == '_') && (cstring_secondChar (id) == '_')) { yylval.ctyp = ctype_unknown; return (TYPE_NAME_OR_ID); } return (NEW_IDENTIFIER); } else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le)) { if (uentry_isDatatype (le)) { yylval.cname = id; return (NEW_IDENTIFIER); } else { yylval.entry = le; return (IDENTIFIER); } } else if (uentry_isDatatype (le)) { if (!g_expectingTypeName) { yylval.cname = id; return (NEW_IDENTIFIER); } else { yylval.ctyp = uentry_getAbstractType (le); uentry_setUsed (le, g_currentloc); return (TYPE_NAME); } } else { yylval.entry = le; return (IDENTIFIER); } /*@=dependenttrans@*/ } static bool processHashIdentifier (/*@only@*/ cstring id) { if (context_inMacro () || context_inIterDef () || context_inIterEnd ()) { uentry le; context_clearJustPopped (); lastidprocessed = id; le = usymtab_lookupSafe (id); if (uentry_isParam (le) || uentry_isRefParam (le)) { return TRUE; } else { return FALSE; } } else { cstring_free (id); return FALSE; } } static /*@only@*/ exprNode processString () { exprNode res; fileloc loc; char *nl = strchr (yytext, '\n'); cstring ns = cstring_fromCharsNew (yytext); if (nl == NULL) { loc = fileloc_copy (g_currentloc); addColumn (cstring_length (ns)); } else { char *lastnl = nl; loc = fileloc_copy (g_currentloc); context_incLineno (); while ((nl = strchr ((nl + 1), '\n')) != NULL) { context_incLineno (); lastnl = nl; } } res = exprNode_stringLiteral (ns, loc); return (res); } static char processChar () { char fchar; char next; llassert (*yytext != '\0'); fchar = *(yytext + 1); if (fchar != '\\') return fchar; next = *(yytext + 2); switch (next) { case 'n': return '\n'; case 't': return '\t'; case '\"': return '\"'; case '\'': return '\''; case '\\': return '\\'; default: return '\0'; } } static double processFloat () { double ret = atof (yytext); return (ret); } static long processHex () { llassert (yytext[0] == '0' && (yytext[1] == 'X' || yytext[1] == 'x')); /* ** Note: this does not get the correct value, but we only care ** is it is non-zero. */ return (atol (yytext + 2)); } static long processDec () { return (atol (yytext)); } static int processSpec (int tok) { size_t length = strlen (yytext); if (inSpecPart) { setTokLengthT (length); RETURN_TOK (tok); } else { context_saveLocation (); setTokLengthT (length); return (processIdentifier (makeIdentifier (yytext))); } }