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