1 #define yy_create_buffer parser__create_buffer
2 #define yy_delete_buffer parser__delete_buffer
3 #define yy_scan_buffer parser__scan_buffer
4 #define yy_scan_string parser__scan_string
5 #define yy_scan_bytes parser__scan_bytes
6 #define yy_flex_debug parser__flex_debug
7 #define yy_init_buffer parser__init_buffer
8 #define yy_flush_buffer parser__flush_buffer
9 #define yy_load_buffer_state parser__load_buffer_state
10 #define yy_switch_to_buffer parser__switch_to_buffer
11 #define yyin parser_in
12 #define yyleng parser_leng
13 #define yylex parser_lex
14 #define yyout parser_out
15 #define yyrestart parser_restart
16 #define yytext parser_text
17 #define yywrap parser_wrap
19 #line 20 "parser.yy.c"
20 /* A lexical scanner generated by flex */
22 /* Scanner skeleton version:
23 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
27 #define YY_FLEX_MAJOR_VERSION 2
28 #define YY_FLEX_MINOR_VERSION 5
33 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
46 /* Use prototypes in function declarations. */
49 /* The "const" storage-class-modifier is valid. */
52 #else /* ! __cplusplus */
60 #endif /* ! __cplusplus */
79 #define YY_PROTO(proto) proto
81 #define YY_PROTO(proto) ()
84 /* Returned upon end-of-file. */
87 /* Promotes a possibly negative, possibly signed char to an unsigned
88 * integer for use as an array index. If the signed char is negative,
89 * we want to instead treat it as an 8-bit unsigned char, hence the
92 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
94 /* Enter a start condition. This macro really ought to take a parameter,
95 * but we do it the disgusting crufty way forced on us by the ()-less
96 * definition of BEGIN.
98 #define BEGIN yy_start = 1 + 2 *
100 /* Translate the current start state into a value that can be later handed
101 * to BEGIN to return to the state. The YYSTATE alias is for lex
104 #define YY_START ((yy_start - 1) / 2)
105 #define YYSTATE YY_START
107 /* Action number for EOF rule of a given start state. */
108 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
110 /* Special action meaning "start processing a new file". */
111 #define YY_NEW_FILE yyrestart( yyin )
113 #define YY_END_OF_BUFFER_CHAR 0
115 /* Size of default input buffer. */
116 #define YY_BUF_SIZE 16384
118 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
121 extern FILE *yyin
, *yyout
;
123 #define EOB_ACT_CONTINUE_SCAN 0
124 #define EOB_ACT_END_OF_FILE 1
125 #define EOB_ACT_LAST_MATCH 2
127 /* The funky do-while in the following #define is used to turn the definition
128 * int a single C statement (which needs a semi-colon terminator). This
129 * avoids problems with code like:
131 * if ( condition_holds )
134 * do_something_else();
136 * Prior to using the do-while the compiler would get upset at the
137 * "else" because it interpreted the "if" statement as being all
138 * done when it reached the ';' after the yyless() call.
141 /* Return all but the first 'n' matched characters back to the input stream. */
146 /* Undo effects of setting up yytext. */ \
147 *yy_cp = yy_hold_char; \
148 YY_RESTORE_YY_MORE_OFFSET \
149 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
150 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
154 #define unput(c) yyunput( c, yytext_ptr )
156 /* The following is because we cannot portably get our hands on size_t
157 * (without autoconf's help, which isn't available because we want
158 * flex-generated scanners to compile on their own).
160 typedef unsigned int yy_size_t
;
163 struct yy_buffer_state
167 char *yy_ch_buf
; /* input buffer */
168 char *yy_buf_pos
; /* current position in input buffer */
170 /* Size of input buffer in bytes, not including room for EOB
173 yy_size_t yy_buf_size
;
175 /* Number of characters read into yy_ch_buf, not including EOB
180 /* Whether we "own" the buffer - i.e., we know we created it,
181 * and can realloc() it to grow it, and should free() it to
184 int yy_is_our_buffer
;
186 /* Whether this is an "interactive" input source; if so, and
187 * if we're using stdio for input, then we want to use getc()
188 * instead of fread(), to make sure we stop fetching input after
191 int yy_is_interactive
;
193 /* Whether we're considered to be at the beginning of a line.
194 * If so, '^' rules will be active on the next match, otherwise
199 /* Whether to try to fill the input buffer when we reach the
204 int yy_buffer_status
;
205 #define YY_BUFFER_NEW 0
206 #define YY_BUFFER_NORMAL 1
207 /* When an EOF's been seen but there's still some text to process
208 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
209 * shouldn't try reading from the input source any more. We might
210 * still have a bunch of tokens to match, though, because of
211 * possible backing-up.
213 * When we actually see the EOF, we change the status to "new"
214 * (via yyrestart()), so that the user can continue scanning by
215 * just pointing yyin at a new input file.
217 #define YY_BUFFER_EOF_PENDING 2
220 static YY_BUFFER_STATE yy_current_buffer
= 0;
222 /* We provide macros for accessing buffer states in case in the
223 * future we want to put the buffer states in a more general
226 #define YY_CURRENT_BUFFER yy_current_buffer
229 /* yy_hold_char holds the character lost when yytext is formed. */
230 static char yy_hold_char
;
232 static int yy_n_chars
; /* number of characters read into yy_ch_buf */
237 /* Points to current character in buffer. */
238 static char *yy_c_buf_p
= (char *) 0;
239 static int yy_init
= 1; /* whether we need to initialize */
240 static int yy_start
= 0; /* start state number */
242 /* Flag which is used to allow yywrap()'s to do buffer switches
243 * instead of setting up a fresh yyin. A bit of a hack ...
245 static int yy_did_buffer_switch_on_eof
;
247 void yyrestart
YY_PROTO(( FILE *input_file
));
249 void yy_switch_to_buffer
YY_PROTO(( YY_BUFFER_STATE new_buffer
));
250 void yy_load_buffer_state
YY_PROTO(( void ));
251 YY_BUFFER_STATE yy_create_buffer
YY_PROTO(( FILE *file
, int size
));
252 void yy_delete_buffer
YY_PROTO(( YY_BUFFER_STATE b
));
253 void yy_init_buffer
YY_PROTO(( YY_BUFFER_STATE b
, FILE *file
));
254 void yy_flush_buffer
YY_PROTO(( YY_BUFFER_STATE b
));
255 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
257 YY_BUFFER_STATE yy_scan_buffer
YY_PROTO(( char *base
, yy_size_t size
));
258 YY_BUFFER_STATE yy_scan_string
YY_PROTO(( yyconst
char *yy_str
));
259 YY_BUFFER_STATE yy_scan_bytes
YY_PROTO(( yyconst
char *bytes
, int len
));
261 static void *yy_flex_alloc
YY_PROTO(( yy_size_t
));
262 static void *yy_flex_realloc
YY_PROTO(( void *, yy_size_t
));
263 static void yy_flex_free
YY_PROTO(( void * ));
265 #define yy_new_buffer yy_create_buffer
267 #define yy_set_interactive(is_interactive) \
269 if ( ! yy_current_buffer ) \
270 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
271 yy_current_buffer->yy_is_interactive = is_interactive; \
274 #define yy_set_bol(at_bol) \
276 if ( ! yy_current_buffer ) \
277 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
278 yy_current_buffer->yy_at_bol = at_bol; \
281 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
283 typedef unsigned char YY_CHAR
;
284 FILE *yyin
= (FILE *) 0, *yyout
= (FILE *) 0;
285 typedef int yy_state_type
;
287 #define yytext_ptr yytext
289 static yy_state_type yy_get_previous_state
YY_PROTO(( void ));
290 static yy_state_type yy_try_NUL_trans
YY_PROTO(( yy_state_type current_state
));
291 static int yy_get_next_buffer
YY_PROTO(( void ));
292 static void yy_fatal_error
YY_PROTO(( yyconst
char msg
[] ));
294 /* Done after the current pattern has been matched and before the
295 * corresponding action - sets up yytext.
297 #define YY_DO_BEFORE_ACTION \
298 yytext_ptr = yy_bp; \
299 yyleng = (int) (yy_cp - yy_bp); \
300 yy_hold_char = *yy_cp; \
304 #define YY_NUM_RULES 32
305 #define YY_END_OF_BUFFER 33
306 static yyconst
short int yy_accept
[139] =
308 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
309 33, 31, 21, 20, 31, 3, 31, 31, 16, 16,
310 31, 31, 31, 19, 19, 19, 11, 31, 21, 1,
311 10, 32, 4, 10, 6, 16, 16, 13, 13, 13,
312 12, 2, 26, 30, 24, 0, 16, 16, 16, 0,
313 22, 28, 25, 27, 23, 19, 5, 19, 29, 0,
314 1, 1, 9, 8, 7, 16, 0, 13, 13, 2,
315 17, 16, 16, 15, 19, 16, 0, 13, 0, 15,
316 15, 19, 16, 0, 13, 0, 17, 15, 15, 19,
317 16, 0, 13, 19, 16, 0, 13, 19, 16, 0,
319 13, 19, 16, 0, 13, 19, 0, 16, 0, 18,
320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
322 0, 0, 0, 0, 0, 0, 14, 0
325 static yyconst
int yy_ec
[256] =
327 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
328 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 2, 4, 5, 6, 1, 1, 7, 1, 8,
331 1, 1, 9, 1, 10, 11, 1, 12, 13, 13,
332 13, 13, 13, 13, 13, 13, 13, 1, 1, 14,
333 15, 16, 1, 1, 17, 18, 18, 18, 19, 20,
334 21, 21, 21, 21, 21, 22, 21, 21, 21, 21,
335 21, 23, 24, 21, 25, 21, 21, 26, 27, 21,
336 28, 29, 30, 1, 21, 1, 18, 18, 18, 18,
338 31, 18, 21, 21, 21, 21, 21, 32, 21, 21,
339 21, 21, 21, 21, 21, 21, 33, 21, 21, 34,
340 21, 21, 1, 35, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357 static yyconst
int yy_meta
[36] =
359 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
360 1, 3, 3, 1, 1, 1, 3, 3, 3, 3,
361 4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
365 static yyconst
short int yy_base
[175] =
367 0, 34, 34, 38, 39, 42, 71, 44, 268, 267,
368 265, 491, 491, 491, 249, 491, 256, 241, 96, 22,
369 37, 241, 38, 0, 250, 237, 491, 218, 53, 249,
370 491, 491, 491, 33, 491, 119, 23, 142, 165, 245,
371 491, 0, 491, 491, 491, 48, 0, 33, 88, 0,
372 491, 491, 491, 491, 491, 0, 491, 228, 491, 63,
373 241, 240, 491, 491, 491, 185, 0, 207, 0, 0,
374 104, 491, 491, 124, 222, 227, 0, 249, 102, 94,
375 102, 220, 269, 0, 291, 113, 168, 491, 491, 213,
376 311, 0, 333, 212, 353, 0, 375, 217, 395, 0,
378 417, 206, 439, 222, 221, 62, 0, 220, 140, 491,
379 0, 0, 0, 219, 0, 0, 0, 0, 218, 0,
380 0, 0, 0, 213, 0, 0, 0, 0, 0, 0,
381 0, 0, 0, 0, 0, 0, 491, 491, 472, 476,
382 478, 482, 486, 219, 218, 212, 211, 210, 209, 208,
383 206, 205, 203, 198, 197, 192, 191, 190, 189, 188,
384 187, 186, 185, 183, 176, 169, 168, 167, 155, 144,
388 static yyconst
short int yy_def
[175] =
390 138, 1, 139, 139, 139, 139, 138, 7, 140, 140,
391 138, 138, 138, 138, 138, 138, 138, 138, 138, 19,
392 138, 138, 138, 141, 141, 141, 138, 138, 138, 138,
393 138, 138, 138, 142, 138, 138, 36, 138, 38, 39,
394 138, 143, 138, 138, 138, 138, 20, 138, 138, 144,
395 138, 138, 138, 138, 138, 141, 138, 141, 138, 138,
396 138, 138, 138, 138, 138, 138, 145, 39, 39, 143,
397 138, 138, 138, 144, 141, 138, 146, 39, 138, 138,
398 138, 141, 138, 147, 39, 138, 138, 138, 138, 141,
399 138, 148, 39, 141, 138, 149, 39, 141, 138, 150,
401 39, 141, 138, 138, 39, 141, 151, 103, 138, 138,
402 152, 153, 154, 138, 155, 156, 157, 158, 138, 159,
403 160, 161, 162, 138, 163, 164, 165, 166, 167, 168,
404 169, 170, 171, 172, 173, 174, 138, 0, 138, 138,
405 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
406 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
407 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
411 static yyconst
short int yy_nxt
[527] =
413 12, 13, 14, 15, 16, 12, 17, 12, 12, 18,
414 12, 19, 20, 21, 22, 23, 24, 24, 24, 24,
415 24, 25, 24, 26, 24, 24, 24, 27, 12, 12,
416 24, 24, 24, 24, 28, 29, 32, 64, 33, 30,
417 32, 32, 33, 35, 32, 29, 35, 138, 138, 30,
418 51, 52, 54, 55, 60, 138, 138, 72, 61, 71,
419 71, 65, 34, 109, 60, 72, 34, 34, 61, 110,
420 34, 12, 13, 14, 15, 16, 12, 17, 12, 12,
421 18, 12, 36, 37, 21, 22, 23, 38, 38, 38,
422 38, 39, 40, 39, 39, 39, 39, 39, 27, 12,
424 41, 38, 39, 39, 39, 28, 46, 47, 47, 73,
425 86, 86, 137, 87, 87, 71, 71, 48, 88, 73,
426 49, 50, 79, 89, 87, 87, 88, 48, 49, 50,
427 66, 66, 136, 89, 79, 67, 67, 67, 67, 135,
428 48, 109, 134, 49, 50, 80, 133, 110, 81, 67,
429 48, 49, 50, 68, 68, 80, 81, 132, 68, 68,
430 68, 68, 69, 69, 69, 69, 69, 69, 69, 131,
431 130, 129, 68, 69, 69, 69, 69, 69, 128, 87,
432 87, 69, 69, 69, 69, 127, 79, 126, 124, 123,
433 122, 121, 119, 118, 117, 69, 76, 76, 79, 116,
435 114, 77, 77, 77, 77, 113, 48, 112, 111, 49,
436 104, 100, 96, 92, 84, 77, 48, 49, 78, 78,
437 77, 74, 125, 78, 78, 78, 78, 120, 115, 138,
438 107, 107, 106, 102, 98, 94, 90, 78, 83, 83,
439 82, 62, 62, 84, 84, 84, 84, 75, 48, 57,
440 62, 49, 59, 58, 57, 53, 45, 84, 48, 49,
441 85, 85, 44, 43, 138, 85, 85, 85, 85, 32,
442 32, 138, 138, 138, 138, 138, 138, 138, 138, 85,
443 91, 91, 138, 138, 138, 92, 92, 92, 92, 138,
444 48, 138, 138, 49, 138, 138, 138, 138, 138, 92,
446 48, 49, 93, 93, 138, 138, 138, 93, 93, 93,
447 93, 138, 138, 138, 138, 138, 138, 138, 138, 138,
448 138, 93, 95, 95, 138, 138, 138, 96, 96, 96,
449 96, 138, 48, 138, 138, 49, 138, 138, 138, 138,
450 138, 96, 48, 49, 97, 97, 138, 138, 138, 97,
451 97, 97, 97, 138, 138, 138, 138, 138, 138, 138,
452 138, 138, 138, 97, 99, 99, 138, 138, 138, 100,
453 100, 100, 100, 138, 48, 138, 138, 49, 138, 138,
454 138, 138, 138, 100, 48, 49, 101, 101, 138, 138,
455 138, 101, 101, 101, 101, 138, 138, 138, 138, 138,
457 138, 138, 138, 138, 138, 101, 103, 103, 138, 138,
458 138, 104, 104, 104, 104, 138, 48, 138, 138, 49,
459 138, 138, 138, 138, 138, 104, 48, 49, 105, 105,
460 138, 138, 138, 105, 105, 105, 105, 138, 138, 138,
461 138, 138, 138, 138, 138, 138, 138, 105, 107, 138,
462 108, 108, 138, 138, 138, 138, 138, 138, 138, 138,
463 48, 138, 138, 49, 138, 138, 138, 138, 138, 138,
464 48, 49, 31, 31, 31, 31, 42, 42, 42, 42,
465 56, 56, 63, 138, 63, 63, 70, 138, 70, 70,
466 11, 138, 138, 138, 138, 138, 138, 138, 138, 138,
468 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
469 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
470 138, 138, 138, 138, 138, 138
473 static yyconst
short int yy_chk
[527] =
475 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
476 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
477 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
478 1, 1, 1, 1, 1, 2, 3, 34, 3, 2,
479 4, 5, 4, 5, 6, 8, 6, 20, 37, 8,
480 21, 21, 23, 23, 29, 20, 37, 48, 29, 46,
481 46, 34, 3, 106, 60, 48, 4, 5, 60, 106,
482 6, 7, 7, 7, 7, 7, 7, 7, 7, 7,
483 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
484 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
486 7, 7, 7, 7, 7, 7, 19, 19, 19, 49,
487 79, 79, 174, 79, 79, 71, 71, 19, 80, 49,
488 19, 19, 71, 81, 86, 86, 80, 19, 19, 19,
489 36, 36, 173, 81, 71, 36, 36, 36, 36, 172,
490 36, 109, 171, 36, 36, 74, 170, 109, 74, 36,
491 36, 36, 36, 38, 38, 74, 74, 169, 38, 38,
492 38, 38, 38, 38, 38, 38, 38, 38, 38, 168,
493 167, 166, 38, 38, 38, 38, 39, 39, 165, 87,
494 87, 39, 39, 39, 39, 164, 87, 163, 162, 161,
495 160, 159, 158, 157, 156, 39, 66, 66, 87, 155,
497 154, 66, 66, 66, 66, 153, 66, 152, 151, 66,
498 150, 149, 148, 147, 146, 66, 66, 66, 68, 68,
499 145, 144, 124, 68, 68, 68, 68, 119, 114, 108,
500 105, 104, 102, 98, 94, 90, 82, 68, 76, 76,
501 75, 62, 61, 76, 76, 76, 76, 58, 76, 40,
502 30, 76, 28, 26, 25, 22, 18, 76, 76, 76,
503 78, 78, 17, 15, 11, 78, 78, 78, 78, 10,
504 9, 0, 0, 0, 0, 0, 0, 0, 0, 78,
505 83, 83, 0, 0, 0, 83, 83, 83, 83, 0,
506 83, 0, 0, 83, 0, 0, 0, 0, 0, 83,
508 83, 83, 85, 85, 0, 0, 0, 85, 85, 85,
509 85, 0, 0, 0, 0, 0, 0, 0, 0, 0,
510 0, 85, 91, 91, 0, 0, 0, 91, 91, 91,
511 91, 0, 91, 0, 0, 91, 0, 0, 0, 0,
512 0, 91, 91, 91, 93, 93, 0, 0, 0, 93,
513 93, 93, 93, 0, 0, 0, 0, 0, 0, 0,
514 0, 0, 0, 93, 95, 95, 0, 0, 0, 95,
515 95, 95, 95, 0, 95, 0, 0, 95, 0, 0,
516 0, 0, 0, 95, 95, 95, 97, 97, 0, 0,
517 0, 97, 97, 97, 97, 0, 0, 0, 0, 0,
519 0, 0, 0, 0, 0, 97, 99, 99, 0, 0,
520 0, 99, 99, 99, 99, 0, 99, 0, 0, 99,
521 0, 0, 0, 0, 0, 99, 99, 99, 101, 101,
522 0, 0, 0, 101, 101, 101, 101, 0, 0, 0,
523 0, 0, 0, 0, 0, 0, 0, 101, 103, 0,
524 103, 103, 0, 0, 0, 0, 0, 0, 0, 0,
525 103, 0, 0, 103, 0, 0, 0, 0, 0, 0,
526 103, 103, 139, 139, 139, 139, 140, 140, 140, 140,
527 141, 141, 142, 0, 142, 142, 143, 0, 143, 143,
528 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
530 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
531 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
532 138, 138, 138, 138, 138, 138
535 static yy_state_type yy_last_accepting_state
;
536 static char *yy_last_accepting_cpos
;
538 /* The intent behind this definition is that it'll catch
539 * any uses of REJECT which flex missed.
541 #define REJECT reject_used_but_not_detected
542 #define yymore() yymore_used_but_not_detected
543 #define YY_MORE_ADJ 0
544 #define YY_RESTORE_YY_MORE_OFFSET
551 * Copyright 2002 Ove Kaaven
553 * This library is free software; you can redistribute it and/or
554 * modify it under the terms of the GNU Lesser General Public
555 * License as published by the Free Software Foundation; either
556 * version 2.1 of the License, or (at your option) any later version.
558 * This library is distributed in the hope that it will be useful,
559 * but WITHOUT ANY WARRANTY; without even the implied warranty of
560 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
561 * Lesser General Public License for more details.
563 * You should have received a copy of the GNU Lesser General Public
564 * License along with this library; if not, write to the Free Software
565 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
567 #define YY_STACK_USED 1
568 #define YY_NO_INPUT 1
569 #define YY_NO_UNPUT 1
570 #define YY_NO_TOP_STATE 1
571 #define YY_NEVER_INTERACTIVE 1
593 #define YY_NO_UNISTD_H
599 #include "wine/wpp.h"
601 #include "parser.tab.h"
603 extern char *temp_name
;
605 static void addcchar(char c
);
606 static char *get_buffered_cstring(void);
608 static char *cbuffer
;
610 static int cbufalloc
= 0;
612 static int kw_token(const char *kw
);
613 static int attr_token(const char *kw
);
615 #define MAX_IMPORT_DEPTH 10
617 YY_BUFFER_STATE state
;
621 } import_stack
[MAX_IMPORT_DEPTH
];
622 int import_stack_ptr
= 0;
624 UUID
*parse_uuid(const char *u
)
626 UUID
* uuid
= xmalloc(sizeof(UUID
));
628 /* it would be nice to use UuidFromStringA */
629 uuid
->Data1
= strtoul(u
, NULL
, 16);
630 uuid
->Data2
= strtoul(u
+9, NULL
, 16);
631 uuid
->Data3
= strtoul(u
+14, NULL
, 16);
633 memcpy(b
, u
+19, 2); uuid
->Data4
[0] = strtoul(b
, NULL
, 16);
634 memcpy(b
, u
+21, 2); uuid
->Data4
[1] = strtoul(b
, NULL
, 16);
635 memcpy(b
, u
+24, 2); uuid
->Data4
[2] = strtoul(b
, NULL
, 16);
636 memcpy(b
, u
+26, 2); uuid
->Data4
[3] = strtoul(b
, NULL
, 16);
637 memcpy(b
, u
+28, 2); uuid
->Data4
[4] = strtoul(b
, NULL
, 16);
638 memcpy(b
, u
+30, 2); uuid
->Data4
[5] = strtoul(b
, NULL
, 16);
639 memcpy(b
, u
+32, 2); uuid
->Data4
[6] = strtoul(b
, NULL
, 16);
640 memcpy(b
, u
+34, 2); uuid
->Data4
[7] = strtoul(b
, NULL
, 16);
645 **************************************************************************
646 * The flexer starts here
647 **************************************************************************
649 #line 650 "parser.yy.c"
651 /* Macros after this point can all be overridden by user definitions in
655 #ifndef YY_SKIP_YYWRAP
657 extern "C" int yywrap
YY_PROTO(( void ));
659 extern int yywrap
YY_PROTO(( void ));
664 static void yyunput
YY_PROTO(( int c
, char *buf_ptr
));
668 static void yy_flex_strncpy
YY_PROTO(( char *, yyconst
char *, int ));
671 #ifdef YY_NEED_STRLEN
672 static int yy_flex_strlen
YY_PROTO(( yyconst
char * ));
677 static int yyinput
YY_PROTO(( void ));
679 static int input
YY_PROTO(( void ));
684 static int yy_start_stack_ptr
= 0;
685 static int yy_start_stack_depth
= 0;
686 static int *yy_start_stack
= 0;
687 #ifndef YY_NO_PUSH_STATE
688 static void yy_push_state
YY_PROTO(( int new_state
));
690 #ifndef YY_NO_POP_STATE
691 static void yy_pop_state
YY_PROTO(( void ));
693 #ifndef YY_NO_TOP_STATE
694 static int yy_top_state
YY_PROTO(( void ));
698 #define YY_NO_PUSH_STATE 1
699 #define YY_NO_POP_STATE 1
700 #define YY_NO_TOP_STATE 1
703 #ifdef YY_MALLOC_DECL
711 /* Just try to get by without declaring the routines. This will fail
712 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
713 * or sizeof(void*) != sizeof(int).
718 /* Amount of stuff to slurp up with each read. */
719 #ifndef YY_READ_BUF_SIZE
720 #define YY_READ_BUF_SIZE 8192
723 /* Copy whatever the last rule matched to the standard output. */
726 /* This used to be an fputs(), but since the string might contain NUL's,
727 * we now use fwrite().
729 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
732 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
733 * is returned in "result".
736 #define YY_INPUT(buf,result,max_size) \
737 if ( yy_current_buffer->yy_is_interactive ) \
740 for ( n = 0; n < max_size && \
741 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
744 buf[n++] = (char) c; \
745 if ( c == EOF && ferror( yyin ) ) \
746 YY_FATAL_ERROR( "input in flex scanner failed" ); \
749 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
750 && ferror( yyin ) ) \
751 YY_FATAL_ERROR( "input in flex scanner failed" );
754 /* No semi-colon after return; correct usage is to write "yyterminate();" -
755 * we don't want an extra ';' after the "return" because that will cause
756 * some compilers to complain about unreachable statements.
759 #define yyterminate() return YY_NULL
762 /* Number of entries by which start-condition stack grows. */
763 #ifndef YY_START_STACK_INCR
764 #define YY_START_STACK_INCR 25
767 /* Report a fatal error. */
768 #ifndef YY_FATAL_ERROR
769 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
772 /* Default declaration of generated scanner - a define so the user can
773 * easily add parameters.
776 #define YY_DECL int yylex YY_PROTO(( void ))
779 /* Code executed at the beginning of each rule, after yytext and yyleng
782 #ifndef YY_USER_ACTION
783 #define YY_USER_ACTION
786 /* Code executed at the end of each rule. */
788 #define YY_BREAK break;
791 #define YY_RULE_SETUP \
793 yy_current_buffer->yy_at_bol = \
794 (yytext[yyleng - 1] == '\n'); \
799 register yy_state_type yy_current_state
;
800 register char *yy_cp
, *yy_bp
;
805 #line 806 "parser.yy.c"
816 yy_start
= 1; /* first start state */
824 if ( ! yy_current_buffer
)
826 yy_create_buffer( yyin
, YY_BUF_SIZE
);
828 yy_load_buffer_state();
831 while ( 1 ) /* loops until end-of-file is reached */
835 /* Support of yytext. */
836 *yy_cp
= yy_hold_char
;
838 /* yy_bp points to the position in yy_ch_buf of the start of
843 yy_current_state
= yy_start
;
844 yy_current_state
+= YY_AT_BOL();
848 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
849 if ( yy_accept
[yy_current_state
] )
851 yy_last_accepting_state
= yy_current_state
;
852 yy_last_accepting_cpos
= yy_cp
;
854 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
856 yy_current_state
= (int) yy_def
[yy_current_state
];
857 if ( yy_current_state
>= 139 )
858 yy_c
= yy_meta
[(unsigned int) yy_c
];
860 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
863 while ( yy_base
[yy_current_state
] != 491 );
866 yy_act
= yy_accept
[yy_current_state
];
868 { /* have to back up */
869 yy_cp
= yy_last_accepting_cpos
;
870 yy_current_state
= yy_last_accepting_state
;
871 yy_act
= yy_accept
[yy_current_state
];
877 do_action
: /* This label is used only to access EOF actions. */
881 { /* beginning of action switch */
882 case 0: /* must back up */
883 /* undo the effects of YY_DO_BEFORE_ACTION */
884 *yy_cp
= yy_hold_char
;
885 yy_cp
= yy_last_accepting_cpos
;
886 yy_current_state
= yy_last_accepting_state
;
892 yy_push_state(PP_LINE
);
901 lineno
= (int)strtol(yytext
, &cptr
, 10);
903 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
904 fname
= strchr(cptr
, '"');
906 error_loc("Malformed '#...' line-directive; missing filename\n");
908 cptr
= strchr(fname
, '"');
910 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
912 line_number
= lineno
- 1; /* We didn't read the newline */
914 input_name
= xstrdup(fname
);
920 yy_push_state(QUOTE
); cbufidx
= 0;
927 parser_lval
.str
= get_buffered_cstring();
934 yy_push_state(WSTRQUOTE
);
941 parser_lval
.str
= get_buffered_cstring();
955 addcchar('\\'); addcchar(yytext
[1]);
965 yy_push_state(ATTR
); return '[';
970 yy_pop_state(); return ']';
975 return attr_token(yytext
);
981 parser_lval
.uuid
= parse_uuid(yytext
);
989 parser_lval
.num
= strtoul(yytext
, NULL
, 0);
997 parser_lval
.num
= strtoul(yytext
, NULL
, 0);
1003 #line 164 "parser.l"
1005 parser_lval
.dbl
= strtod(yytext
, NULL
);
1010 *yy_cp
= yy_hold_char
; /* undo effects of setting up yytext */
1011 yy_c_buf_p
= yy_cp
-= 1;
1012 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1014 #line 168 "parser.l"
1019 #line 169 "parser.l"
1020 return kw_token(yytext
);
1024 #line 170 "parser.l"
1029 #line 171 "parser.l"
1034 #line 172 "parser.l"
1039 #line 173 "parser.l"
1044 #line 174 "parser.l"
1049 #line 175 "parser.l"
1054 #line 176 "parser.l"
1059 #line 177 "parser.l"
1060 return GREATEREQUAL
;
1064 #line 178 "parser.l"
1069 #line 179 "parser.l"
1074 #line 180 "parser.l"
1079 #line 181 "parser.l"
1082 case YY_STATE_EOF(INITIAL
):
1083 case YY_STATE_EOF(QUOTE
):
1084 case YY_STATE_EOF(WSTRQUOTE
):
1085 case YY_STATE_EOF(ATTR
):
1086 case YY_STATE_EOF(PP_LINE
):
1087 #line 182 "parser.l"
1089 if (import_stack_ptr
)
1096 #line 187 "parser.l"
1099 #line 1100 "parser.yy.c"
1101 case YY_END_OF_BUFFER
:
1103 /* Amount of text matched not including the EOB char. */
1104 int yy_amount_of_matched_text
= (int) (yy_cp
- yytext_ptr
) - 1;
1106 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1107 *yy_cp
= yy_hold_char
;
1108 YY_RESTORE_YY_MORE_OFFSET
1110 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_NEW
)
1112 /* We're scanning a new file or input source. It's
1113 * possible that this happened because the user
1114 * just pointed yyin at a new source and called
1115 * yylex(). If so, then we have to assure
1116 * consistency between yy_current_buffer and our
1117 * globals. Here is the right place to do so, because
1118 * this is the first action (other than possibly a
1119 * back-up) that will match for the new input source.
1121 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1122 yy_current_buffer
->yy_input_file
= yyin
;
1123 yy_current_buffer
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1126 /* Note that here we test for yy_c_buf_p "<=" to the position
1127 * of the first EOB in the buffer, since yy_c_buf_p will
1128 * already have been incremented past the NUL character
1129 * (since all states make transitions on EOB to the
1130 * end-of-buffer state). Contrast this with the test
1133 if ( yy_c_buf_p
<= &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1134 { /* This was really a NUL. */
1135 yy_state_type yy_next_state
;
1137 yy_c_buf_p
= yytext_ptr
+ yy_amount_of_matched_text
;
1139 yy_current_state
= yy_get_previous_state();
1141 /* Okay, we're now positioned to make the NUL
1142 * transition. We couldn't have
1143 * yy_get_previous_state() go ahead and do it
1144 * for us because it doesn't know how to deal
1145 * with the possibility of jamming (and we don't
1146 * want to build jamming into it because then it
1147 * will run more slowly).
1150 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1152 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1154 if ( yy_next_state
)
1156 /* Consume the NUL. */
1157 yy_cp
= ++yy_c_buf_p
;
1158 yy_current_state
= yy_next_state
;
1165 goto yy_find_action
;
1169 else switch ( yy_get_next_buffer() )
1171 case EOB_ACT_END_OF_FILE
:
1173 yy_did_buffer_switch_on_eof
= 0;
1177 /* Note: because we've taken care in
1178 * yy_get_next_buffer() to have set up
1179 * yytext, we can now set up
1180 * yy_c_buf_p so that if some total
1181 * hoser (like flex itself) wants to
1182 * call the scanner after we return the
1183 * YY_NULL, it'll still work - another
1184 * YY_NULL will get returned.
1186 yy_c_buf_p
= yytext_ptr
+ YY_MORE_ADJ
;
1188 yy_act
= YY_STATE_EOF(YY_START
);
1194 if ( ! yy_did_buffer_switch_on_eof
)
1200 case EOB_ACT_CONTINUE_SCAN
:
1202 yytext_ptr
+ yy_amount_of_matched_text
;
1204 yy_current_state
= yy_get_previous_state();
1207 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1210 case EOB_ACT_LAST_MATCH
:
1212 &yy_current_buffer
->yy_ch_buf
[yy_n_chars
];
1214 yy_current_state
= yy_get_previous_state();
1217 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1218 goto yy_find_action
;
1225 "fatal flex scanner internal error--no action found" );
1226 } /* end of action switch */
1227 } /* end of scanning one token */
1228 } /* end of yylex */
1231 /* yy_get_next_buffer - try to read in a new buffer
1233 * Returns a code representing an action:
1234 * EOB_ACT_LAST_MATCH -
1235 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1236 * EOB_ACT_END_OF_FILE - end of file
1239 static int yy_get_next_buffer()
1241 register char *dest
= yy_current_buffer
->yy_ch_buf
;
1242 register char *source
= yytext_ptr
;
1243 register int number_to_move
, i
;
1246 if ( yy_c_buf_p
> &yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] )
1248 "fatal flex scanner internal error--end of buffer missed" );
1250 if ( yy_current_buffer
->yy_fill_buffer
== 0 )
1251 { /* Don't try to fill the buffer, so this is an EOF. */
1252 if ( yy_c_buf_p
- yytext_ptr
- YY_MORE_ADJ
== 1 )
1254 /* We matched a single character, the EOB, so
1255 * treat this as a final EOF.
1257 return EOB_ACT_END_OF_FILE
;
1262 /* We matched some text prior to the EOB, first
1265 return EOB_ACT_LAST_MATCH
;
1269 /* Try to read more data. */
1271 /* First move last chars to start of buffer. */
1272 number_to_move
= (int) (yy_c_buf_p
- yytext_ptr
) - 1;
1274 for ( i
= 0; i
< number_to_move
; ++i
)
1275 *(dest
++) = *(source
++);
1277 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1278 /* don't do the read, it's not guaranteed to return an EOF,
1281 yy_current_buffer
->yy_n_chars
= yy_n_chars
= 0;
1286 yy_current_buffer
->yy_buf_size
- number_to_move
- 1;
1288 while ( num_to_read
<= 0 )
1289 { /* Not enough room in the buffer - grow it. */
1290 #ifdef YY_USES_REJECT
1292 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1295 /* just a shorter name for the current buffer */
1296 YY_BUFFER_STATE b
= yy_current_buffer
;
1298 int yy_c_buf_p_offset
=
1299 (int) (yy_c_buf_p
- b
->yy_ch_buf
);
1301 if ( b
->yy_is_our_buffer
)
1303 int new_size
= b
->yy_buf_size
* 2;
1305 if ( new_size
<= 0 )
1306 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1308 b
->yy_buf_size
*= 2;
1310 b
->yy_ch_buf
= (char *)
1311 /* Include room in for 2 EOB chars. */
1312 yy_flex_realloc( (void *) b
->yy_ch_buf
,
1313 b
->yy_buf_size
+ 2 );
1316 /* Can't grow it, we don't own it. */
1319 if ( ! b
->yy_ch_buf
)
1321 "fatal error - scanner input buffer overflow" );
1323 yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1325 num_to_read
= yy_current_buffer
->yy_buf_size
-
1330 if ( num_to_read
> YY_READ_BUF_SIZE
)
1331 num_to_read
= YY_READ_BUF_SIZE
;
1333 /* Read in more data. */
1334 YY_INPUT( (&yy_current_buffer
->yy_ch_buf
[number_to_move
]),
1335 yy_n_chars
, num_to_read
);
1337 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1340 if ( yy_n_chars
== 0 )
1342 if ( number_to_move
== YY_MORE_ADJ
)
1344 ret_val
= EOB_ACT_END_OF_FILE
;
1350 ret_val
= EOB_ACT_LAST_MATCH
;
1351 yy_current_buffer
->yy_buffer_status
=
1352 YY_BUFFER_EOF_PENDING
;
1357 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1359 yy_n_chars
+= number_to_move
;
1360 yy_current_buffer
->yy_ch_buf
[yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1361 yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1363 yytext_ptr
= &yy_current_buffer
->yy_ch_buf
[0];
1369 /* yy_get_previous_state - get the state just before the EOB char was reached */
1371 static yy_state_type
yy_get_previous_state()
1373 register yy_state_type yy_current_state
;
1374 register char *yy_cp
;
1376 yy_current_state
= yy_start
;
1377 yy_current_state
+= YY_AT_BOL();
1379 for ( yy_cp
= yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yy_c_buf_p
; ++yy_cp
)
1381 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1382 if ( yy_accept
[yy_current_state
] )
1384 yy_last_accepting_state
= yy_current_state
;
1385 yy_last_accepting_cpos
= yy_cp
;
1387 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1389 yy_current_state
= (int) yy_def
[yy_current_state
];
1390 if ( yy_current_state
>= 139 )
1391 yy_c
= yy_meta
[(unsigned int) yy_c
];
1393 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1396 return yy_current_state
;
1400 /* yy_try_NUL_trans - try to make a transition on the NUL character
1403 * next_state = yy_try_NUL_trans( current_state );
1406 #ifdef YY_USE_PROTOS
1407 static yy_state_type
yy_try_NUL_trans( yy_state_type yy_current_state
)
1409 static yy_state_type
yy_try_NUL_trans( yy_current_state
)
1410 yy_state_type yy_current_state
;
1413 register int yy_is_jam
;
1414 register char *yy_cp
= yy_c_buf_p
;
1416 register YY_CHAR yy_c
= 1;
1417 if ( yy_accept
[yy_current_state
] )
1419 yy_last_accepting_state
= yy_current_state
;
1420 yy_last_accepting_cpos
= yy_cp
;
1422 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1424 yy_current_state
= (int) yy_def
[yy_current_state
];
1425 if ( yy_current_state
>= 139 )
1426 yy_c
= yy_meta
[(unsigned int) yy_c
];
1428 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1429 yy_is_jam
= (yy_current_state
== 138);
1431 return yy_is_jam
? 0 : yy_current_state
;
1436 #ifdef YY_USE_PROTOS
1437 static void yyunput( int c
, register char *yy_bp
)
1439 static void yyunput( c
, yy_bp
)
1441 register char *yy_bp
;
1444 register char *yy_cp
= yy_c_buf_p
;
1446 /* undo effects of setting up yytext */
1447 *yy_cp
= yy_hold_char
;
1449 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1450 { /* need to shift things up to make room */
1451 /* +2 for EOB chars. */
1452 register int number_to_move
= yy_n_chars
+ 2;
1453 register char *dest
= &yy_current_buffer
->yy_ch_buf
[
1454 yy_current_buffer
->yy_buf_size
+ 2];
1455 register char *source
=
1456 &yy_current_buffer
->yy_ch_buf
[number_to_move
];
1458 while ( source
> yy_current_buffer
->yy_ch_buf
)
1459 *--dest
= *--source
;
1461 yy_cp
+= (int) (dest
- source
);
1462 yy_bp
+= (int) (dest
- source
);
1463 yy_current_buffer
->yy_n_chars
=
1464 yy_n_chars
= yy_current_buffer
->yy_buf_size
;
1466 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1467 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1470 *--yy_cp
= (char) c
;
1474 yy_hold_char
= *yy_cp
;
1477 #endif /* ifndef YY_NO_UNPUT */
1481 static int yyinput()
1488 *yy_c_buf_p
= yy_hold_char
;
1490 if ( *yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1492 /* yy_c_buf_p now points to the character we want to return.
1493 * If this occurs *before* the EOB characters, then it's a
1494 * valid NUL; if not, then we've hit the end of the buffer.
1496 if ( yy_c_buf_p
< &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1497 /* This was really a NUL. */
1501 { /* need more input */
1502 int offset
= yy_c_buf_p
- yytext_ptr
;
1505 switch ( yy_get_next_buffer() )
1507 case EOB_ACT_LAST_MATCH
:
1508 /* This happens because yy_g_n_b()
1509 * sees that we've accumulated a
1510 * token and flags that we need to
1511 * try matching the token before
1512 * proceeding. But for input(),
1513 * there's no matching to consider.
1514 * So convert the EOB_ACT_LAST_MATCH
1515 * to EOB_ACT_END_OF_FILE.
1518 /* Reset buffer status. */
1523 case EOB_ACT_END_OF_FILE
:
1528 if ( ! yy_did_buffer_switch_on_eof
)
1537 case EOB_ACT_CONTINUE_SCAN
:
1538 yy_c_buf_p
= yytext_ptr
+ offset
;
1544 c
= *(unsigned char *) yy_c_buf_p
; /* cast for 8-bit char's */
1545 *yy_c_buf_p
= '\0'; /* preserve yytext */
1546 yy_hold_char
= *++yy_c_buf_p
;
1548 yy_current_buffer
->yy_at_bol
= (c
== '\n');
1554 #ifdef YY_USE_PROTOS
1555 void yyrestart( FILE *input_file
)
1557 void yyrestart( input_file
)
1561 if ( ! yy_current_buffer
)
1562 yy_current_buffer
= yy_create_buffer( yyin
, YY_BUF_SIZE
);
1564 yy_init_buffer( yy_current_buffer
, input_file
);
1565 yy_load_buffer_state();
1569 #ifdef YY_USE_PROTOS
1570 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer
)
1572 void yy_switch_to_buffer( new_buffer
)
1573 YY_BUFFER_STATE new_buffer
;
1576 if ( yy_current_buffer
== new_buffer
)
1579 if ( yy_current_buffer
)
1581 /* Flush out information for old buffer. */
1582 *yy_c_buf_p
= yy_hold_char
;
1583 yy_current_buffer
->yy_buf_pos
= yy_c_buf_p
;
1584 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1587 yy_current_buffer
= new_buffer
;
1588 yy_load_buffer_state();
1590 /* We don't actually know whether we did this switch during
1591 * EOF (yywrap()) processing, but the only time this flag
1592 * is looked at is after yywrap() is called, so it's safe
1593 * to go ahead and always set it.
1595 yy_did_buffer_switch_on_eof
= 1;
1599 #ifdef YY_USE_PROTOS
1600 void yy_load_buffer_state( void )
1602 void yy_load_buffer_state()
1605 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1606 yytext_ptr
= yy_c_buf_p
= yy_current_buffer
->yy_buf_pos
;
1607 yyin
= yy_current_buffer
->yy_input_file
;
1608 yy_hold_char
= *yy_c_buf_p
;
1612 #ifdef YY_USE_PROTOS
1613 YY_BUFFER_STATE
yy_create_buffer( FILE *file
, int size
)
1615 YY_BUFFER_STATE
yy_create_buffer( file
, size
)
1622 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1624 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1626 b
->yy_buf_size
= size
;
1628 /* yy_ch_buf has to be 2 characters longer than the size given because
1629 * we need to put in 2 end-of-buffer characters.
1631 b
->yy_ch_buf
= (char *) yy_flex_alloc( b
->yy_buf_size
+ 2 );
1632 if ( ! b
->yy_ch_buf
)
1633 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1635 b
->yy_is_our_buffer
= 1;
1637 yy_init_buffer( b
, file
);
1643 #ifdef YY_USE_PROTOS
1644 void yy_delete_buffer( YY_BUFFER_STATE b
)
1646 void yy_delete_buffer( b
)
1653 if ( b
== yy_current_buffer
)
1654 yy_current_buffer
= (YY_BUFFER_STATE
) 0;
1656 if ( b
->yy_is_our_buffer
)
1657 yy_flex_free( (void *) b
->yy_ch_buf
);
1659 yy_flex_free( (void *) b
);
1663 #ifndef YY_ALWAYS_INTERACTIVE
1664 #ifndef YY_NEVER_INTERACTIVE
1665 extern int isatty
YY_PROTO(( int ));
1669 #ifdef YY_USE_PROTOS
1670 void yy_init_buffer( YY_BUFFER_STATE b
, FILE *file
)
1672 void yy_init_buffer( b
, file
)
1679 yy_flush_buffer( b
);
1681 b
->yy_input_file
= file
;
1682 b
->yy_fill_buffer
= 1;
1684 #if YY_ALWAYS_INTERACTIVE
1685 b
->yy_is_interactive
= 1;
1687 #if YY_NEVER_INTERACTIVE
1688 b
->yy_is_interactive
= 0;
1690 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1696 #ifdef YY_USE_PROTOS
1697 void yy_flush_buffer( YY_BUFFER_STATE b
)
1699 void yy_flush_buffer( b
)
1709 /* We always need two end-of-buffer characters. The first causes
1710 * a transition to the end-of-buffer state. The second causes
1711 * a jam in that state.
1713 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1714 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1716 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1719 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1721 if ( b
== yy_current_buffer
)
1722 yy_load_buffer_state();
1726 #ifndef YY_NO_SCAN_BUFFER
1727 #ifdef YY_USE_PROTOS
1728 YY_BUFFER_STATE
yy_scan_buffer( char *base
, yy_size_t size
)
1730 YY_BUFFER_STATE
yy_scan_buffer( base
, size
)
1738 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1739 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1740 /* They forgot to leave room for the EOB's. */
1743 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1745 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1747 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1748 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1749 b
->yy_is_our_buffer
= 0;
1750 b
->yy_input_file
= 0;
1751 b
->yy_n_chars
= b
->yy_buf_size
;
1752 b
->yy_is_interactive
= 0;
1754 b
->yy_fill_buffer
= 0;
1755 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1757 yy_switch_to_buffer( b
);
1764 #ifndef YY_NO_SCAN_STRING
1765 #ifdef YY_USE_PROTOS
1766 YY_BUFFER_STATE
yy_scan_string( yyconst
char *yy_str
)
1768 YY_BUFFER_STATE
yy_scan_string( yy_str
)
1769 yyconst
char *yy_str
;
1773 for ( len
= 0; yy_str
[len
]; ++len
)
1776 return yy_scan_bytes( yy_str
, len
);
1781 #ifndef YY_NO_SCAN_BYTES
1782 #ifdef YY_USE_PROTOS
1783 YY_BUFFER_STATE
yy_scan_bytes( yyconst
char *bytes
, int len
)
1785 YY_BUFFER_STATE
yy_scan_bytes( bytes
, len
)
1786 yyconst
char *bytes
;
1795 /* Get memory for full buffer, including space for trailing EOB's. */
1797 buf
= (char *) yy_flex_alloc( n
);
1799 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1801 for ( i
= 0; i
< len
; ++i
)
1804 buf
[len
] = buf
[len
+1] = YY_END_OF_BUFFER_CHAR
;
1806 b
= yy_scan_buffer( buf
, n
);
1808 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1810 /* It's okay to grow etc. this buffer, and we should throw it
1811 * away when we're done.
1813 b
->yy_is_our_buffer
= 1;
1820 #ifndef YY_NO_PUSH_STATE
1821 #ifdef YY_USE_PROTOS
1822 static void yy_push_state( int new_state
)
1824 static void yy_push_state( new_state
)
1828 if ( yy_start_stack_ptr
>= yy_start_stack_depth
)
1832 yy_start_stack_depth
+= YY_START_STACK_INCR
;
1833 new_size
= yy_start_stack_depth
* sizeof( int );
1835 if ( ! yy_start_stack
)
1836 yy_start_stack
= (int *) yy_flex_alloc( new_size
);
1839 yy_start_stack
= (int *) yy_flex_realloc(
1840 (void *) yy_start_stack
, new_size
);
1842 if ( ! yy_start_stack
)
1844 "out of memory expanding start-condition stack" );
1847 yy_start_stack
[yy_start_stack_ptr
++] = YY_START
;
1854 #ifndef YY_NO_POP_STATE
1855 static void yy_pop_state()
1857 if ( --yy_start_stack_ptr
< 0 )
1858 YY_FATAL_ERROR( "start-condition stack underflow" );
1860 BEGIN(yy_start_stack
[yy_start_stack_ptr
]);
1865 #ifndef YY_NO_TOP_STATE
1866 static int yy_top_state()
1868 return yy_start_stack
[yy_start_stack_ptr
- 1];
1872 #ifndef YY_EXIT_FAILURE
1873 #define YY_EXIT_FAILURE 2
1876 #ifdef YY_USE_PROTOS
1877 static void yy_fatal_error( yyconst
char msg
[] )
1879 static void yy_fatal_error( msg
)
1883 (void) fprintf( stderr
, "%s\n", msg
);
1884 exit( YY_EXIT_FAILURE
);
1889 /* Redefine yyless() so it works in section 3 code. */
1895 /* Undo effects of setting up yytext. */ \
1896 yytext[yyleng] = yy_hold_char; \
1897 yy_c_buf_p = yytext + n; \
1898 yy_hold_char = *yy_c_buf_p; \
1899 *yy_c_buf_p = '\0'; \
1905 /* Internal utility routines. */
1908 #ifdef YY_USE_PROTOS
1909 static void yy_flex_strncpy( char *s1
, yyconst
char *s2
, int n
)
1911 static void yy_flex_strncpy( s1
, s2
, n
)
1918 for ( i
= 0; i
< n
; ++i
)
1923 #ifdef YY_NEED_STRLEN
1924 #ifdef YY_USE_PROTOS
1925 static int yy_flex_strlen( yyconst
char *s
)
1927 static int yy_flex_strlen( s
)
1932 for ( n
= 0; s
[n
]; ++n
)
1940 #ifdef YY_USE_PROTOS
1941 static void *yy_flex_alloc( yy_size_t size
)
1943 static void *yy_flex_alloc( size
)
1947 return (void *) malloc( size
);
1950 #ifdef YY_USE_PROTOS
1951 static void *yy_flex_realloc( void *ptr
, yy_size_t size
)
1953 static void *yy_flex_realloc( ptr
, size
)
1958 /* The cast to (char *) in the following accommodates both
1959 * implementations that use char* generic pointers, and those
1960 * that use void* generic pointers. It works with the latter
1961 * because both ANSI C and C++ allow castless assignment from
1962 * any pointer type to void*, and deal with argument conversions
1963 * as though doing an assignment.
1965 return (void *) realloc( (char *) ptr
, size
);
1968 #ifdef YY_USE_PROTOS
1969 static void yy_flex_free( void *ptr
)
1971 static void yy_flex_free( ptr
)
1985 #line 187 "parser.l"
1989 int parser_wrap(void)
2000 /* This table MUST be alphabetically sorted on the kw field */
2001 static const struct keyword keywords
[] = {
2005 {"__cdecl", tCDECL
},
2006 {"__fastcall", tFASTCALL
},
2007 {"__int64", tINT64
},
2008 {"__pascal", tPASCAL
},
2009 {"__stdcall", tSTDCALL
},
2011 {"_fastcall", tFASTCALL
},
2012 {"_pascal", tPASCAL
},
2013 {"_stdcall", tSTDCALL
},
2014 {"boolean", tBOOLEAN
},
2019 {"coclass", tCOCLASS
},
2021 {"cpp_quote", tCPPQUOTE
},
2022 {"default", tDEFAULT
},
2023 {"dispinterface", tDISPINTERFACE
},
2024 {"double", tDOUBLE
},
2026 {"error_status_t", tERRORSTATUST
},
2027 {"extern", tEXTERN
},
2029 {"handle_t", tHANDLET
},
2031 {"import", tIMPORT
},
2032 {"importlib", tIMPORTLIB
},
2033 {"inline", tINLINE
},
2035 {"interface", tINTERFACE
},
2036 {"library", tLIBRARY
},
2038 {"methods", tMETHODS
},
2039 {"module", tMODULE
},
2040 {"pascal", tPASCAL
},
2041 {"properties", tPROPERTIES
},
2042 {"register", tREGISTER
},
2044 {"signed", tSIGNED
},
2045 {"sizeof", tSIZEOF
},
2047 {"static", tSTATIC
},
2048 {"stdcall", tSTDCALL
},
2049 {"struct", tSTRUCT
},
2050 {"switch", tSWITCH
},
2051 {"typedef", tTYPEDEF
},
2053 {"unsigned", tUNSIGNED
},
2055 {"wchar_t", tWCHAR
},
2057 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
2059 /* keywords only recognized in attribute lists
2060 * This table MUST be alphabetically sorted on the kw field
2062 static const struct keyword attr_keywords
[] =
2064 {"aggregatable", tAGGREGATABLE
},
2065 {"allocate", tALLOCATE
},
2066 {"appobject", tAPPOBJECT
},
2068 {"async_uuid", tASYNCUUID
},
2069 {"auto_handle", tAUTOHANDLE
},
2070 {"bindable", tBINDABLE
},
2071 {"broadcast", tBROADCAST
},
2072 {"byte_count", tBYTECOUNT
},
2073 {"call_as", tCALLAS
},
2074 {"callback", tCALLBACK
},
2076 {"comm_status", tCOMMSTATUS
},
2077 {"context_handle", tCONTEXTHANDLE
},
2078 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE
},
2079 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE
},
2080 {"control", tCONTROL
},
2081 {"defaultcollelem", tDEFAULTCOLLELEM
},
2082 {"defaultvalue", tDEFAULTVALUE
},
2083 {"defaultvtable", tDEFAULTVTABLE
},
2084 {"displaybind", tDISPLAYBIND
},
2085 {"dllname", tDLLNAME
},
2087 {"endpoint", tENDPOINT
},
2089 {"explicit_handle", tEXPLICITHANDLE
},
2090 {"handle", tHANDLE
},
2091 {"helpcontext", tHELPCONTEXT
},
2092 {"helpfile", tHELPFILE
},
2093 {"helpstring", tHELPSTRING
},
2094 {"helpstringcontext", tHELPSTRINGCONTEXT
},
2095 {"helpstringdll", tHELPSTRINGDLL
},
2096 {"hidden", tHIDDEN
},
2098 {"idempotent", tIDEMPOTENT
},
2100 {"immediatebind", tIMMEDIATEBIND
},
2101 {"implicit_handle", tIMPLICITHANDLE
},
2103 {"in_line", tIN_LINE
},
2104 {"input_sync", tINPUTSYNC
},
2106 {"length_is", tLENGTHIS
},
2108 {"nonbrowsable", tNONBROWSABLE
},
2109 {"noncreatable", tNONCREATABLE
},
2110 {"nonextensible", tNONEXTENSIBLE
},
2111 {"object", tOBJECT
},
2113 {"oleautomation", tOLEAUTOMATION
},
2114 {"optional", tOPTIONAL
},
2116 {"pointer_default", tPOINTERDEFAULT
},
2117 {"propget", tPROPGET
},
2118 {"propput", tPROPPUT
},
2119 {"propputref", tPROPPUTREF
},
2121 {"public", tPUBLIC
},
2123 {"readonly", tREADONLY
},
2125 {"requestedit", tREQUESTEDIT
},
2126 {"restricted", tRESTRICTED
},
2127 {"retval", tRETVAL
},
2128 {"single", tSINGLE
},
2129 {"size_is", tSIZEIS
},
2130 {"source", tSOURCE
},
2131 {"strict_context_handle", tSTRICTCONTEXTHANDLE
},
2132 {"string", tSTRING
},
2133 {"switch_is", tSWITCHIS
},
2134 {"switch_type", tSWITCHTYPE
},
2135 {"transmit_as", tTRANSMITAS
},
2136 {"unique", tUNIQUE
},
2138 {"v1_enum", tV1ENUM
},
2139 {"vararg", tVARARG
},
2140 {"version", tVERSION
},
2141 {"wire_marshal", tWIREMARSHAL
},
2145 #define KWP(p) ((const struct keyword *)(p))
2147 static int kw_cmp_func(const void *s1
, const void *s2
)
2149 return strcmp(KWP(s1
)->kw
, KWP(s2
)->kw
);
2152 static int kw_token(const char *kw
)
2154 struct keyword key
, *kwp
;
2156 kwp
= bsearch(&key
, keywords
, NKEYWORDS
, sizeof(keywords
[0]), kw_cmp_func
);
2158 parser_lval
.str
= xstrdup(kwp
->kw
);
2161 parser_lval
.str
= xstrdup(kw
);
2162 return is_type(kw
) ? aKNOWNTYPE
: aIDENTIFIER
;
2165 static int attr_token(const char *kw
)
2167 struct keyword key
, *kwp
;
2169 kwp
= bsearch(&key
, attr_keywords
, sizeof(attr_keywords
)/sizeof(attr_keywords
[0]),
2170 sizeof(attr_keywords
[0]), kw_cmp_func
);
2172 parser_lval
.str
= xstrdup(kwp
->kw
);
2175 return kw_token(kw
);
2178 static void addcchar(char c
)
2180 if(cbufidx
>= cbufalloc
)
2183 cbuffer
= xrealloc(cbuffer
, cbufalloc
* sizeof(cbuffer
[0]));
2184 if(cbufalloc
> 65536)
2185 parser_warning("Reallocating string buffer larger than 64kB\n");
2187 cbuffer
[cbufidx
++] = c
;
2190 static char *get_buffered_cstring(void)
2193 return xstrdup(cbuffer
);
2196 void pop_import(void)
2198 int ptr
= import_stack_ptr
-1;
2201 yy_delete_buffer( YY_CURRENT_BUFFER
);
2202 yy_switch_to_buffer( import_stack
[ptr
].state
);
2207 temp_name
= import_stack
[ptr
].temp_name
;
2208 input_name
= import_stack
[ptr
].input_name
;
2209 line_number
= import_stack
[ptr
].line_number
;
2215 struct imports
*next
;
2218 int do_import(char *fname
)
2222 struct imports
*import
;
2223 int ptr
= import_stack_ptr
;
2226 import
= first_import
;
2227 while (import
&& strcmp(import
->name
, fname
))
2228 import
= import
->next
;
2229 if (import
) return 0; /* already imported */
2231 import
= xmalloc(sizeof(struct imports
));
2232 import
->name
= xstrdup(fname
);
2233 import
->next
= first_import
;
2234 first_import
= import
;
2236 /* don't search for a file name with a path in the include directories,
2237 * for compatibility with MIDL */
2238 if (strchr( fname
, '/' ) || strchr( fname
, '\\' ))
2239 path
= strdup( fname
);
2240 else if (!(path
= wpp_find_include( fname
, input_name
)))
2241 error_loc("Unable to open include file %s\n", fname
);
2243 import_stack
[ptr
].temp_name
= temp_name
;
2244 import_stack
[ptr
].input_name
= input_name
;
2245 import_stack
[ptr
].line_number
= line_number
;
2250 ret
= wpp_parse_temp( path
, NULL
, &temp_name
);
2253 if((f
= fopen(temp_name
, "r")) == NULL
)
2254 error_loc("Unable to open %s\n", temp_name
);
2256 import_stack
[ptr
].state
= YY_CURRENT_BUFFER
;
2257 yy_switch_to_buffer(yy_create_buffer(f
, YY_BUF_SIZE
));
2261 void abort_import(void)
2265 for (ptr
=0; ptr
<import_stack_ptr
; ptr
++)
2266 unlink(import_stack
[ptr
].temp_name
);