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