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 181
286 #define YY_END_OF_BUFFER 182
287 static yyconst short int yy_accept[530] =
289 0, 0, 182, 180, 160, 161, 147, 180, 3, 82,
290 153, 146, 180, 141, 142, 151, 150, 138, 149, 145,
291 152, 97, 97, 139, 135, 154, 140, 155, 158, 180,
292 82, 143, 179, 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, 177, 178, 129,
296 121, 0, 0, 118, 126, 116, 127, 117, 128, 0,
297 110, 1, 119, 159, 113, 90, 0, 99, 98, 0,
298 97, 125, 131, 133, 132, 124, 0, 0, 0, 82,
300 122, 82, 82, 82, 82, 82, 82, 82, 82, 9,
301 82, 82, 82, 82, 82, 82, 82, 13, 44, 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, 82, 123, 130, 0,
305 0, 2, 104, 4, 0, 108, 109, 110, 0, 111,
306 112, 92, 91, 0, 107, 100, 101, 101, 83, 115,
307 114, 167, 168, 165, 170, 175, 166, 176, 171, 174,
308 169, 172, 173, 0, 0, 82, 82, 82, 82, 82,
309 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
311 82, 82, 82, 11, 82, 82, 27, 82, 82, 82,
312 82, 82, 82, 82, 82, 82, 82, 43, 82, 82,
313 82, 82, 82, 82, 74, 82, 82, 82, 82, 82,
314 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
315 82, 82, 82, 82, 82, 82, 0, 42, 0, 0,
316 110, 0, 108, 109, 0, 113, 93, 94, 94, 105,
317 106, 103, 102, 84, 86, 164, 0, 0, 82, 82,
318 82, 82, 39, 82, 6, 29, 82, 82, 82, 82,
319 82, 82, 10, 25, 82, 82, 82, 82, 12, 82,
320 82, 82, 51, 82, 31, 82, 82, 52, 82, 82,
322 68, 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, 82, 26, 82, 82, 82,
325 0, 110, 96, 95, 85, 87, 87, 0, 163, 82,
326 82, 82, 82, 5, 82, 36, 82, 82, 82, 82,
327 82, 82, 82, 30, 82, 82, 82, 82, 82, 82,
328 82, 82, 82, 82, 69, 82, 82, 82, 82, 82,
329 82, 82, 32, 82, 82, 82, 82, 82, 82, 82,
330 82, 82, 82, 77, 24, 82, 82, 82, 82, 82,
331 18, 76, 89, 88, 162, 82, 80, 82, 82, 82,
333 82, 82, 82, 82, 28, 82, 38, 82, 21, 82,
334 54, 78, 82, 60, 82, 82, 82, 82, 82, 82,
335 82, 58, 82, 14, 75, 34, 15, 82, 41, 22,
336 17, 82, 82, 82, 82, 82, 72, 19, 20, 82,
337 81, 37, 47, 64, 82, 82, 8, 82, 59, 82,
338 82, 82, 62, 53, 82, 82, 82, 45, 82, 82,
339 57, 82, 46, 61, 82, 23, 82, 82, 82, 82,
340 65, 7, 82, 73, 82, 82, 82, 70, 16, 82,
341 40, 82, 55, 82, 33, 35, 82, 71, 56, 82,
342 82, 82, 82, 67, 82, 82, 82, 82, 63, 82,
344 82, 82, 82, 82, 82, 82, 82, 48, 82, 82,
345 82, 66, 82, 82, 82, 79, 82, 82, 82, 82,
346 82, 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[537] =
395 0, 0, 679, 680, 680, 680, 653, 73, 0, 0,
396 55, 71, 630, 680, 680, 651, 67, 680, 68, 66,
397 74, 80, 87, 680, 680, 65, 650, 77, 680, 99,
398 623, 680, 680, 680, 648, 622, 28, 605, 67, 40,
399 73, 82, 606, 84, 51, 605, 89, 98, 617, 612,
400 105, 102, 603, 62, 607, 605, 680, 86, 680, 680,
401 680, 108, 175, 660, 0, 0, 680, 680, 680, 680,
402 680, 127, 168, 680, 680, 680, 680, 680, 680, 644,
403 162, 680, 680, 680, 164, 169, 171, 166, 167, 0,
404 211, 636, 680, 680, 680, 635, 252, 622, 622, 585,
406 680, 603, 582, 586, 598, 585, 155, 588, 148, 581,
407 582, 579, 144, 586, 582, 579, 576, 0, 98, 580,
408 587, 580, 577, 568, 570, 576, 569, 579, 573, 565,
409 569, 565, 165, 574, 64, 142, 574, 114, 569, 565,
410 557, 560, 183, 574, 180, 564, 567, 680, 680, 242,
411 187, 0, 680, 680, 234, 680, 680, 243, 241, 680,
412 680, 204, 221, 194, 270, 225, 680, 223, 266, 680,
413 680, 680, 580, 680, 680, 680, 680, 680, 680, 680,
414 680, 680, 680, 581, 582, 229, 554, 549, 552, 564,
415 559, 547, 559, 203, 560, 555, 557, 553, 545, 542,
417 550, 537, 552, 0, 538, 542, 545, 530, 533, 536,
418 539, 529, 531, 532, 537, 524, 517, 0, 534, 520,
419 534, 527, 246, 516, 0, 518, 517, 519, 526, 527,
420 511, 509, 509, 511, 520, 519, 515, 517, 507, 511,
421 502, 223, 514, 516, 505, 504, 254, 308, 561, 292,
422 296, 303, 680, 680, 301, 313, 236, 680, 279, 680,
423 680, 680, 680, 294, 283, 680, 535, 523, 506, 505,
424 496, 485, 0, 497, 0, 0, 496, 487, 495, 484,
425 489, 490, 0, 0, 483, 483, 493, 479, 0, 483,
426 488, 483, 0, 273, 0, 488, 473, 473, 474, 484,
428 0, 484, 478, 472, 468, 479, 464, 466, 476, 462,
429 474, 464, 468, 467, 472, 471, 457, 459, 467, 465,
430 463, 455, 460, 461, 449, 461, 0, 445, 457, 457,
431 317, 339, 680, 680, 299, 680, 289, 482, 680, 458,
432 440, 440, 441, 0, 292, 0, 442, 443, 449, 447,
433 446, 437, 436, 0, 443, 431, 435, 441, 439, 437,
434 431, 436, 420, 421, 0, 437, 418, 418, 429, 423,
435 420, 428, 0, 427, 424, 428, 425, 409, 418, 420,
436 405, 418, 419, 0, 0, 408, 416, 412, 407, 408,
437 0, 0, 680, 680, 680, 412, 0, 397, 409, 409,
439 398, 392, 392, 404, 0, 404, 406, 387, 0, 404,
440 0, 0, 398, 0, 392, 386, 396, 386, 388, 385,
441 392, 0, 385, 0, 0, 386, 0, 383, 0, 0,
442 0, 387, 381, 385, 380, 384, 0, 0, 0, 377,
443 0, 0, 0, 370, 382, 380, 0, 371, 0, 372,
444 371, 370, 0, 0, 368, 354, 360, 0, 343, 342,
445 0, 344, 0, 0, 338, 0, 343, 343, 341, 326,
446 0, 0, 325, 0, 331, 323, 331, 0, 0, 334,
447 0, 320, 0, 333, 327, 0, 319, 0, 0, 311,
448 320, 328, 326, 0, 317, 320, 313, 326, 0, 319,
450 305, 318, 315, 299, 300, 310, 296, 0, 307, 310,
451 301, 0, 302, 292, 285, 0, 280, 294, 270, 281,
452 242, 139, 117, 66, 0, 44, 28, 0, 680, 400,
453 404, 408, 413, 417, 419, 424
456 static yyconst short int yy_def[537] =
458 529, 1, 529, 529, 529, 529, 529, 530, 531, 532,
459 529, 529, 533, 529, 529, 529, 529, 529, 529, 529,
460 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
461 532, 529, 529, 529, 529, 532, 532, 532, 532, 532,
462 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
463 532, 532, 532, 532, 532, 532, 529, 529, 529, 529,
464 529, 530, 529, 530, 534, 532, 529, 529, 529, 529,
465 529, 533, 533, 529, 529, 529, 529, 529, 529, 529,
466 529, 529, 529, 529, 529, 529, 529, 529, 529, 535,
467 529, 529, 529, 529, 529, 529, 529, 529, 529, 532,
469 529, 532, 532, 532, 532, 532, 532, 532, 532, 532,
470 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
471 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
472 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
473 532, 532, 532, 532, 532, 532, 532, 529, 529, 529,
474 536, 534, 529, 529, 529, 529, 529, 529, 529, 529,
475 529, 529, 529, 529, 529, 529, 529, 529, 535, 529,
476 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
477 529, 529, 529, 529, 529, 532, 532, 532, 532, 532,
478 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
480 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
481 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
482 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
483 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
484 532, 532, 532, 532, 532, 532, 536, 529, 536, 529,
485 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
486 529, 529, 529, 529, 529, 529, 529, 529, 532, 532,
487 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
488 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
489 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
491 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
492 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
493 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
494 529, 529, 529, 529, 529, 529, 529, 529, 529, 532,
495 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
496 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
497 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
498 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
499 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
500 532, 532, 529, 529, 529, 532, 532, 532, 532, 532,
502 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
503 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
504 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
505 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
506 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
507 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
508 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
509 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
510 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
511 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
513 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
514 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
515 532, 532, 532, 532, 532, 532, 532, 532, 0, 529,
516 529, 529, 529, 529, 529, 529
519 static yyconst short int yy_nxt[759] =
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, 528, 80, 77, 81, 81, 82, 92, 93,
530 103, 76, 78, 79, 109, 71, 104, 85, 83, 86,
532 86, 95, 96, 110, 85, 121, 91, 91, 527, 122,
533 148, 87, 144, 63, 226, 88, 97, 106, 87, 64,
534 84, 89, 88, 90, 107, 145, 98, 227, 89, 68,
535 108, 69, 114, 111, 87, 112, 99, 153, 526, 118,
536 88, 87, 115, 124, 113, 116, 119, 88, 89, 127,
537 120, 90, 125, 128, 64, 89, 140, 126, 206, 134,
538 129, 149, 135, 136, 231, 207, 130, 141, 131, 137,
539 529, 525, 138, 73, 142, 139, 150, 150, 72, 232,
540 151, 81, 81, 158, 158, 164, 85, 164, 86, 86,
541 165, 165, 248, 155, 156, 159, 160, 157, 228, 161,
543 87, 166, 168, 195, 162, 192, 524, 167, 200, 193,
544 163, 201, 196, 165, 165, 229, 155, 156, 159, 160,
545 221, 222, 157, 87, 161, 223, 166, 168, 85, 162,
546 91, 91, 224, 249, 167, 237, 238, 163, 243, 257,
547 244, 239, 87, 150, 150, 258, 88, 151, 250, 240,
548 250, 241, 89, 251, 251, 255, 259, 255, 263, 248,
549 256, 256, 158, 158, 257, 87, 262, 269, 270, 278,
550 279, 88, 258, 325, 252, 253, 326, 333, 254, 89,
551 172, 259, 173, 263, 174, 175, 176, 177, 178, 165,
552 165, 179, 180, 262, 181, 182, 183, 252, 253, 306,
554 249, 264, 260, 254, 333, 261, 523, 265, 307, 150,
555 150, 251, 251, 151, 334, 251, 251, 331, 337, 331,
556 256, 256, 332, 332, 394, 260, 264, 358, 156, 335,
557 261, 157, 256, 256, 265, 336, 332, 332, 359, 334,
558 393, 522, 521, 337, 520, 160, 400, 519, 161, 394,
559 518, 156, 517, 401, 335, 516, 157, 515, 332, 332,
560 514, 513, 336, 512, 511, 510, 509, 393, 160, 508,
561 507, 253, 506, 161, 254, 505, 504, 503, 502, 501,
562 500, 499, 498, 497, 496, 495, 494, 493, 492, 491,
563 490, 489, 488, 487, 253, 486, 485, 484, 483, 254,
565 62, 62, 62, 62, 62, 65, 482, 481, 65, 66,
566 480, 66, 66, 72, 72, 479, 72, 72, 152, 478,
567 152, 152, 169, 169, 247, 247, 247, 247, 247, 477,
568 476, 475, 474, 473, 472, 471, 470, 469, 468, 467,
569 466, 465, 464, 463, 462, 461, 460, 459, 458, 457,
570 456, 455, 454, 453, 452, 451, 450, 449, 448, 447,
571 446, 445, 444, 443, 442, 441, 440, 439, 438, 437,
572 436, 435, 434, 433, 432, 431, 430, 429, 428, 427,
573 426, 425, 424, 423, 422, 421, 420, 419, 418, 417,
574 416, 415, 414, 413, 412, 411, 410, 409, 408, 407,
576 406, 405, 404, 403, 402, 399, 398, 397, 396, 395,
577 392, 391, 390, 389, 388, 387, 386, 385, 384, 383,
578 382, 381, 380, 379, 378, 377, 376, 375, 374, 373,
579 372, 371, 370, 369, 368, 367, 366, 365, 364, 363,
580 362, 361, 360, 357, 356, 355, 354, 353, 352, 351,
581 350, 349, 348, 347, 346, 345, 344, 343, 342, 341,
582 340, 339, 338, 529, 330, 329, 328, 327, 324, 323,
583 322, 321, 320, 319, 318, 317, 316, 315, 314, 313,
584 312, 311, 310, 309, 308, 305, 304, 303, 302, 301,
585 300, 299, 298, 297, 296, 295, 294, 293, 292, 291,
587 290, 289, 288, 287, 286, 285, 284, 283, 282, 281,
588 280, 277, 276, 275, 274, 273, 272, 271, 268, 267,
589 266, 246, 245, 242, 236, 235, 234, 233, 230, 225,
590 220, 219, 218, 217, 216, 215, 214, 213, 212, 211,
591 210, 209, 208, 205, 204, 203, 202, 199, 198, 197,
592 194, 191, 190, 189, 188, 187, 186, 185, 184, 171,
593 170, 154, 529, 147, 146, 143, 133, 132, 123, 117,
594 105, 102, 101, 100, 94, 74, 73, 61, 529, 3,
595 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
596 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
598 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
599 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
600 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
601 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
602 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
603 529, 529, 529, 529, 529, 529, 529, 529
606 static yyconst short int yy_chk[759] =
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, 527, 20, 19, 20, 20, 21, 26, 26,
617 37, 17, 19, 19, 40, 12, 37, 22, 21, 22,
619 22, 28, 28, 40, 23, 45, 23, 23, 526, 45,
620 58, 22, 54, 62, 135, 22, 30, 39, 23, 8,
621 21, 22, 23, 22, 39, 54, 30, 135, 23, 11,
622 39, 11, 42, 41, 22, 41, 30, 72, 524, 44,
623 22, 23, 42, 47, 41, 42, 44, 23, 22, 48,
624 44, 22, 47, 48, 62, 23, 52, 47, 119, 51,
625 48, 58, 51, 51, 138, 119, 48, 52, 48, 51,
626 73, 523, 51, 72, 52, 51, 63, 63, 73, 138,
627 63, 81, 81, 85, 85, 87, 86, 87, 86, 86,
628 87, 87, 151, 81, 81, 85, 85, 81, 136, 85,
630 86, 88, 89, 109, 86, 107, 522, 88, 113, 107,
631 86, 113, 109, 164, 164, 136, 81, 81, 85, 85,
632 133, 133, 81, 86, 85, 133, 88, 89, 91, 86,
633 91, 91, 133, 151, 88, 143, 143, 86, 145, 162,
634 145, 143, 91, 150, 150, 162, 91, 150, 155, 143,
635 155, 143, 91, 155, 155, 159, 163, 159, 168, 247,
636 159, 159, 158, 158, 162, 91, 166, 186, 186, 194,
637 194, 91, 162, 242, 158, 158, 242, 257, 158, 91,
638 97, 163, 97, 168, 97, 97, 97, 97, 97, 165,
639 165, 97, 97, 166, 97, 97, 97, 158, 158, 223,
641 247, 169, 165, 158, 257, 165, 521, 169, 223, 248,
642 248, 250, 250, 248, 259, 251, 251, 252, 265, 252,
643 255, 255, 252, 252, 337, 165, 169, 294, 251, 264,
644 165, 251, 256, 256, 169, 264, 331, 331, 294, 259,
645 335, 520, 519, 265, 518, 256, 345, 517, 256, 337,
646 515, 251, 514, 345, 264, 513, 251, 511, 332, 332,
647 510, 509, 264, 507, 506, 505, 504, 335, 256, 503,
648 502, 332, 501, 256, 332, 500, 498, 497, 496, 495,
649 493, 492, 491, 490, 487, 485, 484, 482, 480, 477,
650 476, 475, 473, 470, 332, 469, 468, 467, 465, 332,
652 530, 530, 530, 530, 530, 531, 462, 460, 531, 532,
653 459, 532, 532, 533, 533, 457, 533, 533, 534, 456,
654 534, 534, 535, 535, 536, 536, 536, 536, 536, 455,
655 452, 451, 450, 448, 446, 445, 444, 440, 436, 435,
656 434, 433, 432, 428, 426, 423, 421, 420, 419, 418,
657 417, 416, 415, 413, 410, 408, 407, 406, 404, 403,
658 402, 401, 400, 399, 398, 396, 390, 389, 388, 387,
659 386, 383, 382, 381, 380, 379, 378, 377, 376, 375,
660 374, 372, 371, 370, 369, 368, 367, 366, 364, 363,
661 362, 361, 360, 359, 358, 357, 356, 355, 353, 352,
663 351, 350, 349, 348, 347, 343, 342, 341, 340, 338,
664 330, 329, 328, 326, 325, 324, 323, 322, 321, 320,
665 319, 318, 317, 316, 315, 314, 313, 312, 311, 310,
666 309, 308, 307, 306, 305, 304, 303, 302, 300, 299,
667 298, 297, 296, 292, 291, 290, 288, 287, 286, 285,
668 282, 281, 280, 279, 278, 277, 274, 272, 271, 270,
669 269, 268, 267, 249, 246, 245, 244, 243, 241, 240,
670 239, 238, 237, 236, 235, 234, 233, 232, 231, 230,
671 229, 228, 227, 226, 224, 222, 221, 220, 219, 217,
672 216, 215, 214, 213, 212, 211, 210, 209, 208, 207,
674 206, 205, 203, 202, 201, 200, 199, 198, 197, 196,
675 195, 193, 192, 191, 190, 189, 188, 187, 185, 184,
676 173, 147, 146, 144, 142, 141, 140, 139, 137, 134,
677 132, 131, 130, 129, 128, 127, 126, 125, 124, 123,
678 122, 121, 120, 117, 116, 115, 114, 112, 111, 110,
679 108, 106, 105, 104, 103, 102, 100, 99, 98, 96,
680 92, 80, 64, 56, 55, 53, 50, 49, 46, 43,
681 38, 36, 35, 31, 27, 16, 13, 7, 3, 529,
682 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
683 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
685 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
686 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
687 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
688 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
689 529, 529, 529, 529, 529, 529, 529, 529, 529, 529,
690 529, 529, 529, 529, 529, 529, 529, 529
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 >= 530 )
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] != 680 );
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 432 "cscanner.l"
1976 { setTokLength (1); RETURN_TOK (TCAND); }
1980 #line 435 "cscanner.l"
1985 #line 436 "cscanner.l"
1986 { context_incLineno ();
1989 continueLine = FALSE;
1993 if (context_inMacro ())
1995 /* Don't use RETURN_TOK */
1996 yylval.tok = lltok_create (TENDMACRO, g_currentloc);
1997 lastWasString = FALSE;
2005 #line 452 "cscanner.l"
2008 if (processMacro ()) {
2009 if (context_inIterDef ())
2011 RETURN_TOK (LLMACROITER);
2013 if (context_inIterEnd ())
2015 RETURN_TOK (LLMACROEND);
2017 if (context_inMacro ())
2019 RETURN_TOK (LLMACRO);
2026 #line 469 "cscanner.l"
2027 { if (context_inHeader () || context_inFunction ())
2033 int nspchar = ninput ();
2037 ** This is a hack to get the column number correct.
2040 llassert (nspchar >= '0' && nspchar <= '9');
2042 nspaces = nspchar - '0';
2044 setTokLength (5 + nspaces);
2046 if (processMacro ())
2048 if (context_inIterDef ())
2050 RETURN_TOK (LLMACROITER);
2052 if (context_inIterEnd ())
2054 RETURN_TOK (LLMACROEND);
2056 if (context_inMacro ())
2058 RETURN_TOK (LLMACRO);
2066 #line 505 "cscanner.l"
2067 { setTokLength (4); lldiagmsg (ctype_unparseTable ()); }
2071 #line 506 "cscanner.l"
2073 lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc)));
2078 #line 509 "cscanner.l"
2079 { setTokLength (3); usymtab_printLocal (); }
2083 #line 510 "cscanner.l"
2084 { setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); }
2088 #line 511 "cscanner.l"
2089 { setTokLength (3); lldiagmsg (context_unparse ()); }
2093 #line 512 "cscanner.l"
2094 { setTokLength (3); lldiagmsg (context_unparseClauses ()); }
2098 #line 513 "cscanner.l"
2099 { setTokLength (3); usymtab_printGuards (); }
2103 #line 514 "cscanner.l"
2104 { setTokLength (3); usymtab_printOut (); }
2108 #line 515 "cscanner.l"
2109 { setTokLength (3); usymtab_printAll (); }
2113 #line 516 "cscanner.l"
2114 { setTokLength (3); usymtab_printComplete (); }
2118 #line 517 "cscanner.l"
2119 { setTokLength (3); usymtab_printTypes (); }
2123 #line 518 "cscanner.l"
2124 { setTokLength (3); lldiagmsg (usymtab_unparseStack ()); }
2128 #line 519 "cscanner.l"
2130 lldiagmsg (message ("Can modify: %q",
2131 sRefSet_unparse (context_modList ())));
2136 #line 523 "cscanner.l"
2137 { /* BEFORE_COMMENT_MARKER */
2139 incColumn (); incColumn ();
2140 tok = handleLlSpecial ();
2149 #line 532 "cscanner.l"
2150 { /* AFTER_COMMENT_MARKER */
2153 RETURN_TOK (QENDMACRO); }
2157 #line 536 "cscanner.l"
2158 { incColumn (); continueLine = TRUE; }
2162 #line 537 "cscanner.l"
2166 message ("Invalid character (ascii: %d), skipping character",
2173 #line 544 "cscanner.l"
2176 #line 2177 "lex.yy.c"
2177 case YY_STATE_EOF(INITIAL):
2180 case YY_END_OF_BUFFER:
2182 /* Amount of text matched not including the EOB char. */
2183 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2185 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2186 *yy_cp = yy_hold_char;
2187 YY_RESTORE_YY_MORE_OFFSET
2189 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2191 /* We're scanning a new file or input source. It's
2192 * possible that this happened because the user
2193 * just pointed yyin at a new source and called
2194 * yylex(). If so, then we have to assure
2195 * consistency between yy_current_buffer and our
2196 * globals. Here is the right place to do so, because
2197 * this is the first action (other than possibly a
2198 * back-up) that will match for the new input source.
2200 yy_n_chars = yy_current_buffer->yy_n_chars;
2201 yy_current_buffer->yy_input_file = yyin;
2202 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2205 /* Note that here we test for yy_c_buf_p "<=" to the position
2206 * of the first EOB in the buffer, since yy_c_buf_p will
2207 * already have been incremented past the NUL character
2208 * (since all states make transitions on EOB to the
2209 * end-of-buffer state). Contrast this with the test
2212 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2213 { /* This was really a NUL. */
2214 yy_state_type yy_next_state;
2216 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2218 yy_current_state = yy_get_previous_state();
2220 /* Okay, we're now positioned to make the NUL
2221 * transition. We couldn't have
2222 * yy_get_previous_state() go ahead and do it
2223 * for us because it doesn't know how to deal
2224 * with the possibility of jamming (and we don't
2225 * want to build jamming into it because then it
2226 * will run more slowly).
2229 yy_next_state = yy_try_NUL_trans( yy_current_state );
2231 yy_bp = yytext_ptr + YY_MORE_ADJ;
2233 if ( yy_next_state )
2235 /* Consume the NUL. */
2236 yy_cp = ++yy_c_buf_p;
2237 yy_current_state = yy_next_state;
2244 goto yy_find_action;
2248 else switch ( yy_get_next_buffer() )
2250 case EOB_ACT_END_OF_FILE:
2252 yy_did_buffer_switch_on_eof = 0;
2256 /* Note: because we've taken care in
2257 * yy_get_next_buffer() to have set up
2258 * yytext, we can now set up
2259 * yy_c_buf_p so that if some total
2260 * hoser (like flex itself) wants to
2261 * call the scanner after we return the
2262 * YY_NULL, it'll still work - another
2263 * YY_NULL will get returned.
2265 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2267 yy_act = YY_STATE_EOF(YY_START);
2273 if ( ! yy_did_buffer_switch_on_eof )
2279 case EOB_ACT_CONTINUE_SCAN:
2281 yytext_ptr + yy_amount_of_matched_text;
2283 yy_current_state = yy_get_previous_state();
2286 yy_bp = yytext_ptr + YY_MORE_ADJ;
2289 case EOB_ACT_LAST_MATCH:
2291 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2293 yy_current_state = yy_get_previous_state();
2296 yy_bp = yytext_ptr + YY_MORE_ADJ;
2297 goto yy_find_action;
2304 "fatal flex scanner internal error--no action found" );
2305 } /* end of action switch */
2306 } /* end of scanning one token */
2307 } /* end of yylex */
2310 /* yy_get_next_buffer - try to read in a new buffer
2312 * Returns a code representing an action:
2313 * EOB_ACT_LAST_MATCH -
2314 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2315 * EOB_ACT_END_OF_FILE - end of file
2318 static int yy_get_next_buffer()
2320 register char *dest = yy_current_buffer->yy_ch_buf;
2321 register char *source = yytext_ptr;
2322 register int number_to_move, i;
2325 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2327 "fatal flex scanner internal error--end of buffer missed" );
2329 if ( yy_current_buffer->yy_fill_buffer == 0 )
2330 { /* Don't try to fill the buffer, so this is an EOF. */
2331 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2333 /* We matched a single character, the EOB, so
2334 * treat this as a final EOF.
2336 return EOB_ACT_END_OF_FILE;
2341 /* We matched some text prior to the EOB, first
2344 return EOB_ACT_LAST_MATCH;
2348 /* Try to read more data. */
2350 /* First move last chars to start of buffer. */
2351 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2353 for ( i = 0; i < number_to_move; ++i )
2354 *(dest++) = *(source++);
2356 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2357 /* don't do the read, it's not guaranteed to return an EOF,
2360 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2365 yy_current_buffer->yy_buf_size - number_to_move - 1;
2367 while ( num_to_read <= 0 )
2368 { /* Not enough room in the buffer - grow it. */
2369 #ifdef YY_USES_REJECT
2371 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2374 /* just a shorter name for the current buffer */
2375 YY_BUFFER_STATE b = yy_current_buffer;
2377 int yy_c_buf_p_offset =
2378 (int) (yy_c_buf_p - b->yy_ch_buf);
2380 if ( b->yy_is_our_buffer )
2382 int new_size = b->yy_buf_size * 2;
2384 if ( new_size <= 0 )
2385 b->yy_buf_size += b->yy_buf_size / 8;
2387 b->yy_buf_size *= 2;
2389 b->yy_ch_buf = (char *)
2390 /* Include room in for 2 EOB chars. */
2391 yy_flex_realloc( (void *) b->yy_ch_buf,
2392 b->yy_buf_size + 2 );
2395 /* Can't grow it, we don't own it. */
2398 if ( ! b->yy_ch_buf )
2400 "fatal error - scanner input buffer overflow" );
2402 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2404 num_to_read = yy_current_buffer->yy_buf_size -
2409 if ( num_to_read > YY_READ_BUF_SIZE )
2410 num_to_read = YY_READ_BUF_SIZE;
2412 /* Read in more data. */
2413 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2414 yy_n_chars, num_to_read );
2416 yy_current_buffer->yy_n_chars = yy_n_chars;
2419 if ( yy_n_chars == 0 )
2421 if ( number_to_move == YY_MORE_ADJ )
2423 ret_val = EOB_ACT_END_OF_FILE;
2429 ret_val = EOB_ACT_LAST_MATCH;
2430 yy_current_buffer->yy_buffer_status =
2431 YY_BUFFER_EOF_PENDING;
2436 ret_val = EOB_ACT_CONTINUE_SCAN;
2438 yy_n_chars += number_to_move;
2439 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2440 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2442 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2448 /* yy_get_previous_state - get the state just before the EOB char was reached */
2450 static yy_state_type yy_get_previous_state()
2452 register yy_state_type yy_current_state;
2453 register char *yy_cp;
2455 yy_current_state = yy_start;
2457 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2459 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2460 if ( yy_accept[yy_current_state] )
2462 yy_last_accepting_state = yy_current_state;
2463 yy_last_accepting_cpos = yy_cp;
2465 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2467 yy_current_state = (int) yy_def[yy_current_state];
2468 if ( yy_current_state >= 530 )
2469 yy_c = yy_meta[(unsigned int) yy_c];
2471 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2474 return yy_current_state;
2478 /* yy_try_NUL_trans - try to make a transition on the NUL character
2481 * next_state = yy_try_NUL_trans( current_state );
2484 #ifdef YY_USE_PROTOS
2485 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2487 static yy_state_type yy_try_NUL_trans( yy_current_state )
2488 yy_state_type yy_current_state;
2491 register int yy_is_jam;
2492 register char *yy_cp = yy_c_buf_p;
2494 register YY_CHAR yy_c = 1;
2495 if ( yy_accept[yy_current_state] )
2497 yy_last_accepting_state = yy_current_state;
2498 yy_last_accepting_cpos = yy_cp;
2500 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2502 yy_current_state = (int) yy_def[yy_current_state];
2503 if ( yy_current_state >= 530 )
2504 yy_c = yy_meta[(unsigned int) yy_c];
2506 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2507 yy_is_jam = (yy_current_state == 529);
2509 return yy_is_jam ? 0 : yy_current_state;
2514 #ifdef YY_USE_PROTOS
2515 static void yyunput( int c, register char *yy_bp )
2517 static void yyunput( c, yy_bp )
2519 register char *yy_bp;
2522 register char *yy_cp = yy_c_buf_p;
2524 /* undo effects of setting up yytext */
2525 *yy_cp = yy_hold_char;
2527 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2528 { /* need to shift things up to make room */
2529 /* +2 for EOB chars. */
2530 register int number_to_move = yy_n_chars + 2;
2531 register char *dest = &yy_current_buffer->yy_ch_buf[
2532 yy_current_buffer->yy_buf_size + 2];
2533 register char *source =
2534 &yy_current_buffer->yy_ch_buf[number_to_move];
2536 while ( source > yy_current_buffer->yy_ch_buf )
2537 *--dest = *--source;
2539 yy_cp += (int) (dest - source);
2540 yy_bp += (int) (dest - source);
2541 yy_current_buffer->yy_n_chars =
2542 yy_n_chars = yy_current_buffer->yy_buf_size;
2544 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2545 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2548 *--yy_cp = (char) c;
2552 yy_hold_char = *yy_cp;
2555 #endif /* ifndef YY_NO_UNPUT */
2559 static int yyinput()
2566 *yy_c_buf_p = yy_hold_char;
2568 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2570 /* yy_c_buf_p now points to the character we want to return.
2571 * If this occurs *before* the EOB characters, then it's a
2572 * valid NUL; if not, then we've hit the end of the buffer.
2574 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2575 /* This was really a NUL. */
2579 { /* need more input */
2580 int offset = yy_c_buf_p - yytext_ptr;
2583 switch ( yy_get_next_buffer() )
2585 case EOB_ACT_LAST_MATCH:
2586 /* This happens because yy_g_n_b()
2587 * sees that we've accumulated a
2588 * token and flags that we need to
2589 * try matching the token before
2590 * proceeding. But for input(),
2591 * there's no matching to consider.
2592 * So convert the EOB_ACT_LAST_MATCH
2593 * to EOB_ACT_END_OF_FILE.
2596 /* Reset buffer status. */
2601 case EOB_ACT_END_OF_FILE:
2606 if ( ! yy_did_buffer_switch_on_eof )
2615 case EOB_ACT_CONTINUE_SCAN:
2616 yy_c_buf_p = yytext_ptr + offset;
2622 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2623 *yy_c_buf_p = '\0'; /* preserve yytext */
2624 yy_hold_char = *++yy_c_buf_p;
2631 #ifdef YY_USE_PROTOS
2632 void yyrestart( FILE *input_file )
2634 void yyrestart( input_file )
2638 if ( ! yy_current_buffer )
2639 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2641 yy_init_buffer( yy_current_buffer, input_file );
2642 yy_load_buffer_state();
2646 #ifdef YY_USE_PROTOS
2647 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2649 void yy_switch_to_buffer( new_buffer )
2650 YY_BUFFER_STATE new_buffer;
2653 if ( yy_current_buffer == new_buffer )
2656 if ( yy_current_buffer )
2658 /* Flush out information for old buffer. */
2659 *yy_c_buf_p = yy_hold_char;
2660 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2661 yy_current_buffer->yy_n_chars = yy_n_chars;
2664 yy_current_buffer = new_buffer;
2665 yy_load_buffer_state();
2667 /* We don't actually know whether we did this switch during
2668 * EOF (yywrap()) processing, but the only time this flag
2669 * is looked at is after yywrap() is called, so it's safe
2670 * to go ahead and always set it.
2672 yy_did_buffer_switch_on_eof = 1;
2676 #ifdef YY_USE_PROTOS
2677 void yy_load_buffer_state( void )
2679 void yy_load_buffer_state()
2682 yy_n_chars = yy_current_buffer->yy_n_chars;
2683 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2684 yyin = yy_current_buffer->yy_input_file;
2685 yy_hold_char = *yy_c_buf_p;
2689 #ifdef YY_USE_PROTOS
2690 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2692 YY_BUFFER_STATE yy_create_buffer( file, size )
2699 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2701 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2703 b->yy_buf_size = size;
2705 /* yy_ch_buf has to be 2 characters longer than the size given because
2706 * we need to put in 2 end-of-buffer characters.
2708 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2709 if ( ! b->yy_ch_buf )
2710 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2712 b->yy_is_our_buffer = 1;
2714 yy_init_buffer( b, file );
2720 #ifdef YY_USE_PROTOS
2721 void yy_delete_buffer( YY_BUFFER_STATE b )
2723 void yy_delete_buffer( b )
2730 if ( b == yy_current_buffer )
2731 yy_current_buffer = (YY_BUFFER_STATE) 0;
2733 if ( b->yy_is_our_buffer )
2734 yy_flex_free( (void *) b->yy_ch_buf );
2736 yy_flex_free( (void *) b );
2740 #ifndef YY_ALWAYS_INTERACTIVE
2741 #ifndef YY_NEVER_INTERACTIVE
2742 extern int isatty YY_PROTO(( int ));
2746 #ifdef YY_USE_PROTOS
2747 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2749 void yy_init_buffer( b, file )
2756 yy_flush_buffer( b );
2758 b->yy_input_file = file;
2759 b->yy_fill_buffer = 1;
2761 #if YY_ALWAYS_INTERACTIVE
2762 b->yy_is_interactive = 1;
2764 #if YY_NEVER_INTERACTIVE
2765 b->yy_is_interactive = 0;
2767 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2773 #ifdef YY_USE_PROTOS
2774 void yy_flush_buffer( YY_BUFFER_STATE b )
2776 void yy_flush_buffer( b )
2786 /* We always need two end-of-buffer characters. The first causes
2787 * a transition to the end-of-buffer state. The second causes
2788 * a jam in that state.
2790 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2791 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2793 b->yy_buf_pos = &b->yy_ch_buf[0];
2796 b->yy_buffer_status = YY_BUFFER_NEW;
2798 if ( b == yy_current_buffer )
2799 yy_load_buffer_state();
2803 #ifndef YY_NO_SCAN_BUFFER
2804 #ifdef YY_USE_PROTOS
2805 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2807 YY_BUFFER_STATE yy_scan_buffer( base, size )
2815 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2816 base[size-1] != YY_END_OF_BUFFER_CHAR )
2817 /* They forgot to leave room for the EOB's. */
2820 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2822 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2824 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2825 b->yy_buf_pos = b->yy_ch_buf = base;
2826 b->yy_is_our_buffer = 0;
2827 b->yy_input_file = 0;
2828 b->yy_n_chars = b->yy_buf_size;
2829 b->yy_is_interactive = 0;
2831 b->yy_fill_buffer = 0;
2832 b->yy_buffer_status = YY_BUFFER_NEW;
2834 yy_switch_to_buffer( b );
2841 #ifndef YY_NO_SCAN_STRING
2842 #ifdef YY_USE_PROTOS
2843 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2845 YY_BUFFER_STATE yy_scan_string( yy_str )
2846 yyconst char *yy_str;
2850 for ( len = 0; yy_str[len]; ++len )
2853 return yy_scan_bytes( yy_str, len );
2858 #ifndef YY_NO_SCAN_BYTES
2859 #ifdef YY_USE_PROTOS
2860 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2862 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2863 yyconst char *bytes;
2872 /* Get memory for full buffer, including space for trailing EOB's. */
2874 buf = (char *) yy_flex_alloc( n );
2876 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2878 for ( i = 0; i < len; ++i )
2881 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2883 b = yy_scan_buffer( buf, n );
2885 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2887 /* It's okay to grow etc. this buffer, and we should throw it
2888 * away when we're done.
2890 b->yy_is_our_buffer = 1;
2897 #ifndef YY_NO_PUSH_STATE
2898 #ifdef YY_USE_PROTOS
2899 static void yy_push_state( int new_state )
2901 static void yy_push_state( new_state )
2905 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2909 yy_start_stack_depth += YY_START_STACK_INCR;
2910 new_size = yy_start_stack_depth * sizeof( int );
2912 if ( ! yy_start_stack )
2913 yy_start_stack = (int *) yy_flex_alloc( new_size );
2916 yy_start_stack = (int *) yy_flex_realloc(
2917 (void *) yy_start_stack, new_size );
2919 if ( ! yy_start_stack )
2921 "out of memory expanding start-condition stack" );
2924 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2931 #ifndef YY_NO_POP_STATE
2932 static void yy_pop_state()
2934 if ( --yy_start_stack_ptr < 0 )
2935 YY_FATAL_ERROR( "start-condition stack underflow" );
2937 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2942 #ifndef YY_NO_TOP_STATE
2943 static int yy_top_state()
2945 return yy_start_stack[yy_start_stack_ptr - 1];
2949 #ifndef YY_EXIT_FAILURE
2950 #define YY_EXIT_FAILURE 2
2953 #ifdef YY_USE_PROTOS
2954 static void yy_fatal_error( yyconst char msg[] )
2956 static void yy_fatal_error( msg )
2960 (void) fprintf( stderr, "%s\n", msg );
2961 exit( YY_EXIT_FAILURE );
2966 /* Redefine yyless() so it works in section 3 code. */
2972 /* Undo effects of setting up yytext. */ \
2973 yytext[yyleng] = yy_hold_char; \
2974 yy_c_buf_p = yytext + n; \
2975 yy_hold_char = *yy_c_buf_p; \
2976 *yy_c_buf_p = '\0'; \
2982 /* Internal utility routines. */
2985 #ifdef YY_USE_PROTOS
2986 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2988 static void yy_flex_strncpy( s1, s2, n )
2995 for ( i = 0; i < n; ++i )
3000 #ifdef YY_NEED_STRLEN
3001 #ifdef YY_USE_PROTOS
3002 static int yy_flex_strlen( yyconst char *s )
3004 static int yy_flex_strlen( s )
3009 for ( n = 0; s[n]; ++n )
3017 #ifdef YY_USE_PROTOS
3018 static void *yy_flex_alloc( yy_size_t size )
3020 static void *yy_flex_alloc( size )
3024 return (void *) malloc( size );
3027 #ifdef YY_USE_PROTOS
3028 static void *yy_flex_realloc( void *ptr, yy_size_t size )
3030 static void *yy_flex_realloc( ptr, size )
3035 /* The cast to (char *) in the following accommodates both
3036 * implementations that use char* generic pointers, and those
3037 * that use void* generic pointers. It works with the latter
3038 * because both ANSI C and C++ allow castless assignment from
3039 * any pointer type to void*, and deal with argument conversions
3040 * as though doing an assignment.
3042 return (void *) realloc( (char *) ptr, size );
3045 #ifdef YY_USE_PROTOS
3046 static void yy_flex_free( void *ptr )
3048 static void yy_flex_free( ptr )
3062 #line 544 "cscanner.l"
3067 /*@null@*/ /*@observer@*/ char *name;
3072 ** These tokens are followed by syntax that is parsed by the
3076 struct skeyword s_parsetable[] = {
3077 { "modifies", QMODIFIES } ,
3078 { "globals", QGLOBALS } ,
3080 { "constant", QCONSTANT } ,
3081 { "function", QFUNCTION } ,
3083 { "defines", QDEFINES } ,
3085 { "allocates", QALLOCATES } ,
3087 { "releases", QRELEASES } ,
3088 { "pre", QPRECLAUSE } ,
3089 { "post", QPOSTCLAUSE } ,
3090 {"setBufferSize", QSETBUFFERSIZE},
3091 {"requires", QBUFFERCONSTRAINT},
3092 {"ensures", QENSURESCONSTRAINT},
3093 {"setStringLength", QSETSTRINGLENGTH},
3094 {"testinRange", QTESTINRANGE},
3099 ** These tokens are either stand-alone tokens, or followed by
3100 ** token-specific text.
3103 struct skeyword s_keytable[] = {
3104 { "anytype", QANYTYPE } ,
3105 { "integraltype", QINTEGRALTYPE } ,
3106 { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } ,
3107 { "signedintegraltype", QSIGNEDINTEGRALTYPE } ,
3111 { "owned", QOWNED } ,
3112 { "dependent", QDEPENDENT } ,
3113 { "partial", QPARTIAL } ,
3114 { "special", QSPECIAL } ,
3115 { "truenull", QTRUENULL } ,
3116 { "falsenull", QFALSENULL } ,
3119 { "notnull", QNOTNULL } ,
3120 { "abstract", QABSTRACT } ,
3121 { "concrete", QCONCRETE } ,
3122 { "mutable", QMUTABLE } ,
3123 { "immutable", QIMMUTABLE } ,
3124 { "unused", QUNUSED } ,
3125 { "external", QEXTERNAL } ,
3127 { "unique", QUNIQUE } ,
3128 { "returned", QRETURNED } ,
3129 { "exposed", QEXPOSED } ,
3130 { "refcounted", QREFCOUNTED } ,
3132 { "newref", QNEWREF } ,
3133 { "tempref", QTEMPREF } ,
3134 { "killref", QKILLREF } ,
3136 { "relnull", QRELNULL } ,
3137 { "nullterminated", QNULLTERMINATED },
3138 { "setBufferSize", QSETBUFFERSIZE },
3139 { "requires", QBUFFERCONSTRAINT },
3140 { "ensures", QENSURESCONSTRAINT },
3141 { "testInRange", QTESTINRANGE},
3142 { "MaxSet", QMAXSET},
3143 { "MaxRead", QMAXREAD},
3144 { "reldef", QRELDEF } ,
3145 { "observer", QOBSERVER } ,
3146 { "exits", QEXITS } ,
3147 { "mayexit", QMAYEXIT } ,
3148 { "trueexit", QTRUEEXIT } ,
3149 { "falseexit", QFALSEEXIT } ,
3150 { "neverexit", QNEVEREXIT } ,
3152 { "shared", QSHARED } ,
3154 { "unchecked", QUNCHECKED } ,
3155 { "checked", QCHECKED } ,
3156 { "checkmod", QCHECKMOD } ,
3157 { "checkedstrict", QCHECKEDSTRICT } ,
3158 { "innercontinue", QINNERCONTINUE } ,
3159 { "innerbreak", QINNERBREAK } ,
3160 { "loopbreak", QLOOPBREAK } ,
3161 { "switchbreak", QSWITCHBREAK } ,
3162 { "safebreak", QSAFEBREAK } ,
3163 { "fallthrough", QFALLTHROUGH } ,
3164 { "l_fallthrou", QLINTFALLTHROUGH } ,
3165 { "l_fallth", QLINTFALLTHRU } ,
3166 { "notreached", QNOTREACHED } ,
3167 { "l_notreach", QLINTNOTREACHED } ,
3168 { "printflike", QPRINTFLIKE } ,
3169 { "l_printfli", QLINTPRINTFLIKE } ,
3170 { "scanflike", QSCANFLIKE } ,
3171 { "messagelike", QMESSAGELIKE } ,
3172 { "l_argsus", QARGSUSED } ,
3177 ** would be better if these weren't hard coded...
3180 static bool isArtificial (cstring s)
3182 return (cstring_equalLit (s, "modifies")
3183 || cstring_equalLit (s, "globals")
3184 || cstring_equalLit (s, "alt"));
3187 void swallowMacro (void)
3190 bool skipnext = FALSE;
3192 while ((i = lminput ()) != EOF)
3209 checkUngetc (i, yyin);
3217 checkUngetc (i, yyin);
3221 static int commentMarkerToken (cstring s)
3225 while (s_parsetable[i].name != NULL)
3227 if (cstring_equalLit (s, s_parsetable[i].name))
3229 return s_parsetable[i].token;
3238 static int tokenMacroCode (cstring s)
3242 while (s_keytable[i].name != NULL)
3244 if (cstring_equalLit (s, s_keytable[i].name))
3246 if (s_keytable[i].token == QLINTFALLTHROUGH)
3249 (FLG_WARNLINTCOMMENTS,
3251 ("Traditional lint comment /*FALLTHROUGH*/ used. "
3252 "This is interpreted by "
3253 "LCLint in the same way as most Unix lints, but it is "
3254 "preferable to replace it with the /*@fallthrough@*/ "
3255 "stylized comment"),
3257 return QFALLTHROUGH;
3259 else if (s_keytable[i].token == QLINTFALLTHRU)
3262 (FLG_WARNLINTCOMMENTS,
3264 ("Traditional lint comment /*FALLTHRU*/ used. "
3265 "This is interpreted by "
3266 "LCLint in the same way as most Unix lints, but it is "
3267 "preferable to replace it with the /*@fallthrough@*/ "
3268 "stylized comment"),
3270 return QFALLTHROUGH;
3272 else if (s_keytable[i].token == QLINTNOTREACHED)
3275 (FLG_WARNLINTCOMMENTS,
3277 ("Traditional lint comment /*NOTREACHED*/ used. "
3278 "This is interpreted by "
3279 "LCLint in the same way as most Unix lints, but it is "
3280 "preferable to replace it with the /*@notreached@*/ "
3281 "stylized comment."),
3286 else if (s_keytable[i].token == QPRINTFLIKE)
3288 setSpecialFunction (QU_PRINTFLIKE);
3291 else if (s_keytable[i].token == QLINTPRINTFLIKE)
3294 (FLG_WARNLINTCOMMENTS,
3296 ("Traditional lint comment /*PRINTFLIKE*/ used. "
3297 "This is interpreted by "
3298 "LCLint in the same way as most Unix lints, but it is "
3299 "preferable to replace it with either /*@printflike@*/, "
3300 "/*@scanflike@*/ or /*@messagelike@*/."),
3303 setSpecialFunction (QU_PRINTFLIKE);
3306 else if (s_keytable[i].token == QSCANFLIKE)
3308 setSpecialFunction (QU_SCANFLIKE);
3311 else if (s_keytable[i].token == QMESSAGELIKE)
3313 setSpecialFunction (QU_MESSAGELIKE);
3316 else if (s_keytable[i].token == QARGSUSED)
3319 (FLG_WARNLINTCOMMENTS,
3321 ("Traditional lint comment /*ARGSUSED*/ used. "
3322 "This is interpreted by "
3323 "LCLint in the same way as most Unix lints, but it is "
3324 "preferable to use /*@unused@*/ annotations on "
3325 "the unused parameters."),
3332 return s_keytable[i].token;
3341 static int lminput ()
3343 if (savechar == '\0')
3350 int save = (int) savechar;
3356 static void lmsavechar (char c)
3358 if (savechar == '\0') savechar = c;
3361 llbuglit ("lmsavechar: override");
3365 static int returnFloat (ctype ct, double f)
3367 yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext),
3368 fileloc_decColumn (g_currentloc, tokLength));
3373 static int returnInt (ctype ct, long i)
3377 if (ctype_equal (ct, ctype_int))
3381 c = context_typeofZero ();
3385 c = context_typeofOne ();
3389 yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext),
3390 fileloc_decColumn (g_currentloc, tokLength), i);
3395 static int returnChar (char c)
3397 yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext),
3398 fileloc_decColumn (g_currentloc, tokLength));
3403 static int ninput ()
3407 if (c != EOF && ((char)c == '\n'))
3409 context_incLineno ();
3415 static char macro_nextChar ()
3417 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3422 c = char_fromInt (ic);
3424 if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0]))
3428 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3430 ; /* skip to newline */
3433 context_incLineno ();
3437 return macro_nextChar ();
3444 else /* if (c == '@') */
3446 if (handleLlSpecial () != BADTOK)
3448 llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax");
3451 return macro_nextChar ();
3454 else if (!in_escape && c == '\"')
3456 in_quote = !in_quote;
3458 else if (!in_escape && c == '\'')
3462 else if ((in_quote || in_char) && c == '\\')
3464 in_escape = !in_escape;
3466 else if ((in_quote || in_char) && in_escape)
3470 else if (!in_quote && c == '/')
3474 if ((c2 = char_fromInt (lminput ())) == '*')
3478 while ((c2 = char_fromInt (lminput ())) != '\0'
3479 && c2 != '\n' && c2 != '*')
3486 while ((c2 = char_fromInt (lminput ())) != '\0'
3499 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3503 return macro_nextChar ();
3507 /*** putchar does not work! why? puts to stdio...??! ***/
3515 ** keeps stylized comments
3518 static char macro_nextCharC ()
3520 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3523 c = char_fromInt (lminput ());
3525 if (!in_quote && !in_char && c == '\\')
3527 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3529 ; /* skip to newline */
3532 context_incLineno ();
3536 return macro_nextCharC ();
3543 else if (!in_escape && c == '\"')
3545 in_quote = !in_quote;
3547 else if (!in_escape && c == '\'')
3551 else if ((in_quote || in_char) && c == '\\')
3553 in_escape = !in_escape;
3555 else if ((in_quote || in_char) && in_escape)
3559 else if (!in_quote && c == '/')
3563 if ((c2 = char_fromInt (lminput ())) == '*')
3567 while ((c2 = char_fromInt (lminput ())) != '\0'
3568 && c2 != '\n' && c2 != '*')
3575 while ((c2 = char_fromInt (lminput ())) != '\0'
3588 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3592 return macro_nextCharC ();
3603 ** skips whitespace (handles line continuations)
3604 ** returns first non-whitespace character
3607 static char skip_whitespace ()
3611 while ((c = macro_nextChar ()) == ' ' || c == '\t')
3619 static void handleMacro ()
3621 cstring mac = cstring_undefined;
3625 while (currentColumn () > 2)
3627 mac = cstring_appendChar (mac, ' ');
3631 c = macro_nextCharC ();
3633 if (c >= '0' && c <= '9')
3637 for (i = 0; i < ((c - '0') + 1); i++)
3639 mac = cstring_appendChar (mac, ' ');
3647 while (((c = macro_nextCharC ()) != '\0') && (c != '\n'))
3649 mac = cstring_appendChar (mac, c);
3653 macrocode = tokenMacroCode (mac);
3655 if (macrocode == BADTOK && !isArtificial (mac))
3657 DPRINTF (("Add macro: %s", mac));
3658 context_addMacroCache (mac);
3667 context_incLineno ();
3671 static bool processMacro (void)
3676 cstring fname = cstring_undefined;
3678 bool isspecfcn = FALSE;
3679 bool isiter = FALSE;
3680 bool skipparam = FALSE;
3681 bool isenditer = FALSE;
3682 bool unknownm = FALSE;
3683 bool hasParams = FALSE;
3684 bool emptyMacro = FALSE;
3685 char c = skip_whitespace ();
3686 fileloc loc = fileloc_noColumn (g_currentloc);
3688 /* are both of these necessary? what do they mean? */
3689 uentryList specparams = uentryList_undefined;
3690 uentryList pn = uentryList_undefined;
3692 context_resetMacroMissingParams ();
3694 if (c == '\0' || c == '\n')
3696 llcontbug (cstring_makeLiteral ("Bad macro"));
3701 fname = cstring_appendChar (fname, c);
3703 while ((c = macro_nextChar ()) != '(' && c != '\0'
3704 && c != ' ' && c != '\t' && c != '\n')
3706 fname = cstring_appendChar (fname, c);
3709 if (c == ' ' || c == '\t' || c == '\n')
3715 while (c == ' ' || c == '\t')
3717 c = macro_nextChar ();
3731 hasParams = (c == '(');
3734 if (usymtab_exists (fname))
3736 e2 = usymtab_lookupExpose (fname);
3737 ct = uentry_getType (e2);
3740 if (uentry_isCodeDefined (e2)
3741 && fileloc_isUser (uentry_whereDefined (e2)))
3745 message ("Macro %s already defined", fname),
3748 uentry_showWhereDefined (e2);
3749 uentry_clearDefined (e2);
3752 if (uentry_isFunction (e2))
3754 uentry_setType (e2, ctype_unknown);
3757 context_enterUnknownMacro (e2);
3761 context_enterConstantMacro (e2);
3766 if (uentry_isForward (e2) && uentry_isFunction (e2))
3773 ("Parameterized macro has no prototype or specification: %s ",
3778 uentry_setType (e2, ctype_unknown);
3779 uentry_setFunctionDefined (e2, loc);
3780 uentry_setUsed (e2, fileloc_undefined);
3781 context_enterUnknownMacro (e2);
3785 if (uentry_isIter (e2))
3788 specparams = uentry_getParams (e2);
3789 noparams = uentryList_size (specparams);
3790 uentry_setDefined (e2, loc);
3791 context_enterIterDef (e2);
3793 else if (uentry_isEndIter (e2))
3796 uentry_setDefined (e2, loc);
3797 context_enterIterEnd (e2); /* don't care about it now */
3798 /* but should parse like an iter! */
3800 else if (uentry_isConstant (e2))
3806 message ("Constant %s implemented as parameterized macro",
3810 uentry_showWhereSpecified (e2);
3811 uentry_setType (e2, ctype_unknown);
3812 uentry_makeVarFunction (e2);
3813 uentry_setDefined (e2, g_currentloc);
3814 uentry_setFunctionDefined (e2, g_currentloc);
3815 context_enterUnknownMacro (e2);
3819 if (!uentry_isSpecified (e2))
3821 fileloc oloc = uentry_whereDeclared (e2);
3823 if (fileloc_isLib (oloc))
3827 else if (fileloc_isUndefined (oloc)
3828 || fileloc_isPreproc (oloc))
3833 (FLG_MACROCONSTDECL,
3835 ("Macro constant %q not declared",
3836 uentry_getName (e2)),
3840 else if (!fileloc_withinLines (oloc, loc, 2))
3841 { /* bogus! will give errors if there is too much whitespace */
3845 ("Macro constant name %s does not match name in "
3846 "previous constant declaration. This constant "
3847 "is declared at %q", fname,
3848 fileloc_unparse (oloc)),
3853 context_enterConstantMacro (e2);
3854 cstring_free (fname);
3860 else if (ctype_isFunction (ct))
3863 specparams = ctype_argsFunction (ct);
3864 noparams = uentryList_size (specparams);
3866 uentry_setFunctionDefined (e2, loc);
3867 context_enterMacro (e2);
3869 else if (uentry_isVar (e2))
3875 message ("Variable %s implemented as parameterized macro",
3879 uentry_showWhereSpecified (e2);
3880 uentry_setType (e2, ctype_unknown);
3881 uentry_makeVarFunction (e2);
3882 uentry_setDefined (e2, g_currentloc);
3883 uentry_setFunctionDefined (e2, g_currentloc);
3884 context_enterUnknownMacro (e2);
3888 uentry ucons = uentry_makeConstant (fname,
3891 if (uentry_isExpandedMacro (e2))
3899 message ("Variable %s implemented by a macro",
3903 uentry_showWhereSpecified (e2);
3907 uentry_setDefined (e2, loc);
3908 uentry_setUsed (ucons, loc);
3910 context_enterConstantMacro (ucons);
3911 uentry_markOwned (ucons);
3912 cstring_free (fname);
3918 if (uentry_isDatatype (e2))
3922 message ("Type implemented as macro: %x",
3923 uentry_getName (e2)),
3924 message ("A type is implemented using a macro definition. A "
3925 "typedef should be used instead."),
3929 /* Must exit scope (not sure why a new scope was entered?) */
3930 usymtab_quietExitScope (g_currentloc);
3931 uentry_setDefined (e2, g_currentloc);
3937 (message ("Unexpanded macro not function or constant: %q",
3938 uentry_unparse (e2)));
3939 uentry_setType (e2, ctype_unknown);
3943 uentry_makeVarFunction (e2);
3944 uentry_setDefined (e2, g_currentloc);
3945 uentry_setFunctionDefined (e2, g_currentloc);
3946 context_enterUnknownMacro (e2);
3958 (FLG_MACROMATCHNAME,
3959 message ("Unexpanded macro %s does not match name of a constant "
3960 "or iter declaration. The name used in the control "
3961 "comment on the previous line should match. "
3962 "(Assuming macro defines a constant.)",
3967 ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined);
3968 uentry_setUsed (ce, loc); /* perhaps bogus? */
3969 e2 = usymtab_supEntryReturn (ce);
3971 context_enterConstantMacro (e2);
3972 cstring_free (fname);
3977 /* in macros, ( must follow immediatetly after name */
3983 c = skip_whitespace ();
3985 while (c != ')' && c != '\0')
3988 bool suppress = context_inSuppressRegion ();
3989 cstring paramname = cstring_undefined;
3992 ** save the parameter location
3996 context_saveLocation ();
3999 while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')')
4001 paramname = cstring_appendChar (paramname, c);
4002 c = macro_nextChar ();
4005 if (c == ' ' || c == '\t') c = skip_whitespace ();
4009 c = macro_nextChar ();
4010 if (c == ' ' || c == '\t') c = skip_whitespace ();
4015 llfatalerror (cstring_makeLiteral
4016 ("Bad macro syntax: uentryList"));
4019 if ((isspecfcn || isiter) && (paramno < noparams)
4020 && !uentry_isElipsisMarker (uentryList_getN
4021 (specparams, paramno)))
4023 uentry decl = uentryList_getN (specparams, paramno);
4026 param = uentry_nameCopy (paramname, decl);
4029 uentry_setParam (param);
4030 sr = sRef_makeParam (paramno, uentry_getType (param));
4032 if (sRef_getNullState (sr) == NS_ABSNULL)
4034 ctype pt = ctype_realType (uentry_getType (param));
4036 if (ctype_isUser (pt))
4038 uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt));
4040 if (uentry_isValid (te))
4042 sRef_setStateFromUentry (sr, te);
4047 sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
4051 uentry_setSref (param, sr);
4052 uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
4054 skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
4058 fileloc sloc = context_getSaveLocation ();
4060 param = uentry_makeVariableSrefParam
4061 (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
4062 cstring_free (paramname);
4064 sRef_setPosNull (uentry_getSref (param), sloc);
4066 uentry_setDeclaredForce (param, sloc);
4069 fileloc_free (sloc);
4074 llassert (!uentry_isElipsisMarker (param));
4078 sRef_makeUnsafe (uentry_getSref (param));
4081 pn = uentryList_add (pn, uentry_copy (param));
4082 usymtab_supEntry (param);
4086 /* don't add param */
4087 uentry_free (param);
4092 (void) macro_nextChar ();
4093 c = skip_whitespace ();
4101 if (isspecfcn || isiter)
4103 if (paramno != noparams && noparams >= 0)
4109 message ("Macro %s specified with %d args, defined with %d",
4110 fname, noparams, paramno),
4113 uentry_showWhereSpecified (e2);
4114 uentry_resetParams (e2, pn);
4119 uentry_resetParams (e2, pn);
4126 ** the form should be:
4128 ** # define newname oldname
4129 ** where oldname refers to a function matching the specification
4135 sRef_setGlobalScope ();
4136 usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown));
4137 sRef_clearGlobalScope ();
4141 context_setMacroMissingParams ();
4146 /* context_setuentryList (pn); */
4147 usymtab_enterScope ();
4150 cstring_free (fname);
4155 static bool handleSpecial (char *yyt)
4157 char *l = mstring_create (MAX_NAME_LENGTH);
4158 static bool reportcpp = FALSE;
4164 strcpy (l, yyt + 1);
4166 /* Need to safe original l for deallocating. */
4169 l += strlen (yyt) - 1;
4171 while ((c = char_fromInt (lminput ())) != '\n' && c != '\0')
4177 olc = cstring_fromChars (ol);
4179 if (cstring_equalPrefix (olc, "pragma"))
4181 char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN));
4182 char *opname = pname;
4183 char *ptr = ol + 6; /* pragma is six characters, plus space */
4187 /* skip whitespace */
4188 while (((c = *ptr) != '\0') && isspace (c))
4194 while (((c = *ptr) != '\0') && !isspace (c))
4198 if (len > MAX_PRAGMA_LEN)
4209 if (len == PRAGMA_LEN_EXPAND
4210 && mstring_equal (opname, PRAGMA_EXPAND))
4212 cstring exname = cstring_undefined;
4216 while (((c = *ptr) != '\0') && !isspace (c))
4218 exname = cstring_appendChar (exname, c);
4223 ue = usymtab_lookupExposeGlob (exname);
4225 if (uentry_isExpandedMacro (ue))
4227 if (fileloc_isPreproc (uentry_whereDefined (ue)))
4229 fileloc_setColumn (g_currentloc, 1);
4230 uentry_setDefined (ue, g_currentloc);
4234 cstring_free (exname);
4237 else if (cstring_equalPrefix (olc, "ident"))
4239 /* Some pre-processors will leave these in the code. Ignore rest of line */
4242 ** Yuk...Win32 filenames can have spaces in them...we need to read
4243 ** to the matching end quote.
4245 else if ((sscanf (ol, "line %d \"", &lineno) == 1)
4246 || (sscanf (ol, " %d \"", &lineno) == 1))
4252 while (*tmp != '\"' && *tmp != '\0')
4257 llassert (*tmp == '\"');
4262 while (*tmp != '\"' && *tmp != '\0')
4267 llassert (*tmp == '\"');
4271 DPRINTF (("fname: %s", fname));
4273 # if defined(OS2) || defined(MSDOS) || defined(WIN32)
4276 ** DOS-like path delimiters get delivered in pairs, something like
4277 ** \"..\\\\file.h\", so we have to make it normal again. We do NOT
4278 ** remove the pre dirs yet as we usually specify tmp paths relative
4279 ** to the current directory, so tmp files would not get found in
4280 ** the hash table. If this method fails we try it again later.
4287 ** Skip past the drive marker.
4290 DPRINTF (("stmp: %s / %s", stmp, fname));
4292 if (strchr (stmp, ':') != NULL)
4294 stmp = strchr (stmp, ':') + 1;
4297 DPRINTF (("stmp: %s / %s", stmp, fname));
4299 while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL )
4301 if (*(stmp+1) == CONNECTCHAR)
4303 memmove (stmp, stmp+1, strlen (stmp));
4307 DPRINTF (("stmp: %s / %s", stmp, fname));
4310 DPRINTF (("Now: base = %s", fname));
4312 fid = fileTable_lookupBase (context_fileTable (),
4313 cstring_fromChars (fname));
4314 if (!(fileId_isValid (fid)))
4316 fname = removePreDirs (fname);
4317 fid = fileTable_lookupBase (context_fileTable (),
4318 cstring_fromChars (fname));
4321 # else /* !defined(OS2) && !defined(MSDOS) */
4322 fname = removePreDirs (fname);
4323 fid = fileTable_lookupBase (context_fileTable (),
4324 cstring_fromChars (fname));
4325 # endif /* !defined(OS2) && !defined(MSDOS) */
4327 if (!(fileId_isValid (fid)))
4329 if (isHeaderFile (cstring_fromChars (fname)))
4331 fid = fileTable_addHeaderFile (context_fileTable (),
4332 cstring_fromChars (fname));
4336 fid = fileTable_addFile (context_fileTable (),
4337 cstring_fromChars (fname));
4341 setFileLine (fid, lineno);
4343 else if ((sscanf (ol, "line %d", &lineno) == 1)
4344 || (sscanf (ol, " %d", &lineno) == 1))
4346 setLine (lineno); /* next line is <cr> */
4350 if (mstring_equal (ol, "")) {
4351 DPRINTF (("Empty pp command!"));
4353 ** evs 2000-05-16: This is a horrible kludge, to get around a bug (well, difficulty) in the pre-processor.
4354 ** We handle a plain # in the input file, by echoing it, and ignoring it in the post-pp-file.
4363 llbug (message ("File contains preprocessor command: #%s",
4364 cstring_fromChars (ol)));
4377 static int handleLlSpecial ()
4381 char *s = mstring_createEmpty ();
4386 while (((ic = ninput ()) != 0) && isalpha (ic))
4389 s = mstring_append (s, c);
4395 if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0])
4399 llassert (ic == AFTER_COMMENT_MARKER[1]);
4402 if (isProcessingGlobMods () && (*s == '\0'))
4405 return QNOMODS; /* special token no modifications token */
4413 tok = commentMarkerToken (cstring_fromChars (os));
4417 tokLength = charsread;
4423 /* Add rest of the comment */
4425 if (ic != 0 && ic != EOF)
4430 s = mstring_append (s, c);
4433 while (((ic = ninput ()) != 0) && (ic != EOF)
4434 && (ic != AFTER_COMMENT_MARKER[0]))
4437 s = mstring_append (s, c);
4442 if (ic == AFTER_COMMENT_MARKER[0])
4445 llassert ((char) nc == AFTER_COMMENT_MARKER[1]);
4452 while (*s == ' ' || *s == '\t' || *s == '\n')
4457 if (*s == '-' || *s == '+' || *s == '=') /* setting flags */
4461 while (c == '-' || c == '+' || c == '=')
4463 ynm set = ynm_fromCodeChar (c);
4468 thisflag = cstring_fromChars (s);
4470 while ((c = *s) != '\0' && (c != '-') && (c != '=')
4471 && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n'))
4478 if (!context_getFlag (FLG_NOCOMMENTS))
4480 cstring flagname = thisflag;
4481 flagcode fflag = identifyFlag (flagname);
4483 if (flagcode_isSkip (fflag))
4487 else if (flagcode_isInvalid (fflag))
4489 if (isMode (flagname))
4491 if (ynm_isMaybe (set))
4496 ("Stylized comment attempts to restore flag %s. "
4497 "A mode flag cannot be restored.",
4502 context_setMode (flagname);
4509 message ("Unrecognized option in stylized comment: %s",
4513 else if (flagcode_isGlobalFlag (fflag))
4518 ("Stylized comment attempts to set global flag %s. "
4519 "A global flag cannot be set locally.",
4524 context_fileSetFlag (fflag, set);
4526 if (flagcode_hasArgument (fflag))
4528 if (ynm_isMaybe (set))
4533 ("Stylized comment attempts to restore flag %s. "
4534 "A flag for setting a value cannot be restored.",
4538 { /* cut-and-pastied from llmain...blecch */
4539 cstring extra = cstring_undefined;
4545 rest = mstring_copy (s);
4549 while ((rchar = *rest) != '\0'
4550 && (isspace (rchar)))
4556 while ((rchar = *rest) != '\0'
4557 && !isspace (rchar))
4559 extra = cstring_appendChar (extra, rchar);
4566 if (cstring_isUndefined (extra))
4571 ("Flag %s (in stylized comment) must be followed by an argument",
4572 flagcode_unparse (fflag)));
4578 if (flagcode_hasValue (fflag))
4580 setValueFlag (fflag, extra);
4582 else if (flagcode_hasString (fflag))
4584 setStringFlag (fflag, extra);
4601 while ((c == ' ') || (c == '\t') || (c == '\n'))
4607 if (context_inHeader () && !isArtificial (cstring_fromChars (os)))
4609 context_addComment (cstring_fromCharsNew (os));
4622 while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n')
4634 t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t)));
4635 macrocode = tokenMacroCode (cstring_fromChars (t));
4637 if (macrocode != BADTOK)
4639 tokLength = mstring_length (t);
4645 if (macrocode == SKIPTOK)
4653 if (context_inHeader ())
4660 if ((context_inMacro () || context_inGlobalContext ())
4661 && macrocode != SKIPTOK
4662 && !isArtificial (cstring_fromChars (os)))
4664 context_addComment (cstring_fromCharsNew (os));
4677 if (mstring_equal (t, "ignore"))
4679 if (!context_getFlag (FLG_NOCOMMENTS))
4681 context_enterSuppressRegion ();
4684 else if ((*t == 'i' || *t == 't')
4685 && (*(t + 1) == '\0'))
4687 if (!context_getFlag (FLG_NOCOMMENTS)
4688 && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS)))
4690 context_enterSuppressLine (-1); /* infinite suppression */
4693 else if (((*t == 'i') || (*t == 't'))
4694 && ((*(t + 1) >= '0' && *(t + 1) <= '9')))
4696 bool tmpcomment = (*t == 't');
4698 char *tt = t; /* don't mangle t, since it is free'd */
4701 if (lc >= '0' && lc <= '9')
4703 val = (int)(lc - '0');
4706 while (lc >= '0' && lc <= '9')
4715 if (!context_getFlag (FLG_NOCOMMENTS)
4716 && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS)))
4718 context_enterSuppressLine (val);
4721 else if (mstring_equal (t, "end"))
4723 if (!context_getFlag (FLG_NOCOMMENTS))
4725 context_exitSuppressRegion ();
4728 else if (mstring_equal (t, "notfunction"))
4730 ; /* handled by pcpp */
4732 else if (mstring_equal (t, "access"))
4738 while ((c = *s) && (c == ' ' || c == '\t' || c == '\n'))
4748 tname = cstring_fromChars (s);
4750 while ((c = *s) != '\0' && c != ' '
4751 && c != '\t' && c != '\n' && c != ',')
4759 if (!context_getFlag (FLG_NOCOMMENTS)
4760 && !context_getFlag (FLG_NOACCESS))
4762 if (usymtab_existsType (tname))
4764 usymId uid = usymtab_getTypeId (tname);
4765 context_addFileAccessType (uid);
4769 if (!(context_inSuppressRegion ()
4770 || context_inSuppressZone (g_currentloc)))
4774 ("%q: Unrecognized type %s used in access comment",
4775 fileloc_unparse (g_currentloc), tname));
4785 if (c != ',' && c != ' ')
4791 else if (mstring_equal (t, "noaccess"))
4798 while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n'))
4808 tname = cstring_fromChars (s);
4810 while ((lc = *s) != '\0' && lc != ' ' && lc != '\t'
4811 && lc != '\n' && lc != ',')
4818 if (!context_getFlag (FLG_NOCOMMENTS)
4819 && !context_getFlag (FLG_NOACCESS))
4821 if (usymtab_existsType (tname))
4823 typeId tuid = usymtab_getTypeId (tname);
4825 if (context_couldHaveAccess (tuid))
4827 context_removeFileAccessType (tuid);
4831 if (!(context_inSuppressRegion ()
4832 || context_inSuppressZone (g_currentloc)))
4834 uentry ue = usymtab_getTypeEntry (tuid);
4836 if (uentry_isAbstractDatatype (ue))
4840 ("%q: Non-accessible abstract type %s used in noaccess comment",
4841 fileloc_unparse (g_currentloc), tname));
4847 ("%q: Non-abstract type %s used in noaccess comment",
4848 fileloc_unparse (g_currentloc), tname));
4855 if (!(context_inSuppressRegion ()
4856 || context_inSuppressZone (g_currentloc)))
4860 ("%q: Unrecognized type %s used in noaccess comment",
4861 fileloc_unparse (g_currentloc), tname));
4871 if (lc != ',' && lc != ' ')
4879 setTokLength (- (2 + charsread));
4881 voptgenerror (FLG_UNRECOGCOMMENTS,
4882 message ("Stylized comment unrecognized: %s",
4883 cstring_fromChars (os)),
4894 static /*@only@*/ cstring makeIdentifier (char *s)
4896 char *c = mstring_create (size_toInt (strlen (s)) + 1);
4897 cstring id = cstring_fromChars (c);
4899 while (isalnum (*s) || (*s == '_') || (*s == '$'))
4908 /*@observer@*/ /*@dependent@*/ uentry coerceId (cstring cn)
4910 if (!(usymtab_exists (cn)))
4912 fileloc loc = fileloc_createExternal ();
4915 ** We need to put this in a global scope, otherwise the sRef will be deallocated.
4918 uentry ce = uentry_makeUnrecognized (cn, loc);
4920 if (!context_inIterEnd ())
4924 message ("Unrecognized (possibly system) identifier: %q",
4925 uentry_getName (ce)),
4932 return (usymtab_lookup (cn));
4936 ** like, coerceId, but doesn't supercede for iters
4939 /*@observer@*/ uentry coerceIterId (cstring cn)
4941 if (!(usymtab_exists (cn)))
4943 return uentry_undefined;
4946 return (usymtab_lookup (cn));
4949 /*@observer@*/ cstring LastIdentifier ()
4951 return (lastidprocessed);
4954 static int processIdentifier (cstring id)
4958 DPRINTF (("Process identifier: %s", id));
4960 context_clearJustPopped ();
4961 lastidprocessed = id;
4963 if (context_inFunctionDecl ())
4965 int tok = commentMarkerToken (id);
4973 tok = tokenMacroCode (id);
4982 /* Consider handling: Defined by C99 as static const char __func__[] */
4984 if (context_getFlag (FLG_GNUEXTENSIONS))
4988 if (cstring_equalLit (id, "__stdcall")
4989 || cstring_equalLit (id, "__cdecl")
4990 || cstring_equalLit (id, "__extension__"))
4994 else if (cstring_equalLit (id, "__volatile__"))
4998 else if (cstring_equalLit (id, "__signed"))
5002 else if (cstring_equalLit (id, "__unsigned"))
5006 else if (cstring_equalLit (id, "__const__"))
5010 else if (cstring_equalLit (id, "__alignof__"))
5012 tok = CALIGNOF; /* alignof is parsed like sizeof */
5014 else if (cstring_equalLit (id, "__FUNCTION__")
5015 || cstring_equalLit (id, "__PRETTY_FUNCTION__"))
5017 /* These tokens hold the name of the current function as strings */
5018 yylval.expr = exprNode_stringLiteral (id, fileloc_copy (g_currentloc));
5020 lastWasString = TRUE;
5024 else if (cstring_equalLit (id, "__attribute__")
5025 || cstring_equalLit (id, "__asm__")
5026 || cstring_equalLit (id, "_asm")
5027 || cstring_equalLit (id, "__asm")
5028 || cstring_equalLit (id, "__declspec"))
5031 bool useparens = FALSE;
5032 bool usebraces = FALSE;
5033 bool inquote = FALSE;
5034 bool inescape = FALSE;
5037 while ((ic = input ()) != EOF)
5044 else if (ic == '\\')
5048 else if (ic == '\"')
5084 else if (ic == ')' && useparens)
5087 if (depth == 0) break;
5089 else if (ic == '}' && usebraces)
5092 if (depth == 0) break;
5095 && !usebraces && !useparens
5096 && cstring_equalLit (id, "__asm"))
5099 ** We need this because some MS VC++ include files
5100 ** have __asm mov ... }
5101 ** Its a kludge, but otherwise would need to parse
5110 context_incLineno ();
5112 if (cstring_equalLit (id, "__asm")
5113 && !useparens && !usebraces)
5120 llassert ((useparens && ic == ')')
5121 || (usebraces && ic == '}')
5122 || (!useparens && !usebraces));
5126 else if (cstring_equalLit (id, "inline")
5127 || cstring_equalLit (id, "__inline")
5128 || cstring_equalLit (id, "_inline")
5129 || cstring_equalLit (id, "__inline__"))
5140 le = usymtab_lookupSafe (id);
5142 /*@-dependenttrans@*/
5144 if (uentry_isIter (le))
5149 else if (uentry_isEndIter (le))
5152 return (ITER_ENDNAME);
5154 else if (uentry_isUndefined (le))
5158 /* avoid parse errors for certain system built ins */
5160 if (g_expectingTypeName && (cstring_firstChar (id) == '_')
5161 && (cstring_secondChar (id) == '_'))
5163 return (TYPE_NAME_OR_ID);
5166 return (NEW_IDENTIFIER);
5168 else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le))
5170 if (uentry_isDatatype (le))
5173 return (NEW_IDENTIFIER);
5178 return (IDENTIFIER);
5181 else if (uentry_isDatatype (le))
5183 if (!g_expectingTypeName)
5187 return (NEW_IDENTIFIER);
5191 yylval.ctyp = uentry_getAbstractType (le);
5193 uentry_setUsed (le, g_currentloc);
5200 return (IDENTIFIER);
5203 /*@=dependenttrans@*/
5206 static bool processHashIdentifier (/*@only@*/ cstring id)
5208 if (context_inMacro () || context_inIterDef () ||
5209 context_inIterEnd ())
5213 context_clearJustPopped ();
5215 lastidprocessed = id;
5216 le = usymtab_lookupSafe (id);
5218 if (uentry_isParam (le) || uentry_isRefParam (le))
5235 static /*@only@*/ exprNode processString ()
5239 char *nl = strchr (yytext, '\n');
5240 cstring ns = cstring_fromCharsNew (yytext);
5244 loc = fileloc_copy (g_currentloc);
5245 addColumn (cstring_length (ns));
5251 loc = fileloc_copy (g_currentloc);
5253 context_incLineno ();
5255 while ((nl = strchr ((nl + 1), '\n')) != NULL)
5257 context_incLineno ();
5263 res = exprNode_stringLiteral (ns, loc);
5273 llassert (*yytext != '\0');
5274 fchar = *(yytext + 1);
5275 if (fchar != '\\') return fchar;
5277 next = *(yytext + 2);
5281 case 'n': return '\n';
5282 case 't': return '\t';
5283 case '\"': return '\"';
5284 case '\'': return '\'';
5285 case '\\': return '\\';
5286 default: return '\0';
5291 double processFloat ()
5293 double ret = atof (yytext);
5304 llassert (yytext[0] == '0'
5305 && (yytext[1] == 'X' || yytext[1] == 'x'));
5307 while (yytext[index] != '\0') {
5309 char c = yytext[index];
5311 if (c >= '0' && c <= '9') {
5312 tval = (int) c - (int) '0';
5313 } else if (c >= 'A' && c <= 'F') {
5314 tval = (int) c - (int) 'A' + 10;
5315 } else if (c >= 'a' && c <= 'f') {
5316 tval = (int) c - (int) 'a' + 10;
5317 } else if (c == 'U' || c == 'L' || c == 'u' || c == 'l') {
5319 while (yytext[index] != '\0') {
5320 if (c == 'U' || c == 'L' || c == 'u' || c == 'l') {
5325 message ("Invalid character (%c) following specifier in hex constant: %s",
5326 c, cstring_fromChars (yytext)),
5336 message ("Invalid character (%c) in hex constant: %s",
5337 c, cstring_fromChars (yytext)),
5342 val = (val * 16) + tval;
5346 DPRINTF (("Hex constant: %s = %ld", yytext, val));
5351 long processOctal ()
5356 llassert (yytext[0] == '0' && yytext[1] != 'X' && yytext[1] != 'x');
5358 while (yytext[index] != '\0') {
5360 char c = yytext[index];
5362 if (c >= '0' && c <= '7') {
5363 tval = (int) c - (int) '0';
5367 message ("Invalid character (%c) in octal constant: %s",
5368 c, cstring_fromChars (yytext)),
5373 val = (val * 8) + tval;
5377 DPRINTF (("Octal constant: %s = %ld", yytext, val));
5384 return (atol (yytext));
5388 processSpec (int tok)
5390 size_t length = strlen (yytext);
5395 setTokLengthT (length);
5401 context_saveLocation ();
5402 setTokLengthT (length);
5403 return (processIdentifier (makeIdentifier (yytext)));