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"
229 /* end standard C++ headers. */
234 /* The "const" storage-class-modifier is valid. */
237 #else /* ! __cplusplus */
239 /* C99 requires __STDC__ to be defined as 1. */
240 #if defined (__STDC__)
244 #endif /* defined (__STDC__) */
245 #endif /* ! __cplusplus */
248 #define yyconst const
253 %# For compilers that can not handle prototypes.
255 %# The function prototype
256 %# int foo(int x, char* y);
258 %# ...should be written as
259 %# int foo M4_YY_PARAMS(int x, char* y);
261 %# ...which could possibly generate
264 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
266 m4_define( [[M4_YY_PARAMS]], [[()]])
269 m4_define( [[M4_YY_PARAMS]], [[($*)]])
273 /* Returned upon end-of-file. */
278 /* Promotes a possibly negative, possibly signed char to an unsigned
279 * integer for use as an array index. If the signed char is negative,
280 * we want to instead treat it as an 8-bit unsigned char, hence the
283 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
290 /* An opaque pointer. */
291 #ifndef YY_TYPEDEF_YY_SCANNER_T
292 #define YY_TYPEDEF_YY_SCANNER_T
293 typedef void* yyscan_t;
296 %# Declare yyguts variable
297 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
298 %# Perform a noop access on yyguts to prevent unused variable complains
299 m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])
300 %# For use wherever a Global is accessed or assigned.
301 m4_define( [[YY_G]], [[yyg->$1]])
303 %# For use in function prototypes to append the additional argument.
304 m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
305 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
307 %# For use in function definitions to append the additional argument.
308 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
310 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
311 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
314 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
315 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
317 m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
319 %# For use in function calls to pass the additional argument.
320 m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
321 m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
323 %# For use in function documentation to adjust for additional argument.
324 m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
326 /* For convenience, these vars (plus the bison vars far below)
327 are macros in the reentrant scanner. */
328 #define yyin YY_G(yyin_r)
329 #define yyout YY_G(yyout_r)
330 #define yyextra YY_G(yyextra_r)
331 #define yyleng YY_G(yyleng_r)
332 #define yytext YY_G(yytext_r)
333 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
334 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
335 #define yy_flex_debug YY_G(yy_flex_debug_r)
337 m4_define( [[M4_YY_INCR_LINENO]],
350 m4_define( [[M4_YY_INCR_LINENO]],
355 %# Define these macros to be no-ops.
356 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
357 m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])
358 m4_define( [[YY_G]], [[($1)]])
359 m4_define( [[M4_YY_PROTO_LAST_ARG]])
360 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
361 m4_define( [[M4_YY_DEF_LAST_ARG]])
363 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
365 m4_define( [[M4_YY_DEF_ONLY_ARG]])
368 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
370 m4_define([[M4_YY_DECL_LAST_ARG]])
371 m4_define([[M4_YY_CALL_LAST_ARG]])
372 m4_define([[M4_YY_CALL_ONLY_ARG]])
373 m4_define( [[M4_YY_DOC_PARAM]], [[]])
378 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
380 %# For compilers that need traditional function definitions.
382 %# The function prototype taking 2 arguments
383 %# int foo (int x, char* y)
385 %# ...should be written as
386 %# int foo YYFARGS2(int,x, char*,y)
388 %# ...which could possibly generate
389 %# int foo (x,y,yyscanner)
392 %# yyscan_t yyscanner;
394 %# Generate traditional function defs
395 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
396 M4_YY_DECL_LAST_ARG]])
397 m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
399 M4_YY_DECL_LAST_ARG]])
400 m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
403 M4_YY_DECL_LAST_ARG]])
404 m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
408 M4_YY_DECL_LAST_ARG]])
411 %# Generate C99 function defs.
412 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
413 m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
414 m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
415 m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
418 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
420 /* Enter a start condition. This macro really ought to take a parameter,
421 * but we do it the disgusting crufty way forced on us by the ()-less
422 * definition of BEGIN.
424 #define BEGIN YY_G(yy_start) = 1 + 2 *
427 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
429 /* Translate the current start state into a value that can be later handed
430 * to BEGIN to return to the state. The YYSTATE alias is for lex
433 #define YY_START ((YY_G(yy_start) - 1) / 2)
434 #define YYSTATE YY_START
437 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
439 /* Action number for EOF rule of a given start state. */
440 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
443 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
445 /* Special action meaning "start processing a new file". */
446 #define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
449 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
451 #define YY_END_OF_BUFFER_CHAR 0
454 /* Size of default input buffer. */
456 #define YY_BUF_SIZE 16384
459 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
461 /* The state buf must be large enough to hold one state per character in the main buffer.
463 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
467 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
468 #define YY_TYPEDEF_YY_BUFFER_STATE
469 typedef struct yy_buffer_state *YY_BUFFER_STATE;
472 #ifndef YY_TYPEDEF_YY_SIZE_T
473 #define YY_TYPEDEF_YY_SIZE_T
474 typedef size_t yy_size_t;
478 extern yy_size_t yyleng;
483 extern FILE *yyin, *yyout;
487 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
489 #define EOB_ACT_CONTINUE_SCAN 0
490 #define EOB_ACT_END_OF_FILE 1
491 #define EOB_ACT_LAST_MATCH 2
494 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
496 m4_ifdef( [[M4_YY_USE_LINENO]],
498 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
499 * access to the local variable yy_act. Since yyless() is a macro, it would break
500 * existing scanners that call yyless() from OUTSIDE yylex.
501 * One obvious solution it to make yy_act a global. I tried that, and saw
502 * a 5% performance hit in a non-yylineno scanner, because yy_act is
503 * normally declared as a register variable-- so it is not worth it.
505 #define YY_LESS_LINENO(n) \
508 for ( yyl = n; yyl < yyleng; ++yyl )\
509 if ( yytext[yyl] == '\n' )\
512 #define YY_LINENO_REWIND_TO(dst) \
515 for ( p = yy_cp-1; p >= (dst); --p)\
521 #define YY_LESS_LINENO(n)
522 #define YY_LINENO_REWIND_TO(ptr)
526 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
528 /* Return all but the first "n" matched characters back to the input stream. */
532 /* Undo effects of setting up yytext. */ \
533 int yyless_macro_arg = (n); \
534 YY_LESS_LINENO(yyless_macro_arg);\
535 *yy_cp = YY_G(yy_hold_char); \
536 YY_RESTORE_YY_MORE_OFFSET \
537 YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
538 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
543 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
545 #define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
548 #ifndef YY_STRUCT_YY_BUFFER_STATE
549 #define YY_STRUCT_YY_BUFFER_STATE
550 struct yy_buffer_state
557 std::istream* yy_input_file;
561 char *yy_ch_buf; /* input buffer */
562 char *yy_buf_pos; /* current position in input buffer */
564 /* Size of input buffer in bytes, not including room for EOB
567 yy_size_t yy_buf_size;
569 /* Number of characters read into yy_ch_buf, not including EOB
572 yy_size_t yy_n_chars;
574 /* Whether we "own" the buffer - i.e., we know we created it,
575 * and can realloc() it to grow it, and should free() it to
578 int yy_is_our_buffer;
580 /* Whether this is an "interactive" input source; if so, and
581 * if we're using stdio for input, then we want to use getc()
582 * instead of fread(), to make sure we stop fetching input after
585 int yy_is_interactive;
587 /* Whether we're considered to be at the beginning of a line.
588 * If so, '^' rules will be active on the next match, otherwise
593 int yy_bs_lineno; /**< The line count. */
594 int yy_bs_column; /**< The column count. */
597 /* Whether to try to fill the input buffer when we reach the
602 int yy_buffer_status;
603 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
605 #define YY_BUFFER_NEW 0
606 #define YY_BUFFER_NORMAL 1
607 /* When an EOF's been seen but there's still some text to process
608 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
609 * shouldn't try reading from the input source any more. We might
610 * still have a bunch of tokens to match, though, because of
611 * possible backing-up.
613 * When we actually see the EOF, we change the status to "new"
614 * (via yyrestart()), so that the user can continue scanning by
615 * just pointing yyin at a new input file.
617 #define YY_BUFFER_EOF_PENDING 2
620 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
622 %if-c-only Standard (non-C++) definition
626 /* Stack of input buffers. */
627 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
628 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
629 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
634 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
636 /* We provide macros for accessing buffer states in case in the
637 * future we want to put the buffer states in a more general
640 * Returns the top of the stack, or NULL.
642 #define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
643 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
647 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
649 /* Same as previous macro, but useful when we know that the buffer stack is not
650 * NULL or when we need an lvalue. For internal use only.
652 #define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
655 %if-c-only Standard (non-C++) definition
659 /* yy_hold_char holds the character lost when yytext is formed. */
660 static char yy_hold_char;
661 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
664 /* Points to current character in buffer. */
665 static char *yy_c_buf_p = (char *) 0;
666 static int yy_init = 0; /* whether we need to initialize */
667 static int yy_start = 0; /* start state number */
669 /* Flag which is used to allow yywrap()'s to do buffer switches
670 * instead of setting up a fresh yyin. A bit of a hack ...
672 static int yy_did_buffer_switch_on_eof;
676 void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
677 void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
678 YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
679 void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
680 void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
681 void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
682 void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
684 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
686 static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
687 static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
688 static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
691 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
693 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
696 YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
697 YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
698 YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );
702 void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
703 void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
704 void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
706 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
708 #define yy_new_buffer yy_create_buffer
711 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
713 #define yy_set_interactive(is_interactive) \
715 if ( ! YY_CURRENT_BUFFER ){ \
716 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
717 YY_CURRENT_BUFFER_LVALUE = \
718 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
720 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
724 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
726 #define yy_set_bol(at_bol) \
728 if ( ! YY_CURRENT_BUFFER ){\
729 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
730 YY_CURRENT_BUFFER_LVALUE = \
731 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
733 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
737 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
739 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
742 %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
744 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
749 %if-c-only Standard (non-C++) definition
751 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
753 static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
754 static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
755 static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
756 #if defined(__GNUC__) && __GNUC__ >= 3
757 __attribute__((__noreturn__))
759 static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
764 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
766 /* Done after the current pattern has been matched and before the
767 * corresponding action - sets up yytext.
769 #define YY_DO_BEFORE_ACTION \
770 YY_G(yytext_ptr) = yy_bp; \
771 %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
772 YY_G(yy_hold_char) = *yy_cp; \
774 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
775 YY_G(yy_c_buf_p) = yy_cp;
778 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
780 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
783 m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
785 m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
787 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
789 #ifndef YY_NO_UNISTD_H
790 /* Special case for "unistd.h", since it is non-ANSI. We include it way
791 * down here because we want the user's section 1 to have been scanned first.
792 * The user has a chance to override it with an option.
803 m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
805 #define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
808 #ifndef YY_EXTRA_TYPE
809 #define YY_EXTRA_TYPE void *
814 %if-c-only Reentrant structure and macros (non-C++).
817 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
819 /* Holds the entire state of the reentrant scanner. */
823 /* User-defined. Not touched by flex. */
824 YY_EXTRA_TYPE yyextra_r;
826 /* The rest are the same as the globals declared in the non-reentrant scanner. */
827 FILE *yyin_r, *yyout_r;
828 size_t yy_buffer_stack_top; /**< index of top of stack. */
829 size_t yy_buffer_stack_max; /**< capacity of stack. */
830 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
832 yy_size_t yy_n_chars;
837 int yy_did_buffer_switch_on_eof;
838 int yy_start_stack_ptr;
839 int yy_start_stack_depth;
841 yy_state_type yy_last_accepting_state;
842 char* yy_last_accepting_cpos;
847 m4_ifdef( [[M4_YY_USES_REJECT]],
849 yy_state_type *yy_state_buf;
850 yy_state_type *yy_state_ptr;
854 /* These are only needed for trailing context rules,
855 * but there's no conditional variable for that yet. */
856 int yy_looking_for_trail_begin;
861 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
863 char yytext_r[YYLMAX];
866 int yy_prev_more_offset;
874 m4_ifdef( [[M4_YY_BISON_LVAL]],
879 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
884 }; /* end struct yyguts_t */
889 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
891 static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
897 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
899 m4_ifdef( [[M4_YY_BISON_LVAL]],
901 /* This must go here because YYSTYPE and YYLTYPE are included
902 * from bison output in section 1.*/
903 # define yylval YY_G(yylval_r)
906 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
908 # define yylloc YY_G(yylloc_r)
912 int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
914 int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
918 %endif End reentrant structures and macros.
920 /* Accessor methods to globals.
921 These are made visible to non-reentrant scanners for convenience. */
923 m4_ifdef( [[M4_YY_NO_DESTROY]],,
925 int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
928 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
930 int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
933 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
935 void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
938 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
940 YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
943 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
945 void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
948 m4_ifdef( [[M4_YY_NO_GET_IN]],,
950 FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
953 m4_ifdef( [[M4_YY_NO_SET_IN]],,
955 void yyset_in M4_YY_PARAMS( FILE * _in_str M4_YY_PROTO_LAST_ARG );
958 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
960 FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
963 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
965 void yyset_out M4_YY_PARAMS( FILE * _out_str M4_YY_PROTO_LAST_ARG );
968 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
970 yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
973 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
975 char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
978 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
980 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
983 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
985 void yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );
988 m4_ifdef( [[M4_YY_REENTRANT]],
990 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
992 int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
996 m4_ifdef( [[M4_YY_REENTRANT]],
998 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
1000 void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );
1005 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
1007 YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1010 void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
1012 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1014 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
1016 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1019 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
1021 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
1026 /* Macros after this point can all be overridden by user definitions in
1030 #ifndef YY_SKIP_YYWRAP
1032 extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1034 extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1040 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1042 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
1049 static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1052 #ifdef YY_NEED_STRLEN
1053 static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1057 %if-c-only Standard (non-C++) definition
1060 static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1062 static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1070 %# TODO: This is messy.
1071 m4_ifdef( [[M4_YY_STACK_USED]],
1074 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1076 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1078 static int yy_start_stack_ptr = 0;
1079 static int yy_start_stack_depth = 0;
1080 static int *yy_start_stack = NULL;
1084 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1086 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1088 static void yy_push_state M4_YY_PARAMS( int _new_state M4_YY_PROTO_LAST_ARG);
1090 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1092 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1094 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1096 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1102 m4_define( [[M4_YY_NO_PUSH_STATE]])
1103 m4_define( [[M4_YY_NO_POP_STATE]])
1104 m4_define( [[M4_YY_NO_TOP_STATE]])
1108 /* Amount of stuff to slurp up with each read. */
1109 #ifndef YY_READ_BUF_SIZE
1110 #define YY_READ_BUF_SIZE 8192
1113 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1115 /* Copy whatever the last rule matched to the standard output. */
1117 %if-c-only Standard (non-C++) definition
1118 /* This used to be an fputs(), but since the string might contain NUL's,
1119 * we now use fwrite().
1121 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
1123 %if-c++-only C++ definition
1124 #define ECHO LexerOutput( yytext, yyleng )
1129 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1131 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1132 * is returned in "result".
1135 #define YY_INPUT(buf,result,max_size) \
1136 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1138 %if-c++-only C++ definition \
1139 if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
1140 YY_FATAL_ERROR( "input in flex scanner failed" );
1146 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1148 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1149 * we don't want an extra ';' after the "return" because that will cause
1150 * some compilers to complain about unreachable statements.
1153 #define yyterminate() return YY_NULL
1157 /* Number of entries by which start-condition stack grows. */
1158 #ifndef YY_START_STACK_INCR
1159 #define YY_START_STACK_INCR 25
1162 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1164 /* Report a fatal error. */
1165 #ifndef YY_FATAL_ERROR
1167 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1170 #define YY_FATAL_ERROR(msg) LexerError( msg )
1175 %if-tables-serialization structures and prototypes
1176 m4preproc_include(`tables_shared.h')
1178 /* Load the DFA tables from the given stream. */
1179 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1181 /* Unload the tables from memory. */
1182 int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1185 /** Describes a mapping from a serialized table id to its deserialized state in
1186 * this scanner. This is the bridge between our "generic" deserialization code
1187 * and the specifics of this scanner.
1190 enum yytbl_id dm_id;/**< table identifier */
1191 void **dm_arr; /**< address of pointer to store the deserialized table. */
1192 size_t dm_sz; /**< local sizeof() each element in table. */
1195 /** A {0,0,0}-terminated list of structs, forming the map */
1196 static struct yytbl_dmap yydmap[] =
1198 %tables-yydmap generated elements
1202 /** A tables-reader object to maintain some state in the read. */
1203 struct yytbl_reader {
1204 FILE * fp; /**< input stream */
1205 flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1209 /* end tables serialization structures and prototypes */
1213 /* Default declaration of generated scanner - a define so the user can
1214 * easily add parameters.
1217 #define YY_DECL_IS_OURS 1
1218 %if-c-only Standard (non-C++) definition
1221 m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1222 m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1224 m4_ifdef( [[M4_YY_BISON_LVAL]],
1226 m4_dnl The bison pure parser is used. Redefine yylex to
1227 m4_dnl accept the lval parameter.
1229 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1230 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1231 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1232 [[YYFARGS1(YYSTYPE *,yylval_param)]])
1235 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1237 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
1239 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1240 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1241 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1242 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1245 extern int yylex M4_YY_LEX_PROTO;
1247 #define YY_DECL int yylex M4_YY_LEX_DECLARATION
1249 %if-c++-only C++ definition
1250 #define YY_DECL int yyFlexLexer::yylex()
1252 #endif /* !YY_DECL */
1254 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1256 /* Code executed at the beginning of each rule, after yytext and yyleng
1259 #ifndef YY_USER_ACTION
1260 #define YY_USER_ACTION
1264 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1266 /* Code executed at the end of each rule. */
1268 #define YY_BREAK /*LINTED*/break;
1272 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1274 %% [6.0] YY_RULE_SETUP definition goes here
1278 /** The main scanner function which does all the work.
1282 register yy_state_type yy_current_state;
1283 register char *yy_cp, *yy_bp;
1284 register int yy_act;
1285 M4_YY_DECL_GUTS_VAR();
1287 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1289 m4_ifdef( [[M4_YY_BISON_LVAL]],
1293 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1299 m4_ifdef( [[M4_YY_BISON_LVAL]],
1301 yylval = yylval_param;
1304 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1306 yylloc = yylloc_param;
1309 if ( !YY_G(yy_init) )
1317 m4_ifdef( [[M4_YY_USES_REJECT]],
1319 /* Create the reject buffer large enough to save one state per allowed character. */
1320 if ( ! YY_G(yy_state_buf) )
1321 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
1322 if ( ! YY_G(yy_state_buf) )
1323 YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1326 if ( ! YY_G(yy_start) )
1327 YY_G(yy_start) = 1; /* first start state */
1342 yyout = & std::cout;
1345 if ( ! YY_CURRENT_BUFFER ) {
1346 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1347 YY_CURRENT_BUFFER_LVALUE =
1348 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1351 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1355 %% [7.0] user's declarations go here
1357 while (/*CONSTCOND*/ 1 ) /* loops until end-of-file is reached */
1359 %% [8.0] yymore()-related code goes here
1360 yy_cp = YY_G(yy_c_buf_p);
1362 /* Support of yytext. */
1363 *yy_cp = YY_G(yy_hold_char);
1365 /* yy_bp points to the position in yy_ch_buf of the start of
1370 %% [9.0] code to set up and find next match goes here
1373 %% [10.0] code to find the action number goes here
1375 YY_DO_BEFORE_ACTION;
1377 %% [11.0] code for yylineno update goes here
1379 do_action: /* This label is used only to access EOF actions. */
1381 %% [12.0] debug code goes here
1384 { /* beginning of action switch */
1385 %% [13.0] actions go here
1387 case YY_END_OF_BUFFER:
1389 /* Amount of text matched not including the EOB char. */
1390 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1392 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1393 *yy_cp = YY_G(yy_hold_char);
1394 YY_RESTORE_YY_MORE_OFFSET
1396 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1398 /* We're scanning a new file or input source. It's
1399 * possible that this happened because the user
1400 * just pointed yyin at a new source and called
1401 * yylex(). If so, then we have to assure
1402 * consistency between YY_CURRENT_BUFFER and our
1403 * globals. Here is the right place to do so, because
1404 * this is the first action (other than possibly a
1405 * back-up) that will match for the new input source.
1407 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1408 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1409 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1412 /* Note that here we test for yy_c_buf_p "<=" to the position
1413 * of the first EOB in the buffer, since yy_c_buf_p will
1414 * already have been incremented past the NUL character
1415 * (since all states make transitions on EOB to the
1416 * end-of-buffer state). Contrast this with the test
1419 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1420 { /* This was really a NUL. */
1421 yy_state_type yy_next_state;
1423 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1425 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1427 /* Okay, we're now positioned to make the NUL
1428 * transition. We couldn't have
1429 * yy_get_previous_state() go ahead and do it
1430 * for us because it doesn't know how to deal
1431 * with the possibility of jamming (and we don't
1432 * want to build jamming into it because then it
1433 * will run more slowly).
1436 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1438 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1440 if ( yy_next_state )
1442 /* Consume the NUL. */
1443 yy_cp = ++YY_G(yy_c_buf_p);
1444 yy_current_state = yy_next_state;
1450 %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1451 goto yy_find_action;
1455 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1457 case EOB_ACT_END_OF_FILE:
1459 YY_G(yy_did_buffer_switch_on_eof) = 0;
1461 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1463 /* Note: because we've taken care in
1464 * yy_get_next_buffer() to have set up
1465 * yytext, we can now set up
1466 * yy_c_buf_p so that if some total
1467 * hoser (like flex itself) wants to
1468 * call the scanner after we return the
1469 * YY_NULL, it'll still work - another
1470 * YY_NULL will get returned.
1472 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1474 yy_act = YY_STATE_EOF(YY_START);
1480 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1486 case EOB_ACT_CONTINUE_SCAN:
1488 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1490 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1492 yy_cp = YY_G(yy_c_buf_p);
1493 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1496 case EOB_ACT_LAST_MATCH:
1498 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1500 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1502 yy_cp = YY_G(yy_c_buf_p);
1503 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1504 goto yy_find_action;
1511 "fatal flex scanner internal error--no action found" );
1512 } /* end of action switch */
1513 } /* end of scanning one token */
1514 } /* end of user's declarations */
1515 } /* end of yylex */
1520 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1522 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1530 yylineno = 1; // this will only get updated if %option yylineno
1532 yy_did_buffer_switch_on_eof = 0;
1534 yy_looking_for_trail_begin = 0;
1537 yy_more_offset = yy_prev_more_offset = 0;
1539 yy_start_stack_ptr = yy_start_stack_depth = 0;
1540 yy_start_stack = NULL;
1542 yy_buffer_stack = 0;
1543 yy_buffer_stack_top = 0;
1544 yy_buffer_stack_max = 0;
1547 m4_ifdef( [[M4_YY_USES_REJECT]],
1549 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1556 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1558 yyFlexLexer::~yyFlexLexer()
1560 delete [] yy_state_buf;
1561 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1562 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1563 yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
1566 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1568 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1572 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1573 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1580 #ifdef YY_INTERACTIVE
1581 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1583 int yyFlexLexer::LexerInput( char* buf, int max_size )
1586 if ( yyin->eof() || yyin->fail() )
1589 #ifdef YY_INTERACTIVE
1590 yyin->get( buf[0] );
1601 (void) yyin->read( buf, max_size );
1606 return yyin->gcount();
1610 void yyFlexLexer::LexerOutput( const char* buf, int size )
1612 (void) yyout->write( buf, size );
1617 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1619 /* yy_get_next_buffer - try to read in a new buffer
1621 * Returns a code representing an action:
1622 * EOB_ACT_LAST_MATCH -
1623 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1624 * EOB_ACT_END_OF_FILE - end of file
1627 static int yy_get_next_buffer YYFARGS0(void)
1630 int yyFlexLexer::yy_get_next_buffer()
1633 M4_YY_DECL_GUTS_VAR();
1634 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1635 register char *source = YY_G(yytext_ptr);
1636 register yy_size_t number_to_move, i;
1639 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1641 "fatal flex scanner internal error--end of buffer missed" );
1643 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1644 { /* Don't try to fill the buffer, so this is an EOF. */
1645 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1647 /* We matched a single character, the EOB, so
1648 * treat this as a final EOF.
1650 return EOB_ACT_END_OF_FILE;
1655 /* We matched some text prior to the EOB, first
1658 return EOB_ACT_LAST_MATCH;
1662 /* Try to read more data. */
1664 /* First move last chars to start of buffer. */
1665 number_to_move = (yy_size_t)((YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1);
1667 for ( i = 0; i < number_to_move; ++i )
1668 *(dest++) = *(source++);
1670 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1671 /* don't do the read, it's not guaranteed to return an EOF,
1674 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1678 yy_size_t num_to_read =
1679 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1681 while ( num_to_read <= 0 )
1682 { /* Not enough room in the buffer - grow it. */
1683 m4_ifdef( [[M4_YY_USES_REJECT]],
1686 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1689 /* just a shorter name for the current buffer */
1690 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1692 int yy_c_buf_p_offset =
1693 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1695 if ( b->yy_is_our_buffer )
1697 yy_size_t new_size = b->yy_buf_size * 2;
1699 if ( new_size <= 0 )
1700 b->yy_buf_size += b->yy_buf_size / 8;
1702 b->yy_buf_size *= 2;
1704 b->yy_ch_buf = (char *)
1705 /* Include room in for 2 EOB chars. */
1706 yyrealloc( (void *) b->yy_ch_buf,
1707 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1710 /* Can't grow it, we don't own it. */
1713 if ( ! b->yy_ch_buf )
1715 "fatal error - scanner input buffer overflow" );
1717 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1719 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1724 if ( num_to_read > YY_READ_BUF_SIZE )
1725 num_to_read = YY_READ_BUF_SIZE;
1727 /* Read in more data. */
1728 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1729 YY_G(yy_n_chars), num_to_read );
1731 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1734 if ( YY_G(yy_n_chars) == 0 )
1736 if ( number_to_move == YY_MORE_ADJ )
1738 ret_val = EOB_ACT_END_OF_FILE;
1739 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1744 ret_val = EOB_ACT_LAST_MATCH;
1745 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1746 YY_BUFFER_EOF_PENDING;
1751 ret_val = EOB_ACT_CONTINUE_SCAN;
1753 if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1754 /* Extend the array by 50%, plus the number we really need. */
1755 yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
1756 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1757 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
1758 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1759 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1762 YY_G(yy_n_chars) += number_to_move;
1763 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1764 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1766 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1772 /* yy_get_previous_state - get the state just before the EOB char was reached */
1776 static yy_state_type yy_get_previous_state YYFARGS0(void)
1779 yy_state_type yyFlexLexer::yy_get_previous_state()
1782 register yy_state_type yy_current_state;
1783 register char *yy_cp;
1784 M4_YY_DECL_GUTS_VAR();
1786 %% [15.0] code to get the start state into yy_current_state goes here
1788 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1790 %% [16.0] code to find the next state goes here
1793 return yy_current_state;
1797 /* yy_try_NUL_trans - try to make a transition on the NUL character
1800 * next_state = yy_try_NUL_trans( current_state );
1803 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1806 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1809 register int yy_is_jam;
1810 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1811 %% [17.0] code to find the next state, and perhaps do backing up, goes here
1813 M4_YY_NOOP_GUTS_VAR();
1814 return yy_is_jam ? 0 : yy_current_state;
1820 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1822 static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1825 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1828 register char *yy_cp;
1829 M4_YY_DECL_GUTS_VAR();
1831 yy_cp = YY_G(yy_c_buf_p);
1833 /* undo effects of setting up yytext */
1834 *yy_cp = YY_G(yy_hold_char);
1836 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1837 { /* need to shift things up to make room */
1838 /* +2 for EOB chars. */
1839 register yy_size_t number_to_move = YY_G(yy_n_chars) + 2;
1840 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1841 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1842 register char *source =
1843 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1845 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1846 *--dest = *--source;
1848 yy_cp += (int) (dest - source);
1849 yy_bp += (int) (dest - source);
1850 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1851 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1853 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1854 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1857 *--yy_cp = (char) c;
1859 %% [18.0] update yylineno here
1860 m4_ifdef( [[M4_YY_USE_LINENO]],
1867 YY_G(yytext_ptr) = yy_bp;
1868 YY_G(yy_hold_char) = *yy_cp;
1869 YY_G(yy_c_buf_p) = yy_cp;
1879 static int yyinput YYFARGS0(void)
1881 static int input YYFARGS0(void)
1886 int yyFlexLexer::yyinput()
1890 M4_YY_DECL_GUTS_VAR();
1892 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1894 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1896 /* yy_c_buf_p now points to the character we want to return.
1897 * If this occurs *before* the EOB characters, then it's a
1898 * valid NUL; if not, then we've hit the end of the buffer.
1900 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1901 /* This was really a NUL. */
1902 *YY_G(yy_c_buf_p) = '\0';
1905 { /* need more input */
1906 yy_size_t offset = (yy_size_t)
1907 (YY_G(yy_c_buf_p) - YY_G(yytext_ptr));
1910 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1912 case EOB_ACT_LAST_MATCH:
1913 /* This happens because yy_g_n_b()
1914 * sees that we've accumulated a
1915 * token and flags that we need to
1916 * try matching the token before
1917 * proceeding. But for input(),
1918 * there's no matching to consider.
1919 * So convert the EOB_ACT_LAST_MATCH
1920 * to EOB_ACT_END_OF_FILE.
1923 /* Reset buffer status. */
1924 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1928 case EOB_ACT_END_OF_FILE:
1930 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1933 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1936 return yyinput(M4_YY_CALL_ONLY_ARG);
1938 return input(M4_YY_CALL_ONLY_ARG);
1942 case EOB_ACT_CONTINUE_SCAN:
1943 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1949 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
1950 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
1951 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1953 %% [19.0] update BOL and yylineno
1958 #endif /* ifndef YY_NO_INPUT */
1961 /** Immediately switch to a different input stream.
1962 * @param input_file A readable stream.
1964 * @note This function does not reset the start condition to @c INITIAL .
1967 void yyrestart YYFARGS1( FILE *,input_file)
1970 void yyFlexLexer::yyrestart( std::istream* input_file )
1973 M4_YY_DECL_GUTS_VAR();
1975 if ( ! YY_CURRENT_BUFFER ){
1976 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1977 YY_CURRENT_BUFFER_LVALUE =
1978 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1981 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1982 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1985 /** Switch to a different input buffer.
1986 * @param new_buffer The new input buffer.
1990 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1993 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1996 M4_YY_DECL_GUTS_VAR();
1998 /* TODO. We should be able to replace this entire function body
2000 * yypop_buffer_state();
2001 * yypush_buffer_state(new_buffer);
2003 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
2004 if ( YY_CURRENT_BUFFER == new_buffer )
2007 if ( YY_CURRENT_BUFFER )
2009 /* Flush out information for old buffer. */
2010 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2011 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2012 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2015 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2016 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2018 /* We don't actually know whether we did this switch during
2019 * EOF (yywrap()) processing, but the only time this flag
2020 * is looked at is after yywrap() is called, so it's safe
2021 * to go ahead and always set it.
2023 YY_G(yy_did_buffer_switch_on_eof) = 1;
2028 static void yy_load_buffer_state YYFARGS0(void)
2031 void yyFlexLexer::yy_load_buffer_state()
2034 M4_YY_DECL_GUTS_VAR();
2035 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2036 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2037 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2038 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
2041 /** Allocate and initialize an input buffer state.
2042 * @param file A readable stream.
2043 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2045 * @return the allocated buffer state.
2048 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
2051 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2055 m4_dnl M4_YY_DECL_GUTS_VAR();
2057 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2059 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2061 b->yy_buf_size = (yy_size_t)size;
2063 /* yy_ch_buf has to be 2 characters longer than the size given because
2064 * we need to put in 2 end-of-buffer characters.
2066 b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
2067 if ( ! b->yy_ch_buf )
2068 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2070 b->yy_is_our_buffer = 1;
2072 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2077 /** Destroy the buffer.
2078 * @param b a buffer created with yy_create_buffer()
2082 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2085 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2088 M4_YY_DECL_GUTS_VAR();
2093 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2094 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2096 if ( b->yy_is_our_buffer )
2097 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2099 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2103 /* Initializes or reinitializes a buffer.
2104 * This function is sometimes called more than once on the same buffer,
2105 * such as during a yyrestart() or at EOF.
2108 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2111 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2116 M4_YY_DECL_GUTS_VAR();
2118 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2120 b->yy_input_file = file;
2121 b->yy_fill_buffer = 1;
2123 /* If b is the current buffer, then yy_init_buffer was _probably_
2124 * called from yyrestart() or through yy_get_next_buffer.
2125 * In that case, we don't want to reset the lineno or column.
2127 if (b != YY_CURRENT_BUFFER){
2128 b->yy_bs_lineno = 1;
2129 b->yy_bs_column = 0;
2133 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2135 b->yy_is_interactive = 1;
2138 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2140 b->yy_is_interactive = 0;
2143 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2148 b->yy_is_interactive = 0;
2153 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2154 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2158 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2161 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2164 M4_YY_DECL_GUTS_VAR();
2170 /* We always need two end-of-buffer characters. The first causes
2171 * a transition to the end-of-buffer state. The second causes
2172 * a jam in that state.
2174 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2175 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2177 b->yy_buf_pos = &b->yy_ch_buf[0];
2180 b->yy_buffer_status = YY_BUFFER_NEW;
2182 if ( b == YY_CURRENT_BUFFER )
2183 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2187 /** Pushes the new state onto the stack. The new state becomes
2188 * the current state. This function will allocate the stack
2190 * @param new_buffer The new state.
2194 void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2197 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2200 M4_YY_DECL_GUTS_VAR();
2201 if (new_buffer == NULL)
2204 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2206 /* This block is copied from yy_switch_to_buffer. */
2207 if ( YY_CURRENT_BUFFER )
2209 /* Flush out information for old buffer. */
2210 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2211 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2212 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2215 /* Only push if top exists. Otherwise, replace top. */
2216 if (YY_CURRENT_BUFFER)
2217 YY_G(yy_buffer_stack_top)++;
2218 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2220 /* copied from yy_switch_to_buffer. */
2221 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2222 YY_G(yy_did_buffer_switch_on_eof) = 1;
2228 /** Removes and deletes the top of the stack, if present.
2229 * The next element becomes the new top.
2233 void yypop_buffer_state YYFARGS0(void)
2236 void yyFlexLexer::yypop_buffer_state (void)
2239 M4_YY_DECL_GUTS_VAR();
2240 if (!YY_CURRENT_BUFFER)
2243 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2244 YY_CURRENT_BUFFER_LVALUE = NULL;
2245 if (YY_G(yy_buffer_stack_top) > 0)
2246 --YY_G(yy_buffer_stack_top);
2248 if (YY_CURRENT_BUFFER) {
2249 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2250 YY_G(yy_did_buffer_switch_on_eof) = 1;
2257 /* Allocates the stack if it does not exist.
2258 * Guarantees space for at least one push.
2261 static void yyensure_buffer_stack YYFARGS0(void)
2264 void yyFlexLexer::yyensure_buffer_stack(void)
2267 yy_size_t num_to_alloc;
2268 M4_YY_DECL_GUTS_VAR();
2270 if (!YY_G(yy_buffer_stack)) {
2272 /* First allocation is just for 2 elements, since we don't know if this
2273 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2274 * immediate realloc on the next call.
2277 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2278 (num_to_alloc * sizeof(struct yy_buffer_state*)
2279 M4_YY_CALL_LAST_ARG);
2280 if ( ! YY_G(yy_buffer_stack) )
2281 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2284 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2286 YY_G(yy_buffer_stack_max) = num_to_alloc;
2287 YY_G(yy_buffer_stack_top) = 0;
2291 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2293 /* Increase the buffer to prepare for a possible push. */
2294 yy_size_t grow_size = 8 /* arbitrary grow size */;
2296 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2297 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2298 (YY_G(yy_buffer_stack),
2299 num_to_alloc * sizeof(struct yy_buffer_state*)
2300 M4_YY_CALL_LAST_ARG);
2301 if ( ! YY_G(yy_buffer_stack) )
2302 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2304 /* zero only the new slots.*/
2305 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2306 YY_G(yy_buffer_stack_max) = num_to_alloc;
2314 m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2317 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2318 * @param base the character buffer
2319 * @param size the size in bytes of the character buffer
2321 * @return the newly allocated buffer state object.
2323 YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2326 m4_dnl M4_YY_DECL_GUTS_VAR();
2329 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2330 base[size-1] != YY_END_OF_BUFFER_CHAR )
2331 /* They forgot to leave room for the EOB's. */
2334 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2336 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2338 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2339 b->yy_buf_pos = b->yy_ch_buf = base;
2340 b->yy_is_our_buffer = 0;
2341 b->yy_input_file = 0;
2342 b->yy_n_chars = b->yy_buf_size;
2343 b->yy_is_interactive = 0;
2345 b->yy_fill_buffer = 0;
2346 b->yy_buffer_status = YY_BUFFER_NEW;
2348 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2356 m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2359 /** Setup the input buffer state to scan a string. The next call to yylex() will
2360 * scan from a @e copy of @a str.
2361 * @param yystr a NUL-terminated string to scan
2363 * @return the newly allocated buffer state object.
2364 * @note If you want to scan bytes that may contain NUL values, then use
2365 * yy_scan_bytes() instead.
2367 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2369 m4_dnl M4_YY_DECL_GUTS_VAR();
2371 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2377 m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2380 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2381 * scan from a @e copy of @a bytes.
2382 * @param yybytes the byte buffer to scan
2383 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2385 * @return the newly allocated buffer state object.
2387 YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)
2393 m4_dnl M4_YY_DECL_GUTS_VAR();
2395 /* Get memory for full buffer, including space for trailing EOB's. */
2396 n = _yybytes_len + 2;
2397 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2399 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2401 for ( i = 0; i < _yybytes_len; ++i )
2402 buf[i] = yybytes[i];
2404 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2406 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2408 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2410 /* It's okay to grow etc. this buffer, and we should throw it
2411 * away when we're done.
2413 b->yy_is_our_buffer = 1;
2421 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2424 static void yy_push_state YYFARGS1( int ,_new_state)
2427 void yyFlexLexer::yy_push_state( int _new_state )
2430 M4_YY_DECL_GUTS_VAR();
2431 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2435 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2436 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2438 if ( ! YY_G(yy_start_stack) )
2439 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2442 YY_G(yy_start_stack) = (int *) yyrealloc(
2443 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2445 if ( ! YY_G(yy_start_stack) )
2446 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2449 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2456 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2459 static void yy_pop_state YYFARGS0(void)
2462 void yyFlexLexer::yy_pop_state()
2465 M4_YY_DECL_GUTS_VAR();
2466 if ( --YY_G(yy_start_stack_ptr) < 0 )
2467 YY_FATAL_ERROR( "start-condition stack underflow" );
2469 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2474 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2477 static int yy_top_state YYFARGS0(void)
2480 int yyFlexLexer::yy_top_state()
2483 M4_YY_DECL_GUTS_VAR();
2484 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2488 #ifndef YY_EXIT_FAILURE
2489 #define YY_EXIT_FAILURE 2
2493 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2495 m4_dnl M4_YY_DECL_GUTS_VAR();
2496 (void) fprintf( stderr, "%s\n", msg );
2497 exit( YY_EXIT_FAILURE );
2501 void yyFlexLexer::LexerError( yyconst char msg[] )
2503 M4_YY_DECL_GUTS_VAR();
2504 std::cerr << msg << std::endl;
2505 exit( YY_EXIT_FAILURE );
2509 /* Redefine yyless() so it works in section 3 code. */
2515 /* Undo effects of setting up yytext. */ \
2516 int yyless_macro_arg = (n); \
2517 YY_LESS_LINENO(yyless_macro_arg);\
2518 yytext[yyleng] = YY_G(yy_hold_char); \
2519 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2520 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2521 *YY_G(yy_c_buf_p) = '\0'; \
2522 yyleng = yyless_macro_arg; \
2528 /* Accessor methods (get/set functions) to struct members. */
2532 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2534 /** Get the user-defined data for this scanner.
2537 YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2539 M4_YY_DECL_GUTS_VAR();
2545 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2547 /** Get the current line number.
2550 int yyget_lineno YYFARGS0(void)
2552 M4_YY_DECL_GUTS_VAR();
2554 m4_ifdef( [[M4_YY_REENTRANT]],
2556 if (! YY_CURRENT_BUFFER)
2563 m4_ifdef( [[M4_YY_REENTRANT]],
2565 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2567 /** Get the current column number.
2570 int yyget_column YYFARGS0(void)
2572 M4_YY_DECL_GUTS_VAR();
2574 m4_ifdef( [[M4_YY_REENTRANT]],
2576 if (! YY_CURRENT_BUFFER)
2584 m4_ifdef( [[M4_YY_NO_GET_IN]],,
2586 /** Get the input stream.
2589 FILE *yyget_in YYFARGS0(void)
2591 M4_YY_DECL_GUTS_VAR();
2596 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2598 /** Get the output stream.
2601 FILE *yyget_out YYFARGS0(void)
2603 M4_YY_DECL_GUTS_VAR();
2608 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2610 /** Get the length of the current token.
2613 yy_size_t yyget_leng YYFARGS0(void)
2615 M4_YY_DECL_GUTS_VAR();
2620 /** Get the current token.
2623 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2625 char *yyget_text YYFARGS0(void)
2627 M4_YY_DECL_GUTS_VAR();
2633 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2635 /** Set the user-defined data. This data is never touched by the scanner.
2636 * @param user_defined The data to be associated with this scanner.
2639 void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2641 M4_YY_DECL_GUTS_VAR();
2642 yyextra = user_defined ;
2647 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2649 /** Set the current line number.
2650 * @param _line_number
2653 void yyset_lineno YYFARGS1( int ,_line_number)
2655 M4_YY_DECL_GUTS_VAR();
2657 m4_ifdef( [[M4_YY_REENTRANT]],
2659 /* lineno is only valid if an input buffer exists. */
2660 if (! YY_CURRENT_BUFFER )
2661 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2663 yylineno = _line_number;
2667 m4_ifdef( [[M4_YY_REENTRANT]],
2669 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2671 /** Set the current column.
2672 * @param _line_number
2675 void yyset_column YYFARGS1( int , _column_no)
2677 M4_YY_DECL_GUTS_VAR();
2679 m4_ifdef( [[M4_YY_REENTRANT]],
2681 /* column is only valid if an input buffer exists. */
2682 if (! YY_CURRENT_BUFFER )
2683 YY_FATAL_ERROR( "yyset_column called with no buffer" );
2685 yycolumn = _column_no;
2691 m4_ifdef( [[M4_YY_NO_SET_IN]],,
2693 /** Set the input stream. This does not discard the current
2695 * @param _in_str A readable stream.
2697 * @see yy_switch_to_buffer
2699 void yyset_in YYFARGS1( FILE * ,_in_str)
2701 M4_YY_DECL_GUTS_VAR();
2706 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2708 void yyset_out YYFARGS1( FILE * ,_out_str)
2710 M4_YY_DECL_GUTS_VAR();
2716 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2718 int yyget_debug YYFARGS0(void)
2720 M4_YY_DECL_GUTS_VAR();
2721 return yy_flex_debug;
2725 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2727 void yyset_debug YYFARGS1( int ,_bdebug)
2729 M4_YY_DECL_GUTS_VAR();
2730 yy_flex_debug = _bdebug ;
2736 /* Accessor methods for yylval and yylloc */
2739 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2741 YYSTYPE * yyget_lval YYFARGS0(void)
2743 M4_YY_DECL_GUTS_VAR();
2748 m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2750 void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2752 M4_YY_DECL_GUTS_VAR();
2753 yylval = yylval_param;
2757 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2759 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2761 YYLTYPE *yyget_lloc YYFARGS0(void)
2763 M4_YY_DECL_GUTS_VAR();
2768 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2770 void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2772 M4_YY_DECL_GUTS_VAR();
2773 yylloc = yylloc_param;
2781 /* User-visible API */
2783 /* yylex_init is special because it creates the scanner itself, so it is
2784 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2785 * That's why we explicitly handle the declaration, instead of using our macros.
2787 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2789 int yylex_init( ptr_yy_globals )
2790 yyscan_t* ptr_yy_globals;
2793 int yylex_init(yyscan_t* ptr_yy_globals)
2796 if (ptr_yy_globals == NULL){
2801 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2803 if (*ptr_yy_globals == NULL){
2808 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2809 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2811 return yy_init_globals ( *ptr_yy_globals );
2815 /* yylex_init_extra has the same functionality as yylex_init, but follows the
2816 * convention of taking the scanner as the last argument. Note however, that
2817 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2818 * is the reason, too, why this function also must handle its own declaration).
2819 * The user defined value in the first argument will be available to yyalloc in
2820 * the yyextra field.
2822 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2824 int yylex_init_extra( yy_user_defined, ptr_yy_globals )
2825 YY_EXTRA_TYPE yy_user_defined;
2826 yyscan_t* ptr_yy_globals;
2829 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2832 struct yyguts_t dummy_yyguts;
2834 yyset_extra (yy_user_defined, &dummy_yyguts);
2836 if (ptr_yy_globals == NULL){
2841 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2843 if (*ptr_yy_globals == NULL){
2848 /* By setting to 0xAA, we expose bugs in
2849 yy_init_globals. Leave at 0x00 for releases. */
2850 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2852 yyset_extra (yy_user_defined, *ptr_yy_globals);
2854 return yy_init_globals ( *ptr_yy_globals );
2861 static int yy_init_globals YYFARGS0(void)
2863 M4_YY_DECL_GUTS_VAR();
2864 /* Initialization is the same as for the non-reentrant scanner.
2865 * This function is called from yylex_destroy(), so don't allocate here.
2868 m4_ifdef( [[M4_YY_USE_LINENO]],
2870 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2872 /* We do not touch yylineno unless the option is enabled. */
2876 YY_G(yy_buffer_stack) = 0;
2877 YY_G(yy_buffer_stack_top) = 0;
2878 YY_G(yy_buffer_stack_max) = 0;
2879 YY_G(yy_c_buf_p) = (char *) 0;
2883 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2885 YY_G(yy_start_stack_ptr) = 0;
2886 YY_G(yy_start_stack_depth) = 0;
2887 YY_G(yy_start_stack) = NULL;
2890 m4_ifdef( [[M4_YY_USES_REJECT]],
2892 YY_G(yy_state_buf) = 0;
2893 YY_G(yy_state_ptr) = 0;
2894 YY_G(yy_full_match) = 0;
2898 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2900 YY_G(yytext_ptr) = 0;
2901 YY_G(yy_more_offset) = 0;
2902 YY_G(yy_prev_more_offset) = 0;
2905 /* Defined in main.c */
2914 /* For future reference: Set errno on error, since we are called by
2922 %if-c-only SNIP! this currently causes conflicts with the c++ scanner
2923 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2924 int yylex_destroy YYFARGS0(void)
2926 M4_YY_DECL_GUTS_VAR();
2928 /* Pop the buffer stack, destroying each element. */
2929 while(YY_CURRENT_BUFFER){
2930 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2931 YY_CURRENT_BUFFER_LVALUE = NULL;
2932 yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2935 /* Destroy the stack itself. */
2936 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2937 YY_G(yy_buffer_stack) = NULL;
2939 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2941 /* Destroy the start condition stack. */
2942 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2943 YY_G(yy_start_stack) = NULL;
2946 m4_ifdef( [[M4_YY_USES_REJECT]],
2948 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2949 YY_G(yy_state_buf) = NULL;
2952 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2953 * yylex() is called, initialization will occur. */
2954 yy_init_globals( M4_YY_CALL_ONLY_ARG);
2957 /* Destroy the main struct (reentrant only). */
2958 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2966 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2969 * Internal utility routines.
2973 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2976 static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2979 for ( i = 0; i < n; ++i )
2985 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2987 #ifdef YY_NEED_STRLEN
2988 static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2991 for ( n = 0; s[n]; ++n )
2999 m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
3001 void *yyalloc YYFARGS1( yy_size_t ,size)
3003 return (void *) malloc( size );
3007 m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
3009 void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
3011 /* The cast to (char *) in the following accommodates both
3012 * implementations that use char* generic pointers, and those
3013 * that use void* generic pointers. It works with the latter
3014 * because both ANSI C and C++ allow castless assignment from
3015 * any pointer type to void*, and deal with argument conversions
3016 * as though doing an assignment.
3018 return (void *) realloc( (char *) ptr, size );
3022 m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
3024 void yyfree YYFARGS1( void *,ptr)
3026 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3030 %if-tables-serialization definitions
3031 m4preproc_include(`tables_shared.c')
3033 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
3036 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3040 rd->bread += sizeof(flex_uint8_t);
3044 static int yytbl_read16 (void *v, struct yytbl_reader * rd)
3047 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3051 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3052 rd->bread += sizeof(flex_uint16_t);
3056 static int yytbl_read32 (void *v, struct yytbl_reader * rd)
3059 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3063 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3064 rd->bread += sizeof(flex_uint32_t);
3068 /** Read the header */
3069 static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3072 memset (th, 0, sizeof (struct yytbl_hdr));
3074 if (yytbl_read32 (&(th->th_magic), rd) != 0)
3077 if (th->th_magic != YYTBL_MAGIC){
3078 YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */
3082 if (yytbl_read32 (&(th->th_hsize), rd) != 0
3083 || yytbl_read32 (&(th->th_ssize), rd) != 0
3084 || yytbl_read16 (&(th->th_flags), rd) != 0)
3087 /* Sanity check on header size. Greater than 1k suggests some funny business. */
3088 if (th->th_hsize < 16 || th->th_hsize > 1024){
3089 YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */
3093 /* Allocate enough space for the version and name fields */
3094 bytes = th->th_hsize - 14;
3095 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3096 if ( ! th->th_version )
3097 YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
3099 /* we read it all into th_version, and point th_name into that data */
3100 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
3102 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3103 th->th_version = NULL;
3109 th->th_name = th->th_version + strlen (th->th_version) + 1;
3113 /** lookup id in the dmap list.
3114 * @param dmap pointer to first element in list
3115 * @return NULL if not found.
3117 static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3121 if (dmap->dm_id == id)
3128 /** Read a table while mapping its contents to the local array.
3129 * @param dmap used to performing mapping
3130 * @return 0 on success
3132 static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3134 struct yytbl_data td;
3135 struct yytbl_dmap *transdmap=0;
3136 int len, i, rv, inner_loop_count;
3139 memset (&td, 0, sizeof (struct yytbl_data));
3141 if (yytbl_read16 (&td.td_id, rd) != 0
3142 || yytbl_read16 (&td.td_flags, rd) != 0
3143 || yytbl_read32 (&td.td_hilen, rd) != 0
3144 || yytbl_read32 (&td.td_lolen, rd) != 0)
3147 /* Lookup the map for the transition table so we have it in case we need it
3148 * inside the loop below. This scanner might not even have a transition
3149 * table, which is ok.
3151 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3153 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3154 YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */
3158 /* Allocate space for table.
3159 * The --full yy_transition table is a special case, since we
3160 * need the dmap.dm_sz entry to tell us the sizeof the individual
3166 if ((td.td_flags & YYTD_STRUCT))
3167 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3169 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3171 if(M4_YY_TABLES_VERIFY)
3172 /* We point to the array itself */
3175 /* We point to the address of a pointer. */
3176 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3178 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
3181 /* If it's a struct, we read 2 integers to get one element */
3182 if ((td.td_flags & YYTD_STRUCT) != 0)
3183 inner_loop_count = 2;
3185 inner_loop_count = 1;
3187 /* read and map each element.
3188 * This loop iterates once for each element of the td_data array.
3189 * Notice that we increment 'i' in the inner loop.
3191 len = yytbl_calc_total_len (&td);
3192 for (i = 0; i < len; ){
3196 /* This loop really executes exactly 1 or 2 times.
3197 * The second time is to handle the second member of the
3198 * YYTD_STRUCT for the yy_transition array.
3200 for (j = 0; j < inner_loop_count; j++, i++) {
3203 /* read into t32 no matter what the real size is. */
3208 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3209 case sizeof (flex_int32_t):
3210 rv = yytbl_read32 (&t32, rd);
3212 case sizeof (flex_int16_t):
3213 rv = yytbl_read16 (&t16, rd);
3216 case sizeof (flex_int8_t):
3217 rv = yytbl_read8 (&t8, rd);
3221 YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */
3228 /* copy into the deserialized array... */
3230 if ((td.td_flags & YYTD_STRUCT)) {
3231 /* t32 is the j'th member of a two-element struct. */
3234 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3235 : &(((struct yy_trans_info *) p)->yy_nxt);
3237 switch (dmap->dm_sz) {
3238 case sizeof (flex_int32_t):
3239 if (M4_YY_TABLES_VERIFY){
3240 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3241 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" );
3243 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3245 case sizeof (flex_int16_t):
3246 if (M4_YY_TABLES_VERIFY ){
3247 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3248 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" );
3250 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3252 case sizeof(flex_int8_t):
3253 if (M4_YY_TABLES_VERIFY ){
3254 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3255 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" );
3257 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3260 YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */
3264 /* if we're done with j, increment p */
3266 p = (struct yy_trans_info *) p + 1;
3268 else if ((td.td_flags & YYTD_PTRANS)) {
3269 /* t32 is an index into the transition array. */
3270 struct yy_trans_info *v;
3274 YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */
3278 if( M4_YY_TABLES_VERIFY)
3279 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3281 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3283 if(M4_YY_TABLES_VERIFY ){
3284 if( ((struct yy_trans_info **) p)[0] != v)
3285 YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
3287 ((struct yy_trans_info **) p)[0] = v;
3290 p = (struct yy_trans_info **) p + 1;
3293 /* t32 is a plain int. copy data, then incrememnt p. */
3294 switch (dmap->dm_sz) {
3295 case sizeof (flex_int32_t):
3296 if(M4_YY_TABLES_VERIFY ){
3297 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3298 YY_FATAL_ERROR( "tables verification failed at flex_int32_t" );
3300 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3301 p = ((flex_int32_t *) p) + 1;
3303 case sizeof (flex_int16_t):
3304 if(M4_YY_TABLES_VERIFY ){
3305 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3306 YY_FATAL_ERROR( "tables verification failed at flex_int16_t" );
3308 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3309 p = ((flex_int16_t *) p) + 1;
3311 case sizeof (flex_int8_t):
3312 if(M4_YY_TABLES_VERIFY ){
3313 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3314 YY_FATAL_ERROR( "tables verification failed at flex_int8_t" );
3316 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3317 p = ((flex_int8_t *) p) + 1;
3320 YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */
3328 /* Now eat padding. */
3331 pad = yypad64(rd->bread);
3334 if(yytbl_read8(&t8,rd) != 0)
3342 %define-yytables The name for this specific scanner's tables.
3344 /* Find the key and load the DFA tables from the given stream. */
3345 static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3348 struct yytbl_hdr th;
3349 struct yytbl_reader rd;
3352 th.th_version = NULL;
3354 /* Keep trying until we find the right set of tables or end of file. */
3355 while (!feof(rd.fp)) {
3357 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3362 /* A NULL key means choose the first set of tables. */
3366 if (strcmp(th.th_name,key) != 0){
3367 /* Skip ahead to next set */
3368 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3369 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3370 th.th_version = NULL;
3376 while (rd.bread < th.th_ssize){
3377 /* Load the data tables */
3378 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3386 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3387 th.th_version = NULL;
3393 /** Load the DFA tables for this scanner from the given stream. */
3394 int yytables_fload YYFARGS1(FILE *, fp)
3397 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3402 /** Destroy the loaded tables, freeing memory, etc.. */
3403 int yytables_destroy YYFARGS0(void)
3405 struct yytbl_dmap *dmap=0;
3407 if(!M4_YY_TABLES_VERIFY){
3408 /* Walk the dmap, freeing the pointers */
3409 for(dmap=yydmap; dmap->dm_id; dmap++) {
3412 if(v && *(char**)v){
3413 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3422 /* end table serialization code definitions */
3426 m4_ifdef([[M4_YY_MAIN]], [[
3427 int main M4_YY_PARAMS(void);
3436 yylex_destroy( lexer);
3448 m4_ifdef( [[M4_YY_IN_HEADER]],
3451 #undef YY_FLUSH_BUFFER
3453 #undef yy_new_buffer
3454 #undef yy_set_interactive
3455 #undef YY_DO_BEFORE_ACTION
3457 #ifdef YY_DECL_IS_OURS
3458 #undef YY_DECL_IS_OURS