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