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