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 168
369 #define YY_END_OF_BUFFER 169
370 static yyconst short int yy_accept[500] =
372 0, 0, 169, 167, 147, 148, 135, 167, 3, 79,
373 141, 134, 167, 129, 130, 139, 138, 126, 137, 133,
374 140, 88, 88, 127, 123, 142, 128, 143, 146, 167,
375 131, 166, 132, 144, 79, 79, 79, 79, 79, 79,
376 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
377 79, 79, 79, 79, 79, 124, 145, 125, 136, 122,
378 0, 42, 0, 2, 79, 108, 164, 165, 117, 109,
379 0, 0, 106, 114, 104, 115, 105, 116, 0, 98,
380 1, 107, 101, 84, 0, 90, 89, 0, 88, 113,
381 119, 121, 120, 112, 0, 0, 0, 110, 79, 79,
383 79, 79, 79, 79, 79, 79, 9, 79, 79, 79,
384 79, 79, 79, 79, 13, 44, 79, 79, 79, 79,
385 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
386 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
387 79, 79, 79, 79, 111, 118, 0, 0, 2, 92,
388 4, 0, 96, 97, 98, 0, 99, 100, 86, 85,
389 0, 95, 91, 91, 80, 103, 102, 154, 155, 152,
390 157, 162, 153, 163, 158, 161, 156, 159, 160, 0,
391 0, 79, 79, 79, 79, 79, 79, 79, 79, 79,
392 79, 79, 79, 79, 79, 79, 79, 79, 11, 79,
394 79, 27, 79, 79, 79, 79, 79, 79, 79, 79,
395 79, 79, 43, 79, 79, 79, 79, 79, 79, 74,
396 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
397 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
398 79, 0, 42, 0, 0, 98, 0, 96, 97, 0,
399 101, 87, 87, 93, 94, 81, 82, 151, 0, 0,
400 79, 79, 39, 79, 6, 29, 79, 79, 79, 79,
401 79, 79, 10, 25, 79, 79, 79, 79, 12, 79,
402 79, 79, 51, 79, 31, 79, 79, 52, 79, 79,
403 68, 79, 79, 79, 79, 79, 79, 79, 79, 79,
405 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
406 79, 79, 79, 79, 79, 79, 26, 79, 79, 79,
407 0, 98, 83, 83, 0, 150, 79, 79, 5, 79,
408 36, 79, 79, 79, 79, 79, 79, 79, 30, 79,
409 79, 79, 79, 79, 79, 79, 79, 79, 69, 79,
410 79, 79, 79, 79, 79, 79, 32, 79, 79, 79,
411 79, 79, 79, 79, 79, 79, 79, 77, 24, 79,
412 79, 79, 79, 79, 18, 76, 149, 79, 79, 79,
413 79, 79, 79, 79, 28, 79, 38, 79, 21, 79,
414 54, 78, 79, 60, 79, 79, 79, 79, 79, 79,
416 58, 79, 14, 75, 34, 15, 79, 41, 22, 17,
417 79, 79, 79, 79, 79, 72, 19, 20, 79, 37,
418 47, 64, 79, 79, 8, 79, 59, 79, 79, 79,
419 62, 53, 79, 79, 45, 79, 79, 57, 79, 46,
420 61, 79, 23, 79, 79, 79, 79, 65, 7, 79,
421 73, 79, 79, 70, 16, 79, 40, 79, 55, 79,
422 33, 35, 79, 71, 56, 79, 79, 79, 67, 79,
423 79, 79, 63, 79, 79, 79, 79, 79, 79, 79,
424 48, 79, 79, 66, 79, 79, 79, 79, 79, 79,
425 79, 79, 79, 79, 50, 79, 79, 49, 0
429 static yyconst int yy_ec[256] =
431 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
432 4, 4, 1, 1, 1, 1, 1, 1, 1, 1,
433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 1, 2, 5, 6, 7, 8, 9, 10, 11, 12,
435 13, 14, 15, 16, 17, 18, 19, 20, 21, 21,
436 21, 21, 21, 21, 21, 21, 21, 22, 23, 24,
437 25, 26, 27, 28, 29, 30, 31, 30, 32, 33,
438 34, 8, 8, 8, 35, 36, 37, 8, 8, 8,
439 38, 39, 40, 41, 42, 8, 43, 44, 8, 45,
440 46, 47, 48, 49, 50, 1, 51, 52, 53, 54,
442 55, 56, 57, 58, 59, 8, 60, 61, 62, 63,
443 64, 65, 8, 66, 67, 68, 69, 70, 71, 72,
444 73, 74, 75, 76, 77, 78, 1, 1, 1, 1,
445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447 1, 1, 1, 1, 1, 1, 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,
453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455 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,
461 static yyconst int yy_meta[79] =
463 1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
464 3, 1, 1, 1, 1, 1, 1, 1, 1, 4,
465 4, 1, 1, 1, 1, 1, 1, 1, 5, 5,
466 5, 5, 5, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 1, 1, 1, 1, 2,
468 5, 5, 5, 5, 5, 5, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 1, 1, 1, 1
473 static yyconst short int yy_base[507] =
475 0, 0, 641, 642, 642, 642, 615, 73, 0, 0,
476 55, 71, 592, 642, 642, 613, 67, 642, 68, 66,
477 74, 80, 85, 642, 642, 65, 612, 82, 642, 91,
478 642, 642, 642, 611, 585, 28, 568, 67, 40, 65,
479 72, 569, 88, 55, 568, 79, 101, 580, 575, 103,
480 90, 566, 51, 570, 568, 642, 113, 642, 642, 642,
481 133, 163, 623, 0, 0, 642, 642, 642, 642, 642,
482 100, 139, 642, 642, 642, 642, 642, 642, 607, 155,
483 642, 642, 162, 172, 164, 117, 141, 0, 204, 599,
484 642, 642, 642, 598, 245, 585, 585, 642, 567, 546,
486 550, 562, 549, 145, 552, 141, 545, 546, 543, 144,
487 550, 546, 543, 540, 0, 99, 544, 551, 544, 541,
488 532, 534, 540, 533, 543, 537, 529, 533, 529, 174,
489 538, 156, 158, 538, 162, 533, 529, 521, 524, 184,
490 538, 140, 528, 531, 642, 642, 242, 172, 0, 642,
491 642, 235, 642, 642, 251, 243, 642, 642, 192, 193,
492 246, 272, 642, 642, 233, 642, 642, 642, 544, 642,
493 642, 642, 642, 642, 642, 642, 642, 642, 642, 545,
494 546, 518, 513, 516, 528, 523, 511, 523, 228, 524,
495 519, 521, 517, 509, 506, 514, 501, 516, 0, 502,
497 506, 509, 494, 497, 500, 503, 493, 495, 496, 501,
498 488, 481, 0, 498, 484, 498, 491, 214, 480, 0,
499 482, 481, 483, 490, 491, 475, 473, 473, 475, 484,
500 483, 479, 481, 471, 475, 466, 246, 478, 480, 469,
501 468, 215, 307, 525, 278, 283, 300, 642, 642, 302,
502 304, 642, 642, 642, 642, 249, 265, 642, 499, 487,
503 462, 451, 0, 463, 0, 0, 462, 453, 461, 450,
504 455, 456, 0, 0, 449, 449, 459, 445, 0, 449,
505 454, 449, 0, 272, 0, 454, 439, 0, 441, 451,
506 0, 451, 445, 439, 435, 446, 431, 433, 443, 429,
508 441, 431, 435, 434, 439, 438, 424, 426, 434, 432,
509 430, 422, 427, 428, 416, 428, 0, 412, 424, 424,
510 309, 314, 642, 642, 449, 642, 409, 410, 0, 281,
511 0, 411, 412, 418, 416, 415, 406, 405, 0, 412,
512 400, 404, 410, 408, 406, 400, 390, 391, 0, 407,
513 388, 388, 399, 393, 390, 398, 0, 397, 394, 398,
514 395, 379, 388, 390, 375, 388, 389, 0, 0, 378,
515 386, 382, 377, 378, 0, 0, 642, 368, 380, 380,
516 369, 363, 363, 375, 0, 375, 377, 358, 0, 375,
517 0, 0, 369, 0, 363, 368, 358, 360, 357, 364,
519 0, 357, 0, 0, 358, 0, 355, 0, 0, 0,
520 359, 353, 357, 352, 356, 0, 0, 0, 349, 0,
521 0, 342, 354, 352, 0, 343, 0, 344, 334, 330,
522 0, 0, 320, 327, 0, 314, 308, 0, 310, 0,
523 0, 311, 0, 316, 315, 313, 299, 0, 0, 298,
524 0, 303, 295, 0, 0, 307, 0, 293, 0, 305,
525 299, 0, 291, 0, 0, 283, 301, 299, 0, 290,
526 293, 286, 0, 292, 280, 293, 290, 276, 286, 264,
527 0, 280, 257, 0, 250, 204, 189, 198, 174, 178,
528 161, 137, 148, 100, 0, 48, 28, 0, 642, 375,
530 379, 383, 388, 392, 394, 399
533 static yyconst short int yy_def[507] =
535 499, 1, 499, 499, 499, 499, 499, 500, 501, 502,
536 499, 499, 503, 499, 499, 499, 499, 499, 499, 499,
537 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
538 499, 499, 499, 499, 502, 502, 502, 502, 502, 502,
539 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
540 502, 502, 502, 502, 502, 499, 499, 499, 499, 499,
541 500, 499, 500, 504, 502, 499, 499, 499, 499, 499,
542 503, 503, 499, 499, 499, 499, 499, 499, 499, 499,
543 499, 499, 499, 499, 499, 499, 499, 505, 499, 499,
544 499, 499, 499, 499, 499, 499, 499, 499, 502, 502,
546 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
547 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
548 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
549 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
550 502, 502, 502, 502, 499, 499, 499, 506, 504, 499,
551 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
552 499, 499, 499, 499, 505, 499, 499, 499, 499, 499,
553 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
554 499, 502, 502, 502, 502, 502, 502, 502, 502, 502,
555 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
557 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
558 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
559 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
560 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
561 502, 506, 499, 506, 499, 499, 499, 499, 499, 499,
562 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
563 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
564 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
565 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
566 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
568 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
569 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
570 499, 499, 499, 499, 499, 499, 502, 502, 502, 502,
571 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
572 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
573 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
574 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
575 502, 502, 502, 502, 502, 502, 499, 502, 502, 502,
576 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
577 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
579 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
580 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
581 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
582 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
583 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
584 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
585 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
586 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
587 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
588 502, 502, 502, 502, 502, 502, 502, 502, 0, 499,
590 499, 499, 499, 499, 499, 499
593 static yyconst short int yy_nxt[721] =
595 4, 5, 6, 5, 7, 8, 9, 10, 11, 12,
596 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
597 23, 24, 25, 26, 27, 28, 29, 30, 10, 10,
598 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
599 10, 10, 10, 10, 10, 31, 32, 33, 34, 35,
600 36, 37, 38, 39, 40, 41, 42, 10, 43, 44,
601 45, 10, 46, 47, 48, 49, 50, 51, 52, 53,
602 54, 10, 55, 10, 56, 57, 58, 59, 62, 66,
603 69, 74, 498, 79, 76, 80, 80, 81, 90, 91,
604 100, 75, 77, 78, 106, 70, 101, 83, 82, 84,
606 84, 141, 83, 107, 89, 89, 93, 94, 95, 118,
607 150, 85, 497, 119, 142, 86, 85, 103, 96, 63,
608 86, 87, 111, 88, 104, 108, 87, 109, 97, 67,
609 105, 68, 112, 121, 85, 113, 110, 145, 62, 85,
610 86, 499, 122, 115, 137, 86, 72, 123, 87, 71,
611 116, 88, 124, 87, 117, 138, 125, 131, 163, 201,
612 132, 133, 139, 126, 147, 147, 202, 134, 148, 127,
613 135, 128, 496, 136, 80, 80, 164, 243, 161, 63,
614 161, 155, 155, 162, 162, 163, 152, 153, 146, 83,
615 154, 84, 84, 156, 157, 187, 190, 158, 238, 188,
617 239, 164, 495, 85, 494, 191, 221, 159, 195, 152,
618 153, 196, 226, 160, 223, 154, 156, 157, 244, 222,
619 243, 83, 158, 89, 89, 493, 85, 227, 253, 216,
620 217, 224, 159, 252, 218, 85, 232, 233, 492, 86,
621 160, 219, 234, 147, 147, 87, 491, 148, 490, 245,
622 235, 245, 236, 253, 246, 246, 489, 250, 85, 250,
623 252, 244, 251, 251, 86, 162, 162, 296, 256, 488,
624 155, 155, 87, 168, 257, 169, 297, 170, 171, 172,
625 173, 174, 247, 248, 175, 176, 249, 177, 178, 179,
626 323, 162, 162, 256, 268, 269, 315, 246, 246, 316,
628 324, 257, 246, 246, 254, 247, 248, 255, 147, 147,
629 487, 249, 148, 486, 321, 153, 321, 323, 154, 322,
630 322, 251, 251, 251, 251, 324, 343, 254, 322, 322,
631 485, 484, 255, 322, 322, 380, 157, 344, 153, 158,
632 483, 482, 381, 154, 481, 480, 248, 479, 478, 249,
633 477, 476, 475, 474, 473, 472, 471, 470, 469, 157,
634 468, 467, 466, 465, 158, 464, 463, 462, 461, 248,
635 460, 459, 458, 457, 249, 61, 61, 61, 61, 61,
636 64, 456, 455, 64, 65, 454, 65, 65, 71, 71,
637 453, 71, 71, 149, 452, 149, 149, 165, 165, 242,
639 242, 242, 242, 242, 451, 450, 449, 448, 447, 446,
640 445, 444, 443, 442, 441, 440, 439, 438, 437, 436,
641 435, 434, 433, 432, 431, 430, 429, 428, 427, 426,
642 425, 424, 423, 422, 421, 420, 419, 418, 417, 416,
643 415, 414, 413, 412, 411, 410, 409, 408, 407, 406,
644 405, 404, 403, 402, 401, 400, 399, 398, 397, 396,
645 395, 394, 393, 392, 391, 390, 389, 388, 387, 386,
646 385, 384, 383, 382, 379, 378, 377, 376, 375, 374,
647 373, 372, 371, 370, 369, 368, 367, 366, 365, 364,
648 363, 362, 361, 360, 359, 358, 357, 356, 355, 354,
650 353, 352, 351, 350, 349, 348, 347, 346, 345, 342,
651 341, 340, 339, 338, 337, 336, 335, 334, 333, 332,
652 331, 330, 329, 328, 327, 326, 325, 499, 320, 319,
653 318, 317, 314, 313, 312, 311, 310, 309, 308, 307,
654 306, 305, 304, 303, 302, 301, 300, 299, 298, 295,
655 294, 293, 292, 291, 290, 289, 288, 287, 286, 285,
656 284, 283, 282, 281, 280, 279, 278, 277, 276, 275,
657 274, 273, 272, 271, 270, 267, 266, 265, 264, 263,
658 262, 261, 260, 259, 258, 241, 240, 237, 231, 230,
659 229, 228, 225, 220, 215, 214, 213, 212, 211, 210,
661 209, 208, 207, 206, 205, 204, 203, 200, 199, 198,
662 197, 194, 193, 192, 189, 186, 185, 184, 183, 182,
663 181, 180, 167, 166, 151, 499, 144, 143, 140, 130,
664 129, 120, 114, 102, 99, 98, 92, 73, 72, 60,
665 499, 3, 499, 499, 499, 499, 499, 499, 499, 499,
666 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
667 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
668 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
669 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
670 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
672 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
673 499, 499, 499, 499, 499, 499, 499, 499, 499, 499
676 static yyconst short int yy_chk[721] =
678 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
679 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
680 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
681 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
682 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
683 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
684 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
685 1, 1, 1, 1, 1, 1, 1, 1, 8, 11,
686 12, 17, 497, 20, 19, 20, 20, 21, 26, 26,
687 36, 17, 19, 19, 39, 12, 36, 22, 21, 22,
689 22, 53, 23, 39, 23, 23, 28, 28, 30, 44,
690 71, 22, 496, 44, 53, 22, 23, 38, 30, 8,
691 23, 22, 41, 22, 38, 40, 23, 40, 30, 11,
692 38, 11, 41, 46, 22, 41, 40, 57, 61, 23,
693 22, 72, 46, 43, 51, 23, 71, 46, 22, 72,
694 43, 22, 47, 23, 43, 51, 47, 50, 86, 116,
695 50, 50, 51, 47, 62, 62, 116, 50, 62, 47,
696 50, 47, 494, 50, 80, 80, 87, 148, 85, 61,
697 85, 83, 83, 85, 85, 86, 80, 80, 57, 84,
698 80, 84, 84, 83, 83, 104, 106, 83, 142, 104,
700 142, 87, 493, 84, 492, 106, 132, 84, 110, 80,
701 80, 110, 135, 84, 133, 80, 83, 83, 148, 132,
702 242, 89, 83, 89, 89, 491, 84, 135, 160, 130,
703 130, 133, 84, 159, 130, 89, 140, 140, 490, 89,
704 84, 130, 140, 147, 147, 89, 489, 147, 488, 152,
705 140, 152, 140, 160, 152, 152, 487, 156, 89, 156,
706 159, 242, 156, 156, 89, 161, 161, 218, 165, 486,
707 155, 155, 89, 95, 165, 95, 218, 95, 95, 95,
708 95, 95, 155, 155, 95, 95, 155, 95, 95, 95,
709 256, 162, 162, 165, 189, 189, 237, 245, 245, 237,
711 257, 165, 246, 246, 162, 155, 155, 162, 243, 243,
712 485, 155, 243, 483, 247, 246, 247, 256, 246, 247,
713 247, 250, 250, 251, 251, 257, 284, 162, 321, 321,
714 482, 480, 162, 322, 322, 330, 251, 284, 246, 251,
715 479, 478, 330, 246, 477, 476, 322, 475, 474, 322,
716 472, 471, 470, 468, 467, 466, 463, 461, 460, 251,
717 458, 456, 453, 452, 251, 450, 447, 446, 445, 322,
718 444, 442, 439, 437, 322, 500, 500, 500, 500, 500,
719 501, 436, 434, 501, 502, 433, 502, 502, 503, 503,
720 430, 503, 503, 504, 429, 504, 504, 505, 505, 506,
722 506, 506, 506, 506, 428, 426, 424, 423, 422, 419,
723 415, 414, 413, 412, 411, 407, 405, 402, 400, 399,
724 398, 397, 396, 395, 393, 390, 388, 387, 386, 384,
725 383, 382, 381, 380, 379, 378, 374, 373, 372, 371,
726 370, 367, 366, 365, 364, 363, 362, 361, 360, 359,
727 358, 356, 355, 354, 353, 352, 351, 350, 348, 347,
728 346, 345, 344, 343, 342, 341, 340, 338, 337, 336,
729 335, 334, 333, 332, 328, 327, 325, 320, 319, 318,
730 316, 315, 314, 313, 312, 311, 310, 309, 308, 307,
731 306, 305, 304, 303, 302, 301, 300, 299, 298, 297,
733 296, 295, 294, 293, 292, 290, 289, 287, 286, 282,
734 281, 280, 278, 277, 276, 275, 272, 271, 270, 269,
735 268, 267, 264, 262, 261, 260, 259, 244, 241, 240,
736 239, 238, 236, 235, 234, 233, 232, 231, 230, 229,
737 228, 227, 226, 225, 224, 223, 222, 221, 219, 217,
738 216, 215, 214, 212, 211, 210, 209, 208, 207, 206,
739 205, 204, 203, 202, 201, 200, 198, 197, 196, 195,
740 194, 193, 192, 191, 190, 188, 187, 186, 185, 184,
741 183, 182, 181, 180, 169, 144, 143, 141, 139, 138,
742 137, 136, 134, 131, 129, 128, 127, 126, 125, 124,
744 123, 122, 121, 120, 119, 118, 117, 114, 113, 112,
745 111, 109, 108, 107, 105, 103, 102, 101, 100, 99,
746 97, 96, 94, 90, 79, 63, 55, 54, 52, 49,
747 48, 45, 42, 37, 35, 34, 27, 16, 13, 7,
748 3, 499, 499, 499, 499, 499, 499, 499, 499, 499,
749 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
750 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
751 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
752 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
753 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
755 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
756 499, 499, 499, 499, 499, 499, 499, 499, 499, 499
759 static yy_state_type yy_last_accepting_state;
760 static char *yy_last_accepting_cpos;
762 /* The intent behind this definition is that it'll catch
763 * any uses of REJECT which flex missed.
765 #define REJECT reject_used_but_not_detected
766 #define yymore() yymore_used_but_not_detected
767 #define YY_MORE_ADJ 0
768 #define YY_RESTORE_YY_MORE_OFFSET
773 ** Copyright (c) Massachusetts Institute of Technology 1994-1998.
774 ** All Rights Reserved.
775 ** Unpublished rights reserved under the copyright laws of
776 ** the United States.
778 ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
779 ** OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
781 ** This code is distributed freely and may be used freely under the
782 ** following conditions:
784 ** 1. This notice may not be removed or altered.
786 ** 2. Works derived from this code are not distributed for
787 ** commercial gain without explicit permission from MIT
788 ** (for permission contact lclint-request@sds.lcs.mit.edu).
791 * Modified by Herbert 08/19/97:
792 * - added #include for IBM's OS/2 compiler.
793 * - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only).
796 * Modified by Mike Smith
797 * Corrected missing 'line' in scanf() calls in handleSpecial().
798 * Without this, I get an error when LCLint hits a '#line' directive
799 * in the pre-pre-processed source files. For safety, I have made these
800 * conditional on OS2 and MSDOS because I don't understand why noone else
801 * has seen this problem.
803 * Modified by Mike Smith, 4th June 1997
804 * Finally resolved the #line problem. The scanf() calls have been fixed to
805 * allow the following #line forms:-
807 * #line 123 "filename"
812 * The last two are generated by the GNU pre-processor, apparently
814 #line 56 "cscanner.l"
816 ** based on original C lexer by Nate Osgood
817 ** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993
821 # include "lclintMacros.nf"
825 # include "sgrammar.h"
826 # include "sgrammar_tokens.h"
828 # include "cgrammar.h"
829 # include "cgrammar_tokens.h"
832 # include "fileIdList.h"
835 # if defined(OS2) && defined(__IBMC__)
836 /* needed for isatty()... */
840 static bool lastWasString = FALSE;
841 static char savechar = '\0';
844 # define yyinput() (incColumn (), getc (yyin))
848 extern /*@external@*/ int read ();
852 static /*@owned@*/ cstring lastidprocessed = cstring_undefined;
854 static int lminput (void);
855 static int tokLength = 0;
856 static bool inSpecPart = FALSE;
857 static bool continueLine = FALSE;
859 static int ninput (void);
860 static char processChar (void);
861 static double processFloat (void);
862 static /*@only@*/ exprNode processString (void);
863 static long processDec (void);
864 static long processHex (void);
865 static int processIdentifier (/*@only@*/ cstring)
866 /*@globals undef lastidprocessed@*/ ;
867 static bool processHashIdentifier (/*@only@*/ cstring)
868 /*@globals undef lastidprocessed@*/ ;
870 static int processSpec (int);
871 static bool handleSpecial (char *);
872 static int handleLlSpecial (void);
873 static void handleMacro (void);
874 static bool processMacro (void);
875 static /*@only@*/ cstring makeIdentifier (char *);
877 /* yes, this is exported! */
878 bool g_expectingTypeName = TRUE; /* beginning of file can be type name! */
880 static int returnInt (ctype, long);
881 static int returnFloat (ctype, double);
882 static int returnChar (char);
883 static void setTokLength (int) /*@modifies g_currentloc@*/ ;
884 static void setTokLengthT (size_t) /*@modifies g_currentloc@*/ ;
886 static void advanceLine (void)
893 # define RETURN_INT(c,i) \
894 do { lastWasString = FALSE; \
895 return (returnInt (c, i)); } while (FALSE)
897 # define RETURN_FLOAT(c,f) \
898 do { lastWasString = FALSE; \
899 return (returnFloat (c, f)); \
902 # define RETURN_CHAR(c) \
903 do { lastWasString = FALSE; \
904 return (returnChar (c)); \
907 # define RETURN_TOK(t) \
908 do { yylval.tok = lltok_create (t, fileloc_decColumn (g_currentloc, tokLength)); \
910 lastWasString = FALSE; \
911 return (t); } while (FALSE)
913 # define RETURN_TYPE(t, ct) \
914 do { yylval.ctyp = ct; tokLength = 0; return (t); } while (FALSE)
916 /* don't fileloc_decColumn (g_currentloc, tokLength));
917 the string could have \n's in it!
920 # define RETURN_STRING(c) \
921 do { yylval.expr = exprNode_stringLiteral (c, fileloc_decColumn (g_currentloc, tokLength)); \
923 lastWasString = TRUE; \
924 return (CCONSTANT); } while (FALSE)
926 # define RETURN_EXPR(e) \
927 do { yylval.expr = e; \
929 lastWasString = TRUE; \
930 return (CCONSTANT); } while (FALSE)
934 static void setTokLength (int len)
940 static void setTokLengthT (size_t len)
942 setTokLength (size_toInt (len));
945 # include "flex.head"
948 /* Macros after this point can all be overridden by user definitions in
952 #ifndef YY_SKIP_YYWRAP
954 extern "C" int yywrap YY_PROTO(( void ));
956 extern int yywrap YY_PROTO(( void ));
961 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
965 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
968 #ifdef YY_NEED_STRLEN
969 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
974 static int yyinput YY_PROTO(( void ));
976 static int input YY_PROTO(( void ));
981 static int yy_start_stack_ptr = 0;
982 static int yy_start_stack_depth = 0;
983 static int *yy_start_stack = 0;
984 #ifndef YY_NO_PUSH_STATE
985 static void yy_push_state YY_PROTO(( int new_state ));
987 #ifndef YY_NO_POP_STATE
988 static void yy_pop_state YY_PROTO(( void ));
990 #ifndef YY_NO_TOP_STATE
991 static int yy_top_state YY_PROTO(( void ));
995 #define YY_NO_PUSH_STATE 1
996 #define YY_NO_POP_STATE 1
997 #define YY_NO_TOP_STATE 1
1000 #ifdef YY_MALLOC_DECL
1008 /* Just try to get by without declaring the routines. This will fail
1009 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
1010 * or sizeof(void*) != sizeof(int).
1015 /* Amount of stuff to slurp up with each read. */
1016 #ifndef YY_READ_BUF_SIZE
1017 #define YY_READ_BUF_SIZE 8192
1020 /* Copy whatever the last rule matched to the standard output. */
1023 /* This used to be an fputs(), but since the string might contain NUL's,
1024 * we now use fwrite().
1026 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1029 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1030 * is returned in "result".
1033 #define YY_INPUT(buf,result,max_size) \
1034 if ( yy_current_buffer->yy_is_interactive ) \
1037 for ( n = 0; n < max_size && \
1038 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1039 buf[n] = (char) c; \
1041 buf[n++] = (char) c; \
1042 if ( c == EOF && ferror( yyin ) ) \
1043 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1046 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
1047 && ferror( yyin ) ) \
1048 YY_FATAL_ERROR( "input in flex scanner failed" );
1051 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1052 * we don't want an extra ';' after the "return" because that will cause
1053 * some compilers to complain about unreachable statements.
1056 #define yyterminate() return YY_NULL
1059 /* Number of entries by which start-condition stack grows. */
1060 #ifndef YY_START_STACK_INCR
1061 #define YY_START_STACK_INCR 25
1064 /* Report a fatal error. */
1065 #ifndef YY_FATAL_ERROR
1066 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1069 /* Default declaration of generated scanner - a define so the user can
1070 * easily add parameters.
1073 #define YY_DECL int yylex YY_PROTO(( void ))
1076 /* Code executed at the beginning of each rule, after yytext and yyleng
1079 #ifndef YY_USER_ACTION
1080 #define YY_USER_ACTION
1083 /* Code executed at the end of each rule. */
1085 #define YY_BREAK break;
1088 #define YY_RULE_SETUP \
1093 register yy_state_type yy_current_state;
1094 register char *yy_cp, *yy_bp;
1095 register int yy_act;
1097 #line 189 "cscanner.l"
1100 #line 1018 "lex.yy.c"
1111 yy_start = 1; /* first start state */
1119 if ( ! yy_current_buffer )
1121 yy_create_buffer( yyin, YY_BUF_SIZE );
1123 yy_load_buffer_state();
1126 while ( 1 ) /* loops until end-of-file is reached */
1130 /* Support of yytext. */
1131 *yy_cp = yy_hold_char;
1133 /* yy_bp points to the position in yy_ch_buf of the start of
1138 yy_current_state = yy_start;
1142 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1143 if ( yy_accept[yy_current_state] )
1145 yy_last_accepting_state = yy_current_state;
1146 yy_last_accepting_cpos = yy_cp;
1148 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1150 yy_current_state = (int) yy_def[yy_current_state];
1151 if ( yy_current_state >= 500 )
1152 yy_c = yy_meta[(unsigned int) yy_c];
1154 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1157 while ( yy_base[yy_current_state] != 642 );
1160 yy_act = yy_accept[yy_current_state];
1162 { /* have to back up */
1163 yy_cp = yy_last_accepting_cpos;
1164 yy_current_state = yy_last_accepting_state;
1165 yy_act = yy_accept[yy_current_state];
1168 YY_DO_BEFORE_ACTION;
1171 do_action: /* This label is used only to access EOF actions. */
1175 { /* beginning of action switch */
1176 case 0: /* must back up */
1177 /* undo the effects of YY_DO_BEFORE_ACTION */
1178 *yy_cp = yy_hold_char;
1179 yy_cp = yy_last_accepting_cpos;
1180 yy_current_state = yy_last_accepting_state;
1181 goto yy_find_action;
1185 #line 191 "cscanner.l"
1186 { llfatalbug (cstring_makeLiteral ("Comment in pre-processor output")); }
1190 #line 193 "cscanner.l"
1192 context_saveLocation ();
1193 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1195 if (processHashIdentifier (makeIdentifier (yytext + 1)))
1203 RETURN_STRING (cstring_makeLiteral ("\"\""));
1208 if (handleSpecial (yytext))
1218 #line 217 "cscanner.l"
1219 { if (handleSpecial (yytext))
1221 setTokLength (1); RETURN_TOK (0);
1227 #line 222 "cscanner.l"
1228 { setTokLength (3); RETURN_TOK (CTOK_ELIPSIS); }
1232 #line 223 "cscanner.l"
1233 { setTokLength (5); RETURN_TOK (BREAK); }
1237 #line 224 "cscanner.l"
1238 { setTokLength (4); RETURN_TOK (CASE); }
1242 #line 225 "cscanner.l"
1243 { setTokLength (8); RETURN_TOK (CONTINUE); }
1247 #line 226 "cscanner.l"
1248 { setTokLength (7); RETURN_TOK (DEFAULT); }
1252 #line 227 "cscanner.l"
1253 { setTokLength (2); RETURN_TOK (DO); }
1257 #line 228 "cscanner.l"
1258 { setTokLength (4); RETURN_TOK (CELSE); }
1262 #line 229 "cscanner.l"
1263 { setTokLength (3); RETURN_TOK (CFOR); }
1267 #line 230 "cscanner.l"
1268 { setTokLength (4); RETURN_TOK (GOTO); }
1272 #line 231 "cscanner.l"
1273 { setTokLength (2); RETURN_TOK (CIF); }
1277 #line 232 "cscanner.l"
1278 { setTokLength (6); RETURN_TOK (RETURN); }
1282 #line 233 "cscanner.l"
1283 { setTokLength (6); RETURN_TOK (CSIZEOF); }
1287 #line 234 "cscanner.l"
1288 { setTokLength (8); RETURN_TOK (COFFSETOF); }
1292 #line 235 "cscanner.l"
1293 { setTokLength (6); RETURN_TOK (SWITCH); }
1297 #line 236 "cscanner.l"
1298 { setTokLength (5); RETURN_TOK (WHILE); }
1302 #line 237 "cscanner.l"
1303 { setTokLength (6); RETURN_TOK (VA_ARG); }
1307 #line 238 "cscanner.l"
1308 { setTokLength (6); RETURN_TOK (VA_DCL); }
1312 #line 239 "cscanner.l"
1314 /* gcc extension...this might not be appropriate */
1315 setTokLength (6); RETURN_TOK (QINLINE); }
1319 #line 243 "cscanner.l"
1320 { setTokLength (6); RETURN_TOK (CSTRUCT); }
1324 #line 244 "cscanner.l"
1325 { setTokLength (7); RETURN_TOK (CTYPEDEF); }
1329 #line 246 "cscanner.l"
1330 { setTokLength (5); RETURN_TOK (CUNION); }
1334 #line 247 "cscanner.l"
1335 { setTokLength (4); RETURN_TOK (CENUM); }
1339 #line 249 "cscanner.l"
1340 { setTokLength (4); RETURN_TYPE (CVOID, ctype_void); }
1344 #line 250 "cscanner.l"
1345 { setTokLength (3); RETURN_TYPE (CINT, ctype_int); }
1349 #line 251 "cscanner.l"
1350 { setTokLength (6); RETURN_TYPE (CDOUBLE, ctype_double); }
1354 #line 252 "cscanner.l"
1355 { setTokLength (4); RETURN_TYPE (CGCHAR, ctype_char); }
1359 #line 253 "cscanner.l"
1360 { setTokLength (5); RETURN_TYPE (CGFLOAT, ctype_float); }
1364 #line 255 "cscanner.l"
1365 { setTokLength (4); RETURN_TOK (QLONG); }
1369 #line 256 "cscanner.l"
1370 { setTokLength (5); RETURN_TOK (QSHORT); }
1374 #line 257 "cscanner.l"
1375 { setTokLength (8); RETURN_TOK (QUNSIGNED); }
1379 #line 258 "cscanner.l"
1380 { setTokLength (6); RETURN_TOK (QSIGNED); }
1384 #line 260 "cscanner.l"
1385 { setTokLength (8); RETURN_TOK (QVOLATILE); }
1389 #line 261 "cscanner.l"
1390 { setTokLength (5); RETURN_TOK (QCONST); }
1392 /* some systems expect this! [gack!] */
1395 #line 264 "cscanner.l"
1396 { setTokLength (7); RETURN_TOK (QCONST); }
1400 #line 266 "cscanner.l"
1401 { setTokLength (6); RETURN_TOK (QEXTERN); }
1405 #line 267 "cscanner.l"
1406 { setTokLength (4); RETURN_TOK (QAUTO); }
1410 #line 268 "cscanner.l"
1411 { setTokLength (8); RETURN_TOK (QREGISTER); }
1415 #line 269 "cscanner.l"
1416 { setTokLength (6); RETURN_TOK (QSTATIC); }
1420 #line 271 "cscanner.l"
1421 { RETURN_EXPR (processString ()); }
1425 #line 272 "cscanner.l"
1426 { return (processSpec (QOUT)); }
1430 #line 273 "cscanner.l"
1431 { return (processSpec (QIN)); }
1435 #line 274 "cscanner.l"
1436 { return (processSpec (QPARTIAL)); }
1440 #line 275 "cscanner.l"
1441 { return (processSpec (QSPECIAL)); }
1445 #line 276 "cscanner.l"
1446 { return (processSpec (QANYTYPE)); }
1450 #line 277 "cscanner.l"
1451 { return (processSpec (QINTEGRALTYPE)); }
1455 #line 278 "cscanner.l"
1456 { return (processSpec (QUNSIGNEDINTEGRALTYPE)); }
1460 #line 279 "cscanner.l"
1461 { return (processSpec (QSIGNEDINTEGRALTYPE)); }
1465 #line 280 "cscanner.l"
1466 { return (processSpec (QKEEP)); }
1470 #line 281 "cscanner.l"
1471 { return (processSpec (QNULL)); }
1475 #line 282 "cscanner.l"
1476 { return (processSpec (QNOTNULL)); }
1480 #line 283 "cscanner.l"
1481 { return (processSpec (QISNULL)); }
1485 #line 284 "cscanner.l"
1486 { return (processSpec (QTRUENULL)); }
1490 #line 285 "cscanner.l"
1491 { return (processSpec (QFALSENULL)); }
1495 #line 286 "cscanner.l"
1496 { return (processSpec (QRELNULL)); }
1500 #line 287 "cscanner.l"
1501 { return (processSpec (QRELDEF)); }
1505 #line 288 "cscanner.l"
1506 { return (processSpec (QEXPOSED)); }
1510 #line 289 "cscanner.l"
1511 { return (processSpec (QNEWREF)); }
1515 #line 290 "cscanner.l"
1516 { return (processSpec (QTEMPREF)); }
1520 #line 291 "cscanner.l"
1521 { return (processSpec (QKILLREF)); }
1525 #line 292 "cscanner.l"
1526 { return (processSpec (QREFCOUNTED)); }
1530 #line 293 "cscanner.l"
1531 { return (processSpec (QCHECKED)); }
1535 #line 294 "cscanner.l"
1536 { return (processSpec (QCHECKMOD)); }
1540 #line 295 "cscanner.l"
1541 { return (processSpec (QCHECKEDSTRICT)); }
1545 #line 296 "cscanner.l"
1546 { return (processSpec (QUNCHECKED)); }
1550 #line 297 "cscanner.l"
1551 { return (processSpec (QONLY)); }
1555 #line 298 "cscanner.l"
1556 { return (processSpec (QOWNED)); }
1560 #line 299 "cscanner.l"
1561 { return (processSpec (QOBSERVER)); }
1565 #line 300 "cscanner.l"
1566 { return (processSpec (QDEPENDENT)); }
1570 #line 301 "cscanner.l"
1571 { return (processSpec (QUNUSED)); }
1575 #line 302 "cscanner.l"
1576 { return (processSpec (QEXTERNAL)); }
1580 #line 303 "cscanner.l"
1581 { return (processSpec (QSEF)); }
1585 #line 304 "cscanner.l"
1586 { return (processSpec (QSHARED)); }
1590 #line 305 "cscanner.l"
1591 { return (processSpec (QYIELD)); }
1595 #line 306 "cscanner.l"
1596 { return (processSpec (QUNDEF)); }
1600 #line 307 "cscanner.l"
1601 { return (processSpec (QKILLED)); }
1605 #line 308 "cscanner.l"
1607 context_saveLocation ();
1608 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1609 tok = processIdentifier (makeIdentifier (yytext));
1618 #line 317 "cscanner.l"
1619 { setTokLengthT (mstring_length (yytext));
1620 RETURN_INT (ctype_uint, processHex ());
1625 #line 320 "cscanner.l"
1626 { setTokLengthT (mstring_length (yytext));
1627 RETURN_INT (ctype_lint, processHex ()); }
1631 #line 322 "cscanner.l"
1632 { setTokLengthT (mstring_length (yytext));
1633 RETURN_INT (ctype_uint, processHex ()); }
1637 #line 324 "cscanner.l"
1638 { setTokLengthT (mstring_length (yytext));
1639 RETURN_INT (ctype_ulint, processHex ()); }
1643 #line 326 "cscanner.l"
1644 { setTokLengthT (mstring_length (yytext));
1645 RETURN_INT (ctype_int, processDec ()); }
1649 #line 328 "cscanner.l"
1650 { setTokLengthT (mstring_length (yytext));
1651 RETURN_INT (ctype_uint, processDec ()); }
1655 #line 330 "cscanner.l"
1656 { setTokLengthT (mstring_length (yytext));
1657 RETURN_INT (ctype_lint, processDec ()); }
1661 #line 332 "cscanner.l"
1662 { setTokLengthT (mstring_length (yytext));
1663 RETURN_INT (ctype_ulint, processDec ()); }
1667 #line 334 "cscanner.l"
1668 { setTokLengthT (mstring_length (yytext));
1669 RETURN_INT (ctype_int, processDec ()); }
1673 #line 336 "cscanner.l"
1674 { setTokLengthT (mstring_length (yytext));
1675 RETURN_INT (ctype_uint, processDec ()); }
1679 #line 338 "cscanner.l"
1680 { setTokLengthT (mstring_length (yytext));
1681 RETURN_INT (ctype_lint, processDec ()); }
1685 #line 340 "cscanner.l"
1686 { setTokLengthT (mstring_length (yytext));
1687 RETURN_INT (ctype_ulint, processDec ()); }
1691 #line 342 "cscanner.l"
1692 { setTokLengthT (mstring_length (yytext));
1693 RETURN_CHAR (processChar ()); }
1697 #line 344 "cscanner.l"
1698 { setTokLengthT (mstring_length (yytext));
1699 RETURN_FLOAT (ctype_float, processFloat ()); }
1703 #line 346 "cscanner.l"
1704 { setTokLengthT (mstring_length (yytext));
1705 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1709 #line 348 "cscanner.l"
1710 { setTokLengthT (mstring_length (yytext));
1711 RETURN_FLOAT (ctype_double, processFloat ()); }
1715 #line 351 "cscanner.l"
1716 { setTokLengthT (mstring_length (yytext));
1717 RETURN_FLOAT (ctype_float, processFloat ()); }
1721 #line 353 "cscanner.l"
1722 { setTokLengthT (mstring_length (yytext));
1723 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1727 #line 355 "cscanner.l"
1728 { setTokLengthT (mstring_length (yytext));
1729 RETURN_FLOAT (ctype_double, processFloat ()); }
1733 #line 358 "cscanner.l"
1734 { setTokLengthT (mstring_length (yytext));
1735 RETURN_FLOAT (ctype_float, processFloat ()); }
1739 #line 360 "cscanner.l"
1740 { setTokLengthT (mstring_length (yytext));
1741 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1745 #line 362 "cscanner.l"
1746 { setTokLengthT (mstring_length (yytext));
1747 RETURN_FLOAT (ctype_double, processFloat ()); }
1751 #line 365 "cscanner.l"
1752 { setTokLength (3); RETURN_TOK (RIGHT_ASSIGN); }
1756 #line 366 "cscanner.l"
1757 { setTokLength (3); RETURN_TOK (LEFT_ASSIGN); }
1761 #line 367 "cscanner.l"
1762 { setTokLength (2); RETURN_TOK (ADD_ASSIGN); }
1766 #line 368 "cscanner.l"
1767 { setTokLength (2); RETURN_TOK (SUB_ASSIGN); }
1771 #line 369 "cscanner.l"
1772 { setTokLength (2); RETURN_TOK (MUL_ASSIGN); }
1776 #line 370 "cscanner.l"
1777 { setTokLength (2); RETURN_TOK (DIV_ASSIGN); }
1781 #line 371 "cscanner.l"
1782 { setTokLength (2); RETURN_TOK (MOD_ASSIGN); }
1786 #line 372 "cscanner.l"
1787 { setTokLength (2); RETURN_TOK (AND_ASSIGN); }
1791 #line 373 "cscanner.l"
1792 { setTokLength (2); RETURN_TOK (XOR_ASSIGN); }
1796 #line 374 "cscanner.l"
1797 { setTokLength (2); RETURN_TOK (OR_ASSIGN); }
1801 #line 375 "cscanner.l"
1802 { setTokLength (2); RETURN_TOK (RIGHT_OP); }
1806 #line 376 "cscanner.l"
1807 { setTokLength (2); RETURN_TOK (LEFT_OP); }
1811 #line 377 "cscanner.l"
1812 { setTokLength (2); RETURN_TOK (INC_OP); }
1816 #line 378 "cscanner.l"
1817 { setTokLength (2); RETURN_TOK (DEC_OP); }
1821 #line 379 "cscanner.l"
1822 { setTokLength (2); RETURN_TOK (ARROW_OP); }
1826 #line 380 "cscanner.l"
1827 { setTokLength (2); RETURN_TOK (AND_OP); }
1831 #line 381 "cscanner.l"
1832 { setTokLength (2); RETURN_TOK (OR_OP); }
1836 #line 382 "cscanner.l"
1837 { setTokLength (2); RETURN_TOK (LE_OP); }
1841 #line 383 "cscanner.l"
1842 { setTokLength (2); RETURN_TOK (GE_OP); }
1846 #line 384 "cscanner.l"
1847 { setTokLength (2); RETURN_TOK (EQ_OP); }
1851 #line 385 "cscanner.l"
1852 { setTokLength (2); RETURN_TOK (NE_OP); }
1856 #line 386 "cscanner.l"
1857 { setTokLength (1); RETURN_TOK (TSEMI); }
1861 #line 387 "cscanner.l"
1862 { setTokLength (1); RETURN_TOK (TLBRACE); }
1866 #line 388 "cscanner.l"
1867 { setTokLength (1); RETURN_TOK (TRBRACE); }
1871 #line 389 "cscanner.l"
1872 { setTokLength (1); RETURN_TOK (TCOMMA); }
1876 #line 390 "cscanner.l"
1877 { setTokLength (1); RETURN_TOK (TCOLON); }
1881 #line 391 "cscanner.l"
1882 { setTokLength (1); RETURN_TOK (TASSIGN); }
1886 #line 392 "cscanner.l"
1887 { setTokLength (1); RETURN_TOK (TLPAREN); }
1891 #line 393 "cscanner.l"
1892 { setTokLength (1); RETURN_TOK (TRPAREN); }
1896 #line 394 "cscanner.l"
1897 { setTokLength (1); RETURN_TOK (TLSQBR); }
1901 #line 395 "cscanner.l"
1902 { setTokLength (1); RETURN_TOK (TRSQBR); }
1906 #line 396 "cscanner.l"
1907 { setTokLength (1); RETURN_TOK (TDOT); }
1911 #line 397 "cscanner.l"
1912 { setTokLength (1); RETURN_TOK (TAMPERSAND); }
1916 #line 398 "cscanner.l"
1917 { setTokLength (1); RETURN_TOK (TEXCL); }
1921 #line 401 "cscanner.l"
1922 { setTokLength (1); RETURN_TOK (TTILDE); }
1926 #line 402 "cscanner.l"
1927 { setTokLength (1); RETURN_TOK (TMINUS); }
1931 #line 403 "cscanner.l"
1932 { setTokLength (1); RETURN_TOK (TPLUS); }
1936 #line 404 "cscanner.l"
1937 { setTokLength (1); RETURN_TOK (TMULT); }
1941 #line 405 "cscanner.l"
1942 { setTokLength (1); RETURN_TOK (TDIV); }
1946 #line 406 "cscanner.l"
1947 { setTokLength (1); RETURN_TOK (TPERCENT); }
1951 #line 407 "cscanner.l"
1952 { setTokLength (1); RETURN_TOK (TLT); }
1956 #line 408 "cscanner.l"
1957 { setTokLength (1); RETURN_TOK (TGT); }
1961 #line 409 "cscanner.l"
1962 { setTokLength (1); RETURN_TOK (TCIRC); }
1966 #line 410 "cscanner.l"
1967 { setTokLength (1); RETURN_TOK (TBAR); }
1971 #line 411 "cscanner.l"
1972 { setTokLength (1); RETURN_TOK (TQUEST); }
1976 #line 413 "cscanner.l"
1981 #line 414 "cscanner.l"
1982 { context_incLineno ();
1985 continueLine = FALSE;
1989 if (context_inMacro ())
1991 /* Don't use RETURN_TOK */
1992 yylval.tok = lltok_create (TENDMACRO, g_currentloc);
1993 lastWasString = FALSE;
2001 #line 430 "cscanner.l"
2004 if (processMacro ()) {
2005 if (context_inIterDef ())
2007 RETURN_TOK (LLMACROITER);
2009 if (context_inIterEnd ())
2011 RETURN_TOK (LLMACROEND);
2013 if (context_inMacro ())
2015 RETURN_TOK (LLMACRO);
2022 #line 447 "cscanner.l"
2023 { if (context_inHeader () || context_inFunction ())
2029 int nspchar = ninput ();
2033 ** This is a hack to get the column number correct.
2036 llassert (nspchar >= '0' && nspchar <= '9');
2038 nspaces = nspchar - '0';
2040 setTokLength (5 + nspaces);
2042 if (processMacro ())
2044 if (context_inIterDef ())
2046 RETURN_TOK (LLMACROITER);
2048 if (context_inIterEnd ())
2050 RETURN_TOK (LLMACROEND);
2052 if (context_inMacro ())
2054 RETURN_TOK (LLMACRO);
2062 #line 483 "cscanner.l"
2063 { setTokLength (4); lldiagmsg (ctype_unparseTable ()); }
2067 #line 484 "cscanner.l"
2069 lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc)));
2074 #line 487 "cscanner.l"
2075 { setTokLength (3); usymtab_printLocal (); }
2079 #line 488 "cscanner.l"
2080 { setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); }
2084 #line 489 "cscanner.l"
2085 { setTokLength (3); lldiagmsg (context_unparse ()); }
2089 #line 490 "cscanner.l"
2090 { setTokLength (3); lldiagmsg (context_unparseClauses ()); }
2094 #line 491 "cscanner.l"
2095 { setTokLength (3); usymtab_printGuards (); }
2099 #line 492 "cscanner.l"
2100 { setTokLength (3); usymtab_printOut (); }
2104 #line 493 "cscanner.l"
2105 { setTokLength (3); usymtab_printAll (); }
2109 #line 494 "cscanner.l"
2110 { setTokLength (3); usymtab_printComplete (); }
2114 #line 495 "cscanner.l"
2115 { setTokLength (3); usymtab_printTypes (); }
2119 #line 496 "cscanner.l"
2120 { setTokLength (3); lldiagmsg (usymtab_unparseStack ()); }
2124 #line 497 "cscanner.l"
2126 lldiagmsg (message ("Can modify: %q",
2127 sRefSet_unparse (context_modList ())));
2132 #line 501 "cscanner.l"
2133 { /* BEFORE_COMMENT_MARKER */
2135 incColumn (); incColumn ();
2136 tok = handleLlSpecial ();
2145 #line 510 "cscanner.l"
2146 { /* AFTER_COMMENT_MARKER */
2149 RETURN_TOK (QENDMACRO); }
2153 #line 514 "cscanner.l"
2154 { incColumn (); continueLine = TRUE; }
2158 #line 515 "cscanner.l"
2162 message ("Invalid character (ascii: %d), skipping character",
2169 #line 522 "cscanner.l"
2172 #line 2090 "lex.yy.c"
2173 case YY_STATE_EOF(INITIAL):
2176 case YY_END_OF_BUFFER:
2178 /* Amount of text matched not including the EOB char. */
2179 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2181 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2182 *yy_cp = yy_hold_char;
2183 YY_RESTORE_YY_MORE_OFFSET
2185 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2187 /* We're scanning a new file or input source. It's
2188 * possible that this happened because the user
2189 * just pointed yyin at a new source and called
2190 * yylex(). If so, then we have to assure
2191 * consistency between yy_current_buffer and our
2192 * globals. Here is the right place to do so, because
2193 * this is the first action (other than possibly a
2194 * back-up) that will match for the new input source.
2196 yy_n_chars = yy_current_buffer->yy_n_chars;
2197 yy_current_buffer->yy_input_file = yyin;
2198 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2201 /* Note that here we test for yy_c_buf_p "<=" to the position
2202 * of the first EOB in the buffer, since yy_c_buf_p will
2203 * already have been incremented past the NUL character
2204 * (since all states make transitions on EOB to the
2205 * end-of-buffer state). Contrast this with the test
2208 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2209 { /* This was really a NUL. */
2210 yy_state_type yy_next_state;
2212 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2214 yy_current_state = yy_get_previous_state();
2216 /* Okay, we're now positioned to make the NUL
2217 * transition. We couldn't have
2218 * yy_get_previous_state() go ahead and do it
2219 * for us because it doesn't know how to deal
2220 * with the possibility of jamming (and we don't
2221 * want to build jamming into it because then it
2222 * will run more slowly).
2225 yy_next_state = yy_try_NUL_trans( yy_current_state );
2227 yy_bp = yytext_ptr + YY_MORE_ADJ;
2229 if ( yy_next_state )
2231 /* Consume the NUL. */
2232 yy_cp = ++yy_c_buf_p;
2233 yy_current_state = yy_next_state;
2240 goto yy_find_action;
2244 else switch ( yy_get_next_buffer() )
2246 case EOB_ACT_END_OF_FILE:
2248 yy_did_buffer_switch_on_eof = 0;
2252 /* Note: because we've taken care in
2253 * yy_get_next_buffer() to have set up
2254 * yytext, we can now set up
2255 * yy_c_buf_p so that if some total
2256 * hoser (like flex itself) wants to
2257 * call the scanner after we return the
2258 * YY_NULL, it'll still work - another
2259 * YY_NULL will get returned.
2261 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2263 yy_act = YY_STATE_EOF(YY_START);
2269 if ( ! yy_did_buffer_switch_on_eof )
2275 case EOB_ACT_CONTINUE_SCAN:
2277 yytext_ptr + yy_amount_of_matched_text;
2279 yy_current_state = yy_get_previous_state();
2282 yy_bp = yytext_ptr + YY_MORE_ADJ;
2285 case EOB_ACT_LAST_MATCH:
2287 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2289 yy_current_state = yy_get_previous_state();
2292 yy_bp = yytext_ptr + YY_MORE_ADJ;
2293 goto yy_find_action;
2300 "fatal flex scanner internal error--no action found" );
2301 } /* end of action switch */
2302 } /* end of scanning one token */
2303 } /* end of yylex */
2306 /* yy_get_next_buffer - try to read in a new buffer
2308 * Returns a code representing an action:
2309 * EOB_ACT_LAST_MATCH -
2310 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2311 * EOB_ACT_END_OF_FILE - end of file
2314 static int yy_get_next_buffer()
2316 register char *dest = yy_current_buffer->yy_ch_buf;
2317 register char *source = yytext_ptr;
2318 register int number_to_move, i;
2321 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2323 "fatal flex scanner internal error--end of buffer missed" );
2325 if ( yy_current_buffer->yy_fill_buffer == 0 )
2326 { /* Don't try to fill the buffer, so this is an EOF. */
2327 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2329 /* We matched a single character, the EOB, so
2330 * treat this as a final EOF.
2332 return EOB_ACT_END_OF_FILE;
2337 /* We matched some text prior to the EOB, first
2340 return EOB_ACT_LAST_MATCH;
2344 /* Try to read more data. */
2346 /* First move last chars to start of buffer. */
2347 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2349 for ( i = 0; i < number_to_move; ++i )
2350 *(dest++) = *(source++);
2352 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2353 /* don't do the read, it's not guaranteed to return an EOF,
2356 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2361 yy_current_buffer->yy_buf_size - number_to_move - 1;
2363 while ( num_to_read <= 0 )
2364 { /* Not enough room in the buffer - grow it. */
2365 #ifdef YY_USES_REJECT
2367 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2370 /* just a shorter name for the current buffer */
2371 YY_BUFFER_STATE b = yy_current_buffer;
2373 int yy_c_buf_p_offset =
2374 (int) (yy_c_buf_p - b->yy_ch_buf);
2376 if ( b->yy_is_our_buffer )
2378 int new_size = b->yy_buf_size * 2;
2380 if ( new_size <= 0 )
2381 b->yy_buf_size += b->yy_buf_size / 8;
2383 b->yy_buf_size *= 2;
2385 b->yy_ch_buf = (char *)
2386 /* Include room in for 2 EOB chars. */
2387 yy_flex_realloc( (void *) b->yy_ch_buf,
2388 b->yy_buf_size + 2 );
2391 /* Can't grow it, we don't own it. */
2394 if ( ! b->yy_ch_buf )
2396 "fatal error - scanner input buffer overflow" );
2398 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2400 num_to_read = yy_current_buffer->yy_buf_size -
2405 if ( num_to_read > YY_READ_BUF_SIZE )
2406 num_to_read = YY_READ_BUF_SIZE;
2408 /* Read in more data. */
2409 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2410 yy_n_chars, num_to_read );
2412 yy_current_buffer->yy_n_chars = yy_n_chars;
2415 if ( yy_n_chars == 0 )
2417 if ( number_to_move == YY_MORE_ADJ )
2419 ret_val = EOB_ACT_END_OF_FILE;
2425 ret_val = EOB_ACT_LAST_MATCH;
2426 yy_current_buffer->yy_buffer_status =
2427 YY_BUFFER_EOF_PENDING;
2432 ret_val = EOB_ACT_CONTINUE_SCAN;
2434 yy_n_chars += number_to_move;
2435 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2436 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2438 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2444 /* yy_get_previous_state - get the state just before the EOB char was reached */
2446 static yy_state_type yy_get_previous_state()
2448 register yy_state_type yy_current_state;
2449 register char *yy_cp;
2451 yy_current_state = yy_start;
2453 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2455 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2456 if ( yy_accept[yy_current_state] )
2458 yy_last_accepting_state = yy_current_state;
2459 yy_last_accepting_cpos = yy_cp;
2461 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2463 yy_current_state = (int) yy_def[yy_current_state];
2464 if ( yy_current_state >= 500 )
2465 yy_c = yy_meta[(unsigned int) yy_c];
2467 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2470 return yy_current_state;
2474 /* yy_try_NUL_trans - try to make a transition on the NUL character
2477 * next_state = yy_try_NUL_trans( current_state );
2480 #ifdef YY_USE_PROTOS
2481 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2483 static yy_state_type yy_try_NUL_trans( yy_current_state )
2484 yy_state_type yy_current_state;
2487 register int yy_is_jam;
2488 register char *yy_cp = yy_c_buf_p;
2490 register YY_CHAR yy_c = 1;
2491 if ( yy_accept[yy_current_state] )
2493 yy_last_accepting_state = yy_current_state;
2494 yy_last_accepting_cpos = yy_cp;
2496 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2498 yy_current_state = (int) yy_def[yy_current_state];
2499 if ( yy_current_state >= 500 )
2500 yy_c = yy_meta[(unsigned int) yy_c];
2502 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2503 yy_is_jam = (yy_current_state == 499);
2505 return yy_is_jam ? 0 : yy_current_state;
2510 #ifdef YY_USE_PROTOS
2511 static void yyunput( int c, register char *yy_bp )
2513 static void yyunput( c, yy_bp )
2515 register char *yy_bp;
2518 register char *yy_cp = yy_c_buf_p;
2520 /* undo effects of setting up yytext */
2521 *yy_cp = yy_hold_char;
2523 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2524 { /* need to shift things up to make room */
2525 /* +2 for EOB chars. */
2526 register int number_to_move = yy_n_chars + 2;
2527 register char *dest = &yy_current_buffer->yy_ch_buf[
2528 yy_current_buffer->yy_buf_size + 2];
2529 register char *source =
2530 &yy_current_buffer->yy_ch_buf[number_to_move];
2532 while ( source > yy_current_buffer->yy_ch_buf )
2533 *--dest = *--source;
2535 yy_cp += (int) (dest - source);
2536 yy_bp += (int) (dest - source);
2537 yy_current_buffer->yy_n_chars =
2538 yy_n_chars = yy_current_buffer->yy_buf_size;
2540 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2541 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2544 *--yy_cp = (char) c;
2548 yy_hold_char = *yy_cp;
2551 #endif /* ifndef YY_NO_UNPUT */
2555 static int yyinput()
2562 *yy_c_buf_p = yy_hold_char;
2564 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2566 /* yy_c_buf_p now points to the character we want to return.
2567 * If this occurs *before* the EOB characters, then it's a
2568 * valid NUL; if not, then we've hit the end of the buffer.
2570 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2571 /* This was really a NUL. */
2575 { /* need more input */
2576 int offset = yy_c_buf_p - yytext_ptr;
2579 switch ( yy_get_next_buffer() )
2581 case EOB_ACT_LAST_MATCH:
2582 /* This happens because yy_g_n_b()
2583 * sees that we've accumulated a
2584 * token and flags that we need to
2585 * try matching the token before
2586 * proceeding. But for input(),
2587 * there's no matching to consider.
2588 * So convert the EOB_ACT_LAST_MATCH
2589 * to EOB_ACT_END_OF_FILE.
2592 /* Reset buffer status. */
2597 case EOB_ACT_END_OF_FILE:
2602 if ( ! yy_did_buffer_switch_on_eof )
2611 case EOB_ACT_CONTINUE_SCAN:
2612 yy_c_buf_p = yytext_ptr + offset;
2618 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2619 *yy_c_buf_p = '\0'; /* preserve yytext */
2620 yy_hold_char = *++yy_c_buf_p;
2627 #ifdef YY_USE_PROTOS
2628 void yyrestart( FILE *input_file )
2630 void yyrestart( input_file )
2634 if ( ! yy_current_buffer )
2635 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2637 yy_init_buffer( yy_current_buffer, input_file );
2638 yy_load_buffer_state();
2642 #ifdef YY_USE_PROTOS
2643 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2645 void yy_switch_to_buffer( new_buffer )
2646 YY_BUFFER_STATE new_buffer;
2649 if ( yy_current_buffer == new_buffer )
2652 if ( yy_current_buffer )
2654 /* Flush out information for old buffer. */
2655 *yy_c_buf_p = yy_hold_char;
2656 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2657 yy_current_buffer->yy_n_chars = yy_n_chars;
2660 yy_current_buffer = new_buffer;
2661 yy_load_buffer_state();
2663 /* We don't actually know whether we did this switch during
2664 * EOF (yywrap()) processing, but the only time this flag
2665 * is looked at is after yywrap() is called, so it's safe
2666 * to go ahead and always set it.
2668 yy_did_buffer_switch_on_eof = 1;
2672 #ifdef YY_USE_PROTOS
2673 void yy_load_buffer_state( void )
2675 void yy_load_buffer_state()
2678 yy_n_chars = yy_current_buffer->yy_n_chars;
2679 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2680 yyin = yy_current_buffer->yy_input_file;
2681 yy_hold_char = *yy_c_buf_p;
2685 #ifdef YY_USE_PROTOS
2686 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2688 YY_BUFFER_STATE yy_create_buffer( file, size )
2695 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2697 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2699 b->yy_buf_size = size;
2701 /* yy_ch_buf has to be 2 characters longer than the size given because
2702 * we need to put in 2 end-of-buffer characters.
2704 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2705 if ( ! b->yy_ch_buf )
2706 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2708 b->yy_is_our_buffer = 1;
2710 yy_init_buffer( b, file );
2716 #ifdef YY_USE_PROTOS
2717 void yy_delete_buffer( YY_BUFFER_STATE b )
2719 void yy_delete_buffer( b )
2726 if ( b == yy_current_buffer )
2727 yy_current_buffer = (YY_BUFFER_STATE) 0;
2729 if ( b->yy_is_our_buffer )
2730 yy_flex_free( (void *) b->yy_ch_buf );
2732 yy_flex_free( (void *) b );
2736 #ifndef YY_ALWAYS_INTERACTIVE
2737 #ifndef YY_NEVER_INTERACTIVE
2738 extern int isatty YY_PROTO(( int ));
2742 #ifdef YY_USE_PROTOS
2743 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2745 void yy_init_buffer( b, file )
2752 yy_flush_buffer( b );
2754 b->yy_input_file = file;
2755 b->yy_fill_buffer = 1;
2757 #if YY_ALWAYS_INTERACTIVE
2758 b->yy_is_interactive = 1;
2760 #if YY_NEVER_INTERACTIVE
2761 b->yy_is_interactive = 0;
2763 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2769 #ifdef YY_USE_PROTOS
2770 void yy_flush_buffer( YY_BUFFER_STATE b )
2772 void yy_flush_buffer( b )
2782 /* We always need two end-of-buffer characters. The first causes
2783 * a transition to the end-of-buffer state. The second causes
2784 * a jam in that state.
2786 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2787 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2789 b->yy_buf_pos = &b->yy_ch_buf[0];
2792 b->yy_buffer_status = YY_BUFFER_NEW;
2794 if ( b == yy_current_buffer )
2795 yy_load_buffer_state();
2799 #ifndef YY_NO_SCAN_BUFFER
2800 #ifdef YY_USE_PROTOS
2801 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2803 YY_BUFFER_STATE yy_scan_buffer( base, size )
2811 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2812 base[size-1] != YY_END_OF_BUFFER_CHAR )
2813 /* They forgot to leave room for the EOB's. */
2816 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2818 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2820 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2821 b->yy_buf_pos = b->yy_ch_buf = base;
2822 b->yy_is_our_buffer = 0;
2823 b->yy_input_file = 0;
2824 b->yy_n_chars = b->yy_buf_size;
2825 b->yy_is_interactive = 0;
2827 b->yy_fill_buffer = 0;
2828 b->yy_buffer_status = YY_BUFFER_NEW;
2830 yy_switch_to_buffer( b );
2837 #ifndef YY_NO_SCAN_STRING
2838 #ifdef YY_USE_PROTOS
2839 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2841 YY_BUFFER_STATE yy_scan_string( yy_str )
2842 yyconst char *yy_str;
2846 for ( len = 0; yy_str[len]; ++len )
2849 return yy_scan_bytes( yy_str, len );
2854 #ifndef YY_NO_SCAN_BYTES
2855 #ifdef YY_USE_PROTOS
2856 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2858 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2859 yyconst char *bytes;
2868 /* Get memory for full buffer, including space for trailing EOB's. */
2870 buf = (char *) yy_flex_alloc( n );
2872 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2874 for ( i = 0; i < len; ++i )
2877 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2879 b = yy_scan_buffer( buf, n );
2881 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2883 /* It's okay to grow etc. this buffer, and we should throw it
2884 * away when we're done.
2886 b->yy_is_our_buffer = 1;
2893 #ifndef YY_NO_PUSH_STATE
2894 #ifdef YY_USE_PROTOS
2895 static void yy_push_state( int new_state )
2897 static void yy_push_state( new_state )
2901 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2905 yy_start_stack_depth += YY_START_STACK_INCR;
2906 new_size = yy_start_stack_depth * sizeof( int );
2908 if ( ! yy_start_stack )
2909 yy_start_stack = (int *) yy_flex_alloc( new_size );
2912 yy_start_stack = (int *) yy_flex_realloc(
2913 (void *) yy_start_stack, new_size );
2915 if ( ! yy_start_stack )
2917 "out of memory expanding start-condition stack" );
2920 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2927 #ifndef YY_NO_POP_STATE
2928 static void yy_pop_state()
2930 if ( --yy_start_stack_ptr < 0 )
2931 YY_FATAL_ERROR( "start-condition stack underflow" );
2933 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2938 #ifndef YY_NO_TOP_STATE
2939 static int yy_top_state()
2941 return yy_start_stack[yy_start_stack_ptr - 1];
2945 #ifndef YY_EXIT_FAILURE
2946 #define YY_EXIT_FAILURE 2
2949 #ifdef YY_USE_PROTOS
2950 static void yy_fatal_error( yyconst char msg[] )
2952 static void yy_fatal_error( msg )
2956 (void) fprintf( stderr, "%s\n", msg );
2957 exit( YY_EXIT_FAILURE );
2962 /* Redefine yyless() so it works in section 3 code. */
2968 /* Undo effects of setting up yytext. */ \
2969 yytext[yyleng] = yy_hold_char; \
2970 yy_c_buf_p = yytext + n; \
2971 yy_hold_char = *yy_c_buf_p; \
2972 *yy_c_buf_p = '\0'; \
2978 /* Internal utility routines. */
2981 #ifdef YY_USE_PROTOS
2982 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2984 static void yy_flex_strncpy( s1, s2, n )
2991 for ( i = 0; i < n; ++i )
2996 #ifdef YY_NEED_STRLEN
2997 #ifdef YY_USE_PROTOS
2998 static int yy_flex_strlen( yyconst char *s )
3000 static int yy_flex_strlen( s )
3005 for ( n = 0; s[n]; ++n )
3013 #ifdef YY_USE_PROTOS
3014 static void *yy_flex_alloc( yy_size_t size )
3016 static void *yy_flex_alloc( size )
3020 return (void *) malloc( size );
3023 #ifdef YY_USE_PROTOS
3024 static void *yy_flex_realloc( void *ptr, yy_size_t size )
3026 static void *yy_flex_realloc( ptr, size )
3031 /* The cast to (char *) in the following accommodates both
3032 * implementations that use char* generic pointers, and those
3033 * that use void* generic pointers. It works with the latter
3034 * because both ANSI C and C++ allow castless assignment from
3035 * any pointer type to void*, and deal with argument conversions
3036 * as though doing an assignment.
3038 return (void *) realloc( (char *) ptr, size );
3041 #ifdef YY_USE_PROTOS
3042 static void yy_flex_free( void *ptr )
3044 static void yy_flex_free( ptr )
3058 #line 522 "cscanner.l"
3063 /*@null@*/ /*@observer@*/ char *name;
3068 ** These tokens are followed by syntax that is parsed by the
3072 struct skeyword s_parsetable[] = {
3073 { "modifies", QMODIFIES } ,
3074 { "globals", QGLOBALS } ,
3076 { "constant", QCONSTANT } ,
3077 { "function", QFUNCTION } ,
3079 { "defines", QDEFINES } ,
3081 { "allocates", QALLOCATES } ,
3083 { "releases", QRELEASES } ,
3084 { "pre", QPRECLAUSE } ,
3085 { "post", QPOSTCLAUSE } ,
3090 ** These tokens are either stand-alone tokens, or followed by
3091 ** token-specific text.
3094 struct skeyword s_keytable[] = {
3095 { "anytype", QANYTYPE } ,
3096 { "integraltype", QINTEGRALTYPE } ,
3097 { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } ,
3098 { "signedintegraltype", QSIGNEDINTEGRALTYPE } ,
3102 { "owned", QOWNED } ,
3103 { "dependent", QDEPENDENT } ,
3104 { "partial", QPARTIAL } ,
3105 { "special", QSPECIAL } ,
3106 { "truenull", QTRUENULL } ,
3107 { "falsenull", QFALSENULL } ,
3110 { "notnull", QNOTNULL } ,
3111 { "abstract", QABSTRACT } ,
3112 { "concrete", QCONCRETE } ,
3113 { "mutable", QMUTABLE } ,
3114 { "immutable", QIMMUTABLE } ,
3115 { "unused", QUNUSED } ,
3116 { "external", QEXTERNAL } ,
3118 { "unique", QUNIQUE } ,
3119 { "returned", QRETURNED } ,
3120 { "exposed", QEXPOSED } ,
3121 { "refcounted", QREFCOUNTED } ,
3123 { "newref", QNEWREF } ,
3124 { "tempref", QTEMPREF } ,
3125 { "killref", QKILLREF } ,
3127 { "relnull", QRELNULL } ,
3128 { "reldef", QRELDEF } ,
3129 { "observer", QOBSERVER } ,
3130 { "exits", QEXITS } ,
3131 { "mayexit", QMAYEXIT } ,
3132 { "trueexit", QTRUEEXIT } ,
3133 { "falseexit", QFALSEEXIT } ,
3134 { "neverexit", QNEVEREXIT } ,
3136 { "shared", QSHARED } ,
3138 { "unchecked", QUNCHECKED } ,
3139 { "checked", QCHECKED } ,
3140 { "checkmod", QCHECKMOD } ,
3141 { "checkedstrict", QCHECKEDSTRICT } ,
3142 { "innercontinue", QINNERCONTINUE } ,
3143 { "innerbreak", QINNERBREAK } ,
3144 { "loopbreak", QLOOPBREAK } ,
3145 { "switchbreak", QSWITCHBREAK } ,
3146 { "safebreak", QSAFEBREAK } ,
3147 { "fallthrough", QFALLTHROUGH } ,
3148 { "l_fallthrou", QLINTFALLTHROUGH } ,
3149 { "l_fallth", QLINTFALLTHRU } ,
3150 { "notreached", QNOTREACHED } ,
3151 { "l_notreach", QLINTNOTREACHED } ,
3152 { "printflike", QPRINTFLIKE } ,
3153 { "l_printfli", QLINTPRINTFLIKE } ,
3154 { "scanflike", QSCANFLIKE } ,
3155 { "messagelike", QMESSAGELIKE } ,
3156 { "l_argsus", QARGSUSED } ,
3161 ** would be better if these weren't hard coded...
3164 static bool isArtificial (cstring s)
3166 return (cstring_equalLit (s, "modifies")
3167 || cstring_equalLit (s, "globals")
3168 || cstring_equalLit (s, "alt"));
3171 void swallowMacro (void)
3174 bool skipnext = FALSE;
3176 while ((i = lminput ()) != EOF)
3193 checkUngetc (i, yyin);
3201 checkUngetc (i, yyin);
3205 static int commentMarkerToken (cstring s)
3209 while (s_parsetable[i].name != NULL)
3211 if (cstring_equalLit (s, s_parsetable[i].name))
3213 return s_parsetable[i].token;
3222 static int tokenMacroCode (cstring s)
3226 while (s_keytable[i].name != NULL)
3228 if (cstring_equalLit (s, s_keytable[i].name))
3230 if (s_keytable[i].token == QLINTFALLTHROUGH)
3233 (FLG_WARNLINTCOMMENTS,
3235 ("Traditional lint comment /*FALLTHROUGH*/ used. "
3236 "This is interpreted by "
3237 "LCLint in the same way as most Unix lints, but it is "
3238 "preferable to replace it with the /*@fallthrough@*/ "
3239 "stylized comment"),
3241 return QFALLTHROUGH;
3243 else if (s_keytable[i].token == QLINTFALLTHRU)
3246 (FLG_WARNLINTCOMMENTS,
3248 ("Traditional lint comment /*FALLTHRU*/ used. "
3249 "This is interpreted by "
3250 "LCLint in the same way as most Unix lints, but it is "
3251 "preferable to replace it with the /*@fallthrough@*/ "
3252 "stylized comment"),
3254 return QFALLTHROUGH;
3256 else if (s_keytable[i].token == QLINTNOTREACHED)
3259 (FLG_WARNLINTCOMMENTS,
3261 ("Traditional lint comment /*NOTREACHED*/ used. "
3262 "This is interpreted by "
3263 "LCLint in the same way as most Unix lints, but it is "
3264 "preferable to replace it with the /*@notreached@*/ "
3265 "stylized comment."),
3270 else if (s_keytable[i].token == QPRINTFLIKE)
3272 setSpecialFunction (QU_PRINTFLIKE);
3275 else if (s_keytable[i].token == QLINTPRINTFLIKE)
3278 (FLG_WARNLINTCOMMENTS,
3280 ("Traditional lint comment /*PRINTFLIKE*/ used. "
3281 "This is interpreted by "
3282 "LCLint in the same way as most Unix lints, but it is "
3283 "preferable to replace it with either /*@printflike@*/, "
3284 "/*@scanflike@*/ or /*@messagelike@*/."),
3287 setSpecialFunction (QU_PRINTFLIKE);
3290 else if (s_keytable[i].token == QSCANFLIKE)
3292 setSpecialFunction (QU_SCANFLIKE);
3295 else if (s_keytable[i].token == QMESSAGELIKE)
3297 setSpecialFunction (QU_MESSAGELIKE);
3300 else if (s_keytable[i].token == QARGSUSED)
3303 (FLG_WARNLINTCOMMENTS,
3305 ("Traditional lint comment /*ARGSUSED*/ used. "
3306 "This is interpreted by "
3307 "LCLint in the same way as most Unix lints, but it is "
3308 "preferable to use /*@unused@*/ annotations on "
3309 "the unused parameters."),
3316 return s_keytable[i].token;
3325 static int lminput ()
3327 if (savechar == '\0')
3334 int save = (int) savechar;
3340 static void lmsavechar (char c)
3342 if (savechar == '\0') savechar = c;
3345 llbuglit ("lmsavechar: override");
3349 static int returnFloat (ctype ct, double f)
3351 yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext),
3352 fileloc_decColumn (g_currentloc, tokLength));
3357 static int returnInt (ctype ct, long i)
3361 if (ctype_equal (ct, ctype_int))
3365 c = context_typeofZero ();
3369 c = context_typeofOne ();
3373 yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext),
3374 fileloc_decColumn (g_currentloc, tokLength), i);
3379 static int returnChar (char c)
3381 yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext),
3382 fileloc_decColumn (g_currentloc, tokLength));
3387 static int ninput ()
3391 if (c != EOF && ((char)c == '\n'))
3393 context_incLineno ();
3399 static char macro_nextChar ()
3401 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3406 c = char_fromInt (ic);
3408 if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0]))
3412 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3414 ; /* skip to newline */
3417 context_incLineno ();
3421 return macro_nextChar ();
3428 else /* if (c == '@') */
3430 if (handleLlSpecial () != BADTOK)
3432 llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax");
3435 return macro_nextChar ();
3438 else if (!in_escape && c == '\"')
3440 in_quote = !in_quote;
3442 else if (!in_escape && c == '\'')
3446 else if ((in_quote || in_char) && c == '\\')
3448 in_escape = !in_escape;
3450 else if ((in_quote || in_char) && in_escape)
3454 else if (!in_quote && c == '/')
3458 if ((c2 = char_fromInt (lminput ())) == '*')
3462 while ((c2 = char_fromInt (lminput ())) != '\0'
3463 && c2 != '\n' && c2 != '*')
3470 while ((c2 = char_fromInt (lminput ())) != '\0'
3483 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3487 return macro_nextChar ();
3491 /*** putchar does not work! why? puts to stdio...??! ***/
3499 ** keeps stylized comments
3502 static char macro_nextCharC ()
3504 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3507 c = char_fromInt (lminput ());
3509 if (!in_quote && !in_char && c == '\\')
3511 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3513 ; /* skip to newline */
3516 context_incLineno ();
3520 return macro_nextCharC ();
3527 else if (!in_escape && c == '\"')
3529 in_quote = !in_quote;
3531 else if (!in_escape && c == '\'')
3535 else if ((in_quote || in_char) && c == '\\')
3537 in_escape = !in_escape;
3539 else if ((in_quote || in_char) && in_escape)
3543 else if (!in_quote && c == '/')
3547 if ((c2 = char_fromInt (lminput ())) == '*')
3551 while ((c2 = char_fromInt (lminput ())) != '\0'
3552 && c2 != '\n' && c2 != '*')
3559 while ((c2 = char_fromInt (lminput ())) != '\0'
3572 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3576 return macro_nextCharC ();
3587 ** skips whitespace (handles line continuations)
3588 ** returns first non-whitespace character
3591 static char skip_whitespace ()
3595 while ((c = macro_nextChar ()) == ' ' || c == '\t')
3603 static void handleMacro ()
3605 cstring mac = cstring_undefined;
3609 while (currentColumn () > 2)
3611 mac = cstring_appendChar (mac, ' ');
3615 c = macro_nextCharC ();
3617 if (c >= '0' && c <= '9')
3621 for (i = 0; i < ((c - '0') + 1); i++)
3623 mac = cstring_appendChar (mac, ' ');
3631 while (((c = macro_nextCharC ()) != '\0') && (c != '\n'))
3633 mac = cstring_appendChar (mac, c);
3637 macrocode = tokenMacroCode (mac);
3639 if (macrocode == BADTOK && !isArtificial (mac))
3641 DPRINTF (("Add macro: %s", mac));
3642 context_addMacroCache (mac);
3651 context_incLineno ();
3655 static bool processMacro (void)
3660 cstring fname = cstring_undefined;
3662 bool isspecfcn = FALSE;
3663 bool isiter = FALSE;
3664 bool skipparam = FALSE;
3665 bool isenditer = FALSE;
3666 bool unknownm = FALSE;
3667 bool hasParams = FALSE;
3668 bool emptyMacro = FALSE;
3669 char c = skip_whitespace ();
3670 fileloc loc = fileloc_noColumn (g_currentloc);
3672 /* are both of these necessary? what do they mean? */
3673 uentryList specparams = uentryList_undefined;
3674 uentryList pn = uentryList_undefined;
3676 context_resetMacroMissingParams ();
3678 if (c == '\0' || c == '\n')
3680 llcontbug (cstring_makeLiteral ("Bad macro"));
3685 fname = cstring_appendChar (fname, c);
3687 while ((c = macro_nextChar ()) != '(' && c != '\0'
3688 && c != ' ' && c != '\t' && c != '\n')
3690 fname = cstring_appendChar (fname, c);
3693 if (c == ' ' || c == '\t' || c == '\n')
3699 while (c == ' ' || c == '\t')
3701 c = macro_nextChar ();
3715 hasParams = (c == '(');
3718 if (usymtab_exists (fname))
3720 e2 = usymtab_lookupExpose (fname);
3721 ct = uentry_getType (e2);
3724 if (uentry_isCodeDefined (e2)
3725 && fileloc_isUser (uentry_whereDefined (e2)))
3729 message ("Macro %s already defined", fname),
3732 uentry_showWhereDefined (e2);
3733 uentry_clearDefined (e2);
3736 if (uentry_isFunction (e2))
3738 uentry_setType (e2, ctype_unknown);
3741 context_enterUnknownMacro (e2);
3745 context_enterConstantMacro (e2);
3750 if (uentry_isForward (e2) && uentry_isFunction (e2))
3757 ("Parameterized macro has no prototype or specification: %s ",
3762 uentry_setType (e2, ctype_unknown);
3763 uentry_setFunctionDefined (e2, loc);
3764 uentry_setUsed (e2, fileloc_undefined);
3765 context_enterUnknownMacro (e2);
3769 if (uentry_isIter (e2))
3772 specparams = uentry_getParams (e2);
3773 noparams = uentryList_size (specparams);
3774 uentry_setDefined (e2, loc);
3775 context_enterIterDef (e2);
3777 else if (uentry_isEndIter (e2))
3780 uentry_setDefined (e2, loc);
3781 context_enterIterEnd (e2); /* don't care about it now */
3782 /* but should parse like an iter! */
3784 else if (uentry_isConstant (e2))
3790 message ("Constant %s implemented as parameterized macro",
3794 uentry_showWhereSpecified (e2);
3795 uentry_setType (e2, ctype_unknown);
3796 uentry_makeVarFunction (e2);
3797 uentry_setDefined (e2, g_currentloc);
3798 uentry_setFunctionDefined (e2, g_currentloc);
3799 context_enterUnknownMacro (e2);
3803 if (!uentry_isSpecified (e2))
3805 fileloc oloc = uentry_whereDeclared (e2);
3807 if (fileloc_isLib (oloc))
3811 else if (fileloc_isUndefined (oloc)
3812 || fileloc_isPreproc (oloc))
3817 (FLG_MACROCONSTDECL,
3819 ("Macro constant %q not declared",
3820 uentry_getName (e2)),
3824 else if (!fileloc_withinLines (oloc, loc, 2))
3825 { /* bogus! will give errors if there is too much whitespace */
3829 ("Macro constant name %s does not match name in "
3830 "previous constant declaration. This constant "
3831 "is declared at %q", fname,
3832 fileloc_unparse (oloc)),
3837 context_enterConstantMacro (e2);
3838 cstring_free (fname);
3844 else if (ctype_isFunction (ct))
3847 specparams = ctype_argsFunction (ct);
3848 noparams = uentryList_size (specparams);
3850 uentry_setFunctionDefined (e2, loc);
3851 context_enterMacro (e2);
3853 else if (uentry_isVar (e2))
3859 message ("Variable %s implemented as parameterized macro",
3863 uentry_showWhereSpecified (e2);
3864 uentry_setType (e2, ctype_unknown);
3865 uentry_makeVarFunction (e2);
3866 uentry_setDefined (e2, g_currentloc);
3867 uentry_setFunctionDefined (e2, g_currentloc);
3868 context_enterUnknownMacro (e2);
3872 uentry ucons = uentry_makeConstant (fname,
3875 if (uentry_isExpandedMacro (e2))
3883 message ("Variable %s implemented by a macro",
3887 uentry_showWhereSpecified (e2);
3891 uentry_setDefined (e2, loc);
3892 uentry_setUsed (ucons, loc);
3894 context_enterConstantMacro (ucons);
3895 uentry_markOwned (ucons);
3896 cstring_free (fname);
3902 if (uentry_isDatatype (e2))
3906 message ("Type implemented as macro: %x",
3907 uentry_getName (e2)),
3908 message ("A type is implemented using a macro definition. A "
3909 "typedef should be used instead."),
3913 /* Must exit scope (not sure why a new scope was entered?) */
3914 usymtab_quietExitScope (g_currentloc);
3915 uentry_setDefined (e2, g_currentloc);
3921 (message ("Unexpanded macro not function or constant: %q",
3922 uentry_unparse (e2)));
3923 uentry_setType (e2, ctype_unknown);
3927 uentry_makeVarFunction (e2);
3928 uentry_setDefined (e2, g_currentloc);
3929 uentry_setFunctionDefined (e2, g_currentloc);
3930 context_enterUnknownMacro (e2);
3942 (FLG_MACROMATCHNAME,
3943 message ("Unexpanded macro %s does not match name of a constant "
3944 "or iter declaration. The name used in the control "
3945 "comment on the previous line should match. "
3946 "(Assuming macro defines a constant.)",
3951 ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined);
3952 uentry_setUsed (ce, loc); /* perhaps bogus? */
3953 e2 = usymtab_supEntryReturn (ce);
3955 context_enterConstantMacro (e2);
3956 cstring_free (fname);
3961 /* in macros, ( must follow immediatetly after name */
3967 c = skip_whitespace ();
3969 while (c != ')' && c != '\0')
3972 bool suppress = context_inSuppressRegion ();
3973 cstring paramname = cstring_undefined;
3976 ** save the parameter location
3980 context_saveLocation ();
3983 while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')')
3985 paramname = cstring_appendChar (paramname, c);
3986 c = macro_nextChar ();
3989 if (c == ' ' || c == '\t') c = skip_whitespace ();
3993 c = macro_nextChar ();
3994 if (c == ' ' || c == '\t') c = skip_whitespace ();
3999 llfatalerror (cstring_makeLiteral
4000 ("Bad macro syntax: uentryList"));
4003 if ((isspecfcn || isiter) && (paramno < noparams)
4004 && !uentry_isElipsisMarker (uentryList_getN
4005 (specparams, paramno)))
4007 uentry decl = uentryList_getN (specparams, paramno);
4010 param = uentry_nameCopy (paramname, decl);
4013 uentry_setParam (param);
4014 sr = sRef_makeParam (paramno, uentry_getType (param));
4016 if (sRef_getNullState (sr) == NS_ABSNULL)
4018 ctype pt = ctype_realType (uentry_getType (param));
4020 if (ctype_isUser (pt))
4022 uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt));
4024 if (uentry_isValid (te))
4026 sRef_setStateFromUentry (sr, te);
4031 sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
4035 uentry_setSref (param, sr);
4036 uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
4038 skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
4042 fileloc sloc = context_getSaveLocation ();
4044 param = uentry_makeVariableSrefParam
4045 (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
4046 cstring_free (paramname);
4048 sRef_setPosNull (uentry_getSref (param), sloc);
4050 uentry_setDeclaredForce (param, sloc);
4053 fileloc_free (sloc);
4058 llassert (!uentry_isElipsisMarker (param));
4062 sRef_makeUnsafe (uentry_getSref (param));
4065 pn = uentryList_add (pn, uentry_copy (param));
4066 usymtab_supEntry (param);
4070 /* don't add param */
4071 uentry_free (param);
4076 (void) macro_nextChar ();
4077 c = skip_whitespace ();
4085 if (isspecfcn || isiter)
4087 if (paramno != noparams && noparams >= 0)
4093 message ("Macro %s specified with %d args, defined with %d",
4094 fname, noparams, paramno),
4097 uentry_showWhereSpecified (e2);
4098 uentry_resetParams (e2, pn);
4103 uentry_resetParams (e2, pn);
4110 ** the form should be:
4112 ** # define newname oldname
4113 ** where oldname refers to a function matching the specification
4119 sRef_setGlobalScope ();
4120 usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown));
4121 sRef_clearGlobalScope ();
4125 context_setMacroMissingParams ();
4130 /* context_setuentryList (pn); */
4131 usymtab_enterScope ();
4134 cstring_free (fname);
4139 static bool handleSpecial (char *yyt)
4141 char *l = mstring_create (MAX_NAME_LENGTH);
4142 static bool reportcpp = FALSE;
4148 strcpy (l, yyt + 1);
4150 /* Need to safe original l for deallocating. */
4153 l += strlen (yyt) - 1;
4155 while ((c = char_fromInt (lminput ())) != '\n' && c != '\0')
4161 olc = cstring_fromChars (ol);
4163 if (cstring_equalPrefix (olc, "pragma"))
4165 char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN));
4166 char *opname = pname;
4167 char *ptr = ol + 6; /* pragma is six characters, plus space */
4171 /* skip whitespace */
4172 while (((c = *ptr) != '\0') && isspace (c))
4178 while (((c = *ptr) != '\0') && !isspace (c))
4182 if (len > MAX_PRAGMA_LEN)
4193 if (len == PRAGMA_LEN_EXPAND
4194 && mstring_equal (opname, PRAGMA_EXPAND))
4196 cstring exname = cstring_undefined;
4200 while (((c = *ptr) != '\0') && !isspace (c))
4202 exname = cstring_appendChar (exname, c);
4207 ue = usymtab_lookupExposeGlob (exname);
4209 if (uentry_isExpandedMacro (ue))
4211 if (fileloc_isPreproc (uentry_whereDefined (ue)))
4213 fileloc_setColumn (g_currentloc, 1);
4214 uentry_setDefined (ue, g_currentloc);
4218 cstring_free (exname);
4221 else if (cstring_equalPrefix (olc, "ident"))
4223 /* Some pre-processors will leave these in the code. Ignore rest of line */
4226 ** Yuk...Win32 filenames can have spaces in them...we need to read
4227 ** to the matching end quote.
4229 else if ((sscanf (ol, "line %d \"", &lineno) == 1)
4230 || (sscanf (ol, " %d \"", &lineno) == 1))
4236 while (*tmp != '\"' && *tmp != '\0')
4241 llassert (*tmp == '\"');
4246 while (*tmp != '\"' && *tmp != '\0')
4251 llassert (*tmp == '\"');
4255 DPRINTF (("fname: %s", fname));
4257 # if defined(OS2) || defined(MSDOS) || defined(WIN32)
4260 ** DOS-like path delimiters get delivered in pairs, something like
4261 ** \"..\\\\file.h\", so we have to make it normal again. We do NOT
4262 ** remove the pre dirs yet as we usually specify tmp paths relative
4263 ** to the current directory, so tmp files would not get found in
4264 ** the hash table. If this method fails we try it again later.
4271 ** Skip past the drive marker.
4274 DPRINTF (("stmp: %s / %s", stmp, fname));
4276 if (strchr (stmp, ':') != NULL)
4278 stmp = strchr (stmp, ':') + 1;
4281 DPRINTF (("stmp: %s / %s", stmp, fname));
4283 while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL )
4285 if (*(stmp+1) == CONNECTCHAR)
4287 memmove (stmp, stmp+1, strlen (stmp));
4291 DPRINTF (("stmp: %s / %s", stmp, fname));
4294 DPRINTF (("Now: base = %s", fname));
4296 fid = fileTable_lookupBase (context_fileTable (),
4297 cstring_fromChars (fname));
4298 if (!(fileId_isValid (fid)))
4300 fname = removePreDirs (fname);
4301 fid = fileTable_lookupBase (context_fileTable (),
4302 cstring_fromChars (fname));
4305 # else /* !defined(OS2) && !defined(MSDOS) */
4306 fname = removePreDirs (fname);
4307 fid = fileTable_lookupBase (context_fileTable (),
4308 cstring_fromChars (fname));
4309 # endif /* !defined(OS2) && !defined(MSDOS) */
4311 if (!(fileId_isValid (fid)))
4313 if (isHeaderFile (cstring_fromChars (fname)))
4315 fid = fileTable_addHeaderFile (context_fileTable (),
4316 cstring_fromChars (fname));
4320 fid = fileTable_addFile (context_fileTable (),
4321 cstring_fromChars (fname));
4325 setFileLine (fid, lineno);
4327 else if ((sscanf (ol, "line %d", &lineno) == 1)
4328 || (sscanf (ol, " %d", &lineno) == 1))
4330 setLine (lineno); /* next line is <cr> */
4336 llerror (FLG_SYNTAX,
4337 message ("File contains preprocessor command: #%s. "
4338 "Check LCLINT_CPPCMD environment variable. "
4339 "(Further instances unreported)",
4340 cstring_fromChars (ol)));
4352 static int handleLlSpecial ()
4356 char *s = mstring_createEmpty ();
4360 bool isstart = FALSE;
4362 while (((ic = ninput ()) != 0) && isalpha (ic))
4365 s = mstring_append (s, c);
4371 if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0])
4375 llassert (ic == AFTER_COMMENT_MARKER[1]);
4378 if (isProcessingGlobMods () && (*s == '\0'))
4381 return QNOMODS; /* special token no modifications token */
4389 tok = commentMarkerToken (cstring_fromChars (os));
4393 tokLength = charsread;
4399 /* Add rest of the comment */
4401 if (ic != 0 && ic != EOF)
4406 s = mstring_append (s, c);
4409 while (((ic = ninput ()) != 0) && (ic != EOF)
4410 && (ic != AFTER_COMMENT_MARKER[0]))
4413 s = mstring_append (s, c);
4418 if (ic == AFTER_COMMENT_MARKER[0])
4421 llassert ((char) nc == AFTER_COMMENT_MARKER[1]);
4428 while (*s == ' ' || *s == '\t' || *s == '\n')
4433 if (*s == '-' || *s == '+' || *s == '=') /* setting flags */
4437 while (c == '-' || c == '+' || c == '=')
4439 ynm set = ynm_fromCodeChar (c);
4444 thisflag = cstring_fromChars (s);
4446 while ((c = *s) != '\0' && (c != '-') && (c != '=')
4447 && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n'))
4454 if (!context_getFlag (FLG_NOCOMMENTS))
4456 cstring flagname = thisflag;
4457 flagcode fflag = identifyFlag (flagname);
4459 if (flagcode_isSkip (fflag))
4463 else if (flagcode_isInvalid (fflag))
4465 if (isMode (flagname))
4467 if (ynm_isMaybe (set))
4472 ("Stylized comment attempts to restore flag %s. "
4473 "A mode flag cannot be restored.",
4478 context_setMode (flagname);
4485 message ("Unrecognized option in stylized comment: %s",
4489 else if (flagcode_isGlobalFlag (fflag))
4494 ("Stylized comment attempts to set global flag %s. "
4495 "A global flag cannot be set locally.",
4500 context_fileSetFlag (fflag, set);
4502 if (flagcode_hasArgument (fflag))
4504 if (ynm_isMaybe (set))
4509 ("Stylized comment attempts to restore flag %s. "
4510 "A flag for setting a value cannot be restored.",
4514 { /* cut-and-pastied from llmain...blecch */
4515 cstring extra = cstring_undefined;
4521 rest = mstring_copy (s);
4525 while ((rchar = *rest) != '\0'
4526 && (isspace (rchar)))
4532 while ((rchar = *rest) != '\0'
4533 && !isspace (rchar))
4535 extra = cstring_appendChar (extra, rchar);
4542 if (cstring_isUndefined (extra))
4547 ("Flag %s (in stylized comment) must be followed by an argument",
4548 flagcode_unparse (fflag)));
4554 if (flagcode_hasValue (fflag))
4556 setValueFlag (fflag, extra);
4558 else if (flagcode_hasString (fflag))
4560 setStringFlag (fflag, extra);
4576 while ((c == ' ') || (c == '\t') || (c == '\n'))
4582 if (context_inHeader () && !isArtificial (cstring_fromChars (os)))
4584 context_addComment (cstring_fromCharsNew (os));
4597 while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n')
4609 t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t)));
4610 macrocode = tokenMacroCode (cstring_fromChars (t));
4612 if (macrocode != BADTOK)
4614 tokLength = mstring_length (t);
4620 if (macrocode == SKIPTOK)
4628 if (context_inHeader ())
4635 if ((context_inMacro () || context_inGlobalContext ())
4636 && macrocode != SKIPTOK
4637 && !isArtificial (cstring_fromChars (os)))
4639 context_addComment (cstring_fromCharsNew (os));
4652 if (mstring_equal (t, "ignore"))
4654 if (!context_getFlag (FLG_NOCOMMENTS))
4656 context_enterSuppressRegion ();
4659 else if ((*t == 'i' || *t == 't')
4660 && (*(t + 1) == '\0'))
4662 if (!context_getFlag (FLG_NOCOMMENTS)
4663 && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS)))
4665 context_enterSuppressLine (-1); /* infinite suppression */
4668 else if (((*t == 'i') || (*t == 't'))
4669 && ((*(t + 1) >= '0' && *(t + 1) <= '9')))
4671 bool tmpcomment = (*t == 't');
4673 char *tt = t; /* don't mangle t, since it is free'd */
4676 if (lc >= '0' && lc <= '9')
4678 val = (int)(lc - '0');
4681 while (lc >= '0' && lc <= '9')
4690 if (!context_getFlag (FLG_NOCOMMENTS)
4691 && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS)))
4693 context_enterSuppressLine (val);
4696 else if (mstring_equal (t, "end"))
4698 if (!context_getFlag (FLG_NOCOMMENTS))
4700 context_exitSuppressRegion ();
4703 else if (mstring_equal (t, "notfunction"))
4705 ; /* handled by pcpp */
4707 else if (mstring_equal (t, "access"))
4713 while ((c = *s) && (c == ' ' || c == '\t' || c == '\n'))
4723 tname = cstring_fromChars (s);
4725 while ((c = *s) != '\0' && c != ' '
4726 && c != '\t' && c != '\n' && c != ',')
4734 if (!context_getFlag (FLG_NOCOMMENTS)
4735 && !context_getFlag (FLG_NOACCESS))
4737 if (usymtab_existsType (tname))
4739 usymId uid = usymtab_getTypeId (tname);
4741 context_addFileAccessType (uid);
4745 if (!(context_inSuppressRegion ()
4746 || context_inSuppressZone (g_currentloc)))
4750 ("%q: Unrecognized type %s used in access comment",
4751 fileloc_unparse (g_currentloc), tname));
4761 if (c != ',' && c != ' ')
4767 else if (mstring_equal (t, "noaccess"))
4774 while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n'))
4784 tname = cstring_fromChars (s);
4786 while ((lc = *s) != '\0' && lc != ' ' && lc != '\t'
4787 && lc != '\n' && lc != ',')
4794 if (!context_getFlag (FLG_NOCOMMENTS)
4795 && !context_getFlag (FLG_NOACCESS))
4797 if (usymtab_existsType (tname))
4799 typeId tuid = usymtab_getTypeId (tname);
4801 if (context_couldHaveAccess (tuid))
4803 context_removeFileAccessType (tuid);
4807 if (!(context_inSuppressRegion ()
4808 || context_inSuppressZone (g_currentloc)))
4810 uentry ue = usymtab_getTypeEntry (tuid);
4812 if (uentry_isAbstractDatatype (ue))
4816 ("%q: Non-accessible abstract type %s used in noaccess comment",
4817 fileloc_unparse (g_currentloc), tname));
4823 ("%q: Non-abstract type %s used in noaccess comment",
4824 fileloc_unparse (g_currentloc), tname));
4831 if (!(context_inSuppressRegion ()
4832 || context_inSuppressZone (g_currentloc)))
4836 ("%q: Unrecognized type %s used in noaccess comment",
4837 fileloc_unparse (g_currentloc), tname));
4847 if (lc != ',' && lc != ' ')
4855 setTokLength (- (2 + charsread));
4857 voptgenerror (FLG_UNRECOGCOMMENTS,
4858 message ("Stylized comment unrecognized: %s",
4859 cstring_fromChars (os)),
4870 static /*@only@*/ cstring makeIdentifier (char *s)
4872 char *c = mstring_create (size_toInt (strlen (s)) + 1);
4873 cstring id = cstring_fromChars (c);
4875 while (isalnum (*s) || (*s == '_') || (*s == '$'))
4884 /*@observer@*/ /*@dependent@*/ uentry coerceId (ctype c)
4886 cstring cn = LastIdentifier ();
4889 if (!(usymtab_exists (cn)))
4891 if (ctype_isUnknown (c))
4894 fileloc loc = fileloc_createExternal ();
4895 bool infunc = sRef_modInFunction ();
4899 sRef_setGlobalScope ();
4902 ce = uentry_makeVariableLoc (cn, c);
4903 uentry_setDefined (ce, loc);
4906 if (!context_inIterEnd ())
4910 message ("Unrecognized (possibly system) identifier: %q",
4911 uentry_getName (ce)),
4912 uentry_whereLast (ce));
4915 uentry_setHasNameError (ce);
4916 ce = usymtab_supReturnFileEntry (ce);
4920 sRef_clearGlobalScope ();
4925 llcontbug (message ("coerceId: bad call: %t", c));
4926 return (uentry_makeVariableLoc (cn, ctype_unknown));
4930 return (usymtab_lookup (cn));
4934 ** like, coerceId, but doesn't supercede for iters
4937 /*@observer@*/ uentry coerceIterId (ctype c)
4939 cstring cn = LastIdentifier ();
4941 if (!(usymtab_exists (cn)))
4943 if (ctype_isUnknown (c))
4945 return uentry_undefined;
4949 llcontbug (message ("coerceId: bad call: %t", c));
4950 return (uentry_makeVariableLoc (cn, ctype_unknown));
4954 return (usymtab_lookup (cn));
4957 /*@observer@*/ cstring LastIdentifier ()
4959 return (lastidprocessed);
4962 static int processIdentifier (cstring id)
4966 context_clearJustPopped ();
4967 lastidprocessed = id;
4969 if (context_inFunctionDecl ())
4971 int tok = commentMarkerToken (id);
4979 tok = tokenMacroCode (id);
4988 if (context_getFlag (FLG_GNUEXTENSIONS))
4992 if (cstring_equalLit (id, "__stdcall")
4993 || cstring_equalLit (id, "__cdecl"))
4997 else if (cstring_equalLit (id, "__volatile__"))
5001 else if (cstring_equalLit (id, "__signed"))
5005 else if (cstring_equalLit (id, "__unsigned"))
5009 else if (cstring_equalLit (id, "__const__"))
5013 else if (cstring_equalLit (id, "__attribute__")
5014 || cstring_equalLit (id, "__extension__")
5015 || cstring_equalLit (id, "__asm__")
5016 || cstring_equalLit (id, "_asm")
5017 || cstring_equalLit (id, "__asm")
5018 || cstring_equalLit (id, "__declspec"))
5021 bool useparens = FALSE;
5022 bool usebraces = FALSE;
5023 bool inquote = FALSE;
5024 bool inescape = FALSE;
5027 while ((ic = input ()) != EOF)
5034 else if (ic == '\\')
5038 else if (ic == '\"')
5074 else if (ic == ')' && useparens)
5077 if (depth == 0) break;
5079 else if (ic == '}' && usebraces)
5082 if (depth == 0) break;
5085 && !usebraces && !useparens
5086 && cstring_equalLit (id, "__asm"))
5089 ** We need this because some MS VC++ include files
5090 ** have __asm mov ... }
5091 ** Its a kludge, but otherwise would need to parse
5100 context_incLineno ();
5102 if (cstring_equalLit (id, "__asm")
5103 && !useparens && !usebraces)
5110 llassert ((useparens && ic == ')')
5111 || (usebraces && ic == '}')
5112 || (!useparens && !usebraces));
5114 if (cstring_equalLit (id, "__extension__"))
5124 else if (cstring_equalLit (id, "inline")
5125 || cstring_equalLit (id, "__inline")
5126 || cstring_equalLit (id, "_inline")
5127 || cstring_equalLit (id, "__inline__"))
5138 le = usymtab_lookupSafe (id);
5140 /*@-dependenttrans@*/
5142 if (uentry_isIter (le))
5147 else if (uentry_isEndIter (le))
5150 return (ITER_ENDNAME);
5152 else if (uentry_isUndefined (le))
5156 /* avoid parse errors for certain system built ins */
5158 if (g_expectingTypeName && (cstring_firstChar (id) == '_')
5159 && (cstring_secondChar (id) == '_'))
5161 yylval.ctyp = ctype_unknown;
5162 return (TYPE_NAME_OR_ID);
5165 return (NEW_IDENTIFIER);
5167 else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le))
5169 if (uentry_isDatatype (le))
5172 return (NEW_IDENTIFIER);
5177 return (IDENTIFIER);
5180 else if (uentry_isDatatype (le))
5182 if (!g_expectingTypeName)
5186 return (NEW_IDENTIFIER);
5190 yylval.ctyp = uentry_getAbstractType (le);
5192 uentry_setUsed (le, g_currentloc);
5199 return (IDENTIFIER);
5202 /*@=dependenttrans@*/
5205 static bool processHashIdentifier (/*@only@*/ cstring id)
5207 if (context_inMacro () || context_inIterDef () ||
5208 context_inIterEnd ())
5212 context_clearJustPopped ();
5214 lastidprocessed = id;
5215 le = usymtab_lookupSafe (id);
5217 if (uentry_isParam (le) || uentry_isRefParam (le))
5234 static /*@only@*/ exprNode processString ()
5238 char *nl = strchr (yytext, '\n');
5239 cstring ns = cstring_fromCharsNew (yytext);
5243 loc = fileloc_copy (g_currentloc);
5244 addColumn (cstring_length (ns));
5250 loc = fileloc_copy (g_currentloc);
5252 context_incLineno ();
5254 while ((nl = strchr ((nl + 1), '\n')) != NULL)
5256 context_incLineno ();
5262 res = exprNode_stringLiteral (ns, loc);
5272 llassert (*yytext != '\0');
5273 fchar = *(yytext + 1);
5274 if (fchar != '\\') return fchar;
5276 next = *(yytext + 2);
5280 case 'n': return '\n';
5281 case 't': return '\t';
5282 case '\"': return '\"';
5283 case '\'': return '\'';
5284 case '\\': return '\\';
5285 default: return '\0';
5290 double processFloat ()
5292 double ret = atof (yytext);
5300 llassert (yytext[0] == '0'
5301 && (yytext[1] == 'X' || yytext[1] == 'x'));
5304 ** Note: this does not get the correct value, but we only care
5305 ** is it is non-zero.
5308 return (atol (yytext + 2));
5314 return (atol (yytext));
5318 processSpec (int tok)
5320 size_t length = strlen (yytext);
5325 setTokLengthT (length);
5331 context_saveLocation ();
5332 setTokLengthT (length);
5333 return (processIdentifier (makeIdentifier (yytext)));