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. */
206 %if-tables-serialization
207 #include <sys/types.h>
208 #include <netinet/in.h>
210 /* end standard C headers. */
213 m4preproc_include(`flexint.h')
217 /* begin standard C++ headers. */
222 /* end standard C++ headers. */
227 /* The "const" storage-class-modifier is valid. */
230 #else /* ! __cplusplus */
232 /* C99 requires __STDC__ to be defined as 1. */
233 #if defined (__STDC__)
237 #endif /* defined (__STDC__) */
238 #endif /* ! __cplusplus */
241 #define yyconst const
246 %# For compilers that can not handle prototypes.
248 %# The function prototype
249 %# int foo(int x, char* y);
251 %# ...should be written as
252 %# int foo M4_YY_PARAMS(int x, char* y);
254 %# ...which could possibly generate
257 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
259 m4_define( [[M4_YY_PARAMS]], [[()]])
262 m4_define( [[M4_YY_PARAMS]], [[($*)]])
266 /* Returned upon end-of-file. */
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
276 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
283 /* An opaque pointer. */
284 #ifndef YY_TYPEDEF_YY_SCANNER_T
285 #define YY_TYPEDEF_YY_SCANNER_T
286 typedef void* yyscan_t;
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]])
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]])
298 %# For use in function definitions to append the additional argument.
299 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
301 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
302 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
305 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
306 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
308 m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
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]])
314 %# For use in function documentation to adjust for additional argument.
315 m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
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)
328 m4_define( [[M4_YY_INCR_LINENO]],
341 m4_define( [[M4_YY_INCR_LINENO]],
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]])
353 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
355 m4_define( [[M4_YY_DEF_ONLY_ARG]])
358 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
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]], [[]])
368 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
370 %# For compilers that need traditional function definitions.
372 %# The function prototype taking 2 arguments
373 %# int foo (int x, char* y)
375 %# ...should be written as
376 %# int foo YYFARGS2(int,x, char*,y)
378 %# ...which could possibly generate
379 %# int foo (x,y,yyscanner)
382 %# yyscan_t yyscanner;
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) [[\]]
389 M4_YY_DECL_LAST_ARG]])
390 m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
393 M4_YY_DECL_LAST_ARG]])
394 m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
398 M4_YY_DECL_LAST_ARG]])
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)]])
408 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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.
414 #define BEGIN YY_G(yy_start) = 1 + 2 *
417 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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
423 #define YY_START ((YY_G(yy_start) - 1) / 2)
424 #define YYSTATE YY_START
427 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
429 /* Action number for EOF rule of a given start state. */
430 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
433 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
435 /* Special action meaning "start processing a new file". */
436 #define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
439 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
441 #define YY_END_OF_BUFFER_CHAR 0
444 /* Size of default input buffer. */
446 #define YY_BUF_SIZE 16384
449 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
451 /* The state buf must be large enough to hold one state per character in the main buffer.
453 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
457 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
458 #define YY_TYPEDEF_YY_BUFFER_STATE
459 typedef struct yy_buffer_state *YY_BUFFER_STATE;
468 extern FILE *yyin, *yyout;
472 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
474 #define EOB_ACT_CONTINUE_SCAN 0
475 #define EOB_ACT_END_OF_FILE 1
476 #define EOB_ACT_LAST_MATCH 2
479 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
481 m4_ifdef( [[M4_YY_USE_LINENO]],
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.
490 #define YY_LESS_LINENO(n) \
493 for ( yyl = n; yyl < yyleng; ++yyl )\
494 if ( yytext[yyl] == '\n' )\
499 #define YY_LESS_LINENO(n)
503 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
505 /* Return all but the first "n" matched characters back to the input stream. */
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 */ \
520 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
522 #define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
525 #ifndef YY_TYPEDEF_YY_SIZE_T
526 #define YY_TYPEDEF_YY_SIZE_T
527 typedef size_t yy_size_t;
530 #ifndef YY_STRUCT_YY_BUFFER_STATE
531 #define YY_STRUCT_YY_BUFFER_STATE
532 struct yy_buffer_state
539 std::istream* yy_input_file;
543 char *yy_ch_buf; /* input buffer */
544 char *yy_buf_pos; /* current position in input buffer */
546 /* Size of input buffer in bytes, not including room for EOB
549 yy_size_t yy_buf_size;
551 /* Number of characters read into yy_ch_buf, not including EOB
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
560 int yy_is_our_buffer;
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
567 int yy_is_interactive;
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
575 int yy_bs_lineno; /**< The line count. */
576 int yy_bs_column; /**< The column count. */
579 /* Whether to try to fill the input buffer when we reach the
584 int yy_buffer_status;
585 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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.
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.
599 #define YY_BUFFER_EOF_PENDING 2
602 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
604 %if-c-only Standard (non-C++) definition
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. */
616 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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
622 * Returns the top of the stack, or NULL.
624 #define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
625 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
629 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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.
634 #define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
637 %if-c-only Standard (non-C++) definition
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 */
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 */
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 ...
654 static int yy_did_buffer_switch_on_eof;
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 );
666 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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 );
673 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
675 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
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 );
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 );
688 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
690 #define yy_new_buffer yy_create_buffer
693 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
695 #define yy_set_interactive(is_interactive) \
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); \
702 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
706 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
708 #define yy_set_bol(at_bol) \
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); \
715 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
719 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
721 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
724 %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
726 %if-c-only Standard (non-C++) definition
728 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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 );
738 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
740 /* Done after the current pattern has been matched and before the
741 * corresponding action - sets up yytext.
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; \
748 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
749 YY_G(yy_c_buf_p) = yy_cp;
752 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
754 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
757 m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
759 m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
761 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
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.
777 m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
779 #define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
782 #ifndef YY_EXTRA_TYPE
783 #define YY_EXTRA_TYPE void *
788 %if-c-only Reentrant structure and macros (non-C++).
791 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
793 /* Holds the entire state of the reentrant scanner. */
797 /* User-defined. Not touched by flex. */
798 YY_EXTRA_TYPE yyextra_r;
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. */
811 int yy_did_buffer_switch_on_eof;
812 int yy_start_stack_ptr;
813 int yy_start_stack_depth;
815 yy_state_type yy_last_accepting_state;
816 char* yy_last_accepting_cpos;
821 m4_ifdef( [[M4_YY_USES_REJECT]],
823 yy_state_type *yy_state_buf;
824 yy_state_type *yy_state_ptr;
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;
835 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
837 char yytext_r[YYLMAX];
840 int yy_prev_more_offset;
848 m4_ifdef( [[M4_YY_BISON_LVAL]],
853 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
858 }; /* end struct yyguts_t */
863 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
865 static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
871 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
873 m4_ifdef( [[M4_YY_BISON_LVAL]],
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)
880 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
882 # define yylloc YY_G(yylloc_r)
886 int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
888 int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
892 %endif End reentrant structures and macros.
894 /* Accessor methods to globals.
895 These are made visible to non-reentrant scanners for convenience. */
897 m4_ifdef( [[M4_YY_NO_DESTROY]],,
899 int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
902 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
904 int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
907 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
909 void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
912 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
914 YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
917 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
919 void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
922 m4_ifdef( [[M4_YY_NO_GET_IN]],,
924 FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
927 m4_ifdef( [[M4_YY_NO_SET_IN]],,
929 void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );
932 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
934 FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
937 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
939 void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );
942 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
944 int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
947 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
949 char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
952 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
954 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
957 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
959 void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
963 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
965 YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
968 void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
970 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
972 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
974 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
977 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
979 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
984 /* Macros after this point can all be overridden by user definitions in
988 #ifndef YY_SKIP_YYWRAP
990 extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
992 extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
997 m4_ifdef( [[M4_YY_NO_UNPUT]],,
999 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
1005 static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1008 #ifdef YY_NEED_STRLEN
1009 static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1013 %if-c-only Standard (non-C++) definition
1016 static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1018 static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1026 %# TODO: This is messy.
1027 m4_ifdef( [[M4_YY_STACK_USED]],
1030 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1032 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1034 static int yy_start_stack_ptr = 0;
1035 static int yy_start_stack_depth = 0;
1036 static int *yy_start_stack = NULL;
1040 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1042 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1044 static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG);
1046 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1048 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1050 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1052 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1058 m4_define( [[M4_YY_NO_PUSH_STATE]])
1059 m4_define( [[M4_YY_NO_POP_STATE]])
1060 m4_define( [[M4_YY_NO_TOP_STATE]])
1064 /* Amount of stuff to slurp up with each read. */
1065 #ifndef YY_READ_BUF_SIZE
1066 #define YY_READ_BUF_SIZE 8192
1069 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1071 /* Copy whatever the last rule matched to the standard output. */
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().
1077 #define ECHO fwrite( yytext, yyleng, 1, yyout )
1079 %if-c++-only C++ definition
1080 #define ECHO LexerOutput( yytext, yyleng )
1085 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1087 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1088 * is returned in "result".
1091 #define YY_INPUT(buf,result,max_size) \
1092 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1094 %if-c++-only C++ definition \
1095 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
1096 YY_FATAL_ERROR( "input in flex scanner failed" );
1102 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
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.
1109 #define yyterminate() return YY_NULL
1113 /* Number of entries by which start-condition stack grows. */
1114 #ifndef YY_START_STACK_INCR
1115 #define YY_START_STACK_INCR 25
1118 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1120 /* Report a fatal error. */
1121 #ifndef YY_FATAL_ERROR
1123 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1126 #define YY_FATAL_ERROR(msg) LexerError( msg )
1131 %if-tables-serialization structures and prototypes
1132 m4preproc_include(`tables_shared.h')
1134 /* Load the DFA tables from the given stream. */
1135 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1137 /* Unload the tables from memory. */
1138 int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
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.
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. */
1151 /** A {0,0,0}-terminated list of structs, forming the map */
1152 static struct yytbl_dmap yydmap[] =
1154 %tables-yydmap generated elements
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 */
1165 /* end tables serialization structures and prototypes */
1169 /* Default declaration of generated scanner - a define so the user can
1170 * easily add parameters.
1173 #define YY_DECL_IS_OURS 1
1174 %if-c-only Standard (non-C++) definition
1177 m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1178 m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1180 m4_ifdef( [[M4_YY_BISON_LVAL]],
1182 m4_dnl The bison pure parser is used. Redefine yylex to
1183 m4_dnl accept the lval parameter.
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)]])
1191 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1193 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
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)]])
1201 extern int yylex M4_YY_LEX_PROTO;
1203 #define YY_DECL int yylex M4_YY_LEX_DECLARATION
1205 %if-c++-only C++ definition
1206 #define YY_DECL int yyFlexLexer::yylex()
1208 #endif /* !YY_DECL */
1210 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1212 /* Code executed at the beginning of each rule, after yytext and yyleng
1215 #ifndef YY_USER_ACTION
1216 #define YY_USER_ACTION
1220 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1222 /* Code executed at the end of each rule. */
1224 #define YY_BREAK break;
1228 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1230 %% [6.0] YY_RULE_SETUP definition goes here
1234 /** The main scanner function which does all the work.
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();
1243 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1245 m4_ifdef( [[M4_YY_BISON_LVAL]],
1249 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1255 %% [7.0] user's declarations go here
1257 m4_ifdef( [[M4_YY_BISON_LVAL]],
1259 yylval = yylval_param;
1262 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1264 yylloc = yylloc_param;
1267 if ( !YY_G(yy_init) )
1275 m4_ifdef( [[M4_YY_USES_REJECT]],
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()" );
1284 if ( ! YY_G(yy_start) )
1285 YY_G(yy_start) = 1; /* first start state */
1300 yyout = & std::cout;
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);
1309 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1312 while ( 1 ) /* loops until end-of-file is reached */
1314 %% [8.0] yymore()-related code goes here
1315 yy_cp = YY_G(yy_c_buf_p);
1317 /* Support of yytext. */
1318 *yy_cp = YY_G(yy_hold_char);
1320 /* yy_bp points to the position in yy_ch_buf of the start of
1325 %% [9.0] code to set up and find next match goes here
1328 %% [10.0] code to find the action number goes here
1330 YY_DO_BEFORE_ACTION;
1332 %% [11.0] code for yylineno update goes here
1334 do_action: /* This label is used only to access EOF actions. */
1336 %% [12.0] debug code goes here
1339 { /* beginning of action switch */
1340 %% [13.0] actions go here
1342 case YY_END_OF_BUFFER:
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;
1347 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1348 *yy_cp = YY_G(yy_hold_char);
1349 YY_RESTORE_YY_MORE_OFFSET
1351 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
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.
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;
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
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;
1378 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1380 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
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).
1391 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1393 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1395 if ( yy_next_state )
1397 /* Consume the NUL. */
1398 yy_cp = ++YY_G(yy_c_buf_p);
1399 yy_current_state = yy_next_state;
1405 %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1406 goto yy_find_action;
1410 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1412 case EOB_ACT_END_OF_FILE:
1414 YY_G(yy_did_buffer_switch_on_eof) = 0;
1416 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
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.
1427 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1429 yy_act = YY_STATE_EOF(YY_START);
1435 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1441 case EOB_ACT_CONTINUE_SCAN:
1443 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1445 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1447 yy_cp = YY_G(yy_c_buf_p);
1448 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1451 case EOB_ACT_LAST_MATCH:
1453 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1455 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1457 yy_cp = YY_G(yy_c_buf_p);
1458 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1459 goto yy_find_action;
1466 "fatal flex scanner internal error--no action found" );
1467 } /* end of action switch */
1468 } /* end of scanning one token */
1469 } /* end of yylex */
1474 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1476 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1484 yylineno = 1; // this will only get updated if %option yylineno
1486 yy_did_buffer_switch_on_eof = 0;
1488 yy_looking_for_trail_begin = 0;
1491 yy_more_offset = yy_prev_more_offset = 0;
1493 yy_start_stack_ptr = yy_start_stack_depth = 0;
1494 yy_start_stack = NULL;
1496 yy_buffer_stack = 0;
1497 yy_buffer_stack_top = 0;
1498 yy_buffer_stack_max = 0;
1501 m4_ifdef( [[M4_YY_USES_REJECT]],
1503 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1510 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1512 yyFlexLexer::~yyFlexLexer()
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 );
1520 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1522 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
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);
1534 #ifdef YY_INTERACTIVE
1535 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1537 int yyFlexLexer::LexerInput( char* buf, int max_size )
1540 if ( yyin->eof() || yyin->fail() )
1543 #ifdef YY_INTERACTIVE
1544 yyin->get( buf[0] );
1555 (void) yyin->read( buf, max_size );
1560 return yyin->gcount();
1564 void yyFlexLexer::LexerOutput( const char* buf, int size )
1566 (void) yyout->write( buf, size );
1571 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1573 /* yy_get_next_buffer - try to read in a new buffer
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
1581 static int yy_get_next_buffer YYFARGS0(void)
1584 int yyFlexLexer::yy_get_next_buffer()
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;
1593 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1595 "fatal flex scanner internal error--end of buffer missed" );
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 )
1601 /* We matched a single character, the EOB, so
1602 * treat this as a final EOF.
1604 return EOB_ACT_END_OF_FILE;
1609 /* We matched some text prior to the EOB, first
1612 return EOB_ACT_LAST_MATCH;
1616 /* Try to read more data. */
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;
1621 for ( i = 0; i < number_to_move; ++i )
1622 *(dest++) = *(source++);
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,
1628 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1633 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1635 while ( num_to_read <= 0 )
1636 { /* Not enough room in the buffer - grow it. */
1637 m4_ifdef( [[M4_YY_USES_REJECT]],
1640 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1643 /* just a shorter name for the current buffer */
1644 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1646 int yy_c_buf_p_offset =
1647 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1649 if ( b->yy_is_our_buffer )
1651 int new_size = b->yy_buf_size * 2;
1653 if ( new_size <= 0 )
1654 b->yy_buf_size += b->yy_buf_size / 8;
1656 b->yy_buf_size *= 2;
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 );
1664 /* Can't grow it, we don't own it. */
1667 if ( ! b->yy_ch_buf )
1669 "fatal error - scanner input buffer overflow" );
1671 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1673 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1678 if ( num_to_read > YY_READ_BUF_SIZE )
1679 num_to_read = YY_READ_BUF_SIZE;
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 );
1685 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1688 if ( YY_G(yy_n_chars) == 0 )
1690 if ( number_to_move == YY_MORE_ADJ )
1692 ret_val = EOB_ACT_END_OF_FILE;
1693 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1698 ret_val = EOB_ACT_LAST_MATCH;
1699 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1700 YY_BUFFER_EOF_PENDING;
1705 ret_val = EOB_ACT_CONTINUE_SCAN;
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()" );
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;
1720 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1726 /* yy_get_previous_state - get the state just before the EOB char was reached */
1730 static yy_state_type yy_get_previous_state YYFARGS0(void)
1733 yy_state_type yyFlexLexer::yy_get_previous_state()
1736 register yy_state_type yy_current_state;
1737 register char *yy_cp;
1738 M4_YY_DECL_GUTS_VAR();
1740 %% [15.0] code to get the start state into yy_current_state goes here
1742 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1744 %% [16.0] code to find the next state goes here
1747 return yy_current_state;
1751 /* yy_try_NUL_trans - try to make a transition on the NUL character
1754 * next_state = yy_try_NUL_trans( current_state );
1757 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1760 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
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
1767 return yy_is_jam ? 0 : yy_current_state;
1772 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1774 static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1777 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1780 register char *yy_cp;
1781 M4_YY_DECL_GUTS_VAR();
1783 yy_cp = YY_G(yy_c_buf_p);
1785 /* undo effects of setting up yytext */
1786 *yy_cp = YY_G(yy_hold_char);
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];
1797 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1798 *--dest = *--source;
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;
1805 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1806 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1809 *--yy_cp = (char) c;
1811 %% [18.0] update yylineno here
1812 m4_ifdef( [[M4_YY_USE_LINENO]],
1819 YY_G(yytext_ptr) = yy_bp;
1820 YY_G(yy_hold_char) = *yy_cp;
1821 YY_G(yy_c_buf_p) = yy_cp;
1830 static int yyinput YYFARGS0(void)
1832 static int input YYFARGS0(void)
1837 int yyFlexLexer::yyinput()
1841 M4_YY_DECL_GUTS_VAR();
1843 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1845 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
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.
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';
1856 { /* need more input */
1857 int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1860 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
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.
1873 /* Reset buffer status. */
1874 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1878 case EOB_ACT_END_OF_FILE:
1880 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1883 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1886 return yyinput(M4_YY_CALL_ONLY_ARG);
1888 return input(M4_YY_CALL_ONLY_ARG);
1892 case EOB_ACT_CONTINUE_SCAN:
1893 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
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);
1903 %% [19.0] update BOL and yylineno
1908 #endif /* ifndef YY_NO_INPUT */
1911 /** Immediately switch to a different input stream.
1912 * @param input_file A readable stream.
1914 * @note This function does not reset the start condition to @c INITIAL .
1917 void yyrestart YYFARGS1( FILE *,input_file)
1920 void yyFlexLexer::yyrestart( std::istream* input_file )
1923 M4_YY_DECL_GUTS_VAR();
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);
1931 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1932 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1935 /** Switch to a different input buffer.
1936 * @param new_buffer The new input buffer.
1940 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1943 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1946 M4_YY_DECL_GUTS_VAR();
1948 /* TODO. We should be able to replace this entire function body
1950 * yypop_buffer_state();
1951 * yypush_buffer_state(new_buffer);
1953 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1954 if ( YY_CURRENT_BUFFER == new_buffer )
1957 if ( YY_CURRENT_BUFFER )
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);
1965 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1966 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
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.
1973 YY_G(yy_did_buffer_switch_on_eof) = 1;
1978 static void yy_load_buffer_state YYFARGS0(void)
1981 void yyFlexLexer::yy_load_buffer_state()
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);
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.
1995 * @return the allocated buffer state.
1998 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
2001 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2005 m4_dnl M4_YY_DECL_GUTS_VAR();
2007 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2009 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2011 b->yy_buf_size = size;
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.
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()" );
2020 b->yy_is_our_buffer = 1;
2022 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2027 /** Destroy the buffer.
2028 * @param b a buffer created with yy_create_buffer()
2032 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2035 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2038 M4_YY_DECL_GUTS_VAR();
2043 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2044 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2046 if ( b->yy_is_our_buffer )
2047 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2049 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2054 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],,
2056 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2059 extern int isatty M4_YY_PARAMS( int );
2060 #endif /* __cplusplus */
2066 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2068 extern "C" int isatty M4_YY_PARAMS( int );
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.
2077 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2080 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2085 M4_YY_DECL_GUTS_VAR();
2087 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2089 b->yy_input_file = file;
2090 b->yy_fill_buffer = 1;
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.
2096 if (b != YY_CURRENT_BUFFER){
2097 b->yy_bs_lineno = 1;
2098 b->yy_bs_column = 0;
2102 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2104 b->yy_is_interactive = 1;
2107 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2109 b->yy_is_interactive = 0;
2112 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2117 b->yy_is_interactive = 0;
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.
2127 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2130 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2133 M4_YY_DECL_GUTS_VAR();
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.
2143 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2144 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2146 b->yy_buf_pos = &b->yy_ch_buf[0];
2149 b->yy_buffer_status = YY_BUFFER_NEW;
2151 if ( b == YY_CURRENT_BUFFER )
2152 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2156 /** Pushes the new state onto the stack. The new state becomes
2157 * the current state. This function will allocate the stack
2159 * @param new_buffer The new state.
2163 void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2166 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2169 M4_YY_DECL_GUTS_VAR();
2170 if (new_buffer == NULL)
2173 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2175 /* This block is copied from yy_switch_to_buffer. */
2176 if ( YY_CURRENT_BUFFER )
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);
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;
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;
2197 /** Removes and deletes the top of the stack, if present.
2198 * The next element becomes the new top.
2202 void yypop_buffer_state YYFARGS0(void)
2205 void yyFlexLexer::yypop_buffer_state (void)
2208 M4_YY_DECL_GUTS_VAR();
2209 if (!YY_CURRENT_BUFFER)
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);
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;
2226 /* Allocates the stack if it does not exist.
2227 * Guarantees space for at least one push.
2230 static void yyensure_buffer_stack YYFARGS0(void)
2233 void yyFlexLexer::yyensure_buffer_stack(void)
2237 M4_YY_DECL_GUTS_VAR();
2239 if (!YY_G(yy_buffer_stack)) {
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.
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()" );
2253 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2255 YY_G(yy_buffer_stack_max) = num_to_alloc;
2256 YY_G(yy_buffer_stack_top) = 0;
2260 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2262 /* Increase the buffer to prepare for a possible push. */
2263 int grow_size = 8 /* arbitrary grow size */;
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()" );
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;
2283 m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
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
2290 * @return the newly allocated buffer state object.
2292 YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2295 m4_dnl M4_YY_DECL_GUTS_VAR();
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. */
2303 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2305 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
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;
2314 b->yy_fill_buffer = 0;
2315 b->yy_buffer_status = YY_BUFFER_NEW;
2317 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2325 m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
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
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.
2336 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2338 m4_dnl M4_YY_DECL_GUTS_VAR();
2340 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2346 m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
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.
2354 * @return the newly allocated buffer state object.
2356 YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, int ,_yybytes_len)
2362 m4_dnl M4_YY_DECL_GUTS_VAR();
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 );
2368 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2370 for ( i = 0; i < _yybytes_len; ++i )
2371 buf[i] = yybytes[i];
2373 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2375 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2377 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2379 /* It's okay to grow etc. this buffer, and we should throw it
2380 * away when we're done.
2382 b->yy_is_our_buffer = 1;
2390 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2393 static void yy_push_state YYFARGS1( int ,new_state)
2396 void yyFlexLexer::yy_push_state( int new_state )
2399 M4_YY_DECL_GUTS_VAR();
2400 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2404 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2405 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2407 if ( ! YY_G(yy_start_stack) )
2408 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2411 YY_G(yy_start_stack) = (int *) yyrealloc(
2412 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2414 if ( ! YY_G(yy_start_stack) )
2415 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2418 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2425 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2428 static void yy_pop_state YYFARGS0(void)
2431 void yyFlexLexer::yy_pop_state()
2434 M4_YY_DECL_GUTS_VAR();
2435 if ( --YY_G(yy_start_stack_ptr) < 0 )
2436 YY_FATAL_ERROR( "start-condition stack underflow" );
2438 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2443 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2446 static int yy_top_state YYFARGS0(void)
2449 int yyFlexLexer::yy_top_state()
2452 M4_YY_DECL_GUTS_VAR();
2453 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2457 #ifndef YY_EXIT_FAILURE
2458 #define YY_EXIT_FAILURE 2
2462 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2464 m4_dnl M4_YY_DECL_GUTS_VAR();
2465 (void) fprintf( stderr, "%s\n", msg );
2466 exit( YY_EXIT_FAILURE );
2470 void yyFlexLexer::LexerError( yyconst char msg[] )
2472 M4_YY_DECL_GUTS_VAR();
2473 std::cerr << msg << std::endl;
2474 exit( YY_EXIT_FAILURE );
2478 /* Redefine yyless() so it works in section 3 code. */
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; \
2497 /* Accessor methods (get/set functions) to struct members. */
2501 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2503 /** Get the user-defined data for this scanner.
2506 YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2508 M4_YY_DECL_GUTS_VAR();
2514 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2516 /** Get the current line number.
2519 int yyget_lineno YYFARGS0(void)
2521 M4_YY_DECL_GUTS_VAR();
2523 m4_ifdef( [[M4_YY_REENTRANT]],
2525 if (! YY_CURRENT_BUFFER)
2532 m4_ifdef( [[M4_YY_REENTRANT]],
2534 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2536 /** Get the current column number.
2539 int yyget_column YYFARGS0(void)
2541 M4_YY_DECL_GUTS_VAR();
2543 m4_ifdef( [[M4_YY_REENTRANT]],
2545 if (! YY_CURRENT_BUFFER)
2553 m4_ifdef( [[M4_YY_NO_GET_IN]],,
2555 /** Get the input stream.
2558 FILE *yyget_in YYFARGS0(void)
2560 M4_YY_DECL_GUTS_VAR();
2565 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2567 /** Get the output stream.
2570 FILE *yyget_out YYFARGS0(void)
2572 M4_YY_DECL_GUTS_VAR();
2577 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2579 /** Get the length of the current token.
2582 int yyget_leng YYFARGS0(void)
2584 M4_YY_DECL_GUTS_VAR();
2589 /** Get the current token.
2592 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2594 char *yyget_text YYFARGS0(void)
2596 M4_YY_DECL_GUTS_VAR();
2602 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
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.
2608 void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2610 M4_YY_DECL_GUTS_VAR();
2611 yyextra = user_defined ;
2616 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2618 /** Set the current line number.
2619 * @param line_number
2622 void yyset_lineno YYFARGS1( int ,line_number)
2624 M4_YY_DECL_GUTS_VAR();
2626 m4_ifdef( [[M4_YY_REENTRANT]],
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);
2632 yylineno = line_number;
2636 m4_ifdef( [[M4_YY_REENTRANT]],
2638 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2640 /** Set the current column.
2641 * @param line_number
2644 void yyset_column YYFARGS1( int , column_no)
2646 M4_YY_DECL_GUTS_VAR();
2648 m4_ifdef( [[M4_YY_REENTRANT]],
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);
2654 yycolumn = column_no;
2660 m4_ifdef( [[M4_YY_NO_SET_IN]],,
2662 /** Set the input stream. This does not discard the current
2664 * @param in_str A readable stream.
2666 * @see yy_switch_to_buffer
2668 void yyset_in YYFARGS1( FILE * ,in_str)
2670 M4_YY_DECL_GUTS_VAR();
2675 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2677 void yyset_out YYFARGS1( FILE * ,out_str)
2679 M4_YY_DECL_GUTS_VAR();
2685 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2687 int yyget_debug YYFARGS0(void)
2689 M4_YY_DECL_GUTS_VAR();
2690 return yy_flex_debug;
2694 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2696 void yyset_debug YYFARGS1( int ,bdebug)
2698 M4_YY_DECL_GUTS_VAR();
2699 yy_flex_debug = bdebug ;
2705 /* Accessor methods for yylval and yylloc */
2708 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2710 YYSTYPE * yyget_lval YYFARGS0(void)
2712 M4_YY_DECL_GUTS_VAR();
2717 m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2719 void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2721 M4_YY_DECL_GUTS_VAR();
2722 yylval = yylval_param;
2726 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2728 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2730 YYLTYPE *yyget_lloc YYFARGS0(void)
2732 M4_YY_DECL_GUTS_VAR();
2737 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2739 void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2741 M4_YY_DECL_GUTS_VAR();
2742 yylloc = yylloc_param;
2750 /* User-visible API */
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.
2756 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2758 int yylex_init( ptr_yy_globals )
2759 yyscan_t* ptr_yy_globals;
2762 int yylex_init(yyscan_t* ptr_yy_globals)
2765 if (ptr_yy_globals == NULL){
2770 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2772 if (*ptr_yy_globals == NULL){
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));
2780 return yy_init_globals ( *ptr_yy_globals );
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.
2791 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2793 int yylex_init_extra( yy_user_defined, ptr_yy_globals )
2794 YY_EXTRA_TYPE yy_user_defined;
2795 yyscan_t* ptr_yy_globals;
2798 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2801 struct yyguts_t dummy_yyguts;
2803 yyset_extra (yy_user_defined, &dummy_yyguts);
2805 if (ptr_yy_globals == NULL){
2810 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2812 if (*ptr_yy_globals == NULL){
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));
2821 yyset_extra (yy_user_defined, *ptr_yy_globals);
2823 return yy_init_globals ( *ptr_yy_globals );
2830 static int yy_init_globals YYFARGS0(void)
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.
2837 m4_ifdef( [[M4_YY_USE_LINENO]],
2839 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2841 /* We do not touch yylineno unless the option is enabled. */
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;
2852 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2854 YY_G(yy_start_stack_ptr) = 0;
2855 YY_G(yy_start_stack_depth) = 0;
2856 YY_G(yy_start_stack) = NULL;
2859 m4_ifdef( [[M4_YY_USES_REJECT]],
2861 YY_G(yy_state_buf) = 0;
2862 YY_G(yy_state_ptr) = 0;
2863 YY_G(yy_full_match) = 0;
2867 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2869 YY_G(yytext_ptr) = 0;
2870 YY_G(yy_more_offset) = 0;
2871 YY_G(yy_prev_more_offset) = 0;
2874 /* Defined in main.c */
2883 /* For future reference: Set errno on error, since we are called by
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)
2895 M4_YY_DECL_GUTS_VAR();
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);
2904 /* Destroy the stack itself. */
2905 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2906 YY_G(yy_buffer_stack) = NULL;
2908 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
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;
2915 m4_ifdef( [[M4_YY_USES_REJECT]],
2917 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2918 YY_G(yy_state_buf) = NULL;
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);
2926 /* Destroy the main struct (reentrant only). */
2927 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2935 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2938 * Internal utility routines.
2942 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2945 static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2948 for ( i = 0; i < n; ++i )
2954 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2956 #ifdef YY_NEED_STRLEN
2957 static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2960 for ( n = 0; s[n]; ++n )
2968 m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
2970 void *yyalloc YYFARGS1( yy_size_t ,size)
2972 return (void *) malloc( size );
2976 m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
2978 void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
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.
2987 return (void *) realloc( (char *) ptr, size );
2991 m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
2993 void yyfree YYFARGS1( void *,ptr)
2995 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2999 %if-tables-serialization definitions
3000 m4preproc_include(`tables_shared.c')
3002 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
3005 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3009 rd->bread += sizeof(flex_uint8_t);
3013 static int yytbl_read16 (void *v, struct yytbl_reader * rd)
3016 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3020 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3021 rd->bread += sizeof(flex_uint16_t);
3025 static int yytbl_read32 (void *v, struct yytbl_reader * rd)
3028 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3032 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3033 rd->bread += sizeof(flex_uint32_t);
3037 /** Read the header */
3038 static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3041 memset (th, 0, sizeof (struct yytbl_hdr));
3043 if (yytbl_read32 (&(th->th_magic), rd) != 0)
3046 if (th->th_magic != YYTBL_MAGIC){
3047 yy_fatal_error("bad magic number" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
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)
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);
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()" );
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){
3071 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3072 th->th_version = NULL;
3078 th->th_name = th->th_version + strlen (th->th_version) + 1;
3082 /** lookup id in the dmap list.
3083 * @param dmap pointer to first element in list
3084 * @return NULL if not found.
3086 static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3090 if (dmap->dm_id == id)
3097 /** Read a table while mapping its contents to the local array.
3098 * @param dmap used to performing mapping
3099 * @return 0 on success
3101 static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3103 struct yytbl_data td;
3104 struct yytbl_dmap *transdmap=0;
3105 int len, i, rv, inner_loop_count;
3108 memset (&td, 0, sizeof (struct yytbl_data));
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)
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.
3120 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
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);
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
3135 if ((td.td_flags & YYTD_STRUCT))
3136 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3138 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3140 if(M4_YY_TABLES_VERIFY)
3141 /* We point to the array itself */
3144 /* We point to the address of a pointer. */
3145 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3147 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
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;
3154 inner_loop_count = 1;
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.
3160 len = yytbl_calc_total_len (&td);
3161 for (i = 0; i < len; ){
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.
3169 for (j = 0; j < inner_loop_count; j++, i++) {
3172 /* read into t32 no matter what the real size is. */
3177 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3178 case sizeof (flex_int32_t):
3179 rv = yytbl_read32 (&t32, rd);
3181 case sizeof (flex_int16_t):
3182 rv = yytbl_read16 (&t16, rd);
3185 case sizeof (flex_int8_t):
3186 rv = yytbl_read8 (&t8, rd);
3190 yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3197 /* copy into the deserialized array... */
3199 if ((td.td_flags & YYTD_STRUCT)) {
3200 /* t32 is the j'th member of a two-element struct. */
3203 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3204 : &(((struct yy_trans_info *) p)->yy_nxt);
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);
3212 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
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);
3219 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
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);
3226 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3229 yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3233 /* if we're done with j, increment p */
3235 p = (struct yy_trans_info *) p + 1;
3237 else if ((td.td_flags & YYTD_PTRANS)) {
3238 /* t32 is an index into the transition array. */
3239 struct yy_trans_info *v;
3243 yy_fatal_error("transition table not found" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3247 if( M4_YY_TABLES_VERIFY)
3248 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3250 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
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);
3256 ((struct yy_trans_info **) p)[0] = v;
3259 p = (struct yy_trans_info **) p + 1;
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);
3269 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3270 p = ((flex_int32_t *) p) + 1;
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);
3277 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3278 p = ((flex_int16_t *) p) + 1;
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);
3285 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3286 p = ((flex_int8_t *) p) + 1;
3289 yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3297 /* Now eat padding. */
3300 pad = yypad64(rd->bread);
3303 if(yytbl_read8(&t8,rd) != 0)
3311 %define-yytables The name for this specific scanner's tables.
3313 /* Find the key and load the DFA tables from the given stream. */
3314 static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3317 struct yytbl_hdr th;
3318 struct yytbl_reader rd;
3321 th.th_version = NULL;
3323 /* Keep trying until we find the right set of tables or end of file. */
3324 while (!feof(rd.fp)) {
3326 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3331 /* A NULL key means choose the first set of tables. */
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;
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){
3355 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3356 th.th_version = NULL;
3362 /** Load the DFA tables for this scanner from the given stream. */
3363 int yytables_fload YYFARGS1(FILE *, fp)
3366 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3371 /** Destroy the loaded tables, freeing memory, etc.. */
3372 int yytables_destroy YYFARGS0(void)
3374 struct yytbl_dmap *dmap=0;
3376 if(!M4_YY_TABLES_VERIFY){
3377 /* Walk the dmap, freeing the pointers */
3378 for(dmap=yydmap; dmap->dm_id; dmap++) {
3381 if(v && *(char**)v){
3382 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3391 /* end table serialization code definitions */
3395 m4_ifdef([[M4_YY_MAIN]], [[
3396 int main M4_YY_PARAMS(void);
3405 yylex_destroy( lexer);
3417 m4_ifdef( [[M4_YY_IN_HEADER]],
3420 #undef YY_FLUSH_BUFFER
3422 #undef yy_new_buffer
3423 #undef yy_set_interactive
3424 #undef YY_DO_BEFORE_ACTION
3426 #ifdef YY_DECL_IS_OURS
3427 #undef YY_DECL_IS_OURS