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