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 310 "cscanner.l"
1542 context_saveLocation ();
1543 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1544 tok = processIdentifier (makeIdentifier (yytext));
1553 #line 319 "cscanner.l"
1554 { setTokLengthT (mstring_length (yytext));
1555 RETURN_INT (ctype_int, processHex ()); /* evs 2000-05-17 was ctype_uint */
1560 #line 322 "cscanner.l"
1561 { setTokLengthT (mstring_length (yytext));
1562 RETURN_INT (ctype_lint, processHex ()); }
1566 #line 324 "cscanner.l"
1567 { setTokLengthT (mstring_length (yytext));
1568 RETURN_INT (ctype_llint, processHex ()); }
1572 #line 326 "cscanner.l"
1573 { setTokLengthT (mstring_length (yytext));
1574 RETURN_INT (ctype_uint, processHex ()); }
1578 #line 328 "cscanner.l"
1579 { setTokLengthT (mstring_length (yytext));
1580 RETURN_INT (ctype_ulint, processHex ()); }
1584 #line 330 "cscanner.l"
1585 { setTokLengthT (mstring_length (yytext));
1586 RETURN_INT (ctype_ullint, processHex ()); }
1590 #line 332 "cscanner.l"
1591 { setTokLengthT (mstring_length (yytext));
1592 RETURN_INT (ctype_ullint, processHex ()); }
1596 #line 334 "cscanner.l"
1597 { setTokLengthT (mstring_length (yytext));
1598 RETURN_INT (ctype_int, processOctal ()); }
1602 #line 336 "cscanner.l"
1603 { setTokLengthT (mstring_length (yytext));
1604 RETURN_INT (ctype_uint, processOctal ()); }
1608 #line 338 "cscanner.l"
1609 { setTokLengthT (mstring_length (yytext));
1610 RETURN_INT (ctype_lint, processOctal ()); }
1614 #line 340 "cscanner.l"
1615 { setTokLengthT (mstring_length (yytext));
1616 RETURN_INT (ctype_llint, processOctal ()); }
1620 #line 342 "cscanner.l"
1621 { setTokLengthT (mstring_length (yytext));
1622 RETURN_INT (ctype_ulint, processOctal ()); }
1626 #line 344 "cscanner.l"
1627 { setTokLengthT (mstring_length (yytext));
1628 RETURN_INT (ctype_ullint, processOctal ()); }
1632 #line 346 "cscanner.l"
1633 { setTokLengthT (mstring_length (yytext));
1634 RETURN_INT (ctype_ullint, processOctal ()); }
1638 #line 348 "cscanner.l"
1639 { setTokLengthT (mstring_length (yytext));
1640 RETURN_INT (ctype_int, processDec ()); }
1644 #line 350 "cscanner.l"
1645 { setTokLengthT (mstring_length (yytext));
1646 RETURN_INT (ctype_uint, processDec ()); }
1650 #line 352 "cscanner.l"
1651 { setTokLengthT (mstring_length (yytext));
1652 RETURN_INT (ctype_lint, processDec ()); }
1656 #line 354 "cscanner.l"
1657 { setTokLengthT (mstring_length (yytext));
1658 RETURN_INT (ctype_llint, processDec ()); }
1662 #line 356 "cscanner.l"
1663 { setTokLengthT (mstring_length (yytext));
1664 RETURN_INT (ctype_ulint, processDec ()); }
1668 #line 358 "cscanner.l"
1669 { setTokLengthT (mstring_length (yytext));
1670 RETURN_INT (ctype_ullint, processDec ()); }
1674 #line 360 "cscanner.l"
1675 { setTokLengthT (mstring_length (yytext));
1676 RETURN_INT (ctype_ullint, processDec ()); }
1680 #line 362 "cscanner.l"
1681 { setTokLengthT (mstring_length (yytext));
1682 RETURN_CHAR (processChar ()); }
1686 #line 364 "cscanner.l"
1687 { setTokLengthT (mstring_length (yytext));
1688 RETURN_FLOAT (ctype_float, processFloat ()); }
1692 #line 366 "cscanner.l"
1693 { setTokLengthT (mstring_length (yytext));
1694 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1698 #line 368 "cscanner.l"
1699 { setTokLengthT (mstring_length (yytext));
1700 RETURN_FLOAT (ctype_double, processFloat ()); }
1704 #line 371 "cscanner.l"
1705 { setTokLengthT (mstring_length (yytext));
1706 RETURN_FLOAT (ctype_float, processFloat ()); }
1710 #line 373 "cscanner.l"
1711 { setTokLengthT (mstring_length (yytext));
1712 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1716 #line 375 "cscanner.l"
1717 { setTokLengthT (mstring_length (yytext));
1718 RETURN_FLOAT (ctype_double, processFloat ()); }
1722 #line 378 "cscanner.l"
1723 { setTokLengthT (mstring_length (yytext));
1724 RETURN_FLOAT (ctype_float, processFloat ()); }
1728 #line 380 "cscanner.l"
1729 { setTokLengthT (mstring_length (yytext));
1730 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
1734 #line 382 "cscanner.l"
1735 { setTokLengthT (mstring_length (yytext));
1736 RETURN_FLOAT (ctype_double, processFloat ()); }
1740 #line 385 "cscanner.l"
1741 { setTokLength (3); RETURN_TOK (RIGHT_ASSIGN); }
1745 #line 386 "cscanner.l"
1746 { setTokLength (3); RETURN_TOK (LEFT_ASSIGN); }
1750 #line 387 "cscanner.l"
1751 { setTokLength (2); RETURN_TOK (ADD_ASSIGN); }
1755 #line 388 "cscanner.l"
1756 { setTokLength (2); RETURN_TOK (SUB_ASSIGN); }
1760 #line 389 "cscanner.l"
1761 { setTokLength (2); RETURN_TOK (MUL_ASSIGN); }
1765 #line 390 "cscanner.l"
1766 { setTokLength (2); RETURN_TOK (DIV_ASSIGN); }
1770 #line 391 "cscanner.l"
1771 { setTokLength (2); RETURN_TOK (MOD_ASSIGN); }
1775 #line 392 "cscanner.l"
1776 { setTokLength (2); RETURN_TOK (AND_ASSIGN); }
1780 #line 393 "cscanner.l"
1781 { setTokLength (2); RETURN_TOK (XOR_ASSIGN); }
1785 #line 394 "cscanner.l"
1786 { setTokLength (2); RETURN_TOK (OR_ASSIGN); }
1790 #line 395 "cscanner.l"
1791 { setTokLength (2); RETURN_TOK (RIGHT_OP); }
1795 #line 396 "cscanner.l"
1796 { setTokLength (2); RETURN_TOK (LEFT_OP); }
1800 #line 397 "cscanner.l"
1801 { setTokLength (2); RETURN_TOK (INC_OP); }
1805 #line 398 "cscanner.l"
1806 { setTokLength (2); RETURN_TOK (DEC_OP); }
1810 #line 399 "cscanner.l"
1811 { setTokLength (2); RETURN_TOK (ARROW_OP); }
1815 #line 400 "cscanner.l"
1816 { setTokLength (2); RETURN_TOK (AND_OP); }
1820 #line 401 "cscanner.l"
1821 { setTokLength (2); RETURN_TOK (OR_OP); }
1825 #line 402 "cscanner.l"
1826 { setTokLength (2); RETURN_TOK (LE_OP); }
1830 #line 403 "cscanner.l"
1831 { setTokLength (2); RETURN_TOK (GE_OP); }
1835 #line 404 "cscanner.l"
1836 { setTokLength (2); RETURN_TOK (EQ_OP); }
1840 #line 405 "cscanner.l"
1841 { setTokLength (2); RETURN_TOK (NE_OP); }
1845 #line 406 "cscanner.l"
1846 { setTokLength (1); RETURN_TOK (TSEMI); }
1850 #line 407 "cscanner.l"
1851 { setTokLength (1); RETURN_TOK (TLBRACE); }
1855 #line 408 "cscanner.l"
1856 { setTokLength (1); RETURN_TOK (TRBRACE); }
1860 #line 409 "cscanner.l"
1861 { setTokLength (1); RETURN_TOK (TCOMMA); }
1865 #line 410 "cscanner.l"
1866 { setTokLength (1); RETURN_TOK (TCOLON); }
1870 #line 411 "cscanner.l"
1871 { setTokLength (1); RETURN_TOK (TASSIGN); }
1875 #line 412 "cscanner.l"
1876 { setTokLength (1); RETURN_TOK (TLPAREN); }
1880 #line 413 "cscanner.l"
1881 { setTokLength (1); RETURN_TOK (TRPAREN); }
1885 #line 414 "cscanner.l"
1886 { setTokLength (1); RETURN_TOK (TLSQBR); }
1890 #line 415 "cscanner.l"
1891 { setTokLength (1); RETURN_TOK (TRSQBR); }
1895 #line 416 "cscanner.l"
1896 { setTokLength (1); RETURN_TOK (TDOT); }
1900 #line 417 "cscanner.l"
1901 { setTokLength (1); RETURN_TOK (TAMPERSAND); }
1905 #line 418 "cscanner.l"
1906 { setTokLength (1); RETURN_TOK (TEXCL); }
1910 #line 421 "cscanner.l"
1911 { setTokLength (1); RETURN_TOK (TTILDE); }
1915 #line 422 "cscanner.l"
1916 { setTokLength (1); RETURN_TOK (TMINUS); }
1920 #line 423 "cscanner.l"
1921 { setTokLength (1); RETURN_TOK (TPLUS); }
1925 #line 424 "cscanner.l"
1926 { setTokLength (1); RETURN_TOK (TMULT); }
1930 #line 425 "cscanner.l"
1931 { setTokLength (1); RETURN_TOK (TDIV); }
1935 #line 426 "cscanner.l"
1936 { setTokLength (1); RETURN_TOK (TPERCENT); }
1940 #line 427 "cscanner.l"
1941 { setTokLength (1); RETURN_TOK (TLT); }
1945 #line 428 "cscanner.l"
1946 { setTokLength (1); RETURN_TOK (TGT); }
1950 #line 429 "cscanner.l"
1951 { setTokLength (1); RETURN_TOK (TCIRC); }
1955 #line 430 "cscanner.l"
1956 { setTokLength (1); RETURN_TOK (TBAR); }
1960 #line 431 "cscanner.l"
1961 { setTokLength (1); RETURN_TOK (TQUEST); }
1965 #line 433 "cscanner.l"
1970 #line 434 "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 450 "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 467 "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 503 "cscanner.l"
2052 { setTokLength (4); lldiagmsg (ctype_unparseTable ()); }
2056 #line 504 "cscanner.l"
2058 lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc)));
2063 #line 507 "cscanner.l"
2064 { setTokLength (3); usymtab_printLocal (); }
2068 #line 508 "cscanner.l"
2069 { setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); }
2073 #line 509 "cscanner.l"
2074 { setTokLength (3); lldiagmsg (context_unparse ()); }
2078 #line 510 "cscanner.l"
2079 { setTokLength (3); lldiagmsg (context_unparseClauses ()); }
2083 #line 511 "cscanner.l"
2084 { setTokLength (3); usymtab_printGuards (); }
2088 #line 512 "cscanner.l"
2089 { setTokLength (3); usymtab_printOut (); }
2093 #line 513 "cscanner.l"
2094 { setTokLength (3); usymtab_printAll (); }
2098 #line 514 "cscanner.l"
2099 { setTokLength (3); usymtab_printComplete (); }
2103 #line 515 "cscanner.l"
2104 { setTokLength (3); usymtab_printTypes (); }
2108 #line 516 "cscanner.l"
2109 { setTokLength (3); lldiagmsg (usymtab_unparseStack ()); }
2113 #line 517 "cscanner.l"
2115 lldiagmsg (message ("Can modify: %q",
2116 sRefSet_unparse (context_modList ())));
2121 #line 521 "cscanner.l"
2122 { /* BEFORE_COMMENT_MARKER */
2124 incColumn (); incColumn ();
2125 tok = handleLlSpecial ();
2134 #line 530 "cscanner.l"
2135 { /* AFTER_COMMENT_MARKER */
2138 RETURN_TOK (QENDMACRO); }
2142 #line 534 "cscanner.l"
2143 { incColumn (); continueLine = TRUE; }
2147 #line 535 "cscanner.l"
2151 message ("Invalid character (ascii: %d), skipping character",
2158 #line 542 "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 542 "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 } ,
3079 ** These tokens are either stand-alone tokens, or followed by
3080 ** token-specific text.
3083 struct skeyword s_keytable[] = {
3084 { "anytype", QANYTYPE } ,
3085 { "integraltype", QINTEGRALTYPE } ,
3086 { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } ,
3087 { "signedintegraltype", QSIGNEDINTEGRALTYPE } ,
3091 { "owned", QOWNED } ,
3092 { "dependent", QDEPENDENT } ,
3093 { "partial", QPARTIAL } ,
3094 { "special", QSPECIAL } ,
3095 { "truenull", QTRUENULL } ,
3096 { "falsenull", QFALSENULL } ,
3099 { "notnull", QNOTNULL } ,
3100 { "abstract", QABSTRACT } ,
3101 { "concrete", QCONCRETE } ,
3102 { "mutable", QMUTABLE } ,
3103 { "immutable", QIMMUTABLE } ,
3104 { "unused", QUNUSED } ,
3105 { "external", QEXTERNAL } ,
3107 { "unique", QUNIQUE } ,
3108 { "returned", QRETURNED } ,
3109 { "exposed", QEXPOSED } ,
3110 { "refcounted", QREFCOUNTED } ,
3112 { "newref", QNEWREF } ,
3113 { "tempref", QTEMPREF } ,
3114 { "killref", QKILLREF } ,
3116 { "relnull", QRELNULL } ,
3117 { "nullterminated", QNULLTERMINATED },
3118 { "reldef", QRELDEF } ,
3119 { "observer", QOBSERVER } ,
3120 { "exits", QEXITS } ,
3121 { "mayexit", QMAYEXIT } ,
3122 { "trueexit", QTRUEEXIT } ,
3123 { "falseexit", QFALSEEXIT } ,
3124 { "neverexit", QNEVEREXIT } ,
3126 { "shared", QSHARED } ,
3128 { "unchecked", QUNCHECKED } ,
3129 { "checked", QCHECKED } ,
3130 { "checkmod", QCHECKMOD } ,
3131 { "checkedstrict", QCHECKEDSTRICT } ,
3132 { "innercontinue", QINNERCONTINUE } ,
3133 { "innerbreak", QINNERBREAK } ,
3134 { "loopbreak", QLOOPBREAK } ,
3135 { "switchbreak", QSWITCHBREAK } ,
3136 { "safebreak", QSAFEBREAK } ,
3137 { "fallthrough", QFALLTHROUGH } ,
3138 { "l_fallthrou", QLINTFALLTHROUGH } ,
3139 { "l_fallth", QLINTFALLTHRU } ,
3140 { "notreached", QNOTREACHED } ,
3141 { "l_notreach", QLINTNOTREACHED } ,
3142 { "printflike", QPRINTFLIKE } ,
3143 { "l_printfli", QLINTPRINTFLIKE } ,
3144 { "scanflike", QSCANFLIKE } ,
3145 { "messagelike", QMESSAGELIKE } ,
3146 { "l_argsus", QARGSUSED } ,
3151 ** would be better if these weren't hard coded...
3154 static bool isArtificial (cstring s)
3156 return (cstring_equalLit (s, "modifies")
3157 || cstring_equalLit (s, "globals")
3158 || cstring_equalLit (s, "alt"));
3161 void swallowMacro (void)
3164 bool skipnext = FALSE;
3166 while ((i = lminput ()) != EOF)
3183 checkUngetc (i, yyin);
3191 checkUngetc (i, yyin);
3195 static int commentMarkerToken (cstring s)
3199 while (s_parsetable[i].name != NULL)
3201 if (cstring_equalLit (s, s_parsetable[i].name))
3203 return s_parsetable[i].token;
3212 static int tokenMacroCode (cstring s)
3216 while (s_keytable[i].name != NULL)
3218 if (cstring_equalLit (s, s_keytable[i].name))
3220 if (s_keytable[i].token == QLINTFALLTHROUGH)
3223 (FLG_WARNLINTCOMMENTS,
3225 ("Traditional lint comment /*FALLTHROUGH*/ used. "
3226 "This is interpreted by "
3227 "LCLint in the same way as most Unix lints, but it is "
3228 "preferable to replace it with the /*@fallthrough@*/ "
3229 "stylized comment"),
3231 return QFALLTHROUGH;
3233 else if (s_keytable[i].token == QLINTFALLTHRU)
3236 (FLG_WARNLINTCOMMENTS,
3238 ("Traditional lint comment /*FALLTHRU*/ used. "
3239 "This is interpreted by "
3240 "LCLint in the same way as most Unix lints, but it is "
3241 "preferable to replace it with the /*@fallthrough@*/ "
3242 "stylized comment"),
3244 return QFALLTHROUGH;
3246 else if (s_keytable[i].token == QLINTNOTREACHED)
3249 (FLG_WARNLINTCOMMENTS,
3251 ("Traditional lint comment /*NOTREACHED*/ used. "
3252 "This is interpreted by "
3253 "LCLint in the same way as most Unix lints, but it is "
3254 "preferable to replace it with the /*@notreached@*/ "
3255 "stylized comment."),
3260 else if (s_keytable[i].token == QPRINTFLIKE)
3262 setSpecialFunction (QU_PRINTFLIKE);
3265 else if (s_keytable[i].token == QLINTPRINTFLIKE)
3268 (FLG_WARNLINTCOMMENTS,
3270 ("Traditional lint comment /*PRINTFLIKE*/ used. "
3271 "This is interpreted by "
3272 "LCLint in the same way as most Unix lints, but it is "
3273 "preferable to replace it with either /*@printflike@*/, "
3274 "/*@scanflike@*/ or /*@messagelike@*/."),
3277 setSpecialFunction (QU_PRINTFLIKE);
3280 else if (s_keytable[i].token == QSCANFLIKE)
3282 setSpecialFunction (QU_SCANFLIKE);
3285 else if (s_keytable[i].token == QMESSAGELIKE)
3287 setSpecialFunction (QU_MESSAGELIKE);
3290 else if (s_keytable[i].token == QARGSUSED)
3293 (FLG_WARNLINTCOMMENTS,
3295 ("Traditional lint comment /*ARGSUSED*/ used. "
3296 "This is interpreted by "
3297 "LCLint in the same way as most Unix lints, but it is "
3298 "preferable to use /*@unused@*/ annotations on "
3299 "the unused parameters."),
3306 return s_keytable[i].token;
3315 static int lminput ()
3317 if (savechar == '\0')
3324 int save = (int) savechar;
3330 static void lmsavechar (char c)
3332 if (savechar == '\0') savechar = c;
3335 llbuglit ("lmsavechar: override");
3339 static int returnFloat (ctype ct, double f)
3341 yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext),
3342 fileloc_decColumn (g_currentloc, tokLength));
3347 static int returnInt (ctype ct, long i)
3351 if (ctype_equal (ct, ctype_int))
3355 c = context_typeofZero ();
3359 c = context_typeofOne ();
3363 yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext),
3364 fileloc_decColumn (g_currentloc, tokLength), i);
3369 static int returnChar (char c)
3371 yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext),
3372 fileloc_decColumn (g_currentloc, tokLength));
3377 static int ninput ()
3381 if (c != EOF && ((char)c == '\n'))
3383 context_incLineno ();
3389 static char macro_nextChar ()
3391 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3396 c = char_fromInt (ic);
3398 if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0]))
3402 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3404 ; /* skip to newline */
3407 context_incLineno ();
3411 return macro_nextChar ();
3418 else /* if (c == '@') */
3420 if (handleLlSpecial () != BADTOK)
3422 llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax");
3425 return macro_nextChar ();
3428 else if (!in_escape && c == '\"')
3430 in_quote = !in_quote;
3432 else if (!in_escape && c == '\'')
3436 else if ((in_quote || in_char) && c == '\\')
3438 in_escape = !in_escape;
3440 else if ((in_quote || in_char) && in_escape)
3444 else if (!in_quote && c == '/')
3448 if ((c2 = char_fromInt (lminput ())) == '*')
3452 while ((c2 = char_fromInt (lminput ())) != '\0'
3453 && c2 != '\n' && c2 != '*')
3460 while ((c2 = char_fromInt (lminput ())) != '\0'
3473 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3477 return macro_nextChar ();
3481 /*** putchar does not work! why? puts to stdio...??! ***/
3489 ** keeps stylized comments
3492 static char macro_nextCharC ()
3494 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3497 c = char_fromInt (lminput ());
3499 if (!in_quote && !in_char && c == '\\')
3501 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3503 ; /* skip to newline */
3506 context_incLineno ();
3510 return macro_nextCharC ();
3517 else if (!in_escape && c == '\"')
3519 in_quote = !in_quote;
3521 else if (!in_escape && c == '\'')
3525 else if ((in_quote || in_char) && c == '\\')
3527 in_escape = !in_escape;
3529 else if ((in_quote || in_char) && in_escape)
3533 else if (!in_quote && c == '/')
3537 if ((c2 = char_fromInt (lminput ())) == '*')
3541 while ((c2 = char_fromInt (lminput ())) != '\0'
3542 && c2 != '\n' && c2 != '*')
3549 while ((c2 = char_fromInt (lminput ())) != '\0'
3562 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3566 return macro_nextCharC ();
3577 ** skips whitespace (handles line continuations)
3578 ** returns first non-whitespace character
3581 static char skip_whitespace ()
3585 while ((c = macro_nextChar ()) == ' ' || c == '\t')
3593 static void handleMacro ()
3595 cstring mac = cstring_undefined;
3599 while (currentColumn () > 2)
3601 mac = cstring_appendChar (mac, ' ');
3605 c = macro_nextCharC ();
3607 if (c >= '0' && c <= '9')
3611 for (i = 0; i < ((c - '0') + 1); i++)
3613 mac = cstring_appendChar (mac, ' ');
3621 while (((c = macro_nextCharC ()) != '\0') && (c != '\n'))
3623 mac = cstring_appendChar (mac, c);
3627 macrocode = tokenMacroCode (mac);
3629 if (macrocode == BADTOK && !isArtificial (mac))
3631 DPRINTF (("Add macro: %s", mac));
3632 context_addMacroCache (mac);
3641 context_incLineno ();
3645 static bool processMacro (void)
3650 cstring fname = cstring_undefined;
3652 bool isspecfcn = FALSE;
3653 bool isiter = FALSE;
3654 bool skipparam = FALSE;
3655 bool isenditer = FALSE;
3656 bool unknownm = FALSE;
3657 bool hasParams = FALSE;
3658 bool emptyMacro = FALSE;
3659 char c = skip_whitespace ();
3660 fileloc loc = fileloc_noColumn (g_currentloc);
3662 /* are both of these necessary? what do they mean? */
3663 uentryList specparams = uentryList_undefined;
3664 uentryList pn = uentryList_undefined;
3666 context_resetMacroMissingParams ();
3668 if (c == '\0' || c == '\n')
3670 llcontbug (cstring_makeLiteral ("Bad macro"));
3675 fname = cstring_appendChar (fname, c);
3677 while ((c = macro_nextChar ()) != '(' && c != '\0'
3678 && c != ' ' && c != '\t' && c != '\n')
3680 fname = cstring_appendChar (fname, c);
3683 if (c == ' ' || c == '\t' || c == '\n')
3689 while (c == ' ' || c == '\t')
3691 c = macro_nextChar ();
3705 hasParams = (c == '(');
3708 if (usymtab_exists (fname))
3710 e2 = usymtab_lookupExpose (fname);
3711 ct = uentry_getType (e2);
3714 if (uentry_isCodeDefined (e2)
3715 && fileloc_isUser (uentry_whereDefined (e2)))
3719 message ("Macro %s already defined", fname),
3722 uentry_showWhereDefined (e2);
3723 uentry_clearDefined (e2);
3726 if (uentry_isFunction (e2))
3728 uentry_setType (e2, ctype_unknown);
3731 context_enterUnknownMacro (e2);
3735 context_enterConstantMacro (e2);
3740 if (uentry_isForward (e2) && uentry_isFunction (e2))
3747 ("Parameterized macro has no prototype or specification: %s ",
3752 uentry_setType (e2, ctype_unknown);
3753 uentry_setFunctionDefined (e2, loc);
3754 uentry_setUsed (e2, fileloc_undefined);
3755 context_enterUnknownMacro (e2);
3759 if (uentry_isIter (e2))
3762 specparams = uentry_getParams (e2);
3763 noparams = uentryList_size (specparams);
3764 uentry_setDefined (e2, loc);
3765 context_enterIterDef (e2);
3767 else if (uentry_isEndIter (e2))
3770 uentry_setDefined (e2, loc);
3771 context_enterIterEnd (e2); /* don't care about it now */
3772 /* but should parse like an iter! */
3774 else if (uentry_isConstant (e2))
3780 message ("Constant %s implemented as parameterized macro",
3784 uentry_showWhereSpecified (e2);
3785 uentry_setType (e2, ctype_unknown);
3786 uentry_makeVarFunction (e2);
3787 uentry_setDefined (e2, g_currentloc);
3788 uentry_setFunctionDefined (e2, g_currentloc);
3789 context_enterUnknownMacro (e2);
3793 if (!uentry_isSpecified (e2))
3795 fileloc oloc = uentry_whereDeclared (e2);
3797 if (fileloc_isLib (oloc))
3801 else if (fileloc_isUndefined (oloc)
3802 || fileloc_isPreproc (oloc))
3807 (FLG_MACROCONSTDECL,
3809 ("Macro constant %q not declared",
3810 uentry_getName (e2)),
3814 else if (!fileloc_withinLines (oloc, loc, 2))
3815 { /* bogus! will give errors if there is too much whitespace */
3819 ("Macro constant name %s does not match name in "
3820 "previous constant declaration. This constant "
3821 "is declared at %q", fname,
3822 fileloc_unparse (oloc)),
3827 context_enterConstantMacro (e2);
3828 cstring_free (fname);
3834 else if (ctype_isFunction (ct))
3837 specparams = ctype_argsFunction (ct);
3838 noparams = uentryList_size (specparams);
3840 uentry_setFunctionDefined (e2, loc);
3841 context_enterMacro (e2);
3843 else if (uentry_isVar (e2))
3849 message ("Variable %s implemented as parameterized macro",
3853 uentry_showWhereSpecified (e2);
3854 uentry_setType (e2, ctype_unknown);
3855 uentry_makeVarFunction (e2);
3856 uentry_setDefined (e2, g_currentloc);
3857 uentry_setFunctionDefined (e2, g_currentloc);
3858 context_enterUnknownMacro (e2);
3862 uentry ucons = uentry_makeConstant (fname,
3865 if (uentry_isExpandedMacro (e2))
3873 message ("Variable %s implemented by a macro",
3877 uentry_showWhereSpecified (e2);
3881 uentry_setDefined (e2, loc);
3882 uentry_setUsed (ucons, loc);
3884 context_enterConstantMacro (ucons);
3885 uentry_markOwned (ucons);
3886 cstring_free (fname);
3892 if (uentry_isDatatype (e2))
3896 message ("Type implemented as macro: %x",
3897 uentry_getName (e2)),
3898 message ("A type is implemented using a macro definition. A "
3899 "typedef should be used instead."),
3903 /* Must exit scope (not sure why a new scope was entered?) */
3904 usymtab_quietExitScope (g_currentloc);
3905 uentry_setDefined (e2, g_currentloc);
3911 (message ("Unexpanded macro not function or constant: %q",
3912 uentry_unparse (e2)));
3913 uentry_setType (e2, ctype_unknown);
3917 uentry_makeVarFunction (e2);
3918 uentry_setDefined (e2, g_currentloc);
3919 uentry_setFunctionDefined (e2, g_currentloc);
3920 context_enterUnknownMacro (e2);
3932 (FLG_MACROMATCHNAME,
3933 message ("Unexpanded macro %s does not match name of a constant "
3934 "or iter declaration. The name used in the control "
3935 "comment on the previous line should match. "
3936 "(Assuming macro defines a constant.)",
3941 ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined);
3942 uentry_setUsed (ce, loc); /* perhaps bogus? */
3943 e2 = usymtab_supEntryReturn (ce);
3945 context_enterConstantMacro (e2);
3946 cstring_free (fname);
3951 /* in macros, ( must follow immediatetly after name */
3957 c = skip_whitespace ();
3959 while (c != ')' && c != '\0')
3962 bool suppress = context_inSuppressRegion ();
3963 cstring paramname = cstring_undefined;
3966 ** save the parameter location
3970 context_saveLocation ();
3973 while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')')
3975 paramname = cstring_appendChar (paramname, c);
3976 c = macro_nextChar ();
3979 if (c == ' ' || c == '\t') c = skip_whitespace ();
3983 c = macro_nextChar ();
3984 if (c == ' ' || c == '\t') c = skip_whitespace ();
3989 llfatalerror (cstring_makeLiteral
3990 ("Bad macro syntax: uentryList"));
3993 if ((isspecfcn || isiter) && (paramno < noparams)
3994 && !uentry_isElipsisMarker (uentryList_getN
3995 (specparams, paramno)))
3997 uentry decl = uentryList_getN (specparams, paramno);
4000 param = uentry_nameCopy (paramname, decl);
4003 uentry_setParam (param);
4004 sr = sRef_makeParam (paramno, uentry_getType (param));
4006 if (sRef_getNullState (sr) == NS_ABSNULL)
4008 ctype pt = ctype_realType (uentry_getType (param));
4010 if (ctype_isUser (pt))
4012 uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt));
4014 if (uentry_isValid (te))
4016 sRef_setStateFromUentry (sr, te);
4021 sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
4025 uentry_setSref (param, sr);
4026 uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
4028 skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
4032 fileloc sloc = context_getSaveLocation ();
4034 param = uentry_makeVariableSrefParam
4035 (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
4036 cstring_free (paramname);
4038 sRef_setPosNull (uentry_getSref (param), sloc);
4040 uentry_setDeclaredForce (param, sloc);
4043 fileloc_free (sloc);
4048 llassert (!uentry_isElipsisMarker (param));
4052 sRef_makeUnsafe (uentry_getSref (param));
4055 pn = uentryList_add (pn, uentry_copy (param));
4056 usymtab_supEntry (param);
4060 /* don't add param */
4061 uentry_free (param);
4066 (void) macro_nextChar ();
4067 c = skip_whitespace ();
4075 if (isspecfcn || isiter)
4077 if (paramno != noparams && noparams >= 0)
4083 message ("Macro %s specified with %d args, defined with %d",
4084 fname, noparams, paramno),
4087 uentry_showWhereSpecified (e2);
4088 uentry_resetParams (e2, pn);
4093 uentry_resetParams (e2, pn);
4100 ** the form should be:
4102 ** # define newname oldname
4103 ** where oldname refers to a function matching the specification
4109 sRef_setGlobalScope ();
4110 usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown));
4111 sRef_clearGlobalScope ();
4115 context_setMacroMissingParams ();
4120 /* context_setuentryList (pn); */
4121 usymtab_enterScope ();
4124 cstring_free (fname);
4129 static bool handleSpecial (char *yyt)
4131 char *l = mstring_create (MAX_NAME_LENGTH);
4132 static bool reportcpp = FALSE;
4138 strcpy (l, yyt + 1);
4140 /* Need to safe original l for deallocating. */
4143 l += strlen (yyt) - 1;
4145 while ((c = char_fromInt (lminput ())) != '\n' && c != '\0')
4151 olc = cstring_fromChars (ol);
4153 if (cstring_equalPrefix (olc, "pragma"))
4155 char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN));
4156 char *opname = pname;
4157 char *ptr = ol + 6; /* pragma is six characters, plus space */
4161 /* skip whitespace */
4162 while (((c = *ptr) != '\0') && isspace (c))
4168 while (((c = *ptr) != '\0') && !isspace (c))
4172 if (len > MAX_PRAGMA_LEN)
4183 if (len == PRAGMA_LEN_EXPAND
4184 && mstring_equal (opname, PRAGMA_EXPAND))
4186 cstring exname = cstring_undefined;
4190 while (((c = *ptr) != '\0') && !isspace (c))
4192 exname = cstring_appendChar (exname, c);
4197 ue = usymtab_lookupExposeGlob (exname);
4199 if (uentry_isExpandedMacro (ue))
4201 if (fileloc_isPreproc (uentry_whereDefined (ue)))
4203 fileloc_setColumn (g_currentloc, 1);
4204 uentry_setDefined (ue, g_currentloc);
4208 cstring_free (exname);
4211 else if (cstring_equalPrefix (olc, "ident"))
4213 /* Some pre-processors will leave these in the code. Ignore rest of line */
4216 ** Yuk...Win32 filenames can have spaces in them...we need to read
4217 ** to the matching end quote.
4219 else if ((sscanf (ol, "line %d \"", &lineno) == 1)
4220 || (sscanf (ol, " %d \"", &lineno) == 1))
4226 while (*tmp != '\"' && *tmp != '\0')
4231 llassert (*tmp == '\"');
4236 while (*tmp != '\"' && *tmp != '\0')
4241 llassert (*tmp == '\"');
4245 DPRINTF (("fname: %s", fname));
4247 # if defined(OS2) || defined(MSDOS) || defined(WIN32)
4250 ** DOS-like path delimiters get delivered in pairs, something like
4251 ** \"..\\\\file.h\", so we have to make it normal again. We do NOT
4252 ** remove the pre dirs yet as we usually specify tmp paths relative
4253 ** to the current directory, so tmp files would not get found in
4254 ** the hash table. If this method fails we try it again later.
4261 ** Skip past the drive marker.
4264 DPRINTF (("stmp: %s / %s", stmp, fname));
4266 if (strchr (stmp, ':') != NULL)
4268 stmp = strchr (stmp, ':') + 1;
4271 DPRINTF (("stmp: %s / %s", stmp, fname));
4273 while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL )
4275 if (*(stmp+1) == CONNECTCHAR)
4277 memmove (stmp, stmp+1, strlen (stmp));
4281 DPRINTF (("stmp: %s / %s", stmp, fname));
4284 DPRINTF (("Now: base = %s", fname));
4286 fid = fileTable_lookupBase (context_fileTable (),
4287 cstring_fromChars (fname));
4288 if (!(fileId_isValid (fid)))
4290 fname = removePreDirs (fname);
4291 fid = fileTable_lookupBase (context_fileTable (),
4292 cstring_fromChars (fname));
4295 # else /* !defined(OS2) && !defined(MSDOS) */
4296 fname = removePreDirs (fname);
4297 fid = fileTable_lookupBase (context_fileTable (),
4298 cstring_fromChars (fname));
4299 # endif /* !defined(OS2) && !defined(MSDOS) */
4301 if (!(fileId_isValid (fid)))
4303 if (isHeaderFile (cstring_fromChars (fname)))
4305 fid = fileTable_addHeaderFile (context_fileTable (),
4306 cstring_fromChars (fname));
4310 fid = fileTable_addFile (context_fileTable (),
4311 cstring_fromChars (fname));
4315 setFileLine (fid, lineno);
4317 else if ((sscanf (ol, "line %d", &lineno) == 1)
4318 || (sscanf (ol, " %d", &lineno) == 1))
4320 setLine (lineno); /* next line is <cr> */
4324 if (mstring_equal (ol, "")) {
4325 DPRINTF (("Empty pp command!"));
4327 ** evs 2000-05-16: This is a horrible kludge, to get around a bug (well, difficulty) in the pre-processor.
4328 ** We handle a plain # in the input file, by echoing it, and ignoring it in the post-pp-file.
4337 llbug (message ("File contains preprocessor command: #%s",
4338 cstring_fromChars (ol)));
4351 static int handleLlSpecial ()
4355 char *s = mstring_createEmpty ();
4360 while (((ic = ninput ()) != 0) && isalpha (ic))
4363 s = mstring_append (s, c);
4369 if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0])
4373 llassert (ic == AFTER_COMMENT_MARKER[1]);
4376 if (isProcessingGlobMods () && (*s == '\0'))
4379 return QNOMODS; /* special token no modifications token */
4387 tok = commentMarkerToken (cstring_fromChars (os));
4391 tokLength = charsread;
4397 /* Add rest of the comment */
4399 if (ic != 0 && ic != EOF)
4404 s = mstring_append (s, c);
4407 while (((ic = ninput ()) != 0) && (ic != EOF)
4408 && (ic != AFTER_COMMENT_MARKER[0]))
4411 s = mstring_append (s, c);
4416 if (ic == AFTER_COMMENT_MARKER[0])
4419 llassert ((char) nc == AFTER_COMMENT_MARKER[1]);
4426 while (*s == ' ' || *s == '\t' || *s == '\n')
4431 if (*s == '-' || *s == '+' || *s == '=') /* setting flags */
4435 while (c == '-' || c == '+' || c == '=')
4437 ynm set = ynm_fromCodeChar (c);
4442 thisflag = cstring_fromChars (s);
4444 while ((c = *s) != '\0' && (c != '-') && (c != '=')
4445 && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n'))
4452 if (!context_getFlag (FLG_NOCOMMENTS))
4454 cstring flagname = thisflag;
4455 flagcode fflag = identifyFlag (flagname);
4457 if (flagcode_isSkip (fflag))
4461 else if (flagcode_isInvalid (fflag))
4463 if (isMode (flagname))
4465 if (ynm_isMaybe (set))
4470 ("Stylized comment attempts to restore flag %s. "
4471 "A mode flag cannot be restored.",
4476 context_setMode (flagname);
4483 message ("Unrecognized option in stylized comment: %s",
4487 else if (flagcode_isGlobalFlag (fflag))
4492 ("Stylized comment attempts to set global flag %s. "
4493 "A global flag cannot be set locally.",
4498 context_fileSetFlag (fflag, set);
4500 if (flagcode_hasArgument (fflag))
4502 if (ynm_isMaybe (set))
4507 ("Stylized comment attempts to restore flag %s. "
4508 "A flag for setting a value cannot be restored.",
4512 { /* cut-and-pastied from llmain...blecch */
4513 cstring extra = cstring_undefined;
4519 rest = mstring_copy (s);
4523 while ((rchar = *rest) != '\0'
4524 && (isspace (rchar)))
4530 while ((rchar = *rest) != '\0'
4531 && !isspace (rchar))
4533 extra = cstring_appendChar (extra, rchar);
4540 if (cstring_isUndefined (extra))
4545 ("Flag %s (in stylized comment) must be followed by an argument",
4546 flagcode_unparse (fflag)));
4552 if (flagcode_hasValue (fflag))
4554 setValueFlag (fflag, extra);
4556 else if (flagcode_hasString (fflag))
4558 setStringFlag (fflag, extra);
4574 while ((c == ' ') || (c == '\t') || (c == '\n'))
4580 if (context_inHeader () && !isArtificial (cstring_fromChars (os)))
4582 context_addComment (cstring_fromCharsNew (os));
4595 while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n')
4607 t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t)));
4608 macrocode = tokenMacroCode (cstring_fromChars (t));
4610 if (macrocode != BADTOK)
4612 tokLength = mstring_length (t);
4618 if (macrocode == SKIPTOK)
4626 if (context_inHeader ())
4633 if ((context_inMacro () || context_inGlobalContext ())
4634 && macrocode != SKIPTOK
4635 && !isArtificial (cstring_fromChars (os)))
4637 context_addComment (cstring_fromCharsNew (os));
4650 if (mstring_equal (t, "ignore"))
4652 if (!context_getFlag (FLG_NOCOMMENTS))
4654 context_enterSuppressRegion ();
4657 else if ((*t == 'i' || *t == 't')
4658 && (*(t + 1) == '\0'))
4660 if (!context_getFlag (FLG_NOCOMMENTS)
4661 && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS)))
4663 context_enterSuppressLine (-1); /* infinite suppression */
4666 else if (((*t == 'i') || (*t == 't'))
4667 && ((*(t + 1) >= '0' && *(t + 1) <= '9')))
4669 bool tmpcomment = (*t == 't');
4671 char *tt = t; /* don't mangle t, since it is free'd */
4674 if (lc >= '0' && lc <= '9')
4676 val = (int)(lc - '0');
4679 while (lc >= '0' && lc <= '9')
4688 if (!context_getFlag (FLG_NOCOMMENTS)
4689 && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS)))
4691 context_enterSuppressLine (val);
4694 else if (mstring_equal (t, "end"))
4696 if (!context_getFlag (FLG_NOCOMMENTS))
4698 context_exitSuppressRegion ();
4701 else if (mstring_equal (t, "notfunction"))
4703 ; /* handled by pcpp */
4705 else if (mstring_equal (t, "access"))
4711 while ((c = *s) && (c == ' ' || c == '\t' || c == '\n'))
4721 tname = cstring_fromChars (s);
4723 while ((c = *s) != '\0' && c != ' '
4724 && c != '\t' && c != '\n' && c != ',')
4732 if (!context_getFlag (FLG_NOCOMMENTS)
4733 && !context_getFlag (FLG_NOACCESS))
4735 if (usymtab_existsType (tname))
4737 usymId uid = usymtab_getTypeId (tname);
4739 context_addFileAccessType (uid);
4743 if (!(context_inSuppressRegion ()
4744 || context_inSuppressZone (g_currentloc)))
4748 ("%q: Unrecognized type %s used in access comment",
4749 fileloc_unparse (g_currentloc), tname));
4759 if (c != ',' && c != ' ')
4765 else if (mstring_equal (t, "noaccess"))
4772 while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n'))
4782 tname = cstring_fromChars (s);
4784 while ((lc = *s) != '\0' && lc != ' ' && lc != '\t'
4785 && lc != '\n' && lc != ',')
4792 if (!context_getFlag (FLG_NOCOMMENTS)
4793 && !context_getFlag (FLG_NOACCESS))
4795 if (usymtab_existsType (tname))
4797 typeId tuid = usymtab_getTypeId (tname);
4799 if (context_couldHaveAccess (tuid))
4801 context_removeFileAccessType (tuid);
4805 if (!(context_inSuppressRegion ()
4806 || context_inSuppressZone (g_currentloc)))
4808 uentry ue = usymtab_getTypeEntry (tuid);
4810 if (uentry_isAbstractDatatype (ue))
4814 ("%q: Non-accessible abstract type %s used in noaccess comment",
4815 fileloc_unparse (g_currentloc), tname));
4821 ("%q: Non-abstract type %s used in noaccess comment",
4822 fileloc_unparse (g_currentloc), tname));
4829 if (!(context_inSuppressRegion ()
4830 || context_inSuppressZone (g_currentloc)))
4834 ("%q: Unrecognized type %s used in noaccess comment",
4835 fileloc_unparse (g_currentloc), tname));
4845 if (lc != ',' && lc != ' ')
4853 setTokLength (- (2 + charsread));
4855 voptgenerror (FLG_UNRECOGCOMMENTS,
4856 message ("Stylized comment unrecognized: %s",
4857 cstring_fromChars (os)),
4868 static /*@only@*/ cstring makeIdentifier (char *s)
4870 char *c = mstring_create (size_toInt (strlen (s)) + 1);
4871 cstring id = cstring_fromChars (c);
4873 while (isalnum (*s) || (*s == '_') || (*s == '$'))
4882 /*@observer@*/ /*@dependent@*/ uentry coerceId (cstring cn)
4884 if (!(usymtab_exists (cn)))
4886 fileloc loc = fileloc_createExternal ();
4889 ** We need to put this in a global scope, otherwise the sRef will be deallocated.
4892 uentry ce = uentry_makeUnrecognized (cn, loc);
4894 if (!context_inIterEnd ())
4898 message ("Unrecognized (possibly system) identifier: %q",
4899 uentry_getName (ce)),
4906 return (usymtab_lookup (cn));
4910 ** like, coerceId, but doesn't supercede for iters
4913 /*@observer@*/ uentry coerceIterId (cstring cn)
4915 if (!(usymtab_exists (cn)))
4917 return uentry_undefined;
4920 return (usymtab_lookup (cn));
4923 /*@observer@*/ cstring LastIdentifier ()
4925 return (lastidprocessed);
4928 static int processIdentifier (cstring id)
4932 DPRINTF (("Process identifier: %s", id));
4934 context_clearJustPopped ();
4935 lastidprocessed = id;
4937 if (context_inFunctionDecl ())
4939 int tok = commentMarkerToken (id);
4947 tok = tokenMacroCode (id);
4956 /* Consider handling: Defined by C99 as static const char __func__[] */
4958 if (context_getFlag (FLG_GNUEXTENSIONS))
4962 if (cstring_equalLit (id, "__stdcall")
4963 || cstring_equalLit (id, "__cdecl")
4964 || cstring_equalLit (id, "__extension__"))
4968 else if (cstring_equalLit (id, "__volatile__"))
4972 else if (cstring_equalLit (id, "__signed"))
4976 else if (cstring_equalLit (id, "__unsigned"))
4980 else if (cstring_equalLit (id, "__const__"))
4984 else if (cstring_equalLit (id, "__alignof__"))
4986 tok = CALIGNOF; /* alignof is parsed like sizeof */
4988 else if (cstring_equalLit (id, "__FUNCTION__")
4989 || cstring_equalLit (id, "__PRETTY_FUNCTION__"))
4991 /* These tokens hold the name of the current function as strings */
4992 yylval.expr = exprNode_stringLiteral (id, fileloc_copy (g_currentloc));
4994 lastWasString = TRUE;
4998 else if (cstring_equalLit (id, "__attribute__")
4999 || cstring_equalLit (id, "__asm__")
5000 || cstring_equalLit (id, "_asm")
5001 || cstring_equalLit (id, "__asm")
5002 || cstring_equalLit (id, "__declspec"))
5005 bool useparens = FALSE;
5006 bool usebraces = FALSE;
5007 bool inquote = FALSE;
5008 bool inescape = FALSE;
5011 while ((ic = input ()) != EOF)
5018 else if (ic == '\\')
5022 else if (ic == '\"')
5058 else if (ic == ')' && useparens)
5061 if (depth == 0) break;
5063 else if (ic == '}' && usebraces)
5066 if (depth == 0) break;
5069 && !usebraces && !useparens
5070 && cstring_equalLit (id, "__asm"))
5073 ** We need this because some MS VC++ include files
5074 ** have __asm mov ... }
5075 ** Its a kludge, but otherwise would need to parse
5084 context_incLineno ();
5086 if (cstring_equalLit (id, "__asm")
5087 && !useparens && !usebraces)
5094 llassert ((useparens && ic == ')')
5095 || (usebraces && ic == '}')
5096 || (!useparens && !usebraces));
5100 else if (cstring_equalLit (id, "inline")
5101 || cstring_equalLit (id, "__inline")
5102 || cstring_equalLit (id, "_inline")
5103 || cstring_equalLit (id, "__inline__"))
5114 le = usymtab_lookupSafe (id);
5116 /*@-dependenttrans@*/
5118 if (uentry_isIter (le))
5123 else if (uentry_isEndIter (le))
5126 return (ITER_ENDNAME);
5128 else if (uentry_isUndefined (le))
5132 /* avoid parse errors for certain system built ins */
5134 if (g_expectingTypeName && (cstring_firstChar (id) == '_')
5135 && (cstring_secondChar (id) == '_'))
5137 return (TYPE_NAME_OR_ID);
5140 return (NEW_IDENTIFIER);
5142 else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le))
5144 if (uentry_isDatatype (le))
5147 return (NEW_IDENTIFIER);
5152 return (IDENTIFIER);
5155 else if (uentry_isDatatype (le))
5157 if (!g_expectingTypeName)
5161 return (NEW_IDENTIFIER);
5165 yylval.ctyp = uentry_getAbstractType (le);
5167 uentry_setUsed (le, g_currentloc);
5174 return (IDENTIFIER);
5177 /*@=dependenttrans@*/
5180 static bool processHashIdentifier (/*@only@*/ cstring id)
5182 if (context_inMacro () || context_inIterDef () ||
5183 context_inIterEnd ())
5187 context_clearJustPopped ();
5189 lastidprocessed = id;
5190 le = usymtab_lookupSafe (id);
5192 if (uentry_isParam (le) || uentry_isRefParam (le))
5209 static /*@only@*/ exprNode processString ()
5213 char *nl = strchr (yytext, '\n');
5214 cstring ns = cstring_fromCharsNew (yytext);
5218 loc = fileloc_copy (g_currentloc);
5219 addColumn (cstring_length (ns));
5225 loc = fileloc_copy (g_currentloc);
5227 context_incLineno ();
5229 while ((nl = strchr ((nl + 1), '\n')) != NULL)
5231 context_incLineno ();
5237 res = exprNode_stringLiteral (ns, loc);
5247 llassert (*yytext != '\0');
5248 fchar = *(yytext + 1);
5249 if (fchar != '\\') return fchar;
5251 next = *(yytext + 2);
5255 case 'n': return '\n';
5256 case 't': return '\t';
5257 case '\"': return '\"';
5258 case '\'': return '\'';
5259 case '\\': return '\\';
5260 default: return '\0';
5265 double processFloat ()
5267 double ret = atof (yytext);
5278 llassert (yytext[0] == '0'
5279 && (yytext[1] == 'X' || yytext[1] == 'x'));
5281 while (yytext[index] != '\0') {
5283 char c = yytext[index];
5285 if (c >= '0' && c <= '9') {
5286 tval = (int) c - (int) '0';
5287 } else if (c >= 'A' && c <= 'F') {
5288 tval = (int) c - (int) 'A' + 10;
5289 } else if (c >= 'a' && c <= 'f') {
5290 tval = (int) c - (int) 'a' + 10;
5294 message ("Invalid character (%c) in hex constant: %s",
5295 c, cstring_fromChars (yytext)),
5300 val = (val * 16) + tval;
5304 DPRINTF (("Hex constant: %s = %ld", yytext, val));
5309 long processOctal ()
5314 llassert (yytext[0] == '0' && yytext[1] != 'X' && yytext[1] != 'x');
5316 while (yytext[index] != '\0') {
5318 char c = yytext[index];
5320 if (c >= '0' && c <= '7') {
5321 tval = (int) c - (int) '0';
5325 message ("Invalid character (%c) in octal constant: %s",
5326 c, cstring_fromChars (yytext)),
5331 val = (val * 8) + tval;
5335 DPRINTF (("Octal constant: %s = %ld", yytext, val));
5342 return (atol (yytext));
5346 processSpec (int tok)
5348 size_t length = strlen (yytext);
5353 setTokLengthT (length);
5359 context_saveLocation ();
5360 setTokLengthT (length);
5361 return (processIdentifier (makeIdentifier (yytext)));