1 #line 2 "scripts/genksyms/lex.c"
3 #line 4 "scripts/genksyms/lex.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
12 /* %if-not-reentrant */
19 #define YY_FLEX_MAJOR_VERSION 2
20 #define YY_FLEX_MINOR_VERSION 5
21 #define YY_FLEX_SUBMINOR_VERSION 35
22 #if YY_FLEX_SUBMINOR_VERSION > 0
37 /* First, we deal with platform-specific or compiler-specific issues. */
39 /* begin standard C headers. */
47 /* %if-tables-serialization */
49 /* end standard C headers. */
52 /* flex integer type definitions */
57 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
59 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
61 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
62 * if you want the limit (max/min) macros for int types.
64 #ifndef __STDC_LIMIT_MACROS
65 #define __STDC_LIMIT_MACROS 1
69 typedef int8_t flex_int8_t;
70 typedef uint8_t flex_uint8_t;
71 typedef int16_t flex_int16_t;
72 typedef uint16_t flex_uint16_t;
73 typedef int32_t flex_int32_t;
74 typedef uint32_t flex_uint32_t;
76 typedef signed char flex_int8_t;
77 typedef short int flex_int16_t;
78 typedef int flex_int32_t;
79 typedef unsigned char flex_uint8_t;
80 typedef unsigned short int flex_uint16_t;
81 typedef unsigned int flex_uint32_t;
83 /* Limits of integral types. */
85 #define INT8_MIN (-128)
88 #define INT16_MIN (-32767-1)
91 #define INT32_MIN (-2147483647-1)
94 #define INT8_MAX (127)
97 #define INT16_MAX (32767)
100 #define INT32_MAX (2147483647)
103 #define UINT8_MAX (255U)
106 #define UINT16_MAX (65535U)
109 #define UINT32_MAX (4294967295U)
114 #endif /* ! FLEXINT_H */
123 /* The "const" storage-class-modifier is valid. */
126 #else /* ! __cplusplus */
128 /* C99 requires __STDC__ to be defined as 1. */
129 #if defined (__STDC__)
133 #endif /* defined (__STDC__) */
134 #endif /* ! __cplusplus */
137 #define yyconst const
142 /* %not-for-header */
144 /* Returned upon end-of-file. */
148 /* %not-for-header */
150 /* Promotes a possibly negative, possibly signed char to an unsigned
151 * integer for use as an array index. If the signed char is negative,
152 * we want to instead treat it as an 8-bit unsigned char, hence the
155 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
161 /* %if-not-reentrant */
165 /* Enter a start condition. This macro really ought to take a parameter,
166 * but we do it the disgusting crufty way forced on us by the ()-less
167 * definition of BEGIN.
169 #define BEGIN (yy_start) = 1 + 2 *
171 /* Translate the current start state into a value that can be later handed
172 * to BEGIN to return to the state. The YYSTATE alias is for lex
175 #define YY_START (((yy_start) - 1) / 2)
176 #define YYSTATE YY_START
178 /* Action number for EOF rule of a given start state. */
179 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
181 /* Special action meaning "start processing a new file". */
182 #define YY_NEW_FILE yyrestart(yyin )
184 #define YY_END_OF_BUFFER_CHAR 0
186 /* Size of default input buffer. */
188 #define YY_BUF_SIZE 16384
191 /* The state buf must be large enough to hold one state per character in the main buffer.
193 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
195 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
196 #define YY_TYPEDEF_YY_BUFFER_STATE
197 typedef struct yy_buffer_state *YY_BUFFER_STATE;
200 /* %if-not-reentrant */
205 /* %if-not-reentrant */
206 extern FILE *yyin, *yyout;
210 #define EOB_ACT_CONTINUE_SCAN 0
211 #define EOB_ACT_END_OF_FILE 1
212 #define EOB_ACT_LAST_MATCH 2
214 #define YY_LESS_LINENO(n)
216 /* Return all but the first "n" matched characters back to the input stream. */
220 /* Undo effects of setting up yytext. */ \
221 int yyless_macro_arg = (n); \
222 YY_LESS_LINENO(yyless_macro_arg);\
223 *yy_cp = (yy_hold_char); \
224 YY_RESTORE_YY_MORE_OFFSET \
225 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
226 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
230 #define unput(c) yyunput( c, (yytext_ptr) )
232 #ifndef YY_TYPEDEF_YY_SIZE_T
233 #define YY_TYPEDEF_YY_SIZE_T
234 typedef size_t yy_size_t;
237 #ifndef YY_STRUCT_YY_BUFFER_STATE
238 #define YY_STRUCT_YY_BUFFER_STATE
239 struct yy_buffer_state
248 char *yy_ch_buf; /* input buffer */
249 char *yy_buf_pos; /* current position in input buffer */
251 /* Size of input buffer in bytes, not including room for EOB
254 yy_size_t yy_buf_size;
256 /* Number of characters read into yy_ch_buf, not including EOB
261 /* Whether we "own" the buffer - i.e., we know we created it,
262 * and can realloc() it to grow it, and should free() it to
265 int yy_is_our_buffer;
267 /* Whether this is an "interactive" input source; if so, and
268 * if we're using stdio for input, then we want to use getc()
269 * instead of fread(), to make sure we stop fetching input after
272 int yy_is_interactive;
274 /* Whether we're considered to be at the beginning of a line.
275 * If so, '^' rules will be active on the next match, otherwise
280 int yy_bs_lineno; /**< The line count. */
281 int yy_bs_column; /**< The column count. */
283 /* Whether to try to fill the input buffer when we reach the
288 int yy_buffer_status;
290 #define YY_BUFFER_NEW 0
291 #define YY_BUFFER_NORMAL 1
292 /* When an EOF's been seen but there's still some text to process
293 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
294 * shouldn't try reading from the input source any more. We might
295 * still have a bunch of tokens to match, though, because of
296 * possible backing-up.
298 * When we actually see the EOF, we change the status to "new"
299 * (via yyrestart()), so that the user can continue scanning by
300 * just pointing yyin at a new input file.
302 #define YY_BUFFER_EOF_PENDING 2
305 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
307 /* %if-c-only Standard (non-C++) definition */
308 /* %not-for-header */
310 /* %if-not-reentrant */
312 /* Stack of input buffers. */
313 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
314 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
315 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
321 /* We provide macros for accessing buffer states in case in the
322 * future we want to put the buffer states in a more general
325 * Returns the top of the stack, or NULL.
327 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
328 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
331 /* Same as previous macro, but useful when we know that the buffer stack is not
332 * NULL or when we need an lvalue. For internal use only.
334 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
336 /* %if-c-only Standard (non-C++) definition */
338 /* %if-not-reentrant */
339 /* %not-for-header */
341 /* yy_hold_char holds the character lost when yytext is formed. */
342 static char yy_hold_char;
343 static int yy_n_chars; /* number of characters read into yy_ch_buf */
346 /* Points to current character in buffer. */
347 static char *yy_c_buf_p = (char *) 0;
348 static int yy_init = 0; /* whether we need to initialize */
349 static int yy_start = 0; /* start state number */
351 /* Flag which is used to allow yywrap()'s to do buffer switches
352 * instead of setting up a fresh yyin. A bit of a hack ...
354 static int yy_did_buffer_switch_on_eof;
359 void yyrestart (FILE *input_file );
360 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
361 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
362 void yy_delete_buffer (YY_BUFFER_STATE b );
363 void yy_flush_buffer (YY_BUFFER_STATE b );
364 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
365 void yypop_buffer_state (void );
367 static void yyensure_buffer_stack (void );
368 static void yy_load_buffer_state (void );
369 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
371 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
373 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
374 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
375 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
379 void *yyalloc (yy_size_t );
380 void *yyrealloc (void *,yy_size_t );
381 void yyfree (void * );
383 #define yy_new_buffer yy_create_buffer
385 #define yy_set_interactive(is_interactive) \
387 if ( ! YY_CURRENT_BUFFER ){ \
388 yyensure_buffer_stack (); \
389 YY_CURRENT_BUFFER_LVALUE = \
390 yy_create_buffer(yyin,YY_BUF_SIZE ); \
392 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
395 #define yy_set_bol(at_bol) \
397 if ( ! YY_CURRENT_BUFFER ){\
398 yyensure_buffer_stack (); \
399 YY_CURRENT_BUFFER_LVALUE = \
400 yy_create_buffer(yyin,YY_BUF_SIZE ); \
402 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
405 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
407 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
408 /* Begin user sect3 */
411 #define YY_SKIP_YYWRAP
415 typedef unsigned char YY_CHAR;
417 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
419 typedef int yy_state_type;
426 #define yytext_ptr yytext
428 /* %if-c-only Standard (non-C++) definition */
430 static yy_state_type yy_get_previous_state (void );
431 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
432 static int yy_get_next_buffer (void );
433 static void yy_fatal_error (yyconst char msg[] );
437 /* Done after the current pattern has been matched and before the
438 * corresponding action - sets up yytext.
440 #define YY_DO_BEFORE_ACTION \
441 (yytext_ptr) = yy_bp; \
442 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
443 yyleng = (size_t) (yy_cp - yy_bp); \
444 (yy_hold_char) = *yy_cp; \
446 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
447 (yy_c_buf_p) = yy_cp;
449 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
450 #define YY_NUM_RULES 13
451 #define YY_END_OF_BUFFER 14
452 /* This struct is not used in this scanner,
453 but its presence is necessary. */
456 flex_int32_t yy_verify;
459 static yyconst flex_int16_t yy_accept[76] =
461 0, 0, 0, 0, 14, 12, 4, 3, 12, 7,
462 12, 12, 7, 12, 12, 12, 12, 12, 9, 9,
463 12, 12, 12, 4, 0, 5, 0, 7, 0, 6,
464 0, 0, 0, 0, 0, 0, 2, 8, 10, 10,
465 9, 0, 0, 9, 9, 0, 9, 0, 0, 11,
466 0, 0, 0, 10, 0, 10, 9, 9, 0, 0,
467 0, 0, 0, 0, 0, 10, 10, 0, 0, 0,
471 static yyconst flex_int32_t yy_ec[256] =
473 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
474 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
475 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
476 1, 2, 1, 5, 6, 7, 8, 9, 10, 1,
477 1, 8, 11, 1, 12, 13, 8, 14, 15, 15,
478 15, 15, 15, 15, 15, 16, 16, 1, 1, 17,
479 18, 19, 1, 1, 20, 20, 20, 20, 21, 22,
480 7, 7, 7, 7, 7, 23, 7, 7, 7, 7,
481 7, 7, 7, 7, 24, 7, 7, 25, 7, 7,
482 1, 26, 1, 8, 7, 1, 20, 20, 20, 20,
484 21, 22, 7, 7, 7, 7, 7, 27, 7, 7,
485 7, 7, 7, 7, 7, 7, 24, 7, 7, 25,
486 7, 7, 1, 28, 1, 8, 1, 1, 1, 1,
487 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
488 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
489 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
490 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
491 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
492 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
493 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
495 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
496 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
497 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
498 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
499 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
503 static yyconst flex_int32_t yy_meta[29] =
505 1, 1, 2, 1, 1, 1, 3, 1, 1, 1,
506 4, 4, 5, 6, 6, 6, 1, 1, 1, 7,
507 8, 7, 3, 3, 3, 1, 3, 1
510 static yyconst flex_int16_t yy_base[88] =
512 0, 147, 21, 140, 145, 284, 39, 284, 26, 0,
513 32, 126, 40, 44, 115, 35, 36, 46, 50, 53,
514 39, 61, 54, 79, 65, 284, 0, 0, 66, 284,
515 0, 119, 79, 75, 123, 104, 284, 284, 107, 0,
516 79, 73, 76, 76, 66, 0, 0, 85, 86, 284,
517 133, 83, 91, 284, 99, 147, 284, 114, 122, 70,
518 107, 141, 172, 151, 135, 181, 284, 137, 114, 157,
519 149, 48, 45, 284, 284, 208, 214, 222, 230, 238,
520 246, 250, 255, 256, 261, 267, 275
523 static yyconst flex_int16_t yy_def[88] =
525 75, 1, 1, 3, 75, 75, 75, 75, 76, 77,
526 78, 75, 77, 79, 75, 75, 75, 75, 75, 19,
527 75, 75, 75, 75, 76, 75, 80, 77, 78, 75,
528 81, 75, 76, 78, 79, 79, 75, 75, 75, 39,
529 19, 82, 83, 75, 75, 84, 20, 76, 78, 75,
530 79, 51, 85, 75, 75, 75, 75, 84, 79, 51,
531 79, 79, 79, 51, 75, 75, 75, 86, 79, 63,
532 86, 87, 87, 75, 0, 75, 75, 75, 75, 75,
533 75, 75, 75, 75, 75, 75, 75
536 static yyconst flex_int16_t yy_nxt[313] =
538 6, 7, 8, 7, 9, 6, 10, 6, 6, 11,
539 6, 6, 12, 6, 6, 6, 6, 6, 6, 10,
540 10, 10, 13, 10, 10, 6, 10, 6, 15, 16,
541 26, 15, 17, 18, 19, 20, 20, 21, 15, 22,
542 24, 30, 24, 38, 33, 36, 37, 74, 23, 34,
543 74, 27, 38, 38, 38, 38, 38, 31, 32, 39,
544 39, 39, 40, 41, 41, 42, 47, 47, 47, 26,
545 43, 38, 44, 45, 46, 30, 44, 75, 38, 38,
546 24, 38, 24, 26, 30, 40, 55, 55, 57, 26,
547 27, 31, 57, 43, 35, 30, 64, 64, 64, 57,
549 31, 65, 65, 75, 27, 36, 37, 35, 59, 37,
550 27, 31, 56, 56, 56, 59, 37, 51, 52, 52,
551 39, 39, 39, 59, 37, 37, 68, 53, 54, 54,
552 69, 50, 38, 54, 59, 37, 44, 45, 32, 37,
553 44, 35, 59, 37, 75, 14, 60, 60, 66, 66,
554 66, 37, 14, 72, 75, 61, 62, 63, 59, 61,
555 56, 56, 56, 69, 64, 64, 64, 69, 67, 67,
556 75, 75, 75, 67, 37, 35, 75, 75, 75, 61,
557 62, 75, 75, 61, 75, 70, 70, 70, 75, 75,
558 75, 70, 70, 70, 66, 66, 66, 75, 75, 75,
560 75, 75, 54, 54, 75, 75, 75, 54, 25, 25,
561 25, 25, 25, 25, 25, 25, 28, 75, 75, 28,
562 28, 28, 29, 29, 29, 29, 29, 29, 29, 29,
563 35, 35, 35, 35, 35, 35, 35, 35, 48, 75,
564 48, 48, 48, 48, 48, 48, 49, 75, 49, 49,
565 49, 49, 49, 49, 42, 42, 75, 42, 56, 75,
566 56, 58, 58, 58, 66, 75, 66, 71, 71, 71,
567 71, 71, 71, 71, 71, 73, 73, 73, 73, 73,
568 73, 73, 73, 5, 75, 75, 75, 75, 75, 75,
569 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
571 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
575 static yyconst flex_int16_t yy_chk[313] =
577 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
578 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
579 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
580 9, 3, 3, 3, 3, 3, 3, 3, 3, 3,
581 7, 11, 7, 16, 13, 14, 14, 73, 3, 13,
582 72, 9, 16, 17, 17, 21, 21, 11, 18, 18,
583 18, 18, 19, 19, 19, 19, 20, 20, 20, 25,
584 19, 23, 19, 19, 19, 29, 19, 20, 22, 22,
585 24, 23, 24, 33, 34, 42, 43, 43, 45, 48,
586 25, 29, 45, 42, 60, 49, 52, 52, 52, 44,
588 34, 53, 53, 41, 33, 36, 36, 52, 61, 61,
589 48, 49, 55, 55, 55, 69, 69, 36, 36, 36,
590 39, 39, 39, 59, 59, 35, 59, 39, 39, 39,
591 61, 32, 15, 39, 51, 51, 58, 58, 12, 68,
592 58, 68, 62, 62, 5, 4, 51, 51, 65, 65,
593 65, 71, 2, 71, 0, 51, 51, 51, 70, 51,
594 56, 56, 56, 62, 64, 64, 64, 62, 56, 56,
595 0, 0, 0, 56, 63, 64, 0, 0, 0, 70,
596 70, 0, 0, 70, 0, 63, 63, 63, 0, 0,
597 0, 63, 63, 63, 66, 66, 66, 0, 0, 0,
599 0, 0, 66, 66, 0, 0, 0, 66, 76, 76,
600 76, 76, 76, 76, 76, 76, 77, 0, 0, 77,
601 77, 77, 78, 78, 78, 78, 78, 78, 78, 78,
602 79, 79, 79, 79, 79, 79, 79, 79, 80, 0,
603 80, 80, 80, 80, 80, 80, 81, 0, 81, 81,
604 81, 81, 81, 81, 82, 82, 0, 82, 83, 0,
605 83, 84, 84, 84, 85, 0, 85, 86, 86, 86,
606 86, 86, 86, 86, 86, 87, 87, 87, 87, 87,
607 87, 87, 87, 75, 75, 75, 75, 75, 75, 75,
608 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
610 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
614 static yy_state_type yy_last_accepting_state;
615 static char *yy_last_accepting_cpos;
617 extern int yy_flex_debug;
618 int yy_flex_debug = 1;
620 static yyconst flex_int16_t yy_rule_linenum[13] =
622 71, 72, 73, 76, 79, 80, 81, 87, 88, 89,
626 /* The intent behind this definition is that it'll catch
627 * any uses of REJECT which flex missed.
629 #define REJECT reject_used_but_not_detected
630 #define yymore() yymore_used_but_not_detected
631 #define YY_MORE_ADJ 0
632 #define YY_RESTORE_YY_MORE_OFFSET
634 #line 1 "scripts/genksyms/lex.l"
635 /* Lexical analysis for genksyms.
636 Copyright 1996, 1997 Linux International.
638 New implementation contributed by Richard Henderson <rth@tamu.edu>
639 Based on original work by Bjorn Ekwall <bj0rn@blox.se>
641 Taken from Linux modutils 2.4.22.
643 This program is free software; you can redistribute it and/or modify it
644 under the terms of the GNU General Public License as published by the
645 Free Software Foundation; either version 2 of the License, or (at your
646 option) any later version.
648 This program is distributed in the hope that it will be useful, but
649 WITHOUT ANY WARRANTY; without even the implied warranty of
650 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
651 General Public License for more details.
653 You should have received a copy of the GNU General Public License
654 along with this program; if not, write to the Free Software Foundation,
655 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
656 #line 25 "scripts/genksyms/lex.l"
663 #include "genksyms.h"
666 /* We've got a two-level lexer here. We let flex do basic tokenization
667 and then we categorize those basic tokens in the second stage. */
668 #define YY_DECL static int yylex1(void)
670 /* Version 2 checksumming does proper tokenization; version 1 wasn't
671 quite so pedantic. */
673 /* We don't do multiple input files. */
674 #define YY_NO_INPUT 1
675 #line 676 "scripts/genksyms/lex.c"
680 #ifndef YY_NO_UNISTD_H
681 /* Special case for "unistd.h", since it is non-ANSI. We include it way
682 * down here because we want the user's section 1 to have been scanned first.
683 * The user has a chance to override it with an option.
692 #ifndef YY_EXTRA_TYPE
693 #define YY_EXTRA_TYPE void *
696 /* %if-c-only Reentrant structure and macros (non-C++). */
700 static int yy_init_globals (void );
705 /* %endif End reentrant structures and macros. */
707 /* Accessor methods to globals.
708 These are made visible to non-reentrant scanners for convenience. */
710 int yylex_destroy (void );
712 int yyget_debug (void );
714 void yyset_debug (int debug_flag );
716 YY_EXTRA_TYPE yyget_extra (void );
718 void yyset_extra (YY_EXTRA_TYPE user_defined );
720 FILE *yyget_in (void );
722 void yyset_in (FILE * in_str );
724 FILE *yyget_out (void );
726 void yyset_out (FILE * out_str );
728 int yyget_leng (void );
730 char *yyget_text (void );
732 int yyget_lineno (void );
734 void yyset_lineno (int line_number );
736 /* %if-bison-bridge */
739 /* Macros after this point can all be overridden by user definitions in
743 #ifndef YY_SKIP_YYWRAP
745 extern "C" int yywrap (void );
747 extern int yywrap (void );
751 /* %not-for-header */
753 static void yyunput (int c,char *buf_ptr );
760 static void yy_flex_strncpy (char *,yyconst char *,int );
763 #ifdef YY_NEED_STRLEN
764 static int yy_flex_strlen (yyconst char * );
768 /* %if-c-only Standard (non-C++) definition */
769 /* %not-for-header */
772 static int yyinput (void );
774 static int input (void );
785 /* Amount of stuff to slurp up with each read. */
786 #ifndef YY_READ_BUF_SIZE
787 #define YY_READ_BUF_SIZE 8192
790 /* Copy whatever the last rule matched to the standard output. */
792 /* %if-c-only Standard (non-C++) definition */
793 /* This used to be an fputs(), but since the string might contain NUL's,
794 * we now use fwrite().
796 #define ECHO fwrite( yytext, yyleng, 1, yyout )
798 /* %if-c++-only C++ definition */
802 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
803 * is returned in "result".
806 #define YY_INPUT(buf,result,max_size) \
807 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
808 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
812 for ( n = 0; n < max_size && \
813 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
816 buf[n++] = (char) c; \
817 if ( c == EOF && ferror( yyin ) ) \
818 YY_FATAL_ERROR( "input in flex scanner failed" ); \
824 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
826 if( errno != EINTR) \
828 YY_FATAL_ERROR( "input in flex scanner failed" ); \
836 /* %if-c++-only C++ definition \ */\
841 /* No semi-colon after return; correct usage is to write "yyterminate();" -
842 * we don't want an extra ';' after the "return" because that will cause
843 * some compilers to complain about unreachable statements.
846 #define yyterminate() return YY_NULL
849 /* Number of entries by which start-condition stack grows. */
850 #ifndef YY_START_STACK_INCR
851 #define YY_START_STACK_INCR 25
854 /* Report a fatal error. */
855 #ifndef YY_FATAL_ERROR
857 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
863 /* %if-tables-serialization structures and prototypes */
864 /* %not-for-header */
868 /* %not-for-header */
870 /* %tables-yydmap generated elements */
872 /* end tables serialization structures and prototypes */
876 /* Default declaration of generated scanner - a define so the user can
877 * easily add parameters.
880 #define YY_DECL_IS_OURS 1
881 /* %if-c-only Standard (non-C++) definition */
883 extern int yylex (void);
885 #define YY_DECL int yylex (void)
887 /* %if-c++-only C++ definition */
889 #endif /* !YY_DECL */
891 /* Code executed at the beginning of each rule, after yytext and yyleng
894 #ifndef YY_USER_ACTION
895 #define YY_USER_ACTION
898 /* Code executed at the end of each rule. */
900 #define YY_BREAK break;
903 /* %% [6.0] YY_RULE_SETUP definition goes here */
904 #define YY_RULE_SETUP \
906 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
907 (yytext[yyleng - 1] == '\n'); \
910 /* %not-for-header */
912 /** The main scanner function which does all the work.
916 register yy_state_type yy_current_state;
917 register char *yy_cp, *yy_bp;
920 /* %% [7.0] user's declarations go here */
921 #line 67 "scripts/genksyms/lex.l"
925 /* Keep track of our location in the original source files. */
926 #line 927 "scripts/genksyms/lex.c"
937 (yy_start) = 1; /* first start state */
953 if ( ! YY_CURRENT_BUFFER ) {
954 yyensure_buffer_stack ();
955 YY_CURRENT_BUFFER_LVALUE =
956 yy_create_buffer(yyin,YY_BUF_SIZE );
959 yy_load_buffer_state( );
962 while ( 1 ) /* loops until end-of-file is reached */
964 /* %% [8.0] yymore()-related code goes here */
965 yy_cp = (yy_c_buf_p);
967 /* Support of yytext. */
968 *yy_cp = (yy_hold_char);
970 /* yy_bp points to the position in yy_ch_buf of the start of
975 /* %% [9.0] code to set up and find next match goes here */
976 yy_current_state = (yy_start);
977 yy_current_state += YY_AT_BOL();
981 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
982 if ( yy_accept[yy_current_state] )
984 (yy_last_accepting_state) = yy_current_state;
985 (yy_last_accepting_cpos) = yy_cp;
987 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
989 yy_current_state = (int) yy_def[yy_current_state];
990 if ( yy_current_state >= 76 )
991 yy_c = yy_meta[(unsigned int) yy_c];
993 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
996 while ( yy_base[yy_current_state] != 284 );
999 /* %% [10.0] code to find the action number goes here */
1000 yy_act = yy_accept[yy_current_state];
1002 { /* have to back up */
1003 yy_cp = (yy_last_accepting_cpos);
1004 yy_current_state = (yy_last_accepting_state);
1005 yy_act = yy_accept[yy_current_state];
1008 YY_DO_BEFORE_ACTION;
1010 /* %% [11.0] code for yylineno update goes here */
1012 do_action: /* This label is used only to access EOF actions. */
1014 /* %% [12.0] debug code goes here */
1015 if ( yy_flex_debug )
1018 fprintf( stderr, "--scanner backing up\n" );
1019 else if ( yy_act < 13 )
1020 fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
1021 (long)yy_rule_linenum[yy_act], yytext );
1022 else if ( yy_act == 13 )
1023 fprintf( stderr, "--accepting default rule (\"%s\")\n",
1025 else if ( yy_act == 14 )
1026 fprintf( stderr, "--(end of buffer or a NUL)\n" );
1028 fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
1032 { /* beginning of action switch */
1033 /* %% [13.0] actions go here */
1034 case 0: /* must back up */
1035 /* undo the effects of YY_DO_BEFORE_ACTION */
1036 *yy_cp = (yy_hold_char);
1037 yy_cp = (yy_last_accepting_cpos);
1038 yy_current_state = (yy_last_accepting_state);
1039 goto yy_find_action;
1042 /* rule 1 can match eol */
1044 #line 71 "scripts/genksyms/lex.l"
1048 /* rule 2 can match eol */
1050 #line 72 "scripts/genksyms/lex.l"
1054 /* rule 3 can match eol */
1056 #line 73 "scripts/genksyms/lex.l"
1059 /* Ignore all other whitespace. */
1062 #line 76 "scripts/genksyms/lex.l"
1066 /* rule 5 can match eol */
1068 #line 79 "scripts/genksyms/lex.l"
1072 /* rule 6 can match eol */
1074 #line 80 "scripts/genksyms/lex.l"
1079 #line 81 "scripts/genksyms/lex.l"
1082 /* The Pedant requires that the other C multi-character tokens be
1083 recognized as tokens. We don't actually use them since we don't
1084 parse expressions, but we do want whitespace to be arranged
1085 around them properly. */
1088 #line 87 "scripts/genksyms/lex.l"
1093 #line 88 "scripts/genksyms/lex.l"
1098 #line 89 "scripts/genksyms/lex.l"
1103 #line 91 "scripts/genksyms/lex.l"
1106 /* All other tokens are single characters. */
1109 #line 94 "scripts/genksyms/lex.l"
1114 #line 97 "scripts/genksyms/lex.l"
1117 #line 1118 "scripts/genksyms/lex.c"
1118 case YY_STATE_EOF(INITIAL):
1119 case YY_STATE_EOF(V2_TOKENS):
1122 case YY_END_OF_BUFFER:
1124 /* Amount of text matched not including the EOB char. */
1125 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1127 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1128 *yy_cp = (yy_hold_char);
1129 YY_RESTORE_YY_MORE_OFFSET
1131 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1133 /* We're scanning a new file or input source. It's
1134 * possible that this happened because the user
1135 * just pointed yyin at a new source and called
1136 * yylex(). If so, then we have to assure
1137 * consistency between YY_CURRENT_BUFFER and our
1138 * globals. Here is the right place to do so, because
1139 * this is the first action (other than possibly a
1140 * back-up) that will match for the new input source.
1142 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1143 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1144 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1147 /* Note that here we test for yy_c_buf_p "<=" to the position
1148 * of the first EOB in the buffer, since yy_c_buf_p will
1149 * already have been incremented past the NUL character
1150 * (since all states make transitions on EOB to the
1151 * end-of-buffer state). Contrast this with the test
1154 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1155 { /* This was really a NUL. */
1156 yy_state_type yy_next_state;
1158 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1160 yy_current_state = yy_get_previous_state( );
1162 /* Okay, we're now positioned to make the NUL
1163 * transition. We couldn't have
1164 * yy_get_previous_state() go ahead and do it
1165 * for us because it doesn't know how to deal
1166 * with the possibility of jamming (and we don't
1167 * want to build jamming into it because then it
1168 * will run more slowly).
1171 yy_next_state = yy_try_NUL_trans( yy_current_state );
1173 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1175 if ( yy_next_state )
1177 /* Consume the NUL. */
1178 yy_cp = ++(yy_c_buf_p);
1179 yy_current_state = yy_next_state;
1185 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
1186 yy_cp = (yy_c_buf_p);
1187 goto yy_find_action;
1191 else switch ( yy_get_next_buffer( ) )
1193 case EOB_ACT_END_OF_FILE:
1195 (yy_did_buffer_switch_on_eof) = 0;
1199 /* Note: because we've taken care in
1200 * yy_get_next_buffer() to have set up
1201 * yytext, we can now set up
1202 * yy_c_buf_p so that if some total
1203 * hoser (like flex itself) wants to
1204 * call the scanner after we return the
1205 * YY_NULL, it'll still work - another
1206 * YY_NULL will get returned.
1208 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1210 yy_act = YY_STATE_EOF(YY_START);
1216 if ( ! (yy_did_buffer_switch_on_eof) )
1222 case EOB_ACT_CONTINUE_SCAN:
1224 (yytext_ptr) + yy_amount_of_matched_text;
1226 yy_current_state = yy_get_previous_state( );
1228 yy_cp = (yy_c_buf_p);
1229 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1232 case EOB_ACT_LAST_MATCH:
1234 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1236 yy_current_state = yy_get_previous_state( );
1238 yy_cp = (yy_c_buf_p);
1239 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1240 goto yy_find_action;
1247 "fatal flex scanner internal error--no action found" );
1248 } /* end of action switch */
1249 } /* end of scanning one token */
1250 } /* end of yylex */
1251 /* %ok-for-header */
1254 /* %not-for-header */
1256 /* %ok-for-header */
1260 /* yy_get_next_buffer - try to read in a new buffer
1262 * Returns a code representing an action:
1263 * EOB_ACT_LAST_MATCH -
1264 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1265 * EOB_ACT_END_OF_FILE - end of file
1268 static int yy_get_next_buffer (void)
1273 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1274 register char *source = (yytext_ptr);
1275 register int number_to_move, i;
1278 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1280 "fatal flex scanner internal error--end of buffer missed" );
1282 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1283 { /* Don't try to fill the buffer, so this is an EOF. */
1284 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1286 /* We matched a single character, the EOB, so
1287 * treat this as a final EOF.
1289 return EOB_ACT_END_OF_FILE;
1294 /* We matched some text prior to the EOB, first
1297 return EOB_ACT_LAST_MATCH;
1301 /* Try to read more data. */
1303 /* First move last chars to start of buffer. */
1304 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1306 for ( i = 0; i < number_to_move; ++i )
1307 *(dest++) = *(source++);
1309 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1310 /* don't do the read, it's not guaranteed to return an EOF,
1313 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1318 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1320 while ( num_to_read <= 0 )
1321 { /* Not enough room in the buffer - grow it. */
1323 /* just a shorter name for the current buffer */
1324 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1326 int yy_c_buf_p_offset =
1327 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1329 if ( b->yy_is_our_buffer )
1331 int new_size = b->yy_buf_size * 2;
1333 if ( new_size <= 0 )
1334 b->yy_buf_size += b->yy_buf_size / 8;
1336 b->yy_buf_size *= 2;
1338 b->yy_ch_buf = (char *)
1339 /* Include room in for 2 EOB chars. */
1340 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1343 /* Can't grow it, we don't own it. */
1346 if ( ! b->yy_ch_buf )
1348 "fatal error - scanner input buffer overflow" );
1350 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1352 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1357 if ( num_to_read > YY_READ_BUF_SIZE )
1358 num_to_read = YY_READ_BUF_SIZE;
1360 /* Read in more data. */
1361 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1362 (yy_n_chars), (size_t) num_to_read );
1364 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1367 if ( (yy_n_chars) == 0 )
1369 if ( number_to_move == YY_MORE_ADJ )
1371 ret_val = EOB_ACT_END_OF_FILE;
1377 ret_val = EOB_ACT_LAST_MATCH;
1378 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1379 YY_BUFFER_EOF_PENDING;
1384 ret_val = EOB_ACT_CONTINUE_SCAN;
1386 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1387 /* Extend the array by 50%, plus the number we really need. */
1388 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1389 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1390 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1391 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1394 (yy_n_chars) += number_to_move;
1395 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1396 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1398 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1403 /* yy_get_previous_state - get the state just before the EOB char was reached */
1406 /* %not-for-header */
1408 static yy_state_type yy_get_previous_state (void)
1413 register yy_state_type yy_current_state;
1414 register char *yy_cp;
1416 /* %% [15.0] code to get the start state into yy_current_state goes here */
1417 yy_current_state = (yy_start);
1418 yy_current_state += YY_AT_BOL();
1420 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1422 /* %% [16.0] code to find the next state goes here */
1423 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1424 if ( yy_accept[yy_current_state] )
1426 (yy_last_accepting_state) = yy_current_state;
1427 (yy_last_accepting_cpos) = yy_cp;
1429 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1431 yy_current_state = (int) yy_def[yy_current_state];
1432 if ( yy_current_state >= 76 )
1433 yy_c = yy_meta[(unsigned int) yy_c];
1435 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1438 return yy_current_state;
1441 /* yy_try_NUL_trans - try to make a transition on the NUL character
1444 * next_state = yy_try_NUL_trans( current_state );
1447 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1452 register int yy_is_jam;
1453 /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
1454 register char *yy_cp = (yy_c_buf_p);
1456 register YY_CHAR yy_c = 1;
1457 if ( yy_accept[yy_current_state] )
1459 (yy_last_accepting_state) = yy_current_state;
1460 (yy_last_accepting_cpos) = yy_cp;
1462 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1464 yy_current_state = (int) yy_def[yy_current_state];
1465 if ( yy_current_state >= 76 )
1466 yy_c = yy_meta[(unsigned int) yy_c];
1468 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1469 yy_is_jam = (yy_current_state == 75);
1471 return yy_is_jam ? 0 : yy_current_state;
1476 static void yyunput (int c, register char * yy_bp )
1481 register char *yy_cp;
1483 yy_cp = (yy_c_buf_p);
1485 /* undo effects of setting up yytext */
1486 *yy_cp = (yy_hold_char);
1488 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1489 { /* need to shift things up to make room */
1490 /* +2 for EOB chars. */
1491 register int number_to_move = (yy_n_chars) + 2;
1492 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1493 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1494 register char *source =
1495 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1497 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1498 *--dest = *--source;
1500 yy_cp += (int) (dest - source);
1501 yy_bp += (int) (dest - source);
1502 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1503 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1505 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1506 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1509 *--yy_cp = (char) c;
1511 /* %% [18.0] update yylineno here */
1513 (yytext_ptr) = yy_bp;
1514 (yy_hold_char) = *yy_cp;
1515 (yy_c_buf_p) = yy_cp;
1524 static int yyinput (void)
1526 static int input (void)
1535 *(yy_c_buf_p) = (yy_hold_char);
1537 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1539 /* yy_c_buf_p now points to the character we want to return.
1540 * If this occurs *before* the EOB characters, then it's a
1541 * valid NUL; if not, then we've hit the end of the buffer.
1543 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1544 /* This was really a NUL. */
1545 *(yy_c_buf_p) = '\0';
1548 { /* need more input */
1549 int offset = (yy_c_buf_p) - (yytext_ptr);
1552 switch ( yy_get_next_buffer( ) )
1554 case EOB_ACT_LAST_MATCH:
1555 /* This happens because yy_g_n_b()
1556 * sees that we've accumulated a
1557 * token and flags that we need to
1558 * try matching the token before
1559 * proceeding. But for input(),
1560 * there's no matching to consider.
1561 * So convert the EOB_ACT_LAST_MATCH
1562 * to EOB_ACT_END_OF_FILE.
1565 /* Reset buffer status. */
1570 case EOB_ACT_END_OF_FILE:
1575 if ( ! (yy_did_buffer_switch_on_eof) )
1584 case EOB_ACT_CONTINUE_SCAN:
1585 (yy_c_buf_p) = (yytext_ptr) + offset;
1591 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1592 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1593 (yy_hold_char) = *++(yy_c_buf_p);
1595 /* %% [19.0] update BOL and yylineno */
1596 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1601 #endif /* ifndef YY_NO_INPUT */
1604 /** Immediately switch to a different input stream.
1605 * @param input_file A readable stream.
1607 * @note This function does not reset the start condition to @c INITIAL .
1610 void yyrestart (FILE * input_file )
1616 if ( ! YY_CURRENT_BUFFER ){
1617 yyensure_buffer_stack ();
1618 YY_CURRENT_BUFFER_LVALUE =
1619 yy_create_buffer(yyin,YY_BUF_SIZE );
1622 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1623 yy_load_buffer_state( );
1626 /** Switch to a different input buffer.
1627 * @param new_buffer The new input buffer.
1631 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1637 /* TODO. We should be able to replace this entire function body
1639 * yypop_buffer_state();
1640 * yypush_buffer_state(new_buffer);
1642 yyensure_buffer_stack ();
1643 if ( YY_CURRENT_BUFFER == new_buffer )
1646 if ( YY_CURRENT_BUFFER )
1648 /* Flush out information for old buffer. */
1649 *(yy_c_buf_p) = (yy_hold_char);
1650 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1651 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1654 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1655 yy_load_buffer_state( );
1657 /* We don't actually know whether we did this switch during
1658 * EOF (yywrap()) processing, but the only time this flag
1659 * is looked at is after yywrap() is called, so it's safe
1660 * to go ahead and always set it.
1662 (yy_did_buffer_switch_on_eof) = 1;
1666 static void yy_load_buffer_state (void)
1671 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1672 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1673 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1674 (yy_hold_char) = *(yy_c_buf_p);
1677 /** Allocate and initialize an input buffer state.
1678 * @param file A readable stream.
1679 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1681 * @return the allocated buffer state.
1684 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1691 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1693 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1695 b->yy_buf_size = size;
1697 /* yy_ch_buf has to be 2 characters longer than the size given because
1698 * we need to put in 2 end-of-buffer characters.
1700 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1701 if ( ! b->yy_ch_buf )
1702 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1704 b->yy_is_our_buffer = 1;
1706 yy_init_buffer(b,file );
1711 /** Destroy the buffer.
1712 * @param b a buffer created with yy_create_buffer()
1716 void yy_delete_buffer (YY_BUFFER_STATE b )
1725 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1726 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1728 if ( b->yy_is_our_buffer )
1729 yyfree((void *) b->yy_ch_buf );
1731 yyfree((void *) b );
1737 extern int isatty (int );
1738 #endif /* __cplusplus */
1745 /* Initializes or reinitializes a buffer.
1746 * This function is sometimes called more than once on the same buffer,
1747 * such as during a yyrestart() or at EOF.
1750 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1758 yy_flush_buffer(b );
1760 b->yy_input_file = file;
1761 b->yy_fill_buffer = 1;
1763 /* If b is the current buffer, then yy_init_buffer was _probably_
1764 * called from yyrestart() or through yy_get_next_buffer.
1765 * In that case, we don't want to reset the lineno or column.
1767 if (b != YY_CURRENT_BUFFER){
1768 b->yy_bs_lineno = 1;
1769 b->yy_bs_column = 0;
1774 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1782 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1783 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1787 void yy_flush_buffer (YY_BUFFER_STATE b )
1797 /* We always need two end-of-buffer characters. The first causes
1798 * a transition to the end-of-buffer state. The second causes
1799 * a jam in that state.
1801 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1802 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1804 b->yy_buf_pos = &b->yy_ch_buf[0];
1807 b->yy_buffer_status = YY_BUFFER_NEW;
1809 if ( b == YY_CURRENT_BUFFER )
1810 yy_load_buffer_state( );
1814 /** Pushes the new state onto the stack. The new state becomes
1815 * the current state. This function will allocate the stack
1817 * @param new_buffer The new state.
1821 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1826 if (new_buffer == NULL)
1829 yyensure_buffer_stack();
1831 /* This block is copied from yy_switch_to_buffer. */
1832 if ( YY_CURRENT_BUFFER )
1834 /* Flush out information for old buffer. */
1835 *(yy_c_buf_p) = (yy_hold_char);
1836 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1837 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1840 /* Only push if top exists. Otherwise, replace top. */
1841 if (YY_CURRENT_BUFFER)
1842 (yy_buffer_stack_top)++;
1843 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1845 /* copied from yy_switch_to_buffer. */
1846 yy_load_buffer_state( );
1847 (yy_did_buffer_switch_on_eof) = 1;
1852 /** Removes and deletes the top of the stack, if present.
1853 * The next element becomes the new top.
1857 void yypop_buffer_state (void)
1862 if (!YY_CURRENT_BUFFER)
1865 yy_delete_buffer(YY_CURRENT_BUFFER );
1866 YY_CURRENT_BUFFER_LVALUE = NULL;
1867 if ((yy_buffer_stack_top) > 0)
1868 --(yy_buffer_stack_top);
1870 if (YY_CURRENT_BUFFER) {
1871 yy_load_buffer_state( );
1872 (yy_did_buffer_switch_on_eof) = 1;
1878 /* Allocates the stack if it does not exist.
1879 * Guarantees space for at least one push.
1882 static void yyensure_buffer_stack (void)
1889 if (!(yy_buffer_stack)) {
1891 /* First allocation is just for 2 elements, since we don't know if this
1892 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1893 * immediate realloc on the next call.
1896 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1897 (num_to_alloc * sizeof(struct yy_buffer_state*)
1899 if ( ! (yy_buffer_stack) )
1900 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1902 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1904 (yy_buffer_stack_max) = num_to_alloc;
1905 (yy_buffer_stack_top) = 0;
1909 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1911 /* Increase the buffer to prepare for a possible push. */
1912 int grow_size = 8 /* arbitrary grow size */;
1914 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1915 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1917 num_to_alloc * sizeof(struct yy_buffer_state*)
1919 if ( ! (yy_buffer_stack) )
1920 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1922 /* zero only the new slots.*/
1923 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1924 (yy_buffer_stack_max) = num_to_alloc;
1930 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1931 * @param base the character buffer
1932 * @param size the size in bytes of the character buffer
1934 * @return the newly allocated buffer state object.
1936 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1941 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1942 base[size-1] != YY_END_OF_BUFFER_CHAR )
1943 /* They forgot to leave room for the EOB's. */
1946 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1948 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1950 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1951 b->yy_buf_pos = b->yy_ch_buf = base;
1952 b->yy_is_our_buffer = 0;
1953 b->yy_input_file = 0;
1954 b->yy_n_chars = b->yy_buf_size;
1955 b->yy_is_interactive = 0;
1957 b->yy_fill_buffer = 0;
1958 b->yy_buffer_status = YY_BUFFER_NEW;
1960 yy_switch_to_buffer(b );
1967 /** Setup the input buffer state to scan a string. The next call to yylex() will
1968 * scan from a @e copy of @a str.
1969 * @param yystr a NUL-terminated string to scan
1971 * @return the newly allocated buffer state object.
1972 * @note If you want to scan bytes that may contain NUL values, then use
1973 * yy_scan_bytes() instead.
1975 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1978 return yy_scan_bytes(yystr,strlen(yystr) );
1983 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1984 * scan from a @e copy of @a bytes.
1985 * @param bytes the byte buffer to scan
1986 * @param len the number of bytes in the buffer pointed to by @a bytes.
1988 * @return the newly allocated buffer state object.
1990 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1997 /* Get memory for full buffer, including space for trailing EOB's. */
1998 n = _yybytes_len + 2;
1999 buf = (char *) yyalloc(n );
2001 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2003 for ( i = 0; i < _yybytes_len; ++i )
2004 buf[i] = yybytes[i];
2006 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2008 b = yy_scan_buffer(buf,n );
2010 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2012 /* It's okay to grow etc. this buffer, and we should throw it
2013 * away when we're done.
2015 b->yy_is_our_buffer = 1;
2021 #ifndef YY_EXIT_FAILURE
2022 #define YY_EXIT_FAILURE 2
2026 static void yy_fatal_error (yyconst char* msg )
2028 (void) fprintf( stderr, "%s\n", msg );
2029 exit( YY_EXIT_FAILURE );
2035 /* Redefine yyless() so it works in section 3 code. */
2041 /* Undo effects of setting up yytext. */ \
2042 int yyless_macro_arg = (n); \
2043 YY_LESS_LINENO(yyless_macro_arg);\
2044 yytext[yyleng] = (yy_hold_char); \
2045 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2046 (yy_hold_char) = *(yy_c_buf_p); \
2047 *(yy_c_buf_p) = '\0'; \
2048 yyleng = yyless_macro_arg; \
2052 /* Accessor methods (get/set functions) to struct members. */
2058 /** Get the current line number.
2061 int yyget_lineno (void)
2067 /** Get the input stream.
2070 FILE *yyget_in (void)
2075 /** Get the output stream.
2078 FILE *yyget_out (void)
2083 /** Get the length of the current token.
2086 int yyget_leng (void)
2091 /** Get the current token.
2095 char *yyget_text (void)
2103 /** Set the current line number.
2104 * @param line_number
2107 void yyset_lineno (int line_number )
2110 yylineno = line_number;
2113 /** Set the input stream. This does not discard the current
2115 * @param in_str A readable stream.
2117 * @see yy_switch_to_buffer
2119 void yyset_in (FILE * in_str )
2124 void yyset_out (FILE * out_str )
2129 int yyget_debug (void)
2131 return yy_flex_debug;
2134 void yyset_debug (int bdebug )
2136 yy_flex_debug = bdebug ;
2142 /* %if-bison-bridge */
2144 /* %endif if-c-only */
2147 static int yy_init_globals (void)
2149 /* Initialization is the same as for the non-reentrant scanner.
2150 * This function is called from yylex_destroy(), so don't allocate here.
2153 (yy_buffer_stack) = 0;
2154 (yy_buffer_stack_top) = 0;
2155 (yy_buffer_stack_max) = 0;
2156 (yy_c_buf_p) = (char *) 0;
2160 /* Defined in main.c */
2169 /* For future reference: Set errno on error, since we are called by
2176 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2177 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2178 int yylex_destroy (void)
2181 /* Pop the buffer stack, destroying each element. */
2182 while(YY_CURRENT_BUFFER){
2183 yy_delete_buffer(YY_CURRENT_BUFFER );
2184 YY_CURRENT_BUFFER_LVALUE = NULL;
2185 yypop_buffer_state();
2188 /* Destroy the stack itself. */
2189 yyfree((yy_buffer_stack) );
2190 (yy_buffer_stack) = NULL;
2192 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2193 * yylex() is called, initialization will occur. */
2203 * Internal utility routines.
2207 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2210 for ( i = 0; i < n; ++i )
2215 #ifdef YY_NEED_STRLEN
2216 static int yy_flex_strlen (yyconst char * s )
2219 for ( n = 0; s[n]; ++n )
2226 void *yyalloc (yy_size_t size )
2228 return (void *) malloc( size );
2231 void *yyrealloc (void * ptr, yy_size_t size )
2233 /* The cast to (char *) in the following accommodates both
2234 * implementations that use char* generic pointers, and those
2235 * that use void* generic pointers. It works with the latter
2236 * because both ANSI C and C++ allow castless assignment from
2237 * any pointer type to void*, and deal with argument conversions
2238 * as though doing an assignment.
2240 return (void *) realloc( (char *) ptr, size );
2243 void yyfree (void * ptr )
2245 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2248 /* %if-tables-serialization definitions */
2249 /* %define-yytables The name for this specific scanner's tables. */
2250 #define YYTABLES_NAME "yytables"
2253 /* %ok-for-header */
2255 #line 97 "scripts/genksyms/lex.l"
2259 /* Bring in the keyword recognizer. */
2261 #include "keywords.c"
2264 /* Macros to append to our phrase collection list. */
2266 #define _APP(T,L) do { \
2267 cur_node = next_node; \
2268 next_node = xmalloc(sizeof(*next_node)); \
2269 next_node->next = cur_node; \
2270 cur_node->string = memcpy(xmalloc(L+1), T, L+1); \
2271 cur_node->tag = SYM_NORMAL; \
2274 #define APP _APP(yytext, yyleng)
2277 /* The second stage lexer. Here we incorporate knowledge of the state
2278 of the parser to tailor the tokens that are returned. */
2284 ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_BRACKET, ST_BRACE,
2285 ST_EXPRESSION, ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4,
2286 ST_TABLE_5, ST_TABLE_6
2287 } lexstate = ST_NOTSTARTED;
2289 static int suppress_type_lookup, dont_want_brace_phrase;
2290 static struct string_list *next_node;
2292 int token, count = 0;
2293 struct string_list *cur_node;
2295 if (lexstate == ST_NOTSTARTED)
2298 next_node = xmalloc(sizeof(*next_node));
2299 next_node->next = NULL;
2300 lexstate = ST_NORMAL;
2308 else if (token == FILENAME)
2312 /* Save the filename and line number for later error messages. */
2317 file = strchr(yytext, '\"')+1;
2318 e = strchr(file, '\"');
2320 cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1);
2321 cur_line = atoi(yytext+2);
2334 const struct resword *r = is_reserved_word(yytext, yyleng);
2337 switch (token = r->token)
2339 case ATTRIBUTE_KEYW:
2340 lexstate = ST_ATTRIBUTE;
2350 dont_want_brace_phrase = 3;
2352 suppress_type_lookup = 2;
2355 case EXPORT_SYMBOL_KEYW:
2359 if (!suppress_type_lookup)
2361 struct symbol *sym = find_symbol(yytext, SYM_TYPEDEF);
2362 if (sym && sym->type == SYM_TYPEDEF)
2370 lexstate = ST_BRACKET;
2376 if (dont_want_brace_phrase)
2378 lexstate = ST_BRACE;
2384 lexstate = ST_EXPRESSION;
2404 lexstate = ST_NORMAL;
2405 token = ATTRIBUTE_PHRASE;
2424 lexstate = ST_NORMAL;
2444 lexstate = ST_NORMAL;
2445 token = BRACKET_PHRASE;
2464 lexstate = ST_NORMAL;
2465 token = BRACE_PHRASE;
2477 case '(': case '[': case '{':
2481 case ')': case ']': case '}':
2488 /* Put back the token we just read so's we can find it again
2489 after registering the expression. */
2492 lexstate = ST_NORMAL;
2493 token = EXPRESSION_PHRASE;
2508 if (token == IDENT && yyleng == 1 && yytext[0] == 'X')
2510 token = EXPORT_SYMBOL_KEYW;
2511 lexstate = ST_TABLE_5;
2515 lexstate = ST_TABLE_6;
2521 case '{': case '[': case '(':
2524 case '}': case ']': case ')':
2529 lexstate = ST_TABLE_2;
2539 lexstate = ST_NORMAL;
2547 lexstate = ST_TABLE_2;
2561 if (suppress_type_lookup > 0)
2562 --suppress_type_lookup;
2563 if (dont_want_brace_phrase > 0)
2564 --dont_want_brace_phrase;
2566 yylval = &next_node->next;
2570 /* A Bison parser, made by GNU Bison 2.3. */
2572 /* Skeleton interface for Bison's Yacc-like parsers in C
2574 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
2575 Free Software Foundation, Inc.
2577 This program is free software; you can redistribute it and/or modify
2578 it under the terms of the GNU General Public License as published by
2579 the Free Software Foundation; either version 2, or (at your option)
2582 This program is distributed in the hope that it will be useful,
2583 but WITHOUT ANY WARRANTY; without even the implied warranty of
2584 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2585 GNU General Public License for more details.
2587 You should have received a copy of the GNU General Public License
2588 along with this program; if not, write to the Free Software
2589 Foundation, Inc., 51 Franklin Street, Fifth Floor,
2590 Boston, MA 02110-1301, USA. */
2592 /* As a special exception, you may create a larger work that contains
2593 part or all of the Bison parser skeleton and distribute that work
2594 under terms of your choice, so long as that work isn't itself a
2595 parser generator using the skeleton or a modified version thereof
2596 as a parser skeleton. Alternatively, if you modify or redistribute
2597 the parser skeleton itself, you may (at your option) remove this
2598 special exception, which will cause the skeleton and the resulting
2599 Bison output files to be licensed under the GNU General Public
2600 License without this special exception.
2602 This special exception was added by the Free Software Foundation in
2603 version 2.2 of Bison. */
2607 # define YYTOKENTYPE
2608 /* Put the tokens into the symbol table, so that GDB and other debuggers
2612 ATTRIBUTE_KEYW = 259,
2620 EXTENSION_KEYW = 267,
2625 REGISTER_KEYW = 272,
2626 RESTRICT_KEYW = 273,
2633 UNSIGNED_KEYW = 280,
2635 VOLATILE_KEYW = 282,
2637 EXPORT_SYMBOL_KEYW = 284,
2639 ATTRIBUTE_PHRASE = 286,
2641 BRACKET_PHRASE = 288,
2642 EXPRESSION_PHRASE = 289,
2655 #define ASM_KEYW 258
2656 #define ATTRIBUTE_KEYW 259
2657 #define AUTO_KEYW 260
2658 #define BOOL_KEYW 261
2659 #define CHAR_KEYW 262
2660 #define CONST_KEYW 263
2661 #define DOUBLE_KEYW 264
2662 #define ENUM_KEYW 265
2663 #define EXTERN_KEYW 266
2664 #define EXTENSION_KEYW 267
2665 #define FLOAT_KEYW 268
2666 #define INLINE_KEYW 269
2667 #define INT_KEYW 270
2668 #define LONG_KEYW 271
2669 #define REGISTER_KEYW 272
2670 #define RESTRICT_KEYW 273
2671 #define SHORT_KEYW 274
2672 #define SIGNED_KEYW 275
2673 #define STATIC_KEYW 276
2674 #define STRUCT_KEYW 277
2675 #define TYPEDEF_KEYW 278
2676 #define UNION_KEYW 279
2677 #define UNSIGNED_KEYW 280
2678 #define VOID_KEYW 281
2679 #define VOLATILE_KEYW 282
2680 #define TYPEOF_KEYW 283
2681 #define EXPORT_SYMBOL_KEYW 284
2682 #define ASM_PHRASE 285
2683 #define ATTRIBUTE_PHRASE 286
2684 #define BRACE_PHRASE 287
2685 #define BRACKET_PHRASE 288
2686 #define EXPRESSION_PHRASE 289
2695 #define FILENAME 298
2700 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
2701 typedef int YYSTYPE;
2702 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
2703 # define YYSTYPE_IS_DECLARED 1
2704 # define YYSTYPE_IS_TRIVIAL 1
2707 extern YYSTYPE yylval;