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 #if defined(__GNUC__) && __GNUC__ >= 3
740 __attribute__((__noreturn__))
742 static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
747 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
749 /* Done after the current pattern has been matched and before the
750 * corresponding action - sets up yytext.
752 #define YY_DO_BEFORE_ACTION \
753 YY_G(yytext_ptr) = yy_bp; \
754 %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
755 YY_G(yy_hold_char) = *yy_cp; \
757 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
758 YY_G(yy_c_buf_p) = yy_cp;
761 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
763 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
766 m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
768 m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
770 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
772 #ifndef YY_NO_UNISTD_H
773 /* Special case for "unistd.h", since it is non-ANSI. We include it way
774 * down here because we want the user's section 1 to have been scanned first.
775 * The user has a chance to override it with an option.
786 m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
788 #define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
791 #ifndef YY_EXTRA_TYPE
792 #define YY_EXTRA_TYPE void *
797 %if-c-only Reentrant structure and macros (non-C++).
800 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
802 /* Holds the entire state of the reentrant scanner. */
806 /* User-defined. Not touched by flex. */
807 YY_EXTRA_TYPE yyextra_r;
809 /* The rest are the same as the globals declared in the non-reentrant scanner. */
810 FILE *yyin_r, *yyout_r;
811 size_t yy_buffer_stack_top; /**< index of top of stack. */
812 size_t yy_buffer_stack_max; /**< capacity of stack. */
813 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
820 int yy_did_buffer_switch_on_eof;
821 int yy_start_stack_ptr;
822 int yy_start_stack_depth;
824 yy_state_type yy_last_accepting_state;
825 char* yy_last_accepting_cpos;
830 m4_ifdef( [[M4_YY_USES_REJECT]],
832 yy_state_type *yy_state_buf;
833 yy_state_type *yy_state_ptr;
837 /* These are only needed for trailing context rules,
838 * but there's no conditional variable for that yet. */
839 int yy_looking_for_trail_begin;
844 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
846 char yytext_r[YYLMAX];
849 int yy_prev_more_offset;
857 m4_ifdef( [[M4_YY_BISON_LVAL]],
862 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
867 }; /* end struct yyguts_t */
872 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
874 static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
880 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
882 m4_ifdef( [[M4_YY_BISON_LVAL]],
884 /* This must go here because YYSTYPE and YYLTYPE are included
885 * from bison output in section 1.*/
886 # define yylval YY_G(yylval_r)
889 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
891 # define yylloc YY_G(yylloc_r)
895 int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
897 int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
901 %endif End reentrant structures and macros.
903 /* Accessor methods to globals.
904 These are made visible to non-reentrant scanners for convenience. */
906 m4_ifdef( [[M4_YY_NO_DESTROY]],,
908 int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
911 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
913 int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
916 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
918 void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
921 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
923 YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
926 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
928 void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
931 m4_ifdef( [[M4_YY_NO_GET_IN]],,
933 FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
936 m4_ifdef( [[M4_YY_NO_SET_IN]],,
938 void yyset_in M4_YY_PARAMS( FILE * _in_str M4_YY_PROTO_LAST_ARG );
941 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
943 FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
946 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
948 void yyset_out M4_YY_PARAMS( FILE * _out_str M4_YY_PROTO_LAST_ARG );
951 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
953 int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
956 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
958 char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
961 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
963 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
966 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
968 void yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );
972 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
974 YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
977 void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
979 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
981 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
983 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
986 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
988 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
993 /* Macros after this point can all be overridden by user definitions in
997 #ifndef YY_SKIP_YYWRAP
999 extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1001 extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1007 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1009 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
1016 static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1019 #ifdef YY_NEED_STRLEN
1020 static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1024 %if-c-only Standard (non-C++) definition
1027 static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1029 static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1037 %# TODO: This is messy.
1038 m4_ifdef( [[M4_YY_STACK_USED]],
1041 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1043 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1045 static int yy_start_stack_ptr = 0;
1046 static int yy_start_stack_depth = 0;
1047 static int *yy_start_stack = NULL;
1051 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1053 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1055 static void yy_push_state M4_YY_PARAMS( int _new_state M4_YY_PROTO_LAST_ARG);
1057 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1059 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1061 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1063 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1069 m4_define( [[M4_YY_NO_PUSH_STATE]])
1070 m4_define( [[M4_YY_NO_POP_STATE]])
1071 m4_define( [[M4_YY_NO_TOP_STATE]])
1075 /* Amount of stuff to slurp up with each read. */
1076 #ifndef YY_READ_BUF_SIZE
1077 #define YY_READ_BUF_SIZE 8192
1080 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1082 /* Copy whatever the last rule matched to the standard output. */
1084 %if-c-only Standard (non-C++) definition
1085 /* This used to be an fputs(), but since the string might contain NUL's,
1086 * we now use fwrite().
1088 #define ECHO fwrite( yytext, yyleng, 1, yyout )
1090 %if-c++-only C++ definition
1091 #define ECHO LexerOutput( yytext, yyleng )
1096 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1098 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1099 * is returned in "result".
1102 #define YY_INPUT(buf,result,max_size) \
1103 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1105 %if-c++-only C++ definition \
1106 if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
1107 YY_FATAL_ERROR( "input in flex scanner failed" );
1113 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1115 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1116 * we don't want an extra ';' after the "return" because that will cause
1117 * some compilers to complain about unreachable statements.
1120 #define yyterminate() return YY_NULL
1124 /* Number of entries by which start-condition stack grows. */
1125 #ifndef YY_START_STACK_INCR
1126 #define YY_START_STACK_INCR 25
1129 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1131 /* Report a fatal error. */
1132 #ifndef YY_FATAL_ERROR
1134 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1137 #define YY_FATAL_ERROR(msg) LexerError( msg )
1142 %if-tables-serialization structures and prototypes
1143 m4preproc_include(`tables_shared.h')
1145 /* Load the DFA tables from the given stream. */
1146 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1148 /* Unload the tables from memory. */
1149 int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1152 /** Describes a mapping from a serialized table id to its deserialized state in
1153 * this scanner. This is the bridge between our "generic" deserialization code
1154 * and the specifics of this scanner.
1157 enum yytbl_id dm_id;/**< table identifier */
1158 void **dm_arr; /**< address of pointer to store the deserialized table. */
1159 size_t dm_sz; /**< local sizeof() each element in table. */
1162 /** A {0,0,0}-terminated list of structs, forming the map */
1163 static struct yytbl_dmap yydmap[] =
1165 %tables-yydmap generated elements
1169 /** A tables-reader object to maintain some state in the read. */
1170 struct yytbl_reader {
1171 FILE * fp; /**< input stream */
1172 flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1176 /* end tables serialization structures and prototypes */
1180 /* Default declaration of generated scanner - a define so the user can
1181 * easily add parameters.
1184 #define YY_DECL_IS_OURS 1
1185 %if-c-only Standard (non-C++) definition
1188 m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1189 m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1191 m4_ifdef( [[M4_YY_BISON_LVAL]],
1193 m4_dnl The bison pure parser is used. Redefine yylex to
1194 m4_dnl accept the lval parameter.
1196 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1197 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1198 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1199 [[YYFARGS1(YYSTYPE *,yylval_param)]])
1202 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1204 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
1206 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1207 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1208 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1209 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1212 extern int yylex M4_YY_LEX_PROTO;
1214 #define YY_DECL int yylex M4_YY_LEX_DECLARATION
1216 %if-c++-only C++ definition
1217 #define YY_DECL int yyFlexLexer::yylex()
1219 #endif /* !YY_DECL */
1221 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1223 /* Code executed at the beginning of each rule, after yytext and yyleng
1226 #ifndef YY_USER_ACTION
1227 #define YY_USER_ACTION
1231 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1233 /* Code executed at the end of each rule. */
1235 #define YY_BREAK /*LINTED*/break;
1239 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1241 %% [6.0] YY_RULE_SETUP definition goes here
1245 /** The main scanner function which does all the work.
1249 register yy_state_type yy_current_state;
1250 register char *yy_cp, *yy_bp;
1251 register int yy_act;
1252 M4_YY_DECL_GUTS_VAR();
1254 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1256 m4_ifdef( [[M4_YY_BISON_LVAL]],
1260 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1266 %% [7.0] user's declarations go here
1268 m4_ifdef( [[M4_YY_BISON_LVAL]],
1270 yylval = yylval_param;
1273 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1275 yylloc = yylloc_param;
1278 if ( !YY_G(yy_init) )
1286 m4_ifdef( [[M4_YY_USES_REJECT]],
1288 /* Create the reject buffer large enough to save one state per allowed character. */
1289 if ( ! YY_G(yy_state_buf) )
1290 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
1291 if ( ! YY_G(yy_state_buf) )
1292 YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1295 if ( ! YY_G(yy_start) )
1296 YY_G(yy_start) = 1; /* first start state */
1311 yyout = & std::cout;
1314 if ( ! YY_CURRENT_BUFFER ) {
1315 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1316 YY_CURRENT_BUFFER_LVALUE =
1317 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1320 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1323 while (/*CONSTCOND*/ 1 ) /* loops until end-of-file is reached */
1325 %% [8.0] yymore()-related code goes here
1326 yy_cp = YY_G(yy_c_buf_p);
1328 /* Support of yytext. */
1329 *yy_cp = YY_G(yy_hold_char);
1331 /* yy_bp points to the position in yy_ch_buf of the start of
1336 %% [9.0] code to set up and find next match goes here
1339 %% [10.0] code to find the action number goes here
1341 YY_DO_BEFORE_ACTION;
1343 %% [11.0] code for yylineno update goes here
1345 do_action: /* This label is used only to access EOF actions. */
1347 %% [12.0] debug code goes here
1350 { /* beginning of action switch */
1351 %% [13.0] actions go here
1353 case YY_END_OF_BUFFER:
1355 /* Amount of text matched not including the EOB char. */
1356 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1358 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1359 *yy_cp = YY_G(yy_hold_char);
1360 YY_RESTORE_YY_MORE_OFFSET
1362 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1364 /* We're scanning a new file or input source. It's
1365 * possible that this happened because the user
1366 * just pointed yyin at a new source and called
1367 * yylex(). If so, then we have to assure
1368 * consistency between YY_CURRENT_BUFFER and our
1369 * globals. Here is the right place to do so, because
1370 * this is the first action (other than possibly a
1371 * back-up) that will match for the new input source.
1373 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1374 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1375 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1378 /* Note that here we test for yy_c_buf_p "<=" to the position
1379 * of the first EOB in the buffer, since yy_c_buf_p will
1380 * already have been incremented past the NUL character
1381 * (since all states make transitions on EOB to the
1382 * end-of-buffer state). Contrast this with the test
1385 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1386 { /* This was really a NUL. */
1387 yy_state_type yy_next_state;
1389 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1391 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1393 /* Okay, we're now positioned to make the NUL
1394 * transition. We couldn't have
1395 * yy_get_previous_state() go ahead and do it
1396 * for us because it doesn't know how to deal
1397 * with the possibility of jamming (and we don't
1398 * want to build jamming into it because then it
1399 * will run more slowly).
1402 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1404 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1406 if ( yy_next_state )
1408 /* Consume the NUL. */
1409 yy_cp = ++YY_G(yy_c_buf_p);
1410 yy_current_state = yy_next_state;
1416 %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1417 goto yy_find_action;
1421 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1423 case EOB_ACT_END_OF_FILE:
1425 YY_G(yy_did_buffer_switch_on_eof) = 0;
1427 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1429 /* Note: because we've taken care in
1430 * yy_get_next_buffer() to have set up
1431 * yytext, we can now set up
1432 * yy_c_buf_p so that if some total
1433 * hoser (like flex itself) wants to
1434 * call the scanner after we return the
1435 * YY_NULL, it'll still work - another
1436 * YY_NULL will get returned.
1438 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1440 yy_act = YY_STATE_EOF(YY_START);
1446 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1452 case EOB_ACT_CONTINUE_SCAN:
1454 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1456 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1458 yy_cp = YY_G(yy_c_buf_p);
1459 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1462 case EOB_ACT_LAST_MATCH:
1464 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1466 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1468 yy_cp = YY_G(yy_c_buf_p);
1469 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1470 goto yy_find_action;
1477 "fatal flex scanner internal error--no action found" );
1478 } /* end of action switch */
1479 } /* end of scanning one token */
1480 } /* end of yylex */
1485 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1487 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1495 yylineno = 1; // this will only get updated if %option yylineno
1497 yy_did_buffer_switch_on_eof = 0;
1499 yy_looking_for_trail_begin = 0;
1502 yy_more_offset = yy_prev_more_offset = 0;
1504 yy_start_stack_ptr = yy_start_stack_depth = 0;
1505 yy_start_stack = NULL;
1507 yy_buffer_stack = 0;
1508 yy_buffer_stack_top = 0;
1509 yy_buffer_stack_max = 0;
1512 m4_ifdef( [[M4_YY_USES_REJECT]],
1514 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1521 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1523 yyFlexLexer::~yyFlexLexer()
1525 delete [] yy_state_buf;
1526 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1527 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1528 yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
1531 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1533 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1537 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1538 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1545 #ifdef YY_INTERACTIVE
1546 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1548 int yyFlexLexer::LexerInput( char* buf, int max_size )
1551 if ( yyin->eof() || yyin->fail() )
1554 #ifdef YY_INTERACTIVE
1555 yyin->get( buf[0] );
1566 (void) yyin->read( buf, max_size );
1571 return yyin->gcount();
1575 void yyFlexLexer::LexerOutput( const char* buf, int size )
1577 (void) yyout->write( buf, size );
1582 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1584 /* yy_get_next_buffer - try to read in a new buffer
1586 * Returns a code representing an action:
1587 * EOB_ACT_LAST_MATCH -
1588 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1589 * EOB_ACT_END_OF_FILE - end of file
1592 static int yy_get_next_buffer YYFARGS0(void)
1595 int yyFlexLexer::yy_get_next_buffer()
1598 M4_YY_DECL_GUTS_VAR();
1599 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1600 register char *source = YY_G(yytext_ptr);
1601 register int number_to_move, i;
1604 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1606 "fatal flex scanner internal error--end of buffer missed" );
1608 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1609 { /* Don't try to fill the buffer, so this is an EOF. */
1610 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1612 /* We matched a single character, the EOB, so
1613 * treat this as a final EOF.
1615 return EOB_ACT_END_OF_FILE;
1620 /* We matched some text prior to the EOB, first
1623 return EOB_ACT_LAST_MATCH;
1627 /* Try to read more data. */
1629 /* First move last chars to start of buffer. */
1630 number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
1632 for ( i = 0; i < number_to_move; ++i )
1633 *(dest++) = *(source++);
1635 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1636 /* don't do the read, it's not guaranteed to return an EOF,
1639 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1644 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1646 while ( num_to_read <= 0 )
1647 { /* Not enough room in the buffer - grow it. */
1648 m4_ifdef( [[M4_YY_USES_REJECT]],
1651 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1654 /* just a shorter name for the current buffer */
1655 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1657 int yy_c_buf_p_offset =
1658 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1660 if ( b->yy_is_our_buffer )
1662 int new_size = b->yy_buf_size * 2;
1664 if ( new_size <= 0 )
1665 b->yy_buf_size += b->yy_buf_size / 8;
1667 b->yy_buf_size *= 2;
1669 b->yy_ch_buf = (char *)
1670 /* Include room in for 2 EOB chars. */
1671 yyrealloc( (void *) b->yy_ch_buf,
1672 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1675 /* Can't grow it, we don't own it. */
1678 if ( ! b->yy_ch_buf )
1680 "fatal error - scanner input buffer overflow" );
1682 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1684 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1689 if ( num_to_read > YY_READ_BUF_SIZE )
1690 num_to_read = YY_READ_BUF_SIZE;
1692 /* Read in more data. */
1693 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1694 YY_G(yy_n_chars), (size_t) num_to_read );
1696 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1699 if ( YY_G(yy_n_chars) == 0 )
1701 if ( number_to_move == YY_MORE_ADJ )
1703 ret_val = EOB_ACT_END_OF_FILE;
1704 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1709 ret_val = EOB_ACT_LAST_MATCH;
1710 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1711 YY_BUFFER_EOF_PENDING;
1716 ret_val = EOB_ACT_CONTINUE_SCAN;
1718 if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1719 /* Extend the array by 50%, plus the number we really need. */
1720 yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
1721 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1722 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
1723 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1724 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1727 YY_G(yy_n_chars) += number_to_move;
1728 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1729 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1731 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1737 /* yy_get_previous_state - get the state just before the EOB char was reached */
1741 static yy_state_type yy_get_previous_state YYFARGS0(void)
1744 yy_state_type yyFlexLexer::yy_get_previous_state()
1747 register yy_state_type yy_current_state;
1748 register char *yy_cp;
1749 M4_YY_DECL_GUTS_VAR();
1751 %% [15.0] code to get the start state into yy_current_state goes here
1753 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1755 %% [16.0] code to find the next state goes here
1758 return yy_current_state;
1762 /* yy_try_NUL_trans - try to make a transition on the NUL character
1765 * next_state = yy_try_NUL_trans( current_state );
1768 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1771 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1774 register int yy_is_jam;
1775 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1776 %% [17.0] code to find the next state, and perhaps do backing up, goes here
1778 return yy_is_jam ? 0 : yy_current_state;
1784 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1786 static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1789 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1792 register char *yy_cp;
1793 M4_YY_DECL_GUTS_VAR();
1795 yy_cp = YY_G(yy_c_buf_p);
1797 /* undo effects of setting up yytext */
1798 *yy_cp = YY_G(yy_hold_char);
1800 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1801 { /* need to shift things up to make room */
1802 /* +2 for EOB chars. */
1803 register int number_to_move = YY_G(yy_n_chars) + 2;
1804 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1805 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1806 register char *source =
1807 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1809 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1810 *--dest = *--source;
1812 yy_cp += (int) (dest - source);
1813 yy_bp += (int) (dest - source);
1814 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1815 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1817 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1818 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1821 *--yy_cp = (char) c;
1823 %% [18.0] update yylineno here
1824 m4_ifdef( [[M4_YY_USE_LINENO]],
1831 YY_G(yytext_ptr) = yy_bp;
1832 YY_G(yy_hold_char) = *yy_cp;
1833 YY_G(yy_c_buf_p) = yy_cp;
1843 static int yyinput YYFARGS0(void)
1845 static int input YYFARGS0(void)
1850 int yyFlexLexer::yyinput()
1854 M4_YY_DECL_GUTS_VAR();
1856 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1858 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1860 /* yy_c_buf_p now points to the character we want to return.
1861 * If this occurs *before* the EOB characters, then it's a
1862 * valid NUL; if not, then we've hit the end of the buffer.
1864 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1865 /* This was really a NUL. */
1866 *YY_G(yy_c_buf_p) = '\0';
1869 { /* need more input */
1870 int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1873 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1875 case EOB_ACT_LAST_MATCH:
1876 /* This happens because yy_g_n_b()
1877 * sees that we've accumulated a
1878 * token and flags that we need to
1879 * try matching the token before
1880 * proceeding. But for input(),
1881 * there's no matching to consider.
1882 * So convert the EOB_ACT_LAST_MATCH
1883 * to EOB_ACT_END_OF_FILE.
1886 /* Reset buffer status. */
1887 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1891 case EOB_ACT_END_OF_FILE:
1893 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1896 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1899 return yyinput(M4_YY_CALL_ONLY_ARG);
1901 return input(M4_YY_CALL_ONLY_ARG);
1905 case EOB_ACT_CONTINUE_SCAN:
1906 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1912 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
1913 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
1914 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1916 %% [19.0] update BOL and yylineno
1921 #endif /* ifndef YY_NO_INPUT */
1924 /** Immediately switch to a different input stream.
1925 * @param input_file A readable stream.
1927 * @note This function does not reset the start condition to @c INITIAL .
1930 void yyrestart YYFARGS1( FILE *,input_file)
1933 void yyFlexLexer::yyrestart( std::istream* input_file )
1936 M4_YY_DECL_GUTS_VAR();
1938 if ( ! YY_CURRENT_BUFFER ){
1939 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1940 YY_CURRENT_BUFFER_LVALUE =
1941 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1944 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1945 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1948 /** Switch to a different input buffer.
1949 * @param new_buffer The new input buffer.
1953 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1956 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1959 M4_YY_DECL_GUTS_VAR();
1961 /* TODO. We should be able to replace this entire function body
1963 * yypop_buffer_state();
1964 * yypush_buffer_state(new_buffer);
1966 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1967 if ( YY_CURRENT_BUFFER == new_buffer )
1970 if ( YY_CURRENT_BUFFER )
1972 /* Flush out information for old buffer. */
1973 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1974 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
1975 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1978 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1979 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1981 /* We don't actually know whether we did this switch during
1982 * EOF (yywrap()) processing, but the only time this flag
1983 * is looked at is after yywrap() is called, so it's safe
1984 * to go ahead and always set it.
1986 YY_G(yy_did_buffer_switch_on_eof) = 1;
1991 static void yy_load_buffer_state YYFARGS0(void)
1994 void yyFlexLexer::yy_load_buffer_state()
1997 M4_YY_DECL_GUTS_VAR();
1998 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1999 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2000 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2001 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
2004 /** Allocate and initialize an input buffer state.
2005 * @param file A readable stream.
2006 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2008 * @return the allocated buffer state.
2011 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
2014 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2018 m4_dnl M4_YY_DECL_GUTS_VAR();
2020 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2022 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2024 b->yy_buf_size = size;
2026 /* yy_ch_buf has to be 2 characters longer than the size given because
2027 * we need to put in 2 end-of-buffer characters.
2029 b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
2030 if ( ! b->yy_ch_buf )
2031 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2033 b->yy_is_our_buffer = 1;
2035 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2040 /** Destroy the buffer.
2041 * @param b a buffer created with yy_create_buffer()
2045 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2048 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2051 M4_YY_DECL_GUTS_VAR();
2056 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2057 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2059 if ( b->yy_is_our_buffer )
2060 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2062 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2067 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],,
2069 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2072 extern int isatty M4_YY_PARAMS( int );
2073 #endif /* __cplusplus */
2079 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2081 extern "C" int isatty M4_YY_PARAMS( int );
2085 /* Initializes or reinitializes a buffer.
2086 * This function is sometimes called more than once on the same buffer,
2087 * such as during a yyrestart() or at EOF.
2090 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2093 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2098 M4_YY_DECL_GUTS_VAR();
2100 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2102 b->yy_input_file = file;
2103 b->yy_fill_buffer = 1;
2105 /* If b is the current buffer, then yy_init_buffer was _probably_
2106 * called from yyrestart() or through yy_get_next_buffer.
2107 * In that case, we don't want to reset the lineno or column.
2109 if (b != YY_CURRENT_BUFFER){
2110 b->yy_bs_lineno = 1;
2111 b->yy_bs_column = 0;
2115 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2117 b->yy_is_interactive = 1;
2120 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2122 b->yy_is_interactive = 0;
2125 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2130 b->yy_is_interactive = 0;
2135 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2136 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2140 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2143 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2146 M4_YY_DECL_GUTS_VAR();
2152 /* We always need two end-of-buffer characters. The first causes
2153 * a transition to the end-of-buffer state. The second causes
2154 * a jam in that state.
2156 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2157 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2159 b->yy_buf_pos = &b->yy_ch_buf[0];
2162 b->yy_buffer_status = YY_BUFFER_NEW;
2164 if ( b == YY_CURRENT_BUFFER )
2165 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2169 /** Pushes the new state onto the stack. The new state becomes
2170 * the current state. This function will allocate the stack
2172 * @param new_buffer The new state.
2176 void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2179 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2182 M4_YY_DECL_GUTS_VAR();
2183 if (new_buffer == NULL)
2186 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2188 /* This block is copied from yy_switch_to_buffer. */
2189 if ( YY_CURRENT_BUFFER )
2191 /* Flush out information for old buffer. */
2192 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2193 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2194 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2197 /* Only push if top exists. Otherwise, replace top. */
2198 if (YY_CURRENT_BUFFER)
2199 YY_G(yy_buffer_stack_top)++;
2200 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2202 /* copied from yy_switch_to_buffer. */
2203 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2204 YY_G(yy_did_buffer_switch_on_eof) = 1;
2210 /** Removes and deletes the top of the stack, if present.
2211 * The next element becomes the new top.
2215 void yypop_buffer_state YYFARGS0(void)
2218 void yyFlexLexer::yypop_buffer_state (void)
2221 M4_YY_DECL_GUTS_VAR();
2222 if (!YY_CURRENT_BUFFER)
2225 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2226 YY_CURRENT_BUFFER_LVALUE = NULL;
2227 if (YY_G(yy_buffer_stack_top) > 0)
2228 --YY_G(yy_buffer_stack_top);
2230 if (YY_CURRENT_BUFFER) {
2231 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2232 YY_G(yy_did_buffer_switch_on_eof) = 1;
2239 /* Allocates the stack if it does not exist.
2240 * Guarantees space for at least one push.
2243 static void yyensure_buffer_stack YYFARGS0(void)
2246 void yyFlexLexer::yyensure_buffer_stack(void)
2250 M4_YY_DECL_GUTS_VAR();
2252 if (!YY_G(yy_buffer_stack)) {
2254 /* First allocation is just for 2 elements, since we don't know if this
2255 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2256 * immediate realloc on the next call.
2259 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2260 (num_to_alloc * sizeof(struct yy_buffer_state*)
2261 M4_YY_CALL_LAST_ARG);
2262 if ( ! YY_G(yy_buffer_stack) )
2263 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2266 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2268 YY_G(yy_buffer_stack_max) = num_to_alloc;
2269 YY_G(yy_buffer_stack_top) = 0;
2273 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2275 /* Increase the buffer to prepare for a possible push. */
2276 int grow_size = 8 /* arbitrary grow size */;
2278 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2279 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2280 (YY_G(yy_buffer_stack),
2281 num_to_alloc * sizeof(struct yy_buffer_state*)
2282 M4_YY_CALL_LAST_ARG);
2283 if ( ! YY_G(yy_buffer_stack) )
2284 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2286 /* zero only the new slots.*/
2287 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2288 YY_G(yy_buffer_stack_max) = num_to_alloc;
2296 m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2299 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2300 * @param base the character buffer
2301 * @param size the size in bytes of the character buffer
2303 * @return the newly allocated buffer state object.
2305 YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2308 m4_dnl M4_YY_DECL_GUTS_VAR();
2311 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2312 base[size-1] != YY_END_OF_BUFFER_CHAR )
2313 /* They forgot to leave room for the EOB's. */
2316 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2318 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2320 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2321 b->yy_buf_pos = b->yy_ch_buf = base;
2322 b->yy_is_our_buffer = 0;
2323 b->yy_input_file = 0;
2324 b->yy_n_chars = b->yy_buf_size;
2325 b->yy_is_interactive = 0;
2327 b->yy_fill_buffer = 0;
2328 b->yy_buffer_status = YY_BUFFER_NEW;
2330 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2338 m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2341 /** Setup the input buffer state to scan a string. The next call to yylex() will
2342 * scan from a @e copy of @a str.
2343 * @param yystr a NUL-terminated string to scan
2345 * @return the newly allocated buffer state object.
2346 * @note If you want to scan bytes that may contain NUL values, then use
2347 * yy_scan_bytes() instead.
2349 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2351 m4_dnl M4_YY_DECL_GUTS_VAR();
2353 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2359 m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2362 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2363 * scan from a @e copy of @a bytes.
2364 * @param bytes the byte buffer to scan
2365 * @param len the number of bytes in the buffer pointed to by @a bytes.
2367 * @return the newly allocated buffer state object.
2369 YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, int ,_yybytes_len)
2375 m4_dnl M4_YY_DECL_GUTS_VAR();
2377 /* Get memory for full buffer, including space for trailing EOB's. */
2378 n = _yybytes_len + 2;
2379 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2381 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2383 for ( i = 0; i < _yybytes_len; ++i )
2384 buf[i] = yybytes[i];
2386 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2388 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2390 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2392 /* It's okay to grow etc. this buffer, and we should throw it
2393 * away when we're done.
2395 b->yy_is_our_buffer = 1;
2403 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2406 static void yy_push_state YYFARGS1( int ,_new_state)
2409 void yyFlexLexer::yy_push_state( int _new_state )
2412 M4_YY_DECL_GUTS_VAR();
2413 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2417 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2418 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2420 if ( ! YY_G(yy_start_stack) )
2421 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2424 YY_G(yy_start_stack) = (int *) yyrealloc(
2425 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2427 if ( ! YY_G(yy_start_stack) )
2428 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2431 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2438 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2441 static void yy_pop_state YYFARGS0(void)
2444 void yyFlexLexer::yy_pop_state()
2447 M4_YY_DECL_GUTS_VAR();
2448 if ( --YY_G(yy_start_stack_ptr) < 0 )
2449 YY_FATAL_ERROR( "start-condition stack underflow" );
2451 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2456 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2459 static int yy_top_state YYFARGS0(void)
2462 int yyFlexLexer::yy_top_state()
2465 M4_YY_DECL_GUTS_VAR();
2466 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2470 #ifndef YY_EXIT_FAILURE
2471 #define YY_EXIT_FAILURE 2
2475 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2477 m4_dnl M4_YY_DECL_GUTS_VAR();
2478 (void) fprintf( stderr, "%s\n", msg );
2479 exit( YY_EXIT_FAILURE );
2483 void yyFlexLexer::LexerError( yyconst char msg[] )
2485 M4_YY_DECL_GUTS_VAR();
2486 std::cerr << msg << std::endl;
2487 exit( YY_EXIT_FAILURE );
2491 /* Redefine yyless() so it works in section 3 code. */
2497 /* Undo effects of setting up yytext. */ \
2498 int yyless_macro_arg = (n); \
2499 YY_LESS_LINENO(yyless_macro_arg);\
2500 yytext[yyleng] = YY_G(yy_hold_char); \
2501 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2502 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2503 *YY_G(yy_c_buf_p) = '\0'; \
2504 yyleng = yyless_macro_arg; \
2510 /* Accessor methods (get/set functions) to struct members. */
2514 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2516 /** Get the user-defined data for this scanner.
2519 YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2521 M4_YY_DECL_GUTS_VAR();
2527 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2529 /** Get the current line number.
2532 int yyget_lineno YYFARGS0(void)
2534 M4_YY_DECL_GUTS_VAR();
2536 m4_ifdef( [[M4_YY_REENTRANT]],
2538 if (! YY_CURRENT_BUFFER)
2545 m4_ifdef( [[M4_YY_REENTRANT]],
2547 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2549 /** Get the current column number.
2552 int yyget_column YYFARGS0(void)
2554 M4_YY_DECL_GUTS_VAR();
2556 m4_ifdef( [[M4_YY_REENTRANT]],
2558 if (! YY_CURRENT_BUFFER)
2566 m4_ifdef( [[M4_YY_NO_GET_IN]],,
2568 /** Get the input stream.
2571 FILE *yyget_in YYFARGS0(void)
2573 M4_YY_DECL_GUTS_VAR();
2578 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2580 /** Get the output stream.
2583 FILE *yyget_out YYFARGS0(void)
2585 M4_YY_DECL_GUTS_VAR();
2590 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2592 /** Get the length of the current token.
2595 int yyget_leng YYFARGS0(void)
2597 M4_YY_DECL_GUTS_VAR();
2602 /** Get the current token.
2605 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2607 char *yyget_text YYFARGS0(void)
2609 M4_YY_DECL_GUTS_VAR();
2615 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2617 /** Set the user-defined data. This data is never touched by the scanner.
2618 * @param user_defined The data to be associated with this scanner.
2621 void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2623 M4_YY_DECL_GUTS_VAR();
2624 yyextra = user_defined ;
2629 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2631 /** Set the current line number.
2632 * @param _line_number
2635 void yyset_lineno YYFARGS1( int ,_line_number)
2637 M4_YY_DECL_GUTS_VAR();
2639 m4_ifdef( [[M4_YY_REENTRANT]],
2641 /* lineno is only valid if an input buffer exists. */
2642 if (! YY_CURRENT_BUFFER )
2643 yy_fatal_error( "yyset_lineno called with no buffer" M4_YY_CALL_LAST_ARG);
2645 yylineno = _line_number;
2649 m4_ifdef( [[M4_YY_REENTRANT]],
2651 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2653 /** Set the current column.
2654 * @param _line_number
2657 void yyset_column YYFARGS1( int , _column_no)
2659 M4_YY_DECL_GUTS_VAR();
2661 m4_ifdef( [[M4_YY_REENTRANT]],
2663 /* column is only valid if an input buffer exists. */
2664 if (! YY_CURRENT_BUFFER )
2665 yy_fatal_error( "yyset_column called with no buffer" M4_YY_CALL_LAST_ARG);
2667 yycolumn = _column_no;
2673 m4_ifdef( [[M4_YY_NO_SET_IN]],,
2675 /** Set the input stream. This does not discard the current
2677 * @param _in_str A readable stream.
2679 * @see yy_switch_to_buffer
2681 void yyset_in YYFARGS1( FILE * ,_in_str)
2683 M4_YY_DECL_GUTS_VAR();
2688 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2690 void yyset_out YYFARGS1( FILE * ,_out_str)
2692 M4_YY_DECL_GUTS_VAR();
2698 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2700 int yyget_debug YYFARGS0(void)
2702 M4_YY_DECL_GUTS_VAR();
2703 return yy_flex_debug;
2707 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2709 void yyset_debug YYFARGS1( int ,_bdebug)
2711 M4_YY_DECL_GUTS_VAR();
2712 yy_flex_debug = _bdebug ;
2718 /* Accessor methods for yylval and yylloc */
2721 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2723 YYSTYPE * yyget_lval YYFARGS0(void)
2725 M4_YY_DECL_GUTS_VAR();
2730 m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2732 void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2734 M4_YY_DECL_GUTS_VAR();
2735 yylval = yylval_param;
2739 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2741 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2743 YYLTYPE *yyget_lloc YYFARGS0(void)
2745 M4_YY_DECL_GUTS_VAR();
2750 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2752 void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2754 M4_YY_DECL_GUTS_VAR();
2755 yylloc = yylloc_param;
2763 /* User-visible API */
2765 /* yylex_init is special because it creates the scanner itself, so it is
2766 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2767 * That's why we explicitly handle the declaration, instead of using our macros.
2769 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2771 int yylex_init( ptr_yy_globals )
2772 yyscan_t* ptr_yy_globals;
2775 int yylex_init(yyscan_t* ptr_yy_globals)
2778 if (ptr_yy_globals == NULL){
2783 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2785 if (*ptr_yy_globals == NULL){
2790 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2791 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2793 return yy_init_globals ( *ptr_yy_globals );
2797 /* yylex_init_extra has the same functionality as yylex_init, but follows the
2798 * convention of taking the scanner as the last argument. Note however, that
2799 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2800 * is the reason, too, why this function also must handle its own declaration).
2801 * The user defined value in the first argument will be available to yyalloc in
2802 * the yyextra field.
2804 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2806 int yylex_init_extra( yy_user_defined, ptr_yy_globals )
2807 YY_EXTRA_TYPE yy_user_defined;
2808 yyscan_t* ptr_yy_globals;
2811 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2814 struct yyguts_t dummy_yyguts;
2816 yyset_extra (yy_user_defined, &dummy_yyguts);
2818 if (ptr_yy_globals == NULL){
2823 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2825 if (*ptr_yy_globals == NULL){
2830 /* By setting to 0xAA, we expose bugs in
2831 yy_init_globals. Leave at 0x00 for releases. */
2832 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2834 yyset_extra (yy_user_defined, *ptr_yy_globals);
2836 return yy_init_globals ( *ptr_yy_globals );
2843 static int yy_init_globals YYFARGS0(void)
2845 M4_YY_DECL_GUTS_VAR();
2846 /* Initialization is the same as for the non-reentrant scanner.
2847 * This function is called from yylex_destroy(), so don't allocate here.
2850 m4_ifdef( [[M4_YY_USE_LINENO]],
2852 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2854 /* We do not touch yylineno unless the option is enabled. */
2858 YY_G(yy_buffer_stack) = 0;
2859 YY_G(yy_buffer_stack_top) = 0;
2860 YY_G(yy_buffer_stack_max) = 0;
2861 YY_G(yy_c_buf_p) = (char *) 0;
2865 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2867 YY_G(yy_start_stack_ptr) = 0;
2868 YY_G(yy_start_stack_depth) = 0;
2869 YY_G(yy_start_stack) = NULL;
2872 m4_ifdef( [[M4_YY_USES_REJECT]],
2874 YY_G(yy_state_buf) = 0;
2875 YY_G(yy_state_ptr) = 0;
2876 YY_G(yy_full_match) = 0;
2880 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2882 YY_G(yytext_ptr) = 0;
2883 YY_G(yy_more_offset) = 0;
2884 YY_G(yy_prev_more_offset) = 0;
2887 /* Defined in main.c */
2896 /* For future reference: Set errno on error, since we are called by
2904 %if-c-only SNIP! this currently causes conflicts with the c++ scanner
2905 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2906 int yylex_destroy YYFARGS0(void)
2908 M4_YY_DECL_GUTS_VAR();
2910 /* Pop the buffer stack, destroying each element. */
2911 while(YY_CURRENT_BUFFER){
2912 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2913 YY_CURRENT_BUFFER_LVALUE = NULL;
2914 yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2917 /* Destroy the stack itself. */
2918 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2919 YY_G(yy_buffer_stack) = NULL;
2921 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2923 /* Destroy the start condition stack. */
2924 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2925 YY_G(yy_start_stack) = NULL;
2928 m4_ifdef( [[M4_YY_USES_REJECT]],
2930 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2931 YY_G(yy_state_buf) = NULL;
2934 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2935 * yylex() is called, initialization will occur. */
2936 yy_init_globals( M4_YY_CALL_ONLY_ARG);
2939 /* Destroy the main struct (reentrant only). */
2940 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2948 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2951 * Internal utility routines.
2955 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2958 static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2961 for ( i = 0; i < n; ++i )
2967 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2969 #ifdef YY_NEED_STRLEN
2970 static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2973 for ( n = 0; s[n]; ++n )
2981 m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
2983 void *yyalloc YYFARGS1( yy_size_t ,size)
2985 return (void *) malloc( size );
2989 m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
2991 void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
2993 /* The cast to (char *) in the following accommodates both
2994 * implementations that use char* generic pointers, and those
2995 * that use void* generic pointers. It works with the latter
2996 * because both ANSI C and C++ allow castless assignment from
2997 * any pointer type to void*, and deal with argument conversions
2998 * as though doing an assignment.
3000 return (void *) realloc( (char *) ptr, size );
3004 m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
3006 void yyfree YYFARGS1( void *,ptr)
3008 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3012 %if-tables-serialization definitions
3013 m4preproc_include(`tables_shared.c')
3015 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
3018 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3022 rd->bread += sizeof(flex_uint8_t);
3026 static int yytbl_read16 (void *v, struct yytbl_reader * rd)
3029 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3033 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3034 rd->bread += sizeof(flex_uint16_t);
3038 static int yytbl_read32 (void *v, struct yytbl_reader * rd)
3041 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3045 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3046 rd->bread += sizeof(flex_uint32_t);
3050 /** Read the header */
3051 static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3054 memset (th, 0, sizeof (struct yytbl_hdr));
3056 if (yytbl_read32 (&(th->th_magic), rd) != 0)
3059 if (th->th_magic != YYTBL_MAGIC){
3060 yy_fatal_error("bad magic number" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3064 if (yytbl_read32 (&(th->th_hsize), rd) != 0
3065 || yytbl_read32 (&(th->th_ssize), rd) != 0
3066 || yytbl_read16 (&(th->th_flags), rd) != 0)
3069 /* Sanity check on header size. Greater than 1k suggests some funny business. */
3070 if (th->th_hsize < 16 || th->th_hsize > 1024){
3071 yy_fatal_error("insane header size detected" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3075 /* Allocate enough space for the version and name fields */
3076 bytes = th->th_hsize - 14;
3077 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3078 if ( ! th->th_version )
3079 YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
3081 /* we read it all into th_version, and point th_name into that data */
3082 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
3084 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3085 th->th_version = NULL;
3091 th->th_name = th->th_version + strlen (th->th_version) + 1;
3095 /** lookup id in the dmap list.
3096 * @param dmap pointer to first element in list
3097 * @return NULL if not found.
3099 static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3103 if (dmap->dm_id == id)
3110 /** Read a table while mapping its contents to the local array.
3111 * @param dmap used to performing mapping
3112 * @return 0 on success
3114 static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3116 struct yytbl_data td;
3117 struct yytbl_dmap *transdmap=0;
3118 int len, i, rv, inner_loop_count;
3121 memset (&td, 0, sizeof (struct yytbl_data));
3123 if (yytbl_read16 (&td.td_id, rd) != 0
3124 || yytbl_read16 (&td.td_flags, rd) != 0
3125 || yytbl_read32 (&td.td_hilen, rd) != 0
3126 || yytbl_read32 (&td.td_lolen, rd) != 0)
3129 /* Lookup the map for the transition table so we have it in case we need it
3130 * inside the loop below. This scanner might not even have a transition
3131 * table, which is ok.
3133 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3135 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3136 yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3140 /* Allocate space for table.
3141 * The --full yy_transition table is a special case, since we
3142 * need the dmap.dm_sz entry to tell us the sizeof the individual
3148 if ((td.td_flags & YYTD_STRUCT))
3149 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3151 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3153 if(M4_YY_TABLES_VERIFY)
3154 /* We point to the array itself */
3157 /* We point to the address of a pointer. */
3158 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3160 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
3163 /* If it's a struct, we read 2 integers to get one element */
3164 if ((td.td_flags & YYTD_STRUCT) != 0)
3165 inner_loop_count = 2;
3167 inner_loop_count = 1;
3169 /* read and map each element.
3170 * This loop iterates once for each element of the td_data array.
3171 * Notice that we increment 'i' in the inner loop.
3173 len = yytbl_calc_total_len (&td);
3174 for (i = 0; i < len; ){
3178 /* This loop really executes exactly 1 or 2 times.
3179 * The second time is to handle the second member of the
3180 * YYTD_STRUCT for the yy_transition array.
3182 for (j = 0; j < inner_loop_count; j++, i++) {
3185 /* read into t32 no matter what the real size is. */
3190 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3191 case sizeof (flex_int32_t):
3192 rv = yytbl_read32 (&t32, rd);
3194 case sizeof (flex_int16_t):
3195 rv = yytbl_read16 (&t16, rd);
3198 case sizeof (flex_int8_t):
3199 rv = yytbl_read8 (&t8, rd);
3203 yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3210 /* copy into the deserialized array... */
3212 if ((td.td_flags & YYTD_STRUCT)) {
3213 /* t32 is the j'th member of a two-element struct. */
3216 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3217 : &(((struct yy_trans_info *) p)->yy_nxt);
3219 switch (dmap->dm_sz) {
3220 case sizeof (flex_int32_t):
3221 if (M4_YY_TABLES_VERIFY){
3222 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3223 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int32_t" M4_YY_CALL_LAST_ARG);
3225 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3227 case sizeof (flex_int16_t):
3228 if (M4_YY_TABLES_VERIFY ){
3229 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3230 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int16_t" M4_YY_CALL_LAST_ARG);
3232 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3234 case sizeof(flex_int8_t):
3235 if (M4_YY_TABLES_VERIFY ){
3236 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3237 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int8_t" M4_YY_CALL_LAST_ARG);
3239 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3242 yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3246 /* if we're done with j, increment p */
3248 p = (struct yy_trans_info *) p + 1;
3250 else if ((td.td_flags & YYTD_PTRANS)) {
3251 /* t32 is an index into the transition array. */
3252 struct yy_trans_info *v;
3256 yy_fatal_error("transition table not found" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3260 if( M4_YY_TABLES_VERIFY)
3261 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3263 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3265 if(M4_YY_TABLES_VERIFY ){
3266 if( ((struct yy_trans_info **) p)[0] != v)
3267 yy_fatal_error("tables verification failed at YYTD_PTRANS" M4_YY_CALL_LAST_ARG);
3269 ((struct yy_trans_info **) p)[0] = v;
3272 p = (struct yy_trans_info **) p + 1;
3275 /* t32 is a plain int. copy data, then incrememnt p. */
3276 switch (dmap->dm_sz) {
3277 case sizeof (flex_int32_t):
3278 if(M4_YY_TABLES_VERIFY ){
3279 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3280 yy_fatal_error("tables verification failed at flex_int32_t" M4_YY_CALL_LAST_ARG);
3282 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3283 p = ((flex_int32_t *) p) + 1;
3285 case sizeof (flex_int16_t):
3286 if(M4_YY_TABLES_VERIFY ){
3287 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3288 yy_fatal_error("tables verification failed at flex_int16_t" M4_YY_CALL_LAST_ARG);
3290 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3291 p = ((flex_int16_t *) p) + 1;
3293 case sizeof (flex_int8_t):
3294 if(M4_YY_TABLES_VERIFY ){
3295 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3296 yy_fatal_error("tables verification failed at flex_int8_t" M4_YY_CALL_LAST_ARG);
3298 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3299 p = ((flex_int8_t *) p) + 1;
3302 yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3310 /* Now eat padding. */
3313 pad = yypad64(rd->bread);
3316 if(yytbl_read8(&t8,rd) != 0)
3324 %define-yytables The name for this specific scanner's tables.
3326 /* Find the key and load the DFA tables from the given stream. */
3327 static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3330 struct yytbl_hdr th;
3331 struct yytbl_reader rd;
3334 th.th_version = NULL;
3336 /* Keep trying until we find the right set of tables or end of file. */
3337 while (!feof(rd.fp)) {
3339 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3344 /* A NULL key means choose the first set of tables. */
3348 if (strcmp(th.th_name,key) != 0){
3349 /* Skip ahead to next set */
3350 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3351 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3352 th.th_version = NULL;
3358 while (rd.bread < th.th_ssize){
3359 /* Load the data tables */
3360 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3368 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3369 th.th_version = NULL;
3375 /** Load the DFA tables for this scanner from the given stream. */
3376 int yytables_fload YYFARGS1(FILE *, fp)
3379 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3384 /** Destroy the loaded tables, freeing memory, etc.. */
3385 int yytables_destroy YYFARGS0(void)
3387 struct yytbl_dmap *dmap=0;
3389 if(!M4_YY_TABLES_VERIFY){
3390 /* Walk the dmap, freeing the pointers */
3391 for(dmap=yydmap; dmap->dm_id; dmap++) {
3394 if(v && *(char**)v){
3395 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3404 /* end table serialization code definitions */
3408 m4_ifdef([[M4_YY_MAIN]], [[
3409 int main M4_YY_PARAMS(void);
3418 yylex_destroy( lexer);
3430 m4_ifdef( [[M4_YY_IN_HEADER]],
3433 #undef YY_FLUSH_BUFFER
3435 #undef yy_new_buffer
3436 #undef yy_set_interactive
3437 #undef YY_DO_BEFORE_ACTION
3439 #ifdef YY_DECL_IS_OURS
3440 #undef YY_DECL_IS_OURS