5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
12 /* %if-not-reentrant */
13 #define yy_create_buffer skel__create_buffer
14 #define yy_delete_buffer skel__delete_buffer
15 #define yy_flex_debug skel__flex_debug
16 #define yy_init_buffer skel__init_buffer
17 #define yy_flush_buffer skel__flush_buffer
18 #define yy_load_buffer_state skel__load_buffer_state
19 #define yy_switch_to_buffer skel__switch_to_buffer
21 #define yyleng skel_leng
22 #define yylex skel_lex
23 #define yylineno skel_lineno
24 #define yyout skel_out
25 #define yyrestart skel_restart
26 #define yytext skel_text
27 #define yywrap skel_wrap
28 #define yyalloc skel_alloc
29 #define yyrealloc skel_realloc
30 #define yyfree skel_free
37 #define YY_FLEX_MAJOR_VERSION 2
38 #define YY_FLEX_MINOR_VERSION 5
39 #define YY_FLEX_SUBMINOR_VERSION 35
40 #if YY_FLEX_SUBMINOR_VERSION > 0
55 /* First, we deal with platform-specific or compiler-specific issues. */
57 /* begin standard C headers. */
65 /* %if-tables-serialization */
67 /* end standard C headers. */
70 /* flex integer type definitions */
75 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
77 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
79 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
80 * if you want the limit (max/min) macros for int types.
82 #ifndef __STDC_LIMIT_MACROS
83 #define __STDC_LIMIT_MACROS 1
87 typedef int8_t flex_int8_t;
88 typedef uint8_t flex_uint8_t;
89 typedef int16_t flex_int16_t;
90 typedef uint16_t flex_uint16_t;
91 typedef int32_t flex_int32_t;
92 typedef uint32_t flex_uint32_t;
94 typedef signed char flex_int8_t;
95 typedef short int flex_int16_t;
96 typedef int flex_int32_t;
97 typedef unsigned char flex_uint8_t;
98 typedef unsigned short int flex_uint16_t;
99 typedef unsigned int flex_uint32_t;
102 /* Limits of integral types. */
104 #define INT8_MIN (-128)
107 #define INT16_MIN (-32767-1)
110 #define INT32_MIN (-2147483647-1)
113 #define INT8_MAX (127)
116 #define INT16_MAX (32767)
119 #define INT32_MAX (2147483647)
122 #define UINT8_MAX (255U)
125 #define UINT16_MAX (65535U)
128 #define UINT32_MAX (4294967295U)
131 #endif /* ! FLEXINT_H */
140 /* The "const" storage-class-modifier is valid. */
143 #else /* ! __cplusplus */
145 /* C99 requires __STDC__ to be defined as 1. */
146 #if defined (__STDC__)
150 #endif /* defined (__STDC__) */
151 #endif /* ! __cplusplus */
154 #define yyconst const
159 /* %not-for-header */
161 /* Returned upon end-of-file. */
165 /* %not-for-header */
167 /* Promotes a possibly negative, possibly signed char to an unsigned
168 * integer for use as an array index. If the signed char is negative,
169 * we want to instead treat it as an 8-bit unsigned char, hence the
172 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
178 /* %if-not-reentrant */
182 /* Enter a start condition. This macro really ought to take a parameter,
183 * but we do it the disgusting crufty way forced on us by the ()-less
184 * definition of BEGIN.
186 #define BEGIN (yy_start) = 1 + 2 *
188 /* Translate the current start state into a value that can be later handed
189 * to BEGIN to return to the state. The YYSTATE alias is for lex
192 #define YY_START (((yy_start) - 1) / 2)
193 #define YYSTATE YY_START
195 /* Action number for EOF rule of a given start state. */
196 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
198 /* Special action meaning "start processing a new file". */
199 #define YY_NEW_FILE skel_restart(skel_in )
201 #define YY_END_OF_BUFFER_CHAR 0
203 /* Size of default input buffer. */
205 #define YY_BUF_SIZE 16384
208 /* The state buf must be large enough to hold one state per character in the main buffer.
210 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
212 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
213 #define YY_TYPEDEF_YY_BUFFER_STATE
214 typedef struct yy_buffer_state *YY_BUFFER_STATE;
217 /* %if-not-reentrant */
218 extern int skel_leng;
222 /* %if-not-reentrant */
223 extern FILE *skel_in, *skel_out;
227 #define EOB_ACT_CONTINUE_SCAN 0
228 #define EOB_ACT_END_OF_FILE 1
229 #define EOB_ACT_LAST_MATCH 2
231 #define YY_LESS_LINENO(n)
233 /* Return all but the first "n" matched characters back to the input stream. */
237 /* Undo effects of setting up skel_text. */ \
238 int yyless_macro_arg = (n); \
239 YY_LESS_LINENO(yyless_macro_arg);\
240 *yy_cp = (yy_hold_char); \
241 YY_RESTORE_YY_MORE_OFFSET \
242 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
243 YY_DO_BEFORE_ACTION; /* set up skel_text again */ \
247 #define unput(c) yyunput( c, (yytext_ptr) )
249 #ifndef YY_TYPEDEF_YY_SIZE_T
250 #define YY_TYPEDEF_YY_SIZE_T
251 typedef size_t yy_size_t;
254 #ifndef YY_STRUCT_YY_BUFFER_STATE
255 #define YY_STRUCT_YY_BUFFER_STATE
256 struct yy_buffer_state
265 char *yy_ch_buf; /* input buffer */
266 char *yy_buf_pos; /* current position in input buffer */
268 /* Size of input buffer in bytes, not including room for EOB
271 yy_size_t yy_buf_size;
273 /* Number of characters read into yy_ch_buf, not including EOB
278 /* Whether we "own" the buffer - i.e., we know we created it,
279 * and can realloc() it to grow it, and should free() it to
282 int yy_is_our_buffer;
284 /* Whether this is an "interactive" input source; if so, and
285 * if we're using stdio for input, then we want to use getc()
286 * instead of fread(), to make sure we stop fetching input after
289 int yy_is_interactive;
291 /* Whether we're considered to be at the beginning of a line.
292 * If so, '^' rules will be active on the next match, otherwise
297 int yy_bs_lineno; /**< The line count. */
298 int yy_bs_column; /**< The column count. */
300 /* Whether to try to fill the input buffer when we reach the
305 int yy_buffer_status;
307 #define YY_BUFFER_NEW 0
308 #define YY_BUFFER_NORMAL 1
309 /* When an EOF's been seen but there's still some text to process
310 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
311 * shouldn't try reading from the input source any more. We might
312 * still have a bunch of tokens to match, though, because of
313 * possible backing-up.
315 * When we actually see the EOF, we change the status to "new"
316 * (via skel_restart()), so that the user can continue scanning by
317 * just pointing skel_in at a new input file.
319 #define YY_BUFFER_EOF_PENDING 2
322 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
324 /* %if-c-only Standard (non-C++) definition */
325 /* %not-for-header */
327 /* %if-not-reentrant */
329 /* Stack of input buffers. */
330 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
331 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
332 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
338 /* We provide macros for accessing buffer states in case in the
339 * future we want to put the buffer states in a more general
342 * Returns the top of the stack, or NULL.
344 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
345 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
348 /* Same as previous macro, but useful when we know that the buffer stack is not
349 * NULL or when we need an lvalue. For internal use only.
351 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
353 /* %if-c-only Standard (non-C++) definition */
355 /* %if-not-reentrant */
356 /* %not-for-header */
358 /* yy_hold_char holds the character lost when skel_text is formed. */
359 static char yy_hold_char;
360 static int yy_n_chars; /* number of characters read into yy_ch_buf */
363 /* Points to current character in buffer. */
364 static char *yy_c_buf_p = (char *) 0;
365 static int yy_init = 0; /* whether we need to initialize */
366 static int yy_start = 0; /* start state number */
368 /* Flag which is used to allow skel_wrap()'s to do buffer switches
369 * instead of setting up a fresh skel_in. A bit of a hack ...
371 static int yy_did_buffer_switch_on_eof;
376 void skel_restart (FILE *input_file );
377 void skel__switch_to_buffer (YY_BUFFER_STATE new_buffer );
378 YY_BUFFER_STATE skel__create_buffer (FILE *file,int size );
379 void skel__delete_buffer (YY_BUFFER_STATE b );
380 void skel__flush_buffer (YY_BUFFER_STATE b );
381 void skel_push_buffer_state (YY_BUFFER_STATE new_buffer );
382 void skel_pop_buffer_state (void );
384 static void skel_ensure_buffer_stack (void );
385 static void skel__load_buffer_state (void );
386 static void skel__init_buffer (YY_BUFFER_STATE b,FILE *file );
388 #define YY_FLUSH_BUFFER skel__flush_buffer(YY_CURRENT_BUFFER )
390 YY_BUFFER_STATE skel__scan_buffer (char *base,yy_size_t size );
391 YY_BUFFER_STATE skel__scan_string (yyconst char *yy_str );
392 YY_BUFFER_STATE skel__scan_bytes (yyconst char *bytes,int len );
396 void *skel_alloc (yy_size_t );
397 void *skel_realloc (void *,yy_size_t );
398 void skel_free (void * );
400 #define yy_new_buffer skel__create_buffer
402 #define yy_set_interactive(is_interactive) \
404 if ( ! YY_CURRENT_BUFFER ){ \
405 skel_ensure_buffer_stack (); \
406 YY_CURRENT_BUFFER_LVALUE = \
407 skel__create_buffer(skel_in,YY_BUF_SIZE ); \
409 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
412 #define yy_set_bol(at_bol) \
414 if ( ! YY_CURRENT_BUFFER ){\
415 skel_ensure_buffer_stack (); \
416 YY_CURRENT_BUFFER_LVALUE = \
417 skel__create_buffer(skel_in,YY_BUF_SIZE ); \
419 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
422 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
424 /* %% [1.0] skel_text/skel_in/skel_out/yy_state_type/skel_lineno etc. def's & init go here */
425 /* Begin user sect3 */
427 #define skel_wrap(n) 1
428 #define YY_SKIP_YYWRAP
432 typedef unsigned char YY_CHAR;
434 FILE *skel_in = (FILE *) 0, *skel_out = (FILE *) 0;
436 typedef int yy_state_type;
438 extern int skel_lineno;
442 extern char *skel_text;
443 #define yytext_ptr skel_text
445 /* %if-c-only Standard (non-C++) definition */
447 static yy_state_type yy_get_previous_state (void );
448 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
449 static int yy_get_next_buffer (void );
450 static void yy_fatal_error (yyconst char msg[] );
454 /* Done after the current pattern has been matched and before the
455 * corresponding action - sets up skel_text.
457 #define YY_DO_BEFORE_ACTION \
458 (yytext_ptr) = yy_bp; \
459 /* %% [2.0] code to fiddle skel_text and skel_leng for yymore() goes here \ */\
460 skel_leng = (size_t) (yy_cp - yy_bp); \
461 (yy_hold_char) = *yy_cp; \
463 /* %% [3.0] code to copy yytext_ptr to skel_text[] goes here, if %array \ */\
464 (yy_c_buf_p) = yy_cp;
466 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
467 #define YY_NUM_RULES 22
468 #define YY_END_OF_BUFFER 23
469 /* This struct is not used in this scanner,
470 but its presence is necessary. */
473 flex_int32_t yy_verify;
476 static yyconst flex_int16_t yy_accept[45] =
478 0, 0, 0, 0, 0, 0, 23, 11, 10, 9,
479 12, 19, 21, 20, 20, 11, 9, 5, 1, 9,
480 4, 9, 2, 3, 12, 19, 17, 18, 13, 16,
481 14, 15, 8, 9, 9, 9, 9, 9, 9, 9,
485 static yyconst flex_int32_t yy_ec[256] =
487 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
488 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
489 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
490 1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
491 5, 1, 1, 5, 1, 1, 1, 1, 1, 1,
492 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
493 1, 1, 1, 6, 1, 1, 1, 1, 1, 1,
494 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, 7, 8, 7, 7, 7, 7,
498 9, 10, 7, 7, 11, 7, 7, 12, 7, 13,
499 14, 7, 7, 7, 7, 7, 7, 7, 7, 7,
500 7, 7, 15, 1, 16, 1, 1, 1, 1, 1,
501 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
502 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
503 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
504 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
505 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
506 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
509 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
510 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
511 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
512 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
513 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
517 static yyconst flex_int32_t yy_meta[17] =
519 1, 1, 2, 3, 1, 4, 1, 5, 1, 1,
523 static yyconst flex_int16_t yy_base[53] =
525 0, 1, 60, 26, 6, 8, 29, 0, 105, 11,
526 0, 25, 105, 105, 105, 0, 0, 105, 105, 41,
527 105, 46, 105, 105, 0, 105, 105, 105, 105, 105,
528 105, 105, 105, 60, 4, 23, 25, 28, 43, 38,
529 57, 105, 105, 105, 71, 76, 81, 86, 91, 96,
533 static yyconst flex_int16_t yy_def[53] =
535 45, 45, 46, 46, 47, 47, 44, 48, 44, 44,
536 49, 50, 44, 44, 44, 48, 51, 44, 44, 52,
537 44, 44, 44, 44, 49, 44, 44, 44, 44, 44,
538 44, 44, 44, 52, 34, 34, 34, 34, 34, 34,
539 34, 44, 44, 0, 44, 44, 44, 44, 44, 44,
543 static yyconst flex_int16_t yy_nxt[122] =
545 17, 44, 9, 9, 44, 10, 10, 14, 15, 14,
546 15, 17, 17, 18, 37, 17, 19, 20, 21, 20,
547 20, 20, 20, 20, 22, 23, 24, 27, 44, 28,
548 29, 12, 30, 20, 38, 20, 40, 39, 20, 31,
549 32, 17, 17, 42, 33, 17, 17, 17, 20, 33,
550 17, 41, 20, 20, 20, 34, 20, 35, 20, 20,
551 17, 17, 43, 33, 17, 12, 44, 20, 44, 44,
552 36, 8, 8, 8, 8, 8, 11, 11, 11, 11,
553 11, 13, 13, 13, 13, 13, 16, 44, 16, 44,
554 16, 25, 25, 25, 44, 25, 26, 26, 26, 26,
556 26, 20, 44, 20, 7, 44, 44, 44, 44, 44,
557 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
561 static yyconst flex_int16_t yy_chk[122] =
563 51, 0, 1, 2, 0, 1, 2, 5, 5, 6,
564 6, 10, 10, 10, 35, 10, 10, 10, 10, 10,
565 10, 10, 10, 10, 10, 10, 10, 12, 7, 12,
566 12, 4, 12, 36, 36, 37, 38, 37, 38, 12,
567 12, 20, 20, 40, 20, 20, 22, 22, 40, 22,
568 22, 39, 22, 39, 22, 22, 22, 22, 22, 22,
569 34, 34, 41, 34, 34, 3, 0, 41, 0, 0,
570 34, 45, 45, 45, 45, 45, 46, 46, 46, 46,
571 46, 47, 47, 47, 47, 47, 48, 0, 48, 0,
572 48, 49, 49, 49, 0, 49, 50, 50, 50, 50,
574 50, 52, 0, 52, 44, 44, 44, 44, 44, 44,
575 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
579 static yy_state_type yy_last_accepting_state;
580 static char *yy_last_accepting_cpos;
582 extern int skel__flex_debug;
583 int skel__flex_debug = 1;
585 static yyconst flex_int16_t yy_rule_linenum[22] =
587 72, 73, 74, 75, 76, 78, 79, 81, 90, 91,
588 92, 104, 106, 107, 108, 109, 111, 113, 134, 138,
592 /* The intent behind this definition is that it'll catch
593 * any uses of REJECT which flex missed.
595 #define REJECT reject_used_but_not_detected
596 #define yymore() yymore_used_but_not_detected
597 #define YY_MORE_ADJ 0
598 #define YY_RESTORE_YY_MORE_OFFSET
600 #line 1 "scan-skel.l"
601 /* Scan Bison Skeletons. -*- C -*-
603 Copyright (C) 2001-2007, 2009-2012 Free Software Foundation, Inc.
605 This file is part of Bison, the GNU Compiler Compiler.
607 This program is free software: you can redistribute it and/or modify
608 it under the terms of the GNU General Public License as published by
609 the Free Software Foundation, either version 3 of the License, or
610 (at your option) any later version.
612 This program is distributed in the hope that it will be useful,
613 but WITHOUT ANY WARRANTY; without even the implied warranty of
614 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
615 GNU General Public License for more details.
617 You should have received a copy of the GNU General Public License
618 along with this program. If not, see <http://www.gnu.org/licenses/>. */
619 #define YY_NO_INPUT 1
620 #line 24 "scan-skel.l"
621 /* Work around a bug in flex 2.5.31. See Debian bug 333231
622 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>. */
624 #define skel_wrap() 1
626 #define FLEX_PREFIX(Id) skel_ ## Id
627 #include "flex-scanner.h"
631 #include <quotearg.h>
633 #include "complain.h"
636 #include "scan-skel.h"
638 #define YY_DECL static int skel_lex (void)
641 #define QPUTS(String) \
642 fputs (quotearg_style (c_quoting_style, String), skel_out)
644 static void at_directive_perform (int at_directive_argc,
645 char *at_directive_argv[],
646 char **outnamep, int *out_linenop);
647 static void fail_for_at_directive_too_many_args (char const *at_directive_name);
648 static void fail_for_at_directive_too_few_args (char const *at_directive_name);
649 static void fail_for_invalid_at (char const *at);
652 #line 653 "scan-skel.c"
655 #define SC_AT_DIRECTIVE_ARGS 1
656 #define SC_AT_DIRECTIVE_SKIP_WS 2
658 #ifndef YY_NO_UNISTD_H
659 /* Special case for "unistd.h", since it is non-ANSI. We include it way
660 * down here because we want the user's section 1 to have been scanned first.
661 * The user has a chance to override it with an option.
670 #ifndef YY_EXTRA_TYPE
671 #define YY_EXTRA_TYPE void *
674 /* %if-c-only Reentrant structure and macros (non-C++). */
678 static int yy_init_globals (void );
683 /* %endif End reentrant structures and macros. */
685 /* Accessor methods to globals.
686 These are made visible to non-reentrant scanners for convenience. */
688 int skel_lex_destroy (void );
690 int skel_get_debug (void );
692 void skel_set_debug (int debug_flag );
694 YY_EXTRA_TYPE skel_get_extra (void );
696 void skel_set_extra (YY_EXTRA_TYPE user_defined );
698 FILE *skel_get_in (void );
700 void skel_set_in (FILE * in_str );
702 FILE *skel_get_out (void );
704 void skel_set_out (FILE * out_str );
706 int skel_get_leng (void );
708 char *skel_get_text (void );
710 int skel_get_lineno (void );
712 void skel_set_lineno (int line_number );
714 /* %if-bison-bridge */
717 /* Macros after this point can all be overridden by user definitions in
721 #ifndef YY_SKIP_YYWRAP
723 extern "C" int skel_wrap (void );
725 extern int skel_wrap (void );
729 /* %not-for-header */
736 static void yy_flex_strncpy (char *,yyconst char *,int );
739 #ifdef YY_NEED_STRLEN
740 static int yy_flex_strlen (yyconst char * );
744 /* %if-c-only Standard (non-C++) definition */
745 /* %not-for-header */
748 static int yyinput (void );
750 static int input (void );
761 /* Amount of stuff to slurp up with each read. */
762 #ifndef YY_READ_BUF_SIZE
763 #define YY_READ_BUF_SIZE 8192
766 /* Copy whatever the last rule matched to the standard output. */
768 /* %if-c-only Standard (non-C++) definition */
769 /* This used to be an fputs(), but since the string might contain NUL's,
770 * we now use fwrite().
772 #define ECHO fwrite( skel_text, skel_leng, 1, skel_out )
774 /* %if-c++-only C++ definition */
778 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
779 * is returned in "result".
782 #define YY_INPUT(buf,result,max_size) \
783 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
784 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
788 for ( n = 0; n < max_size && \
789 (c = getc( skel_in )) != EOF && c != '\n'; ++n ) \
792 buf[n++] = (char) c; \
793 if ( c == EOF && ferror( skel_in ) ) \
794 YY_FATAL_ERROR( "input in flex scanner failed" ); \
800 while ( (result = fread(buf, 1, max_size, skel_in))==0 && ferror(skel_in)) \
802 if( errno != EINTR) \
804 YY_FATAL_ERROR( "input in flex scanner failed" ); \
812 /* %if-c++-only C++ definition \ */\
817 /* No semi-colon after return; correct usage is to write "yyterminate();" -
818 * we don't want an extra ';' after the "return" because that will cause
819 * some compilers to complain about unreachable statements.
822 #define yyterminate() return YY_NULL
825 /* Number of entries by which start-condition stack grows. */
826 #ifndef YY_START_STACK_INCR
827 #define YY_START_STACK_INCR 25
830 /* Report a fatal error. */
831 #ifndef YY_FATAL_ERROR
833 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
839 /* %if-tables-serialization structures and prototypes */
840 /* %not-for-header */
844 /* %not-for-header */
846 /* %tables-yydmap generated elements */
848 /* end tables serialization structures and prototypes */
852 /* Default declaration of generated scanner - a define so the user can
853 * easily add parameters.
856 #define YY_DECL_IS_OURS 1
857 /* %if-c-only Standard (non-C++) definition */
859 extern int skel_lex (void);
861 #define YY_DECL int skel_lex (void)
863 /* %if-c++-only C++ definition */
865 #endif /* !YY_DECL */
867 /* Code executed at the beginning of each rule, after skel_text and skel_leng
870 #ifndef YY_USER_ACTION
871 #define YY_USER_ACTION
874 /* Code executed at the end of each rule. */
876 #define YY_BREAK break;
879 /* %% [6.0] YY_RULE_SETUP definition goes here */
880 #define YY_RULE_SETUP \
883 /* %not-for-header */
885 /** The main scanner function which does all the work.
889 register yy_state_type yy_current_state;
890 register char *yy_cp, *yy_bp;
893 /* %% [7.0] user's declarations go here */
894 #line 58 "scan-skel.l"
898 int out_lineno PACIFY_CC (= 0);
899 char *outname = NULL;
901 /* Currently, only the @warn, @complain, @fatal, @warn_at, @complain_at, and
902 @fatal_at directives take multiple arguments, and the last three already
903 can't take more than 7. at_directive_argv[0] is the directive name. */
904 #define AT_DIRECTIVE_ARGC_MAX 8
905 int at_directive_argc = 0;
906 char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
909 #line 910 "scan-skel.c"
920 (yy_start) = 1; /* first start state */
936 if ( ! YY_CURRENT_BUFFER ) {
937 skel_ensure_buffer_stack ();
938 YY_CURRENT_BUFFER_LVALUE =
939 skel__create_buffer(skel_in,YY_BUF_SIZE );
942 skel__load_buffer_state( );
945 while ( 1 ) /* loops until end-of-file is reached */
947 /* %% [8.0] yymore()-related code goes here */
948 yy_cp = (yy_c_buf_p);
950 /* Support of skel_text. */
951 *yy_cp = (yy_hold_char);
953 /* yy_bp points to the position in yy_ch_buf of the start of
958 /* %% [9.0] code to set up and find next match goes here */
959 yy_current_state = (yy_start);
963 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
964 if ( yy_accept[yy_current_state] )
966 (yy_last_accepting_state) = yy_current_state;
967 (yy_last_accepting_cpos) = yy_cp;
969 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
971 yy_current_state = (int) yy_def[yy_current_state];
972 if ( yy_current_state >= 45 )
973 yy_c = yy_meta[(unsigned int) yy_c];
975 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
978 while ( yy_current_state != 44 );
979 yy_cp = (yy_last_accepting_cpos);
980 yy_current_state = (yy_last_accepting_state);
983 /* %% [10.0] code to find the action number goes here */
984 yy_act = yy_accept[yy_current_state];
988 /* %% [11.0] code for skel_lineno update goes here */
990 do_action: /* This label is used only to access EOF actions. */
992 /* %% [12.0] debug code goes here */
993 if ( skel__flex_debug )
996 fprintf( stderr, "--scanner backing up\n" );
997 else if ( yy_act < 22 )
998 fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
999 (long)yy_rule_linenum[yy_act], skel_text );
1000 else if ( yy_act == 22 )
1001 fprintf( stderr, "--accepting default rule (\"%s\")\n",
1003 else if ( yy_act == 23 )
1004 fprintf( stderr, "--(end of buffer or a NUL)\n" );
1006 fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
1010 { /* beginning of action switch */
1011 /* %% [13.0] actions go here */
1012 case 0: /* must back up */
1013 /* undo the effects of YY_DO_BEFORE_ACTION */
1014 *yy_cp = (yy_hold_char);
1015 yy_cp = (yy_last_accepting_cpos);
1016 yy_current_state = (yy_last_accepting_state);
1017 goto yy_find_action;
1021 #line 72 "scan-skel.l"
1022 fputc ('@', skel_out);
1026 #line 73 "scan-skel.l"
1027 fputc ('[', skel_out);
1031 #line 74 "scan-skel.l"
1032 fputc (']', skel_out);
1036 #line 75 "scan-skel.l"
1037 /* Empty. Used by b4_cat in ../data/bison.m4. */
1040 /* rule 5 can match eol */
1042 #line 76 "scan-skel.l"
1047 #line 78 "scan-skel.l"
1048 fprintf (skel_out, "%d", out_lineno + 1);
1052 #line 79 "scan-skel.l"
1057 #line 81 "scan-skel.l"
1059 skel_text[skel_leng-1] = '\0';
1060 obstack_grow (&obstack_for_string, skel_text, skel_leng);
1061 at_directive_argv[at_directive_argc++] =
1062 obstack_finish (&obstack_for_string);
1063 BEGIN SC_AT_DIRECTIVE_ARGS;
1066 /* This pattern must not match more than the previous @ patterns. */
1069 #line 90 "scan-skel.l"
1070 fail_for_invalid_at (skel_text);
1073 /* rule 10 can match eol */
1075 #line 91 "scan-skel.l"
1080 #line 92 "scan-skel.l"
1083 case YY_STATE_EOF(INITIAL):
1084 #line 94 "scan-skel.l"
1096 /* rule 12 can match eol */
1098 #line 104 "scan-skel.l"
1103 #line 106 "scan-skel.l"
1104 { obstack_1grow (&obstack_for_string, '@'); }
1108 #line 107 "scan-skel.l"
1109 { obstack_1grow (&obstack_for_string, '['); }
1113 #line 108 "scan-skel.l"
1114 { obstack_1grow (&obstack_for_string, ']'); }
1118 #line 109 "scan-skel.l"
1119 /* Empty. Useful for starting an argument
1120 that begins with whitespace. */
1123 /* rule 17 can match eol */
1125 #line 111 "scan-skel.l"
1130 #line 113 "scan-skel.l"
1132 if (at_directive_argc >= AT_DIRECTIVE_ARGC_MAX)
1133 fail_for_at_directive_too_many_args (at_directive_argv[0]);
1135 obstack_1grow (&obstack_for_string, '\0');
1136 at_directive_argv[at_directive_argc++] =
1137 obstack_finish (&obstack_for_string);
1139 /* Like M4, skip whitespace after a comma. */
1140 if (skel_text[1] == ',')
1141 BEGIN SC_AT_DIRECTIVE_SKIP_WS;
1144 at_directive_perform (at_directive_argc, at_directive_argv,
1145 &outname, &out_lineno);
1146 obstack_free (&obstack_for_string, at_directive_argv[0]);
1147 at_directive_argc = 0;
1154 #line 134 "scan-skel.l"
1155 { fail_for_invalid_at (skel_text); }
1160 /* rule 20 can match eol */
1162 #line 138 "scan-skel.l"
1167 #line 139 "scan-skel.l"
1168 { yyless (0); BEGIN SC_AT_DIRECTIVE_ARGS; }
1172 case YY_STATE_EOF(SC_AT_DIRECTIVE_ARGS):
1173 case YY_STATE_EOF(SC_AT_DIRECTIVE_SKIP_WS):
1174 #line 143 "scan-skel.l"
1176 fatal (_("unclosed %s directive in skeleton"), at_directive_argv[0]);
1182 #line 148 "scan-skel.l"
1183 YY_FATAL_ERROR( "flex scanner jammed" );
1185 #line 1186 "scan-skel.c"
1187 case YY_END_OF_BUFFER:
1189 /* Amount of text matched not including the EOB char. */
1190 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1192 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1193 *yy_cp = (yy_hold_char);
1194 YY_RESTORE_YY_MORE_OFFSET
1196 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1198 /* We're scanning a new file or input source. It's
1199 * possible that this happened because the user
1200 * just pointed skel_in at a new source and called
1201 * skel_lex(). If so, then we have to assure
1202 * consistency between YY_CURRENT_BUFFER and our
1203 * globals. Here is the right place to do so, because
1204 * this is the first action (other than possibly a
1205 * back-up) that will match for the new input source.
1207 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1208 YY_CURRENT_BUFFER_LVALUE->yy_input_file = skel_in;
1209 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1212 /* Note that here we test for yy_c_buf_p "<=" to the position
1213 * of the first EOB in the buffer, since yy_c_buf_p will
1214 * already have been incremented past the NUL character
1215 * (since all states make transitions on EOB to the
1216 * end-of-buffer state). Contrast this with the test
1219 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1220 { /* This was really a NUL. */
1221 yy_state_type yy_next_state;
1223 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1225 yy_current_state = yy_get_previous_state( );
1227 /* Okay, we're now positioned to make the NUL
1228 * transition. We couldn't have
1229 * yy_get_previous_state() go ahead and do it
1230 * for us because it doesn't know how to deal
1231 * with the possibility of jamming (and we don't
1232 * want to build jamming into it because then it
1233 * will run more slowly).
1236 yy_next_state = yy_try_NUL_trans( yy_current_state );
1238 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1240 if ( yy_next_state )
1242 /* Consume the NUL. */
1243 yy_cp = ++(yy_c_buf_p);
1244 yy_current_state = yy_next_state;
1250 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
1251 yy_cp = (yy_last_accepting_cpos);
1252 yy_current_state = (yy_last_accepting_state);
1253 goto yy_find_action;
1257 else switch ( yy_get_next_buffer( ) )
1259 case EOB_ACT_END_OF_FILE:
1261 (yy_did_buffer_switch_on_eof) = 0;
1265 /* Note: because we've taken care in
1266 * yy_get_next_buffer() to have set up
1267 * skel_text, we can now set up
1268 * yy_c_buf_p so that if some total
1269 * hoser (like flex itself) wants to
1270 * call the scanner after we return the
1271 * YY_NULL, it'll still work - another
1272 * YY_NULL will get returned.
1274 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1276 yy_act = YY_STATE_EOF(YY_START);
1282 if ( ! (yy_did_buffer_switch_on_eof) )
1288 case EOB_ACT_CONTINUE_SCAN:
1290 (yytext_ptr) + yy_amount_of_matched_text;
1292 yy_current_state = yy_get_previous_state( );
1294 yy_cp = (yy_c_buf_p);
1295 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1298 case EOB_ACT_LAST_MATCH:
1300 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1302 yy_current_state = yy_get_previous_state( );
1304 yy_cp = (yy_c_buf_p);
1305 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1306 goto yy_find_action;
1313 "fatal flex scanner internal error--no action found" );
1314 } /* end of action switch */
1315 } /* end of scanning one token */
1316 } /* end of skel_lex */
1317 /* %ok-for-header */
1320 /* %not-for-header */
1322 /* %ok-for-header */
1326 /* yy_get_next_buffer - try to read in a new buffer
1328 * Returns a code representing an action:
1329 * EOB_ACT_LAST_MATCH -
1330 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1331 * EOB_ACT_END_OF_FILE - end of file
1334 static int yy_get_next_buffer (void)
1339 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1340 register char *source = (yytext_ptr);
1341 register int number_to_move, i;
1344 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1346 "fatal flex scanner internal error--end of buffer missed" );
1348 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1349 { /* Don't try to fill the buffer, so this is an EOF. */
1350 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1352 /* We matched a single character, the EOB, so
1353 * treat this as a final EOF.
1355 return EOB_ACT_END_OF_FILE;
1360 /* We matched some text prior to the EOB, first
1363 return EOB_ACT_LAST_MATCH;
1367 /* Try to read more data. */
1369 /* First move last chars to start of buffer. */
1370 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1372 for ( i = 0; i < number_to_move; ++i )
1373 *(dest++) = *(source++);
1375 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1376 /* don't do the read, it's not guaranteed to return an EOF,
1379 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1384 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1386 while ( num_to_read <= 0 )
1387 { /* Not enough room in the buffer - grow it. */
1389 /* just a shorter name for the current buffer */
1390 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1392 int yy_c_buf_p_offset =
1393 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1395 if ( b->yy_is_our_buffer )
1397 int new_size = b->yy_buf_size * 2;
1399 if ( new_size <= 0 )
1400 b->yy_buf_size += b->yy_buf_size / 8;
1402 b->yy_buf_size *= 2;
1404 b->yy_ch_buf = (char *)
1405 /* Include room in for 2 EOB chars. */
1406 skel_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1409 /* Can't grow it, we don't own it. */
1412 if ( ! b->yy_ch_buf )
1414 "fatal error - scanner input buffer overflow" );
1416 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1418 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1423 if ( num_to_read > YY_READ_BUF_SIZE )
1424 num_to_read = YY_READ_BUF_SIZE;
1426 /* Read in more data. */
1427 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1428 (yy_n_chars), (size_t) num_to_read );
1430 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1433 if ( (yy_n_chars) == 0 )
1435 if ( number_to_move == YY_MORE_ADJ )
1437 ret_val = EOB_ACT_END_OF_FILE;
1438 skel_restart(skel_in );
1443 ret_val = EOB_ACT_LAST_MATCH;
1444 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1445 YY_BUFFER_EOF_PENDING;
1450 ret_val = EOB_ACT_CONTINUE_SCAN;
1452 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1453 /* Extend the array by 50%, plus the number we really need. */
1454 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1455 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) skel_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1456 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1457 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1460 (yy_n_chars) += number_to_move;
1461 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1462 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1464 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1469 /* yy_get_previous_state - get the state just before the EOB char was reached */
1472 /* %not-for-header */
1474 static yy_state_type yy_get_previous_state (void)
1479 register yy_state_type yy_current_state;
1480 register char *yy_cp;
1482 /* %% [15.0] code to get the start state into yy_current_state goes here */
1483 yy_current_state = (yy_start);
1485 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1487 /* %% [16.0] code to find the next state goes here */
1488 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1489 if ( yy_accept[yy_current_state] )
1491 (yy_last_accepting_state) = yy_current_state;
1492 (yy_last_accepting_cpos) = yy_cp;
1494 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1496 yy_current_state = (int) yy_def[yy_current_state];
1497 if ( yy_current_state >= 45 )
1498 yy_c = yy_meta[(unsigned int) yy_c];
1500 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1503 return yy_current_state;
1506 /* yy_try_NUL_trans - try to make a transition on the NUL character
1509 * next_state = yy_try_NUL_trans( current_state );
1512 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1517 register int yy_is_jam;
1518 /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
1519 register char *yy_cp = (yy_c_buf_p);
1521 register YY_CHAR yy_c = 1;
1522 if ( yy_accept[yy_current_state] )
1524 (yy_last_accepting_state) = yy_current_state;
1525 (yy_last_accepting_cpos) = yy_cp;
1527 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1529 yy_current_state = (int) yy_def[yy_current_state];
1530 if ( yy_current_state >= 45 )
1531 yy_c = yy_meta[(unsigned int) yy_c];
1533 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1534 yy_is_jam = (yy_current_state == 44);
1536 return yy_is_jam ? 0 : yy_current_state;
1546 static int yyinput (void)
1548 static int input (void)
1557 *(yy_c_buf_p) = (yy_hold_char);
1559 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1561 /* yy_c_buf_p now points to the character we want to return.
1562 * If this occurs *before* the EOB characters, then it's a
1563 * valid NUL; if not, then we've hit the end of the buffer.
1565 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1566 /* This was really a NUL. */
1567 *(yy_c_buf_p) = '\0';
1570 { /* need more input */
1571 int offset = (yy_c_buf_p) - (yytext_ptr);
1574 switch ( yy_get_next_buffer( ) )
1576 case EOB_ACT_LAST_MATCH:
1577 /* This happens because yy_g_n_b()
1578 * sees that we've accumulated a
1579 * token and flags that we need to
1580 * try matching the token before
1581 * proceeding. But for input(),
1582 * there's no matching to consider.
1583 * So convert the EOB_ACT_LAST_MATCH
1584 * to EOB_ACT_END_OF_FILE.
1587 /* Reset buffer status. */
1588 skel_restart(skel_in );
1592 case EOB_ACT_END_OF_FILE:
1597 if ( ! (yy_did_buffer_switch_on_eof) )
1606 case EOB_ACT_CONTINUE_SCAN:
1607 (yy_c_buf_p) = (yytext_ptr) + offset;
1613 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1614 *(yy_c_buf_p) = '\0'; /* preserve skel_text */
1615 (yy_hold_char) = *++(yy_c_buf_p);
1617 /* %% [19.0] update BOL and skel_lineno */
1622 #endif /* ifndef YY_NO_INPUT */
1625 /** Immediately switch to a different input stream.
1626 * @param input_file A readable stream.
1628 * @note This function does not reset the start condition to @c INITIAL .
1631 void skel_restart (FILE * input_file )
1637 if ( ! YY_CURRENT_BUFFER ){
1638 skel_ensure_buffer_stack ();
1639 YY_CURRENT_BUFFER_LVALUE =
1640 skel__create_buffer(skel_in,YY_BUF_SIZE );
1643 skel__init_buffer(YY_CURRENT_BUFFER,input_file );
1644 skel__load_buffer_state( );
1647 /** Switch to a different input buffer.
1648 * @param new_buffer The new input buffer.
1652 void skel__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1658 /* TODO. We should be able to replace this entire function body
1660 * skel_pop_buffer_state();
1661 * skel_push_buffer_state(new_buffer);
1663 skel_ensure_buffer_stack ();
1664 if ( YY_CURRENT_BUFFER == new_buffer )
1667 if ( YY_CURRENT_BUFFER )
1669 /* Flush out information for old buffer. */
1670 *(yy_c_buf_p) = (yy_hold_char);
1671 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1672 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1675 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1676 skel__load_buffer_state( );
1678 /* We don't actually know whether we did this switch during
1679 * EOF (skel_wrap()) processing, but the only time this flag
1680 * is looked at is after skel_wrap() is called, so it's safe
1681 * to go ahead and always set it.
1683 (yy_did_buffer_switch_on_eof) = 1;
1687 static void skel__load_buffer_state (void)
1692 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1693 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1694 skel_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1695 (yy_hold_char) = *(yy_c_buf_p);
1698 /** Allocate and initialize an input buffer state.
1699 * @param file A readable stream.
1700 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1702 * @return the allocated buffer state.
1705 YY_BUFFER_STATE skel__create_buffer (FILE * file, int size )
1712 b = (YY_BUFFER_STATE) skel_alloc(sizeof( struct yy_buffer_state ) );
1714 YY_FATAL_ERROR( "out of dynamic memory in skel__create_buffer()" );
1716 b->yy_buf_size = size;
1718 /* yy_ch_buf has to be 2 characters longer than the size given because
1719 * we need to put in 2 end-of-buffer characters.
1721 b->yy_ch_buf = (char *) skel_alloc(b->yy_buf_size + 2 );
1722 if ( ! b->yy_ch_buf )
1723 YY_FATAL_ERROR( "out of dynamic memory in skel__create_buffer()" );
1725 b->yy_is_our_buffer = 1;
1727 skel__init_buffer(b,file );
1732 /** Destroy the buffer.
1733 * @param b a buffer created with skel__create_buffer()
1737 void skel__delete_buffer (YY_BUFFER_STATE b )
1746 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1747 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1749 if ( b->yy_is_our_buffer )
1750 skel_free((void *) b->yy_ch_buf );
1752 skel_free((void *) b );
1762 /* Initializes or reinitializes a buffer.
1763 * This function is sometimes called more than once on the same buffer,
1764 * such as during a skel_restart() or at EOF.
1767 static void skel__init_buffer (YY_BUFFER_STATE b, FILE * file )
1775 skel__flush_buffer(b );
1777 b->yy_input_file = file;
1778 b->yy_fill_buffer = 1;
1780 /* If b is the current buffer, then skel__init_buffer was _probably_
1781 * called from skel_restart() or through yy_get_next_buffer.
1782 * In that case, we don't want to reset the lineno or column.
1784 if (b != YY_CURRENT_BUFFER){
1785 b->yy_bs_lineno = 1;
1786 b->yy_bs_column = 0;
1791 b->yy_is_interactive = 0;
1799 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1800 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1804 void skel__flush_buffer (YY_BUFFER_STATE b )
1814 /* We always need two end-of-buffer characters. The first causes
1815 * a transition to the end-of-buffer state. The second causes
1816 * a jam in that state.
1818 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1819 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1821 b->yy_buf_pos = &b->yy_ch_buf[0];
1824 b->yy_buffer_status = YY_BUFFER_NEW;
1826 if ( b == YY_CURRENT_BUFFER )
1827 skel__load_buffer_state( );
1831 /** Pushes the new state onto the stack. The new state becomes
1832 * the current state. This function will allocate the stack
1834 * @param new_buffer The new state.
1838 void skel_push_buffer_state (YY_BUFFER_STATE new_buffer )
1843 if (new_buffer == NULL)
1846 skel_ensure_buffer_stack();
1848 /* This block is copied from skel__switch_to_buffer. */
1849 if ( YY_CURRENT_BUFFER )
1851 /* Flush out information for old buffer. */
1852 *(yy_c_buf_p) = (yy_hold_char);
1853 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1854 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1857 /* Only push if top exists. Otherwise, replace top. */
1858 if (YY_CURRENT_BUFFER)
1859 (yy_buffer_stack_top)++;
1860 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1862 /* copied from skel__switch_to_buffer. */
1863 skel__load_buffer_state( );
1864 (yy_did_buffer_switch_on_eof) = 1;
1869 /** Removes and deletes the top of the stack, if present.
1870 * The next element becomes the new top.
1874 void skel_pop_buffer_state (void)
1879 if (!YY_CURRENT_BUFFER)
1882 skel__delete_buffer(YY_CURRENT_BUFFER );
1883 YY_CURRENT_BUFFER_LVALUE = NULL;
1884 if ((yy_buffer_stack_top) > 0)
1885 --(yy_buffer_stack_top);
1887 if (YY_CURRENT_BUFFER) {
1888 skel__load_buffer_state( );
1889 (yy_did_buffer_switch_on_eof) = 1;
1895 /* Allocates the stack if it does not exist.
1896 * Guarantees space for at least one push.
1899 static void skel_ensure_buffer_stack (void)
1906 if (!(yy_buffer_stack)) {
1908 /* First allocation is just for 2 elements, since we don't know if this
1909 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1910 * immediate realloc on the next call.
1913 (yy_buffer_stack) = (struct yy_buffer_state**)skel_alloc
1914 (num_to_alloc * sizeof(struct yy_buffer_state*)
1916 if ( ! (yy_buffer_stack) )
1917 YY_FATAL_ERROR( "out of dynamic memory in skel_ensure_buffer_stack()" );
1919 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1921 (yy_buffer_stack_max) = num_to_alloc;
1922 (yy_buffer_stack_top) = 0;
1926 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1928 /* Increase the buffer to prepare for a possible push. */
1929 int grow_size = 8 /* arbitrary grow size */;
1931 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1932 (yy_buffer_stack) = (struct yy_buffer_state**)skel_realloc
1934 num_to_alloc * sizeof(struct yy_buffer_state*)
1936 if ( ! (yy_buffer_stack) )
1937 YY_FATAL_ERROR( "out of dynamic memory in skel_ensure_buffer_stack()" );
1939 /* zero only the new slots.*/
1940 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1941 (yy_buffer_stack_max) = num_to_alloc;
1947 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1948 * @param base the character buffer
1949 * @param size the size in bytes of the character buffer
1951 * @return the newly allocated buffer state object.
1953 YY_BUFFER_STATE skel__scan_buffer (char * base, yy_size_t size )
1958 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1959 base[size-1] != YY_END_OF_BUFFER_CHAR )
1960 /* They forgot to leave room for the EOB's. */
1963 b = (YY_BUFFER_STATE) skel_alloc(sizeof( struct yy_buffer_state ) );
1965 YY_FATAL_ERROR( "out of dynamic memory in skel__scan_buffer()" );
1967 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1968 b->yy_buf_pos = b->yy_ch_buf = base;
1969 b->yy_is_our_buffer = 0;
1970 b->yy_input_file = 0;
1971 b->yy_n_chars = b->yy_buf_size;
1972 b->yy_is_interactive = 0;
1974 b->yy_fill_buffer = 0;
1975 b->yy_buffer_status = YY_BUFFER_NEW;
1977 skel__switch_to_buffer(b );
1984 /** Setup the input buffer state to scan a string. The next call to skel_lex() will
1985 * scan from a @e copy of @a str.
1986 * @param yystr a NUL-terminated string to scan
1988 * @return the newly allocated buffer state object.
1989 * @note If you want to scan bytes that may contain NUL values, then use
1990 * skel__scan_bytes() instead.
1992 YY_BUFFER_STATE skel__scan_string (yyconst char * yystr )
1995 return skel__scan_bytes(yystr,strlen(yystr) );
2000 /** Setup the input buffer state to scan the given bytes. The next call to skel_lex() will
2001 * scan from a @e copy of @a bytes.
2002 * @param bytes the byte buffer to scan
2003 * @param len the number of bytes in the buffer pointed to by @a bytes.
2005 * @return the newly allocated buffer state object.
2007 YY_BUFFER_STATE skel__scan_bytes (yyconst char * yybytes, int _yybytes_len )
2014 /* Get memory for full buffer, including space for trailing EOB's. */
2015 n = _yybytes_len + 2;
2016 buf = (char *) skel_alloc(n );
2018 YY_FATAL_ERROR( "out of dynamic memory in skel__scan_bytes()" );
2020 for ( i = 0; i < _yybytes_len; ++i )
2021 buf[i] = yybytes[i];
2023 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2025 b = skel__scan_buffer(buf,n );
2027 YY_FATAL_ERROR( "bad buffer in skel__scan_bytes()" );
2029 /* It's okay to grow etc. this buffer, and we should throw it
2030 * away when we're done.
2032 b->yy_is_our_buffer = 1;
2038 #ifndef YY_EXIT_FAILURE
2039 #define YY_EXIT_FAILURE 2
2043 static void yy_fatal_error (yyconst char* msg )
2045 (void) fprintf( stderr, "%s\n", msg );
2046 exit( YY_EXIT_FAILURE );
2052 /* Redefine yyless() so it works in section 3 code. */
2058 /* Undo effects of setting up skel_text. */ \
2059 int yyless_macro_arg = (n); \
2060 YY_LESS_LINENO(yyless_macro_arg);\
2061 skel_text[skel_leng] = (yy_hold_char); \
2062 (yy_c_buf_p) = skel_text + yyless_macro_arg; \
2063 (yy_hold_char) = *(yy_c_buf_p); \
2064 *(yy_c_buf_p) = '\0'; \
2065 skel_leng = yyless_macro_arg; \
2069 /* Accessor methods (get/set functions) to struct members. */
2075 /** Get the current line number.
2078 int skel_get_lineno (void)
2084 /** Get the input stream.
2087 FILE *skel_get_in (void)
2092 /** Get the output stream.
2095 FILE *skel_get_out (void)
2100 /** Get the length of the current token.
2103 int skel_get_leng (void)
2108 /** Get the current token.
2112 char *skel_get_text (void)
2120 /** Set the current line number.
2121 * @param line_number
2124 void skel_set_lineno (int line_number )
2127 skel_lineno = line_number;
2130 /** Set the input stream. This does not discard the current
2132 * @param in_str A readable stream.
2134 * @see skel__switch_to_buffer
2136 void skel_set_in (FILE * in_str )
2141 void skel_set_out (FILE * out_str )
2143 skel_out = out_str ;
2146 int skel_get_debug (void)
2148 return skel__flex_debug;
2151 void skel_set_debug (int bdebug )
2153 skel__flex_debug = bdebug ;
2159 /* %if-bison-bridge */
2161 /* %endif if-c-only */
2164 static int yy_init_globals (void)
2166 /* Initialization is the same as for the non-reentrant scanner.
2167 * This function is called from skel_lex_destroy(), so don't allocate here.
2170 (yy_buffer_stack) = 0;
2171 (yy_buffer_stack_top) = 0;
2172 (yy_buffer_stack_max) = 0;
2173 (yy_c_buf_p) = (char *) 0;
2177 /* Defined in main.c */
2182 skel_in = (FILE *) 0;
2183 skel_out = (FILE *) 0;
2186 /* For future reference: Set errno on error, since we are called by
2193 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2194 /* skel_lex_destroy is for both reentrant and non-reentrant scanners. */
2195 int skel_lex_destroy (void)
2198 /* Pop the buffer stack, destroying each element. */
2199 while(YY_CURRENT_BUFFER){
2200 skel__delete_buffer(YY_CURRENT_BUFFER );
2201 YY_CURRENT_BUFFER_LVALUE = NULL;
2202 skel_pop_buffer_state();
2205 /* Destroy the stack itself. */
2206 skel_free((yy_buffer_stack) );
2207 (yy_buffer_stack) = NULL;
2209 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2210 * skel_lex() is called, initialization will occur. */
2220 * Internal utility routines.
2224 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2227 for ( i = 0; i < n; ++i )
2232 #ifdef YY_NEED_STRLEN
2233 static int yy_flex_strlen (yyconst char * s )
2236 for ( n = 0; s[n]; ++n )
2243 void *skel_alloc (yy_size_t size )
2245 return (void *) malloc( size );
2248 void *skel_realloc (void * ptr, yy_size_t size )
2250 /* The cast to (char *) in the following accommodates both
2251 * implementations that use char* generic pointers, and those
2252 * that use void* generic pointers. It works with the latter
2253 * because both ANSI C and C++ allow castless assignment from
2254 * any pointer type to void*, and deal with argument conversions
2255 * as though doing an assignment.
2257 return (void *) realloc( (char *) ptr, size );
2260 void skel_free (void * ptr )
2262 free( (char *) ptr ); /* see skel_realloc() for (char *) cast */
2265 /* %if-tables-serialization definitions */
2266 /* %define-yytables The name for this specific scanner's tables. */
2267 #define YYTABLES_NAME "yytables"
2270 /* %ok-for-header */
2272 #line 148 "scan-skel.l"
2276 /*------------------------.
2277 | Scan a Bison skeleton. |
2278 `------------------------*/
2281 scan_skel (FILE *in)
2283 static bool initialized = false;
2287 obstack_init (&obstack_for_string);
2290 skel__flex_debug = trace_flag & trace_skeleton;
2295 skel_scanner_free (void)
2297 obstack_free (&obstack_for_string, 0);
2298 /* Reclaim Flex's buffers. */
2299 skel_lex_destroy ();
2303 at_directive_perform (int at_directive_argc,
2304 char *at_directive_argv[],
2305 char **outnamep, int *out_linenop)
2307 if (0 == strcmp (at_directive_argv[0], "@basename"))
2309 if (at_directive_argc > 2)
2310 fail_for_at_directive_too_many_args (at_directive_argv[0]);
2311 fputs (last_component (at_directive_argv[1]), skel_out);
2313 else if (0 == strcmp (at_directive_argv[0], "@warn")
2314 || 0 == strcmp (at_directive_argv[0], "@complain")
2315 || 0 == strcmp (at_directive_argv[0], "@fatal"))
2317 void (*func)(char const *, ...);
2318 switch (at_directive_argv[0][1])
2320 case 'w': func = warn; break;
2321 case 'c': func = complain; break;
2322 case 'f': func = fatal; break;
2323 default: aver (false); break;
2325 switch (at_directive_argc)
2328 func (_(at_directive_argv[1]));
2331 func (_(at_directive_argv[1]), at_directive_argv[2]);
2334 func (_(at_directive_argv[1]), at_directive_argv[2],
2335 at_directive_argv[3]);
2338 func (_(at_directive_argv[1]), at_directive_argv[2],
2339 at_directive_argv[3], at_directive_argv[4]);
2342 func (_(at_directive_argv[1]), at_directive_argv[2],
2343 at_directive_argv[3], at_directive_argv[4],
2344 at_directive_argv[5]);
2347 fail_for_at_directive_too_many_args (at_directive_argv[0]);
2351 else if (0 == strcmp (at_directive_argv[0], "@warn_at")
2352 || 0 == strcmp (at_directive_argv[0], "@complain_at")
2353 || 0 == strcmp (at_directive_argv[0], "@fatal_at"))
2355 void (*func)(location, char const *, ...);
2357 if (at_directive_argc < 4)
2358 fail_for_at_directive_too_few_args (at_directive_argv[0]);
2359 switch (at_directive_argv[0][1])
2361 case 'w': func = warn_at; break;
2362 case 'c': func = complain_at; break;
2363 case 'f': func = fatal_at; break;
2364 default: aver (false); break;
2366 boundary_set_from_string (&loc.start, at_directive_argv[1]);
2367 boundary_set_from_string (&loc.end, at_directive_argv[2]);
2368 switch (at_directive_argc)
2371 func (loc, _(at_directive_argv[3]));
2374 func (loc, _(at_directive_argv[3]), at_directive_argv[4]);
2377 func (loc, _(at_directive_argv[3]), at_directive_argv[4],
2378 at_directive_argv[5]);
2381 func (loc, _(at_directive_argv[3]), at_directive_argv[4],
2382 at_directive_argv[5], at_directive_argv[6]);
2385 func (loc, _(at_directive_argv[3]), at_directive_argv[4],
2386 at_directive_argv[5], at_directive_argv[6],
2387 at_directive_argv[7]);
2390 fail_for_at_directive_too_many_args (at_directive_argv[0]);
2394 else if (0 == strcmp (at_directive_argv[0], "@output"))
2396 if (at_directive_argc > 2)
2397 fail_for_at_directive_too_many_args (at_directive_argv[0]);
2403 *outnamep = xstrdup (at_directive_argv[1]);
2404 output_file_name_check (outnamep);
2405 skel_out = xfopen (*outnamep, "w");
2409 fail_for_invalid_at (at_directive_argv[0]);
2413 fail_for_at_directive_too_few_args (char const *at_directive_name)
2415 fatal (_("too few arguments for %s directive in skeleton"),
2420 fail_for_at_directive_too_many_args (char const *at_directive_name)
2422 fatal (_("too many arguments for %s directive in skeleton"),
2427 fail_for_invalid_at (char const *at)
2429 fatal ("invalid @ in skeleton: %s", at);