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