]> andersk Git - splint.git/blame - src/cscanner.c.der
noexpand always false.
[splint.git] / src / cscanner.c.der
CommitLineData
885824d3 1/*
2** Inserted at beginning of c files generated by flex
3** REMEMBER: Change flex.reset too.
4*/
5
6/*@-allmacros@*/
7/*@-pred@*/
8/*@-globstate@*/
9/*@-null@*/
10/*@+boolint@*/
11/*@+charint@*/
12/*@-macrospec@*/
13/*@-macroredef@*/
14/*@-exitarg@*/
15/*@-compdef@*/
16/*@-uniondef@*/
17/*@+ignorequals@*/
18/*@-noreturn@*/
19/*@-mustfree@*/
20/*@-compdestroy@*/
21/*@-branchstate@*/
22/*@-unreachable@*/
23/*@-varuse@*/
24/*@-fcnuse@*/
25/*@-exportlocal@*/
26/*@-evalorderuncon@*/
27/*@-exportheader@*/
28/*@-redecl@*/
29/*@-loopswitchbreak@*/
30/*@-switchswitchbreak@*/
31/*@-sizeoftype@*/
32/*@-czechfcns@*/
33/*@-noparams@*/
34/*@-ansireserved@*/
35/*@-ifblock@*/
36/*@-whileblock@*/
37/*@-forblock@*/
38/*@-elseifcomplete@*/
39/*@+ptrnegate@*/
40/*@-onlytrans@*/
41/*@-temptrans@*/
42/*@-immediatetrans@*/
43/*@-namechecks@*/
44/*@+matchanyintegral@*/
45/*@-statictrans@*/
46/*@-compmempass@*/
47/*@-forempty@*/
48/*@-evalorder@*/
49/*@-retalias@*/
50/*@-dependenttrans@*/
51/*@-noeffect@*/
52/*@-protoparammatch@*/
53/*@-casebreak@*/
54/*@-retvalother@*/
55
56# ifdef __LCLINT__
57/*@-redecl@*/ /*@-type@*/
58extern int lsllex (void);
59/*@=redecl@*/ /*@=type@*/
60
61/*
62** Need to do this because ECHO is defined by the Posix library.
63** flex shouldn't use it.
64*/
65
66/*@notfunction@*/
67# define ECHO \
68 fwrite (yytext, yyleng, 1, yyout)
69
70# ifndef DEFFILENO
71extern /*@external@*/ int fileno (/* FILE *stream */);
72# define DEFFILENO
73# endif
74# endif
75
76# ifdef OSF
77# undef __GNUC__
78# endif
79
80/*@-redecl@*/
81
82/* < end of flex.head > */
83
84/* A lexical scanner generated by flex */
85
86/* Scanner skeleton version:
87 * $Header$
88 */
89
90#define FLEX_SCANNER
91#define YY_FLEX_MAJOR_VERSION 2
92#define YY_FLEX_MINOR_VERSION 5
93
94#include <stdio.h>
95
96
97/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
98#ifdef c_plusplus
99#ifndef __cplusplus
100#define __cplusplus
101#endif
102#endif
103
104
105#ifdef __cplusplus
106
107#include <stdlib.h>
108#include <unistd.h>
109
110/* Use prototypes in function declarations. */
111#define YY_USE_PROTOS
112
113/* The "const" storage-class-modifier is valid. */
114#define YY_USE_CONST
115
116#else /* ! __cplusplus */
117
118#if __STDC__
119
120#define YY_USE_PROTOS
121#define YY_USE_CONST
122
123#endif /* __STDC__ */
124#endif /* ! __cplusplus */
125
126#ifdef __TURBOC__
127 #pragma warn -rch
128 #pragma warn -use
129#include <io.h>
130#include <stdlib.h>
131#define YY_USE_CONST
132#define YY_USE_PROTOS
133#endif
134
135#ifdef YY_USE_CONST
136#define yyconst const
137#else
138#define yyconst
139#endif
140
141
142#ifdef YY_USE_PROTOS
143#define YY_PROTO(proto) proto
144#else
145#define YY_PROTO(proto) ()
146#endif
147
148/* Returned upon end-of-file. */
149#define YY_NULL 0
150
151/* Promotes a possibly negative, possibly signed char to an unsigned
152 * integer for use as an array index. If the signed char is negative,
153 * we want to instead treat it as an 8-bit unsigned char, hence the
154 * double cast.
155 */
156#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
157
158/* Enter a start condition. This macro really ought to take a parameter,
159 * but we do it the disgusting crufty way forced on us by the ()-less
160 * definition of BEGIN.
161 */
162#define BEGIN yy_start = 1 + 2 *
163
164/* Translate the current start state into a value that can be later handed
165 * to BEGIN to return to the state. The YYSTATE alias is for lex
166 * compatibility.
167 */
168#define YY_START ((yy_start - 1) / 2)
169#define YYSTATE YY_START
170
171/* Action number for EOF rule of a given start state. */
172#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
173
174/* Special action meaning "start processing a new file". */
175#define YY_NEW_FILE yyrestart( yyin )
176
177#define YY_END_OF_BUFFER_CHAR 0
178
179/* Size of default input buffer. */
180#define YY_BUF_SIZE 16384
181
182typedef struct yy_buffer_state *YY_BUFFER_STATE;
183
184extern int yyleng;
185extern FILE *yyin, *yyout;
186
187#define EOB_ACT_CONTINUE_SCAN 0
188#define EOB_ACT_END_OF_FILE 1
189#define EOB_ACT_LAST_MATCH 2
190
191/* The funky do-while in the following #define is used to turn the definition
192 * int a single C statement (which needs a semi-colon terminator). This
193 * avoids problems with code like:
194 *
195 * if ( condition_holds )
196 * yyless( 5 );
197 * else
198 * do_something_else();
199 *
200 * Prior to using the do-while the compiler would get upset at the
201 * "else" because it interpreted the "if" statement as being all
202 * done when it reached the ';' after the yyless() call.
203 */
204
205/* Return all but the first 'n' matched characters back to the input stream. */
206
207#define yyless(n) \
208 do \
209 { \
210 /* Undo effects of setting up yytext. */ \
211 *yy_cp = yy_hold_char; \
212 YY_RESTORE_YY_MORE_OFFSET \
213 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
214 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
215 } \
216 while ( 0 )
217
218#define unput(c) yyunput( c, yytext_ptr )
219
220/* The following is because we cannot portably get our hands on size_t
221 * (without autoconf's help, which isn't available because we want
222 * flex-generated scanners to compile on their own).
223 */
224typedef unsigned int yy_size_t;
225
226
227struct yy_buffer_state
228 {
229 FILE *yy_input_file;
230
231 char *yy_ch_buf; /* input buffer */
232 char *yy_buf_pos; /* current position in input buffer */
233
234 /* Size of input buffer in bytes, not including room for EOB
235 * characters.
236 */
237 yy_size_t yy_buf_size;
238
239 /* Number of characters read into yy_ch_buf, not including EOB
240 * characters.
241 */
242 int yy_n_chars;
243
244 /* Whether we "own" the buffer - i.e., we know we created it,
245 * and can realloc() it to grow it, and should free() it to
246 * delete it.
247 */
248 int yy_is_our_buffer;
249
250 /* Whether this is an "interactive" input source; if so, and
251 * if we're using stdio for input, then we want to use getc()
252 * instead of fread(), to make sure we stop fetching input after
253 * each newline.
254 */
255 int yy_is_interactive;
256
257 /* Whether we're considered to be at the beginning of a line.
258 * If so, '^' rules will be active on the next match, otherwise
259 * not.
260 */
261 int yy_at_bol;
262
263 /* Whether to try to fill the input buffer when we reach the
264 * end of it.
265 */
266 int yy_fill_buffer;
267
268 int yy_buffer_status;
269#define YY_BUFFER_NEW 0
270#define YY_BUFFER_NORMAL 1
271 /* When an EOF's been seen but there's still some text to process
272 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
273 * shouldn't try reading from the input source any more. We might
274 * still have a bunch of tokens to match, though, because of
275 * possible backing-up.
276 *
277 * When we actually see the EOF, we change the status to "new"
278 * (via yyrestart()), so that the user can continue scanning by
279 * just pointing yyin at a new input file.
280 */
281#define YY_BUFFER_EOF_PENDING 2
282 };
283
284static YY_BUFFER_STATE yy_current_buffer = 0;
285
286/* We provide macros for accessing buffer states in case in the
287 * future we want to put the buffer states in a more general
288 * "scanner state".
289 */
290#define YY_CURRENT_BUFFER yy_current_buffer
291
292
293/* yy_hold_char holds the character lost when yytext is formed. */
294static char yy_hold_char;
295
296static int yy_n_chars; /* number of characters read into yy_ch_buf */
297
298
299int yyleng;
300
301/* Points to current character in buffer. */
302static char *yy_c_buf_p = (char *) 0;
303static int yy_init = 1; /* whether we need to initialize */
304static int yy_start = 0; /* start state number */
305
306/* Flag which is used to allow yywrap()'s to do buffer switches
307 * instead of setting up a fresh yyin. A bit of a hack ...
308 */
309static int yy_did_buffer_switch_on_eof;
310
311void yyrestart YY_PROTO(( FILE *input_file ));
312
313void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
314void yy_load_buffer_state YY_PROTO(( void ));
315YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
316void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
317void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
318void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
319#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
320
321YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
322YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
323YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
324
325static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
326static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
327static void yy_flex_free YY_PROTO(( void * ));
328
329#define yy_new_buffer yy_create_buffer
330
331#define yy_set_interactive(is_interactive) \
332 { \
333 if ( ! yy_current_buffer ) \
334 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
335 yy_current_buffer->yy_is_interactive = is_interactive; \
336 }
337
338#define yy_set_bol(at_bol) \
339 { \
340 if ( ! yy_current_buffer ) \
341 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
342 yy_current_buffer->yy_at_bol = at_bol; \
343 }
344
345#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
346
347typedef unsigned char YY_CHAR;
348FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
349typedef int yy_state_type;
350extern char *yytext;
351#define yytext_ptr yytext
352
353static yy_state_type yy_get_previous_state YY_PROTO(( void ));
354static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
355static int yy_get_next_buffer YY_PROTO(( void ));
356static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
357
358/* Done after the current pattern has been matched and before the
359 * corresponding action - sets up yytext.
360 */
361#define YY_DO_BEFORE_ACTION \
362 yytext_ptr = yy_bp; \
363 yyleng = (int) (yy_cp - yy_bp); \
364 yy_hold_char = *yy_cp; \
365 *yy_cp = '\0'; \
366 yy_c_buf_p = yy_cp;
367
1ac6313d 368#define YY_NUM_RULES 168
369#define YY_END_OF_BUFFER 169
370static yyconst short int yy_accept[500] =
885824d3 371 { 0,
1ac6313d 372 0, 0, 169, 167, 147, 148, 135, 167, 3, 79,
373 141, 134, 167, 129, 130, 139, 138, 126, 137, 133,
374 140, 88, 88, 127, 123, 142, 128, 143, 146, 167,
375 131, 166, 132, 144, 79, 79, 79, 79, 79, 79,
885824d3 376 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
1ac6313d 377 79, 79, 79, 79, 79, 124, 145, 125, 136, 122,
378 0, 42, 0, 2, 79, 108, 164, 165, 117, 109,
379 0, 0, 106, 114, 104, 115, 105, 116, 0, 98,
380 1, 107, 101, 84, 0, 90, 89, 0, 88, 113,
381 119, 121, 120, 112, 0, 0, 0, 110, 79, 79,
885824d3 382
383 79, 79, 79, 79, 79, 79, 9, 79, 79, 79,
384 79, 79, 79, 79, 13, 44, 79, 79, 79, 79,
385 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
386 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
1ac6313d 387 79, 79, 79, 79, 111, 118, 0, 0, 2, 92,
388 4, 0, 96, 97, 98, 0, 99, 100, 86, 85,
389 0, 95, 91, 91, 80, 103, 102, 154, 155, 152,
390 157, 162, 153, 163, 158, 161, 156, 159, 160, 0,
391 0, 79, 79, 79, 79, 79, 79, 79, 79, 79,
392 79, 79, 79, 79, 79, 79, 79, 79, 11, 79,
393
394 79, 27, 79, 79, 79, 79, 79, 79, 79, 79,
395 79, 79, 43, 79, 79, 79, 79, 79, 79, 74,
885824d3 396 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
885824d3 397 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
1ac6313d 398 79, 0, 42, 0, 0, 98, 0, 96, 97, 0,
399 101, 87, 87, 93, 94, 81, 82, 151, 0, 0,
400 79, 79, 39, 79, 6, 29, 79, 79, 79, 79,
401 79, 79, 10, 25, 79, 79, 79, 79, 12, 79,
402 79, 79, 51, 79, 31, 79, 79, 52, 79, 79,
403 68, 79, 79, 79, 79, 79, 79, 79, 79, 79,
404
885824d3 405 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
1ac6313d 406 79, 79, 79, 79, 79, 79, 26, 79, 79, 79,
407 0, 98, 83, 83, 0, 150, 79, 79, 5, 79,
408 36, 79, 79, 79, 79, 79, 79, 79, 30, 79,
409 79, 79, 79, 79, 79, 79, 79, 79, 69, 79,
410 79, 79, 79, 79, 79, 79, 32, 79, 79, 79,
411 79, 79, 79, 79, 79, 79, 79, 77, 24, 79,
412 79, 79, 79, 79, 18, 76, 149, 79, 79, 79,
413 79, 79, 79, 79, 28, 79, 38, 79, 21, 79,
414 54, 78, 79, 60, 79, 79, 79, 79, 79, 79,
415
416 58, 79, 14, 75, 34, 15, 79, 41, 22, 17,
417 79, 79, 79, 79, 79, 72, 19, 20, 79, 37,
418 47, 64, 79, 79, 8, 79, 59, 79, 79, 79,
419 62, 53, 79, 79, 45, 79, 79, 57, 79, 46,
420 61, 79, 23, 79, 79, 79, 79, 65, 7, 79,
421 73, 79, 79, 70, 16, 79, 40, 79, 55, 79,
422 33, 35, 79, 71, 56, 79, 79, 79, 67, 79,
423 79, 79, 63, 79, 79, 79, 79, 79, 79, 79,
424 48, 79, 79, 66, 79, 79, 79, 79, 79, 79,
425 79, 79, 79, 79, 50, 79, 79, 49, 0
426
885824d3 427 } ;
428
429static yyconst int yy_ec[256] =
430 { 0,
431 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
432 4, 4, 1, 1, 1, 1, 1, 1, 1, 1,
433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 1, 2, 5, 6, 7, 8, 9, 10, 11, 12,
435 13, 14, 15, 16, 17, 18, 19, 20, 21, 21,
436 21, 21, 21, 21, 21, 21, 21, 22, 23, 24,
437 25, 26, 27, 28, 29, 30, 31, 30, 32, 33,
438 34, 8, 8, 8, 35, 36, 37, 8, 8, 8,
439 38, 39, 40, 41, 42, 8, 43, 44, 8, 45,
440 46, 47, 48, 49, 50, 1, 51, 52, 53, 54,
441
442 55, 56, 57, 58, 59, 8, 60, 61, 62, 63,
443 64, 65, 8, 66, 67, 68, 69, 70, 71, 72,
444 73, 74, 75, 76, 77, 78, 1, 1, 1, 1,
445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
450 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452
453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
456 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
458 1, 1, 1, 1, 1
459 } ;
460
461static yyconst int yy_meta[79] =
462 { 0,
463 1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
464 3, 1, 1, 1, 1, 1, 1, 1, 1, 4,
465 4, 1, 1, 1, 1, 1, 1, 1, 5, 5,
466 5, 5, 5, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 1, 1, 1, 1, 2,
468 5, 5, 5, 5, 5, 5, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 1, 1, 1, 1
471 } ;
472
1ac6313d 473static yyconst short int yy_base[507] =
885824d3 474 { 0,
1ac6313d 475 0, 0, 641, 642, 642, 642, 615, 73, 0, 0,
476 55, 71, 592, 642, 642, 613, 67, 642, 68, 66,
477 74, 80, 85, 642, 642, 65, 612, 82, 642, 91,
478 642, 642, 642, 611, 585, 28, 568, 67, 40, 65,
479 72, 569, 88, 55, 568, 79, 101, 580, 575, 103,
480 90, 566, 51, 570, 568, 642, 113, 642, 642, 642,
481 133, 163, 623, 0, 0, 642, 642, 642, 642, 642,
482 100, 139, 642, 642, 642, 642, 642, 642, 607, 155,
483 642, 642, 162, 172, 164, 117, 141, 0, 204, 599,
484 642, 642, 642, 598, 245, 585, 585, 642, 567, 546,
485
486 550, 562, 549, 145, 552, 141, 545, 546, 543, 144,
487 550, 546, 543, 540, 0, 99, 544, 551, 544, 541,
488 532, 534, 540, 533, 543, 537, 529, 533, 529, 174,
489 538, 156, 158, 538, 162, 533, 529, 521, 524, 184,
490 538, 140, 528, 531, 642, 642, 242, 172, 0, 642,
491 642, 235, 642, 642, 251, 243, 642, 642, 192, 193,
492 246, 272, 642, 642, 233, 642, 642, 642, 544, 642,
493 642, 642, 642, 642, 642, 642, 642, 642, 642, 545,
494 546, 518, 513, 516, 528, 523, 511, 523, 228, 524,
495 519, 521, 517, 509, 506, 514, 501, 516, 0, 502,
496
497 506, 509, 494, 497, 500, 503, 493, 495, 496, 501,
498 488, 481, 0, 498, 484, 498, 491, 214, 480, 0,
499 482, 481, 483, 490, 491, 475, 473, 473, 475, 484,
500 483, 479, 481, 471, 475, 466, 246, 478, 480, 469,
501 468, 215, 307, 525, 278, 283, 300, 642, 642, 302,
502 304, 642, 642, 642, 642, 249, 265, 642, 499, 487,
503 462, 451, 0, 463, 0, 0, 462, 453, 461, 450,
504 455, 456, 0, 0, 449, 449, 459, 445, 0, 449,
505 454, 449, 0, 272, 0, 454, 439, 0, 441, 451,
506 0, 451, 445, 439, 435, 446, 431, 433, 443, 429,
507
508 441, 431, 435, 434, 439, 438, 424, 426, 434, 432,
509 430, 422, 427, 428, 416, 428, 0, 412, 424, 424,
510 309, 314, 642, 642, 449, 642, 409, 410, 0, 281,
511 0, 411, 412, 418, 416, 415, 406, 405, 0, 412,
512 400, 404, 410, 408, 406, 400, 390, 391, 0, 407,
513 388, 388, 399, 393, 390, 398, 0, 397, 394, 398,
514 395, 379, 388, 390, 375, 388, 389, 0, 0, 378,
515 386, 382, 377, 378, 0, 0, 642, 368, 380, 380,
516 369, 363, 363, 375, 0, 375, 377, 358, 0, 375,
517 0, 0, 369, 0, 363, 368, 358, 360, 357, 364,
518
519 0, 357, 0, 0, 358, 0, 355, 0, 0, 0,
520 359, 353, 357, 352, 356, 0, 0, 0, 349, 0,
521 0, 342, 354, 352, 0, 343, 0, 344, 334, 330,
522 0, 0, 320, 327, 0, 314, 308, 0, 310, 0,
523 0, 311, 0, 316, 315, 313, 299, 0, 0, 298,
524 0, 303, 295, 0, 0, 307, 0, 293, 0, 305,
525 299, 0, 291, 0, 0, 283, 301, 299, 0, 290,
526 293, 286, 0, 292, 280, 293, 290, 276, 286, 264,
527 0, 280, 257, 0, 250, 204, 189, 198, 174, 178,
528 161, 137, 148, 100, 0, 48, 28, 0, 642, 375,
529
530 379, 383, 388, 392, 394, 399
885824d3 531 } ;
532
1ac6313d 533static yyconst short int yy_def[507] =
885824d3 534 { 0,
1ac6313d 535 499, 1, 499, 499, 499, 499, 499, 500, 501, 502,
536 499, 499, 503, 499, 499, 499, 499, 499, 499, 499,
537 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
538 499, 499, 499, 499, 502, 502, 502, 502, 502, 502,
539 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
540 502, 502, 502, 502, 502, 499, 499, 499, 499, 499,
541 500, 499, 500, 504, 502, 499, 499, 499, 499, 499,
542 503, 503, 499, 499, 499, 499, 499, 499, 499, 499,
543 499, 499, 499, 499, 499, 499, 499, 505, 499, 499,
544 499, 499, 499, 499, 499, 499, 499, 499, 502, 502,
545
546 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
547 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
548 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
549 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
550 502, 502, 502, 502, 499, 499, 499, 506, 504, 499,
551 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
552 499, 499, 499, 499, 505, 499, 499, 499, 499, 499,
553 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
554 499, 502, 502, 502, 502, 502, 502, 502, 502, 502,
555 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
556
557 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
558 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
559 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
560 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
561 502, 506, 499, 506, 499, 499, 499, 499, 499, 499,
562 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
563 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
564 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
565 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
566 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
567
568 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
569 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
570 499, 499, 499, 499, 499, 499, 502, 502, 502, 502,
571 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
572 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
573 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
574 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
575 502, 502, 502, 502, 502, 502, 499, 502, 502, 502,
576 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
577 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
578
579 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
580 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
581 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
582 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
583 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
584 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
585 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
586 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
587 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
588 502, 502, 502, 502, 502, 502, 502, 502, 0, 499,
589
590 499, 499, 499, 499, 499, 499
885824d3 591 } ;
592
1ac6313d 593static yyconst short int yy_nxt[721] =
885824d3 594 { 0,
595 4, 5, 6, 5, 7, 8, 9, 10, 11, 12,
596 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
597 23, 24, 25, 26, 27, 28, 29, 30, 10, 10,
598 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
599 10, 10, 10, 10, 10, 31, 32, 33, 34, 35,
600 36, 37, 38, 39, 40, 41, 42, 10, 43, 44,
601 45, 10, 46, 47, 48, 49, 50, 51, 52, 53,
602 54, 10, 55, 10, 56, 57, 58, 59, 62, 66,
1ac6313d 603 69, 74, 498, 79, 76, 80, 80, 81, 90, 91,
885824d3 604 100, 75, 77, 78, 106, 70, 101, 83, 82, 84,
605
606 84, 141, 83, 107, 89, 89, 93, 94, 95, 118,
1ac6313d 607 150, 85, 497, 119, 142, 86, 85, 103, 96, 63,
885824d3 608 86, 87, 111, 88, 104, 108, 87, 109, 97, 67,
609 105, 68, 112, 121, 85, 113, 110, 145, 62, 85,
1ac6313d 610 86, 499, 122, 115, 137, 86, 72, 123, 87, 71,
611 116, 88, 124, 87, 117, 138, 125, 131, 163, 201,
612 132, 133, 139, 126, 147, 147, 202, 134, 148, 127,
613 135, 128, 496, 136, 80, 80, 164, 243, 161, 63,
614 161, 155, 155, 162, 162, 163, 152, 153, 146, 83,
615 154, 84, 84, 156, 157, 187, 190, 158, 238, 188,
616
617 239, 164, 495, 85, 494, 191, 221, 159, 195, 152,
618 153, 196, 226, 160, 223, 154, 156, 157, 244, 222,
619 243, 83, 158, 89, 89, 493, 85, 227, 253, 216,
620 217, 224, 159, 252, 218, 85, 232, 233, 492, 86,
621 160, 219, 234, 147, 147, 87, 491, 148, 490, 245,
622 235, 245, 236, 253, 246, 246, 489, 250, 85, 250,
623 252, 244, 251, 251, 86, 162, 162, 296, 256, 488,
624 155, 155, 87, 168, 257, 169, 297, 170, 171, 172,
625 173, 174, 247, 248, 175, 176, 249, 177, 178, 179,
626 323, 162, 162, 256, 268, 269, 315, 246, 246, 316,
627
628 324, 257, 246, 246, 254, 247, 248, 255, 147, 147,
629 487, 249, 148, 486, 321, 153, 321, 323, 154, 322,
630 322, 251, 251, 251, 251, 324, 343, 254, 322, 322,
631 485, 484, 255, 322, 322, 380, 157, 344, 153, 158,
632 483, 482, 381, 154, 481, 480, 248, 479, 478, 249,
633 477, 476, 475, 474, 473, 472, 471, 470, 469, 157,
634 468, 467, 466, 465, 158, 464, 463, 462, 461, 248,
635 460, 459, 458, 457, 249, 61, 61, 61, 61, 61,
636 64, 456, 455, 64, 65, 454, 65, 65, 71, 71,
637 453, 71, 71, 149, 452, 149, 149, 165, 165, 242,
638
639 242, 242, 242, 242, 451, 450, 449, 448, 447, 446,
640 445, 444, 443, 442, 441, 440, 439, 438, 437, 436,
641 435, 434, 433, 432, 431, 430, 429, 428, 427, 426,
642 425, 424, 423, 422, 421, 420, 419, 418, 417, 416,
643 415, 414, 413, 412, 411, 410, 409, 408, 407, 406,
644 405, 404, 403, 402, 401, 400, 399, 398, 397, 396,
645 395, 394, 393, 392, 391, 390, 389, 388, 387, 386,
646 385, 384, 383, 382, 379, 378, 377, 376, 375, 374,
647 373, 372, 371, 370, 369, 368, 367, 366, 365, 364,
648 363, 362, 361, 360, 359, 358, 357, 356, 355, 354,
649
650 353, 352, 351, 350, 349, 348, 347, 346, 345, 342,
651 341, 340, 339, 338, 337, 336, 335, 334, 333, 332,
652 331, 330, 329, 328, 327, 326, 325, 499, 320, 319,
653 318, 317, 314, 313, 312, 311, 310, 309, 308, 307,
654 306, 305, 304, 303, 302, 301, 300, 299, 298, 295,
655 294, 293, 292, 291, 290, 289, 288, 287, 286, 285,
656 284, 283, 282, 281, 280, 279, 278, 277, 276, 275,
657 274, 273, 272, 271, 270, 267, 266, 265, 264, 263,
658 262, 261, 260, 259, 258, 241, 240, 237, 231, 230,
659 229, 228, 225, 220, 215, 214, 213, 212, 211, 210,
660
661 209, 208, 207, 206, 205, 204, 203, 200, 199, 198,
662 197, 194, 193, 192, 189, 186, 185, 184, 183, 182,
663 181, 180, 167, 166, 151, 499, 144, 143, 140, 130,
664 129, 120, 114, 102, 99, 98, 92, 73, 72, 60,
665 499, 3, 499, 499, 499, 499, 499, 499, 499, 499,
666 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
667 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
668 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
669 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
670 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
671
672 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
673 499, 499, 499, 499, 499, 499, 499, 499, 499, 499
885824d3 674 } ;
675
1ac6313d 676static yyconst short int yy_chk[721] =
885824d3 677 { 0,
678 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
679 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
680 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
681 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
682 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
683 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
684 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
685 1, 1, 1, 1, 1, 1, 1, 1, 8, 11,
1ac6313d 686 12, 17, 497, 20, 19, 20, 20, 21, 26, 26,
885824d3 687 36, 17, 19, 19, 39, 12, 36, 22, 21, 22,
688
689 22, 53, 23, 39, 23, 23, 28, 28, 30, 44,
1ac6313d 690 71, 22, 496, 44, 53, 22, 23, 38, 30, 8,
885824d3 691 23, 22, 41, 22, 38, 40, 23, 40, 30, 11,
692 38, 11, 41, 46, 22, 41, 40, 57, 61, 23,
693 22, 72, 46, 43, 51, 23, 71, 46, 22, 72,
1ac6313d 694 43, 22, 47, 23, 43, 51, 47, 50, 86, 116,
885824d3 695 50, 50, 51, 47, 62, 62, 116, 50, 62, 47,
1ac6313d 696 50, 47, 494, 50, 80, 80, 87, 148, 85, 61,
697 85, 83, 83, 85, 85, 86, 80, 80, 57, 84,
698 80, 84, 84, 83, 83, 104, 106, 83, 142, 104,
699
700 142, 87, 493, 84, 492, 106, 132, 84, 110, 80,
701 80, 110, 135, 84, 133, 80, 83, 83, 148, 132,
702 242, 89, 83, 89, 89, 491, 84, 135, 160, 130,
703 130, 133, 84, 159, 130, 89, 140, 140, 490, 89,
704 84, 130, 140, 147, 147, 89, 489, 147, 488, 152,
705 140, 152, 140, 160, 152, 152, 487, 156, 89, 156,
706 159, 242, 156, 156, 89, 161, 161, 218, 165, 486,
707 155, 155, 89, 95, 165, 95, 218, 95, 95, 95,
885824d3 708 95, 95, 155, 155, 95, 95, 155, 95, 95, 95,
1ac6313d 709 256, 162, 162, 165, 189, 189, 237, 245, 245, 237,
710
711 257, 165, 246, 246, 162, 155, 155, 162, 243, 243,
712 485, 155, 243, 483, 247, 246, 247, 256, 246, 247,
713 247, 250, 250, 251, 251, 257, 284, 162, 321, 321,
714 482, 480, 162, 322, 322, 330, 251, 284, 246, 251,
715 479, 478, 330, 246, 477, 476, 322, 475, 474, 322,
716 472, 471, 470, 468, 467, 466, 463, 461, 460, 251,
717 458, 456, 453, 452, 251, 450, 447, 446, 445, 322,
718 444, 442, 439, 437, 322, 500, 500, 500, 500, 500,
719 501, 436, 434, 501, 502, 433, 502, 502, 503, 503,
720 430, 503, 503, 504, 429, 504, 504, 505, 505, 506,
721
722 506, 506, 506, 506, 428, 426, 424, 423, 422, 419,
723 415, 414, 413, 412, 411, 407, 405, 402, 400, 399,
724 398, 397, 396, 395, 393, 390, 388, 387, 386, 384,
725 383, 382, 381, 380, 379, 378, 374, 373, 372, 371,
726 370, 367, 366, 365, 364, 363, 362, 361, 360, 359,
727 358, 356, 355, 354, 353, 352, 351, 350, 348, 347,
728 346, 345, 344, 343, 342, 341, 340, 338, 337, 336,
729 335, 334, 333, 332, 328, 327, 325, 320, 319, 318,
730 316, 315, 314, 313, 312, 311, 310, 309, 308, 307,
731 306, 305, 304, 303, 302, 301, 300, 299, 298, 297,
732
733 296, 295, 294, 293, 292, 290, 289, 287, 286, 282,
734 281, 280, 278, 277, 276, 275, 272, 271, 270, 269,
735 268, 267, 264, 262, 261, 260, 259, 244, 241, 240,
736 239, 238, 236, 235, 234, 233, 232, 231, 230, 229,
737 228, 227, 226, 225, 224, 223, 222, 221, 219, 217,
738 216, 215, 214, 212, 211, 210, 209, 208, 207, 206,
739 205, 204, 203, 202, 201, 200, 198, 197, 196, 195,
740 194, 193, 192, 191, 190, 188, 187, 186, 185, 184,
741 183, 182, 181, 180, 169, 144, 143, 141, 139, 138,
742 137, 136, 134, 131, 129, 128, 127, 126, 125, 124,
743
744 123, 122, 121, 120, 119, 118, 117, 114, 113, 112,
745 111, 109, 108, 107, 105, 103, 102, 101, 100, 99,
746 97, 96, 94, 90, 79, 63, 55, 54, 52, 49,
747 48, 45, 42, 37, 35, 34, 27, 16, 13, 7,
748 3, 499, 499, 499, 499, 499, 499, 499, 499, 499,
749 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
750 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
751 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
752 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
753 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
754
755 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
756 499, 499, 499, 499, 499, 499, 499, 499, 499, 499
885824d3 757 } ;
758
759static yy_state_type yy_last_accepting_state;
760static char *yy_last_accepting_cpos;
761
762/* The intent behind this definition is that it'll catch
763 * any uses of REJECT which flex missed.
764 */
765#define REJECT reject_used_but_not_detected
766#define yymore() yymore_used_but_not_detected
767#define YY_MORE_ADJ 0
768#define YY_RESTORE_YY_MORE_OFFSET
769char *yytext;
770#line 1 "cscanner.l"
771#define INITIAL 0
772/*;-*-C-*-;
773** Copyright (c) Massachusetts Institute of Technology 1994-1998.
774** All Rights Reserved.
775** Unpublished rights reserved under the copyright laws of
776** the United States.
777**
778** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
779** OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
780**
781** This code is distributed freely and may be used freely under the
782** following conditions:
783**
784** 1. This notice may not be removed or altered.
785**
786** 2. Works derived from this code are not distributed for
787** commercial gain without explicit permission from MIT
788** (for permission contact lclint-request@sds.lcs.mit.edu).
789*/
790/*
791 * Modified by Herbert 08/19/97:
792 * - added #include for IBM's OS/2 compiler.
793 * - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only).
794 */
795/*
796 * Modified by Mike Smith
797 * Corrected missing 'line' in scanf() calls in handleSpecial().
798 * Without this, I get an error when LCLint hits a '#line' directive
799 * in the pre-pre-processed source files. For safety, I have made these
800 * conditional on OS2 and MSDOS because I don't understand why noone else
801 * has seen this problem.
802 *
803 * Modified by Mike Smith, 4th June 1997
804 * Finally resolved the #line problem. The scanf() calls have been fixed to
805 * allow the following #line forms:-
806 *
807 * #line 123 "filename"
808 * #line 123
809 * # 123 "filename"
810 * # 123
811 *
812 * The last two are generated by the GNU pre-processor, apparently
813 */
814#line 56 "cscanner.l"
815/*
816** based on original C lexer by Nate Osgood
817** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993
818**
819*/
820
821# include "lclintMacros.nf"
822# include "basic.h"
823
824# ifdef SANITIZER
825# include "sgrammar.h"
826# include "sgrammar_tokens.h"
827# else
828# include "cgrammar.h"
829# include "cgrammar_tokens.h"
830# endif
831
832# include "fileIdList.h"
833# include "portab.h"
834
835# if defined(OS2) && defined(__IBMC__)
836 /* needed for isatty()... */
837# include <io.h>
838# endif
839
840static bool lastWasString = FALSE;
841static char savechar = '\0';
842
843/*@notfunction@*/
844# define yyinput() (incColumn (), getc (yyin))
845
846/*@-noparams@*/
847/*@-incondefs@*/
848extern /*@external@*/ int read ();
849/*@=incondefs@*/
850/*@=noparams@*/
851
852static /*@owned@*/ cstring lastidprocessed = cstring_undefined;
853
854static int lminput (void);
855static int tokLength = 0;
856static bool inSpecPart = FALSE;
857static bool continueLine = FALSE;
858
859static int ninput (void);
860static char processChar (void);
861static double processFloat (void);
862static /*@only@*/ exprNode processString (void);
863static long processDec (void);
864static long processHex (void);
885824d3 865static int processIdentifier (/*@only@*/ cstring)
866 /*@globals undef lastidprocessed@*/ ;
867static bool processHashIdentifier (/*@only@*/ cstring)
868 /*@globals undef lastidprocessed@*/ ;
869
870static int processSpec (int);
871static bool handleSpecial (char *);
872static int handleLlSpecial (void);
873static void handleMacro (void);
874static bool processMacro (void);
875static /*@only@*/ cstring makeIdentifier (char *);
876
877/* yes, this is exported! */
878bool g_expectingTypeName = TRUE; /* beginning of file can be type name! */
879
880static int returnInt (ctype, long);
881static int returnFloat (ctype, double);
882static int returnChar (char);
883static void setTokLength (int) /*@modifies g_currentloc@*/ ;
884static void setTokLengthT (size_t) /*@modifies g_currentloc@*/ ;
885
886static void advanceLine (void)
887{
888 tokLength = 0;
889 beginLine ();
890}
891
892/*@-allmacros@*/
893# define RETURN_INT(c,i) \
894 do { lastWasString = FALSE; \
895 return (returnInt (c, i)); } while (FALSE)
896
897# define RETURN_FLOAT(c,f) \
898 do { lastWasString = FALSE; \
899 return (returnFloat (c, f)); \
900 } while (FALSE)
901
902# define RETURN_CHAR(c) \
903 do { lastWasString = FALSE; \
904 return (returnChar (c)); \
905 } while (FALSE)
906
907# define RETURN_TOK(t) \
908 do { yylval.tok = lltok_create (t, fileloc_decColumn (g_currentloc, tokLength)); \
909 tokLength = 0; \
910 lastWasString = FALSE; \
911 return (t); } while (FALSE)
912
913# define RETURN_TYPE(t, ct) \
914 do { yylval.ctyp = ct; tokLength = 0; return (t); } while (FALSE)
915
916/* don't fileloc_decColumn (g_currentloc, tokLength));
917 the string could have \n's in it!
918*/
919
920# define RETURN_STRING(c) \
921 do { yylval.expr = exprNode_stringLiteral (c, fileloc_decColumn (g_currentloc, tokLength)); \
922 tokLength = 0; \
923 lastWasString = TRUE; \
924 return (CCONSTANT); } while (FALSE)
925
926# define RETURN_EXPR(e) \
927 do { yylval.expr = e; \
928 tokLength = 0; \
929 lastWasString = TRUE; \
930 return (CCONSTANT); } while (FALSE)
931
932/*@=allmacros@*/
933
934static void setTokLength (int len)
935{
936 addColumn (len);
937 tokLength = len;
938}
939
940static void setTokLengthT (size_t len)
941{
942 setTokLength (size_toInt (len));
943}
944
945# include "flex.head"
1ac6313d 946#line 864 "lex.yy.c"
885824d3 947
948/* Macros after this point can all be overridden by user definitions in
949 * section 1.
950 */
951
952#ifndef YY_SKIP_YYWRAP
953#ifdef __cplusplus
954extern "C" int yywrap YY_PROTO(( void ));
955#else
956extern int yywrap YY_PROTO(( void ));
957#endif
958#endif
959
960#ifndef YY_NO_UNPUT
961static void yyunput YY_PROTO(( int c, char *buf_ptr ));
962#endif
963
964#ifndef yytext_ptr
965static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
966#endif
967
968#ifdef YY_NEED_STRLEN
969static int yy_flex_strlen YY_PROTO(( yyconst char * ));
970#endif
971
972#ifndef YY_NO_INPUT
973#ifdef __cplusplus
974static int yyinput YY_PROTO(( void ));
975#else
976static int input YY_PROTO(( void ));
977#endif
978#endif
979
980#if YY_STACK_USED
981static int yy_start_stack_ptr = 0;
982static int yy_start_stack_depth = 0;
983static int *yy_start_stack = 0;
984#ifndef YY_NO_PUSH_STATE
985static void yy_push_state YY_PROTO(( int new_state ));
986#endif
987#ifndef YY_NO_POP_STATE
988static void yy_pop_state YY_PROTO(( void ));
989#endif
990#ifndef YY_NO_TOP_STATE
991static int yy_top_state YY_PROTO(( void ));
992#endif
993
994#else
995#define YY_NO_PUSH_STATE 1
996#define YY_NO_POP_STATE 1
997#define YY_NO_TOP_STATE 1
998#endif
999
1000#ifdef YY_MALLOC_DECL
1001YY_MALLOC_DECL
1002#else
1003#if __STDC__
1004#ifndef __cplusplus
1005#include <stdlib.h>
1006#endif
1007#else
1008/* Just try to get by without declaring the routines. This will fail
1009 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
1010 * or sizeof(void*) != sizeof(int).
1011 */
1012#endif
1013#endif
1014
1015/* Amount of stuff to slurp up with each read. */
1016#ifndef YY_READ_BUF_SIZE
1017#define YY_READ_BUF_SIZE 8192
1018#endif
1019
1020/* Copy whatever the last rule matched to the standard output. */
1021
1022#ifndef ECHO
1023/* This used to be an fputs(), but since the string might contain NUL's,
1024 * we now use fwrite().
1025 */
1026#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1027#endif
1028
1029/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1030 * is returned in "result".
1031 */
1032#ifndef YY_INPUT
1033#define YY_INPUT(buf,result,max_size) \
1034 if ( yy_current_buffer->yy_is_interactive ) \
1035 { \
1036 int c = '*', n; \
1037 for ( n = 0; n < max_size && \
1038 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1039 buf[n] = (char) c; \
1040 if ( c == '\n' ) \
1041 buf[n++] = (char) c; \
1042 if ( c == EOF && ferror( yyin ) ) \
1043 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1044 result = n; \
1045 } \
1046 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
1047 && ferror( yyin ) ) \
1048 YY_FATAL_ERROR( "input in flex scanner failed" );
1049#endif
1050
1051/* No semi-colon after return; correct usage is to write "yyterminate();" -
1052 * we don't want an extra ';' after the "return" because that will cause
1053 * some compilers to complain about unreachable statements.
1054 */
1055#ifndef yyterminate
1056#define yyterminate() return YY_NULL
1057#endif
1058
1059/* Number of entries by which start-condition stack grows. */
1060#ifndef YY_START_STACK_INCR
1061#define YY_START_STACK_INCR 25
1062#endif
1063
1064/* Report a fatal error. */
1065#ifndef YY_FATAL_ERROR
1066#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1067#endif
1068
1069/* Default declaration of generated scanner - a define so the user can
1070 * easily add parameters.
1071 */
1072#ifndef YY_DECL
1073#define YY_DECL int yylex YY_PROTO(( void ))
1074#endif
1075
1076/* Code executed at the beginning of each rule, after yytext and yyleng
1077 * have been set up.
1078 */
1079#ifndef YY_USER_ACTION
1080#define YY_USER_ACTION
1081#endif
1082
1083/* Code executed at the end of each rule. */
1084#ifndef YY_BREAK
1085#define YY_BREAK break;
1086#endif
1087
1088#define YY_RULE_SETUP \
1089 YY_USER_ACTION
1090
1091YY_DECL
1092 {
1093 register yy_state_type yy_current_state;
1094 register char *yy_cp, *yy_bp;
1095 register int yy_act;
1096
1ac6313d 1097#line 189 "cscanner.l"
885824d3 1098
1099
1ac6313d 1100#line 1018 "lex.yy.c"
885824d3 1101
1102 if ( yy_init )
1103 {
1104 yy_init = 0;
1105
1106#ifdef YY_USER_INIT
1107 YY_USER_INIT;
1108#endif
1109
1110 if ( ! yy_start )
1111 yy_start = 1; /* first start state */
1112
1113 if ( ! yyin )
1114 yyin = stdin;
1115
1116 if ( ! yyout )
1117 yyout = stdout;
1118
1119 if ( ! yy_current_buffer )
1120 yy_current_buffer =
1121 yy_create_buffer( yyin, YY_BUF_SIZE );
1122
1123 yy_load_buffer_state();
1124 }
1125
1126 while ( 1 ) /* loops until end-of-file is reached */
1127 {
1128 yy_cp = yy_c_buf_p;
1129
1130 /* Support of yytext. */
1131 *yy_cp = yy_hold_char;
1132
1133 /* yy_bp points to the position in yy_ch_buf of the start of
1134 * the current run.
1135 */
1136 yy_bp = yy_cp;
1137
1138 yy_current_state = yy_start;
1139yy_match:
1140 do
1141 {
1142 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1143 if ( yy_accept[yy_current_state] )
1144 {
1145 yy_last_accepting_state = yy_current_state;
1146 yy_last_accepting_cpos = yy_cp;
1147 }
1148 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1149 {
1150 yy_current_state = (int) yy_def[yy_current_state];
1ac6313d 1151 if ( yy_current_state >= 500 )
885824d3 1152 yy_c = yy_meta[(unsigned int) yy_c];
1153 }
1154 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1155 ++yy_cp;
1156 }
1ac6313d 1157 while ( yy_base[yy_current_state] != 642 );
885824d3 1158
1159yy_find_action:
1160 yy_act = yy_accept[yy_current_state];
1161 if ( yy_act == 0 )
1162 { /* have to back up */
1163 yy_cp = yy_last_accepting_cpos;
1164 yy_current_state = yy_last_accepting_state;
1165 yy_act = yy_accept[yy_current_state];
1166 }
1167
1168 YY_DO_BEFORE_ACTION;
1169
1170
1171do_action: /* This label is used only to access EOF actions. */
1172
1173
1174 switch ( yy_act )
1175 { /* beginning of action switch */
1176 case 0: /* must back up */
1177 /* undo the effects of YY_DO_BEFORE_ACTION */
1178 *yy_cp = yy_hold_char;
1179 yy_cp = yy_last_accepting_cpos;
1180 yy_current_state = yy_last_accepting_state;
1181 goto yy_find_action;
1182
1183case 1:
1184YY_RULE_SETUP
1ac6313d 1185#line 191 "cscanner.l"
885824d3 1186{ llfatalbug (cstring_makeLiteral ("Comment in pre-processor output")); }
1187 YY_BREAK
1188case 2:
1189YY_RULE_SETUP
1ac6313d 1190#line 193 "cscanner.l"
885824d3 1191{
1192 context_saveLocation ();
1193 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1194
1195 if (processHashIdentifier (makeIdentifier (yytext + 1)))
1196 {
1197 if (lastWasString)
1198 {
1199 ;
1200 }
1201 else
1202 {
1203 RETURN_STRING (cstring_makeLiteral ("\"\""));
1204 }
1205 }
1206 else
1207 {
1208 if (handleSpecial (yytext))
1209 {
1210 setTokLength (1);
1211 RETURN_TOK (0);
1212 }
1213 }
1214 }
1215 YY_BREAK
1216case 3:
1217YY_RULE_SETUP
1ac6313d 1218#line 217 "cscanner.l"
885824d3 1219{ if (handleSpecial (yytext))
1220 {
1221 setTokLength (1); RETURN_TOK (0);
1222 }
1223 }
1224 YY_BREAK
1225case 4:
1226YY_RULE_SETUP
1ac6313d 1227#line 222 "cscanner.l"
885824d3 1228{ setTokLength (3); RETURN_TOK (CTOK_ELIPSIS); }
1229 YY_BREAK
1230case 5:
1231YY_RULE_SETUP
1ac6313d 1232#line 223 "cscanner.l"
885824d3 1233{ setTokLength (5); RETURN_TOK (BREAK); }
1234 YY_BREAK
1235case 6:
1236YY_RULE_SETUP
1ac6313d 1237#line 224 "cscanner.l"
885824d3 1238{ setTokLength (4); RETURN_TOK (CASE); }
1239 YY_BREAK
1240case 7:
1241YY_RULE_SETUP
1ac6313d 1242#line 225 "cscanner.l"
885824d3 1243{ setTokLength (8); RETURN_TOK (CONTINUE); }
1244 YY_BREAK
1245case 8:
1246YY_RULE_SETUP
1ac6313d 1247#line 226 "cscanner.l"
885824d3 1248{ setTokLength (7); RETURN_TOK (DEFAULT); }
1249 YY_BREAK
1250case 9:
1251YY_RULE_SETUP
1ac6313d 1252#line 227 "cscanner.l"
885824d3 1253{ setTokLength (2); RETURN_TOK (DO); }
1254 YY_BREAK
1255case 10:
1256YY_RULE_SETUP
1ac6313d 1257#line 228 "cscanner.l"
885824d3 1258{ setTokLength (4); RETURN_TOK (CELSE); }
1259 YY_BREAK
1260case 11:
1261YY_RULE_SETUP
1ac6313d 1262#line 229 "cscanner.l"
885824d3 1263{ setTokLength (3); RETURN_TOK (CFOR); }
1264 YY_BREAK
1265case 12:
1266YY_RULE_SETUP
1ac6313d 1267#line 230 "cscanner.l"
885824d3 1268{ setTokLength (4); RETURN_TOK (GOTO); }
1269 YY_BREAK
1270case 13:
1271YY_RULE_SETUP
1ac6313d 1272#line 231 "cscanner.l"
885824d3 1273{ setTokLength (2); RETURN_TOK (CIF); }
1274 YY_BREAK
1275case 14:
1276YY_RULE_SETUP
1ac6313d 1277#line 232 "cscanner.l"
885824d3 1278{ setTokLength (6); RETURN_TOK (RETURN); }
1279 YY_BREAK
1280case 15:
1281YY_RULE_SETUP
1ac6313d 1282#line 233 "cscanner.l"
885824d3 1283{ setTokLength (6); RETURN_TOK (CSIZEOF); }
1284 YY_BREAK
1285case 16:
1286YY_RULE_SETUP
1ac6313d 1287#line 234 "cscanner.l"
885824d3 1288{ setTokLength (8); RETURN_TOK (COFFSETOF); }
1289 YY_BREAK
1290case 17:
1291YY_RULE_SETUP
1ac6313d 1292#line 235 "cscanner.l"
885824d3 1293{ setTokLength (6); RETURN_TOK (SWITCH); }
1294 YY_BREAK
1295case 18:
1296YY_RULE_SETUP
1ac6313d 1297#line 236 "cscanner.l"
885824d3 1298{ setTokLength (5); RETURN_TOK (WHILE); }
1299 YY_BREAK
1300case 19:
1301YY_RULE_SETUP
1ac6313d 1302#line 237 "cscanner.l"
885824d3 1303{ setTokLength (6); RETURN_TOK (VA_ARG); }
1304 YY_BREAK
1305case 20:
1306YY_RULE_SETUP
1ac6313d 1307#line 238 "cscanner.l"
885824d3 1308{ setTokLength (6); RETURN_TOK (VA_DCL); }
1309 YY_BREAK
1310case 21:
1311YY_RULE_SETUP
1ac6313d 1312#line 239 "cscanner.l"
885824d3 1313{
1314 /* gcc extension...this might not be appropriate */
1315 setTokLength (6); RETURN_TOK (QINLINE); }
1316 YY_BREAK
1317case 22:
1318YY_RULE_SETUP
1ac6313d 1319#line 243 "cscanner.l"
885824d3 1320{ setTokLength (6); RETURN_TOK (CSTRUCT); }
1321 YY_BREAK
1322case 23:
1323YY_RULE_SETUP
1ac6313d 1324#line 244 "cscanner.l"
885824d3 1325{ setTokLength (7); RETURN_TOK (CTYPEDEF); }
1326 YY_BREAK
1327case 24:
1328YY_RULE_SETUP
1ac6313d 1329#line 246 "cscanner.l"
885824d3 1330{ setTokLength (5); RETURN_TOK (CUNION); }
1331 YY_BREAK
1332case 25:
1333YY_RULE_SETUP
1ac6313d 1334#line 247 "cscanner.l"
885824d3 1335{ setTokLength (4); RETURN_TOK (CENUM); }
1336 YY_BREAK
1337case 26:
1338YY_RULE_SETUP
1ac6313d 1339#line 249 "cscanner.l"
885824d3 1340{ setTokLength (4); RETURN_TYPE (CVOID, ctype_void); }
1341 YY_BREAK
1342case 27:
1343YY_RULE_SETUP
1ac6313d 1344#line 250 "cscanner.l"
885824d3 1345{ setTokLength (3); RETURN_TYPE (CINT, ctype_int); }
1346 YY_BREAK
1347case 28:
1348YY_RULE_SETUP
1ac6313d 1349#line 251 "cscanner.l"
885824d3 1350{ setTokLength (6); RETURN_TYPE (CDOUBLE, ctype_double); }
1351 YY_BREAK
1352case 29:
1353YY_RULE_SETUP
1ac6313d 1354#line 252 "cscanner.l"
885824d3 1355{ setTokLength (4); RETURN_TYPE (CGCHAR, ctype_char); }
1356 YY_BREAK
1357case 30:
1358YY_RULE_SETUP
1ac6313d 1359#line 253 "cscanner.l"
885824d3 1360{ setTokLength (5); RETURN_TYPE (CGFLOAT, ctype_float); }
1361 YY_BREAK
1362case 31:
1363YY_RULE_SETUP
1ac6313d 1364#line 255 "cscanner.l"
885824d3 1365{ setTokLength (4); RETURN_TOK (QLONG); }
1366 YY_BREAK
1367case 32:
1368YY_RULE_SETUP
1ac6313d 1369#line 256 "cscanner.l"
885824d3 1370{ setTokLength (5); RETURN_TOK (QSHORT); }
1371 YY_BREAK
1372case 33:
1373YY_RULE_SETUP
1ac6313d 1374#line 257 "cscanner.l"
885824d3 1375{ setTokLength (8); RETURN_TOK (QUNSIGNED); }
1376 YY_BREAK
1377case 34:
1378YY_RULE_SETUP
1ac6313d 1379#line 258 "cscanner.l"
885824d3 1380{ setTokLength (6); RETURN_TOK (QSIGNED); }
1381 YY_BREAK
1382case 35:
1383YY_RULE_SETUP
1ac6313d 1384#line 260 "cscanner.l"
885824d3 1385{ setTokLength (8); RETURN_TOK (QVOLATILE); }
1386 YY_BREAK
1387case 36:
1388YY_RULE_SETUP
1ac6313d 1389#line 261 "cscanner.l"
885824d3 1390{ setTokLength (5); RETURN_TOK (QCONST); }
1391 YY_BREAK
1392/* some systems expect this! [gack!] */
1393case 37:
1394YY_RULE_SETUP
1ac6313d 1395#line 264 "cscanner.l"
885824d3 1396{ setTokLength (7); RETURN_TOK (QCONST); }
1397 YY_BREAK
1398case 38:
1399YY_RULE_SETUP
1ac6313d 1400#line 266 "cscanner.l"
885824d3 1401{ setTokLength (6); RETURN_TOK (QEXTERN); }
1402 YY_BREAK
1403case 39:
1404YY_RULE_SETUP
1ac6313d 1405#line 267 "cscanner.l"
885824d3 1406{ setTokLength (4); RETURN_TOK (QAUTO); }
1407 YY_BREAK
1408case 40:
1409YY_RULE_SETUP
1ac6313d 1410#line 268 "cscanner.l"
885824d3 1411{ setTokLength (8); RETURN_TOK (QREGISTER); }
1412 YY_BREAK
1413case 41:
1414YY_RULE_SETUP
1ac6313d 1415#line 269 "cscanner.l"
885824d3 1416{ setTokLength (6); RETURN_TOK (QSTATIC); }
1417 YY_BREAK
1418case 42:
1419YY_RULE_SETUP
1ac6313d 1420#line 271 "cscanner.l"
885824d3 1421{ RETURN_EXPR (processString ()); }
1422 YY_BREAK
1423case 43:
1424YY_RULE_SETUP
1ac6313d 1425#line 272 "cscanner.l"
885824d3 1426{ return (processSpec (QOUT)); }
1427 YY_BREAK
1428case 44:
1429YY_RULE_SETUP
1ac6313d 1430#line 273 "cscanner.l"
885824d3 1431{ return (processSpec (QIN)); }
1432 YY_BREAK
1433case 45:
1434YY_RULE_SETUP
1ac6313d 1435#line 274 "cscanner.l"
885824d3 1436{ return (processSpec (QPARTIAL)); }
1437 YY_BREAK
1438case 46:
1439YY_RULE_SETUP
1ac6313d 1440#line 275 "cscanner.l"
885824d3 1441{ return (processSpec (QSPECIAL)); }
1442 YY_BREAK
1443case 47:
1444YY_RULE_SETUP
1ac6313d 1445#line 276 "cscanner.l"
885824d3 1446{ return (processSpec (QANYTYPE)); }
1447 YY_BREAK
1448case 48:
1449YY_RULE_SETUP
1ac6313d 1450#line 277 "cscanner.l"
885824d3 1451{ return (processSpec (QINTEGRALTYPE)); }
1452 YY_BREAK
1453case 49:
1454YY_RULE_SETUP
1ac6313d 1455#line 278 "cscanner.l"
885824d3 1456{ return (processSpec (QUNSIGNEDINTEGRALTYPE)); }
1457 YY_BREAK
1458case 50:
1459YY_RULE_SETUP
1ac6313d 1460#line 279 "cscanner.l"
885824d3 1461{ return (processSpec (QSIGNEDINTEGRALTYPE)); }
1462 YY_BREAK
1463case 51:
1464YY_RULE_SETUP
1ac6313d 1465#line 280 "cscanner.l"
885824d3 1466{ return (processSpec (QKEEP)); }
1467 YY_BREAK
1468case 52:
1469YY_RULE_SETUP
1ac6313d 1470#line 281 "cscanner.l"
885824d3 1471{ return (processSpec (QNULL)); }
1472 YY_BREAK
1473case 53:
1474YY_RULE_SETUP
1ac6313d 1475#line 282 "cscanner.l"
885824d3 1476{ return (processSpec (QNOTNULL)); }
1477 YY_BREAK
1478case 54:
1479YY_RULE_SETUP
1ac6313d 1480#line 283 "cscanner.l"
885824d3 1481{ return (processSpec (QISNULL)); }
1482 YY_BREAK
1483case 55:
1484YY_RULE_SETUP
1ac6313d 1485#line 284 "cscanner.l"
885824d3 1486{ return (processSpec (QTRUENULL)); }
1487 YY_BREAK
1488case 56:
1489YY_RULE_SETUP
1ac6313d 1490#line 285 "cscanner.l"
885824d3 1491{ return (processSpec (QFALSENULL)); }
1492 YY_BREAK
1493case 57:
1494YY_RULE_SETUP
1ac6313d 1495#line 286 "cscanner.l"
885824d3 1496{ return (processSpec (QRELNULL)); }
1497 YY_BREAK
1498case 58:
1499YY_RULE_SETUP
1ac6313d 1500#line 287 "cscanner.l"
885824d3 1501{ return (processSpec (QRELDEF)); }
1502 YY_BREAK
1503case 59:
1504YY_RULE_SETUP
1ac6313d 1505#line 288 "cscanner.l"
885824d3 1506{ return (processSpec (QEXPOSED)); }
1507 YY_BREAK
1508case 60:
1509YY_RULE_SETUP
1ac6313d 1510#line 289 "cscanner.l"
885824d3 1511{ return (processSpec (QNEWREF)); }
1512 YY_BREAK
1513case 61:
1514YY_RULE_SETUP
1ac6313d 1515#line 290 "cscanner.l"
885824d3 1516{ return (processSpec (QTEMPREF)); }
1517 YY_BREAK
1518case 62:
1519YY_RULE_SETUP
1ac6313d 1520#line 291 "cscanner.l"
885824d3 1521{ return (processSpec (QKILLREF)); }
1522 YY_BREAK
1523case 63:
1524YY_RULE_SETUP
1ac6313d 1525#line 292 "cscanner.l"
885824d3 1526{ return (processSpec (QREFCOUNTED)); }
1527 YY_BREAK
1528case 64:
1529YY_RULE_SETUP
1ac6313d 1530#line 293 "cscanner.l"
885824d3 1531{ return (processSpec (QCHECKED)); }
1532 YY_BREAK
1533case 65:
1534YY_RULE_SETUP
1ac6313d 1535#line 294 "cscanner.l"
885824d3 1536{ return (processSpec (QCHECKMOD)); }
1537 YY_BREAK
1538case 66:
1539YY_RULE_SETUP
1ac6313d 1540#line 295 "cscanner.l"
885824d3 1541{ return (processSpec (QCHECKEDSTRICT)); }
1542 YY_BREAK
1543case 67:
1544YY_RULE_SETUP
1ac6313d 1545#line 296 "cscanner.l"
885824d3 1546{ return (processSpec (QUNCHECKED)); }
1547 YY_BREAK
1548case 68:
1549YY_RULE_SETUP
1ac6313d 1550#line 297 "cscanner.l"
885824d3 1551{ return (processSpec (QONLY)); }
1552 YY_BREAK
1553case 69:
1554YY_RULE_SETUP
1ac6313d 1555#line 298 "cscanner.l"
885824d3 1556{ return (processSpec (QOWNED)); }
1557 YY_BREAK
1558case 70:
1559YY_RULE_SETUP
1ac6313d 1560#line 299 "cscanner.l"
885824d3 1561{ return (processSpec (QOBSERVER)); }
1562 YY_BREAK
1563case 71:
1564YY_RULE_SETUP
1ac6313d 1565#line 300 "cscanner.l"
885824d3 1566{ return (processSpec (QDEPENDENT)); }
1567 YY_BREAK
1568case 72:
1569YY_RULE_SETUP
1ac6313d 1570#line 301 "cscanner.l"
885824d3 1571{ return (processSpec (QUNUSED)); }
1572 YY_BREAK
1573case 73:
1574YY_RULE_SETUP
1ac6313d 1575#line 302 "cscanner.l"
885824d3 1576{ return (processSpec (QEXTERNAL)); }
1577 YY_BREAK
1578case 74:
1579YY_RULE_SETUP
1ac6313d 1580#line 303 "cscanner.l"
885824d3 1581{ return (processSpec (QSEF)); }
1582 YY_BREAK
1583case 75:
1584YY_RULE_SETUP
1ac6313d 1585#line 304 "cscanner.l"
885824d3 1586{ return (processSpec (QSHARED)); }
1587 YY_BREAK
1588case 76:
1589YY_RULE_SETUP
1ac6313d 1590#line 305 "cscanner.l"
885824d3 1591{ return (processSpec (QYIELD)); }
1592 YY_BREAK
1593case 77:
1594YY_RULE_SETUP
1ac6313d 1595#line 306 "cscanner.l"
885824d3 1596{ return (processSpec (QUNDEF)); }
1597 YY_BREAK
1598case 78:
1599YY_RULE_SETUP
1ac6313d 1600#line 307 "cscanner.l"
885824d3 1601{ return (processSpec (QKILLED)); }
1602 YY_BREAK
1603case 79:
1604YY_RULE_SETUP
1ac6313d 1605#line 308 "cscanner.l"
885824d3 1606{ int tok;
1607 context_saveLocation ();
1608 setTokLength (longUnsigned_toInt (mstring_length (yytext)));
1609 tok = processIdentifier (makeIdentifier (yytext));
1610 if (tok != BADTOK)
1611 {
1612 return (tok);
1613 }
1614 }
1615 YY_BREAK
1616case 80:
1617YY_RULE_SETUP
1ac6313d 1618#line 317 "cscanner.l"
885824d3 1619{ setTokLengthT (mstring_length (yytext));
1ac6313d 1620 RETURN_INT (ctype_uint, processHex ());
885824d3 1621 }
1622 YY_BREAK
1623case 81:
1624YY_RULE_SETUP
1ac6313d 1625#line 320 "cscanner.l"
885824d3 1626{ setTokLengthT (mstring_length (yytext));
1627 RETURN_INT (ctype_lint, processHex ()); }
1628 YY_BREAK
1629case 82:
1630YY_RULE_SETUP
1ac6313d 1631#line 322 "cscanner.l"
885824d3 1632{ setTokLengthT (mstring_length (yytext));
1ac6313d 1633 RETURN_INT (ctype_uint, processHex ()); }
885824d3 1634 YY_BREAK
1635case 83:
1636YY_RULE_SETUP
1ac6313d 1637#line 324 "cscanner.l"
885824d3 1638{ setTokLengthT (mstring_length (yytext));
1ac6313d 1639 RETURN_INT (ctype_ulint, processHex ()); }
885824d3 1640 YY_BREAK
1641case 84:
1642YY_RULE_SETUP
1ac6313d 1643#line 326 "cscanner.l"
885824d3 1644{ setTokLengthT (mstring_length (yytext));
1ac6313d 1645 RETURN_INT (ctype_int, processDec ()); }
885824d3 1646 YY_BREAK
1647case 85:
1648YY_RULE_SETUP
1ac6313d 1649#line 328 "cscanner.l"
885824d3 1650{ setTokLengthT (mstring_length (yytext));
1ac6313d 1651 RETURN_INT (ctype_uint, processDec ()); }
885824d3 1652 YY_BREAK
1653case 86:
1654YY_RULE_SETUP
1ac6313d 1655#line 330 "cscanner.l"
885824d3 1656{ setTokLengthT (mstring_length (yytext));
1ac6313d 1657 RETURN_INT (ctype_lint, processDec ()); }
885824d3 1658 YY_BREAK
1659case 87:
1660YY_RULE_SETUP
1ac6313d 1661#line 332 "cscanner.l"
885824d3 1662{ setTokLengthT (mstring_length (yytext));
1ac6313d 1663 RETURN_INT (ctype_ulint, processDec ()); }
885824d3 1664 YY_BREAK
1665case 88:
1666YY_RULE_SETUP
1ac6313d 1667#line 334 "cscanner.l"
885824d3 1668{ setTokLengthT (mstring_length (yytext));
1ac6313d 1669 RETURN_INT (ctype_int, processDec ()); }
885824d3 1670 YY_BREAK
1671case 89:
1672YY_RULE_SETUP
1ac6313d 1673#line 336 "cscanner.l"
885824d3 1674{ setTokLengthT (mstring_length (yytext));
1ac6313d 1675 RETURN_INT (ctype_uint, processDec ()); }
885824d3 1676 YY_BREAK
1677case 90:
1678YY_RULE_SETUP
1ac6313d 1679#line 338 "cscanner.l"
885824d3 1680{ setTokLengthT (mstring_length (yytext));
1ac6313d 1681 RETURN_INT (ctype_lint, processDec ()); }
885824d3 1682 YY_BREAK
1683case 91:
1684YY_RULE_SETUP
1ac6313d 1685#line 340 "cscanner.l"
885824d3 1686{ setTokLengthT (mstring_length (yytext));
1ac6313d 1687 RETURN_INT (ctype_ulint, processDec ()); }
885824d3 1688 YY_BREAK
1689case 92:
1690YY_RULE_SETUP
1ac6313d 1691#line 342 "cscanner.l"
885824d3 1692{ setTokLengthT (mstring_length (yytext));
1ac6313d 1693 RETURN_CHAR (processChar ()); }
885824d3 1694 YY_BREAK
1695case 93:
1696YY_RULE_SETUP
1ac6313d 1697#line 344 "cscanner.l"
885824d3 1698{ setTokLengthT (mstring_length (yytext));
1ac6313d 1699 RETURN_FLOAT (ctype_float, processFloat ()); }
885824d3 1700 YY_BREAK
1701case 94:
1702YY_RULE_SETUP
1ac6313d 1703#line 346 "cscanner.l"
885824d3 1704{ setTokLengthT (mstring_length (yytext));
1ac6313d 1705 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
885824d3 1706 YY_BREAK
1707case 95:
1708YY_RULE_SETUP
1ac6313d 1709#line 348 "cscanner.l"
885824d3 1710{ setTokLengthT (mstring_length (yytext));
1ac6313d 1711 RETURN_FLOAT (ctype_double, processFloat ()); }
885824d3 1712 YY_BREAK
1713case 96:
1714YY_RULE_SETUP
1715#line 351 "cscanner.l"
1716{ setTokLengthT (mstring_length (yytext));
1ac6313d 1717 RETURN_FLOAT (ctype_float, processFloat ()); }
885824d3 1718 YY_BREAK
1719case 97:
1720YY_RULE_SETUP
1721#line 353 "cscanner.l"
1722{ setTokLengthT (mstring_length (yytext));
1ac6313d 1723 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
885824d3 1724 YY_BREAK
1725case 98:
1726YY_RULE_SETUP
1727#line 355 "cscanner.l"
1728{ setTokLengthT (mstring_length (yytext));
1ac6313d 1729 RETURN_FLOAT (ctype_double, processFloat ()); }
885824d3 1730 YY_BREAK
1731case 99:
1732YY_RULE_SETUP
1ac6313d 1733#line 358 "cscanner.l"
885824d3 1734{ setTokLengthT (mstring_length (yytext));
1ac6313d 1735 RETURN_FLOAT (ctype_float, processFloat ()); }
885824d3 1736 YY_BREAK
1737case 100:
1738YY_RULE_SETUP
1ac6313d 1739#line 360 "cscanner.l"
885824d3 1740{ setTokLengthT (mstring_length (yytext));
1ac6313d 1741 RETURN_FLOAT (ctype_ldouble, processFloat ()); }
885824d3 1742 YY_BREAK
1743case 101:
1744YY_RULE_SETUP
1ac6313d 1745#line 362 "cscanner.l"
885824d3 1746{ setTokLengthT (mstring_length (yytext));
1ac6313d 1747 RETURN_FLOAT (ctype_double, processFloat ()); }
885824d3 1748 YY_BREAK
1749case 102:
1750YY_RULE_SETUP
885824d3 1751#line 365 "cscanner.l"
885824d3 1752{ setTokLength (3); RETURN_TOK (RIGHT_ASSIGN); }
1753 YY_BREAK
1ac6313d 1754case 103:
885824d3 1755YY_RULE_SETUP
1ac6313d 1756#line 366 "cscanner.l"
885824d3 1757{ setTokLength (3); RETURN_TOK (LEFT_ASSIGN); }
1758 YY_BREAK
1ac6313d 1759case 104:
885824d3 1760YY_RULE_SETUP
1ac6313d 1761#line 367 "cscanner.l"
885824d3 1762{ setTokLength (2); RETURN_TOK (ADD_ASSIGN); }
1763 YY_BREAK
1ac6313d 1764case 105:
885824d3 1765YY_RULE_SETUP
1ac6313d 1766#line 368 "cscanner.l"
885824d3 1767{ setTokLength (2); RETURN_TOK (SUB_ASSIGN); }
1768 YY_BREAK
1ac6313d 1769case 106:
885824d3 1770YY_RULE_SETUP
1ac6313d 1771#line 369 "cscanner.l"
885824d3 1772{ setTokLength (2); RETURN_TOK (MUL_ASSIGN); }
1773 YY_BREAK
1ac6313d 1774case 107:
885824d3 1775YY_RULE_SETUP
1ac6313d 1776#line 370 "cscanner.l"
885824d3 1777{ setTokLength (2); RETURN_TOK (DIV_ASSIGN); }
1778 YY_BREAK
1ac6313d 1779case 108:
885824d3 1780YY_RULE_SETUP
1ac6313d 1781#line 371 "cscanner.l"
885824d3 1782{ setTokLength (2); RETURN_TOK (MOD_ASSIGN); }
1783 YY_BREAK
1ac6313d 1784case 109:
885824d3 1785YY_RULE_SETUP
1ac6313d 1786#line 372 "cscanner.l"
885824d3 1787{ setTokLength (2); RETURN_TOK (AND_ASSIGN); }
1788 YY_BREAK
1ac6313d 1789case 110:
885824d3 1790YY_RULE_SETUP
1ac6313d 1791#line 373 "cscanner.l"
885824d3 1792{ setTokLength (2); RETURN_TOK (XOR_ASSIGN); }
1793 YY_BREAK
1ac6313d 1794case 111:
885824d3 1795YY_RULE_SETUP
1ac6313d 1796#line 374 "cscanner.l"
885824d3 1797{ setTokLength (2); RETURN_TOK (OR_ASSIGN); }
1798 YY_BREAK
1ac6313d 1799case 112:
885824d3 1800YY_RULE_SETUP
1ac6313d 1801#line 375 "cscanner.l"
885824d3 1802{ setTokLength (2); RETURN_TOK (RIGHT_OP); }
1803 YY_BREAK
1ac6313d 1804case 113:
885824d3 1805YY_RULE_SETUP
1ac6313d 1806#line 376 "cscanner.l"
885824d3 1807{ setTokLength (2); RETURN_TOK (LEFT_OP); }
1808 YY_BREAK
1ac6313d 1809case 114:
885824d3 1810YY_RULE_SETUP
1ac6313d 1811#line 377 "cscanner.l"
885824d3 1812{ setTokLength (2); RETURN_TOK (INC_OP); }
1813 YY_BREAK
1ac6313d 1814case 115:
885824d3 1815YY_RULE_SETUP
1ac6313d 1816#line 378 "cscanner.l"
885824d3 1817{ setTokLength (2); RETURN_TOK (DEC_OP); }
1818 YY_BREAK
1ac6313d 1819case 116:
885824d3 1820YY_RULE_SETUP
1ac6313d 1821#line 379 "cscanner.l"
885824d3 1822{ setTokLength (2); RETURN_TOK (ARROW_OP); }
1823 YY_BREAK
1ac6313d 1824case 117:
885824d3 1825YY_RULE_SETUP
1ac6313d 1826#line 380 "cscanner.l"
885824d3 1827{ setTokLength (2); RETURN_TOK (AND_OP); }
1828 YY_BREAK
1ac6313d 1829case 118:
885824d3 1830YY_RULE_SETUP
1ac6313d 1831#line 381 "cscanner.l"
885824d3 1832{ setTokLength (2); RETURN_TOK (OR_OP); }
1833 YY_BREAK
1ac6313d 1834case 119:
885824d3 1835YY_RULE_SETUP
1ac6313d 1836#line 382 "cscanner.l"
885824d3 1837{ setTokLength (2); RETURN_TOK (LE_OP); }
1838 YY_BREAK
1ac6313d 1839case 120:
885824d3 1840YY_RULE_SETUP
1ac6313d 1841#line 383 "cscanner.l"
885824d3 1842{ setTokLength (2); RETURN_TOK (GE_OP); }
1843 YY_BREAK
1ac6313d 1844case 121:
885824d3 1845YY_RULE_SETUP
1ac6313d 1846#line 384 "cscanner.l"
885824d3 1847{ setTokLength (2); RETURN_TOK (EQ_OP); }
1848 YY_BREAK
1ac6313d 1849case 122:
885824d3 1850YY_RULE_SETUP
1ac6313d 1851#line 385 "cscanner.l"
885824d3 1852{ setTokLength (2); RETURN_TOK (NE_OP); }
1853 YY_BREAK
1ac6313d 1854case 123:
885824d3 1855YY_RULE_SETUP
1ac6313d 1856#line 386 "cscanner.l"
885824d3 1857{ setTokLength (1); RETURN_TOK (TSEMI); }
1858 YY_BREAK
1ac6313d 1859case 124:
885824d3 1860YY_RULE_SETUP
1ac6313d 1861#line 387 "cscanner.l"
885824d3 1862{ setTokLength (1); RETURN_TOK (TLBRACE); }
1863 YY_BREAK
1ac6313d 1864case 125:
885824d3 1865YY_RULE_SETUP
1ac6313d 1866#line 388 "cscanner.l"
885824d3 1867{ setTokLength (1); RETURN_TOK (TRBRACE); }
1868 YY_BREAK
1ac6313d 1869case 126:
885824d3 1870YY_RULE_SETUP
1ac6313d 1871#line 389 "cscanner.l"
885824d3 1872{ setTokLength (1); RETURN_TOK (TCOMMA); }
1873 YY_BREAK
1ac6313d 1874case 127:
885824d3 1875YY_RULE_SETUP
1ac6313d 1876#line 390 "cscanner.l"
885824d3 1877{ setTokLength (1); RETURN_TOK (TCOLON); }
1878 YY_BREAK
1ac6313d 1879case 128:
885824d3 1880YY_RULE_SETUP
1ac6313d 1881#line 391 "cscanner.l"
885824d3 1882{ setTokLength (1); RETURN_TOK (TASSIGN); }
1883 YY_BREAK
1ac6313d 1884case 129:
885824d3 1885YY_RULE_SETUP
1ac6313d 1886#line 392 "cscanner.l"
885824d3 1887{ setTokLength (1); RETURN_TOK (TLPAREN); }
1888 YY_BREAK
1ac6313d 1889case 130:
885824d3 1890YY_RULE_SETUP
1ac6313d 1891#line 393 "cscanner.l"
885824d3 1892{ setTokLength (1); RETURN_TOK (TRPAREN); }
1893 YY_BREAK
1ac6313d 1894case 131:
885824d3 1895YY_RULE_SETUP
1ac6313d 1896#line 394 "cscanner.l"
885824d3 1897{ setTokLength (1); RETURN_TOK (TLSQBR); }
1898 YY_BREAK
1ac6313d 1899case 132:
885824d3 1900YY_RULE_SETUP
1ac6313d 1901#line 395 "cscanner.l"
885824d3 1902{ setTokLength (1); RETURN_TOK (TRSQBR); }
1903 YY_BREAK
1ac6313d 1904case 133:
885824d3 1905YY_RULE_SETUP
1ac6313d 1906#line 396 "cscanner.l"
885824d3 1907{ setTokLength (1); RETURN_TOK (TDOT); }
1908 YY_BREAK
1ac6313d 1909case 134:
885824d3 1910YY_RULE_SETUP
1ac6313d 1911#line 397 "cscanner.l"
885824d3 1912{ setTokLength (1); RETURN_TOK (TAMPERSAND); }
1913 YY_BREAK
1ac6313d 1914case 135:
885824d3 1915YY_RULE_SETUP
1ac6313d 1916#line 398 "cscanner.l"
885824d3 1917{ setTokLength (1); RETURN_TOK (TEXCL); }
1918 YY_BREAK
1ac6313d 1919case 136:
885824d3 1920YY_RULE_SETUP
1ac6313d 1921#line 401 "cscanner.l"
885824d3 1922{ setTokLength (1); RETURN_TOK (TTILDE); }
1923 YY_BREAK
1ac6313d 1924case 137:
885824d3 1925YY_RULE_SETUP
1ac6313d 1926#line 402 "cscanner.l"
885824d3 1927{ setTokLength (1); RETURN_TOK (TMINUS); }
1928 YY_BREAK
1ac6313d 1929case 138:
885824d3 1930YY_RULE_SETUP
1ac6313d 1931#line 403 "cscanner.l"
885824d3 1932{ setTokLength (1); RETURN_TOK (TPLUS); }
1933 YY_BREAK
1ac6313d 1934case 139:
885824d3 1935YY_RULE_SETUP
1ac6313d 1936#line 404 "cscanner.l"
885824d3 1937{ setTokLength (1); RETURN_TOK (TMULT); }
1938 YY_BREAK
1ac6313d 1939case 140:
885824d3 1940YY_RULE_SETUP
1ac6313d 1941#line 405 "cscanner.l"
885824d3 1942{ setTokLength (1); RETURN_TOK (TDIV); }
1943 YY_BREAK
1ac6313d 1944case 141:
885824d3 1945YY_RULE_SETUP
1ac6313d 1946#line 406 "cscanner.l"
885824d3 1947{ setTokLength (1); RETURN_TOK (TPERCENT); }
1948 YY_BREAK
1ac6313d 1949case 142:
885824d3 1950YY_RULE_SETUP
1ac6313d 1951#line 407 "cscanner.l"
885824d3 1952{ setTokLength (1); RETURN_TOK (TLT); }
1953 YY_BREAK
1ac6313d 1954case 143:
885824d3 1955YY_RULE_SETUP
1ac6313d 1956#line 408 "cscanner.l"
885824d3 1957{ setTokLength (1); RETURN_TOK (TGT); }
1958 YY_BREAK
1ac6313d 1959case 144:
885824d3 1960YY_RULE_SETUP
1ac6313d 1961#line 409 "cscanner.l"
885824d3 1962{ setTokLength (1); RETURN_TOK (TCIRC); }
1963 YY_BREAK
1ac6313d 1964case 145:
885824d3 1965YY_RULE_SETUP
1ac6313d 1966#line 410 "cscanner.l"
885824d3 1967{ setTokLength (1); RETURN_TOK (TBAR); }
1968 YY_BREAK
1ac6313d 1969case 146:
885824d3 1970YY_RULE_SETUP
1ac6313d 1971#line 411 "cscanner.l"
885824d3 1972{ setTokLength (1); RETURN_TOK (TQUEST); }
1973 YY_BREAK
1ac6313d 1974case 147:
885824d3 1975YY_RULE_SETUP
1ac6313d 1976#line 413 "cscanner.l"
885824d3 1977{ incColumn (); }
1978 YY_BREAK
1ac6313d 1979case 148:
885824d3 1980YY_RULE_SETUP
1ac6313d 1981#line 414 "cscanner.l"
885824d3 1982{ context_incLineno ();
1983 if (continueLine)
1984 {
1985 continueLine = FALSE;
1986 }
1987 else
1988 {
1989 if (context_inMacro ())
1990 {
1991 /* Don't use RETURN_TOK */
1992 yylval.tok = lltok_create (TENDMACRO, g_currentloc);
1993 lastWasString = FALSE;
1994 return (TENDMACRO);
1995 }
1996 }
1997 }
1998 YY_BREAK
1ac6313d 1999case 149:
885824d3 2000YY_RULE_SETUP
1ac6313d 2001#line 430 "cscanner.l"
885824d3 2002{ setTokLength (6);
2003
2004 if (processMacro ()) {
2005 if (context_inIterDef ())
2006 {
2007 RETURN_TOK (LLMACROITER);
2008 }
2009 if (context_inIterEnd ())
2010 {
2011 RETURN_TOK (LLMACROEND);
2012 }
2013 if (context_inMacro ())
2014 {
2015 RETURN_TOK (LLMACRO);
2016 }
2017 }
2018 }
2019 YY_BREAK
1ac6313d 2020case 150:
885824d3 2021YY_RULE_SETUP
1ac6313d 2022#line 447 "cscanner.l"
885824d3 2023{ if (context_inHeader () || context_inFunction ())
2024 {
2025 handleMacro ();
2026 }
2027 else
2028 {
2029 int nspchar = ninput ();
2030 int nspaces;
2031
2032 /*
2033 ** This is a hack to get the column number correct.
2034 */
2035
2036 llassert (nspchar >= '0' && nspchar <= '9');
2037
2038 nspaces = nspchar - '0';
2039
2040 setTokLength (5 + nspaces);
2041
2042 if (processMacro ())
2043 {
2044 if (context_inIterDef ())
2045 {
2046 RETURN_TOK (LLMACROITER);
2047 }
2048 if (context_inIterEnd ())
2049 {
2050 RETURN_TOK (LLMACROEND);
2051 }
2052 if (context_inMacro ())
2053 {
2054 RETURN_TOK (LLMACRO);
2055 }
2056 }
2057 }
2058 }
2059 YY_BREAK
1ac6313d 2060case 151:
885824d3 2061YY_RULE_SETUP
1ac6313d 2062#line 483 "cscanner.l"
885824d3 2063{ setTokLength (4); lldiagmsg (ctype_unparseTable ()); }
2064 YY_BREAK
1ac6313d 2065case 152:
885824d3 2066YY_RULE_SETUP
1ac6313d 2067#line 484 "cscanner.l"
885824d3 2068{ setTokLength (3);
2069 lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc)));
2070 }
2071 YY_BREAK
1ac6313d 2072case 153:
885824d3 2073YY_RULE_SETUP
1ac6313d 2074#line 487 "cscanner.l"
885824d3 2075{ setTokLength (3); usymtab_printLocal (); }
2076 YY_BREAK
1ac6313d 2077case 154:
885824d3 2078YY_RULE_SETUP
1ac6313d 2079#line 488 "cscanner.l"
885824d3 2080{ setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); }
2081 YY_BREAK
1ac6313d 2082case 155:
885824d3 2083YY_RULE_SETUP
1ac6313d 2084#line 489 "cscanner.l"
885824d3 2085{ setTokLength (3); lldiagmsg (context_unparse ()); }
2086 YY_BREAK
1ac6313d 2087case 156:
885824d3 2088YY_RULE_SETUP
1ac6313d 2089#line 490 "cscanner.l"
885824d3 2090{ setTokLength (3); lldiagmsg (context_unparseClauses ()); }
2091 YY_BREAK
1ac6313d 2092case 157:
885824d3 2093YY_RULE_SETUP
1ac6313d 2094#line 491 "cscanner.l"
885824d3 2095{ setTokLength (3); usymtab_printGuards (); }
2096 YY_BREAK
1ac6313d 2097case 158:
885824d3 2098YY_RULE_SETUP
1ac6313d 2099#line 492 "cscanner.l"
885824d3 2100{ setTokLength (3); usymtab_printOut (); }
2101 YY_BREAK
1ac6313d 2102case 159:
885824d3 2103YY_RULE_SETUP
1ac6313d 2104#line 493 "cscanner.l"
885824d3 2105{ setTokLength (3); usymtab_printAll (); }
2106 YY_BREAK
1ac6313d 2107case 160:
885824d3 2108YY_RULE_SETUP
1ac6313d 2109#line 494 "cscanner.l"
885824d3 2110{ setTokLength (3); usymtab_printComplete (); }
2111 YY_BREAK
1ac6313d 2112case 161:
885824d3 2113YY_RULE_SETUP
1ac6313d 2114#line 495 "cscanner.l"
885824d3 2115{ setTokLength (3); usymtab_printTypes (); }
2116 YY_BREAK
1ac6313d 2117case 162:
885824d3 2118YY_RULE_SETUP
1ac6313d 2119#line 496 "cscanner.l"
885824d3 2120{ setTokLength (3); lldiagmsg (usymtab_unparseStack ()); }
2121 YY_BREAK
1ac6313d 2122case 163:
885824d3 2123YY_RULE_SETUP
1ac6313d 2124#line 497 "cscanner.l"
885824d3 2125{ setTokLength (3);
2126 lldiagmsg (message ("Can modify: %q",
2127 sRefSet_unparse (context_modList ())));
2128 }
2129 YY_BREAK
1ac6313d 2130case 164:
885824d3 2131YY_RULE_SETUP
1ac6313d 2132#line 501 "cscanner.l"
885824d3 2133{ /* BEFORE_COMMENT_MARKER */
2134 int tok;
2135 incColumn (); incColumn ();
2136 tok = handleLlSpecial ();
2137 if (tok != BADTOK)
2138 {
2139 RETURN_TOK (tok);
2140 }
2141 }
2142 YY_BREAK
1ac6313d 2143case 165:
885824d3 2144YY_RULE_SETUP
1ac6313d 2145#line 510 "cscanner.l"
885824d3 2146{ /* AFTER_COMMENT_MARKER */
2147 setTokLength (2);
2148 inSpecPart = FALSE;
2149 RETURN_TOK (QENDMACRO); }
2150 YY_BREAK
1ac6313d 2151case 166:
885824d3 2152YY_RULE_SETUP
1ac6313d 2153#line 514 "cscanner.l"
885824d3 2154{ incColumn (); continueLine = TRUE; }
2155 YY_BREAK
1ac6313d 2156case 167:
885824d3 2157YY_RULE_SETUP
1ac6313d 2158#line 515 "cscanner.l"
885824d3 2159{ incColumn ();
2160 voptgenerror
2161 (FLG_SYNTAX,
2162 message ("Invalid character (ascii: %d), skipping character",
2163 (int)(*yytext)),
2164 g_currentloc);
2165 }
2166 YY_BREAK
1ac6313d 2167case 168:
885824d3 2168YY_RULE_SETUP
1ac6313d 2169#line 522 "cscanner.l"
885824d3 2170ECHO;
2171 YY_BREAK
1ac6313d 2172#line 2090 "lex.yy.c"
885824d3 2173case YY_STATE_EOF(INITIAL):
2174 yyterminate();
2175
2176 case YY_END_OF_BUFFER:
2177 {
2178 /* Amount of text matched not including the EOB char. */
2179 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2180
2181 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2182 *yy_cp = yy_hold_char;
2183 YY_RESTORE_YY_MORE_OFFSET
2184
2185 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2186 {
2187 /* We're scanning a new file or input source. It's
2188 * possible that this happened because the user
2189 * just pointed yyin at a new source and called
2190 * yylex(). If so, then we have to assure
2191 * consistency between yy_current_buffer and our
2192 * globals. Here is the right place to do so, because
2193 * this is the first action (other than possibly a
2194 * back-up) that will match for the new input source.
2195 */
2196 yy_n_chars = yy_current_buffer->yy_n_chars;
2197 yy_current_buffer->yy_input_file = yyin;
2198 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2199 }
2200
2201 /* Note that here we test for yy_c_buf_p "<=" to the position
2202 * of the first EOB in the buffer, since yy_c_buf_p will
2203 * already have been incremented past the NUL character
2204 * (since all states make transitions on EOB to the
2205 * end-of-buffer state). Contrast this with the test
2206 * in input().
2207 */
2208 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2209 { /* This was really a NUL. */
2210 yy_state_type yy_next_state;
2211
2212 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2213
2214 yy_current_state = yy_get_previous_state();
2215
2216 /* Okay, we're now positioned to make the NUL
2217 * transition. We couldn't have
2218 * yy_get_previous_state() go ahead and do it
2219 * for us because it doesn't know how to deal
2220 * with the possibility of jamming (and we don't
2221 * want to build jamming into it because then it
2222 * will run more slowly).
2223 */
2224
2225 yy_next_state = yy_try_NUL_trans( yy_current_state );
2226
2227 yy_bp = yytext_ptr + YY_MORE_ADJ;
2228
2229 if ( yy_next_state )
2230 {
2231 /* Consume the NUL. */
2232 yy_cp = ++yy_c_buf_p;
2233 yy_current_state = yy_next_state;
2234 goto yy_match;
2235 }
2236
2237 else
2238 {
2239 yy_cp = yy_c_buf_p;
2240 goto yy_find_action;
2241 }
2242 }
2243
2244 else switch ( yy_get_next_buffer() )
2245 {
2246 case EOB_ACT_END_OF_FILE:
2247 {
2248 yy_did_buffer_switch_on_eof = 0;
2249
2250 if ( yywrap() )
2251 {
2252 /* Note: because we've taken care in
2253 * yy_get_next_buffer() to have set up
2254 * yytext, we can now set up
2255 * yy_c_buf_p so that if some total
2256 * hoser (like flex itself) wants to
2257 * call the scanner after we return the
2258 * YY_NULL, it'll still work - another
2259 * YY_NULL will get returned.
2260 */
2261 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2262
2263 yy_act = YY_STATE_EOF(YY_START);
2264 goto do_action;
2265 }
2266
2267 else
2268 {
2269 if ( ! yy_did_buffer_switch_on_eof )
2270 YY_NEW_FILE;
2271 }
2272 break;
2273 }
2274
2275 case EOB_ACT_CONTINUE_SCAN:
2276 yy_c_buf_p =
2277 yytext_ptr + yy_amount_of_matched_text;
2278
2279 yy_current_state = yy_get_previous_state();
2280
2281 yy_cp = yy_c_buf_p;
2282 yy_bp = yytext_ptr + YY_MORE_ADJ;
2283 goto yy_match;
2284
2285 case EOB_ACT_LAST_MATCH:
2286 yy_c_buf_p =
2287 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2288
2289 yy_current_state = yy_get_previous_state();
2290
2291 yy_cp = yy_c_buf_p;
2292 yy_bp = yytext_ptr + YY_MORE_ADJ;
2293 goto yy_find_action;
2294 }
2295 break;
2296 }
2297
2298 default:
2299 YY_FATAL_ERROR(
2300 "fatal flex scanner internal error--no action found" );
2301 } /* end of action switch */
2302 } /* end of scanning one token */
2303 } /* end of yylex */
2304
2305
2306/* yy_get_next_buffer - try to read in a new buffer
2307 *
2308 * Returns a code representing an action:
2309 * EOB_ACT_LAST_MATCH -
2310 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2311 * EOB_ACT_END_OF_FILE - end of file
2312 */
2313
2314static int yy_get_next_buffer()
2315 {
2316 register char *dest = yy_current_buffer->yy_ch_buf;
2317 register char *source = yytext_ptr;
2318 register int number_to_move, i;
2319 int ret_val;
2320
2321 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2322 YY_FATAL_ERROR(
2323 "fatal flex scanner internal error--end of buffer missed" );
2324
2325 if ( yy_current_buffer->yy_fill_buffer == 0 )
2326 { /* Don't try to fill the buffer, so this is an EOF. */
2327 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2328 {
2329 /* We matched a single character, the EOB, so
2330 * treat this as a final EOF.
2331 */
2332 return EOB_ACT_END_OF_FILE;
2333 }
2334
2335 else
2336 {
2337 /* We matched some text prior to the EOB, first
2338 * process it.
2339 */
2340 return EOB_ACT_LAST_MATCH;
2341 }
2342 }
2343
2344 /* Try to read more data. */
2345
2346 /* First move last chars to start of buffer. */
2347 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2348
2349 for ( i = 0; i < number_to_move; ++i )
2350 *(dest++) = *(source++);
2351
2352 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2353 /* don't do the read, it's not guaranteed to return an EOF,
2354 * just force an EOF
2355 */
2356 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2357
2358 else
2359 {
2360 int num_to_read =
2361 yy_current_buffer->yy_buf_size - number_to_move - 1;
2362
2363 while ( num_to_read <= 0 )
2364 { /* Not enough room in the buffer - grow it. */
2365#ifdef YY_USES_REJECT
2366 YY_FATAL_ERROR(
2367"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2368#else
2369
2370 /* just a shorter name for the current buffer */
2371 YY_BUFFER_STATE b = yy_current_buffer;
2372
2373 int yy_c_buf_p_offset =
2374 (int) (yy_c_buf_p - b->yy_ch_buf);
2375
2376 if ( b->yy_is_our_buffer )
2377 {
2378 int new_size = b->yy_buf_size * 2;
2379
2380 if ( new_size <= 0 )
2381 b->yy_buf_size += b->yy_buf_size / 8;
2382 else
2383 b->yy_buf_size *= 2;
2384
2385 b->yy_ch_buf = (char *)
2386 /* Include room in for 2 EOB chars. */
2387 yy_flex_realloc( (void *) b->yy_ch_buf,
2388 b->yy_buf_size + 2 );
2389 }
2390 else
2391 /* Can't grow it, we don't own it. */
2392 b->yy_ch_buf = 0;
2393
2394 if ( ! b->yy_ch_buf )
2395 YY_FATAL_ERROR(
2396 "fatal error - scanner input buffer overflow" );
2397
2398 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2399
2400 num_to_read = yy_current_buffer->yy_buf_size -
2401 number_to_move - 1;
2402#endif
2403 }
2404
2405 if ( num_to_read > YY_READ_BUF_SIZE )
2406 num_to_read = YY_READ_BUF_SIZE;
2407
2408 /* Read in more data. */
2409 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2410 yy_n_chars, num_to_read );
2411
2412 yy_current_buffer->yy_n_chars = yy_n_chars;
2413 }
2414
2415 if ( yy_n_chars == 0 )
2416 {
2417 if ( number_to_move == YY_MORE_ADJ )
2418 {
2419 ret_val = EOB_ACT_END_OF_FILE;
2420 yyrestart( yyin );
2421 }
2422
2423 else
2424 {
2425 ret_val = EOB_ACT_LAST_MATCH;
2426 yy_current_buffer->yy_buffer_status =
2427 YY_BUFFER_EOF_PENDING;
2428 }
2429 }
2430
2431 else
2432 ret_val = EOB_ACT_CONTINUE_SCAN;
2433
2434 yy_n_chars += number_to_move;
2435 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2436 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2437
2438 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2439
2440 return ret_val;
2441 }
2442
2443
2444/* yy_get_previous_state - get the state just before the EOB char was reached */
2445
2446static yy_state_type yy_get_previous_state()
2447 {
2448 register yy_state_type yy_current_state;
2449 register char *yy_cp;
2450
2451 yy_current_state = yy_start;
2452
2453 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2454 {
2455 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2456 if ( yy_accept[yy_current_state] )
2457 {
2458 yy_last_accepting_state = yy_current_state;
2459 yy_last_accepting_cpos = yy_cp;
2460 }
2461 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2462 {
2463 yy_current_state = (int) yy_def[yy_current_state];
1ac6313d 2464 if ( yy_current_state >= 500 )
885824d3 2465 yy_c = yy_meta[(unsigned int) yy_c];
2466 }
2467 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2468 }
2469
2470 return yy_current_state;
2471 }
2472
2473
2474/* yy_try_NUL_trans - try to make a transition on the NUL character
2475 *
2476 * synopsis
2477 * next_state = yy_try_NUL_trans( current_state );
2478 */
2479
2480#ifdef YY_USE_PROTOS
2481static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2482#else
2483static yy_state_type yy_try_NUL_trans( yy_current_state )
2484yy_state_type yy_current_state;
2485#endif
2486 {
2487 register int yy_is_jam;
2488 register char *yy_cp = yy_c_buf_p;
2489
2490 register YY_CHAR yy_c = 1;
2491 if ( yy_accept[yy_current_state] )
2492 {
2493 yy_last_accepting_state = yy_current_state;
2494 yy_last_accepting_cpos = yy_cp;
2495 }
2496 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2497 {
2498 yy_current_state = (int) yy_def[yy_current_state];
1ac6313d 2499 if ( yy_current_state >= 500 )
885824d3 2500 yy_c = yy_meta[(unsigned int) yy_c];
2501 }
2502 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1ac6313d 2503 yy_is_jam = (yy_current_state == 499);
885824d3 2504
2505 return yy_is_jam ? 0 : yy_current_state;
2506 }
2507
2508
2509#ifndef YY_NO_UNPUT
2510#ifdef YY_USE_PROTOS
2511static void yyunput( int c, register char *yy_bp )
2512#else
2513static void yyunput( c, yy_bp )
2514int c;
2515register char *yy_bp;
2516#endif
2517 {
2518 register char *yy_cp = yy_c_buf_p;
2519
2520 /* undo effects of setting up yytext */
2521 *yy_cp = yy_hold_char;
2522
2523 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2524 { /* need to shift things up to make room */
2525 /* +2 for EOB chars. */
2526 register int number_to_move = yy_n_chars + 2;
2527 register char *dest = &yy_current_buffer->yy_ch_buf[
2528 yy_current_buffer->yy_buf_size + 2];
2529 register char *source =
2530 &yy_current_buffer->yy_ch_buf[number_to_move];
2531
2532 while ( source > yy_current_buffer->yy_ch_buf )
2533 *--dest = *--source;
2534
2535 yy_cp += (int) (dest - source);
2536 yy_bp += (int) (dest - source);
2537 yy_current_buffer->yy_n_chars =
2538 yy_n_chars = yy_current_buffer->yy_buf_size;
2539
2540 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2541 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2542 }
2543
2544 *--yy_cp = (char) c;
2545
2546
2547 yytext_ptr = yy_bp;
2548 yy_hold_char = *yy_cp;
2549 yy_c_buf_p = yy_cp;
2550 }
2551#endif /* ifndef YY_NO_UNPUT */
2552
2553
2554#ifdef __cplusplus
2555static int yyinput()
2556#else
2557static int input()
2558#endif
2559 {
2560 int c;
2561
2562 *yy_c_buf_p = yy_hold_char;
2563
2564 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2565 {
2566 /* yy_c_buf_p now points to the character we want to return.
2567 * If this occurs *before* the EOB characters, then it's a
2568 * valid NUL; if not, then we've hit the end of the buffer.
2569 */
2570 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2571 /* This was really a NUL. */
2572 *yy_c_buf_p = '\0';
2573
2574 else
2575 { /* need more input */
2576 int offset = yy_c_buf_p - yytext_ptr;
2577 ++yy_c_buf_p;
2578
2579 switch ( yy_get_next_buffer() )
2580 {
2581 case EOB_ACT_LAST_MATCH:
2582 /* This happens because yy_g_n_b()
2583 * sees that we've accumulated a
2584 * token and flags that we need to
2585 * try matching the token before
2586 * proceeding. But for input(),
2587 * there's no matching to consider.
2588 * So convert the EOB_ACT_LAST_MATCH
2589 * to EOB_ACT_END_OF_FILE.
2590 */
2591
2592 /* Reset buffer status. */
2593 yyrestart( yyin );
2594
2595 /* fall through */
2596
2597 case EOB_ACT_END_OF_FILE:
2598 {
2599 if ( yywrap() )
2600 return EOF;
2601
2602 if ( ! yy_did_buffer_switch_on_eof )
2603 YY_NEW_FILE;
2604#ifdef __cplusplus
2605 return yyinput();
2606#else
2607 return input();
2608#endif
2609 }
2610
2611 case EOB_ACT_CONTINUE_SCAN:
2612 yy_c_buf_p = yytext_ptr + offset;
2613 break;
2614 }
2615 }
2616 }
2617
2618 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2619 *yy_c_buf_p = '\0'; /* preserve yytext */
2620 yy_hold_char = *++yy_c_buf_p;
2621
2622
2623 return c;
2624 }
2625
2626
2627#ifdef YY_USE_PROTOS
2628void yyrestart( FILE *input_file )
2629#else
2630void yyrestart( input_file )
2631FILE *input_file;
2632#endif
2633 {
2634 if ( ! yy_current_buffer )
2635 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2636
2637 yy_init_buffer( yy_current_buffer, input_file );
2638 yy_load_buffer_state();
2639 }
2640
2641
2642#ifdef YY_USE_PROTOS
2643void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2644#else
2645void yy_switch_to_buffer( new_buffer )
2646YY_BUFFER_STATE new_buffer;
2647#endif
2648 {
2649 if ( yy_current_buffer == new_buffer )
2650 return;
2651
2652 if ( yy_current_buffer )
2653 {
2654 /* Flush out information for old buffer. */
2655 *yy_c_buf_p = yy_hold_char;
2656 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2657 yy_current_buffer->yy_n_chars = yy_n_chars;
2658 }
2659
2660 yy_current_buffer = new_buffer;
2661 yy_load_buffer_state();
2662
2663 /* We don't actually know whether we did this switch during
2664 * EOF (yywrap()) processing, but the only time this flag
2665 * is looked at is after yywrap() is called, so it's safe
2666 * to go ahead and always set it.
2667 */
2668 yy_did_buffer_switch_on_eof = 1;
2669 }
2670
2671
2672#ifdef YY_USE_PROTOS
2673void yy_load_buffer_state( void )
2674#else
2675void yy_load_buffer_state()
2676#endif
2677 {
2678 yy_n_chars = yy_current_buffer->yy_n_chars;
2679 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2680 yyin = yy_current_buffer->yy_input_file;
2681 yy_hold_char = *yy_c_buf_p;
2682 }
2683
2684
2685#ifdef YY_USE_PROTOS
2686YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2687#else
2688YY_BUFFER_STATE yy_create_buffer( file, size )
2689FILE *file;
2690int size;
2691#endif
2692 {
2693 YY_BUFFER_STATE b;
2694
2695 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2696 if ( ! b )
2697 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2698
2699 b->yy_buf_size = size;
2700
2701 /* yy_ch_buf has to be 2 characters longer than the size given because
2702 * we need to put in 2 end-of-buffer characters.
2703 */
2704 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2705 if ( ! b->yy_ch_buf )
2706 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2707
2708 b->yy_is_our_buffer = 1;
2709
2710 yy_init_buffer( b, file );
2711
2712 return b;
2713 }
2714
2715
2716#ifdef YY_USE_PROTOS
2717void yy_delete_buffer( YY_BUFFER_STATE b )
2718#else
2719void yy_delete_buffer( b )
2720YY_BUFFER_STATE b;
2721#endif
2722 {
2723 if ( ! b )
2724 return;
2725
2726 if ( b == yy_current_buffer )
2727 yy_current_buffer = (YY_BUFFER_STATE) 0;
2728
2729 if ( b->yy_is_our_buffer )
2730 yy_flex_free( (void *) b->yy_ch_buf );
2731
2732 yy_flex_free( (void *) b );
2733 }
2734
2735
2736#ifndef YY_ALWAYS_INTERACTIVE
2737#ifndef YY_NEVER_INTERACTIVE
2738extern int isatty YY_PROTO(( int ));
2739#endif
2740#endif
2741
2742#ifdef YY_USE_PROTOS
2743void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2744#else
2745void yy_init_buffer( b, file )
2746YY_BUFFER_STATE b;
2747FILE *file;
2748#endif
2749
2750
2751 {
2752 yy_flush_buffer( b );
2753
2754 b->yy_input_file = file;
2755 b->yy_fill_buffer = 1;
2756
2757#if YY_ALWAYS_INTERACTIVE
2758 b->yy_is_interactive = 1;
2759#else
2760#if YY_NEVER_INTERACTIVE
2761 b->yy_is_interactive = 0;
2762#else
2763 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2764#endif
2765#endif
2766 }
2767
2768
2769#ifdef YY_USE_PROTOS
2770void yy_flush_buffer( YY_BUFFER_STATE b )
2771#else
2772void yy_flush_buffer( b )
2773YY_BUFFER_STATE b;
2774#endif
2775
2776 {
2777 if ( ! b )
2778 return;
2779
2780 b->yy_n_chars = 0;
2781
2782 /* We always need two end-of-buffer characters. The first causes
2783 * a transition to the end-of-buffer state. The second causes
2784 * a jam in that state.
2785 */
2786 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2787 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2788
2789 b->yy_buf_pos = &b->yy_ch_buf[0];
2790
2791 b->yy_at_bol = 1;
2792 b->yy_buffer_status = YY_BUFFER_NEW;
2793
2794 if ( b == yy_current_buffer )
2795 yy_load_buffer_state();
2796 }
2797
2798
2799#ifndef YY_NO_SCAN_BUFFER
2800#ifdef YY_USE_PROTOS
2801YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2802#else
2803YY_BUFFER_STATE yy_scan_buffer( base, size )
2804char *base;
2805yy_size_t size;
2806#endif
2807 {
2808 YY_BUFFER_STATE b;
2809
2810 if ( size < 2 ||
2811 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2812 base[size-1] != YY_END_OF_BUFFER_CHAR )
2813 /* They forgot to leave room for the EOB's. */
2814 return 0;
2815
2816 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2817 if ( ! b )
2818 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2819
2820 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2821 b->yy_buf_pos = b->yy_ch_buf = base;
2822 b->yy_is_our_buffer = 0;
2823 b->yy_input_file = 0;
2824 b->yy_n_chars = b->yy_buf_size;
2825 b->yy_is_interactive = 0;
2826 b->yy_at_bol = 1;
2827 b->yy_fill_buffer = 0;
2828 b->yy_buffer_status = YY_BUFFER_NEW;
2829
2830 yy_switch_to_buffer( b );
2831
2832 return b;
2833 }
2834#endif
2835
2836
2837#ifndef YY_NO_SCAN_STRING
2838#ifdef YY_USE_PROTOS
2839YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2840#else
2841YY_BUFFER_STATE yy_scan_string( yy_str )
2842yyconst char *yy_str;
2843#endif
2844 {
2845 int len;
2846 for ( len = 0; yy_str[len]; ++len )
2847 ;
2848
2849 return yy_scan_bytes( yy_str, len );
2850 }
2851#endif
2852
2853
2854#ifndef YY_NO_SCAN_BYTES
2855#ifdef YY_USE_PROTOS
2856YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2857#else
2858YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2859yyconst char *bytes;
2860int len;
2861#endif
2862 {
2863 YY_BUFFER_STATE b;
2864 char *buf;
2865 yy_size_t n;
2866 int i;
2867
2868 /* Get memory for full buffer, including space for trailing EOB's. */
2869 n = len + 2;
2870 buf = (char *) yy_flex_alloc( n );
2871 if ( ! buf )
2872 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2873
2874 for ( i = 0; i < len; ++i )
2875 buf[i] = bytes[i];
2876
2877 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2878
2879 b = yy_scan_buffer( buf, n );
2880 if ( ! b )
2881 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2882
2883 /* It's okay to grow etc. this buffer, and we should throw it
2884 * away when we're done.
2885 */
2886 b->yy_is_our_buffer = 1;
2887
2888 return b;
2889 }
2890#endif
2891
2892
2893#ifndef YY_NO_PUSH_STATE
2894#ifdef YY_USE_PROTOS
2895static void yy_push_state( int new_state )
2896#else
2897static void yy_push_state( new_state )
2898int new_state;
2899#endif
2900 {
2901 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2902 {
2903 yy_size_t new_size;
2904
2905 yy_start_stack_depth += YY_START_STACK_INCR;
2906 new_size = yy_start_stack_depth * sizeof( int );
2907
2908 if ( ! yy_start_stack )
2909 yy_start_stack = (int *) yy_flex_alloc( new_size );
2910
2911 else
2912 yy_start_stack = (int *) yy_flex_realloc(
2913 (void *) yy_start_stack, new_size );
2914
2915 if ( ! yy_start_stack )
2916 YY_FATAL_ERROR(
2917 "out of memory expanding start-condition stack" );
2918 }
2919
2920 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2921
2922 BEGIN(new_state);
2923 }
2924#endif
2925
2926
2927#ifndef YY_NO_POP_STATE
2928static void yy_pop_state()
2929 {
2930 if ( --yy_start_stack_ptr < 0 )
2931 YY_FATAL_ERROR( "start-condition stack underflow" );
2932
2933 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2934 }
2935#endif
2936
2937
2938#ifndef YY_NO_TOP_STATE
2939static int yy_top_state()
2940 {
2941 return yy_start_stack[yy_start_stack_ptr - 1];
2942 }
2943#endif
2944
2945#ifndef YY_EXIT_FAILURE
2946#define YY_EXIT_FAILURE 2
2947#endif
2948
2949#ifdef YY_USE_PROTOS
2950static void yy_fatal_error( yyconst char msg[] )
2951#else
2952static void yy_fatal_error( msg )
2953char msg[];
2954#endif
2955 {
2956 (void) fprintf( stderr, "%s\n", msg );
2957 exit( YY_EXIT_FAILURE );
2958 }
2959
2960
2961
2962/* Redefine yyless() so it works in section 3 code. */
2963
2964#undef yyless
2965#define yyless(n) \
2966 do \
2967 { \
2968 /* Undo effects of setting up yytext. */ \
2969 yytext[yyleng] = yy_hold_char; \
2970 yy_c_buf_p = yytext + n; \
2971 yy_hold_char = *yy_c_buf_p; \
2972 *yy_c_buf_p = '\0'; \
2973 yyleng = n; \
2974 } \
2975 while ( 0 )
2976
2977
2978/* Internal utility routines. */
2979
2980#ifndef yytext_ptr
2981#ifdef YY_USE_PROTOS
2982static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2983#else
2984static void yy_flex_strncpy( s1, s2, n )
2985char *s1;
2986yyconst char *s2;
2987int n;
2988#endif
2989 {
2990 register int i;
2991 for ( i = 0; i < n; ++i )
2992 s1[i] = s2[i];
2993 }
2994#endif
2995
2996#ifdef YY_NEED_STRLEN
2997#ifdef YY_USE_PROTOS
2998static int yy_flex_strlen( yyconst char *s )
2999#else
3000static int yy_flex_strlen( s )
3001yyconst char *s;
3002#endif
3003 {
3004 register int n;
3005 for ( n = 0; s[n]; ++n )
3006 ;
3007
3008 return n;
3009 }
3010#endif
3011
3012
3013#ifdef YY_USE_PROTOS
3014static void *yy_flex_alloc( yy_size_t size )
3015#else
3016static void *yy_flex_alloc( size )
3017yy_size_t size;
3018#endif
3019 {
3020 return (void *) malloc( size );
3021 }
3022
3023#ifdef YY_USE_PROTOS
3024static void *yy_flex_realloc( void *ptr, yy_size_t size )
3025#else
3026static void *yy_flex_realloc( ptr, size )
3027void *ptr;
3028yy_size_t size;
3029#endif
3030 {
3031 /* The cast to (char *) in the following accommodates both
3032 * implementations that use char* generic pointers, and those
3033 * that use void* generic pointers. It works with the latter
3034 * because both ANSI C and C++ allow castless assignment from
3035 * any pointer type to void*, and deal with argument conversions
3036 * as though doing an assignment.
3037 */
3038 return (void *) realloc( (char *) ptr, size );
3039 }
3040
3041#ifdef YY_USE_PROTOS
3042static void yy_flex_free( void *ptr )
3043#else
3044static void yy_flex_free( ptr )
3045void *ptr;
3046#endif
3047 {
3048 free( ptr );
3049 }
3050
3051#if YY_MAIN
3052int main()
3053 {
3054 yylex();
3055 return 0;
3056 }
3057#endif
1ac6313d 3058#line 522 "cscanner.l"
885824d3 3059
3060
3061struct skeyword
3062{
3063 /*@null@*/ /*@observer@*/ char *name;
3064 int token;
3065} ;
3066
3067/*
3068** These tokens are followed by syntax that is parsed by the
3069** grammar proper.
3070*/
3071
3072struct skeyword s_parsetable[] = {
3073 { "modifies", QMODIFIES } ,
3074 { "globals", QGLOBALS } ,
3075 { "alt", QALT } ,
3076 { "constant", QCONSTANT } ,
3077 { "function", QFUNCTION } ,
3078 { "iter", QITER } ,
3079 { "defines", QDEFINES } ,
3080 { "uses", QUSES } ,
3081 { "allocates", QALLOCATES } ,
3082 { "sets", QSETS } ,
3083 { "releases", QRELEASES } ,
3084 { "pre", QPRECLAUSE } ,
3085 { "post", QPOSTCLAUSE } ,
3086 { NULL, BADTOK }
3087} ;
3088
3089/*
3090** These tokens are either stand-alone tokens, or followed by
3091** token-specific text.
3092*/
3093
3094struct skeyword s_keytable[] = {
3095 { "anytype", QANYTYPE } ,
3096 { "integraltype", QINTEGRALTYPE } ,
3097 { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } ,
3098 { "signedintegraltype", QSIGNEDINTEGRALTYPE } ,
3099 { "out", QOUT } ,
3100 { "in", QIN } ,
3101 { "only", QONLY } ,
3102 { "owned", QOWNED } ,
3103 { "dependent", QDEPENDENT } ,
3104 { "partial", QPARTIAL } ,
3105 { "special", QSPECIAL } ,
3106 { "truenull", QTRUENULL } ,
3107 { "falsenull", QFALSENULL } ,
3108 { "keep", QKEEP } ,
3109 { "kept", QKEPT } ,
3110 { "notnull", QNOTNULL } ,
3111 { "abstract", QABSTRACT } ,
3112 { "concrete", QCONCRETE } ,
3113 { "mutable", QMUTABLE } ,
3114 { "immutable", QIMMUTABLE } ,
3115 { "unused", QUNUSED } ,
3116 { "external", QEXTERNAL } ,
3117 { "sef", QSEF } ,
3118 { "unique", QUNIQUE } ,
3119 { "returned", QRETURNED } ,
3120 { "exposed", QEXPOSED } ,
3121 { "refcounted", QREFCOUNTED } ,
3122 { "refs", QREFS } ,
3123 { "newref", QNEWREF } ,
3124 { "tempref", QTEMPREF } ,
3125 { "killref", QKILLREF } ,
3126 { "null", QNULL } ,
3127 { "relnull", QRELNULL } ,
3128 { "reldef", QRELDEF } ,
3129 { "observer", QOBSERVER } ,
3130 { "exits", QEXITS } ,
3131 { "mayexit", QMAYEXIT } ,
3132 { "trueexit", QTRUEEXIT } ,
3133 { "falseexit", QFALSEEXIT } ,
3134 { "neverexit", QNEVEREXIT } ,
3135 { "temp", QTEMP } ,
3136 { "shared", QSHARED } ,
3137 { "ref", QREF } ,
3138 { "unchecked", QUNCHECKED } ,
3139 { "checked", QCHECKED } ,
3140 { "checkmod", QCHECKMOD } ,
3141 { "checkedstrict", QCHECKEDSTRICT } ,
3142 { "innercontinue", QINNERCONTINUE } ,
3143 { "innerbreak", QINNERBREAK } ,
3144 { "loopbreak", QLOOPBREAK } ,
3145 { "switchbreak", QSWITCHBREAK } ,
3146 { "safebreak", QSAFEBREAK } ,
3147 { "fallthrough", QFALLTHROUGH } ,
3148 { "l_fallthrou", QLINTFALLTHROUGH } ,
3149 { "l_fallth", QLINTFALLTHRU } ,
3150 { "notreached", QNOTREACHED } ,
3151 { "l_notreach", QLINTNOTREACHED } ,
3152 { "printflike", QPRINTFLIKE } ,
3153 { "l_printfli", QLINTPRINTFLIKE } ,
3154 { "scanflike", QSCANFLIKE } ,
3155 { "messagelike", QMESSAGELIKE } ,
3156 { "l_argsus", QARGSUSED } ,
3157 { NULL, BADTOK }
3158} ;
3159
3160/*
3161** would be better if these weren't hard coded...
3162*/
3163
3164static bool isArtificial (cstring s)
3165{
3166 return (cstring_equalLit (s, "modifies")
3167 || cstring_equalLit (s, "globals")
3168 || cstring_equalLit (s, "alt"));
3169}
3170
3171void swallowMacro (void)
3172{
3173 int i;
3174 bool skipnext = FALSE;
3175
3176 while ((i = lminput ()) != EOF)
3177 {
3178 char c = (char) i;
3179
3180
3181 if (c == '\\')
3182 {
3183 skipnext = TRUE;
3184 }
3185 else if (c == '\n')
3186 {
3187 if (skipnext)
3188 {
3189 skipnext = FALSE;
3190 }
3191 else
3192 {
3193 checkUngetc (i, yyin);
3194 return;
3195 }
3196 }
3197 }
3198
3199 if (i != EOF)
3200 {
3201 checkUngetc (i, yyin);
3202 }
3203}
3204
3205static int commentMarkerToken (cstring s)
3206{
3207 int i = 0;
3208
3209 while (s_parsetable[i].name != NULL)
3210 {
3211 if (cstring_equalLit (s, s_parsetable[i].name))
3212 {
3213 return s_parsetable[i].token;
3214 }
3215
3216 i++;
3217 }
3218
3219 return BADTOK;
3220}
3221
3222static int tokenMacroCode (cstring s)
3223{
3224 int i = 0;
3225
3226 while (s_keytable[i].name != NULL)
3227 {
3228 if (cstring_equalLit (s, s_keytable[i].name))
3229 {
3230 if (s_keytable[i].token == QLINTFALLTHROUGH)
3231 {
3232 voptgenerror
3233 (FLG_WARNLINTCOMMENTS,
3234 cstring_makeLiteral
3235 ("Traditional lint comment /*FALLTHROUGH*/ used. "
3236 "This is interpreted by "
3237 "LCLint in the same way as most Unix lints, but it is "
3238 "preferable to replace it with the /*@fallthrough@*/ "
3239 "stylized comment"),
3240 g_currentloc);
3241 return QFALLTHROUGH;
3242 }
3243 else if (s_keytable[i].token == QLINTFALLTHRU)
3244 {
3245 voptgenerror
3246 (FLG_WARNLINTCOMMENTS,
3247 cstring_makeLiteral
3248 ("Traditional lint comment /*FALLTHRU*/ used. "
3249 "This is interpreted by "
3250 "LCLint in the same way as most Unix lints, but it is "
3251 "preferable to replace it with the /*@fallthrough@*/ "
3252 "stylized comment"),
3253 g_currentloc);
3254 return QFALLTHROUGH;
3255 }
3256 else if (s_keytable[i].token == QLINTNOTREACHED)
3257 {
3258 voptgenerror
3259 (FLG_WARNLINTCOMMENTS,
3260 cstring_makeLiteral
3261 ("Traditional lint comment /*NOTREACHED*/ used. "
3262 "This is interpreted by "
3263 "LCLint in the same way as most Unix lints, but it is "
3264 "preferable to replace it with the /*@notreached@*/ "
3265 "stylized comment."),
3266 g_currentloc);
3267
3268 return QNOTREACHED;
3269 }
3270 else if (s_keytable[i].token == QPRINTFLIKE)
3271 {
3272 setSpecialFunction (QU_PRINTFLIKE);
3273 return SKIPTOK;
3274 }
3275 else if (s_keytable[i].token == QLINTPRINTFLIKE)
3276 {
3277 voptgenerror
3278 (FLG_WARNLINTCOMMENTS,
3279 cstring_makeLiteral
3280 ("Traditional lint comment /*PRINTFLIKE*/ used. "
3281 "This is interpreted by "
3282 "LCLint in the same way as most Unix lints, but it is "
3283 "preferable to replace it with either /*@printflike@*/, "
3284 "/*@scanflike@*/ or /*@messagelike@*/."),
3285 g_currentloc);
3286
3287 setSpecialFunction (QU_PRINTFLIKE);
3288 return SKIPTOK;
3289 }
3290 else if (s_keytable[i].token == QSCANFLIKE)
3291 {
3292 setSpecialFunction (QU_SCANFLIKE);
3293 return SKIPTOK;
3294 }
3295 else if (s_keytable[i].token == QMESSAGELIKE)
3296 {
3297 setSpecialFunction (QU_MESSAGELIKE);
3298 return SKIPTOK;
3299 }
3300 else if (s_keytable[i].token == QARGSUSED)
3301 {
3302 voptgenerror
3303 (FLG_WARNLINTCOMMENTS,
3304 cstring_makeLiteral
3305 ("Traditional lint comment /*ARGSUSED*/ used. "
3306 "This is interpreted by "
3307 "LCLint in the same way as most Unix lints, but it is "
3308 "preferable to use /*@unused@*/ annotations on "
3309 "the unused parameters."),
3310 g_currentloc);
3311
3312 setArgsUsed ();
3313 return SKIPTOK;
3314 }
3315
3316 return s_keytable[i].token;
3317 }
3318
3319 i++;
3320 }
3321
3322 return BADTOK;
3323}
3324
3325static int lminput ()
3326{
3327 if (savechar == '\0')
3328 {
3329 incColumn ();
3330 return (input ());
3331 }
3332 else
3333 {
3334 int save = (int) savechar;
3335 savechar = '\0';
3336 return save;
3337 }
3338}
3339
3340static void lmsavechar (char c)
3341{
3342 if (savechar == '\0') savechar = c;
3343 else
3344 {
3345 llbuglit ("lmsavechar: override");
3346 }
3347}
3348
3349static int returnFloat (ctype ct, double f)
3350{
3351 yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext),
3352 fileloc_decColumn (g_currentloc, tokLength));
3353 tokLength = 0;
3354 return (CCONSTANT);
3355}
3356
3357static int returnInt (ctype ct, long i)
3358{
3359 ctype c = ct;
3360
3361 if (ctype_equal (ct, ctype_int))
3362 {
3363 if (i == 0)
3364 {
3365 c = context_typeofZero ();
3366 }
3367 else if (i == 1)
3368 {
3369 c = context_typeofOne ();
3370 }
3371 }
3372
3373 yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext),
3374 fileloc_decColumn (g_currentloc, tokLength), i);
3375 tokLength = 0;
3376 return (CCONSTANT);
3377}
3378
3379static int returnChar (char c)
3380{
3381 yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext),
3382 fileloc_decColumn (g_currentloc, tokLength));
3383 tokLength = 0;
3384 return (CCONSTANT);
3385}
3386
3387static int ninput ()
3388{
3389 int c = lminput ();
3390
3391 if (c != EOF && ((char)c == '\n'))
3392 {
3393 context_incLineno ();
3394 }
3395
3396 return c;
3397}
3398
3399static char macro_nextChar ()
3400{
3401 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3402 int ic;
3403 char c;
3404
3405 ic = lminput ();
3406 c = char_fromInt (ic);
3407
3408 if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0]))
3409 {
3410 if (c == '\\')
3411 {
3412 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3413 {
3414 ; /* skip to newline */
3415 }
3416
3417 context_incLineno ();
3418
3419 if (c != '\0')
3420 {
3421 return macro_nextChar ();
3422 }
3423 else
3424 {
3425 return c;
3426 }
3427 }
3428 else /* if (c == '@') */
3429 {
3430 if (handleLlSpecial () != BADTOK)
3431 {
3432 llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax");
3433 }
3434
3435 return macro_nextChar ();
3436 }
3437 }
3438 else if (!in_escape && c == '\"')
3439 {
3440 in_quote = !in_quote;
3441 }
3442 else if (!in_escape && c == '\'')
3443 {
3444 in_char = !in_char;
3445 }
3446 else if ((in_quote || in_char) && c == '\\')
3447 {
3448 in_escape = !in_escape;
3449 }
3450 else if ((in_quote || in_char) && in_escape)
3451 {
3452 in_escape = FALSE;
3453 }
3454 else if (!in_quote && c == '/')
3455 {
3456 char c2;
3457
3458 if ((c2 = char_fromInt (lminput ())) == '*')
3459 {
3460 while (c2 != '\0')
3461 {
3462 while ((c2 = char_fromInt (lminput ())) != '\0'
3463 && c2 != '\n' && c2 != '*')
3464 {
3465 ;
3466 }
3467
3468 if (c2 == '*')
3469 {
3470 while ((c2 = char_fromInt (lminput ())) != '\0'
3471 && c2 == '*')
3472 {
3473 ;
3474 }
3475
3476 if (c2 == '/')
3477 {
3478 goto outofcomment;
3479 }
3480 }
3481 else
3482 {
3483 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3484 }
3485 }
3486 outofcomment:
3487 return macro_nextChar ();
3488 }
3489 else
3490 {
3491 /*** putchar does not work! why? puts to stdio...??! ***/
3492 lmsavechar (c2);
3493 }
3494 }
3495 return c;
3496}
3497
3498/*
3499** keeps stylized comments
3500*/
3501
3502static char macro_nextCharC ()
3503{
3504 static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE;
3505 char c;
3506
3507 c = char_fromInt (lminput ());
3508
3509 if (!in_quote && !in_char && c == '\\')
3510 {
3511 while ((c = char_fromInt (lminput ())) != '\0' && c != '\n')
3512 {
3513 ; /* skip to newline */
3514 }
3515
3516 context_incLineno ();
3517
3518 if (c != '\0')
3519 {
3520 return macro_nextCharC ();
3521 }
3522 else
3523 {
3524 return c;
3525 }
3526 }
3527 else if (!in_escape && c == '\"')
3528 {
3529 in_quote = !in_quote;
3530 }
3531 else if (!in_escape && c == '\'')
3532 {
3533 in_char = !in_char;
3534 }
3535 else if ((in_quote || in_char) && c == '\\')
3536 {
3537 in_escape = !in_escape;
3538 }
3539 else if ((in_quote || in_char) && in_escape)
3540 {
3541 in_escape = FALSE;
3542 }
3543 else if (!in_quote && c == '/')
3544 {
3545 char c2;
3546
3547 if ((c2 = char_fromInt (lminput ())) == '*')
3548 {
3549 while (c2 != '\0')
3550 {
3551 while ((c2 = char_fromInt (lminput ())) != '\0'
3552 && c2 != '\n' && c2 != '*')
3553 {
3554 ;
3555 }
3556
3557 if (c2 == '*')
3558 {
3559 while ((c2 = char_fromInt (lminput ())) != '\0'
3560 && c2 == '*')
3561 {
3562 ;
3563 }
3564
3565 if (c2 == '/')
3566 {
3567 goto outofcomment;
3568 }
3569 }
3570 else
3571 {
3572 llfatalerror (cstring_makeLiteral ("Macro: bad comment!"));
3573 }
3574 }
3575 outofcomment:
3576 return macro_nextCharC ();
3577 }
3578 else
3579 {
3580 lmsavechar (c2);
3581 }
3582 }
3583 return c;
3584}
3585
3586/*
3587** skips whitespace (handles line continuations)
3588** returns first non-whitespace character
3589*/
3590
3591static char skip_whitespace ()
3592{
3593 char c;
3594
3595 while ((c = macro_nextChar ()) == ' ' || c == '\t')
3596 {
3597 ;
3598 }
3599
3600 return c;
3601}
3602
3603static void handleMacro ()
3604{
3605 cstring mac = cstring_undefined;
3606 int macrocode;
3607 char c;
3608
3609 while (currentColumn () > 2)
3610 {
3611 mac = cstring_appendChar (mac, ' ');
3612 setTokLength (-1);
3613 }
3614
3615 c = macro_nextCharC ();
3616
3617 if (c >= '0' && c <= '9')
3618 {
3619 int i;
3620
3621 for (i = 0; i < ((c - '0') + 1); i++)
3622 {
3623 mac = cstring_appendChar (mac, ' ');
3624 }
3625 }
3626 else
3627 {
3628 BADBRANCH;
3629 }
3630
3631 while (((c = macro_nextCharC ()) != '\0') && (c != '\n'))
3632 {
3633 mac = cstring_appendChar (mac, c);
3634 }
3635
3636
3637 macrocode = tokenMacroCode (mac);
3638
3639 if (macrocode == BADTOK && !isArtificial (mac))
3640 {
3641 DPRINTF (("Add macro: %s", mac));
3642 context_addMacroCache (mac);
3643 }
3644 else
3645 {
3646 cstring_free (mac);
3647 }
3648
3649 if (c == '\n')
3650 {
3651 context_incLineno ();
3652 }
3653}
3654
3655static bool processMacro (void)
3656{
3657 uentry e2;
3658 ctype ct;
3659 int noparams = 0;
3660 cstring fname = cstring_undefined;
3661 bool res = TRUE;
3662 bool isspecfcn = FALSE;
3663 bool isiter = FALSE;
3664 bool skipparam = FALSE;
3665 bool isenditer = FALSE;
3666 bool unknownm = FALSE;
3667 bool hasParams = FALSE;
3668 bool emptyMacro = FALSE;
3669 char c = skip_whitespace ();
3670 fileloc loc = fileloc_noColumn (g_currentloc);
3671
3672 /* are both of these necessary? what do they mean? */
3673 uentryList specparams = uentryList_undefined;
3674 uentryList pn = uentryList_undefined;
3675
3676 context_resetMacroMissingParams ();
3677
3678 if (c == '\0' || c == '\n')
3679 {
3680 llcontbug (cstring_makeLiteral ("Bad macro"));
3681 fileloc_free (loc);
3682 return FALSE;
3683 }
3684
3685 fname = cstring_appendChar (fname, c);
3686
3687 while ((c = macro_nextChar ()) != '(' && c != '\0'
3688 && c != ' ' && c != '\t' && c != '\n')
3689 {
3690 fname = cstring_appendChar (fname, c);
3691 }
3692
3693 if (c == ' ' || c == '\t' || c == '\n')
3694 {
3695 char oldc = c;
3696
3697 if (c != '\n')
3698 {
3699 while (c == ' ' || c == '\t')
3700 {
3701 c = macro_nextChar ();
3702 }
3703 unput (c);
3704 }
3705
3706 if (c == '\n')
3707 {
3708 emptyMacro = TRUE;
3709 unput (c);
3710 }
3711
3712 c = oldc;
3713 }
3714
3715 hasParams = (c == '(');
3716
3717
3718 if (usymtab_exists (fname))
3719 {
3720 e2 = usymtab_lookupExpose (fname);
3721 ct = uentry_getType (e2);
3722
3723
3724 if (uentry_isCodeDefined (e2)
3725 && fileloc_isUser (uentry_whereDefined (e2)))
3726 {
3727 if (optgenerror
3728 (FLG_MACROREDEF,
3729 message ("Macro %s already defined", fname),
3730 loc))
3731 {
3732 uentry_showWhereDefined (e2);
3733 uentry_clearDefined (e2);
3734 }
3735
3736 if (uentry_isFunction (e2))
3737 {
3738 uentry_setType (e2, ctype_unknown);
3739 ct = ctype_unknown;
3740 unknownm = TRUE;
3741 context_enterUnknownMacro (e2);
3742 }
3743 else
3744 {
3745 context_enterConstantMacro (e2);
3746 }
3747 }
3748 else
3749 {
3750 if (uentry_isForward (e2) && uentry_isFunction (e2))
3751 {
3752 unknownm = TRUE;
3753
3754 voptgenerror
3755 (FLG_MACROFCNDECL,
3756 message
3757 ("Parameterized macro has no prototype or specification: %s ",
3758 fname),
3759 loc);
3760
3761 ct = ctype_unknown;
3762 uentry_setType (e2, ctype_unknown);
3763 uentry_setFunctionDefined (e2, loc);
3764 uentry_setUsed (e2, fileloc_undefined);
3765 context_enterUnknownMacro (e2);
3766 }
3767 else
3768 {
3769 if (uentry_isIter (e2))
3770 {
3771 isiter = TRUE;
3772 specparams = uentry_getParams (e2);
3773 noparams = uentryList_size (specparams);
3774 uentry_setDefined (e2, loc);
3775 context_enterIterDef (e2);
3776 }
3777 else if (uentry_isEndIter (e2))
3778 {
3779 isenditer = TRUE;
3780 uentry_setDefined (e2, loc);
3781 context_enterIterEnd (e2); /* don't care about it now */
3782 /* but should parse like an iter! */
3783 }
3784 else if (uentry_isConstant (e2))
3785 {
3786 if (hasParams)
3787 {
3788 voptgenerror
3789 (FLG_INCONDEFS,
3790 message ("Constant %s implemented as parameterized macro",
3791 fname),
3792 g_currentloc);
3793
3794 uentry_showWhereSpecified (e2);
3795 uentry_setType (e2, ctype_unknown);
3796 uentry_makeVarFunction (e2);
3797 uentry_setDefined (e2, g_currentloc);
3798 uentry_setFunctionDefined (e2, g_currentloc);
3799 context_enterUnknownMacro (e2);
3800 }
3801 else
3802 {
3803 if (!uentry_isSpecified (e2))
3804 {
3805 fileloc oloc = uentry_whereDeclared (e2);
3806
3807 if (fileloc_isLib (oloc))
3808 {
3809 ;
3810 }
3811 else if (fileloc_isUndefined (oloc)
3812 || fileloc_isPreproc (oloc))
3813 {
3814 if (!emptyMacro)
3815 {
3816 voptgenerror
3817 (FLG_MACROCONSTDECL,
3818 message
3819 ("Macro constant %q not declared",
3820 uentry_getName (e2)),
3821 loc);
3822 }
3823 }
3824 else if (!fileloc_withinLines (oloc, loc, 2))
3825 { /* bogus! will give errors if there is too much whitespace */
3826 voptgenerror
3827 (FLG_SYNTAX,
3828 message
3829 ("Macro constant name %s does not match name in "
3830 "previous constant declaration. This constant "
3831 "is declared at %q", fname,
3832 fileloc_unparse (oloc)),
3833 loc);
3834 }
3835 }
3836
3837 context_enterConstantMacro (e2);
3838 cstring_free (fname);
3839 fileloc_free (loc);
3840 return res;
3841 }
3842
3843 }
3844 else if (ctype_isFunction (ct))
3845 {
3846 isspecfcn = TRUE;
3847 specparams = ctype_argsFunction (ct);
3848 noparams = uentryList_size (specparams);
3849
3850 uentry_setFunctionDefined (e2, loc);
3851 context_enterMacro (e2);
3852 }
3853 else if (uentry_isVar (e2))
3854 {
3855 if (hasParams)
3856 {
3857 voptgenerror
3858 (FLG_INCONDEFS,
3859 message ("Variable %s implemented as parameterized macro",
3860 fname),
3861 loc);
3862
3863 uentry_showWhereSpecified (e2);
3864 uentry_setType (e2, ctype_unknown);
3865 uentry_makeVarFunction (e2);
3866 uentry_setDefined (e2, g_currentloc);
3867 uentry_setFunctionDefined (e2, g_currentloc);
3868 context_enterUnknownMacro (e2);
3869 }
3870 else
3871 {
3872 uentry ucons = uentry_makeConstant (fname,
3873 ctype_unknown,
3874 loc);
3875 if (uentry_isExpandedMacro (e2))
3876 {
3877 ; /* okay */
3878 }
3879 else
3880 {
3881 if (optgenerror
3882 (FLG_INCONDEFS,
3883 message ("Variable %s implemented by a macro",
3884 fname),
3885 loc))
3886 {
3887 uentry_showWhereSpecified (e2);
3888 }
3889 }
3890
3891 uentry_setDefined (e2, loc);
3892 uentry_setUsed (ucons, loc);
3893
3894 context_enterConstantMacro (ucons);
3895 uentry_markOwned (ucons);
3896 cstring_free (fname);
3897 return res;
3898 }
3899 }
3900 else
3901 {
3902 if (uentry_isDatatype (e2))
3903 {
3904 vgenhinterror
3905 (FLG_SYNTAX,
3906 message ("Type implemented as macro: %x",
3907 uentry_getName (e2)),
3908 message ("A type is implemented using a macro definition. A "
3909 "typedef should be used instead."),
3910 g_currentloc);
3911
3912 swallowMacro ();
3913 /* Must exit scope (not sure why a new scope was entered?) */
3914 usymtab_quietExitScope (g_currentloc);
3915 uentry_setDefined (e2, g_currentloc);
3916 res = FALSE;
3917 }
3918 else
3919 {
3920 llcontbug
3921 (message ("Unexpanded macro not function or constant: %q",
3922 uentry_unparse (e2)));
3923 uentry_setType (e2, ctype_unknown);
3924
3925 if (hasParams)
3926 {
3927 uentry_makeVarFunction (e2);
3928 uentry_setDefined (e2, g_currentloc);
3929 uentry_setFunctionDefined (e2, g_currentloc);
3930 context_enterUnknownMacro (e2);
3931 }
3932 }
3933 }
3934 }
3935 }
3936 }
3937 else
3938 {
3939 uentry ce;
3940
3941 voptgenerror
3942 (FLG_MACROMATCHNAME,
3943 message ("Unexpanded macro %s does not match name of a constant "
3944 "or iter declaration. The name used in the control "
3945 "comment on the previous line should match. "
3946 "(Assuming macro defines a constant.)",
3947 fname),
3948 loc);
3949
3950
3951 ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined);
3952 uentry_setUsed (ce, loc); /* perhaps bogus? */
3953 e2 = usymtab_supEntryReturn (ce);
3954
3955 context_enterConstantMacro (e2);
3956 cstring_free (fname);
3957 fileloc_free (loc);
3958 return res;
3959 }
3960
3961 /* in macros, ( must follow immediatetly after name */
3962
3963 if (hasParams)
3964 {
3965 int paramno = 0;
3966
3967 c = skip_whitespace ();
3968
3969 while (c != ')' && c != '\0')
3970 {
3971 uentry param;
3972 bool suppress = context_inSuppressRegion ();
3973 cstring paramname = cstring_undefined;
3974
3975 /*
3976 ** save the parameter location
3977 */
3978
3979 decColumn ();
3980 context_saveLocation ();
3981 incColumn ();
3982
3983 while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')')
3984 {
3985 paramname = cstring_appendChar (paramname, c);
3986 c = macro_nextChar ();
3987 }
3988
3989 if (c == ' ' || c == '\t') c = skip_whitespace ();
3990
3991 if (c == ',')
3992 {
3993 c = macro_nextChar ();
3994 if (c == ' ' || c == '\t') c = skip_whitespace ();
3995 }
3996
3997 if (c == '\0')
3998 {
3999 llfatalerror (cstring_makeLiteral
4000 ("Bad macro syntax: uentryList"));
4001 }
4002
4003 if ((isspecfcn || isiter) && (paramno < noparams)
4004 && !uentry_isElipsisMarker (uentryList_getN
4005 (specparams, paramno)))
4006 {
4007 uentry decl = uentryList_getN (specparams, paramno);
4008 sRef sr;
4009
4010 param = uentry_nameCopy (paramname, decl);
4011
4012
4013 uentry_setParam (param);
4014 sr = sRef_makeParam (paramno, uentry_getType (param));
4015
4016 if (sRef_getNullState (sr) == NS_ABSNULL)
4017 {
4018 ctype pt = ctype_realType (uentry_getType (param));
4019
4020 if (ctype_isUser (pt))
4021 {
4022 uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt));
4023
4024 if (uentry_isValid (te))
4025 {
4026 sRef_setStateFromUentry (sr, te);
4027 }
4028 }
4029 else
4030 {
4031 sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
4032 }
4033 }
4034
4035 uentry_setSref (param, sr);
4036 uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
4037
4038 skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
4039 }
4040 else
4041 {
4042 fileloc sloc = context_getSaveLocation ();
4043
4044 param = uentry_makeVariableSrefParam
4045 (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
4046 cstring_free (paramname);
4047
4048 sRef_setPosNull (uentry_getSref (param), sloc);
4049
4050 uentry_setDeclaredForce (param, sloc);
4051
4052 skipparam = FALSE;
4053 fileloc_free (sloc);
4054 }
4055
4056 if (!skipparam)
4057 {
4058 llassert (!uentry_isElipsisMarker (param));
4059
4060 if (!suppress)
4061 {
4062 sRef_makeUnsafe (uentry_getSref (param));
4063 }
4064
4065 pn = uentryList_add (pn, uentry_copy (param));
4066 usymtab_supEntry (param);
4067 }
4068 else
4069 {
4070 /* don't add param */
4071 uentry_free (param);
4072 }
4073
4074 if (c == ',')
4075 {
4076 (void) macro_nextChar ();
4077 c = skip_whitespace ();
4078 }
4079
4080 paramno++;
4081 }
4082
4083 if (c == ')')
4084 {
4085 if (isspecfcn || isiter)
4086 {
4087 if (paramno != noparams && noparams >= 0)
4088 {
4089 advanceLine ();
4090
4091 voptgenerror
4092 (FLG_INCONDEFS,
4093 message ("Macro %s specified with %d args, defined with %d",
4094 fname, noparams, paramno),
4095 g_currentloc);
4096
4097 uentry_showWhereSpecified (e2);
4098 uentry_resetParams (e2, pn);
4099 }
4100 }
4101 else
4102 {
4103 uentry_resetParams (e2, pn);
4104 }
4105 }
4106 }
4107 else
4108 {
4109 /*
4110 ** the form should be:
4111 **
4112 ** # define newname oldname
4113 ** where oldname refers to a function matching the specification
4114 ** of newname.
4115 */
4116
4117 if (unknownm)
4118 {
4119 sRef_setGlobalScope ();
4120 usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown));
4121 sRef_clearGlobalScope ();
4122 }
4123 else
4124 {
4125 context_setMacroMissingParams ();
4126 }
4127 }
4128
4129
4130 /* context_setuentryList (pn); */
4131 usymtab_enterScope ();
4132
4133 fileloc_free (loc);
4134 cstring_free (fname);
4135
4136 return res;
4137}
4138
4139static bool handleSpecial (char *yyt)
4140{
4141 char *l = mstring_create (MAX_NAME_LENGTH);
4142 static bool reportcpp = FALSE;
4143 int lineno = 0;
4144 char c;
4145 char *ol;
4146 cstring olc;
4147
4148 strcpy (l, yyt + 1);
4149
4150 /* Need to safe original l for deallocating. */
4151 ol = l;
4152
4153 l += strlen (yyt) - 1;
4154
4155 while ((c = char_fromInt (lminput ())) != '\n' && c != '\0')
4156 {
4157 *l++ = c;
4158 }
4159
4160 *l = '\0';
4161 olc = cstring_fromChars (ol);
4162
4163 if (cstring_equalPrefix (olc, "pragma"))
4164 {
4165 char *pname = mstring_create (longUnsigned_fromInt (MAX_PRAGMA_LEN));
4166 char *opname = pname;
4167 char *ptr = ol + 6; /* pragma is six characters, plus space */
4168 int len = 0;
4169
4170
4171 /* skip whitespace */
4172 while (((c = *ptr) != '\0') && isspace (c))
4173 {
4174 ptr++;
4175 }
4176
4177
4178 while (((c = *ptr) != '\0') && !isspace (c))
4179 {
4180 len++;
4181
4182 if (len > MAX_PRAGMA_LEN)
4183 {
4184 break;
4185 }
4186
4187 ptr++;
4188 *pname++ = c;
4189 }
4190
4191 *pname = '\0';
4192
4193 if (len == PRAGMA_LEN_EXPAND
4194 && mstring_equal (opname, PRAGMA_EXPAND))
4195 {
4196 cstring exname = cstring_undefined;
4197 uentry ue;
4198
4199 ptr++;
4200 while (((c = *ptr) != '\0') && !isspace (c))
4201 {
4202 exname = cstring_appendChar (exname, c);
4203 ptr++;
4204 }
4205
4206
4207 ue = usymtab_lookupExposeGlob (exname);
4208
4209 if (uentry_isExpandedMacro (ue))
4210 {
4211 if (fileloc_isPreproc (uentry_whereDefined (ue)))
4212 {
4213 fileloc_setColumn (g_currentloc, 1);
4214 uentry_setDefined (ue, g_currentloc);
4215 }
4216 }
4217
4218 cstring_free (exname);
4219 }
4220 }
4221 else if (cstring_equalPrefix (olc, "ident"))
4222 {
4223 /* Some pre-processors will leave these in the code. Ignore rest of line */
4224 }
4225 /*
4226 ** Yuk...Win32 filenames can have spaces in them...we need to read
4227 ** to the matching end quote.
4228 */
4229 else if ((sscanf (ol, "line %d \"", &lineno) == 1)
4230 || (sscanf (ol, " %d \"", &lineno) == 1))
4231 {
4232 char *tmp = ol;
4233 char *fname;
4234 fileId fid;
4235
4236 while (*tmp != '\"' && *tmp != '\0')
4237 {
4238 tmp++;
4239 }
4240
4241 llassert (*tmp == '\"');
4242
4243 tmp++;
4244 fname = tmp;
4245
4246 while (*tmp != '\"' && *tmp != '\0')
4247 {
4248 tmp++;
4249 }
4250
4251 llassert (*tmp == '\"');
4252
4253 *tmp = '\0';
4254
4255 DPRINTF (("fname: %s", fname));
4256
4257# if defined(OS2) || defined(MSDOS) || defined(WIN32)
4258
4259 /*
4260 ** DOS-like path delimiters get delivered in pairs, something like
4261 ** \"..\\\\file.h\", so we have to make it normal again. We do NOT
4262 ** remove the pre dirs yet as we usually specify tmp paths relative
4263 ** to the current directory, so tmp files would not get found in
4264 ** the hash table. If this method fails we try it again later.
4265 */
4266
4267 {
4268 char *stmp = fname;
4269
4270 /*
4271 ** Skip past the drive marker.
4272 */
4273
4274 DPRINTF (("stmp: %s / %s", stmp, fname));
4275
4276 if (strchr (stmp, ':') != NULL)
4277 {
4278 stmp = strchr (stmp, ':') + 1;
4279 }
4280
4281 DPRINTF (("stmp: %s / %s", stmp, fname));
4282
4283 while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL )
4284 {
4285 if (*(stmp+1) == CONNECTCHAR)
4286 {
4287 memmove (stmp, stmp+1, strlen (stmp));
4288 }
4289
4290 stmp++;
4291 DPRINTF (("stmp: %s / %s", stmp, fname));
4292 }
4293
4294 DPRINTF (("Now: base = %s", fname));
4295
4296 fid = fileTable_lookupBase (context_fileTable (),
4297 cstring_fromChars (fname));
4298 if (!(fileId_isValid (fid)))
4299 {
4300 fname = removePreDirs (fname);
4301 fid = fileTable_lookupBase (context_fileTable (),
4302 cstring_fromChars (fname));
4303 }
4304 }
4305# else /* !defined(OS2) && !defined(MSDOS) */
4306 fname = removePreDirs (fname);
4307 fid = fileTable_lookupBase (context_fileTable (),
4308 cstring_fromChars (fname));
4309# endif /* !defined(OS2) && !defined(MSDOS) */
4310
4311 if (!(fileId_isValid (fid)))
4312 {
4313 if (isHeaderFile (cstring_fromChars (fname)))
4314 {
4315 fid = fileTable_addHeaderFile (context_fileTable (),
4316 cstring_fromChars (fname));
4317 }
4318 else
4319 {
4320 fid = fileTable_addFile (context_fileTable (),
4321 cstring_fromChars (fname));
4322 }
4323 }
4324
4325 setFileLine (fid, lineno);
4326 }
4327 else if ((sscanf (ol, "line %d", &lineno) == 1)
4328 || (sscanf (ol, " %d", &lineno) == 1))
4329 {
4330 setLine (lineno); /* next line is <cr> */
4331 }
4332 else
4333 {
1ac6313d 4334 if (!reportcpp)
4335 {
4336 llerror (FLG_SYNTAX,
4337 message ("File contains preprocessor command: #%s. "
4338 "Check LCLINT_CPPCMD environment variable. "
4339 "(Further instances unreported)",
885824d3 4340 cstring_fromChars (ol)));
1ac6313d 4341 reportcpp = TRUE;
4342 }
4343
885824d3 4344 sfree (ol);
4345 return TRUE;
4346 }
4347
4348 sfree (ol);
4349 return FALSE;
4350}
4351
4352static int handleLlSpecial ()
4353{
4354 int ic;
4355 char c;
4356 char *s = mstring_createEmpty ();
4357 char *os;
4358 int tok;
4359 int charsread = 0;
1ac6313d 4360 bool isstart = FALSE;
885824d3 4361
4362 while (((ic = ninput ()) != 0) && isalpha (ic))
4363 {
4364 c = (char) ic;
4365 s = mstring_append (s, c);
4366 charsread++;
4367 }
4368
4369 os = s;
4370
4371 if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0])
4372 {
4373 ic = ninput ();
4374
4375 llassert (ic == AFTER_COMMENT_MARKER[1]);
4376
4377
4378 if (isProcessingGlobMods () && (*s == '\0'))
4379 {
4380 sfree (os);
4381 return QNOMODS; /* special token no modifications token */
4382 }
4383 else
4384 {
4385 ;
4386 }
4387 }
4388
4389 tok = commentMarkerToken (cstring_fromChars (os));
4390
4391 if (tok != BADTOK)
4392 {
4393 tokLength = charsread;
4394 sfree (os);
1ac6313d 4395 inSpecPart = TRUE;
4396 return tok;
885824d3 4397 }
1ac6313d 4398
885824d3 4399 /* Add rest of the comment */
1ac6313d 4400
885824d3 4401 if (ic != 0 && ic != EOF)
4402 {
4403 c = (char) ic;
4404
4405
4406 s = mstring_append (s, c);
4407 charsread++;
4408
4409 while (((ic = ninput ()) != 0) && (ic != EOF)
4410 && (ic != AFTER_COMMENT_MARKER[0]))
4411 {
4412 c = (char) ic;
4413 s = mstring_append (s, c);
4414 charsread++;
4415 }
4416 }
4417
4418 if (ic == AFTER_COMMENT_MARKER[0])
4419 {
4420 int nc = ninput ();
4421 llassert ((char) nc == AFTER_COMMENT_MARKER[1]);
4422 charsread++;
4423 }
4424
4425
4426 os = s;
4427
4428 while (*s == ' ' || *s == '\t' || *s == '\n')
4429 {
4430 s++;
4431 }
4432
4433 if (*s == '-' || *s == '+' || *s == '=') /* setting flags */
4434 {
4435 c = *s;
4436
4437 while (c == '-' || c == '+' || c == '=')
4438 {
4439 ynm set = ynm_fromCodeChar (c);
4440 cstring thisflag;
4441
4442 s++;
4443
4444 thisflag = cstring_fromChars (s);
4445
4446 while ((c = *s) != '\0' && (c != '-') && (c != '=')
4447 && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n'))
4448 {
4449 s++;
4450 }
4451
4452 *s = '\0';
4453
4454 if (!context_getFlag (FLG_NOCOMMENTS))
4455 {
4456 cstring flagname = thisflag;
4457 flagcode fflag = identifyFlag (flagname);
4458
4459 if (flagcode_isSkip (fflag))
4460 {
4461 ;
4462 }
4463 else if (flagcode_isInvalid (fflag))
4464 {
4465 if (isMode (flagname))
4466 {
4467 if (ynm_isMaybe (set))
4468 {
4469 llerror
4470 (FLG_BADFLAG,
4471 message
4472 ("Stylized comment attempts to restore flag %s. "
4473 "A mode flag cannot be restored.",
4474 flagname));
4475 }
4476 else
4477 {
4478 context_setMode (flagname);
4479 }
4480 }
4481 else
4482 {
4483 llerror
4484 (FLG_BADFLAG,
4485 message ("Unrecognized option in stylized comment: %s",
4486 flagname));
4487 }
4488 }
4489 else if (flagcode_isGlobalFlag (fflag))
4490 {
4491 llerror
4492 (FLG_BADFLAG,
4493 message
4494 ("Stylized comment attempts to set global flag %s. "
4495 "A global flag cannot be set locally.",
4496 flagname));
4497 }
4498 else
4499 {
4500 context_fileSetFlag (fflag, set);
4501
4502 if (flagcode_hasArgument (fflag))
4503 {
4504 if (ynm_isMaybe (set))
4505 {
4506 llerror
4507 (FLG_BADFLAG,
4508 message
4509 ("Stylized comment attempts to restore flag %s. "
4510 "A flag for setting a value cannot be restored.",
4511 flagname));
4512 }
4513 else
4514 { /* cut-and-pastied from llmain...blecch */
4515 cstring extra = cstring_undefined;
4516 char *rest;
4517 char *orest;
4518 char rchar;
4519
4520 *s = c;
4521 rest = mstring_copy (s);
4522 orest = rest;
4523 *s = '\0';
4524
4525 while ((rchar = *rest) != '\0'
4526 && (isspace (rchar)))
4527 {
4528 rest++;
4529 s++;
4530 }
4531
4532 while ((rchar = *rest) != '\0'
4533 && !isspace (rchar))
4534 {
4535 extra = cstring_appendChar (extra, rchar);
4536 rest++;
4537 s++;
4538 }
4539
4540 sfree (orest);
4541
4542 if (cstring_isUndefined (extra))
4543 {
4544 llerror
4545 (FLG_BADFLAG,
4546 message
4547 ("Flag %s (in stylized comment) must be followed by an argument",
4548 flagcode_unparse (fflag)));
4549 }
4550 else
4551 {
4552 s--;
4553
4554 if (flagcode_hasValue (fflag))
4555 {
4556 setValueFlag (fflag, extra);
4557 }
4558 else if (flagcode_hasString (fflag))
4559 {
4560 setStringFlag (fflag, extra);
4561 }
4562 else
4563 {
4564 BADEXIT;
4565 }
4566 }
4567 }
4568 }
4569 }
4570 }
4571 else
4572 {
4573 }
4574
4575 *s = c;
4576 while ((c == ' ') || (c == '\t') || (c == '\n'))
4577 {
4578 c = *(++s);
4579 }
4580 }
4581
4582 if (context_inHeader () && !isArtificial (cstring_fromChars (os)))
4583 {
4584 context_addComment (cstring_fromCharsNew (os));
4585 }
4586 else
4587 {
4588 ;
4589 }
4590 }
4591 else
4592 {
4593 char *t = s;
4594 int macrocode;
4595 char tchar = '\0';
4596
4597 while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n')
4598 {
4599 s++;
4600 }
4601
4602 if (*s != '\0')
4603 {
4604 tchar = *s;
4605 *s = '\0';
4606 s++;
4607 }
4608
4609 t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t)));
4610 macrocode = tokenMacroCode (cstring_fromChars (t));
4611
4612 if (macrocode != BADTOK)
4613 {
4614 tokLength = mstring_length (t);
4615
4616
4617 sfree (t);
4618 sfree (os);
4619
4620 if (macrocode == SKIPTOK)
4621 {
4622 return BADTOK;
4623 }
4624
4625 return macrocode;
4626 }
4627
4628 if (context_inHeader ())
4629 {
4630 if (tchar != '\0')
4631 {
4632 *(s-1) = tchar;
4633 }
4634
4635 if ((context_inMacro () || context_inGlobalContext ())
4636 && macrocode != SKIPTOK
4637 && !isArtificial (cstring_fromChars (os)))
4638 {
4639 context_addComment (cstring_fromCharsNew (os));
4640 }
4641 else
4642 {
4643 ;
4644 }
4645
4646 if (tchar != '\0')
4647 {
4648 *(s-1) = '\0';
4649 }
4650 }
4651
4652 if (mstring_equal (t, "ignore"))
4653 {
4654 if (!context_getFlag (FLG_NOCOMMENTS))
4655 {
4656 context_enterSuppressRegion ();
4657 }
4658 }
4659 else if ((*t == 'i' || *t == 't')
4660 && (*(t + 1) == '\0'))
4661 {
4662 if (!context_getFlag (FLG_NOCOMMENTS)
4663 && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS)))
4664 {
4665 context_enterSuppressLine (-1); /* infinite suppression */
4666 }
4667 }
4668 else if (((*t == 'i') || (*t == 't'))
4669 && ((*(t + 1) >= '0' && *(t + 1) <= '9')))
4670 {
4671 bool tmpcomment = (*t == 't');
4672 int val = -1;
4673 char *tt = t; /* don't mangle t, since it is free'd */
4674 char lc = *(++tt);
4675
4676 if (lc >= '0' && lc <= '9')
4677 {
4678 val = (int)(lc - '0');
4679
4680 lc = *(++tt);
4681 while (lc >= '0' && lc <= '9')
4682 {
4683 val *= 10;
4684 val += lc - '0';
4685 lc = *(++tt);
4686 }
4687 }
4688
4689
4690 if (!context_getFlag (FLG_NOCOMMENTS)
4691 && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS)))
4692 {
4693 context_enterSuppressLine (val);
4694 }
4695 }
4696 else if (mstring_equal (t, "end"))
4697 {
4698 if (!context_getFlag (FLG_NOCOMMENTS))
4699 {
4700 context_exitSuppressRegion ();
4701 }
4702 }
4703 else if (mstring_equal (t, "notfunction"))
4704 {
4705 ; /* handled by pcpp */
4706 }
4707 else if (mstring_equal (t, "access"))
4708 {
4709 cstring tname;
4710
4711 while (TRUE)
4712 {
4713 while ((c = *s) && (c == ' ' || c == '\t' || c == '\n'))
4714 {
4715 s++;
4716 }
4717
4718 if (c == '\0')
4719 {
4720 break;
4721 }
4722
4723 tname = cstring_fromChars (s);
4724
4725 while ((c = *s) != '\0' && c != ' '
4726 && c != '\t' && c != '\n' && c != ',')
4727 {
4728 s++;
4729 }
4730
4731 *s = '\0';
4732
4733
4734 if (!context_getFlag (FLG_NOCOMMENTS)
4735 && !context_getFlag (FLG_NOACCESS))
4736 {
4737 if (usymtab_existsType (tname))
4738 {
4739 usymId uid = usymtab_getTypeId (tname);
4740
4741 context_addFileAccessType (uid);
4742 }
4743 else
4744 {
4745 if (!(context_inSuppressRegion ()
4746 || context_inSuppressZone (g_currentloc)))
4747 {
4748 llmsg
4749 (message
4750 ("%q: Unrecognized type %s used in access comment",
4751 fileloc_unparse (g_currentloc), tname));
4752 }
4753 }
4754 }
4755
4756 if (c != '\0')
4757 {
4758 s++;
4759 }
4760
4761 if (c != ',' && c != ' ')
4762 {
4763 break;
4764 }
4765 }
4766 }
4767 else if (mstring_equal (t, "noaccess"))
4768 {
4769 cstring tname;
4770 char lc;
4771
4772 while (TRUE)
4773 {
4774 while ((lc = *s) && (lc == ' ' || lc == '\t' || lc == '\n'))
4775 {
4776 s++;
4777 }
4778
4779 if (lc == '\0')
4780 {
4781 break;
4782 }
4783
4784 tname = cstring_fromChars (s);
4785
4786 while ((lc = *s) != '\0' && lc != ' ' && lc != '\t'
4787 && lc != '\n' && lc != ',')
4788 {
4789 s++;
4790 }
4791
4792 *s = '\0';
4793
4794 if (!context_getFlag (FLG_NOCOMMENTS)
4795 && !context_getFlag (FLG_NOACCESS))
4796 {
4797 if (usymtab_existsType (tname))
4798 {
4799 typeId tuid = usymtab_getTypeId (tname);
4800
4801 if (context_couldHaveAccess (tuid))
4802 {
4803 context_removeFileAccessType (tuid);
4804 }
4805 else
4806 {
4807 if (!(context_inSuppressRegion ()
4808 || context_inSuppressZone (g_currentloc)))
4809 {
4810 uentry ue = usymtab_getTypeEntry (tuid);
4811
4812 if (uentry_isAbstractDatatype (ue))
4813 {
4814 llmsg
4815 (message
4816 ("%q: Non-accessible abstract type %s used in noaccess comment",
4817 fileloc_unparse (g_currentloc), tname));
4818 }
4819 else
4820 {
4821 llmsg
4822 (message
4823 ("%q: Non-abstract type %s used in noaccess comment",
4824 fileloc_unparse (g_currentloc), tname));
4825 }
4826 }
4827 }
4828 }
4829 else
4830 {
4831 if (!(context_inSuppressRegion ()
4832 || context_inSuppressZone (g_currentloc)))
4833 {
4834 llmsg
4835 (message
4836 ("%q: Unrecognized type %s used in noaccess comment",
4837 fileloc_unparse (g_currentloc), tname));
4838 }
4839 }
4840 }
4841
4842 if (lc != '\0')
4843 {
4844 s++;
4845 }
4846
4847 if (lc != ',' && lc != ' ')
4848 {
4849 break;
4850 }
4851 }
4852 }
4853 else
4854 {
4855 setTokLength (- (2 + charsread));
4856
4857 voptgenerror (FLG_UNRECOGCOMMENTS,
4858 message ("Stylized comment unrecognized: %s",
4859 cstring_fromChars (os)),
4860 g_currentloc);
4861 }
4862
4863 sfree (t);
4864 }
4865
4866 sfree (os);
4867 return BADTOK;
4868}
4869
4870static /*@only@*/ cstring makeIdentifier (char *s)
4871{
4872 char *c = mstring_create (size_toInt (strlen (s)) + 1);
4873 cstring id = cstring_fromChars (c);
4874
4875 while (isalnum (*s) || (*s == '_') || (*s == '$'))
4876 {
4877 *c++ = *s++;
4878 }
4879
4880 *c = '\0';
4881 return (id);
4882}
4883
1ac6313d 4884/*@observer@*/ /*@dependent@*/ uentry coerceId (ctype c)
885824d3 4885{
1ac6313d 4886 cstring cn = LastIdentifier ();
4887
4888
885824d3 4889 if (!(usymtab_exists (cn)))
4890 {
1ac6313d 4891 if (ctype_isUnknown (c))
4892 {
4893 uentry ce;
4894 fileloc loc = fileloc_createExternal ();
4895 bool infunc = sRef_modInFunction ();
4896
4897 if (infunc)
4898 {
4899 sRef_setGlobalScope ();
4900 }
4901
4902 ce = uentry_makeVariableLoc (cn, c);
4903 uentry_setDefined (ce, loc);
4904 fileloc_free (loc);
4905
4906 if (!context_inIterEnd ())
4907 {
4908 voptgenerror
4909 (FLG_SYSTEMUNRECOG,
4910 message ("Unrecognized (possibly system) identifier: %q",
4911 uentry_getName (ce)),
4912 uentry_whereLast (ce));
4913 }
4914
4915 uentry_setHasNameError (ce);
4916 ce = usymtab_supReturnFileEntry (ce);
4917
4918 if (infunc)
4919 {
4920 sRef_clearGlobalScope ();
4921 }
4922 }
4923 else
885824d3 4924 {
1ac6313d 4925 llcontbug (message ("coerceId: bad call: %t", c));
4926 return (uentry_makeVariableLoc (cn, ctype_unknown));
885824d3 4927 }
885824d3 4928 }
4929
4930 return (usymtab_lookup (cn));
4931}
4932
4933/*
4934** like, coerceId, but doesn't supercede for iters
4935*/
4936
1ac6313d 4937/*@observer@*/ uentry coerceIterId (ctype c)
885824d3 4938{
1ac6313d 4939 cstring cn = LastIdentifier ();
4940
885824d3 4941 if (!(usymtab_exists (cn)))
4942 {
1ac6313d 4943 if (ctype_isUnknown (c))
4944 {
4945 return uentry_undefined;
4946 }
4947 else
4948 {
4949 llcontbug (message ("coerceId: bad call: %t", c));
4950 return (uentry_makeVariableLoc (cn, ctype_unknown));
4951 }
885824d3 4952 }
4953
4954 return (usymtab_lookup (cn));
4955}
4956
4957/*@observer@*/ cstring LastIdentifier ()
4958{
4959 return (lastidprocessed);
4960}
4961
4962static int processIdentifier (cstring id)
4963{
4964 uentry le;
1ac6313d 4965
885824d3 4966 context_clearJustPopped ();
4967 lastidprocessed = id;
4968
4969 if (context_inFunctionDecl ())
4970 {
4971 int tok = commentMarkerToken (id);
4972
4973 if (tok != BADTOK)
4974 {
4975 return tok;
4976 }
4977 else
4978 {
4979 tok = tokenMacroCode (id);
4980
4981 if (tok != BADTOK)
4982 {
4983 return tok;
4984 }
4985 }
4986 }
4987
885824d3 4988 if (context_getFlag (FLG_GNUEXTENSIONS))
4989 {
4990 int tok = BADTOK;
4991
4992 if (cstring_equalLit (id, "__stdcall")
1ac6313d 4993 || cstring_equalLit (id, "__cdecl"))
885824d3 4994 {
4995 return BADTOK;
4996 }
4997 else if (cstring_equalLit (id, "__volatile__"))
4998 {
4999 tok = QVOLATILE;
5000 }
5001 else if (cstring_equalLit (id, "__signed"))
5002 {
5003 tok = QSIGNED;
5004 }
5005 else if (cstring_equalLit (id, "__unsigned"))
5006 {
5007 tok = QUNSIGNED;
5008 }
5009 else if (cstring_equalLit (id, "__const__"))
5010 {
5011 tok = QCONST;
5012 }
885824d3 5013 else if (cstring_equalLit (id, "__attribute__")
1ac6313d 5014 || cstring_equalLit (id, "__extension__")
885824d3 5015 || cstring_equalLit (id, "__asm__")
5016 || cstring_equalLit (id, "_asm")
5017 || cstring_equalLit (id, "__asm")
5018 || cstring_equalLit (id, "__declspec"))
5019 {
5020 int depth = 0;
5021 bool useparens = FALSE;
5022 bool usebraces = FALSE;
5023 bool inquote = FALSE;
5024 bool inescape = FALSE;
5025 int ic;
5026
5027 while ((ic = input ()) != EOF)
5028 {
5029
5030 if (inescape)
5031 {
5032 inescape = FALSE;
5033 }
5034 else if (ic == '\\')
5035 {
5036 inescape = TRUE;
5037 }
5038 else if (ic == '\"')
5039 {
5040 inquote = !inquote;
5041 }
5042 else if (!inquote)
5043 {
5044 if (ic == '(')
5045 {
5046 if (!useparens)
5047 {
5048 if (!usebraces)
5049 {
5050 useparens = TRUE;
5051 }
5052 }
5053
5054 if (useparens)
5055 {
5056 depth++;
5057 }
5058 }
5059 else if (ic == '{')
5060 {
5061 if (!usebraces)
5062 {
5063 if (!useparens)
5064 {
5065 usebraces = TRUE;
5066 }
5067 }
5068
5069 if (usebraces)
5070 {
5071 depth++;
5072 }
5073 }
5074 else if (ic == ')' && useparens)
5075 {
5076 depth--;
5077 if (depth == 0) break;
5078 }
5079 else if (ic == '}' && usebraces)
5080 {
5081 depth--;
5082 if (depth == 0) break;
5083 }
5084 else if (ic == '}'
5085 && !usebraces && !useparens
5086 && cstring_equalLit (id, "__asm"))
5087 {
5088 /*
5089 ** We need this because some MS VC++ include files
5090 ** have __asm mov ... }
5091 ** Its a kludge, but otherwise would need to parse
5092 ** the asm code!
5093 */
5094 return TRBRACE;
5095 }
5096 }
5097
5098 if (ic == '\n')
5099 {
5100 context_incLineno ();
5101
5102 if (cstring_equalLit (id, "__asm")
5103 && !useparens && !usebraces)
5104 {
5105 break;
5106 }
5107 }
5108 }
5109
5110 llassert ((useparens && ic == ')')
5111 || (usebraces && ic == '}')
5112 || (!useparens && !usebraces));
5113
1ac6313d 5114 if (cstring_equalLit (id, "__extension__"))
5115 {
5116 tokLength = 0;
5117 tok = QEXTENSION;
5118 }
5119 else
5120 {
5121 return BADTOK;
5122 }
885824d3 5123 }
5124 else if (cstring_equalLit (id, "inline")
5125 || cstring_equalLit (id, "__inline")
5126 || cstring_equalLit (id, "_inline")
5127 || cstring_equalLit (id, "__inline__"))
5128 {
5129 tok = QINLINE;
5130 }
5131
5132 if (tok != BADTOK)
5133 {
5134 RETURN_TOK (tok);
5135 }
5136 }
5137
5138 le = usymtab_lookupSafe (id);
5139
5140 /*@-dependenttrans@*/
5141
5142 if (uentry_isIter (le))
5143 {
5144 yylval.entry = le;
5145 return (ITER_NAME);
5146 }
5147 else if (uentry_isEndIter (le))
5148 {
5149 yylval.entry = le;
5150 return (ITER_ENDNAME);
5151 }
5152 else if (uentry_isUndefined (le))
5153 {
5154 yylval.cname = id;
5155
5156 /* avoid parse errors for certain system built ins */
5157
5158 if (g_expectingTypeName && (cstring_firstChar (id) == '_')
5159 && (cstring_secondChar (id) == '_'))
5160 {
1ac6313d 5161 yylval.ctyp = ctype_unknown;
885824d3 5162 return (TYPE_NAME_OR_ID);
5163 }
5164
5165 return (NEW_IDENTIFIER);
5166 }
5167 else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le))
5168 {
5169 if (uentry_isDatatype (le))
5170 {
5171 yylval.cname = id;
5172 return (NEW_IDENTIFIER);
5173 }
5174 else
5175 {
5176 yylval.entry = le;
5177 return (IDENTIFIER);
5178 }
5179 }
5180 else if (uentry_isDatatype (le))
5181 {
5182 if (!g_expectingTypeName)
5183 {
5184 yylval.cname = id;
5185
5186 return (NEW_IDENTIFIER);
5187 }
5188 else
5189 {
5190 yylval.ctyp = uentry_getAbstractType (le);
5191
5192 uentry_setUsed (le, g_currentloc);
5193 return (TYPE_NAME);
5194 }
5195 }
5196 else
5197 {
5198 yylval.entry = le;
5199 return (IDENTIFIER);
5200 }
5201
5202 /*@=dependenttrans@*/
5203}
5204
5205static bool processHashIdentifier (/*@only@*/ cstring id)
5206{
5207 if (context_inMacro () || context_inIterDef () ||
5208 context_inIterEnd ())
5209 {
5210 uentry le;
5211
5212 context_clearJustPopped ();
5213
5214 lastidprocessed = id;
5215 le = usymtab_lookupSafe (id);
5216
5217 if (uentry_isParam (le) || uentry_isRefParam (le))
5218 {
5219 return TRUE;
5220 }
5221 else
5222 {
5223 return FALSE;
5224 }
5225 }
5226 else
5227 {
5228 cstring_free (id);
5229 return FALSE;
5230 }
5231}
5232
5233
5234static /*@only@*/ exprNode processString ()
5235{
5236 exprNode res;
5237 fileloc loc;
5238 char *nl = strchr (yytext, '\n');
5239 cstring ns = cstring_fromCharsNew (yytext);
5240
5241 if (nl == NULL)
5242 {
5243 loc = fileloc_copy (g_currentloc);
5244 addColumn (cstring_length (ns));
5245 }
5246 else
5247 {
5248 char *lastnl = nl;
5249
5250 loc = fileloc_copy (g_currentloc);
5251
5252 context_incLineno ();
5253
5254 while ((nl = strchr ((nl + 1), '\n')) != NULL)
5255 {
5256 context_incLineno ();
5257 lastnl = nl;
5258 }
5259 }
5260
5261
5262 res = exprNode_stringLiteral (ns, loc);
5263 return (res);
5264}
5265
5266static
5267char processChar ()
5268{
5269 char fchar;
5270 char next;
5271
5272 llassert (*yytext != '\0');
5273 fchar = *(yytext + 1);
5274 if (fchar != '\\') return fchar;
5275
5276 next = *(yytext + 2);
1ac6313d 5277
885824d3 5278 switch (next)
5279 {
5280 case 'n': return '\n';
5281 case 't': return '\t';
5282 case '\"': return '\"';
5283 case '\'': return '\'';
5284 case '\\': return '\\';
5285 default: return '\0';
5286 }
5287}
5288
5289static
5290double processFloat ()
5291{
5292 double ret = atof (yytext);
5293
5294 return (ret);
5295}
5296
5297static
5298long processHex ()
5299{
885824d3 5300 llassert (yytext[0] == '0'
5301 && (yytext[1] == 'X' || yytext[1] == 'x'));
5302
1ac6313d 5303 /*
5304 ** Note: this does not get the correct value, but we only care
5305 ** is it is non-zero.
5306 */
885824d3 5307
1ac6313d 5308 return (atol (yytext + 2));
885824d3 5309}
5310
5311static
5312long processDec ()
5313{
5314 return (atol (yytext));
5315}
5316
5317static int
5318processSpec (int tok)
5319{
5320 size_t length = strlen (yytext);
5321
5322
5323 if (inSpecPart)
5324 {
5325 setTokLengthT (length);
5326 RETURN_TOK (tok);
5327 }
5328 else
5329 {
5330
5331 context_saveLocation ();
5332 setTokLengthT (length);
5333 return (processIdentifier (makeIdentifier (yytext)));
5334 }
5335}
This page took 0.839294 seconds and 5 git commands to generate.