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