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 178
286 #define YY_END_OF_BUFFER 179
287 static yyconst short int yy_accept[519] =
289 0, 0, 179, 177, 157, 158, 145, 177, 3, 80,
290 151, 144, 177, 139, 140, 149, 148, 136, 147, 143,
291 150, 95, 95, 137, 133, 152, 138, 153, 156, 177,
292 141, 176, 142, 154, 80, 80, 80, 80, 80, 80,
293 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
294 80, 80, 80, 80, 80, 134, 155, 135, 146, 132,
295 0, 42, 0, 2, 80, 118, 174, 175, 127, 119,
296 0, 0, 116, 124, 114, 125, 115, 126, 0, 108,
297 1, 117, 111, 88, 0, 97, 96, 0, 95, 123,
298 129, 131, 130, 122, 0, 0, 0, 120, 80, 80,
300 80, 80, 80, 80, 80, 80, 9, 80, 80, 80,
301 80, 80, 80, 80, 13, 44, 80, 80, 80, 80,
302 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
303 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
304 80, 80, 80, 80, 121, 128, 0, 0, 2, 102,
305 4, 0, 106, 107, 108, 0, 109, 110, 90, 89,
306 0, 105, 98, 99, 99, 81, 113, 112, 164, 165,
307 162, 167, 172, 163, 173, 168, 171, 166, 169, 170,
308 0, 0, 80, 80, 80, 80, 80, 80, 80, 80,
309 80, 80, 80, 80, 80, 80, 80, 80, 80, 11,
311 80, 80, 27, 80, 80, 80, 80, 80, 80, 80,
312 80, 80, 80, 43, 80, 80, 80, 80, 80, 80,
313 74, 80, 80, 80, 80, 80, 80, 80, 80, 80,
314 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
315 80, 80, 0, 42, 0, 0, 108, 0, 106, 107,
316 0, 111, 91, 92, 92, 103, 104, 101, 100, 82,
317 84, 161, 0, 0, 80, 80, 39, 80, 6, 29,
318 80, 80, 80, 80, 80, 80, 10, 25, 80, 80,
319 80, 80, 12, 80, 80, 80, 51, 80, 31, 80,
320 80, 52, 80, 80, 68, 80, 80, 80, 80, 80,
322 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
323 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
324 26, 80, 80, 80, 0, 108, 94, 93, 83, 85,
325 85, 0, 160, 80, 80, 5, 80, 36, 80, 80,
326 80, 80, 80, 80, 80, 30, 80, 80, 80, 80,
327 80, 80, 80, 80, 80, 80, 69, 80, 80, 80,
328 80, 80, 80, 80, 32, 80, 80, 80, 80, 80,
329 80, 80, 80, 80, 80, 77, 24, 80, 80, 80,
330 80, 80, 18, 76, 87, 86, 159, 80, 80, 80,
331 80, 80, 80, 80, 28, 80, 38, 80, 21, 80,
333 54, 78, 80, 60, 80, 80, 80, 80, 80, 80,
334 80, 58, 80, 14, 75, 34, 15, 80, 41, 22,
335 17, 80, 80, 80, 80, 80, 72, 19, 20, 80,
336 37, 47, 64, 80, 80, 8, 80, 59, 80, 80,
337 80, 62, 53, 80, 80, 80, 45, 80, 80, 57,
338 80, 46, 61, 80, 23, 80, 80, 80, 80, 65,
339 7, 80, 73, 80, 80, 80, 70, 16, 80, 40,
340 80, 55, 80, 33, 35, 80, 71, 56, 80, 80,
341 80, 80, 67, 80, 80, 80, 80, 63, 80, 80,
342 80, 80, 80, 80, 80, 80, 48, 80, 80, 80,
344 66, 80, 80, 80, 79, 80, 80, 80, 80, 80,
345 80, 80, 80, 50, 80, 80, 49, 0
348 static yyconst int yy_ec[256] =
350 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
351 4, 4, 1, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 2, 5, 6, 7, 8, 9, 10, 11, 12,
354 13, 14, 15, 16, 17, 18, 19, 20, 21, 21,
355 21, 21, 21, 21, 21, 21, 21, 22, 23, 24,
356 25, 26, 27, 28, 29, 30, 31, 30, 32, 33,
357 34, 8, 8, 8, 35, 36, 37, 8, 8, 8,
358 38, 39, 40, 41, 42, 8, 43, 44, 8, 45,
359 46, 47, 48, 49, 50, 1, 51, 52, 53, 54,
361 55, 56, 57, 58, 59, 8, 60, 61, 62, 63,
362 64, 65, 8, 66, 67, 68, 69, 70, 71, 72,
363 73, 74, 75, 76, 77, 78, 1, 1, 1, 1,
364 1, 1, 1, 1, 1, 1, 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,
372 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,
380 static yyconst int yy_meta[79] =
382 1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
383 3, 1, 1, 1, 1, 1, 1, 1, 1, 4,
384 4, 1, 1, 1, 1, 1, 1, 1, 5, 5,
385 5, 5, 5, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 1, 1, 1, 1, 2,
387 5, 5, 5, 5, 5, 5, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 1, 1, 1, 1
392 static yyconst short int yy_base[526] =
394 0, 0, 669, 670, 670, 670, 643, 73, 0, 0,
395 55, 71, 620, 670, 670, 641, 67, 670, 68, 66,
396 74, 80, 85, 670, 670, 65, 640, 82, 670, 91,
397 670, 670, 670, 639, 613, 28, 596, 67, 40, 65,
398 72, 597, 88, 55, 596, 79, 101, 608, 603, 103,
399 90, 594, 51, 598, 596, 670, 113, 670, 670, 670,
400 133, 163, 651, 0, 0, 670, 670, 670, 670, 670,
401 100, 139, 670, 670, 670, 670, 670, 670, 635, 155,
402 670, 670, 162, 172, 164, 160, 142, 0, 204, 627,
403 670, 670, 670, 626, 245, 613, 613, 670, 595, 574,
405 578, 590, 577, 122, 580, 141, 573, 574, 571, 144,
406 578, 574, 571, 568, 0, 99, 572, 579, 572, 569,
407 560, 562, 568, 561, 571, 565, 557, 561, 557, 174,
408 566, 135, 158, 566, 154, 561, 557, 549, 552, 184,
409 566, 167, 556, 559, 670, 670, 242, 153, 0, 670,
410 670, 235, 670, 670, 251, 243, 670, 670, 233, 230,
411 241, 272, 165, 670, 234, 261, 670, 670, 670, 572,
412 670, 670, 670, 670, 670, 670, 670, 670, 670, 670,
413 573, 574, 546, 541, 544, 556, 551, 539, 551, 200,
414 552, 547, 549, 545, 537, 534, 542, 529, 544, 0,
416 530, 534, 537, 522, 525, 528, 531, 521, 523, 524,
417 529, 516, 509, 0, 526, 512, 526, 519, 246, 508,
418 0, 510, 509, 511, 518, 519, 503, 501, 501, 503,
419 512, 511, 507, 509, 499, 503, 494, 203, 506, 508,
420 497, 496, 271, 308, 553, 278, 296, 304, 670, 670,
421 306, 314, 254, 670, 277, 670, 670, 670, 670, 295,
422 279, 670, 527, 515, 490, 479, 0, 491, 0, 0,
423 490, 481, 489, 478, 483, 484, 0, 0, 477, 477,
424 487, 473, 0, 477, 482, 477, 0, 287, 0, 482,
425 467, 467, 468, 478, 0, 478, 472, 466, 462, 473,
427 458, 460, 470, 456, 468, 458, 462, 461, 466, 465,
428 451, 453, 461, 459, 457, 449, 454, 455, 443, 455,
429 0, 439, 451, 451, 323, 325, 670, 670, 294, 670,
430 305, 476, 670, 436, 437, 0, 293, 0, 438, 439,
431 445, 443, 442, 433, 432, 0, 439, 427, 431, 437,
432 435, 433, 427, 432, 416, 417, 0, 433, 414, 414,
433 425, 419, 416, 424, 0, 423, 420, 424, 421, 405,
434 414, 416, 401, 414, 415, 0, 0, 404, 412, 408,
435 403, 404, 0, 0, 670, 670, 670, 394, 406, 406,
436 395, 389, 389, 401, 0, 401, 403, 384, 0, 401,
438 0, 0, 395, 0, 389, 383, 393, 383, 385, 382,
439 389, 0, 382, 0, 0, 383, 0, 380, 0, 0,
440 0, 384, 378, 382, 377, 381, 0, 0, 0, 374,
441 0, 0, 367, 379, 377, 0, 368, 0, 369, 368,
442 367, 0, 0, 365, 360, 369, 0, 356, 357, 0,
443 359, 0, 0, 360, 0, 365, 365, 363, 349, 0,
444 0, 348, 0, 345, 334, 338, 0, 0, 339, 0,
445 325, 0, 331, 325, 0, 317, 0, 0, 309, 317,
446 325, 323, 0, 314, 317, 309, 322, 0, 315, 303,
447 316, 313, 299, 299, 307, 292, 0, 304, 303, 294,
449 0, 295, 278, 254, 0, 236, 250, 176, 186, 174,
450 151, 158, 128, 0, 48, 28, 0, 670, 386, 390,
451 394, 399, 403, 405, 410
454 static yyconst short int yy_def[526] =
456 518, 1, 518, 518, 518, 518, 518, 519, 520, 521,
457 518, 518, 522, 518, 518, 518, 518, 518, 518, 518,
458 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
459 518, 518, 518, 518, 521, 521, 521, 521, 521, 521,
460 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
461 521, 521, 521, 521, 521, 518, 518, 518, 518, 518,
462 519, 518, 519, 523, 521, 518, 518, 518, 518, 518,
463 522, 522, 518, 518, 518, 518, 518, 518, 518, 518,
464 518, 518, 518, 518, 518, 518, 518, 524, 518, 518,
465 518, 518, 518, 518, 518, 518, 518, 518, 521, 521,
467 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
468 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
469 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
470 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
471 521, 521, 521, 521, 518, 518, 518, 525, 523, 518,
472 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
473 518, 518, 518, 518, 518, 524, 518, 518, 518, 518,
474 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
475 518, 518, 521, 521, 521, 521, 521, 521, 521, 521,
476 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
478 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
479 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
480 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
481 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
482 521, 521, 525, 518, 525, 518, 518, 518, 518, 518,
483 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
484 518, 518, 518, 518, 521, 521, 521, 521, 521, 521,
485 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
486 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
487 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
489 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
490 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
491 521, 521, 521, 521, 518, 518, 518, 518, 518, 518,
492 518, 518, 518, 521, 521, 521, 521, 521, 521, 521,
493 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
494 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
495 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
496 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
497 521, 521, 521, 521, 518, 518, 518, 521, 521, 521,
498 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
500 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
501 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
502 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
503 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
504 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
505 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
506 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
507 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
508 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
509 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
511 521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
512 521, 521, 521, 521, 521, 521, 521, 0, 518, 518,
513 518, 518, 518, 518, 518
516 static yyconst short int yy_nxt[749] =
518 4, 5, 6, 5, 7, 8, 9, 10, 11, 12,
519 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
520 23, 24, 25, 26, 27, 28, 29, 30, 10, 10,
521 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
522 10, 10, 10, 10, 10, 31, 32, 33, 34, 35,
523 36, 37, 38, 39, 40, 41, 42, 10, 43, 44,
524 45, 10, 46, 47, 48, 49, 50, 51, 52, 53,
525 54, 10, 55, 10, 56, 57, 58, 59, 62, 66,
526 69, 74, 517, 79, 76, 80, 80, 81, 90, 91,
527 100, 75, 77, 78, 106, 70, 101, 83, 82, 84,
529 84, 141, 83, 107, 89, 89, 93, 94, 95, 118,
530 150, 85, 516, 119, 142, 86, 85, 103, 96, 63,
531 86, 87, 111, 88, 104, 108, 87, 109, 97, 67,
532 105, 68, 112, 121, 85, 113, 110, 145, 62, 85,
533 86, 518, 122, 115, 137, 86, 72, 123, 87, 71,
534 116, 88, 124, 87, 117, 138, 125, 131, 244, 202,
535 132, 133, 139, 126, 147, 147, 203, 134, 148, 127,
536 135, 128, 188, 136, 80, 80, 189, 165, 161, 63,
537 161, 155, 155, 162, 162, 222, 152, 153, 146, 83,
538 154, 84, 84, 156, 157, 163, 191, 158, 223, 245,
540 515, 164, 165, 85, 227, 192, 258, 159, 196, 152,
541 153, 197, 514, 160, 224, 154, 156, 157, 513, 228,
542 163, 83, 158, 89, 89, 239, 85, 240, 164, 217,
543 218, 225, 159, 258, 219, 85, 233, 234, 512, 86,
544 160, 220, 235, 147, 147, 87, 511, 148, 510, 246,
545 236, 246, 237, 319, 247, 247, 320, 251, 85, 251,
546 162, 162, 252, 252, 86, 255, 272, 273, 253, 259,
547 155, 155, 87, 169, 254, 170, 244, 171, 172, 173,
548 174, 175, 248, 249, 176, 177, 250, 178, 179, 180,
549 255, 162, 162, 253, 259, 327, 260, 247, 247, 300,
551 509, 254, 261, 508, 256, 248, 249, 257, 301, 147,
552 147, 250, 328, 148, 331, 247, 247, 245, 325, 507,
553 325, 260, 327, 326, 326, 252, 252, 256, 153, 261,
554 329, 154, 257, 252, 252, 385, 330, 328, 506, 331,
555 386, 350, 326, 326, 326, 326, 157, 390, 505, 158,
556 504, 153, 351, 503, 391, 329, 154, 249, 502, 501,
557 250, 500, 385, 330, 499, 386, 498, 497, 496, 157,
558 495, 494, 493, 492, 158, 491, 490, 489, 488, 487,
559 249, 486, 485, 484, 483, 250, 61, 61, 61, 61,
560 61, 64, 482, 481, 64, 65, 480, 65, 65, 71,
562 71, 479, 71, 71, 149, 478, 149, 149, 166, 166,
563 243, 243, 243, 243, 243, 477, 476, 475, 474, 473,
564 472, 471, 470, 469, 468, 467, 466, 465, 464, 463,
565 462, 461, 460, 459, 458, 457, 456, 455, 454, 453,
566 452, 451, 450, 449, 448, 447, 446, 445, 444, 443,
567 442, 441, 440, 439, 438, 437, 436, 435, 434, 433,
568 432, 431, 430, 429, 428, 427, 426, 425, 424, 423,
569 422, 421, 420, 419, 418, 417, 416, 415, 414, 413,
570 412, 411, 410, 409, 408, 407, 406, 405, 404, 403,
571 402, 401, 400, 399, 398, 397, 396, 395, 394, 393,
573 392, 389, 388, 387, 384, 383, 382, 381, 380, 379,
574 378, 377, 376, 375, 374, 373, 372, 371, 370, 369,
575 368, 367, 366, 365, 364, 363, 362, 361, 360, 359,
576 358, 357, 356, 355, 354, 353, 352, 349, 348, 347,
577 346, 345, 344, 343, 342, 341, 340, 339, 338, 337,
578 336, 335, 334, 333, 332, 518, 324, 323, 322, 321,
579 318, 317, 316, 315, 314, 313, 312, 311, 310, 309,
580 308, 307, 306, 305, 304, 303, 302, 299, 298, 297,
581 296, 295, 294, 293, 292, 291, 290, 289, 288, 287,
582 286, 285, 284, 283, 282, 281, 280, 279, 278, 277,
584 276, 275, 274, 271, 270, 269, 268, 267, 266, 265,
585 264, 263, 262, 242, 241, 238, 232, 231, 230, 229,
586 226, 221, 216, 215, 214, 213, 212, 211, 210, 209,
587 208, 207, 206, 205, 204, 201, 200, 199, 198, 195,
588 194, 193, 190, 187, 186, 185, 184, 183, 182, 181,
589 168, 167, 151, 518, 144, 143, 140, 130, 129, 120,
590 114, 102, 99, 98, 92, 73, 72, 60, 518, 3,
591 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
592 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
593 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
595 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
596 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
597 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
598 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
599 518, 518, 518, 518, 518, 518, 518, 518
602 static yyconst short int yy_chk[749] =
604 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
605 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
606 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
607 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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, 8, 11,
612 12, 17, 516, 20, 19, 20, 20, 21, 26, 26,
613 36, 17, 19, 19, 39, 12, 36, 22, 21, 22,
615 22, 53, 23, 39, 23, 23, 28, 28, 30, 44,
616 71, 22, 515, 44, 53, 22, 23, 38, 30, 8,
617 23, 22, 41, 22, 38, 40, 23, 40, 30, 11,
618 38, 11, 41, 46, 22, 41, 40, 57, 61, 23,
619 22, 72, 46, 43, 51, 23, 71, 46, 22, 72,
620 43, 22, 47, 23, 43, 51, 47, 50, 148, 116,
621 50, 50, 51, 47, 62, 62, 116, 50, 62, 47,
622 50, 47, 104, 50, 80, 80, 104, 87, 85, 61,
623 85, 83, 83, 85, 85, 132, 80, 80, 57, 84,
624 80, 84, 84, 83, 83, 86, 106, 83, 132, 148,
626 513, 86, 87, 84, 135, 106, 163, 84, 110, 80,
627 80, 110, 512, 84, 133, 80, 83, 83, 511, 135,
628 86, 89, 83, 89, 89, 142, 84, 142, 86, 130,
629 130, 133, 84, 163, 130, 89, 140, 140, 510, 89,
630 84, 130, 140, 147, 147, 89, 509, 147, 508, 152,
631 140, 152, 140, 238, 152, 152, 238, 156, 89, 156,
632 161, 161, 156, 156, 89, 160, 190, 190, 159, 165,
633 155, 155, 89, 95, 159, 95, 243, 95, 95, 95,
634 95, 95, 155, 155, 95, 95, 155, 95, 95, 95,
635 160, 162, 162, 159, 165, 253, 166, 246, 246, 219,
637 507, 159, 166, 506, 162, 155, 155, 162, 219, 244,
638 244, 155, 255, 244, 261, 247, 247, 243, 248, 504,
639 248, 166, 253, 248, 248, 251, 251, 162, 247, 166,
640 260, 247, 162, 252, 252, 329, 260, 255, 503, 261,
641 331, 288, 325, 325, 326, 326, 252, 337, 502, 252,
642 500, 247, 288, 499, 337, 260, 247, 326, 498, 496,
643 326, 495, 329, 260, 494, 331, 493, 492, 491, 252,
644 490, 489, 487, 486, 252, 485, 484, 482, 481, 480,
645 326, 479, 476, 474, 473, 326, 519, 519, 519, 519,
646 519, 520, 471, 469, 520, 521, 466, 521, 521, 522,
648 522, 465, 522, 522, 523, 464, 523, 523, 524, 524,
649 525, 525, 525, 525, 525, 462, 459, 458, 457, 456,
650 454, 451, 449, 448, 446, 445, 444, 441, 440, 439,
651 437, 435, 434, 433, 430, 426, 425, 424, 423, 422,
652 418, 416, 413, 411, 410, 409, 408, 407, 406, 405,
653 403, 400, 398, 397, 396, 394, 393, 392, 391, 390,
654 389, 388, 382, 381, 380, 379, 378, 375, 374, 373,
655 372, 371, 370, 369, 368, 367, 366, 364, 363, 362,
656 361, 360, 359, 358, 356, 355, 354, 353, 352, 351,
657 350, 349, 348, 347, 345, 344, 343, 342, 341, 340,
659 339, 335, 334, 332, 324, 323, 322, 320, 319, 318,
660 317, 316, 315, 314, 313, 312, 311, 310, 309, 308,
661 307, 306, 305, 304, 303, 302, 301, 300, 299, 298,
662 297, 296, 294, 293, 292, 291, 290, 286, 285, 284,
663 282, 281, 280, 279, 276, 275, 274, 273, 272, 271,
664 268, 266, 265, 264, 263, 245, 242, 241, 240, 239,
665 237, 236, 235, 234, 233, 232, 231, 230, 229, 228,
666 227, 226, 225, 224, 223, 222, 220, 218, 217, 216,
667 215, 213, 212, 211, 210, 209, 208, 207, 206, 205,
668 204, 203, 202, 201, 199, 198, 197, 196, 195, 194,
670 193, 192, 191, 189, 188, 187, 186, 185, 184, 183,
671 182, 181, 170, 144, 143, 141, 139, 138, 137, 136,
672 134, 131, 129, 128, 127, 126, 125, 124, 123, 122,
673 121, 120, 119, 118, 117, 114, 113, 112, 111, 109,
674 108, 107, 105, 103, 102, 101, 100, 99, 97, 96,
675 94, 90, 79, 63, 55, 54, 52, 49, 48, 45,
676 42, 37, 35, 34, 27, 16, 13, 7, 3, 518,
677 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
678 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
679 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
681 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
682 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
683 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
684 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
685 518, 518, 518, 518, 518, 518, 518, 518
688 static yy_state_type yy_last_accepting_state;
689 static char *yy_last_accepting_cpos;
691 /* The intent behind this definition is that it'll catch
692 * any uses of REJECT which flex missed.
694 #define REJECT reject_used_but_not_detected
695 #define yymore() yymore_used_but_not_detected
696 #define YY_MORE_ADJ 0
697 #define YY_RESTORE_YY_MORE_OFFSET
702 ** Copyright (c) Massachusetts Institute of Technology 1994-1998.
703 ** All Rights Reserved.
704 ** Unpublished rights reserved under the copyright laws of
705 ** the United States.
707 ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
708 ** OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
710 ** This code is distributed freely and may be used freely under the
711 ** following conditions:
713 ** 1. This notice may not be removed or altered.
715 ** 2. Works derived from this code are not distributed for
716 ** commercial gain without explicit permission from MIT
717 ** (for permission contact lclint-request@sds.lcs.mit.edu).
720 * Modified by Herbert 08/19/97:
721 * - added #include for IBM's OS/2 compiler.
722 * - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only).
725 * Modified by Mike Smith
726 * Corrected missing 'line' in scanf() calls in handleSpecial().
727 * Without this, I get an error when LCLint hits a '#line' directive
728 * in the pre-pre-processed source files. For safety, I have made these
729 * conditional on OS2 and MSDOS because I don't understand why noone else
730 * has seen this problem.
732 * Modified by Mike Smith, 4th June 1997
733 * Finally resolved the #line problem. The scanf() calls have been fixed to
734 * allow the following #line forms:-
736 * #line 123 "filename"
741 * The last two are generated by the GNU pre-processor, apparently
743 #line 56 "cscanner.l"
745 ** based on original C lexer by Nate Osgood
746 ** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993
750 # include "lclintMacros.nf"
754 # include "sgrammar.h"
755 # include "sgrammar_tokens.h"
757 # include "cgrammar.h"
758 # 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, *yy_bp;
1025 register int yy_act;
1027 #line 190 "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 >= 519 )
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] != 670 );
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 192 "cscanner.l"
1116 { llfatalbug (cstring_makeLiteral ("Comment in pre-processor output")); }
1120 #line 194 "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 218 "cscanner.l"
1149 { if (handleSpecial (yytext))
1151 setTokLength (1); RETURN_TOK (0);
1157 #line 223 "cscanner.l"
1158 { setTokLength (3); RETURN_TOK (CTOK_ELIPSIS); }
1162 #line 224 "cscanner.l"
1163 { setTokLength (5); RETURN_TOK (BREAK); }
1167 #line 225 "cscanner.l"
1168 { setTokLength (4); RETURN_TOK (CASE); }
1172 #line 226 "cscanner.l"
1173 { setTokLength (8); RETURN_TOK (CONTINUE); }
1177 #line 227 "cscanner.l"
1178 { setTokLength (7); RETURN_TOK (DEFAULT); }
1182 #line 228 "cscanner.l"
1183 { setTokLength (2); RETURN_TOK (DO); }
1187 #line 229 "cscanner.l"
1188 { setTokLength (4); RETURN_TOK (CELSE); }
1192 #line 230 "cscanner.l"
1193 { setTokLength (3); RETURN_TOK (CFOR); }
1197 #line 231 "cscanner.l"
1198 { setTokLength (4); RETURN_TOK (GOTO); }
1202 #line 232 "cscanner.l"
1203 { setTokLength (2); RETURN_TOK (CIF); }
1207 #line 233 "cscanner.l"
1208 { setTokLength (6); RETURN_TOK (RETURN); }
1212 #line 234 "cscanner.l"
1213 { setTokLength (6); RETURN_TOK (CSIZEOF); }
1217 #line 235 "cscanner.l"
1218 { setTokLength (8); RETURN_TOK (COFFSETOF); }
1222 #line 236 "cscanner.l"
1223 { setTokLength (6); RETURN_TOK (SWITCH); }
1227 #line 237 "cscanner.l"
1228 { setTokLength (5); RETURN_TOK (WHILE); }
1232 #line 238 "cscanner.l"
1233 { setTokLength (6); RETURN_TOK (VA_ARG); }
1237 #line 239 "cscanner.l"
1238 { setTokLength (6); RETURN_TOK (VA_DCL); }
1242 #line 240 "cscanner.l"
1244 /* gcc extension...this might not be appropriate */
1245 setTokLength (6); RETURN_TOK (QINLINE); }
1249 #line 244 "cscanner.l"
1250 { setTokLength (6); RETURN_TOK (CSTRUCT); }
1254 #line 245 "cscanner.l"
1255 { setTokLength (7); RETURN_TOK (CTYPEDEF); }
1259 #line 247 "cscanner.l"
1260 { setTokLength (5); RETURN_TOK (CUNION); }
1264 #line 248 "cscanner.l"
1265 { setTokLength (4); RETURN_TOK (CENUM); }
1269 #line 250 "cscanner.l"
1270 { setTokLength (4); RETURN_TYPE (CVOID, ctype_void); }
1274 #line 251 "cscanner.l"
1275 { setTokLength (3); RETURN_TYPE (CINT, ctype_int); }
1279 #line 252 "cscanner.l"
1280 { setTokLength (6); RETURN_TYPE (CDOUBLE, ctype_double); }
1284 #line 253 "cscanner.l"
1285 { setTokLength (4); RETURN_TYPE (CGCHAR, ctype_char); }
1289 #line 254 "cscanner.l"
1290 { setTokLength (5); RETURN_TYPE (CGFLOAT, ctype_float); }
1294 #line 256 "cscanner.l"
1295 { setTokLength (4); RETURN_TOK (QLONG); }
1299 #line 257 "cscanner.l"
1300 { setTokLength (5); RETURN_TOK (QSHORT); }
1304 #line 258 "cscanner.l"
1305 { setTokLength (8); RETURN_TOK (QUNSIGNED); }
1309 #line 259 "cscanner.l"
1310 { setTokLength (6); RETURN_TOK (QSIGNED); }
1314 #line 261 "cscanner.l"
1315 { setTokLength (8); RETURN_TOK (QVOLATILE); }
1319 #line 262 "cscanner.l"
1320 { setTokLength (5); RETURN_TOK (QCONST); }
1322 /* some systems expect this! [gack!] */
1325 #line 265 "cscanner.l"
1326 { setTokLength (7); RETURN_TOK (QCONST); }
1330 #line 267 "cscanner.l"
1331 { setTokLength (6); RETURN_TOK (QEXTERN); }
1335 #line 268 "cscanner.l"
1336 { setTokLength (4); RETURN_TOK (QAUTO); }
1340 #line 269 "cscanner.l"
1341 { setTokLength (8); RETURN_TOK (QREGISTER); }
1345 #line 270 "cscanner.l"
1346 { setTokLength (6); RETURN_TOK (QSTATIC); }
1350 #line 272 "cscanner.l"
1351 { RETURN_EXPR (processString ()); }
1355 #line 273 "cscanner.l"
1356 { return (processSpec (QOUT)); }
1360 #line 274 "cscanner.l"
1361 { return (processSpec (QIN)); }
1365 #line 275 "cscanner.l"
1366 { return (processSpec (QPARTIAL)); }
1370 #line 276 "cscanner.l"
1371 { return (processSpec (QSPECIAL)); }
1375 #line 277 "cscanner.l"
1376 { return (processSpec (QANYTYPE)); }
1380 #line 278 "cscanner.l"
1381 { return (processSpec (QINTEGRALTYPE)); }
1385 #line 279 "cscanner.l"
1386 { return (processSpec (QUNSIGNEDINTEGRALTYPE)); }
1390 #line 280 "cscanner.l"
1391 { return (processSpec (QSIGNEDINTEGRALTYPE)); }
1395 #line 281 "cscanner.l"
1396 { return (processSpec (QKEEP)); }
1400 #line 282 "cscanner.l"
1401 { return (processSpec (QNULL)); }
1405 #line 283 "cscanner.l"
1406 { return (processSpec (QNOTNULL)); }
1410 #line 284 "cscanner.l"
1411 { return (processSpec (QISNULL)); }
1415 #line 285 "cscanner.l"
1416 { return (processSpec (QTRUENULL)); }
1420 #line 286 "cscanner.l"
1421 { return (processSpec (QFALSENULL)); }
1425 #line 287 "cscanner.l"
1426 { return (processSpec (QRELNULL)); }
1430 #line 288 "cscanner.l"
1431 { return (processSpec (QRELDEF)); }
1435 #line 289 "cscanner.l"
1436 { return (processSpec (QEXPOSED)); }
1440 #line 290 "cscanner.l"
1441 { return (processSpec (QNEWREF)); }
1445 #line 291 "cscanner.l"
1446 { return (processSpec (QTEMPREF)); }
1450 #line 292 "cscanner.l"
1451 { return (processSpec (QKILLREF)); }
1455 #line 293 "cscanner.l"
1456 { return (processSpec (QREFCOUNTED)); }
1460 #line 294 "cscanner.l"
1461 { return (processSpec (QCHECKED)); }
1465 #line 295 "cscanner.l"
1466 { return (processSpec (QCHECKMOD)); }
1470 #line 296 "cscanner.l"
1471 { return (processSpec (QCHECKEDSTRICT)); }
1475 #line 297 "cscanner.l"
1476 { return (processSpec (QUNCHECKED)); }
1480 #line 298 "cscanner.l"
1481 { return (processSpec (QONLY)); }
1485 #line 299 "cscanner.l"
1486 { return (processSpec (QOWNED)); }
1490 #line 300 "cscanner.l"
1491 { return (processSpec (QOBSERVER)); }
1495 #line 301 "cscanner.l"
1496 { return (processSpec (QDEPENDENT)); }
1500 #line 302 "cscanner.l"
1501 { return (processSpec (QUNUSED)); }
1505 #line 303 "cscanner.l"
1506 { return (processSpec (QEXTERNAL)); }
1510 #line 304 "cscanner.l"
1511 { return (processSpec (QSEF)); }
1515 #line 305 "cscanner.l"
1516 { return (processSpec (QSHARED)); }
1520 #line 306 "cscanner.l"
1521 { return (processSpec (QYIELD)); }
1525 #line 307 "cscanner.l"
1526 { return (processSpec (QUNDEF)); }
1530 #line 308 "cscanner.l"
1531 { return (processSpec (QKILLED)); }
1535 #line 309 "cscanner.l"
1536 { return (processSpec (QNULLTERMINATED));}
1540 #line 311 "cscanner.l"
1542 context_saveLocation ();
1543 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1544 tok = processIdentifier (makeIdentifier (yytext));
1553 #line 320 "cscanner.l"
1554 { setTokLengthT (mstring_length (yytext));
1555 RETURN_INT (ctype_int, processHex ()); /* evs 2000-05-17 was ctype_uint */
1560 #line 323 "cscanner.l"
1561 { setTokLengthT (mstring_length (yytext));
1562 RETURN_INT (ctype_lint, processHex ()); }
1566 #line 325 "cscanner.l"
1567 { setTokLengthT (mstring_length (yytext));
1568 RETURN_INT (ctype_llint, processHex ()); }
1572 #line 327 "cscanner.l"
1573 { setTokLengthT (mstring_length (yytext));
1574 RETURN_INT (ctype_uint, processHex ()); }
1578 #line 329 "cscanner.l"
1579 { setTokLengthT (mstring_length (yytext));
1580 RETURN_INT (ctype_ulint, processHex ()); }
1584 #line 331 "cscanner.l"
1585 { setTokLengthT (mstring_length (yytext));
1586 RETURN_INT (ctype_ullint, processHex ()); }
1590 #line 333 "cscanner.l"
1591 { setTokLengthT (mstring_length (yytext));
1592 RETURN_INT (ctype_ullint, processHex ()); }
1596 #line 335 "cscanner.l"
1597 { setTokLengthT (mstring_length (yytext));
1598 RETURN_INT (ctype_int, processOctal ()); }
1602 #line 337 "cscanner.l"
1603 { setTokLengthT (mstring_length (yytext));
1604 RETURN_INT (ctype_uint, processOctal ()); }
1608 #line 339 "cscanner.l"
1609 { setTokLengthT (mstring_length (yytext));
1610 RETURN_INT (ctype_lint, processOctal ()); }
1614 #line 341 "cscanner.l"
1615 { setTokLengthT (mstring_length (yytext));
1616 RETURN_INT (ctype_llint, processOctal ()); }
1620 #line 343 "cscanner.l"
1621 { setTokLengthT (mstring_length (yytext));
1622 RETURN_INT (ctype_ulint, processOctal ()); }
1626 #line 345 "cscanner.l"
1627 { setTokLengthT (mstring_length (yytext));
1628 RETURN_INT (ctype_ullint, processOctal ()); }
1632 #line 347 "cscanner.l"
1633 { setTokLengthT (mstring_length (yytext));
1634 RETURN_INT (ctype_ullint, processOctal ()); }
1638 #line 349 "cscanner.l"
1639 { setTokLengthT (mstring_length (yytext));
1640 RETURN_INT (ctype_int, processDec ()); }
1644 #line 351 "cscanner.l"
1645 { setTokLengthT (mstring_length (yytext));
1646 RETURN_INT (ctype_uint, processDec ()); }
1650 #line 353 "cscanner.l"
1651 { setTokLengthT (mstring_length (yytext));
1652 RETURN_INT (ctype_lint, processDec ()); }
1656 #line 355 "cscanner.l"
1657 { setTokLengthT (mstring_length (yytext));
1658 RETURN_INT (ctype_llint, processDec ()); }
1662 #line 357 "cscanner.l"
1663 { setTokLengthT (mstring_length (yytext));
1664 RETURN_INT (ctype_ulint, processDec ()); }
1668 #line 359 "cscanner.l"
1669 { setTokLengthT (mstring_length (yytext));
1670 RETURN_INT (ctype_ullint, processDec ()); }
1674 #line 361 "cscanner.l"
1675 { setTokLengthT (mstring_length (yytext));
1676 RETURN_INT (ctype_ullint, processDec ()); }
1680 #line 363 "cscanner.l"
1681 { setTokLengthT (mstring_length (yytext));
1682 RETURN_CHAR (processChar ()); }
1686 #line 365 "cscanner.l"
1687 { setTokLengthT (mstring_length (yytext));
1688 RETURN_FLOAT (ctype_float, processFloat ()); }
1692 #line 367 "cscanner.l"
1693 { setTokLengthT (mstring_length (yytext));
1694 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1698 #line 369 "cscanner.l"
1699 { setTokLengthT (mstring_length (yytext));
1700 RETURN_FLOAT (ctype_double, processFloat ()); }
1704 #line 372 "cscanner.l"
1705 { setTokLengthT (mstring_length (yytext));
1706 RETURN_FLOAT (ctype_float, processFloat ()); }
1710 #line 374 "cscanner.l"
1711 { setTokLengthT (mstring_length (yytext));
1712 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1716 #line 376 "cscanner.l"
1717 { setTokLengthT (mstring_length (yytext));
1718 RETURN_FLOAT (ctype_double, processFloat ()); }
1722 #line 379 "cscanner.l"
1723 { setTokLengthT (mstring_length (yytext));
1724 RETURN_FLOAT (ctype_float, processFloat ()); }
1728 #line 381 "cscanner.l"
1729 { setTokLengthT (mstring_length (yytext));
1730 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1734 #line 383 "cscanner.l"
1735 { setTokLengthT (mstring_length (yytext));
1736 RETURN_FLOAT (ctype_double, processFloat ()); }
1740 #line 386 "cscanner.l"
1741 { setTokLength (3); RETURN_TOK (RIGHT_ASSIGN); }
1745 #line 387 "cscanner.l"
1746 { setTokLength (3); RETURN_TOK (LEFT_ASSIGN); }
1750 #line 388 "cscanner.l"
1751 { setTokLength (2); RETURN_TOK (ADD_ASSIGN); }
1755 #line 389 "cscanner.l"
1756 { setTokLength (2); RETURN_TOK (SUB_ASSIGN); }
1760 #line 390 "cscanner.l"
1761 { setTokLength (2); RETURN_TOK (MUL_ASSIGN); }
1765 #line 391 "cscanner.l"
1766 { setTokLength (2); RETURN_TOK (DIV_ASSIGN); }
1770 #line 392 "cscanner.l"
1771 { setTokLength (2); RETURN_TOK (MOD_ASSIGN); }
1775 #line 393 "cscanner.l"
1776 { setTokLength (2); RETURN_TOK (AND_ASSIGN); }
1780 #line 394 "cscanner.l"
1781 { setTokLength (2); RETURN_TOK (XOR_ASSIGN); }
1785 #line 395 "cscanner.l"
1786 { setTokLength (2); RETURN_TOK (OR_ASSIGN); }
1790 #line 396 "cscanner.l"
1791 { setTokLength (2); RETURN_TOK (RIGHT_OP); }
1795 #line 397 "cscanner.l"
1796 { setTokLength (2); RETURN_TOK (LEFT_OP); }
1800 #line 398 "cscanner.l"
1801 { setTokLength (2); RETURN_TOK (INC_OP); }
1805 #line 399 "cscanner.l"
1806 { setTokLength (2); RETURN_TOK (DEC_OP); }
1810 #line 400 "cscanner.l"
1811 { setTokLength (2); RETURN_TOK (ARROW_OP); }
1815 #line 401 "cscanner.l"
1816 { setTokLength (2); RETURN_TOK (AND_OP); }
1820 #line 402 "cscanner.l"
1821 { setTokLength (2); RETURN_TOK (OR_OP); }
1825 #line 403 "cscanner.l"
1826 { setTokLength (2); RETURN_TOK (LE_OP); }
1830 #line 404 "cscanner.l"
1831 { setTokLength (2); RETURN_TOK (GE_OP); }
1835 #line 405 "cscanner.l"
1836 { setTokLength (2); RETURN_TOK (EQ_OP); }
1840 #line 406 "cscanner.l"
1841 { setTokLength (2); RETURN_TOK (NE_OP); }
1845 #line 407 "cscanner.l"
1846 { setTokLength (1); RETURN_TOK (TSEMI); }
1850 #line 408 "cscanner.l"
1851 { setTokLength (1); RETURN_TOK (TLBRACE); }
1855 #line 409 "cscanner.l"
1856 { setTokLength (1); RETURN_TOK (TRBRACE); }
1860 #line 410 "cscanner.l"
1861 { setTokLength (1); RETURN_TOK (TCOMMA); }
1865 #line 411 "cscanner.l"
1866 { setTokLength (1); RETURN_TOK (TCOLON); }
1870 #line 412 "cscanner.l"
1871 { setTokLength (1); RETURN_TOK (TASSIGN); }
1875 #line 413 "cscanner.l"
1876 { setTokLength (1); RETURN_TOK (TLPAREN); }
1880 #line 414 "cscanner.l"
1881 { setTokLength (1); RETURN_TOK (TRPAREN); }
1885 #line 415 "cscanner.l"
1886 { setTokLength (1); RETURN_TOK (TLSQBR); }
1890 #line 416 "cscanner.l"
1891 { setTokLength (1); RETURN_TOK (TRSQBR); }
1895 #line 417 "cscanner.l"
1896 { setTokLength (1); RETURN_TOK (TDOT); }
1900 #line 418 "cscanner.l"
1901 { setTokLength (1); RETURN_TOK (TAMPERSAND); }
1905 #line 419 "cscanner.l"
1906 { setTokLength (1); RETURN_TOK (TEXCL); }
1910 #line 422 "cscanner.l"
1911 { setTokLength (1); RETURN_TOK (TTILDE); }
1915 #line 423 "cscanner.l"
1916 { setTokLength (1); RETURN_TOK (TMINUS); }
1920 #line 424 "cscanner.l"
1921 { setTokLength (1); RETURN_TOK (TPLUS); }
1925 #line 425 "cscanner.l"
1926 { setTokLength (1); RETURN_TOK (TMULT); }
1930 #line 426 "cscanner.l"
1931 { setTokLength (1); RETURN_TOK (TDIV); }
1935 #line 427 "cscanner.l"
1936 { setTokLength (1); RETURN_TOK (TPERCENT); }
1940 #line 428 "cscanner.l"
1941 { setTokLength (1); RETURN_TOK (TLT); }
1945 #line 429 "cscanner.l"
1946 { setTokLength (1); RETURN_TOK (TGT); }
1950 #line 430 "cscanner.l"
1951 { setTokLength (1); RETURN_TOK (TCIRC); }
1955 #line 431 "cscanner.l"
1956 { setTokLength (1); RETURN_TOK (TBAR); }
1960 #line 432 "cscanner.l"
1961 { setTokLength (1); RETURN_TOK (TQUEST); }
1965 #line 434 "cscanner.l"
1970 #line 435 "cscanner.l"
1971 { context_incLineno ();
1974 continueLine = FALSE;
1978 if (context_inMacro ())
1980 /* Don't use RETURN_TOK */
1981 yylval.tok = lltok_create (TENDMACRO, g_currentloc);
1982 lastWasString = FALSE;
1990 #line 451 "cscanner.l"
1993 if (processMacro ()) {
1994 if (context_inIterDef ())
1996 RETURN_TOK (LLMACROITER);
1998 if (context_inIterEnd ())
2000 RETURN_TOK (LLMACROEND);
2002 if (context_inMacro ())
2004 RETURN_TOK (LLMACRO);
2011 #line 468 "cscanner.l"
2012 { if (context_inHeader () || context_inFunction ())
2018 int nspchar = ninput ();
2022 ** This is a hack to get the column number correct.
2025 llassert (nspchar >= '0' && nspchar <= '9');
2027 nspaces = nspchar - '0';
2029 setTokLength (5 + nspaces);
2031 if (processMacro ())
2033 if (context_inIterDef ())
2035 RETURN_TOK (LLMACROITER);
2037 if (context_inIterEnd ())
2039 RETURN_TOK (LLMACROEND);
2041 if (context_inMacro ())
2043 RETURN_TOK (LLMACRO);
2051 #line 504 "cscanner.l"
2052 { setTokLength (4); lldiagmsg (ctype_unparseTable ()); }
2056 #line 505 "cscanner.l"
2058 lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc)));
2063 #line 508 "cscanner.l"
2064 { setTokLength (3); usymtab_printLocal (); }
2068 #line 509 "cscanner.l"
2069 { setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); }
2073 #line 510 "cscanner.l"
2074 { setTokLength (3); lldiagmsg (context_unparse ()); }
2078 #line 511 "cscanner.l"
2079 { setTokLength (3); lldiagmsg (context_unparseClauses ()); }
2083 #line 512 "cscanner.l"
2084 { setTokLength (3); usymtab_printGuards (); }
2088 #line 513 "cscanner.l"
2089 { setTokLength (3); usymtab_printOut (); }
2093 #line 514 "cscanner.l"
2094 { setTokLength (3); usymtab_printAll (); }
2098 #line 515 "cscanner.l"
2099 { setTokLength (3); usymtab_printComplete (); }
2103 #line 516 "cscanner.l"
2104 { setTokLength (3); usymtab_printTypes (); }
2108 #line 517 "cscanner.l"
2109 { setTokLength (3); lldiagmsg (usymtab_unparseStack ()); }
2113 #line 518 "cscanner.l"
2115 lldiagmsg (message ("Can modify: %q",
2116 sRefSet_unparse (context_modList ())));
2121 #line 522 "cscanner.l"
2122 { /* BEFORE_COMMENT_MARKER */
2124 incColumn (); incColumn ();
2125 tok = handleLlSpecial ();
2134 #line 531 "cscanner.l"
2135 { /* AFTER_COMMENT_MARKER */
2138 RETURN_TOK (QENDMACRO); }
2142 #line 535 "cscanner.l"
2143 { incColumn (); continueLine = TRUE; }
2147 #line 536 "cscanner.l"
2151 message ("Invalid character (ascii: %d), skipping character",
2158 #line 543 "cscanner.l"
2161 #line 2162 "lex.yy.c"
2162 case YY_STATE_EOF(INITIAL):
2165 case YY_END_OF_BUFFER:
2167 /* Amount of text matched not including the EOB char. */
2168 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2170 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2171 *yy_cp = yy_hold_char;
2172 YY_RESTORE_YY_MORE_OFFSET
2174 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2176 /* We're scanning a new file or input source. It's
2177 * possible that this happened because the user
2178 * just pointed yyin at a new source and called
2179 * yylex(). If so, then we have to assure
2180 * consistency between yy_current_buffer and our
2181 * globals. Here is the right place to do so, because
2182 * this is the first action (other than possibly a
2183 * back-up) that will match for the new input source.
2185 yy_n_chars = yy_current_buffer->yy_n_chars;
2186 yy_current_buffer->yy_input_file = yyin;
2187 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2190 /* Note that here we test for yy_c_buf_p "<=" to the position
2191 * of the first EOB in the buffer, since yy_c_buf_p will
2192 * already have been incremented past the NUL character
2193 * (since all states make transitions on EOB to the
2194 * end-of-buffer state). Contrast this with the test
2197 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2198 { /* This was really a NUL. */
2199 yy_state_type yy_next_state;
2201 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2203 yy_current_state = yy_get_previous_state();
2205 /* Okay, we're now positioned to make the NUL
2206 * transition. We couldn't have
2207 * yy_get_previous_state() go ahead and do it
2208 * for us because it doesn't know how to deal
2209 * with the possibility of jamming (and we don't
2210 * want to build jamming into it because then it
2211 * will run more slowly).
2214 yy_next_state = yy_try_NUL_trans( yy_current_state );
2216 yy_bp = yytext_ptr + YY_MORE_ADJ;
2218 if ( yy_next_state )
2220 /* Consume the NUL. */
2221 yy_cp = ++yy_c_buf_p;
2222 yy_current_state = yy_next_state;
2229 goto yy_find_action;
2233 else switch ( yy_get_next_buffer() )
2235 case EOB_ACT_END_OF_FILE:
2237 yy_did_buffer_switch_on_eof = 0;
2241 /* Note: because we've taken care in
2242 * yy_get_next_buffer() to have set up
2243 * yytext, we can now set up
2244 * yy_c_buf_p so that if some total
2245 * hoser (like flex itself) wants to
2246 * call the scanner after we return the
2247 * YY_NULL, it'll still work - another
2248 * YY_NULL will get returned.
2250 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2252 yy_act = YY_STATE_EOF(YY_START);
2258 if ( ! yy_did_buffer_switch_on_eof )
2264 case EOB_ACT_CONTINUE_SCAN:
2266 yytext_ptr + yy_amount_of_matched_text;
2268 yy_current_state = yy_get_previous_state();
2271 yy_bp = yytext_ptr + YY_MORE_ADJ;
2274 case EOB_ACT_LAST_MATCH:
2276 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2278 yy_current_state = yy_get_previous_state();
2281 yy_bp = yytext_ptr + YY_MORE_ADJ;
2282 goto yy_find_action;
2289 "fatal flex scanner internal error--no action found" );
2290 } /* end of action switch */
2291 } /* end of scanning one token */
2292 } /* end of yylex */
2295 /* yy_get_next_buffer - try to read in a new buffer
2297 * Returns a code representing an action:
2298 * EOB_ACT_LAST_MATCH -
2299 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2300 * EOB_ACT_END_OF_FILE - end of file
2303 static int yy_get_next_buffer()
2305 register char *dest = yy_current_buffer->yy_ch_buf;
2306 register char *source = yytext_ptr;
2307 register int number_to_move, i;
2310 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2312 "fatal flex scanner internal error--end of buffer missed" );
2314 if ( yy_current_buffer->yy_fill_buffer == 0 )
2315 { /* Don't try to fill the buffer, so this is an EOF. */
2316 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2318 /* We matched a single character, the EOB, so
2319 * treat this as a final EOF.
2321 return EOB_ACT_END_OF_FILE;
2326 /* We matched some text prior to the EOB, first
2329 return EOB_ACT_LAST_MATCH;
2333 /* Try to read more data. */
2335 /* First move last chars to start of buffer. */
2336 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2338 for ( i = 0; i < number_to_move; ++i )
2339 *(dest++) = *(source++);
2341 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2342 /* don't do the read, it's not guaranteed to return an EOF,
2345 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2350 yy_current_buffer->yy_buf_size - number_to_move - 1;
2352 while ( num_to_read <= 0 )
2353 { /* Not enough room in the buffer - grow it. */
2354 #ifdef YY_USES_REJECT
2356 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2359 /* just a shorter name for the current buffer */
2360 YY_BUFFER_STATE b = yy_current_buffer;
2362 int yy_c_buf_p_offset =
2363 (int) (yy_c_buf_p - b->yy_ch_buf);
2365 if ( b->yy_is_our_buffer )
2367 int new_size = b->yy_buf_size * 2;
2369 if ( new_size <= 0 )
2370 b->yy_buf_size += b->yy_buf_size / 8;
2372 b->yy_buf_size *= 2;
2374 b->yy_ch_buf = (char *)
2375 /* Include room in for 2 EOB chars. */
2376 yy_flex_realloc( (void *) b->yy_ch_buf,
2377 b->yy_buf_size + 2 );
2380 /* Can't grow it, we don't own it. */
2383 if ( ! b->yy_ch_buf )
2385 "fatal error - scanner input buffer overflow" );
2387 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2389 num_to_read = yy_current_buffer->yy_buf_size -
2394 if ( num_to_read > YY_READ_BUF_SIZE )
2395 num_to_read = YY_READ_BUF_SIZE;
2397 /* Read in more data. */
2398 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2399 yy_n_chars, num_to_read );
2401 yy_current_buffer->yy_n_chars = yy_n_chars;
2404 if ( yy_n_chars == 0 )
2406 if ( number_to_move == YY_MORE_ADJ )
2408 ret_val = EOB_ACT_END_OF_FILE;
2414 ret_val = EOB_ACT_LAST_MATCH;
2415 yy_current_buffer->yy_buffer_status =
2416 YY_BUFFER_EOF_PENDING;
2421 ret_val = EOB_ACT_CONTINUE_SCAN;
2423 yy_n_chars += number_to_move;
2424 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2425 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2427 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2433 /* yy_get_previous_state - get the state just before the EOB char was reached */
2435 static yy_state_type yy_get_previous_state()
2437 register yy_state_type yy_current_state;
2438 register char *yy_cp;
2440 yy_current_state = yy_start;
2442 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2444 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2445 if ( yy_accept[yy_current_state] )
2447 yy_last_accepting_state = yy_current_state;
2448 yy_last_accepting_cpos = yy_cp;
2450 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2452 yy_current_state = (int) yy_def[yy_current_state];
2453 if ( yy_current_state >= 519 )
2454 yy_c = yy_meta[(unsigned int) yy_c];
2456 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2459 return yy_current_state;
2463 /* yy_try_NUL_trans - try to make a transition on the NUL character
2466 * next_state = yy_try_NUL_trans( current_state );
2469 #ifdef YY_USE_PROTOS
2470 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2472 static yy_state_type yy_try_NUL_trans( yy_current_state )
2473 yy_state_type yy_current_state;
2476 register int yy_is_jam;
2477 register char *yy_cp = yy_c_buf_p;
2479 register YY_CHAR yy_c = 1;
2480 if ( yy_accept[yy_current_state] )
2482 yy_last_accepting_state = yy_current_state;
2483 yy_last_accepting_cpos = yy_cp;
2485 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2487 yy_current_state = (int) yy_def[yy_current_state];
2488 if ( yy_current_state >= 519 )
2489 yy_c = yy_meta[(unsigned int) yy_c];
2491 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2492 yy_is_jam = (yy_current_state == 518);
2494 return yy_is_jam ? 0 : yy_current_state;
2499 #ifdef YY_USE_PROTOS
2500 static void yyunput( int c, register char *yy_bp )
2502 static void yyunput( c, yy_bp )
2504 register char *yy_bp;
2507 register char *yy_cp = yy_c_buf_p;
2509 /* undo effects of setting up yytext */
2510 *yy_cp = yy_hold_char;
2512 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2513 { /* need to shift things up to make room */
2514 /* +2 for EOB chars. */
2515 register int number_to_move = yy_n_chars + 2;
2516 register char *dest = &yy_current_buffer->yy_ch_buf[
2517 yy_current_buffer->yy_buf_size + 2];
2518 register char *source =
2519 &yy_current_buffer->yy_ch_buf[number_to_move];
2521 while ( source > yy_current_buffer->yy_ch_buf )
2522 *--dest = *--source;
2524 yy_cp += (int) (dest - source);
2525 yy_bp += (int) (dest - source);
2526 yy_current_buffer->yy_n_chars =
2527 yy_n_chars = yy_current_buffer->yy_buf_size;
2529 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2530 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2533 *--yy_cp = (char) c;
2537 yy_hold_char = *yy_cp;
2540 #endif /* ifndef YY_NO_UNPUT */
2544 static int yyinput()
2551 *yy_c_buf_p = yy_hold_char;
2553 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2555 /* yy_c_buf_p now points to the character we want to return.
2556 * If this occurs *before* the EOB characters, then it's a
2557 * valid NUL; if not, then we've hit the end of the buffer.
2559 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2560 /* This was really a NUL. */
2564 { /* need more input */
2565 int offset = yy_c_buf_p - yytext_ptr;
2568 switch ( yy_get_next_buffer() )
2570 case EOB_ACT_LAST_MATCH:
2571 /* This happens because yy_g_n_b()
2572 * sees that we've accumulated a
2573 * token and flags that we need to
2574 * try matching the token before
2575 * proceeding. But for input(),
2576 * there's no matching to consider.
2577 * So convert the EOB_ACT_LAST_MATCH
2578 * to EOB_ACT_END_OF_FILE.
2581 /* Reset buffer status. */
2586 case EOB_ACT_END_OF_FILE:
2591 if ( ! yy_did_buffer_switch_on_eof )
2600 case EOB_ACT_CONTINUE_SCAN:
2601 yy_c_buf_p = yytext_ptr + offset;
2607 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2608 *yy_c_buf_p = '\0'; /* preserve yytext */
2609 yy_hold_char = *++yy_c_buf_p;
2616 #ifdef YY_USE_PROTOS
2617 void yyrestart( FILE *input_file )
2619 void yyrestart( input_file )
2623 if ( ! yy_current_buffer )
2624 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2626 yy_init_buffer( yy_current_buffer, input_file );
2627 yy_load_buffer_state();
2631 #ifdef YY_USE_PROTOS
2632 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2634 void yy_switch_to_buffer( new_buffer )
2635 YY_BUFFER_STATE new_buffer;
2638 if ( yy_current_buffer == new_buffer )
2641 if ( yy_current_buffer )
2643 /* Flush out information for old buffer. */
2644 *yy_c_buf_p = yy_hold_char;
2645 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2646 yy_current_buffer->yy_n_chars = yy_n_chars;
2649 yy_current_buffer = new_buffer;
2650 yy_load_buffer_state();
2652 /* We don't actually know whether we did this switch during
2653 * EOF (yywrap()) processing, but the only time this flag
2654 * is looked at is after yywrap() is called, so it's safe
2655 * to go ahead and always set it.
2657 yy_did_buffer_switch_on_eof = 1;
2661 #ifdef YY_USE_PROTOS
2662 void yy_load_buffer_state( void )
2664 void yy_load_buffer_state()
2667 yy_n_chars = yy_current_buffer->yy_n_chars;
2668 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2669 yyin = yy_current_buffer->yy_input_file;
2670 yy_hold_char = *yy_c_buf_p;
2674 #ifdef YY_USE_PROTOS
2675 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2677 YY_BUFFER_STATE yy_create_buffer( file, size )
2684 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2686 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2688 b->yy_buf_size = size;
2690 /* yy_ch_buf has to be 2 characters longer than the size given because
2691 * we need to put in 2 end-of-buffer characters.
2693 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2694 if ( ! b->yy_ch_buf )
2695 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2697 b->yy_is_our_buffer = 1;
2699 yy_init_buffer( b, file );
2705 #ifdef YY_USE_PROTOS
2706 void yy_delete_buffer( YY_BUFFER_STATE b )
2708 void yy_delete_buffer( b )
2715 if ( b == yy_current_buffer )
2716 yy_current_buffer = (YY_BUFFER_STATE) 0;
2718 if ( b->yy_is_our_buffer )
2719 yy_flex_free( (void *) b->yy_ch_buf );
2721 yy_flex_free( (void *) b );
2725 #ifndef YY_ALWAYS_INTERACTIVE
2726 #ifndef YY_NEVER_INTERACTIVE
2727 extern int isatty YY_PROTO(( int ));
2731 #ifdef YY_USE_PROTOS
2732 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2734 void yy_init_buffer( b, file )
2741 yy_flush_buffer( b );
2743 b->yy_input_file = file;
2744 b->yy_fill_buffer = 1;
2746 #if YY_ALWAYS_INTERACTIVE
2747 b->yy_is_interactive = 1;
2749 #if YY_NEVER_INTERACTIVE
2750 b->yy_is_interactive = 0;
2752 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2758 #ifdef YY_USE_PROTOS
2759 void yy_flush_buffer( YY_BUFFER_STATE b )
2761 void yy_flush_buffer( b )
2771 /* We always need two end-of-buffer characters. The first causes
2772 * a transition to the end-of-buffer state. The second causes
2773 * a jam in that state.
2775 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2776 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2778 b->yy_buf_pos = &b->yy_ch_buf[0];
2781 b->yy_buffer_status = YY_BUFFER_NEW;
2783 if ( b == yy_current_buffer )
2784 yy_load_buffer_state();
2788 #ifndef YY_NO_SCAN_BUFFER
2789 #ifdef YY_USE_PROTOS
2790 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2792 YY_BUFFER_STATE yy_scan_buffer( base, size )
2800 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2801 base[size-1] != YY_END_OF_BUFFER_CHAR )
2802 /* They forgot to leave room for the EOB's. */
2805 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2807 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2809 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2810 b->yy_buf_pos = b->yy_ch_buf = base;
2811 b->yy_is_our_buffer = 0;
2812 b->yy_input_file = 0;
2813 b->yy_n_chars = b->yy_buf_size;
2814 b->yy_is_interactive = 0;
2816 b->yy_fill_buffer = 0;
2817 b->yy_buffer_status = YY_BUFFER_NEW;
2819 yy_switch_to_buffer( b );
2826 #ifndef YY_NO_SCAN_STRING
2827 #ifdef YY_USE_PROTOS
2828 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2830 YY_BUFFER_STATE yy_scan_string( yy_str )
2831 yyconst char *yy_str;
2835 for ( len = 0; yy_str[len]; ++len )
2838 return yy_scan_bytes( yy_str, len );
2843 #ifndef YY_NO_SCAN_BYTES
2844 #ifdef YY_USE_PROTOS
2845 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2847 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2848 yyconst char *bytes;
2857 /* Get memory for full buffer, including space for trailing EOB's. */
2859 buf = (char *) yy_flex_alloc( n );
2861 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2863 for ( i = 0; i < len; ++i )
2866 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2868 b = yy_scan_buffer( buf, n );
2870 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2872 /* It's okay to grow etc. this buffer, and we should throw it
2873 * away when we're done.
2875 b->yy_is_our_buffer = 1;
2882 #ifndef YY_NO_PUSH_STATE
2883 #ifdef YY_USE_PROTOS
2884 static void yy_push_state( int new_state )
2886 static void yy_push_state( new_state )
2890 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2894 yy_start_stack_depth += YY_START_STACK_INCR;
2895 new_size = yy_start_stack_depth * sizeof( int );
2897 if ( ! yy_start_stack )
2898 yy_start_stack = (int *) yy_flex_alloc( new_size );
2901 yy_start_stack = (int *) yy_flex_realloc(
2902 (void *) yy_start_stack, new_size );
2904 if ( ! yy_start_stack )
2906 "out of memory expanding start-condition stack" );
2909 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2916 #ifndef YY_NO_POP_STATE
2917 static void yy_pop_state()
2919 if ( --yy_start_stack_ptr < 0 )
2920 YY_FATAL_ERROR( "start-condition stack underflow" );
2922 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2927 #ifndef YY_NO_TOP_STATE
2928 static int yy_top_state()
2930 return yy_start_stack[yy_start_stack_ptr - 1];
2934 #ifndef YY_EXIT_FAILURE
2935 #define YY_EXIT_FAILURE 2
2938 #ifdef YY_USE_PROTOS
2939 static void yy_fatal_error( yyconst char msg[] )
2941 static void yy_fatal_error( msg )
2945 (void) fprintf( stderr, "%s\n", msg );
2946 exit( YY_EXIT_FAILURE );
2951 /* Redefine yyless() so it works in section 3 code. */
2957 /* Undo effects of setting up yytext. */ \
2958 yytext[yyleng] = yy_hold_char; \
2959 yy_c_buf_p = yytext + n; \
2960 yy_hold_char = *yy_c_buf_p; \
2961 *yy_c_buf_p = '\0'; \
2967 /* Internal utility routines. */
2970 #ifdef YY_USE_PROTOS
2971 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2973 static void yy_flex_strncpy( s1, s2, n )
2980 for ( i = 0; i < n; ++i )
2985 #ifdef YY_NEED_STRLEN
2986 #ifdef YY_USE_PROTOS
2987 static int yy_flex_strlen( yyconst char *s )
2989 static int yy_flex_strlen( s )
2994 for ( n = 0; s[n]; ++n )
3002 #ifdef YY_USE_PROTOS
3003 static void *yy_flex_alloc( yy_size_t size )
3005 static void *yy_flex_alloc( size )
3009 return (void *) malloc( size );
3012 #ifdef YY_USE_PROTOS
3013 static void *yy_flex_realloc( void *ptr, yy_size_t size )
3015 static void *yy_flex_realloc( ptr, size )
3020 /* The cast to (char *) in the following accommodates both
3021 * implementations that use char* generic pointers, and those
3022 * that use void* generic pointers. It works with the latter
3023 * because both ANSI C and C++ allow castless assignment from
3024 * any pointer type to void*, and deal with argument conversions
3025 * as though doing an assignment.
3027 return (void *) realloc( (char *) ptr, size );
3030 #ifdef YY_USE_PROTOS
3031 static void yy_flex_free( void *ptr )
3033 static void yy_flex_free( ptr )
3047 #line 543 "cscanner.l"
3052 /*@null@*/ /*@observer@*/ char *name;
3057 ** These tokens are followed by syntax that is parsed by the
3061 struct skeyword s_parsetable[] = {
3062 { "modifies", QMODIFIES } ,
3063 { "globals", QGLOBALS } ,
3065 { "constant", QCONSTANT } ,
3066 { "function", QFUNCTION } ,
3068 { "defines", QDEFINES } ,
3070 { "allocates", QALLOCATES } ,
3072 { "releases", QRELEASES } ,
3073 { "pre", QPRECLAUSE } ,
3074 { "post", QPOSTCLAUSE } ,
3075 {"setBufferSize", QSETBUFFERSIZE},
3076 {"setStringLength", QSETSTRINGLENGTH},
3081 ** These tokens are either stand-alone tokens, or followed by
3082 ** token-specific text.
3085 struct skeyword s_keytable[] = {
3086 { "anytype", QANYTYPE } ,
3087 { "integraltype", QINTEGRALTYPE } ,
3088 { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } ,
3089 { "signedintegraltype", QSIGNEDINTEGRALTYPE } ,
3093 { "owned", QOWNED } ,
3094 { "dependent", QDEPENDENT } ,
3095 { "partial", QPARTIAL } ,
3096 { "special", QSPECIAL } ,
3097 { "truenull", QTRUENULL } ,
3098 { "falsenull", QFALSENULL } ,
3101 { "notnull", QNOTNULL } ,
3102 { "abstract", QABSTRACT } ,
3103 { "concrete", QCONCRETE } ,
3104 { "mutable", QMUTABLE } ,
3105 { "immutable", QIMMUTABLE } ,
3106 { "unused", QUNUSED } ,
3107 { "external", QEXTERNAL } ,
3109 { "unique", QUNIQUE } ,
3110 { "returned", QRETURNED } ,
3111 { "exposed", QEXPOSED } ,
3112 { "refcounted", QREFCOUNTED } ,
3114 { "newref", QNEWREF } ,
3115 { "tempref", QTEMPREF } ,
3116 { "killref", QKILLREF } ,
3118 { "relnull", QRELNULL } ,
3119 { "nullterminated", QNULLTERMINATED },
3120 { "setBufferSize", QSETBUFFERSIZE },
3121 { "reldef", QRELDEF } ,
3122 { "observer", QOBSERVER } ,
3123 { "exits", QEXITS } ,
3124 { "mayexit", QMAYEXIT } ,
3125 { "trueexit", QTRUEEXIT } ,
3126 { "falseexit", QFALSEEXIT } ,
3127 { "neverexit", QNEVEREXIT } ,
3129 { "shared", QSHARED } ,
3131 { "unchecked", QUNCHECKED } ,
3132 { "checked", QCHECKED } ,
3133 { "checkmod", QCHECKMOD } ,
3134 { "checkedstrict", QCHECKEDSTRICT } ,
3135 { "innercontinue", QINNERCONTINUE } ,
3136 { "innerbreak", QINNERBREAK } ,
3137 { "loopbreak", QLOOPBREAK } ,
3138 { "switchbreak", QSWITCHBREAK } ,
3139 { "safebreak", QSAFEBREAK } ,
3140 { "fallthrough", QFALLTHROUGH } ,
3141 { "l_fallthrou", QLINTFALLTHROUGH } ,
3142 { "l_fallth", QLINTFALLTHRU } ,
3143 { "notreached", QNOTREACHED } ,
3144 { "l_notreach", QLINTNOTREACHED } ,
3145 { "printflike", QPRINTFLIKE } ,
3146 { "l_printfli", QLINTPRINTFLIKE } ,
3147 { "scanflike", QSCANFLIKE } ,
3148 { "messagelike", QMESSAGELIKE } ,
3149 { "l_argsus", QARGSUSED } ,
3154 ** would be better if these weren't hard coded...
3157 static bool isArtificial (cstring s)
3159 return (cstring_equalLit (s, "modifies")
3160 || cstring_equalLit (s, "globals")
3161 || cstring_equalLit (s, "alt"));
3164 void swallowMacro (void)
3167 bool skipnext = FALSE;
3169 while ((i = lminput ()) != EOF)
3186 checkUngetc (i, yyin);
3194 checkUngetc (i, yyin);
3198 static int commentMarkerToken (cstring s)
3202 while (s_parsetable[i].name != NULL)
3204 if (cstring_equalLit (s, s_parsetable[i].name))
3206 return s_parsetable[i].token;
3215 static int tokenMacroCode (cstring s)
3219 while (s_keytable[i].name != NULL)
3221 if (cstring_equalLit (s, s_keytable[i].name))
3223 if (s_keytable[i].token == QLINTFALLTHROUGH)
3226 (FLG_WARNLINTCOMMENTS,
3228 ("Traditional lint comment /*FALLTHROUGH*/ used. "
3229 "This is interpreted by "
3230 "LCLint in the same way as most Unix lints, but it is "
3231 "preferable to replace it with the /*@fallthrough@*/ "
3232 "stylized comment"),
3234 return QFALLTHROUGH;
3236 else if (s_keytable[i].token == QLINTFALLTHRU)
3239 (FLG_WARNLINTCOMMENTS,
3241 ("Traditional lint comment /*FALLTHRU*/ used. "
3242 "This is interpreted by "
3243 "LCLint in the same way as most Unix lints, but it is "
3244 "preferable to replace it with the /*@fallthrough@*/ "
3245 "stylized comment"),
3247 return QFALLTHROUGH;
3249 else if (s_keytable[i].token == QLINTNOTREACHED)
3252 (FLG_WARNLINTCOMMENTS,
3254 ("Traditional lint comment /*NOTREACHED*/ used. "
3255 "This is interpreted by "
3256 "LCLint in the same way as most Unix lints, but it is "
3257 "preferable to replace it with the /*@notreached@*/ "
3258 "stylized comment."),
3263 else if (s_keytable[i].token == QPRINTFLIKE)
3265 setSpecialFunction (QU_PRINTFLIKE);
3268 else if (s_keytable[i].token == QLINTPRINTFLIKE)
3271 (FLG_WARNLINTCOMMENTS,
3273 ("Traditional lint comment /*PRINTFLIKE*/ used. "
3274 "This is interpreted by "
3275 "LCLint in the same way as most Unix lints, but it is "
3276 "preferable to replace it with either /*@printflike@*/, "
3277 "/*@scanflike@*/ or /*@messagelike@*/."),
3280 setSpecialFunction (QU_PRINTFLIKE);
3283 else if (s_keytable[i].token == QSCANFLIKE)
3285 setSpecialFunction (QU_SCANFLIKE);
3288 else if (s_keytable[i].token == QMESSAGELIKE)
3290 setSpecialFunction (QU_MESSAGELIKE);
3293 else if (s_keytable[i].token == QARGSUSED)
3296 (FLG_WARNLINTCOMMENTS,
3298 ("Traditional lint comment /*ARGSUSED*/ used. "
3299 "This is interpreted by "
3300 "LCLint in the same way as most Unix lints, but it is "
3301 "preferable to use /*@unused@*/ annotations on "
3302 "the unused parameters."),
3309 return s_keytable[i].token;
3318 static int lminput ()
3320 if (savechar == '\0')
3327 int save = (int) savechar;
3333 static void lmsavechar (char c)
3335 if (savechar == '\0') savechar = c;
3338 llbuglit ("lmsavechar: override");
3342 static int returnFloat (ctype ct, double f)
3344 yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext),
3345 fileloc_decColumn (g_currentloc, tokLength));
3350 static int returnInt (ctype ct, long i)
3354 if (ctype_equal (ct, ctype_int))
3358 c = context_typeofZero ();
3362 c = context_typeofOne ();
3366 yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext),
3367 fileloc_decColumn (g_currentloc, tokLength), i);
3372 static int returnChar (char c)
3374 yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext),
3375 fileloc_decColumn (g_currentloc, tokLength));
3380 static int ninput ()
3384 if (c != EOF && ((char)c == '\n'))
3386 context_incLineno ();
3392 static char macro_nextChar ()
3394 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3399 c = char_fromInt (ic);
3401 if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0]))
3405 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3407 ; /* skip to newline */
3410 context_incLineno ();
3414 return macro_nextChar ();
3421 else /* if (c == '@') */
3423 if (handleLlSpecial () != BADTOK)
3425 llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax");
3428 return macro_nextChar ();
3431 else if (!in_escape && c == '\"')
3433 in_quote = !in_quote;
3435 else if (!in_escape && c == '\'')
3439 else if ((in_quote || in_char) && c == '\\')
3441 in_escape = !in_escape;
3443 else if ((in_quote || in_char) && in_escape)
3447 else if (!in_quote && c == '/')
3451 if ((c2 = char_fromInt (lminput ())) == '*')
3455 while ((c2 = char_fromInt (lminput ())) != '\0'
3456 && c2 != '\n' && c2 != '*')
3463 while ((c2 = char_fromInt (lminput ())) != '\0'
3476 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3480 return macro_nextChar ();
3484 /*** putchar does not work! why? puts to stdio...??! ***/
3492 ** keeps stylized comments
3495 static char macro_nextCharC ()
3497 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3500 c = char_fromInt (lminput ());
3502 if (!in_quote && !in_char && c == '\\')
3504 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3506 ; /* skip to newline */
3509 context_incLineno ();
3513 return macro_nextCharC ();
3520 else if (!in_escape && c == '\"')
3522 in_quote = !in_quote;
3524 else if (!in_escape && c == '\'')
3528 else if ((in_quote || in_char) && c == '\\')
3530 in_escape = !in_escape;
3532 else if ((in_quote || in_char) && in_escape)
3536 else if (!in_quote && c == '/')
3540 if ((c2 = char_fromInt (lminput ())) == '*')
3544 while ((c2 = char_fromInt (lminput ())) != '\0'
3545 && c2 != '\n' && c2 != '*')
3552 while ((c2 = char_fromInt (lminput ())) != '\0'
3565 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3569 return macro_nextCharC ();
3580 ** skips whitespace (handles line continuations)
3581 ** returns first non-whitespace character
3584 static char skip_whitespace ()
3588 while ((c = macro_nextChar ()) == ' ' || c == '\t')
3596 static void handleMacro ()
3598 cstring mac = cstring_undefined;
3602 while (currentColumn () > 2)
3604 mac = cstring_appendChar (mac, ' ');
3608 c = macro_nextCharC ();
3610 if (c >= '0' && c <= '9')
3614 for (i = 0; i < ((c - '0') + 1); i++)
3616 mac = cstring_appendChar (mac, ' ');
3624 while (((c = macro_nextCharC ()) != '\0') && (c != '\n'))
3626 mac = cstring_appendChar (mac, c);
3630 macrocode = tokenMacroCode (mac);
3632 if (macrocode == BADTOK && !isArtificial (mac))
3634 DPRINTF (("Add macro: %s", mac));
3635 context_addMacroCache (mac);
3644 context_incLineno ();
3648 static bool processMacro (void)
3653 cstring fname = cstring_undefined;
3655 bool isspecfcn = FALSE;
3656 bool isiter = FALSE;
3657 bool skipparam = FALSE;
3658 bool isenditer = FALSE;
3659 bool unknownm = FALSE;
3660 bool hasParams = FALSE;
3661 bool emptyMacro = FALSE;
3662 char c = skip_whitespace ();
3663 fileloc loc = fileloc_noColumn (g_currentloc);
3665 /* are both of these necessary? what do they mean? */
3666 uentryList specparams = uentryList_undefined;
3667 uentryList pn = uentryList_undefined;
3669 context_resetMacroMissingParams ();
3671 if (c == '\0' || c == '\n')
3673 llcontbug (cstring_makeLiteral ("Bad macro"));
3678 fname = cstring_appendChar (fname, c);
3680 while ((c = macro_nextChar ()) != '(' && c != '\0'
3681 && c != ' ' && c != '\t' && c != '\n')
3683 fname = cstring_appendChar (fname, c);
3686 if (c == ' ' || c == '\t' || c == '\n')
3692 while (c == ' ' || c == '\t')
3694 c = macro_nextChar ();
3708 hasParams = (c == '(');
3711 if (usymtab_exists (fname))
3713 e2 = usymtab_lookupExpose (fname);
3714 ct = uentry_getType (e2);
3717 if (uentry_isCodeDefined (e2)
3718 && fileloc_isUser (uentry_whereDefined (e2)))
3722 message ("Macro %s already defined", fname),
3725 uentry_showWhereDefined (e2);
3726 uentry_clearDefined (e2);
3729 if (uentry_isFunction (e2))
3731 uentry_setType (e2, ctype_unknown);
3734 context_enterUnknownMacro (e2);
3738 context_enterConstantMacro (e2);
3743 if (uentry_isForward (e2) && uentry_isFunction (e2))
3750 ("Parameterized macro has no prototype or specification: %s ",
3755 uentry_setType (e2, ctype_unknown);
3756 uentry_setFunctionDefined (e2, loc);
3757 uentry_setUsed (e2, fileloc_undefined);
3758 context_enterUnknownMacro (e2);
3762 if (uentry_isIter (e2))
3765 specparams = uentry_getParams (e2);
3766 noparams = uentryList_size (specparams);
3767 uentry_setDefined (e2, loc);
3768 context_enterIterDef (e2);
3770 else if (uentry_isEndIter (e2))
3773 uentry_setDefined (e2, loc);
3774 context_enterIterEnd (e2); /* don't care about it now */
3775 /* but should parse like an iter! */
3777 else if (uentry_isConstant (e2))
3783 message ("Constant %s implemented as parameterized macro",
3787 uentry_showWhereSpecified (e2);
3788 uentry_setType (e2, ctype_unknown);
3789 uentry_makeVarFunction (e2);
3790 uentry_setDefined (e2, g_currentloc);
3791 uentry_setFunctionDefined (e2, g_currentloc);
3792 context_enterUnknownMacro (e2);
3796 if (!uentry_isSpecified (e2))
3798 fileloc oloc = uentry_whereDeclared (e2);
3800 if (fileloc_isLib (oloc))
3804 else if (fileloc_isUndefined (oloc)
3805 || fileloc_isPreproc (oloc))
3810 (FLG_MACROCONSTDECL,
3812 ("Macro constant %q not declared",
3813 uentry_getName (e2)),
3817 else if (!fileloc_withinLines (oloc, loc, 2))
3818 { /* bogus! will give errors if there is too much whitespace */
3822 ("Macro constant name %s does not match name in "
3823 "previous constant declaration. This constant "
3824 "is declared at %q", fname,
3825 fileloc_unparse (oloc)),
3830 context_enterConstantMacro (e2);
3831 cstring_free (fname);
3837 else if (ctype_isFunction (ct))
3840 specparams = ctype_argsFunction (ct);
3841 noparams = uentryList_size (specparams);
3843 uentry_setFunctionDefined (e2, loc);
3844 context_enterMacro (e2);
3846 else if (uentry_isVar (e2))
3852 message ("Variable %s implemented as parameterized macro",
3856 uentry_showWhereSpecified (e2);
3857 uentry_setType (e2, ctype_unknown);
3858 uentry_makeVarFunction (e2);
3859 uentry_setDefined (e2, g_currentloc);
3860 uentry_setFunctionDefined (e2, g_currentloc);
3861 context_enterUnknownMacro (e2);
3865 uentry ucons = uentry_makeConstant (fname,
3868 if (uentry_isExpandedMacro (e2))
3876 message ("Variable %s implemented by a macro",
3880 uentry_showWhereSpecified (e2);
3884 uentry_setDefined (e2, loc);
3885 uentry_setUsed (ucons, loc);
3887 context_enterConstantMacro (ucons);
3888 uentry_markOwned (ucons);
3889 cstring_free (fname);
3895 if (uentry_isDatatype (e2))
3899 message ("Type implemented as macro: %x",
3900 uentry_getName (e2)),
3901 message ("A type is implemented using a macro definition. A "
3902 "typedef should be used instead."),
3906 /* Must exit scope (not sure why a new scope was entered?) */
3907 usymtab_quietExitScope (g_currentloc);
3908 uentry_setDefined (e2, g_currentloc);
3914 (message ("Unexpanded macro not function or constant: %q",
3915 uentry_unparse (e2)));
3916 uentry_setType (e2, ctype_unknown);
3920 uentry_makeVarFunction (e2);
3921 uentry_setDefined (e2, g_currentloc);
3922 uentry_setFunctionDefined (e2, g_currentloc);
3923 context_enterUnknownMacro (e2);
3935 (FLG_MACROMATCHNAME,
3936 message ("Unexpanded macro %s does not match name of a constant "
3937 "or iter declaration. The name used in the control "
3938 "comment on the previous line should match. "
3939 "(Assuming macro defines a constant.)",
3944 ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined);
3945 uentry_setUsed (ce, loc); /* perhaps bogus? */
3946 e2 = usymtab_supEntryReturn (ce);
3948 context_enterConstantMacro (e2);
3949 cstring_free (fname);
3954 /* in macros, ( must follow immediatetly after name */
3960 c = skip_whitespace ();
3962 while (c != ')' && c != '\0')
3965 bool suppress = context_inSuppressRegion ();
3966 cstring paramname = cstring_undefined;
3969 ** save the parameter location
3973 context_saveLocation ();
3976 while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')')
3978 paramname = cstring_appendChar (paramname, c);
3979 c = macro_nextChar ();
3982 if (c == ' ' || c == '\t') c = skip_whitespace ();
3986 c = macro_nextChar ();
3987 if (c == ' ' || c == '\t') c = skip_whitespace ();
3992 llfatalerror (cstring_makeLiteral
3993 ("Bad macro syntax: uentryList"));
3996 if ((isspecfcn || isiter) && (paramno < noparams)
3997 && !uentry_isElipsisMarker (uentryList_getN
3998 (specparams, paramno)))
4000 uentry decl = uentryList_getN (specparams, paramno);
4003 param = uentry_nameCopy (paramname, decl);
4006 uentry_setParam (param);
4007 sr = sRef_makeParam (paramno, uentry_getType (param));
4009 if (sRef_getNullState (sr) == NS_ABSNULL)
4011 ctype pt = ctype_realType (uentry_getType (param));
4013 if (ctype_isUser (pt))
4015 uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt));
4017 if (uentry_isValid (te))
4019 sRef_setStateFromUentry (sr, te);
4024 sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
4028 uentry_setSref (param, sr);
4029 uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
4031 skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
4035 fileloc sloc = context_getSaveLocation ();
4037 param = uentry_makeVariableSrefParam
4038 (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
4039 cstring_free (paramname);
4041 sRef_setPosNull (uentry_getSref (param), sloc);
4043 uentry_setDeclaredForce (param, sloc);
4046 fileloc_free (sloc);
4051 llassert (!uentry_isElipsisMarker (param));
4055 sRef_makeUnsafe (uentry_getSref (param));
4058 pn = uentryList_add (pn, uentry_copy (param));
4059 usymtab_supEntry (param);
4063 /* don't add param */
4064 uentry_free (param);
4069 (void) macro_nextChar ();
4070 c = skip_whitespace ();
4078 if (isspecfcn || isiter)
4080 if (paramno != noparams && noparams >= 0)
4086 message ("Macro %s specified with %d args, defined with %d",
4087 fname, noparams, paramno),
4090 uentry_showWhereSpecified (e2);
4091 uentry_resetParams (e2, pn);
4096 uentry_resetParams (e2, pn);
4103 ** the form should be:
4105 ** # define newname oldname
4106 ** where oldname refers to a function matching the specification
4112 sRef_setGlobalScope ();
4113 usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown));
4114 sRef_clearGlobalScope ();
4118 context_setMacroMissingParams ();
4123 /* context_setuentryList (pn); */
4124 usymtab_enterScope ();
4127 cstring_free (fname);
4132 static bool handleSpecial (char *yyt)
4134 char *l = mstring_create (MAX_NAME_LENGTH);
4135 static bool reportcpp = FALSE;
4141 strcpy (l, yyt + 1);
4143 /* Need to safe original l for deallocating. */
4146 l += strlen (yyt) - 1;
4148 while ((c = char_fromInt (lminput ())) != '\n' && c != '\0')
4154 olc = cstring_fromChars (ol);
4156 if (cstring_equalPrefix (olc, "pragma"))
4158 char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN));
4159 char *opname = pname;
4160 char *ptr = ol + 6; /* pragma is six characters, plus space */
4164 /* skip whitespace */
4165 while (((c = *ptr) != '\0') && isspace (c))
4171 while (((c = *ptr) != '\0') && !isspace (c))
4175 if (len > MAX_PRAGMA_LEN)
4186 if (len == PRAGMA_LEN_EXPAND
4187 && mstring_equal (opname, PRAGMA_EXPAND))
4189 cstring exname = cstring_undefined;
4193 while (((c = *ptr) != '\0') && !isspace (c))
4195 exname = cstring_appendChar (exname, c);
4200 ue = usymtab_lookupExposeGlob (exname);
4202 if (uentry_isExpandedMacro (ue))
4204 if (fileloc_isPreproc (uentry_whereDefined (ue)))
4206 fileloc_setColumn (g_currentloc, 1);
4207 uentry_setDefined (ue, g_currentloc);
4211 cstring_free (exname);
4214 else if (cstring_equalPrefix (olc, "ident"))
4216 /* Some pre-processors will leave these in the code. Ignore rest of line */
4219 ** Yuk...Win32 filenames can have spaces in them...we need to read
4220 ** to the matching end quote.
4222 else if ((sscanf (ol, "line %d \"", &lineno) == 1)
4223 || (sscanf (ol, " %d \"", &lineno) == 1))
4229 while (*tmp != '\"' && *tmp != '\0')
4234 llassert (*tmp == '\"');
4239 while (*tmp != '\"' && *tmp != '\0')
4244 llassert (*tmp == '\"');
4248 DPRINTF (("fname: %s", fname));
4250 # if defined(OS2) || defined(MSDOS) || defined(WIN32)
4253 ** DOS-like path delimiters get delivered in pairs, something like
4254 ** \"..\\\\file.h\", so we have to make it normal again. We do NOT
4255 ** remove the pre dirs yet as we usually specify tmp paths relative
4256 ** to the current directory, so tmp files would not get found in
4257 ** the hash table. If this method fails we try it again later.
4264 ** Skip past the drive marker.
4267 DPRINTF (("stmp: %s / %s", stmp, fname));
4269 if (strchr (stmp, ':') != NULL)
4271 stmp = strchr (stmp, ':') + 1;
4274 DPRINTF (("stmp: %s / %s", stmp, fname));
4276 while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL )
4278 if (*(stmp+1) == CONNECTCHAR)
4280 memmove (stmp, stmp+1, strlen (stmp));
4284 DPRINTF (("stmp: %s / %s", stmp, fname));
4287 DPRINTF (("Now: base = %s", fname));
4289 fid = fileTable_lookupBase (context_fileTable (),
4290 cstring_fromChars (fname));
4291 if (!(fileId_isValid (fid)))
4293 fname = removePreDirs (fname);
4294 fid = fileTable_lookupBase (context_fileTable (),
4295 cstring_fromChars (fname));
4298 # else /* !defined(OS2) && !defined(MSDOS) */
4299 fname = removePreDirs (fname);
4300 fid = fileTable_lookupBase (context_fileTable (),
4301 cstring_fromChars (fname));
4302 # endif /* !defined(OS2) && !defined(MSDOS) */
4304 if (!(fileId_isValid (fid)))
4306 if (isHeaderFile (cstring_fromChars (fname)))
4308 fid = fileTable_addHeaderFile (context_fileTable (),
4309 cstring_fromChars (fname));
4313 fid = fileTable_addFile (context_fileTable (),
4314 cstring_fromChars (fname));
4318 setFileLine (fid, lineno);
4320 else if ((sscanf (ol, "line %d", &lineno) == 1)
4321 || (sscanf (ol, " %d", &lineno) == 1))
4323 setLine (lineno); /* next line is <cr> */
4327 if (mstring_equal (ol, "")) {
4328 DPRINTF (("Empty pp command!"));
4330 ** evs 2000-05-16: This is a horrible kludge, to get around a bug (well, difficulty) in the pre-processor.
4331 ** We handle a plain # in the input file, by echoing it, and ignoring it in the post-pp-file.
4340 llbug (message ("File contains preprocessor command: #%s",
4341 cstring_fromChars (ol)));
4354 static int handleLlSpecial ()
4358 char *s = mstring_createEmpty ();
4363 while (((ic = ninput ()) != 0) && isalpha (ic))
4366 s = mstring_append (s, c);
4372 if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0])
4376 llassert (ic == AFTER_COMMENT_MARKER[1]);
4379 if (isProcessingGlobMods () && (*s == '\0'))
4382 return QNOMODS; /* special token no modifications token */
4390 tok = commentMarkerToken (cstring_fromChars (os));
4394 tokLength = charsread;
4400 /* Add rest of the comment */
4402 if (ic != 0 && ic != EOF)
4407 s = mstring_append (s, c);
4410 while (((ic = ninput ()) != 0) && (ic != EOF)
4411 && (ic != AFTER_COMMENT_MARKER[0]))
4414 s = mstring_append (s, c);
4419 if (ic == AFTER_COMMENT_MARKER[0])
4422 llassert ((char) nc == AFTER_COMMENT_MARKER[1]);
4429 while (*s == ' ' || *s == '\t' || *s == '\n')
4434 if (*s == '-' || *s == '+' || *s == '=') /* setting flags */
4438 while (c == '-' || c == '+' || c == '=')
4440 ynm set = ynm_fromCodeChar (c);
4445 thisflag = cstring_fromChars (s);
4447 while ((c = *s) != '\0' && (c != '-') && (c != '=')
4448 && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n'))
4455 if (!context_getFlag (FLG_NOCOMMENTS))
4457 cstring flagname = thisflag;
4458 flagcode fflag = identifyFlag (flagname);
4460 if (flagcode_isSkip (fflag))
4464 else if (flagcode_isInvalid (fflag))
4466 if (isMode (flagname))
4468 if (ynm_isMaybe (set))
4473 ("Stylized comment attempts to restore flag %s. "
4474 "A mode flag cannot be restored.",
4479 context_setMode (flagname);
4486 message ("Unrecognized option in stylized comment: %s",
4490 else if (flagcode_isGlobalFlag (fflag))
4495 ("Stylized comment attempts to set global flag %s. "
4496 "A global flag cannot be set locally.",
4501 context_fileSetFlag (fflag, set);
4503 if (flagcode_hasArgument (fflag))
4505 if (ynm_isMaybe (set))
4510 ("Stylized comment attempts to restore flag %s. "
4511 "A flag for setting a value cannot be restored.",
4515 { /* cut-and-pastied from llmain...blecch */
4516 cstring extra = cstring_undefined;
4522 rest = mstring_copy (s);
4526 while ((rchar = *rest) != '\0'
4527 && (isspace (rchar)))
4533 while ((rchar = *rest) != '\0'
4534 && !isspace (rchar))
4536 extra = cstring_appendChar (extra, rchar);
4543 if (cstring_isUndefined (extra))
4548 ("Flag %s (in stylized comment) must be followed by an argument",
4549 flagcode_unparse (fflag)));
4555 if (flagcode_hasValue (fflag))
4557 setValueFlag (fflag, extra);
4559 else if (flagcode_hasString (fflag))
4561 setStringFlag (fflag, extra);
4577 while ((c == ' ') || (c == '\t') || (c == '\n'))
4583 if (context_inHeader () && !isArtificial (cstring_fromChars (os)))
4585 context_addComment (cstring_fromCharsNew (os));
4598 while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n')
4610 t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t)));
4611 macrocode = tokenMacroCode (cstring_fromChars (t));
4613 if (macrocode != BADTOK)
4615 tokLength = mstring_length (t);
4621 if (macrocode == SKIPTOK)
4629 if (context_inHeader ())
4636 if ((context_inMacro () || context_inGlobalContext ())
4637 && macrocode != SKIPTOK
4638 && !isArtificial (cstring_fromChars (os)))
4640 context_addComment (cstring_fromCharsNew (os));
4653 if (mstring_equal (t, "ignore"))
4655 if (!context_getFlag (FLG_NOCOMMENTS))
4657 context_enterSuppressRegion ();
4660 else if ((*t == 'i' || *t == 't')
4661 && (*(t + 1) == '\0'))
4663 if (!context_getFlag (FLG_NOCOMMENTS)
4664 && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS)))
4666 context_enterSuppressLine (-1); /* infinite suppression */
4669 else if (((*t == 'i') || (*t == 't'))
4670 && ((*(t + 1) >= '0' && *(t + 1) <= '9')))
4672 bool tmpcomment = (*t == 't');
4674 char *tt = t; /* don't mangle t, since it is free'd */
4677 if (lc >= '0' && lc <= '9')
4679 val = (int)(lc - '0');
4682 while (lc >= '0' && lc <= '9')
4691 if (!context_getFlag (FLG_NOCOMMENTS)
4692 && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS)))
4694 context_enterSuppressLine (val);
4697 else if (mstring_equal (t, "end"))
4699 if (!context_getFlag (FLG_NOCOMMENTS))
4701 context_exitSuppressRegion ();
4704 else if (mstring_equal (t, "notfunction"))
4706 ; /* handled by pcpp */
4708 else if (mstring_equal (t, "access"))
4714 while ((c = *s) && (c == ' ' || c == '\t' || c == '\n'))
4724 tname = cstring_fromChars (s);
4726 while ((c = *s) != '\0' && c != ' '
4727 && c != '\t' && c != '\n' && c != ',')
4735 if (!context_getFlag (FLG_NOCOMMENTS)
4736 && !context_getFlag (FLG_NOACCESS))
4738 if (usymtab_existsType (tname))
4740 usymId uid = usymtab_getTypeId (tname);
4742 context_addFileAccessType (uid);
4746 if (!(context_inSuppressRegion ()
4747 || context_inSuppressZone (g_currentloc)))
4751 ("%q: Unrecognized type %s used in access comment",
4752 fileloc_unparse (g_currentloc), tname));
4762 if (c != ',' && c != ' ')
4768 else if (mstring_equal (t, "noaccess"))
4775 while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n'))
4785 tname = cstring_fromChars (s);
4787 while ((lc = *s) != '\0' && lc != ' ' && lc != '\t'
4788 && lc != '\n' && lc != ',')
4795 if (!context_getFlag (FLG_NOCOMMENTS)
4796 && !context_getFlag (FLG_NOACCESS))
4798 if (usymtab_existsType (tname))
4800 typeId tuid = usymtab_getTypeId (tname);
4802 if (context_couldHaveAccess (tuid))
4804 context_removeFileAccessType (tuid);
4808 if (!(context_inSuppressRegion ()
4809 || context_inSuppressZone (g_currentloc)))
4811 uentry ue = usymtab_getTypeEntry (tuid);
4813 if (uentry_isAbstractDatatype (ue))
4817 ("%q: Non-accessible abstract type %s used in noaccess comment",
4818 fileloc_unparse (g_currentloc), tname));
4824 ("%q: Non-abstract type %s used in noaccess comment",
4825 fileloc_unparse (g_currentloc), tname));
4832 if (!(context_inSuppressRegion ()
4833 || context_inSuppressZone (g_currentloc)))
4837 ("%q: Unrecognized type %s used in noaccess comment",
4838 fileloc_unparse (g_currentloc), tname));
4848 if (lc != ',' && lc != ' ')
4856 setTokLength (- (2 + charsread));
4858 voptgenerror (FLG_UNRECOGCOMMENTS,
4859 message ("Stylized comment unrecognized: %s",
4860 cstring_fromChars (os)),
4871 static /*@only@*/ cstring makeIdentifier (char *s)
4873 char *c = mstring_create (size_toInt (strlen (s)) + 1);
4874 cstring id = cstring_fromChars (c);
4876 while (isalnum (*s) || (*s == '_') || (*s == '$'))
4885 /*@observer@*/ /*@dependent@*/ uentry coerceId (cstring cn)
4887 if (!(usymtab_exists (cn)))
4889 fileloc loc = fileloc_createExternal ();
4892 ** We need to put this in a global scope, otherwise the sRef will be deallocated.
4895 uentry ce = uentry_makeUnrecognized (cn, loc);
4897 if (!context_inIterEnd ())
4901 message ("Unrecognized (possibly system) identifier: %q",
4902 uentry_getName (ce)),
4909 return (usymtab_lookup (cn));
4913 ** like, coerceId, but doesn't supercede for iters
4916 /*@observer@*/ uentry coerceIterId (cstring cn)
4918 if (!(usymtab_exists (cn)))
4920 return uentry_undefined;
4923 return (usymtab_lookup (cn));
4926 /*@observer@*/ cstring LastIdentifier ()
4928 return (lastidprocessed);
4931 static int processIdentifier (cstring id)
4935 DPRINTF (("Process identifier: %s", id));
4937 context_clearJustPopped ();
4938 lastidprocessed = id;
4940 if (context_inFunctionDecl ())
4942 int tok = commentMarkerToken (id);
4950 tok = tokenMacroCode (id);
4959 /* Consider handling: Defined by C99 as static const char __func__[] */
4961 if (context_getFlag (FLG_GNUEXTENSIONS))
4965 if (cstring_equalLit (id, "__stdcall")
4966 || cstring_equalLit (id, "__cdecl")
4967 || cstring_equalLit (id, "__extension__"))
4971 else if (cstring_equalLit (id, "__volatile__"))
4975 else if (cstring_equalLit (id, "__signed"))
4979 else if (cstring_equalLit (id, "__unsigned"))
4983 else if (cstring_equalLit (id, "__const__"))
4987 else if (cstring_equalLit (id, "__alignof__"))
4989 tok = CALIGNOF; /* alignof is parsed like sizeof */
4991 else if (cstring_equalLit (id, "__FUNCTION__")
4992 || cstring_equalLit (id, "__PRETTY_FUNCTION__"))
4994 /* These tokens hold the name of the current function as strings */
4995 yylval.expr = exprNode_stringLiteral (id, fileloc_copy (g_currentloc));
4997 lastWasString = TRUE;
5001 else if (cstring_equalLit (id, "__attribute__")
5002 || cstring_equalLit (id, "__asm__")
5003 || cstring_equalLit (id, "_asm")
5004 || cstring_equalLit (id, "__asm")
5005 || cstring_equalLit (id, "__declspec"))
5008 bool useparens = FALSE;
5009 bool usebraces = FALSE;
5010 bool inquote = FALSE;
5011 bool inescape = FALSE;
5014 while ((ic = input ()) != EOF)
5021 else if (ic == '\\')
5025 else if (ic == '\"')
5061 else if (ic == ')' && useparens)
5064 if (depth == 0) break;
5066 else if (ic == '}' && usebraces)
5069 if (depth == 0) break;
5072 && !usebraces && !useparens
5073 && cstring_equalLit (id, "__asm"))
5076 ** We need this because some MS VC++ include files
5077 ** have __asm mov ... }
5078 ** Its a kludge, but otherwise would need to parse
5087 context_incLineno ();
5089 if (cstring_equalLit (id, "__asm")
5090 && !useparens && !usebraces)
5097 llassert ((useparens && ic == ')')
5098 || (usebraces && ic == '}')
5099 || (!useparens && !usebraces));
5103 else if (cstring_equalLit (id, "inline")
5104 || cstring_equalLit (id, "__inline")
5105 || cstring_equalLit (id, "_inline")
5106 || cstring_equalLit (id, "__inline__"))
5117 le = usymtab_lookupSafe (id);
5119 /*@-dependenttrans@*/
5121 if (uentry_isIter (le))
5126 else if (uentry_isEndIter (le))
5129 return (ITER_ENDNAME);
5131 else if (uentry_isUndefined (le))
5135 /* avoid parse errors for certain system built ins */
5137 if (g_expectingTypeName && (cstring_firstChar (id) == '_')
5138 && (cstring_secondChar (id) == '_'))
5140 return (TYPE_NAME_OR_ID);
5143 return (NEW_IDENTIFIER);
5145 else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le))
5147 if (uentry_isDatatype (le))
5150 return (NEW_IDENTIFIER);
5155 return (IDENTIFIER);
5158 else if (uentry_isDatatype (le))
5160 if (!g_expectingTypeName)
5164 return (NEW_IDENTIFIER);
5168 yylval.ctyp = uentry_getAbstractType (le);
5170 uentry_setUsed (le, g_currentloc);
5177 return (IDENTIFIER);
5180 /*@=dependenttrans@*/
5183 static bool processHashIdentifier (/*@only@*/ cstring id)
5185 if (context_inMacro () || context_inIterDef () ||
5186 context_inIterEnd ())
5190 context_clearJustPopped ();
5192 lastidprocessed = id;
5193 le = usymtab_lookupSafe (id);
5195 if (uentry_isParam (le) || uentry_isRefParam (le))
5212 static /*@only@*/ exprNode processString ()
5216 char *nl = strchr (yytext, '\n');
5217 cstring ns = cstring_fromCharsNew (yytext);
5221 loc = fileloc_copy (g_currentloc);
5222 addColumn (cstring_length (ns));
5228 loc = fileloc_copy (g_currentloc);
5230 context_incLineno ();
5232 while ((nl = strchr ((nl + 1), '\n')) != NULL)
5234 context_incLineno ();
5240 res = exprNode_stringLiteral (ns, loc);
5250 llassert (*yytext != '\0');
5251 fchar = *(yytext + 1);
5252 if (fchar != '\\') return fchar;
5254 next = *(yytext + 2);
5258 case 'n': return '\n';
5259 case 't': return '\t';
5260 case '\"': return '\"';
5261 case '\'': return '\'';
5262 case '\\': return '\\';
5263 default: return '\0';
5268 double processFloat ()
5270 double ret = atof (yytext);
5281 llassert (yytext[0] == '0'
5282 && (yytext[1] == 'X' || yytext[1] == 'x'));
5284 while (yytext[index] != '\0') {
5286 char c = yytext[index];
5288 if (c >= '0' && c <= '9') {
5289 tval = (int) c - (int) '0';
5290 } else if (c >= 'A' && c <= 'F') {
5291 tval = (int) c - (int) 'A' + 10;
5292 } else if (c >= 'a' && c <= 'f') {
5293 tval = (int) c - (int) 'a' + 10;
5297 message ("Invalid character (%c) in hex constant: %s",
5298 c, cstring_fromChars (yytext)),
5303 val = (val * 16) + tval;
5307 DPRINTF (("Hex constant: %s = %ld", yytext, val));
5312 long processOctal ()
5317 llassert (yytext[0] == '0' && yytext[1] != 'X' && yytext[1] != 'x');
5319 while (yytext[index] != '\0') {
5321 char c = yytext[index];
5323 if (c >= '0' && c <= '7') {
5324 tval = (int) c - (int) '0';
5328 message ("Invalid character (%c) in octal constant: %s",
5329 c, cstring_fromChars (yytext)),
5334 val = (val * 8) + tval;
5338 DPRINTF (("Octal constant: %s = %ld", yytext, val));
5345 return (atol (yytext));
5349 processSpec (int tok)
5351 size_t length = strlen (yytext);
5356 setTokLengthT (length);
5362 context_saveLocation ();
5363 setTokLengthT (length);
5364 return (processIdentifier (makeIdentifier (yytext)));