[MKHIVE] Remove key name in our custom registry tree; use cell index instead
[reactos.git] / reactos / tools / widl / parser.yy.c
1 #line 2 "parser.yy.c"
2
3 #line 4 "parser.yy.c"
4
5 #define YY_INT_ALIGNED short int
6
7 /* A lexical scanner generated by flex */
8
9 #define yy_create_buffer parser__create_buffer
10 #define yy_delete_buffer parser__delete_buffer
11 #define yy_flex_debug parser__flex_debug
12 #define yy_init_buffer parser__init_buffer
13 #define yy_flush_buffer parser__flush_buffer
14 #define yy_load_buffer_state parser__load_buffer_state
15 #define yy_switch_to_buffer parser__switch_to_buffer
16 #define yyin parser_in
17 #define yyleng parser_leng
18 #define yylex parser_lex
19 #define yylineno parser_lineno
20 #define yyout parser_out
21 #define yyrestart parser_restart
22 #define yytext parser_text
23 #define yywrap parser_wrap
24 #define yyalloc parser_alloc
25 #define yyrealloc parser_realloc
26 #define yyfree parser_free
27
28 #define FLEX_SCANNER
29 #define YY_FLEX_MAJOR_VERSION 2
30 #define YY_FLEX_MINOR_VERSION 5
31 #define YY_FLEX_SUBMINOR_VERSION 35
32 #if YY_FLEX_SUBMINOR_VERSION > 0
33 #define FLEX_BETA
34 #endif
35
36 /* First, we deal with platform-specific or compiler-specific issues. */
37
38 /* begin standard C headers. */
39 #include <stdio.h>
40 #include <string.h>
41 #include <errno.h>
42 #include <stdlib.h>
43
44 /* end standard C headers. */
45
46 /* flex integer type definitions */
47
48 #ifndef FLEXINT_H
49 #define FLEXINT_H
50
51 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52
53 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54
55 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56 * if you want the limit (max/min) macros for int types.
57 */
58 #ifndef __STDC_LIMIT_MACROS
59 #define __STDC_LIMIT_MACROS 1
60 #endif
61
62 #include <inttypes.h>
63 typedef int8_t flex_int8_t;
64 typedef uint8_t flex_uint8_t;
65 typedef int16_t flex_int16_t;
66 typedef uint16_t flex_uint16_t;
67 typedef int32_t flex_int32_t;
68 typedef uint32_t flex_uint32_t;
69 #else
70 typedef signed char flex_int8_t;
71 typedef short int flex_int16_t;
72 typedef int flex_int32_t;
73 typedef unsigned char flex_uint8_t;
74 typedef unsigned short int flex_uint16_t;
75 typedef unsigned int flex_uint32_t;
76
77 /* Limits of integral types. */
78 #ifndef INT8_MIN
79 #define INT8_MIN (-128)
80 #endif
81 #ifndef INT16_MIN
82 #define INT16_MIN (-32767-1)
83 #endif
84 #ifndef INT32_MIN
85 #define INT32_MIN (-2147483647-1)
86 #endif
87 #ifndef INT8_MAX
88 #define INT8_MAX (127)
89 #endif
90 #ifndef INT16_MAX
91 #define INT16_MAX (32767)
92 #endif
93 #ifndef INT32_MAX
94 #define INT32_MAX (2147483647)
95 #endif
96 #ifndef UINT8_MAX
97 #define UINT8_MAX (255U)
98 #endif
99 #ifndef UINT16_MAX
100 #define UINT16_MAX (65535U)
101 #endif
102 #ifndef UINT32_MAX
103 #define UINT32_MAX (4294967295U)
104 #endif
105
106 #endif /* ! C99 */
107
108 #endif /* ! FLEXINT_H */
109
110 #ifdef __cplusplus
111
112 /* The "const" storage-class-modifier is valid. */
113 #define YY_USE_CONST
114
115 #else /* ! __cplusplus */
116
117 /* C99 requires __STDC__ to be defined as 1. */
118 #if defined (__STDC__)
119
120 #define YY_USE_CONST
121
122 #endif /* defined (__STDC__) */
123 #endif /* ! __cplusplus */
124
125 #ifdef YY_USE_CONST
126 #define yyconst const
127 #else
128 #define yyconst
129 #endif
130
131 /* Returned upon end-of-file. */
132 #define YY_NULL 0
133
134 /* Promotes a possibly negative, possibly signed char to an unsigned
135 * integer for use as an array index. If the signed char is negative,
136 * we want to instead treat it as an 8-bit unsigned char, hence the
137 * double cast.
138 */
139 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
140
141 /* Enter a start condition. This macro really ought to take a parameter,
142 * but we do it the disgusting crufty way forced on us by the ()-less
143 * definition of BEGIN.
144 */
145 #define BEGIN (yy_start) = 1 + 2 *
146
147 /* Translate the current start state into a value that can be later handed
148 * to BEGIN to return to the state. The YYSTATE alias is for lex
149 * compatibility.
150 */
151 #define YY_START (((yy_start) - 1) / 2)
152 #define YYSTATE YY_START
153
154 /* Action number for EOF rule of a given start state. */
155 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
156
157 /* Special action meaning "start processing a new file". */
158 #define YY_NEW_FILE parser_restart(parser_in )
159
160 #define YY_END_OF_BUFFER_CHAR 0
161
162 /* Size of default input buffer. */
163 #ifndef YY_BUF_SIZE
164 #ifdef __ia64__
165 /* On IA-64, the buffer size is 16k, not 8k.
166 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
167 * Ditto for the __ia64__ case accordingly.
168 */
169 #define YY_BUF_SIZE 32768
170 #else
171 #define YY_BUF_SIZE 16384
172 #endif /* __ia64__ */
173 #endif
174
175 /* The state buf must be large enough to hold one state per character in the main buffer.
176 */
177 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
178
179 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
180 #define YY_TYPEDEF_YY_BUFFER_STATE
181 typedef struct yy_buffer_state *YY_BUFFER_STATE;
182 #endif
183
184 extern int parser_leng;
185
186 extern FILE *parser_in, *parser_out;
187
188 #define EOB_ACT_CONTINUE_SCAN 0
189 #define EOB_ACT_END_OF_FILE 1
190 #define EOB_ACT_LAST_MATCH 2
191
192 #define YY_LESS_LINENO(n)
193
194 /* Return all but the first "n" matched characters back to the input stream. */
195 #define yyless(n) \
196 do \
197 { \
198 /* Undo effects of setting up parser_text. */ \
199 int yyless_macro_arg = (n); \
200 YY_LESS_LINENO(yyless_macro_arg);\
201 *yy_cp = (yy_hold_char); \
202 YY_RESTORE_YY_MORE_OFFSET \
203 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
204 YY_DO_BEFORE_ACTION; /* set up parser_text again */ \
205 } \
206 while ( 0 )
207
208 #define unput(c) yyunput( c, (yytext_ptr) )
209
210 #ifndef YY_TYPEDEF_YY_SIZE_T
211 #define YY_TYPEDEF_YY_SIZE_T
212 typedef size_t yy_size_t;
213 #endif
214
215 #ifndef YY_STRUCT_YY_BUFFER_STATE
216 #define YY_STRUCT_YY_BUFFER_STATE
217 struct yy_buffer_state
218 {
219 FILE *yy_input_file;
220
221 char *yy_ch_buf; /* input buffer */
222 char *yy_buf_pos; /* current position in input buffer */
223
224 /* Size of input buffer in bytes, not including room for EOB
225 * characters.
226 */
227 yy_size_t yy_buf_size;
228
229 /* Number of characters read into yy_ch_buf, not including EOB
230 * characters.
231 */
232 int yy_n_chars;
233
234 /* Whether we "own" the buffer - i.e., we know we created it,
235 * and can realloc() it to grow it, and should free() it to
236 * delete it.
237 */
238 int yy_is_our_buffer;
239
240 /* Whether this is an "interactive" input source; if so, and
241 * if we're using stdio for input, then we want to use getc()
242 * instead of fread(), to make sure we stop fetching input after
243 * each newline.
244 */
245 int yy_is_interactive;
246
247 /* Whether we're considered to be at the beginning of a line.
248 * If so, '^' rules will be active on the next match, otherwise
249 * not.
250 */
251 int yy_at_bol;
252
253 int yy_bs_lineno; /**< The line count. */
254 int yy_bs_column; /**< The column count. */
255
256 /* Whether to try to fill the input buffer when we reach the
257 * end of it.
258 */
259 int yy_fill_buffer;
260
261 int yy_buffer_status;
262
263 #define YY_BUFFER_NEW 0
264 #define YY_BUFFER_NORMAL 1
265 /* When an EOF's been seen but there's still some text to process
266 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
267 * shouldn't try reading from the input source any more. We might
268 * still have a bunch of tokens to match, though, because of
269 * possible backing-up.
270 *
271 * When we actually see the EOF, we change the status to "new"
272 * (via parser_restart()), so that the user can continue scanning by
273 * just pointing parser_in at a new input file.
274 */
275 #define YY_BUFFER_EOF_PENDING 2
276
277 };
278 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
279
280 /* Stack of input buffers. */
281 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
282 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
283 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
284
285 /* We provide macros for accessing buffer states in case in the
286 * future we want to put the buffer states in a more general
287 * "scanner state".
288 *
289 * Returns the top of the stack, or NULL.
290 */
291 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
292 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
293 : NULL)
294
295 /* Same as previous macro, but useful when we know that the buffer stack is not
296 * NULL or when we need an lvalue. For internal use only.
297 */
298 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
299
300 /* yy_hold_char holds the character lost when parser_text is formed. */
301 static char yy_hold_char;
302 static int yy_n_chars; /* number of characters read into yy_ch_buf */
303 int parser_leng;
304
305 /* Points to current character in buffer. */
306 static char *yy_c_buf_p = (char *) 0;
307 static int yy_init = 0; /* whether we need to initialize */
308 static int yy_start = 0; /* start state number */
309
310 /* Flag which is used to allow parser_wrap()'s to do buffer switches
311 * instead of setting up a fresh parser_in. A bit of a hack ...
312 */
313 static int yy_did_buffer_switch_on_eof;
314
315 void parser_restart (FILE *input_file );
316 void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer );
317 YY_BUFFER_STATE parser__create_buffer (FILE *file,int size );
318 void parser__delete_buffer (YY_BUFFER_STATE b );
319 void parser__flush_buffer (YY_BUFFER_STATE b );
320 void parser_push_buffer_state (YY_BUFFER_STATE new_buffer );
321 void parser_pop_buffer_state (void );
322
323 static void parser_ensure_buffer_stack (void );
324 static void parser__load_buffer_state (void );
325 static void parser__init_buffer (YY_BUFFER_STATE b,FILE *file );
326
327 #define YY_FLUSH_BUFFER parser__flush_buffer(YY_CURRENT_BUFFER )
328
329 YY_BUFFER_STATE parser__scan_buffer (char *base,yy_size_t size );
330 YY_BUFFER_STATE parser__scan_string (yyconst char *yy_str );
331 YY_BUFFER_STATE parser__scan_bytes (yyconst char *bytes,int len );
332
333 void *parser_alloc (yy_size_t );
334 void *parser_realloc (void *,yy_size_t );
335 void parser_free (void * );
336
337 #define yy_new_buffer parser__create_buffer
338
339 #define yy_set_interactive(is_interactive) \
340 { \
341 if ( ! YY_CURRENT_BUFFER ){ \
342 parser_ensure_buffer_stack (); \
343 YY_CURRENT_BUFFER_LVALUE = \
344 parser__create_buffer(parser_in,YY_BUF_SIZE ); \
345 } \
346 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
347 }
348
349 #define yy_set_bol(at_bol) \
350 { \
351 if ( ! YY_CURRENT_BUFFER ){\
352 parser_ensure_buffer_stack (); \
353 YY_CURRENT_BUFFER_LVALUE = \
354 parser__create_buffer(parser_in,YY_BUF_SIZE ); \
355 } \
356 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
357 }
358
359 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
360
361 /* Begin user sect3 */
362
363 typedef unsigned char YY_CHAR;
364
365 FILE *parser_in = (FILE *) 0, *parser_out = (FILE *) 0;
366
367 typedef int yy_state_type;
368
369 extern int parser_lineno;
370
371 int parser_lineno = 1;
372
373 extern char *parser_text;
374 #define yytext_ptr parser_text
375
376 static yy_state_type yy_get_previous_state (void );
377 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
378 static int yy_get_next_buffer (void );
379 static void yy_fatal_error (yyconst char msg[] );
380
381 /* Done after the current pattern has been matched and before the
382 * corresponding action - sets up parser_text.
383 */
384 #define YY_DO_BEFORE_ACTION \
385 (yytext_ptr) = yy_bp; \
386 parser_leng = (size_t) (yy_cp - yy_bp); \
387 (yy_hold_char) = *yy_cp; \
388 *yy_cp = '\0'; \
389 (yy_c_buf_p) = yy_cp;
390
391 #define YY_NUM_RULES 39
392 #define YY_END_OF_BUFFER 40
393 /* This struct is not used in this scanner,
394 but its presence is necessary. */
395 struct yy_trans_info
396 {
397 flex_int32_t yy_verify;
398 flex_int32_t yy_nxt;
399 };
400 static yyconst flex_int16_t yy_accept[174] =
401 { 0,
402 0, 0, 0, 0, 0, 0, 0, 0, 3, 3,
403 5, 5, 0, 0, 40, 38, 27, 26, 38, 6,
404 38, 10, 38, 38, 22, 22, 38, 38, 38, 25,
405 25, 25, 17, 38, 27, 2, 16, 39, 7, 16,
406 9, 22, 22, 19, 19, 19, 18, 27, 2, 3,
407 5, 5, 11, 16, 32, 36, 30, 0, 0, 22,
408 22, 22, 0, 28, 34, 31, 33, 29, 25, 8,
409 25, 35, 0, 2, 2, 0, 15, 13, 12, 22,
410 0, 19, 19, 0, 2, 2, 3, 5, 5, 14,
411 37, 23, 22, 22, 21, 25, 0, 22, 0, 19,
412
413 5, 0, 21, 21, 25, 0, 22, 0, 19, 5,
414 0, 23, 21, 21, 25, 0, 22, 0, 19, 5,
415 25, 0, 22, 0, 19, 5, 25, 0, 22, 0,
416 19, 5, 25, 1, 22, 0, 19, 5, 25, 0,
417 22, 4, 0, 24, 0, 4, 0, 0, 0, 0,
418 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
419 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
420 0, 20, 0
421 } ;
422
423 static yyconst flex_int32_t yy_ec[256] =
424 { 0,
425 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
426 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
429 1, 1, 10, 1, 11, 12, 1, 13, 14, 14,
430 14, 14, 14, 14, 14, 14, 14, 1, 1, 15,
431 16, 17, 1, 1, 18, 19, 19, 19, 20, 21,
432 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
433 22, 24, 25, 22, 26, 22, 22, 27, 28, 22,
434 29, 30, 31, 1, 32, 1, 33, 19, 34, 35,
435
436 36, 19, 37, 38, 39, 22, 22, 40, 41, 22,
437 42, 43, 22, 44, 22, 22, 45, 22, 22, 46,
438 22, 22, 1, 47, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
440 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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, 1, 1, 1, 1,
444 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446
447 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
450 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452 1, 1, 1, 1, 1
453 } ;
454
455 static yyconst flex_int32_t yy_meta[48] =
456 { 0,
457 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
458 1, 1, 3, 3, 1, 1, 1, 3, 3, 3,
459 3, 4, 4, 4, 4, 4, 4, 4, 1, 1,
460 1, 4, 3, 3, 3, 3, 4, 4, 4, 4,
461 4, 4, 4, 4, 4, 4, 1
462 } ;
463
464 static yyconst flex_int16_t yy_base[214] =
465 { 0,
466 0, 46, 46, 50, 51, 54, 84, 56, 345, 344,
467 129, 130, 131, 132, 346, 639, 639, 639, 325, 639,
468 333, 639, 322, 326, 160, 124, 45, 321, 47, 0,
469 331, 316, 639, 286, 63, 139, 639, 639, 639, 45,
470 639, 194, 117, 228, 0, 326, 639, 64, 324, 0,
471 0, 286, 639, 135, 639, 639, 639, 312, 54, 154,
472 130, 119, 0, 639, 639, 639, 639, 639, 0, 639,
473 296, 639, 71, 146, 147, 272, 639, 639, 639, 252,
474 0, 285, 0, 72, 313, 312, 0, 0, 278, 639,
475 639, 140, 639, 639, 158, 291, 277, 309, 0, 342,
476
477 269, 182, 152, 162, 290, 265, 366, 0, 399, 269,
478 58, 196, 639, 639, 276, 255, 423, 0, 456, 259,
479 270, 258, 480, 0, 513, 255, 266, 281, 537, 0,
480 570, 244, 251, 275, 212, 265, 263, 227, 143, 0,
481 267, 0, 149, 639, 0, 0, 0, 0, 257, 0,
482 0, 0, 0, 256, 0, 0, 0, 0, 249, 0,
483 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
484 0, 639, 639, 606, 610, 614, 616, 620, 622, 626,
485 630, 256, 255, 253, 252, 251, 250, 248, 247, 634,
486 242, 241, 240, 234, 233, 230, 228, 221, 219, 216,
487
488 215, 208, 201, 198, 188, 185, 176, 154, 152, 143,
489 80, 79, 76
490 } ;
491
492 static yyconst flex_int16_t yy_def[214] =
493 { 0,
494 173, 1, 174, 174, 174, 174, 173, 7, 175, 175,
495 176, 176, 174, 174, 173, 173, 173, 173, 173, 173,
496 173, 173, 173, 173, 173, 173, 173, 173, 173, 177,
497 177, 177, 173, 173, 173, 173, 173, 173, 173, 178,
498 173, 173, 42, 179, 179, 179, 173, 173, 173, 180,
499 181, 181, 173, 178, 173, 173, 173, 173, 173, 173,
500 173, 173, 182, 173, 173, 173, 173, 173, 177, 173,
501 177, 173, 173, 173, 173, 173, 173, 173, 173, 173,
502 183, 179, 179, 173, 173, 173, 180, 181, 181, 173,
503 173, 173, 173, 173, 182, 177, 173, 173, 184, 179,
504
505 181, 173, 173, 173, 177, 173, 173, 185, 179, 181,
506 173, 173, 173, 173, 177, 173, 173, 186, 179, 181,
507 177, 173, 173, 187, 179, 181, 177, 173, 173, 188,
508 179, 181, 177, 173, 173, 173, 179, 181, 177, 189,
509 173, 190, 173, 173, 191, 190, 192, 193, 173, 194,
510 195, 196, 197, 173, 198, 199, 200, 201, 173, 202,
511 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
512 213, 173, 0, 173, 173, 173, 173, 173, 173, 173,
513 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
514 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
515
516 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
517 173, 173, 173
518 } ;
519
520 static yyconst flex_int16_t yy_nxt[687] =
521 { 0,
522 16, 17, 18, 19, 20, 16, 21, 22, 16, 16,
523 23, 24, 25, 26, 27, 28, 29, 30, 30, 30,
524 30, 30, 31, 30, 32, 30, 30, 30, 33, 16,
525 16, 30, 30, 30, 30, 30, 30, 30, 30, 30,
526 30, 30, 30, 30, 30, 30, 34, 35, 38, 78,
527 39, 36, 38, 38, 39, 41, 38, 48, 41, 64,
528 65, 49, 67, 68, 73, 84, 92, 92, 74, 85,
529 112, 112, 73, 84, 79, 40, 74, 85, 172, 40,
530 40, 171, 170, 40, 16, 17, 18, 19, 20, 16,
531 21, 22, 16, 16, 23, 24, 42, 43, 27, 28,
532
533 29, 44, 44, 44, 44, 45, 46, 45, 45, 45,
534 45, 45, 33, 16, 47, 45, 44, 44, 44, 44,
535 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
536 34, 38, 38, 38, 38, 59, 60, 60, 53, 53,
537 75, 94, 90, 173, 143, 169, 61, 75, 75, 62,
538 143, 144, 92, 92, 168, 93, 167, 144, 94, 102,
539 54, 54, 173, 61, 79, 59, 60, 60, 62, 52,
540 52, 59, 60, 60, 93, 102, 61, 113, 166, 62,
541 103, 76, 61, 104, 114, 62, 63, 165, 76, 76,
542 164, 111, 111, 61, 112, 112, 113, 103, 62, 61,
543
544 163, 114, 104, 162, 62, 63, 80, 80, 112, 112,
545 161, 81, 81, 81, 81, 102, 61, 159, 158, 62,
546 63, 157, 140, 156, 141, 141, 81, 81, 81, 81,
547 154, 102, 153, 61, 61, 152, 151, 62, 62, 63,
548 82, 82, 149, 148, 147, 82, 82, 82, 82, 145,
549 136, 61, 130, 124, 118, 108, 62, 99, 95, 160,
550 82, 82, 82, 82, 98, 98, 155, 150, 142, 99,
551 99, 99, 99, 140, 61, 140, 134, 62, 139, 141,
552 141, 138, 134, 133, 99, 99, 99, 99, 132, 61,
553 128, 61, 62, 127, 126, 122, 62, 100, 100, 121,
554
555 120, 116, 100, 100, 100, 100, 61, 115, 110, 106,
556 105, 62, 101, 86, 86, 97, 96, 100, 100, 100,
557 100, 107, 107, 91, 89, 86, 108, 108, 108, 108,
558 70, 61, 72, 71, 62, 70, 66, 58, 57, 56,
559 55, 108, 108, 108, 108, 173, 38, 38, 61, 173,
560 173, 173, 173, 62, 109, 109, 173, 173, 173, 109,
561 109, 109, 109, 173, 173, 173, 173, 173, 173, 173,
562 173, 173, 173, 173, 109, 109, 109, 109, 117, 117,
563 173, 173, 173, 118, 118, 118, 118, 173, 61, 173,
564 173, 62, 173, 173, 173, 173, 173, 173, 118, 118,
565
566 118, 118, 173, 173, 173, 61, 173, 173, 173, 173,
567 62, 119, 119, 173, 173, 173, 119, 119, 119, 119,
568 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
569 173, 119, 119, 119, 119, 123, 123, 173, 173, 173,
570 124, 124, 124, 124, 173, 61, 173, 173, 62, 173,
571 173, 173, 173, 173, 173, 124, 124, 124, 124, 173,
572 173, 173, 61, 173, 173, 173, 173, 62, 125, 125,
573 173, 173, 173, 125, 125, 125, 125, 173, 173, 173,
574 173, 173, 173, 173, 173, 173, 173, 173, 125, 125,
575 125, 125, 129, 129, 173, 173, 173, 130, 130, 130,
576
577 130, 173, 61, 173, 173, 62, 173, 173, 173, 173,
578 173, 173, 130, 130, 130, 130, 173, 173, 173, 61,
579 173, 173, 173, 173, 62, 131, 131, 173, 173, 173,
580 131, 131, 131, 131, 173, 173, 173, 173, 173, 173,
581 173, 173, 173, 173, 173, 131, 131, 131, 131, 135,
582 135, 173, 173, 173, 136, 136, 136, 136, 173, 61,
583 173, 173, 62, 173, 173, 173, 173, 173, 173, 136,
584 136, 136, 136, 173, 173, 173, 61, 173, 173, 173,
585 173, 62, 137, 137, 173, 173, 173, 137, 137, 137,
586 137, 173, 173, 173, 173, 173, 173, 173, 173, 173,
587
588 173, 173, 137, 137, 137, 137, 37, 37, 37, 37,
589 50, 50, 50, 50, 51, 51, 51, 51, 69, 69,
590 77, 173, 77, 77, 83, 83, 87, 173, 87, 87,
591 88, 173, 88, 88, 146, 173, 146, 146, 15, 173,
592 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
593 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
594 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
595 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
596 173, 173, 173, 173, 173, 173
597 } ;
598
599 static yyconst flex_int16_t yy_chk[687] =
600 { 0,
601 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
602 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
603 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
604 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
605 1, 1, 1, 1, 1, 1, 1, 2, 3, 40,
606 3, 2, 4, 5, 4, 5, 6, 8, 6, 27,
607 27, 8, 29, 29, 35, 48, 59, 59, 35, 48,
608 111, 111, 73, 84, 40, 3, 73, 84, 213, 4,
609 5, 212, 211, 6, 7, 7, 7, 7, 7, 7,
610 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
611
612 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
613 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
614 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
615 7, 11, 12, 13, 14, 26, 26, 26, 13, 14,
616 36, 62, 54, 43, 139, 210, 26, 74, 75, 26,
617 143, 139, 92, 92, 209, 61, 208, 143, 62, 92,
618 13, 14, 43, 26, 54, 60, 60, 60, 26, 11,
619 12, 25, 25, 25, 61, 92, 60, 103, 207, 60,
620 95, 36, 25, 95, 104, 25, 25, 206, 74, 75,
621 205, 102, 102, 60, 102, 102, 103, 95, 60, 25,
622
623 204, 104, 95, 203, 25, 25, 42, 42, 112, 112,
624 202, 42, 42, 42, 42, 112, 42, 201, 200, 42,
625 42, 199, 135, 198, 135, 135, 42, 42, 42, 42,
626 197, 112, 196, 42, 135, 195, 194, 135, 42, 42,
627 44, 44, 193, 192, 191, 44, 44, 44, 44, 189,
628 188, 135, 187, 186, 185, 184, 135, 183, 182, 159,
629 44, 44, 44, 44, 80, 80, 154, 149, 138, 80,
630 80, 80, 80, 137, 80, 136, 134, 80, 133, 141,
631 141, 132, 128, 127, 80, 80, 80, 80, 126, 141,
632 122, 80, 141, 121, 120, 116, 80, 82, 82, 115,
633
634 110, 106, 82, 82, 82, 82, 141, 105, 101, 97,
635 96, 141, 89, 86, 85, 76, 71, 82, 82, 82,
636 82, 98, 98, 58, 52, 49, 98, 98, 98, 98,
637 46, 98, 34, 32, 98, 31, 28, 24, 23, 21,
638 19, 98, 98, 98, 98, 15, 10, 9, 98, 0,
639 0, 0, 0, 98, 100, 100, 0, 0, 0, 100,
640 100, 100, 100, 0, 0, 0, 0, 0, 0, 0,
641 0, 0, 0, 0, 100, 100, 100, 100, 107, 107,
642 0, 0, 0, 107, 107, 107, 107, 0, 107, 0,
643 0, 107, 0, 0, 0, 0, 0, 0, 107, 107,
644
645 107, 107, 0, 0, 0, 107, 0, 0, 0, 0,
646 107, 109, 109, 0, 0, 0, 109, 109, 109, 109,
647 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
648 0, 109, 109, 109, 109, 117, 117, 0, 0, 0,
649 117, 117, 117, 117, 0, 117, 0, 0, 117, 0,
650 0, 0, 0, 0, 0, 117, 117, 117, 117, 0,
651 0, 0, 117, 0, 0, 0, 0, 117, 119, 119,
652 0, 0, 0, 119, 119, 119, 119, 0, 0, 0,
653 0, 0, 0, 0, 0, 0, 0, 0, 119, 119,
654 119, 119, 123, 123, 0, 0, 0, 123, 123, 123,
655
656 123, 0, 123, 0, 0, 123, 0, 0, 0, 0,
657 0, 0, 123, 123, 123, 123, 0, 0, 0, 123,
658 0, 0, 0, 0, 123, 125, 125, 0, 0, 0,
659 125, 125, 125, 125, 0, 0, 0, 0, 0, 0,
660 0, 0, 0, 0, 0, 125, 125, 125, 125, 129,
661 129, 0, 0, 0, 129, 129, 129, 129, 0, 129,
662 0, 0, 129, 0, 0, 0, 0, 0, 0, 129,
663 129, 129, 129, 0, 0, 0, 129, 0, 0, 0,
664 0, 129, 131, 131, 0, 0, 0, 131, 131, 131,
665 131, 0, 0, 0, 0, 0, 0, 0, 0, 0,
666
667 0, 0, 131, 131, 131, 131, 174, 174, 174, 174,
668 175, 175, 175, 175, 176, 176, 176, 176, 177, 177,
669 178, 0, 178, 178, 179, 179, 180, 0, 180, 180,
670 181, 0, 181, 181, 190, 0, 190, 190, 173, 173,
671 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
672 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
673 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
674 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
675 173, 173, 173, 173, 173, 173
676 } ;
677
678 static yy_state_type yy_last_accepting_state;
679 static char *yy_last_accepting_cpos;
680
681 extern int parser__flex_debug;
682 int parser__flex_debug = 0;
683
684 /* The intent behind this definition is that it'll catch
685 * any uses of REJECT which flex missed.
686 */
687 #define REJECT reject_used_but_not_detected
688 #define yymore() yymore_used_but_not_detected
689 #define YY_MORE_ADJ 0
690 #define YY_RESTORE_YY_MORE_OFFSET
691 char *parser_text;
692 #line 1 "parser.l"
693 /* -*-C-*-
694 * IDL Compiler
695 *
696 * Copyright 2002 Ove Kaaven
697 *
698 * This library is free software; you can redistribute it and/or
699 * modify it under the terms of the GNU Lesser General Public
700 * License as published by the Free Software Foundation; either
701 * version 2.1 of the License, or (at your option) any later version.
702 *
703 * This library is distributed in the hope that it will be useful,
704 * but WITHOUT ANY WARRANTY; without even the implied warranty of
705 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
706 * Lesser General Public License for more details.
707 *
708 * You should have received a copy of the GNU Lesser General Public
709 * License along with this library; if not, write to the Free Software
710 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
711 */
712 #define YY_NO_INPUT 1
713
714
715
716
717
718
719 #line 44 "parser.l"
720
721 #include "config.h"
722 #include "wine/port.h"
723
724 #include <stdio.h>
725 #include <stdlib.h>
726 #include <string.h>
727 #include <ctype.h>
728 #include <assert.h>
729 #include <errno.h>
730 #include <limits.h>
731
732 #ifdef HAVE_UNISTD_H
733 #include <unistd.h>
734 #else
735 #define YY_NO_UNISTD_H
736 #endif
737
738 #include "widl.h"
739 #include "utils.h"
740 #include "parser.h"
741 #include "wine/wpp.h"
742
743 #include "parser.tab.h"
744
745 static void addcchar(char c);
746 static char *get_buffered_cstring(void);
747
748 static char *cbuffer;
749 static int cbufidx;
750 static int cbufalloc = 0;
751
752 static int kw_token(const char *kw);
753 static int attr_token(const char *kw);
754
755 #define MAX_IMPORT_DEPTH 10
756 struct {
757 YY_BUFFER_STATE state;
758 char *input_name;
759 int line_number;
760 char *temp_name;
761 } import_stack[MAX_IMPORT_DEPTH];
762 int import_stack_ptr = 0;
763
764 /* converts an integer in string form to an unsigned long and prints an error
765 * on overflow */
766 static unsigned int xstrtoul(const char *nptr, char **endptr, int base)
767 {
768 unsigned long val;
769
770 errno = 0;
771 val = strtoul(nptr, endptr, base);
772 if ((val == ULONG_MAX && errno == ERANGE) || ((unsigned int)val != val))
773 error_loc("integer constant %s is too large\n", nptr);
774 return val;
775 }
776
777 UUID *parse_uuid(const char *u)
778 {
779 UUID* uuid = xmalloc(sizeof(UUID));
780 char b[3];
781 /* it would be nice to use UuidFromStringA */
782 uuid->Data1 = strtoul(u, NULL, 16);
783 uuid->Data2 = strtoul(u+9, NULL, 16);
784 uuid->Data3 = strtoul(u+14, NULL, 16);
785 b[2] = 0;
786 memcpy(b, u+19, 2); uuid->Data4[0] = strtoul(b, NULL, 16);
787 memcpy(b, u+21, 2); uuid->Data4[1] = strtoul(b, NULL, 16);
788 memcpy(b, u+24, 2); uuid->Data4[2] = strtoul(b, NULL, 16);
789 memcpy(b, u+26, 2); uuid->Data4[3] = strtoul(b, NULL, 16);
790 memcpy(b, u+28, 2); uuid->Data4[4] = strtoul(b, NULL, 16);
791 memcpy(b, u+30, 2); uuid->Data4[5] = strtoul(b, NULL, 16);
792 memcpy(b, u+32, 2); uuid->Data4[6] = strtoul(b, NULL, 16);
793 memcpy(b, u+34, 2); uuid->Data4[7] = strtoul(b, NULL, 16);
794 return uuid;
795 }
796
797 /*
798 **************************************************************************
799 * The flexer starts here
800 **************************************************************************
801 */
802 #line 803 "parser.yy.c"
803
804 #define INITIAL 0
805 #define QUOTE 1
806 #define WSTRQUOTE 2
807 #define ATTR 3
808 #define PP_LINE 4
809 #define PP_PRAGMA 5
810 #define SQUOTE 6
811
812 #ifndef YY_NO_UNISTD_H
813 /* Special case for "unistd.h", since it is non-ANSI. We include it way
814 * down here because we want the user's section 1 to have been scanned first.
815 * The user has a chance to override it with an option.
816 */
817 #include <unistd.h>
818 #endif
819
820 #ifndef YY_EXTRA_TYPE
821 #define YY_EXTRA_TYPE void *
822 #endif
823
824 static int yy_init_globals (void );
825
826 /* Accessor methods to globals.
827 These are made visible to non-reentrant scanners for convenience. */
828
829 int parser_lex_destroy (void );
830
831 int parser_get_debug (void );
832
833 void parser_set_debug (int debug_flag );
834
835 YY_EXTRA_TYPE parser_get_extra (void );
836
837 void parser_set_extra (YY_EXTRA_TYPE user_defined );
838
839 FILE *parser_get_in (void );
840
841 void parser_set_in (FILE * in_str );
842
843 FILE *parser_get_out (void );
844
845 void parser_set_out (FILE * out_str );
846
847 int parser_get_leng (void );
848
849 char *parser_get_text (void );
850
851 int parser_get_lineno (void );
852
853 void parser_set_lineno (int line_number );
854
855 /* Macros after this point can all be overridden by user definitions in
856 * section 1.
857 */
858
859 #ifndef YY_SKIP_YYWRAP
860 #ifdef __cplusplus
861 extern "C" int parser_wrap (void );
862 #else
863 extern int parser_wrap (void );
864 #endif
865 #endif
866
867 #ifndef yytext_ptr
868 static void yy_flex_strncpy (char *,yyconst char *,int );
869 #endif
870
871 #ifdef YY_NEED_STRLEN
872 static int yy_flex_strlen (yyconst char * );
873 #endif
874
875 #ifndef YY_NO_INPUT
876
877 #ifdef __cplusplus
878 static int yyinput (void );
879 #else
880 static int input (void );
881 #endif
882
883 #endif
884
885 static int yy_start_stack_ptr = 0;
886 static int yy_start_stack_depth = 0;
887 static int *yy_start_stack = NULL;
888
889 static void yy_push_state (int new_state );
890
891 static void yy_pop_state (void );
892
893 /* Amount of stuff to slurp up with each read. */
894 #ifndef YY_READ_BUF_SIZE
895 #ifdef __ia64__
896 /* On IA-64, the buffer size is 16k, not 8k */
897 #define YY_READ_BUF_SIZE 16384
898 #else
899 #define YY_READ_BUF_SIZE 8192
900 #endif /* __ia64__ */
901 #endif
902
903 /* Copy whatever the last rule matched to the standard output. */
904 #ifndef ECHO
905 /* This used to be an fputs(), but since the string might contain NUL's,
906 * we now use fwrite().
907 */
908 #define ECHO do { if (fwrite( parser_text, parser_leng, 1, parser_out )) {} } while (0)
909 #endif
910
911 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
912 * is returned in "result".
913 */
914 #ifndef YY_INPUT
915 #define YY_INPUT(buf,result,max_size) \
916 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
917 { \
918 int c = '*'; \
919 size_t n; \
920 for ( n = 0; n < max_size && \
921 (c = getc( parser_in )) != EOF && c != '\n'; ++n ) \
922 buf[n] = (char) c; \
923 if ( c == '\n' ) \
924 buf[n++] = (char) c; \
925 if ( c == EOF && ferror( parser_in ) ) \
926 YY_FATAL_ERROR( "input in flex scanner failed" ); \
927 result = n; \
928 } \
929 else \
930 { \
931 errno=0; \
932 while ( (result = fread(buf, 1, max_size, parser_in))==0 && ferror(parser_in)) \
933 { \
934 if( errno != EINTR) \
935 { \
936 YY_FATAL_ERROR( "input in flex scanner failed" ); \
937 break; \
938 } \
939 errno=0; \
940 clearerr(parser_in); \
941 } \
942 }\
943 \
944
945 #endif
946
947 /* No semi-colon after return; correct usage is to write "yyterminate();" -
948 * we don't want an extra ';' after the "return" because that will cause
949 * some compilers to complain about unreachable statements.
950 */
951 #ifndef yyterminate
952 #define yyterminate() return YY_NULL
953 #endif
954
955 /* Number of entries by which start-condition stack grows. */
956 #ifndef YY_START_STACK_INCR
957 #define YY_START_STACK_INCR 25
958 #endif
959
960 /* Report a fatal error. */
961 #ifndef YY_FATAL_ERROR
962 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
963 #endif
964
965 /* end tables serialization structures and prototypes */
966
967 /* Default declaration of generated scanner - a define so the user can
968 * easily add parameters.
969 */
970 #ifndef YY_DECL
971 #define YY_DECL_IS_OURS 1
972
973 extern int parser_lex (void);
974
975 #define YY_DECL int parser_lex (void)
976 #endif /* !YY_DECL */
977
978 /* Code executed at the beginning of each rule, after parser_text and parser_leng
979 * have been set up.
980 */
981 #ifndef YY_USER_ACTION
982 #define YY_USER_ACTION
983 #endif
984
985 /* Code executed at the end of each rule. */
986 #ifndef YY_BREAK
987 #define YY_BREAK break;
988 #endif
989
990 #define YY_RULE_SETUP \
991 if ( parser_leng > 0 ) \
992 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
993 (parser_text[parser_leng - 1] == '\n'); \
994 YY_USER_ACTION
995
996 /** The main scanner function which does all the work.
997 */
998 YY_DECL
999 {
1000 register yy_state_type yy_current_state;
1001 register char *yy_cp, *yy_bp;
1002 register int yy_act;
1003
1004 #line 128 "parser.l"
1005
1006 #line 1007 "parser.yy.c"
1007
1008 if ( !(yy_init) )
1009 {
1010 (yy_init) = 1;
1011
1012 #ifdef YY_USER_INIT
1013 YY_USER_INIT;
1014 #endif
1015
1016 if ( ! (yy_start) )
1017 (yy_start) = 1; /* first start state */
1018
1019 if ( ! parser_in )
1020 parser_in = stdin;
1021
1022 if ( ! parser_out )
1023 parser_out = stdout;
1024
1025 if ( ! YY_CURRENT_BUFFER ) {
1026 parser_ensure_buffer_stack ();
1027 YY_CURRENT_BUFFER_LVALUE =
1028 parser__create_buffer(parser_in,YY_BUF_SIZE );
1029 }
1030
1031 parser__load_buffer_state( );
1032 }
1033
1034 while ( 1 ) /* loops until end-of-file is reached */
1035 {
1036 yy_cp = (yy_c_buf_p);
1037
1038 /* Support of parser_text. */
1039 *yy_cp = (yy_hold_char);
1040
1041 /* yy_bp points to the position in yy_ch_buf of the start of
1042 * the current run.
1043 */
1044 yy_bp = yy_cp;
1045
1046 yy_current_state = (yy_start);
1047 yy_current_state += YY_AT_BOL();
1048 yy_match:
1049 do
1050 {
1051 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1052 if ( yy_accept[yy_current_state] )
1053 {
1054 (yy_last_accepting_state) = yy_current_state;
1055 (yy_last_accepting_cpos) = yy_cp;
1056 }
1057 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1058 {
1059 yy_current_state = (int) yy_def[yy_current_state];
1060 if ( yy_current_state >= 174 )
1061 yy_c = yy_meta[(unsigned int) yy_c];
1062 }
1063 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1064 ++yy_cp;
1065 }
1066 while ( yy_current_state != 173 );
1067 yy_cp = (yy_last_accepting_cpos);
1068 yy_current_state = (yy_last_accepting_state);
1069
1070 yy_find_action:
1071 yy_act = yy_accept[yy_current_state];
1072
1073 YY_DO_BEFORE_ACTION;
1074
1075 do_action: /* This label is used only to access EOF actions. */
1076
1077 switch ( yy_act )
1078 { /* beginning of action switch */
1079 case 0: /* must back up */
1080 /* undo the effects of YY_DO_BEFORE_ACTION */
1081 *yy_cp = (yy_hold_char);
1082 yy_cp = (yy_last_accepting_cpos);
1083 yy_current_state = (yy_last_accepting_state);
1084 goto yy_find_action;
1085
1086 case 1:
1087 YY_RULE_SETUP
1088 #line 129 "parser.l"
1089 yy_push_state(PP_PRAGMA);
1090 YY_BREAK
1091 case 2:
1092 YY_RULE_SETUP
1093 #line 130 "parser.l"
1094 yy_push_state(PP_LINE);
1095 YY_BREAK
1096 case 3:
1097 YY_RULE_SETUP
1098 #line 131 "parser.l"
1099 {
1100 int lineno;
1101 char *cptr, *fname;
1102 yy_pop_state();
1103 lineno = (int)strtol(parser_text, &cptr, 10);
1104 if(!lineno)
1105 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
1106 fname = strchr(cptr, '"');
1107 if(!fname)
1108 error_loc("Malformed '#...' line-directive; missing filename\n");
1109 fname++;
1110 cptr = strchr(fname, '"');
1111 if(!cptr)
1112 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
1113 *cptr = '\0';
1114 line_number = lineno - 1; /* We didn't read the newline */
1115 input_name = xstrdup(fname);
1116 }
1117 YY_BREAK
1118 case 4:
1119 YY_RULE_SETUP
1120 #line 149 "parser.l"
1121 yyless(9); yy_pop_state(); return tCPPQUOTE;
1122 YY_BREAK
1123 case 5:
1124 YY_RULE_SETUP
1125 #line 150 "parser.l"
1126 parser_lval.str = xstrdup(parser_text); yy_pop_state(); return aPRAGMA;
1127 YY_BREAK
1128 case 6:
1129 YY_RULE_SETUP
1130 #line 151 "parser.l"
1131 yy_push_state(QUOTE); cbufidx = 0;
1132 YY_BREAK
1133 case 7:
1134 YY_RULE_SETUP
1135 #line 152 "parser.l"
1136 {
1137 yy_pop_state();
1138 parser_lval.str = get_buffered_cstring();
1139 return aSTRING;
1140 }
1141 YY_BREAK
1142 case 8:
1143 YY_RULE_SETUP
1144 #line 157 "parser.l"
1145 yy_push_state(WSTRQUOTE); cbufidx = 0;
1146 YY_BREAK
1147 case 9:
1148 YY_RULE_SETUP
1149 #line 158 "parser.l"
1150 {
1151 yy_pop_state();
1152 parser_lval.str = get_buffered_cstring();
1153 return aWSTRING;
1154 }
1155 YY_BREAK
1156 case 10:
1157 YY_RULE_SETUP
1158 #line 163 "parser.l"
1159 yy_push_state(SQUOTE); cbufidx = 0;
1160 YY_BREAK
1161 case 11:
1162 YY_RULE_SETUP
1163 #line 164 "parser.l"
1164 {
1165 yy_pop_state();
1166 parser_lval.str = get_buffered_cstring();
1167 return aSQSTRING;
1168 }
1169 YY_BREAK
1170 case 12:
1171 #line 170 "parser.l"
1172 case 13:
1173 YY_RULE_SETUP
1174 #line 170 "parser.l"
1175 addcchar(parser_text[1]);
1176 YY_BREAK
1177 case 14:
1178 YY_RULE_SETUP
1179 #line 171 "parser.l"
1180 addcchar(parser_text[1]);
1181 YY_BREAK
1182 case 15:
1183 YY_RULE_SETUP
1184 #line 172 "parser.l"
1185 addcchar('\\'); addcchar(parser_text[1]);
1186 YY_BREAK
1187 case 16:
1188 YY_RULE_SETUP
1189 #line 173 "parser.l"
1190 addcchar(parser_text[0]);
1191 YY_BREAK
1192 case 17:
1193 YY_RULE_SETUP
1194 #line 174 "parser.l"
1195 yy_push_state(ATTR); return '[';
1196 YY_BREAK
1197 case 18:
1198 YY_RULE_SETUP
1199 #line 175 "parser.l"
1200 yy_pop_state(); return ']';
1201 YY_BREAK
1202 case 19:
1203 YY_RULE_SETUP
1204 #line 176 "parser.l"
1205 return attr_token(parser_text);
1206 YY_BREAK
1207 case 20:
1208 YY_RULE_SETUP
1209 #line 177 "parser.l"
1210 {
1211 parser_lval.uuid = parse_uuid(parser_text);
1212 return aUUID;
1213 }
1214 YY_BREAK
1215 case 21:
1216 YY_RULE_SETUP
1217 #line 181 "parser.l"
1218 {
1219 parser_lval.num = xstrtoul(parser_text, NULL, 0);
1220 return aHEXNUM;
1221 }
1222 YY_BREAK
1223 case 22:
1224 YY_RULE_SETUP
1225 #line 185 "parser.l"
1226 {
1227 parser_lval.num = xstrtoul(parser_text, NULL, 0);
1228 return aNUM;
1229 }
1230 YY_BREAK
1231 case 23:
1232 YY_RULE_SETUP
1233 #line 189 "parser.l"
1234 {
1235 parser_lval.dbl = strtod(parser_text, NULL);
1236 return aDOUBLE;
1237 }
1238 YY_BREAK
1239 case 24:
1240 *yy_cp = (yy_hold_char); /* undo effects of setting up parser_text */
1241 (yy_c_buf_p) = yy_cp -= 1;
1242 YY_DO_BEFORE_ACTION; /* set up parser_text again */
1243 YY_RULE_SETUP
1244 #line 193 "parser.l"
1245 return tSAFEARRAY;
1246 YY_BREAK
1247 case 25:
1248 YY_RULE_SETUP
1249 #line 194 "parser.l"
1250 return kw_token(parser_text);
1251 YY_BREAK
1252 case 26:
1253 /* rule 26 can match eol */
1254 YY_RULE_SETUP
1255 #line 195 "parser.l"
1256 line_number++;
1257 YY_BREAK
1258 case 27:
1259 YY_RULE_SETUP
1260 #line 196 "parser.l"
1261
1262 YY_BREAK
1263 case 28:
1264 YY_RULE_SETUP
1265 #line 197 "parser.l"
1266 return SHL;
1267 YY_BREAK
1268 case 29:
1269 YY_RULE_SETUP
1270 #line 198 "parser.l"
1271 return SHR;
1272 YY_BREAK
1273 case 30:
1274 YY_RULE_SETUP
1275 #line 199 "parser.l"
1276 return MEMBERPTR;
1277 YY_BREAK
1278 case 31:
1279 YY_RULE_SETUP
1280 #line 200 "parser.l"
1281 return EQUALITY;
1282 YY_BREAK
1283 case 32:
1284 YY_RULE_SETUP
1285 #line 201 "parser.l"
1286 return INEQUALITY;
1287 YY_BREAK
1288 case 33:
1289 YY_RULE_SETUP
1290 #line 202 "parser.l"
1291 return GREATEREQUAL;
1292 YY_BREAK
1293 case 34:
1294 YY_RULE_SETUP
1295 #line 203 "parser.l"
1296 return LESSEQUAL;
1297 YY_BREAK
1298 case 35:
1299 YY_RULE_SETUP
1300 #line 204 "parser.l"
1301 return LOGICALOR;
1302 YY_BREAK
1303 case 36:
1304 YY_RULE_SETUP
1305 #line 205 "parser.l"
1306 return LOGICALAND;
1307 YY_BREAK
1308 case 37:
1309 YY_RULE_SETUP
1310 #line 206 "parser.l"
1311 return ELLIPSIS;
1312 YY_BREAK
1313 case 38:
1314 YY_RULE_SETUP
1315 #line 207 "parser.l"
1316 return parser_text[0];
1317 YY_BREAK
1318 case YY_STATE_EOF(INITIAL):
1319 case YY_STATE_EOF(QUOTE):
1320 case YY_STATE_EOF(WSTRQUOTE):
1321 case YY_STATE_EOF(ATTR):
1322 case YY_STATE_EOF(PP_LINE):
1323 case YY_STATE_EOF(PP_PRAGMA):
1324 case YY_STATE_EOF(SQUOTE):
1325 #line 208 "parser.l"
1326 {
1327 if (import_stack_ptr)
1328 return aEOF;
1329 else yyterminate();
1330 }
1331 YY_BREAK
1332 case 39:
1333 YY_RULE_SETUP
1334 #line 213 "parser.l"
1335 ECHO;
1336 YY_BREAK
1337 #line 1338 "parser.yy.c"
1338
1339 case YY_END_OF_BUFFER:
1340 {
1341 /* Amount of text matched not including the EOB char. */
1342 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1343
1344 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1345 *yy_cp = (yy_hold_char);
1346 YY_RESTORE_YY_MORE_OFFSET
1347
1348 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1349 {
1350 /* We're scanning a new file or input source. It's
1351 * possible that this happened because the user
1352 * just pointed parser_in at a new source and called
1353 * parser_lex(). If so, then we have to assure
1354 * consistency between YY_CURRENT_BUFFER and our
1355 * globals. Here is the right place to do so, because
1356 * this is the first action (other than possibly a
1357 * back-up) that will match for the new input source.
1358 */
1359 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1360 YY_CURRENT_BUFFER_LVALUE->yy_input_file = parser_in;
1361 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1362 }
1363
1364 /* Note that here we test for yy_c_buf_p "<=" to the position
1365 * of the first EOB in the buffer, since yy_c_buf_p will
1366 * already have been incremented past the NUL character
1367 * (since all states make transitions on EOB to the
1368 * end-of-buffer state). Contrast this with the test
1369 * in input().
1370 */
1371 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1372 { /* This was really a NUL. */
1373 yy_state_type yy_next_state;
1374
1375 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1376
1377 yy_current_state = yy_get_previous_state( );
1378
1379 /* Okay, we're now positioned to make the NUL
1380 * transition. We couldn't have
1381 * yy_get_previous_state() go ahead and do it
1382 * for us because it doesn't know how to deal
1383 * with the possibility of jamming (and we don't
1384 * want to build jamming into it because then it
1385 * will run more slowly).
1386 */
1387
1388 yy_next_state = yy_try_NUL_trans( yy_current_state );
1389
1390 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1391
1392 if ( yy_next_state )
1393 {
1394 /* Consume the NUL. */
1395 yy_cp = ++(yy_c_buf_p);
1396 yy_current_state = yy_next_state;
1397 goto yy_match;
1398 }
1399
1400 else
1401 {
1402 yy_cp = (yy_last_accepting_cpos);
1403 yy_current_state = (yy_last_accepting_state);
1404 goto yy_find_action;
1405 }
1406 }
1407
1408 else switch ( yy_get_next_buffer( ) )
1409 {
1410 case EOB_ACT_END_OF_FILE:
1411 {
1412 (yy_did_buffer_switch_on_eof) = 0;
1413
1414 if ( parser_wrap( ) )
1415 {
1416 /* Note: because we've taken care in
1417 * yy_get_next_buffer() to have set up
1418 * parser_text, we can now set up
1419 * yy_c_buf_p so that if some total
1420 * hoser (like flex itself) wants to
1421 * call the scanner after we return the
1422 * YY_NULL, it'll still work - another
1423 * YY_NULL will get returned.
1424 */
1425 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1426
1427 yy_act = YY_STATE_EOF(YY_START);
1428 goto do_action;
1429 }
1430
1431 else
1432 {
1433 if ( ! (yy_did_buffer_switch_on_eof) )
1434 YY_NEW_FILE;
1435 }
1436 break;
1437 }
1438
1439 case EOB_ACT_CONTINUE_SCAN:
1440 (yy_c_buf_p) =
1441 (yytext_ptr) + yy_amount_of_matched_text;
1442
1443 yy_current_state = yy_get_previous_state( );
1444
1445 yy_cp = (yy_c_buf_p);
1446 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1447 goto yy_match;
1448
1449 case EOB_ACT_LAST_MATCH:
1450 (yy_c_buf_p) =
1451 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1452
1453 yy_current_state = yy_get_previous_state( );
1454
1455 yy_cp = (yy_c_buf_p);
1456 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1457 goto yy_find_action;
1458 }
1459 break;
1460 }
1461
1462 default:
1463 YY_FATAL_ERROR(
1464 "fatal flex scanner internal error--no action found" );
1465 } /* end of action switch */
1466 } /* end of scanning one token */
1467 } /* end of parser_lex */
1468
1469 /* yy_get_next_buffer - try to read in a new buffer
1470 *
1471 * Returns a code representing an action:
1472 * EOB_ACT_LAST_MATCH -
1473 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1474 * EOB_ACT_END_OF_FILE - end of file
1475 */
1476 static int yy_get_next_buffer (void)
1477 {
1478 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1479 register char *source = (yytext_ptr);
1480 register int number_to_move, i;
1481 int ret_val;
1482
1483 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1484 YY_FATAL_ERROR(
1485 "fatal flex scanner internal error--end of buffer missed" );
1486
1487 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1488 { /* Don't try to fill the buffer, so this is an EOF. */
1489 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1490 {
1491 /* We matched a single character, the EOB, so
1492 * treat this as a final EOF.
1493 */
1494 return EOB_ACT_END_OF_FILE;
1495 }
1496
1497 else
1498 {
1499 /* We matched some text prior to the EOB, first
1500 * process it.
1501 */
1502 return EOB_ACT_LAST_MATCH;
1503 }
1504 }
1505
1506 /* Try to read more data. */
1507
1508 /* First move last chars to start of buffer. */
1509 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1510
1511 for ( i = 0; i < number_to_move; ++i )
1512 *(dest++) = *(source++);
1513
1514 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1515 /* don't do the read, it's not guaranteed to return an EOF,
1516 * just force an EOF
1517 */
1518 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1519
1520 else
1521 {
1522 int num_to_read =
1523 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1524
1525 while ( num_to_read <= 0 )
1526 { /* Not enough room in the buffer - grow it. */
1527
1528 /* just a shorter name for the current buffer */
1529 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1530
1531 int yy_c_buf_p_offset =
1532 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1533
1534 if ( b->yy_is_our_buffer )
1535 {
1536 int new_size = b->yy_buf_size * 2;
1537
1538 if ( new_size <= 0 )
1539 b->yy_buf_size += b->yy_buf_size / 8;
1540 else
1541 b->yy_buf_size *= 2;
1542
1543 b->yy_ch_buf = (char *)
1544 /* Include room in for 2 EOB chars. */
1545 parser_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1546 }
1547 else
1548 /* Can't grow it, we don't own it. */
1549 b->yy_ch_buf = 0;
1550
1551 if ( ! b->yy_ch_buf )
1552 YY_FATAL_ERROR(
1553 "fatal error - scanner input buffer overflow" );
1554
1555 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1556
1557 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1558 number_to_move - 1;
1559
1560 }
1561
1562 if ( num_to_read > YY_READ_BUF_SIZE )
1563 num_to_read = YY_READ_BUF_SIZE;
1564
1565 /* Read in more data. */
1566 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1567 (yy_n_chars), (size_t) num_to_read );
1568
1569 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1570 }
1571
1572 if ( (yy_n_chars) == 0 )
1573 {
1574 if ( number_to_move == YY_MORE_ADJ )
1575 {
1576 ret_val = EOB_ACT_END_OF_FILE;
1577 parser_restart(parser_in );
1578 }
1579
1580 else
1581 {
1582 ret_val = EOB_ACT_LAST_MATCH;
1583 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1584 YY_BUFFER_EOF_PENDING;
1585 }
1586 }
1587
1588 else
1589 ret_val = EOB_ACT_CONTINUE_SCAN;
1590
1591 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1592 /* Extend the array by 50%, plus the number we really need. */
1593 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1594 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) parser_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1595 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1596 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1597 }
1598
1599 (yy_n_chars) += number_to_move;
1600 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1601 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1602
1603 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1604
1605 return ret_val;
1606 }
1607
1608 /* yy_get_previous_state - get the state just before the EOB char was reached */
1609
1610 static yy_state_type yy_get_previous_state (void)
1611 {
1612 register yy_state_type yy_current_state;
1613 register char *yy_cp;
1614
1615 yy_current_state = (yy_start);
1616 yy_current_state += YY_AT_BOL();
1617
1618 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1619 {
1620 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1621 if ( yy_accept[yy_current_state] )
1622 {
1623 (yy_last_accepting_state) = yy_current_state;
1624 (yy_last_accepting_cpos) = yy_cp;
1625 }
1626 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1627 {
1628 yy_current_state = (int) yy_def[yy_current_state];
1629 if ( yy_current_state >= 174 )
1630 yy_c = yy_meta[(unsigned int) yy_c];
1631 }
1632 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1633 }
1634
1635 return yy_current_state;
1636 }
1637
1638 /* yy_try_NUL_trans - try to make a transition on the NUL character
1639 *
1640 * synopsis
1641 * next_state = yy_try_NUL_trans( current_state );
1642 */
1643 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1644 {
1645 register int yy_is_jam;
1646 register char *yy_cp = (yy_c_buf_p);
1647
1648 register YY_CHAR yy_c = 1;
1649 if ( yy_accept[yy_current_state] )
1650 {
1651 (yy_last_accepting_state) = yy_current_state;
1652 (yy_last_accepting_cpos) = yy_cp;
1653 }
1654 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1655 {
1656 yy_current_state = (int) yy_def[yy_current_state];
1657 if ( yy_current_state >= 174 )
1658 yy_c = yy_meta[(unsigned int) yy_c];
1659 }
1660 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1661 yy_is_jam = (yy_current_state == 173);
1662
1663 return yy_is_jam ? 0 : yy_current_state;
1664 }
1665
1666 #ifndef YY_NO_INPUT
1667 #ifdef __cplusplus
1668 static int yyinput (void)
1669 #else
1670 static int input (void)
1671 #endif
1672
1673 {
1674 int c;
1675
1676 *(yy_c_buf_p) = (yy_hold_char);
1677
1678 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1679 {
1680 /* yy_c_buf_p now points to the character we want to return.
1681 * If this occurs *before* the EOB characters, then it's a
1682 * valid NUL; if not, then we've hit the end of the buffer.
1683 */
1684 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1685 /* This was really a NUL. */
1686 *(yy_c_buf_p) = '\0';
1687
1688 else
1689 { /* need more input */
1690 int offset = (yy_c_buf_p) - (yytext_ptr);
1691 ++(yy_c_buf_p);
1692
1693 switch ( yy_get_next_buffer( ) )
1694 {
1695 case EOB_ACT_LAST_MATCH:
1696 /* This happens because yy_g_n_b()
1697 * sees that we've accumulated a
1698 * token and flags that we need to
1699 * try matching the token before
1700 * proceeding. But for input(),
1701 * there's no matching to consider.
1702 * So convert the EOB_ACT_LAST_MATCH
1703 * to EOB_ACT_END_OF_FILE.
1704 */
1705
1706 /* Reset buffer status. */
1707 parser_restart(parser_in );
1708
1709 /*FALLTHROUGH*/
1710
1711 case EOB_ACT_END_OF_FILE:
1712 {
1713 if ( parser_wrap( ) )
1714 return EOF;
1715
1716 if ( ! (yy_did_buffer_switch_on_eof) )
1717 YY_NEW_FILE;
1718 #ifdef __cplusplus
1719 return yyinput();
1720 #else
1721 return input();
1722 #endif
1723 }
1724
1725 case EOB_ACT_CONTINUE_SCAN:
1726 (yy_c_buf_p) = (yytext_ptr) + offset;
1727 break;
1728 }
1729 }
1730 }
1731
1732 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1733 *(yy_c_buf_p) = '\0'; /* preserve parser_text */
1734 (yy_hold_char) = *++(yy_c_buf_p);
1735
1736 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1737
1738 return c;
1739 }
1740 #endif /* ifndef YY_NO_INPUT */
1741
1742 /** Immediately switch to a different input stream.
1743 * @param input_file A readable stream.
1744 *
1745 * @note This function does not reset the start condition to @c INITIAL .
1746 */
1747 void parser_restart (FILE * input_file )
1748 {
1749
1750 if ( ! YY_CURRENT_BUFFER ){
1751 parser_ensure_buffer_stack ();
1752 YY_CURRENT_BUFFER_LVALUE =
1753 parser__create_buffer(parser_in,YY_BUF_SIZE );
1754 }
1755
1756 parser__init_buffer(YY_CURRENT_BUFFER,input_file );
1757 parser__load_buffer_state( );
1758 }
1759
1760 /** Switch to a different input buffer.
1761 * @param new_buffer The new input buffer.
1762 *
1763 */
1764 void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1765 {
1766
1767 /* TODO. We should be able to replace this entire function body
1768 * with
1769 * parser_pop_buffer_state();
1770 * parser_push_buffer_state(new_buffer);
1771 */
1772 parser_ensure_buffer_stack ();
1773 if ( YY_CURRENT_BUFFER == new_buffer )
1774 return;
1775
1776 if ( YY_CURRENT_BUFFER )
1777 {
1778 /* Flush out information for old buffer. */
1779 *(yy_c_buf_p) = (yy_hold_char);
1780 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1781 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1782 }
1783
1784 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1785 parser__load_buffer_state( );
1786
1787 /* We don't actually know whether we did this switch during
1788 * EOF (parser_wrap()) processing, but the only time this flag
1789 * is looked at is after parser_wrap() is called, so it's safe
1790 * to go ahead and always set it.
1791 */
1792 (yy_did_buffer_switch_on_eof) = 1;
1793 }
1794
1795 static void parser__load_buffer_state (void)
1796 {
1797 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1798 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1799 parser_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1800 (yy_hold_char) = *(yy_c_buf_p);
1801 }
1802
1803 /** Allocate and initialize an input buffer state.
1804 * @param file A readable stream.
1805 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1806 *
1807 * @return the allocated buffer state.
1808 */
1809 YY_BUFFER_STATE parser__create_buffer (FILE * file, int size )
1810 {
1811 YY_BUFFER_STATE b;
1812
1813 b = (YY_BUFFER_STATE) parser_alloc(sizeof( struct yy_buffer_state ) );
1814 if ( ! b )
1815 YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" );
1816
1817 b->yy_buf_size = size;
1818
1819 /* yy_ch_buf has to be 2 characters longer than the size given because
1820 * we need to put in 2 end-of-buffer characters.
1821 */
1822 b->yy_ch_buf = (char *) parser_alloc(b->yy_buf_size + 2 );
1823 if ( ! b->yy_ch_buf )
1824 YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" );
1825
1826 b->yy_is_our_buffer = 1;
1827
1828 parser__init_buffer(b,file );
1829
1830 return b;
1831 }
1832
1833 /** Destroy the buffer.
1834 * @param b a buffer created with parser__create_buffer()
1835 *
1836 */
1837 void parser__delete_buffer (YY_BUFFER_STATE b )
1838 {
1839
1840 if ( ! b )
1841 return;
1842
1843 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1844 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1845
1846 if ( b->yy_is_our_buffer )
1847 parser_free((void *) b->yy_ch_buf );
1848
1849 parser_free((void *) b );
1850 }
1851
1852 /* Initializes or reinitializes a buffer.
1853 * This function is sometimes called more than once on the same buffer,
1854 * such as during a parser_restart() or at EOF.
1855 */
1856 static void parser__init_buffer (YY_BUFFER_STATE b, FILE * file )
1857
1858 {
1859 int oerrno = errno;
1860
1861 parser__flush_buffer(b );
1862
1863 b->yy_input_file = file;
1864 b->yy_fill_buffer = 1;
1865
1866 /* If b is the current buffer, then parser__init_buffer was _probably_
1867 * called from parser_restart() or through yy_get_next_buffer.
1868 * In that case, we don't want to reset the lineno or column.
1869 */
1870 if (b != YY_CURRENT_BUFFER){
1871 b->yy_bs_lineno = 1;
1872 b->yy_bs_column = 0;
1873 }
1874
1875 b->yy_is_interactive = 0;
1876
1877 errno = oerrno;
1878 }
1879
1880 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1881 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1882 *
1883 */
1884 void parser__flush_buffer (YY_BUFFER_STATE b )
1885 {
1886 if ( ! b )
1887 return;
1888
1889 b->yy_n_chars = 0;
1890
1891 /* We always need two end-of-buffer characters. The first causes
1892 * a transition to the end-of-buffer state. The second causes
1893 * a jam in that state.
1894 */
1895 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1896 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1897
1898 b->yy_buf_pos = &b->yy_ch_buf[0];
1899
1900 b->yy_at_bol = 1;
1901 b->yy_buffer_status = YY_BUFFER_NEW;
1902
1903 if ( b == YY_CURRENT_BUFFER )
1904 parser__load_buffer_state( );
1905 }
1906
1907 /** Pushes the new state onto the stack. The new state becomes
1908 * the current state. This function will allocate the stack
1909 * if necessary.
1910 * @param new_buffer The new state.
1911 *
1912 */
1913 void parser_push_buffer_state (YY_BUFFER_STATE new_buffer )
1914 {
1915 if (new_buffer == NULL)
1916 return;
1917
1918 parser_ensure_buffer_stack();
1919
1920 /* This block is copied from parser__switch_to_buffer. */
1921 if ( YY_CURRENT_BUFFER )
1922 {
1923 /* Flush out information for old buffer. */
1924 *(yy_c_buf_p) = (yy_hold_char);
1925 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1926 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1927 }
1928
1929 /* Only push if top exists. Otherwise, replace top. */
1930 if (YY_CURRENT_BUFFER)
1931 (yy_buffer_stack_top)++;
1932 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1933
1934 /* copied from parser__switch_to_buffer. */
1935 parser__load_buffer_state( );
1936 (yy_did_buffer_switch_on_eof) = 1;
1937 }
1938
1939 /** Removes and deletes the top of the stack, if present.
1940 * The next element becomes the new top.
1941 *
1942 */
1943 void parser_pop_buffer_state (void)
1944 {
1945 if (!YY_CURRENT_BUFFER)
1946 return;
1947
1948 parser__delete_buffer(YY_CURRENT_BUFFER );
1949 YY_CURRENT_BUFFER_LVALUE = NULL;
1950 if ((yy_buffer_stack_top) > 0)
1951 --(yy_buffer_stack_top);
1952
1953 if (YY_CURRENT_BUFFER) {
1954 parser__load_buffer_state( );
1955 (yy_did_buffer_switch_on_eof) = 1;
1956 }
1957 }
1958
1959 /* Allocates the stack if it does not exist.
1960 * Guarantees space for at least one push.
1961 */
1962 static void parser_ensure_buffer_stack (void)
1963 {
1964 int num_to_alloc;
1965
1966 if (!(yy_buffer_stack)) {
1967
1968 /* First allocation is just for 2 elements, since we don't know if this
1969 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1970 * immediate realloc on the next call.
1971 */
1972 num_to_alloc = 1;
1973 (yy_buffer_stack) = (struct yy_buffer_state**)parser_alloc
1974 (num_to_alloc * sizeof(struct yy_buffer_state*)
1975 );
1976 if ( ! (yy_buffer_stack) )
1977 YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" );
1978
1979 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1980
1981 (yy_buffer_stack_max) = num_to_alloc;
1982 (yy_buffer_stack_top) = 0;
1983 return;
1984 }
1985
1986 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1987
1988 /* Increase the buffer to prepare for a possible push. */
1989 int grow_size = 8 /* arbitrary grow size */;
1990
1991 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1992 (yy_buffer_stack) = (struct yy_buffer_state**)parser_realloc
1993 ((yy_buffer_stack),
1994 num_to_alloc * sizeof(struct yy_buffer_state*)
1995 );
1996 if ( ! (yy_buffer_stack) )
1997 YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" );
1998
1999 /* zero only the new slots.*/
2000 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2001 (yy_buffer_stack_max) = num_to_alloc;
2002 }
2003 }
2004
2005 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2006 * @param base the character buffer
2007 * @param size the size in bytes of the character buffer
2008 *
2009 * @return the newly allocated buffer state object.
2010 */
2011 YY_BUFFER_STATE parser__scan_buffer (char * base, yy_size_t size )
2012 {
2013 YY_BUFFER_STATE b;
2014
2015 if ( size < 2 ||
2016 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2017 base[size-1] != YY_END_OF_BUFFER_CHAR )
2018 /* They forgot to leave room for the EOB's. */
2019 return 0;
2020
2021 b = (YY_BUFFER_STATE) parser_alloc(sizeof( struct yy_buffer_state ) );
2022 if ( ! b )
2023 YY_FATAL_ERROR( "out of dynamic memory in parser__scan_buffer()" );
2024
2025 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2026 b->yy_buf_pos = b->yy_ch_buf = base;
2027 b->yy_is_our_buffer = 0;
2028 b->yy_input_file = 0;
2029 b->yy_n_chars = b->yy_buf_size;
2030 b->yy_is_interactive = 0;
2031 b->yy_at_bol = 1;
2032 b->yy_fill_buffer = 0;
2033 b->yy_buffer_status = YY_BUFFER_NEW;
2034
2035 parser__switch_to_buffer(b );
2036
2037 return b;
2038 }
2039
2040 /** Setup the input buffer state to scan a string. The next call to parser_lex() will
2041 * scan from a @e copy of @a str.
2042 * @param yystr a NUL-terminated string to scan
2043 *
2044 * @return the newly allocated buffer state object.
2045 * @note If you want to scan bytes that may contain NUL values, then use
2046 * parser__scan_bytes() instead.
2047 */
2048 YY_BUFFER_STATE parser__scan_string (yyconst char * yystr )
2049 {
2050
2051 return parser__scan_bytes(yystr,strlen(yystr) );
2052 }
2053
2054 /** Setup the input buffer state to scan the given bytes. The next call to parser_lex() will
2055 * scan from a @e copy of @a bytes.
2056 * @param yybytes the byte buffer to scan
2057 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2058 *
2059 * @return the newly allocated buffer state object.
2060 */
2061 YY_BUFFER_STATE parser__scan_bytes (yyconst char * yybytes, int _yybytes_len )
2062 {
2063 YY_BUFFER_STATE b;
2064 char *buf;
2065 yy_size_t n;
2066 int i;
2067
2068 /* Get memory for full buffer, including space for trailing EOB's. */
2069 n = _yybytes_len + 2;
2070 buf = (char *) parser_alloc(n );
2071 if ( ! buf )
2072 YY_FATAL_ERROR( "out of dynamic memory in parser__scan_bytes()" );
2073
2074 for ( i = 0; i < _yybytes_len; ++i )
2075 buf[i] = yybytes[i];
2076
2077 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2078
2079 b = parser__scan_buffer(buf,n );
2080 if ( ! b )
2081 YY_FATAL_ERROR( "bad buffer in parser__scan_bytes()" );
2082
2083 /* It's okay to grow etc. this buffer, and we should throw it
2084 * away when we're done.
2085 */
2086 b->yy_is_our_buffer = 1;
2087
2088 return b;
2089 }
2090
2091 static void yy_push_state (int new_state )
2092 {
2093 if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
2094 {
2095 yy_size_t new_size;
2096
2097 (yy_start_stack_depth) += YY_START_STACK_INCR;
2098 new_size = (yy_start_stack_depth) * sizeof( int );
2099
2100 if ( ! (yy_start_stack) )
2101 (yy_start_stack) = (int *) parser_alloc(new_size );
2102
2103 else
2104 (yy_start_stack) = (int *) parser_realloc((void *) (yy_start_stack),new_size );
2105
2106 if ( ! (yy_start_stack) )
2107 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2108 }
2109
2110 (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
2111
2112 BEGIN(new_state);
2113 }
2114
2115 static void yy_pop_state (void)
2116 {
2117 if ( --(yy_start_stack_ptr) < 0 )
2118 YY_FATAL_ERROR( "start-condition stack underflow" );
2119
2120 BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
2121 }
2122
2123 #ifndef YY_EXIT_FAILURE
2124 #define YY_EXIT_FAILURE 2
2125 #endif
2126
2127 static void yy_fatal_error (yyconst char* msg )
2128 {
2129 (void) fprintf( stderr, "%s\n", msg );
2130 exit( YY_EXIT_FAILURE );
2131 }
2132
2133 /* Redefine yyless() so it works in section 3 code. */
2134
2135 #undef yyless
2136 #define yyless(n) \
2137 do \
2138 { \
2139 /* Undo effects of setting up parser_text. */ \
2140 int yyless_macro_arg = (n); \
2141 YY_LESS_LINENO(yyless_macro_arg);\
2142 parser_text[parser_leng] = (yy_hold_char); \
2143 (yy_c_buf_p) = parser_text + yyless_macro_arg; \
2144 (yy_hold_char) = *(yy_c_buf_p); \
2145 *(yy_c_buf_p) = '\0'; \
2146 parser_leng = yyless_macro_arg; \
2147 } \
2148 while ( 0 )
2149
2150 /* Accessor methods (get/set functions) to struct members. */
2151
2152 /** Get the current line number.
2153 *
2154 */
2155 int parser_get_lineno (void)
2156 {
2157
2158 return parser_lineno;
2159 }
2160
2161 /** Get the input stream.
2162 *
2163 */
2164 FILE *parser_get_in (void)
2165 {
2166 return parser_in;
2167 }
2168
2169 /** Get the output stream.
2170 *
2171 */
2172 FILE *parser_get_out (void)
2173 {
2174 return parser_out;
2175 }
2176
2177 /** Get the length of the current token.
2178 *
2179 */
2180 int parser_get_leng (void)
2181 {
2182 return parser_leng;
2183 }
2184
2185 /** Get the current token.
2186 *
2187 */
2188
2189 char *parser_get_text (void)
2190 {
2191 return parser_text;
2192 }
2193
2194 /** Set the current line number.
2195 * @param line_number
2196 *
2197 */
2198 void parser_set_lineno (int line_number )
2199 {
2200
2201 parser_lineno = line_number;
2202 }
2203
2204 /** Set the input stream. This does not discard the current
2205 * input buffer.
2206 * @param in_str A readable stream.
2207 *
2208 * @see parser__switch_to_buffer
2209 */
2210 void parser_set_in (FILE * in_str )
2211 {
2212 parser_in = in_str ;
2213 }
2214
2215 void parser_set_out (FILE * out_str )
2216 {
2217 parser_out = out_str ;
2218 }
2219
2220 int parser_get_debug (void)
2221 {
2222 return parser__flex_debug;
2223 }
2224
2225 void parser_set_debug (int bdebug )
2226 {
2227 parser__flex_debug = bdebug ;
2228 }
2229
2230 static int yy_init_globals (void)
2231 {
2232 /* Initialization is the same as for the non-reentrant scanner.
2233 * This function is called from parser_lex_destroy(), so don't allocate here.
2234 */
2235
2236 (yy_buffer_stack) = 0;
2237 (yy_buffer_stack_top) = 0;
2238 (yy_buffer_stack_max) = 0;
2239 (yy_c_buf_p) = (char *) 0;
2240 (yy_init) = 0;
2241 (yy_start) = 0;
2242
2243 (yy_start_stack_ptr) = 0;
2244 (yy_start_stack_depth) = 0;
2245 (yy_start_stack) = NULL;
2246
2247 /* Defined in main.c */
2248 #ifdef YY_STDINIT
2249 parser_in = stdin;
2250 parser_out = stdout;
2251 #else
2252 parser_in = (FILE *) 0;
2253 parser_out = (FILE *) 0;
2254 #endif
2255
2256 /* For future reference: Set errno on error, since we are called by
2257 * parser_lex_init()
2258 */
2259 return 0;
2260 }
2261
2262 /* parser_lex_destroy is for both reentrant and non-reentrant scanners. */
2263 int parser_lex_destroy (void)
2264 {
2265
2266 /* Pop the buffer stack, destroying each element. */
2267 while(YY_CURRENT_BUFFER){
2268 parser__delete_buffer(YY_CURRENT_BUFFER );
2269 YY_CURRENT_BUFFER_LVALUE = NULL;
2270 parser_pop_buffer_state();
2271 }
2272
2273 /* Destroy the stack itself. */
2274 parser_free((yy_buffer_stack) );
2275 (yy_buffer_stack) = NULL;
2276
2277 /* Destroy the start condition stack. */
2278 parser_free((yy_start_stack) );
2279 (yy_start_stack) = NULL;
2280
2281 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2282 * parser_lex() is called, initialization will occur. */
2283 yy_init_globals( );
2284
2285 return 0;
2286 }
2287
2288 /*
2289 * Internal utility routines.
2290 */
2291
2292 #ifndef yytext_ptr
2293 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2294 {
2295 register int i;
2296 for ( i = 0; i < n; ++i )
2297 s1[i] = s2[i];
2298 }
2299 #endif
2300
2301 #ifdef YY_NEED_STRLEN
2302 static int yy_flex_strlen (yyconst char * s )
2303 {
2304 register int n;
2305 for ( n = 0; s[n]; ++n )
2306 ;
2307
2308 return n;
2309 }
2310 #endif
2311
2312 void *parser_alloc (yy_size_t size )
2313 {
2314 return (void *) malloc( size );
2315 }
2316
2317 void *parser_realloc (void * ptr, yy_size_t size )
2318 {
2319 /* The cast to (char *) in the following accommodates both
2320 * implementations that use char* generic pointers, and those
2321 * that use void* generic pointers. It works with the latter
2322 * because both ANSI C and C++ allow castless assignment from
2323 * any pointer type to void*, and deal with argument conversions
2324 * as though doing an assignment.
2325 */
2326 return (void *) realloc( (char *) ptr, size );
2327 }
2328
2329 void parser_free (void * ptr )
2330 {
2331 free( (char *) ptr ); /* see parser_realloc() for (char *) cast */
2332 }
2333
2334 #define YYTABLES_NAME "yytables"
2335
2336 #line 213 "parser.l"
2337
2338
2339
2340 #ifndef parser_wrap
2341 int parser_wrap(void)
2342 {
2343 return 1;
2344 }
2345 #endif
2346
2347 struct keyword {
2348 const char *kw;
2349 int token;
2350 };
2351
2352 /* This table MUST be alphabetically sorted on the kw field */
2353 static const struct keyword keywords[] = {
2354 {"FALSE", tFALSE},
2355 {"NULL", tNULL},
2356 {"TRUE", tTRUE},
2357 {"__cdecl", tCDECL},
2358 {"__fastcall", tFASTCALL},
2359 {"__int3264", tINT3264},
2360 {"__int64", tINT64},
2361 {"__pascal", tPASCAL},
2362 {"__stdcall", tSTDCALL},
2363 {"_cdecl", tCDECL},
2364 {"_fastcall", tFASTCALL},
2365 {"_pascal", tPASCAL},
2366 {"_stdcall", tSTDCALL},
2367 {"boolean", tBOOLEAN},
2368 {"byte", tBYTE},
2369 {"case", tCASE},
2370 {"cdecl", tCDECL},
2371 {"char", tCHAR},
2372 {"coclass", tCOCLASS},
2373 {"const", tCONST},
2374 {"cpp_quote", tCPPQUOTE},
2375 {"default", tDEFAULT},
2376 {"dispinterface", tDISPINTERFACE},
2377 {"double", tDOUBLE},
2378 {"enum", tENUM},
2379 {"error_status_t", tERRORSTATUST},
2380 {"extern", tEXTERN},
2381 {"float", tFLOAT},
2382 {"handle_t", tHANDLET},
2383 {"hyper", tHYPER},
2384 {"import", tIMPORT},
2385 {"importlib", tIMPORTLIB},
2386 {"inline", tINLINE},
2387 {"int", tINT},
2388 {"interface", tINTERFACE},
2389 {"library", tLIBRARY},
2390 {"long", tLONG},
2391 {"methods", tMETHODS},
2392 {"module", tMODULE},
2393 {"namespace", tNAMESPACE},
2394 {"pascal", tPASCAL},
2395 {"properties", tPROPERTIES},
2396 {"register", tREGISTER},
2397 {"short", tSHORT},
2398 {"signed", tSIGNED},
2399 {"sizeof", tSIZEOF},
2400 {"small", tSMALL},
2401 {"static", tSTATIC},
2402 {"stdcall", tSTDCALL},
2403 {"struct", tSTRUCT},
2404 {"switch", tSWITCH},
2405 {"typedef", tTYPEDEF},
2406 {"union", tUNION},
2407 {"unsigned", tUNSIGNED},
2408 {"void", tVOID},
2409 {"wchar_t", tWCHAR},
2410 };
2411 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
2412
2413 /* keywords only recognized in attribute lists
2414 * This table MUST be alphabetically sorted on the kw field
2415 */
2416 static const struct keyword attr_keywords[] =
2417 {
2418 {"aggregatable", tAGGREGATABLE},
2419 {"allocate", tALLOCATE},
2420 {"annotation", tANNOTATION},
2421 {"apartment", tAPARTMENT},
2422 {"appobject", tAPPOBJECT},
2423 {"async", tASYNC},
2424 {"async_uuid", tASYNCUUID},
2425 {"auto_handle", tAUTOHANDLE},
2426 {"bindable", tBINDABLE},
2427 {"both", tBOTH},
2428 {"broadcast", tBROADCAST},
2429 {"byte_count", tBYTECOUNT},
2430 {"call_as", tCALLAS},
2431 {"callback", tCALLBACK},
2432 {"code", tCODE},
2433 {"comm_status", tCOMMSTATUS},
2434 {"context_handle", tCONTEXTHANDLE},
2435 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
2436 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
2437 {"control", tCONTROL},
2438 {"decode", tDECODE},
2439 {"defaultbind", tDEFAULTBIND},
2440 {"defaultcollelem", tDEFAULTCOLLELEM},
2441 {"defaultvalue", tDEFAULTVALUE},
2442 {"defaultvtable", tDEFAULTVTABLE},
2443 {"disable_consistency_check", tDISABLECONSISTENCYCHECK},
2444 {"displaybind", tDISPLAYBIND},
2445 {"dllname", tDLLNAME},
2446 {"dual", tDUAL},
2447 {"enable_allocate", tENABLEALLOCATE},
2448 {"encode", tENCODE},
2449 {"endpoint", tENDPOINT},
2450 {"entry", tENTRY},
2451 {"explicit_handle", tEXPLICITHANDLE},
2452 {"fault_status", tFAULTSTATUS},
2453 {"force_allocate", tFORCEALLOCATE},
2454 {"free", tFREE},
2455 {"handle", tHANDLE},
2456 {"helpcontext", tHELPCONTEXT},
2457 {"helpfile", tHELPFILE},
2458 {"helpstring", tHELPSTRING},
2459 {"helpstringcontext", tHELPSTRINGCONTEXT},
2460 {"helpstringdll", tHELPSTRINGDLL},
2461 {"hidden", tHIDDEN},
2462 {"id", tID},
2463 {"idempotent", tIDEMPOTENT},
2464 {"ignore", tIGNORE},
2465 {"iid_is", tIIDIS},
2466 {"immediatebind", tIMMEDIATEBIND},
2467 {"implicit_handle", tIMPLICITHANDLE},
2468 {"in", tIN},
2469 {"in_line", tIN_LINE},
2470 {"input_sync", tINPUTSYNC},
2471 {"lcid", tLCID},
2472 {"length_is", tLENGTHIS},
2473 {"licensed", tLICENSED},
2474 {"local", tLOCAL},
2475 {"maybe", tMAYBE},
2476 {"message", tMESSAGE},
2477 {"neutral", tNEUTRAL},
2478 {"nocode", tNOCODE},
2479 {"nonbrowsable", tNONBROWSABLE},
2480 {"noncreatable", tNONCREATABLE},
2481 {"nonextensible", tNONEXTENSIBLE},
2482 {"notify", tNOTIFY},
2483 {"notify_flag", tNOTIFYFLAG},
2484 {"object", tOBJECT},
2485 {"odl", tODL},
2486 {"oleautomation", tOLEAUTOMATION},
2487 {"optimize", tOPTIMIZE},
2488 {"optional", tOPTIONAL},
2489 {"out", tOUT},
2490 {"partial_ignore", tPARTIALIGNORE},
2491 {"pointer_default", tPOINTERDEFAULT},
2492 {"progid", tPROGID},
2493 {"propget", tPROPGET},
2494 {"propput", tPROPPUT},
2495 {"propputref", tPROPPUTREF},
2496 {"proxy", tPROXY},
2497 {"ptr", tPTR},
2498 {"public", tPUBLIC},
2499 {"range", tRANGE},
2500 {"readonly", tREADONLY},
2501 {"ref", tREF},
2502 {"represent_as", tREPRESENTAS},
2503 {"requestedit", tREQUESTEDIT},
2504 {"restricted", tRESTRICTED},
2505 {"retval", tRETVAL},
2506 {"single", tSINGLE},
2507 {"size_is", tSIZEIS},
2508 {"source", tSOURCE},
2509 {"strict_context_handle", tSTRICTCONTEXTHANDLE},
2510 {"string", tSTRING},
2511 {"switch_is", tSWITCHIS},
2512 {"switch_type", tSWITCHTYPE},
2513 {"threading", tTHREADING},
2514 {"transmit_as", tTRANSMITAS},
2515 {"uidefault", tUIDEFAULT},
2516 {"unique", tUNIQUE},
2517 {"user_marshal", tUSERMARSHAL},
2518 {"usesgetlasterror", tUSESGETLASTERROR},
2519 {"uuid", tUUID},
2520 {"v1_enum", tV1ENUM},
2521 {"vararg", tVARARG},
2522 {"version", tVERSION},
2523 {"vi_progid", tVIPROGID},
2524 {"wire_marshal", tWIREMARSHAL},
2525 };
2526
2527 /* attributes TODO:
2528 custom
2529 first_is
2530 last_is
2531 max_is
2532 min_is
2533 */
2534
2535 #define KWP(p) ((const struct keyword *)(p))
2536
2537 static int kw_cmp_func(const void *s1, const void *s2)
2538 {
2539 return strcmp(KWP(s1)->kw, KWP(s2)->kw);
2540 }
2541
2542 static int kw_token(const char *kw)
2543 {
2544 struct keyword key, *kwp;
2545 key.kw = kw;
2546 kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
2547 if (kwp && (do_rt_extension || kwp->token != tNAMESPACE)) {
2548 parser_lval.str = xstrdup(kwp->kw);
2549 return kwp->token;
2550 }
2551 parser_lval.str = xstrdup(kw);
2552 return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER;
2553 }
2554
2555 static int attr_token(const char *kw)
2556 {
2557 struct keyword key, *kwp;
2558 key.kw = kw;
2559 kwp = bsearch(&key, attr_keywords, sizeof(attr_keywords)/sizeof(attr_keywords[0]),
2560 sizeof(attr_keywords[0]), kw_cmp_func);
2561 if (kwp) {
2562 parser_lval.str = xstrdup(kwp->kw);
2563 return kwp->token;
2564 }
2565 return kw_token(kw);
2566 }
2567
2568 static void addcchar(char c)
2569 {
2570 if(cbufidx >= cbufalloc)
2571 {
2572 cbufalloc += 1024;
2573 cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
2574 if(cbufalloc > 65536)
2575 parser_warning("Reallocating string buffer larger than 64kB\n");
2576 }
2577 cbuffer[cbufidx++] = c;
2578 }
2579
2580 static char *get_buffered_cstring(void)
2581 {
2582 addcchar(0);
2583 return xstrdup(cbuffer);
2584 }
2585
2586 void pop_import(void)
2587 {
2588 int ptr = import_stack_ptr-1;
2589
2590 fclose(parser_in);
2591 parser__delete_buffer(YY_CURRENT_BUFFER );
2592 parser__switch_to_buffer(import_stack[ptr].state );
2593 if (temp_name) {
2594 unlink(temp_name);
2595 free(temp_name);
2596 }
2597 temp_name = import_stack[ptr].temp_name;
2598 input_name = import_stack[ptr].input_name;
2599 line_number = import_stack[ptr].line_number;
2600 import_stack_ptr--;
2601 }
2602
2603 struct imports {
2604 char *name;
2605 struct imports *next;
2606 } *first_import;
2607
2608 int do_import(char *fname)
2609 {
2610 FILE *f;
2611 char *path, *name;
2612 struct imports *import;
2613 int ptr = import_stack_ptr;
2614 int ret, fd;
2615
2616 import = first_import;
2617 while (import && strcmp(import->name, fname))
2618 import = import->next;
2619 if (import) return 0; /* already imported */
2620
2621 import = xmalloc(sizeof(struct imports));
2622 import->name = xstrdup(fname);
2623 import->next = first_import;
2624 first_import = import;
2625
2626 /* don't search for a file name with a path in the include directories,
2627 * for compatibility with MIDL */
2628 if (strchr( fname, '/' ) || strchr( fname, '\\' ))
2629 path = xstrdup( fname );
2630 else if (!(path = wpp_find_include( fname, input_name )))
2631 error_loc("Unable to open include file %s\n", fname);
2632
2633 import_stack[ptr].temp_name = temp_name;
2634 import_stack[ptr].input_name = input_name;
2635 import_stack[ptr].line_number = line_number;
2636 import_stack_ptr++;
2637 input_name = path;
2638 line_number = 1;
2639
2640 name = xstrdup( "widl.XXXXXX" );
2641 if((fd = mkstemps( name, 0 )) == -1)
2642 error("Could not generate a temp name from %s\n", name);
2643
2644 temp_name = name;
2645 if (!(f = fdopen(fd, "wt")))
2646 error("Could not open fd %s for writing\n", name);
2647
2648 ret = wpp_parse( path, f );
2649 fclose( f );
2650 if (ret) exit(1);
2651
2652 if((f = fopen(temp_name, "r")) == NULL)
2653 error_loc("Unable to open %s\n", temp_name);
2654
2655 import_stack[ptr].state = YY_CURRENT_BUFFER;
2656 parser__switch_to_buffer(parser__create_buffer(f,YY_BUF_SIZE));
2657 return 1;
2658 }
2659
2660 void abort_import(void)
2661 {
2662 int ptr;
2663
2664 for (ptr=0; ptr<import_stack_ptr; ptr++)
2665 unlink(import_stack[ptr].temp_name);
2666 }
2667