2 ** Inserted at beginning of c files generated by flex
3 ** REMEMBER: Change flex.reset too.
29 /*@-loopswitchbreak@*/
30 /*@-switchswitchbreak@*/
44 /*@+matchanyintegral@*/
52 /*@-protoparammatch@*/
57 /*@-redecl@*/ /*@-type@*/
58 extern int lsllex (void);
59 /*@=redecl@*/ /*@=type@*/
62 ** Need to do this because ECHO is defined by the Posix library.
63 ** flex shouldn't use it.
68 fwrite (yytext, yyleng, 1, yyout)
71 extern /*@external@*/ int fileno (/* FILE *stream */);
82 /* < end of flex.head > */
84 /* A lexical scanner generated by flex */
86 /* Scanner skeleton version:
91 #define YY_FLEX_MAJOR_VERSION 2
92 #define YY_FLEX_MINOR_VERSION 5
97 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
110 /* Use prototypes in function declarations. */
111 #define YY_USE_PROTOS
113 /* The "const" storage-class-modifier is valid. */
116 #else /* ! __cplusplus */
120 #define YY_USE_PROTOS
123 #endif /* __STDC__ */
124 #endif /* ! __cplusplus */
132 #define YY_USE_PROTOS
136 #define yyconst const
143 #define YY_PROTO(proto) proto
145 #define YY_PROTO(proto) ()
148 /* Returned upon end-of-file. */
151 /* Promotes a possibly negative, possibly signed char to an unsigned
152 * integer for use as an array index. If the signed char is negative,
153 * we want to instead treat it as an 8-bit unsigned char, hence the
156 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
158 /* Enter a start condition. This macro really ought to take a parameter,
159 * but we do it the disgusting crufty way forced on us by the ()-less
160 * definition of BEGIN.
162 #define BEGIN yy_start = 1 + 2 *
164 /* Translate the current start state into a value that can be later handed
165 * to BEGIN to return to the state. The YYSTATE alias is for lex
168 #define YY_START ((yy_start - 1) / 2)
169 #define YYSTATE YY_START
171 /* Action number for EOF rule of a given start state. */
172 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
174 /* Special action meaning "start processing a new file". */
175 #define YY_NEW_FILE yyrestart( yyin )
177 #define YY_END_OF_BUFFER_CHAR 0
179 /* Size of default input buffer. */
180 #define YY_BUF_SIZE 16384
182 typedef struct yy_buffer_state *YY_BUFFER_STATE;
185 extern FILE *yyin, *yyout;
187 #define EOB_ACT_CONTINUE_SCAN 0
188 #define EOB_ACT_END_OF_FILE 1
189 #define EOB_ACT_LAST_MATCH 2
191 /* The funky do-while in the following #define is used to turn the definition
192 * int a single C statement (which needs a semi-colon terminator). This
193 * avoids problems with code like:
195 * if ( condition_holds )
198 * do_something_else();
200 * Prior to using the do-while the compiler would get upset at the
201 * "else" because it interpreted the "if" statement as being all
202 * done when it reached the ';' after the yyless() call.
205 /* Return all but the first 'n' matched characters back to the input stream. */
210 /* Undo effects of setting up yytext. */ \
211 *yy_cp = yy_hold_char; \
212 YY_RESTORE_YY_MORE_OFFSET \
213 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
214 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
218 #define unput(c) yyunput( c, yytext_ptr )
220 /* The following is because we cannot portably get our hands on size_t
221 * (without autoconf's help, which isn't available because we want
222 * flex-generated scanners to compile on their own).
224 typedef unsigned int yy_size_t;
227 struct yy_buffer_state
231 char *yy_ch_buf; /* input buffer */
232 char *yy_buf_pos; /* current position in input buffer */
234 /* Size of input buffer in bytes, not including room for EOB
237 yy_size_t yy_buf_size;
239 /* Number of characters read into yy_ch_buf, not including EOB
244 /* Whether we "own" the buffer - i.e., we know we created it,
245 * and can realloc() it to grow it, and should free() it to
248 int yy_is_our_buffer;
250 /* Whether this is an "interactive" input source; if so, and
251 * if we're using stdio for input, then we want to use getc()
252 * instead of fread(), to make sure we stop fetching input after
255 int yy_is_interactive;
257 /* Whether we're considered to be at the beginning of a line.
258 * If so, '^' rules will be active on the next match, otherwise
263 /* Whether to try to fill the input buffer when we reach the
268 int yy_buffer_status;
269 #define YY_BUFFER_NEW 0
270 #define YY_BUFFER_NORMAL 1
271 /* When an EOF's been seen but there's still some text to process
272 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
273 * shouldn't try reading from the input source any more. We might
274 * still have a bunch of tokens to match, though, because of
275 * possible backing-up.
277 * When we actually see the EOF, we change the status to "new"
278 * (via yyrestart()), so that the user can continue scanning by
279 * just pointing yyin at a new input file.
281 #define YY_BUFFER_EOF_PENDING 2
284 static YY_BUFFER_STATE yy_current_buffer = 0;
286 /* We provide macros for accessing buffer states in case in the
287 * future we want to put the buffer states in a more general
290 #define YY_CURRENT_BUFFER yy_current_buffer
293 /* yy_hold_char holds the character lost when yytext is formed. */
294 static char yy_hold_char;
296 static int yy_n_chars; /* number of characters read into yy_ch_buf */
301 /* Points to current character in buffer. */
302 static char *yy_c_buf_p = (char *) 0;
303 static int yy_init = 1; /* whether we need to initialize */
304 static int yy_start = 0; /* start state number */
306 /* Flag which is used to allow yywrap()'s to do buffer switches
307 * instead of setting up a fresh yyin. A bit of a hack ...
309 static int yy_did_buffer_switch_on_eof;
311 void yyrestart YY_PROTO(( FILE *input_file ));
313 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
314 void yy_load_buffer_state YY_PROTO(( void ));
315 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
316 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
317 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
318 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
319 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
321 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
322 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
323 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
325 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
326 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
327 static void yy_flex_free YY_PROTO(( void * ));
329 #define yy_new_buffer yy_create_buffer
331 #define yy_set_interactive(is_interactive) \
333 if ( ! yy_current_buffer ) \
334 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
335 yy_current_buffer->yy_is_interactive = is_interactive; \
338 #define yy_set_bol(at_bol) \
340 if ( ! yy_current_buffer ) \
341 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
342 yy_current_buffer->yy_at_bol = at_bol; \
345 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
347 typedef unsigned char YY_CHAR;
348 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
349 typedef int yy_state_type;
351 #define yytext_ptr yytext
353 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
354 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
355 static int yy_get_next_buffer YY_PROTO(( void ));
356 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
358 /* Done after the current pattern has been matched and before the
359 * corresponding action - sets up yytext.
361 #define YY_DO_BEFORE_ACTION \
362 yytext_ptr = yy_bp; \
363 yyleng = (int) (yy_cp - yy_bp); \
364 yy_hold_char = *yy_cp; \
368 #define YY_NUM_RULES 180
369 #define YY_END_OF_BUFFER 181
370 static yyconst short int yy_accept[529] =
372 0, 0, 181, 179, 159, 160, 147, 179, 3, 82,
373 153, 146, 179, 141, 142, 151, 150, 138, 149, 145,
374 152, 97, 97, 139, 135, 154, 140, 155, 158, 179,
375 82, 143, 178, 144, 156, 82, 82, 82, 82, 82,
376 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
377 82, 82, 82, 82, 82, 82, 136, 157, 137, 148,
378 134, 0, 42, 0, 2, 82, 120, 176, 177, 129,
379 121, 0, 0, 118, 126, 116, 127, 117, 128, 0,
380 110, 1, 119, 113, 90, 0, 99, 98, 0, 97,
381 125, 131, 133, 132, 124, 0, 0, 0, 82, 122,
383 82, 82, 82, 82, 82, 82, 82, 82, 9, 82,
384 82, 82, 82, 82, 82, 82, 13, 44, 82, 82,
385 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
386 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
387 82, 82, 82, 82, 82, 82, 123, 130, 0, 0,
388 2, 104, 4, 0, 108, 109, 110, 0, 111, 112,
389 92, 91, 0, 107, 100, 101, 101, 83, 115, 114,
390 166, 167, 164, 169, 174, 165, 175, 170, 173, 168,
391 171, 172, 0, 0, 82, 82, 82, 82, 82, 82,
392 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
394 82, 82, 11, 82, 82, 27, 82, 82, 82, 82,
395 82, 82, 82, 82, 82, 82, 43, 82, 82, 82,
396 82, 82, 82, 74, 82, 82, 82, 82, 82, 82,
397 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
398 82, 82, 82, 82, 82, 0, 42, 0, 0, 110,
399 0, 108, 109, 0, 113, 93, 94, 94, 105, 106,
400 103, 102, 84, 86, 163, 0, 0, 82, 82, 82,
401 82, 39, 82, 6, 29, 82, 82, 82, 82, 82,
402 82, 10, 25, 82, 82, 82, 82, 12, 82, 82,
403 82, 51, 82, 31, 82, 82, 52, 82, 82, 68,
405 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
406 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
407 82, 82, 82, 82, 82, 26, 82, 82, 82, 0,
408 110, 96, 95, 85, 87, 87, 0, 162, 82, 82,
409 82, 82, 5, 82, 36, 82, 82, 82, 82, 82,
410 82, 82, 30, 82, 82, 82, 82, 82, 82, 82,
411 82, 82, 82, 69, 82, 82, 82, 82, 82, 82,
412 82, 32, 82, 82, 82, 82, 82, 82, 82, 82,
413 82, 82, 77, 24, 82, 82, 82, 82, 82, 18,
414 76, 89, 88, 161, 82, 80, 82, 82, 82, 82,
416 82, 82, 82, 28, 82, 38, 82, 21, 82, 54,
417 78, 82, 60, 82, 82, 82, 82, 82, 82, 82,
418 58, 82, 14, 75, 34, 15, 82, 41, 22, 17,
419 82, 82, 82, 82, 82, 72, 19, 20, 82, 81,
420 37, 47, 64, 82, 82, 8, 82, 59, 82, 82,
421 82, 62, 53, 82, 82, 82, 45, 82, 82, 57,
422 82, 46, 61, 82, 23, 82, 82, 82, 82, 65,
423 7, 82, 73, 82, 82, 82, 70, 16, 82, 40,
424 82, 55, 82, 33, 35, 82, 71, 56, 82, 82,
425 82, 82, 67, 82, 82, 82, 82, 63, 82, 82,
427 82, 82, 82, 82, 82, 82, 48, 82, 82, 82,
428 66, 82, 82, 82, 79, 82, 82, 82, 82, 82,
429 82, 82, 82, 50, 82, 82, 49, 0
432 static yyconst int yy_ec[256] =
434 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
435 4, 4, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437 1, 2, 5, 6, 7, 8, 9, 10, 11, 12,
438 13, 14, 15, 16, 17, 18, 19, 20, 21, 21,
439 21, 21, 21, 21, 21, 21, 21, 22, 23, 24,
440 25, 26, 27, 28, 29, 30, 31, 30, 32, 33,
441 34, 8, 8, 8, 35, 36, 37, 8, 8, 8,
442 38, 39, 40, 41, 42, 8, 43, 44, 8, 45,
443 46, 47, 48, 49, 50, 1, 51, 52, 53, 54,
445 55, 56, 57, 58, 59, 8, 60, 61, 62, 63,
446 64, 65, 8, 66, 67, 68, 69, 70, 71, 72,
447 73, 74, 75, 76, 77, 78, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
450 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
456 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
458 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
460 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
464 static yyconst int yy_meta[79] =
466 1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
467 3, 1, 1, 1, 1, 1, 1, 1, 1, 4,
468 4, 1, 1, 1, 1, 1, 1, 1, 5, 5,
469 5, 5, 5, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 1, 1, 1, 1, 2,
471 5, 5, 5, 5, 5, 5, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 1, 1, 1, 1
476 static yyconst short int yy_base[536] =
478 0, 0, 678, 679, 679, 679, 652, 73, 0, 0,
479 55, 71, 629, 679, 679, 650, 67, 679, 68, 66,
480 74, 80, 85, 679, 679, 65, 649, 82, 679, 91,
481 622, 679, 679, 679, 647, 621, 28, 604, 67, 40,
482 65, 72, 605, 88, 55, 604, 79, 101, 616, 611,
483 103, 90, 602, 51, 606, 604, 679, 113, 679, 679,
484 679, 133, 163, 659, 0, 0, 679, 679, 679, 679,
485 679, 100, 139, 679, 679, 679, 679, 679, 679, 643,
486 155, 679, 679, 162, 172, 164, 160, 142, 0, 204,
487 635, 679, 679, 679, 634, 245, 621, 621, 584, 679,
489 602, 581, 585, 597, 584, 122, 587, 141, 580, 581,
490 578, 144, 585, 581, 578, 575, 0, 99, 579, 586,
491 579, 576, 567, 569, 575, 568, 578, 572, 564, 568,
492 564, 174, 573, 135, 158, 573, 154, 568, 564, 556,
493 559, 184, 573, 167, 563, 566, 679, 679, 242, 153,
494 0, 679, 679, 235, 679, 679, 251, 243, 679, 679,
495 233, 230, 241, 272, 165, 679, 234, 261, 679, 679,
496 679, 579, 679, 679, 679, 679, 679, 679, 679, 679,
497 679, 679, 580, 581, 228, 553, 548, 551, 563, 558,
498 546, 558, 231, 559, 554, 556, 552, 544, 541, 549,
500 536, 551, 0, 537, 541, 544, 529, 532, 535, 538,
501 528, 530, 531, 536, 523, 516, 0, 533, 519, 533,
502 526, 246, 515, 0, 517, 516, 518, 525, 526, 510,
503 508, 508, 510, 519, 518, 514, 516, 506, 510, 501,
504 203, 513, 515, 504, 503, 271, 308, 560, 295, 299,
505 306, 679, 679, 304, 316, 262, 679, 277, 679, 679,
506 679, 679, 298, 281, 679, 534, 522, 505, 504, 495,
507 484, 0, 496, 0, 0, 495, 486, 494, 483, 488,
508 489, 0, 0, 482, 482, 492, 478, 0, 482, 487,
509 482, 0, 284, 0, 487, 472, 472, 473, 483, 0,
511 483, 477, 471, 467, 478, 463, 465, 475, 461, 473,
512 463, 467, 466, 471, 470, 456, 458, 466, 464, 462,
513 454, 459, 460, 448, 460, 0, 444, 456, 456, 323,
514 325, 679, 679, 287, 679, 305, 481, 679, 457, 439,
515 439, 440, 0, 292, 0, 441, 442, 448, 446, 445,
516 436, 435, 0, 442, 430, 434, 440, 438, 436, 430,
517 435, 419, 420, 0, 436, 417, 417, 428, 422, 419,
518 427, 0, 426, 423, 427, 424, 408, 417, 419, 404,
519 417, 418, 0, 0, 407, 415, 411, 406, 407, 0,
520 0, 679, 679, 679, 411, 0, 396, 408, 408, 397,
522 391, 391, 403, 0, 403, 405, 386, 0, 403, 0,
523 0, 397, 0, 391, 385, 395, 385, 387, 384, 391,
524 0, 384, 0, 0, 385, 0, 382, 0, 0, 0,
525 386, 380, 384, 379, 383, 0, 0, 0, 376, 0,
526 0, 0, 369, 381, 379, 0, 370, 0, 371, 370,
527 369, 0, 0, 367, 362, 371, 0, 358, 359, 0,
528 361, 0, 0, 362, 0, 367, 367, 365, 351, 0,
529 0, 350, 0, 356, 348, 347, 0, 0, 347, 0,
530 329, 0, 340, 334, 0, 319, 0, 0, 311, 320,
531 328, 325, 0, 316, 319, 311, 324, 0, 317, 305,
533 318, 315, 301, 302, 310, 296, 0, 308, 311, 300,
534 0, 299, 290, 282, 0, 233, 245, 176, 186, 174,
535 151, 158, 128, 0, 48, 28, 0, 679, 386, 390,
536 394, 399, 403, 405, 410
539 static yyconst short int yy_def[536] =
541 528, 1, 528, 528, 528, 528, 528, 529, 530, 531,
542 528, 528, 532, 528, 528, 528, 528, 528, 528, 528,
543 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
544 531, 528, 528, 528, 528, 531, 531, 531, 531, 531,
545 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
546 531, 531, 531, 531, 531, 531, 528, 528, 528, 528,
547 528, 529, 528, 529, 533, 531, 528, 528, 528, 528,
548 528, 532, 532, 528, 528, 528, 528, 528, 528, 528,
549 528, 528, 528, 528, 528, 528, 528, 528, 534, 528,
550 528, 528, 528, 528, 528, 528, 528, 528, 531, 528,
552 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
553 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
554 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
555 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
556 531, 531, 531, 531, 531, 531, 528, 528, 528, 535,
557 533, 528, 528, 528, 528, 528, 528, 528, 528, 528,
558 528, 528, 528, 528, 528, 528, 528, 534, 528, 528,
559 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
560 528, 528, 528, 528, 531, 531, 531, 531, 531, 531,
561 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
563 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
564 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
565 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
566 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
567 531, 531, 531, 531, 531, 535, 528, 535, 528, 528,
568 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
569 528, 528, 528, 528, 528, 528, 528, 531, 531, 531,
570 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
571 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
572 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
574 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
575 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
576 531, 531, 531, 531, 531, 531, 531, 531, 531, 528,
577 528, 528, 528, 528, 528, 528, 528, 528, 531, 531,
578 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
579 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
580 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
581 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
582 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
583 531, 528, 528, 528, 531, 531, 531, 531, 531, 531,
585 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
586 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
587 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
588 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
589 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
590 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
591 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
592 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
593 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
594 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
596 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
597 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
598 531, 531, 531, 531, 531, 531, 531, 0, 528, 528,
599 528, 528, 528, 528, 528
602 static yyconst short int yy_nxt[758] =
604 4, 5, 6, 5, 7, 8, 9, 10, 11, 12,
605 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
606 23, 24, 25, 26, 27, 28, 29, 30, 10, 10,
607 10, 10, 10, 10, 10, 10, 31, 10, 10, 10,
608 10, 10, 10, 10, 10, 32, 33, 34, 35, 36,
609 37, 38, 39, 40, 41, 42, 43, 10, 44, 45,
610 46, 10, 47, 48, 49, 50, 51, 52, 53, 54,
611 55, 10, 56, 10, 57, 58, 59, 60, 63, 67,
612 70, 75, 527, 80, 77, 81, 81, 82, 91, 92,
613 102, 76, 78, 79, 108, 71, 103, 84, 83, 85,
615 85, 143, 84, 109, 90, 90, 94, 95, 96, 120,
616 152, 86, 526, 121, 144, 87, 86, 105, 97, 64,
617 87, 88, 113, 89, 106, 110, 88, 111, 98, 68,
618 107, 69, 114, 123, 86, 115, 112, 147, 63, 86,
619 87, 528, 124, 117, 139, 87, 73, 125, 88, 72,
620 118, 89, 126, 88, 119, 140, 127, 133, 247, 205,
621 134, 135, 141, 128, 149, 149, 206, 136, 150, 129,
622 137, 130, 191, 138, 81, 81, 192, 167, 163, 64,
623 163, 157, 157, 164, 164, 225, 154, 155, 148, 84,
624 156, 85, 85, 158, 159, 165, 194, 160, 226, 248,
626 525, 166, 167, 86, 230, 195, 261, 161, 199, 154,
627 155, 200, 524, 162, 227, 156, 158, 159, 523, 231,
628 165, 84, 160, 90, 90, 242, 86, 243, 166, 220,
629 221, 228, 161, 261, 222, 86, 236, 237, 522, 87,
630 162, 223, 238, 149, 149, 88, 521, 150, 520, 249,
631 239, 249, 240, 324, 250, 250, 325, 254, 86, 254,
632 164, 164, 255, 255, 87, 258, 268, 269, 256, 262,
633 157, 157, 88, 171, 257, 172, 247, 173, 174, 175,
634 176, 177, 251, 252, 178, 179, 253, 180, 181, 182,
635 258, 164, 164, 256, 262, 519, 263, 277, 278, 305,
637 518, 257, 264, 332, 259, 251, 252, 260, 306, 149,
638 149, 253, 333, 150, 250, 250, 336, 248, 250, 250,
639 330, 263, 330, 255, 255, 331, 331, 259, 392, 264,
640 332, 155, 260, 334, 156, 255, 255, 333, 357, 335,
641 393, 336, 331, 331, 331, 331, 399, 517, 159, 358,
642 516, 160, 515, 400, 155, 392, 514, 252, 334, 156,
643 253, 513, 512, 511, 510, 393, 335, 509, 508, 507,
644 506, 159, 505, 504, 503, 502, 160, 501, 500, 499,
645 252, 498, 497, 496, 495, 253, 62, 62, 62, 62,
646 62, 65, 494, 493, 65, 66, 492, 66, 66, 72,
648 72, 491, 72, 72, 151, 490, 151, 151, 168, 168,
649 246, 246, 246, 246, 246, 489, 488, 487, 486, 485,
650 484, 483, 482, 481, 480, 479, 478, 477, 476, 475,
651 474, 473, 472, 471, 470, 469, 468, 467, 466, 465,
652 464, 463, 462, 461, 460, 459, 458, 457, 456, 455,
653 454, 453, 452, 451, 450, 449, 448, 447, 446, 445,
654 444, 443, 442, 441, 440, 439, 438, 437, 436, 435,
655 434, 433, 432, 431, 430, 429, 428, 427, 426, 425,
656 424, 423, 422, 421, 420, 419, 418, 417, 416, 415,
657 414, 413, 412, 411, 410, 409, 408, 407, 406, 405,
659 404, 403, 402, 401, 398, 397, 396, 395, 394, 391,
660 390, 389, 388, 387, 386, 385, 384, 383, 382, 381,
661 380, 379, 378, 377, 376, 375, 374, 373, 372, 371,
662 370, 369, 368, 367, 366, 365, 364, 363, 362, 361,
663 360, 359, 356, 355, 354, 353, 352, 351, 350, 349,
664 348, 347, 346, 345, 344, 343, 342, 341, 340, 339,
665 338, 337, 528, 329, 328, 327, 326, 323, 322, 321,
666 320, 319, 318, 317, 316, 315, 314, 313, 312, 311,
667 310, 309, 308, 307, 304, 303, 302, 301, 300, 299,
668 298, 297, 296, 295, 294, 293, 292, 291, 290, 289,
670 288, 287, 286, 285, 284, 283, 282, 281, 280, 279,
671 276, 275, 274, 273, 272, 271, 270, 267, 266, 265,
672 245, 244, 241, 235, 234, 233, 232, 229, 224, 219,
673 218, 217, 216, 215, 214, 213, 212, 211, 210, 209,
674 208, 207, 204, 203, 202, 201, 198, 197, 196, 193,
675 190, 189, 188, 187, 186, 185, 184, 183, 170, 169,
676 153, 528, 146, 145, 142, 132, 131, 122, 116, 104,
677 101, 100, 99, 93, 74, 73, 61, 528, 3, 528,
678 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
679 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
681 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
682 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
683 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
684 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
685 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
686 528, 528, 528, 528, 528, 528, 528
689 static yyconst short int yy_chk[758] =
691 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
692 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
693 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
694 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
695 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
696 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
697 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
698 1, 1, 1, 1, 1, 1, 1, 1, 8, 11,
699 12, 17, 526, 20, 19, 20, 20, 21, 26, 26,
700 37, 17, 19, 19, 40, 12, 37, 22, 21, 22,
702 22, 54, 23, 40, 23, 23, 28, 28, 30, 45,
703 72, 22, 525, 45, 54, 22, 23, 39, 30, 8,
704 23, 22, 42, 22, 39, 41, 23, 41, 30, 11,
705 39, 11, 42, 47, 22, 42, 41, 58, 62, 23,
706 22, 73, 47, 44, 52, 23, 72, 47, 22, 73,
707 44, 22, 48, 23, 44, 52, 48, 51, 150, 118,
708 51, 51, 52, 48, 63, 63, 118, 51, 63, 48,
709 51, 48, 106, 51, 81, 81, 106, 88, 86, 62,
710 86, 84, 84, 86, 86, 134, 81, 81, 58, 85,
711 81, 85, 85, 84, 84, 87, 108, 84, 134, 150,
713 523, 87, 88, 85, 137, 108, 165, 85, 112, 81,
714 81, 112, 522, 85, 135, 81, 84, 84, 521, 137,
715 87, 90, 84, 90, 90, 144, 85, 144, 87, 132,
716 132, 135, 85, 165, 132, 90, 142, 142, 520, 90,
717 85, 132, 142, 149, 149, 90, 519, 149, 518, 154,
718 142, 154, 142, 241, 154, 154, 241, 158, 90, 158,
719 163, 163, 158, 158, 90, 162, 185, 185, 161, 167,
720 157, 157, 90, 96, 161, 96, 246, 96, 96, 96,
721 96, 96, 157, 157, 96, 96, 157, 96, 96, 96,
722 162, 164, 164, 161, 167, 517, 168, 193, 193, 222,
724 516, 161, 168, 256, 164, 157, 157, 164, 222, 247,
725 247, 157, 258, 247, 249, 249, 264, 246, 250, 250,
726 251, 168, 251, 254, 254, 251, 251, 164, 334, 168,
727 256, 250, 164, 263, 250, 255, 255, 258, 293, 263,
728 336, 264, 330, 330, 331, 331, 344, 514, 255, 293,
729 513, 255, 512, 344, 250, 334, 510, 331, 263, 250,
730 331, 509, 508, 506, 505, 336, 263, 504, 503, 502,
731 501, 255, 500, 499, 497, 496, 255, 495, 494, 492,
732 331, 491, 490, 489, 486, 331, 529, 529, 529, 529,
733 529, 530, 484, 483, 530, 531, 481, 531, 531, 532,
735 532, 479, 532, 532, 533, 476, 533, 533, 534, 534,
736 535, 535, 535, 535, 535, 475, 474, 472, 469, 468,
737 467, 466, 464, 461, 459, 458, 456, 455, 454, 451,
738 450, 449, 447, 445, 444, 443, 439, 435, 434, 433,
739 432, 431, 427, 425, 422, 420, 419, 418, 417, 416,
740 415, 414, 412, 409, 407, 406, 405, 403, 402, 401,
741 400, 399, 398, 397, 395, 389, 388, 387, 386, 385,
742 382, 381, 380, 379, 378, 377, 376, 375, 374, 373,
743 371, 370, 369, 368, 367, 366, 365, 363, 362, 361,
744 360, 359, 358, 357, 356, 355, 354, 352, 351, 350,
746 349, 348, 347, 346, 342, 341, 340, 339, 337, 329,
747 328, 327, 325, 324, 323, 322, 321, 320, 319, 318,
748 317, 316, 315, 314, 313, 312, 311, 310, 309, 308,
749 307, 306, 305, 304, 303, 302, 301, 299, 298, 297,
750 296, 295, 291, 290, 289, 287, 286, 285, 284, 281,
751 280, 279, 278, 277, 276, 273, 271, 270, 269, 268,
752 267, 266, 248, 245, 244, 243, 242, 240, 239, 238,
753 237, 236, 235, 234, 233, 232, 231, 230, 229, 228,
754 227, 226, 225, 223, 221, 220, 219, 218, 216, 215,
755 214, 213, 212, 211, 210, 209, 208, 207, 206, 205,
757 204, 202, 201, 200, 199, 198, 197, 196, 195, 194,
758 192, 191, 190, 189, 188, 187, 186, 184, 183, 172,
759 146, 145, 143, 141, 140, 139, 138, 136, 133, 131,
760 130, 129, 128, 127, 126, 125, 124, 123, 122, 121,
761 120, 119, 116, 115, 114, 113, 111, 110, 109, 107,
762 105, 104, 103, 102, 101, 99, 98, 97, 95, 91,
763 80, 64, 56, 55, 53, 50, 49, 46, 43, 38,
764 36, 35, 31, 27, 16, 13, 7, 3, 528, 528,
765 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
766 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
768 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
769 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
770 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
771 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
772 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
773 528, 528, 528, 528, 528, 528, 528
776 static yy_state_type yy_last_accepting_state;
777 static char *yy_last_accepting_cpos;
779 /* The intent behind this definition is that it'll catch
780 * any uses of REJECT which flex missed.
782 #define REJECT reject_used_but_not_detected
783 #define yymore() yymore_used_but_not_detected
784 #define YY_MORE_ADJ 0
785 #define YY_RESTORE_YY_MORE_OFFSET
790 ** Copyright (c) Massachusetts Institute of Technology 1994-1998.
791 ** All Rights Reserved.
792 ** Unpublished rights reserved under the copyright laws of
793 ** the United States.
795 ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
796 ** OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
798 ** This code is distributed freely and may be used freely under the
799 ** following conditions:
801 ** 1. This notice may not be removed or altered.
803 ** 2. Works derived from this code are not distributed for
804 ** commercial gain without explicit permission from MIT
805 ** (for permission contact lclint-request@sds.lcs.mit.edu).
808 * Modified by Herbert 08/19/97:
809 * - added #include for IBM's OS/2 compiler.
810 * - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only).
813 * Modified by Mike Smith
814 * Corrected missing 'line' in scanf() calls in handleSpecial().
815 * Without this, I get an error when LCLint hits a '#line' directive
816 * in the pre-pre-processed source files. For safety, I have made these
817 * conditional on OS2 and MSDOS because I don't understand why noone else
818 * has seen this problem.
820 * Modified by Mike Smith, 4th June 1997
821 * Finally resolved the #line problem. The scanf() calls have been fixed to
822 * allow the following #line forms:-
824 * #line 123 "filename"
829 * The last two are generated by the GNU pre-processor, apparently
831 #line 56 "cscanner.l"
833 ** based on original C lexer by Nate Osgood
834 ** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993
838 # include "lclintMacros.nf"
841 # include "cgrammar.h"
842 # include "cgrammar_tokens.h"
844 # include "fileIdList.h"
847 # if defined(OS2) && defined(__IBMC__)
848 /* needed for isatty()... */
852 static bool lastWasString = FALSE;
853 static char savechar = '\0';
856 # define yyinput() (incColumn (), getc (yyin))
860 extern /*@external@*/ int read ();
864 static /*@owned@*/ cstring lastidprocessed = cstring_undefined;
866 static int lminput (void);
867 static int tokLength = 0;
868 static bool inSpecPart = FALSE;
869 static bool continueLine = FALSE;
871 static int ninput (void);
872 static char processChar (void);
873 static double processFloat (void);
874 static /*@only@*/ exprNode processString (void);
875 static long processDec (void);
876 static long processHex (void);
877 static long processOctal (void);
878 static int processIdentifier (/*@only@*/ cstring)
879 /*@globals undef lastidprocessed@*/ ;
880 static bool processHashIdentifier (/*@only@*/ cstring)
881 /*@globals undef lastidprocessed@*/ ;
883 static int processSpec (int);
884 static bool handleSpecial (char *);
885 static int handleLlSpecial (void);
886 static void handleMacro (void);
887 static bool processMacro (void);
888 static /*@only@*/ cstring makeIdentifier (char *);
890 /* yes, this is exported! */
891 bool g_expectingTypeName = TRUE; /* beginning of file can be type name! */
893 static int returnInt (ctype, long);
894 static int returnFloat (ctype, double);
895 static int returnChar (char);
896 static void setTokLength (int) /*@modifies g_currentloc@*/ ;
897 static void setTokLengthT (size_t) /*@modifies g_currentloc@*/ ;
899 static void advanceLine (void)
906 # define RETURN_INT(c,i) \
907 do { lastWasString = FALSE; \
908 return (returnInt (c, i)); } while (FALSE)
910 # define RETURN_FLOAT(c,f) \
911 do { lastWasString = FALSE; \
912 return (returnFloat (c, f)); \
915 # define RETURN_CHAR(c) \
916 do { lastWasString = FALSE; \
917 return (returnChar (c)); \
920 # define RETURN_TOK(t) \
921 do { yylval.tok = lltok_create (t, fileloc_decColumn (g_currentloc, tokLength)); \
923 lastWasString = FALSE; \
924 return (t); } while (FALSE)
926 # define RETURN_TYPE(t, ct) \
927 do { yylval.ctyp = ct; tokLength = 0; return (t); } while (FALSE)
929 /* don't fileloc_decColumn (g_currentloc, tokLength));
930 the string could have \n's in it!
933 # define RETURN_STRING(c) \
934 do { yylval.expr = exprNode_stringLiteral (c, fileloc_decColumn (g_currentloc, tokLength)); \
936 lastWasString = TRUE; \
937 return (CCONSTANT); } while (FALSE)
939 # define RETURN_EXPR(e) \
940 do { yylval.expr = e; \
942 lastWasString = TRUE; \
943 return (CCONSTANT); } while (FALSE)
947 static void setTokLength (int len)
953 static void setTokLengthT (size_t len)
955 setTokLength (size_toInt (len));
958 # include "flex.head"
961 /* Macros after this point can all be overridden by user definitions in
965 #ifndef YY_SKIP_YYWRAP
967 extern "C" int yywrap YY_PROTO(( void ));
969 extern int yywrap YY_PROTO(( void ));
974 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
978 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
981 #ifdef YY_NEED_STRLEN
982 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
987 static int yyinput YY_PROTO(( void ));
989 static int input YY_PROTO(( void ));
994 static int yy_start_stack_ptr = 0;
995 static int yy_start_stack_depth = 0;
996 static int *yy_start_stack = 0;
997 #ifndef YY_NO_PUSH_STATE
998 static void yy_push_state YY_PROTO(( int new_state ));
1000 #ifndef YY_NO_POP_STATE
1001 static void yy_pop_state YY_PROTO(( void ));
1003 #ifndef YY_NO_TOP_STATE
1004 static int yy_top_state YY_PROTO(( void ));
1008 #define YY_NO_PUSH_STATE 1
1009 #define YY_NO_POP_STATE 1
1010 #define YY_NO_TOP_STATE 1
1013 #ifdef YY_MALLOC_DECL
1021 /* Just try to get by without declaring the routines. This will fail
1022 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
1023 * or sizeof(void*) != sizeof(int).
1028 /* Amount of stuff to slurp up with each read. */
1029 #ifndef YY_READ_BUF_SIZE
1030 #define YY_READ_BUF_SIZE 8192
1033 /* Copy whatever the last rule matched to the standard output. */
1036 /* This used to be an fputs(), but since the string might contain NUL's,
1037 * we now use fwrite().
1039 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1042 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1043 * is returned in "result".
1046 #define YY_INPUT(buf,result,max_size) \
1047 if ( yy_current_buffer->yy_is_interactive ) \
1050 for ( n = 0; n < max_size && \
1051 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1052 buf[n] = (char) c; \
1054 buf[n++] = (char) c; \
1055 if ( c == EOF && ferror( yyin ) ) \
1056 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1059 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
1060 && ferror( yyin ) ) \
1061 YY_FATAL_ERROR( "input in flex scanner failed" );
1064 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1065 * we don't want an extra ';' after the "return" because that will cause
1066 * some compilers to complain about unreachable statements.
1069 #define yyterminate() return YY_NULL
1072 /* Number of entries by which start-condition stack grows. */
1073 #ifndef YY_START_STACK_INCR
1074 #define YY_START_STACK_INCR 25
1077 /* Report a fatal error. */
1078 #ifndef YY_FATAL_ERROR
1079 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1082 /* Default declaration of generated scanner - a define so the user can
1083 * easily add parameters.
1086 #define YY_DECL int yylex YY_PROTO(( void ))
1089 /* Code executed at the beginning of each rule, after yytext and yyleng
1092 #ifndef YY_USER_ACTION
1093 #define YY_USER_ACTION
1096 /* Code executed at the end of each rule. */
1098 #define YY_BREAK break;
1101 #define YY_RULE_SETUP \
1106 register yy_state_type yy_current_state;
1107 register char *yy_cp, *yy_bp;
1108 register int yy_act;
1110 #line 185 "cscanner.l"
1113 #line 1031 "lex.yy.c"
1124 yy_start = 1; /* first start state */
1132 if ( ! yy_current_buffer )
1134 yy_create_buffer( yyin, YY_BUF_SIZE );
1136 yy_load_buffer_state();
1139 while ( 1 ) /* loops until end-of-file is reached */
1143 /* Support of yytext. */
1144 *yy_cp = yy_hold_char;
1146 /* yy_bp points to the position in yy_ch_buf of the start of
1151 yy_current_state = yy_start;
1155 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1156 if ( yy_accept[yy_current_state] )
1158 yy_last_accepting_state = yy_current_state;
1159 yy_last_accepting_cpos = yy_cp;
1161 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1163 yy_current_state = (int) yy_def[yy_current_state];
1164 if ( yy_current_state >= 529 )
1165 yy_c = yy_meta[(unsigned int) yy_c];
1167 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1170 while ( yy_base[yy_current_state] != 679 );
1173 yy_act = yy_accept[yy_current_state];
1175 { /* have to back up */
1176 yy_cp = yy_last_accepting_cpos;
1177 yy_current_state = yy_last_accepting_state;
1178 yy_act = yy_accept[yy_current_state];
1181 YY_DO_BEFORE_ACTION;
1184 do_action: /* This label is used only to access EOF actions. */
1188 { /* beginning of action switch */
1189 case 0: /* must back up */
1190 /* undo the effects of YY_DO_BEFORE_ACTION */
1191 *yy_cp = yy_hold_char;
1192 yy_cp = yy_last_accepting_cpos;
1193 yy_current_state = yy_last_accepting_state;
1194 goto yy_find_action;
1198 #line 187 "cscanner.l"
1199 { llfatalbug (cstring_makeLiteral ("Comment in pre-processor output")); }
1203 #line 189 "cscanner.l"
1205 context_saveLocation ();
1206 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1208 if (processHashIdentifier (makeIdentifier (yytext + 1)))
1216 RETURN_STRING (cstring_makeLiteral ("\"\""));
1221 if (handleSpecial (yytext))
1231 #line 213 "cscanner.l"
1232 { if (handleSpecial (yytext))
1234 setTokLength (1); RETURN_TOK (0);
1240 #line 218 "cscanner.l"
1241 { setTokLength (3); RETURN_TOK (CTOK_ELIPSIS); }
1245 #line 219 "cscanner.l"
1246 { setTokLength (5); RETURN_TOK (BREAK); }
1250 #line 220 "cscanner.l"
1251 { setTokLength (4); RETURN_TOK (CASE); }
1255 #line 221 "cscanner.l"
1256 { setTokLength (8); RETURN_TOK (CONTINUE); }
1260 #line 222 "cscanner.l"
1261 { setTokLength (7); RETURN_TOK (DEFAULT); }
1265 #line 223 "cscanner.l"
1266 { setTokLength (2); RETURN_TOK (DO); }
1270 #line 224 "cscanner.l"
1271 { setTokLength (4); RETURN_TOK (CELSE); }
1275 #line 225 "cscanner.l"
1276 { setTokLength (3); RETURN_TOK (CFOR); }
1280 #line 226 "cscanner.l"
1281 { setTokLength (4); RETURN_TOK (GOTO); }
1285 #line 227 "cscanner.l"
1286 { setTokLength (2); RETURN_TOK (CIF); }
1290 #line 228 "cscanner.l"
1291 { setTokLength (6); RETURN_TOK (RETURN); }
1295 #line 229 "cscanner.l"
1296 { setTokLength (6); RETURN_TOK (CSIZEOF); }
1300 #line 230 "cscanner.l"
1301 { setTokLength (8); RETURN_TOK (COFFSETOF); }
1305 #line 231 "cscanner.l"
1306 { setTokLength (6); RETURN_TOK (SWITCH); }
1310 #line 232 "cscanner.l"
1311 { setTokLength (5); RETURN_TOK (WHILE); }
1315 #line 233 "cscanner.l"
1316 { setTokLength (6); RETURN_TOK (VA_ARG); }
1320 #line 234 "cscanner.l"
1321 { setTokLength (6); RETURN_TOK (VA_DCL); }
1325 #line 235 "cscanner.l"
1327 /* gcc extension...this might not be appropriate */
1328 setTokLength (6); RETURN_TOK (QINLINE); }
1332 #line 239 "cscanner.l"
1333 { setTokLength (6); RETURN_TOK (CSTRUCT); }
1337 #line 240 "cscanner.l"
1338 { setTokLength (7); RETURN_TOK (CTYPEDEF); }
1342 #line 242 "cscanner.l"
1343 { setTokLength (5); RETURN_TOK (CUNION); }
1347 #line 243 "cscanner.l"
1348 { setTokLength (4); RETURN_TOK (CENUM); }
1352 #line 245 "cscanner.l"
1353 { setTokLength (4); RETURN_TYPE (CVOID, ctype_void); }
1357 #line 246 "cscanner.l"
1358 { setTokLength (3); RETURN_TYPE (CINT, ctype_int); }
1362 #line 247 "cscanner.l"
1363 { setTokLength (6); RETURN_TYPE (CDOUBLE, ctype_double); }
1367 #line 248 "cscanner.l"
1368 { setTokLength (4); RETURN_TYPE (CGCHAR, ctype_char); }
1372 #line 249 "cscanner.l"
1373 { setTokLength (5); RETURN_TYPE (CGFLOAT, ctype_float); }
1377 #line 251 "cscanner.l"
1378 { setTokLength (4); RETURN_TOK (QLONG); }
1382 #line 252 "cscanner.l"
1383 { setTokLength (5); RETURN_TOK (QSHORT); }
1387 #line 253 "cscanner.l"
1388 { setTokLength (8); RETURN_TOK (QUNSIGNED); }
1392 #line 254 "cscanner.l"
1393 { setTokLength (6); RETURN_TOK (QSIGNED); }
1397 #line 256 "cscanner.l"
1398 { setTokLength (8); RETURN_TOK (QVOLATILE); }
1402 #line 257 "cscanner.l"
1403 { setTokLength (5); RETURN_TOK (QCONST); }
1405 /* some systems expect this! [gack!] */
1408 #line 260 "cscanner.l"
1409 { setTokLength (7); RETURN_TOK (QCONST); }
1413 #line 262 "cscanner.l"
1414 { setTokLength (6); RETURN_TOK (QEXTERN); }
1418 #line 263 "cscanner.l"
1419 { setTokLength (4); RETURN_TOK (QAUTO); }
1423 #line 264 "cscanner.l"
1424 { setTokLength (8); RETURN_TOK (QREGISTER); }
1428 #line 265 "cscanner.l"
1429 { setTokLength (6); RETURN_TOK (QSTATIC); }
1433 #line 267 "cscanner.l"
1434 { RETURN_EXPR (processString ()); }
1438 #line 268 "cscanner.l"
1439 { return (processSpec (QOUT)); }
1443 #line 269 "cscanner.l"
1444 { return (processSpec (QIN)); }
1448 #line 270 "cscanner.l"
1449 { return (processSpec (QPARTIAL)); }
1453 #line 271 "cscanner.l"
1454 { return (processSpec (QSPECIAL)); }
1458 #line 272 "cscanner.l"
1459 { return (processSpec (QANYTYPE)); }
1463 #line 273 "cscanner.l"
1464 { return (processSpec (QINTEGRALTYPE)); }
1468 #line 274 "cscanner.l"
1469 { return (processSpec (QUNSIGNEDINTEGRALTYPE)); }
1473 #line 275 "cscanner.l"
1474 { return (processSpec (QSIGNEDINTEGRALTYPE)); }
1478 #line 276 "cscanner.l"
1479 { return (processSpec (QKEEP)); }
1483 #line 277 "cscanner.l"
1484 { return (processSpec (QNULL)); }
1488 #line 278 "cscanner.l"
1489 { return (processSpec (QNOTNULL)); }
1493 #line 279 "cscanner.l"
1494 { return (processSpec (QISNULL)); }
1498 #line 280 "cscanner.l"
1499 { return (processSpec (QTRUENULL)); }
1503 #line 281 "cscanner.l"
1504 { return (processSpec (QFALSENULL)); }
1508 #line 282 "cscanner.l"
1509 { return (processSpec (QRELNULL)); }
1513 #line 283 "cscanner.l"
1514 { return (processSpec (QRELDEF)); }
1518 #line 284 "cscanner.l"
1519 { return (processSpec (QEXPOSED)); }
1523 #line 285 "cscanner.l"
1524 { return (processSpec (QNEWREF)); }
1528 #line 286 "cscanner.l"
1529 { return (processSpec (QTEMPREF)); }
1533 #line 287 "cscanner.l"
1534 { return (processSpec (QKILLREF)); }
1538 #line 288 "cscanner.l"
1539 { return (processSpec (QREFCOUNTED)); }
1543 #line 289 "cscanner.l"
1544 { return (processSpec (QCHECKED)); }
1548 #line 290 "cscanner.l"
1549 { return (processSpec (QCHECKMOD)); }
1553 #line 291 "cscanner.l"
1554 { return (processSpec (QCHECKEDSTRICT)); }
1558 #line 292 "cscanner.l"
1559 { return (processSpec (QUNCHECKED)); }
1563 #line 293 "cscanner.l"
1564 { return (processSpec (QONLY)); }
1568 #line 294 "cscanner.l"
1569 { return (processSpec (QOWNED)); }
1573 #line 295 "cscanner.l"
1574 { return (processSpec (QOBSERVER)); }
1578 #line 296 "cscanner.l"
1579 { return (processSpec (QDEPENDENT)); }
1583 #line 297 "cscanner.l"
1584 { return (processSpec (QUNUSED)); }
1588 #line 298 "cscanner.l"
1589 { return (processSpec (QEXTERNAL)); }
1593 #line 299 "cscanner.l"
1594 { return (processSpec (QSEF)); }
1598 #line 300 "cscanner.l"
1599 { return (processSpec (QSHARED)); }
1603 #line 301 "cscanner.l"
1604 { return (processSpec (QYIELD)); }
1608 #line 302 "cscanner.l"
1609 { return (processSpec (QUNDEF)); }
1613 #line 303 "cscanner.l"
1614 { return (processSpec (QKILLED)); }
1618 #line 304 "cscanner.l"
1619 { return (processSpec (QNULLTERMINATED));}
1623 #line 305 "cscanner.l"
1624 { return (processSpec (QMAXSET));}
1628 #line 306 "cscanner.l"
1629 { return (processSpec (QMAXREAD));}
1633 #line 308 "cscanner.l"
1635 context_saveLocation ();
1636 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1637 tok = processIdentifier (makeIdentifier (yytext));
1646 #line 317 "cscanner.l"
1647 { setTokLengthT (mstring_length (yytext));
1648 RETURN_INT (ctype_int, processHex ()); /* evs 2000-05-17 was ctype_uint */
1653 #line 320 "cscanner.l"
1654 { setTokLengthT (mstring_length (yytext));
1655 RETURN_INT (ctype_lint, processHex ()); }
1659 #line 322 "cscanner.l"
1660 { setTokLengthT (mstring_length (yytext));
1661 RETURN_INT (ctype_llint, processHex ()); }
1665 #line 324 "cscanner.l"
1666 { setTokLengthT (mstring_length (yytext));
1667 RETURN_INT (ctype_uint, processHex ()); }
1671 #line 326 "cscanner.l"
1672 { setTokLengthT (mstring_length (yytext));
1673 RETURN_INT (ctype_ulint, processHex ()); }
1677 #line 328 "cscanner.l"
1678 { setTokLengthT (mstring_length (yytext));
1679 RETURN_INT (ctype_ullint, processHex ()); }
1683 #line 330 "cscanner.l"
1684 { setTokLengthT (mstring_length (yytext));
1685 RETURN_INT (ctype_ullint, processHex ()); }
1689 #line 332 "cscanner.l"
1690 { setTokLengthT (mstring_length (yytext));
1691 RETURN_INT (ctype_int, processOctal ()); }
1695 #line 334 "cscanner.l"
1696 { setTokLengthT (mstring_length (yytext));
1697 RETURN_INT (ctype_uint, processOctal ()); }
1701 #line 336 "cscanner.l"
1702 { setTokLengthT (mstring_length (yytext));
1703 RETURN_INT (ctype_lint, processOctal ()); }
1707 #line 338 "cscanner.l"
1708 { setTokLengthT (mstring_length (yytext));
1709 RETURN_INT (ctype_llint, processOctal ()); }
1713 #line 340 "cscanner.l"
1714 { setTokLengthT (mstring_length (yytext));
1715 RETURN_INT (ctype_ulint, processOctal ()); }
1719 #line 342 "cscanner.l"
1720 { setTokLengthT (mstring_length (yytext));
1721 RETURN_INT (ctype_ullint, processOctal ()); }
1725 #line 344 "cscanner.l"
1726 { setTokLengthT (mstring_length (yytext));
1727 RETURN_INT (ctype_ullint, processOctal ()); }
1731 #line 346 "cscanner.l"
1732 { setTokLengthT (mstring_length (yytext));
1733 RETURN_INT (ctype_int, processDec ()); }
1737 #line 348 "cscanner.l"
1738 { setTokLengthT (mstring_length (yytext));
1739 RETURN_INT (ctype_uint, processDec ()); }
1743 #line 350 "cscanner.l"
1744 { setTokLengthT (mstring_length (yytext));
1745 RETURN_INT (ctype_lint, processDec ()); }
1749 #line 352 "cscanner.l"
1750 { setTokLengthT (mstring_length (yytext));
1751 RETURN_INT (ctype_llint, processDec ()); }
1755 #line 354 "cscanner.l"
1756 { setTokLengthT (mstring_length (yytext));
1757 RETURN_INT (ctype_ulint, processDec ()); }
1761 #line 356 "cscanner.l"
1762 { setTokLengthT (mstring_length (yytext));
1763 RETURN_INT (ctype_ullint, processDec ()); }
1767 #line 358 "cscanner.l"
1768 { setTokLengthT (mstring_length (yytext));
1769 RETURN_INT (ctype_ullint, processDec ()); }
1773 #line 360 "cscanner.l"
1774 { setTokLengthT (mstring_length (yytext));
1775 RETURN_CHAR (processChar ()); }
1779 #line 362 "cscanner.l"
1780 { setTokLengthT (mstring_length (yytext));
1781 RETURN_FLOAT (ctype_float, processFloat ()); }
1785 #line 364 "cscanner.l"
1786 { setTokLengthT (mstring_length (yytext));
1787 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1791 #line 366 "cscanner.l"
1792 { setTokLengthT (mstring_length (yytext));
1793 RETURN_FLOAT (ctype_double, processFloat ()); }
1797 #line 369 "cscanner.l"
1798 { setTokLengthT (mstring_length (yytext));
1799 RETURN_FLOAT (ctype_float, processFloat ()); }
1803 #line 371 "cscanner.l"
1804 { setTokLengthT (mstring_length (yytext));
1805 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1809 #line 373 "cscanner.l"
1810 { setTokLengthT (mstring_length (yytext));
1811 RETURN_FLOAT (ctype_double, processFloat ()); }
1815 #line 376 "cscanner.l"
1816 { setTokLengthT (mstring_length (yytext));
1817 RETURN_FLOAT (ctype_float, processFloat ()); }
1821 #line 378 "cscanner.l"
1822 { setTokLengthT (mstring_length (yytext));
1823 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1827 #line 380 "cscanner.l"
1828 { setTokLengthT (mstring_length (yytext));
1829 RETURN_FLOAT (ctype_double, processFloat ()); }
1833 #line 383 "cscanner.l"
1834 { setTokLength (3); RETURN_TOK (RIGHT_ASSIGN); }
1838 #line 384 "cscanner.l"
1839 { setTokLength (3); RETURN_TOK (LEFT_ASSIGN); }
1843 #line 385 "cscanner.l"
1844 { setTokLength (2); RETURN_TOK (ADD_ASSIGN); }
1848 #line 386 "cscanner.l"
1849 { setTokLength (2); RETURN_TOK (SUB_ASSIGN); }
1853 #line 387 "cscanner.l"
1854 { setTokLength (2); RETURN_TOK (MUL_ASSIGN); }
1858 #line 388 "cscanner.l"
1859 { setTokLength (2); RETURN_TOK (DIV_ASSIGN); }
1863 #line 389 "cscanner.l"
1864 { setTokLength (2); RETURN_TOK (MOD_ASSIGN); }
1868 #line 390 "cscanner.l"
1869 { setTokLength (2); RETURN_TOK (AND_ASSIGN); }
1873 #line 391 "cscanner.l"
1874 { setTokLength (2); RETURN_TOK (XOR_ASSIGN); }
1878 #line 392 "cscanner.l"
1879 { setTokLength (2); RETURN_TOK (OR_ASSIGN); }
1883 #line 393 "cscanner.l"
1884 { setTokLength (2); RETURN_TOK (RIGHT_OP); }
1888 #line 394 "cscanner.l"
1889 { setTokLength (2); RETURN_TOK (LEFT_OP); }
1893 #line 395 "cscanner.l"
1894 { setTokLength (2); RETURN_TOK (INC_OP); }
1898 #line 396 "cscanner.l"
1899 { setTokLength (2); RETURN_TOK (DEC_OP); }
1903 #line 397 "cscanner.l"
1904 { setTokLength (2); RETURN_TOK (ARROW_OP); }
1908 #line 398 "cscanner.l"
1909 { setTokLength (2); RETURN_TOK (AND_OP); }
1913 #line 399 "cscanner.l"
1914 { setTokLength (2); RETURN_TOK (OR_OP); }
1918 #line 400 "cscanner.l"
1919 { setTokLength (2); RETURN_TOK (LE_OP); }
1923 #line 401 "cscanner.l"
1924 { setTokLength (2); RETURN_TOK (GE_OP); }
1928 #line 402 "cscanner.l"
1929 { setTokLength (2); RETURN_TOK (EQ_OP); }
1933 #line 403 "cscanner.l"
1934 { setTokLength (2); RETURN_TOK (NE_OP); }
1938 #line 404 "cscanner.l"
1939 { setTokLength (1); RETURN_TOK (TSEMI); }
1943 #line 405 "cscanner.l"
1944 { setTokLength (1); RETURN_TOK (TLBRACE); }
1948 #line 406 "cscanner.l"
1949 { setTokLength (1); RETURN_TOK (TRBRACE); }
1953 #line 407 "cscanner.l"
1954 { setTokLength (1); RETURN_TOK (TCOMMA); }
1958 #line 408 "cscanner.l"
1959 { setTokLength (1); RETURN_TOK (TCOLON); }
1963 #line 409 "cscanner.l"
1964 { setTokLength (1); RETURN_TOK (TASSIGN); }
1968 #line 410 "cscanner.l"
1969 { setTokLength (1); RETURN_TOK (TLPAREN); }
1973 #line 411 "cscanner.l"
1974 { setTokLength (1); RETURN_TOK (TRPAREN); }
1978 #line 412 "cscanner.l"
1979 { setTokLength (1); RETURN_TOK (TLSQBR); }
1983 #line 413 "cscanner.l"
1984 { setTokLength (1); RETURN_TOK (TRSQBR); }
1988 #line 414 "cscanner.l"
1989 { setTokLength (1); RETURN_TOK (TDOT); }
1993 #line 415 "cscanner.l"
1994 { setTokLength (1); RETURN_TOK (TAMPERSAND); }
1998 #line 416 "cscanner.l"
1999 { setTokLength (1); RETURN_TOK (TEXCL); }
2003 #line 419 "cscanner.l"
2004 { setTokLength (1); RETURN_TOK (TTILDE); }
2008 #line 420 "cscanner.l"
2009 { setTokLength (1); RETURN_TOK (TMINUS); }
2013 #line 421 "cscanner.l"
2014 { setTokLength (1); RETURN_TOK (TPLUS); }
2018 #line 422 "cscanner.l"
2019 { setTokLength (1); RETURN_TOK (TMULT); }
2023 #line 423 "cscanner.l"
2024 { setTokLength (1); RETURN_TOK (TDIV); }
2028 #line 424 "cscanner.l"
2029 { setTokLength (1); RETURN_TOK (TPERCENT); }
2033 #line 425 "cscanner.l"
2034 { setTokLength (1); RETURN_TOK (TLT); }
2038 #line 426 "cscanner.l"
2039 { setTokLength (1); RETURN_TOK (TGT); }
2043 #line 427 "cscanner.l"
2044 { setTokLength (1); RETURN_TOK (TCIRC); }
2048 #line 428 "cscanner.l"
2049 { setTokLength (1); RETURN_TOK (TBAR); }
2053 #line 429 "cscanner.l"
2054 { setTokLength (1); RETURN_TOK (TQUEST); }
2058 #line 431 "cscanner.l"
2063 #line 432 "cscanner.l"
2064 { context_incLineno ();
2067 continueLine = FALSE;
2071 if (context_inMacro ())
2073 /* Don't use RETURN_TOK */
2074 yylval.tok = lltok_create (TENDMACRO, g_currentloc);
2075 lastWasString = FALSE;
2083 #line 448 "cscanner.l"
2086 if (processMacro ()) {
2087 if (context_inIterDef ())
2089 RETURN_TOK (LLMACROITER);
2091 if (context_inIterEnd ())
2093 RETURN_TOK (LLMACROEND);
2095 if (context_inMacro ())
2097 RETURN_TOK (LLMACRO);
2104 #line 465 "cscanner.l"
2105 { if (context_inHeader () || context_inFunction ())
2111 int nspchar = ninput ();
2115 ** This is a hack to get the column number correct.
2118 llassert (nspchar >= '0' && nspchar <= '9');
2120 nspaces = nspchar - '0';
2122 setTokLength (5 + nspaces);
2124 if (processMacro ())
2126 if (context_inIterDef ())
2128 RETURN_TOK (LLMACROITER);
2130 if (context_inIterEnd ())
2132 RETURN_TOK (LLMACROEND);
2134 if (context_inMacro ())
2136 RETURN_TOK (LLMACRO);
2144 #line 501 "cscanner.l"
2145 { setTokLength (4); lldiagmsg (ctype_unparseTable ()); }
2149 #line 502 "cscanner.l"
2151 lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc)));
2156 #line 505 "cscanner.l"
2157 { setTokLength (3); usymtab_printLocal (); }
2161 #line 506 "cscanner.l"
2162 { setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); }
2166 #line 507 "cscanner.l"
2167 { setTokLength (3); lldiagmsg (context_unparse ()); }
2171 #line 508 "cscanner.l"
2172 { setTokLength (3); lldiagmsg (context_unparseClauses ()); }
2176 #line 509 "cscanner.l"
2177 { setTokLength (3); usymtab_printGuards (); }
2181 #line 510 "cscanner.l"
2182 { setTokLength (3); usymtab_printOut (); }
2186 #line 511 "cscanner.l"
2187 { setTokLength (3); usymtab_printAll (); }
2191 #line 512 "cscanner.l"
2192 { setTokLength (3); usymtab_printComplete (); }
2196 #line 513 "cscanner.l"
2197 { setTokLength (3); usymtab_printTypes (); }
2201 #line 514 "cscanner.l"
2202 { setTokLength (3); lldiagmsg (usymtab_unparseStack ()); }
2206 #line 515 "cscanner.l"
2208 lldiagmsg (message ("Can modify: %q",
2209 sRefSet_unparse (context_modList ())));
2214 #line 519 "cscanner.l"
2215 { /* BEFORE_COMMENT_MARKER */
2217 incColumn (); incColumn ();
2218 tok = handleLlSpecial ();
2227 #line 528 "cscanner.l"
2228 { /* AFTER_COMMENT_MARKER */
2231 RETURN_TOK (QENDMACRO); }
2235 #line 532 "cscanner.l"
2236 { incColumn (); continueLine = TRUE; }
2240 #line 533 "cscanner.l"
2244 message ("Invalid character (ascii: %d), skipping character",
2251 #line 540 "cscanner.l"
2254 #line 2172 "lex.yy.c"
2255 case YY_STATE_EOF(INITIAL):
2258 case YY_END_OF_BUFFER:
2260 /* Amount of text matched not including the EOB char. */
2261 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2263 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2264 *yy_cp = yy_hold_char;
2265 YY_RESTORE_YY_MORE_OFFSET
2267 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2269 /* We're scanning a new file or input source. It's
2270 * possible that this happened because the user
2271 * just pointed yyin at a new source and called
2272 * yylex(). If so, then we have to assure
2273 * consistency between yy_current_buffer and our
2274 * globals. Here is the right place to do so, because
2275 * this is the first action (other than possibly a
2276 * back-up) that will match for the new input source.
2278 yy_n_chars = yy_current_buffer->yy_n_chars;
2279 yy_current_buffer->yy_input_file = yyin;
2280 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2283 /* Note that here we test for yy_c_buf_p "<=" to the position
2284 * of the first EOB in the buffer, since yy_c_buf_p will
2285 * already have been incremented past the NUL character
2286 * (since all states make transitions on EOB to the
2287 * end-of-buffer state). Contrast this with the test
2290 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2291 { /* This was really a NUL. */
2292 yy_state_type yy_next_state;
2294 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2296 yy_current_state = yy_get_previous_state();
2298 /* Okay, we're now positioned to make the NUL
2299 * transition. We couldn't have
2300 * yy_get_previous_state() go ahead and do it
2301 * for us because it doesn't know how to deal
2302 * with the possibility of jamming (and we don't
2303 * want to build jamming into it because then it
2304 * will run more slowly).
2307 yy_next_state = yy_try_NUL_trans( yy_current_state );
2309 yy_bp = yytext_ptr + YY_MORE_ADJ;
2311 if ( yy_next_state )
2313 /* Consume the NUL. */
2314 yy_cp = ++yy_c_buf_p;
2315 yy_current_state = yy_next_state;
2322 goto yy_find_action;
2326 else switch ( yy_get_next_buffer() )
2328 case EOB_ACT_END_OF_FILE:
2330 yy_did_buffer_switch_on_eof = 0;
2334 /* Note: because we've taken care in
2335 * yy_get_next_buffer() to have set up
2336 * yytext, we can now set up
2337 * yy_c_buf_p so that if some total
2338 * hoser (like flex itself) wants to
2339 * call the scanner after we return the
2340 * YY_NULL, it'll still work - another
2341 * YY_NULL will get returned.
2343 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2345 yy_act = YY_STATE_EOF(YY_START);
2351 if ( ! yy_did_buffer_switch_on_eof )
2357 case EOB_ACT_CONTINUE_SCAN:
2359 yytext_ptr + yy_amount_of_matched_text;
2361 yy_current_state = yy_get_previous_state();
2364 yy_bp = yytext_ptr + YY_MORE_ADJ;
2367 case EOB_ACT_LAST_MATCH:
2369 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2371 yy_current_state = yy_get_previous_state();
2374 yy_bp = yytext_ptr + YY_MORE_ADJ;
2375 goto yy_find_action;
2382 "fatal flex scanner internal error--no action found" );
2383 } /* end of action switch */
2384 } /* end of scanning one token */
2385 } /* end of yylex */
2388 /* yy_get_next_buffer - try to read in a new buffer
2390 * Returns a code representing an action:
2391 * EOB_ACT_LAST_MATCH -
2392 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2393 * EOB_ACT_END_OF_FILE - end of file
2396 static int yy_get_next_buffer()
2398 register char *dest = yy_current_buffer->yy_ch_buf;
2399 register char *source = yytext_ptr;
2400 register int number_to_move, i;
2403 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2405 "fatal flex scanner internal error--end of buffer missed" );
2407 if ( yy_current_buffer->yy_fill_buffer == 0 )
2408 { /* Don't try to fill the buffer, so this is an EOF. */
2409 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2411 /* We matched a single character, the EOB, so
2412 * treat this as a final EOF.
2414 return EOB_ACT_END_OF_FILE;
2419 /* We matched some text prior to the EOB, first
2422 return EOB_ACT_LAST_MATCH;
2426 /* Try to read more data. */
2428 /* First move last chars to start of buffer. */
2429 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2431 for ( i = 0; i < number_to_move; ++i )
2432 *(dest++) = *(source++);
2434 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2435 /* don't do the read, it's not guaranteed to return an EOF,
2438 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2443 yy_current_buffer->yy_buf_size - number_to_move - 1;
2445 while ( num_to_read <= 0 )
2446 { /* Not enough room in the buffer - grow it. */
2447 #ifdef YY_USES_REJECT
2449 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2452 /* just a shorter name for the current buffer */
2453 YY_BUFFER_STATE b = yy_current_buffer;
2455 int yy_c_buf_p_offset =
2456 (int) (yy_c_buf_p - b->yy_ch_buf);
2458 if ( b->yy_is_our_buffer )
2460 int new_size = b->yy_buf_size * 2;
2462 if ( new_size <= 0 )
2463 b->yy_buf_size += b->yy_buf_size / 8;
2465 b->yy_buf_size *= 2;
2467 b->yy_ch_buf = (char *)
2468 /* Include room in for 2 EOB chars. */
2469 yy_flex_realloc( (void *) b->yy_ch_buf,
2470 b->yy_buf_size + 2 );
2473 /* Can't grow it, we don't own it. */
2476 if ( ! b->yy_ch_buf )
2478 "fatal error - scanner input buffer overflow" );
2480 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2482 num_to_read = yy_current_buffer->yy_buf_size -
2487 if ( num_to_read > YY_READ_BUF_SIZE )
2488 num_to_read = YY_READ_BUF_SIZE;
2490 /* Read in more data. */
2491 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2492 yy_n_chars, num_to_read );
2494 yy_current_buffer->yy_n_chars = yy_n_chars;
2497 if ( yy_n_chars == 0 )
2499 if ( number_to_move == YY_MORE_ADJ )
2501 ret_val = EOB_ACT_END_OF_FILE;
2507 ret_val = EOB_ACT_LAST_MATCH;
2508 yy_current_buffer->yy_buffer_status =
2509 YY_BUFFER_EOF_PENDING;
2514 ret_val = EOB_ACT_CONTINUE_SCAN;
2516 yy_n_chars += number_to_move;
2517 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2518 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2520 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2526 /* yy_get_previous_state - get the state just before the EOB char was reached */
2528 static yy_state_type yy_get_previous_state()
2530 register yy_state_type yy_current_state;
2531 register char *yy_cp;
2533 yy_current_state = yy_start;
2535 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2537 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2538 if ( yy_accept[yy_current_state] )
2540 yy_last_accepting_state = yy_current_state;
2541 yy_last_accepting_cpos = yy_cp;
2543 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2545 yy_current_state = (int) yy_def[yy_current_state];
2546 if ( yy_current_state >= 529 )
2547 yy_c = yy_meta[(unsigned int) yy_c];
2549 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2552 return yy_current_state;
2556 /* yy_try_NUL_trans - try to make a transition on the NUL character
2559 * next_state = yy_try_NUL_trans( current_state );
2562 #ifdef YY_USE_PROTOS
2563 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2565 static yy_state_type yy_try_NUL_trans( yy_current_state )
2566 yy_state_type yy_current_state;
2569 register int yy_is_jam;
2570 register char *yy_cp = yy_c_buf_p;
2572 register YY_CHAR yy_c = 1;
2573 if ( yy_accept[yy_current_state] )
2575 yy_last_accepting_state = yy_current_state;
2576 yy_last_accepting_cpos = yy_cp;
2578 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2580 yy_current_state = (int) yy_def[yy_current_state];
2581 if ( yy_current_state >= 529 )
2582 yy_c = yy_meta[(unsigned int) yy_c];
2584 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2585 yy_is_jam = (yy_current_state == 528);
2587 return yy_is_jam ? 0 : yy_current_state;
2592 #ifdef YY_USE_PROTOS
2593 static void yyunput( int c, register char *yy_bp )
2595 static void yyunput( c, yy_bp )
2597 register char *yy_bp;
2600 register char *yy_cp = yy_c_buf_p;
2602 /* undo effects of setting up yytext */
2603 *yy_cp = yy_hold_char;
2605 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2606 { /* need to shift things up to make room */
2607 /* +2 for EOB chars. */
2608 register int number_to_move = yy_n_chars + 2;
2609 register char *dest = &yy_current_buffer->yy_ch_buf[
2610 yy_current_buffer->yy_buf_size + 2];
2611 register char *source =
2612 &yy_current_buffer->yy_ch_buf[number_to_move];
2614 while ( source > yy_current_buffer->yy_ch_buf )
2615 *--dest = *--source;
2617 yy_cp += (int) (dest - source);
2618 yy_bp += (int) (dest - source);
2619 yy_current_buffer->yy_n_chars =
2620 yy_n_chars = yy_current_buffer->yy_buf_size;
2622 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2623 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2626 *--yy_cp = (char) c;
2630 yy_hold_char = *yy_cp;
2633 #endif /* ifndef YY_NO_UNPUT */
2637 static int yyinput()
2644 *yy_c_buf_p = yy_hold_char;
2646 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2648 /* yy_c_buf_p now points to the character we want to return.
2649 * If this occurs *before* the EOB characters, then it's a
2650 * valid NUL; if not, then we've hit the end of the buffer.
2652 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2653 /* This was really a NUL. */
2657 { /* need more input */
2658 int offset = yy_c_buf_p - yytext_ptr;
2661 switch ( yy_get_next_buffer() )
2663 case EOB_ACT_LAST_MATCH:
2664 /* This happens because yy_g_n_b()
2665 * sees that we've accumulated a
2666 * token and flags that we need to
2667 * try matching the token before
2668 * proceeding. But for input(),
2669 * there's no matching to consider.
2670 * So convert the EOB_ACT_LAST_MATCH
2671 * to EOB_ACT_END_OF_FILE.
2674 /* Reset buffer status. */
2679 case EOB_ACT_END_OF_FILE:
2684 if ( ! yy_did_buffer_switch_on_eof )
2693 case EOB_ACT_CONTINUE_SCAN:
2694 yy_c_buf_p = yytext_ptr + offset;
2700 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2701 *yy_c_buf_p = '\0'; /* preserve yytext */
2702 yy_hold_char = *++yy_c_buf_p;
2709 #ifdef YY_USE_PROTOS
2710 void yyrestart( FILE *input_file )
2712 void yyrestart( input_file )
2716 if ( ! yy_current_buffer )
2717 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2719 yy_init_buffer( yy_current_buffer, input_file );
2720 yy_load_buffer_state();
2724 #ifdef YY_USE_PROTOS
2725 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2727 void yy_switch_to_buffer( new_buffer )
2728 YY_BUFFER_STATE new_buffer;
2731 if ( yy_current_buffer == new_buffer )
2734 if ( yy_current_buffer )
2736 /* Flush out information for old buffer. */
2737 *yy_c_buf_p = yy_hold_char;
2738 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2739 yy_current_buffer->yy_n_chars = yy_n_chars;
2742 yy_current_buffer = new_buffer;
2743 yy_load_buffer_state();
2745 /* We don't actually know whether we did this switch during
2746 * EOF (yywrap()) processing, but the only time this flag
2747 * is looked at is after yywrap() is called, so it's safe
2748 * to go ahead and always set it.
2750 yy_did_buffer_switch_on_eof = 1;
2754 #ifdef YY_USE_PROTOS
2755 void yy_load_buffer_state( void )
2757 void yy_load_buffer_state()
2760 yy_n_chars = yy_current_buffer->yy_n_chars;
2761 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2762 yyin = yy_current_buffer->yy_input_file;
2763 yy_hold_char = *yy_c_buf_p;
2767 #ifdef YY_USE_PROTOS
2768 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2770 YY_BUFFER_STATE yy_create_buffer( file, size )
2777 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2779 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2781 b->yy_buf_size = size;
2783 /* yy_ch_buf has to be 2 characters longer than the size given because
2784 * we need to put in 2 end-of-buffer characters.
2786 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2787 if ( ! b->yy_ch_buf )
2788 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2790 b->yy_is_our_buffer = 1;
2792 yy_init_buffer( b, file );
2798 #ifdef YY_USE_PROTOS
2799 void yy_delete_buffer( YY_BUFFER_STATE b )
2801 void yy_delete_buffer( b )
2808 if ( b == yy_current_buffer )
2809 yy_current_buffer = (YY_BUFFER_STATE) 0;
2811 if ( b->yy_is_our_buffer )
2812 yy_flex_free( (void *) b->yy_ch_buf );
2814 yy_flex_free( (void *) b );
2818 #ifndef YY_ALWAYS_INTERACTIVE
2819 #ifndef YY_NEVER_INTERACTIVE
2820 extern int isatty YY_PROTO(( int ));
2824 #ifdef YY_USE_PROTOS
2825 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2827 void yy_init_buffer( b, file )
2834 yy_flush_buffer( b );
2836 b->yy_input_file = file;
2837 b->yy_fill_buffer = 1;
2839 #if YY_ALWAYS_INTERACTIVE
2840 b->yy_is_interactive = 1;
2842 #if YY_NEVER_INTERACTIVE
2843 b->yy_is_interactive = 0;
2845 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2851 #ifdef YY_USE_PROTOS
2852 void yy_flush_buffer( YY_BUFFER_STATE b )
2854 void yy_flush_buffer( b )
2864 /* We always need two end-of-buffer characters. The first causes
2865 * a transition to the end-of-buffer state. The second causes
2866 * a jam in that state.
2868 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2869 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2871 b->yy_buf_pos = &b->yy_ch_buf[0];
2874 b->yy_buffer_status = YY_BUFFER_NEW;
2876 if ( b == yy_current_buffer )
2877 yy_load_buffer_state();
2881 #ifndef YY_NO_SCAN_BUFFER
2882 #ifdef YY_USE_PROTOS
2883 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2885 YY_BUFFER_STATE yy_scan_buffer( base, size )
2893 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2894 base[size-1] != YY_END_OF_BUFFER_CHAR )
2895 /* They forgot to leave room for the EOB's. */
2898 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2900 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2902 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2903 b->yy_buf_pos = b->yy_ch_buf = base;
2904 b->yy_is_our_buffer = 0;
2905 b->yy_input_file = 0;
2906 b->yy_n_chars = b->yy_buf_size;
2907 b->yy_is_interactive = 0;
2909 b->yy_fill_buffer = 0;
2910 b->yy_buffer_status = YY_BUFFER_NEW;
2912 yy_switch_to_buffer( b );
2919 #ifndef YY_NO_SCAN_STRING
2920 #ifdef YY_USE_PROTOS
2921 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2923 YY_BUFFER_STATE yy_scan_string( yy_str )
2924 yyconst char *yy_str;
2928 for ( len = 0; yy_str[len]; ++len )
2931 return yy_scan_bytes( yy_str, len );
2936 #ifndef YY_NO_SCAN_BYTES
2937 #ifdef YY_USE_PROTOS
2938 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2940 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2941 yyconst char *bytes;
2950 /* Get memory for full buffer, including space for trailing EOB's. */
2952 buf = (char *) yy_flex_alloc( n );
2954 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2956 for ( i = 0; i < len; ++i )
2959 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2961 b = yy_scan_buffer( buf, n );
2963 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2965 /* It's okay to grow etc. this buffer, and we should throw it
2966 * away when we're done.
2968 b->yy_is_our_buffer = 1;
2975 #ifndef YY_NO_PUSH_STATE
2976 #ifdef YY_USE_PROTOS
2977 static void yy_push_state( int new_state )
2979 static void yy_push_state( new_state )
2983 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2987 yy_start_stack_depth += YY_START_STACK_INCR;
2988 new_size = yy_start_stack_depth * sizeof( int );
2990 if ( ! yy_start_stack )
2991 yy_start_stack = (int *) yy_flex_alloc( new_size );
2994 yy_start_stack = (int *) yy_flex_realloc(
2995 (void *) yy_start_stack, new_size );
2997 if ( ! yy_start_stack )
2999 "out of memory expanding start-condition stack" );
3002 yy_start_stack[yy_start_stack_ptr++] = YY_START;
3009 #ifndef YY_NO_POP_STATE
3010 static void yy_pop_state()
3012 if ( --yy_start_stack_ptr < 0 )
3013 YY_FATAL_ERROR( "start-condition stack underflow" );
3015 BEGIN(yy_start_stack[yy_start_stack_ptr]);
3020 #ifndef YY_NO_TOP_STATE
3021 static int yy_top_state()
3023 return yy_start_stack[yy_start_stack_ptr - 1];
3027 #ifndef YY_EXIT_FAILURE
3028 #define YY_EXIT_FAILURE 2
3031 #ifdef YY_USE_PROTOS
3032 static void yy_fatal_error( yyconst char msg[] )
3034 static void yy_fatal_error( msg )
3038 (void) fprintf( stderr, "%s\n", msg );
3039 exit( YY_EXIT_FAILURE );
3044 /* Redefine yyless() so it works in section 3 code. */
3050 /* Undo effects of setting up yytext. */ \
3051 yytext[yyleng] = yy_hold_char; \
3052 yy_c_buf_p = yytext + n; \
3053 yy_hold_char = *yy_c_buf_p; \
3054 *yy_c_buf_p = '\0'; \
3060 /* Internal utility routines. */
3063 #ifdef YY_USE_PROTOS
3064 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
3066 static void yy_flex_strncpy( s1, s2, n )
3073 for ( i = 0; i < n; ++i )
3078 #ifdef YY_NEED_STRLEN
3079 #ifdef YY_USE_PROTOS
3080 static int yy_flex_strlen( yyconst char *s )
3082 static int yy_flex_strlen( s )
3087 for ( n = 0; s[n]; ++n )
3095 #ifdef YY_USE_PROTOS
3096 static void *yy_flex_alloc( yy_size_t size )
3098 static void *yy_flex_alloc( size )
3102 return (void *) malloc( size );
3105 #ifdef YY_USE_PROTOS
3106 static void *yy_flex_realloc( void *ptr, yy_size_t size )
3108 static void *yy_flex_realloc( ptr, size )
3113 /* The cast to (char *) in the following accommodates both
3114 * implementations that use char* generic pointers, and those
3115 * that use void* generic pointers. It works with the latter
3116 * because both ANSI C and C++ allow castless assignment from
3117 * any pointer type to void*, and deal with argument conversions
3118 * as though doing an assignment.
3120 return (void *) realloc( (char *) ptr, size );
3123 #ifdef YY_USE_PROTOS
3124 static void yy_flex_free( void *ptr )
3126 static void yy_flex_free( ptr )
3140 #line 540 "cscanner.l"
3145 /*@null@*/ /*@observer@*/ char *name;
3150 ** These tokens are followed by syntax that is parsed by the
3154 struct skeyword s_parsetable[] = {
3155 { "modifies", QMODIFIES } ,
3156 { "globals", QGLOBALS } ,
3158 { "constant", QCONSTANT } ,
3159 { "function", QFUNCTION } ,
3161 { "defines", QDEFINES } ,
3163 { "allocates", QALLOCATES } ,
3165 { "releases", QRELEASES } ,
3166 { "pre", QPRECLAUSE } ,
3167 { "post", QPOSTCLAUSE } ,
3168 {"setBufferSize", QSETBUFFERSIZE},
3169 {"bufferConstraint", QBUFFERCONSTRAINT},
3170 {"ensuresConstraint", QENSURESCONSTRAINT},
3171 {"setStringLength", QSETSTRINGLENGTH},
3172 {"testinRange", QTESTINRANGE},
3177 ** These tokens are either stand-alone tokens, or followed by
3178 ** token-specific text.
3181 struct skeyword s_keytable[] = {
3182 { "anytype", QANYTYPE } ,
3183 { "integraltype", QINTEGRALTYPE } ,
3184 { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } ,
3185 { "signedintegraltype", QSIGNEDINTEGRALTYPE } ,
3189 { "owned", QOWNED } ,
3190 { "dependent", QDEPENDENT } ,
3191 { "partial", QPARTIAL } ,
3192 { "special", QSPECIAL } ,
3193 { "truenull", QTRUENULL } ,
3194 { "falsenull", QFALSENULL } ,
3197 { "notnull", QNOTNULL } ,
3198 { "abstract", QABSTRACT } ,
3199 { "concrete", QCONCRETE } ,
3200 { "mutable", QMUTABLE } ,
3201 { "immutable", QIMMUTABLE } ,
3202 { "unused", QUNUSED } ,
3203 { "external", QEXTERNAL } ,
3205 { "unique", QUNIQUE } ,
3206 { "returned", QRETURNED } ,
3207 { "exposed", QEXPOSED } ,
3208 { "refcounted", QREFCOUNTED } ,
3210 { "newref", QNEWREF } ,
3211 { "tempref", QTEMPREF } ,
3212 { "killref", QKILLREF } ,
3214 { "relnull", QRELNULL } ,
3215 { "nullterminated", QNULLTERMINATED },
3216 { "setBufferSize", QSETBUFFERSIZE },
3217 { "bufferConstraint", QBUFFERCONSTRAINT },
3218 { "ensuresConstraint", QENSURESCONSTRAINT },
3219 { "testInRange", QTESTINRANGE},
3220 { "MaxSet", QMAXSET},
3221 { "MaxRead", QMAXREAD},
3222 { "reldef", QRELDEF } ,
3223 { "observer", QOBSERVER } ,
3224 { "exits", QEXITS } ,
3225 { "mayexit", QMAYEXIT } ,
3226 { "trueexit", QTRUEEXIT } ,
3227 { "falseexit", QFALSEEXIT } ,
3228 { "neverexit", QNEVEREXIT } ,
3230 { "shared", QSHARED } ,
3232 { "unchecked", QUNCHECKED } ,
3233 { "checked", QCHECKED } ,
3234 { "checkmod", QCHECKMOD } ,
3235 { "checkedstrict", QCHECKEDSTRICT } ,
3236 { "innercontinue", QINNERCONTINUE } ,
3237 { "innerbreak", QINNERBREAK } ,
3238 { "loopbreak", QLOOPBREAK } ,
3239 { "switchbreak", QSWITCHBREAK } ,
3240 { "safebreak", QSAFEBREAK } ,
3241 { "fallthrough", QFALLTHROUGH } ,
3242 { "l_fallthrou", QLINTFALLTHROUGH } ,
3243 { "l_fallth", QLINTFALLTHRU } ,
3244 { "notreached", QNOTREACHED } ,
3245 { "l_notreach", QLINTNOTREACHED } ,
3246 { "printflike", QPRINTFLIKE } ,
3247 { "l_printfli", QLINTPRINTFLIKE } ,
3248 { "scanflike", QSCANFLIKE } ,
3249 { "messagelike", QMESSAGELIKE } ,
3250 { "l_argsus", QARGSUSED } ,
3255 ** would be better if these weren't hard coded...
3258 static bool isArtificial (cstring s)
3260 return (cstring_equalLit (s, "modifies")
3261 || cstring_equalLit (s, "globals")
3262 || cstring_equalLit (s, "alt"));
3265 void swallowMacro (void)
3268 bool skipnext = FALSE;
3270 while ((i = lminput ()) != EOF)
3287 checkUngetc (i, yyin);
3295 checkUngetc (i, yyin);
3299 static int commentMarkerToken (cstring s)
3303 while (s_parsetable[i].name != NULL)
3305 if (cstring_equalLit (s, s_parsetable[i].name))
3307 return s_parsetable[i].token;
3316 static int tokenMacroCode (cstring s)
3320 while (s_keytable[i].name != NULL)
3322 if (cstring_equalLit (s, s_keytable[i].name))
3324 if (s_keytable[i].token == QLINTFALLTHROUGH)
3327 (FLG_WARNLINTCOMMENTS,
3329 ("Traditional lint comment /*FALLTHROUGH*/ used. "
3330 "This is interpreted by "
3331 "LCLint in the same way as most Unix lints, but it is "
3332 "preferable to replace it with the /*@fallthrough@*/ "
3333 "stylized comment"),
3335 return QFALLTHROUGH;
3337 else if (s_keytable[i].token == QLINTFALLTHRU)
3340 (FLG_WARNLINTCOMMENTS,
3342 ("Traditional lint comment /*FALLTHRU*/ used. "
3343 "This is interpreted by "
3344 "LCLint in the same way as most Unix lints, but it is "
3345 "preferable to replace it with the /*@fallthrough@*/ "
3346 "stylized comment"),
3348 return QFALLTHROUGH;
3350 else if (s_keytable[i].token == QLINTNOTREACHED)
3353 (FLG_WARNLINTCOMMENTS,
3355 ("Traditional lint comment /*NOTREACHED*/ used. "
3356 "This is interpreted by "
3357 "LCLint in the same way as most Unix lints, but it is "
3358 "preferable to replace it with the /*@notreached@*/ "
3359 "stylized comment."),
3364 else if (s_keytable[i].token == QPRINTFLIKE)
3366 setSpecialFunction (QU_PRINTFLIKE);
3369 else if (s_keytable[i].token == QLINTPRINTFLIKE)
3372 (FLG_WARNLINTCOMMENTS,
3374 ("Traditional lint comment /*PRINTFLIKE*/ used. "
3375 "This is interpreted by "
3376 "LCLint in the same way as most Unix lints, but it is "
3377 "preferable to replace it with either /*@printflike@*/, "
3378 "/*@scanflike@*/ or /*@messagelike@*/."),
3381 setSpecialFunction (QU_PRINTFLIKE);
3384 else if (s_keytable[i].token == QSCANFLIKE)
3386 setSpecialFunction (QU_SCANFLIKE);
3389 else if (s_keytable[i].token == QMESSAGELIKE)
3391 setSpecialFunction (QU_MESSAGELIKE);
3394 else if (s_keytable[i].token == QARGSUSED)
3397 (FLG_WARNLINTCOMMENTS,
3399 ("Traditional lint comment /*ARGSUSED*/ used. "
3400 "This is interpreted by "
3401 "LCLint in the same way as most Unix lints, but it is "
3402 "preferable to use /*@unused@*/ annotations on "
3403 "the unused parameters."),
3410 return s_keytable[i].token;
3419 static int lminput ()
3421 if (savechar == '\0')
3428 int save = (int) savechar;
3434 static void lmsavechar (char c)
3436 if (savechar == '\0') savechar = c;
3439 llbuglit ("lmsavechar: override");
3443 static int returnFloat (ctype ct, double f)
3445 yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext),
3446 fileloc_decColumn (g_currentloc, tokLength));
3451 static int returnInt (ctype ct, long i)
3455 if (ctype_equal (ct, ctype_int))
3459 c = context_typeofZero ();
3463 c = context_typeofOne ();
3467 yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext),
3468 fileloc_decColumn (g_currentloc, tokLength), i);
3473 static int returnChar (char c)
3475 yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext),
3476 fileloc_decColumn (g_currentloc, tokLength));
3481 static int ninput ()
3485 if (c != EOF && ((char)c == '\n'))
3487 context_incLineno ();
3493 static char macro_nextChar ()
3495 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3500 c = char_fromInt (ic);
3502 if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0]))
3506 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3508 ; /* skip to newline */
3511 context_incLineno ();
3515 return macro_nextChar ();
3522 else /* if (c == '@') */
3524 if (handleLlSpecial () != BADTOK)
3526 llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax");
3529 return macro_nextChar ();
3532 else if (!in_escape && c == '\"')
3534 in_quote = !in_quote;
3536 else if (!in_escape && c == '\'')
3540 else if ((in_quote || in_char) && c == '\\')
3542 in_escape = !in_escape;
3544 else if ((in_quote || in_char) && in_escape)
3548 else if (!in_quote && c == '/')
3552 if ((c2 = char_fromInt (lminput ())) == '*')
3556 while ((c2 = char_fromInt (lminput ())) != '\0'
3557 && c2 != '\n' && c2 != '*')
3564 while ((c2 = char_fromInt (lminput ())) != '\0'
3577 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3581 return macro_nextChar ();
3585 /*** putchar does not work! why? puts to stdio...??! ***/
3593 ** keeps stylized comments
3596 static char macro_nextCharC ()
3598 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3601 c = char_fromInt (lminput ());
3603 if (!in_quote && !in_char && c == '\\')
3605 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3607 ; /* skip to newline */
3610 context_incLineno ();
3614 return macro_nextCharC ();
3621 else if (!in_escape && c == '\"')
3623 in_quote = !in_quote;
3625 else if (!in_escape && c == '\'')
3629 else if ((in_quote || in_char) && c == '\\')
3631 in_escape = !in_escape;
3633 else if ((in_quote || in_char) && in_escape)
3637 else if (!in_quote && c == '/')
3641 if ((c2 = char_fromInt (lminput ())) == '*')
3645 while ((c2 = char_fromInt (lminput ())) != '\0'
3646 && c2 != '\n' && c2 != '*')
3653 while ((c2 = char_fromInt (lminput ())) != '\0'
3666 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3670 return macro_nextCharC ();
3681 ** skips whitespace (handles line continuations)
3682 ** returns first non-whitespace character
3685 static char skip_whitespace ()
3689 while ((c = macro_nextChar ()) == ' ' || c == '\t')
3697 static void handleMacro ()
3699 cstring mac = cstring_undefined;
3703 while (currentColumn () > 2)
3705 mac = cstring_appendChar (mac, ' ');
3709 c = macro_nextCharC ();
3711 if (c >= '0' && c <= '9')
3715 for (i = 0; i < ((c - '0') + 1); i++)
3717 mac = cstring_appendChar (mac, ' ');
3725 while (((c = macro_nextCharC ()) != '\0') && (c != '\n'))
3727 mac = cstring_appendChar (mac, c);
3731 macrocode = tokenMacroCode (mac);
3733 if (macrocode == BADTOK && !isArtificial (mac))
3735 DPRINTF (("Add macro: %s", mac));
3736 context_addMacroCache (mac);
3745 context_incLineno ();
3749 static bool processMacro (void)
3754 cstring fname = cstring_undefined;
3756 bool isspecfcn = FALSE;
3757 bool isiter = FALSE;
3758 bool skipparam = FALSE;
3759 bool isenditer = FALSE;
3760 bool unknownm = FALSE;
3761 bool hasParams = FALSE;
3762 bool emptyMacro = FALSE;
3763 char c = skip_whitespace ();
3764 fileloc loc = fileloc_noColumn (g_currentloc);
3766 /* are both of these necessary? what do they mean? */
3767 uentryList specparams = uentryList_undefined;
3768 uentryList pn = uentryList_undefined;
3770 context_resetMacroMissingParams ();
3772 if (c == '\0' || c == '\n')
3774 llcontbug (cstring_makeLiteral ("Bad macro"));
3779 fname = cstring_appendChar (fname, c);
3781 while ((c = macro_nextChar ()) != '(' && c != '\0'
3782 && c != ' ' && c != '\t' && c != '\n')
3784 fname = cstring_appendChar (fname, c);
3787 if (c == ' ' || c == '\t' || c == '\n')
3793 while (c == ' ' || c == '\t')
3795 c = macro_nextChar ();
3809 hasParams = (c == '(');
3812 if (usymtab_exists (fname))
3814 e2 = usymtab_lookupExpose (fname);
3815 ct = uentry_getType (e2);
3818 if (uentry_isCodeDefined (e2)
3819 && fileloc_isUser (uentry_whereDefined (e2)))
3823 message ("Macro %s already defined", fname),
3826 uentry_showWhereDefined (e2);
3827 uentry_clearDefined (e2);
3830 if (uentry_isFunction (e2))
3832 uentry_setType (e2, ctype_unknown);
3835 context_enterUnknownMacro (e2);
3839 context_enterConstantMacro (e2);
3844 if (uentry_isForward (e2) && uentry_isFunction (e2))
3851 ("Parameterized macro has no prototype or specification: %s ",
3856 uentry_setType (e2, ctype_unknown);
3857 uentry_setFunctionDefined (e2, loc);
3858 uentry_setUsed (e2, fileloc_undefined);
3859 context_enterUnknownMacro (e2);
3863 if (uentry_isIter (e2))
3866 specparams = uentry_getParams (e2);
3867 noparams = uentryList_size (specparams);
3868 uentry_setDefined (e2, loc);
3869 context_enterIterDef (e2);
3871 else if (uentry_isEndIter (e2))
3874 uentry_setDefined (e2, loc);
3875 context_enterIterEnd (e2); /* don't care about it now */
3876 /* but should parse like an iter! */
3878 else if (uentry_isConstant (e2))
3884 message ("Constant %s implemented as parameterized macro",
3888 uentry_showWhereSpecified (e2);
3889 uentry_setType (e2, ctype_unknown);
3890 uentry_makeVarFunction (e2);
3891 uentry_setDefined (e2, g_currentloc);
3892 uentry_setFunctionDefined (e2, g_currentloc);
3893 context_enterUnknownMacro (e2);
3897 if (!uentry_isSpecified (e2))
3899 fileloc oloc = uentry_whereDeclared (e2);
3901 if (fileloc_isLib (oloc))
3905 else if (fileloc_isUndefined (oloc)
3906 || fileloc_isPreproc (oloc))
3911 (FLG_MACROCONSTDECL,
3913 ("Macro constant %q not declared",
3914 uentry_getName (e2)),
3918 else if (!fileloc_withinLines (oloc, loc, 2))
3919 { /* bogus! will give errors if there is too much whitespace */
3923 ("Macro constant name %s does not match name in "
3924 "previous constant declaration. This constant "
3925 "is declared at %q", fname,
3926 fileloc_unparse (oloc)),
3931 context_enterConstantMacro (e2);
3932 cstring_free (fname);
3938 else if (ctype_isFunction (ct))
3941 specparams = ctype_argsFunction (ct);
3942 noparams = uentryList_size (specparams);
3944 uentry_setFunctionDefined (e2, loc);
3945 context_enterMacro (e2);
3947 else if (uentry_isVar (e2))
3953 message ("Variable %s implemented as parameterized macro",
3957 uentry_showWhereSpecified (e2);
3958 uentry_setType (e2, ctype_unknown);
3959 uentry_makeVarFunction (e2);
3960 uentry_setDefined (e2, g_currentloc);
3961 uentry_setFunctionDefined (e2, g_currentloc);
3962 context_enterUnknownMacro (e2);
3966 uentry ucons = uentry_makeConstant (fname,
3969 if (uentry_isExpandedMacro (e2))
3977 message ("Variable %s implemented by a macro",
3981 uentry_showWhereSpecified (e2);
3985 uentry_setDefined (e2, loc);
3986 uentry_setUsed (ucons, loc);
3988 context_enterConstantMacro (ucons);
3989 uentry_markOwned (ucons);
3990 cstring_free (fname);
3996 if (uentry_isDatatype (e2))
4000 message ("Type implemented as macro: %x",
4001 uentry_getName (e2)),
4002 message ("A type is implemented using a macro definition. A "
4003 "typedef should be used instead."),
4007 /* Must exit scope (not sure why a new scope was entered?) */
4008 usymtab_quietExitScope (g_currentloc);
4009 uentry_setDefined (e2, g_currentloc);
4015 (message ("Unexpanded macro not function or constant: %q",
4016 uentry_unparse (e2)));
4017 uentry_setType (e2, ctype_unknown);
4021 uentry_makeVarFunction (e2);
4022 uentry_setDefined (e2, g_currentloc);
4023 uentry_setFunctionDefined (e2, g_currentloc);
4024 context_enterUnknownMacro (e2);
4036 (FLG_MACROMATCHNAME,
4037 message ("Unexpanded macro %s does not match name of a constant "
4038 "or iter declaration. The name used in the control "
4039 "comment on the previous line should match. "
4040 "(Assuming macro defines a constant.)",
4045 ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined);
4046 uentry_setUsed (ce, loc); /* perhaps bogus? */
4047 e2 = usymtab_supEntryReturn (ce);
4049 context_enterConstantMacro (e2);
4050 cstring_free (fname);
4055 /* in macros, ( must follow immediatetly after name */
4061 c = skip_whitespace ();
4063 while (c != ')' && c != '\0')
4066 bool suppress = context_inSuppressRegion ();
4067 cstring paramname = cstring_undefined;
4070 ** save the parameter location
4074 context_saveLocation ();
4077 while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')')
4079 paramname = cstring_appendChar (paramname, c);
4080 c = macro_nextChar ();
4083 if (c == ' ' || c == '\t') c = skip_whitespace ();
4087 c = macro_nextChar ();
4088 if (c == ' ' || c == '\t') c = skip_whitespace ();
4093 llfatalerror (cstring_makeLiteral
4094 ("Bad macro syntax: uentryList"));
4097 if ((isspecfcn || isiter) && (paramno < noparams)
4098 && !uentry_isElipsisMarker (uentryList_getN
4099 (specparams, paramno)))
4101 uentry decl = uentryList_getN (specparams, paramno);
4104 param = uentry_nameCopy (paramname, decl);
4107 uentry_setParam (param);
4108 sr = sRef_makeParam (paramno, uentry_getType (param));
4110 if (sRef_getNullState (sr) == NS_ABSNULL)
4112 ctype pt = ctype_realType (uentry_getType (param));
4114 if (ctype_isUser (pt))
4116 uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt));
4118 if (uentry_isValid (te))
4120 sRef_setStateFromUentry (sr, te);
4125 sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
4129 uentry_setSref (param, sr);
4130 uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
4132 skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
4136 fileloc sloc = context_getSaveLocation ();
4138 param = uentry_makeVariableSrefParam
4139 (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
4140 cstring_free (paramname);
4142 sRef_setPosNull (uentry_getSref (param), sloc);
4144 uentry_setDeclaredForce (param, sloc);
4147 fileloc_free (sloc);
4152 llassert (!uentry_isElipsisMarker (param));
4156 sRef_makeUnsafe (uentry_getSref (param));
4159 pn = uentryList_add (pn, uentry_copy (param));
4160 usymtab_supEntry (param);
4164 /* don't add param */
4165 uentry_free (param);
4170 (void) macro_nextChar ();
4171 c = skip_whitespace ();
4179 if (isspecfcn || isiter)
4181 if (paramno != noparams && noparams >= 0)
4187 message ("Macro %s specified with %d args, defined with %d",
4188 fname, noparams, paramno),
4191 uentry_showWhereSpecified (e2);
4192 uentry_resetParams (e2, pn);
4197 uentry_resetParams (e2, pn);
4204 ** the form should be:
4206 ** # define newname oldname
4207 ** where oldname refers to a function matching the specification
4213 sRef_setGlobalScope ();
4214 usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown));
4215 sRef_clearGlobalScope ();
4219 context_setMacroMissingParams ();
4224 /* context_setuentryList (pn); */
4225 usymtab_enterScope ();
4228 cstring_free (fname);
4233 static bool handleSpecial (char *yyt)
4235 char *l = mstring_create (MAX_NAME_LENGTH);
4236 static bool reportcpp = FALSE;
4242 strcpy (l, yyt + 1);
4244 /* Need to safe original l for deallocating. */
4247 l += strlen (yyt) - 1;
4249 while ((c = char_fromInt (lminput ())) != '\n' && c != '\0')
4255 olc = cstring_fromChars (ol);
4257 if (cstring_equalPrefix (olc, "pragma"))
4259 char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN));
4260 char *opname = pname;
4261 char *ptr = ol + 6; /* pragma is six characters, plus space */
4265 /* skip whitespace */
4266 while (((c = *ptr) != '\0') && isspace (c))
4272 while (((c = *ptr) != '\0') && !isspace (c))
4276 if (len > MAX_PRAGMA_LEN)
4287 if (len == PRAGMA_LEN_EXPAND
4288 && mstring_equal (opname, PRAGMA_EXPAND))
4290 cstring exname = cstring_undefined;
4294 while (((c = *ptr) != '\0') && !isspace (c))
4296 exname = cstring_appendChar (exname, c);
4301 ue = usymtab_lookupExposeGlob (exname);
4303 if (uentry_isExpandedMacro (ue))
4305 if (fileloc_isPreproc (uentry_whereDefined (ue)))
4307 fileloc_setColumn (g_currentloc, 1);
4308 uentry_setDefined (ue, g_currentloc);
4312 cstring_free (exname);
4315 else if (cstring_equalPrefix (olc, "ident"))
4317 /* Some pre-processors will leave these in the code. Ignore rest of line */
4320 ** Yuk...Win32 filenames can have spaces in them...we need to read
4321 ** to the matching end quote.
4323 else if ((sscanf (ol, "line %d \"", &lineno) == 1)
4324 || (sscanf (ol, " %d \"", &lineno) == 1))
4330 while (*tmp != '\"' && *tmp != '\0')
4335 llassert (*tmp == '\"');
4340 while (*tmp != '\"' && *tmp != '\0')
4345 llassert (*tmp == '\"');
4349 DPRINTF (("fname: %s", fname));
4351 # if defined(OS2) || defined(MSDOS) || defined(WIN32)
4354 ** DOS-like path delimiters get delivered in pairs, something like
4355 ** \"..\\\\file.h\", so we have to make it normal again. We do NOT
4356 ** remove the pre dirs yet as we usually specify tmp paths relative
4357 ** to the current directory, so tmp files would not get found in
4358 ** the hash table. If this method fails we try it again later.
4365 ** Skip past the drive marker.
4368 DPRINTF (("stmp: %s / %s", stmp, fname));
4370 if (strchr (stmp, ':') != NULL)
4372 stmp = strchr (stmp, ':') + 1;
4375 DPRINTF (("stmp: %s / %s", stmp, fname));
4377 while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL )
4379 if (*(stmp+1) == CONNECTCHAR)
4381 memmove (stmp, stmp+1, strlen (stmp));
4385 DPRINTF (("stmp: %s / %s", stmp, fname));
4388 DPRINTF (("Now: base = %s", fname));
4390 fid = fileTable_lookupBase (context_fileTable (),
4391 cstring_fromChars (fname));
4392 if (!(fileId_isValid (fid)))
4394 fname = removePreDirs (fname);
4395 fid = fileTable_lookupBase (context_fileTable (),
4396 cstring_fromChars (fname));
4399 # else /* !defined(OS2) && !defined(MSDOS) */
4400 fname = removePreDirs (fname);
4401 fid = fileTable_lookupBase (context_fileTable (),
4402 cstring_fromChars (fname));
4403 # endif /* !defined(OS2) && !defined(MSDOS) */
4405 if (!(fileId_isValid (fid)))
4407 if (isHeaderFile (cstring_fromChars (fname)))
4409 fid = fileTable_addHeaderFile (context_fileTable (),
4410 cstring_fromChars (fname));
4414 fid = fileTable_addFile (context_fileTable (),
4415 cstring_fromChars (fname));
4419 setFileLine (fid, lineno);
4421 else if ((sscanf (ol, "line %d", &lineno) == 1)
4422 || (sscanf (ol, " %d", &lineno) == 1))
4424 setLine (lineno); /* next line is <cr> */
4428 if (mstring_equal (ol, "")) {
4429 DPRINTF (("Empty pp command!"));
4431 ** evs 2000-05-16: This is a horrible kludge, to get around a bug (well, difficulty) in the pre-processor.
4432 ** We handle a plain # in the input file, by echoing it, and ignoring it in the post-pp-file.
4441 llbug (message ("File contains preprocessor command: #%s",
4442 cstring_fromChars (ol)));
4455 static int handleLlSpecial ()
4459 char *s = mstring_createEmpty ();
4464 while (((ic = ninput ()) != 0) && isalpha (ic))
4467 s = mstring_append (s, c);
4473 if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0])
4477 llassert (ic == AFTER_COMMENT_MARKER[1]);
4480 if (isProcessingGlobMods () && (*s == '\0'))
4483 return QNOMODS; /* special token no modifications token */
4491 tok = commentMarkerToken (cstring_fromChars (os));
4495 tokLength = charsread;
4501 /* Add rest of the comment */
4503 if (ic != 0 && ic != EOF)
4508 s = mstring_append (s, c);
4511 while (((ic = ninput ()) != 0) && (ic != EOF)
4512 && (ic != AFTER_COMMENT_MARKER[0]))
4515 s = mstring_append (s, c);
4520 if (ic == AFTER_COMMENT_MARKER[0])
4523 llassert ((char) nc == AFTER_COMMENT_MARKER[1]);
4530 while (*s == ' ' || *s == '\t' || *s == '\n')
4535 if (*s == '-' || *s == '+' || *s == '=') /* setting flags */
4539 while (c == '-' || c == '+' || c == '=')
4541 ynm set = ynm_fromCodeChar (c);
4546 thisflag = cstring_fromChars (s);
4548 while ((c = *s) != '\0' && (c != '-') && (c != '=')
4549 && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n'))
4556 if (!context_getFlag (FLG_NOCOMMENTS))
4558 cstring flagname = thisflag;
4559 flagcode fflag = identifyFlag (flagname);
4561 if (flagcode_isSkip (fflag))
4565 else if (flagcode_isInvalid (fflag))
4567 if (isMode (flagname))
4569 if (ynm_isMaybe (set))
4574 ("Stylized comment attempts to restore flag %s. "
4575 "A mode flag cannot be restored.",
4580 context_setMode (flagname);
4587 message ("Unrecognized option in stylized comment: %s",
4591 else if (flagcode_isGlobalFlag (fflag))
4596 ("Stylized comment attempts to set global flag %s. "
4597 "A global flag cannot be set locally.",
4602 context_fileSetFlag (fflag, set);
4604 if (flagcode_hasArgument (fflag))
4606 if (ynm_isMaybe (set))
4611 ("Stylized comment attempts to restore flag %s. "
4612 "A flag for setting a value cannot be restored.",
4616 { /* cut-and-pastied from llmain...blecch */
4617 cstring extra = cstring_undefined;
4623 rest = mstring_copy (s);
4627 while ((rchar = *rest) != '\0'
4628 && (isspace (rchar)))
4634 while ((rchar = *rest) != '\0'
4635 && !isspace (rchar))
4637 extra = cstring_appendChar (extra, rchar);
4644 if (cstring_isUndefined (extra))
4649 ("Flag %s (in stylized comment) must be followed by an argument",
4650 flagcode_unparse (fflag)));
4656 if (flagcode_hasValue (fflag))
4658 setValueFlag (fflag, extra);
4660 else if (flagcode_hasString (fflag))
4662 setStringFlag (fflag, extra);
4679 while ((c == ' ') || (c == '\t') || (c == '\n'))
4685 if (context_inHeader () && !isArtificial (cstring_fromChars (os)))
4687 context_addComment (cstring_fromCharsNew (os));
4700 while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n')
4712 t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t)));
4713 macrocode = tokenMacroCode (cstring_fromChars (t));
4715 if (macrocode != BADTOK)
4717 tokLength = mstring_length (t);
4723 if (macrocode == SKIPTOK)
4731 if (context_inHeader ())
4738 if ((context_inMacro () || context_inGlobalContext ())
4739 && macrocode != SKIPTOK
4740 && !isArtificial (cstring_fromChars (os)))
4742 context_addComment (cstring_fromCharsNew (os));
4755 if (mstring_equal (t, "ignore"))
4757 if (!context_getFlag (FLG_NOCOMMENTS))
4759 context_enterSuppressRegion ();
4762 else if ((*t == 'i' || *t == 't')
4763 && (*(t + 1) == '\0'))
4765 if (!context_getFlag (FLG_NOCOMMENTS)
4766 && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS)))
4768 context_enterSuppressLine (-1); /* infinite suppression */
4771 else if (((*t == 'i') || (*t == 't'))
4772 && ((*(t + 1) >= '0' && *(t + 1) <= '9')))
4774 bool tmpcomment = (*t == 't');
4776 char *tt = t; /* don't mangle t, since it is free'd */
4779 if (lc >= '0' && lc <= '9')
4781 val = (int)(lc - '0');
4784 while (lc >= '0' && lc <= '9')
4793 if (!context_getFlag (FLG_NOCOMMENTS)
4794 && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS)))
4796 context_enterSuppressLine (val);
4799 else if (mstring_equal (t, "end"))
4801 if (!context_getFlag (FLG_NOCOMMENTS))
4803 context_exitSuppressRegion ();
4806 else if (mstring_equal (t, "notfunction"))
4808 ; /* handled by pcpp */
4810 else if (mstring_equal (t, "access"))
4816 while ((c = *s) && (c == ' ' || c == '\t' || c == '\n'))
4826 tname = cstring_fromChars (s);
4828 while ((c = *s) != '\0' && c != ' '
4829 && c != '\t' && c != '\n' && c != ',')
4837 if (!context_getFlag (FLG_NOCOMMENTS)
4838 && !context_getFlag (FLG_NOACCESS))
4840 if (usymtab_existsType (tname))
4842 usymId uid = usymtab_getTypeId (tname);
4843 context_addFileAccessType (uid);
4847 if (!(context_inSuppressRegion ()
4848 || context_inSuppressZone (g_currentloc)))
4852 ("%q: Unrecognized type %s used in access comment",
4853 fileloc_unparse (g_currentloc), tname));
4863 if (c != ',' && c != ' ')
4869 else if (mstring_equal (t, "noaccess"))
4876 while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n'))
4886 tname = cstring_fromChars (s);
4888 while ((lc = *s) != '\0' && lc != ' ' && lc != '\t'
4889 && lc != '\n' && lc != ',')
4896 if (!context_getFlag (FLG_NOCOMMENTS)
4897 && !context_getFlag (FLG_NOACCESS))
4899 if (usymtab_existsType (tname))
4901 typeId tuid = usymtab_getTypeId (tname);
4903 if (context_couldHaveAccess (tuid))
4905 context_removeFileAccessType (tuid);
4909 if (!(context_inSuppressRegion ()
4910 || context_inSuppressZone (g_currentloc)))
4912 uentry ue = usymtab_getTypeEntry (tuid);
4914 if (uentry_isAbstractDatatype (ue))
4918 ("%q: Non-accessible abstract type %s used in noaccess comment",
4919 fileloc_unparse (g_currentloc), tname));
4925 ("%q: Non-abstract type %s used in noaccess comment",
4926 fileloc_unparse (g_currentloc), tname));
4933 if (!(context_inSuppressRegion ()
4934 || context_inSuppressZone (g_currentloc)))
4938 ("%q: Unrecognized type %s used in noaccess comment",
4939 fileloc_unparse (g_currentloc), tname));
4949 if (lc != ',' && lc != ' ')
4957 setTokLength (- (2 + charsread));
4959 voptgenerror (FLG_UNRECOGCOMMENTS,
4960 message ("Stylized comment unrecognized: %s",
4961 cstring_fromChars (os)),
4972 static /*@only@*/ cstring makeIdentifier (char *s)
4974 char *c = mstring_create (size_toInt (strlen (s)) + 1);
4975 cstring id = cstring_fromChars (c);
4977 while (isalnum (*s) || (*s == '_') || (*s == '$'))
4986 /*@observer@*/ /*@dependent@*/ uentry coerceId (cstring cn)
4988 if (!(usymtab_exists (cn)))
4990 fileloc loc = fileloc_createExternal ();
4993 ** We need to put this in a global scope, otherwise the sRef will be deallocated.
4996 uentry ce = uentry_makeUnrecognized (cn, loc);
4998 if (!context_inIterEnd ())
5002 message ("Unrecognized (possibly system) identifier: %q",
5003 uentry_getName (ce)),
5010 return (usymtab_lookup (cn));
5014 ** like, coerceId, but doesn't supercede for iters
5017 /*@observer@*/ uentry coerceIterId (cstring cn)
5019 if (!(usymtab_exists (cn)))
5021 return uentry_undefined;
5024 return (usymtab_lookup (cn));
5027 /*@observer@*/ cstring LastIdentifier ()
5029 return (lastidprocessed);
5032 static int processIdentifier (cstring id)
5036 DPRINTF (("Process identifier: %s", id));
5038 context_clearJustPopped ();
5039 lastidprocessed = id;
5041 if (context_inFunctionDecl ())
5043 int tok = commentMarkerToken (id);
5051 tok = tokenMacroCode (id);
5060 /* Consider handling: Defined by C99 as static const char __func__[] */
5062 if (context_getFlag (FLG_GNUEXTENSIONS))
5066 if (cstring_equalLit (id, "__stdcall")
5067 || cstring_equalLit (id, "__cdecl")
5068 || cstring_equalLit (id, "__extension__"))
5072 else if (cstring_equalLit (id, "__volatile__"))
5076 else if (cstring_equalLit (id, "__signed"))
5080 else if (cstring_equalLit (id, "__unsigned"))
5084 else if (cstring_equalLit (id, "__const__"))
5088 else if (cstring_equalLit (id, "__alignof__"))
5090 tok = CALIGNOF; /* alignof is parsed like sizeof */
5092 else if (cstring_equalLit (id, "__FUNCTION__")
5093 || cstring_equalLit (id, "__PRETTY_FUNCTION__"))
5095 /* These tokens hold the name of the current function as strings */
5096 yylval.expr = exprNode_stringLiteral (id, fileloc_copy (g_currentloc));
5098 lastWasString = TRUE;
5102 else if (cstring_equalLit (id, "__attribute__")
5103 || cstring_equalLit (id, "__asm__")
5104 || cstring_equalLit (id, "_asm")
5105 || cstring_equalLit (id, "__asm")
5106 || cstring_equalLit (id, "__declspec"))
5109 bool useparens = FALSE;
5110 bool usebraces = FALSE;
5111 bool inquote = FALSE;
5112 bool inescape = FALSE;
5115 while ((ic = input ()) != EOF)
5122 else if (ic == '\\')
5126 else if (ic == '\"')
5162 else if (ic == ')' && useparens)
5165 if (depth == 0) break;
5167 else if (ic == '}' && usebraces)
5170 if (depth == 0) break;
5173 && !usebraces && !useparens
5174 && cstring_equalLit (id, "__asm"))
5177 ** We need this because some MS VC++ include files
5178 ** have __asm mov ... }
5179 ** Its a kludge, but otherwise would need to parse
5188 context_incLineno ();
5190 if (cstring_equalLit (id, "__asm")
5191 && !useparens && !usebraces)
5198 llassert ((useparens && ic == ')')
5199 || (usebraces && ic == '}')
5200 || (!useparens && !usebraces));
5204 else if (cstring_equalLit (id, "inline")
5205 || cstring_equalLit (id, "__inline")
5206 || cstring_equalLit (id, "_inline")
5207 || cstring_equalLit (id, "__inline__"))
5218 le = usymtab_lookupSafe (id);
5220 /*@-dependenttrans@*/
5222 if (uentry_isIter (le))
5227 else if (uentry_isEndIter (le))
5230 return (ITER_ENDNAME);
5232 else if (uentry_isUndefined (le))
5236 /* avoid parse errors for certain system built ins */
5238 if (g_expectingTypeName && (cstring_firstChar (id) == '_')
5239 && (cstring_secondChar (id) == '_'))
5241 return (TYPE_NAME_OR_ID);
5244 return (NEW_IDENTIFIER);
5246 else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le))
5248 if (uentry_isDatatype (le))
5251 return (NEW_IDENTIFIER);
5256 return (IDENTIFIER);
5259 else if (uentry_isDatatype (le))
5261 if (!g_expectingTypeName)
5265 return (NEW_IDENTIFIER);
5269 yylval.ctyp = uentry_getAbstractType (le);
5271 uentry_setUsed (le, g_currentloc);
5278 return (IDENTIFIER);
5281 /*@=dependenttrans@*/
5284 static bool processHashIdentifier (/*@only@*/ cstring id)
5286 if (context_inMacro () || context_inIterDef () ||
5287 context_inIterEnd ())
5291 context_clearJustPopped ();
5293 lastidprocessed = id;
5294 le = usymtab_lookupSafe (id);
5296 if (uentry_isParam (le) || uentry_isRefParam (le))
5313 static /*@only@*/ exprNode processString ()
5317 char *nl = strchr (yytext, '\n');
5318 cstring ns = cstring_fromCharsNew (yytext);
5322 loc = fileloc_copy (g_currentloc);
5323 addColumn (cstring_length (ns));
5329 loc = fileloc_copy (g_currentloc);
5331 context_incLineno ();
5333 while ((nl = strchr ((nl + 1), '\n')) != NULL)
5335 context_incLineno ();
5341 res = exprNode_stringLiteral (ns, loc);
5351 llassert (*yytext != '\0');
5352 fchar = *(yytext + 1);
5353 if (fchar != '\\') return fchar;
5355 next = *(yytext + 2);
5359 case 'n': return '\n';
5360 case 't': return '\t';
5361 case '\"': return '\"';
5362 case '\'': return '\'';
5363 case '\\': return '\\';
5364 default: return '\0';
5369 double processFloat ()
5371 double ret = atof (yytext);
5382 llassert (yytext[0] == '0'
5383 && (yytext[1] == 'X' || yytext[1] == 'x'));
5385 while (yytext[index] != '\0') {
5387 char c = yytext[index];
5389 if (c >= '0' && c <= '9') {
5390 tval = (int) c - (int) '0';
5391 } else if (c >= 'A' && c <= 'F') {
5392 tval = (int) c - (int) 'A' + 10;
5393 } else if (c >= 'a' && c <= 'f') {
5394 tval = (int) c - (int) 'a' + 10;
5395 } else if (c == 'U' || c == 'L' || c == 'u' || c == 'l') {
5397 while (yytext[index] != '\0') {
5398 if (c == 'U' || c == 'L' || c == 'u' || c == 'l') {
5403 message ("Invalid character (%c) following specifier in hex constant: %s",
5404 c, cstring_fromChars (yytext)),
5414 message ("Invalid character (%c) in hex constant: %s",
5415 c, cstring_fromChars (yytext)),
5420 val = (val * 16) + tval;
5424 DPRINTF (("Hex constant: %s = %ld", yytext, val));
5429 long processOctal ()
5434 llassert (yytext[0] == '0' && yytext[1] != 'X' && yytext[1] != 'x');
5436 while (yytext[index] != '\0') {
5438 char c = yytext[index];
5440 if (c >= '0' && c <= '7') {
5441 tval = (int) c - (int) '0';
5445 message ("Invalid character (%c) in octal constant: %s",
5446 c, cstring_fromChars (yytext)),
5451 val = (val * 8) + tval;
5455 DPRINTF (("Octal constant: %s = %ld", yytext, val));
5462 return (atol (yytext));
5466 processSpec (int tok)
5468 size_t length = strlen (yytext);
5473 setTokLengthT (length);
5479 context_saveLocation ();
5480 setTokLengthT (length);
5481 return (processIdentifier (makeIdentifier (yytext)));