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 23
305 #define YY_END_OF_BUFFER 24
306 static yyconst
short int yy_accept
[113] =
308 0, 0, 0, 0, 0, 0, 2, 2, 24, 22,
309 19, 18, 3, 14, 14, 22, 22, 17, 17, 9,
310 19, 1, 8, 23, 4, 8, 14, 14, 11, 11,
311 10, 2, 0, 14, 0, 20, 21, 17, 17, 0,
312 1, 1, 7, 6, 5, 14, 0, 11, 11, 2,
313 15, 13, 17, 14, 0, 11, 0, 17, 14, 0,
314 11, 0, 15, 17, 14, 0, 11, 17, 14, 0,
315 11, 17, 14, 0, 11, 17, 14, 0, 11, 17,
316 0, 14, 0, 16, 0, 0, 0, 0, 0, 0,
317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
323 static yyconst
int yy_ec
[256] =
325 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
326 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
327 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
328 1, 2, 1, 4, 5, 1, 1, 1, 1, 6,
329 1, 1, 7, 1, 8, 9, 1, 10, 11, 11,
330 11, 11, 11, 11, 11, 11, 11, 1, 1, 12,
331 1, 13, 1, 1, 14, 15, 15, 15, 16, 17,
332 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
333 18, 19, 20, 18, 18, 18, 18, 18, 21, 18,
334 22, 23, 24, 1, 18, 1, 15, 15, 15, 15,
336 25, 15, 18, 18, 18, 18, 18, 18, 18, 18,
337 18, 18, 18, 18, 18, 18, 18, 18, 18, 26,
338 18, 18, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 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,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 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,
355 static yyconst
int yy_meta
[27] =
357 1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
358 3, 1, 1, 3, 3, 3, 3, 4, 4, 4,
362 static yyconst
short int yy_base
[151] =
364 0, 25, 25, 28, 42, 31, 265, 264, 266, 269,
365 269, 269, 269, 60, 28, 253, 251, 0, 249, 269,
366 38, 260, 269, 269, 269, 31, 39, 62, 79, 0,
367 269, 0, 31, 35, 0, 269, 269, 0, 244, 72,
368 258, 257, 269, 269, 269, 65, 0, 96, 0, 0,
369 113, 0, 242, 68, 0, 129, 149, 240, 70, 0,
370 151, 72, 74, 229, 81, 0, 168, 224, 91, 0,
371 185, 212, 98, 0, 202, 204, 117, 216, 207, 124,
372 0, 108, 129, 269, 0, 0, 0, 206, 0, 0,
373 0, 0, 201, 0, 0, 0, 0, 200, 0, 0,
375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
376 269, 269, 228, 233, 236, 241, 244, 247, 252, 204,
377 195, 194, 189, 188, 187, 178, 177, 172, 171, 170,
378 161, 160, 155, 150, 149, 148, 139, 138, 134, 133,
379 131, 130, 129, 117, 100, 84, 61, 52, 44, 31
382 static yyconst
short int yy_def
[151] =
384 112, 1, 113, 113, 1, 5, 114, 114, 112, 112,
385 112, 112, 112, 112, 112, 112, 112, 115, 115, 112,
386 112, 112, 112, 112, 112, 116, 117, 117, 112, 118,
387 112, 119, 112, 112, 120, 112, 112, 115, 115, 112,
388 112, 112, 112, 112, 112, 121, 121, 112, 118, 119,
389 112, 120, 115, 122, 122, 112, 112, 115, 123, 123,
390 112, 112, 51, 115, 124, 124, 112, 115, 125, 125,
391 112, 115, 126, 126, 112, 115, 112, 112, 118, 115,
392 127, 112, 112, 112, 128, 129, 130, 112, 131, 132,
393 133, 134, 112, 135, 136, 137, 138, 112, 139, 140,
395 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
396 112, 0, 112, 112, 112, 112, 112, 112, 112, 112,
397 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
398 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
399 112, 112, 112, 112, 112, 112, 112, 112, 112, 112
402 static yyconst
short int yy_nxt
[296] =
404 10, 11, 12, 13, 10, 10, 10, 10, 10, 14,
405 15, 16, 17, 18, 18, 18, 18, 18, 18, 19,
406 18, 20, 10, 10, 18, 18, 21, 24, 25, 22,
407 24, 25, 21, 111, 44, 22, 33, 34, 34, 40,
408 51, 51, 41, 33, 34, 34, 110, 26, 46, 46,
409 26, 27, 28, 45, 109, 29, 29, 29, 29, 30,
410 30, 30, 30, 108, 35, 31, 29, 30, 33, 34,
411 34, 46, 46, 40, 54, 54, 41, 59, 59, 65,
412 65, 63, 63, 63, 63, 35, 107, 112, 48, 48,
413 69, 69, 48, 48, 48, 48, 49, 49, 49, 49,
415 73, 73, 106, 48, 49, 56, 56, 77, 77, 56,
416 56, 56, 56, 49, 49, 49, 49, 82, 82, 105,
417 56, 49, 51, 51, 81, 83, 82, 82, 57, 84,
418 83, 104, 103, 102, 84, 101, 100, 57, 61, 61,
419 98, 97, 61, 61, 61, 61, 49, 49, 49, 49,
420 96, 95, 93, 61, 49, 62, 62, 92, 63, 63,
421 67, 67, 91, 90, 67, 67, 67, 67, 49, 49,
422 49, 49, 88, 87, 86, 67, 49, 71, 71, 85,
423 78, 71, 71, 71, 71, 49, 49, 49, 49, 74,
424 70, 66, 71, 49, 75, 75, 60, 55, 75, 75,
426 75, 75, 49, 49, 49, 49, 52, 99, 94, 75,
427 49, 79, 79, 89, 81, 79, 79, 79, 79, 49,
428 49, 49, 49, 81, 80, 76, 79, 49, 23, 23,
429 23, 23, 23, 32, 32, 32, 32, 32, 38, 38,
430 38, 43, 72, 43, 43, 43, 47, 68, 47, 49,
431 49, 49, 50, 64, 50, 50, 50, 58, 42, 42,
432 53, 42, 39, 37, 36, 112, 24, 24, 9, 112,
433 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
434 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
435 112, 112, 112, 112, 112
439 static yyconst
short int yy_chk
[296] =
441 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
442 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
443 1, 1, 1, 1, 1, 1, 2, 3, 3, 2,
444 4, 4, 6, 150, 26, 6, 15, 15, 15, 21,
445 33, 33, 21, 34, 34, 34, 149, 3, 27, 27,
446 4, 5, 5, 26, 148, 5, 5, 5, 5, 5,
447 5, 5, 5, 147, 27, 5, 5, 5, 14, 14,
448 14, 28, 28, 40, 46, 46, 40, 54, 54, 59,
449 59, 62, 62, 63, 63, 14, 146, 28, 29, 29,
450 65, 65, 29, 29, 29, 29, 29, 29, 29, 29,
452 69, 69, 145, 29, 29, 48, 48, 73, 73, 48,
453 48, 48, 48, 48, 48, 48, 48, 82, 82, 144,
454 48, 48, 51, 51, 77, 80, 77, 77, 51, 80,
455 83, 143, 142, 141, 83, 140, 139, 51, 56, 56,
456 138, 137, 56, 56, 56, 56, 56, 56, 56, 56,
457 136, 135, 134, 56, 56, 57, 57, 133, 57, 57,
458 61, 61, 132, 131, 61, 61, 61, 61, 61, 61,
459 61, 61, 130, 129, 128, 61, 61, 67, 67, 127,
460 126, 67, 67, 67, 67, 67, 67, 67, 67, 125,
461 124, 123, 67, 67, 71, 71, 122, 121, 71, 71,
463 71, 71, 71, 71, 71, 71, 120, 98, 93, 71,
464 71, 75, 75, 88, 79, 75, 75, 75, 75, 75,
465 75, 75, 75, 78, 76, 72, 75, 75, 113, 113,
466 113, 113, 113, 114, 114, 114, 114, 114, 115, 115,
467 115, 116, 68, 116, 116, 116, 117, 64, 117, 118,
468 118, 118, 119, 58, 119, 119, 119, 53, 42, 41,
469 39, 22, 19, 17, 16, 9, 8, 7, 112, 112,
470 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
471 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
472 112, 112, 112, 112, 112
476 static yy_state_type yy_last_accepting_state
;
477 static char *yy_last_accepting_cpos
;
479 /* The intent behind this definition is that it'll catch
480 * any uses of REJECT which flex missed.
482 #define REJECT reject_used_but_not_detected
483 #define yymore() yymore_used_but_not_detected
484 #define YY_MORE_ADJ 0
485 #define YY_RESTORE_YY_MORE_OFFSET
492 * Copyright 2002 Ove Kaaven
494 * This library is free software; you can redistribute it and/or
495 * modify it under the terms of the GNU Lesser General Public
496 * License as published by the Free Software Foundation; either
497 * version 2.1 of the License, or (at your option) any later version.
499 * This library is distributed in the hope that it will be useful,
500 * but WITHOUT ANY WARRANTY; without even the implied warranty of
501 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
502 * Lesser General Public License for more details.
504 * You should have received a copy of the GNU Lesser General Public
505 * License along with this library; if not, write to the Free Software
506 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
508 #define YY_STACK_USED 1
509 #define YY_NO_UNPUT 1
510 #define YY_NO_TOP_STATE 1
511 #define YY_NEVER_INTERACTIVE 1
534 #include "wine/wpp.h"
536 #include "parser.tab.h"
538 extern char *temp_name
;
540 static void addcchar(char c
);
541 static char *get_buffered_cstring(void);
543 static char *cbuffer
;
545 static int cbufalloc
= 0;
547 static int kw_token(const char *kw
);
548 static int attr_token(const char *kw
);
550 #define MAX_IMPORT_DEPTH 10
552 YY_BUFFER_STATE state
;
556 } import_stack
[MAX_IMPORT_DEPTH
];
557 int import_stack_ptr
= 0;
559 static void pop_import(void);
561 UUID
*parse_uuid(const char *u
)
563 UUID
* uuid
= xmalloc(sizeof(UUID
));
565 /* it would be nice to use UuidFromStringA */
566 uuid
->Data1
= strtoul(u
, NULL
, 16);
567 uuid
->Data2
= strtoul(u
+9, NULL
, 16);
568 uuid
->Data3
= strtoul(u
+14, NULL
, 16);
570 memcpy(b
, u
+19, 2); uuid
->Data4
[0] = strtoul(b
, NULL
, 16);
571 memcpy(b
, u
+21, 2); uuid
->Data4
[1] = strtoul(b
, NULL
, 16);
572 memcpy(b
, u
+24, 2); uuid
->Data4
[2] = strtoul(b
, NULL
, 16);
573 memcpy(b
, u
+26, 2); uuid
->Data4
[3] = strtoul(b
, NULL
, 16);
574 memcpy(b
, u
+28, 2); uuid
->Data4
[4] = strtoul(b
, NULL
, 16);
575 memcpy(b
, u
+30, 2); uuid
->Data4
[5] = strtoul(b
, NULL
, 16);
576 memcpy(b
, u
+32, 2); uuid
->Data4
[6] = strtoul(b
, NULL
, 16);
577 memcpy(b
, u
+34, 2); uuid
->Data4
[7] = strtoul(b
, NULL
, 16);
582 **************************************************************************
583 * The flexer starts here
584 **************************************************************************
586 #line 587 "parser.yy.c"
588 /* Macros after this point can all be overridden by user definitions in
592 #ifndef YY_SKIP_YYWRAP
594 extern "C" int yywrap
YY_PROTO(( void ));
596 extern int yywrap
YY_PROTO(( void ));
601 static void yyunput
YY_PROTO(( int c
, char *buf_ptr
));
605 static void yy_flex_strncpy
YY_PROTO(( char *, yyconst
char *, int ));
608 #ifdef YY_NEED_STRLEN
609 static int yy_flex_strlen
YY_PROTO(( yyconst
char * ));
614 static int yyinput
YY_PROTO(( void ));
616 static int input
YY_PROTO(( void ));
621 static int yy_start_stack_ptr
= 0;
622 static int yy_start_stack_depth
= 0;
623 static int *yy_start_stack
= 0;
624 #ifndef YY_NO_PUSH_STATE
625 static void yy_push_state
YY_PROTO(( int new_state
));
627 #ifndef YY_NO_POP_STATE
628 static void yy_pop_state
YY_PROTO(( void ));
630 #ifndef YY_NO_TOP_STATE
631 static int yy_top_state
YY_PROTO(( void ));
635 #define YY_NO_PUSH_STATE 1
636 #define YY_NO_POP_STATE 1
637 #define YY_NO_TOP_STATE 1
640 #ifdef YY_MALLOC_DECL
648 /* Just try to get by without declaring the routines. This will fail
649 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
650 * or sizeof(void*) != sizeof(int).
655 /* Amount of stuff to slurp up with each read. */
656 #ifndef YY_READ_BUF_SIZE
657 #define YY_READ_BUF_SIZE 8192
660 /* Copy whatever the last rule matched to the standard output. */
663 /* This used to be an fputs(), but since the string might contain NUL's,
664 * we now use fwrite().
666 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
669 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
670 * is returned in "result".
673 #define YY_INPUT(buf,result,max_size) \
674 if ( yy_current_buffer->yy_is_interactive ) \
677 for ( n = 0; n < max_size && \
678 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
681 buf[n++] = (char) c; \
682 if ( c == EOF && ferror( yyin ) ) \
683 YY_FATAL_ERROR( "input in flex scanner failed" ); \
686 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
687 && ferror( yyin ) ) \
688 YY_FATAL_ERROR( "input in flex scanner failed" );
691 /* No semi-colon after return; correct usage is to write "yyterminate();" -
692 * we don't want an extra ';' after the "return" because that will cause
693 * some compilers to complain about unreachable statements.
696 #define yyterminate() return YY_NULL
699 /* Number of entries by which start-condition stack grows. */
700 #ifndef YY_START_STACK_INCR
701 #define YY_START_STACK_INCR 25
704 /* Report a fatal error. */
705 #ifndef YY_FATAL_ERROR
706 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
709 /* Default declaration of generated scanner - a define so the user can
710 * easily add parameters.
713 #define YY_DECL int yylex YY_PROTO(( void ))
716 /* Code executed at the beginning of each rule, after yytext and yyleng
719 #ifndef YY_USER_ACTION
720 #define YY_USER_ACTION
723 /* Code executed at the end of each rule. */
725 #define YY_BREAK break;
728 #define YY_RULE_SETUP \
730 yy_current_buffer->yy_at_bol = \
731 (yytext[yyleng - 1] == '\n'); \
736 register yy_state_type yy_current_state
;
737 register char *yy_cp
, *yy_bp
;
742 #line 743 "parser.yy.c"
753 yy_start
= 1; /* first start state */
761 if ( ! yy_current_buffer
)
763 yy_create_buffer( yyin
, YY_BUF_SIZE
);
765 yy_load_buffer_state();
768 while ( 1 ) /* loops until end-of-file is reached */
772 /* Support of yytext. */
773 *yy_cp
= yy_hold_char
;
775 /* yy_bp points to the position in yy_ch_buf of the start of
780 yy_current_state
= yy_start
;
781 yy_current_state
+= YY_AT_BOL();
785 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
786 if ( yy_accept
[yy_current_state
] )
788 yy_last_accepting_state
= yy_current_state
;
789 yy_last_accepting_cpos
= yy_cp
;
791 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
793 yy_current_state
= (int) yy_def
[yy_current_state
];
794 if ( yy_current_state
>= 113 )
795 yy_c
= yy_meta
[(unsigned int) yy_c
];
797 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
800 while ( yy_base
[yy_current_state
] != 269 );
803 yy_act
= yy_accept
[yy_current_state
];
805 { /* have to back up */
806 yy_cp
= yy_last_accepting_cpos
;
807 yy_current_state
= yy_last_accepting_state
;
808 yy_act
= yy_accept
[yy_current_state
];
814 do_action
: /* This label is used only to access EOF actions. */
818 { /* beginning of action switch */
819 case 0: /* must back up */
820 /* undo the effects of YY_DO_BEFORE_ACTION */
821 *yy_cp
= yy_hold_char
;
822 yy_cp
= yy_last_accepting_cpos
;
823 yy_current_state
= yy_last_accepting_state
;
829 yy_push_state(PP_LINE
);
838 lineno
= (int)strtol(yytext
, &cptr
, 10);
840 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
841 fname
= strchr(cptr
, '"');
843 error_loc("Malformed '#...' line-directive; missing filename\n");
845 cptr
= strchr(fname
, '"');
847 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
849 line_number
= lineno
- 1; /* We didn't read the newline */
851 input_name
= xstrdup(fname
);
857 yy_push_state(QUOTE
); cbufidx
= 0;
864 parser_lval
.str
= get_buffered_cstring();
878 addcchar('\\'); addcchar(yytext
[1]);
888 yy_push_state(ATTR
); return '[';
893 yy_pop_state(); return ']';
898 return attr_token(yytext
);
904 parser_lval
.uuid
= parse_uuid(yytext
);
912 parser_lval
.num
= strtoul(yytext
, NULL
, 0);
920 parser_lval
.num
= strtoul(yytext
, NULL
, 0);
928 parser_lval
.dbl
= strtod(yytext
, NULL
);
933 *yy_cp
= yy_hold_char
; /* undo effects of setting up yytext */
934 yy_c_buf_p
= yy_cp
-= 1;
935 YY_DO_BEFORE_ACTION
; /* set up yytext again */
943 return kw_token(yytext
);
970 case YY_STATE_EOF(INITIAL
):
971 case YY_STATE_EOF(QUOTE
):
972 case YY_STATE_EOF(ATTR
):
973 case YY_STATE_EOF(PP_LINE
):
976 if (import_stack_ptr
) {
988 #line 989 "parser.yy.c"
990 case YY_END_OF_BUFFER
:
992 /* Amount of text matched not including the EOB char. */
993 int yy_amount_of_matched_text
= (int) (yy_cp
- yytext_ptr
) - 1;
995 /* Undo the effects of YY_DO_BEFORE_ACTION. */
996 *yy_cp
= yy_hold_char
;
997 YY_RESTORE_YY_MORE_OFFSET
999 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_NEW
)
1001 /* We're scanning a new file or input source. It's
1002 * possible that this happened because the user
1003 * just pointed yyin at a new source and called
1004 * yylex(). If so, then we have to assure
1005 * consistency between yy_current_buffer and our
1006 * globals. Here is the right place to do so, because
1007 * this is the first action (other than possibly a
1008 * back-up) that will match for the new input source.
1010 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1011 yy_current_buffer
->yy_input_file
= yyin
;
1012 yy_current_buffer
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1015 /* Note that here we test for yy_c_buf_p "<=" to the position
1016 * of the first EOB in the buffer, since yy_c_buf_p will
1017 * already have been incremented past the NUL character
1018 * (since all states make transitions on EOB to the
1019 * end-of-buffer state). Contrast this with the test
1022 if ( yy_c_buf_p
<= &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1023 { /* This was really a NUL. */
1024 yy_state_type yy_next_state
;
1026 yy_c_buf_p
= yytext_ptr
+ yy_amount_of_matched_text
;
1028 yy_current_state
= yy_get_previous_state();
1030 /* Okay, we're now positioned to make the NUL
1031 * transition. We couldn't have
1032 * yy_get_previous_state() go ahead and do it
1033 * for us because it doesn't know how to deal
1034 * with the possibility of jamming (and we don't
1035 * want to build jamming into it because then it
1036 * will run more slowly).
1039 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1041 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1043 if ( yy_next_state
)
1045 /* Consume the NUL. */
1046 yy_cp
= ++yy_c_buf_p
;
1047 yy_current_state
= yy_next_state
;
1054 goto yy_find_action
;
1058 else switch ( yy_get_next_buffer() )
1060 case EOB_ACT_END_OF_FILE
:
1062 yy_did_buffer_switch_on_eof
= 0;
1066 /* Note: because we've taken care in
1067 * yy_get_next_buffer() to have set up
1068 * yytext, we can now set up
1069 * yy_c_buf_p so that if some total
1070 * hoser (like flex itself) wants to
1071 * call the scanner after we return the
1072 * YY_NULL, it'll still work - another
1073 * YY_NULL will get returned.
1075 yy_c_buf_p
= yytext_ptr
+ YY_MORE_ADJ
;
1077 yy_act
= YY_STATE_EOF(YY_START
);
1083 if ( ! yy_did_buffer_switch_on_eof
)
1089 case EOB_ACT_CONTINUE_SCAN
:
1091 yytext_ptr
+ yy_amount_of_matched_text
;
1093 yy_current_state
= yy_get_previous_state();
1096 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1099 case EOB_ACT_LAST_MATCH
:
1101 &yy_current_buffer
->yy_ch_buf
[yy_n_chars
];
1103 yy_current_state
= yy_get_previous_state();
1106 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1107 goto yy_find_action
;
1114 "fatal flex scanner internal error--no action found" );
1115 } /* end of action switch */
1116 } /* end of scanning one token */
1117 } /* end of yylex */
1120 /* yy_get_next_buffer - try to read in a new buffer
1122 * Returns a code representing an action:
1123 * EOB_ACT_LAST_MATCH -
1124 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1125 * EOB_ACT_END_OF_FILE - end of file
1128 static int yy_get_next_buffer()
1130 register char *dest
= yy_current_buffer
->yy_ch_buf
;
1131 register char *source
= yytext_ptr
;
1132 register int number_to_move
, i
;
1135 if ( yy_c_buf_p
> &yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] )
1137 "fatal flex scanner internal error--end of buffer missed" );
1139 if ( yy_current_buffer
->yy_fill_buffer
== 0 )
1140 { /* Don't try to fill the buffer, so this is an EOF. */
1141 if ( yy_c_buf_p
- yytext_ptr
- YY_MORE_ADJ
== 1 )
1143 /* We matched a single character, the EOB, so
1144 * treat this as a final EOF.
1146 return EOB_ACT_END_OF_FILE
;
1151 /* We matched some text prior to the EOB, first
1154 return EOB_ACT_LAST_MATCH
;
1158 /* Try to read more data. */
1160 /* First move last chars to start of buffer. */
1161 number_to_move
= (int) (yy_c_buf_p
- yytext_ptr
) - 1;
1163 for ( i
= 0; i
< number_to_move
; ++i
)
1164 *(dest
++) = *(source
++);
1166 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1167 /* don't do the read, it's not guaranteed to return an EOF,
1170 yy_current_buffer
->yy_n_chars
= yy_n_chars
= 0;
1175 yy_current_buffer
->yy_buf_size
- number_to_move
- 1;
1177 while ( num_to_read
<= 0 )
1178 { /* Not enough room in the buffer - grow it. */
1179 #ifdef YY_USES_REJECT
1181 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1184 /* just a shorter name for the current buffer */
1185 YY_BUFFER_STATE b
= yy_current_buffer
;
1187 int yy_c_buf_p_offset
=
1188 (int) (yy_c_buf_p
- b
->yy_ch_buf
);
1190 if ( b
->yy_is_our_buffer
)
1192 int new_size
= b
->yy_buf_size
* 2;
1194 if ( new_size
<= 0 )
1195 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1197 b
->yy_buf_size
*= 2;
1199 b
->yy_ch_buf
= (char *)
1200 /* Include room in for 2 EOB chars. */
1201 yy_flex_realloc( (void *) b
->yy_ch_buf
,
1202 b
->yy_buf_size
+ 2 );
1205 /* Can't grow it, we don't own it. */
1208 if ( ! b
->yy_ch_buf
)
1210 "fatal error - scanner input buffer overflow" );
1212 yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1214 num_to_read
= yy_current_buffer
->yy_buf_size
-
1219 if ( num_to_read
> YY_READ_BUF_SIZE
)
1220 num_to_read
= YY_READ_BUF_SIZE
;
1222 /* Read in more data. */
1223 YY_INPUT( (&yy_current_buffer
->yy_ch_buf
[number_to_move
]),
1224 yy_n_chars
, num_to_read
);
1226 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1229 if ( yy_n_chars
== 0 )
1231 if ( number_to_move
== YY_MORE_ADJ
)
1233 ret_val
= EOB_ACT_END_OF_FILE
;
1239 ret_val
= EOB_ACT_LAST_MATCH
;
1240 yy_current_buffer
->yy_buffer_status
=
1241 YY_BUFFER_EOF_PENDING
;
1246 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1248 yy_n_chars
+= number_to_move
;
1249 yy_current_buffer
->yy_ch_buf
[yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1250 yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1252 yytext_ptr
= &yy_current_buffer
->yy_ch_buf
[0];
1258 /* yy_get_previous_state - get the state just before the EOB char was reached */
1260 static yy_state_type
yy_get_previous_state()
1262 register yy_state_type yy_current_state
;
1263 register char *yy_cp
;
1265 yy_current_state
= yy_start
;
1266 yy_current_state
+= YY_AT_BOL();
1268 for ( yy_cp
= yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yy_c_buf_p
; ++yy_cp
)
1270 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1271 if ( yy_accept
[yy_current_state
] )
1273 yy_last_accepting_state
= yy_current_state
;
1274 yy_last_accepting_cpos
= yy_cp
;
1276 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1278 yy_current_state
= (int) yy_def
[yy_current_state
];
1279 if ( yy_current_state
>= 113 )
1280 yy_c
= yy_meta
[(unsigned int) yy_c
];
1282 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1285 return yy_current_state
;
1289 /* yy_try_NUL_trans - try to make a transition on the NUL character
1292 * next_state = yy_try_NUL_trans( current_state );
1295 #ifdef YY_USE_PROTOS
1296 static yy_state_type
yy_try_NUL_trans( yy_state_type yy_current_state
)
1298 static yy_state_type
yy_try_NUL_trans( yy_current_state
)
1299 yy_state_type yy_current_state
;
1302 register int yy_is_jam
;
1303 register char *yy_cp
= yy_c_buf_p
;
1305 register YY_CHAR yy_c
= 1;
1306 if ( yy_accept
[yy_current_state
] )
1308 yy_last_accepting_state
= yy_current_state
;
1309 yy_last_accepting_cpos
= yy_cp
;
1311 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1313 yy_current_state
= (int) yy_def
[yy_current_state
];
1314 if ( yy_current_state
>= 113 )
1315 yy_c
= yy_meta
[(unsigned int) yy_c
];
1317 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1318 yy_is_jam
= (yy_current_state
== 112);
1320 return yy_is_jam
? 0 : yy_current_state
;
1325 #ifdef YY_USE_PROTOS
1326 static void yyunput( int c
, register char *yy_bp
)
1328 static void yyunput( c
, yy_bp
)
1330 register char *yy_bp
;
1333 register char *yy_cp
= yy_c_buf_p
;
1335 /* undo effects of setting up yytext */
1336 *yy_cp
= yy_hold_char
;
1338 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1339 { /* need to shift things up to make room */
1340 /* +2 for EOB chars. */
1341 register int number_to_move
= yy_n_chars
+ 2;
1342 register char *dest
= &yy_current_buffer
->yy_ch_buf
[
1343 yy_current_buffer
->yy_buf_size
+ 2];
1344 register char *source
=
1345 &yy_current_buffer
->yy_ch_buf
[number_to_move
];
1347 while ( source
> yy_current_buffer
->yy_ch_buf
)
1348 *--dest
= *--source
;
1350 yy_cp
+= (int) (dest
- source
);
1351 yy_bp
+= (int) (dest
- source
);
1352 yy_current_buffer
->yy_n_chars
=
1353 yy_n_chars
= yy_current_buffer
->yy_buf_size
;
1355 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1356 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1359 *--yy_cp
= (char) c
;
1363 yy_hold_char
= *yy_cp
;
1366 #endif /* ifndef YY_NO_UNPUT */
1370 static int yyinput()
1377 *yy_c_buf_p
= yy_hold_char
;
1379 if ( *yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1381 /* yy_c_buf_p now points to the character we want to return.
1382 * If this occurs *before* the EOB characters, then it's a
1383 * valid NUL; if not, then we've hit the end of the buffer.
1385 if ( yy_c_buf_p
< &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1386 /* This was really a NUL. */
1390 { /* need more input */
1391 int offset
= yy_c_buf_p
- yytext_ptr
;
1394 switch ( yy_get_next_buffer() )
1396 case EOB_ACT_LAST_MATCH
:
1397 /* This happens because yy_g_n_b()
1398 * sees that we've accumulated a
1399 * token and flags that we need to
1400 * try matching the token before
1401 * proceeding. But for input(),
1402 * there's no matching to consider.
1403 * So convert the EOB_ACT_LAST_MATCH
1404 * to EOB_ACT_END_OF_FILE.
1407 /* Reset buffer status. */
1412 case EOB_ACT_END_OF_FILE
:
1417 if ( ! yy_did_buffer_switch_on_eof
)
1426 case EOB_ACT_CONTINUE_SCAN
:
1427 yy_c_buf_p
= yytext_ptr
+ offset
;
1433 c
= *(unsigned char *) yy_c_buf_p
; /* cast for 8-bit char's */
1434 *yy_c_buf_p
= '\0'; /* preserve yytext */
1435 yy_hold_char
= *++yy_c_buf_p
;
1437 yy_current_buffer
->yy_at_bol
= (c
== '\n');
1443 #ifdef YY_USE_PROTOS
1444 void yyrestart( FILE *input_file
)
1446 void yyrestart( input_file
)
1450 if ( ! yy_current_buffer
)
1451 yy_current_buffer
= yy_create_buffer( yyin
, YY_BUF_SIZE
);
1453 yy_init_buffer( yy_current_buffer
, input_file
);
1454 yy_load_buffer_state();
1458 #ifdef YY_USE_PROTOS
1459 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer
)
1461 void yy_switch_to_buffer( new_buffer
)
1462 YY_BUFFER_STATE new_buffer
;
1465 if ( yy_current_buffer
== new_buffer
)
1468 if ( yy_current_buffer
)
1470 /* Flush out information for old buffer. */
1471 *yy_c_buf_p
= yy_hold_char
;
1472 yy_current_buffer
->yy_buf_pos
= yy_c_buf_p
;
1473 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1476 yy_current_buffer
= new_buffer
;
1477 yy_load_buffer_state();
1479 /* We don't actually know whether we did this switch during
1480 * EOF (yywrap()) processing, but the only time this flag
1481 * is looked at is after yywrap() is called, so it's safe
1482 * to go ahead and always set it.
1484 yy_did_buffer_switch_on_eof
= 1;
1488 #ifdef YY_USE_PROTOS
1489 void yy_load_buffer_state( void )
1491 void yy_load_buffer_state()
1494 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1495 yytext_ptr
= yy_c_buf_p
= yy_current_buffer
->yy_buf_pos
;
1496 yyin
= yy_current_buffer
->yy_input_file
;
1497 yy_hold_char
= *yy_c_buf_p
;
1501 #ifdef YY_USE_PROTOS
1502 YY_BUFFER_STATE
yy_create_buffer( FILE *file
, int size
)
1504 YY_BUFFER_STATE
yy_create_buffer( file
, size
)
1511 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1513 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1515 b
->yy_buf_size
= size
;
1517 /* yy_ch_buf has to be 2 characters longer than the size given because
1518 * we need to put in 2 end-of-buffer characters.
1520 b
->yy_ch_buf
= (char *) yy_flex_alloc( b
->yy_buf_size
+ 2 );
1521 if ( ! b
->yy_ch_buf
)
1522 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1524 b
->yy_is_our_buffer
= 1;
1526 yy_init_buffer( b
, file
);
1532 #ifdef YY_USE_PROTOS
1533 void yy_delete_buffer( YY_BUFFER_STATE b
)
1535 void yy_delete_buffer( b
)
1542 if ( b
== yy_current_buffer
)
1543 yy_current_buffer
= (YY_BUFFER_STATE
) 0;
1545 if ( b
->yy_is_our_buffer
)
1546 yy_flex_free( (void *) b
->yy_ch_buf
);
1548 yy_flex_free( (void *) b
);
1552 #ifndef YY_ALWAYS_INTERACTIVE
1553 #ifndef YY_NEVER_INTERACTIVE
1554 extern int isatty
YY_PROTO(( int ));
1558 #ifdef YY_USE_PROTOS
1559 void yy_init_buffer( YY_BUFFER_STATE b
, FILE *file
)
1561 void yy_init_buffer( b
, file
)
1568 yy_flush_buffer( b
);
1570 b
->yy_input_file
= file
;
1571 b
->yy_fill_buffer
= 1;
1573 #if YY_ALWAYS_INTERACTIVE
1574 b
->yy_is_interactive
= 1;
1576 #if YY_NEVER_INTERACTIVE
1577 b
->yy_is_interactive
= 0;
1579 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1585 #ifdef YY_USE_PROTOS
1586 void yy_flush_buffer( YY_BUFFER_STATE b
)
1588 void yy_flush_buffer( b
)
1598 /* We always need two end-of-buffer characters. The first causes
1599 * a transition to the end-of-buffer state. The second causes
1600 * a jam in that state.
1602 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1603 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1605 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1608 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1610 if ( b
== yy_current_buffer
)
1611 yy_load_buffer_state();
1615 #ifndef YY_NO_SCAN_BUFFER
1616 #ifdef YY_USE_PROTOS
1617 YY_BUFFER_STATE
yy_scan_buffer( char *base
, yy_size_t size
)
1619 YY_BUFFER_STATE
yy_scan_buffer( base
, size
)
1627 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1628 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1629 /* They forgot to leave room for the EOB's. */
1632 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1634 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1636 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1637 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1638 b
->yy_is_our_buffer
= 0;
1639 b
->yy_input_file
= 0;
1640 b
->yy_n_chars
= b
->yy_buf_size
;
1641 b
->yy_is_interactive
= 0;
1643 b
->yy_fill_buffer
= 0;
1644 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1646 yy_switch_to_buffer( b
);
1653 #ifndef YY_NO_SCAN_STRING
1654 #ifdef YY_USE_PROTOS
1655 YY_BUFFER_STATE
yy_scan_string( yyconst
char *yy_str
)
1657 YY_BUFFER_STATE
yy_scan_string( yy_str
)
1658 yyconst
char *yy_str
;
1662 for ( len
= 0; yy_str
[len
]; ++len
)
1665 return yy_scan_bytes( yy_str
, len
);
1670 #ifndef YY_NO_SCAN_BYTES
1671 #ifdef YY_USE_PROTOS
1672 YY_BUFFER_STATE
yy_scan_bytes( yyconst
char *bytes
, int len
)
1674 YY_BUFFER_STATE
yy_scan_bytes( bytes
, len
)
1675 yyconst
char *bytes
;
1684 /* Get memory for full buffer, including space for trailing EOB's. */
1686 buf
= (char *) yy_flex_alloc( n
);
1688 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1690 for ( i
= 0; i
< len
; ++i
)
1693 buf
[len
] = buf
[len
+1] = YY_END_OF_BUFFER_CHAR
;
1695 b
= yy_scan_buffer( buf
, n
);
1697 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1699 /* It's okay to grow etc. this buffer, and we should throw it
1700 * away when we're done.
1702 b
->yy_is_our_buffer
= 1;
1709 #ifndef YY_NO_PUSH_STATE
1710 #ifdef YY_USE_PROTOS
1711 static void yy_push_state( int new_state
)
1713 static void yy_push_state( new_state
)
1717 if ( yy_start_stack_ptr
>= yy_start_stack_depth
)
1721 yy_start_stack_depth
+= YY_START_STACK_INCR
;
1722 new_size
= yy_start_stack_depth
* sizeof( int );
1724 if ( ! yy_start_stack
)
1725 yy_start_stack
= (int *) yy_flex_alloc( new_size
);
1728 yy_start_stack
= (int *) yy_flex_realloc(
1729 (void *) yy_start_stack
, new_size
);
1731 if ( ! yy_start_stack
)
1733 "out of memory expanding start-condition stack" );
1736 yy_start_stack
[yy_start_stack_ptr
++] = YY_START
;
1743 #ifndef YY_NO_POP_STATE
1744 static void yy_pop_state()
1746 if ( --yy_start_stack_ptr
< 0 )
1747 YY_FATAL_ERROR( "start-condition stack underflow" );
1749 BEGIN(yy_start_stack
[yy_start_stack_ptr
]);
1754 #ifndef YY_NO_TOP_STATE
1755 static int yy_top_state()
1757 return yy_start_stack
[yy_start_stack_ptr
- 1];
1761 #ifndef YY_EXIT_FAILURE
1762 #define YY_EXIT_FAILURE 2
1765 #ifdef YY_USE_PROTOS
1766 static void yy_fatal_error( yyconst
char msg
[] )
1768 static void yy_fatal_error( msg
)
1772 (void) fprintf( stderr
, "%s\n", msg
);
1773 exit( YY_EXIT_FAILURE
);
1778 /* Redefine yyless() so it works in section 3 code. */
1784 /* Undo effects of setting up yytext. */ \
1785 yytext[yyleng] = yy_hold_char; \
1786 yy_c_buf_p = yytext + n; \
1787 yy_hold_char = *yy_c_buf_p; \
1788 *yy_c_buf_p = '\0'; \
1794 /* Internal utility routines. */
1797 #ifdef YY_USE_PROTOS
1798 static void yy_flex_strncpy( char *s1
, yyconst
char *s2
, int n
)
1800 static void yy_flex_strncpy( s1
, s2
, n
)
1807 for ( i
= 0; i
< n
; ++i
)
1812 #ifdef YY_NEED_STRLEN
1813 #ifdef YY_USE_PROTOS
1814 static int yy_flex_strlen( yyconst
char *s
)
1816 static int yy_flex_strlen( s
)
1821 for ( n
= 0; s
[n
]; ++n
)
1829 #ifdef YY_USE_PROTOS
1830 static void *yy_flex_alloc( yy_size_t size
)
1832 static void *yy_flex_alloc( size
)
1836 return (void *) malloc( size
);
1839 #ifdef YY_USE_PROTOS
1840 static void *yy_flex_realloc( void *ptr
, yy_size_t size
)
1842 static void *yy_flex_realloc( ptr
, size
)
1847 /* The cast to (char *) in the following accommodates both
1848 * implementations that use char* generic pointers, and those
1849 * that use void* generic pointers. It works with the latter
1850 * because both ANSI C and C++ allow castless assignment from
1851 * any pointer type to void*, and deal with argument conversions
1852 * as though doing an assignment.
1854 return (void *) realloc( (char *) ptr
, size
);
1857 #ifdef YY_USE_PROTOS
1858 static void yy_flex_free( void *ptr
)
1860 static void yy_flex_free( ptr
)
1874 #line 172 "parser.l"
1878 int parser_wrap(void)
1889 static const struct keyword keywords
[] = {
1892 {"__cdecl", tCDECL
},
1893 {"__int64", tINT64
},
1894 {"__stdcall", tSTDCALL
},
1895 {"_stdcall", tSTDCALL
},
1896 {"boolean", tBOOLEAN
},
1898 {"callback", tCALLBACK
},
1901 {"coclass", tCOCLASS
},
1903 {"comm_status", tCOMMSTATUS
},
1905 {"cpp_quote", tCPPQUOTE
},
1906 {"default", tDEFAULT
},
1907 {"dispinterface", tDISPINTERFACE
},
1908 {"double", tDOUBLE
},
1910 {"error_status_t", tERRORSTATUST
},
1911 {"extern", tEXTERN
},
1913 {"handle_t", tHANDLET
},
1915 {"import", tIMPORT
},
1916 {"importlib", tIMPORTLIB
},
1917 {"in_line", tINLINE
},
1919 {"interface", tINTERFACE
},
1920 {"library", tLIBRARY
},
1922 {"methods", tMETHODS
},
1923 {"module", tMODULE
},
1924 {"properties", tPROPERTIES
},
1926 {"signed", tSIGNED
},
1927 {"sizeof", tSIZEOF
},
1929 {"struct", tSTRUCT
},
1930 {"switch", tSWITCH
},
1931 {"typedef", tTYPEDEF
},
1933 {"unsigned", tUNSIGNED
},
1935 {"wchar_t", tWCHAR
},
1937 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
1939 /* keywords only recognized in attribute lists */
1940 static const struct keyword attr_keywords
[] =
1942 {"aggregatable", tAGGREGATABLE
},
1943 {"allocate", tALLOCATE
},
1944 {"appobject", tAPPOBJECT
},
1946 {"async_uuid", tASYNCUUID
},
1947 {"auto_handle", tAUTOHANDLE
},
1948 {"bindable", tBINDABLE
},
1949 {"broadcast", tBROADCAST
},
1950 {"byte_count", tBYTECOUNT
},
1951 {"call_as", tCALLAS
},
1952 {"context_handle", tCONTEXTHANDLE
},
1953 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE
},
1954 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE
},
1955 {"control", tCONTROL
},
1956 {"defaultcollelem", tDEFAULTCOLLELEM
},
1957 {"defaultvalue", tDEFAULTVALUE
},
1958 {"defaultvtable", tDEFAULTVTABLE
},
1959 {"displaybind", tDISPLAYBIND
},
1960 {"dllname", tDLLNAME
},
1962 {"endpoint", tENDPOINT
},
1964 {"explicit_handle", tEXPLICITHANDLE
},
1965 {"handle", tHANDLE
},
1966 {"helpcontext", tHELPCONTEXT
},
1967 {"helpfile", tHELPFILE
},
1968 {"helpstring", tHELPSTRING
},
1969 {"helpstringcontext", tHELPSTRINGCONTEXT
},
1970 {"helpstringdll", tHELPSTRINGDLL
},
1971 {"hidden", tHIDDEN
},
1973 {"idempotent", tIDEMPOTENT
},
1975 {"immediatebind", tIMMEDIATEBIND
},
1976 {"implicit_handle", tIMPLICITHANDLE
},
1978 {"input_sync", tINPUTSYNC
},
1980 {"length_is", tLENGTHIS
},
1982 {"nonbrowsable", tNONBROWSABLE
},
1983 {"noncreatable", tNONCREATABLE
},
1984 {"nonextensible", tNONEXTENSIBLE
},
1985 {"object", tOBJECT
},
1987 {"oleautomation", tOLEAUTOMATION
},
1988 {"optional", tOPTIONAL
},
1990 {"pointer_default", tPOINTERDEFAULT
},
1991 {"propget", tPROPGET
},
1992 {"propput", tPROPPUT
},
1993 {"propputref", tPROPPUTREF
},
1995 {"public", tPUBLIC
},
1997 {"readonly", tREADONLY
},
1999 {"requestedit", tREQUESTEDIT
},
2000 {"restricted", tRESTRICTED
},
2001 {"retval", tRETVAL
},
2002 {"single", tSINGLE
},
2003 {"size_is", tSIZEIS
},
2004 {"source", tSOURCE
},
2005 {"strict_context_handle", tSTRICTCONTEXTHANDLE
},
2006 {"string", tSTRING
},
2007 {"switch_is", tSWITCHIS
},
2008 {"switch_type", tSWITCHTYPE
},
2009 {"transmit_as", tTRANSMITAS
},
2010 {"unique", tUNIQUE
},
2012 {"v1_enum", tV1ENUM
},
2013 {"vararg", tVARARG
},
2014 {"version", tVERSION
},
2015 {"wire_marshal", tWIREMARSHAL
},
2019 #define KWP(p) ((const struct keyword *)(p))
2021 static int kw_cmp_func(const void *s1
, const void *s2
)
2023 return strcmp(KWP(s1
)->kw
, KWP(s2
)->kw
);
2026 static int kw_token(const char *kw
)
2028 struct keyword key
, *kwp
;
2030 kwp
= bsearch(&key
, keywords
, NKEYWORDS
, sizeof(keywords
[0]), kw_cmp_func
);
2032 parser_lval
.str
= xstrdup(kwp
->kw
);
2035 parser_lval
.str
= xstrdup(kw
);
2036 return is_type(kw
) ? aKNOWNTYPE
: aIDENTIFIER
;
2039 static int attr_token(const char *kw
)
2041 struct keyword key
, *kwp
;
2043 kwp
= bsearch(&key
, attr_keywords
, sizeof(attr_keywords
)/sizeof(attr_keywords
[0]),
2044 sizeof(attr_keywords
[0]), kw_cmp_func
);
2046 parser_lval
.str
= xstrdup(kwp
->kw
);
2049 return kw_token(kw
);
2052 static void addcchar(char c
)
2054 if(cbufidx
>= cbufalloc
)
2057 cbuffer
= xrealloc(cbuffer
, cbufalloc
* sizeof(cbuffer
[0]));
2058 if(cbufalloc
> 65536)
2059 parser_warning("Reallocating string buffer larger than 64kB\n");
2061 cbuffer
[cbufidx
++] = c
;
2064 static char *get_buffered_cstring(void)
2067 return xstrdup(cbuffer
);
2070 static void pop_import(void)
2072 int ptr
= import_stack_ptr
-1;
2075 yy_delete_buffer( YY_CURRENT_BUFFER
);
2076 yy_switch_to_buffer( import_stack
[ptr
].state
);
2081 temp_name
= import_stack
[ptr
].temp_name
;
2083 input_name
= import_stack
[ptr
].input_name
;
2084 line_number
= import_stack
[ptr
].line_number
;
2090 struct imports
*next
;
2093 int do_import(char *fname
)
2096 char *hname
, *path
, *p
;
2097 struct imports
*import
;
2098 int ptr
= import_stack_ptr
;
2101 if (!parse_only
&& do_header
) {
2102 hname
= dup_basename(fname
, ".idl");
2103 p
= hname
+ strlen(hname
) - 2;
2104 if (p
<= hname
|| strcmp( p
, ".h" )) strcat(hname
, ".h");
2106 fprintf(header
, "#include <%s>\n", hname
);
2110 import
= first_import
;
2111 while (import
&& strcmp(import
->name
, fname
))
2112 import
= import
->next
;
2113 if (import
) return 0; /* already imported */
2115 import
= xmalloc(sizeof(struct imports
));
2116 import
->name
= xstrdup(fname
);
2117 import
->next
= first_import
;
2118 first_import
= import
;
2120 /* don't search for a file name with a path in the include directories,
2121 * for compatibility with MIDL */
2122 if (strchr( fname
, '/' ) || strchr( fname
, '\\' ))
2123 path
= strdup( fname
);
2124 else if (!(path
= wpp_find_include( fname
, input_name
)))
2125 error_loc("Unable to open include file %s\n", fname
);
2127 import_stack
[ptr
].temp_name
= temp_name
;
2128 import_stack
[ptr
].input_name
= input_name
;
2129 import_stack
[ptr
].line_number
= line_number
;
2134 ret
= wpp_parse_temp( path
, NULL
, &temp_name
);
2137 if((f
= fopen(temp_name
, "r")) == NULL
)
2138 error_loc("Unable to open %s\n", temp_name
);
2140 import_stack
[ptr
].state
= YY_CURRENT_BUFFER
;
2141 yy_switch_to_buffer(yy_create_buffer(f
, YY_BUF_SIZE
));
2145 void abort_import(void)
2149 for (ptr
=0; ptr
<import_stack_ptr
; ptr
++)
2150 unlink(import_stack
[ptr
].temp_name
);