2bf33f614bcc7eef440cd8ed029d56b03ed14f45
[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
587 #include <stdio.h>
588 #include <stdlib.h>
589 #include <string.h>
590 #include <ctype.h>
591 #include <assert.h>
592 #include <errno.h>
593 #include <limits.h>
594
595 #ifdef HAVE_UNISTD_H
596 #include <unistd.h>
597 #else
598 #define YY_NO_UNISTD_H
599 #endif
600
601 #include "widl.h"
602 #include "utils.h"
603 #include "parser.h"
604 #include "wine/wpp.h"
605
606 #include "parser.tab.h"
607
608 static void addcchar(char c);
609 static char *get_buffered_cstring(void);
610
611 static char *cbuffer;
612 static int cbufidx;
613 static int cbufalloc = 0;
614
615 static int kw_token(const char *kw);
616 static int attr_token(const char *kw);
617
618 #define MAX_IMPORT_DEPTH 10
619 struct {
620 YY_BUFFER_STATE state;
621 char *input_name;
622 int line_number;
623 char *temp_name;
624 } import_stack[MAX_IMPORT_DEPTH];
625 int import_stack_ptr = 0;
626
627 /* converts an integer in string form to an unsigned long and prints an error
628 * on overflow */
629 static unsigned long xstrtoul(const char *nptr, char **endptr, int base)
630 {
631 unsigned long l;
632
633 errno = 0;
634 l = strtoul(nptr, endptr, base);
635 if (l == ULONG_MAX && errno == ERANGE)
636 error_loc("integer constant %s is too large\n", nptr);
637 return l;
638 }
639
640 UUID *parse_uuid(const char *u)
641 {
642 UUID* uuid = xmalloc(sizeof(UUID));
643 char b[3];
644 /* it would be nice to use UuidFromStringA */
645 uuid->Data1 = strtoul(u, NULL, 16);
646 uuid->Data2 = strtoul(u+9, NULL, 16);
647 uuid->Data3 = strtoul(u+14, NULL, 16);
648 b[2] = 0;
649 memcpy(b, u+19, 2); uuid->Data4[0] = strtoul(b, NULL, 16);
650 memcpy(b, u+21, 2); uuid->Data4[1] = strtoul(b, NULL, 16);
651 memcpy(b, u+24, 2); uuid->Data4[2] = strtoul(b, NULL, 16);
652 memcpy(b, u+26, 2); uuid->Data4[3] = strtoul(b, NULL, 16);
653 memcpy(b, u+28, 2); uuid->Data4[4] = strtoul(b, NULL, 16);
654 memcpy(b, u+30, 2); uuid->Data4[5] = strtoul(b, NULL, 16);
655 memcpy(b, u+32, 2); uuid->Data4[6] = strtoul(b, NULL, 16);
656 memcpy(b, u+34, 2); uuid->Data4[7] = strtoul(b, NULL, 16);
657 return uuid;
658 }
659
660 /*
661 **************************************************************************
662 * The flexer starts here
663 **************************************************************************
664 */
665 #line 666 "parser.yy.c"
666
667 /* Macros after this point can all be overridden by user definitions in
668 * section 1.
669 */
670
671 #ifndef YY_SKIP_YYWRAP
672 #ifdef __cplusplus
673 extern "C" int yywrap YY_PROTO(( void ));
674 #else
675 extern int yywrap YY_PROTO(( void ));
676 #endif
677 #endif
678
679 #ifndef YY_NO_UNPUT
680 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
681 #endif
682
683 #ifndef yytext_ptr
684 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
685 #endif
686
687 #ifdef YY_NEED_STRLEN
688 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
689 #endif
690
691 #ifndef YY_NO_INPUT
692 #ifdef __cplusplus
693 static int yyinput YY_PROTO(( void ));
694 #else
695 static int input YY_PROTO(( void ));
696 #endif
697 #endif
698
699 #if YY_STACK_USED
700 static int yy_start_stack_ptr = 0;
701 static int yy_start_stack_depth = 0;
702 static int *yy_start_stack = 0;
703 #ifndef YY_NO_PUSH_STATE
704 static void yy_push_state YY_PROTO(( int new_state ));
705 #endif
706 #ifndef YY_NO_POP_STATE
707 static void yy_pop_state YY_PROTO(( void ));
708 #endif
709 #ifndef YY_NO_TOP_STATE
710 static int yy_top_state YY_PROTO(( void ));
711 #endif
712
713 #else
714 #define YY_NO_PUSH_STATE 1
715 #define YY_NO_POP_STATE 1
716 #define YY_NO_TOP_STATE 1
717 #endif
718
719 #ifdef YY_MALLOC_DECL
720 YY_MALLOC_DECL
721 #else
722 #if __STDC__
723 #ifndef __cplusplus
724 #include <stdlib.h>
725 #endif
726 #else
727 /* Just try to get by without declaring the routines. This will fail
728 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
729 * or sizeof(void*) != sizeof(int).
730 */
731 #endif
732 #endif
733
734 /* Amount of stuff to slurp up with each read. */
735 #ifndef YY_READ_BUF_SIZE
736 #define YY_READ_BUF_SIZE 8192
737 #endif
738
739 /* Copy whatever the last rule matched to the standard output. */
740
741 #ifndef ECHO
742 /* This used to be an fputs(), but since the string might contain NUL's,
743 * we now use fwrite().
744 */
745 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
746 #endif
747
748 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
749 * is returned in "result".
750 */
751 #ifndef YY_INPUT
752 #define YY_INPUT(buf,result,max_size) \
753 if ( yy_current_buffer->yy_is_interactive ) \
754 { \
755 int c = '*', n; \
756 for ( n = 0; n < max_size && \
757 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
758 buf[n] = (char) c; \
759 if ( c == '\n' ) \
760 buf[n++] = (char) c; \
761 if ( c == EOF && ferror( yyin ) ) \
762 YY_FATAL_ERROR( "input in flex scanner failed" ); \
763 result = n; \
764 } \
765 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
766 && ferror( yyin ) ) \
767 YY_FATAL_ERROR( "input in flex scanner failed" );
768 #endif
769
770 /* No semi-colon after return; correct usage is to write "yyterminate();" -
771 * we don't want an extra ';' after the "return" because that will cause
772 * some compilers to complain about unreachable statements.
773 */
774 #ifndef yyterminate
775 #define yyterminate() return YY_NULL
776 #endif
777
778 /* Number of entries by which start-condition stack grows. */
779 #ifndef YY_START_STACK_INCR
780 #define YY_START_STACK_INCR 25
781 #endif
782
783 /* Report a fatal error. */
784 #ifndef YY_FATAL_ERROR
785 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
786 #endif
787
788 /* Default declaration of generated scanner - a define so the user can
789 * easily add parameters.
790 */
791 #ifndef YY_DECL
792 #define YY_DECL int yylex YY_PROTO(( void ))
793 #endif
794
795 /* Code executed at the beginning of each rule, after yytext and yyleng
796 * have been set up.
797 */
798 #ifndef YY_USER_ACTION
799 #define YY_USER_ACTION
800 #endif
801
802 /* Code executed at the end of each rule. */
803 #ifndef YY_BREAK
804 #define YY_BREAK break;
805 #endif
806
807 #define YY_RULE_SETUP \
808 if ( yyleng > 0 ) \
809 yy_current_buffer->yy_at_bol = \
810 (yytext[yyleng - 1] == '\n'); \
811 YY_USER_ACTION
812
813 YY_DECL
814 {
815 register yy_state_type yy_current_state;
816 register char *yy_cp, *yy_bp;
817 register int yy_act;
818
819 #line 126 "parser.l"
820
821 #line 822 "parser.yy.c"
822
823 if ( yy_init )
824 {
825 yy_init = 0;
826
827 #ifdef YY_USER_INIT
828 YY_USER_INIT;
829 #endif
830
831 if ( ! yy_start )
832 yy_start = 1; /* first start state */
833
834 if ( ! yyin )
835 yyin = stdin;
836
837 if ( ! yyout )
838 yyout = stdout;
839
840 if ( ! yy_current_buffer )
841 yy_current_buffer =
842 yy_create_buffer( yyin, YY_BUF_SIZE );
843
844 yy_load_buffer_state();
845 }
846
847 while ( 1 ) /* loops until end-of-file is reached */
848 {
849 yy_cp = yy_c_buf_p;
850
851 /* Support of yytext. */
852 *yy_cp = yy_hold_char;
853
854 /* yy_bp points to the position in yy_ch_buf of the start of
855 * the current run.
856 */
857 yy_bp = yy_cp;
858
859 yy_current_state = yy_start;
860 yy_current_state += YY_AT_BOL();
861 yy_match:
862 do
863 {
864 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
865 if ( yy_accept[yy_current_state] )
866 {
867 yy_last_accepting_state = yy_current_state;
868 yy_last_accepting_cpos = yy_cp;
869 }
870 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
871 {
872 yy_current_state = (int) yy_def[yy_current_state];
873 if ( yy_current_state >= 148 )
874 yy_c = yy_meta[(unsigned int) yy_c];
875 }
876 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
877 ++yy_cp;
878 }
879 while ( yy_base[yy_current_state] != 481 );
880
881 yy_find_action:
882 yy_act = yy_accept[yy_current_state];
883 if ( yy_act == 0 )
884 { /* have to back up */
885 yy_cp = yy_last_accepting_cpos;
886 yy_current_state = yy_last_accepting_state;
887 yy_act = yy_accept[yy_current_state];
888 }
889
890 YY_DO_BEFORE_ACTION;
891
892
893 do_action: /* This label is used only to access EOF actions. */
894
895
896 switch ( yy_act )
897 { /* beginning of action switch */
898 case 0: /* must back up */
899 /* undo the effects of YY_DO_BEFORE_ACTION */
900 *yy_cp = yy_hold_char;
901 yy_cp = yy_last_accepting_cpos;
902 yy_current_state = yy_last_accepting_state;
903 goto yy_find_action;
904
905 case 1:
906 YY_RULE_SETUP
907 #line 127 "parser.l"
908 yy_push_state(PP_LINE);
909 YY_BREAK
910 case 2:
911 YY_RULE_SETUP
912 #line 128 "parser.l"
913 {
914 int lineno;
915 char *cptr, *fname;
916 yy_pop_state();
917 lineno = (int)strtol(yytext, &cptr, 10);
918 if(!lineno)
919 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
920 fname = strchr(cptr, '"');
921 if(!fname)
922 error_loc("Malformed '#...' line-directive; missing filename\n");
923 fname++;
924 cptr = strchr(fname, '"');
925 if(!cptr)
926 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
927 *cptr = '\0';
928 line_number = lineno - 1; /* We didn't read the newline */
929 free( input_name );
930 input_name = xstrdup(fname);
931 }
932 YY_BREAK
933 case 3:
934 YY_RULE_SETUP
935 #line 147 "parser.l"
936 yy_push_state(QUOTE); cbufidx = 0;
937 YY_BREAK
938 case 4:
939 YY_RULE_SETUP
940 #line 148 "parser.l"
941 {
942 yy_pop_state();
943 parser_lval.str = get_buffered_cstring();
944 return aSTRING;
945 }
946 YY_BREAK
947 case 5:
948 YY_RULE_SETUP
949 #line 153 "parser.l"
950 yy_push_state(WSTRQUOTE);
951 YY_BREAK
952 case 6:
953 YY_RULE_SETUP
954 #line 154 "parser.l"
955 {
956 yy_pop_state();
957 parser_lval.str = get_buffered_cstring();
958 return aWSTRING;
959 }
960 YY_BREAK
961 case 7:
962 YY_RULE_SETUP
963 #line 159 "parser.l"
964 yy_push_state(SQUOTE); cbufidx = 0;
965 YY_BREAK
966 case 8:
967 YY_RULE_SETUP
968 #line 160 "parser.l"
969 {
970 yy_pop_state();
971 parser_lval.str = get_buffered_cstring();
972 return aSQSTRING;
973 }
974 YY_BREAK
975 case 9:
976 #line 166 "parser.l"
977 case 10:
978 YY_RULE_SETUP
979 #line 166 "parser.l"
980 addcchar(yytext[1]);
981 YY_BREAK
982 case 11:
983 YY_RULE_SETUP
984 #line 167 "parser.l"
985 addcchar(yytext[1]);
986 YY_BREAK
987 case 12:
988 YY_RULE_SETUP
989 #line 168 "parser.l"
990 addcchar('\\'); addcchar(yytext[1]);
991 YY_BREAK
992 case 13:
993 YY_RULE_SETUP
994 #line 169 "parser.l"
995 addcchar(yytext[0]);
996 YY_BREAK
997 case 14:
998 YY_RULE_SETUP
999 #line 170 "parser.l"
1000 yy_push_state(ATTR); return '[';
1001 YY_BREAK
1002 case 15:
1003 YY_RULE_SETUP
1004 #line 171 "parser.l"
1005 yy_pop_state(); return ']';
1006 YY_BREAK
1007 case 16:
1008 YY_RULE_SETUP
1009 #line 172 "parser.l"
1010 return attr_token(yytext);
1011 YY_BREAK
1012 case 17:
1013 YY_RULE_SETUP
1014 #line 173 "parser.l"
1015 {
1016 parser_lval.uuid = parse_uuid(yytext);
1017 return aUUID;
1018 }
1019 YY_BREAK
1020 case 18:
1021 YY_RULE_SETUP
1022 #line 177 "parser.l"
1023 {
1024 parser_lval.num = xstrtoul(yytext, NULL, 0);
1025 return aHEXNUM;
1026 }
1027 YY_BREAK
1028 case 19:
1029 YY_RULE_SETUP
1030 #line 181 "parser.l"
1031 {
1032 parser_lval.num = xstrtoul(yytext, NULL, 0);
1033 return aNUM;
1034 }
1035 YY_BREAK
1036 case 20:
1037 YY_RULE_SETUP
1038 #line 185 "parser.l"
1039 {
1040 parser_lval.dbl = strtod(yytext, NULL);
1041 return aDOUBLE;
1042 }
1043 YY_BREAK
1044 case 21:
1045 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
1046 yy_c_buf_p = yy_cp -= 1;
1047 YY_DO_BEFORE_ACTION; /* set up yytext again */
1048 YY_RULE_SETUP
1049 #line 189 "parser.l"
1050 return tSAFEARRAY;
1051 YY_BREAK
1052 case 22:
1053 YY_RULE_SETUP
1054 #line 190 "parser.l"
1055 return kw_token(yytext);
1056 YY_BREAK
1057 case 23:
1058 YY_RULE_SETUP
1059 #line 191 "parser.l"
1060 line_number++;
1061 YY_BREAK
1062 case 24:
1063 YY_RULE_SETUP
1064 #line 192 "parser.l"
1065
1066 YY_BREAK
1067 case 25:
1068 YY_RULE_SETUP
1069 #line 193 "parser.l"
1070 return SHL;
1071 YY_BREAK
1072 case 26:
1073 YY_RULE_SETUP
1074 #line 194 "parser.l"
1075 return SHR;
1076 YY_BREAK
1077 case 27:
1078 YY_RULE_SETUP
1079 #line 195 "parser.l"
1080 return MEMBERPTR;
1081 YY_BREAK
1082 case 28:
1083 YY_RULE_SETUP
1084 #line 196 "parser.l"
1085 return EQUALITY;
1086 YY_BREAK
1087 case 29:
1088 YY_RULE_SETUP
1089 #line 197 "parser.l"
1090 return INEQUALITY;
1091 YY_BREAK
1092 case 30:
1093 YY_RULE_SETUP
1094 #line 198 "parser.l"
1095 return GREATEREQUAL;
1096 YY_BREAK
1097 case 31:
1098 YY_RULE_SETUP
1099 #line 199 "parser.l"
1100 return LESSEQUAL;
1101 YY_BREAK
1102 case 32:
1103 YY_RULE_SETUP
1104 #line 200 "parser.l"
1105 return LOGICALOR;
1106 YY_BREAK
1107 case 33:
1108 YY_RULE_SETUP
1109 #line 201 "parser.l"
1110 return LOGICALAND;
1111 YY_BREAK
1112 case 34:
1113 YY_RULE_SETUP
1114 #line 202 "parser.l"
1115 return ELLIPSIS;
1116 YY_BREAK
1117 case 35:
1118 YY_RULE_SETUP
1119 #line 203 "parser.l"
1120 return yytext[0];
1121 YY_BREAK
1122 case YY_STATE_EOF(INITIAL):
1123 case YY_STATE_EOF(QUOTE):
1124 case YY_STATE_EOF(WSTRQUOTE):
1125 case YY_STATE_EOF(ATTR):
1126 case YY_STATE_EOF(PP_LINE):
1127 case YY_STATE_EOF(SQUOTE):
1128 #line 204 "parser.l"
1129 {
1130 if (import_stack_ptr)
1131 return aEOF;
1132 else yyterminate();
1133 }
1134 YY_BREAK
1135 case 36:
1136 YY_RULE_SETUP
1137 #line 209 "parser.l"
1138 ECHO;
1139 YY_BREAK
1140 #line 1141 "parser.yy.c"
1141
1142 case YY_END_OF_BUFFER:
1143 {
1144 /* Amount of text matched not including the EOB char. */
1145 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1146
1147 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1148 *yy_cp = yy_hold_char;
1149 YY_RESTORE_YY_MORE_OFFSET
1150
1151 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1152 {
1153 /* We're scanning a new file or input source. It's
1154 * possible that this happened because the user
1155 * just pointed yyin at a new source and called
1156 * yylex(). If so, then we have to assure
1157 * consistency between yy_current_buffer and our
1158 * globals. Here is the right place to do so, because
1159 * this is the first action (other than possibly a
1160 * back-up) that will match for the new input source.
1161 */
1162 yy_n_chars = yy_current_buffer->yy_n_chars;
1163 yy_current_buffer->yy_input_file = yyin;
1164 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1165 }
1166
1167 /* Note that here we test for yy_c_buf_p "<=" to the position
1168 * of the first EOB in the buffer, since yy_c_buf_p will
1169 * already have been incremented past the NUL character
1170 * (since all states make transitions on EOB to the
1171 * end-of-buffer state). Contrast this with the test
1172 * in input().
1173 */
1174 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1175 { /* This was really a NUL. */
1176 yy_state_type yy_next_state;
1177
1178 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1179
1180 yy_current_state = yy_get_previous_state();
1181
1182 /* Okay, we're now positioned to make the NUL
1183 * transition. We couldn't have
1184 * yy_get_previous_state() go ahead and do it
1185 * for us because it doesn't know how to deal
1186 * with the possibility of jamming (and we don't
1187 * want to build jamming into it because then it
1188 * will run more slowly).
1189 */
1190
1191 yy_next_state = yy_try_NUL_trans( yy_current_state );
1192
1193 yy_bp = yytext_ptr + YY_MORE_ADJ;
1194
1195 if ( yy_next_state )
1196 {
1197 /* Consume the NUL. */
1198 yy_cp = ++yy_c_buf_p;
1199 yy_current_state = yy_next_state;
1200 goto yy_match;
1201 }
1202
1203 else
1204 {
1205 yy_cp = yy_c_buf_p;
1206 goto yy_find_action;
1207 }
1208 }
1209
1210 else switch ( yy_get_next_buffer() )
1211 {
1212 case EOB_ACT_END_OF_FILE:
1213 {
1214 yy_did_buffer_switch_on_eof = 0;
1215
1216 if ( yywrap() )
1217 {
1218 /* Note: because we've taken care in
1219 * yy_get_next_buffer() to have set up
1220 * yytext, we can now set up
1221 * yy_c_buf_p so that if some total
1222 * hoser (like flex itself) wants to
1223 * call the scanner after we return the
1224 * YY_NULL, it'll still work - another
1225 * YY_NULL will get returned.
1226 */
1227 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1228
1229 yy_act = YY_STATE_EOF(YY_START);
1230 goto do_action;
1231 }
1232
1233 else
1234 {
1235 if ( ! yy_did_buffer_switch_on_eof )
1236 YY_NEW_FILE;
1237 }
1238 break;
1239 }
1240
1241 case EOB_ACT_CONTINUE_SCAN:
1242 yy_c_buf_p =
1243 yytext_ptr + yy_amount_of_matched_text;
1244
1245 yy_current_state = yy_get_previous_state();
1246
1247 yy_cp = yy_c_buf_p;
1248 yy_bp = yytext_ptr + YY_MORE_ADJ;
1249 goto yy_match;
1250
1251 case EOB_ACT_LAST_MATCH:
1252 yy_c_buf_p =
1253 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1254
1255 yy_current_state = yy_get_previous_state();
1256
1257 yy_cp = yy_c_buf_p;
1258 yy_bp = yytext_ptr + YY_MORE_ADJ;
1259 goto yy_find_action;
1260 }
1261 break;
1262 }
1263
1264 default:
1265 YY_FATAL_ERROR(
1266 "fatal flex scanner internal error--no action found" );
1267 } /* end of action switch */
1268 } /* end of scanning one token */
1269 } /* end of yylex */
1270
1271
1272 /* yy_get_next_buffer - try to read in a new buffer
1273 *
1274 * Returns a code representing an action:
1275 * EOB_ACT_LAST_MATCH -
1276 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1277 * EOB_ACT_END_OF_FILE - end of file
1278 */
1279
1280 static int yy_get_next_buffer()
1281 {
1282 register char *dest = yy_current_buffer->yy_ch_buf;
1283 register char *source = yytext_ptr;
1284 register int number_to_move, i;
1285 int ret_val;
1286
1287 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1288 YY_FATAL_ERROR(
1289 "fatal flex scanner internal error--end of buffer missed" );
1290
1291 if ( yy_current_buffer->yy_fill_buffer == 0 )
1292 { /* Don't try to fill the buffer, so this is an EOF. */
1293 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1294 {
1295 /* We matched a single character, the EOB, so
1296 * treat this as a final EOF.
1297 */
1298 return EOB_ACT_END_OF_FILE;
1299 }
1300
1301 else
1302 {
1303 /* We matched some text prior to the EOB, first
1304 * process it.
1305 */
1306 return EOB_ACT_LAST_MATCH;
1307 }
1308 }
1309
1310 /* Try to read more data. */
1311
1312 /* First move last chars to start of buffer. */
1313 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1314
1315 for ( i = 0; i < number_to_move; ++i )
1316 *(dest++) = *(source++);
1317
1318 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1319 /* don't do the read, it's not guaranteed to return an EOF,
1320 * just force an EOF
1321 */
1322 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1323
1324 else
1325 {
1326 int num_to_read =
1327 yy_current_buffer->yy_buf_size - number_to_move - 1;
1328
1329 while ( num_to_read <= 0 )
1330 { /* Not enough room in the buffer - grow it. */
1331 #ifdef YY_USES_REJECT
1332 YY_FATAL_ERROR(
1333 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1334 #else
1335
1336 /* just a shorter name for the current buffer */
1337 YY_BUFFER_STATE b = yy_current_buffer;
1338
1339 int yy_c_buf_p_offset =
1340 (int) (yy_c_buf_p - b->yy_ch_buf);
1341
1342 if ( b->yy_is_our_buffer )
1343 {
1344 int new_size = b->yy_buf_size * 2;
1345
1346 if ( new_size <= 0 )
1347 b->yy_buf_size += b->yy_buf_size / 8;
1348 else
1349 b->yy_buf_size *= 2;
1350
1351 b->yy_ch_buf = (char *)
1352 /* Include room in for 2 EOB chars. */
1353 yy_flex_realloc( (void *) b->yy_ch_buf,
1354 b->yy_buf_size + 2 );
1355 }
1356 else
1357 /* Can't grow it, we don't own it. */
1358 b->yy_ch_buf = 0;
1359
1360 if ( ! b->yy_ch_buf )
1361 YY_FATAL_ERROR(
1362 "fatal error - scanner input buffer overflow" );
1363
1364 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1365
1366 num_to_read = yy_current_buffer->yy_buf_size -
1367 number_to_move - 1;
1368 #endif
1369 }
1370
1371 if ( num_to_read > YY_READ_BUF_SIZE )
1372 num_to_read = YY_READ_BUF_SIZE;
1373
1374 /* Read in more data. */
1375 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1376 yy_n_chars, num_to_read );
1377
1378 yy_current_buffer->yy_n_chars = yy_n_chars;
1379 }
1380
1381 if ( yy_n_chars == 0 )
1382 {
1383 if ( number_to_move == YY_MORE_ADJ )
1384 {
1385 ret_val = EOB_ACT_END_OF_FILE;
1386 yyrestart( yyin );
1387 }
1388
1389 else
1390 {
1391 ret_val = EOB_ACT_LAST_MATCH;
1392 yy_current_buffer->yy_buffer_status =
1393 YY_BUFFER_EOF_PENDING;
1394 }
1395 }
1396
1397 else
1398 ret_val = EOB_ACT_CONTINUE_SCAN;
1399
1400 yy_n_chars += number_to_move;
1401 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1402 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1403
1404 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1405
1406 return ret_val;
1407 }
1408
1409
1410 /* yy_get_previous_state - get the state just before the EOB char was reached */
1411
1412 static yy_state_type yy_get_previous_state()
1413 {
1414 register yy_state_type yy_current_state;
1415 register char *yy_cp;
1416
1417 yy_current_state = yy_start;
1418 yy_current_state += YY_AT_BOL();
1419
1420 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1421 {
1422 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1423 if ( yy_accept[yy_current_state] )
1424 {
1425 yy_last_accepting_state = yy_current_state;
1426 yy_last_accepting_cpos = yy_cp;
1427 }
1428 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1429 {
1430 yy_current_state = (int) yy_def[yy_current_state];
1431 if ( yy_current_state >= 148 )
1432 yy_c = yy_meta[(unsigned int) yy_c];
1433 }
1434 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1435 }
1436
1437 return yy_current_state;
1438 }
1439
1440
1441 /* yy_try_NUL_trans - try to make a transition on the NUL character
1442 *
1443 * synopsis
1444 * next_state = yy_try_NUL_trans( current_state );
1445 */
1446
1447 #ifdef YY_USE_PROTOS
1448 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1449 #else
1450 static yy_state_type yy_try_NUL_trans( yy_current_state )
1451 yy_state_type yy_current_state;
1452 #endif
1453 {
1454 register int yy_is_jam;
1455 register char *yy_cp = yy_c_buf_p;
1456
1457 register YY_CHAR yy_c = 1;
1458 if ( yy_accept[yy_current_state] )
1459 {
1460 yy_last_accepting_state = yy_current_state;
1461 yy_last_accepting_cpos = yy_cp;
1462 }
1463 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1464 {
1465 yy_current_state = (int) yy_def[yy_current_state];
1466 if ( yy_current_state >= 148 )
1467 yy_c = yy_meta[(unsigned int) yy_c];
1468 }
1469 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1470 yy_is_jam = (yy_current_state == 147);
1471
1472 return yy_is_jam ? 0 : yy_current_state;
1473 }
1474
1475
1476 #ifndef YY_NO_UNPUT
1477 #ifdef YY_USE_PROTOS
1478 static void yyunput( int c, register char *yy_bp )
1479 #else
1480 static void yyunput( c, yy_bp )
1481 int c;
1482 register char *yy_bp;
1483 #endif
1484 {
1485 register char *yy_cp = yy_c_buf_p;
1486
1487 /* undo effects of setting up yytext */
1488 *yy_cp = yy_hold_char;
1489
1490 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1491 { /* need to shift things up to make room */
1492 /* +2 for EOB chars. */
1493 register int number_to_move = yy_n_chars + 2;
1494 register char *dest = &yy_current_buffer->yy_ch_buf[
1495 yy_current_buffer->yy_buf_size + 2];
1496 register char *source =
1497 &yy_current_buffer->yy_ch_buf[number_to_move];
1498
1499 while ( source > yy_current_buffer->yy_ch_buf )
1500 *--dest = *--source;
1501
1502 yy_cp += (int) (dest - source);
1503 yy_bp += (int) (dest - source);
1504 yy_current_buffer->yy_n_chars =
1505 yy_n_chars = yy_current_buffer->yy_buf_size;
1506
1507 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1508 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1509 }
1510
1511 *--yy_cp = (char) c;
1512
1513
1514 yytext_ptr = yy_bp;
1515 yy_hold_char = *yy_cp;
1516 yy_c_buf_p = yy_cp;
1517 }
1518 #endif /* ifndef YY_NO_UNPUT */
1519
1520
1521 #ifdef __cplusplus
1522 static int yyinput()
1523 #else
1524 static int input()
1525 #endif
1526 {
1527 int c;
1528
1529 *yy_c_buf_p = yy_hold_char;
1530
1531 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1532 {
1533 /* yy_c_buf_p now points to the character we want to return.
1534 * If this occurs *before* the EOB characters, then it's a
1535 * valid NUL; if not, then we've hit the end of the buffer.
1536 */
1537 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1538 /* This was really a NUL. */
1539 *yy_c_buf_p = '\0';
1540
1541 else
1542 { /* need more input */
1543 int offset = yy_c_buf_p - yytext_ptr;
1544 ++yy_c_buf_p;
1545
1546 switch ( yy_get_next_buffer() )
1547 {
1548 case EOB_ACT_LAST_MATCH:
1549 /* This happens because yy_g_n_b()
1550 * sees that we've accumulated a
1551 * token and flags that we need to
1552 * try matching the token before
1553 * proceeding. But for input(),
1554 * there's no matching to consider.
1555 * So convert the EOB_ACT_LAST_MATCH
1556 * to EOB_ACT_END_OF_FILE.
1557 */
1558
1559 /* Reset buffer status. */
1560 yyrestart( yyin );
1561
1562 /* fall through */
1563
1564 case EOB_ACT_END_OF_FILE:
1565 {
1566 if ( yywrap() )
1567 return EOF;
1568
1569 if ( ! yy_did_buffer_switch_on_eof )
1570 YY_NEW_FILE;
1571 #ifdef __cplusplus
1572 return yyinput();
1573 #else
1574 return input();
1575 #endif
1576 }
1577
1578 case EOB_ACT_CONTINUE_SCAN:
1579 yy_c_buf_p = yytext_ptr + offset;
1580 break;
1581 }
1582 }
1583 }
1584
1585 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1586 *yy_c_buf_p = '\0'; /* preserve yytext */
1587 yy_hold_char = *++yy_c_buf_p;
1588
1589 yy_current_buffer->yy_at_bol = (c == '\n');
1590
1591 return c;
1592 }
1593
1594
1595 #ifdef YY_USE_PROTOS
1596 void yyrestart( FILE *input_file )
1597 #else
1598 void yyrestart( input_file )
1599 FILE *input_file;
1600 #endif
1601 {
1602 if ( ! yy_current_buffer )
1603 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1604
1605 yy_init_buffer( yy_current_buffer, input_file );
1606 yy_load_buffer_state();
1607 }
1608
1609
1610 #ifdef YY_USE_PROTOS
1611 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1612 #else
1613 void yy_switch_to_buffer( new_buffer )
1614 YY_BUFFER_STATE new_buffer;
1615 #endif
1616 {
1617 if ( yy_current_buffer == new_buffer )
1618 return;
1619
1620 if ( yy_current_buffer )
1621 {
1622 /* Flush out information for old buffer. */
1623 *yy_c_buf_p = yy_hold_char;
1624 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1625 yy_current_buffer->yy_n_chars = yy_n_chars;
1626 }
1627
1628 yy_current_buffer = new_buffer;
1629 yy_load_buffer_state();
1630
1631 /* We don't actually know whether we did this switch during
1632 * EOF (yywrap()) processing, but the only time this flag
1633 * is looked at is after yywrap() is called, so it's safe
1634 * to go ahead and always set it.
1635 */
1636 yy_did_buffer_switch_on_eof = 1;
1637 }
1638
1639
1640 #ifdef YY_USE_PROTOS
1641 void yy_load_buffer_state( void )
1642 #else
1643 void yy_load_buffer_state()
1644 #endif
1645 {
1646 yy_n_chars = yy_current_buffer->yy_n_chars;
1647 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1648 yyin = yy_current_buffer->yy_input_file;
1649 yy_hold_char = *yy_c_buf_p;
1650 }
1651
1652
1653 #ifdef YY_USE_PROTOS
1654 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1655 #else
1656 YY_BUFFER_STATE yy_create_buffer( file, size )
1657 FILE *file;
1658 int size;
1659 #endif
1660 {
1661 YY_BUFFER_STATE b;
1662
1663 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1664 if ( ! b )
1665 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1666
1667 b->yy_buf_size = size;
1668
1669 /* yy_ch_buf has to be 2 characters longer than the size given because
1670 * we need to put in 2 end-of-buffer characters.
1671 */
1672 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1673 if ( ! b->yy_ch_buf )
1674 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1675
1676 b->yy_is_our_buffer = 1;
1677
1678 yy_init_buffer( b, file );
1679
1680 return b;
1681 }
1682
1683
1684 #ifdef YY_USE_PROTOS
1685 void yy_delete_buffer( YY_BUFFER_STATE b )
1686 #else
1687 void yy_delete_buffer( b )
1688 YY_BUFFER_STATE b;
1689 #endif
1690 {
1691 if ( ! b )
1692 return;
1693
1694 if ( b == yy_current_buffer )
1695 yy_current_buffer = (YY_BUFFER_STATE) 0;
1696
1697 if ( b->yy_is_our_buffer )
1698 yy_flex_free( (void *) b->yy_ch_buf );
1699
1700 yy_flex_free( (void *) b );
1701 }
1702
1703
1704 #ifndef YY_ALWAYS_INTERACTIVE
1705 #ifndef YY_NEVER_INTERACTIVE
1706 extern int isatty YY_PROTO(( int ));
1707 #endif
1708 #endif
1709
1710 #ifdef YY_USE_PROTOS
1711 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1712 #else
1713 void yy_init_buffer( b, file )
1714 YY_BUFFER_STATE b;
1715 FILE *file;
1716 #endif
1717
1718
1719 {
1720 yy_flush_buffer( b );
1721
1722 b->yy_input_file = file;
1723 b->yy_fill_buffer = 1;
1724
1725 #if YY_ALWAYS_INTERACTIVE
1726 b->yy_is_interactive = 1;
1727 #else
1728 #if YY_NEVER_INTERACTIVE
1729 b->yy_is_interactive = 0;
1730 #else
1731 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1732 #endif
1733 #endif
1734 }
1735
1736
1737 #ifdef YY_USE_PROTOS
1738 void yy_flush_buffer( YY_BUFFER_STATE b )
1739 #else
1740 void yy_flush_buffer( b )
1741 YY_BUFFER_STATE b;
1742 #endif
1743
1744 {
1745 if ( ! b )
1746 return;
1747
1748 b->yy_n_chars = 0;
1749
1750 /* We always need two end-of-buffer characters. The first causes
1751 * a transition to the end-of-buffer state. The second causes
1752 * a jam in that state.
1753 */
1754 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1755 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1756
1757 b->yy_buf_pos = &b->yy_ch_buf[0];
1758
1759 b->yy_at_bol = 1;
1760 b->yy_buffer_status = YY_BUFFER_NEW;
1761
1762 if ( b == yy_current_buffer )
1763 yy_load_buffer_state();
1764 }
1765
1766
1767 #ifndef YY_NO_SCAN_BUFFER
1768 #ifdef YY_USE_PROTOS
1769 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1770 #else
1771 YY_BUFFER_STATE yy_scan_buffer( base, size )
1772 char *base;
1773 yy_size_t size;
1774 #endif
1775 {
1776 YY_BUFFER_STATE b;
1777
1778 if ( size < 2 ||
1779 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1780 base[size-1] != YY_END_OF_BUFFER_CHAR )
1781 /* They forgot to leave room for the EOB's. */
1782 return 0;
1783
1784 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1785 if ( ! b )
1786 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1787
1788 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1789 b->yy_buf_pos = b->yy_ch_buf = base;
1790 b->yy_is_our_buffer = 0;
1791 b->yy_input_file = 0;
1792 b->yy_n_chars = b->yy_buf_size;
1793 b->yy_is_interactive = 0;
1794 b->yy_at_bol = 1;
1795 b->yy_fill_buffer = 0;
1796 b->yy_buffer_status = YY_BUFFER_NEW;
1797
1798 yy_switch_to_buffer( b );
1799
1800 return b;
1801 }
1802 #endif
1803
1804
1805 #ifndef YY_NO_SCAN_STRING
1806 #ifdef YY_USE_PROTOS
1807 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1808 #else
1809 YY_BUFFER_STATE yy_scan_string( yy_str )
1810 yyconst char *yy_str;
1811 #endif
1812 {
1813 int len;
1814 for ( len = 0; yy_str[len]; ++len )
1815 ;
1816
1817 return yy_scan_bytes( yy_str, len );
1818 }
1819 #endif
1820
1821
1822 #ifndef YY_NO_SCAN_BYTES
1823 #ifdef YY_USE_PROTOS
1824 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1825 #else
1826 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1827 yyconst char *bytes;
1828 int len;
1829 #endif
1830 {
1831 YY_BUFFER_STATE b;
1832 char *buf;
1833 yy_size_t n;
1834 int i;
1835
1836 /* Get memory for full buffer, including space for trailing EOB's. */
1837 n = len + 2;
1838 buf = (char *) yy_flex_alloc( n );
1839 if ( ! buf )
1840 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1841
1842 for ( i = 0; i < len; ++i )
1843 buf[i] = bytes[i];
1844
1845 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1846
1847 b = yy_scan_buffer( buf, n );
1848 if ( ! b )
1849 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1850
1851 /* It's okay to grow etc. this buffer, and we should throw it
1852 * away when we're done.
1853 */
1854 b->yy_is_our_buffer = 1;
1855
1856 return b;
1857 }
1858 #endif
1859
1860
1861 #ifndef YY_NO_PUSH_STATE
1862 #ifdef YY_USE_PROTOS
1863 static void yy_push_state( int new_state )
1864 #else
1865 static void yy_push_state( new_state )
1866 int new_state;
1867 #endif
1868 {
1869 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1870 {
1871 yy_size_t new_size;
1872
1873 yy_start_stack_depth += YY_START_STACK_INCR;
1874 new_size = yy_start_stack_depth * sizeof( int );
1875
1876 if ( ! yy_start_stack )
1877 yy_start_stack = (int *) yy_flex_alloc( new_size );
1878
1879 else
1880 yy_start_stack = (int *) yy_flex_realloc(
1881 (void *) yy_start_stack, new_size );
1882
1883 if ( ! yy_start_stack )
1884 YY_FATAL_ERROR(
1885 "out of memory expanding start-condition stack" );
1886 }
1887
1888 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1889
1890 BEGIN(new_state);
1891 }
1892 #endif
1893
1894
1895 #ifndef YY_NO_POP_STATE
1896 static void yy_pop_state()
1897 {
1898 if ( --yy_start_stack_ptr < 0 )
1899 YY_FATAL_ERROR( "start-condition stack underflow" );
1900
1901 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1902 }
1903 #endif
1904
1905
1906 #ifndef YY_NO_TOP_STATE
1907 static int yy_top_state()
1908 {
1909 return yy_start_stack[yy_start_stack_ptr - 1];
1910 }
1911 #endif
1912
1913 #ifndef YY_EXIT_FAILURE
1914 #define YY_EXIT_FAILURE 2
1915 #endif
1916
1917 #ifdef YY_USE_PROTOS
1918 static void yy_fatal_error( yyconst char msg[] )
1919 #else
1920 static void yy_fatal_error( msg )
1921 char msg[];
1922 #endif
1923 {
1924 (void) fprintf( stderr, "%s\n", msg );
1925 exit( YY_EXIT_FAILURE );
1926 }
1927
1928
1929
1930 /* Redefine yyless() so it works in section 3 code. */
1931
1932 #undef yyless
1933 #define yyless(n) \
1934 do \
1935 { \
1936 /* Undo effects of setting up yytext. */ \
1937 yytext[yyleng] = yy_hold_char; \
1938 yy_c_buf_p = yytext + n; \
1939 yy_hold_char = *yy_c_buf_p; \
1940 *yy_c_buf_p = '\0'; \
1941 yyleng = n; \
1942 } \
1943 while ( 0 )
1944
1945
1946 /* Internal utility routines. */
1947
1948 #ifndef yytext_ptr
1949 #ifdef YY_USE_PROTOS
1950 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1951 #else
1952 static void yy_flex_strncpy( s1, s2, n )
1953 char *s1;
1954 yyconst char *s2;
1955 int n;
1956 #endif
1957 {
1958 register int i;
1959 for ( i = 0; i < n; ++i )
1960 s1[i] = s2[i];
1961 }
1962 #endif
1963
1964 #ifdef YY_NEED_STRLEN
1965 #ifdef YY_USE_PROTOS
1966 static int yy_flex_strlen( yyconst char *s )
1967 #else
1968 static int yy_flex_strlen( s )
1969 yyconst char *s;
1970 #endif
1971 {
1972 register int n;
1973 for ( n = 0; s[n]; ++n )
1974 ;
1975
1976 return n;
1977 }
1978 #endif
1979
1980
1981 #ifdef YY_USE_PROTOS
1982 static void *yy_flex_alloc( yy_size_t size )
1983 #else
1984 static void *yy_flex_alloc( size )
1985 yy_size_t size;
1986 #endif
1987 {
1988 return (void *) malloc( size );
1989 }
1990
1991 #ifdef YY_USE_PROTOS
1992 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1993 #else
1994 static void *yy_flex_realloc( ptr, size )
1995 void *ptr;
1996 yy_size_t size;
1997 #endif
1998 {
1999 /* The cast to (char *) in the following accommodates both
2000 * implementations that use char* generic pointers, and those
2001 * that use void* generic pointers. It works with the latter
2002 * because both ANSI C and C++ allow castless assignment from
2003 * any pointer type to void*, and deal with argument conversions
2004 * as though doing an assignment.
2005 */
2006 return (void *) realloc( (char *) ptr, size );
2007 }
2008
2009 #ifdef YY_USE_PROTOS
2010 static void yy_flex_free( void *ptr )
2011 #else
2012 static void yy_flex_free( ptr )
2013 void *ptr;
2014 #endif
2015 {
2016 free( ptr );
2017 }
2018
2019 #if YY_MAIN
2020 int main()
2021 {
2022 yylex();
2023 return 0;
2024 }
2025 #endif
2026 #line 209 "parser.l"
2027
2028
2029 #ifndef parser_wrap
2030 int parser_wrap(void)
2031 {
2032 return 1;
2033 }
2034 #endif
2035
2036 struct keyword {
2037 const char *kw;
2038 int token;
2039 };
2040
2041 /* This table MUST be alphabetically sorted on the kw field */
2042 static const struct keyword keywords[] = {
2043 {"FALSE", tFALSE},
2044 {"NULL", tNULL},
2045 {"TRUE", tTRUE},
2046 {"__cdecl", tCDECL},
2047 {"__fastcall", tFASTCALL},
2048 {"__int3264", tINT3264},
2049 {"__int64", tINT64},
2050 {"__pascal", tPASCAL},
2051 {"__stdcall", tSTDCALL},
2052 {"_cdecl", tCDECL},
2053 {"_fastcall", tFASTCALL},
2054 {"_pascal", tPASCAL},
2055 {"_stdcall", tSTDCALL},
2056 {"boolean", tBOOLEAN},
2057 {"byte", tBYTE},
2058 {"case", tCASE},
2059 {"cdecl", tCDECL},
2060 {"char", tCHAR},
2061 {"coclass", tCOCLASS},
2062 {"const", tCONST},
2063 {"cpp_quote", tCPPQUOTE},
2064 {"default", tDEFAULT},
2065 {"dispinterface", tDISPINTERFACE},
2066 {"double", tDOUBLE},
2067 {"enum", tENUM},
2068 {"error_status_t", tERRORSTATUST},
2069 {"extern", tEXTERN},
2070 {"float", tFLOAT},
2071 {"handle_t", tHANDLET},
2072 {"hyper", tHYPER},
2073 {"import", tIMPORT},
2074 {"importlib", tIMPORTLIB},
2075 {"inline", tINLINE},
2076 {"int", tINT},
2077 {"interface", tINTERFACE},
2078 {"library", tLIBRARY},
2079 {"long", tLONG},
2080 {"methods", tMETHODS},
2081 {"module", tMODULE},
2082 {"pascal", tPASCAL},
2083 {"properties", tPROPERTIES},
2084 {"register", tREGISTER},
2085 {"short", tSHORT},
2086 {"signed", tSIGNED},
2087 {"sizeof", tSIZEOF},
2088 {"small", tSMALL},
2089 {"static", tSTATIC},
2090 {"stdcall", tSTDCALL},
2091 {"struct", tSTRUCT},
2092 {"switch", tSWITCH},
2093 {"typedef", tTYPEDEF},
2094 {"union", tUNION},
2095 {"unsigned", tUNSIGNED},
2096 {"void", tVOID},
2097 {"wchar_t", tWCHAR},
2098 };
2099 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
2100
2101 /* keywords only recognized in attribute lists
2102 * This table MUST be alphabetically sorted on the kw field
2103 */
2104 static const struct keyword attr_keywords[] =
2105 {
2106 {"aggregatable", tAGGREGATABLE},
2107 {"allocate", tALLOCATE},
2108 {"annotation", tANNOTATION},
2109 {"appobject", tAPPOBJECT},
2110 {"async", tASYNC},
2111 {"async_uuid", tASYNCUUID},
2112 {"auto_handle", tAUTOHANDLE},
2113 {"bindable", tBINDABLE},
2114 {"broadcast", tBROADCAST},
2115 {"byte_count", tBYTECOUNT},
2116 {"call_as", tCALLAS},
2117 {"callback", tCALLBACK},
2118 {"code", tCODE},
2119 {"comm_status", tCOMMSTATUS},
2120 {"context_handle", tCONTEXTHANDLE},
2121 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
2122 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
2123 {"control", tCONTROL},
2124 {"defaultcollelem", tDEFAULTCOLLELEM},
2125 {"defaultvalue", tDEFAULTVALUE},
2126 {"defaultvtable", tDEFAULTVTABLE},
2127 {"displaybind", tDISPLAYBIND},
2128 {"dllname", tDLLNAME},
2129 {"dual", tDUAL},
2130 {"endpoint", tENDPOINT},
2131 {"entry", tENTRY},
2132 {"explicit_handle", tEXPLICITHANDLE},
2133 {"handle", tHANDLE},
2134 {"helpcontext", tHELPCONTEXT},
2135 {"helpfile", tHELPFILE},
2136 {"helpstring", tHELPSTRING},
2137 {"helpstringcontext", tHELPSTRINGCONTEXT},
2138 {"helpstringdll", tHELPSTRINGDLL},
2139 {"hidden", tHIDDEN},
2140 {"id", tID},
2141 {"idempotent", tIDEMPOTENT},
2142 {"iid_is", tIIDIS},
2143 {"immediatebind", tIMMEDIATEBIND},
2144 {"implicit_handle", tIMPLICITHANDLE},
2145 {"in", tIN},
2146 {"in_line", tIN_LINE},
2147 {"input_sync", tINPUTSYNC},
2148 {"lcid", tLCID},
2149 {"length_is", tLENGTHIS},
2150 {"local", tLOCAL},
2151 {"nonbrowsable", tNONBROWSABLE},
2152 {"noncreatable", tNONCREATABLE},
2153 {"nonextensible", tNONEXTENSIBLE},
2154 {"object", tOBJECT},
2155 {"odl", tODL},
2156 {"oleautomation", tOLEAUTOMATION},
2157 {"optional", tOPTIONAL},
2158 {"out", tOUT},
2159 {"pointer_default", tPOINTERDEFAULT},
2160 {"propget", tPROPGET},
2161 {"propput", tPROPPUT},
2162 {"propputref", tPROPPUTREF},
2163 {"ptr", tPTR},
2164 {"public", tPUBLIC},
2165 {"range", tRANGE},
2166 {"readonly", tREADONLY},
2167 {"ref", tREF},
2168 {"requestedit", tREQUESTEDIT},
2169 {"restricted", tRESTRICTED},
2170 {"retval", tRETVAL},
2171 {"size_is", tSIZEIS},
2172 {"source", tSOURCE},
2173 {"strict_context_handle", tSTRICTCONTEXTHANDLE},
2174 {"string", tSTRING},
2175 {"switch_is", tSWITCHIS},
2176 {"switch_type", tSWITCHTYPE},
2177 {"transmit_as", tTRANSMITAS},
2178 {"unique", tUNIQUE},
2179 {"uuid", tUUID},
2180 {"v1_enum", tV1ENUM},
2181 {"vararg", tVARARG},
2182 {"version", tVERSION},
2183 {"wire_marshal", tWIREMARSHAL},
2184 };
2185
2186
2187 #define KWP(p) ((const struct keyword *)(p))
2188
2189 static int kw_cmp_func(const void *s1, const void *s2)
2190 {
2191 return strcmp(KWP(s1)->kw, KWP(s2)->kw);
2192 }
2193
2194 static int kw_token(const char *kw)
2195 {
2196 struct keyword key, *kwp;
2197 key.kw = kw;
2198 kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
2199 if (kwp) {
2200 parser_lval.str = xstrdup(kwp->kw);
2201 return kwp->token;
2202 }
2203 parser_lval.str = xstrdup(kw);
2204 return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER;
2205 }
2206
2207 static int attr_token(const char *kw)
2208 {
2209 struct keyword key, *kwp;
2210 key.kw = kw;
2211 kwp = bsearch(&key, attr_keywords, sizeof(attr_keywords)/sizeof(attr_keywords[0]),
2212 sizeof(attr_keywords[0]), kw_cmp_func);
2213 if (kwp) {
2214 parser_lval.str = xstrdup(kwp->kw);
2215 return kwp->token;
2216 }
2217 return kw_token(kw);
2218 }
2219
2220 static void addcchar(char c)
2221 {
2222 if(cbufidx >= cbufalloc)
2223 {
2224 cbufalloc += 1024;
2225 cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
2226 if(cbufalloc > 65536)
2227 parser_warning("Reallocating string buffer larger than 64kB\n");
2228 }
2229 cbuffer[cbufidx++] = c;
2230 }
2231
2232 static char *get_buffered_cstring(void)
2233 {
2234 addcchar(0);
2235 return xstrdup(cbuffer);
2236 }
2237
2238 void pop_import(void)
2239 {
2240 int ptr = import_stack_ptr-1;
2241
2242 fclose(yyin);
2243 yy_delete_buffer( YY_CURRENT_BUFFER );
2244 yy_switch_to_buffer( import_stack[ptr].state );
2245 if (temp_name) {
2246 unlink(temp_name);
2247 free(temp_name);
2248 }
2249 temp_name = import_stack[ptr].temp_name;
2250 input_name = import_stack[ptr].input_name;
2251 line_number = import_stack[ptr].line_number;
2252 import_stack_ptr--;
2253 }
2254
2255 struct imports {
2256 char *name;
2257 struct imports *next;
2258 } *first_import;
2259
2260 int do_import(char *fname)
2261 {
2262 FILE *f;
2263 char *path;
2264 struct imports *import;
2265 int ptr = import_stack_ptr;
2266 int ret;
2267
2268 import = first_import;
2269 while (import && strcmp(import->name, fname))
2270 import = import->next;
2271 if (import) return 0; /* already imported */
2272
2273 import = xmalloc(sizeof(struct imports));
2274 import->name = xstrdup(fname);
2275 import->next = first_import;
2276 first_import = import;
2277
2278 /* don't search for a file name with a path in the include directories,
2279 * for compatibility with MIDL */
2280 if (strchr( fname, '/' ) || strchr( fname, '\\' ))
2281 path = strdup( fname );
2282 else if (!(path = wpp_find_include( fname, input_name )))
2283 error_loc("Unable to open include file %s\n", fname);
2284
2285 import_stack[ptr].temp_name = temp_name;
2286 import_stack[ptr].input_name = input_name;
2287 import_stack[ptr].line_number = line_number;
2288 import_stack_ptr++;
2289 input_name = path;
2290 line_number = 1;
2291
2292 ret = wpp_parse_temp( path, NULL, &temp_name );
2293 if (ret) exit(1);
2294
2295 if((f = fopen(temp_name, "r")) == NULL)
2296 error_loc("Unable to open %s\n", temp_name);
2297
2298 import_stack[ptr].state = YY_CURRENT_BUFFER;
2299 yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
2300 return 1;
2301 }
2302
2303 void abort_import(void)
2304 {
2305 int ptr;
2306
2307 for (ptr=0; ptr<import_stack_ptr; ptr++)
2308 unlink(import_stack[ptr].temp_name);
2309 }