5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
9 #define yy_create_buffer parser__create_buffer
10 #define yy_delete_buffer parser__delete_buffer
11 #define yy_flex_debug parser__flex_debug
12 #define yy_init_buffer parser__init_buffer
13 #define yy_flush_buffer parser__flush_buffer
14 #define yy_load_buffer_state parser__load_buffer_state
15 #define yy_switch_to_buffer parser__switch_to_buffer
16 #define yyin parser_in
17 #define yyleng parser_leng
18 #define yylex parser_lex
19 #define yylineno parser_lineno
20 #define yyout parser_out
21 #define yyrestart parser_restart
22 #define yytext parser_text
23 #define yywrap parser_wrap
24 #define yyalloc parser_alloc
25 #define yyrealloc parser_realloc
26 #define yyfree parser_free
29 #define YY_FLEX_MAJOR_VERSION 2
30 #define YY_FLEX_MINOR_VERSION 5
31 #define YY_FLEX_SUBMINOR_VERSION 35
32 #if YY_FLEX_SUBMINOR_VERSION > 0
36 /* First, we deal with platform-specific or compiler-specific issues. */
38 /* begin standard C headers. */
44 /* end standard C headers. */
46 /* flex integer type definitions */
51 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
53 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
55 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56 * if you want the limit (max/min) macros for int types.
58 #ifndef __STDC_LIMIT_MACROS
59 #define __STDC_LIMIT_MACROS 1
63 typedef int8_t flex_int8_t
;
64 typedef uint8_t flex_uint8_t
;
65 typedef int16_t flex_int16_t
;
66 typedef uint16_t flex_uint16_t
;
67 typedef int32_t flex_int32_t
;
68 typedef uint32_t flex_uint32_t
;
70 typedef signed char flex_int8_t
;
71 typedef short int flex_int16_t
;
72 typedef int flex_int32_t
;
73 typedef unsigned char flex_uint8_t
;
74 typedef unsigned short int flex_uint16_t
;
75 typedef unsigned int flex_uint32_t
;
77 /* Limits of integral types. */
79 #define INT8_MIN (-128)
82 #define INT16_MIN (-32767-1)
85 #define INT32_MIN (-2147483647-1)
88 #define INT8_MAX (127)
91 #define INT16_MAX (32767)
94 #define INT32_MAX (2147483647)
97 #define UINT8_MAX (255U)
100 #define UINT16_MAX (65535U)
103 #define UINT32_MAX (4294967295U)
108 #endif /* ! FLEXINT_H */
112 /* The "const" storage-class-modifier is valid. */
115 #else /* ! __cplusplus */
117 /* C99 requires __STDC__ to be defined as 1. */
118 #if defined (__STDC__)
122 #endif /* defined (__STDC__) */
123 #endif /* ! __cplusplus */
126 #define yyconst const
131 /* Returned upon end-of-file. */
134 /* Promotes a possibly negative, possibly signed char to an unsigned
135 * integer for use as an array index. If the signed char is negative,
136 * we want to instead treat it as an 8-bit unsigned char, hence the
139 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
141 /* Enter a start condition. This macro really ought to take a parameter,
142 * but we do it the disgusting crufty way forced on us by the ()-less
143 * definition of BEGIN.
145 #define BEGIN (yy_start) = 1 + 2 *
147 /* Translate the current start state into a value that can be later handed
148 * to BEGIN to return to the state. The YYSTATE alias is for lex
151 #define YY_START (((yy_start) - 1) / 2)
152 #define YYSTATE YY_START
154 /* Action number for EOF rule of a given start state. */
155 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
157 /* Special action meaning "start processing a new file". */
158 #define YY_NEW_FILE parser_restart(parser_in )
160 #define YY_END_OF_BUFFER_CHAR 0
162 /* Size of default input buffer. */
165 /* On IA-64, the buffer size is 16k, not 8k.
166 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
167 * Ditto for the __ia64__ case accordingly.
169 #define YY_BUF_SIZE 32768
171 #define YY_BUF_SIZE 16384
172 #endif /* __ia64__ */
175 /* The state buf must be large enough to hold one state per character in the main buffer.
177 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
179 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
180 #define YY_TYPEDEF_YY_BUFFER_STATE
181 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
184 extern int parser_leng
;
186 extern FILE *parser_in
, *parser_out
;
188 #define EOB_ACT_CONTINUE_SCAN 0
189 #define EOB_ACT_END_OF_FILE 1
190 #define EOB_ACT_LAST_MATCH 2
192 #define YY_LESS_LINENO(n)
194 /* Return all but the first "n" matched characters back to the input stream. */
198 /* Undo effects of setting up parser_text. */ \
199 int yyless_macro_arg = (n); \
200 YY_LESS_LINENO(yyless_macro_arg);\
201 *yy_cp = (yy_hold_char); \
202 YY_RESTORE_YY_MORE_OFFSET \
203 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
204 YY_DO_BEFORE_ACTION; /* set up parser_text again */ \
208 #define unput(c) yyunput( c, (yytext_ptr) )
210 #ifndef YY_TYPEDEF_YY_SIZE_T
211 #define YY_TYPEDEF_YY_SIZE_T
212 typedef size_t yy_size_t
;
215 #ifndef YY_STRUCT_YY_BUFFER_STATE
216 #define YY_STRUCT_YY_BUFFER_STATE
217 struct yy_buffer_state
221 char *yy_ch_buf
; /* input buffer */
222 char *yy_buf_pos
; /* current position in input buffer */
224 /* Size of input buffer in bytes, not including room for EOB
227 yy_size_t yy_buf_size
;
229 /* Number of characters read into yy_ch_buf, not including EOB
234 /* Whether we "own" the buffer - i.e., we know we created it,
235 * and can realloc() it to grow it, and should free() it to
238 int yy_is_our_buffer
;
240 /* Whether this is an "interactive" input source; if so, and
241 * if we're using stdio for input, then we want to use getc()
242 * instead of fread(), to make sure we stop fetching input after
245 int yy_is_interactive
;
247 /* Whether we're considered to be at the beginning of a line.
248 * If so, '^' rules will be active on the next match, otherwise
253 int yy_bs_lineno
; /**< The line count. */
254 int yy_bs_column
; /**< The column count. */
256 /* Whether to try to fill the input buffer when we reach the
261 int yy_buffer_status
;
263 #define YY_BUFFER_NEW 0
264 #define YY_BUFFER_NORMAL 1
265 /* When an EOF's been seen but there's still some text to process
266 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
267 * shouldn't try reading from the input source any more. We might
268 * still have a bunch of tokens to match, though, because of
269 * possible backing-up.
271 * When we actually see the EOF, we change the status to "new"
272 * (via parser_restart()), so that the user can continue scanning by
273 * just pointing parser_in at a new input file.
275 #define YY_BUFFER_EOF_PENDING 2
278 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
280 /* Stack of input buffers. */
281 static size_t yy_buffer_stack_top
= 0; /**< index of top of stack. */
282 static size_t yy_buffer_stack_max
= 0; /**< capacity of stack. */
283 static YY_BUFFER_STATE
* yy_buffer_stack
= 0; /**< Stack as an array. */
285 /* We provide macros for accessing buffer states in case in the
286 * future we want to put the buffer states in a more general
289 * Returns the top of the stack, or NULL.
291 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
292 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
295 /* Same as previous macro, but useful when we know that the buffer stack is not
296 * NULL or when we need an lvalue. For internal use only.
298 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
300 /* yy_hold_char holds the character lost when parser_text is formed. */
301 static char yy_hold_char
;
302 static int yy_n_chars
; /* number of characters read into yy_ch_buf */
305 /* Points to current character in buffer. */
306 static char *yy_c_buf_p
= (char *) 0;
307 static int yy_init
= 0; /* whether we need to initialize */
308 static int yy_start
= 0; /* start state number */
310 /* Flag which is used to allow parser_wrap()'s to do buffer switches
311 * instead of setting up a fresh parser_in. A bit of a hack ...
313 static int yy_did_buffer_switch_on_eof
;
315 void parser_restart (FILE *input_file
);
316 void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer
);
317 YY_BUFFER_STATE
parser__create_buffer (FILE *file
,int size
);
318 void parser__delete_buffer (YY_BUFFER_STATE b
);
319 void parser__flush_buffer (YY_BUFFER_STATE b
);
320 void parser_push_buffer_state (YY_BUFFER_STATE new_buffer
);
321 void parser_pop_buffer_state (void );
323 static void parser_ensure_buffer_stack (void );
324 static void parser__load_buffer_state (void );
325 static void parser__init_buffer (YY_BUFFER_STATE b
,FILE *file
);
327 #define YY_FLUSH_BUFFER parser__flush_buffer(YY_CURRENT_BUFFER )
329 YY_BUFFER_STATE
parser__scan_buffer (char *base
,yy_size_t size
);
330 YY_BUFFER_STATE
parser__scan_string (yyconst
char *yy_str
);
331 YY_BUFFER_STATE
parser__scan_bytes (yyconst
char *bytes
,int len
);
333 void *parser_alloc (yy_size_t
);
334 void *parser_realloc (void *,yy_size_t
);
335 void parser_free (void * );
337 #define yy_new_buffer parser__create_buffer
339 #define yy_set_interactive(is_interactive) \
341 if ( ! YY_CURRENT_BUFFER ){ \
342 parser_ensure_buffer_stack (); \
343 YY_CURRENT_BUFFER_LVALUE = \
344 parser__create_buffer(parser_in,YY_BUF_SIZE ); \
346 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
349 #define yy_set_bol(at_bol) \
351 if ( ! YY_CURRENT_BUFFER ){\
352 parser_ensure_buffer_stack (); \
353 YY_CURRENT_BUFFER_LVALUE = \
354 parser__create_buffer(parser_in,YY_BUF_SIZE ); \
356 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
359 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
361 /* Begin user sect3 */
363 typedef unsigned char YY_CHAR
;
365 FILE *parser_in
= (FILE *) 0, *parser_out
= (FILE *) 0;
367 typedef int yy_state_type
;
369 extern int parser_lineno
;
371 int parser_lineno
= 1;
373 extern char *parser_text
;
374 #define yytext_ptr parser_text
376 static yy_state_type
yy_get_previous_state (void );
377 static yy_state_type
yy_try_NUL_trans (yy_state_type current_state
);
378 static int yy_get_next_buffer (void );
379 static void yy_fatal_error (yyconst
char msg
[] );
381 /* Done after the current pattern has been matched and before the
382 * corresponding action - sets up parser_text.
384 #define YY_DO_BEFORE_ACTION \
385 (yytext_ptr) = yy_bp; \
386 parser_leng = (size_t) (yy_cp - yy_bp); \
387 (yy_hold_char) = *yy_cp; \
389 (yy_c_buf_p) = yy_cp;
391 #define YY_NUM_RULES 40
392 #define YY_END_OF_BUFFER 41
393 /* This struct is not used in this scanner,
394 but its presence is necessary. */
397 flex_int32_t yy_verify
;
400 static yyconst flex_int16_t yy_accept
[180] =
402 0, 0, 0, 0, 0, 0, 0, 0, 3, 3,
403 6, 6, 0, 0, 41, 39, 28, 27, 39, 7,
404 39, 11, 39, 39, 23, 23, 39, 39, 39, 26,
405 26, 26, 18, 39, 28, 2, 17, 40, 8, 17,
406 10, 23, 23, 20, 20, 20, 19, 28, 2, 3,
407 6, 6, 6, 12, 17, 33, 37, 31, 0, 0,
408 23, 23, 23, 0, 29, 35, 32, 34, 30, 26,
409 9, 26, 36, 0, 2, 2, 0, 16, 14, 13,
410 23, 0, 20, 20, 0, 2, 2, 3, 6, 6,
411 6, 15, 38, 24, 23, 23, 22, 26, 0, 23,
413 0, 20, 6, 6, 0, 22, 22, 26, 0, 23,
414 0, 20, 6, 6, 0, 24, 22, 22, 26, 0,
415 23, 0, 20, 6, 5, 26, 0, 23, 0, 20,
416 6, 5, 26, 0, 23, 0, 20, 6, 26, 1,
417 23, 0, 20, 6, 26, 0, 23, 4, 0, 25,
418 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
419 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
420 0, 0, 0, 0, 0, 0, 0, 21, 0
423 static yyconst flex_int32_t yy_ec
[256] =
425 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
426 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
429 1, 1, 10, 1, 11, 12, 1, 13, 14, 14,
430 14, 14, 14, 14, 14, 14, 14, 1, 1, 15,
431 16, 17, 1, 1, 18, 19, 19, 19, 20, 21,
432 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
433 22, 24, 25, 22, 26, 22, 22, 27, 28, 22,
434 29, 30, 31, 1, 32, 1, 33, 19, 34, 35,
436 36, 19, 37, 38, 39, 22, 22, 40, 41, 42,
437 43, 44, 22, 45, 22, 46, 47, 22, 48, 49,
438 22, 22, 1, 50, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
440 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
441 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
442 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
443 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
450 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455 static yyconst flex_int32_t yy_meta
[51] =
457 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
458 1, 1, 3, 3, 1, 1, 1, 3, 3, 3,
459 3, 4, 4, 4, 4, 4, 4, 4, 1, 1,
460 1, 4, 3, 3, 3, 3, 4, 4, 4, 4,
461 4, 4, 4, 4, 4, 4, 4, 4, 4, 1
464 static yyconst flex_int16_t yy_base
[221] =
466 0, 49, 49, 53, 54, 57, 87, 59, 335, 334,
467 135, 136, 137, 138, 335, 674, 674, 674, 318, 674,
468 326, 674, 315, 319, 173, 135, 48, 314, 50, 0,
469 323, 305, 674, 272, 66, 148, 674, 674, 674, 48,
470 674, 210, 115, 247, 0, 316, 674, 67, 315, 0,
471 0, 277, 275, 674, 135, 674, 674, 674, 301, 57,
472 167, 125, 129, 0, 674, 674, 674, 674, 674, 0,
473 674, 289, 674, 74, 151, 153, 264, 674, 674, 674,
474 271, 0, 306, 0, 75, 306, 299, 0, 0, 264,
475 256, 674, 674, 189, 674, 674, 131, 276, 262, 330,
477 0, 365, 253, 243, 149, 144, 133, 269, 249, 389,
478 0, 424, 247, 232, 61, 191, 674, 674, 253, 235,
479 448, 0, 483, 239, 0, 250, 240, 507, 0, 542,
480 238, 0, 253, 268, 566, 0, 601, 231, 236, 261,
481 289, 251, 247, 213, 192, 0, 348, 0, 206, 674,
482 0, 0, 0, 0, 244, 0, 0, 0, 0, 243,
483 0, 0, 0, 0, 242, 0, 0, 0, 0, 0,
484 0, 0, 0, 0, 0, 0, 0, 674, 674, 637,
485 641, 645, 647, 651, 653, 657, 661, 249, 248, 246,
486 245, 244, 665, 239, 238, 237, 669, 236, 235, 232,
488 231, 229, 223, 218, 216, 215, 214, 213, 209, 207,
489 203, 195, 186, 185, 171, 163, 141, 83, 82, 79
492 static yyconst flex_int16_t yy_def
[221] =
494 179, 1, 180, 180, 180, 180, 179, 7, 181, 181,
495 182, 182, 180, 180, 179, 179, 179, 179, 179, 179,
496 179, 179, 179, 179, 179, 179, 179, 179, 179, 183,
497 183, 183, 179, 179, 179, 179, 179, 179, 179, 184,
498 179, 179, 42, 185, 185, 185, 179, 179, 179, 186,
499 187, 187, 187, 179, 184, 179, 179, 179, 179, 179,
500 179, 179, 179, 188, 179, 179, 179, 179, 179, 183,
501 179, 183, 179, 179, 179, 179, 179, 179, 179, 179,
502 179, 189, 185, 185, 179, 179, 179, 186, 187, 187,
503 187, 179, 179, 179, 179, 179, 188, 183, 179, 179,
505 190, 185, 187, 187, 179, 179, 179, 183, 179, 179,
506 191, 185, 187, 187, 179, 179, 179, 179, 183, 179,
507 179, 192, 185, 187, 193, 183, 179, 179, 194, 185,
508 187, 193, 183, 179, 179, 195, 185, 187, 183, 179,
509 179, 179, 185, 187, 183, 196, 179, 197, 179, 179,
510 198, 197, 199, 200, 179, 201, 202, 203, 204, 179,
511 205, 206, 207, 208, 179, 209, 210, 211, 212, 213,
512 214, 215, 216, 217, 218, 219, 220, 179, 0, 179,
513 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
514 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
516 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
517 179, 179, 179, 179, 179, 179, 179, 179, 179, 179
520 static yyconst flex_int16_t yy_nxt
[725] =
522 16, 17, 18, 19, 20, 16, 21, 22, 16, 16,
523 23, 24, 25, 26, 27, 28, 29, 30, 30, 30,
524 30, 30, 31, 30, 32, 30, 30, 30, 33, 16,
525 16, 30, 30, 30, 30, 30, 30, 30, 30, 30,
526 30, 30, 30, 30, 30, 30, 30, 30, 30, 34,
527 35, 38, 79, 39, 36, 38, 38, 39, 41, 38,
528 48, 41, 65, 66, 49, 68, 69, 74, 85, 94,
529 94, 75, 86, 116, 116, 74, 85, 80, 40, 75,
530 86, 178, 40, 40, 177, 176, 40, 16, 17, 18,
531 19, 20, 16, 21, 22, 16, 16, 23, 24, 42,
533 43, 27, 28, 29, 44, 44, 44, 44, 45, 46,
534 45, 45, 45, 45, 45, 33, 16, 47, 45, 44,
535 44, 44, 44, 45, 45, 45, 45, 45, 45, 45,
536 45, 45, 45, 45, 45, 45, 34, 38, 38, 38,
537 38, 179, 92, 175, 54, 54, 60, 61, 61, 76,
538 95, 96, 76, 106, 76, 118, 107, 62, 115, 115,
539 63, 116, 116, 179, 80, 174, 55, 55, 96, 117,
540 106, 95, 118, 173, 62, 52, 52, 107, 60, 61,
541 61, 63, 53, 53, 60, 61, 61, 172, 171, 62,
542 117, 77, 63, 149, 77, 62, 77, 170, 63, 64,
544 150, 94, 94, 116, 116, 169, 62, 149, 105, 168,
545 105, 167, 62, 63, 150, 165, 164, 163, 162, 63,
546 160, 64, 81, 81, 105, 159, 105, 82, 82, 82,
547 82, 158, 62, 157, 155, 63, 64, 154, 153, 151,
548 142, 136, 82, 82, 82, 82, 129, 122, 111, 62,
549 101, 97, 166, 161, 156, 148, 63, 146, 64, 83,
550 83, 146, 140, 145, 83, 83, 83, 83, 144, 140,
551 139, 138, 134, 133, 131, 127, 126, 125, 124, 83,
552 83, 83, 83, 100, 100, 120, 119, 114, 101, 101,
553 101, 101, 113, 62, 109, 108, 63, 104, 103, 146,
555 87, 147, 147, 101, 101, 101, 101, 87, 99, 98,
556 62, 62, 93, 91, 63, 90, 87, 63, 102, 102,
557 71, 73, 72, 102, 102, 102, 102, 71, 62, 67,
558 59, 58, 57, 56, 179, 63, 38, 38, 102, 102,
559 102, 102, 110, 110, 179, 179, 179, 111, 111, 111,
560 111, 179, 62, 179, 179, 63, 179, 179, 179, 179,
561 147, 147, 111, 111, 111, 111, 179, 179, 179, 62,
562 62, 179, 179, 63, 179, 179, 63, 112, 112, 179,
563 179, 179, 112, 112, 112, 112, 179, 62, 179, 179,
564 179, 179, 179, 179, 63, 179, 179, 112, 112, 112,
566 112, 121, 121, 179, 179, 179, 122, 122, 122, 122,
567 179, 62, 179, 179, 63, 179, 179, 179, 179, 179,
568 179, 122, 122, 122, 122, 179, 179, 179, 62, 179,
569 179, 179, 179, 179, 179, 63, 123, 123, 179, 179,
570 179, 123, 123, 123, 123, 179, 179, 179, 179, 179,
571 179, 179, 179, 179, 179, 179, 123, 123, 123, 123,
572 128, 128, 179, 179, 179, 129, 129, 129, 129, 179,
573 62, 179, 179, 63, 179, 179, 179, 179, 179, 179,
574 129, 129, 129, 129, 179, 179, 179, 62, 179, 179,
575 179, 179, 179, 179, 63, 130, 130, 179, 179, 179,
577 130, 130, 130, 130, 179, 179, 179, 179, 179, 179,
578 179, 179, 179, 179, 179, 130, 130, 130, 130, 135,
579 135, 179, 179, 179, 136, 136, 136, 136, 179, 62,
580 179, 179, 63, 179, 179, 179, 179, 179, 179, 136,
581 136, 136, 136, 179, 179, 179, 62, 179, 179, 179,
582 179, 179, 179, 63, 137, 137, 179, 179, 179, 137,
583 137, 137, 137, 179, 179, 179, 179, 179, 179, 179,
584 179, 179, 179, 179, 137, 137, 137, 137, 141, 141,
585 179, 179, 179, 142, 142, 142, 142, 179, 62, 179,
586 179, 63, 179, 179, 179, 179, 179, 179, 142, 142,
588 142, 142, 179, 179, 179, 62, 179, 179, 179, 179,
589 179, 179, 63, 143, 143, 179, 179, 179, 143, 143,
590 143, 143, 179, 179, 179, 179, 179, 179, 179, 179,
591 179, 179, 179, 143, 143, 143, 143, 37, 37, 37,
592 37, 50, 50, 50, 50, 51, 51, 51, 51, 70,
593 70, 78, 179, 78, 78, 84, 84, 88, 179, 88,
594 88, 89, 179, 89, 89, 132, 179, 132, 132, 152,
595 179, 152, 152, 15, 179, 179, 179, 179, 179, 179,
596 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
597 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
599 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
600 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
604 static yyconst flex_int16_t yy_chk
[725] =
606 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
607 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
608 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
609 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
610 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
611 2, 3, 40, 3, 2, 4, 5, 4, 5, 6,
612 8, 6, 27, 27, 8, 29, 29, 35, 48, 60,
613 60, 35, 48, 115, 115, 74, 85, 40, 3, 74,
614 85, 220, 4, 5, 219, 218, 6, 7, 7, 7,
615 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
617 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
618 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
619 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
620 7, 7, 7, 7, 7, 7, 7, 11, 12, 13,
621 14, 43, 55, 217, 13, 14, 26, 26, 26, 36,
622 62, 63, 75, 97, 76, 107, 97, 26, 105, 105,
623 26, 105, 105, 43, 55, 216, 13, 14, 63, 106,
624 97, 62, 107, 215, 26, 11, 12, 97, 61, 61,
625 61, 26, 11, 12, 25, 25, 25, 214, 213, 61,
626 106, 36, 61, 145, 75, 25, 76, 212, 25, 25,
628 145, 94, 94, 116, 116, 211, 61, 149, 94, 210,
629 116, 209, 25, 61, 149, 208, 207, 206, 205, 25,
630 204, 25, 42, 42, 94, 203, 116, 42, 42, 42,
631 42, 202, 42, 201, 200, 42, 42, 199, 198, 196,
632 195, 194, 42, 42, 42, 42, 192, 191, 190, 42,
633 189, 188, 165, 160, 155, 144, 42, 143, 42, 44,
634 44, 142, 140, 139, 44, 44, 44, 44, 138, 134,
635 133, 131, 127, 126, 124, 120, 119, 114, 113, 44,
636 44, 44, 44, 81, 81, 109, 108, 104, 81, 81,
637 81, 81, 103, 81, 99, 98, 81, 91, 90, 141,
639 87, 141, 141, 81, 81, 81, 81, 86, 77, 72,
640 81, 141, 59, 53, 141, 52, 49, 81, 83, 83,
641 46, 34, 32, 83, 83, 83, 83, 31, 141, 28,
642 24, 23, 21, 19, 15, 141, 10, 9, 83, 83,
643 83, 83, 100, 100, 0, 0, 0, 100, 100, 100,
644 100, 0, 100, 0, 0, 100, 0, 0, 0, 0,
645 147, 147, 100, 100, 100, 100, 0, 0, 0, 100,
646 147, 0, 0, 147, 0, 0, 100, 102, 102, 0,
647 0, 0, 102, 102, 102, 102, 0, 147, 0, 0,
648 0, 0, 0, 0, 147, 0, 0, 102, 102, 102,
650 102, 110, 110, 0, 0, 0, 110, 110, 110, 110,
651 0, 110, 0, 0, 110, 0, 0, 0, 0, 0,
652 0, 110, 110, 110, 110, 0, 0, 0, 110, 0,
653 0, 0, 0, 0, 0, 110, 112, 112, 0, 0,
654 0, 112, 112, 112, 112, 0, 0, 0, 0, 0,
655 0, 0, 0, 0, 0, 0, 112, 112, 112, 112,
656 121, 121, 0, 0, 0, 121, 121, 121, 121, 0,
657 121, 0, 0, 121, 0, 0, 0, 0, 0, 0,
658 121, 121, 121, 121, 0, 0, 0, 121, 0, 0,
659 0, 0, 0, 0, 121, 123, 123, 0, 0, 0,
661 123, 123, 123, 123, 0, 0, 0, 0, 0, 0,
662 0, 0, 0, 0, 0, 123, 123, 123, 123, 128,
663 128, 0, 0, 0, 128, 128, 128, 128, 0, 128,
664 0, 0, 128, 0, 0, 0, 0, 0, 0, 128,
665 128, 128, 128, 0, 0, 0, 128, 0, 0, 0,
666 0, 0, 0, 128, 130, 130, 0, 0, 0, 130,
667 130, 130, 130, 0, 0, 0, 0, 0, 0, 0,
668 0, 0, 0, 0, 130, 130, 130, 130, 135, 135,
669 0, 0, 0, 135, 135, 135, 135, 0, 135, 0,
670 0, 135, 0, 0, 0, 0, 0, 0, 135, 135,
672 135, 135, 0, 0, 0, 135, 0, 0, 0, 0,
673 0, 0, 135, 137, 137, 0, 0, 0, 137, 137,
674 137, 137, 0, 0, 0, 0, 0, 0, 0, 0,
675 0, 0, 0, 137, 137, 137, 137, 180, 180, 180,
676 180, 181, 181, 181, 181, 182, 182, 182, 182, 183,
677 183, 184, 0, 184, 184, 185, 185, 186, 0, 186,
678 186, 187, 0, 187, 187, 193, 0, 193, 193, 197,
679 0, 197, 197, 179, 179, 179, 179, 179, 179, 179,
680 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
681 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
683 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
684 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
688 static yy_state_type yy_last_accepting_state
;
689 static char *yy_last_accepting_cpos
;
691 extern int parser__flex_debug
;
692 int parser__flex_debug
= 0;
694 /* The intent behind this definition is that it'll catch
695 * any uses of REJECT which flex missed.
697 #define REJECT reject_used_but_not_detected
698 #define yymore() yymore_used_but_not_detected
699 #define YY_MORE_ADJ 0
700 #define YY_RESTORE_YY_MORE_OFFSET
706 * Copyright 2002 Ove Kaaven
708 * This library is free software; you can redistribute it and/or
709 * modify it under the terms of the GNU Lesser General Public
710 * License as published by the Free Software Foundation; either
711 * version 2.1 of the License, or (at your option) any later version.
713 * This library is distributed in the hope that it will be useful,
714 * but WITHOUT ANY WARRANTY; without even the implied warranty of
715 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
716 * Lesser General Public License for more details.
718 * You should have received a copy of the GNU Lesser General Public
719 * License along with this library; if not, write to the Free Software
720 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
722 #define YY_NO_INPUT 1
732 #include "wine/port.h"
745 #define YY_NO_UNISTD_H
751 #include "wine/wpp.h"
753 #include "parser.tab.h"
755 static void addcchar(char c
);
756 static char *get_buffered_cstring(void);
758 static char *cbuffer
;
760 static int cbufalloc
= 0;
762 static int kw_token(const char *kw
);
763 static int attr_token(const char *kw
);
765 #define MAX_IMPORT_DEPTH 10
767 YY_BUFFER_STATE state
;
771 } import_stack
[MAX_IMPORT_DEPTH
];
772 int import_stack_ptr
= 0;
774 /* converts an integer in string form to an unsigned long and prints an error
776 static unsigned int xstrtoul(const char *nptr
, char **endptr
, int base
)
781 val
= strtoul(nptr
, endptr
, base
);
782 if ((val
== ULONG_MAX
&& errno
== ERANGE
) || ((unsigned int)val
!= val
))
783 error_loc("integer constant %s is too large\n", nptr
);
787 UUID
*parse_uuid(const char *u
)
789 UUID
* uuid
= xmalloc(sizeof(UUID
));
791 /* it would be nice to use UuidFromStringA */
792 uuid
->Data1
= strtoul(u
, NULL
, 16);
793 uuid
->Data2
= strtoul(u
+9, NULL
, 16);
794 uuid
->Data3
= strtoul(u
+14, NULL
, 16);
796 memcpy(b
, u
+19, 2); uuid
->Data4
[0] = strtoul(b
, NULL
, 16);
797 memcpy(b
, u
+21, 2); uuid
->Data4
[1] = strtoul(b
, NULL
, 16);
798 memcpy(b
, u
+24, 2); uuid
->Data4
[2] = strtoul(b
, NULL
, 16);
799 memcpy(b
, u
+26, 2); uuid
->Data4
[3] = strtoul(b
, NULL
, 16);
800 memcpy(b
, u
+28, 2); uuid
->Data4
[4] = strtoul(b
, NULL
, 16);
801 memcpy(b
, u
+30, 2); uuid
->Data4
[5] = strtoul(b
, NULL
, 16);
802 memcpy(b
, u
+32, 2); uuid
->Data4
[6] = strtoul(b
, NULL
, 16);
803 memcpy(b
, u
+34, 2); uuid
->Data4
[7] = strtoul(b
, NULL
, 16);
808 **************************************************************************
809 * The flexer starts here
810 **************************************************************************
812 #line 813 "parser.yy.c"
822 #ifndef YY_NO_UNISTD_H
823 /* Special case for "unistd.h", since it is non-ANSI. We include it way
824 * down here because we want the user's section 1 to have been scanned first.
825 * The user has a chance to override it with an option.
830 #ifndef YY_EXTRA_TYPE
831 #define YY_EXTRA_TYPE void *
834 static int yy_init_globals (void );
836 /* Accessor methods to globals.
837 These are made visible to non-reentrant scanners for convenience. */
839 int parser_lex_destroy (void );
841 int parser_get_debug (void );
843 void parser_set_debug (int debug_flag
);
845 YY_EXTRA_TYPE
parser_get_extra (void );
847 void parser_set_extra (YY_EXTRA_TYPE user_defined
);
849 FILE *parser_get_in (void );
851 void parser_set_in (FILE * in_str
);
853 FILE *parser_get_out (void );
855 void parser_set_out (FILE * out_str
);
857 int parser_get_leng (void );
859 char *parser_get_text (void );
861 int parser_get_lineno (void );
863 void parser_set_lineno (int line_number
);
865 /* Macros after this point can all be overridden by user definitions in
869 #ifndef YY_SKIP_YYWRAP
871 extern "C" int parser_wrap (void );
873 extern int parser_wrap (void );
878 static void yy_flex_strncpy (char *,yyconst
char *,int );
881 #ifdef YY_NEED_STRLEN
882 static int yy_flex_strlen (yyconst
char * );
888 static int yyinput (void );
890 static int input (void );
895 static int yy_start_stack_ptr
= 0;
896 static int yy_start_stack_depth
= 0;
897 static int *yy_start_stack
= NULL
;
899 static void yy_push_state (int new_state
);
901 static void yy_pop_state (void );
903 /* Amount of stuff to slurp up with each read. */
904 #ifndef YY_READ_BUF_SIZE
906 /* On IA-64, the buffer size is 16k, not 8k */
907 #define YY_READ_BUF_SIZE 16384
909 #define YY_READ_BUF_SIZE 8192
910 #endif /* __ia64__ */
913 /* Copy whatever the last rule matched to the standard output. */
915 /* This used to be an fputs(), but since the string might contain NUL's,
916 * we now use fwrite().
918 #define ECHO do { if (fwrite( parser_text, parser_leng, 1, parser_out )) {} } while (0)
921 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
922 * is returned in "result".
925 #define YY_INPUT(buf,result,max_size) \
926 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
930 for ( n = 0; n < max_size && \
931 (c = getc( parser_in )) != EOF && c != '\n'; ++n ) \
934 buf[n++] = (char) c; \
935 if ( c == EOF && ferror( parser_in ) ) \
936 YY_FATAL_ERROR( "input in flex scanner failed" ); \
942 while ( (result = fread(buf, 1, max_size, parser_in))==0 && ferror(parser_in)) \
944 if( errno != EINTR) \
946 YY_FATAL_ERROR( "input in flex scanner failed" ); \
950 clearerr(parser_in); \
957 /* No semi-colon after return; correct usage is to write "yyterminate();" -
958 * we don't want an extra ';' after the "return" because that will cause
959 * some compilers to complain about unreachable statements.
962 #define yyterminate() return YY_NULL
965 /* Number of entries by which start-condition stack grows. */
966 #ifndef YY_START_STACK_INCR
967 #define YY_START_STACK_INCR 25
970 /* Report a fatal error. */
971 #ifndef YY_FATAL_ERROR
972 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
975 /* end tables serialization structures and prototypes */
977 /* Default declaration of generated scanner - a define so the user can
978 * easily add parameters.
981 #define YY_DECL_IS_OURS 1
983 extern int parser_lex (void);
985 #define YY_DECL int parser_lex (void)
986 #endif /* !YY_DECL */
988 /* Code executed at the beginning of each rule, after parser_text and parser_leng
991 #ifndef YY_USER_ACTION
992 #define YY_USER_ACTION
995 /* Code executed at the end of each rule. */
997 #define YY_BREAK break;
1000 #define YY_RULE_SETUP \
1001 if ( parser_leng > 0 ) \
1002 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1003 (parser_text[parser_leng - 1] == '\n'); \
1006 /** The main scanner function which does all the work.
1010 register yy_state_type yy_current_state
;
1011 register char *yy_cp
, *yy_bp
;
1012 register int yy_act
;
1014 #line 128 "parser.l"
1016 #line 1017 "parser.yy.c"
1027 (yy_start
) = 1; /* first start state */
1033 parser_out
= stdout
;
1035 if ( ! YY_CURRENT_BUFFER
) {
1036 parser_ensure_buffer_stack ();
1037 YY_CURRENT_BUFFER_LVALUE
=
1038 parser__create_buffer(parser_in
,YY_BUF_SIZE
);
1041 parser__load_buffer_state( );
1044 while ( 1 ) /* loops until end-of-file is reached */
1046 yy_cp
= (yy_c_buf_p
);
1048 /* Support of parser_text. */
1049 *yy_cp
= (yy_hold_char
);
1051 /* yy_bp points to the position in yy_ch_buf of the start of
1056 yy_current_state
= (yy_start
);
1057 yy_current_state
+= YY_AT_BOL();
1061 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
1062 if ( yy_accept
[yy_current_state
] )
1064 (yy_last_accepting_state
) = yy_current_state
;
1065 (yy_last_accepting_cpos
) = yy_cp
;
1067 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1069 yy_current_state
= (int) yy_def
[yy_current_state
];
1070 if ( yy_current_state
>= 180 )
1071 yy_c
= yy_meta
[(unsigned int) yy_c
];
1073 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1076 while ( yy_current_state
!= 179 );
1077 yy_cp
= (yy_last_accepting_cpos
);
1078 yy_current_state
= (yy_last_accepting_state
);
1081 yy_act
= yy_accept
[yy_current_state
];
1083 YY_DO_BEFORE_ACTION
;
1085 do_action
: /* This label is used only to access EOF actions. */
1088 { /* beginning of action switch */
1089 case 0: /* must back up */
1090 /* undo the effects of YY_DO_BEFORE_ACTION */
1091 *yy_cp
= (yy_hold_char
);
1092 yy_cp
= (yy_last_accepting_cpos
);
1093 yy_current_state
= (yy_last_accepting_state
);
1094 goto yy_find_action
;
1098 #line 129 "parser.l"
1099 yy_push_state(PP_PRAGMA
);
1103 #line 130 "parser.l"
1104 yy_push_state(PP_LINE
);
1108 #line 131 "parser.l"
1113 lineno
= (int)strtol(parser_text
, &cptr
, 10);
1115 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
1116 fname
= strchr(cptr
, '"');
1118 error_loc("Malformed '#...' line-directive; missing filename\n");
1120 cptr
= strchr(fname
, '"');
1122 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
1124 line_number
= lineno
- 1; /* We didn't read the newline */
1125 input_name
= xstrdup(fname
);
1130 #line 149 "parser.l"
1131 yyless(9); yy_pop_state(); return tCPPQUOTE
;
1135 #line 150 "parser.l"
1137 if(import_stack_ptr
) {
1139 error_loc("winrt IDL file imported in non-winrt mode\n");
1141 const char *ptr
= parser_text
+5;
1145 while(isspace(*ptr
))
1147 if(!strncmp(ptr
, "ns_prefix", 9) && (!*(ptr
+= 9) || isspace(*ptr
)))
1148 use_abi_namespace
= TRUE
;
1155 #line 166 "parser.l"
1156 parser_lval
.str
= xstrdup(parser_text
); yy_pop_state(); return aPRAGMA
;
1160 #line 167 "parser.l"
1161 yy_push_state(QUOTE
); cbufidx
= 0;
1165 #line 168 "parser.l"
1168 parser_lval
.str
= get_buffered_cstring();
1174 #line 173 "parser.l"
1175 yy_push_state(WSTRQUOTE
); cbufidx
= 0;
1179 #line 174 "parser.l"
1182 parser_lval
.str
= get_buffered_cstring();
1188 #line 179 "parser.l"
1189 yy_push_state(SQUOTE
); cbufidx
= 0;
1193 #line 180 "parser.l"
1196 parser_lval
.str
= get_buffered_cstring();
1201 #line 186 "parser.l"
1204 #line 186 "parser.l"
1205 addcchar(parser_text
[1]);
1209 #line 187 "parser.l"
1210 addcchar(parser_text
[1]);
1214 #line 188 "parser.l"
1215 addcchar('\\'); addcchar(parser_text
[1]);
1219 #line 189 "parser.l"
1220 addcchar(parser_text
[0]);
1224 #line 190 "parser.l"
1225 yy_push_state(ATTR
); return '[';
1229 #line 191 "parser.l"
1230 yy_pop_state(); return ']';
1234 #line 192 "parser.l"
1235 return attr_token(parser_text
);
1239 #line 193 "parser.l"
1241 parser_lval
.uuid
= parse_uuid(parser_text
);
1247 #line 197 "parser.l"
1249 parser_lval
.num
= xstrtoul(parser_text
, NULL
, 0);
1255 #line 201 "parser.l"
1257 parser_lval
.num
= xstrtoul(parser_text
, NULL
, 0);
1263 #line 205 "parser.l"
1265 parser_lval
.dbl
= strtod(parser_text
, NULL
);
1270 *yy_cp
= (yy_hold_char
); /* undo effects of setting up parser_text */
1271 (yy_c_buf_p
) = yy_cp
-= 1;
1272 YY_DO_BEFORE_ACTION
; /* set up parser_text again */
1274 #line 209 "parser.l"
1279 #line 210 "parser.l"
1280 return kw_token(parser_text
);
1283 /* rule 27 can match eol */
1285 #line 211 "parser.l"
1290 #line 212 "parser.l"
1295 #line 213 "parser.l"
1300 #line 214 "parser.l"
1305 #line 215 "parser.l"
1310 #line 216 "parser.l"
1315 #line 217 "parser.l"
1320 #line 218 "parser.l"
1321 return GREATEREQUAL
;
1325 #line 219 "parser.l"
1330 #line 220 "parser.l"
1335 #line 221 "parser.l"
1340 #line 222 "parser.l"
1345 #line 223 "parser.l"
1346 return parser_text
[0];
1348 case YY_STATE_EOF(INITIAL
):
1349 case YY_STATE_EOF(QUOTE
):
1350 case YY_STATE_EOF(WSTRQUOTE
):
1351 case YY_STATE_EOF(ATTR
):
1352 case YY_STATE_EOF(PP_LINE
):
1353 case YY_STATE_EOF(PP_PRAGMA
):
1354 case YY_STATE_EOF(SQUOTE
):
1355 #line 224 "parser.l"
1357 if (import_stack_ptr
)
1364 #line 229 "parser.l"
1367 #line 1368 "parser.yy.c"
1369 case YY_END_OF_BUFFER
:
1371 /* Amount of text matched not including the EOB char. */
1372 int yy_amount_of_matched_text
= (int) (yy_cp
- (yytext_ptr
)) - 1;
1374 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1375 *yy_cp
= (yy_hold_char
);
1376 YY_RESTORE_YY_MORE_OFFSET
1378 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
1380 /* We're scanning a new file or input source. It's
1381 * possible that this happened because the user
1382 * just pointed parser_in at a new source and called
1383 * parser_lex(). If so, then we have to assure
1384 * consistency between YY_CURRENT_BUFFER and our
1385 * globals. Here is the right place to do so, because
1386 * this is the first action (other than possibly a
1387 * back-up) that will match for the new input source.
1389 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1390 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= parser_in
;
1391 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1394 /* Note that here we test for yy_c_buf_p "<=" to the position
1395 * of the first EOB in the buffer, since yy_c_buf_p will
1396 * already have been incremented past the NUL character
1397 * (since all states make transitions on EOB to the
1398 * end-of-buffer state). Contrast this with the test
1401 if ( (yy_c_buf_p
) <= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1402 { /* This was really a NUL. */
1403 yy_state_type yy_next_state
;
1405 (yy_c_buf_p
) = (yytext_ptr
) + yy_amount_of_matched_text
;
1407 yy_current_state
= yy_get_previous_state( );
1409 /* Okay, we're now positioned to make the NUL
1410 * transition. We couldn't have
1411 * yy_get_previous_state() go ahead and do it
1412 * for us because it doesn't know how to deal
1413 * with the possibility of jamming (and we don't
1414 * want to build jamming into it because then it
1415 * will run more slowly).
1418 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1420 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1422 if ( yy_next_state
)
1424 /* Consume the NUL. */
1425 yy_cp
= ++(yy_c_buf_p
);
1426 yy_current_state
= yy_next_state
;
1432 yy_cp
= (yy_last_accepting_cpos
);
1433 yy_current_state
= (yy_last_accepting_state
);
1434 goto yy_find_action
;
1438 else switch ( yy_get_next_buffer( ) )
1440 case EOB_ACT_END_OF_FILE
:
1442 (yy_did_buffer_switch_on_eof
) = 0;
1444 if ( parser_wrap( ) )
1446 /* Note: because we've taken care in
1447 * yy_get_next_buffer() to have set up
1448 * parser_text, we can now set up
1449 * yy_c_buf_p so that if some total
1450 * hoser (like flex itself) wants to
1451 * call the scanner after we return the
1452 * YY_NULL, it'll still work - another
1453 * YY_NULL will get returned.
1455 (yy_c_buf_p
) = (yytext_ptr
) + YY_MORE_ADJ
;
1457 yy_act
= YY_STATE_EOF(YY_START
);
1463 if ( ! (yy_did_buffer_switch_on_eof
) )
1469 case EOB_ACT_CONTINUE_SCAN
:
1471 (yytext_ptr
) + yy_amount_of_matched_text
;
1473 yy_current_state
= yy_get_previous_state( );
1475 yy_cp
= (yy_c_buf_p
);
1476 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1479 case EOB_ACT_LAST_MATCH
:
1481 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)];
1483 yy_current_state
= yy_get_previous_state( );
1485 yy_cp
= (yy_c_buf_p
);
1486 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1487 goto yy_find_action
;
1494 "fatal flex scanner internal error--no action found" );
1495 } /* end of action switch */
1496 } /* end of scanning one token */
1497 } /* end of parser_lex */
1499 /* yy_get_next_buffer - try to read in a new buffer
1501 * Returns a code representing an action:
1502 * EOB_ACT_LAST_MATCH -
1503 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1504 * EOB_ACT_END_OF_FILE - end of file
1506 static int yy_get_next_buffer (void)
1508 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1509 register char *source
= (yytext_ptr
);
1510 register int number_to_move
, i
;
1513 if ( (yy_c_buf_p
) > &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] )
1515 "fatal flex scanner internal error--end of buffer missed" );
1517 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1518 { /* Don't try to fill the buffer, so this is an EOF. */
1519 if ( (yy_c_buf_p
) - (yytext_ptr
) - YY_MORE_ADJ
== 1 )
1521 /* We matched a single character, the EOB, so
1522 * treat this as a final EOF.
1524 return EOB_ACT_END_OF_FILE
;
1529 /* We matched some text prior to the EOB, first
1532 return EOB_ACT_LAST_MATCH
;
1536 /* Try to read more data. */
1538 /* First move last chars to start of buffer. */
1539 number_to_move
= (int) ((yy_c_buf_p
) - (yytext_ptr
)) - 1;
1541 for ( i
= 0; i
< number_to_move
; ++i
)
1542 *(dest
++) = *(source
++);
1544 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1545 /* don't do the read, it's not guaranteed to return an EOF,
1548 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
) = 0;
1553 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1555 while ( num_to_read
<= 0 )
1556 { /* Not enough room in the buffer - grow it. */
1558 /* just a shorter name for the current buffer */
1559 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
1561 int yy_c_buf_p_offset
=
1562 (int) ((yy_c_buf_p
) - b
->yy_ch_buf
);
1564 if ( b
->yy_is_our_buffer
)
1566 int new_size
= b
->yy_buf_size
* 2;
1568 if ( new_size
<= 0 )
1569 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1571 b
->yy_buf_size
*= 2;
1573 b
->yy_ch_buf
= (char *)
1574 /* Include room in for 2 EOB chars. */
1575 parser_realloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 );
1578 /* Can't grow it, we don't own it. */
1581 if ( ! b
->yy_ch_buf
)
1583 "fatal error - scanner input buffer overflow" );
1585 (yy_c_buf_p
) = &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1587 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
1592 if ( num_to_read
> YY_READ_BUF_SIZE
)
1593 num_to_read
= YY_READ_BUF_SIZE
;
1595 /* Read in more data. */
1596 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1597 (yy_n_chars
), (size_t) num_to_read
);
1599 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1602 if ( (yy_n_chars
) == 0 )
1604 if ( number_to_move
== YY_MORE_ADJ
)
1606 ret_val
= EOB_ACT_END_OF_FILE
;
1607 parser_restart(parser_in
);
1612 ret_val
= EOB_ACT_LAST_MATCH
;
1613 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1614 YY_BUFFER_EOF_PENDING
;
1619 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1621 if ((yy_size_t
) ((yy_n_chars
) + number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
1622 /* Extend the array by 50%, plus the number we really need. */
1623 yy_size_t new_size
= (yy_n_chars
) + number_to_move
+ ((yy_n_chars
) >> 1);
1624 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) parser_realloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
);
1625 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1626 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1629 (yy_n_chars
) += number_to_move
;
1630 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] = YY_END_OF_BUFFER_CHAR
;
1631 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] = YY_END_OF_BUFFER_CHAR
;
1633 (yytext_ptr
) = &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1638 /* yy_get_previous_state - get the state just before the EOB char was reached */
1640 static yy_state_type
yy_get_previous_state (void)
1642 register yy_state_type yy_current_state
;
1643 register char *yy_cp
;
1645 yy_current_state
= (yy_start
);
1646 yy_current_state
+= YY_AT_BOL();
1648 for ( yy_cp
= (yytext_ptr
) + YY_MORE_ADJ
; yy_cp
< (yy_c_buf_p
); ++yy_cp
)
1650 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1651 if ( yy_accept
[yy_current_state
] )
1653 (yy_last_accepting_state
) = yy_current_state
;
1654 (yy_last_accepting_cpos
) = yy_cp
;
1656 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1658 yy_current_state
= (int) yy_def
[yy_current_state
];
1659 if ( yy_current_state
>= 180 )
1660 yy_c
= yy_meta
[(unsigned int) yy_c
];
1662 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1665 return yy_current_state
;
1668 /* yy_try_NUL_trans - try to make a transition on the NUL character
1671 * next_state = yy_try_NUL_trans( current_state );
1673 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
)
1675 register int yy_is_jam
;
1676 register char *yy_cp
= (yy_c_buf_p
);
1678 register YY_CHAR yy_c
= 1;
1679 if ( yy_accept
[yy_current_state
] )
1681 (yy_last_accepting_state
) = yy_current_state
;
1682 (yy_last_accepting_cpos
) = yy_cp
;
1684 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1686 yy_current_state
= (int) yy_def
[yy_current_state
];
1687 if ( yy_current_state
>= 180 )
1688 yy_c
= yy_meta
[(unsigned int) yy_c
];
1690 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1691 yy_is_jam
= (yy_current_state
== 179);
1693 return yy_is_jam
? 0 : yy_current_state
;
1698 static int yyinput (void)
1700 static int input (void)
1706 *(yy_c_buf_p
) = (yy_hold_char
);
1708 if ( *(yy_c_buf_p
) == YY_END_OF_BUFFER_CHAR
)
1710 /* yy_c_buf_p now points to the character we want to return.
1711 * If this occurs *before* the EOB characters, then it's a
1712 * valid NUL; if not, then we've hit the end of the buffer.
1714 if ( (yy_c_buf_p
) < &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1715 /* This was really a NUL. */
1716 *(yy_c_buf_p
) = '\0';
1719 { /* need more input */
1720 int offset
= (yy_c_buf_p
) - (yytext_ptr
);
1723 switch ( yy_get_next_buffer( ) )
1725 case EOB_ACT_LAST_MATCH
:
1726 /* This happens because yy_g_n_b()
1727 * sees that we've accumulated a
1728 * token and flags that we need to
1729 * try matching the token before
1730 * proceeding. But for input(),
1731 * there's no matching to consider.
1732 * So convert the EOB_ACT_LAST_MATCH
1733 * to EOB_ACT_END_OF_FILE.
1736 /* Reset buffer status. */
1737 parser_restart(parser_in
);
1741 case EOB_ACT_END_OF_FILE
:
1743 if ( parser_wrap( ) )
1746 if ( ! (yy_did_buffer_switch_on_eof
) )
1755 case EOB_ACT_CONTINUE_SCAN
:
1756 (yy_c_buf_p
) = (yytext_ptr
) + offset
;
1762 c
= *(unsigned char *) (yy_c_buf_p
); /* cast for 8-bit char's */
1763 *(yy_c_buf_p
) = '\0'; /* preserve parser_text */
1764 (yy_hold_char
) = *++(yy_c_buf_p
);
1766 YY_CURRENT_BUFFER_LVALUE
->yy_at_bol
= (c
== '\n');
1770 #endif /* ifndef YY_NO_INPUT */
1772 /** Immediately switch to a different input stream.
1773 * @param input_file A readable stream.
1775 * @note This function does not reset the start condition to @c INITIAL .
1777 void parser_restart (FILE * input_file
)
1780 if ( ! YY_CURRENT_BUFFER
){
1781 parser_ensure_buffer_stack ();
1782 YY_CURRENT_BUFFER_LVALUE
=
1783 parser__create_buffer(parser_in
,YY_BUF_SIZE
);
1786 parser__init_buffer(YY_CURRENT_BUFFER
,input_file
);
1787 parser__load_buffer_state( );
1790 /** Switch to a different input buffer.
1791 * @param new_buffer The new input buffer.
1794 void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer
)
1797 /* TODO. We should be able to replace this entire function body
1799 * parser_pop_buffer_state();
1800 * parser_push_buffer_state(new_buffer);
1802 parser_ensure_buffer_stack ();
1803 if ( YY_CURRENT_BUFFER
== new_buffer
)
1806 if ( YY_CURRENT_BUFFER
)
1808 /* Flush out information for old buffer. */
1809 *(yy_c_buf_p
) = (yy_hold_char
);
1810 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1811 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1814 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1815 parser__load_buffer_state( );
1817 /* We don't actually know whether we did this switch during
1818 * EOF (parser_wrap()) processing, but the only time this flag
1819 * is looked at is after parser_wrap() is called, so it's safe
1820 * to go ahead and always set it.
1822 (yy_did_buffer_switch_on_eof
) = 1;
1825 static void parser__load_buffer_state (void)
1827 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1828 (yytext_ptr
) = (yy_c_buf_p
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1829 parser_in
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1830 (yy_hold_char
) = *(yy_c_buf_p
);
1833 /** Allocate and initialize an input buffer state.
1834 * @param file A readable stream.
1835 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1837 * @return the allocated buffer state.
1839 YY_BUFFER_STATE
parser__create_buffer (FILE * file
, int size
)
1843 b
= (YY_BUFFER_STATE
) parser_alloc(sizeof( struct yy_buffer_state
) );
1845 YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" );
1847 b
->yy_buf_size
= size
;
1849 /* yy_ch_buf has to be 2 characters longer than the size given because
1850 * we need to put in 2 end-of-buffer characters.
1852 b
->yy_ch_buf
= (char *) parser_alloc(b
->yy_buf_size
+ 2 );
1853 if ( ! b
->yy_ch_buf
)
1854 YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" );
1856 b
->yy_is_our_buffer
= 1;
1858 parser__init_buffer(b
,file
);
1863 /** Destroy the buffer.
1864 * @param b a buffer created with parser__create_buffer()
1867 void parser__delete_buffer (YY_BUFFER_STATE b
)
1873 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1874 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1876 if ( b
->yy_is_our_buffer
)
1877 parser_free((void *) b
->yy_ch_buf
);
1879 parser_free((void *) b
);
1882 /* Initializes or reinitializes a buffer.
1883 * This function is sometimes called more than once on the same buffer,
1884 * such as during a parser_restart() or at EOF.
1886 static void parser__init_buffer (YY_BUFFER_STATE b
, FILE * file
)
1891 parser__flush_buffer(b
);
1893 b
->yy_input_file
= file
;
1894 b
->yy_fill_buffer
= 1;
1896 /* If b is the current buffer, then parser__init_buffer was _probably_
1897 * called from parser_restart() or through yy_get_next_buffer.
1898 * In that case, we don't want to reset the lineno or column.
1900 if (b
!= YY_CURRENT_BUFFER
){
1901 b
->yy_bs_lineno
= 1;
1902 b
->yy_bs_column
= 0;
1905 b
->yy_is_interactive
= 0;
1910 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1911 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1914 void parser__flush_buffer (YY_BUFFER_STATE b
)
1921 /* We always need two end-of-buffer characters. The first causes
1922 * a transition to the end-of-buffer state. The second causes
1923 * a jam in that state.
1925 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1926 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1928 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1931 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1933 if ( b
== YY_CURRENT_BUFFER
)
1934 parser__load_buffer_state( );
1937 /** Pushes the new state onto the stack. The new state becomes
1938 * the current state. This function will allocate the stack
1940 * @param new_buffer The new state.
1943 void parser_push_buffer_state (YY_BUFFER_STATE new_buffer
)
1945 if (new_buffer
== NULL
)
1948 parser_ensure_buffer_stack();
1950 /* This block is copied from parser__switch_to_buffer. */
1951 if ( YY_CURRENT_BUFFER
)
1953 /* Flush out information for old buffer. */
1954 *(yy_c_buf_p
) = (yy_hold_char
);
1955 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1956 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1959 /* Only push if top exists. Otherwise, replace top. */
1960 if (YY_CURRENT_BUFFER
)
1961 (yy_buffer_stack_top
)++;
1962 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1964 /* copied from parser__switch_to_buffer. */
1965 parser__load_buffer_state( );
1966 (yy_did_buffer_switch_on_eof
) = 1;
1969 /** Removes and deletes the top of the stack, if present.
1970 * The next element becomes the new top.
1973 void parser_pop_buffer_state (void)
1975 if (!YY_CURRENT_BUFFER
)
1978 parser__delete_buffer(YY_CURRENT_BUFFER
);
1979 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1980 if ((yy_buffer_stack_top
) > 0)
1981 --(yy_buffer_stack_top
);
1983 if (YY_CURRENT_BUFFER
) {
1984 parser__load_buffer_state( );
1985 (yy_did_buffer_switch_on_eof
) = 1;
1989 /* Allocates the stack if it does not exist.
1990 * Guarantees space for at least one push.
1992 static void parser_ensure_buffer_stack (void)
1996 if (!(yy_buffer_stack
)) {
1998 /* First allocation is just for 2 elements, since we don't know if this
1999 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2000 * immediate realloc on the next call.
2003 (yy_buffer_stack
) = (struct yy_buffer_state
**)parser_alloc
2004 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
2006 if ( ! (yy_buffer_stack
) )
2007 YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" );
2009 memset((yy_buffer_stack
), 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
2011 (yy_buffer_stack_max
) = num_to_alloc
;
2012 (yy_buffer_stack_top
) = 0;
2016 if ((yy_buffer_stack_top
) >= ((yy_buffer_stack_max
)) - 1){
2018 /* Increase the buffer to prepare for a possible push. */
2019 int grow_size
= 8 /* arbitrary grow size */;
2021 num_to_alloc
= (yy_buffer_stack_max
) + grow_size
;
2022 (yy_buffer_stack
) = (struct yy_buffer_state
**)parser_realloc
2024 num_to_alloc
* sizeof(struct yy_buffer_state
*)
2026 if ( ! (yy_buffer_stack
) )
2027 YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" );
2029 /* zero only the new slots.*/
2030 memset((yy_buffer_stack
) + (yy_buffer_stack_max
), 0, grow_size
* sizeof(struct yy_buffer_state
*));
2031 (yy_buffer_stack_max
) = num_to_alloc
;
2035 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2036 * @param base the character buffer
2037 * @param size the size in bytes of the character buffer
2039 * @return the newly allocated buffer state object.
2041 YY_BUFFER_STATE
parser__scan_buffer (char * base
, yy_size_t size
)
2046 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
2047 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
2048 /* They forgot to leave room for the EOB's. */
2051 b
= (YY_BUFFER_STATE
) parser_alloc(sizeof( struct yy_buffer_state
) );
2053 YY_FATAL_ERROR( "out of dynamic memory in parser__scan_buffer()" );
2055 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
2056 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
2057 b
->yy_is_our_buffer
= 0;
2058 b
->yy_input_file
= 0;
2059 b
->yy_n_chars
= b
->yy_buf_size
;
2060 b
->yy_is_interactive
= 0;
2062 b
->yy_fill_buffer
= 0;
2063 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2065 parser__switch_to_buffer(b
);
2070 /** Setup the input buffer state to scan a string. The next call to parser_lex() will
2071 * scan from a @e copy of @a str.
2072 * @param yystr a NUL-terminated string to scan
2074 * @return the newly allocated buffer state object.
2075 * @note If you want to scan bytes that may contain NUL values, then use
2076 * parser__scan_bytes() instead.
2078 YY_BUFFER_STATE
parser__scan_string (yyconst
char * yystr
)
2081 return parser__scan_bytes(yystr
,strlen(yystr
) );
2084 /** Setup the input buffer state to scan the given bytes. The next call to parser_lex() will
2085 * scan from a @e copy of @a bytes.
2086 * @param yybytes the byte buffer to scan
2087 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2089 * @return the newly allocated buffer state object.
2091 YY_BUFFER_STATE
parser__scan_bytes (yyconst
char * yybytes
, int _yybytes_len
)
2098 /* Get memory for full buffer, including space for trailing EOB's. */
2099 n
= _yybytes_len
+ 2;
2100 buf
= (char *) parser_alloc(n
);
2102 YY_FATAL_ERROR( "out of dynamic memory in parser__scan_bytes()" );
2104 for ( i
= 0; i
< _yybytes_len
; ++i
)
2105 buf
[i
] = yybytes
[i
];
2107 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
2109 b
= parser__scan_buffer(buf
,n
);
2111 YY_FATAL_ERROR( "bad buffer in parser__scan_bytes()" );
2113 /* It's okay to grow etc. this buffer, and we should throw it
2114 * away when we're done.
2116 b
->yy_is_our_buffer
= 1;
2121 static void yy_push_state (int new_state
)
2123 if ( (yy_start_stack_ptr
) >= (yy_start_stack_depth
) )
2127 (yy_start_stack_depth
) += YY_START_STACK_INCR
;
2128 new_size
= (yy_start_stack_depth
) * sizeof( int );
2130 if ( ! (yy_start_stack
) )
2131 (yy_start_stack
) = (int *) parser_alloc(new_size
);
2134 (yy_start_stack
) = (int *) parser_realloc((void *) (yy_start_stack
),new_size
);
2136 if ( ! (yy_start_stack
) )
2137 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2140 (yy_start_stack
)[(yy_start_stack_ptr
)++] = YY_START
;
2145 static void yy_pop_state (void)
2147 if ( --(yy_start_stack_ptr
) < 0 )
2148 YY_FATAL_ERROR( "start-condition stack underflow" );
2150 BEGIN((yy_start_stack
)[(yy_start_stack_ptr
)]);
2153 #ifndef YY_EXIT_FAILURE
2154 #define YY_EXIT_FAILURE 2
2157 static void yy_fatal_error (yyconst
char* msg
)
2159 (void) fprintf( stderr
, "%s\n", msg
);
2160 exit( YY_EXIT_FAILURE
);
2163 /* Redefine yyless() so it works in section 3 code. */
2169 /* Undo effects of setting up parser_text. */ \
2170 int yyless_macro_arg = (n); \
2171 YY_LESS_LINENO(yyless_macro_arg);\
2172 parser_text[parser_leng] = (yy_hold_char); \
2173 (yy_c_buf_p) = parser_text + yyless_macro_arg; \
2174 (yy_hold_char) = *(yy_c_buf_p); \
2175 *(yy_c_buf_p) = '\0'; \
2176 parser_leng = yyless_macro_arg; \
2180 /* Accessor methods (get/set functions) to struct members. */
2182 /** Get the current line number.
2185 int parser_get_lineno (void)
2188 return parser_lineno
;
2191 /** Get the input stream.
2194 FILE *parser_get_in (void)
2199 /** Get the output stream.
2202 FILE *parser_get_out (void)
2207 /** Get the length of the current token.
2210 int parser_get_leng (void)
2215 /** Get the current token.
2219 char *parser_get_text (void)
2224 /** Set the current line number.
2225 * @param line_number
2228 void parser_set_lineno (int line_number
)
2231 parser_lineno
= line_number
;
2234 /** Set the input stream. This does not discard the current
2236 * @param in_str A readable stream.
2238 * @see parser__switch_to_buffer
2240 void parser_set_in (FILE * in_str
)
2242 parser_in
= in_str
;
2245 void parser_set_out (FILE * out_str
)
2247 parser_out
= out_str
;
2250 int parser_get_debug (void)
2252 return parser__flex_debug
;
2255 void parser_set_debug (int bdebug
)
2257 parser__flex_debug
= bdebug
;
2260 static int yy_init_globals (void)
2262 /* Initialization is the same as for the non-reentrant scanner.
2263 * This function is called from parser_lex_destroy(), so don't allocate here.
2266 (yy_buffer_stack
) = 0;
2267 (yy_buffer_stack_top
) = 0;
2268 (yy_buffer_stack_max
) = 0;
2269 (yy_c_buf_p
) = (char *) 0;
2273 (yy_start_stack_ptr
) = 0;
2274 (yy_start_stack_depth
) = 0;
2275 (yy_start_stack
) = NULL
;
2277 /* Defined in main.c */
2280 parser_out
= stdout
;
2282 parser_in
= (FILE *) 0;
2283 parser_out
= (FILE *) 0;
2286 /* For future reference: Set errno on error, since we are called by
2292 /* parser_lex_destroy is for both reentrant and non-reentrant scanners. */
2293 int parser_lex_destroy (void)
2296 /* Pop the buffer stack, destroying each element. */
2297 while(YY_CURRENT_BUFFER
){
2298 parser__delete_buffer(YY_CURRENT_BUFFER
);
2299 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2300 parser_pop_buffer_state();
2303 /* Destroy the stack itself. */
2304 parser_free((yy_buffer_stack
) );
2305 (yy_buffer_stack
) = NULL
;
2307 /* Destroy the start condition stack. */
2308 parser_free((yy_start_stack
) );
2309 (yy_start_stack
) = NULL
;
2311 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2312 * parser_lex() is called, initialization will occur. */
2319 * Internal utility routines.
2323 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
)
2326 for ( i
= 0; i
< n
; ++i
)
2331 #ifdef YY_NEED_STRLEN
2332 static int yy_flex_strlen (yyconst
char * s
)
2335 for ( n
= 0; s
[n
]; ++n
)
2342 void *parser_alloc (yy_size_t size
)
2344 return (void *) malloc( size
);
2347 void *parser_realloc (void * ptr
, yy_size_t size
)
2349 /* The cast to (char *) in the following accommodates both
2350 * implementations that use char* generic pointers, and those
2351 * that use void* generic pointers. It works with the latter
2352 * because both ANSI C and C++ allow castless assignment from
2353 * any pointer type to void*, and deal with argument conversions
2354 * as though doing an assignment.
2356 return (void *) realloc( (char *) ptr
, size
);
2359 void parser_free (void * ptr
)
2361 free( (char *) ptr
); /* see parser_realloc() for (char *) cast */
2364 #define YYTABLES_NAME "yytables"
2366 #line 229 "parser.l"
2371 int parser_wrap(void)
2382 /* This table MUST be alphabetically sorted on the kw field */
2383 static const struct keyword keywords
[] = {
2387 {"__cdecl", tCDECL
},
2388 {"__fastcall", tFASTCALL
},
2389 {"__int3264", tINT3264
},
2390 {"__int64", tINT64
},
2391 {"__pascal", tPASCAL
},
2392 {"__stdcall", tSTDCALL
},
2394 {"_fastcall", tFASTCALL
},
2395 {"_pascal", tPASCAL
},
2396 {"_stdcall", tSTDCALL
},
2397 {"boolean", tBOOLEAN
},
2402 {"coclass", tCOCLASS
},
2404 {"cpp_quote", tCPPQUOTE
},
2405 {"default", tDEFAULT
},
2406 {"dispinterface", tDISPINTERFACE
},
2407 {"double", tDOUBLE
},
2409 {"error_status_t", tERRORSTATUST
},
2410 {"extern", tEXTERN
},
2412 {"handle_t", tHANDLET
},
2414 {"import", tIMPORT
},
2415 {"importlib", tIMPORTLIB
},
2416 {"inline", tINLINE
},
2418 {"interface", tINTERFACE
},
2419 {"library", tLIBRARY
},
2421 {"methods", tMETHODS
},
2422 {"module", tMODULE
},
2423 {"namespace", tNAMESPACE
},
2424 {"pascal", tPASCAL
},
2425 {"properties", tPROPERTIES
},
2426 {"register", tREGISTER
},
2428 {"signed", tSIGNED
},
2429 {"sizeof", tSIZEOF
},
2431 {"static", tSTATIC
},
2432 {"stdcall", tSTDCALL
},
2433 {"struct", tSTRUCT
},
2434 {"switch", tSWITCH
},
2435 {"typedef", tTYPEDEF
},
2437 {"unsigned", tUNSIGNED
},
2439 {"wchar_t", tWCHAR
},
2441 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
2443 /* keywords only recognized in attribute lists
2444 * This table MUST be alphabetically sorted on the kw field
2446 static const struct keyword attr_keywords
[] =
2448 {"aggregatable", tAGGREGATABLE
},
2449 {"allocate", tALLOCATE
},
2450 {"annotation", tANNOTATION
},
2451 {"apartment", tAPARTMENT
},
2452 {"appobject", tAPPOBJECT
},
2454 {"async_uuid", tASYNCUUID
},
2455 {"auto_handle", tAUTOHANDLE
},
2456 {"bindable", tBINDABLE
},
2458 {"broadcast", tBROADCAST
},
2459 {"byte_count", tBYTECOUNT
},
2460 {"call_as", tCALLAS
},
2461 {"callback", tCALLBACK
},
2463 {"comm_status", tCOMMSTATUS
},
2464 {"context_handle", tCONTEXTHANDLE
},
2465 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE
},
2466 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE
},
2467 {"control", tCONTROL
},
2468 {"decode", tDECODE
},
2469 {"defaultbind", tDEFAULTBIND
},
2470 {"defaultcollelem", tDEFAULTCOLLELEM
},
2471 {"defaultvalue", tDEFAULTVALUE
},
2472 {"defaultvtable", tDEFAULTVTABLE
},
2473 {"disable_consistency_check", tDISABLECONSISTENCYCHECK
},
2474 {"displaybind", tDISPLAYBIND
},
2475 {"dllname", tDLLNAME
},
2477 {"enable_allocate", tENABLEALLOCATE
},
2478 {"encode", tENCODE
},
2479 {"endpoint", tENDPOINT
},
2481 {"explicit_handle", tEXPLICITHANDLE
},
2482 {"fault_status", tFAULTSTATUS
},
2483 {"force_allocate", tFORCEALLOCATE
},
2485 {"handle", tHANDLE
},
2486 {"helpcontext", tHELPCONTEXT
},
2487 {"helpfile", tHELPFILE
},
2488 {"helpstring", tHELPSTRING
},
2489 {"helpstringcontext", tHELPSTRINGCONTEXT
},
2490 {"helpstringdll", tHELPSTRINGDLL
},
2491 {"hidden", tHIDDEN
},
2493 {"idempotent", tIDEMPOTENT
},
2494 {"ignore", tIGNORE
},
2496 {"immediatebind", tIMMEDIATEBIND
},
2497 {"implicit_handle", tIMPLICITHANDLE
},
2499 {"in_line", tIN_LINE
},
2500 {"input_sync", tINPUTSYNC
},
2502 {"length_is", tLENGTHIS
},
2503 {"licensed", tLICENSED
},
2506 {"message", tMESSAGE
},
2507 {"neutral", tNEUTRAL
},
2508 {"nocode", tNOCODE
},
2509 {"nonbrowsable", tNONBROWSABLE
},
2510 {"noncreatable", tNONCREATABLE
},
2511 {"nonextensible", tNONEXTENSIBLE
},
2512 {"notify", tNOTIFY
},
2513 {"notify_flag", tNOTIFYFLAG
},
2514 {"object", tOBJECT
},
2516 {"oleautomation", tOLEAUTOMATION
},
2517 {"optimize", tOPTIMIZE
},
2518 {"optional", tOPTIONAL
},
2520 {"partial_ignore", tPARTIALIGNORE
},
2521 {"pointer_default", tPOINTERDEFAULT
},
2522 {"progid", tPROGID
},
2523 {"propget", tPROPGET
},
2524 {"propput", tPROPPUT
},
2525 {"propputref", tPROPPUTREF
},
2528 {"public", tPUBLIC
},
2530 {"readonly", tREADONLY
},
2532 {"represent_as", tREPRESENTAS
},
2533 {"requestedit", tREQUESTEDIT
},
2534 {"restricted", tRESTRICTED
},
2535 {"retval", tRETVAL
},
2536 {"single", tSINGLE
},
2537 {"size_is", tSIZEIS
},
2538 {"source", tSOURCE
},
2539 {"strict_context_handle", tSTRICTCONTEXTHANDLE
},
2540 {"string", tSTRING
},
2541 {"switch_is", tSWITCHIS
},
2542 {"switch_type", tSWITCHTYPE
},
2543 {"threading", tTHREADING
},
2544 {"transmit_as", tTRANSMITAS
},
2545 {"uidefault", tUIDEFAULT
},
2546 {"unique", tUNIQUE
},
2547 {"user_marshal", tUSERMARSHAL
},
2548 {"usesgetlasterror", tUSESGETLASTERROR
},
2550 {"v1_enum", tV1ENUM
},
2551 {"vararg", tVARARG
},
2552 {"version", tVERSION
},
2553 {"vi_progid", tVIPROGID
},
2554 {"wire_marshal", tWIREMARSHAL
},
2565 #define KWP(p) ((const struct keyword *)(p))
2567 static int kw_cmp_func(const void *s1
, const void *s2
)
2569 return strcmp(KWP(s1
)->kw
, KWP(s2
)->kw
);
2572 static int kw_token(const char *kw
)
2574 struct keyword key
, *kwp
;
2576 kwp
= bsearch(&key
, keywords
, NKEYWORDS
, sizeof(keywords
[0]), kw_cmp_func
);
2577 if (kwp
&& (winrt_mode
|| kwp
->token
!= tNAMESPACE
)) {
2578 parser_lval
.str
= xstrdup(kwp
->kw
);
2581 parser_lval
.str
= xstrdup(kw
);
2582 return is_type(kw
) ? aKNOWNTYPE
: aIDENTIFIER
;
2585 static int attr_token(const char *kw
)
2587 struct keyword key
, *kwp
;
2589 kwp
= bsearch(&key
, attr_keywords
, sizeof(attr_keywords
)/sizeof(attr_keywords
[0]),
2590 sizeof(attr_keywords
[0]), kw_cmp_func
);
2592 parser_lval
.str
= xstrdup(kwp
->kw
);
2595 return kw_token(kw
);
2598 static void addcchar(char c
)
2600 if(cbufidx
>= cbufalloc
)
2603 cbuffer
= xrealloc(cbuffer
, cbufalloc
* sizeof(cbuffer
[0]));
2604 if(cbufalloc
> 65536)
2605 parser_warning("Reallocating string buffer larger than 64kB\n");
2607 cbuffer
[cbufidx
++] = c
;
2610 static char *get_buffered_cstring(void)
2613 return xstrdup(cbuffer
);
2616 void pop_import(void)
2618 int ptr
= import_stack_ptr
-1;
2621 parser__delete_buffer(YY_CURRENT_BUFFER
);
2622 parser__switch_to_buffer(import_stack
[ptr
].state
);
2627 temp_name
= import_stack
[ptr
].temp_name
;
2628 input_name
= import_stack
[ptr
].input_name
;
2629 line_number
= import_stack
[ptr
].line_number
;
2635 struct imports
*next
;
2638 int do_import(char *fname
)
2642 struct imports
*import
;
2643 int ptr
= import_stack_ptr
;
2646 import
= first_import
;
2647 while (import
&& strcmp(import
->name
, fname
))
2648 import
= import
->next
;
2649 if (import
) return 0; /* already imported */
2651 import
= xmalloc(sizeof(struct imports
));
2652 import
->name
= xstrdup(fname
);
2653 import
->next
= first_import
;
2654 first_import
= import
;
2656 /* don't search for a file name with a path in the include directories,
2657 * for compatibility with MIDL */
2658 if (strchr( fname
, '/' ) || strchr( fname
, '\\' ))
2659 path
= xstrdup( fname
);
2660 else if (!(path
= wpp_find_include( fname
, input_name
)))
2661 error_loc("Unable to open include file %s\n", fname
);
2663 import_stack
[ptr
].temp_name
= temp_name
;
2664 import_stack
[ptr
].input_name
= input_name
;
2665 import_stack
[ptr
].line_number
= line_number
;
2670 name
= xstrdup( "widl.XXXXXX" );
2671 if((fd
= mkstemps( name
, 0 )) == -1)
2672 error("Could not generate a temp name from %s\n", name
);
2675 if (!(f
= fdopen(fd
, "wt")))
2676 error("Could not open fd %s for writing\n", name
);
2678 ret
= wpp_parse( path
, f
);
2682 if((f
= fopen(temp_name
, "r")) == NULL
)
2683 error_loc("Unable to open %s\n", temp_name
);
2685 import_stack
[ptr
].state
= YY_CURRENT_BUFFER
;
2686 parser__switch_to_buffer(parser__create_buffer(f
,YY_BUF_SIZE
));
2690 void abort_import(void)
2694 for (ptr
=0; ptr
<import_stack_ptr
; ptr
++)
2695 unlink(import_stack
[ptr
].temp_name
);