flex.skl revision 1.1
1%# -*-C-*- vi: set ft=c:
2%# This file is processed in several stages.
3%# Here are the stages, as best as I can describe:
4%#
5%#   1. flex.skl is processed through GNU m4 during the
6%#      pre-compilation stage of flex. Only macros starting
7%#      with `m4preproc_' are processed, and quoting is normal.
8%#
9%#   2. The preprocessed skeleton is translated verbatim into a
10%#      C array, saved as "skel.c" and compiled into the flex binary.
11%#
12%#   3. At runtime, the skeleton is generated and filtered (again)
13%#      through m4. Macros beginning with `m4_' will be processed.
14%#      The quoting is "[[" and "]]" so we don't interfere with
15%#      user code.
16%# 
17%# All generate macros for the m4 stage contain the text "m4" or "M4"
18%# in them. This is to distinguish them from CPP macros.
19%# The exception to this rule is YY_G, which is an m4 macro, 
20%# but it needs to be remain short because it is used everywhere.
21%#
22/* A lexical scanner generated by flex */
23
24%#  Macros for preproc stage.
25m4preproc_changecom
26
27%# Macros for runtime processing stage.
28m4_changecom
29m4_changequote
30m4_changequote([[, ]])
31
32%# 
33%# Lines in this skeleton starting with a "%" character are "control lines"
34%# and affect the generation of the scanner. The possible control codes are
35%# listed and processed in misc.c.
36%#
37%#   %#  -  A comment. The current line is omitted from the generated scanner.
38%#   %if-c++-only  -  The following lines are printed for C++ scanners ONLY.
39%#   %if-c-only    -  The following lines are NOT printed for C++ scanners.
40%#   %if-c-or-c++  -  The following lines are printed in BOTH C and C++ scanners.
41%#   %if-reentrant     - Print for reentrant scanners.(push)
42%#   %if-not-reentrant - Print for non-reentrant scanners. (push)
43%#   %if-bison-bridge  - Print for bison-bridge. (push)
44%#   %if-not-bison-bridge  - Print for non-bison-bridge. (push)
45%#   %endif        - pop from the previous if code.
46%#   %%  -  A stop-point, where code is inserted by flex.
47%#          Each stop-point is numbered here and also in the code generator.
48%#          (See gen.c, etc. for details.)
49%#   %not-for-header  -  Begin code that should NOT appear in a ".h" file.
50%#   %ok-for-header   -  %c and %e are used for building a header file.
51%#   %if-tables-serialization
52%#
53%#   All control-lines EXCEPT comment lines ("%#") will be inserted into
54%#   the generated scanner as a C-style comment. This is to aid those who
55%#   edit the skeleton.
56%#
57
58%not-for-header
59%if-c-only
60%if-not-reentrant
61m4_ifelse(M4_YY_PREFIX,yy,,
62#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]
63#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]
64#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
65#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]
66#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]
67#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]
68#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]
69#define yyin M4_YY_PREFIX[[in]]
70#define yyleng M4_YY_PREFIX[[leng]]
71#define yylex M4_YY_PREFIX[[lex]]
72#define yylineno M4_YY_PREFIX[[lineno]]
73#define yyout M4_YY_PREFIX[[out]]
74#define yyrestart M4_YY_PREFIX[[restart]]
75#define yytext M4_YY_PREFIX[[text]]
76#define yywrap M4_YY_PREFIX[[wrap]]
77#define yyalloc M4_YY_PREFIX[[alloc]]
78#define yyrealloc M4_YY_PREFIX[[realloc]]
79#define yyfree M4_YY_PREFIX[[free]]
80)
81%endif
82%endif
83%ok-for-header
84
85#define FLEX_SCANNER
86#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
87#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
88#define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
89#if YY_FLEX_SUBMINOR_VERSION > 0
90#define FLEX_BETA
91#endif
92
93%# Some negated symbols
94m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])
95m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])
96
97%# This is the m4 way to say "(stack_used || is_reentrant)
98m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
99m4_ifdef( [[M4_YY_REENTRANT]],  [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
100
101%# Prefixes.
102%# The complexity here is necessary so that m4 preserves
103%# the argument lists to each C function.
104
105
106m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
107
108m4preproc_define(`M4_GEN_PREFIX',
109    ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
110
111%if-c++-only
112    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
113     * following macro. This is required in order to pass the c++-multiple-scanners
114     * test in the regression suite. We get reports that it breaks inheritance.
115     * We will address this in a future release of flex, or omit the C++ scanner
116     * altogether.
117     */
118    #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
119%endif
120
121%if-c-only
122    M4_GEN_PREFIX(`_create_buffer')
123    M4_GEN_PREFIX(`_delete_buffer')
124    M4_GEN_PREFIX(`_scan_buffer')
125    M4_GEN_PREFIX(`_scan_string')
126    M4_GEN_PREFIX(`_scan_bytes')
127    M4_GEN_PREFIX(`_init_buffer')
128    M4_GEN_PREFIX(`_flush_buffer')
129    M4_GEN_PREFIX(`_load_buffer_state')
130    M4_GEN_PREFIX(`_switch_to_buffer')
131    M4_GEN_PREFIX(`push_buffer_state')
132    M4_GEN_PREFIX(`pop_buffer_state')
133    M4_GEN_PREFIX(`ensure_buffer_stack')
134    M4_GEN_PREFIX(`lex')
135    M4_GEN_PREFIX(`restart')
136    M4_GEN_PREFIX(`lex_init')
137    M4_GEN_PREFIX(`lex_init_extra')
138    M4_GEN_PREFIX(`lex_destroy')
139    M4_GEN_PREFIX(`get_debug')
140    M4_GEN_PREFIX(`set_debug')
141    M4_GEN_PREFIX(`get_extra')
142    M4_GEN_PREFIX(`set_extra')
143    M4_GEN_PREFIX(`get_in')
144    M4_GEN_PREFIX(`set_in')
145    M4_GEN_PREFIX(`get_out')
146    M4_GEN_PREFIX(`set_out')
147    M4_GEN_PREFIX(`get_leng')
148    M4_GEN_PREFIX(`get_text')
149    M4_GEN_PREFIX(`get_lineno')
150    M4_GEN_PREFIX(`set_lineno')
151    m4_ifdef( [[M4_YY_REENTRANT]],
152    [[
153        M4_GEN_PREFIX(`get_column')
154        M4_GEN_PREFIX(`set_column')
155    ]])
156    M4_GEN_PREFIX(`wrap')
157%endif
158
159m4_ifdef( [[M4_YY_BISON_LVAL]],
160[[
161    M4_GEN_PREFIX(`get_lval')
162    M4_GEN_PREFIX(`set_lval')
163]])
164
165m4_ifdef( [[<M4_YY_BISON_LLOC>]],
166[[
167    M4_GEN_PREFIX(`get_lloc')
168    M4_GEN_PREFIX(`set_lloc')
169]])
170
171
172    M4_GEN_PREFIX(`alloc')
173    M4_GEN_PREFIX(`realloc')
174    M4_GEN_PREFIX(`free')
175
176%if-c-only
177m4_ifdef( [[M4_YY_NOT_REENTRANT]],
178[[
179    M4_GEN_PREFIX(`text')
180    M4_GEN_PREFIX(`leng')
181    M4_GEN_PREFIX(`in')
182    M4_GEN_PREFIX(`out')
183    M4_GEN_PREFIX(`_flex_debug')
184    M4_GEN_PREFIX(`lineno')
185]])
186%endif
187
188
189m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
190[[
191    M4_GEN_PREFIX(`tables_fload')
192    M4_GEN_PREFIX(`tables_destroy')
193    M4_GEN_PREFIX(`TABLES_NAME')
194]])
195
196/* First, we deal with  platform-specific or compiler-specific issues. */
197
198/* begin standard C headers. */
199%if-c-only
200#include <stdio.h>
201#include <string.h>
202#include <errno.h>
203#include <stdlib.h>
204%endif
205
206%if-tables-serialization
207#include <sys/types.h>
208#include <netinet/in.h>
209%endif
210/* end standard C headers. */
211
212%if-c-or-c++
213m4preproc_include(`flexint.h')
214%endif
215
216%if-c++-only
217/* begin standard C++ headers. */
218#include <iostream> 
219#include <errno.h>
220#include <cstdlib>
221#include <cstdio>
222#include <cstring>
223/* end standard C++ headers. */
224%endif
225
226#ifdef __cplusplus
227
228/* The "const" storage-class-modifier is valid. */
229#define YY_USE_CONST
230
231#else	/* ! __cplusplus */
232
233/* C99 requires __STDC__ to be defined as 1. */
234#if defined (__STDC__)
235
236#define YY_USE_CONST
237
238#endif	/* defined (__STDC__) */
239#endif	/* ! __cplusplus */
240
241#ifdef YY_USE_CONST
242#define yyconst const
243#else
244#define yyconst
245#endif
246
247%# For compilers that can not handle prototypes.
248%# e.g.,
249%# The function prototype
250%#    int foo(int x, char* y);
251%# 
252%# ...should be written as
253%#    int foo M4_YY_PARAMS(int x, char* y);
254%# 
255%# ...which could possibly generate
256%#    int foo ();
257%# 
258m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
259[[
260    m4_define( [[M4_YY_PARAMS]], [[()]])
261]],
262[[
263    m4_define( [[M4_YY_PARAMS]], [[($*)]])
264]])
265
266%not-for-header
267/* Returned upon end-of-file. */
268#define YY_NULL 0
269%ok-for-header
270
271%not-for-header
272/* Promotes a possibly negative, possibly signed char to an unsigned
273 * integer for use as an array index.  If the signed char is negative,
274 * we want to instead treat it as an 8-bit unsigned char, hence the
275 * double cast.
276 */
277#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
278%ok-for-header
279
280
281
282%if-reentrant
283
284/* An opaque pointer. */
285#ifndef YY_TYPEDEF_YY_SCANNER_T
286#define YY_TYPEDEF_YY_SCANNER_T
287typedef void* yyscan_t;
288#endif
289
290%# Declare yyguts variable
291m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
292%# Perform a noop access on yyguts to prevent unused variable complains
293m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])
294%# For use wherever a Global is accessed or assigned.
295m4_define( [[YY_G]], [[yyg->$1]])
296
297%# For use in function prototypes to append the additional argument.
298m4_define( [[M4_YY_PROTO_LAST_ARG]],  [[, yyscan_t yyscanner]])
299m4_define( [[M4_YY_PROTO_ONLY_ARG]],  [[yyscan_t yyscanner]])
300
301%# For use in function definitions to append the additional argument.
302m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
303[[
304    m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
305    m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
306]],
307[[
308    m4_define( [[M4_YY_DEF_LAST_ARG]],  [[, yyscan_t yyscanner]])
309    m4_define( [[M4_YY_DEF_ONLY_ARG]],  [[yyscan_t yyscanner]])
310]])
311m4_define( [[M4_YY_DECL_LAST_ARG]],  [[yyscan_t yyscanner;]])
312
313%# For use in function calls to pass the additional argument.
314m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
315m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
316
317%# For use in function documentation to adjust for additional argument.
318m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
319
320/* For convenience, these vars (plus the bison vars far below)
321   are macros in the reentrant scanner. */
322#define yyin YY_G(yyin_r)
323#define yyout YY_G(yyout_r)
324#define yyextra YY_G(yyextra_r)
325#define yyleng YY_G(yyleng_r)
326#define yytext YY_G(yytext_r)
327#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
328#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
329#define yy_flex_debug YY_G(yy_flex_debug_r)
330
331m4_define( [[M4_YY_INCR_LINENO]],
332[[   
333    do{ yylineno++;
334        yycolumn=0;
335    }while(0)
336]])
337
338%endif
339
340
341
342%if-not-reentrant
343
344m4_define( [[M4_YY_INCR_LINENO]],
345[[   
346    yylineno++;
347]])
348
349%# Define these macros to be no-ops.
350m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
351m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])
352m4_define( [[YY_G]], [[($1)]])
353m4_define( [[M4_YY_PROTO_LAST_ARG]])
354m4_define( [[M4_YY_PROTO_ONLY_ARG]],  [[void]])
355m4_define( [[M4_YY_DEF_LAST_ARG]])
356
357m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
358[[
359    m4_define( [[M4_YY_DEF_ONLY_ARG]])
360]],
361[[
362    m4_define( [[M4_YY_DEF_ONLY_ARG]],  [[void]])
363]])
364m4_define([[M4_YY_DECL_LAST_ARG]])
365m4_define([[M4_YY_CALL_LAST_ARG]])
366m4_define([[M4_YY_CALL_ONLY_ARG]])
367m4_define( [[M4_YY_DOC_PARAM]], [[]])
368
369%endif
370
371
372m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
373[[
374%# For compilers that need traditional function definitions.
375%# e.g.,
376%# The function prototype taking 2 arguments
377%#    int foo (int x, char* y)
378%#
379%# ...should be written as
380%#    int foo YYFARGS2(int,x, char*,y)
381%#
382%# ...which could possibly generate
383%#    int foo (x,y,yyscanner)
384%#        int x;
385%#        char * y;
386%#        yyscan_t yyscanner;
387%#
388%# Generate traditional function defs
389    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
390        M4_YY_DECL_LAST_ARG]])
391    m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
392        $1 $2; [[\]]
393        M4_YY_DECL_LAST_ARG]])
394    m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
395        $1 $2; [[\]]
396        $3 $4; [[\]]
397        M4_YY_DECL_LAST_ARG]])
398    m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
399        $1 $2; [[\]]
400        $3 $4; [[\]]
401        $5 $6; [[\]]
402        M4_YY_DECL_LAST_ARG]])
403]],
404[[
405%# Generate C99 function defs.
406    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
407    m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
408    m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
409    m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
410]])
411
412m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
413[[
414/* Enter a start condition.  This macro really ought to take a parameter,
415 * but we do it the disgusting crufty way forced on us by the ()-less
416 * definition of BEGIN.
417 */
418#define BEGIN YY_G(yy_start) = 1 + 2 *
419]])
420
421m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
422[[
423/* Translate the current start state into a value that can be later handed
424 * to BEGIN to return to the state.  The YYSTATE alias is for lex
425 * compatibility.
426 */
427#define YY_START ((YY_G(yy_start) - 1) / 2)
428#define YYSTATE YY_START
429]])
430
431m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
432[[
433/* Action number for EOF rule of a given start state. */
434#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
435]])
436
437m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
438[[
439/* Special action meaning "start processing a new file". */
440#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
441]])
442
443m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
444[[
445#define YY_END_OF_BUFFER_CHAR 0
446]])
447
448/* Size of default input buffer. */
449#ifndef YY_BUF_SIZE
450#ifdef __ia64__
451/* On IA-64, the buffer size is 16k, not 8k.
452 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
453 * Ditto for the __ia64__ case accordingly.
454 */
455#define YY_BUF_SIZE 32768
456#else
457#define YY_BUF_SIZE 16384
458#endif /* __ia64__ */
459#endif
460
461m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
462[[
463/* The state buf must be large enough to hold one state per character in the main buffer.
464 */
465#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
466]])
467
468
469#ifndef YY_TYPEDEF_YY_BUFFER_STATE
470#define YY_TYPEDEF_YY_BUFFER_STATE
471typedef struct yy_buffer_state *YY_BUFFER_STATE;
472#endif
473
474#ifndef YY_TYPEDEF_YY_SIZE_T
475#define YY_TYPEDEF_YY_SIZE_T
476typedef size_t yy_size_t;
477#endif
478
479%if-not-reentrant
480extern yy_size_t yyleng;
481%endif
482
483%if-c-only
484%if-not-reentrant
485extern FILE *yyin, *yyout;
486%endif
487%endif
488
489m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
490[[
491#define EOB_ACT_CONTINUE_SCAN 0
492#define EOB_ACT_END_OF_FILE 1
493#define EOB_ACT_LAST_MATCH 2
494]])
495
496m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
497[[
498    m4_ifdef( [[M4_YY_USE_LINENO]],
499    [[
500    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
501     *       access to the local variable yy_act. Since yyless() is a macro, it would break
502     *       existing scanners that call yyless() from OUTSIDE yylex. 
503     *       One obvious solution it to make yy_act a global. I tried that, and saw
504     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
505     *       normally declared as a register variable-- so it is not worth it.
506     */
507    #define  YY_LESS_LINENO(n) \
508            do { \
509                int yyl;\
510                for ( yyl = n; yyl < yyleng; ++yyl )\
511                    if ( yytext[yyl] == '\n' )\
512                        --yylineno;\
513            }while(0)
514    #define YY_LINENO_REWIND_TO(dst) \
515            do {\
516                const char *p;\
517                for ( p = yy_cp-1; p >= (dst); --p)\
518                    if ( *p == '\n' )\
519                        --yylineno;\
520            }while(0)
521    ]],
522    [[
523    #define YY_LESS_LINENO(n)
524    #define YY_LINENO_REWIND_TO(ptr)
525    ]])
526]])
527
528m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
529[[
530/* Return all but the first "n" matched characters back to the input stream. */
531#define yyless(n) \
532	do \
533		{ \
534		/* Undo effects of setting up yytext. */ \
535        int yyless_macro_arg = (n); \
536        YY_LESS_LINENO(yyless_macro_arg);\
537		*yy_cp = YY_G(yy_hold_char); \
538		YY_RESTORE_YY_MORE_OFFSET \
539		YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
540		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
541		} \
542	while ( 0 )
543]])
544
545m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
546[[
547#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
548]])
549
550#ifndef YY_STRUCT_YY_BUFFER_STATE
551#define YY_STRUCT_YY_BUFFER_STATE
552struct yy_buffer_state
553	{
554%if-c-only
555	FILE *yy_input_file;
556%endif
557
558%if-c++-only
559	std::streambuf* yy_input_file; 
560%endif
561
562
563	char *yy_ch_buf;		/* input buffer */
564	char *yy_buf_pos;		/* current position in input buffer */
565
566	/* Size of input buffer in bytes, not including room for EOB
567	 * characters.
568	 */
569	yy_size_t yy_buf_size;
570
571	/* Number of characters read into yy_ch_buf, not including EOB
572	 * characters.
573	 */
574	yy_size_t yy_n_chars;
575
576	/* Whether we "own" the buffer - i.e., we know we created it,
577	 * and can realloc() it to grow it, and should free() it to
578	 * delete it.
579	 */
580	int yy_is_our_buffer;
581
582	/* Whether this is an "interactive" input source; if so, and
583	 * if we're using stdio for input, then we want to use getc()
584	 * instead of fread(), to make sure we stop fetching input after
585	 * each newline.
586	 */
587	int yy_is_interactive;
588
589	/* Whether we're considered to be at the beginning of a line.
590	 * If so, '^' rules will be active on the next match, otherwise
591	 * not.
592	 */
593	int yy_at_bol;
594
595    int yy_bs_lineno; /**< The line count. */
596    int yy_bs_column; /**< The column count. */
597    
598
599	/* Whether to try to fill the input buffer when we reach the
600	 * end of it.
601	 */
602	int yy_fill_buffer;
603
604	int yy_buffer_status;
605m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
606[[
607#define YY_BUFFER_NEW 0
608#define YY_BUFFER_NORMAL 1
609	/* When an EOF's been seen but there's still some text to process
610	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
611	 * shouldn't try reading from the input source any more.  We might
612	 * still have a bunch of tokens to match, though, because of
613	 * possible backing-up.
614	 *
615	 * When we actually see the EOF, we change the status to "new"
616	 * (via yyrestart()), so that the user can continue scanning by
617	 * just pointing yyin at a new input file.
618	 */
619#define YY_BUFFER_EOF_PENDING 2
620]])
621	};
622#endif /* !YY_STRUCT_YY_BUFFER_STATE */
623
624%if-c-only Standard (non-C++) definition
625%not-for-header
626%if-not-reentrant
627
628/* Stack of input buffers. */
629static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
630static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
631static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
632%endif
633%ok-for-header
634%endif
635
636m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
637[[
638/* We provide macros for accessing buffer states in case in the
639 * future we want to put the buffer states in a more general
640 * "scanner state".
641 *
642 * Returns the top of the stack, or NULL.
643 */
644#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
645                          ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
646                          : NULL)
647]])
648
649m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
650[[
651/* Same as previous macro, but useful when we know that the buffer stack is not
652 * NULL or when we need an lvalue. For internal use only.
653 */
654#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
655]])
656
657%if-c-only Standard (non-C++) definition
658
659%if-not-reentrant
660%not-for-header
661/* yy_hold_char holds the character lost when yytext is formed. */
662static char yy_hold_char;
663static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
664yy_size_t yyleng;
665
666/* Points to current character in buffer. */
667static char *yy_c_buf_p = (char *) 0;
668static int yy_init = 0;		/* whether we need to initialize */
669static int yy_start = 0;	/* start state number */
670
671/* Flag which is used to allow yywrap()'s to do buffer switches
672 * instead of setting up a fresh yyin.  A bit of a hack ...
673 */
674static int yy_did_buffer_switch_on_eof;
675%ok-for-header
676%endif
677
678void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
679void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
680YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
681void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
682void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
683void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
684void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
685
686m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
687[[
688static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
689static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
690static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
691]])
692
693m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
694[[
695#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
696]])
697
698YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
699YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
700YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );
701
702%endif
703
704void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
705void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
706void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
707
708m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
709[[
710#define yy_new_buffer yy_create_buffer
711]])
712
713m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
714[[
715#define yy_set_interactive(is_interactive) \
716	{ \
717	if ( ! YY_CURRENT_BUFFER ){ \
718        yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
719		YY_CURRENT_BUFFER_LVALUE =    \
720            yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
721	} \
722	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
723	}
724]])
725
726m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
727[[
728#define yy_set_bol(at_bol) \
729	{ \
730	if ( ! YY_CURRENT_BUFFER ){\
731        yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
732		YY_CURRENT_BUFFER_LVALUE =    \
733            yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
734	} \
735	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
736	}
737]])
738
739m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
740[[
741#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
742]])
743
744%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
745
746m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
747[[
748%% [1.5] DFA
749]])
750
751%if-c-only Standard (non-C++) definition
752
753m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
754[[
755static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
756static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state  M4_YY_PROTO_LAST_ARG);
757static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
758#if defined(__GNUC__) && __GNUC__ >= 3
759__attribute__((__noreturn__))
760#endif
761static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
762]])
763
764%endif
765
766m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
767[[
768/* Done after the current pattern has been matched and before the
769 * corresponding action - sets up yytext.
770 */
771#define YY_DO_BEFORE_ACTION \
772	YY_G(yytext_ptr) = yy_bp; \
773%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
774	YY_G(yy_hold_char) = *yy_cp; \
775	*yy_cp = '\0'; \
776%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
777	YY_G(yy_c_buf_p) = yy_cp;
778]])
779
780m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
781[[
782%% [4.0] data tables for the DFA and the user's section 1 definitions go here
783]])
784
785m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
786M4_YY_SC_DEFS
787m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
788
789m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
790[[
791#ifndef YY_NO_UNISTD_H
792/* Special case for "unistd.h", since it is non-ANSI. We include it way
793 * down here because we want the user's section 1 to have been scanned first.
794 * The user has a chance to override it with an option.
795 */
796%if-c-only
797#include <unistd.h>
798%endif
799%if-c++-only
800#include <unistd.h>
801%endif
802#endif
803]])
804
805m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
806[[
807#define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
808]],
809[[
810#ifndef YY_EXTRA_TYPE
811#define YY_EXTRA_TYPE void *
812#endif
813]]
814)
815
816%if-c-only Reentrant structure and macros (non-C++).
817%if-reentrant
818
819m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
820[[
821/* Holds the entire state of the reentrant scanner. */
822struct yyguts_t
823    {
824
825    /* User-defined. Not touched by flex. */
826    YY_EXTRA_TYPE yyextra_r;
827
828    /* The rest are the same as the globals declared in the non-reentrant scanner. */
829    FILE *yyin_r, *yyout_r;
830    size_t yy_buffer_stack_top; /**< index of top of stack. */
831    size_t yy_buffer_stack_max; /**< capacity of stack. */
832    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
833    char yy_hold_char;
834    yy_size_t yy_n_chars;
835    yy_size_t yyleng_r;
836    char *yy_c_buf_p;
837    int yy_init;
838    int yy_start;
839    int yy_did_buffer_switch_on_eof;
840    int yy_start_stack_ptr;
841    int yy_start_stack_depth;
842    int *yy_start_stack;
843    yy_state_type yy_last_accepting_state;
844    char* yy_last_accepting_cpos;
845
846    int yylineno_r;
847    int yy_flex_debug_r;
848
849m4_ifdef( [[M4_YY_USES_REJECT]],
850[[
851    yy_state_type *yy_state_buf;
852    yy_state_type *yy_state_ptr;
853    char *yy_full_match;
854    int yy_lp;
855
856    /* These are only needed for trailing context rules,
857     * but there's no conditional variable for that yet. */
858    int yy_looking_for_trail_begin;
859    int yy_full_lp;
860    int *yy_full_state;
861]])
862
863m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
864[[
865    char yytext_r[YYLMAX];
866    char *yytext_ptr;
867    int yy_more_offset;
868    int yy_prev_more_offset;
869]],
870[[
871    char *yytext_r;
872    int yy_more_flag;
873    int yy_more_len;
874]])
875
876m4_ifdef( [[M4_YY_BISON_LVAL]],
877[[
878    YYSTYPE * yylval_r;
879]])
880
881m4_ifdef( [[<M4_YY_BISON_LLOC>]],
882[[
883    YYLTYPE * yylloc_r;
884]])
885
886    }; /* end struct yyguts_t */
887]])
888
889
890%if-c-only
891m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
892[[
893static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
894]])
895%endif
896
897%if-reentrant
898
899m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
900[[
901    m4_ifdef( [[M4_YY_BISON_LVAL]],
902    [[
903    /* This must go here because YYSTYPE and YYLTYPE are included
904     * from bison output in section 1.*/
905    #    define yylval YY_G(yylval_r)
906    ]])
907
908    m4_ifdef( [[<M4_YY_BISON_LLOC>]],
909    [[
910    #    define yylloc YY_G(yylloc_r)
911    ]])
912]])
913
914int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
915
916int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
917
918%endif
919
920%endif End reentrant structures and macros.
921
922/* Accessor methods to globals.
923   These are made visible to non-reentrant scanners for convenience. */
924
925m4_ifdef( [[M4_YY_NO_DESTROY]],,
926[[
927int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
928]])
929
930m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
931[[
932int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
933]])
934
935m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
936[[
937void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
938]])
939
940m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
941[[
942YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
943]])
944
945m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
946[[
947void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
948]])
949
950m4_ifdef( [[M4_YY_NO_GET_IN]],,
951[[
952FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
953]])
954
955m4_ifdef( [[M4_YY_NO_SET_IN]],,
956[[
957void yyset_in  M4_YY_PARAMS( FILE * _in_str M4_YY_PROTO_LAST_ARG );
958]])
959
960m4_ifdef( [[M4_YY_NO_GET_OUT]],,
961[[
962FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
963]])
964
965m4_ifdef( [[M4_YY_NO_SET_OUT]],,
966[[
967void yyset_out  M4_YY_PARAMS( FILE * _out_str M4_YY_PROTO_LAST_ARG );
968]])
969
970m4_ifdef( [[M4_YY_NO_GET_LENG]],,
971[[
972yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
973]])
974
975m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
976[[
977char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
978]])
979
980m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
981[[
982int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
983]])
984
985m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
986[[
987void yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );
988]])
989
990m4_ifdef( [[M4_YY_REENTRANT]],
991[[
992m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
993[[
994int yyget_column  M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
995]])
996]])
997
998m4_ifdef( [[M4_YY_REENTRANT]],
999[[
1000m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
1001[[
1002void yyset_column M4_YY_PARAMS( int _column_no M4_YY_PROTO_LAST_ARG );
1003]])
1004]])
1005
1006%if-bison-bridge
1007m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
1008[[
1009YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1010]])
1011
1012void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
1013
1014m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1015[[
1016    m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
1017    [[
1018       YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1019    ]])
1020
1021    m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
1022    [[
1023        void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
1024    ]])
1025]])
1026%endif
1027
1028/* Macros after this point can all be overridden by user definitions in
1029 * section 1.
1030 */
1031
1032#ifndef YY_SKIP_YYWRAP
1033#ifdef __cplusplus
1034extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1035#else
1036extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1037#endif
1038#endif
1039
1040%not-for-header
1041#ifndef YY_NO_UNPUT
1042    m4_ifdef( [[M4_YY_NO_UNPUT]],,
1043    [[
1044    static void yyunput M4_YY_PARAMS( int c, char *buf_ptr  M4_YY_PROTO_LAST_ARG);
1045    ]])
1046#endif
1047%ok-for-header
1048%endif
1049
1050#ifndef yytext_ptr
1051static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1052#endif
1053
1054#ifdef YY_NEED_STRLEN
1055static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1056#endif
1057
1058#ifndef YY_NO_INPUT
1059%if-c-only Standard (non-C++) definition
1060%not-for-header
1061#ifdef __cplusplus
1062static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1063#else
1064static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1065#endif
1066%ok-for-header
1067%endif
1068#endif
1069
1070
1071%if-c-only
1072%# TODO: This is messy.
1073m4_ifdef( [[M4_YY_STACK_USED]],
1074[[
1075
1076m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1077[[
1078    m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1079    [[
1080        static int yy_start_stack_ptr = 0;
1081        static int yy_start_stack_depth = 0;
1082        static int *yy_start_stack = NULL;
1083    ]])
1084]])
1085
1086m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1087[[
1088    m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1089    [[
1090    static void yy_push_state M4_YY_PARAMS( int _new_state M4_YY_PROTO_LAST_ARG);
1091    ]])
1092    m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1093    [[
1094    static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1095    ]])
1096    m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1097    [[
1098    static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1099    ]])
1100]])
1101
1102]],
1103[[
1104m4_define( [[M4_YY_NO_PUSH_STATE]])
1105m4_define( [[M4_YY_NO_POP_STATE]])
1106m4_define( [[M4_YY_NO_TOP_STATE]])
1107]])
1108%endif
1109
1110/* Amount of stuff to slurp up with each read. */
1111#ifndef YY_READ_BUF_SIZE
1112#ifdef __ia64__
1113/* On IA-64, the buffer size is 16k, not 8k */
1114#define YY_READ_BUF_SIZE 16384
1115#else
1116#define YY_READ_BUF_SIZE 8192
1117#endif /* __ia64__ */
1118#endif
1119
1120m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1121[[
1122/* Copy whatever the last rule matched to the standard output. */
1123#ifndef ECHO
1124%if-c-only Standard (non-C++) definition
1125/* This used to be an fputs(), but since the string might contain NUL's,
1126 * we now use fwrite().
1127 */
1128#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
1129%endif
1130%if-c++-only C++ definition
1131#define ECHO LexerOutput( yytext, yyleng )
1132%endif
1133#endif
1134]])
1135
1136m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1137[[
1138/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1139 * is returned in "result".
1140 */
1141#ifndef YY_INPUT
1142#define YY_INPUT(buf,result,max_size) \
1143%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1144\
1145%if-c++-only C++ definition \
1146	if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
1147		YY_FATAL_ERROR( "input in flex scanner failed" );
1148%endif
1149
1150#endif
1151]])
1152
1153m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1154[[
1155/* No semi-colon after return; correct usage is to write "yyterminate();" -
1156 * we don't want an extra ';' after the "return" because that will cause
1157 * some compilers to complain about unreachable statements.
1158 */
1159#ifndef yyterminate
1160#define yyterminate() return YY_NULL
1161#endif
1162]])
1163
1164/* Number of entries by which start-condition stack grows. */
1165#ifndef YY_START_STACK_INCR
1166#define YY_START_STACK_INCR 25
1167#endif
1168
1169m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1170[[
1171/* Report a fatal error. */
1172#ifndef YY_FATAL_ERROR
1173%if-c-only
1174#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1175%endif
1176%if-c++-only
1177#define YY_FATAL_ERROR(msg) LexerError( msg )
1178%endif
1179#endif
1180]])
1181
1182%if-tables-serialization structures and prototypes
1183m4preproc_include(`tables_shared.h')
1184
1185/* Load the DFA tables from the given stream.  */
1186int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1187
1188/* Unload the tables from memory. */
1189int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1190%not-for-header
1191
1192/** Describes a mapping from a serialized table id to its deserialized state in
1193 * this scanner.  This is the bridge between our "generic" deserialization code
1194 * and the specifics of this scanner. 
1195 */
1196struct yytbl_dmap {
1197	enum yytbl_id dm_id;/**< table identifier */
1198	void  **dm_arr;		/**< address of pointer to store the deserialized table. */
1199	size_t  dm_sz;		/**< local sizeof() each element in table. */
1200};
1201
1202/** A {0,0,0}-terminated list of structs, forming the map */
1203static struct yytbl_dmap yydmap[] =
1204{
1205%tables-yydmap generated elements
1206    {0,0,0}
1207};
1208
1209/** A tables-reader object to maintain some state in the read. */
1210struct yytbl_reader {
1211    FILE * fp; /**< input stream */
1212    flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1213};
1214
1215%endif
1216/* end tables serialization structures and prototypes */
1217
1218%ok-for-header
1219
1220/* Default declaration of generated scanner - a define so the user can
1221 * easily add parameters.
1222 */
1223#ifndef YY_DECL
1224#define YY_DECL_IS_OURS 1
1225%if-c-only Standard (non-C++) definition
1226
1227
1228m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1229m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1230
1231m4_ifdef( [[M4_YY_BISON_LVAL]],
1232[[
1233    m4_dnl  The bison pure parser is used. Redefine yylex to
1234    m4_dnl  accept the lval parameter.
1235
1236    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1237               [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1238    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1239               [[YYFARGS1(YYSTYPE *,yylval_param)]])
1240]])
1241
1242m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1243[[
1244    m4_dnl  Locations are used. yylex should also accept the ylloc parameter.
1245
1246    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1247               [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1248    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1249               [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1250]])
1251
1252extern int yylex M4_YY_LEX_PROTO;
1253
1254#define YY_DECL int yylex M4_YY_LEX_DECLARATION
1255%endif
1256%if-c++-only C++ definition
1257#define YY_DECL int yyFlexLexer::yylex()
1258%endif
1259#endif /* !YY_DECL */
1260
1261m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1262[[
1263/* Code executed at the beginning of each rule, after yytext and yyleng
1264 * have been set up.
1265 */
1266#ifndef YY_USER_ACTION
1267#define YY_USER_ACTION
1268#endif
1269]])
1270
1271m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1272[[
1273/* Code executed at the end of each rule. */
1274#ifndef YY_BREAK
1275#define YY_BREAK /*LINTED*/break;
1276#endif
1277]])
1278
1279m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1280[[
1281%% [6.0] YY_RULE_SETUP definition goes here
1282]])
1283
1284%not-for-header
1285/** The main scanner function which does all the work.
1286 */
1287YY_DECL
1288{
1289	yy_state_type yy_current_state;
1290	char *yy_cp, *yy_bp;
1291	int yy_act;
1292    M4_YY_DECL_GUTS_VAR();
1293
1294m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1295[[
1296    m4_ifdef( [[M4_YY_BISON_LVAL]],
1297    [[
1298        YYSTYPE * yylval;
1299    ]])
1300    m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1301    [[
1302        YYLTYPE * yylloc;
1303    ]])
1304]])
1305
1306m4_ifdef( [[M4_YY_BISON_LVAL]],
1307[[
1308    yylval = yylval_param;
1309]])
1310
1311m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1312[[
1313    yylloc = yylloc_param;
1314]])
1315
1316	if ( !YY_G(yy_init) )
1317		{
1318		YY_G(yy_init) = 1;
1319
1320#ifdef YY_USER_INIT
1321		YY_USER_INIT;
1322#endif
1323
1324m4_ifdef( [[M4_YY_USES_REJECT]],
1325[[
1326        /* Create the reject buffer large enough to save one state per allowed character. */
1327        if ( ! YY_G(yy_state_buf) )
1328            YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE  M4_YY_CALL_LAST_ARG);
1329            if ( ! YY_G(yy_state_buf) )
1330                YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1331]])
1332
1333		if ( ! YY_G(yy_start) )
1334			YY_G(yy_start) = 1;	/* first start state */
1335
1336		if ( ! yyin )
1337%if-c-only
1338			yyin = stdin;
1339%endif
1340%if-c++-only
1341			yyin.rdbuf(std::cin.rdbuf());
1342%endif
1343
1344		if ( ! yyout )
1345%if-c-only
1346			yyout = stdout;
1347%endif
1348%if-c++-only
1349			yyout.rdbuf(std::cout.rdbuf());
1350%endif
1351
1352		if ( ! YY_CURRENT_BUFFER ) {
1353			yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1354			YY_CURRENT_BUFFER_LVALUE =
1355				yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1356		}
1357
1358		yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1359		}
1360
1361	{
1362%% [7.0] user's declarations go here
1363
1364	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
1365		{
1366%% [8.0] yymore()-related code goes here
1367		yy_cp = YY_G(yy_c_buf_p);
1368
1369		/* Support of yytext. */
1370		*yy_cp = YY_G(yy_hold_char);
1371
1372		/* yy_bp points to the position in yy_ch_buf of the start of
1373		 * the current run.
1374		 */
1375		yy_bp = yy_cp;
1376
1377%% [9.0] code to set up and find next match goes here
1378
1379yy_find_action:
1380%% [10.0] code to find the action number goes here
1381
1382		YY_DO_BEFORE_ACTION;
1383
1384%% [11.0] code for yylineno update goes here
1385
1386do_action:	/* This label is used only to access EOF actions. */
1387
1388%% [12.0] debug code goes here
1389
1390		switch ( yy_act )
1391	{ /* beginning of action switch */
1392%% [13.0] actions go here
1393
1394	case YY_END_OF_BUFFER:
1395		{
1396		/* Amount of text matched not including the EOB char. */
1397		int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1398
1399		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1400		*yy_cp = YY_G(yy_hold_char);
1401		YY_RESTORE_YY_MORE_OFFSET
1402
1403		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1404			{
1405			/* We're scanning a new file or input source.  It's
1406			 * possible that this happened because the user
1407			 * just pointed yyin at a new source and called
1408			 * yylex().  If so, then we have to assure
1409			 * consistency between YY_CURRENT_BUFFER and our
1410			 * globals.  Here is the right place to do so, because
1411			 * this is the first action (other than possibly a
1412			 * back-up) that will match for the new input source.
1413			 */
1414			YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1415%if-c-only
1416			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1417%endif
1418%if-c++-only
1419			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf();
1420%endif
1421			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1422			}
1423
1424		/* Note that here we test for yy_c_buf_p "<=" to the position
1425		 * of the first EOB in the buffer, since yy_c_buf_p will
1426		 * already have been incremented past the NUL character
1427		 * (since all states make transitions on EOB to the
1428		 * end-of-buffer state).  Contrast this with the test
1429		 * in input().
1430		 */
1431		if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1432			{ /* This was really a NUL. */
1433			yy_state_type yy_next_state;
1434
1435			YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1436
1437			yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1438
1439			/* Okay, we're now positioned to make the NUL
1440			 * transition.  We couldn't have
1441			 * yy_get_previous_state() go ahead and do it
1442			 * for us because it doesn't know how to deal
1443			 * with the possibility of jamming (and we don't
1444			 * want to build jamming into it because then it
1445			 * will run more slowly).
1446			 */
1447
1448			yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1449
1450			yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1451
1452			if ( yy_next_state )
1453				{
1454				/* Consume the NUL. */
1455				yy_cp = ++YY_G(yy_c_buf_p);
1456				yy_current_state = yy_next_state;
1457				goto yy_match;
1458				}
1459
1460			else
1461				{
1462%% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1463				goto yy_find_action;
1464				}
1465			}
1466
1467		else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1468			{
1469			case EOB_ACT_END_OF_FILE:
1470				{
1471				YY_G(yy_did_buffer_switch_on_eof) = 0;
1472
1473				if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1474					{
1475					/* Note: because we've taken care in
1476					 * yy_get_next_buffer() to have set up
1477					 * yytext, we can now set up
1478					 * yy_c_buf_p so that if some total
1479					 * hoser (like flex itself) wants to
1480					 * call the scanner after we return the
1481					 * YY_NULL, it'll still work - another
1482					 * YY_NULL will get returned.
1483					 */
1484					YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1485
1486					yy_act = YY_STATE_EOF(YY_START);
1487					goto do_action;
1488					}
1489
1490				else
1491					{
1492					if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1493						YY_NEW_FILE;
1494					}
1495				break;
1496				}
1497
1498			case EOB_ACT_CONTINUE_SCAN:
1499				YY_G(yy_c_buf_p) =
1500					YY_G(yytext_ptr) + yy_amount_of_matched_text;
1501
1502				yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1503
1504				yy_cp = YY_G(yy_c_buf_p);
1505				yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1506				goto yy_match;
1507
1508			case EOB_ACT_LAST_MATCH:
1509				YY_G(yy_c_buf_p) =
1510				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1511
1512				yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1513
1514				yy_cp = YY_G(yy_c_buf_p);
1515				yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1516				goto yy_find_action;
1517			}
1518		break;
1519		}
1520
1521	default:
1522		YY_FATAL_ERROR(
1523			"fatal flex scanner internal error--no action found" );
1524	} /* end of action switch */
1525		} /* end of scanning one token */
1526	} /* end of user's declarations */
1527} /* end of yylex */
1528%ok-for-header
1529
1530%if-c++-only
1531%not-for-header
1532/* The contents of this function are C++ specific, so the YY_G macro is not used.
1533 * This constructor simply maintains backward compatibility.
1534 * DEPRECATED
1535 */
1536yyFlexLexer::yyFlexLexer( FLEX_STD istream* arg_yyin, FLEX_STD ostream* arg_yyout ):
1537	yyin(arg_yyin ? arg_yyin->rdbuf() : std::cin.rdbuf()),
1538	yyout(arg_yyout ? arg_yyout->rdbuf() : std::cout.rdbuf())
1539{
1540	ctor_common();
1541}
1542
1543/* The contents of this function are C++ specific, so the YY_G macro is not used.
1544 */
1545yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ):
1546	yyin(arg_yyin.rdbuf()),
1547	yyout(arg_yyout.rdbuf())
1548{
1549	ctor_common();
1550}
1551
1552/* The contents of this function are C++ specific, so the YY_G macro is not used.
1553 */
1554void yyFlexLexer::ctor_common()
1555{
1556	yy_c_buf_p = 0;
1557	yy_init = 0;
1558	yy_start = 0;
1559	yy_flex_debug = 0;
1560	yylineno = 1;	// this will only get updated if %option yylineno
1561
1562	yy_did_buffer_switch_on_eof = 0;
1563
1564	yy_looking_for_trail_begin = 0;
1565	yy_more_flag = 0;
1566	yy_more_len = 0;
1567	yy_more_offset = yy_prev_more_offset = 0;
1568
1569	yy_start_stack_ptr = yy_start_stack_depth = 0;
1570	yy_start_stack = NULL;
1571
1572	yy_buffer_stack = 0;
1573	yy_buffer_stack_top = 0;
1574	yy_buffer_stack_max = 0;
1575
1576
1577m4_ifdef( [[M4_YY_USES_REJECT]],
1578[[
1579	yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1580]],
1581[[
1582	yy_state_buf = 0;
1583]])
1584}
1585
1586/* The contents of this function are C++ specific, so the YY_G macro is not used.
1587 */
1588yyFlexLexer::~yyFlexLexer()
1589{
1590	delete [] yy_state_buf;
1591	yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1592	yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1593	yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
1594}
1595
1596/* The contents of this function are C++ specific, so the YY_G macro is not used.
1597 */
1598void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out )
1599{
1600	// was if( new_in )
1601	yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1602	yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1603
1604	// was if( new_out )
1605	yyout.rdbuf(new_out.rdbuf());
1606}
1607
1608/* The contents of this function are C++ specific, so the YY_G macro is not used.
1609 */
1610void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1611{
1612	if( ! new_in ) {
1613		new_in = &yyin;
1614	}
1615
1616	if ( ! new_out ) {
1617		new_out = &yyout;
1618	}
1619
1620	switch_streams(*new_in, *new_out);
1621}
1622
1623#ifdef YY_INTERACTIVE
1624int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1625#else
1626int yyFlexLexer::LexerInput( char* buf, int max_size )
1627#endif
1628{
1629	if ( yyin.eof() || yyin.fail() )
1630		return 0;
1631
1632#ifdef YY_INTERACTIVE
1633	yyin.get( buf[0] );
1634
1635	if ( yyin.eof() )
1636		return 0;
1637
1638	if ( yyin.bad() )
1639		return -1;
1640
1641	return 1;
1642
1643#else
1644	(void) yyin.read( buf, max_size );
1645
1646	if ( yyin.bad() )
1647		return -1;
1648	else
1649		return yyin.gcount();
1650#endif
1651}
1652
1653void yyFlexLexer::LexerOutput( const char* buf, int size )
1654{
1655	(void) yyout.write( buf, size );
1656}
1657%ok-for-header
1658%endif
1659
1660m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1661[[
1662/* yy_get_next_buffer - try to read in a new buffer
1663 *
1664 * Returns a code representing an action:
1665 *	EOB_ACT_LAST_MATCH -
1666 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1667 *	EOB_ACT_END_OF_FILE - end of file
1668 */
1669%if-c-only
1670static int yy_get_next_buffer YYFARGS0(void)
1671%endif
1672%if-c++-only
1673int yyFlexLexer::yy_get_next_buffer()
1674%endif
1675{
1676    M4_YY_DECL_GUTS_VAR();
1677	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1678	char *source = YY_G(yytext_ptr);
1679	yy_size_t number_to_move, i;
1680	int ret_val;
1681
1682	if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1683		YY_FATAL_ERROR(
1684		"fatal flex scanner internal error--end of buffer missed" );
1685
1686	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1687		{ /* Don't try to fill the buffer, so this is an EOF. */
1688		if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1689			{
1690			/* We matched a single character, the EOB, so
1691			 * treat this as a final EOF.
1692			 */
1693			return EOB_ACT_END_OF_FILE;
1694			}
1695
1696		else
1697			{
1698			/* We matched some text prior to the EOB, first
1699			 * process it.
1700			 */
1701			return EOB_ACT_LAST_MATCH;
1702			}
1703		}
1704
1705	/* Try to read more data. */
1706
1707	/* First move last chars to start of buffer. */
1708	number_to_move = (yy_size_t) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
1709
1710	for ( i = 0; i < number_to_move; ++i )
1711		*(dest++) = *(source++);
1712
1713	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1714		/* don't do the read, it's not guaranteed to return an EOF,
1715		 * just force an EOF
1716		 */
1717		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1718
1719	else
1720		{
1721			yy_size_t num_to_read =
1722			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1723
1724		while ( num_to_read <= 0 )
1725			{ /* Not enough room in the buffer - grow it. */
1726m4_ifdef( [[M4_YY_USES_REJECT]],
1727[[
1728			YY_FATAL_ERROR(
1729"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1730]],
1731[[
1732			/* just a shorter name for the current buffer */
1733			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1734
1735			int yy_c_buf_p_offset =
1736				(int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1737
1738			if ( b->yy_is_our_buffer )
1739				{
1740				yy_size_t new_size = b->yy_buf_size * 2;
1741
1742				if ( new_size <= 0 )
1743					b->yy_buf_size += b->yy_buf_size / 8;
1744				else
1745					b->yy_buf_size *= 2;
1746
1747				b->yy_ch_buf = (char *)
1748					/* Include room in for 2 EOB chars. */
1749					yyrealloc( (void *) b->yy_ch_buf,
1750							 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1751				}
1752			else
1753				/* Can't grow it, we don't own it. */
1754				b->yy_ch_buf = 0;
1755
1756			if ( ! b->yy_ch_buf )
1757				YY_FATAL_ERROR(
1758				"fatal error - scanner input buffer overflow" );
1759
1760			YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1761
1762			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1763						number_to_move - 1;
1764]])
1765			}
1766
1767		if ( num_to_read > YY_READ_BUF_SIZE )
1768			num_to_read = YY_READ_BUF_SIZE;
1769
1770		/* Read in more data. */
1771		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1772			YY_G(yy_n_chars), num_to_read );
1773
1774		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1775		}
1776
1777	if ( YY_G(yy_n_chars) == 0 )
1778		{
1779		if ( number_to_move == YY_MORE_ADJ )
1780			{
1781			ret_val = EOB_ACT_END_OF_FILE;
1782			yyrestart( yyin  M4_YY_CALL_LAST_ARG);
1783			}
1784
1785		else
1786			{
1787			ret_val = EOB_ACT_LAST_MATCH;
1788			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1789				YY_BUFFER_EOF_PENDING;
1790			}
1791		}
1792
1793	else
1794		ret_val = EOB_ACT_CONTINUE_SCAN;
1795
1796	if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1797		/* Extend the array by 50%, plus the number we really need. */
1798		yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
1799		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1800			(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
1801		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1802			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1803	}
1804
1805	YY_G(yy_n_chars) += number_to_move;
1806	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1807	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1808
1809	YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1810
1811	return ret_val;
1812}
1813]])
1814
1815/* yy_get_previous_state - get the state just before the EOB char was reached */
1816
1817%if-c-only
1818%not-for-header
1819    static yy_state_type yy_get_previous_state YYFARGS0(void)
1820%endif
1821%if-c++-only
1822    yy_state_type yyFlexLexer::yy_get_previous_state()
1823%endif
1824{
1825	yy_state_type yy_current_state;
1826	char *yy_cp;
1827    M4_YY_DECL_GUTS_VAR();
1828
1829%% [15.0] code to get the start state into yy_current_state goes here
1830
1831	for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1832		{
1833%% [16.0] code to find the next state goes here
1834		}
1835
1836	return yy_current_state;
1837}
1838
1839
1840/* yy_try_NUL_trans - try to make a transition on the NUL character
1841 *
1842 * synopsis
1843 *	next_state = yy_try_NUL_trans( current_state );
1844 */
1845%if-c-only
1846    static yy_state_type yy_try_NUL_trans  YYFARGS1( yy_state_type, yy_current_state)
1847%endif
1848%if-c++-only
1849    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1850%endif
1851{
1852	int yy_is_jam;
1853    M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1854%% [17.0] code to find the next state, and perhaps do backing up, goes here
1855
1856	M4_YY_NOOP_GUTS_VAR();
1857	return yy_is_jam ? 0 : yy_current_state;
1858}
1859
1860
1861#ifndef YY_NO_UNPUT
1862%if-c-only
1863m4_ifdef( [[M4_YY_NO_UNPUT]],,
1864[[
1865    static void yyunput YYFARGS2( int,c, char *,yy_bp)
1866%endif
1867%if-c++-only
1868    void yyFlexLexer::yyunput( int c, char* yy_bp)
1869%endif
1870{
1871	char *yy_cp;
1872    M4_YY_DECL_GUTS_VAR();
1873
1874    yy_cp = YY_G(yy_c_buf_p);
1875
1876	/* undo effects of setting up yytext */
1877	*yy_cp = YY_G(yy_hold_char);
1878
1879	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1880		{ /* need to shift things up to make room */
1881		/* +2 for EOB chars. */
1882		yy_size_t number_to_move = YY_G(yy_n_chars) + 2;
1883		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1884					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1885		char *source =
1886				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1887
1888		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1889			*--dest = *--source;
1890
1891		yy_cp += (int) (dest - source);
1892		yy_bp += (int) (dest - source);
1893		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1894			YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1895
1896		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1897			YY_FATAL_ERROR( "flex scanner push-back overflow" );
1898		}
1899
1900	*--yy_cp = (char) c;
1901
1902%% [18.0] update yylineno here
1903m4_ifdef( [[M4_YY_USE_LINENO]],
1904[[
1905    if ( c == '\n' ){
1906        --yylineno;
1907    }
1908]])
1909
1910	YY_G(yytext_ptr) = yy_bp;
1911	YY_G(yy_hold_char) = *yy_cp;
1912	YY_G(yy_c_buf_p) = yy_cp;
1913}
1914%if-c-only
1915]])
1916%endif
1917#endif
1918
1919%if-c-only
1920#ifndef YY_NO_INPUT
1921#ifdef __cplusplus
1922    static int yyinput YYFARGS0(void)
1923#else
1924    static int input  YYFARGS0(void)
1925#endif
1926
1927%endif
1928%if-c++-only
1929    int yyFlexLexer::yyinput()
1930%endif
1931{
1932	int c;
1933    M4_YY_DECL_GUTS_VAR();
1934
1935	*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1936
1937	if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1938		{
1939		/* yy_c_buf_p now points to the character we want to return.
1940		 * If this occurs *before* the EOB characters, then it's a
1941		 * valid NUL; if not, then we've hit the end of the buffer.
1942		 */
1943		if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1944			/* This was really a NUL. */
1945			*YY_G(yy_c_buf_p) = '\0';
1946
1947		else
1948			{ /* need more input */
1949			yy_size_t offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1950			++YY_G(yy_c_buf_p);
1951
1952			switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1953				{
1954				case EOB_ACT_LAST_MATCH:
1955					/* This happens because yy_g_n_b()
1956					 * sees that we've accumulated a
1957					 * token and flags that we need to
1958					 * try matching the token before
1959					 * proceeding.  But for input(),
1960					 * there's no matching to consider.
1961					 * So convert the EOB_ACT_LAST_MATCH
1962					 * to EOB_ACT_END_OF_FILE.
1963					 */
1964
1965					/* Reset buffer status. */
1966					yyrestart( yyin M4_YY_CALL_LAST_ARG);
1967
1968					/*FALLTHROUGH*/
1969
1970				case EOB_ACT_END_OF_FILE:
1971					{
1972					if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1973						return EOF;
1974
1975					if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1976						YY_NEW_FILE;
1977#ifdef __cplusplus
1978					return yyinput(M4_YY_CALL_ONLY_ARG);
1979#else
1980					return input(M4_YY_CALL_ONLY_ARG);
1981#endif
1982					}
1983
1984				case EOB_ACT_CONTINUE_SCAN:
1985					YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1986					break;
1987				}
1988			}
1989		}
1990
1991	c = *(unsigned char *) YY_G(yy_c_buf_p);	/* cast for 8-bit char's */
1992	*YY_G(yy_c_buf_p) = '\0';	/* preserve yytext */
1993	YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1994
1995%% [19.0] update BOL and yylineno
1996
1997	return c;
1998}
1999%if-c-only
2000#endif	/* ifndef YY_NO_INPUT */
2001%endif
2002
2003/** Immediately switch to a different input stream.
2004 * @param input_file A readable stream.
2005 * M4_YY_DOC_PARAM
2006 * @note This function does not reset the start condition to @c INITIAL .
2007 */
2008%if-c-only
2009    void yyrestart  YYFARGS1( FILE *,input_file)
2010%endif
2011%if-c++-only
2012    void yyFlexLexer::yyrestart( std::istream& input_file )
2013%endif
2014{
2015    M4_YY_DECL_GUTS_VAR();
2016
2017	if ( ! YY_CURRENT_BUFFER ){
2018        yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
2019		YY_CURRENT_BUFFER_LVALUE =
2020            yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
2021	}
2022
2023	yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
2024	yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2025}
2026
2027%if-c++-only
2028/** Delegate to the new version that takes an istream reference.
2029 * @param input_file A readable stream.
2030 * M4_YY_DOC_PARAM
2031 * @note This function does not reset the start condition to @c INITIAL .
2032 */
2033void yyFlexLexer::yyrestart( std::istream* input_file )
2034{
2035	yyrestart( *input_file );
2036}
2037%endif
2038
2039/** Switch to a different input buffer.
2040 * @param new_buffer The new input buffer.
2041 * M4_YY_DOC_PARAM
2042 */
2043%if-c-only
2044    void yy_switch_to_buffer  YYFARGS1( YY_BUFFER_STATE ,new_buffer)
2045%endif
2046%if-c++-only
2047    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2048%endif
2049{
2050    M4_YY_DECL_GUTS_VAR();
2051
2052	/* TODO. We should be able to replace this entire function body
2053	 * with
2054	 *		yypop_buffer_state();
2055	 *		yypush_buffer_state(new_buffer);
2056     */
2057	yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
2058	if ( YY_CURRENT_BUFFER == new_buffer )
2059		return;
2060
2061	if ( YY_CURRENT_BUFFER )
2062		{
2063		/* Flush out information for old buffer. */
2064		*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2065		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2066		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2067		}
2068
2069	YY_CURRENT_BUFFER_LVALUE = new_buffer;
2070	yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2071
2072	/* We don't actually know whether we did this switch during
2073	 * EOF (yywrap()) processing, but the only time this flag
2074	 * is looked at is after yywrap() is called, so it's safe
2075	 * to go ahead and always set it.
2076	 */
2077	YY_G(yy_did_buffer_switch_on_eof) = 1;
2078}
2079
2080
2081%if-c-only
2082static void yy_load_buffer_state  YYFARGS0(void)
2083%endif
2084%if-c++-only
2085    void yyFlexLexer::yy_load_buffer_state()
2086%endif
2087{
2088    M4_YY_DECL_GUTS_VAR();
2089	YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2090	YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2091%if-c-only
2092	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2093%endif
2094%if-c++-only
2095	yyin.rdbuf(YY_CURRENT_BUFFER_LVALUE->yy_input_file);
2096%endif
2097	YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
2098}
2099
2100/** Allocate and initialize an input buffer state.
2101 * @param file A readable stream.
2102 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2103 * M4_YY_DOC_PARAM
2104 * @return the allocated buffer state.
2105 */
2106%if-c-only
2107    YY_BUFFER_STATE yy_create_buffer  YYFARGS2( FILE *,file, int ,size)
2108%endif
2109%if-c++-only
2110    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size )
2111%endif
2112{
2113	YY_BUFFER_STATE b;
2114    m4_dnl M4_YY_DECL_GUTS_VAR();
2115
2116	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2117	if ( ! b )
2118		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2119
2120	b->yy_buf_size = (yy_size_t)size;
2121
2122	/* yy_ch_buf has to be 2 characters longer than the size given because
2123	 * we need to put in 2 end-of-buffer characters.
2124	 */
2125	b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
2126	if ( ! b->yy_ch_buf )
2127		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2128
2129	b->yy_is_our_buffer = 1;
2130
2131	yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2132
2133	return b;
2134}
2135
2136%if-c++-only
2137/** Delegate creation of buffers to the new version that takes an istream reference.
2138 * @param file A readable stream.
2139 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2140 * M4_YY_DOC_PARAM
2141 * @return the allocated buffer state.
2142 */
2143	YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2144{
2145	return yy_create_buffer( *file, size );
2146}
2147%endif
2148
2149/** Destroy the buffer.
2150 * @param b a buffer created with yy_create_buffer()
2151 * M4_YY_DOC_PARAM
2152 */
2153%if-c-only
2154    void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2155%endif
2156%if-c++-only
2157    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2158%endif
2159{
2160    M4_YY_DECL_GUTS_VAR();
2161
2162	if ( ! b )
2163		return;
2164
2165	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2166		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2167
2168	if ( b->yy_is_our_buffer )
2169		yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2170
2171	yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2172}
2173
2174
2175/* Initializes or reinitializes a buffer.
2176 * This function is sometimes called more than once on the same buffer,
2177 * such as during a yyrestart() or at EOF.
2178 */
2179%if-c-only
2180    static void yy_init_buffer  YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2181%endif
2182%if-c++-only
2183    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file )
2184%endif
2185
2186{
2187	int oerrno = errno;
2188    M4_YY_DECL_GUTS_VAR();
2189
2190	yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2191
2192%if-c-only
2193	b->yy_input_file = file;
2194%endif
2195%if-c++-only
2196	b->yy_input_file = file.rdbuf();
2197%endif
2198	b->yy_fill_buffer = 1;
2199
2200    /* If b is the current buffer, then yy_init_buffer was _probably_
2201     * called from yyrestart() or through yy_get_next_buffer.
2202     * In that case, we don't want to reset the lineno or column.
2203     */
2204    if (b != YY_CURRENT_BUFFER){
2205        b->yy_bs_lineno = 1;
2206        b->yy_bs_column = 0;
2207    }
2208
2209%if-c-only
2210m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2211[[
2212	b->yy_is_interactive = 1;
2213]],
2214[[
2215    m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2216    [[
2217        b->yy_is_interactive = 0;
2218    ]],
2219    [[
2220        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2221    ]])
2222]])
2223%endif
2224%if-c++-only
2225	b->yy_is_interactive = 0;
2226%endif
2227	errno = oerrno;
2228}
2229
2230/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2231 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2232 * M4_YY_DOC_PARAM
2233 */
2234%if-c-only
2235    void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2236%endif
2237%if-c++-only
2238    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2239%endif
2240{
2241    M4_YY_DECL_GUTS_VAR();
2242	if ( ! b )
2243		return;
2244
2245	b->yy_n_chars = 0;
2246
2247	/* We always need two end-of-buffer characters.  The first causes
2248	 * a transition to the end-of-buffer state.  The second causes
2249	 * a jam in that state.
2250	 */
2251	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2252	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2253
2254	b->yy_buf_pos = &b->yy_ch_buf[0];
2255
2256	b->yy_at_bol = 1;
2257	b->yy_buffer_status = YY_BUFFER_NEW;
2258
2259	if ( b == YY_CURRENT_BUFFER )
2260		yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2261}
2262
2263%if-c-or-c++
2264/** Pushes the new state onto the stack. The new state becomes
2265 *  the current state. This function will allocate the stack
2266 *  if necessary.
2267 *  @param new_buffer The new state.
2268 *  M4_YY_DOC_PARAM
2269 */
2270%if-c-only
2271void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2272%endif
2273%if-c++-only
2274void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2275%endif
2276{
2277    M4_YY_DECL_GUTS_VAR();
2278	if (new_buffer == NULL)
2279		return;
2280
2281	yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2282
2283	/* This block is copied from yy_switch_to_buffer. */
2284	if ( YY_CURRENT_BUFFER )
2285		{
2286		/* Flush out information for old buffer. */
2287		*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2288		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2289		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2290		}
2291
2292	/* Only push if top exists. Otherwise, replace top. */
2293	if (YY_CURRENT_BUFFER)
2294		YY_G(yy_buffer_stack_top)++;
2295	YY_CURRENT_BUFFER_LVALUE = new_buffer;
2296
2297	/* copied from yy_switch_to_buffer. */
2298	yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2299	YY_G(yy_did_buffer_switch_on_eof) = 1;
2300}
2301%endif
2302
2303
2304%if-c-or-c++
2305/** Removes and deletes the top of the stack, if present.
2306 *  The next element becomes the new top.
2307 *  M4_YY_DOC_PARAM
2308 */
2309%if-c-only
2310void yypop_buffer_state YYFARGS0(void)
2311%endif
2312%if-c++-only
2313void yyFlexLexer::yypop_buffer_state (void)
2314%endif
2315{
2316    M4_YY_DECL_GUTS_VAR();
2317	if (!YY_CURRENT_BUFFER)
2318		return;
2319
2320	yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2321	YY_CURRENT_BUFFER_LVALUE = NULL;
2322	if (YY_G(yy_buffer_stack_top) > 0)
2323		--YY_G(yy_buffer_stack_top);
2324
2325	if (YY_CURRENT_BUFFER) {
2326		yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2327		YY_G(yy_did_buffer_switch_on_eof) = 1;
2328	}
2329}
2330%endif
2331
2332
2333%if-c-or-c++
2334/* Allocates the stack if it does not exist.
2335 *  Guarantees space for at least one push.
2336 */
2337%if-c-only
2338static void yyensure_buffer_stack YYFARGS0(void)
2339%endif
2340%if-c++-only
2341void yyFlexLexer::yyensure_buffer_stack(void)
2342%endif
2343{
2344	yy_size_t num_to_alloc;
2345    M4_YY_DECL_GUTS_VAR();
2346
2347	if (!YY_G(yy_buffer_stack)) {
2348
2349		/* First allocation is just for 2 elements, since we don't know if this
2350		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2351		 * immediate realloc on the next call.
2352         */
2353		num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
2354		YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2355								(num_to_alloc * sizeof(struct yy_buffer_state*)
2356								M4_YY_CALL_LAST_ARG);
2357		if ( ! YY_G(yy_buffer_stack) )
2358			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2359								  
2360		
2361		memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2362				
2363		YY_G(yy_buffer_stack_max) = num_to_alloc;
2364		YY_G(yy_buffer_stack_top) = 0;
2365		return;
2366	}
2367
2368	if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2369
2370		/* Increase the buffer to prepare for a possible push. */
2371		yy_size_t grow_size = 8 /* arbitrary grow size */;
2372
2373		num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2374		YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2375								(YY_G(yy_buffer_stack),
2376								num_to_alloc * sizeof(struct yy_buffer_state*)
2377								M4_YY_CALL_LAST_ARG);
2378		if ( ! YY_G(yy_buffer_stack) )
2379			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2380
2381		/* zero only the new slots.*/
2382		memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2383		YY_G(yy_buffer_stack_max) = num_to_alloc;
2384	}
2385}
2386%endif
2387
2388
2389
2390
2391m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2392[[
2393%if-c-only
2394/** Setup the input buffer state to scan directly from a user-specified character buffer.
2395 * @param base the character buffer
2396 * @param size the size in bytes of the character buffer
2397 * M4_YY_DOC_PARAM
2398 * @return the newly allocated buffer state object. 
2399 */
2400YY_BUFFER_STATE yy_scan_buffer  YYFARGS2( char *,base, yy_size_t ,size)
2401{
2402	YY_BUFFER_STATE b;
2403    m4_dnl M4_YY_DECL_GUTS_VAR();
2404
2405	if ( size < 2 ||
2406	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
2407	     base[size-1] != YY_END_OF_BUFFER_CHAR )
2408		/* They forgot to leave room for the EOB's. */
2409		return 0;
2410
2411	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2412	if ( ! b )
2413		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2414
2415	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
2416	b->yy_buf_pos = b->yy_ch_buf = base;
2417	b->yy_is_our_buffer = 0;
2418	b->yy_input_file = 0;
2419	b->yy_n_chars = b->yy_buf_size;
2420	b->yy_is_interactive = 0;
2421	b->yy_at_bol = 1;
2422	b->yy_fill_buffer = 0;
2423	b->yy_buffer_status = YY_BUFFER_NEW;
2424
2425	yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2426
2427	return b;
2428}
2429%endif
2430]])
2431
2432
2433m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2434[[
2435%if-c-only
2436/** Setup the input buffer state to scan a string. The next call to yylex() will
2437 * scan from a @e copy of @a str.
2438 * @param yystr a NUL-terminated string to scan
2439 * M4_YY_DOC_PARAM
2440 * @return the newly allocated buffer state object.
2441 * @note If you want to scan bytes that may contain NUL values, then use
2442 *       yy_scan_bytes() instead.
2443 */
2444YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2445{
2446    m4_dnl M4_YY_DECL_GUTS_VAR();
2447
2448	return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2449}
2450%endif
2451]])
2452
2453
2454m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2455[[
2456%if-c-only
2457/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2458 * scan from a @e copy of @a bytes.
2459 * @param yybytes the byte buffer to scan
2460 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2461 * M4_YY_DOC_PARAM
2462 * @return the newly allocated buffer state object.
2463 */
2464YY_BUFFER_STATE yy_scan_bytes  YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)
2465{
2466	YY_BUFFER_STATE b;
2467	char *buf;
2468	yy_size_t n;
2469	yy_size_t i;
2470    m4_dnl M4_YY_DECL_GUTS_VAR();
2471
2472	/* Get memory for full buffer, including space for trailing EOB's. */
2473	n = _yybytes_len + 2;
2474	buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2475	if ( ! buf )
2476		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2477
2478	for ( i = 0; i < _yybytes_len; ++i )
2479		buf[i] = yybytes[i];
2480
2481	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2482
2483	b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2484	if ( ! b )
2485		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2486
2487	/* It's okay to grow etc. this buffer, and we should throw it
2488	 * away when we're done.
2489	 */
2490	b->yy_is_our_buffer = 1;
2491
2492	return b;
2493}
2494%endif
2495]])
2496
2497
2498m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2499[[
2500%if-c-only
2501    static void yy_push_state YYFARGS1( int ,_new_state)
2502%endif
2503%if-c++-only
2504    void yyFlexLexer::yy_push_state( int _new_state )
2505%endif
2506{
2507    M4_YY_DECL_GUTS_VAR();
2508	if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2509		{
2510		yy_size_t new_size;
2511
2512		YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2513		new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2514
2515		if ( ! YY_G(yy_start_stack) )
2516			YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2517
2518		else
2519			YY_G(yy_start_stack) = (int *) yyrealloc(
2520					(void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2521
2522		if ( ! YY_G(yy_start_stack) )
2523			YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2524		}
2525
2526	YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2527
2528	BEGIN(_new_state);
2529}
2530]])
2531
2532
2533m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2534[[
2535%if-c-only
2536    static void yy_pop_state  YYFARGS0(void)
2537%endif
2538%if-c++-only
2539    void yyFlexLexer::yy_pop_state()
2540%endif
2541{
2542    M4_YY_DECL_GUTS_VAR();
2543	if ( --YY_G(yy_start_stack_ptr) < 0 )
2544		YY_FATAL_ERROR( "start-condition stack underflow" );
2545
2546	BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2547}
2548]])
2549
2550
2551m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2552[[
2553%if-c-only
2554    static int yy_top_state  YYFARGS0(void)
2555%endif
2556%if-c++-only
2557    int yyFlexLexer::yy_top_state()
2558%endif
2559{
2560    M4_YY_DECL_GUTS_VAR();
2561	return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2562}
2563]])
2564
2565#ifndef YY_EXIT_FAILURE
2566#define YY_EXIT_FAILURE 2
2567#endif
2568
2569%if-c-only
2570static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2571{
2572	M4_YY_DECL_GUTS_VAR();
2573	M4_YY_NOOP_GUTS_VAR();
2574	(void) fprintf( stderr, "%s\n", msg );
2575	exit( YY_EXIT_FAILURE );
2576}
2577%endif
2578%if-c++-only
2579void yyFlexLexer::LexerError( yyconst char msg[] )
2580{
2581    M4_YY_DECL_GUTS_VAR();
2582	std::cerr << msg << std::endl;
2583	exit( YY_EXIT_FAILURE );
2584}
2585%endif
2586
2587/* Redefine yyless() so it works in section 3 code. */
2588
2589#undef yyless
2590#define yyless(n) \
2591	do \
2592		{ \
2593		/* Undo effects of setting up yytext. */ \
2594        int yyless_macro_arg = (n); \
2595        YY_LESS_LINENO(yyless_macro_arg);\
2596		yytext[yyleng] = YY_G(yy_hold_char); \
2597		YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2598		YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2599		*YY_G(yy_c_buf_p) = '\0'; \
2600		yyleng = yyless_macro_arg; \
2601		} \
2602	while ( 0 )
2603
2604
2605
2606/* Accessor  methods (get/set functions) to struct members. */
2607
2608%if-c-only
2609%if-reentrant
2610m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2611[[
2612/** Get the user-defined data for this scanner.
2613 * M4_YY_DOC_PARAM
2614 */
2615YY_EXTRA_TYPE yyget_extra  YYFARGS0(void)
2616{
2617    M4_YY_DECL_GUTS_VAR();
2618    return yyextra;
2619}
2620]])
2621%endif
2622
2623m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2624[[
2625/** Get the current line number.
2626 * M4_YY_DOC_PARAM
2627 */
2628int yyget_lineno  YYFARGS0(void)
2629{
2630    M4_YY_DECL_GUTS_VAR();
2631    
2632    m4_ifdef( [[M4_YY_REENTRANT]],
2633    [[
2634        if (! YY_CURRENT_BUFFER)
2635            return 0;
2636    ]])
2637    return yylineno;
2638}
2639]])
2640
2641m4_ifdef( [[M4_YY_REENTRANT]],
2642[[
2643m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2644[[
2645/** Get the current column number.
2646 * M4_YY_DOC_PARAM
2647 */
2648int yyget_column  YYFARGS0(void)
2649{
2650    M4_YY_DECL_GUTS_VAR();
2651    
2652    m4_ifdef( [[M4_YY_REENTRANT]],
2653    [[
2654        if (! YY_CURRENT_BUFFER)
2655            return 0;
2656    ]])
2657    return yycolumn;
2658}
2659]])
2660]])
2661
2662m4_ifdef( [[M4_YY_NO_GET_IN]],,
2663[[
2664/** Get the input stream.
2665 * M4_YY_DOC_PARAM
2666 */
2667FILE *yyget_in  YYFARGS0(void)
2668{
2669    M4_YY_DECL_GUTS_VAR();
2670    return yyin;
2671}
2672]])
2673
2674m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2675[[
2676/** Get the output stream.
2677 * M4_YY_DOC_PARAM
2678 */
2679FILE *yyget_out  YYFARGS0(void)
2680{
2681    M4_YY_DECL_GUTS_VAR();
2682    return yyout;
2683}
2684]])
2685
2686m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2687[[
2688/** Get the length of the current token.
2689 * M4_YY_DOC_PARAM
2690 */
2691yy_size_t yyget_leng  YYFARGS0(void)
2692{
2693    M4_YY_DECL_GUTS_VAR();
2694    return yyleng;
2695}
2696]])
2697
2698/** Get the current token.
2699 * M4_YY_DOC_PARAM
2700 */
2701m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2702[[
2703char *yyget_text  YYFARGS0(void)
2704{
2705    M4_YY_DECL_GUTS_VAR();
2706    return yytext;
2707}
2708]])
2709
2710%if-reentrant
2711m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2712[[
2713/** Set the user-defined data. This data is never touched by the scanner.
2714 * @param user_defined The data to be associated with this scanner.
2715 * M4_YY_DOC_PARAM
2716 */
2717void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2718{
2719    M4_YY_DECL_GUTS_VAR();
2720    yyextra = user_defined ;
2721}
2722]])
2723%endif
2724
2725m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2726[[
2727/** Set the current line number.
2728 * @param _line_number line number
2729 * M4_YY_DOC_PARAM
2730 */
2731void yyset_lineno YYFARGS1( int ,_line_number)
2732{
2733    M4_YY_DECL_GUTS_VAR();
2734
2735    m4_ifdef( [[M4_YY_REENTRANT]],
2736    [[
2737        /* lineno is only valid if an input buffer exists. */
2738        if (! YY_CURRENT_BUFFER )
2739           YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2740    ]])
2741    yylineno = _line_number;
2742}
2743]])
2744
2745m4_ifdef( [[M4_YY_REENTRANT]],
2746[[
2747m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2748[[
2749/** Set the current column.
2750 * @param _column_no column number
2751 * M4_YY_DOC_PARAM
2752 */
2753void yyset_column YYFARGS1( int , _column_no)
2754{
2755    M4_YY_DECL_GUTS_VAR();
2756
2757    m4_ifdef( [[M4_YY_REENTRANT]],
2758    [[
2759        /* column is only valid if an input buffer exists. */
2760        if (! YY_CURRENT_BUFFER )
2761           YY_FATAL_ERROR( "yyset_column called with no buffer" );
2762    ]])
2763    yycolumn = _column_no;
2764}
2765]])
2766]])
2767
2768
2769m4_ifdef( [[M4_YY_NO_SET_IN]],,
2770[[
2771/** Set the input stream. This does not discard the current
2772 * input buffer.
2773 * @param _in_str A readable stream.
2774 * M4_YY_DOC_PARAM
2775 * @see yy_switch_to_buffer
2776 */
2777void yyset_in YYFARGS1( FILE * ,_in_str)
2778{
2779    M4_YY_DECL_GUTS_VAR();
2780    yyin = _in_str ;
2781}
2782]])
2783
2784m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2785[[
2786void yyset_out YYFARGS1( FILE * ,_out_str)
2787{
2788    M4_YY_DECL_GUTS_VAR();
2789    yyout = _out_str ;
2790}
2791]])
2792
2793
2794m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2795[[
2796int yyget_debug  YYFARGS0(void)
2797{
2798    M4_YY_DECL_GUTS_VAR();
2799    return yy_flex_debug;
2800}
2801]])
2802
2803m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2804[[
2805void yyset_debug YYFARGS1( int ,_bdebug)
2806{
2807    M4_YY_DECL_GUTS_VAR();
2808    yy_flex_debug = _bdebug ;
2809}
2810]])
2811%endif
2812
2813%if-reentrant
2814/* Accessor methods for yylval and yylloc */
2815
2816%if-bison-bridge
2817m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2818[[
2819YYSTYPE * yyget_lval  YYFARGS0(void)
2820{
2821    M4_YY_DECL_GUTS_VAR();
2822    return yylval;
2823}
2824]])
2825
2826m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2827[[
2828void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2829{
2830    M4_YY_DECL_GUTS_VAR();
2831    yylval = yylval_param;
2832}
2833]])
2834
2835m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2836[[
2837    m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2838    [[
2839YYLTYPE *yyget_lloc  YYFARGS0(void)
2840{
2841    M4_YY_DECL_GUTS_VAR();
2842    return yylloc;
2843}
2844    ]])
2845
2846    m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2847    [[
2848void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2849{
2850    M4_YY_DECL_GUTS_VAR();
2851    yylloc = yylloc_param;
2852}
2853    ]])
2854]])
2855
2856%endif
2857
2858
2859/* User-visible API */
2860
2861/* yylex_init is special because it creates the scanner itself, so it is
2862 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2863 * That's why we explicitly handle the declaration, instead of using our macros.
2864 */
2865m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2866[[
2867int yylex_init( ptr_yy_globals )
2868    yyscan_t* ptr_yy_globals;
2869]],
2870[[
2871int yylex_init(yyscan_t* ptr_yy_globals)
2872]])
2873{
2874    if (ptr_yy_globals == NULL){
2875        errno = EINVAL;
2876        return 1;
2877    }
2878
2879    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2880
2881    if (*ptr_yy_globals == NULL){
2882        errno = ENOMEM;
2883        return 1;
2884    }
2885
2886    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2887    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2888
2889    return yy_init_globals ( *ptr_yy_globals );
2890}
2891
2892
2893/* yylex_init_extra has the same functionality as yylex_init, but follows the
2894 * convention of taking the scanner as the last argument. Note however, that
2895 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2896 * is the reason, too, why this function also must handle its own declaration).
2897 * The user defined value in the first argument will be available to yyalloc in
2898 * the yyextra field.
2899 */
2900m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2901[[
2902int yylex_init_extra( yy_user_defined, ptr_yy_globals )
2903    YY_EXTRA_TYPE yy_user_defined;
2904    yyscan_t* ptr_yy_globals;
2905]],
2906[[
2907int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2908]])
2909{
2910    struct yyguts_t dummy_yyguts;
2911
2912    yyset_extra (yy_user_defined, &dummy_yyguts);
2913
2914    if (ptr_yy_globals == NULL){
2915        errno = EINVAL;
2916        return 1;
2917    }
2918	
2919    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2920	
2921    if (*ptr_yy_globals == NULL){
2922        errno = ENOMEM;
2923        return 1;
2924    }
2925    
2926    /* By setting to 0xAA, we expose bugs in
2927    yy_init_globals. Leave at 0x00 for releases. */
2928    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2929    
2930    yyset_extra (yy_user_defined, *ptr_yy_globals);
2931    
2932    return yy_init_globals ( *ptr_yy_globals );
2933}
2934
2935%endif if-c-only
2936%# Actually, that ended an if-rentrant section
2937
2938%if-c-only
2939static int yy_init_globals YYFARGS0(void)
2940{
2941    M4_YY_DECL_GUTS_VAR();
2942    /* Initialization is the same as for the non-reentrant scanner.
2943     * This function is called from yylex_destroy(), so don't allocate here.
2944     */
2945
2946m4_ifdef( [[M4_YY_USE_LINENO]],
2947[[
2948    m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2949    [[
2950    /* We do not touch yylineno unless the option is enabled. */
2951    yylineno =  1;
2952    ]])
2953]])
2954    YY_G(yy_buffer_stack) = 0;
2955    YY_G(yy_buffer_stack_top) = 0;
2956    YY_G(yy_buffer_stack_max) = 0;
2957    YY_G(yy_c_buf_p) = (char *) 0;
2958    YY_G(yy_init) = 0;
2959    YY_G(yy_start) = 0;
2960
2961m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2962[[
2963    YY_G(yy_start_stack_ptr) = 0;
2964    YY_G(yy_start_stack_depth) = 0;
2965    YY_G(yy_start_stack) =  NULL;
2966]])
2967
2968m4_ifdef( [[M4_YY_USES_REJECT]],
2969[[
2970    YY_G(yy_state_buf) = 0;
2971    YY_G(yy_state_ptr) = 0;
2972    YY_G(yy_full_match) = 0;
2973    YY_G(yy_lp) = 0;
2974]])
2975
2976m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2977[[
2978    YY_G(yytext_ptr) = 0;
2979    YY_G(yy_more_offset) = 0;
2980    YY_G(yy_prev_more_offset) = 0;
2981]])
2982
2983/* Defined in main.c */
2984#ifdef YY_STDINIT
2985    yyin = stdin;
2986    yyout = stdout;
2987#else
2988    yyin = (FILE *) 0;
2989    yyout = (FILE *) 0;
2990#endif
2991
2992    /* For future reference: Set errno on error, since we are called by
2993     * yylex_init()
2994     */
2995    return 0;
2996}
2997%endif
2998
2999
3000%if-c-only SNIP! this currently causes conflicts with the c++ scanner
3001/* yylex_destroy is for both reentrant and non-reentrant scanners. */
3002int yylex_destroy  YYFARGS0(void)
3003{
3004    M4_YY_DECL_GUTS_VAR();
3005
3006    /* Pop the buffer stack, destroying each element. */
3007	while(YY_CURRENT_BUFFER){
3008		yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
3009		YY_CURRENT_BUFFER_LVALUE = NULL;
3010		yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
3011	}
3012
3013	/* Destroy the stack itself. */
3014	yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
3015	YY_G(yy_buffer_stack) = NULL;
3016
3017m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
3018[[
3019    /* Destroy the start condition stack. */
3020        yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
3021        YY_G(yy_start_stack) = NULL;
3022]])
3023
3024m4_ifdef( [[M4_YY_USES_REJECT]],
3025[[
3026    yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
3027    YY_G(yy_state_buf)  = NULL;
3028]])
3029
3030    /* Reset the globals. This is important in a non-reentrant scanner so the next time
3031     * yylex() is called, initialization will occur. */
3032    yy_init_globals( M4_YY_CALL_ONLY_ARG);
3033
3034%if-reentrant
3035    /* Destroy the main struct (reentrant only). */
3036    yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
3037    yyscanner = NULL;
3038%endif
3039    return 0;
3040}
3041%endif
3042
3043
3044m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
3045[[
3046/*
3047 * Internal utility routines.
3048 */
3049]])
3050
3051m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
3052[[
3053#ifndef yytext_ptr
3054static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
3055{
3056	M4_YY_DECL_GUTS_VAR();
3057	M4_YY_NOOP_GUTS_VAR();
3058
3059	int i;
3060	for ( i = 0; i < n; ++i )
3061		s1[i] = s2[i];
3062}
3063#endif
3064]])
3065
3066m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
3067[[
3068#ifdef YY_NEED_STRLEN
3069static int yy_flex_strlen YYFARGS1( yyconst char *,s)
3070{
3071	int n;
3072	for ( n = 0; s[n]; ++n )
3073		;
3074
3075	return n;
3076}
3077#endif
3078]])
3079
3080m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
3081[[
3082void *yyalloc YYFARGS1( yy_size_t ,size)
3083{
3084	M4_YY_DECL_GUTS_VAR();
3085	M4_YY_NOOP_GUTS_VAR();
3086	return (void *) malloc( size );
3087}
3088]])
3089
3090m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
3091[[
3092void *yyrealloc  YYFARGS2( void *,ptr, yy_size_t ,size)
3093{
3094	M4_YY_DECL_GUTS_VAR();
3095	M4_YY_NOOP_GUTS_VAR();
3096
3097	/* The cast to (char *) in the following accommodates both
3098	 * implementations that use char* generic pointers, and those
3099	 * that use void* generic pointers.  It works with the latter
3100	 * because both ANSI C and C++ allow castless assignment from
3101	 * any pointer type to void*, and deal with argument conversions
3102	 * as though doing an assignment.
3103	 */
3104	return (void *) realloc( (char *) ptr, size );
3105}
3106]])
3107
3108m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
3109[[
3110void yyfree YYFARGS1( void *,ptr)
3111{
3112	M4_YY_DECL_GUTS_VAR();
3113	M4_YY_NOOP_GUTS_VAR();
3114	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
3115}
3116]])
3117
3118%if-tables-serialization definitions
3119m4preproc_include(`tables_shared.c')
3120
3121static int yytbl_read8 (void *v, struct yytbl_reader * rd)
3122{
3123    errno = 0;
3124    if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3125        errno = EIO;
3126        return -1;
3127    }
3128    rd->bread += sizeof(flex_uint8_t);
3129    return 0;
3130}
3131
3132static int yytbl_read16 (void *v, struct yytbl_reader * rd)
3133{
3134    errno = 0;
3135    if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3136        errno = EIO;
3137        return -1;
3138    }
3139    *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3140    rd->bread += sizeof(flex_uint16_t);
3141    return 0;
3142}
3143
3144static int yytbl_read32 (void *v, struct yytbl_reader * rd)
3145{
3146    errno = 0;
3147    if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3148        errno = EIO;
3149        return -1;
3150    }
3151    *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3152    rd->bread += sizeof(flex_uint32_t);
3153    return 0;
3154}
3155
3156/** Read the header */
3157static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3158{
3159    size_t  bytes;
3160    memset (th, 0, sizeof (struct yytbl_hdr));
3161
3162    if (yytbl_read32 (&(th->th_magic), rd) != 0)
3163        return -1;
3164
3165    if (th->th_magic != YYTBL_MAGIC){
3166        YY_FATAL_ERROR( "bad magic number" );   /* TODO: not fatal. */
3167        return -1;
3168    }
3169
3170    if (yytbl_read32 (&(th->th_hsize), rd) != 0
3171        || yytbl_read32 (&(th->th_ssize), rd) != 0
3172        || yytbl_read16 (&(th->th_flags), rd) != 0)
3173        return -1;
3174
3175    /* Sanity check on header size. Greater than 1k suggests some funny business. */
3176    if (th->th_hsize < 16 || th->th_hsize > 1024){
3177        YY_FATAL_ERROR( "insane header size detected" );   /* TODO: not fatal. */
3178        return -1;
3179    }
3180
3181    /* Allocate enough space for the version and name fields */
3182    bytes = th->th_hsize - 14;
3183    th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3184    if ( ! th->th_version )
3185        YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
3186
3187    /* we read it all into th_version, and point th_name into that data */
3188    if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
3189        errno = EIO;
3190        yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3191        th->th_version = NULL;
3192        return -1;
3193    }
3194    else
3195        rd->bread += bytes;
3196
3197    th->th_name = th->th_version + strlen (th->th_version) + 1;
3198    return 0;
3199}
3200
3201/** lookup id in the dmap list.
3202 *  @param dmap pointer to first element in list
3203 *  @return NULL if not found.
3204 */
3205static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3206                                                      int, id)
3207{
3208	M4_YY_DECL_GUTS_VAR();
3209	M4_YY_NOOP_GUTS_VAR();
3210
3211    while (dmap->dm_id)
3212        if ((int)(dmap->dm_id) == id)
3213            return dmap;
3214        else
3215            dmap++;
3216    return NULL;
3217}
3218
3219/** Read a table while mapping its contents to the local array. 
3220 *  @param dmap used to performing mapping
3221 *  @return 0 on success
3222 */
3223static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3224{
3225    struct yytbl_data td;
3226    struct yytbl_dmap *transdmap=0;
3227    int     len, i, rv, inner_loop_count;
3228    void   *p=0;
3229
3230    memset (&td, 0, sizeof (struct yytbl_data));
3231
3232    if (yytbl_read16 (&td.td_id, rd) != 0
3233        || yytbl_read16 (&td.td_flags, rd) != 0
3234        || yytbl_read32 (&td.td_hilen, rd) != 0
3235        || yytbl_read32 (&td.td_lolen, rd) != 0)
3236        return -1;
3237
3238    /* Lookup the map for the transition table so we have it in case we need it
3239     * inside the loop below. This scanner might not even have a transition
3240     * table, which is ok.
3241     */
3242    transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3243
3244    if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3245        YY_FATAL_ERROR( "table id not found in map." );   /* TODO: not fatal. */
3246        return -1;
3247    }
3248
3249    /* Allocate space for table.
3250     * The --full yy_transition table is a special case, since we
3251     * need the dmap.dm_sz entry to tell us the sizeof the individual
3252     * struct members.
3253     */
3254    {
3255    size_t  bytes;
3256
3257    if ((td.td_flags & YYTD_STRUCT))
3258        bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3259    else
3260        bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3261
3262    if(M4_YY_TABLES_VERIFY)
3263        /* We point to the array itself */
3264        p = dmap->dm_arr; 
3265    else
3266        /* We point to the address of a pointer. */
3267        *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3268        if ( ! p )
3269            YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
3270    }
3271
3272    /* If it's a struct, we read 2 integers to get one element */
3273    if ((td.td_flags & YYTD_STRUCT) != 0)
3274        inner_loop_count = 2;
3275    else
3276        inner_loop_count = 1;
3277
3278    /* read and map each element.
3279     * This loop iterates once for each element of the td_data array.
3280     * Notice that we increment 'i' in the inner loop.
3281     */
3282    len = yytbl_calc_total_len (&td);
3283    for (i = 0; i < len; ){
3284        int    j;
3285
3286
3287        /* This loop really executes exactly 1 or 2 times.
3288         * The second time is to handle the second member of the
3289         * YYTD_STRUCT for the yy_transition array.
3290         */
3291        for (j = 0; j < inner_loop_count; j++, i++) {
3292            flex_int32_t t32;
3293
3294            /* read into t32 no matter what the real size is. */
3295            {
3296            flex_int16_t t16;
3297            flex_int8_t  t8;
3298
3299            switch (YYTDFLAGS2BYTES (td.td_flags)) {
3300            case sizeof (flex_int32_t):
3301                rv = yytbl_read32 (&t32, rd);
3302                break;
3303            case sizeof (flex_int16_t):
3304                rv = yytbl_read16 (&t16, rd);
3305                t32 = t16;
3306                break;
3307            case sizeof (flex_int8_t):
3308                rv = yytbl_read8 (&t8, rd);
3309                t32 = t8;
3310                break;
3311            default: 
3312                YY_FATAL_ERROR( "invalid td_flags" );   /* TODO: not fatal. */
3313                return -1;
3314            }
3315            }
3316            if (rv != 0)
3317                return -1;
3318
3319            /* copy into the deserialized array... */
3320
3321            if ((td.td_flags & YYTD_STRUCT)) {
3322                /* t32 is the j'th member of a two-element struct. */
3323                void   *v;
3324
3325                v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3326                    : &(((struct yy_trans_info *) p)->yy_nxt);
3327
3328                switch (dmap->dm_sz) {
3329                case sizeof (flex_int32_t):
3330                    if (M4_YY_TABLES_VERIFY){
3331                        if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3332                           YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" );
3333                    }else
3334                        ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3335                    break;
3336                case sizeof (flex_int16_t):
3337                    if (M4_YY_TABLES_VERIFY ){
3338                        if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3339                        YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" );
3340                    }else
3341                        ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3342                    break;
3343                case sizeof(flex_int8_t):
3344                    if (M4_YY_TABLES_VERIFY ){
3345                         if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3346                        YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" );
3347                    }else
3348                        ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3349                    break;
3350                default:
3351                    YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" );   /* TODO: not fatal. */
3352                    return -1;
3353                }
3354
3355                /* if we're done with j, increment p */
3356                if (j == 1)
3357                    p = (struct yy_trans_info *) p + 1;
3358            }
3359            else if ((td.td_flags & YYTD_PTRANS)) {
3360                /* t32 is an index into the transition array. */
3361                struct yy_trans_info *v;
3362
3363
3364                if (!transdmap){
3365                    YY_FATAL_ERROR( "transition table not found" );   /* TODO: not fatal. */
3366                    return -1;
3367                }
3368                
3369                if( M4_YY_TABLES_VERIFY)
3370                    v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3371                else
3372                    v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3373
3374                if(M4_YY_TABLES_VERIFY ){
3375                    if( ((struct yy_trans_info **) p)[0] != v)
3376                        YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
3377                }else
3378                    ((struct yy_trans_info **) p)[0] = v;
3379                
3380                /* increment p */
3381                p = (struct yy_trans_info **) p + 1;
3382            }
3383            else {
3384                /* t32 is a plain int. copy data, then incrememnt p. */
3385                switch (dmap->dm_sz) {
3386                case sizeof (flex_int32_t):
3387                    if(M4_YY_TABLES_VERIFY ){
3388                        if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3389                        YY_FATAL_ERROR( "tables verification failed at flex_int32_t" );
3390                    }else
3391                        ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3392                    p = ((flex_int32_t *) p) + 1;
3393                    break;
3394                case sizeof (flex_int16_t):
3395                    if(M4_YY_TABLES_VERIFY ){
3396                        if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3397                        YY_FATAL_ERROR( "tables verification failed at flex_int16_t" );
3398                    }else
3399                        ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3400                    p = ((flex_int16_t *) p) + 1;
3401                    break;
3402                case sizeof (flex_int8_t):
3403                    if(M4_YY_TABLES_VERIFY ){
3404                        if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3405                        YY_FATAL_ERROR( "tables verification failed at flex_int8_t" );
3406                    }else
3407                        ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3408                    p = ((flex_int8_t *) p) + 1;
3409                    break;
3410                default:
3411                    YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" );   /* TODO: not fatal. */
3412                    return -1;
3413                }
3414            }
3415        }
3416
3417    }
3418
3419    /* Now eat padding. */
3420    {
3421        int pad;
3422        pad = yypad64(rd->bread);
3423        while(--pad >= 0){
3424            flex_int8_t t8;
3425            if(yytbl_read8(&t8,rd) != 0)
3426                return -1;
3427        }
3428    }
3429
3430    return 0;
3431}
3432
3433%define-yytables   The name for this specific scanner's tables.
3434
3435/* Find the key and load the DFA tables from the given stream.  */
3436static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3437{
3438    int rv=0;
3439    struct yytbl_hdr th;
3440    struct yytbl_reader rd;
3441
3442    rd.fp = fp;
3443    th.th_version = NULL;
3444
3445    /* Keep trying until we find the right set of tables or end of file. */
3446    while (!feof(rd.fp)) {
3447        rd.bread = 0;
3448        if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3449            rv = -1;
3450            goto return_rv;
3451        }
3452
3453        /* A NULL key means choose the first set of tables. */
3454        if (key == NULL)
3455            break;
3456
3457        if (strcmp(th.th_name,key) != 0){
3458            /* Skip ahead to next set */
3459            fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3460            yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3461            th.th_version = NULL;
3462        }
3463        else
3464            break;
3465    }
3466
3467    while (rd.bread < th.th_ssize){
3468        /* Load the data tables */
3469        if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3470            rv = -1;
3471            goto return_rv;
3472        }
3473    }
3474
3475return_rv:
3476    if(th.th_version){
3477        yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3478        th.th_version = NULL;
3479    }
3480
3481    return rv;
3482}
3483
3484/** Load the DFA tables for this scanner from the given stream.  */
3485int yytables_fload YYFARGS1(FILE *, fp)
3486{
3487
3488    if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3489        return -1;
3490    return 0;
3491}
3492
3493/** Destroy the loaded tables, freeing memory, etc.. */
3494int yytables_destroy YYFARGS0(void)
3495{   
3496    struct yytbl_dmap *dmap=0;
3497
3498    if(!M4_YY_TABLES_VERIFY){
3499        /* Walk the dmap, freeing the pointers */
3500        for(dmap=yydmap; dmap->dm_id; dmap++) {
3501            void * v;
3502            v = dmap->dm_arr;
3503            if(v && *(char**)v){
3504                    yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3505                    *(char**)v = NULL;
3506            }
3507        }
3508    }
3509
3510    return 0;
3511}
3512
3513/* end table serialization code definitions */
3514%endif
3515
3516
3517m4_ifdef([[M4_YY_MAIN]], [[
3518int main M4_YY_PARAMS(void);
3519
3520int main ()
3521{
3522
3523%if-reentrant
3524    yyscan_t lexer;
3525    yylex_init(&lexer);
3526    yylex( lexer );
3527    yylex_destroy( lexer);
3528
3529%endif
3530%if-not-reentrant
3531	yylex();
3532%endif
3533
3534	return 0;
3535}
3536]])
3537
3538%ok-for-header
3539m4_ifdef( [[M4_YY_IN_HEADER]],
3540[[
3541#undef YY_NEW_FILE
3542#undef YY_FLUSH_BUFFER
3543#undef yy_set_bol
3544#undef yy_new_buffer
3545#undef yy_set_interactive
3546#undef YY_DO_BEFORE_ACTION
3547
3548#ifdef YY_DECL_IS_OURS
3549#undef YY_DECL_IS_OURS
3550#undef YY_DECL
3551#endif
3552]])
3553