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_UNPUT 1
569 #define YY_NO_TOP_STATE 1
570 #define YY_NEVER_INTERACTIVE 1
592 #define YY_NO_UNISTD_H
598 #include "wine/wpp.h"
600 #include "parser.tab.h"
602 extern char *temp_name
;
604 static void addcchar(char c
);
605 static char *get_buffered_cstring(void);
607 static char *cbuffer
;
609 static int cbufalloc
= 0;
611 static int kw_token(const char *kw
);
612 static int attr_token(const char *kw
);
614 #define MAX_IMPORT_DEPTH 10
616 YY_BUFFER_STATE state
;
620 } import_stack
[MAX_IMPORT_DEPTH
];
621 int import_stack_ptr
= 0;
623 UUID
*parse_uuid(const char *u
)
625 UUID
* uuid
= xmalloc(sizeof(UUID
));
627 /* it would be nice to use UuidFromStringA */
628 uuid
->Data1
= strtoul(u
, NULL
, 16);
629 uuid
->Data2
= strtoul(u
+9, NULL
, 16);
630 uuid
->Data3
= strtoul(u
+14, NULL
, 16);
632 memcpy(b
, u
+19, 2); uuid
->Data4
[0] = strtoul(b
, NULL
, 16);
633 memcpy(b
, u
+21, 2); uuid
->Data4
[1] = strtoul(b
, NULL
, 16);
634 memcpy(b
, u
+24, 2); uuid
->Data4
[2] = strtoul(b
, NULL
, 16);
635 memcpy(b
, u
+26, 2); uuid
->Data4
[3] = strtoul(b
, NULL
, 16);
636 memcpy(b
, u
+28, 2); uuid
->Data4
[4] = strtoul(b
, NULL
, 16);
637 memcpy(b
, u
+30, 2); uuid
->Data4
[5] = strtoul(b
, NULL
, 16);
638 memcpy(b
, u
+32, 2); uuid
->Data4
[6] = strtoul(b
, NULL
, 16);
639 memcpy(b
, u
+34, 2); uuid
->Data4
[7] = strtoul(b
, NULL
, 16);
644 **************************************************************************
645 * The flexer starts here
646 **************************************************************************
648 #line 649 "parser.yy.c"
650 /* Macros after this point can all be overridden by user definitions in
654 #ifndef YY_SKIP_YYWRAP
656 extern "C" int yywrap
YY_PROTO(( void ));
658 extern int yywrap
YY_PROTO(( void ));
663 static void yyunput
YY_PROTO(( int c
, char *buf_ptr
));
667 static void yy_flex_strncpy
YY_PROTO(( char *, yyconst
char *, int ));
670 #ifdef YY_NEED_STRLEN
671 static int yy_flex_strlen
YY_PROTO(( yyconst
char * ));
676 static int yyinput
YY_PROTO(( void ));
678 static int input
YY_PROTO(( void ));
683 static int yy_start_stack_ptr
= 0;
684 static int yy_start_stack_depth
= 0;
685 static int *yy_start_stack
= 0;
686 #ifndef YY_NO_PUSH_STATE
687 static void yy_push_state
YY_PROTO(( int new_state
));
689 #ifndef YY_NO_POP_STATE
690 static void yy_pop_state
YY_PROTO(( void ));
692 #ifndef YY_NO_TOP_STATE
693 static int yy_top_state
YY_PROTO(( void ));
697 #define YY_NO_PUSH_STATE 1
698 #define YY_NO_POP_STATE 1
699 #define YY_NO_TOP_STATE 1
702 #ifdef YY_MALLOC_DECL
710 /* Just try to get by without declaring the routines. This will fail
711 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
712 * or sizeof(void*) != sizeof(int).
717 /* Amount of stuff to slurp up with each read. */
718 #ifndef YY_READ_BUF_SIZE
719 #define YY_READ_BUF_SIZE 8192
722 /* Copy whatever the last rule matched to the standard output. */
725 /* This used to be an fputs(), but since the string might contain NUL's,
726 * we now use fwrite().
728 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
731 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
732 * is returned in "result".
735 #define YY_INPUT(buf,result,max_size) \
736 if ( yy_current_buffer->yy_is_interactive ) \
739 for ( n = 0; n < max_size && \
740 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
743 buf[n++] = (char) c; \
744 if ( c == EOF && ferror( yyin ) ) \
745 YY_FATAL_ERROR( "input in flex scanner failed" ); \
748 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
749 && ferror( yyin ) ) \
750 YY_FATAL_ERROR( "input in flex scanner failed" );
753 /* No semi-colon after return; correct usage is to write "yyterminate();" -
754 * we don't want an extra ';' after the "return" because that will cause
755 * some compilers to complain about unreachable statements.
758 #define yyterminate() return YY_NULL
761 /* Number of entries by which start-condition stack grows. */
762 #ifndef YY_START_STACK_INCR
763 #define YY_START_STACK_INCR 25
766 /* Report a fatal error. */
767 #ifndef YY_FATAL_ERROR
768 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
771 /* Default declaration of generated scanner - a define so the user can
772 * easily add parameters.
775 #define YY_DECL int yylex YY_PROTO(( void ))
778 /* Code executed at the beginning of each rule, after yytext and yyleng
781 #ifndef YY_USER_ACTION
782 #define YY_USER_ACTION
785 /* Code executed at the end of each rule. */
787 #define YY_BREAK break;
790 #define YY_RULE_SETUP \
792 yy_current_buffer->yy_at_bol = \
793 (yytext[yyleng - 1] == '\n'); \
798 register yy_state_type yy_current_state
;
799 register char *yy_cp
, *yy_bp
;
804 #line 805 "parser.yy.c"
815 yy_start
= 1; /* first start state */
823 if ( ! yy_current_buffer
)
825 yy_create_buffer( yyin
, YY_BUF_SIZE
);
827 yy_load_buffer_state();
830 while ( 1 ) /* loops until end-of-file is reached */
834 /* Support of yytext. */
835 *yy_cp
= yy_hold_char
;
837 /* yy_bp points to the position in yy_ch_buf of the start of
842 yy_current_state
= yy_start
;
843 yy_current_state
+= YY_AT_BOL();
847 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
848 if ( yy_accept
[yy_current_state
] )
850 yy_last_accepting_state
= yy_current_state
;
851 yy_last_accepting_cpos
= yy_cp
;
853 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
855 yy_current_state
= (int) yy_def
[yy_current_state
];
856 if ( yy_current_state
>= 139 )
857 yy_c
= yy_meta
[(unsigned int) yy_c
];
859 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
862 while ( yy_base
[yy_current_state
] != 491 );
865 yy_act
= yy_accept
[yy_current_state
];
867 { /* have to back up */
868 yy_cp
= yy_last_accepting_cpos
;
869 yy_current_state
= yy_last_accepting_state
;
870 yy_act
= yy_accept
[yy_current_state
];
876 do_action
: /* This label is used only to access EOF actions. */
880 { /* beginning of action switch */
881 case 0: /* must back up */
882 /* undo the effects of YY_DO_BEFORE_ACTION */
883 *yy_cp
= yy_hold_char
;
884 yy_cp
= yy_last_accepting_cpos
;
885 yy_current_state
= yy_last_accepting_state
;
891 yy_push_state(PP_LINE
);
900 lineno
= (int)strtol(yytext
, &cptr
, 10);
902 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
903 fname
= strchr(cptr
, '"');
905 error_loc("Malformed '#...' line-directive; missing filename\n");
907 cptr
= strchr(fname
, '"');
909 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
911 line_number
= lineno
- 1; /* We didn't read the newline */
913 input_name
= xstrdup(fname
);
919 yy_push_state(QUOTE
); cbufidx
= 0;
926 parser_lval
.str
= get_buffered_cstring();
933 yy_push_state(WSTRQUOTE
);
940 parser_lval
.str
= get_buffered_cstring();
954 addcchar('\\'); addcchar(yytext
[1]);
964 yy_push_state(ATTR
); return '[';
969 yy_pop_state(); return ']';
974 return attr_token(yytext
);
980 parser_lval
.uuid
= parse_uuid(yytext
);
988 parser_lval
.num
= strtoul(yytext
, NULL
, 0);
996 parser_lval
.num
= strtoul(yytext
, NULL
, 0);
1002 #line 164 "parser.l"
1004 parser_lval
.dbl
= strtod(yytext
, NULL
);
1009 *yy_cp
= yy_hold_char
; /* undo effects of setting up yytext */
1010 yy_c_buf_p
= yy_cp
-= 1;
1011 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1013 #line 168 "parser.l"
1018 #line 169 "parser.l"
1019 return kw_token(yytext
);
1023 #line 170 "parser.l"
1028 #line 171 "parser.l"
1033 #line 172 "parser.l"
1038 #line 173 "parser.l"
1043 #line 174 "parser.l"
1048 #line 175 "parser.l"
1053 #line 176 "parser.l"
1058 #line 177 "parser.l"
1059 return GREATEREQUAL
;
1063 #line 178 "parser.l"
1068 #line 179 "parser.l"
1073 #line 180 "parser.l"
1078 #line 181 "parser.l"
1081 case YY_STATE_EOF(INITIAL
):
1082 case YY_STATE_EOF(QUOTE
):
1083 case YY_STATE_EOF(WSTRQUOTE
):
1084 case YY_STATE_EOF(ATTR
):
1085 case YY_STATE_EOF(PP_LINE
):
1086 #line 182 "parser.l"
1088 if (import_stack_ptr
)
1095 #line 187 "parser.l"
1098 #line 1099 "parser.yy.c"
1100 case YY_END_OF_BUFFER
:
1102 /* Amount of text matched not including the EOB char. */
1103 int yy_amount_of_matched_text
= (int) (yy_cp
- yytext_ptr
) - 1;
1105 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1106 *yy_cp
= yy_hold_char
;
1107 YY_RESTORE_YY_MORE_OFFSET
1109 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_NEW
)
1111 /* We're scanning a new file or input source. It's
1112 * possible that this happened because the user
1113 * just pointed yyin at a new source and called
1114 * yylex(). If so, then we have to assure
1115 * consistency between yy_current_buffer and our
1116 * globals. Here is the right place to do so, because
1117 * this is the first action (other than possibly a
1118 * back-up) that will match for the new input source.
1120 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1121 yy_current_buffer
->yy_input_file
= yyin
;
1122 yy_current_buffer
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1125 /* Note that here we test for yy_c_buf_p "<=" to the position
1126 * of the first EOB in the buffer, since yy_c_buf_p will
1127 * already have been incremented past the NUL character
1128 * (since all states make transitions on EOB to the
1129 * end-of-buffer state). Contrast this with the test
1132 if ( yy_c_buf_p
<= &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1133 { /* This was really a NUL. */
1134 yy_state_type yy_next_state
;
1136 yy_c_buf_p
= yytext_ptr
+ yy_amount_of_matched_text
;
1138 yy_current_state
= yy_get_previous_state();
1140 /* Okay, we're now positioned to make the NUL
1141 * transition. We couldn't have
1142 * yy_get_previous_state() go ahead and do it
1143 * for us because it doesn't know how to deal
1144 * with the possibility of jamming (and we don't
1145 * want to build jamming into it because then it
1146 * will run more slowly).
1149 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1151 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1153 if ( yy_next_state
)
1155 /* Consume the NUL. */
1156 yy_cp
= ++yy_c_buf_p
;
1157 yy_current_state
= yy_next_state
;
1164 goto yy_find_action
;
1168 else switch ( yy_get_next_buffer() )
1170 case EOB_ACT_END_OF_FILE
:
1172 yy_did_buffer_switch_on_eof
= 0;
1176 /* Note: because we've taken care in
1177 * yy_get_next_buffer() to have set up
1178 * yytext, we can now set up
1179 * yy_c_buf_p so that if some total
1180 * hoser (like flex itself) wants to
1181 * call the scanner after we return the
1182 * YY_NULL, it'll still work - another
1183 * YY_NULL will get returned.
1185 yy_c_buf_p
= yytext_ptr
+ YY_MORE_ADJ
;
1187 yy_act
= YY_STATE_EOF(YY_START
);
1193 if ( ! yy_did_buffer_switch_on_eof
)
1199 case EOB_ACT_CONTINUE_SCAN
:
1201 yytext_ptr
+ yy_amount_of_matched_text
;
1203 yy_current_state
= yy_get_previous_state();
1206 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1209 case EOB_ACT_LAST_MATCH
:
1211 &yy_current_buffer
->yy_ch_buf
[yy_n_chars
];
1213 yy_current_state
= yy_get_previous_state();
1216 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1217 goto yy_find_action
;
1224 "fatal flex scanner internal error--no action found" );
1225 } /* end of action switch */
1226 } /* end of scanning one token */
1227 } /* end of yylex */
1230 /* yy_get_next_buffer - try to read in a new buffer
1232 * Returns a code representing an action:
1233 * EOB_ACT_LAST_MATCH -
1234 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1235 * EOB_ACT_END_OF_FILE - end of file
1238 static int yy_get_next_buffer()
1240 register char *dest
= yy_current_buffer
->yy_ch_buf
;
1241 register char *source
= yytext_ptr
;
1242 register int number_to_move
, i
;
1245 if ( yy_c_buf_p
> &yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] )
1247 "fatal flex scanner internal error--end of buffer missed" );
1249 if ( yy_current_buffer
->yy_fill_buffer
== 0 )
1250 { /* Don't try to fill the buffer, so this is an EOF. */
1251 if ( yy_c_buf_p
- yytext_ptr
- YY_MORE_ADJ
== 1 )
1253 /* We matched a single character, the EOB, so
1254 * treat this as a final EOF.
1256 return EOB_ACT_END_OF_FILE
;
1261 /* We matched some text prior to the EOB, first
1264 return EOB_ACT_LAST_MATCH
;
1268 /* Try to read more data. */
1270 /* First move last chars to start of buffer. */
1271 number_to_move
= (int) (yy_c_buf_p
- yytext_ptr
) - 1;
1273 for ( i
= 0; i
< number_to_move
; ++i
)
1274 *(dest
++) = *(source
++);
1276 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1277 /* don't do the read, it's not guaranteed to return an EOF,
1280 yy_current_buffer
->yy_n_chars
= yy_n_chars
= 0;
1285 yy_current_buffer
->yy_buf_size
- number_to_move
- 1;
1287 while ( num_to_read
<= 0 )
1288 { /* Not enough room in the buffer - grow it. */
1289 #ifdef YY_USES_REJECT
1291 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1294 /* just a shorter name for the current buffer */
1295 YY_BUFFER_STATE b
= yy_current_buffer
;
1297 int yy_c_buf_p_offset
=
1298 (int) (yy_c_buf_p
- b
->yy_ch_buf
);
1300 if ( b
->yy_is_our_buffer
)
1302 int new_size
= b
->yy_buf_size
* 2;
1304 if ( new_size
<= 0 )
1305 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1307 b
->yy_buf_size
*= 2;
1309 b
->yy_ch_buf
= (char *)
1310 /* Include room in for 2 EOB chars. */
1311 yy_flex_realloc( (void *) b
->yy_ch_buf
,
1312 b
->yy_buf_size
+ 2 );
1315 /* Can't grow it, we don't own it. */
1318 if ( ! b
->yy_ch_buf
)
1320 "fatal error - scanner input buffer overflow" );
1322 yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1324 num_to_read
= yy_current_buffer
->yy_buf_size
-
1329 if ( num_to_read
> YY_READ_BUF_SIZE
)
1330 num_to_read
= YY_READ_BUF_SIZE
;
1332 /* Read in more data. */
1333 YY_INPUT( (&yy_current_buffer
->yy_ch_buf
[number_to_move
]),
1334 yy_n_chars
, num_to_read
);
1336 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1339 if ( yy_n_chars
== 0 )
1341 if ( number_to_move
== YY_MORE_ADJ
)
1343 ret_val
= EOB_ACT_END_OF_FILE
;
1349 ret_val
= EOB_ACT_LAST_MATCH
;
1350 yy_current_buffer
->yy_buffer_status
=
1351 YY_BUFFER_EOF_PENDING
;
1356 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1358 yy_n_chars
+= number_to_move
;
1359 yy_current_buffer
->yy_ch_buf
[yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1360 yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1362 yytext_ptr
= &yy_current_buffer
->yy_ch_buf
[0];
1368 /* yy_get_previous_state - get the state just before the EOB char was reached */
1370 static yy_state_type
yy_get_previous_state()
1372 register yy_state_type yy_current_state
;
1373 register char *yy_cp
;
1375 yy_current_state
= yy_start
;
1376 yy_current_state
+= YY_AT_BOL();
1378 for ( yy_cp
= yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yy_c_buf_p
; ++yy_cp
)
1380 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1381 if ( yy_accept
[yy_current_state
] )
1383 yy_last_accepting_state
= yy_current_state
;
1384 yy_last_accepting_cpos
= yy_cp
;
1386 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1388 yy_current_state
= (int) yy_def
[yy_current_state
];
1389 if ( yy_current_state
>= 139 )
1390 yy_c
= yy_meta
[(unsigned int) yy_c
];
1392 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1395 return yy_current_state
;
1399 /* yy_try_NUL_trans - try to make a transition on the NUL character
1402 * next_state = yy_try_NUL_trans( current_state );
1405 #ifdef YY_USE_PROTOS
1406 static yy_state_type
yy_try_NUL_trans( yy_state_type yy_current_state
)
1408 static yy_state_type
yy_try_NUL_trans( yy_current_state
)
1409 yy_state_type yy_current_state
;
1412 register int yy_is_jam
;
1413 register char *yy_cp
= yy_c_buf_p
;
1415 register YY_CHAR yy_c
= 1;
1416 if ( yy_accept
[yy_current_state
] )
1418 yy_last_accepting_state
= yy_current_state
;
1419 yy_last_accepting_cpos
= yy_cp
;
1421 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1423 yy_current_state
= (int) yy_def
[yy_current_state
];
1424 if ( yy_current_state
>= 139 )
1425 yy_c
= yy_meta
[(unsigned int) yy_c
];
1427 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1428 yy_is_jam
= (yy_current_state
== 138);
1430 return yy_is_jam
? 0 : yy_current_state
;
1435 #ifdef YY_USE_PROTOS
1436 static void yyunput( int c
, register char *yy_bp
)
1438 static void yyunput( c
, yy_bp
)
1440 register char *yy_bp
;
1443 register char *yy_cp
= yy_c_buf_p
;
1445 /* undo effects of setting up yytext */
1446 *yy_cp
= yy_hold_char
;
1448 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1449 { /* need to shift things up to make room */
1450 /* +2 for EOB chars. */
1451 register int number_to_move
= yy_n_chars
+ 2;
1452 register char *dest
= &yy_current_buffer
->yy_ch_buf
[
1453 yy_current_buffer
->yy_buf_size
+ 2];
1454 register char *source
=
1455 &yy_current_buffer
->yy_ch_buf
[number_to_move
];
1457 while ( source
> yy_current_buffer
->yy_ch_buf
)
1458 *--dest
= *--source
;
1460 yy_cp
+= (int) (dest
- source
);
1461 yy_bp
+= (int) (dest
- source
);
1462 yy_current_buffer
->yy_n_chars
=
1463 yy_n_chars
= yy_current_buffer
->yy_buf_size
;
1465 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1466 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1469 *--yy_cp
= (char) c
;
1473 yy_hold_char
= *yy_cp
;
1476 #endif /* ifndef YY_NO_UNPUT */
1480 static int yyinput()
1487 *yy_c_buf_p
= yy_hold_char
;
1489 if ( *yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1491 /* yy_c_buf_p now points to the character we want to return.
1492 * If this occurs *before* the EOB characters, then it's a
1493 * valid NUL; if not, then we've hit the end of the buffer.
1495 if ( yy_c_buf_p
< &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1496 /* This was really a NUL. */
1500 { /* need more input */
1501 int offset
= yy_c_buf_p
- yytext_ptr
;
1504 switch ( yy_get_next_buffer() )
1506 case EOB_ACT_LAST_MATCH
:
1507 /* This happens because yy_g_n_b()
1508 * sees that we've accumulated a
1509 * token and flags that we need to
1510 * try matching the token before
1511 * proceeding. But for input(),
1512 * there's no matching to consider.
1513 * So convert the EOB_ACT_LAST_MATCH
1514 * to EOB_ACT_END_OF_FILE.
1517 /* Reset buffer status. */
1522 case EOB_ACT_END_OF_FILE
:
1527 if ( ! yy_did_buffer_switch_on_eof
)
1536 case EOB_ACT_CONTINUE_SCAN
:
1537 yy_c_buf_p
= yytext_ptr
+ offset
;
1543 c
= *(unsigned char *) yy_c_buf_p
; /* cast for 8-bit char's */
1544 *yy_c_buf_p
= '\0'; /* preserve yytext */
1545 yy_hold_char
= *++yy_c_buf_p
;
1547 yy_current_buffer
->yy_at_bol
= (c
== '\n');
1553 #ifdef YY_USE_PROTOS
1554 void yyrestart( FILE *input_file
)
1556 void yyrestart( input_file
)
1560 if ( ! yy_current_buffer
)
1561 yy_current_buffer
= yy_create_buffer( yyin
, YY_BUF_SIZE
);
1563 yy_init_buffer( yy_current_buffer
, input_file
);
1564 yy_load_buffer_state();
1568 #ifdef YY_USE_PROTOS
1569 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer
)
1571 void yy_switch_to_buffer( new_buffer
)
1572 YY_BUFFER_STATE new_buffer
;
1575 if ( yy_current_buffer
== new_buffer
)
1578 if ( yy_current_buffer
)
1580 /* Flush out information for old buffer. */
1581 *yy_c_buf_p
= yy_hold_char
;
1582 yy_current_buffer
->yy_buf_pos
= yy_c_buf_p
;
1583 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1586 yy_current_buffer
= new_buffer
;
1587 yy_load_buffer_state();
1589 /* We don't actually know whether we did this switch during
1590 * EOF (yywrap()) processing, but the only time this flag
1591 * is looked at is after yywrap() is called, so it's safe
1592 * to go ahead and always set it.
1594 yy_did_buffer_switch_on_eof
= 1;
1598 #ifdef YY_USE_PROTOS
1599 void yy_load_buffer_state( void )
1601 void yy_load_buffer_state()
1604 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1605 yytext_ptr
= yy_c_buf_p
= yy_current_buffer
->yy_buf_pos
;
1606 yyin
= yy_current_buffer
->yy_input_file
;
1607 yy_hold_char
= *yy_c_buf_p
;
1611 #ifdef YY_USE_PROTOS
1612 YY_BUFFER_STATE
yy_create_buffer( FILE *file
, int size
)
1614 YY_BUFFER_STATE
yy_create_buffer( file
, size
)
1621 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1623 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1625 b
->yy_buf_size
= size
;
1627 /* yy_ch_buf has to be 2 characters longer than the size given because
1628 * we need to put in 2 end-of-buffer characters.
1630 b
->yy_ch_buf
= (char *) yy_flex_alloc( b
->yy_buf_size
+ 2 );
1631 if ( ! b
->yy_ch_buf
)
1632 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1634 b
->yy_is_our_buffer
= 1;
1636 yy_init_buffer( b
, file
);
1642 #ifdef YY_USE_PROTOS
1643 void yy_delete_buffer( YY_BUFFER_STATE b
)
1645 void yy_delete_buffer( b
)
1652 if ( b
== yy_current_buffer
)
1653 yy_current_buffer
= (YY_BUFFER_STATE
) 0;
1655 if ( b
->yy_is_our_buffer
)
1656 yy_flex_free( (void *) b
->yy_ch_buf
);
1658 yy_flex_free( (void *) b
);
1662 #ifndef YY_ALWAYS_INTERACTIVE
1663 #ifndef YY_NEVER_INTERACTIVE
1664 extern int isatty
YY_PROTO(( int ));
1668 #ifdef YY_USE_PROTOS
1669 void yy_init_buffer( YY_BUFFER_STATE b
, FILE *file
)
1671 void yy_init_buffer( b
, file
)
1678 yy_flush_buffer( b
);
1680 b
->yy_input_file
= file
;
1681 b
->yy_fill_buffer
= 1;
1683 #if YY_ALWAYS_INTERACTIVE
1684 b
->yy_is_interactive
= 1;
1686 #if YY_NEVER_INTERACTIVE
1687 b
->yy_is_interactive
= 0;
1689 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1695 #ifdef YY_USE_PROTOS
1696 void yy_flush_buffer( YY_BUFFER_STATE b
)
1698 void yy_flush_buffer( b
)
1708 /* We always need two end-of-buffer characters. The first causes
1709 * a transition to the end-of-buffer state. The second causes
1710 * a jam in that state.
1712 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1713 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1715 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1718 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1720 if ( b
== yy_current_buffer
)
1721 yy_load_buffer_state();
1725 #ifndef YY_NO_SCAN_BUFFER
1726 #ifdef YY_USE_PROTOS
1727 YY_BUFFER_STATE
yy_scan_buffer( char *base
, yy_size_t size
)
1729 YY_BUFFER_STATE
yy_scan_buffer( base
, size
)
1737 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1738 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1739 /* They forgot to leave room for the EOB's. */
1742 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1744 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1746 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1747 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1748 b
->yy_is_our_buffer
= 0;
1749 b
->yy_input_file
= 0;
1750 b
->yy_n_chars
= b
->yy_buf_size
;
1751 b
->yy_is_interactive
= 0;
1753 b
->yy_fill_buffer
= 0;
1754 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1756 yy_switch_to_buffer( b
);
1763 #ifndef YY_NO_SCAN_STRING
1764 #ifdef YY_USE_PROTOS
1765 YY_BUFFER_STATE
yy_scan_string( yyconst
char *yy_str
)
1767 YY_BUFFER_STATE
yy_scan_string( yy_str
)
1768 yyconst
char *yy_str
;
1772 for ( len
= 0; yy_str
[len
]; ++len
)
1775 return yy_scan_bytes( yy_str
, len
);
1780 #ifndef YY_NO_SCAN_BYTES
1781 #ifdef YY_USE_PROTOS
1782 YY_BUFFER_STATE
yy_scan_bytes( yyconst
char *bytes
, int len
)
1784 YY_BUFFER_STATE
yy_scan_bytes( bytes
, len
)
1785 yyconst
char *bytes
;
1794 /* Get memory for full buffer, including space for trailing EOB's. */
1796 buf
= (char *) yy_flex_alloc( n
);
1798 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1800 for ( i
= 0; i
< len
; ++i
)
1803 buf
[len
] = buf
[len
+1] = YY_END_OF_BUFFER_CHAR
;
1805 b
= yy_scan_buffer( buf
, n
);
1807 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1809 /* It's okay to grow etc. this buffer, and we should throw it
1810 * away when we're done.
1812 b
->yy_is_our_buffer
= 1;
1819 #ifndef YY_NO_PUSH_STATE
1820 #ifdef YY_USE_PROTOS
1821 static void yy_push_state( int new_state
)
1823 static void yy_push_state( new_state
)
1827 if ( yy_start_stack_ptr
>= yy_start_stack_depth
)
1831 yy_start_stack_depth
+= YY_START_STACK_INCR
;
1832 new_size
= yy_start_stack_depth
* sizeof( int );
1834 if ( ! yy_start_stack
)
1835 yy_start_stack
= (int *) yy_flex_alloc( new_size
);
1838 yy_start_stack
= (int *) yy_flex_realloc(
1839 (void *) yy_start_stack
, new_size
);
1841 if ( ! yy_start_stack
)
1843 "out of memory expanding start-condition stack" );
1846 yy_start_stack
[yy_start_stack_ptr
++] = YY_START
;
1853 #ifndef YY_NO_POP_STATE
1854 static void yy_pop_state()
1856 if ( --yy_start_stack_ptr
< 0 )
1857 YY_FATAL_ERROR( "start-condition stack underflow" );
1859 BEGIN(yy_start_stack
[yy_start_stack_ptr
]);
1864 #ifndef YY_NO_TOP_STATE
1865 static int yy_top_state()
1867 return yy_start_stack
[yy_start_stack_ptr
- 1];
1871 #ifndef YY_EXIT_FAILURE
1872 #define YY_EXIT_FAILURE 2
1875 #ifdef YY_USE_PROTOS
1876 static void yy_fatal_error( yyconst
char msg
[] )
1878 static void yy_fatal_error( msg
)
1882 (void) fprintf( stderr
, "%s\n", msg
);
1883 exit( YY_EXIT_FAILURE
);
1888 /* Redefine yyless() so it works in section 3 code. */
1894 /* Undo effects of setting up yytext. */ \
1895 yytext[yyleng] = yy_hold_char; \
1896 yy_c_buf_p = yytext + n; \
1897 yy_hold_char = *yy_c_buf_p; \
1898 *yy_c_buf_p = '\0'; \
1904 /* Internal utility routines. */
1907 #ifdef YY_USE_PROTOS
1908 static void yy_flex_strncpy( char *s1
, yyconst
char *s2
, int n
)
1910 static void yy_flex_strncpy( s1
, s2
, n
)
1917 for ( i
= 0; i
< n
; ++i
)
1922 #ifdef YY_NEED_STRLEN
1923 #ifdef YY_USE_PROTOS
1924 static int yy_flex_strlen( yyconst
char *s
)
1926 static int yy_flex_strlen( s
)
1931 for ( n
= 0; s
[n
]; ++n
)
1939 #ifdef YY_USE_PROTOS
1940 static void *yy_flex_alloc( yy_size_t size
)
1942 static void *yy_flex_alloc( size
)
1946 return (void *) malloc( size
);
1949 #ifdef YY_USE_PROTOS
1950 static void *yy_flex_realloc( void *ptr
, yy_size_t size
)
1952 static void *yy_flex_realloc( ptr
, size
)
1957 /* The cast to (char *) in the following accommodates both
1958 * implementations that use char* generic pointers, and those
1959 * that use void* generic pointers. It works with the latter
1960 * because both ANSI C and C++ allow castless assignment from
1961 * any pointer type to void*, and deal with argument conversions
1962 * as though doing an assignment.
1964 return (void *) realloc( (char *) ptr
, size
);
1967 #ifdef YY_USE_PROTOS
1968 static void yy_flex_free( void *ptr
)
1970 static void yy_flex_free( ptr
)
1984 #line 187 "parser.l"
1988 int parser_wrap(void)
1999 static const struct keyword keywords
[] = {
2003 {"__cdecl", tCDECL
},
2004 {"__fastcall", tFASTCALL
},
2005 {"__int64", tINT64
},
2006 {"__pascal", tPASCAL
},
2007 {"__stdcall", tSTDCALL
},
2009 {"_fastcall", tFASTCALL
},
2010 {"_pascal", tPASCAL
},
2011 {"_stdcall", tSTDCALL
},
2012 {"boolean", tBOOLEAN
},
2017 {"coclass", tCOCLASS
},
2019 {"cpp_quote", tCPPQUOTE
},
2020 {"default", tDEFAULT
},
2021 {"dispinterface", tDISPINTERFACE
},
2022 {"double", tDOUBLE
},
2024 {"error_status_t", tERRORSTATUST
},
2025 {"extern", tEXTERN
},
2027 {"handle_t", tHANDLET
},
2029 {"import", tIMPORT
},
2030 {"importlib", tIMPORTLIB
},
2031 {"inline", tINLINE
},
2033 {"interface", tINTERFACE
},
2034 {"library", tLIBRARY
},
2036 {"methods", tMETHODS
},
2037 {"module", tMODULE
},
2038 {"pascal", tPASCAL
},
2039 {"properties", tPROPERTIES
},
2040 {"register", tREGISTER
},
2042 {"signed", tSIGNED
},
2043 {"sizeof", tSIZEOF
},
2045 {"static", tSTATIC
},
2046 {"stdcall", tSTDCALL
},
2047 {"struct", tSTRUCT
},
2048 {"switch", tSWITCH
},
2049 {"typedef", tTYPEDEF
},
2051 {"unsigned", tUNSIGNED
},
2053 {"wchar_t", tWCHAR
},
2055 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
2057 /* keywords only recognized in attribute lists */
2058 static const struct keyword attr_keywords
[] =
2060 {"aggregatable", tAGGREGATABLE
},
2061 {"allocate", tALLOCATE
},
2062 {"appobject", tAPPOBJECT
},
2064 {"async_uuid", tASYNCUUID
},
2065 {"auto_handle", tAUTOHANDLE
},
2066 {"bindable", tBINDABLE
},
2067 {"broadcast", tBROADCAST
},
2068 {"byte_count", tBYTECOUNT
},
2069 {"call_as", tCALLAS
},
2070 {"callback", tCALLBACK
},
2072 {"comm_status", tCOMMSTATUS
},
2073 {"context_handle", tCONTEXTHANDLE
},
2074 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE
},
2075 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE
},
2076 {"control", tCONTROL
},
2077 {"defaultcollelem", tDEFAULTCOLLELEM
},
2078 {"defaultvalue", tDEFAULTVALUE
},
2079 {"defaultvtable", tDEFAULTVTABLE
},
2080 {"displaybind", tDISPLAYBIND
},
2081 {"dllname", tDLLNAME
},
2083 {"endpoint", tENDPOINT
},
2085 {"explicit_handle", tEXPLICITHANDLE
},
2086 {"handle", tHANDLE
},
2087 {"helpcontext", tHELPCONTEXT
},
2088 {"helpfile", tHELPFILE
},
2089 {"helpstring", tHELPSTRING
},
2090 {"helpstringcontext", tHELPSTRINGCONTEXT
},
2091 {"helpstringdll", tHELPSTRINGDLL
},
2092 {"hidden", tHIDDEN
},
2094 {"idempotent", tIDEMPOTENT
},
2096 {"immediatebind", tIMMEDIATEBIND
},
2097 {"implicit_handle", tIMPLICITHANDLE
},
2099 {"in_line", tIN_LINE
},
2100 {"input_sync", tINPUTSYNC
},
2102 {"length_is", tLENGTHIS
},
2104 {"nonbrowsable", tNONBROWSABLE
},
2105 {"noncreatable", tNONCREATABLE
},
2106 {"nonextensible", tNONEXTENSIBLE
},
2107 {"object", tOBJECT
},
2109 {"oleautomation", tOLEAUTOMATION
},
2110 {"optional", tOPTIONAL
},
2112 {"pointer_default", tPOINTERDEFAULT
},
2113 {"propget", tPROPGET
},
2114 {"propput", tPROPPUT
},
2115 {"propputref", tPROPPUTREF
},
2117 {"public", tPUBLIC
},
2119 {"readonly", tREADONLY
},
2121 {"requestedit", tREQUESTEDIT
},
2122 {"restricted", tRESTRICTED
},
2123 {"retval", tRETVAL
},
2124 {"single", tSINGLE
},
2125 {"size_is", tSIZEIS
},
2126 {"source", tSOURCE
},
2127 {"strict_context_handle", tSTRICTCONTEXTHANDLE
},
2128 {"string", tSTRING
},
2129 {"switch_is", tSWITCHIS
},
2130 {"switch_type", tSWITCHTYPE
},
2131 {"transmit_as", tTRANSMITAS
},
2132 {"unique", tUNIQUE
},
2134 {"v1_enum", tV1ENUM
},
2135 {"vararg", tVARARG
},
2136 {"version", tVERSION
},
2137 {"wire_marshal", tWIREMARSHAL
},
2141 #define KWP(p) ((const struct keyword *)(p))
2143 static int kw_cmp_func(const void *s1
, const void *s2
)
2145 return strcmp(KWP(s1
)->kw
, KWP(s2
)->kw
);
2148 static int kw_token(const char *kw
)
2150 struct keyword key
, *kwp
;
2152 kwp
= bsearch(&key
, keywords
, NKEYWORDS
, sizeof(keywords
[0]), kw_cmp_func
);
2154 parser_lval
.str
= xstrdup(kwp
->kw
);
2157 parser_lval
.str
= xstrdup(kw
);
2158 return is_type(kw
) ? aKNOWNTYPE
: aIDENTIFIER
;
2161 static int attr_token(const char *kw
)
2163 struct keyword key
, *kwp
;
2165 kwp
= bsearch(&key
, attr_keywords
, sizeof(attr_keywords
)/sizeof(attr_keywords
[0]),
2166 sizeof(attr_keywords
[0]), kw_cmp_func
);
2168 parser_lval
.str
= xstrdup(kwp
->kw
);
2171 return kw_token(kw
);
2174 static void addcchar(char c
)
2176 if(cbufidx
>= cbufalloc
)
2179 cbuffer
= xrealloc(cbuffer
, cbufalloc
* sizeof(cbuffer
[0]));
2180 if(cbufalloc
> 65536)
2181 parser_warning("Reallocating string buffer larger than 64kB\n");
2183 cbuffer
[cbufidx
++] = c
;
2186 static char *get_buffered_cstring(void)
2189 return xstrdup(cbuffer
);
2192 void pop_import(void)
2194 int ptr
= import_stack_ptr
-1;
2197 yy_delete_buffer( YY_CURRENT_BUFFER
);
2198 yy_switch_to_buffer( import_stack
[ptr
].state
);
2203 temp_name
= import_stack
[ptr
].temp_name
;
2204 input_name
= import_stack
[ptr
].input_name
;
2205 line_number
= import_stack
[ptr
].line_number
;
2211 struct imports
*next
;
2214 int do_import(char *fname
)
2218 struct imports
*import
;
2219 int ptr
= import_stack_ptr
;
2222 import
= first_import
;
2223 while (import
&& strcmp(import
->name
, fname
))
2224 import
= import
->next
;
2225 if (import
) return 0; /* already imported */
2227 import
= xmalloc(sizeof(struct imports
));
2228 import
->name
= xstrdup(fname
);
2229 import
->next
= first_import
;
2230 first_import
= import
;
2232 /* don't search for a file name with a path in the include directories,
2233 * for compatibility with MIDL */
2234 if (strchr( fname
, '/' ) || strchr( fname
, '\\' ))
2235 path
= strdup( fname
);
2236 else if (!(path
= wpp_find_include( fname
, input_name
)))
2237 error_loc("Unable to open include file %s\n", fname
);
2239 import_stack
[ptr
].temp_name
= temp_name
;
2240 import_stack
[ptr
].input_name
= input_name
;
2241 import_stack
[ptr
].line_number
= line_number
;
2246 ret
= wpp_parse_temp( path
, NULL
, &temp_name
);
2249 if((f
= fopen(temp_name
, "r")) == NULL
)
2250 error_loc("Unable to open %s\n", temp_name
);
2252 import_stack
[ptr
].state
= YY_CURRENT_BUFFER
;
2253 yy_switch_to_buffer(yy_create_buffer(f
, YY_BUF_SIZE
));
2257 void abort_import(void)
2261 for (ptr
=0; ptr
<import_stack_ptr
; ptr
++)
2262 unlink(import_stack
[ptr
].temp_name
);