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