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:
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.
9 %# 2. The preprocessed skeleton is translated verbatim into a
10 %# C array, saved as "skel.c" and compiled into the flex binary.
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
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.
22 /* A lexical scanner generated by flex */
24 %# Macros for preproc stage.
27 %# Macros for runtime processing stage.
30 m4_changequote([[, ]])
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.
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
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
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]]
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
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]], [[]])]])
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]])]])
102 %# The complexity here is necessary so that m4 preserves
103 %# the argument lists to each C function.
106 m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
108 m4preproc_define(`M4_GEN_PREFIX',
109 ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
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
118 #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
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')
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]],
153 M4_GEN_PREFIX(`get_column')
154 M4_GEN_PREFIX(`set_column')
156 M4_GEN_PREFIX(`wrap')
159 m4_ifdef( [[M4_YY_BISON_LVAL]],
161 M4_GEN_PREFIX(`get_lval')
162 M4_GEN_PREFIX(`set_lval')
165 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
167 M4_GEN_PREFIX(`get_lloc')
168 M4_GEN_PREFIX(`set_lloc')
172 M4_GEN_PREFIX(`alloc')
173 M4_GEN_PREFIX(`realloc')
174 M4_GEN_PREFIX(`free')
177 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
179 M4_GEN_PREFIX(`text')
180 M4_GEN_PREFIX(`leng')
183 M4_GEN_PREFIX(`_flex_debug')
184 M4_GEN_PREFIX(`lineno')
189 m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
191 M4_GEN_PREFIX(`tables_fload')
192 M4_GEN_PREFIX(`tables_destroy')
193 M4_GEN_PREFIX(`TABLES_NAME')
196 /* First, we deal with platform-specific or compiler-specific issues. */
198 /* begin standard C headers. */
201 #include "namespace.h"
209 %if-tables-serialization
210 #include <sys/types.h>
211 #include <netinet/in.h>
213 /* end standard C headers. */
216 m4preproc_include(`flexint.h')
220 /* begin standard C++ headers. */
222 #include "namespace.h"
228 /* end standard C++ headers. */
233 /* The "const" storage-class-modifier is valid. */
236 #else /* ! __cplusplus */
238 /* C99 requires __STDC__ to be defined as 1. */
239 #if defined (__STDC__)
243 #endif /* defined (__STDC__) */
244 #endif /* ! __cplusplus */
247 #define yyconst const
252 %# For compilers that can not handle prototypes.
254 %# The function prototype
255 %# int foo(int x, char* y);
257 %# ...should be written as
258 %# int foo M4_YY_PARAMS(int x, char* y);
260 %# ...which could possibly generate
263 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
265 m4_define( [[M4_YY_PARAMS]], [[()]])
268 m4_define( [[M4_YY_PARAMS]], [[($*)]])
272 /* Returned upon end-of-file. */
277 /* Promotes a possibly negative, possibly signed char to an unsigned
278 * integer for use as an array index. If the signed char is negative,
279 * we want to instead treat it as an 8-bit unsigned char, hence the
282 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
289 /* An opaque pointer. */
290 #ifndef YY_TYPEDEF_YY_SCANNER_T
291 #define YY_TYPEDEF_YY_SCANNER_T
292 typedef void* yyscan_t;
295 %# Declare yyguts variable
296 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
297 %# For use wherever a Global is accessed or assigned.
298 m4_define( [[YY_G]], [[yyg->$1]])
300 %# For use in function prototypes to append the additional argument.
301 m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
302 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
304 %# For use in function definitions to append the additional argument.
305 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
307 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
308 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
311 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
312 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
314 m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
316 %# For use in function calls to pass the additional argument.
317 m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
318 m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
320 %# For use in function documentation to adjust for additional argument.
321 m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
323 /* For convenience, these vars (plus the bison vars far below)
324 are macros in the reentrant scanner. */
325 #define yyin YY_G(yyin_r)
326 #define yyout YY_G(yyout_r)
327 #define yyextra YY_G(yyextra_r)
328 #define yyleng YY_G(yyleng_r)
329 #define yytext YY_G(yytext_r)
330 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
331 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
332 #define yy_flex_debug YY_G(yy_flex_debug_r)
334 m4_define( [[M4_YY_INCR_LINENO]],
347 m4_define( [[M4_YY_INCR_LINENO]],
352 %# Define these macros to be no-ops.
353 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
354 m4_define( [[YY_G]], [[($1)]])
355 m4_define( [[M4_YY_PROTO_LAST_ARG]])
356 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
357 m4_define( [[M4_YY_DEF_LAST_ARG]])
359 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
361 m4_define( [[M4_YY_DEF_ONLY_ARG]])
364 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
366 m4_define([[M4_YY_DECL_LAST_ARG]])
367 m4_define([[M4_YY_CALL_LAST_ARG]])
368 m4_define([[M4_YY_CALL_ONLY_ARG]])
369 m4_define( [[M4_YY_DOC_PARAM]], [[]])
374 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
376 %# For compilers that need traditional function definitions.
378 %# The function prototype taking 2 arguments
379 %# int foo (int x, char* y)
381 %# ...should be written as
382 %# int foo YYFARGS2(int,x, char*,y)
384 %# ...which could possibly generate
385 %# int foo (x,y,yyscanner)
388 %# yyscan_t yyscanner;
390 %# Generate traditional function defs
391 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
392 M4_YY_DECL_LAST_ARG]])
393 m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
395 M4_YY_DECL_LAST_ARG]])
396 m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
399 M4_YY_DECL_LAST_ARG]])
400 m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
404 M4_YY_DECL_LAST_ARG]])
407 %# Generate C99 function defs.
408 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
409 m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
410 m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
411 m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
414 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
416 /* Enter a start condition. This macro really ought to take a parameter,
417 * but we do it the disgusting crufty way forced on us by the ()-less
418 * definition of BEGIN.
420 #define BEGIN YY_G(yy_start) = 1 + 2 *
423 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
425 /* Translate the current start state into a value that can be later handed
426 * to BEGIN to return to the state. The YYSTATE alias is for lex
429 #define YY_START ((YY_G(yy_start) - 1) / 2)
430 #define YYSTATE YY_START
433 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
435 /* Action number for EOF rule of a given start state. */
436 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
439 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
441 /* Special action meaning "start processing a new file". */
442 #define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
445 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
447 #define YY_END_OF_BUFFER_CHAR 0
450 /* Size of default input buffer. */
452 #define YY_BUF_SIZE 16384
455 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
457 /* The state buf must be large enough to hold one state per character in the main buffer.
459 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
463 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
464 #define YY_TYPEDEF_YY_BUFFER_STATE
465 typedef struct yy_buffer_state *YY_BUFFER_STATE;
474 extern FILE *yyin, *yyout;
478 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
480 #define EOB_ACT_CONTINUE_SCAN 0
481 #define EOB_ACT_END_OF_FILE 1
482 #define EOB_ACT_LAST_MATCH 2
485 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
487 m4_ifdef( [[M4_YY_USE_LINENO]],
489 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
490 * access to the local variable yy_act. Since yyless() is a macro, it would break
491 * existing scanners that call yyless() from OUTSIDE yylex.
492 * One obvious solution it to make yy_act a global. I tried that, and saw
493 * a 5% performance hit in a non-yylineno scanner, because yy_act is
494 * normally declared as a register variable-- so it is not worth it.
496 #define YY_LESS_LINENO(n) \
499 for ( yyl = n; yyl < yyleng; ++yyl )\
500 if ( yytext[yyl] == '\n' )\
505 #define YY_LESS_LINENO(n)
509 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
511 /* Return all but the first "n" matched characters back to the input stream. */
515 /* Undo effects of setting up yytext. */ \
516 int yyless_macro_arg = (n); \
517 YY_LESS_LINENO(yyless_macro_arg);\
518 *yy_cp = YY_G(yy_hold_char); \
519 YY_RESTORE_YY_MORE_OFFSET \
520 YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
521 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
526 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
528 #define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
531 #ifndef YY_TYPEDEF_YY_SIZE_T
532 #define YY_TYPEDEF_YY_SIZE_T
533 typedef size_t yy_size_t;
536 #ifndef YY_STRUCT_YY_BUFFER_STATE
537 #define YY_STRUCT_YY_BUFFER_STATE
538 struct yy_buffer_state
545 std::istream* yy_input_file;
549 char *yy_ch_buf; /* input buffer */
550 char *yy_buf_pos; /* current position in input buffer */
552 /* Size of input buffer in bytes, not including room for EOB
555 yy_size_t yy_buf_size;
557 /* Number of characters read into yy_ch_buf, not including EOB
562 /* Whether we "own" the buffer - i.e., we know we created it,
563 * and can realloc() it to grow it, and should free() it to
566 int yy_is_our_buffer;
568 /* Whether this is an "interactive" input source; if so, and
569 * if we're using stdio for input, then we want to use getc()
570 * instead of fread(), to make sure we stop fetching input after
573 int yy_is_interactive;
575 /* Whether we're considered to be at the beginning of a line.
576 * If so, '^' rules will be active on the next match, otherwise
581 int yy_bs_lineno; /**< The line count. */
582 int yy_bs_column; /**< The column count. */
585 /* Whether to try to fill the input buffer when we reach the
590 int yy_buffer_status;
591 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
593 #define YY_BUFFER_NEW 0
594 #define YY_BUFFER_NORMAL 1
595 /* When an EOF's been seen but there's still some text to process
596 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
597 * shouldn't try reading from the input source any more. We might
598 * still have a bunch of tokens to match, though, because of
599 * possible backing-up.
601 * When we actually see the EOF, we change the status to "new"
602 * (via yyrestart()), so that the user can continue scanning by
603 * just pointing yyin at a new input file.
605 #define YY_BUFFER_EOF_PENDING 2
608 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
610 %if-c-only Standard (non-C++) definition
614 /* Stack of input buffers. */
615 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
616 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
617 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
622 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
624 /* We provide macros for accessing buffer states in case in the
625 * future we want to put the buffer states in a more general
628 * Returns the top of the stack, or NULL.
630 #define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
631 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
635 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
637 /* Same as previous macro, but useful when we know that the buffer stack is not
638 * NULL or when we need an lvalue. For internal use only.
640 #define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
643 %if-c-only Standard (non-C++) definition
647 /* yy_hold_char holds the character lost when yytext is formed. */
648 static char yy_hold_char;
649 static int yy_n_chars; /* number of characters read into yy_ch_buf */
652 /* Points to current character in buffer. */
653 static char *yy_c_buf_p = (char *) 0;
654 static int yy_init = 0; /* whether we need to initialize */
655 static int yy_start = 0; /* start state number */
657 /* Flag which is used to allow yywrap()'s to do buffer switches
658 * instead of setting up a fresh yyin. A bit of a hack ...
660 static int yy_did_buffer_switch_on_eof;
664 void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
665 void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
666 YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
667 void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
668 void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
669 void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
670 void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
672 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
674 static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
675 static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
676 static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
679 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
681 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
684 YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
685 YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
686 YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, int len M4_YY_PROTO_LAST_ARG );
690 void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
691 void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
692 void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
694 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
696 #define yy_new_buffer yy_create_buffer
699 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
701 #define yy_set_interactive(is_interactive) \
703 if ( ! YY_CURRENT_BUFFER ){ \
704 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
705 YY_CURRENT_BUFFER_LVALUE = \
706 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
708 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
712 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
714 #define yy_set_bol(at_bol) \
716 if ( ! YY_CURRENT_BUFFER ){\
717 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
718 YY_CURRENT_BUFFER_LVALUE = \
719 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
721 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
725 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
727 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
730 %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
732 %if-c-only Standard (non-C++) definition
734 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
736 static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
737 static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
738 static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
739 static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
744 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
746 /* Done after the current pattern has been matched and before the
747 * corresponding action - sets up yytext.
749 #define YY_DO_BEFORE_ACTION \
750 YY_G(yytext_ptr) = yy_bp; \
751 %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
752 YY_G(yy_hold_char) = *yy_cp; \
754 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
755 YY_G(yy_c_buf_p) = yy_cp;
758 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
760 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
763 m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
765 m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
767 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
769 #ifndef YY_NO_UNISTD_H
770 /* Special case for "unistd.h", since it is non-ANSI. We include it way
771 * down here because we want the user's section 1 to have been scanned first.
772 * The user has a chance to override it with an option.
783 m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
785 #define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
788 #ifndef YY_EXTRA_TYPE
789 #define YY_EXTRA_TYPE void *
794 %if-c-only Reentrant structure and macros (non-C++).
797 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
799 /* Holds the entire state of the reentrant scanner. */
803 /* User-defined. Not touched by flex. */
804 YY_EXTRA_TYPE yyextra_r;
806 /* The rest are the same as the globals declared in the non-reentrant scanner. */
807 FILE *yyin_r, *yyout_r;
808 size_t yy_buffer_stack_top; /**< index of top of stack. */
809 size_t yy_buffer_stack_max; /**< capacity of stack. */
810 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
817 int yy_did_buffer_switch_on_eof;
818 int yy_start_stack_ptr;
819 int yy_start_stack_depth;
821 yy_state_type yy_last_accepting_state;
822 char* yy_last_accepting_cpos;
827 m4_ifdef( [[M4_YY_USES_REJECT]],
829 yy_state_type *yy_state_buf;
830 yy_state_type *yy_state_ptr;
834 /* These are only needed for trailing context rules,
835 * but there's no conditional variable for that yet. */
836 int yy_looking_for_trail_begin;
841 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
843 char yytext_r[YYLMAX];
846 int yy_prev_more_offset;
854 m4_ifdef( [[M4_YY_BISON_LVAL]],
859 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
864 }; /* end struct yyguts_t */
869 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
871 static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
877 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
879 m4_ifdef( [[M4_YY_BISON_LVAL]],
881 /* This must go here because YYSTYPE and YYLTYPE are included
882 * from bison output in section 1.*/
883 # define yylval YY_G(yylval_r)
886 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
888 # define yylloc YY_G(yylloc_r)
892 int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
894 int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
898 %endif End reentrant structures and macros.
900 /* Accessor methods to globals.
901 These are made visible to non-reentrant scanners for convenience. */
903 m4_ifdef( [[M4_YY_NO_DESTROY]],,
905 int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
908 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
910 int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
913 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
915 void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
918 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
920 YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
923 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
925 void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
928 m4_ifdef( [[M4_YY_NO_GET_IN]],,
930 FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
933 m4_ifdef( [[M4_YY_NO_SET_IN]],,
935 void yyset_in M4_YY_PARAMS( FILE * _in_str M4_YY_PROTO_LAST_ARG );
938 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
940 FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
943 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
945 void yyset_out M4_YY_PARAMS( FILE * _out_str M4_YY_PROTO_LAST_ARG );
948 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
950 int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
953 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
955 char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
958 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
960 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
963 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
965 void yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );
969 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
971 YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
974 void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
976 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
978 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
980 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
983 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
985 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
990 /* Macros after this point can all be overridden by user definitions in
994 #ifndef YY_SKIP_YYWRAP
996 extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
998 extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1004 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1006 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
1013 static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1016 #ifdef YY_NEED_STRLEN
1017 static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1021 %if-c-only Standard (non-C++) definition
1024 static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1026 static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1034 %# TODO: This is messy.
1035 m4_ifdef( [[M4_YY_STACK_USED]],
1038 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1040 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1042 static int yy_start_stack_ptr = 0;
1043 static int yy_start_stack_depth = 0;
1044 static int *yy_start_stack = NULL;
1048 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1050 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1052 static void yy_push_state M4_YY_PARAMS( int _new_state M4_YY_PROTO_LAST_ARG);
1054 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1056 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1058 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1060 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1066 m4_define( [[M4_YY_NO_PUSH_STATE]])
1067 m4_define( [[M4_YY_NO_POP_STATE]])
1068 m4_define( [[M4_YY_NO_TOP_STATE]])
1072 /* Amount of stuff to slurp up with each read. */
1073 #ifndef YY_READ_BUF_SIZE
1074 #define YY_READ_BUF_SIZE 8192
1077 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1079 /* Copy whatever the last rule matched to the standard output. */
1081 %if-c-only Standard (non-C++) definition
1082 /* This used to be an fputs(), but since the string might contain NUL's,
1083 * we now use fwrite().
1085 #define ECHO fwrite( yytext, yyleng, 1, yyout )
1087 %if-c++-only C++ definition
1088 #define ECHO LexerOutput( yytext, yyleng )
1093 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1095 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1096 * is returned in "result".
1099 #define YY_INPUT(buf,result,max_size) \
1100 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1102 %if-c++-only C++ definition \
1103 if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
1104 YY_FATAL_ERROR( "input in flex scanner failed" );
1110 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1112 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1113 * we don't want an extra ';' after the "return" because that will cause
1114 * some compilers to complain about unreachable statements.
1117 #define yyterminate() return YY_NULL
1121 /* Number of entries by which start-condition stack grows. */
1122 #ifndef YY_START_STACK_INCR
1123 #define YY_START_STACK_INCR 25
1126 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1128 /* Report a fatal error. */
1129 #ifndef YY_FATAL_ERROR
1131 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1134 #define YY_FATAL_ERROR(msg) LexerError( msg )
1139 %if-tables-serialization structures and prototypes
1140 m4preproc_include(`tables_shared.h')
1142 /* Load the DFA tables from the given stream. */
1143 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1145 /* Unload the tables from memory. */
1146 int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1149 /** Describes a mapping from a serialized table id to its deserialized state in
1150 * this scanner. This is the bridge between our "generic" deserialization code
1151 * and the specifics of this scanner.
1154 enum yytbl_id dm_id;/**< table identifier */
1155 void **dm_arr; /**< address of pointer to store the deserialized table. */
1156 size_t dm_sz; /**< local sizeof() each element in table. */
1159 /** A {0,0,0}-terminated list of structs, forming the map */
1160 static struct yytbl_dmap yydmap[] =
1162 %tables-yydmap generated elements
1166 /** A tables-reader object to maintain some state in the read. */
1167 struct yytbl_reader {
1168 FILE * fp; /**< input stream */
1169 flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1173 /* end tables serialization structures and prototypes */
1177 /* Default declaration of generated scanner - a define so the user can
1178 * easily add parameters.
1181 #define YY_DECL_IS_OURS 1
1182 %if-c-only Standard (non-C++) definition
1185 m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1186 m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1188 m4_ifdef( [[M4_YY_BISON_LVAL]],
1190 m4_dnl The bison pure parser is used. Redefine yylex to
1191 m4_dnl accept the lval parameter.
1193 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1194 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1195 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1196 [[YYFARGS1(YYSTYPE *,yylval_param)]])
1199 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1201 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
1203 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1204 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1205 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1206 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1209 extern int yylex M4_YY_LEX_PROTO;
1211 #define YY_DECL int yylex M4_YY_LEX_DECLARATION
1213 %if-c++-only C++ definition
1214 #define YY_DECL int yyFlexLexer::yylex()
1216 #endif /* !YY_DECL */
1218 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1220 /* Code executed at the beginning of each rule, after yytext and yyleng
1223 #ifndef YY_USER_ACTION
1224 #define YY_USER_ACTION
1228 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1230 /* Code executed at the end of each rule. */
1232 #define YY_BREAK break;
1236 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1238 %% [6.0] YY_RULE_SETUP definition goes here
1242 /** The main scanner function which does all the work.
1246 register yy_state_type yy_current_state;
1247 register char *yy_cp, *yy_bp;
1248 register int yy_act;
1249 M4_YY_DECL_GUTS_VAR();
1251 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1253 m4_ifdef( [[M4_YY_BISON_LVAL]],
1257 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1263 %% [7.0] user's declarations go here
1265 m4_ifdef( [[M4_YY_BISON_LVAL]],
1267 yylval = yylval_param;
1270 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1272 yylloc = yylloc_param;
1275 if ( !YY_G(yy_init) )
1283 m4_ifdef( [[M4_YY_USES_REJECT]],
1285 /* Create the reject buffer large enough to save one state per allowed character. */
1286 if ( ! YY_G(yy_state_buf) )
1287 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
1288 if ( ! YY_G(yy_state_buf) )
1289 YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1292 if ( ! YY_G(yy_start) )
1293 YY_G(yy_start) = 1; /* first start state */
1308 yyout = & std::cout;
1311 if ( ! YY_CURRENT_BUFFER ) {
1312 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1313 YY_CURRENT_BUFFER_LVALUE =
1314 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1317 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1320 while ( 1 ) /* loops until end-of-file is reached */
1322 %% [8.0] yymore()-related code goes here
1323 yy_cp = YY_G(yy_c_buf_p);
1325 /* Support of yytext. */
1326 *yy_cp = YY_G(yy_hold_char);
1328 /* yy_bp points to the position in yy_ch_buf of the start of
1333 %% [9.0] code to set up and find next match goes here
1336 %% [10.0] code to find the action number goes here
1338 YY_DO_BEFORE_ACTION;
1340 %% [11.0] code for yylineno update goes here
1342 do_action: /* This label is used only to access EOF actions. */
1344 %% [12.0] debug code goes here
1347 { /* beginning of action switch */
1348 %% [13.0] actions go here
1350 case YY_END_OF_BUFFER:
1352 /* Amount of text matched not including the EOB char. */
1353 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1355 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1356 *yy_cp = YY_G(yy_hold_char);
1357 YY_RESTORE_YY_MORE_OFFSET
1359 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1361 /* We're scanning a new file or input source. It's
1362 * possible that this happened because the user
1363 * just pointed yyin at a new source and called
1364 * yylex(). If so, then we have to assure
1365 * consistency between YY_CURRENT_BUFFER and our
1366 * globals. Here is the right place to do so, because
1367 * this is the first action (other than possibly a
1368 * back-up) that will match for the new input source.
1370 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1371 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1372 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1375 /* Note that here we test for yy_c_buf_p "<=" to the position
1376 * of the first EOB in the buffer, since yy_c_buf_p will
1377 * already have been incremented past the NUL character
1378 * (since all states make transitions on EOB to the
1379 * end-of-buffer state). Contrast this with the test
1382 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1383 { /* This was really a NUL. */
1384 yy_state_type yy_next_state;
1386 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1388 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1390 /* Okay, we're now positioned to make the NUL
1391 * transition. We couldn't have
1392 * yy_get_previous_state() go ahead and do it
1393 * for us because it doesn't know how to deal
1394 * with the possibility of jamming (and we don't
1395 * want to build jamming into it because then it
1396 * will run more slowly).
1399 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1401 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1403 if ( yy_next_state )
1405 /* Consume the NUL. */
1406 yy_cp = ++YY_G(yy_c_buf_p);
1407 yy_current_state = yy_next_state;
1413 %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1414 goto yy_find_action;
1418 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1420 case EOB_ACT_END_OF_FILE:
1422 YY_G(yy_did_buffer_switch_on_eof) = 0;
1424 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1426 /* Note: because we've taken care in
1427 * yy_get_next_buffer() to have set up
1428 * yytext, we can now set up
1429 * yy_c_buf_p so that if some total
1430 * hoser (like flex itself) wants to
1431 * call the scanner after we return the
1432 * YY_NULL, it'll still work - another
1433 * YY_NULL will get returned.
1435 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1437 yy_act = YY_STATE_EOF(YY_START);
1443 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1449 case EOB_ACT_CONTINUE_SCAN:
1451 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1453 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1455 yy_cp = YY_G(yy_c_buf_p);
1456 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1459 case EOB_ACT_LAST_MATCH:
1461 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1463 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1465 yy_cp = YY_G(yy_c_buf_p);
1466 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1467 goto yy_find_action;
1474 "fatal flex scanner internal error--no action found" );
1475 } /* end of action switch */
1476 } /* end of scanning one token */
1477 } /* end of yylex */
1482 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1484 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1492 yylineno = 1; // this will only get updated if %option yylineno
1494 yy_did_buffer_switch_on_eof = 0;
1496 yy_looking_for_trail_begin = 0;
1499 yy_more_offset = yy_prev_more_offset = 0;
1501 yy_start_stack_ptr = yy_start_stack_depth = 0;
1502 yy_start_stack = NULL;
1504 yy_buffer_stack = 0;
1505 yy_buffer_stack_top = 0;
1506 yy_buffer_stack_max = 0;
1509 m4_ifdef( [[M4_YY_USES_REJECT]],
1511 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1518 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1520 yyFlexLexer::~yyFlexLexer()
1522 delete [] yy_state_buf;
1523 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1524 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1525 yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
1528 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1530 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1534 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1535 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1542 #ifdef YY_INTERACTIVE
1543 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1545 int yyFlexLexer::LexerInput( char* buf, int max_size )
1548 if ( yyin->eof() || yyin->fail() )
1551 #ifdef YY_INTERACTIVE
1552 yyin->get( buf[0] );
1563 (void) yyin->read( buf, max_size );
1568 return yyin->gcount();
1572 void yyFlexLexer::LexerOutput( const char* buf, int size )
1574 (void) yyout->write( buf, size );
1579 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1581 /* yy_get_next_buffer - try to read in a new buffer
1583 * Returns a code representing an action:
1584 * EOB_ACT_LAST_MATCH -
1585 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1586 * EOB_ACT_END_OF_FILE - end of file
1589 static int yy_get_next_buffer YYFARGS0(void)
1592 int yyFlexLexer::yy_get_next_buffer()
1595 M4_YY_DECL_GUTS_VAR();
1596 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1597 register char *source = YY_G(yytext_ptr);
1598 register int number_to_move, i;
1601 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1603 "fatal flex scanner internal error--end of buffer missed" );
1605 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1606 { /* Don't try to fill the buffer, so this is an EOF. */
1607 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1609 /* We matched a single character, the EOB, so
1610 * treat this as a final EOF.
1612 return EOB_ACT_END_OF_FILE;
1617 /* We matched some text prior to the EOB, first
1620 return EOB_ACT_LAST_MATCH;
1624 /* Try to read more data. */
1626 /* First move last chars to start of buffer. */
1627 number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
1629 for ( i = 0; i < number_to_move; ++i )
1630 *(dest++) = *(source++);
1632 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1633 /* don't do the read, it's not guaranteed to return an EOF,
1636 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1641 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1643 while ( num_to_read <= 0 )
1644 { /* Not enough room in the buffer - grow it. */
1645 m4_ifdef( [[M4_YY_USES_REJECT]],
1648 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1651 /* just a shorter name for the current buffer */
1652 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1654 int yy_c_buf_p_offset =
1655 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1657 if ( b->yy_is_our_buffer )
1659 int new_size = b->yy_buf_size * 2;
1661 if ( new_size <= 0 )
1662 b->yy_buf_size += b->yy_buf_size / 8;
1664 b->yy_buf_size *= 2;
1666 b->yy_ch_buf = (char *)
1667 /* Include room in for 2 EOB chars. */
1668 yyrealloc( (void *) b->yy_ch_buf,
1669 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1672 /* Can't grow it, we don't own it. */
1675 if ( ! b->yy_ch_buf )
1677 "fatal error - scanner input buffer overflow" );
1679 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1681 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1686 if ( num_to_read > YY_READ_BUF_SIZE )
1687 num_to_read = YY_READ_BUF_SIZE;
1689 /* Read in more data. */
1690 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1691 YY_G(yy_n_chars), (size_t) num_to_read );
1693 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1696 if ( YY_G(yy_n_chars) == 0 )
1698 if ( number_to_move == YY_MORE_ADJ )
1700 ret_val = EOB_ACT_END_OF_FILE;
1701 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1706 ret_val = EOB_ACT_LAST_MATCH;
1707 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1708 YY_BUFFER_EOF_PENDING;
1713 ret_val = EOB_ACT_CONTINUE_SCAN;
1715 if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1716 /* Extend the array by 50%, plus the number we really need. */
1717 yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
1718 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1719 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
1720 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1721 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1724 YY_G(yy_n_chars) += number_to_move;
1725 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1726 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1728 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1734 /* yy_get_previous_state - get the state just before the EOB char was reached */
1738 static yy_state_type yy_get_previous_state YYFARGS0(void)
1741 yy_state_type yyFlexLexer::yy_get_previous_state()
1744 register yy_state_type yy_current_state;
1745 register char *yy_cp;
1746 M4_YY_DECL_GUTS_VAR();
1748 %% [15.0] code to get the start state into yy_current_state goes here
1750 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1752 %% [16.0] code to find the next state goes here
1755 return yy_current_state;
1759 /* yy_try_NUL_trans - try to make a transition on the NUL character
1762 * next_state = yy_try_NUL_trans( current_state );
1765 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1768 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1771 register int yy_is_jam;
1772 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1773 %% [17.0] code to find the next state, and perhaps do backing up, goes here
1775 return yy_is_jam ? 0 : yy_current_state;
1781 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1783 static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1786 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1789 register char *yy_cp;
1790 M4_YY_DECL_GUTS_VAR();
1792 yy_cp = YY_G(yy_c_buf_p);
1794 /* undo effects of setting up yytext */
1795 *yy_cp = YY_G(yy_hold_char);
1797 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1798 { /* need to shift things up to make room */
1799 /* +2 for EOB chars. */
1800 register int number_to_move = YY_G(yy_n_chars) + 2;
1801 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1802 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1803 register char *source =
1804 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1806 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1807 *--dest = *--source;
1809 yy_cp += (int) (dest - source);
1810 yy_bp += (int) (dest - source);
1811 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1812 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1814 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1815 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1818 *--yy_cp = (char) c;
1820 %% [18.0] update yylineno here
1821 m4_ifdef( [[M4_YY_USE_LINENO]],
1828 YY_G(yytext_ptr) = yy_bp;
1829 YY_G(yy_hold_char) = *yy_cp;
1830 YY_G(yy_c_buf_p) = yy_cp;
1840 static int yyinput YYFARGS0(void)
1842 static int input YYFARGS0(void)
1847 int yyFlexLexer::yyinput()
1851 M4_YY_DECL_GUTS_VAR();
1853 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1855 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1857 /* yy_c_buf_p now points to the character we want to return.
1858 * If this occurs *before* the EOB characters, then it's a
1859 * valid NUL; if not, then we've hit the end of the buffer.
1861 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1862 /* This was really a NUL. */
1863 *YY_G(yy_c_buf_p) = '\0';
1866 { /* need more input */
1867 int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1870 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1872 case EOB_ACT_LAST_MATCH:
1873 /* This happens because yy_g_n_b()
1874 * sees that we've accumulated a
1875 * token and flags that we need to
1876 * try matching the token before
1877 * proceeding. But for input(),
1878 * there's no matching to consider.
1879 * So convert the EOB_ACT_LAST_MATCH
1880 * to EOB_ACT_END_OF_FILE.
1883 /* Reset buffer status. */
1884 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1888 case EOB_ACT_END_OF_FILE:
1890 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1893 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1896 return yyinput(M4_YY_CALL_ONLY_ARG);
1898 return input(M4_YY_CALL_ONLY_ARG);
1902 case EOB_ACT_CONTINUE_SCAN:
1903 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1909 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
1910 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
1911 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1913 %% [19.0] update BOL and yylineno
1918 #endif /* ifndef YY_NO_INPUT */
1921 /** Immediately switch to a different input stream.
1922 * @param input_file A readable stream.
1924 * @note This function does not reset the start condition to @c INITIAL .
1927 void yyrestart YYFARGS1( FILE *,input_file)
1930 void yyFlexLexer::yyrestart( std::istream* input_file )
1933 M4_YY_DECL_GUTS_VAR();
1935 if ( ! YY_CURRENT_BUFFER ){
1936 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1937 YY_CURRENT_BUFFER_LVALUE =
1938 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1941 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1942 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1945 /** Switch to a different input buffer.
1946 * @param new_buffer The new input buffer.
1950 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1953 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1956 M4_YY_DECL_GUTS_VAR();
1958 /* TODO. We should be able to replace this entire function body
1960 * yypop_buffer_state();
1961 * yypush_buffer_state(new_buffer);
1963 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1964 if ( YY_CURRENT_BUFFER == new_buffer )
1967 if ( YY_CURRENT_BUFFER )
1969 /* Flush out information for old buffer. */
1970 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1971 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
1972 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1975 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1976 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1978 /* We don't actually know whether we did this switch during
1979 * EOF (yywrap()) processing, but the only time this flag
1980 * is looked at is after yywrap() is called, so it's safe
1981 * to go ahead and always set it.
1983 YY_G(yy_did_buffer_switch_on_eof) = 1;
1988 static void yy_load_buffer_state YYFARGS0(void)
1991 void yyFlexLexer::yy_load_buffer_state()
1994 M4_YY_DECL_GUTS_VAR();
1995 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1996 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1997 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1998 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
2001 /** Allocate and initialize an input buffer state.
2002 * @param file A readable stream.
2003 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2005 * @return the allocated buffer state.
2008 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
2011 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2015 m4_dnl M4_YY_DECL_GUTS_VAR();
2017 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2019 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2021 b->yy_buf_size = size;
2023 /* yy_ch_buf has to be 2 characters longer than the size given because
2024 * we need to put in 2 end-of-buffer characters.
2026 b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
2027 if ( ! b->yy_ch_buf )
2028 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2030 b->yy_is_our_buffer = 1;
2032 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2037 /** Destroy the buffer.
2038 * @param b a buffer created with yy_create_buffer()
2042 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2045 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2048 M4_YY_DECL_GUTS_VAR();
2053 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2054 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2056 if ( b->yy_is_our_buffer )
2057 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2059 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2064 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],,
2066 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2069 extern int isatty M4_YY_PARAMS( int );
2070 #endif /* __cplusplus */
2076 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2078 extern "C" int isatty M4_YY_PARAMS( int );
2082 /* Initializes or reinitializes a buffer.
2083 * This function is sometimes called more than once on the same buffer,
2084 * such as during a yyrestart() or at EOF.
2087 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2090 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2095 M4_YY_DECL_GUTS_VAR();
2097 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2099 b->yy_input_file = file;
2100 b->yy_fill_buffer = 1;
2102 /* If b is the current buffer, then yy_init_buffer was _probably_
2103 * called from yyrestart() or through yy_get_next_buffer.
2104 * In that case, we don't want to reset the lineno or column.
2106 if (b != YY_CURRENT_BUFFER){
2107 b->yy_bs_lineno = 1;
2108 b->yy_bs_column = 0;
2112 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2114 b->yy_is_interactive = 1;
2117 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2119 b->yy_is_interactive = 0;
2122 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2127 b->yy_is_interactive = 0;
2132 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2133 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2137 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2140 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2143 M4_YY_DECL_GUTS_VAR();
2149 /* We always need two end-of-buffer characters. The first causes
2150 * a transition to the end-of-buffer state. The second causes
2151 * a jam in that state.
2153 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2154 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2156 b->yy_buf_pos = &b->yy_ch_buf[0];
2159 b->yy_buffer_status = YY_BUFFER_NEW;
2161 if ( b == YY_CURRENT_BUFFER )
2162 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2166 /** Pushes the new state onto the stack. The new state becomes
2167 * the current state. This function will allocate the stack
2169 * @param new_buffer The new state.
2173 void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2176 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2179 M4_YY_DECL_GUTS_VAR();
2180 if (new_buffer == NULL)
2183 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2185 /* This block is copied from yy_switch_to_buffer. */
2186 if ( YY_CURRENT_BUFFER )
2188 /* Flush out information for old buffer. */
2189 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2190 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2191 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2194 /* Only push if top exists. Otherwise, replace top. */
2195 if (YY_CURRENT_BUFFER)
2196 YY_G(yy_buffer_stack_top)++;
2197 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2199 /* copied from yy_switch_to_buffer. */
2200 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2201 YY_G(yy_did_buffer_switch_on_eof) = 1;
2207 /** Removes and deletes the top of the stack, if present.
2208 * The next element becomes the new top.
2212 void yypop_buffer_state YYFARGS0(void)
2215 void yyFlexLexer::yypop_buffer_state (void)
2218 M4_YY_DECL_GUTS_VAR();
2219 if (!YY_CURRENT_BUFFER)
2222 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2223 YY_CURRENT_BUFFER_LVALUE = NULL;
2224 if (YY_G(yy_buffer_stack_top) > 0)
2225 --YY_G(yy_buffer_stack_top);
2227 if (YY_CURRENT_BUFFER) {
2228 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2229 YY_G(yy_did_buffer_switch_on_eof) = 1;
2236 /* Allocates the stack if it does not exist.
2237 * Guarantees space for at least one push.
2240 static void yyensure_buffer_stack YYFARGS0(void)
2243 void yyFlexLexer::yyensure_buffer_stack(void)
2247 M4_YY_DECL_GUTS_VAR();
2249 if (!YY_G(yy_buffer_stack)) {
2251 /* First allocation is just for 2 elements, since we don't know if this
2252 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2253 * immediate realloc on the next call.
2256 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2257 (num_to_alloc * sizeof(struct yy_buffer_state*)
2258 M4_YY_CALL_LAST_ARG);
2259 if ( ! YY_G(yy_buffer_stack) )
2260 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2263 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2265 YY_G(yy_buffer_stack_max) = num_to_alloc;
2266 YY_G(yy_buffer_stack_top) = 0;
2270 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2272 /* Increase the buffer to prepare for a possible push. */
2273 int grow_size = 8 /* arbitrary grow size */;
2275 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2276 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2277 (YY_G(yy_buffer_stack),
2278 num_to_alloc * sizeof(struct yy_buffer_state*)
2279 M4_YY_CALL_LAST_ARG);
2280 if ( ! YY_G(yy_buffer_stack) )
2281 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2283 /* zero only the new slots.*/
2284 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2285 YY_G(yy_buffer_stack_max) = num_to_alloc;
2293 m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2296 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2297 * @param base the character buffer
2298 * @param size the size in bytes of the character buffer
2300 * @return the newly allocated buffer state object.
2302 YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2305 m4_dnl M4_YY_DECL_GUTS_VAR();
2308 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2309 base[size-1] != YY_END_OF_BUFFER_CHAR )
2310 /* They forgot to leave room for the EOB's. */
2313 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2315 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2317 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2318 b->yy_buf_pos = b->yy_ch_buf = base;
2319 b->yy_is_our_buffer = 0;
2320 b->yy_input_file = 0;
2321 b->yy_n_chars = b->yy_buf_size;
2322 b->yy_is_interactive = 0;
2324 b->yy_fill_buffer = 0;
2325 b->yy_buffer_status = YY_BUFFER_NEW;
2327 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2335 m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2338 /** Setup the input buffer state to scan a string. The next call to yylex() will
2339 * scan from a @e copy of @a str.
2340 * @param yystr a NUL-terminated string to scan
2342 * @return the newly allocated buffer state object.
2343 * @note If you want to scan bytes that may contain NUL values, then use
2344 * yy_scan_bytes() instead.
2346 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2348 m4_dnl M4_YY_DECL_GUTS_VAR();
2350 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2356 m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2359 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2360 * scan from a @e copy of @a bytes.
2361 * @param bytes the byte buffer to scan
2362 * @param len the number of bytes in the buffer pointed to by @a bytes.
2364 * @return the newly allocated buffer state object.
2366 YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, int ,_yybytes_len)
2372 m4_dnl M4_YY_DECL_GUTS_VAR();
2374 /* Get memory for full buffer, including space for trailing EOB's. */
2375 n = _yybytes_len + 2;
2376 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2378 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2380 for ( i = 0; i < _yybytes_len; ++i )
2381 buf[i] = yybytes[i];
2383 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2385 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2387 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2389 /* It's okay to grow etc. this buffer, and we should throw it
2390 * away when we're done.
2392 b->yy_is_our_buffer = 1;
2400 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2403 static void yy_push_state YYFARGS1( int ,_new_state)
2406 void yyFlexLexer::yy_push_state( int _new_state )
2409 M4_YY_DECL_GUTS_VAR();
2410 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2414 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2415 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2417 if ( ! YY_G(yy_start_stack) )
2418 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2421 YY_G(yy_start_stack) = (int *) yyrealloc(
2422 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2424 if ( ! YY_G(yy_start_stack) )
2425 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2428 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2435 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2438 static void yy_pop_state YYFARGS0(void)
2441 void yyFlexLexer::yy_pop_state()
2444 M4_YY_DECL_GUTS_VAR();
2445 if ( --YY_G(yy_start_stack_ptr) < 0 )
2446 YY_FATAL_ERROR( "start-condition stack underflow" );
2448 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2453 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2456 static int yy_top_state YYFARGS0(void)
2459 int yyFlexLexer::yy_top_state()
2462 M4_YY_DECL_GUTS_VAR();
2463 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2467 #ifndef YY_EXIT_FAILURE
2468 #define YY_EXIT_FAILURE 2
2472 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2474 m4_dnl M4_YY_DECL_GUTS_VAR();
2475 (void) fprintf( stderr, "%s\n", msg );
2476 exit( YY_EXIT_FAILURE );
2480 void yyFlexLexer::LexerError( yyconst char msg[] )
2482 M4_YY_DECL_GUTS_VAR();
2483 std::cerr << msg << std::endl;
2484 exit( YY_EXIT_FAILURE );
2488 /* Redefine yyless() so it works in section 3 code. */
2494 /* Undo effects of setting up yytext. */ \
2495 int yyless_macro_arg = (n); \
2496 YY_LESS_LINENO(yyless_macro_arg);\
2497 yytext[yyleng] = YY_G(yy_hold_char); \
2498 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2499 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2500 *YY_G(yy_c_buf_p) = '\0'; \
2501 yyleng = yyless_macro_arg; \
2507 /* Accessor methods (get/set functions) to struct members. */
2511 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2513 /** Get the user-defined data for this scanner.
2516 YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2518 M4_YY_DECL_GUTS_VAR();
2524 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2526 /** Get the current line number.
2529 int yyget_lineno YYFARGS0(void)
2531 M4_YY_DECL_GUTS_VAR();
2533 m4_ifdef( [[M4_YY_REENTRANT]],
2535 if (! YY_CURRENT_BUFFER)
2542 m4_ifdef( [[M4_YY_REENTRANT]],
2544 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2546 /** Get the current column number.
2549 int yyget_column YYFARGS0(void)
2551 M4_YY_DECL_GUTS_VAR();
2553 m4_ifdef( [[M4_YY_REENTRANT]],
2555 if (! YY_CURRENT_BUFFER)
2563 m4_ifdef( [[M4_YY_NO_GET_IN]],,
2565 /** Get the input stream.
2568 FILE *yyget_in YYFARGS0(void)
2570 M4_YY_DECL_GUTS_VAR();
2575 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2577 /** Get the output stream.
2580 FILE *yyget_out YYFARGS0(void)
2582 M4_YY_DECL_GUTS_VAR();
2587 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2589 /** Get the length of the current token.
2592 int yyget_leng YYFARGS0(void)
2594 M4_YY_DECL_GUTS_VAR();
2599 /** Get the current token.
2602 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2604 char *yyget_text YYFARGS0(void)
2606 M4_YY_DECL_GUTS_VAR();
2612 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2614 /** Set the user-defined data. This data is never touched by the scanner.
2615 * @param user_defined The data to be associated with this scanner.
2618 void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2620 M4_YY_DECL_GUTS_VAR();
2621 yyextra = user_defined ;
2626 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2628 /** Set the current line number.
2629 * @param _line_number
2632 void yyset_lineno YYFARGS1( int ,_line_number)
2634 M4_YY_DECL_GUTS_VAR();
2636 m4_ifdef( [[M4_YY_REENTRANT]],
2638 /* lineno is only valid if an input buffer exists. */
2639 if (! YY_CURRENT_BUFFER )
2640 yy_fatal_error( "yyset_lineno called with no buffer" M4_YY_CALL_LAST_ARG);
2642 yylineno = _line_number;
2646 m4_ifdef( [[M4_YY_REENTRANT]],
2648 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2650 /** Set the current column.
2651 * @param _line_number
2654 void yyset_column YYFARGS1( int , _column_no)
2656 M4_YY_DECL_GUTS_VAR();
2658 m4_ifdef( [[M4_YY_REENTRANT]],
2660 /* column is only valid if an input buffer exists. */
2661 if (! YY_CURRENT_BUFFER )
2662 yy_fatal_error( "yyset_column called with no buffer" M4_YY_CALL_LAST_ARG);
2664 yycolumn = _column_no;
2670 m4_ifdef( [[M4_YY_NO_SET_IN]],,
2672 /** Set the input stream. This does not discard the current
2674 * @param _in_str A readable stream.
2676 * @see yy_switch_to_buffer
2678 void yyset_in YYFARGS1( FILE * ,_in_str)
2680 M4_YY_DECL_GUTS_VAR();
2685 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2687 void yyset_out YYFARGS1( FILE * ,_out_str)
2689 M4_YY_DECL_GUTS_VAR();
2695 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2697 int yyget_debug YYFARGS0(void)
2699 M4_YY_DECL_GUTS_VAR();
2700 return yy_flex_debug;
2704 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2706 void yyset_debug YYFARGS1( int ,_bdebug)
2708 M4_YY_DECL_GUTS_VAR();
2709 yy_flex_debug = _bdebug ;
2715 /* Accessor methods for yylval and yylloc */
2718 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2720 YYSTYPE * yyget_lval YYFARGS0(void)
2722 M4_YY_DECL_GUTS_VAR();
2727 m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2729 void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2731 M4_YY_DECL_GUTS_VAR();
2732 yylval = yylval_param;
2736 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2738 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2740 YYLTYPE *yyget_lloc YYFARGS0(void)
2742 M4_YY_DECL_GUTS_VAR();
2747 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2749 void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2751 M4_YY_DECL_GUTS_VAR();
2752 yylloc = yylloc_param;
2760 /* User-visible API */
2762 /* yylex_init is special because it creates the scanner itself, so it is
2763 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2764 * That's why we explicitly handle the declaration, instead of using our macros.
2766 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2768 int yylex_init( ptr_yy_globals )
2769 yyscan_t* ptr_yy_globals;
2772 int yylex_init(yyscan_t* ptr_yy_globals)
2775 if (ptr_yy_globals == NULL){
2780 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2782 if (*ptr_yy_globals == NULL){
2787 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2788 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2790 return yy_init_globals ( *ptr_yy_globals );
2794 /* yylex_init_extra has the same functionality as yylex_init, but follows the
2795 * convention of taking the scanner as the last argument. Note however, that
2796 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2797 * is the reason, too, why this function also must handle its own declaration).
2798 * The user defined value in the first argument will be available to yyalloc in
2799 * the yyextra field.
2801 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2803 int yylex_init_extra( yy_user_defined, ptr_yy_globals )
2804 YY_EXTRA_TYPE yy_user_defined;
2805 yyscan_t* ptr_yy_globals;
2808 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2811 struct yyguts_t dummy_yyguts;
2813 yyset_extra (yy_user_defined, &dummy_yyguts);
2815 if (ptr_yy_globals == NULL){
2820 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2822 if (*ptr_yy_globals == NULL){
2827 /* By setting to 0xAA, we expose bugs in
2828 yy_init_globals. Leave at 0x00 for releases. */
2829 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2831 yyset_extra (yy_user_defined, *ptr_yy_globals);
2833 return yy_init_globals ( *ptr_yy_globals );
2840 static int yy_init_globals YYFARGS0(void)
2842 M4_YY_DECL_GUTS_VAR();
2843 /* Initialization is the same as for the non-reentrant scanner.
2844 * This function is called from yylex_destroy(), so don't allocate here.
2847 m4_ifdef( [[M4_YY_USE_LINENO]],
2849 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2851 /* We do not touch yylineno unless the option is enabled. */
2855 YY_G(yy_buffer_stack) = 0;
2856 YY_G(yy_buffer_stack_top) = 0;
2857 YY_G(yy_buffer_stack_max) = 0;
2858 YY_G(yy_c_buf_p) = (char *) 0;
2862 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2864 YY_G(yy_start_stack_ptr) = 0;
2865 YY_G(yy_start_stack_depth) = 0;
2866 YY_G(yy_start_stack) = NULL;
2869 m4_ifdef( [[M4_YY_USES_REJECT]],
2871 YY_G(yy_state_buf) = 0;
2872 YY_G(yy_state_ptr) = 0;
2873 YY_G(yy_full_match) = 0;
2877 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2879 YY_G(yytext_ptr) = 0;
2880 YY_G(yy_more_offset) = 0;
2881 YY_G(yy_prev_more_offset) = 0;
2884 /* Defined in main.c */
2893 /* For future reference: Set errno on error, since we are called by
2901 %if-c-only SNIP! this currently causes conflicts with the c++ scanner
2902 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2903 int yylex_destroy YYFARGS0(void)
2905 M4_YY_DECL_GUTS_VAR();
2907 /* Pop the buffer stack, destroying each element. */
2908 while(YY_CURRENT_BUFFER){
2909 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2910 YY_CURRENT_BUFFER_LVALUE = NULL;
2911 yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2914 /* Destroy the stack itself. */
2915 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2916 YY_G(yy_buffer_stack) = NULL;
2918 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2920 /* Destroy the start condition stack. */
2921 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2922 YY_G(yy_start_stack) = NULL;
2925 m4_ifdef( [[M4_YY_USES_REJECT]],
2927 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2928 YY_G(yy_state_buf) = NULL;
2931 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2932 * yylex() is called, initialization will occur. */
2933 yy_init_globals( M4_YY_CALL_ONLY_ARG);
2936 /* Destroy the main struct (reentrant only). */
2937 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2945 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2948 * Internal utility routines.
2952 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2955 static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2958 for ( i = 0; i < n; ++i )
2964 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2966 #ifdef YY_NEED_STRLEN
2967 static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2970 for ( n = 0; s[n]; ++n )
2978 m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
2980 void *yyalloc YYFARGS1( yy_size_t ,size)
2982 return (void *) malloc( size );
2986 m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
2988 void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
2990 /* The cast to (char *) in the following accommodates both
2991 * implementations that use char* generic pointers, and those
2992 * that use void* generic pointers. It works with the latter
2993 * because both ANSI C and C++ allow castless assignment from
2994 * any pointer type to void*, and deal with argument conversions
2995 * as though doing an assignment.
2997 return (void *) realloc( (char *) ptr, size );
3001 m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
3003 void yyfree YYFARGS1( void *,ptr)
3005 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3009 %if-tables-serialization definitions
3010 m4preproc_include(`tables_shared.c')
3012 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
3015 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3019 rd->bread += sizeof(flex_uint8_t);
3023 static int yytbl_read16 (void *v, struct yytbl_reader * rd)
3026 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3030 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3031 rd->bread += sizeof(flex_uint16_t);
3035 static int yytbl_read32 (void *v, struct yytbl_reader * rd)
3038 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3042 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3043 rd->bread += sizeof(flex_uint32_t);
3047 /** Read the header */
3048 static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3051 memset (th, 0, sizeof (struct yytbl_hdr));
3053 if (yytbl_read32 (&(th->th_magic), rd) != 0)
3056 if (th->th_magic != YYTBL_MAGIC){
3057 yy_fatal_error("bad magic number" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3061 if (yytbl_read32 (&(th->th_hsize), rd) != 0
3062 || yytbl_read32 (&(th->th_ssize), rd) != 0
3063 || yytbl_read16 (&(th->th_flags), rd) != 0)
3066 /* Sanity check on header size. Greater than 1k suggests some funny business. */
3067 if (th->th_hsize < 16 || th->th_hsize > 1024){
3068 yy_fatal_error("insane header size detected" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3072 /* Allocate enough space for the version and name fields */
3073 bytes = th->th_hsize - 14;
3074 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3075 if ( ! th->th_version )
3076 YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
3078 /* we read it all into th_version, and point th_name into that data */
3079 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
3081 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3082 th->th_version = NULL;
3088 th->th_name = th->th_version + strlen (th->th_version) + 1;
3092 /** lookup id in the dmap list.
3093 * @param dmap pointer to first element in list
3094 * @return NULL if not found.
3096 static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3100 if (dmap->dm_id == id)
3107 /** Read a table while mapping its contents to the local array.
3108 * @param dmap used to performing mapping
3109 * @return 0 on success
3111 static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3113 struct yytbl_data td;
3114 struct yytbl_dmap *transdmap=0;
3115 int len, i, rv, inner_loop_count;
3118 memset (&td, 0, sizeof (struct yytbl_data));
3120 if (yytbl_read16 (&td.td_id, rd) != 0
3121 || yytbl_read16 (&td.td_flags, rd) != 0
3122 || yytbl_read32 (&td.td_hilen, rd) != 0
3123 || yytbl_read32 (&td.td_lolen, rd) != 0)
3126 /* Lookup the map for the transition table so we have it in case we need it
3127 * inside the loop below. This scanner might not even have a transition
3128 * table, which is ok.
3130 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3132 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3133 yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3137 /* Allocate space for table.
3138 * The --full yy_transition table is a special case, since we
3139 * need the dmap.dm_sz entry to tell us the sizeof the individual
3145 if ((td.td_flags & YYTD_STRUCT))
3146 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3148 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3150 if(M4_YY_TABLES_VERIFY)
3151 /* We point to the array itself */
3154 /* We point to the address of a pointer. */
3155 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3157 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
3160 /* If it's a struct, we read 2 integers to get one element */
3161 if ((td.td_flags & YYTD_STRUCT) != 0)
3162 inner_loop_count = 2;
3164 inner_loop_count = 1;
3166 /* read and map each element.
3167 * This loop iterates once for each element of the td_data array.
3168 * Notice that we increment 'i' in the inner loop.
3170 len = yytbl_calc_total_len (&td);
3171 for (i = 0; i < len; ){
3175 /* This loop really executes exactly 1 or 2 times.
3176 * The second time is to handle the second member of the
3177 * YYTD_STRUCT for the yy_transition array.
3179 for (j = 0; j < inner_loop_count; j++, i++) {
3182 /* read into t32 no matter what the real size is. */
3187 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3188 case sizeof (flex_int32_t):
3189 rv = yytbl_read32 (&t32, rd);
3191 case sizeof (flex_int16_t):
3192 rv = yytbl_read16 (&t16, rd);
3195 case sizeof (flex_int8_t):
3196 rv = yytbl_read8 (&t8, rd);
3200 yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3207 /* copy into the deserialized array... */
3209 if ((td.td_flags & YYTD_STRUCT)) {
3210 /* t32 is the j'th member of a two-element struct. */
3213 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3214 : &(((struct yy_trans_info *) p)->yy_nxt);
3216 switch (dmap->dm_sz) {
3217 case sizeof (flex_int32_t):
3218 if (M4_YY_TABLES_VERIFY){
3219 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3220 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int32_t" M4_YY_CALL_LAST_ARG);
3222 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3224 case sizeof (flex_int16_t):
3225 if (M4_YY_TABLES_VERIFY ){
3226 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3227 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int16_t" M4_YY_CALL_LAST_ARG);
3229 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3231 case sizeof(flex_int8_t):
3232 if (M4_YY_TABLES_VERIFY ){
3233 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3234 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int8_t" M4_YY_CALL_LAST_ARG);
3236 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3239 yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3243 /* if we're done with j, increment p */
3245 p = (struct yy_trans_info *) p + 1;
3247 else if ((td.td_flags & YYTD_PTRANS)) {
3248 /* t32 is an index into the transition array. */
3249 struct yy_trans_info *v;
3253 yy_fatal_error("transition table not found" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3257 if( M4_YY_TABLES_VERIFY)
3258 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3260 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3262 if(M4_YY_TABLES_VERIFY ){
3263 if( ((struct yy_trans_info **) p)[0] != v)
3264 yy_fatal_error("tables verification failed at YYTD_PTRANS" M4_YY_CALL_LAST_ARG);
3266 ((struct yy_trans_info **) p)[0] = v;
3269 p = (struct yy_trans_info **) p + 1;
3272 /* t32 is a plain int. copy data, then incrememnt p. */
3273 switch (dmap->dm_sz) {
3274 case sizeof (flex_int32_t):
3275 if(M4_YY_TABLES_VERIFY ){
3276 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3277 yy_fatal_error("tables verification failed at flex_int32_t" M4_YY_CALL_LAST_ARG);
3279 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3280 p = ((flex_int32_t *) p) + 1;
3282 case sizeof (flex_int16_t):
3283 if(M4_YY_TABLES_VERIFY ){
3284 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3285 yy_fatal_error("tables verification failed at flex_int16_t" M4_YY_CALL_LAST_ARG);
3287 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3288 p = ((flex_int16_t *) p) + 1;
3290 case sizeof (flex_int8_t):
3291 if(M4_YY_TABLES_VERIFY ){
3292 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3293 yy_fatal_error("tables verification failed at flex_int8_t" M4_YY_CALL_LAST_ARG);
3295 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3296 p = ((flex_int8_t *) p) + 1;
3299 yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3307 /* Now eat padding. */
3310 pad = yypad64(rd->bread);
3313 if(yytbl_read8(&t8,rd) != 0)
3321 %define-yytables The name for this specific scanner's tables.
3323 /* Find the key and load the DFA tables from the given stream. */
3324 static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3327 struct yytbl_hdr th;
3328 struct yytbl_reader rd;
3331 th.th_version = NULL;
3333 /* Keep trying until we find the right set of tables or end of file. */
3334 while (!feof(rd.fp)) {
3336 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3341 /* A NULL key means choose the first set of tables. */
3345 if (strcmp(th.th_name,key) != 0){
3346 /* Skip ahead to next set */
3347 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3348 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3349 th.th_version = NULL;
3355 while (rd.bread < th.th_ssize){
3356 /* Load the data tables */
3357 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3365 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3366 th.th_version = NULL;
3372 /** Load the DFA tables for this scanner from the given stream. */
3373 int yytables_fload YYFARGS1(FILE *, fp)
3376 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3381 /** Destroy the loaded tables, freeing memory, etc.. */
3382 int yytables_destroy YYFARGS0(void)
3384 struct yytbl_dmap *dmap=0;
3386 if(!M4_YY_TABLES_VERIFY){
3387 /* Walk the dmap, freeing the pointers */
3388 for(dmap=yydmap; dmap->dm_id; dmap++) {
3391 if(v && *(char**)v){
3392 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3401 /* end table serialization code definitions */
3405 m4_ifdef([[M4_YY_MAIN]], [[
3406 int main M4_YY_PARAMS(void);
3415 yylex_destroy( lexer);
3427 m4_ifdef( [[M4_YY_IN_HEADER]],
3430 #undef YY_FLUSH_BUFFER
3432 #undef yy_new_buffer
3433 #undef yy_set_interactive
3434 #undef YY_DO_BEFORE_ACTION
3436 #ifdef YY_DECL_IS_OURS
3437 #undef YY_DECL_IS_OURS