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