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 36
305 #define YY_END_OF_BUFFER 37
306 static yyconst
short int yy_accept
[148] =
308 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
309 0, 0, 37, 35, 24, 23, 35, 3, 35, 7,
310 35, 35, 19, 19, 35, 35, 35, 22, 22, 22,
311 14, 35, 24, 1, 13, 36, 4, 13, 6, 19,
312 19, 16, 16, 16, 15, 2, 8, 13, 29, 33,
313 27, 0, 0, 19, 19, 19, 0, 25, 31, 28,
314 30, 26, 22, 5, 22, 32, 0, 1, 1, 12,
315 10, 9, 19, 0, 16, 16, 2, 11, 34, 20,
316 19, 19, 18, 22, 19, 0, 16, 0, 18, 18,
317 22, 19, 0, 16, 0, 20, 18, 18, 22, 19,
319 0, 16, 22, 19, 0, 16, 22, 19, 0, 16,
320 22, 19, 0, 16, 22, 0, 19, 0, 21, 0,
321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
322 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
326 static yyconst
int yy_ec
[256] =
328 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
329 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
332 1, 1, 10, 1, 11, 12, 1, 13, 14, 14,
333 14, 14, 14, 14, 14, 14, 14, 1, 1, 15,
334 16, 17, 1, 1, 18, 19, 19, 19, 20, 21,
335 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
336 22, 24, 25, 22, 26, 22, 22, 27, 28, 22,
337 29, 30, 31, 1, 22, 1, 19, 19, 19, 19,
339 32, 19, 22, 22, 22, 22, 22, 33, 22, 22,
340 22, 22, 22, 22, 22, 22, 34, 22, 22, 35,
341 22, 22, 1, 36, 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,
348 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,
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
358 static yyconst
int yy_meta
[37] =
360 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
361 1, 1, 3, 3, 1, 1, 1, 3, 3, 3,
362 3, 4, 4, 4, 4, 4, 4, 4, 1, 1,
366 static yyconst
short int yy_base
[184] =
368 0, 35, 35, 39, 40, 43, 61, 45, 262, 261,
369 46, 47, 263, 481, 481, 481, 246, 481, 254, 481,
370 243, 243, 85, 25, 41, 238, 42, 0, 248, 229,
371 481, 210, 60, 243, 481, 481, 481, 34, 481, 108,
372 26, 131, 154, 239, 481, 0, 481, 60, 481, 481,
373 481, 231, 58, 0, 75, 77, 0, 481, 481, 481,
374 481, 481, 0, 481, 220, 481, 61, 238, 236, 481,
375 481, 481, 174, 0, 196, 0, 0, 481, 481, 93,
376 481, 481, 113, 213, 216, 0, 238, 166, 89, 81,
377 214, 258, 0, 280, 89, 169, 481, 481, 207, 300,
379 0, 322, 203, 342, 0, 364, 208, 384, 0, 406,
380 197, 428, 213, 212, 115, 0, 211, 128, 481, 0,
381 0, 0, 210, 0, 0, 0, 0, 209, 0, 0,
382 0, 0, 208, 0, 0, 0, 0, 0, 0, 0,
383 0, 0, 0, 0, 0, 481, 481, 462, 466, 468,
384 472, 476, 215, 210, 209, 208, 202, 201, 200, 199,
385 196, 195, 193, 188, 187, 182, 181, 178, 175, 168,
386 167, 166, 159, 158, 157, 145, 135, 130, 129, 113,
390 static yyconst
short int yy_def
[184] =
392 147, 1, 148, 148, 148, 148, 1, 7, 149, 149,
393 148, 148, 147, 147, 147, 147, 147, 147, 147, 147,
394 147, 147, 147, 23, 147, 147, 147, 150, 150, 150,
395 147, 147, 147, 147, 147, 147, 147, 151, 147, 147,
396 40, 147, 42, 43, 147, 152, 147, 151, 147, 147,
397 147, 147, 147, 24, 147, 147, 153, 147, 147, 147,
398 147, 147, 150, 147, 150, 147, 147, 147, 147, 147,
399 147, 147, 147, 154, 43, 43, 152, 147, 147, 147,
400 147, 147, 153, 150, 147, 155, 43, 147, 147, 147,
401 150, 147, 156, 43, 147, 147, 147, 147, 150, 147,
403 157, 43, 150, 147, 158, 43, 150, 147, 159, 43,
404 150, 147, 147, 43, 150, 160, 112, 147, 147, 161,
405 162, 163, 147, 164, 165, 166, 167, 147, 168, 169,
406 170, 171, 147, 172, 173, 174, 175, 176, 177, 178,
407 179, 180, 181, 182, 183, 147, 0, 147, 147, 147,
408 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
409 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
410 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
414 static yyconst
short int yy_nxt
[518] =
416 14, 15, 16, 17, 18, 14, 19, 20, 14, 14,
417 21, 22, 23, 24, 25, 26, 27, 28, 28, 28,
418 28, 28, 29, 28, 30, 28, 28, 28, 31, 14,
419 14, 28, 28, 28, 28, 32, 33, 36, 71, 37,
420 34, 36, 36, 37, 39, 36, 33, 39, 36, 36,
421 34, 147, 147, 47, 47, 58, 59, 61, 62, 147,
422 147, 67, 67, 72, 38, 68, 68, 78, 38, 38,
423 80, 80, 38, 40, 41, 48, 48, 146, 42, 42,
424 42, 42, 43, 44, 43, 43, 43, 43, 43, 72,
425 145, 45, 42, 43, 43, 43, 53, 54, 54, 82,
427 81, 96, 96, 98, 144, 80, 80, 55, 81, 82,
428 56, 57, 88, 98, 97, 143, 118, 55, 56, 57,
429 73, 73, 97, 119, 88, 74, 74, 74, 74, 118,
430 55, 142, 141, 56, 57, 89, 119, 140, 90, 74,
431 55, 56, 57, 75, 75, 89, 90, 139, 75, 75,
432 75, 75, 76, 76, 76, 76, 76, 76, 76, 138,
433 137, 136, 75, 76, 76, 76, 76, 76, 135, 133,
434 132, 76, 76, 76, 76, 95, 95, 131, 96, 96,
435 130, 96, 96, 128, 127, 76, 85, 85, 88, 126,
436 125, 86, 86, 86, 86, 123, 55, 122, 121, 56,
438 88, 120, 113, 109, 105, 86, 55, 56, 87, 87,
439 101, 93, 86, 87, 87, 87, 87, 83, 134, 129,
440 124, 147, 116, 116, 115, 111, 107, 87, 92, 92,
441 103, 99, 91, 93, 93, 93, 93, 69, 55, 69,
442 84, 56, 79, 64, 69, 66, 65, 93, 55, 56,
443 94, 94, 64, 60, 52, 94, 94, 94, 94, 51,
444 50, 49, 147, 36, 36, 147, 147, 147, 147, 94,
445 100, 100, 147, 147, 147, 101, 101, 101, 101, 147,
446 55, 147, 147, 56, 147, 147, 147, 147, 147, 101,
447 55, 56, 102, 102, 147, 147, 147, 102, 102, 102,
449 102, 147, 147, 147, 147, 147, 147, 147, 147, 147,
450 147, 102, 104, 104, 147, 147, 147, 105, 105, 105,
451 105, 147, 55, 147, 147, 56, 147, 147, 147, 147,
452 147, 105, 55, 56, 106, 106, 147, 147, 147, 106,
453 106, 106, 106, 147, 147, 147, 147, 147, 147, 147,
454 147, 147, 147, 106, 108, 108, 147, 147, 147, 109,
455 109, 109, 109, 147, 55, 147, 147, 56, 147, 147,
456 147, 147, 147, 109, 55, 56, 110, 110, 147, 147,
457 147, 110, 110, 110, 110, 147, 147, 147, 147, 147,
458 147, 147, 147, 147, 147, 110, 112, 112, 147, 147,
460 147, 113, 113, 113, 113, 147, 55, 147, 147, 56,
461 147, 147, 147, 147, 147, 113, 55, 56, 114, 114,
462 147, 147, 147, 114, 114, 114, 114, 147, 147, 147,
463 147, 147, 147, 147, 147, 147, 147, 114, 116, 147,
464 117, 117, 147, 147, 147, 147, 147, 147, 147, 147,
465 55, 147, 147, 56, 147, 147, 147, 147, 147, 147,
466 55, 56, 35, 35, 35, 35, 46, 46, 46, 46,
467 63, 63, 70, 147, 70, 70, 77, 147, 77, 77,
468 13, 147, 147, 147, 147, 147, 147, 147, 147, 147,
469 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
471 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
472 147, 147, 147, 147, 147, 147, 147
475 static yyconst
short int yy_chk
[518] =
477 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
478 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
479 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
480 1, 1, 1, 1, 1, 1, 2, 3, 38, 3,
481 2, 4, 5, 4, 5, 6, 8, 6, 11, 12,
482 8, 24, 41, 11, 12, 25, 25, 27, 27, 24,
483 41, 33, 67, 38, 3, 33, 67, 48, 4, 5,
484 53, 53, 6, 7, 7, 11, 12, 183, 7, 7,
485 7, 7, 7, 7, 7, 7, 7, 7, 7, 48,
486 182, 7, 7, 7, 7, 7, 23, 23, 23, 56,
488 55, 95, 95, 90, 181, 80, 80, 23, 55, 56,
489 23, 23, 80, 90, 89, 180, 115, 23, 23, 23,
490 40, 40, 89, 115, 80, 40, 40, 40, 40, 118,
491 40, 179, 178, 40, 40, 83, 118, 177, 83, 40,
492 40, 40, 40, 42, 42, 83, 83, 176, 42, 42,
493 42, 42, 42, 42, 42, 42, 42, 42, 42, 175,
494 174, 173, 42, 42, 42, 42, 43, 43, 172, 171,
495 170, 43, 43, 43, 43, 88, 88, 169, 88, 88,
496 168, 96, 96, 167, 166, 43, 73, 73, 96, 165,
497 164, 73, 73, 73, 73, 163, 73, 162, 161, 73,
499 96, 160, 159, 158, 157, 73, 73, 73, 75, 75,
500 156, 155, 154, 75, 75, 75, 75, 153, 133, 128,
501 123, 117, 114, 113, 111, 107, 103, 75, 85, 85,
502 99, 91, 84, 85, 85, 85, 85, 69, 85, 68,
503 65, 85, 52, 44, 34, 32, 30, 85, 85, 85,
504 87, 87, 29, 26, 22, 87, 87, 87, 87, 21,
505 19, 17, 13, 10, 9, 0, 0, 0, 0, 87,
506 92, 92, 0, 0, 0, 92, 92, 92, 92, 0,
507 92, 0, 0, 92, 0, 0, 0, 0, 0, 92,
508 92, 92, 94, 94, 0, 0, 0, 94, 94, 94,
510 94, 0, 0, 0, 0, 0, 0, 0, 0, 0,
511 0, 94, 100, 100, 0, 0, 0, 100, 100, 100,
512 100, 0, 100, 0, 0, 100, 0, 0, 0, 0,
513 0, 100, 100, 100, 102, 102, 0, 0, 0, 102,
514 102, 102, 102, 0, 0, 0, 0, 0, 0, 0,
515 0, 0, 0, 102, 104, 104, 0, 0, 0, 104,
516 104, 104, 104, 0, 104, 0, 0, 104, 0, 0,
517 0, 0, 0, 104, 104, 104, 106, 106, 0, 0,
518 0, 106, 106, 106, 106, 0, 0, 0, 0, 0,
519 0, 0, 0, 0, 0, 106, 108, 108, 0, 0,
521 0, 108, 108, 108, 108, 0, 108, 0, 0, 108,
522 0, 0, 0, 0, 0, 108, 108, 108, 110, 110,
523 0, 0, 0, 110, 110, 110, 110, 0, 0, 0,
524 0, 0, 0, 0, 0, 0, 0, 110, 112, 0,
525 112, 112, 0, 0, 0, 0, 0, 0, 0, 0,
526 112, 0, 0, 112, 0, 0, 0, 0, 0, 0,
527 112, 112, 148, 148, 148, 148, 149, 149, 149, 149,
528 150, 150, 151, 0, 151, 151, 152, 0, 152, 152,
529 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
530 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
532 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
533 147, 147, 147, 147, 147, 147, 147
536 static yy_state_type yy_last_accepting_state
;
537 static char *yy_last_accepting_cpos
;
539 /* The intent behind this definition is that it'll catch
540 * any uses of REJECT which flex missed.
542 #define REJECT reject_used_but_not_detected
543 #define yymore() yymore_used_but_not_detected
544 #define YY_MORE_ADJ 0
545 #define YY_RESTORE_YY_MORE_OFFSET
552 * Copyright 2002 Ove Kaaven
554 * This library is free software; you can redistribute it and/or
555 * modify it under the terms of the GNU Lesser General Public
556 * License as published by the Free Software Foundation; either
557 * version 2.1 of the License, or (at your option) any later version.
559 * This library is distributed in the hope that it will be useful,
560 * but WITHOUT ANY WARRANTY; without even the implied warranty of
561 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
562 * Lesser General Public License for more details.
564 * You should have received a copy of the GNU Lesser General Public
565 * License along with this library; if not, write to the Free Software
566 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
568 #define YY_STACK_USED 1
569 #define YY_NO_INPUT 1
570 #define YY_NO_UNPUT 1
571 #define YY_NO_TOP_STATE 1
572 #define YY_NEVER_INTERACTIVE 1
586 #include "wine/port.h"
599 #define YY_NO_UNISTD_H
605 #include "wine/wpp.h"
607 #include "parser.tab.h"
609 static void addcchar(char c
);
610 static char *get_buffered_cstring(void);
612 static char *cbuffer
;
614 static int cbufalloc
= 0;
616 static int kw_token(const char *kw
);
617 static int attr_token(const char *kw
);
619 #define MAX_IMPORT_DEPTH 10
621 YY_BUFFER_STATE state
;
625 } import_stack
[MAX_IMPORT_DEPTH
];
626 int import_stack_ptr
= 0;
628 /* converts an integer in string form to an unsigned long and prints an error
630 static unsigned int xstrtoul(const char *nptr
, char **endptr
, int base
)
635 val
= strtoul(nptr
, endptr
, base
);
636 if ((val
== ULONG_MAX
&& errno
== ERANGE
) || ((unsigned int)val
!= val
))
637 error_loc("integer constant %s is too large\n", nptr
);
641 UUID
*parse_uuid(const char *u
)
643 UUID
* uuid
= xmalloc(sizeof(UUID
));
645 /* it would be nice to use UuidFromStringA */
646 uuid
->Data1
= strtoul(u
, NULL
, 16);
647 uuid
->Data2
= strtoul(u
+9, NULL
, 16);
648 uuid
->Data3
= strtoul(u
+14, NULL
, 16);
650 memcpy(b
, u
+19, 2); uuid
->Data4
[0] = strtoul(b
, NULL
, 16);
651 memcpy(b
, u
+21, 2); uuid
->Data4
[1] = strtoul(b
, NULL
, 16);
652 memcpy(b
, u
+24, 2); uuid
->Data4
[2] = strtoul(b
, NULL
, 16);
653 memcpy(b
, u
+26, 2); uuid
->Data4
[3] = strtoul(b
, NULL
, 16);
654 memcpy(b
, u
+28, 2); uuid
->Data4
[4] = strtoul(b
, NULL
, 16);
655 memcpy(b
, u
+30, 2); uuid
->Data4
[5] = strtoul(b
, NULL
, 16);
656 memcpy(b
, u
+32, 2); uuid
->Data4
[6] = strtoul(b
, NULL
, 16);
657 memcpy(b
, u
+34, 2); uuid
->Data4
[7] = strtoul(b
, NULL
, 16);
662 **************************************************************************
663 * The flexer starts here
664 **************************************************************************
666 #line 667 "parser.yy.c"
668 /* Macros after this point can all be overridden by user definitions in
672 #ifndef YY_SKIP_YYWRAP
674 extern "C" int yywrap
YY_PROTO(( void ));
676 extern int yywrap
YY_PROTO(( void ));
681 static void yyunput
YY_PROTO(( int c
, char *buf_ptr
));
685 static void yy_flex_strncpy
YY_PROTO(( char *, yyconst
char *, int ));
688 #ifdef YY_NEED_STRLEN
689 static int yy_flex_strlen
YY_PROTO(( yyconst
char * ));
694 static int yyinput
YY_PROTO(( void ));
696 static int input
YY_PROTO(( void ));
701 static int yy_start_stack_ptr
= 0;
702 static int yy_start_stack_depth
= 0;
703 static int *yy_start_stack
= 0;
704 #ifndef YY_NO_PUSH_STATE
705 static void yy_push_state
YY_PROTO(( int new_state
));
707 #ifndef YY_NO_POP_STATE
708 static void yy_pop_state
YY_PROTO(( void ));
710 #ifndef YY_NO_TOP_STATE
711 static int yy_top_state
YY_PROTO(( void ));
715 #define YY_NO_PUSH_STATE 1
716 #define YY_NO_POP_STATE 1
717 #define YY_NO_TOP_STATE 1
720 #ifdef YY_MALLOC_DECL
728 /* Just try to get by without declaring the routines. This will fail
729 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
730 * or sizeof(void*) != sizeof(int).
735 /* Amount of stuff to slurp up with each read. */
736 #ifndef YY_READ_BUF_SIZE
737 #define YY_READ_BUF_SIZE 8192
740 /* Copy whatever the last rule matched to the standard output. */
743 /* This used to be an fputs(), but since the string might contain NUL's,
744 * we now use fwrite().
746 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
749 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
750 * is returned in "result".
753 #define YY_INPUT(buf,result,max_size) \
754 if ( yy_current_buffer->yy_is_interactive ) \
757 for ( n = 0; n < max_size && \
758 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
761 buf[n++] = (char) c; \
762 if ( c == EOF && ferror( yyin ) ) \
763 YY_FATAL_ERROR( "input in flex scanner failed" ); \
766 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
767 && ferror( yyin ) ) \
768 YY_FATAL_ERROR( "input in flex scanner failed" );
771 /* No semi-colon after return; correct usage is to write "yyterminate();" -
772 * we don't want an extra ';' after the "return" because that will cause
773 * some compilers to complain about unreachable statements.
776 #define yyterminate() return YY_NULL
779 /* Number of entries by which start-condition stack grows. */
780 #ifndef YY_START_STACK_INCR
781 #define YY_START_STACK_INCR 25
784 /* Report a fatal error. */
785 #ifndef YY_FATAL_ERROR
786 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
789 /* Default declaration of generated scanner - a define so the user can
790 * easily add parameters.
793 #define YY_DECL int yylex YY_PROTO(( void ))
796 /* Code executed at the beginning of each rule, after yytext and yyleng
799 #ifndef YY_USER_ACTION
800 #define YY_USER_ACTION
803 /* Code executed at the end of each rule. */
805 #define YY_BREAK break;
808 #define YY_RULE_SETUP \
810 yy_current_buffer->yy_at_bol = \
811 (yytext[yyleng - 1] == '\n'); \
816 register yy_state_type yy_current_state
;
817 register char *yy_cp
, *yy_bp
;
822 #line 823 "parser.yy.c"
833 yy_start
= 1; /* first start state */
841 if ( ! yy_current_buffer
)
843 yy_create_buffer( yyin
, YY_BUF_SIZE
);
845 yy_load_buffer_state();
848 while ( 1 ) /* loops until end-of-file is reached */
852 /* Support of yytext. */
853 *yy_cp
= yy_hold_char
;
855 /* yy_bp points to the position in yy_ch_buf of the start of
860 yy_current_state
= yy_start
;
861 yy_current_state
+= YY_AT_BOL();
865 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
866 if ( yy_accept
[yy_current_state
] )
868 yy_last_accepting_state
= yy_current_state
;
869 yy_last_accepting_cpos
= yy_cp
;
871 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
873 yy_current_state
= (int) yy_def
[yy_current_state
];
874 if ( yy_current_state
>= 148 )
875 yy_c
= yy_meta
[(unsigned int) yy_c
];
877 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
880 while ( yy_base
[yy_current_state
] != 481 );
883 yy_act
= yy_accept
[yy_current_state
];
885 { /* have to back up */
886 yy_cp
= yy_last_accepting_cpos
;
887 yy_current_state
= yy_last_accepting_state
;
888 yy_act
= yy_accept
[yy_current_state
];
894 do_action
: /* This label is used only to access EOF actions. */
898 { /* beginning of action switch */
899 case 0: /* must back up */
900 /* undo the effects of YY_DO_BEFORE_ACTION */
901 *yy_cp
= yy_hold_char
;
902 yy_cp
= yy_last_accepting_cpos
;
903 yy_current_state
= yy_last_accepting_state
;
909 yy_push_state(PP_LINE
);
918 lineno
= (int)strtol(yytext
, &cptr
, 10);
920 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
921 fname
= strchr(cptr
, '"');
923 error_loc("Malformed '#...' line-directive; missing filename\n");
925 cptr
= strchr(fname
, '"');
927 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
929 line_number
= lineno
- 1; /* We didn't read the newline */
931 input_name
= xstrdup(fname
);
937 yy_push_state(QUOTE
); cbufidx
= 0;
944 parser_lval
.str
= get_buffered_cstring();
951 yy_push_state(WSTRQUOTE
); cbufidx
= 0;
958 parser_lval
.str
= get_buffered_cstring();
965 yy_push_state(SQUOTE
); cbufidx
= 0;
972 parser_lval
.str
= get_buffered_cstring();
991 addcchar('\\'); addcchar(yytext
[1]);
1000 #line 171 "parser.l"
1001 yy_push_state(ATTR
); return '[';
1005 #line 172 "parser.l"
1006 yy_pop_state(); return ']';
1010 #line 173 "parser.l"
1011 return attr_token(yytext
);
1015 #line 174 "parser.l"
1017 parser_lval
.uuid
= parse_uuid(yytext
);
1023 #line 178 "parser.l"
1025 parser_lval
.num
= xstrtoul(yytext
, NULL
, 0);
1031 #line 182 "parser.l"
1033 parser_lval
.num
= xstrtoul(yytext
, NULL
, 0);
1039 #line 186 "parser.l"
1041 parser_lval
.dbl
= strtod(yytext
, NULL
);
1046 *yy_cp
= yy_hold_char
; /* undo effects of setting up yytext */
1047 yy_c_buf_p
= yy_cp
-= 1;
1048 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1050 #line 190 "parser.l"
1055 #line 191 "parser.l"
1056 return kw_token(yytext
);
1060 #line 192 "parser.l"
1065 #line 193 "parser.l"
1070 #line 194 "parser.l"
1075 #line 195 "parser.l"
1080 #line 196 "parser.l"
1085 #line 197 "parser.l"
1090 #line 198 "parser.l"
1095 #line 199 "parser.l"
1096 return GREATEREQUAL
;
1100 #line 200 "parser.l"
1105 #line 201 "parser.l"
1110 #line 202 "parser.l"
1115 #line 203 "parser.l"
1120 #line 204 "parser.l"
1123 case YY_STATE_EOF(INITIAL
):
1124 case YY_STATE_EOF(QUOTE
):
1125 case YY_STATE_EOF(WSTRQUOTE
):
1126 case YY_STATE_EOF(ATTR
):
1127 case YY_STATE_EOF(PP_LINE
):
1128 case YY_STATE_EOF(SQUOTE
):
1129 #line 205 "parser.l"
1131 if (import_stack_ptr
)
1138 #line 210 "parser.l"
1141 #line 1142 "parser.yy.c"
1143 case YY_END_OF_BUFFER
:
1145 /* Amount of text matched not including the EOB char. */
1146 int yy_amount_of_matched_text
= (int) (yy_cp
- yytext_ptr
) - 1;
1148 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1149 *yy_cp
= yy_hold_char
;
1150 YY_RESTORE_YY_MORE_OFFSET
1152 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_NEW
)
1154 /* We're scanning a new file or input source. It's
1155 * possible that this happened because the user
1156 * just pointed yyin at a new source and called
1157 * yylex(). If so, then we have to assure
1158 * consistency between yy_current_buffer and our
1159 * globals. Here is the right place to do so, because
1160 * this is the first action (other than possibly a
1161 * back-up) that will match for the new input source.
1163 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1164 yy_current_buffer
->yy_input_file
= yyin
;
1165 yy_current_buffer
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1168 /* Note that here we test for yy_c_buf_p "<=" to the position
1169 * of the first EOB in the buffer, since yy_c_buf_p will
1170 * already have been incremented past the NUL character
1171 * (since all states make transitions on EOB to the
1172 * end-of-buffer state). Contrast this with the test
1175 if ( yy_c_buf_p
<= &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1176 { /* This was really a NUL. */
1177 yy_state_type yy_next_state
;
1179 yy_c_buf_p
= yytext_ptr
+ yy_amount_of_matched_text
;
1181 yy_current_state
= yy_get_previous_state();
1183 /* Okay, we're now positioned to make the NUL
1184 * transition. We couldn't have
1185 * yy_get_previous_state() go ahead and do it
1186 * for us because it doesn't know how to deal
1187 * with the possibility of jamming (and we don't
1188 * want to build jamming into it because then it
1189 * will run more slowly).
1192 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1194 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1196 if ( yy_next_state
)
1198 /* Consume the NUL. */
1199 yy_cp
= ++yy_c_buf_p
;
1200 yy_current_state
= yy_next_state
;
1207 goto yy_find_action
;
1211 else switch ( yy_get_next_buffer() )
1213 case EOB_ACT_END_OF_FILE
:
1215 yy_did_buffer_switch_on_eof
= 0;
1219 /* Note: because we've taken care in
1220 * yy_get_next_buffer() to have set up
1221 * yytext, we can now set up
1222 * yy_c_buf_p so that if some total
1223 * hoser (like flex itself) wants to
1224 * call the scanner after we return the
1225 * YY_NULL, it'll still work - another
1226 * YY_NULL will get returned.
1228 yy_c_buf_p
= yytext_ptr
+ YY_MORE_ADJ
;
1230 yy_act
= YY_STATE_EOF(YY_START
);
1236 if ( ! yy_did_buffer_switch_on_eof
)
1242 case EOB_ACT_CONTINUE_SCAN
:
1244 yytext_ptr
+ yy_amount_of_matched_text
;
1246 yy_current_state
= yy_get_previous_state();
1249 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1252 case EOB_ACT_LAST_MATCH
:
1254 &yy_current_buffer
->yy_ch_buf
[yy_n_chars
];
1256 yy_current_state
= yy_get_previous_state();
1259 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1260 goto yy_find_action
;
1267 "fatal flex scanner internal error--no action found" );
1268 } /* end of action switch */
1269 } /* end of scanning one token */
1270 } /* end of yylex */
1273 /* yy_get_next_buffer - try to read in a new buffer
1275 * Returns a code representing an action:
1276 * EOB_ACT_LAST_MATCH -
1277 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1278 * EOB_ACT_END_OF_FILE - end of file
1281 static int yy_get_next_buffer()
1283 register char *dest
= yy_current_buffer
->yy_ch_buf
;
1284 register char *source
= yytext_ptr
;
1285 register int number_to_move
, i
;
1288 if ( yy_c_buf_p
> &yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] )
1290 "fatal flex scanner internal error--end of buffer missed" );
1292 if ( yy_current_buffer
->yy_fill_buffer
== 0 )
1293 { /* Don't try to fill the buffer, so this is an EOF. */
1294 if ( yy_c_buf_p
- yytext_ptr
- YY_MORE_ADJ
== 1 )
1296 /* We matched a single character, the EOB, so
1297 * treat this as a final EOF.
1299 return EOB_ACT_END_OF_FILE
;
1304 /* We matched some text prior to the EOB, first
1307 return EOB_ACT_LAST_MATCH
;
1311 /* Try to read more data. */
1313 /* First move last chars to start of buffer. */
1314 number_to_move
= (int) (yy_c_buf_p
- yytext_ptr
) - 1;
1316 for ( i
= 0; i
< number_to_move
; ++i
)
1317 *(dest
++) = *(source
++);
1319 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1320 /* don't do the read, it's not guaranteed to return an EOF,
1323 yy_current_buffer
->yy_n_chars
= yy_n_chars
= 0;
1328 yy_current_buffer
->yy_buf_size
- number_to_move
- 1;
1330 while ( num_to_read
<= 0 )
1331 { /* Not enough room in the buffer - grow it. */
1332 #ifdef YY_USES_REJECT
1334 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1337 /* just a shorter name for the current buffer */
1338 YY_BUFFER_STATE b
= yy_current_buffer
;
1340 int yy_c_buf_p_offset
=
1341 (int) (yy_c_buf_p
- b
->yy_ch_buf
);
1343 if ( b
->yy_is_our_buffer
)
1345 int new_size
= b
->yy_buf_size
* 2;
1347 if ( new_size
<= 0 )
1348 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1350 b
->yy_buf_size
*= 2;
1352 b
->yy_ch_buf
= (char *)
1353 /* Include room in for 2 EOB chars. */
1354 yy_flex_realloc( (void *) b
->yy_ch_buf
,
1355 b
->yy_buf_size
+ 2 );
1358 /* Can't grow it, we don't own it. */
1361 if ( ! b
->yy_ch_buf
)
1363 "fatal error - scanner input buffer overflow" );
1365 yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1367 num_to_read
= yy_current_buffer
->yy_buf_size
-
1372 if ( num_to_read
> YY_READ_BUF_SIZE
)
1373 num_to_read
= YY_READ_BUF_SIZE
;
1375 /* Read in more data. */
1376 YY_INPUT( (&yy_current_buffer
->yy_ch_buf
[number_to_move
]),
1377 yy_n_chars
, num_to_read
);
1379 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1382 if ( yy_n_chars
== 0 )
1384 if ( number_to_move
== YY_MORE_ADJ
)
1386 ret_val
= EOB_ACT_END_OF_FILE
;
1392 ret_val
= EOB_ACT_LAST_MATCH
;
1393 yy_current_buffer
->yy_buffer_status
=
1394 YY_BUFFER_EOF_PENDING
;
1399 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1401 yy_n_chars
+= number_to_move
;
1402 yy_current_buffer
->yy_ch_buf
[yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1403 yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1405 yytext_ptr
= &yy_current_buffer
->yy_ch_buf
[0];
1411 /* yy_get_previous_state - get the state just before the EOB char was reached */
1413 static yy_state_type
yy_get_previous_state()
1415 register yy_state_type yy_current_state
;
1416 register char *yy_cp
;
1418 yy_current_state
= yy_start
;
1419 yy_current_state
+= YY_AT_BOL();
1421 for ( yy_cp
= yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yy_c_buf_p
; ++yy_cp
)
1423 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1424 if ( yy_accept
[yy_current_state
] )
1426 yy_last_accepting_state
= yy_current_state
;
1427 yy_last_accepting_cpos
= yy_cp
;
1429 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1431 yy_current_state
= (int) yy_def
[yy_current_state
];
1432 if ( yy_current_state
>= 148 )
1433 yy_c
= yy_meta
[(unsigned int) yy_c
];
1435 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1438 return yy_current_state
;
1442 /* yy_try_NUL_trans - try to make a transition on the NUL character
1445 * next_state = yy_try_NUL_trans( current_state );
1448 #ifdef YY_USE_PROTOS
1449 static yy_state_type
yy_try_NUL_trans( yy_state_type yy_current_state
)
1451 static yy_state_type
yy_try_NUL_trans( yy_current_state
)
1452 yy_state_type yy_current_state
;
1455 register int yy_is_jam
;
1456 register char *yy_cp
= yy_c_buf_p
;
1458 register YY_CHAR yy_c
= 1;
1459 if ( yy_accept
[yy_current_state
] )
1461 yy_last_accepting_state
= yy_current_state
;
1462 yy_last_accepting_cpos
= yy_cp
;
1464 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1466 yy_current_state
= (int) yy_def
[yy_current_state
];
1467 if ( yy_current_state
>= 148 )
1468 yy_c
= yy_meta
[(unsigned int) yy_c
];
1470 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1471 yy_is_jam
= (yy_current_state
== 147);
1473 return yy_is_jam
? 0 : yy_current_state
;
1478 #ifdef YY_USE_PROTOS
1479 static void yyunput( int c
, register char *yy_bp
)
1481 static void yyunput( c
, yy_bp
)
1483 register char *yy_bp
;
1486 register char *yy_cp
= yy_c_buf_p
;
1488 /* undo effects of setting up yytext */
1489 *yy_cp
= yy_hold_char
;
1491 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1492 { /* need to shift things up to make room */
1493 /* +2 for EOB chars. */
1494 register int number_to_move
= yy_n_chars
+ 2;
1495 register char *dest
= &yy_current_buffer
->yy_ch_buf
[
1496 yy_current_buffer
->yy_buf_size
+ 2];
1497 register char *source
=
1498 &yy_current_buffer
->yy_ch_buf
[number_to_move
];
1500 while ( source
> yy_current_buffer
->yy_ch_buf
)
1501 *--dest
= *--source
;
1503 yy_cp
+= (int) (dest
- source
);
1504 yy_bp
+= (int) (dest
- source
);
1505 yy_current_buffer
->yy_n_chars
=
1506 yy_n_chars
= yy_current_buffer
->yy_buf_size
;
1508 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1509 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1512 *--yy_cp
= (char) c
;
1516 yy_hold_char
= *yy_cp
;
1519 #endif /* ifndef YY_NO_UNPUT */
1523 static int yyinput()
1530 *yy_c_buf_p
= yy_hold_char
;
1532 if ( *yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1534 /* yy_c_buf_p now points to the character we want to return.
1535 * If this occurs *before* the EOB characters, then it's a
1536 * valid NUL; if not, then we've hit the end of the buffer.
1538 if ( yy_c_buf_p
< &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1539 /* This was really a NUL. */
1543 { /* need more input */
1544 int offset
= yy_c_buf_p
- yytext_ptr
;
1547 switch ( yy_get_next_buffer() )
1549 case EOB_ACT_LAST_MATCH
:
1550 /* This happens because yy_g_n_b()
1551 * sees that we've accumulated a
1552 * token and flags that we need to
1553 * try matching the token before
1554 * proceeding. But for input(),
1555 * there's no matching to consider.
1556 * So convert the EOB_ACT_LAST_MATCH
1557 * to EOB_ACT_END_OF_FILE.
1560 /* Reset buffer status. */
1565 case EOB_ACT_END_OF_FILE
:
1570 if ( ! yy_did_buffer_switch_on_eof
)
1579 case EOB_ACT_CONTINUE_SCAN
:
1580 yy_c_buf_p
= yytext_ptr
+ offset
;
1586 c
= *(unsigned char *) yy_c_buf_p
; /* cast for 8-bit char's */
1587 *yy_c_buf_p
= '\0'; /* preserve yytext */
1588 yy_hold_char
= *++yy_c_buf_p
;
1590 yy_current_buffer
->yy_at_bol
= (c
== '\n');
1596 #ifdef YY_USE_PROTOS
1597 void yyrestart( FILE *input_file
)
1599 void yyrestart( input_file
)
1603 if ( ! yy_current_buffer
)
1604 yy_current_buffer
= yy_create_buffer( yyin
, YY_BUF_SIZE
);
1606 yy_init_buffer( yy_current_buffer
, input_file
);
1607 yy_load_buffer_state();
1611 #ifdef YY_USE_PROTOS
1612 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer
)
1614 void yy_switch_to_buffer( new_buffer
)
1615 YY_BUFFER_STATE new_buffer
;
1618 if ( yy_current_buffer
== new_buffer
)
1621 if ( yy_current_buffer
)
1623 /* Flush out information for old buffer. */
1624 *yy_c_buf_p
= yy_hold_char
;
1625 yy_current_buffer
->yy_buf_pos
= yy_c_buf_p
;
1626 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1629 yy_current_buffer
= new_buffer
;
1630 yy_load_buffer_state();
1632 /* We don't actually know whether we did this switch during
1633 * EOF (yywrap()) processing, but the only time this flag
1634 * is looked at is after yywrap() is called, so it's safe
1635 * to go ahead and always set it.
1637 yy_did_buffer_switch_on_eof
= 1;
1641 #ifdef YY_USE_PROTOS
1642 void yy_load_buffer_state( void )
1644 void yy_load_buffer_state()
1647 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1648 yytext_ptr
= yy_c_buf_p
= yy_current_buffer
->yy_buf_pos
;
1649 yyin
= yy_current_buffer
->yy_input_file
;
1650 yy_hold_char
= *yy_c_buf_p
;
1654 #ifdef YY_USE_PROTOS
1655 YY_BUFFER_STATE
yy_create_buffer( FILE *file
, int size
)
1657 YY_BUFFER_STATE
yy_create_buffer( file
, size
)
1664 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1666 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1668 b
->yy_buf_size
= size
;
1670 /* yy_ch_buf has to be 2 characters longer than the size given because
1671 * we need to put in 2 end-of-buffer characters.
1673 b
->yy_ch_buf
= (char *) yy_flex_alloc( b
->yy_buf_size
+ 2 );
1674 if ( ! b
->yy_ch_buf
)
1675 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1677 b
->yy_is_our_buffer
= 1;
1679 yy_init_buffer( b
, file
);
1685 #ifdef YY_USE_PROTOS
1686 void yy_delete_buffer( YY_BUFFER_STATE b
)
1688 void yy_delete_buffer( b
)
1695 if ( b
== yy_current_buffer
)
1696 yy_current_buffer
= (YY_BUFFER_STATE
) 0;
1698 if ( b
->yy_is_our_buffer
)
1699 yy_flex_free( (void *) b
->yy_ch_buf
);
1701 yy_flex_free( (void *) b
);
1705 #ifndef YY_ALWAYS_INTERACTIVE
1706 #ifndef YY_NEVER_INTERACTIVE
1707 extern int isatty
YY_PROTO(( int ));
1711 #ifdef YY_USE_PROTOS
1712 void yy_init_buffer( YY_BUFFER_STATE b
, FILE *file
)
1714 void yy_init_buffer( b
, file
)
1721 yy_flush_buffer( b
);
1723 b
->yy_input_file
= file
;
1724 b
->yy_fill_buffer
= 1;
1726 #if YY_ALWAYS_INTERACTIVE
1727 b
->yy_is_interactive
= 1;
1729 #if YY_NEVER_INTERACTIVE
1730 b
->yy_is_interactive
= 0;
1732 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1738 #ifdef YY_USE_PROTOS
1739 void yy_flush_buffer( YY_BUFFER_STATE b
)
1741 void yy_flush_buffer( b
)
1751 /* We always need two end-of-buffer characters. The first causes
1752 * a transition to the end-of-buffer state. The second causes
1753 * a jam in that state.
1755 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1756 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1758 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1761 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1763 if ( b
== yy_current_buffer
)
1764 yy_load_buffer_state();
1768 #ifndef YY_NO_SCAN_BUFFER
1769 #ifdef YY_USE_PROTOS
1770 YY_BUFFER_STATE
yy_scan_buffer( char *base
, yy_size_t size
)
1772 YY_BUFFER_STATE
yy_scan_buffer( base
, size
)
1780 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1781 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1782 /* They forgot to leave room for the EOB's. */
1785 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1787 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1789 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1790 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1791 b
->yy_is_our_buffer
= 0;
1792 b
->yy_input_file
= 0;
1793 b
->yy_n_chars
= b
->yy_buf_size
;
1794 b
->yy_is_interactive
= 0;
1796 b
->yy_fill_buffer
= 0;
1797 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1799 yy_switch_to_buffer( b
);
1806 #ifndef YY_NO_SCAN_STRING
1807 #ifdef YY_USE_PROTOS
1808 YY_BUFFER_STATE
yy_scan_string( yyconst
char *yy_str
)
1810 YY_BUFFER_STATE
yy_scan_string( yy_str
)
1811 yyconst
char *yy_str
;
1815 for ( len
= 0; yy_str
[len
]; ++len
)
1818 return yy_scan_bytes( yy_str
, len
);
1823 #ifndef YY_NO_SCAN_BYTES
1824 #ifdef YY_USE_PROTOS
1825 YY_BUFFER_STATE
yy_scan_bytes( yyconst
char *bytes
, int len
)
1827 YY_BUFFER_STATE
yy_scan_bytes( bytes
, len
)
1828 yyconst
char *bytes
;
1837 /* Get memory for full buffer, including space for trailing EOB's. */
1839 buf
= (char *) yy_flex_alloc( n
);
1841 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1843 for ( i
= 0; i
< len
; ++i
)
1846 buf
[len
] = buf
[len
+1] = YY_END_OF_BUFFER_CHAR
;
1848 b
= yy_scan_buffer( buf
, n
);
1850 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1852 /* It's okay to grow etc. this buffer, and we should throw it
1853 * away when we're done.
1855 b
->yy_is_our_buffer
= 1;
1862 #ifndef YY_NO_PUSH_STATE
1863 #ifdef YY_USE_PROTOS
1864 static void yy_push_state( int new_state
)
1866 static void yy_push_state( new_state
)
1870 if ( yy_start_stack_ptr
>= yy_start_stack_depth
)
1874 yy_start_stack_depth
+= YY_START_STACK_INCR
;
1875 new_size
= yy_start_stack_depth
* sizeof( int );
1877 if ( ! yy_start_stack
)
1878 yy_start_stack
= (int *) yy_flex_alloc( new_size
);
1881 yy_start_stack
= (int *) yy_flex_realloc(
1882 (void *) yy_start_stack
, new_size
);
1884 if ( ! yy_start_stack
)
1886 "out of memory expanding start-condition stack" );
1889 yy_start_stack
[yy_start_stack_ptr
++] = YY_START
;
1896 #ifndef YY_NO_POP_STATE
1897 static void yy_pop_state()
1899 if ( --yy_start_stack_ptr
< 0 )
1900 YY_FATAL_ERROR( "start-condition stack underflow" );
1902 BEGIN(yy_start_stack
[yy_start_stack_ptr
]);
1907 #ifndef YY_NO_TOP_STATE
1908 static int yy_top_state()
1910 return yy_start_stack
[yy_start_stack_ptr
- 1];
1914 #ifndef YY_EXIT_FAILURE
1915 #define YY_EXIT_FAILURE 2
1918 #ifdef YY_USE_PROTOS
1919 static void yy_fatal_error( yyconst
char msg
[] )
1921 static void yy_fatal_error( msg
)
1925 (void) fprintf( stderr
, "%s\n", msg
);
1926 exit( YY_EXIT_FAILURE
);
1931 /* Redefine yyless() so it works in section 3 code. */
1937 /* Undo effects of setting up yytext. */ \
1938 yytext[yyleng] = yy_hold_char; \
1939 yy_c_buf_p = yytext + n; \
1940 yy_hold_char = *yy_c_buf_p; \
1941 *yy_c_buf_p = '\0'; \
1947 /* Internal utility routines. */
1950 #ifdef YY_USE_PROTOS
1951 static void yy_flex_strncpy( char *s1
, yyconst
char *s2
, int n
)
1953 static void yy_flex_strncpy( s1
, s2
, n
)
1960 for ( i
= 0; i
< n
; ++i
)
1965 #ifdef YY_NEED_STRLEN
1966 #ifdef YY_USE_PROTOS
1967 static int yy_flex_strlen( yyconst
char *s
)
1969 static int yy_flex_strlen( s
)
1974 for ( n
= 0; s
[n
]; ++n
)
1982 #ifdef YY_USE_PROTOS
1983 static void *yy_flex_alloc( yy_size_t size
)
1985 static void *yy_flex_alloc( size
)
1989 return (void *) malloc( size
);
1992 #ifdef YY_USE_PROTOS
1993 static void *yy_flex_realloc( void *ptr
, yy_size_t size
)
1995 static void *yy_flex_realloc( ptr
, size
)
2000 /* The cast to (char *) in the following accommodates both
2001 * implementations that use char* generic pointers, and those
2002 * that use void* generic pointers. It works with the latter
2003 * because both ANSI C and C++ allow castless assignment from
2004 * any pointer type to void*, and deal with argument conversions
2005 * as though doing an assignment.
2007 return (void *) realloc( (char *) ptr
, size
);
2010 #ifdef YY_USE_PROTOS
2011 static void yy_flex_free( void *ptr
)
2013 static void yy_flex_free( ptr
)
2027 #line 210 "parser.l"
2031 int parser_wrap(void)
2042 /* This table MUST be alphabetically sorted on the kw field */
2043 static const struct keyword keywords
[] = {
2047 {"__cdecl", tCDECL
},
2048 {"__fastcall", tFASTCALL
},
2049 {"__int3264", tINT3264
},
2050 {"__int64", tINT64
},
2051 {"__pascal", tPASCAL
},
2052 {"__stdcall", tSTDCALL
},
2054 {"_fastcall", tFASTCALL
},
2055 {"_pascal", tPASCAL
},
2056 {"_stdcall", tSTDCALL
},
2057 {"boolean", tBOOLEAN
},
2062 {"coclass", tCOCLASS
},
2064 {"cpp_quote", tCPPQUOTE
},
2065 {"default", tDEFAULT
},
2066 {"dispinterface", tDISPINTERFACE
},
2067 {"double", tDOUBLE
},
2069 {"error_status_t", tERRORSTATUST
},
2070 {"extern", tEXTERN
},
2072 {"handle_t", tHANDLET
},
2074 {"import", tIMPORT
},
2075 {"importlib", tIMPORTLIB
},
2076 {"inline", tINLINE
},
2078 {"interface", tINTERFACE
},
2079 {"library", tLIBRARY
},
2081 {"methods", tMETHODS
},
2082 {"module", tMODULE
},
2083 {"pascal", tPASCAL
},
2084 {"properties", tPROPERTIES
},
2085 {"register", tREGISTER
},
2087 {"signed", tSIGNED
},
2088 {"sizeof", tSIZEOF
},
2090 {"static", tSTATIC
},
2091 {"stdcall", tSTDCALL
},
2092 {"struct", tSTRUCT
},
2093 {"switch", tSWITCH
},
2094 {"typedef", tTYPEDEF
},
2096 {"unsigned", tUNSIGNED
},
2098 {"wchar_t", tWCHAR
},
2100 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
2102 /* keywords only recognized in attribute lists
2103 * This table MUST be alphabetically sorted on the kw field
2105 static const struct keyword attr_keywords
[] =
2107 {"aggregatable", tAGGREGATABLE
},
2108 {"allocate", tALLOCATE
},
2109 {"annotation", tANNOTATION
},
2110 {"apartment", tAPARTMENT
},
2111 {"appobject", tAPPOBJECT
},
2113 {"async_uuid", tASYNCUUID
},
2114 {"auto_handle", tAUTOHANDLE
},
2115 {"bindable", tBINDABLE
},
2117 {"broadcast", tBROADCAST
},
2118 {"byte_count", tBYTECOUNT
},
2119 {"call_as", tCALLAS
},
2120 {"callback", tCALLBACK
},
2122 {"comm_status", tCOMMSTATUS
},
2123 {"context_handle", tCONTEXTHANDLE
},
2124 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE
},
2125 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE
},
2126 {"control", tCONTROL
},
2127 {"decode", tDECODE
},
2128 {"defaultbind", tDEFAULTBIND
},
2129 {"defaultcollelem", tDEFAULTCOLLELEM
},
2130 {"defaultvalue", tDEFAULTVALUE
},
2131 {"defaultvtable", tDEFAULTVTABLE
},
2132 {"disable_consistency_check", tDISABLECONSISTENCYCHECK
},
2133 {"displaybind", tDISPLAYBIND
},
2134 {"dllname", tDLLNAME
},
2136 {"enable_allocate", tENABLEALLOCATE
},
2137 {"encode", tENCODE
},
2138 {"endpoint", tENDPOINT
},
2140 {"explicit_handle", tEXPLICITHANDLE
},
2141 {"fault_status", tFAULTSTATUS
},
2142 {"force_allocate", tFORCEALLOCATE
},
2144 {"handle", tHANDLE
},
2145 {"helpcontext", tHELPCONTEXT
},
2146 {"helpfile", tHELPFILE
},
2147 {"helpstring", tHELPSTRING
},
2148 {"helpstringcontext", tHELPSTRINGCONTEXT
},
2149 {"helpstringdll", tHELPSTRINGDLL
},
2150 {"hidden", tHIDDEN
},
2152 {"idempotent", tIDEMPOTENT
},
2153 {"ignore", tIGNORE
},
2155 {"immediatebind", tIMMEDIATEBIND
},
2156 {"implicit_handle", tIMPLICITHANDLE
},
2158 {"in_line", tIN_LINE
},
2159 {"input_sync", tINPUTSYNC
},
2161 {"length_is", tLENGTHIS
},
2162 {"licensed", tLICENSED
},
2165 {"message", tMESSAGE
},
2166 {"neutral", tNEUTRAL
},
2167 {"nocode", tNOCODE
},
2168 {"nonbrowsable", tNONBROWSABLE
},
2169 {"noncreatable", tNONCREATABLE
},
2170 {"nonextensible", tNONEXTENSIBLE
},
2171 {"notify", tNOTIFY
},
2172 {"notify_flag", tNOTIFYFLAG
},
2173 {"object", tOBJECT
},
2175 {"oleautomation", tOLEAUTOMATION
},
2176 {"optimize", tOPTIMIZE
},
2177 {"optional", tOPTIONAL
},
2179 {"partial_ignore", tPARTIALIGNORE
},
2180 {"pointer_default", tPOINTERDEFAULT
},
2181 {"progid", tPROGID
},
2182 {"propget", tPROPGET
},
2183 {"propput", tPROPPUT
},
2184 {"propputref", tPROPPUTREF
},
2187 {"public", tPUBLIC
},
2189 {"readonly", tREADONLY
},
2191 {"represent_as", tREPRESENTAS
},
2192 {"requestedit", tREQUESTEDIT
},
2193 {"restricted", tRESTRICTED
},
2194 {"retval", tRETVAL
},
2195 {"single", tSINGLE
},
2196 {"size_is", tSIZEIS
},
2197 {"source", tSOURCE
},
2198 {"strict_context_handle", tSTRICTCONTEXTHANDLE
},
2199 {"string", tSTRING
},
2200 {"switch_is", tSWITCHIS
},
2201 {"switch_type", tSWITCHTYPE
},
2202 {"threading", tTHREADING
},
2203 {"transmit_as", tTRANSMITAS
},
2204 {"uidefault", tUIDEFAULT
},
2205 {"unique", tUNIQUE
},
2206 {"user_marshal", tUSERMARSHAL
},
2207 {"usesgetlasterror", tUSESGETLASTERROR
},
2209 {"v1_enum", tV1ENUM
},
2210 {"vararg", tVARARG
},
2211 {"version", tVERSION
},
2212 {"vi_progid", tVIPROGID
},
2213 {"wire_marshal", tWIREMARSHAL
},
2224 #define KWP(p) ((const struct keyword *)(p))
2226 static int kw_cmp_func(const void *s1
, const void *s2
)
2228 return strcmp(KWP(s1
)->kw
, KWP(s2
)->kw
);
2231 static int kw_token(const char *kw
)
2233 struct keyword key
, *kwp
;
2235 kwp
= bsearch(&key
, keywords
, NKEYWORDS
, sizeof(keywords
[0]), kw_cmp_func
);
2237 parser_lval
.str
= xstrdup(kwp
->kw
);
2240 parser_lval
.str
= xstrdup(kw
);
2241 return is_type(kw
) ? aKNOWNTYPE
: aIDENTIFIER
;
2244 static int attr_token(const char *kw
)
2246 struct keyword key
, *kwp
;
2248 kwp
= bsearch(&key
, attr_keywords
, sizeof(attr_keywords
)/sizeof(attr_keywords
[0]),
2249 sizeof(attr_keywords
[0]), kw_cmp_func
);
2251 parser_lval
.str
= xstrdup(kwp
->kw
);
2254 return kw_token(kw
);
2257 static void addcchar(char c
)
2259 if(cbufidx
>= cbufalloc
)
2262 cbuffer
= xrealloc(cbuffer
, cbufalloc
* sizeof(cbuffer
[0]));
2263 if(cbufalloc
> 65536)
2264 parser_warning("Reallocating string buffer larger than 64kB\n");
2266 cbuffer
[cbufidx
++] = c
;
2269 static char *get_buffered_cstring(void)
2272 return xstrdup(cbuffer
);
2275 void pop_import(void)
2277 int ptr
= import_stack_ptr
-1;
2280 yy_delete_buffer( YY_CURRENT_BUFFER
);
2281 yy_switch_to_buffer( import_stack
[ptr
].state
);
2286 temp_name
= import_stack
[ptr
].temp_name
;
2287 input_name
= import_stack
[ptr
].input_name
;
2288 line_number
= import_stack
[ptr
].line_number
;
2294 struct imports
*next
;
2297 int do_import(char *fname
)
2301 struct imports
*import
;
2302 int ptr
= import_stack_ptr
;
2305 import
= first_import
;
2306 while (import
&& strcmp(import
->name
, fname
))
2307 import
= import
->next
;
2308 if (import
) return 0; /* already imported */
2310 import
= xmalloc(sizeof(struct imports
));
2311 import
->name
= xstrdup(fname
);
2312 import
->next
= first_import
;
2313 first_import
= import
;
2315 /* don't search for a file name with a path in the include directories,
2316 * for compatibility with MIDL */
2317 if (strchr( fname
, '/' ) || strchr( fname
, '\\' ))
2318 path
= xstrdup( fname
);
2319 else if (!(path
= wpp_find_include( fname
, input_name
)))
2320 error_loc("Unable to open include file %s\n", fname
);
2322 import_stack
[ptr
].temp_name
= temp_name
;
2323 import_stack
[ptr
].input_name
= input_name
;
2324 import_stack
[ptr
].line_number
= line_number
;
2329 name
= xstrdup( "widl.XXXXXX" );
2330 if((fd
= mkstemps( name
, 0 )) == -1)
2331 error("Could not generate a temp name from %s\n", name
);
2334 if (!(f
= fdopen(fd
, "wt")))
2335 error("Could not open fd %s for writing\n", name
);
2337 ret
= wpp_parse( path
, f
);
2341 if((f
= fopen(temp_name
, "r")) == NULL
)
2342 error_loc("Unable to open %s\n", temp_name
);
2344 import_stack
[ptr
].state
= YY_CURRENT_BUFFER
;
2345 yy_switch_to_buffer(yy_create_buffer(f
, YY_BUF_SIZE
));
2349 void abort_import(void)
2353 for (ptr
=0; ptr
<import_stack_ptr
; ptr
++)
2354 unlink(import_stack
[ptr
].temp_name
);