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