1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
27 /* Use prototypes in function declarations. */
30 /* The "const" storage-class-modifier is valid. */
33 #else /* ! __cplusplus */
41 #endif /* ! __cplusplus */
60 #define YY_PROTO(proto) proto
62 #define YY_PROTO(proto) ()
65 /* Returned upon end-of-file. */
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
75 /* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
79 #define BEGIN yy_start = 1 + 2 *
81 /* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
94 #define YY_END_OF_BUFFER_CHAR 0
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
102 extern FILE *yyin, *yyout;
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
108 /* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
112 * if ( condition_holds )
115 * do_something_else();
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
122 /* Return all but the first 'n' matched characters back to the input stream. */
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
135 #define unput(c) yyunput( c, yytext_ptr )
137 /* The following is because we cannot portably get our hands on size_t
138 * (without autoconf's help, which isn't available because we want
139 * flex-generated scanners to compile on their own).
141 typedef unsigned int yy_size_t;
144 struct yy_buffer_state
148 char *yy_ch_buf; /* input buffer */
149 char *yy_buf_pos; /* current position in input buffer */
151 /* Size of input buffer in bytes, not including room for EOB
154 yy_size_t yy_buf_size;
156 /* Number of characters read into yy_ch_buf, not including EOB
161 /* Whether we "own" the buffer - i.e., we know we created it,
162 * and can realloc() it to grow it, and should free() it to
165 int yy_is_our_buffer;
167 /* Whether this is an "interactive" input source; if so, and
168 * if we're using stdio for input, then we want to use getc()
169 * instead of fread(), to make sure we stop fetching input after
172 int yy_is_interactive;
174 /* Whether we're considered to be at the beginning of a line.
175 * If so, '^' rules will be active on the next match, otherwise
180 /* Whether to try to fill the input buffer when we reach the
185 int yy_buffer_status;
186 #define YY_BUFFER_NEW 0
187 #define YY_BUFFER_NORMAL 1
188 /* When an EOF's been seen but there's still some text to process
189 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
190 * shouldn't try reading from the input source any more. We might
191 * still have a bunch of tokens to match, though, because of
192 * possible backing-up.
194 * When we actually see the EOF, we change the status to "new"
195 * (via yyrestart()), so that the user can continue scanning by
196 * just pointing yyin at a new input file.
198 #define YY_BUFFER_EOF_PENDING 2
201 static YY_BUFFER_STATE yy_current_buffer = 0;
203 /* We provide macros for accessing buffer states in case in the
204 * future we want to put the buffer states in a more general
207 #define YY_CURRENT_BUFFER yy_current_buffer
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
213 static int yy_n_chars; /* number of characters read into yy_ch_buf */
218 /* Points to current character in buffer. */
219 static char *yy_c_buf_p = (char *) 0;
220 static int yy_init = 1; /* whether we need to initialize */
221 static int yy_start = 0; /* start state number */
223 /* Flag which is used to allow yywrap()'s to do buffer switches
224 * instead of setting up a fresh yyin. A bit of a hack ...
226 static int yy_did_buffer_switch_on_eof;
228 void yyrestart YY_PROTO(( FILE *input_file ));
230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
231 void yy_load_buffer_state YY_PROTO(( void ));
232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
242 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
244 static void yy_flex_free YY_PROTO(( void * ));
246 #define yy_new_buffer yy_create_buffer
248 #define yy_set_interactive(is_interactive) \
250 if ( ! yy_current_buffer ) \
251 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
252 yy_current_buffer->yy_is_interactive = is_interactive; \
255 #define yy_set_bol(at_bol) \
257 if ( ! yy_current_buffer ) \
258 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
259 yy_current_buffer->yy_at_bol = at_bol; \
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
264 typedef unsigned char YY_CHAR;
265 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
266 typedef int yy_state_type;
268 #define yytext_ptr yytext
270 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
271 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
272 static int yy_get_next_buffer YY_PROTO(( void ));
273 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
275 /* Done after the current pattern has been matched and before the
276 * corresponding action - sets up yytext.
278 #define YY_DO_BEFORE_ACTION \
279 yytext_ptr = yy_bp; \
280 yyleng = (int) (yy_cp - yy_bp); \
281 yy_hold_char = *yy_cp; \
285 #define YY_NUM_RULES 180
286 #define YY_END_OF_BUFFER 181
287 static yyconst short int yy_accept[529] =
289 0, 0, 181, 179, 159, 160, 147, 179, 3, 82,
290 153, 146, 179, 141, 142, 151, 150, 138, 149, 145,
291 152, 97, 97, 139, 135, 154, 140, 155, 158, 179,
292 82, 143, 178, 144, 156, 82, 82, 82, 82, 82,
293 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
294 82, 82, 82, 82, 82, 82, 136, 157, 137, 148,
295 134, 0, 42, 0, 2, 82, 120, 176, 177, 129,
296 121, 0, 0, 118, 126, 116, 127, 117, 128, 0,
297 110, 1, 119, 113, 90, 0, 99, 98, 0, 97,
298 125, 131, 133, 132, 124, 0, 0, 0, 82, 122,
300 82, 82, 82, 82, 82, 82, 82, 82, 9, 82,
301 82, 82, 82, 82, 82, 82, 13, 44, 82, 82,
302 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
303 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
304 82, 82, 82, 82, 82, 82, 123, 130, 0, 0,
305 2, 104, 4, 0, 108, 109, 110, 0, 111, 112,
306 92, 91, 0, 107, 100, 101, 101, 83, 115, 114,
307 166, 167, 164, 169, 174, 165, 175, 170, 173, 168,
308 171, 172, 0, 0, 82, 82, 82, 82, 82, 82,
309 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
311 82, 82, 11, 82, 82, 27, 82, 82, 82, 82,
312 82, 82, 82, 82, 82, 82, 43, 82, 82, 82,
313 82, 82, 82, 74, 82, 82, 82, 82, 82, 82,
314 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
315 82, 82, 82, 82, 82, 0, 42, 0, 0, 110,
316 0, 108, 109, 0, 113, 93, 94, 94, 105, 106,
317 103, 102, 84, 86, 163, 0, 0, 82, 82, 82,
318 82, 39, 82, 6, 29, 82, 82, 82, 82, 82,
319 82, 10, 25, 82, 82, 82, 82, 12, 82, 82,
320 82, 51, 82, 31, 82, 82, 52, 82, 82, 68,
322 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
323 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
324 82, 82, 82, 82, 82, 26, 82, 82, 82, 0,
325 110, 96, 95, 85, 87, 87, 0, 162, 82, 82,
326 82, 82, 5, 82, 36, 82, 82, 82, 82, 82,
327 82, 82, 30, 82, 82, 82, 82, 82, 82, 82,
328 82, 82, 82, 69, 82, 82, 82, 82, 82, 82,
329 82, 32, 82, 82, 82, 82, 82, 82, 82, 82,
330 82, 82, 77, 24, 82, 82, 82, 82, 82, 18,
331 76, 89, 88, 161, 82, 80, 82, 82, 82, 82,
333 82, 82, 82, 28, 82, 38, 82, 21, 82, 54,
334 78, 82, 60, 82, 82, 82, 82, 82, 82, 82,
335 58, 82, 14, 75, 34, 15, 82, 41, 22, 17,
336 82, 82, 82, 82, 82, 72, 19, 20, 82, 81,
337 37, 47, 64, 82, 82, 8, 82, 59, 82, 82,
338 82, 62, 53, 82, 82, 82, 45, 82, 82, 57,
339 82, 46, 61, 82, 23, 82, 82, 82, 82, 65,
340 7, 82, 73, 82, 82, 82, 70, 16, 82, 40,
341 82, 55, 82, 33, 35, 82, 71, 56, 82, 82,
342 82, 82, 67, 82, 82, 82, 82, 63, 82, 82,
344 82, 82, 82, 82, 82, 82, 48, 82, 82, 82,
345 66, 82, 82, 82, 79, 82, 82, 82, 82, 82,
346 82, 82, 82, 50, 82, 82, 49, 0
349 static yyconst int yy_ec[256] =
351 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
352 4, 4, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
354 1, 2, 5, 6, 7, 8, 9, 10, 11, 12,
355 13, 14, 15, 16, 17, 18, 19, 20, 21, 21,
356 21, 21, 21, 21, 21, 21, 21, 22, 23, 24,
357 25, 26, 27, 28, 29, 30, 31, 30, 32, 33,
358 34, 8, 8, 8, 35, 36, 37, 8, 8, 8,
359 38, 39, 40, 41, 42, 8, 43, 44, 8, 45,
360 46, 47, 48, 49, 50, 1, 51, 52, 53, 54,
362 55, 56, 57, 58, 59, 8, 60, 61, 62, 63,
363 64, 65, 8, 66, 67, 68, 69, 70, 71, 72,
364 73, 74, 75, 76, 77, 78, 1, 1, 1, 1,
365 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
366 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
367 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
368 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
369 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
370 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
371 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
373 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
374 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381 static yyconst int yy_meta[79] =
383 1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
384 3, 1, 1, 1, 1, 1, 1, 1, 1, 4,
385 4, 1, 1, 1, 1, 1, 1, 1, 5, 5,
386 5, 5, 5, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 1, 1, 1, 1, 2,
388 5, 5, 5, 5, 5, 5, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 1, 1, 1, 1
393 static yyconst short int yy_base[536] =
395 0, 0, 678, 679, 679, 679, 652, 73, 0, 0,
396 55, 71, 629, 679, 679, 650, 67, 679, 68, 66,
397 74, 80, 85, 679, 679, 65, 649, 82, 679, 91,
398 622, 679, 679, 679, 647, 621, 28, 604, 67, 40,
399 65, 72, 605, 88, 55, 604, 79, 101, 616, 611,
400 103, 90, 602, 51, 606, 604, 679, 113, 679, 679,
401 679, 133, 163, 659, 0, 0, 679, 679, 679, 679,
402 679, 100, 139, 679, 679, 679, 679, 679, 679, 643,
403 155, 679, 679, 162, 172, 164, 160, 142, 0, 204,
404 635, 679, 679, 679, 634, 245, 621, 621, 584, 679,
406 602, 581, 585, 597, 584, 122, 587, 141, 580, 581,
407 578, 144, 585, 581, 578, 575, 0, 99, 579, 586,
408 579, 576, 567, 569, 575, 568, 578, 572, 564, 568,
409 564, 174, 573, 135, 158, 573, 154, 568, 564, 556,
410 559, 184, 573, 167, 563, 566, 679, 679, 242, 153,
411 0, 679, 679, 235, 679, 679, 251, 243, 679, 679,
412 233, 230, 241, 272, 165, 679, 234, 261, 679, 679,
413 679, 579, 679, 679, 679, 679, 679, 679, 679, 679,
414 679, 679, 580, 581, 228, 553, 548, 551, 563, 558,
415 546, 558, 231, 559, 554, 556, 552, 544, 541, 549,
417 536, 551, 0, 537, 541, 544, 529, 532, 535, 538,
418 528, 530, 531, 536, 523, 516, 0, 533, 519, 533,
419 526, 246, 515, 0, 517, 516, 518, 525, 526, 510,
420 508, 508, 510, 519, 518, 514, 516, 506, 510, 501,
421 203, 513, 515, 504, 503, 271, 308, 560, 295, 299,
422 306, 679, 679, 304, 316, 262, 679, 277, 679, 679,
423 679, 679, 298, 281, 679, 534, 522, 505, 504, 495,
424 484, 0, 496, 0, 0, 495, 486, 494, 483, 488,
425 489, 0, 0, 482, 482, 492, 478, 0, 482, 487,
426 482, 0, 284, 0, 487, 472, 472, 473, 483, 0,
428 483, 477, 471, 467, 478, 463, 465, 475, 461, 473,
429 463, 467, 466, 471, 470, 456, 458, 466, 464, 462,
430 454, 459, 460, 448, 460, 0, 444, 456, 456, 323,
431 325, 679, 679, 287, 679, 305, 481, 679, 457, 439,
432 439, 440, 0, 292, 0, 441, 442, 448, 446, 445,
433 436, 435, 0, 442, 430, 434, 440, 438, 436, 430,
434 435, 419, 420, 0, 436, 417, 417, 428, 422, 419,
435 427, 0, 426, 423, 427, 424, 408, 417, 419, 404,
436 417, 418, 0, 0, 407, 415, 411, 406, 407, 0,
437 0, 679, 679, 679, 411, 0, 396, 408, 408, 397,
439 391, 391, 403, 0, 403, 405, 386, 0, 403, 0,
440 0, 397, 0, 391, 385, 395, 385, 387, 384, 391,
441 0, 384, 0, 0, 385, 0, 382, 0, 0, 0,
442 386, 380, 384, 379, 383, 0, 0, 0, 376, 0,
443 0, 0, 369, 381, 379, 0, 370, 0, 371, 370,
444 369, 0, 0, 367, 362, 371, 0, 358, 359, 0,
445 361, 0, 0, 362, 0, 367, 367, 365, 351, 0,
446 0, 350, 0, 356, 348, 347, 0, 0, 347, 0,
447 329, 0, 340, 334, 0, 319, 0, 0, 311, 320,
448 328, 325, 0, 316, 319, 311, 324, 0, 317, 305,
450 318, 315, 301, 302, 310, 296, 0, 308, 311, 300,
451 0, 299, 290, 282, 0, 233, 245, 176, 186, 174,
452 151, 158, 128, 0, 48, 28, 0, 679, 386, 390,
453 394, 399, 403, 405, 410
456 static yyconst short int yy_def[536] =
458 528, 1, 528, 528, 528, 528, 528, 529, 530, 531,
459 528, 528, 532, 528, 528, 528, 528, 528, 528, 528,
460 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
461 531, 528, 528, 528, 528, 531, 531, 531, 531, 531,
462 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
463 531, 531, 531, 531, 531, 531, 528, 528, 528, 528,
464 528, 529, 528, 529, 533, 531, 528, 528, 528, 528,
465 528, 532, 532, 528, 528, 528, 528, 528, 528, 528,
466 528, 528, 528, 528, 528, 528, 528, 528, 534, 528,
467 528, 528, 528, 528, 528, 528, 528, 528, 531, 528,
469 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
470 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
471 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
472 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
473 531, 531, 531, 531, 531, 531, 528, 528, 528, 535,
474 533, 528, 528, 528, 528, 528, 528, 528, 528, 528,
475 528, 528, 528, 528, 528, 528, 528, 534, 528, 528,
476 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
477 528, 528, 528, 528, 531, 531, 531, 531, 531, 531,
478 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
480 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
481 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
482 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
483 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
484 531, 531, 531, 531, 531, 535, 528, 535, 528, 528,
485 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
486 528, 528, 528, 528, 528, 528, 528, 531, 531, 531,
487 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
488 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
489 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
491 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
492 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
493 531, 531, 531, 531, 531, 531, 531, 531, 531, 528,
494 528, 528, 528, 528, 528, 528, 528, 528, 531, 531,
495 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
496 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
497 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
498 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
499 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
500 531, 528, 528, 528, 531, 531, 531, 531, 531, 531,
502 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
503 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
504 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
505 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
506 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
507 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
508 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
509 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
510 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
511 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
513 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
514 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
515 531, 531, 531, 531, 531, 531, 531, 0, 528, 528,
516 528, 528, 528, 528, 528
519 static yyconst short int yy_nxt[758] =
521 4, 5, 6, 5, 7, 8, 9, 10, 11, 12,
522 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
523 23, 24, 25, 26, 27, 28, 29, 30, 10, 10,
524 10, 10, 10, 10, 10, 10, 31, 10, 10, 10,
525 10, 10, 10, 10, 10, 32, 33, 34, 35, 36,
526 37, 38, 39, 40, 41, 42, 43, 10, 44, 45,
527 46, 10, 47, 48, 49, 50, 51, 52, 53, 54,
528 55, 10, 56, 10, 57, 58, 59, 60, 63, 67,
529 70, 75, 527, 80, 77, 81, 81, 82, 91, 92,
530 102, 76, 78, 79, 108, 71, 103, 84, 83, 85,
532 85, 143, 84, 109, 90, 90, 94, 95, 96, 120,
533 152, 86, 526, 121, 144, 87, 86, 105, 97, 64,
534 87, 88, 113, 89, 106, 110, 88, 111, 98, 68,
535 107, 69, 114, 123, 86, 115, 112, 147, 63, 86,
536 87, 528, 124, 117, 139, 87, 73, 125, 88, 72,
537 118, 89, 126, 88, 119, 140, 127, 133, 247, 205,
538 134, 135, 141, 128, 149, 149, 206, 136, 150, 129,
539 137, 130, 191, 138, 81, 81, 192, 167, 163, 64,
540 163, 157, 157, 164, 164, 225, 154, 155, 148, 84,
541 156, 85, 85, 158, 159, 165, 194, 160, 226, 248,
543 525, 166, 167, 86, 230, 195, 261, 161, 199, 154,
544 155, 200, 524, 162, 227, 156, 158, 159, 523, 231,
545 165, 84, 160, 90, 90, 242, 86, 243, 166, 220,
546 221, 228, 161, 261, 222, 86, 236, 237, 522, 87,
547 162, 223, 238, 149, 149, 88, 521, 150, 520, 249,
548 239, 249, 240, 324, 250, 250, 325, 254, 86, 254,
549 164, 164, 255, 255, 87, 258, 268, 269, 256, 262,
550 157, 157, 88, 171, 257, 172, 247, 173, 174, 175,
551 176, 177, 251, 252, 178, 179, 253, 180, 181, 182,
552 258, 164, 164, 256, 262, 519, 263, 277, 278, 305,
554 518, 257, 264, 332, 259, 251, 252, 260, 306, 149,
555 149, 253, 333, 150, 250, 250, 336, 248, 250, 250,
556 330, 263, 330, 255, 255, 331, 331, 259, 392, 264,
557 332, 155, 260, 334, 156, 255, 255, 333, 357, 335,
558 393, 336, 331, 331, 331, 331, 399, 517, 159, 358,
559 516, 160, 515, 400, 155, 392, 514, 252, 334, 156,
560 253, 513, 512, 511, 510, 393, 335, 509, 508, 507,
561 506, 159, 505, 504, 503, 502, 160, 501, 500, 499,
562 252, 498, 497, 496, 495, 253, 62, 62, 62, 62,
563 62, 65, 494, 493, 65, 66, 492, 66, 66, 72,
565 72, 491, 72, 72, 151, 490, 151, 151, 168, 168,
566 246, 246, 246, 246, 246, 489, 488, 487, 486, 485,
567 484, 483, 482, 481, 480, 479, 478, 477, 476, 475,
568 474, 473, 472, 471, 470, 469, 468, 467, 466, 465,
569 464, 463, 462, 461, 460, 459, 458, 457, 456, 455,
570 454, 453, 452, 451, 450, 449, 448, 447, 446, 445,
571 444, 443, 442, 441, 440, 439, 438, 437, 436, 435,
572 434, 433, 432, 431, 430, 429, 428, 427, 426, 425,
573 424, 423, 422, 421, 420, 419, 418, 417, 416, 415,
574 414, 413, 412, 411, 410, 409, 408, 407, 406, 405,
576 404, 403, 402, 401, 398, 397, 396, 395, 394, 391,
577 390, 389, 388, 387, 386, 385, 384, 383, 382, 381,
578 380, 379, 378, 377, 376, 375, 374, 373, 372, 371,
579 370, 369, 368, 367, 366, 365, 364, 363, 362, 361,
580 360, 359, 356, 355, 354, 353, 352, 351, 350, 349,
581 348, 347, 346, 345, 344, 343, 342, 341, 340, 339,
582 338, 337, 528, 329, 328, 327, 326, 323, 322, 321,
583 320, 319, 318, 317, 316, 315, 314, 313, 312, 311,
584 310, 309, 308, 307, 304, 303, 302, 301, 300, 299,
585 298, 297, 296, 295, 294, 293, 292, 291, 290, 289,
587 288, 287, 286, 285, 284, 283, 282, 281, 280, 279,
588 276, 275, 274, 273, 272, 271, 270, 267, 266, 265,
589 245, 244, 241, 235, 234, 233, 232, 229, 224, 219,
590 218, 217, 216, 215, 214, 213, 212, 211, 210, 209,
591 208, 207, 204, 203, 202, 201, 198, 197, 196, 193,
592 190, 189, 188, 187, 186, 185, 184, 183, 170, 169,
593 153, 528, 146, 145, 142, 132, 131, 122, 116, 104,
594 101, 100, 99, 93, 74, 73, 61, 528, 3, 528,
595 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
596 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
598 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
599 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
600 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
601 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
602 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
603 528, 528, 528, 528, 528, 528, 528
606 static yyconst short int yy_chk[758] =
608 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
609 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
610 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
611 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
612 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
613 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
614 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
615 1, 1, 1, 1, 1, 1, 1, 1, 8, 11,
616 12, 17, 526, 20, 19, 20, 20, 21, 26, 26,
617 37, 17, 19, 19, 40, 12, 37, 22, 21, 22,
619 22, 54, 23, 40, 23, 23, 28, 28, 30, 45,
620 72, 22, 525, 45, 54, 22, 23, 39, 30, 8,
621 23, 22, 42, 22, 39, 41, 23, 41, 30, 11,
622 39, 11, 42, 47, 22, 42, 41, 58, 62, 23,
623 22, 73, 47, 44, 52, 23, 72, 47, 22, 73,
624 44, 22, 48, 23, 44, 52, 48, 51, 150, 118,
625 51, 51, 52, 48, 63, 63, 118, 51, 63, 48,
626 51, 48, 106, 51, 81, 81, 106, 88, 86, 62,
627 86, 84, 84, 86, 86, 134, 81, 81, 58, 85,
628 81, 85, 85, 84, 84, 87, 108, 84, 134, 150,
630 523, 87, 88, 85, 137, 108, 165, 85, 112, 81,
631 81, 112, 522, 85, 135, 81, 84, 84, 521, 137,
632 87, 90, 84, 90, 90, 144, 85, 144, 87, 132,
633 132, 135, 85, 165, 132, 90, 142, 142, 520, 90,
634 85, 132, 142, 149, 149, 90, 519, 149, 518, 154,
635 142, 154, 142, 241, 154, 154, 241, 158, 90, 158,
636 163, 163, 158, 158, 90, 162, 185, 185, 161, 167,
637 157, 157, 90, 96, 161, 96, 246, 96, 96, 96,
638 96, 96, 157, 157, 96, 96, 157, 96, 96, 96,
639 162, 164, 164, 161, 167, 517, 168, 193, 193, 222,
641 516, 161, 168, 256, 164, 157, 157, 164, 222, 247,
642 247, 157, 258, 247, 249, 249, 264, 246, 250, 250,
643 251, 168, 251, 254, 254, 251, 251, 164, 334, 168,
644 256, 250, 164, 263, 250, 255, 255, 258, 293, 263,
645 336, 264, 330, 330, 331, 331, 344, 514, 255, 293,
646 513, 255, 512, 344, 250, 334, 510, 331, 263, 250,
647 331, 509, 508, 506, 505, 336, 263, 504, 503, 502,
648 501, 255, 500, 499, 497, 496, 255, 495, 494, 492,
649 331, 491, 490, 489, 486, 331, 529, 529, 529, 529,
650 529, 530, 484, 483, 530, 531, 481, 531, 531, 532,
652 532, 479, 532, 532, 533, 476, 533, 533, 534, 534,
653 535, 535, 535, 535, 535, 475, 474, 472, 469, 468,
654 467, 466, 464, 461, 459, 458, 456, 455, 454, 451,
655 450, 449, 447, 445, 444, 443, 439, 435, 434, 433,
656 432, 431, 427, 425, 422, 420, 419, 418, 417, 416,
657 415, 414, 412, 409, 407, 406, 405, 403, 402, 401,
658 400, 399, 398, 397, 395, 389, 388, 387, 386, 385,
659 382, 381, 380, 379, 378, 377, 376, 375, 374, 373,
660 371, 370, 369, 368, 367, 366, 365, 363, 362, 361,
661 360, 359, 358, 357, 356, 355, 354, 352, 351, 350,
663 349, 348, 347, 346, 342, 341, 340, 339, 337, 329,
664 328, 327, 325, 324, 323, 322, 321, 320, 319, 318,
665 317, 316, 315, 314, 313, 312, 311, 310, 309, 308,
666 307, 306, 305, 304, 303, 302, 301, 299, 298, 297,
667 296, 295, 291, 290, 289, 287, 286, 285, 284, 281,
668 280, 279, 278, 277, 276, 273, 271, 270, 269, 268,
669 267, 266, 248, 245, 244, 243, 242, 240, 239, 238,
670 237, 236, 235, 234, 233, 232, 231, 230, 229, 228,
671 227, 226, 225, 223, 221, 220, 219, 218, 216, 215,
672 214, 213, 212, 211, 210, 209, 208, 207, 206, 205,
674 204, 202, 201, 200, 199, 198, 197, 196, 195, 194,
675 192, 191, 190, 189, 188, 187, 186, 184, 183, 172,
676 146, 145, 143, 141, 140, 139, 138, 136, 133, 131,
677 130, 129, 128, 127, 126, 125, 124, 123, 122, 121,
678 120, 119, 116, 115, 114, 113, 111, 110, 109, 107,
679 105, 104, 103, 102, 101, 99, 98, 97, 95, 91,
680 80, 64, 56, 55, 53, 50, 49, 46, 43, 38,
681 36, 35, 31, 27, 16, 13, 7, 3, 528, 528,
682 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
683 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
685 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
686 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
687 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
688 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
689 528, 528, 528, 528, 528, 528, 528, 528, 528, 528,
690 528, 528, 528, 528, 528, 528, 528
693 static yy_state_type yy_last_accepting_state;
694 static char *yy_last_accepting_cpos;
696 /* The intent behind this definition is that it'll catch
697 * any uses of REJECT which flex missed.
699 #define REJECT reject_used_but_not_detected
700 #define yymore() yymore_used_but_not_detected
701 #define YY_MORE_ADJ 0
702 #define YY_RESTORE_YY_MORE_OFFSET
707 ** Copyright (c) Massachusetts Institute of Technology 1994-1998.
708 ** All Rights Reserved.
709 ** Unpublished rights reserved under the copyright laws of
710 ** the United States.
712 ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
713 ** OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
715 ** This code is distributed freely and may be used freely under the
716 ** following conditions:
718 ** 1. This notice may not be removed or altered.
720 ** 2. Works derived from this code are not distributed for
721 ** commercial gain without explicit permission from MIT
722 ** (for permission contact lclint-request@sds.lcs.mit.edu).
725 * Modified by Herbert 08/19/97:
726 * - added #include for IBM's OS/2 compiler.
727 * - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only).
730 * Modified by Mike Smith
731 * Corrected missing 'line' in scanf() calls in handleSpecial().
732 * Without this, I get an error when LCLint hits a '#line' directive
733 * in the pre-pre-processed source files. For safety, I have made these
734 * conditional on OS2 and MSDOS because I don't understand why noone else
735 * has seen this problem.
737 * Modified by Mike Smith, 4th June 1997
738 * Finally resolved the #line problem. The scanf() calls have been fixed to
739 * allow the following #line forms:-
741 * #line 123 "filename"
746 * The last two are generated by the GNU pre-processor, apparently
748 #line 56 "cscanner.l"
750 ** based on original C lexer by Nate Osgood
751 ** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993
755 # include "lclintMacros.nf"
758 # include "cgrammar.h"
759 # include "cgrammar_tokens.h"
761 # include "fileIdList.h"
764 # if defined(OS2) && defined(__IBMC__)
765 /* needed for isatty()... */
769 static bool lastWasString = FALSE;
770 static char savechar = '\0';
773 # define yyinput() (incColumn (), getc (yyin))
777 extern /*@external@*/ int read ();
781 static /*@owned@*/ cstring lastidprocessed = cstring_undefined;
783 static int lminput (void);
784 static int tokLength = 0;
785 static bool inSpecPart = FALSE;
786 static bool continueLine = FALSE;
788 static int ninput (void);
789 static char processChar (void);
790 static double processFloat (void);
791 static /*@only@*/ exprNode processString (void);
792 static long processDec (void);
793 static long processHex (void);
794 static long processOctal (void);
795 static int processIdentifier (/*@only@*/ cstring)
796 /*@globals undef lastidprocessed@*/ ;
797 static bool processHashIdentifier (/*@only@*/ cstring)
798 /*@globals undef lastidprocessed@*/ ;
800 static int processSpec (int);
801 static bool handleSpecial (char *);
802 static int handleLlSpecial (void);
803 static void handleMacro (void);
804 static bool processMacro (void);
805 static /*@only@*/ cstring makeIdentifier (char *);
807 /* yes, this is exported! */
808 bool g_expectingTypeName = TRUE; /* beginning of file can be type name! */
810 static int returnInt (ctype, long);
811 static int returnFloat (ctype, double);
812 static int returnChar (char);
813 static void setTokLength (int) /*@modifies g_currentloc@*/ ;
814 static void setTokLengthT (size_t) /*@modifies g_currentloc@*/ ;
816 static void advanceLine (void)
823 # define RETURN_INT(c,i) \
824 do { lastWasString = FALSE; \
825 return (returnInt (c, i)); } while (FALSE)
827 # define RETURN_FLOAT(c,f) \
828 do { lastWasString = FALSE; \
829 return (returnFloat (c, f)); \
832 # define RETURN_CHAR(c) \
833 do { lastWasString = FALSE; \
834 return (returnChar (c)); \
837 # define RETURN_TOK(t) \
838 do { yylval.tok = lltok_create (t, fileloc_decColumn (g_currentloc, tokLength)); \
840 lastWasString = FALSE; \
841 return (t); } while (FALSE)
843 # define RETURN_TYPE(t, ct) \
844 do { yylval.ctyp = ct; tokLength = 0; return (t); } while (FALSE)
846 /* don't fileloc_decColumn (g_currentloc, tokLength));
847 the string could have \n's in it!
850 # define RETURN_STRING(c) \
851 do { yylval.expr = exprNode_stringLiteral (c, fileloc_decColumn (g_currentloc, tokLength)); \
853 lastWasString = TRUE; \
854 return (CCONSTANT); } while (FALSE)
856 # define RETURN_EXPR(e) \
857 do { yylval.expr = e; \
859 lastWasString = TRUE; \
860 return (CCONSTANT); } while (FALSE)
864 static void setTokLength (int len)
870 static void setTokLengthT (size_t len)
872 setTokLength (size_toInt (len));
875 # include "flex.head"
878 /* Macros after this point can all be overridden by user definitions in
882 #ifndef YY_SKIP_YYWRAP
884 extern "C" int yywrap YY_PROTO(( void ));
886 extern int yywrap YY_PROTO(( void ));
891 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
895 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
898 #ifdef YY_NEED_STRLEN
899 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
904 static int yyinput YY_PROTO(( void ));
906 static int input YY_PROTO(( void ));
911 static int yy_start_stack_ptr = 0;
912 static int yy_start_stack_depth = 0;
913 static int *yy_start_stack = 0;
914 #ifndef YY_NO_PUSH_STATE
915 static void yy_push_state YY_PROTO(( int new_state ));
917 #ifndef YY_NO_POP_STATE
918 static void yy_pop_state YY_PROTO(( void ));
920 #ifndef YY_NO_TOP_STATE
921 static int yy_top_state YY_PROTO(( void ));
925 #define YY_NO_PUSH_STATE 1
926 #define YY_NO_POP_STATE 1
927 #define YY_NO_TOP_STATE 1
930 #ifdef YY_MALLOC_DECL
938 /* Just try to get by without declaring the routines. This will fail
939 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
940 * or sizeof(void*) != sizeof(int).
945 /* Amount of stuff to slurp up with each read. */
946 #ifndef YY_READ_BUF_SIZE
947 #define YY_READ_BUF_SIZE 8192
950 /* Copy whatever the last rule matched to the standard output. */
953 /* This used to be an fputs(), but since the string might contain NUL's,
954 * we now use fwrite().
956 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
959 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
960 * is returned in "result".
963 #define YY_INPUT(buf,result,max_size) \
964 if ( yy_current_buffer->yy_is_interactive ) \
967 for ( n = 0; n < max_size && \
968 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
971 buf[n++] = (char) c; \
972 if ( c == EOF && ferror( yyin ) ) \
973 YY_FATAL_ERROR( "input in flex scanner failed" ); \
976 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
977 && ferror( yyin ) ) \
978 YY_FATAL_ERROR( "input in flex scanner failed" );
981 /* No semi-colon after return; correct usage is to write "yyterminate();" -
982 * we don't want an extra ';' after the "return" because that will cause
983 * some compilers to complain about unreachable statements.
986 #define yyterminate() return YY_NULL
989 /* Number of entries by which start-condition stack grows. */
990 #ifndef YY_START_STACK_INCR
991 #define YY_START_STACK_INCR 25
994 /* Report a fatal error. */
995 #ifndef YY_FATAL_ERROR
996 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
999 /* Default declaration of generated scanner - a define so the user can
1000 * easily add parameters.
1003 #define YY_DECL int yylex YY_PROTO(( void ))
1006 /* Code executed at the beginning of each rule, after yytext and yyleng
1009 #ifndef YY_USER_ACTION
1010 #define YY_USER_ACTION
1013 /* Code executed at the end of each rule. */
1015 #define YY_BREAK break;
1018 #define YY_RULE_SETUP \
1023 register yy_state_type yy_current_state;
1024 register char *yy_cp = NULL, *yy_bp = NULL;
1025 register int yy_act;
1027 #line 185 "cscanner.l"
1030 #line 1031 "lex.yy.c"
1041 yy_start = 1; /* first start state */
1049 if ( ! yy_current_buffer )
1051 yy_create_buffer( yyin, YY_BUF_SIZE );
1053 yy_load_buffer_state();
1056 while ( 1 ) /* loops until end-of-file is reached */
1060 /* Support of yytext. */
1061 *yy_cp = yy_hold_char;
1063 /* yy_bp points to the position in yy_ch_buf of the start of
1068 yy_current_state = yy_start;
1072 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1073 if ( yy_accept[yy_current_state] )
1075 yy_last_accepting_state = yy_current_state;
1076 yy_last_accepting_cpos = yy_cp;
1078 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1080 yy_current_state = (int) yy_def[yy_current_state];
1081 if ( yy_current_state >= 529 )
1082 yy_c = yy_meta[(unsigned int) yy_c];
1084 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1087 while ( yy_base[yy_current_state] != 679 );
1090 yy_act = yy_accept[yy_current_state];
1092 { /* have to back up */
1093 yy_cp = yy_last_accepting_cpos;
1094 yy_current_state = yy_last_accepting_state;
1095 yy_act = yy_accept[yy_current_state];
1098 YY_DO_BEFORE_ACTION;
1101 do_action: /* This label is used only to access EOF actions. */
1105 { /* beginning of action switch */
1106 case 0: /* must back up */
1107 /* undo the effects of YY_DO_BEFORE_ACTION */
1108 *yy_cp = yy_hold_char;
1109 yy_cp = yy_last_accepting_cpos;
1110 yy_current_state = yy_last_accepting_state;
1111 goto yy_find_action;
1115 #line 187 "cscanner.l"
1116 { llfatalbug (cstring_makeLiteral ("Comment in pre-processor output")); }
1120 #line 189 "cscanner.l"
1122 context_saveLocation ();
1123 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1125 if (processHashIdentifier (makeIdentifier (yytext + 1)))
1133 RETURN_STRING (cstring_makeLiteral ("\"\""));
1138 if (handleSpecial (yytext))
1148 #line 213 "cscanner.l"
1149 { if (handleSpecial (yytext))
1151 setTokLength (1); RETURN_TOK (0);
1157 #line 218 "cscanner.l"
1158 { setTokLength (3); RETURN_TOK (CTOK_ELIPSIS); }
1162 #line 219 "cscanner.l"
1163 { setTokLength (5); RETURN_TOK (BREAK); }
1167 #line 220 "cscanner.l"
1168 { setTokLength (4); RETURN_TOK (CASE); }
1172 #line 221 "cscanner.l"
1173 { setTokLength (8); RETURN_TOK (CONTINUE); }
1177 #line 222 "cscanner.l"
1178 { setTokLength (7); RETURN_TOK (DEFAULT); }
1182 #line 223 "cscanner.l"
1183 { setTokLength (2); RETURN_TOK (DO); }
1187 #line 224 "cscanner.l"
1188 { setTokLength (4); RETURN_TOK (CELSE); }
1192 #line 225 "cscanner.l"
1193 { setTokLength (3); RETURN_TOK (CFOR); }
1197 #line 226 "cscanner.l"
1198 { setTokLength (4); RETURN_TOK (GOTO); }
1202 #line 227 "cscanner.l"
1203 { setTokLength (2); RETURN_TOK (CIF); }
1207 #line 228 "cscanner.l"
1208 { setTokLength (6); RETURN_TOK (RETURN); }
1212 #line 229 "cscanner.l"
1213 { setTokLength (6); RETURN_TOK (CSIZEOF); }
1217 #line 230 "cscanner.l"
1218 { setTokLength (8); RETURN_TOK (COFFSETOF); }
1222 #line 231 "cscanner.l"
1223 { setTokLength (6); RETURN_TOK (SWITCH); }
1227 #line 232 "cscanner.l"
1228 { setTokLength (5); RETURN_TOK (WHILE); }
1232 #line 233 "cscanner.l"
1233 { setTokLength (6); RETURN_TOK (VA_ARG); }
1237 #line 234 "cscanner.l"
1238 { setTokLength (6); RETURN_TOK (VA_DCL); }
1242 #line 235 "cscanner.l"
1244 /* gcc extension...this might not be appropriate */
1245 setTokLength (6); RETURN_TOK (QINLINE); }
1249 #line 239 "cscanner.l"
1250 { setTokLength (6); RETURN_TOK (CSTRUCT); }
1254 #line 240 "cscanner.l"
1255 { setTokLength (7); RETURN_TOK (CTYPEDEF); }
1259 #line 242 "cscanner.l"
1260 { setTokLength (5); RETURN_TOK (CUNION); }
1264 #line 243 "cscanner.l"
1265 { setTokLength (4); RETURN_TOK (CENUM); }
1269 #line 245 "cscanner.l"
1270 { setTokLength (4); RETURN_TYPE (CVOID, ctype_void); }
1274 #line 246 "cscanner.l"
1275 { setTokLength (3); RETURN_TYPE (CINT, ctype_int); }
1279 #line 247 "cscanner.l"
1280 { setTokLength (6); RETURN_TYPE (CDOUBLE, ctype_double); }
1284 #line 248 "cscanner.l"
1285 { setTokLength (4); RETURN_TYPE (CGCHAR, ctype_char); }
1289 #line 249 "cscanner.l"
1290 { setTokLength (5); RETURN_TYPE (CGFLOAT, ctype_float); }
1294 #line 251 "cscanner.l"
1295 { setTokLength (4); RETURN_TOK (QLONG); }
1299 #line 252 "cscanner.l"
1300 { setTokLength (5); RETURN_TOK (QSHORT); }
1304 #line 253 "cscanner.l"
1305 { setTokLength (8); RETURN_TOK (QUNSIGNED); }
1309 #line 254 "cscanner.l"
1310 { setTokLength (6); RETURN_TOK (QSIGNED); }
1314 #line 256 "cscanner.l"
1315 { setTokLength (8); RETURN_TOK (QVOLATILE); }
1319 #line 257 "cscanner.l"
1320 { setTokLength (5); RETURN_TOK (QCONST); }
1322 /* some systems expect this! [gack!] */
1325 #line 260 "cscanner.l"
1326 { setTokLength (7); RETURN_TOK (QCONST); }
1330 #line 262 "cscanner.l"
1331 { setTokLength (6); RETURN_TOK (QEXTERN); }
1335 #line 263 "cscanner.l"
1336 { setTokLength (4); RETURN_TOK (QAUTO); }
1340 #line 264 "cscanner.l"
1341 { setTokLength (8); RETURN_TOK (QREGISTER); }
1345 #line 265 "cscanner.l"
1346 { setTokLength (6); RETURN_TOK (QSTATIC); }
1350 #line 267 "cscanner.l"
1351 { RETURN_EXPR (processString ()); }
1355 #line 268 "cscanner.l"
1356 { return (processSpec (QOUT)); }
1360 #line 269 "cscanner.l"
1361 { return (processSpec (QIN)); }
1365 #line 270 "cscanner.l"
1366 { return (processSpec (QPARTIAL)); }
1370 #line 271 "cscanner.l"
1371 { return (processSpec (QSPECIAL)); }
1375 #line 272 "cscanner.l"
1376 { return (processSpec (QANYTYPE)); }
1380 #line 273 "cscanner.l"
1381 { return (processSpec (QINTEGRALTYPE)); }
1385 #line 274 "cscanner.l"
1386 { return (processSpec (QUNSIGNEDINTEGRALTYPE)); }
1390 #line 275 "cscanner.l"
1391 { return (processSpec (QSIGNEDINTEGRALTYPE)); }
1395 #line 276 "cscanner.l"
1396 { return (processSpec (QKEEP)); }
1400 #line 277 "cscanner.l"
1401 { return (processSpec (QNULL)); }
1405 #line 278 "cscanner.l"
1406 { return (processSpec (QNOTNULL)); }
1410 #line 279 "cscanner.l"
1411 { return (processSpec (QISNULL)); }
1415 #line 280 "cscanner.l"
1416 { return (processSpec (QTRUENULL)); }
1420 #line 281 "cscanner.l"
1421 { return (processSpec (QFALSENULL)); }
1425 #line 282 "cscanner.l"
1426 { return (processSpec (QRELNULL)); }
1430 #line 283 "cscanner.l"
1431 { return (processSpec (QRELDEF)); }
1435 #line 284 "cscanner.l"
1436 { return (processSpec (QEXPOSED)); }
1440 #line 285 "cscanner.l"
1441 { return (processSpec (QNEWREF)); }
1445 #line 286 "cscanner.l"
1446 { return (processSpec (QTEMPREF)); }
1450 #line 287 "cscanner.l"
1451 { return (processSpec (QKILLREF)); }
1455 #line 288 "cscanner.l"
1456 { return (processSpec (QREFCOUNTED)); }
1460 #line 289 "cscanner.l"
1461 { return (processSpec (QCHECKED)); }
1465 #line 290 "cscanner.l"
1466 { return (processSpec (QCHECKMOD)); }
1470 #line 291 "cscanner.l"
1471 { return (processSpec (QCHECKEDSTRICT)); }
1475 #line 292 "cscanner.l"
1476 { return (processSpec (QUNCHECKED)); }
1480 #line 293 "cscanner.l"
1481 { return (processSpec (QONLY)); }
1485 #line 294 "cscanner.l"
1486 { return (processSpec (QOWNED)); }
1490 #line 295 "cscanner.l"
1491 { return (processSpec (QOBSERVER)); }
1495 #line 296 "cscanner.l"
1496 { return (processSpec (QDEPENDENT)); }
1500 #line 297 "cscanner.l"
1501 { return (processSpec (QUNUSED)); }
1505 #line 298 "cscanner.l"
1506 { return (processSpec (QEXTERNAL)); }
1510 #line 299 "cscanner.l"
1511 { return (processSpec (QSEF)); }
1515 #line 300 "cscanner.l"
1516 { return (processSpec (QSHARED)); }
1520 #line 301 "cscanner.l"
1521 { return (processSpec (QYIELD)); }
1525 #line 302 "cscanner.l"
1526 { return (processSpec (QUNDEF)); }
1530 #line 303 "cscanner.l"
1531 { return (processSpec (QKILLED)); }
1535 #line 304 "cscanner.l"
1536 { return (processSpec (QNULLTERMINATED));}
1540 #line 305 "cscanner.l"
1541 { return (processSpec (QMAXSET));}
1545 #line 306 "cscanner.l"
1546 { return (processSpec (QMAXREAD));}
1550 #line 308 "cscanner.l"
1552 context_saveLocation ();
1553 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1554 tok = processIdentifier (makeIdentifier (yytext));
1563 #line 317 "cscanner.l"
1564 { setTokLengthT (mstring_length (yytext));
1565 RETURN_INT (ctype_int, processHex ()); /* evs 2000-05-17 was ctype_uint */
1570 #line 320 "cscanner.l"
1571 { setTokLengthT (mstring_length (yytext));
1572 RETURN_INT (ctype_lint, processHex ()); }
1576 #line 322 "cscanner.l"
1577 { setTokLengthT (mstring_length (yytext));
1578 RETURN_INT (ctype_llint, processHex ()); }
1582 #line 324 "cscanner.l"
1583 { setTokLengthT (mstring_length (yytext));
1584 RETURN_INT (ctype_uint, processHex ()); }
1588 #line 326 "cscanner.l"
1589 { setTokLengthT (mstring_length (yytext));
1590 RETURN_INT (ctype_ulint, processHex ()); }
1594 #line 328 "cscanner.l"
1595 { setTokLengthT (mstring_length (yytext));
1596 RETURN_INT (ctype_ullint, processHex ()); }
1600 #line 330 "cscanner.l"
1601 { setTokLengthT (mstring_length (yytext));
1602 RETURN_INT (ctype_ullint, processHex ()); }
1606 #line 332 "cscanner.l"
1607 { setTokLengthT (mstring_length (yytext));
1608 RETURN_INT (ctype_int, processOctal ()); }
1612 #line 334 "cscanner.l"
1613 { setTokLengthT (mstring_length (yytext));
1614 RETURN_INT (ctype_uint, processOctal ()); }
1618 #line 336 "cscanner.l"
1619 { setTokLengthT (mstring_length (yytext));
1620 RETURN_INT (ctype_lint, processOctal ()); }
1624 #line 338 "cscanner.l"
1625 { setTokLengthT (mstring_length (yytext));
1626 RETURN_INT (ctype_llint, processOctal ()); }
1630 #line 340 "cscanner.l"
1631 { setTokLengthT (mstring_length (yytext));
1632 RETURN_INT (ctype_ulint, processOctal ()); }
1636 #line 342 "cscanner.l"
1637 { setTokLengthT (mstring_length (yytext));
1638 RETURN_INT (ctype_ullint, processOctal ()); }
1642 #line 344 "cscanner.l"
1643 { setTokLengthT (mstring_length (yytext));
1644 RETURN_INT (ctype_ullint, processOctal ()); }
1648 #line 346 "cscanner.l"
1649 { setTokLengthT (mstring_length (yytext));
1650 RETURN_INT (ctype_int, processDec ()); }
1654 #line 348 "cscanner.l"
1655 { setTokLengthT (mstring_length (yytext));
1656 RETURN_INT (ctype_uint, processDec ()); }
1660 #line 350 "cscanner.l"
1661 { setTokLengthT (mstring_length (yytext));
1662 RETURN_INT (ctype_lint, processDec ()); }
1666 #line 352 "cscanner.l"
1667 { setTokLengthT (mstring_length (yytext));
1668 RETURN_INT (ctype_llint, processDec ()); }
1672 #line 354 "cscanner.l"
1673 { setTokLengthT (mstring_length (yytext));
1674 RETURN_INT (ctype_ulint, processDec ()); }
1678 #line 356 "cscanner.l"
1679 { setTokLengthT (mstring_length (yytext));
1680 RETURN_INT (ctype_ullint, processDec ()); }
1684 #line 358 "cscanner.l"
1685 { setTokLengthT (mstring_length (yytext));
1686 RETURN_INT (ctype_ullint, processDec ()); }
1690 #line 360 "cscanner.l"
1691 { setTokLengthT (mstring_length (yytext));
1692 RETURN_CHAR (processChar ()); }
1696 #line 362 "cscanner.l"
1697 { setTokLengthT (mstring_length (yytext));
1698 RETURN_FLOAT (ctype_float, processFloat ()); }
1702 #line 364 "cscanner.l"
1703 { setTokLengthT (mstring_length (yytext));
1704 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1708 #line 366 "cscanner.l"
1709 { setTokLengthT (mstring_length (yytext));
1710 RETURN_FLOAT (ctype_double, processFloat ()); }
1714 #line 369 "cscanner.l"
1715 { setTokLengthT (mstring_length (yytext));
1716 RETURN_FLOAT (ctype_float, processFloat ()); }
1720 #line 371 "cscanner.l"
1721 { setTokLengthT (mstring_length (yytext));
1722 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1726 #line 373 "cscanner.l"
1727 { setTokLengthT (mstring_length (yytext));
1728 RETURN_FLOAT (ctype_double, processFloat ()); }
1732 #line 376 "cscanner.l"
1733 { setTokLengthT (mstring_length (yytext));
1734 RETURN_FLOAT (ctype_float, processFloat ()); }
1738 #line 378 "cscanner.l"
1739 { setTokLengthT (mstring_length (yytext));
1740 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1744 #line 380 "cscanner.l"
1745 { setTokLengthT (mstring_length (yytext));
1746 RETURN_FLOAT (ctype_double, processFloat ()); }
1750 #line 383 "cscanner.l"
1751 { setTokLength (3); RETURN_TOK (RIGHT_ASSIGN); }
1755 #line 384 "cscanner.l"
1756 { setTokLength (3); RETURN_TOK (LEFT_ASSIGN); }
1760 #line 385 "cscanner.l"
1761 { setTokLength (2); RETURN_TOK (ADD_ASSIGN); }
1765 #line 386 "cscanner.l"
1766 { setTokLength (2); RETURN_TOK (SUB_ASSIGN); }
1770 #line 387 "cscanner.l"
1771 { setTokLength (2); RETURN_TOK (MUL_ASSIGN); }
1775 #line 388 "cscanner.l"
1776 { setTokLength (2); RETURN_TOK (DIV_ASSIGN); }
1780 #line 389 "cscanner.l"
1781 { setTokLength (2); RETURN_TOK (MOD_ASSIGN); }
1785 #line 390 "cscanner.l"
1786 { setTokLength (2); RETURN_TOK (AND_ASSIGN); }
1790 #line 391 "cscanner.l"
1791 { setTokLength (2); RETURN_TOK (XOR_ASSIGN); }
1795 #line 392 "cscanner.l"
1796 { setTokLength (2); RETURN_TOK (OR_ASSIGN); }
1800 #line 393 "cscanner.l"
1801 { setTokLength (2); RETURN_TOK (RIGHT_OP); }
1805 #line 394 "cscanner.l"
1806 { setTokLength (2); RETURN_TOK (LEFT_OP); }
1810 #line 395 "cscanner.l"
1811 { setTokLength (2); RETURN_TOK (INC_OP); }
1815 #line 396 "cscanner.l"
1816 { setTokLength (2); RETURN_TOK (DEC_OP); }
1820 #line 397 "cscanner.l"
1821 { setTokLength (2); RETURN_TOK (ARROW_OP); }
1825 #line 398 "cscanner.l"
1826 { setTokLength (2); RETURN_TOK (AND_OP); }
1830 #line 399 "cscanner.l"
1831 { setTokLength (2); RETURN_TOK (OR_OP); }
1835 #line 400 "cscanner.l"
1836 { setTokLength (2); RETURN_TOK (LE_OP); }
1840 #line 401 "cscanner.l"
1841 { setTokLength (2); RETURN_TOK (GE_OP); }
1845 #line 402 "cscanner.l"
1846 { setTokLength (2); RETURN_TOK (EQ_OP); }
1850 #line 403 "cscanner.l"
1851 { setTokLength (2); RETURN_TOK (NE_OP); }
1855 #line 404 "cscanner.l"
1856 { setTokLength (1); RETURN_TOK (TSEMI); }
1860 #line 405 "cscanner.l"
1861 { setTokLength (1); RETURN_TOK (TLBRACE); }
1865 #line 406 "cscanner.l"
1866 { setTokLength (1); RETURN_TOK (TRBRACE); }
1870 #line 407 "cscanner.l"
1871 { setTokLength (1); RETURN_TOK (TCOMMA); }
1875 #line 408 "cscanner.l"
1876 { setTokLength (1); RETURN_TOK (TCOLON); }
1880 #line 409 "cscanner.l"
1881 { setTokLength (1); RETURN_TOK (TASSIGN); }
1885 #line 410 "cscanner.l"
1886 { setTokLength (1); RETURN_TOK (TLPAREN); }
1890 #line 411 "cscanner.l"
1891 { setTokLength (1); RETURN_TOK (TRPAREN); }
1895 #line 412 "cscanner.l"
1896 { setTokLength (1); RETURN_TOK (TLSQBR); }
1900 #line 413 "cscanner.l"
1901 { setTokLength (1); RETURN_TOK (TRSQBR); }
1905 #line 414 "cscanner.l"
1906 { setTokLength (1); RETURN_TOK (TDOT); }
1910 #line 415 "cscanner.l"
1911 { setTokLength (1); RETURN_TOK (TAMPERSAND); }
1915 #line 416 "cscanner.l"
1916 { setTokLength (1); RETURN_TOK (TEXCL); }
1920 #line 419 "cscanner.l"
1921 { setTokLength (1); RETURN_TOK (TTILDE); }
1925 #line 420 "cscanner.l"
1926 { setTokLength (1); RETURN_TOK (TMINUS); }
1930 #line 421 "cscanner.l"
1931 { setTokLength (1); RETURN_TOK (TPLUS); }
1935 #line 422 "cscanner.l"
1936 { setTokLength (1); RETURN_TOK (TMULT); }
1940 #line 423 "cscanner.l"
1941 { setTokLength (1); RETURN_TOK (TDIV); }
1945 #line 424 "cscanner.l"
1946 { setTokLength (1); RETURN_TOK (TPERCENT); }
1950 #line 425 "cscanner.l"
1951 { setTokLength (1); RETURN_TOK (TLT); }
1955 #line 426 "cscanner.l"
1956 { setTokLength (1); RETURN_TOK (TGT); }
1960 #line 427 "cscanner.l"
1961 { setTokLength (1); RETURN_TOK (TCIRC); }
1965 #line 428 "cscanner.l"
1966 { setTokLength (1); RETURN_TOK (TBAR); }
1970 #line 429 "cscanner.l"
1971 { setTokLength (1); RETURN_TOK (TQUEST); }
1975 #line 431 "cscanner.l"
1980 #line 432 "cscanner.l"
1981 { context_incLineno ();
1984 continueLine = FALSE;
1988 if (context_inMacro ())
1990 /* Don't use RETURN_TOK */
1991 yylval.tok = lltok_create (TENDMACRO, g_currentloc);
1992 lastWasString = FALSE;
2000 #line 448 "cscanner.l"
2003 if (processMacro ()) {
2004 if (context_inIterDef ())
2006 RETURN_TOK (LLMACROITER);
2008 if (context_inIterEnd ())
2010 RETURN_TOK (LLMACROEND);
2012 if (context_inMacro ())
2014 RETURN_TOK (LLMACRO);
2021 #line 465 "cscanner.l"
2022 { if (context_inHeader () || context_inFunction ())
2028 int nspchar = ninput ();
2032 ** This is a hack to get the column number correct.
2035 llassert (nspchar >= '0' && nspchar <= '9');
2037 nspaces = nspchar - '0';
2039 setTokLength (5 + nspaces);
2041 if (processMacro ())
2043 if (context_inIterDef ())
2045 RETURN_TOK (LLMACROITER);
2047 if (context_inIterEnd ())
2049 RETURN_TOK (LLMACROEND);
2051 if (context_inMacro ())
2053 RETURN_TOK (LLMACRO);
2061 #line 501 "cscanner.l"
2062 { setTokLength (4); lldiagmsg (ctype_unparseTable ()); }
2066 #line 502 "cscanner.l"
2068 lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc)));
2073 #line 505 "cscanner.l"
2074 { setTokLength (3); usymtab_printLocal (); }
2078 #line 506 "cscanner.l"
2079 { setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); }
2083 #line 507 "cscanner.l"
2084 { setTokLength (3); lldiagmsg (context_unparse ()); }
2088 #line 508 "cscanner.l"
2089 { setTokLength (3); lldiagmsg (context_unparseClauses ()); }
2093 #line 509 "cscanner.l"
2094 { setTokLength (3); usymtab_printGuards (); }
2098 #line 510 "cscanner.l"
2099 { setTokLength (3); usymtab_printOut (); }
2103 #line 511 "cscanner.l"
2104 { setTokLength (3); usymtab_printAll (); }
2108 #line 512 "cscanner.l"
2109 { setTokLength (3); usymtab_printComplete (); }
2113 #line 513 "cscanner.l"
2114 { setTokLength (3); usymtab_printTypes (); }
2118 #line 514 "cscanner.l"
2119 { setTokLength (3); lldiagmsg (usymtab_unparseStack ()); }
2123 #line 515 "cscanner.l"
2125 lldiagmsg (message ("Can modify: %q",
2126 sRefSet_unparse (context_modList ())));
2131 #line 519 "cscanner.l"
2132 { /* BEFORE_COMMENT_MARKER */
2134 incColumn (); incColumn ();
2135 tok = handleLlSpecial ();
2144 #line 528 "cscanner.l"
2145 { /* AFTER_COMMENT_MARKER */
2148 RETURN_TOK (QENDMACRO); }
2152 #line 532 "cscanner.l"
2153 { incColumn (); continueLine = TRUE; }
2157 #line 533 "cscanner.l"
2161 message ("Invalid character (ascii: %d), skipping character",
2168 #line 540 "cscanner.l"
2171 #line 2172 "lex.yy.c"
2172 case YY_STATE_EOF(INITIAL):
2175 case YY_END_OF_BUFFER:
2177 /* Amount of text matched not including the EOB char. */
2178 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2180 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2181 *yy_cp = yy_hold_char;
2182 YY_RESTORE_YY_MORE_OFFSET
2184 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2186 /* We're scanning a new file or input source. It's
2187 * possible that this happened because the user
2188 * just pointed yyin at a new source and called
2189 * yylex(). If so, then we have to assure
2190 * consistency between yy_current_buffer and our
2191 * globals. Here is the right place to do so, because
2192 * this is the first action (other than possibly a
2193 * back-up) that will match for the new input source.
2195 yy_n_chars = yy_current_buffer->yy_n_chars;
2196 yy_current_buffer->yy_input_file = yyin;
2197 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2200 /* Note that here we test for yy_c_buf_p "<=" to the position
2201 * of the first EOB in the buffer, since yy_c_buf_p will
2202 * already have been incremented past the NUL character
2203 * (since all states make transitions on EOB to the
2204 * end-of-buffer state). Contrast this with the test
2207 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2208 { /* This was really a NUL. */
2209 yy_state_type yy_next_state;
2211 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2213 yy_current_state = yy_get_previous_state();
2215 /* Okay, we're now positioned to make the NUL
2216 * transition. We couldn't have
2217 * yy_get_previous_state() go ahead and do it
2218 * for us because it doesn't know how to deal
2219 * with the possibility of jamming (and we don't
2220 * want to build jamming into it because then it
2221 * will run more slowly).
2224 yy_next_state = yy_try_NUL_trans( yy_current_state );
2226 yy_bp = yytext_ptr + YY_MORE_ADJ;
2228 if ( yy_next_state )
2230 /* Consume the NUL. */
2231 yy_cp = ++yy_c_buf_p;
2232 yy_current_state = yy_next_state;
2239 goto yy_find_action;
2243 else switch ( yy_get_next_buffer() )
2245 case EOB_ACT_END_OF_FILE:
2247 yy_did_buffer_switch_on_eof = 0;
2251 /* Note: because we've taken care in
2252 * yy_get_next_buffer() to have set up
2253 * yytext, we can now set up
2254 * yy_c_buf_p so that if some total
2255 * hoser (like flex itself) wants to
2256 * call the scanner after we return the
2257 * YY_NULL, it'll still work - another
2258 * YY_NULL will get returned.
2260 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2262 yy_act = YY_STATE_EOF(YY_START);
2268 if ( ! yy_did_buffer_switch_on_eof )
2274 case EOB_ACT_CONTINUE_SCAN:
2276 yytext_ptr + yy_amount_of_matched_text;
2278 yy_current_state = yy_get_previous_state();
2281 yy_bp = yytext_ptr + YY_MORE_ADJ;
2284 case EOB_ACT_LAST_MATCH:
2286 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2288 yy_current_state = yy_get_previous_state();
2291 yy_bp = yytext_ptr + YY_MORE_ADJ;
2292 goto yy_find_action;
2299 "fatal flex scanner internal error--no action found" );
2300 } /* end of action switch */
2301 } /* end of scanning one token */
2302 } /* end of yylex */
2305 /* yy_get_next_buffer - try to read in a new buffer
2307 * Returns a code representing an action:
2308 * EOB_ACT_LAST_MATCH -
2309 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2310 * EOB_ACT_END_OF_FILE - end of file
2313 static int yy_get_next_buffer()
2315 register char *dest = yy_current_buffer->yy_ch_buf;
2316 register char *source = yytext_ptr;
2317 register int number_to_move, i;
2320 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2322 "fatal flex scanner internal error--end of buffer missed" );
2324 if ( yy_current_buffer->yy_fill_buffer == 0 )
2325 { /* Don't try to fill the buffer, so this is an EOF. */
2326 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2328 /* We matched a single character, the EOB, so
2329 * treat this as a final EOF.
2331 return EOB_ACT_END_OF_FILE;
2336 /* We matched some text prior to the EOB, first
2339 return EOB_ACT_LAST_MATCH;
2343 /* Try to read more data. */
2345 /* First move last chars to start of buffer. */
2346 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2348 for ( i = 0; i < number_to_move; ++i )
2349 *(dest++) = *(source++);
2351 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2352 /* don't do the read, it's not guaranteed to return an EOF,
2355 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2360 yy_current_buffer->yy_buf_size - number_to_move - 1;
2362 while ( num_to_read <= 0 )
2363 { /* Not enough room in the buffer - grow it. */
2364 #ifdef YY_USES_REJECT
2366 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2369 /* just a shorter name for the current buffer */
2370 YY_BUFFER_STATE b = yy_current_buffer;
2372 int yy_c_buf_p_offset =
2373 (int) (yy_c_buf_p - b->yy_ch_buf);
2375 if ( b->yy_is_our_buffer )
2377 int new_size = b->yy_buf_size * 2;
2379 if ( new_size <= 0 )
2380 b->yy_buf_size += b->yy_buf_size / 8;
2382 b->yy_buf_size *= 2;
2384 b->yy_ch_buf = (char *)
2385 /* Include room in for 2 EOB chars. */
2386 yy_flex_realloc( (void *) b->yy_ch_buf,
2387 b->yy_buf_size + 2 );
2390 /* Can't grow it, we don't own it. */
2393 if ( ! b->yy_ch_buf )
2395 "fatal error - scanner input buffer overflow" );
2397 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2399 num_to_read = yy_current_buffer->yy_buf_size -
2404 if ( num_to_read > YY_READ_BUF_SIZE )
2405 num_to_read = YY_READ_BUF_SIZE;
2407 /* Read in more data. */
2408 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2409 yy_n_chars, num_to_read );
2411 yy_current_buffer->yy_n_chars = yy_n_chars;
2414 if ( yy_n_chars == 0 )
2416 if ( number_to_move == YY_MORE_ADJ )
2418 ret_val = EOB_ACT_END_OF_FILE;
2424 ret_val = EOB_ACT_LAST_MATCH;
2425 yy_current_buffer->yy_buffer_status =
2426 YY_BUFFER_EOF_PENDING;
2431 ret_val = EOB_ACT_CONTINUE_SCAN;
2433 yy_n_chars += number_to_move;
2434 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2435 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2437 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2443 /* yy_get_previous_state - get the state just before the EOB char was reached */
2445 static yy_state_type yy_get_previous_state()
2447 register yy_state_type yy_current_state;
2448 register char *yy_cp;
2450 yy_current_state = yy_start;
2452 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2454 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2455 if ( yy_accept[yy_current_state] )
2457 yy_last_accepting_state = yy_current_state;
2458 yy_last_accepting_cpos = yy_cp;
2460 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2462 yy_current_state = (int) yy_def[yy_current_state];
2463 if ( yy_current_state >= 529 )
2464 yy_c = yy_meta[(unsigned int) yy_c];
2466 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2469 return yy_current_state;
2473 /* yy_try_NUL_trans - try to make a transition on the NUL character
2476 * next_state = yy_try_NUL_trans( current_state );
2479 #ifdef YY_USE_PROTOS
2480 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2482 static yy_state_type yy_try_NUL_trans( yy_current_state )
2483 yy_state_type yy_current_state;
2486 register int yy_is_jam;
2487 register char *yy_cp = yy_c_buf_p;
2489 register YY_CHAR yy_c = 1;
2490 if ( yy_accept[yy_current_state] )
2492 yy_last_accepting_state = yy_current_state;
2493 yy_last_accepting_cpos = yy_cp;
2495 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2497 yy_current_state = (int) yy_def[yy_current_state];
2498 if ( yy_current_state >= 529 )
2499 yy_c = yy_meta[(unsigned int) yy_c];
2501 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2502 yy_is_jam = (yy_current_state == 528);
2504 return yy_is_jam ? 0 : yy_current_state;
2509 #ifdef YY_USE_PROTOS
2510 static void yyunput( int c, register char *yy_bp )
2512 static void yyunput( c, yy_bp )
2514 register char *yy_bp;
2517 register char *yy_cp = yy_c_buf_p;
2519 /* undo effects of setting up yytext */
2520 *yy_cp = yy_hold_char;
2522 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2523 { /* need to shift things up to make room */
2524 /* +2 for EOB chars. */
2525 register int number_to_move = yy_n_chars + 2;
2526 register char *dest = &yy_current_buffer->yy_ch_buf[
2527 yy_current_buffer->yy_buf_size + 2];
2528 register char *source =
2529 &yy_current_buffer->yy_ch_buf[number_to_move];
2531 while ( source > yy_current_buffer->yy_ch_buf )
2532 *--dest = *--source;
2534 yy_cp += (int) (dest - source);
2535 yy_bp += (int) (dest - source);
2536 yy_current_buffer->yy_n_chars =
2537 yy_n_chars = yy_current_buffer->yy_buf_size;
2539 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2540 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2543 *--yy_cp = (char) c;
2547 yy_hold_char = *yy_cp;
2550 #endif /* ifndef YY_NO_UNPUT */
2554 static int yyinput()
2561 *yy_c_buf_p = yy_hold_char;
2563 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2565 /* yy_c_buf_p now points to the character we want to return.
2566 * If this occurs *before* the EOB characters, then it's a
2567 * valid NUL; if not, then we've hit the end of the buffer.
2569 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2570 /* This was really a NUL. */
2574 { /* need more input */
2575 int offset = yy_c_buf_p - yytext_ptr;
2578 switch ( yy_get_next_buffer() )
2580 case EOB_ACT_LAST_MATCH:
2581 /* This happens because yy_g_n_b()
2582 * sees that we've accumulated a
2583 * token and flags that we need to
2584 * try matching the token before
2585 * proceeding. But for input(),
2586 * there's no matching to consider.
2587 * So convert the EOB_ACT_LAST_MATCH
2588 * to EOB_ACT_END_OF_FILE.
2591 /* Reset buffer status. */
2596 case EOB_ACT_END_OF_FILE:
2601 if ( ! yy_did_buffer_switch_on_eof )
2610 case EOB_ACT_CONTINUE_SCAN:
2611 yy_c_buf_p = yytext_ptr + offset;
2617 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2618 *yy_c_buf_p = '\0'; /* preserve yytext */
2619 yy_hold_char = *++yy_c_buf_p;
2626 #ifdef YY_USE_PROTOS
2627 void yyrestart( FILE *input_file )
2629 void yyrestart( input_file )
2633 if ( ! yy_current_buffer )
2634 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2636 yy_init_buffer( yy_current_buffer, input_file );
2637 yy_load_buffer_state();
2641 #ifdef YY_USE_PROTOS
2642 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2644 void yy_switch_to_buffer( new_buffer )
2645 YY_BUFFER_STATE new_buffer;
2648 if ( yy_current_buffer == new_buffer )
2651 if ( yy_current_buffer )
2653 /* Flush out information for old buffer. */
2654 *yy_c_buf_p = yy_hold_char;
2655 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2656 yy_current_buffer->yy_n_chars = yy_n_chars;
2659 yy_current_buffer = new_buffer;
2660 yy_load_buffer_state();
2662 /* We don't actually know whether we did this switch during
2663 * EOF (yywrap()) processing, but the only time this flag
2664 * is looked at is after yywrap() is called, so it's safe
2665 * to go ahead and always set it.
2667 yy_did_buffer_switch_on_eof = 1;
2671 #ifdef YY_USE_PROTOS
2672 void yy_load_buffer_state( void )
2674 void yy_load_buffer_state()
2677 yy_n_chars = yy_current_buffer->yy_n_chars;
2678 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2679 yyin = yy_current_buffer->yy_input_file;
2680 yy_hold_char = *yy_c_buf_p;
2684 #ifdef YY_USE_PROTOS
2685 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2687 YY_BUFFER_STATE yy_create_buffer( file, size )
2694 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2696 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2698 b->yy_buf_size = size;
2700 /* yy_ch_buf has to be 2 characters longer than the size given because
2701 * we need to put in 2 end-of-buffer characters.
2703 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2704 if ( ! b->yy_ch_buf )
2705 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2707 b->yy_is_our_buffer = 1;
2709 yy_init_buffer( b, file );
2715 #ifdef YY_USE_PROTOS
2716 void yy_delete_buffer( YY_BUFFER_STATE b )
2718 void yy_delete_buffer( b )
2725 if ( b == yy_current_buffer )
2726 yy_current_buffer = (YY_BUFFER_STATE) 0;
2728 if ( b->yy_is_our_buffer )
2729 yy_flex_free( (void *) b->yy_ch_buf );
2731 yy_flex_free( (void *) b );
2735 #ifndef YY_ALWAYS_INTERACTIVE
2736 #ifndef YY_NEVER_INTERACTIVE
2737 extern int isatty YY_PROTO(( int ));
2741 #ifdef YY_USE_PROTOS
2742 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2744 void yy_init_buffer( b, file )
2751 yy_flush_buffer( b );
2753 b->yy_input_file = file;
2754 b->yy_fill_buffer = 1;
2756 #if YY_ALWAYS_INTERACTIVE
2757 b->yy_is_interactive = 1;
2759 #if YY_NEVER_INTERACTIVE
2760 b->yy_is_interactive = 0;
2762 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2768 #ifdef YY_USE_PROTOS
2769 void yy_flush_buffer( YY_BUFFER_STATE b )
2771 void yy_flush_buffer( b )
2781 /* We always need two end-of-buffer characters. The first causes
2782 * a transition to the end-of-buffer state. The second causes
2783 * a jam in that state.
2785 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2786 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2788 b->yy_buf_pos = &b->yy_ch_buf[0];
2791 b->yy_buffer_status = YY_BUFFER_NEW;
2793 if ( b == yy_current_buffer )
2794 yy_load_buffer_state();
2798 #ifndef YY_NO_SCAN_BUFFER
2799 #ifdef YY_USE_PROTOS
2800 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2802 YY_BUFFER_STATE yy_scan_buffer( base, size )
2810 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2811 base[size-1] != YY_END_OF_BUFFER_CHAR )
2812 /* They forgot to leave room for the EOB's. */
2815 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2817 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2819 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2820 b->yy_buf_pos = b->yy_ch_buf = base;
2821 b->yy_is_our_buffer = 0;
2822 b->yy_input_file = 0;
2823 b->yy_n_chars = b->yy_buf_size;
2824 b->yy_is_interactive = 0;
2826 b->yy_fill_buffer = 0;
2827 b->yy_buffer_status = YY_BUFFER_NEW;
2829 yy_switch_to_buffer( b );
2836 #ifndef YY_NO_SCAN_STRING
2837 #ifdef YY_USE_PROTOS
2838 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2840 YY_BUFFER_STATE yy_scan_string( yy_str )
2841 yyconst char *yy_str;
2845 for ( len = 0; yy_str[len]; ++len )
2848 return yy_scan_bytes( yy_str, len );
2853 #ifndef YY_NO_SCAN_BYTES
2854 #ifdef YY_USE_PROTOS
2855 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2857 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2858 yyconst char *bytes;
2867 /* Get memory for full buffer, including space for trailing EOB's. */
2869 buf = (char *) yy_flex_alloc( n );
2871 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2873 for ( i = 0; i < len; ++i )
2876 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2878 b = yy_scan_buffer( buf, n );
2880 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2882 /* It's okay to grow etc. this buffer, and we should throw it
2883 * away when we're done.
2885 b->yy_is_our_buffer = 1;
2892 #ifndef YY_NO_PUSH_STATE
2893 #ifdef YY_USE_PROTOS
2894 static void yy_push_state( int new_state )
2896 static void yy_push_state( new_state )
2900 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2904 yy_start_stack_depth += YY_START_STACK_INCR;
2905 new_size = yy_start_stack_depth * sizeof( int );
2907 if ( ! yy_start_stack )
2908 yy_start_stack = (int *) yy_flex_alloc( new_size );
2911 yy_start_stack = (int *) yy_flex_realloc(
2912 (void *) yy_start_stack, new_size );
2914 if ( ! yy_start_stack )
2916 "out of memory expanding start-condition stack" );
2919 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2926 #ifndef YY_NO_POP_STATE
2927 static void yy_pop_state()
2929 if ( --yy_start_stack_ptr < 0 )
2930 YY_FATAL_ERROR( "start-condition stack underflow" );
2932 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2937 #ifndef YY_NO_TOP_STATE
2938 static int yy_top_state()
2940 return yy_start_stack[yy_start_stack_ptr - 1];
2944 #ifndef YY_EXIT_FAILURE
2945 #define YY_EXIT_FAILURE 2
2948 #ifdef YY_USE_PROTOS
2949 static void yy_fatal_error( yyconst char msg[] )
2951 static void yy_fatal_error( msg )
2955 (void) fprintf( stderr, "%s\n", msg );
2956 exit( YY_EXIT_FAILURE );
2961 /* Redefine yyless() so it works in section 3 code. */
2967 /* Undo effects of setting up yytext. */ \
2968 yytext[yyleng] = yy_hold_char; \
2969 yy_c_buf_p = yytext + n; \
2970 yy_hold_char = *yy_c_buf_p; \
2971 *yy_c_buf_p = '\0'; \
2977 /* Internal utility routines. */
2980 #ifdef YY_USE_PROTOS
2981 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2983 static void yy_flex_strncpy( s1, s2, n )
2990 for ( i = 0; i < n; ++i )
2995 #ifdef YY_NEED_STRLEN
2996 #ifdef YY_USE_PROTOS
2997 static int yy_flex_strlen( yyconst char *s )
2999 static int yy_flex_strlen( s )
3004 for ( n = 0; s[n]; ++n )
3012 #ifdef YY_USE_PROTOS
3013 static void *yy_flex_alloc( yy_size_t size )
3015 static void *yy_flex_alloc( size )
3019 return (void *) malloc( size );
3022 #ifdef YY_USE_PROTOS
3023 static void *yy_flex_realloc( void *ptr, yy_size_t size )
3025 static void *yy_flex_realloc( ptr, size )
3030 /* The cast to (char *) in the following accommodates both
3031 * implementations that use char* generic pointers, and those
3032 * that use void* generic pointers. It works with the latter
3033 * because both ANSI C and C++ allow castless assignment from
3034 * any pointer type to void*, and deal with argument conversions
3035 * as though doing an assignment.
3037 return (void *) realloc( (char *) ptr, size );
3040 #ifdef YY_USE_PROTOS
3041 static void yy_flex_free( void *ptr )
3043 static void yy_flex_free( ptr )
3057 #line 540 "cscanner.l"
3062 /*@null@*/ /*@observer@*/ char *name;
3067 ** These tokens are followed by syntax that is parsed by the
3071 struct skeyword s_parsetable[] = {
3072 { "modifies", QMODIFIES } ,
3073 { "globals", QGLOBALS } ,
3075 { "constant", QCONSTANT } ,
3076 { "function", QFUNCTION } ,
3078 { "defines", QDEFINES } ,
3080 { "allocates", QALLOCATES } ,
3082 { "releases", QRELEASES } ,
3083 { "pre", QPRECLAUSE } ,
3084 { "post", QPOSTCLAUSE } ,
3085 {"setBufferSize", QSETBUFFERSIZE},
3086 {"bufferConstraint", QBUFFERCONSTRAINT},
3087 {"ensuresConstraint", QENSURESCONSTRAINT},
3088 {"setStringLength", QSETSTRINGLENGTH},
3089 {"testinRange", QTESTINRANGE},
3094 ** These tokens are either stand-alone tokens, or followed by
3095 ** token-specific text.
3098 struct skeyword s_keytable[] = {
3099 { "anytype", QANYTYPE } ,
3100 { "integraltype", QINTEGRALTYPE } ,
3101 { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } ,
3102 { "signedintegraltype", QSIGNEDINTEGRALTYPE } ,
3106 { "owned", QOWNED } ,
3107 { "dependent", QDEPENDENT } ,
3108 { "partial", QPARTIAL } ,
3109 { "special", QSPECIAL } ,
3110 { "truenull", QTRUENULL } ,
3111 { "falsenull", QFALSENULL } ,
3114 { "notnull", QNOTNULL } ,
3115 { "abstract", QABSTRACT } ,
3116 { "concrete", QCONCRETE } ,
3117 { "mutable", QMUTABLE } ,
3118 { "immutable", QIMMUTABLE } ,
3119 { "unused", QUNUSED } ,
3120 { "external", QEXTERNAL } ,
3122 { "unique", QUNIQUE } ,
3123 { "returned", QRETURNED } ,
3124 { "exposed", QEXPOSED } ,
3125 { "refcounted", QREFCOUNTED } ,
3127 { "newref", QNEWREF } ,
3128 { "tempref", QTEMPREF } ,
3129 { "killref", QKILLREF } ,
3131 { "relnull", QRELNULL } ,
3132 { "nullterminated", QNULLTERMINATED },
3133 { "setBufferSize", QSETBUFFERSIZE },
3134 { "bufferConstraint", QBUFFERCONSTRAINT },
3135 { "ensuresConstraint", QENSURESCONSTRAINT },
3136 { "testInRange", QTESTINRANGE},
3137 { "MaxSet", QMAXSET},
3138 { "MaxRead", QMAXREAD},
3139 { "reldef", QRELDEF } ,
3140 { "observer", QOBSERVER } ,
3141 { "exits", QEXITS } ,
3142 { "mayexit", QMAYEXIT } ,
3143 { "trueexit", QTRUEEXIT } ,
3144 { "falseexit", QFALSEEXIT } ,
3145 { "neverexit", QNEVEREXIT } ,
3147 { "shared", QSHARED } ,
3149 { "unchecked", QUNCHECKED } ,
3150 { "checked", QCHECKED } ,
3151 { "checkmod", QCHECKMOD } ,
3152 { "checkedstrict", QCHECKEDSTRICT } ,
3153 { "innercontinue", QINNERCONTINUE } ,
3154 { "innerbreak", QINNERBREAK } ,
3155 { "loopbreak", QLOOPBREAK } ,
3156 { "switchbreak", QSWITCHBREAK } ,
3157 { "safebreak", QSAFEBREAK } ,
3158 { "fallthrough", QFALLTHROUGH } ,
3159 { "l_fallthrou", QLINTFALLTHROUGH } ,
3160 { "l_fallth", QLINTFALLTHRU } ,
3161 { "notreached", QNOTREACHED } ,
3162 { "l_notreach", QLINTNOTREACHED } ,
3163 { "printflike", QPRINTFLIKE } ,
3164 { "l_printfli", QLINTPRINTFLIKE } ,
3165 { "scanflike", QSCANFLIKE } ,
3166 { "messagelike", QMESSAGELIKE } ,
3167 { "l_argsus", QARGSUSED } ,
3172 ** would be better if these weren't hard coded...
3175 static bool isArtificial (cstring s)
3177 return (cstring_equalLit (s, "modifies")
3178 || cstring_equalLit (s, "globals")
3179 || cstring_equalLit (s, "alt"));
3182 void swallowMacro (void)
3185 bool skipnext = FALSE;
3187 while ((i = lminput ()) != EOF)
3204 checkUngetc (i, yyin);
3212 checkUngetc (i, yyin);
3216 static int commentMarkerToken (cstring s)
3220 while (s_parsetable[i].name != NULL)
3222 if (cstring_equalLit (s, s_parsetable[i].name))
3224 return s_parsetable[i].token;
3233 static int tokenMacroCode (cstring s)
3237 while (s_keytable[i].name != NULL)
3239 if (cstring_equalLit (s, s_keytable[i].name))
3241 if (s_keytable[i].token == QLINTFALLTHROUGH)
3244 (FLG_WARNLINTCOMMENTS,
3246 ("Traditional lint comment /*FALLTHROUGH*/ used. "
3247 "This is interpreted by "
3248 "LCLint in the same way as most Unix lints, but it is "
3249 "preferable to replace it with the /*@fallthrough@*/ "
3250 "stylized comment"),
3252 return QFALLTHROUGH;
3254 else if (s_keytable[i].token == QLINTFALLTHRU)
3257 (FLG_WARNLINTCOMMENTS,
3259 ("Traditional lint comment /*FALLTHRU*/ used. "
3260 "This is interpreted by "
3261 "LCLint in the same way as most Unix lints, but it is "
3262 "preferable to replace it with the /*@fallthrough@*/ "
3263 "stylized comment"),
3265 return QFALLTHROUGH;
3267 else if (s_keytable[i].token == QLINTNOTREACHED)
3270 (FLG_WARNLINTCOMMENTS,
3272 ("Traditional lint comment /*NOTREACHED*/ used. "
3273 "This is interpreted by "
3274 "LCLint in the same way as most Unix lints, but it is "
3275 "preferable to replace it with the /*@notreached@*/ "
3276 "stylized comment."),
3281 else if (s_keytable[i].token == QPRINTFLIKE)
3283 setSpecialFunction (QU_PRINTFLIKE);
3286 else if (s_keytable[i].token == QLINTPRINTFLIKE)
3289 (FLG_WARNLINTCOMMENTS,
3291 ("Traditional lint comment /*PRINTFLIKE*/ used. "
3292 "This is interpreted by "
3293 "LCLint in the same way as most Unix lints, but it is "
3294 "preferable to replace it with either /*@printflike@*/, "
3295 "/*@scanflike@*/ or /*@messagelike@*/."),
3298 setSpecialFunction (QU_PRINTFLIKE);
3301 else if (s_keytable[i].token == QSCANFLIKE)
3303 setSpecialFunction (QU_SCANFLIKE);
3306 else if (s_keytable[i].token == QMESSAGELIKE)
3308 setSpecialFunction (QU_MESSAGELIKE);
3311 else if (s_keytable[i].token == QARGSUSED)
3314 (FLG_WARNLINTCOMMENTS,
3316 ("Traditional lint comment /*ARGSUSED*/ used. "
3317 "This is interpreted by "
3318 "LCLint in the same way as most Unix lints, but it is "
3319 "preferable to use /*@unused@*/ annotations on "
3320 "the unused parameters."),
3327 return s_keytable[i].token;
3336 static int lminput ()
3338 if (savechar == '\0')
3345 int save = (int) savechar;
3351 static void lmsavechar (char c)
3353 if (savechar == '\0') savechar = c;
3356 llbuglit ("lmsavechar: override");
3360 static int returnFloat (ctype ct, double f)
3362 yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext),
3363 fileloc_decColumn (g_currentloc, tokLength));
3368 static int returnInt (ctype ct, long i)
3372 if (ctype_equal (ct, ctype_int))
3376 c = context_typeofZero ();
3380 c = context_typeofOne ();
3384 yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext),
3385 fileloc_decColumn (g_currentloc, tokLength), i);
3390 static int returnChar (char c)
3392 yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext),
3393 fileloc_decColumn (g_currentloc, tokLength));
3398 static int ninput ()
3402 if (c != EOF && ((char)c == '\n'))
3404 context_incLineno ();
3410 static char macro_nextChar ()
3412 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3417 c = char_fromInt (ic);
3419 if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0]))
3423 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3425 ; /* skip to newline */
3428 context_incLineno ();
3432 return macro_nextChar ();
3439 else /* if (c == '@') */
3441 if (handleLlSpecial () != BADTOK)
3443 llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax");
3446 return macro_nextChar ();
3449 else if (!in_escape && c == '\"')
3451 in_quote = !in_quote;
3453 else if (!in_escape && c == '\'')
3457 else if ((in_quote || in_char) && c == '\\')
3459 in_escape = !in_escape;
3461 else if ((in_quote || in_char) && in_escape)
3465 else if (!in_quote && c == '/')
3469 if ((c2 = char_fromInt (lminput ())) == '*')
3473 while ((c2 = char_fromInt (lminput ())) != '\0'
3474 && c2 != '\n' && c2 != '*')
3481 while ((c2 = char_fromInt (lminput ())) != '\0'
3494 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3498 return macro_nextChar ();
3502 /*** putchar does not work! why? puts to stdio...??! ***/
3510 ** keeps stylized comments
3513 static char macro_nextCharC ()
3515 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3518 c = char_fromInt (lminput ());
3520 if (!in_quote && !in_char && c == '\\')
3522 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3524 ; /* skip to newline */
3527 context_incLineno ();
3531 return macro_nextCharC ();
3538 else if (!in_escape && c == '\"')
3540 in_quote = !in_quote;
3542 else if (!in_escape && c == '\'')
3546 else if ((in_quote || in_char) && c == '\\')
3548 in_escape = !in_escape;
3550 else if ((in_quote || in_char) && in_escape)
3554 else if (!in_quote && c == '/')
3558 if ((c2 = char_fromInt (lminput ())) == '*')
3562 while ((c2 = char_fromInt (lminput ())) != '\0'
3563 && c2 != '\n' && c2 != '*')
3570 while ((c2 = char_fromInt (lminput ())) != '\0'
3583 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3587 return macro_nextCharC ();
3598 ** skips whitespace (handles line continuations)
3599 ** returns first non-whitespace character
3602 static char skip_whitespace ()
3606 while ((c = macro_nextChar ()) == ' ' || c == '\t')
3614 static void handleMacro ()
3616 cstring mac = cstring_undefined;
3620 while (currentColumn () > 2)
3622 mac = cstring_appendChar (mac, ' ');
3626 c = macro_nextCharC ();
3628 if (c >= '0' && c <= '9')
3632 for (i = 0; i < ((c - '0') + 1); i++)
3634 mac = cstring_appendChar (mac, ' ');
3642 while (((c = macro_nextCharC ()) != '\0') && (c != '\n'))
3644 mac = cstring_appendChar (mac, c);
3648 macrocode = tokenMacroCode (mac);
3650 if (macrocode == BADTOK && !isArtificial (mac))
3652 DPRINTF (("Add macro: %s", mac));
3653 context_addMacroCache (mac);
3662 context_incLineno ();
3666 static bool processMacro (void)
3671 cstring fname = cstring_undefined;
3673 bool isspecfcn = FALSE;
3674 bool isiter = FALSE;
3675 bool skipparam = FALSE;
3676 bool isenditer = FALSE;
3677 bool unknownm = FALSE;
3678 bool hasParams = FALSE;
3679 bool emptyMacro = FALSE;
3680 char c = skip_whitespace ();
3681 fileloc loc = fileloc_noColumn (g_currentloc);
3683 /* are both of these necessary? what do they mean? */
3684 uentryList specparams = uentryList_undefined;
3685 uentryList pn = uentryList_undefined;
3687 context_resetMacroMissingParams ();
3689 if (c == '\0' || c == '\n')
3691 llcontbug (cstring_makeLiteral ("Bad macro"));
3696 fname = cstring_appendChar (fname, c);
3698 while ((c = macro_nextChar ()) != '(' && c != '\0'
3699 && c != ' ' && c != '\t' && c != '\n')
3701 fname = cstring_appendChar (fname, c);
3704 if (c == ' ' || c == '\t' || c == '\n')
3710 while (c == ' ' || c == '\t')
3712 c = macro_nextChar ();
3726 hasParams = (c == '(');
3729 if (usymtab_exists (fname))
3731 e2 = usymtab_lookupExpose (fname);
3732 ct = uentry_getType (e2);
3735 if (uentry_isCodeDefined (e2)
3736 && fileloc_isUser (uentry_whereDefined (e2)))
3740 message ("Macro %s already defined", fname),
3743 uentry_showWhereDefined (e2);
3744 uentry_clearDefined (e2);
3747 if (uentry_isFunction (e2))
3749 uentry_setType (e2, ctype_unknown);
3752 context_enterUnknownMacro (e2);
3756 context_enterConstantMacro (e2);
3761 if (uentry_isForward (e2) && uentry_isFunction (e2))
3768 ("Parameterized macro has no prototype or specification: %s ",
3773 uentry_setType (e2, ctype_unknown);
3774 uentry_setFunctionDefined (e2, loc);
3775 uentry_setUsed (e2, fileloc_undefined);
3776 context_enterUnknownMacro (e2);
3780 if (uentry_isIter (e2))
3783 specparams = uentry_getParams (e2);
3784 noparams = uentryList_size (specparams);
3785 uentry_setDefined (e2, loc);
3786 context_enterIterDef (e2);
3788 else if (uentry_isEndIter (e2))
3791 uentry_setDefined (e2, loc);
3792 context_enterIterEnd (e2); /* don't care about it now */
3793 /* but should parse like an iter! */
3795 else if (uentry_isConstant (e2))
3801 message ("Constant %s implemented as parameterized macro",
3805 uentry_showWhereSpecified (e2);
3806 uentry_setType (e2, ctype_unknown);
3807 uentry_makeVarFunction (e2);
3808 uentry_setDefined (e2, g_currentloc);
3809 uentry_setFunctionDefined (e2, g_currentloc);
3810 context_enterUnknownMacro (e2);
3814 if (!uentry_isSpecified (e2))
3816 fileloc oloc = uentry_whereDeclared (e2);
3818 if (fileloc_isLib (oloc))
3822 else if (fileloc_isUndefined (oloc)
3823 || fileloc_isPreproc (oloc))
3828 (FLG_MACROCONSTDECL,
3830 ("Macro constant %q not declared",
3831 uentry_getName (e2)),
3835 else if (!fileloc_withinLines (oloc, loc, 2))
3836 { /* bogus! will give errors if there is too much whitespace */
3840 ("Macro constant name %s does not match name in "
3841 "previous constant declaration. This constant "
3842 "is declared at %q", fname,
3843 fileloc_unparse (oloc)),
3848 context_enterConstantMacro (e2);
3849 cstring_free (fname);
3855 else if (ctype_isFunction (ct))
3858 specparams = ctype_argsFunction (ct);
3859 noparams = uentryList_size (specparams);
3861 uentry_setFunctionDefined (e2, loc);
3862 context_enterMacro (e2);
3864 else if (uentry_isVar (e2))
3870 message ("Variable %s implemented as parameterized macro",
3874 uentry_showWhereSpecified (e2);
3875 uentry_setType (e2, ctype_unknown);
3876 uentry_makeVarFunction (e2);
3877 uentry_setDefined (e2, g_currentloc);
3878 uentry_setFunctionDefined (e2, g_currentloc);
3879 context_enterUnknownMacro (e2);
3883 uentry ucons = uentry_makeConstant (fname,
3886 if (uentry_isExpandedMacro (e2))
3894 message ("Variable %s implemented by a macro",
3898 uentry_showWhereSpecified (e2);
3902 uentry_setDefined (e2, loc);
3903 uentry_setUsed (ucons, loc);
3905 context_enterConstantMacro (ucons);
3906 uentry_markOwned (ucons);
3907 cstring_free (fname);
3913 if (uentry_isDatatype (e2))
3917 message ("Type implemented as macro: %x",
3918 uentry_getName (e2)),
3919 message ("A type is implemented using a macro definition. A "
3920 "typedef should be used instead."),
3924 /* Must exit scope (not sure why a new scope was entered?) */
3925 usymtab_quietExitScope (g_currentloc);
3926 uentry_setDefined (e2, g_currentloc);
3932 (message ("Unexpanded macro not function or constant: %q",
3933 uentry_unparse (e2)));
3934 uentry_setType (e2, ctype_unknown);
3938 uentry_makeVarFunction (e2);
3939 uentry_setDefined (e2, g_currentloc);
3940 uentry_setFunctionDefined (e2, g_currentloc);
3941 context_enterUnknownMacro (e2);
3953 (FLG_MACROMATCHNAME,
3954 message ("Unexpanded macro %s does not match name of a constant "
3955 "or iter declaration. The name used in the control "
3956 "comment on the previous line should match. "
3957 "(Assuming macro defines a constant.)",
3962 ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined);
3963 uentry_setUsed (ce, loc); /* perhaps bogus? */
3964 e2 = usymtab_supEntryReturn (ce);
3966 context_enterConstantMacro (e2);
3967 cstring_free (fname);
3972 /* in macros, ( must follow immediatetly after name */
3978 c = skip_whitespace ();
3980 while (c != ')' && c != '\0')
3983 bool suppress = context_inSuppressRegion ();
3984 cstring paramname = cstring_undefined;
3987 ** save the parameter location
3991 context_saveLocation ();
3994 while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')')
3996 paramname = cstring_appendChar (paramname, c);
3997 c = macro_nextChar ();
4000 if (c == ' ' || c == '\t') c = skip_whitespace ();
4004 c = macro_nextChar ();
4005 if (c == ' ' || c == '\t') c = skip_whitespace ();
4010 llfatalerror (cstring_makeLiteral
4011 ("Bad macro syntax: uentryList"));
4014 if ((isspecfcn || isiter) && (paramno < noparams)
4015 && !uentry_isElipsisMarker (uentryList_getN
4016 (specparams, paramno)))
4018 uentry decl = uentryList_getN (specparams, paramno);
4021 param = uentry_nameCopy (paramname, decl);
4024 uentry_setParam (param);
4025 sr = sRef_makeParam (paramno, uentry_getType (param));
4027 if (sRef_getNullState (sr) == NS_ABSNULL)
4029 ctype pt = ctype_realType (uentry_getType (param));
4031 if (ctype_isUser (pt))
4033 uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt));
4035 if (uentry_isValid (te))
4037 sRef_setStateFromUentry (sr, te);
4042 sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
4046 uentry_setSref (param, sr);
4047 uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
4049 skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
4053 fileloc sloc = context_getSaveLocation ();
4055 param = uentry_makeVariableSrefParam
4056 (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
4057 cstring_free (paramname);
4059 sRef_setPosNull (uentry_getSref (param), sloc);
4061 uentry_setDeclaredForce (param, sloc);
4064 fileloc_free (sloc);
4069 llassert (!uentry_isElipsisMarker (param));
4073 sRef_makeUnsafe (uentry_getSref (param));
4076 pn = uentryList_add (pn, uentry_copy (param));
4077 usymtab_supEntry (param);
4081 /* don't add param */
4082 uentry_free (param);
4087 (void) macro_nextChar ();
4088 c = skip_whitespace ();
4096 if (isspecfcn || isiter)
4098 if (paramno != noparams && noparams >= 0)
4104 message ("Macro %s specified with %d args, defined with %d",
4105 fname, noparams, paramno),
4108 uentry_showWhereSpecified (e2);
4109 uentry_resetParams (e2, pn);
4114 uentry_resetParams (e2, pn);
4121 ** the form should be:
4123 ** # define newname oldname
4124 ** where oldname refers to a function matching the specification
4130 sRef_setGlobalScope ();
4131 usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown));
4132 sRef_clearGlobalScope ();
4136 context_setMacroMissingParams ();
4141 /* context_setuentryList (pn); */
4142 usymtab_enterScope ();
4145 cstring_free (fname);
4150 static bool handleSpecial (char *yyt)
4152 char *l = mstring_create (MAX_NAME_LENGTH);
4153 static bool reportcpp = FALSE;
4159 strcpy (l, yyt + 1);
4161 /* Need to safe original l for deallocating. */
4164 l += strlen (yyt) - 1;
4166 while ((c = char_fromInt (lminput ())) != '\n' && c != '\0')
4172 olc = cstring_fromChars (ol);
4174 if (cstring_equalPrefix (olc, "pragma"))
4176 char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN));
4177 char *opname = pname;
4178 char *ptr = ol + 6; /* pragma is six characters, plus space */
4182 /* skip whitespace */
4183 while (((c = *ptr) != '\0') && isspace (c))
4189 while (((c = *ptr) != '\0') && !isspace (c))
4193 if (len > MAX_PRAGMA_LEN)
4204 if (len == PRAGMA_LEN_EXPAND
4205 && mstring_equal (opname, PRAGMA_EXPAND))
4207 cstring exname = cstring_undefined;
4211 while (((c = *ptr) != '\0') && !isspace (c))
4213 exname = cstring_appendChar (exname, c);
4218 ue = usymtab_lookupExposeGlob (exname);
4220 if (uentry_isExpandedMacro (ue))
4222 if (fileloc_isPreproc (uentry_whereDefined (ue)))
4224 fileloc_setColumn (g_currentloc, 1);
4225 uentry_setDefined (ue, g_currentloc);
4229 cstring_free (exname);
4232 else if (cstring_equalPrefix (olc, "ident"))
4234 /* Some pre-processors will leave these in the code. Ignore rest of line */
4237 ** Yuk...Win32 filenames can have spaces in them...we need to read
4238 ** to the matching end quote.
4240 else if ((sscanf (ol, "line %d \"", &lineno) == 1)
4241 || (sscanf (ol, " %d \"", &lineno) == 1))
4247 while (*tmp != '\"' && *tmp != '\0')
4252 llassert (*tmp == '\"');
4257 while (*tmp != '\"' && *tmp != '\0')
4262 llassert (*tmp == '\"');
4266 DPRINTF (("fname: %s", fname));
4268 # if defined(OS2) || defined(MSDOS) || defined(WIN32)
4271 ** DOS-like path delimiters get delivered in pairs, something like
4272 ** \"..\\\\file.h\", so we have to make it normal again. We do NOT
4273 ** remove the pre dirs yet as we usually specify tmp paths relative
4274 ** to the current directory, so tmp files would not get found in
4275 ** the hash table. If this method fails we try it again later.
4282 ** Skip past the drive marker.
4285 DPRINTF (("stmp: %s / %s", stmp, fname));
4287 if (strchr (stmp, ':') != NULL)
4289 stmp = strchr (stmp, ':') + 1;
4292 DPRINTF (("stmp: %s / %s", stmp, fname));
4294 while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL )
4296 if (*(stmp+1) == CONNECTCHAR)
4298 memmove (stmp, stmp+1, strlen (stmp));
4302 DPRINTF (("stmp: %s / %s", stmp, fname));
4305 DPRINTF (("Now: base = %s", fname));
4307 fid = fileTable_lookupBase (context_fileTable (),
4308 cstring_fromChars (fname));
4309 if (!(fileId_isValid (fid)))
4311 fname = removePreDirs (fname);
4312 fid = fileTable_lookupBase (context_fileTable (),
4313 cstring_fromChars (fname));
4316 # else /* !defined(OS2) && !defined(MSDOS) */
4317 fname = removePreDirs (fname);
4318 fid = fileTable_lookupBase (context_fileTable (),
4319 cstring_fromChars (fname));
4320 # endif /* !defined(OS2) && !defined(MSDOS) */
4322 if (!(fileId_isValid (fid)))
4324 if (isHeaderFile (cstring_fromChars (fname)))
4326 fid = fileTable_addHeaderFile (context_fileTable (),
4327 cstring_fromChars (fname));
4331 fid = fileTable_addFile (context_fileTable (),
4332 cstring_fromChars (fname));
4336 setFileLine (fid, lineno);
4338 else if ((sscanf (ol, "line %d", &lineno) == 1)
4339 || (sscanf (ol, " %d", &lineno) == 1))
4341 setLine (lineno); /* next line is <cr> */
4345 if (mstring_equal (ol, "")) {
4346 DPRINTF (("Empty pp command!"));
4348 ** evs 2000-05-16: This is a horrible kludge, to get around a bug (well, difficulty) in the pre-processor.
4349 ** We handle a plain # in the input file, by echoing it, and ignoring it in the post-pp-file.
4358 llbug (message ("File contains preprocessor command: #%s",
4359 cstring_fromChars (ol)));
4372 static int handleLlSpecial ()
4376 char *s = mstring_createEmpty ();
4381 while (((ic = ninput ()) != 0) && isalpha (ic))
4384 s = mstring_append (s, c);
4390 if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0])
4394 llassert (ic == AFTER_COMMENT_MARKER[1]);
4397 if (isProcessingGlobMods () && (*s == '\0'))
4400 return QNOMODS; /* special token no modifications token */
4408 tok = commentMarkerToken (cstring_fromChars (os));
4412 tokLength = charsread;
4418 /* Add rest of the comment */
4420 if (ic != 0 && ic != EOF)
4425 s = mstring_append (s, c);
4428 while (((ic = ninput ()) != 0) && (ic != EOF)
4429 && (ic != AFTER_COMMENT_MARKER[0]))
4432 s = mstring_append (s, c);
4437 if (ic == AFTER_COMMENT_MARKER[0])
4440 llassert ((char) nc == AFTER_COMMENT_MARKER[1]);
4447 while (*s == ' ' || *s == '\t' || *s == '\n')
4452 if (*s == '-' || *s == '+' || *s == '=') /* setting flags */
4456 while (c == '-' || c == '+' || c == '=')
4458 ynm set = ynm_fromCodeChar (c);
4463 thisflag = cstring_fromChars (s);
4465 while ((c = *s) != '\0' && (c != '-') && (c != '=')
4466 && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n'))
4473 if (!context_getFlag (FLG_NOCOMMENTS))
4475 cstring flagname = thisflag;
4476 flagcode fflag = identifyFlag (flagname);
4478 if (flagcode_isSkip (fflag))
4482 else if (flagcode_isInvalid (fflag))
4484 if (isMode (flagname))
4486 if (ynm_isMaybe (set))
4491 ("Stylized comment attempts to restore flag %s. "
4492 "A mode flag cannot be restored.",
4497 context_setMode (flagname);
4504 message ("Unrecognized option in stylized comment: %s",
4508 else if (flagcode_isGlobalFlag (fflag))
4513 ("Stylized comment attempts to set global flag %s. "
4514 "A global flag cannot be set locally.",
4519 context_fileSetFlag (fflag, set);
4521 if (flagcode_hasArgument (fflag))
4523 if (ynm_isMaybe (set))
4528 ("Stylized comment attempts to restore flag %s. "
4529 "A flag for setting a value cannot be restored.",
4533 { /* cut-and-pastied from llmain...blecch */
4534 cstring extra = cstring_undefined;
4540 rest = mstring_copy (s);
4544 while ((rchar = *rest) != '\0'
4545 && (isspace (rchar)))
4551 while ((rchar = *rest) != '\0'
4552 && !isspace (rchar))
4554 extra = cstring_appendChar (extra, rchar);
4561 if (cstring_isUndefined (extra))
4566 ("Flag %s (in stylized comment) must be followed by an argument",
4567 flagcode_unparse (fflag)));
4573 if (flagcode_hasValue (fflag))
4575 setValueFlag (fflag, extra);
4577 else if (flagcode_hasString (fflag))
4579 setStringFlag (fflag, extra);
4596 while ((c == ' ') || (c == '\t') || (c == '\n'))
4602 if (context_inHeader () && !isArtificial (cstring_fromChars (os)))
4604 context_addComment (cstring_fromCharsNew (os));
4617 while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n')
4629 t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t)));
4630 macrocode = tokenMacroCode (cstring_fromChars (t));
4632 if (macrocode != BADTOK)
4634 tokLength = mstring_length (t);
4640 if (macrocode == SKIPTOK)
4648 if (context_inHeader ())
4655 if ((context_inMacro () || context_inGlobalContext ())
4656 && macrocode != SKIPTOK
4657 && !isArtificial (cstring_fromChars (os)))
4659 context_addComment (cstring_fromCharsNew (os));
4672 if (mstring_equal (t, "ignore"))
4674 if (!context_getFlag (FLG_NOCOMMENTS))
4676 context_enterSuppressRegion ();
4679 else if ((*t == 'i' || *t == 't')
4680 && (*(t + 1) == '\0'))
4682 if (!context_getFlag (FLG_NOCOMMENTS)
4683 && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS)))
4685 context_enterSuppressLine (-1); /* infinite suppression */
4688 else if (((*t == 'i') || (*t == 't'))
4689 && ((*(t + 1) >= '0' && *(t + 1) <= '9')))
4691 bool tmpcomment = (*t == 't');
4693 char *tt = t; /* don't mangle t, since it is free'd */
4696 if (lc >= '0' && lc <= '9')
4698 val = (int)(lc - '0');
4701 while (lc >= '0' && lc <= '9')
4710 if (!context_getFlag (FLG_NOCOMMENTS)
4711 && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS)))
4713 context_enterSuppressLine (val);
4716 else if (mstring_equal (t, "end"))
4718 if (!context_getFlag (FLG_NOCOMMENTS))
4720 context_exitSuppressRegion ();
4723 else if (mstring_equal (t, "notfunction"))
4725 ; /* handled by pcpp */
4727 else if (mstring_equal (t, "access"))
4733 while ((c = *s) && (c == ' ' || c == '\t' || c == '\n'))
4743 tname = cstring_fromChars (s);
4745 while ((c = *s) != '\0' && c != ' '
4746 && c != '\t' && c != '\n' && c != ',')
4754 if (!context_getFlag (FLG_NOCOMMENTS)
4755 && !context_getFlag (FLG_NOACCESS))
4757 if (usymtab_existsType (tname))
4759 usymId uid = usymtab_getTypeId (tname);
4760 context_addFileAccessType (uid);
4764 if (!(context_inSuppressRegion ()
4765 || context_inSuppressZone (g_currentloc)))
4769 ("%q: Unrecognized type %s used in access comment",
4770 fileloc_unparse (g_currentloc), tname));
4780 if (c != ',' && c != ' ')
4786 else if (mstring_equal (t, "noaccess"))
4793 while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n'))
4803 tname = cstring_fromChars (s);
4805 while ((lc = *s) != '\0' && lc != ' ' && lc != '\t'
4806 && lc != '\n' && lc != ',')
4813 if (!context_getFlag (FLG_NOCOMMENTS)
4814 && !context_getFlag (FLG_NOACCESS))
4816 if (usymtab_existsType (tname))
4818 typeId tuid = usymtab_getTypeId (tname);
4820 if (context_couldHaveAccess (tuid))
4822 context_removeFileAccessType (tuid);
4826 if (!(context_inSuppressRegion ()
4827 || context_inSuppressZone (g_currentloc)))
4829 uentry ue = usymtab_getTypeEntry (tuid);
4831 if (uentry_isAbstractDatatype (ue))
4835 ("%q: Non-accessible abstract type %s used in noaccess comment",
4836 fileloc_unparse (g_currentloc), tname));
4842 ("%q: Non-abstract type %s used in noaccess comment",
4843 fileloc_unparse (g_currentloc), tname));
4850 if (!(context_inSuppressRegion ()
4851 || context_inSuppressZone (g_currentloc)))
4855 ("%q: Unrecognized type %s used in noaccess comment",
4856 fileloc_unparse (g_currentloc), tname));
4866 if (lc != ',' && lc != ' ')
4874 setTokLength (- (2 + charsread));
4876 voptgenerror (FLG_UNRECOGCOMMENTS,
4877 message ("Stylized comment unrecognized: %s",
4878 cstring_fromChars (os)),
4889 static /*@only@*/ cstring makeIdentifier (char *s)
4891 char *c = mstring_create (size_toInt (strlen (s)) + 1);
4892 cstring id = cstring_fromChars (c);
4894 while (isalnum (*s) || (*s == '_') || (*s == '$'))
4903 /*@observer@*/ /*@dependent@*/ uentry coerceId (cstring cn)
4905 if (!(usymtab_exists (cn)))
4907 fileloc loc = fileloc_createExternal ();
4910 ** We need to put this in a global scope, otherwise the sRef will be deallocated.
4913 uentry ce = uentry_makeUnrecognized (cn, loc);
4915 if (!context_inIterEnd ())
4919 message ("Unrecognized (possibly system) identifier: %q",
4920 uentry_getName (ce)),
4927 return (usymtab_lookup (cn));
4931 ** like, coerceId, but doesn't supercede for iters
4934 /*@observer@*/ uentry coerceIterId (cstring cn)
4936 if (!(usymtab_exists (cn)))
4938 return uentry_undefined;
4941 return (usymtab_lookup (cn));
4944 /*@observer@*/ cstring LastIdentifier ()
4946 return (lastidprocessed);
4949 static int processIdentifier (cstring id)
4953 DPRINTF (("Process identifier: %s", id));
4955 context_clearJustPopped ();
4956 lastidprocessed = id;
4958 if (context_inFunctionDecl ())
4960 int tok = commentMarkerToken (id);
4968 tok = tokenMacroCode (id);
4977 /* Consider handling: Defined by C99 as static const char __func__[] */
4979 if (context_getFlag (FLG_GNUEXTENSIONS))
4983 if (cstring_equalLit (id, "__stdcall")
4984 || cstring_equalLit (id, "__cdecl")
4985 || cstring_equalLit (id, "__extension__"))
4989 else if (cstring_equalLit (id, "__volatile__"))
4993 else if (cstring_equalLit (id, "__signed"))
4997 else if (cstring_equalLit (id, "__unsigned"))
5001 else if (cstring_equalLit (id, "__const__"))
5005 else if (cstring_equalLit (id, "__alignof__"))
5007 tok = CALIGNOF; /* alignof is parsed like sizeof */
5009 else if (cstring_equalLit (id, "__FUNCTION__")
5010 || cstring_equalLit (id, "__PRETTY_FUNCTION__"))
5012 /* These tokens hold the name of the current function as strings */
5013 yylval.expr = exprNode_stringLiteral (id, fileloc_copy (g_currentloc));
5015 lastWasString = TRUE;
5019 else if (cstring_equalLit (id, "__attribute__")
5020 || cstring_equalLit (id, "__asm__")
5021 || cstring_equalLit (id, "_asm")
5022 || cstring_equalLit (id, "__asm")
5023 || cstring_equalLit (id, "__declspec"))
5026 bool useparens = FALSE;
5027 bool usebraces = FALSE;
5028 bool inquote = FALSE;
5029 bool inescape = FALSE;
5032 while ((ic = input ()) != EOF)
5039 else if (ic == '\\')
5043 else if (ic == '\"')
5079 else if (ic == ')' && useparens)
5082 if (depth == 0) break;
5084 else if (ic == '}' && usebraces)
5087 if (depth == 0) break;
5090 && !usebraces && !useparens
5091 && cstring_equalLit (id, "__asm"))
5094 ** We need this because some MS VC++ include files
5095 ** have __asm mov ... }
5096 ** Its a kludge, but otherwise would need to parse
5105 context_incLineno ();
5107 if (cstring_equalLit (id, "__asm")
5108 && !useparens && !usebraces)
5115 llassert ((useparens && ic == ')')
5116 || (usebraces && ic == '}')
5117 || (!useparens && !usebraces));
5121 else if (cstring_equalLit (id, "inline")
5122 || cstring_equalLit (id, "__inline")
5123 || cstring_equalLit (id, "_inline")
5124 || cstring_equalLit (id, "__inline__"))
5135 le = usymtab_lookupSafe (id);
5137 /*@-dependenttrans@*/
5139 if (uentry_isIter (le))
5144 else if (uentry_isEndIter (le))
5147 return (ITER_ENDNAME);
5149 else if (uentry_isUndefined (le))
5153 /* avoid parse errors for certain system built ins */
5155 if (g_expectingTypeName && (cstring_firstChar (id) == '_')
5156 && (cstring_secondChar (id) == '_'))
5158 return (TYPE_NAME_OR_ID);
5161 return (NEW_IDENTIFIER);
5163 else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le))
5165 if (uentry_isDatatype (le))
5168 return (NEW_IDENTIFIER);
5173 return (IDENTIFIER);
5176 else if (uentry_isDatatype (le))
5178 if (!g_expectingTypeName)
5182 return (NEW_IDENTIFIER);
5186 yylval.ctyp = uentry_getAbstractType (le);
5188 uentry_setUsed (le, g_currentloc);
5195 return (IDENTIFIER);
5198 /*@=dependenttrans@*/
5201 static bool processHashIdentifier (/*@only@*/ cstring id)
5203 if (context_inMacro () || context_inIterDef () ||
5204 context_inIterEnd ())
5208 context_clearJustPopped ();
5210 lastidprocessed = id;
5211 le = usymtab_lookupSafe (id);
5213 if (uentry_isParam (le) || uentry_isRefParam (le))
5230 static /*@only@*/ exprNode processString ()
5234 char *nl = strchr (yytext, '\n');
5235 cstring ns = cstring_fromCharsNew (yytext);
5239 loc = fileloc_copy (g_currentloc);
5240 addColumn (cstring_length (ns));
5246 loc = fileloc_copy (g_currentloc);
5248 context_incLineno ();
5250 while ((nl = strchr ((nl + 1), '\n')) != NULL)
5252 context_incLineno ();
5258 res = exprNode_stringLiteral (ns, loc);
5268 llassert (*yytext != '\0');
5269 fchar = *(yytext + 1);
5270 if (fchar != '\\') return fchar;
5272 next = *(yytext + 2);
5276 case 'n': return '\n';
5277 case 't': return '\t';
5278 case '\"': return '\"';
5279 case '\'': return '\'';
5280 case '\\': return '\\';
5281 default: return '\0';
5286 double processFloat ()
5288 double ret = atof (yytext);
5299 llassert (yytext[0] == '0'
5300 && (yytext[1] == 'X' || yytext[1] == 'x'));
5302 while (yytext[index] != '\0') {
5304 char c = yytext[index];
5306 if (c >= '0' && c <= '9') {
5307 tval = (int) c - (int) '0';
5308 } else if (c >= 'A' && c <= 'F') {
5309 tval = (int) c - (int) 'A' + 10;
5310 } else if (c >= 'a' && c <= 'f') {
5311 tval = (int) c - (int) 'a' + 10;
5312 } else if (c == 'U' || c == 'L' || c == 'u' || c == 'l') {
5314 while (yytext[index] != '\0') {
5315 if (c == 'U' || c == 'L' || c == 'u' || c == 'l') {
5320 message ("Invalid character (%c) following specifier in hex constant: %s",
5321 c, cstring_fromChars (yytext)),
5331 message ("Invalid character (%c) in hex constant: %s",
5332 c, cstring_fromChars (yytext)),
5337 val = (val * 16) + tval;
5341 DPRINTF (("Hex constant: %s = %ld", yytext, val));
5346 long processOctal ()
5351 llassert (yytext[0] == '0' && yytext[1] != 'X' && yytext[1] != 'x');
5353 while (yytext[index] != '\0') {
5355 char c = yytext[index];
5357 if (c >= '0' && c <= '7') {
5358 tval = (int) c - (int) '0';
5362 message ("Invalid character (%c) in octal constant: %s",
5363 c, cstring_fromChars (yytext)),
5368 val = (val * 8) + tval;
5372 DPRINTF (("Octal constant: %s = %ld", yytext, val));
5379 return (atol (yytext));
5383 processSpec (int tok)
5385 size_t length = strlen (yytext);
5390 setTokLengthT (length);
5396 context_saveLocation ();
5397 setTokLengthT (length);
5398 return (processIdentifier (makeIdentifier (yytext)));