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