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 #if defined(__FreeBSD__)
199 #ifndef __STDC_LIMIT_MACROS
200 #define __STDC_LIMIT_MACROS
202 #include <sys/cdefs.h>
208 /* begin standard C headers. */
216 %if-tables-serialization
217 #include <sys/types.h>
218 #include <netinet/in.h>
220 /* end standard C headers. */
223 m4preproc_include(`flexint.h')
227 /* begin standard C++ headers. */
233 /* end standard C++ headers. */
238 /* The "const" storage-class-modifier is valid. */
241 #else /* ! __cplusplus */
243 /* C99 requires __STDC__ to be defined as 1. */
244 #if defined (__STDC__)
248 #endif /* defined (__STDC__) */
249 #endif /* ! __cplusplus */
252 #define yyconst const
257 %# For compilers that can not handle prototypes.
259 %# The function prototype
260 %# int foo(int x, char* y);
262 %# ...should be written as
263 %# int foo M4_YY_PARAMS(int x, char* y);
265 %# ...which could possibly generate
268 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
270 m4_define( [[M4_YY_PARAMS]], [[()]])
273 m4_define( [[M4_YY_PARAMS]], [[($*)]])
277 /* Returned upon end-of-file. */
282 /* Promotes a possibly negative, possibly signed char to an unsigned
283 * integer for use as an array index. If the signed char is negative,
284 * we want to instead treat it as an 8-bit unsigned char, hence the
287 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
294 /* An opaque pointer. */
295 #ifndef YY_TYPEDEF_YY_SCANNER_T
296 #define YY_TYPEDEF_YY_SCANNER_T
297 typedef void* yyscan_t;
300 %# Declare yyguts variable
301 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
302 %# Perform a noop access on yyguts to prevent unused variable complains
303 m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])
304 %# For use wherever a Global is accessed or assigned.
305 m4_define( [[YY_G]], [[yyg->$1]])
307 %# For use in function prototypes to append the additional argument.
308 m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
309 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
311 %# For use in function definitions to append the additional argument.
312 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
314 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
315 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
318 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
319 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
321 m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
323 %# For use in function calls to pass the additional argument.
324 m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
325 m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
327 %# For use in function documentation to adjust for additional argument.
328 m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
330 /* For convenience, these vars (plus the bison vars far below)
331 are macros in the reentrant scanner. */
332 #define yyin YY_G(yyin_r)
333 #define yyout YY_G(yyout_r)
334 #define yyextra YY_G(yyextra_r)
335 #define yyleng YY_G(yyleng_r)
336 #define yytext YY_G(yytext_r)
337 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
338 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
339 #define yy_flex_debug YY_G(yy_flex_debug_r)
341 m4_define( [[M4_YY_INCR_LINENO]],
354 m4_define( [[M4_YY_INCR_LINENO]],
359 %# Define these macros to be no-ops.
360 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
361 m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])
362 m4_define( [[YY_G]], [[($1)]])
363 m4_define( [[M4_YY_PROTO_LAST_ARG]])
364 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
365 m4_define( [[M4_YY_DEF_LAST_ARG]])
367 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
369 m4_define( [[M4_YY_DEF_ONLY_ARG]])
372 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
374 m4_define([[M4_YY_DECL_LAST_ARG]])
375 m4_define([[M4_YY_CALL_LAST_ARG]])
376 m4_define([[M4_YY_CALL_ONLY_ARG]])
377 m4_define( [[M4_YY_DOC_PARAM]], [[]])
382 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
384 %# For compilers that need traditional function definitions.
386 %# The function prototype taking 2 arguments
387 %# int foo (int x, char* y)
389 %# ...should be written as
390 %# int foo YYFARGS2(int,x, char*,y)
392 %# ...which could possibly generate
393 %# int foo (x,y,yyscanner)
396 %# yyscan_t yyscanner;
398 %# Generate traditional function defs
399 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
400 M4_YY_DECL_LAST_ARG]])
401 m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
403 M4_YY_DECL_LAST_ARG]])
404 m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
407 M4_YY_DECL_LAST_ARG]])
408 m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
412 M4_YY_DECL_LAST_ARG]])
415 %# Generate C99 function defs.
416 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
417 m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
418 m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
419 m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
422 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
424 /* Enter a start condition. This macro really ought to take a parameter,
425 * but we do it the disgusting crufty way forced on us by the ()-less
426 * definition of BEGIN.
428 #define BEGIN YY_G(yy_start) = 1 + 2 *
431 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
433 /* Translate the current start state into a value that can be later handed
434 * to BEGIN to return to the state. The YYSTATE alias is for lex
437 #define YY_START ((YY_G(yy_start) - 1) / 2)
438 #define YYSTATE YY_START
441 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
443 /* Action number for EOF rule of a given start state. */
444 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
447 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
449 /* Special action meaning "start processing a new file". */
450 #define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
453 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
455 #define YY_END_OF_BUFFER_CHAR 0
458 /* Size of default input buffer. */
460 #define YY_BUF_SIZE 16384
463 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
465 /* The state buf must be large enough to hold one state per character in the main buffer.
467 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
471 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
472 #define YY_TYPEDEF_YY_BUFFER_STATE
473 typedef struct yy_buffer_state *YY_BUFFER_STATE;
476 #ifndef YY_TYPEDEF_YY_SIZE_T
477 #define YY_TYPEDEF_YY_SIZE_T
478 typedef size_t yy_size_t;
482 extern yy_size_t yyleng;
487 extern FILE *yyin, *yyout;
491 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
493 #define EOB_ACT_CONTINUE_SCAN 0
494 #define EOB_ACT_END_OF_FILE 1
495 #define EOB_ACT_LAST_MATCH 2
498 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
500 m4_ifdef( [[M4_YY_USE_LINENO]],
502 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
503 * access to the local variable yy_act. Since yyless() is a macro, it would break
504 * existing scanners that call yyless() from OUTSIDE yylex.
505 * One obvious solution it to make yy_act a global. I tried that, and saw
506 * a 5% performance hit in a non-yylineno scanner, because yy_act is
507 * normally declared as a register variable-- so it is not worth it.
509 #define YY_LESS_LINENO(n) \
512 for ( yyl = n; yyl < yyleng; ++yyl )\
513 if ( yytext[yyl] == '\n' )\
518 #define YY_LESS_LINENO(n)
522 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
524 /* Return all but the first "n" matched characters back to the input stream. */
528 /* Undo effects of setting up yytext. */ \
529 int yyless_macro_arg = (n); \
530 YY_LESS_LINENO(yyless_macro_arg);\
531 *yy_cp = YY_G(yy_hold_char); \
532 YY_RESTORE_YY_MORE_OFFSET \
533 YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
534 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
539 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
541 #define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
544 #ifndef YY_STRUCT_YY_BUFFER_STATE
545 #define YY_STRUCT_YY_BUFFER_STATE
546 struct yy_buffer_state
553 std::istream* yy_input_file;
557 char *yy_ch_buf; /* input buffer */
558 char *yy_buf_pos; /* current position in input buffer */
560 /* Size of input buffer in bytes, not including room for EOB
563 yy_size_t yy_buf_size;
565 /* Number of characters read into yy_ch_buf, not including EOB
568 yy_size_t yy_n_chars;
570 /* Whether we "own" the buffer - i.e., we know we created it,
571 * and can realloc() it to grow it, and should free() it to
574 int yy_is_our_buffer;
576 /* Whether this is an "interactive" input source; if so, and
577 * if we're using stdio for input, then we want to use getc()
578 * instead of fread(), to make sure we stop fetching input after
581 int yy_is_interactive;
583 /* Whether we're considered to be at the beginning of a line.
584 * If so, '^' rules will be active on the next match, otherwise
589 int yy_bs_lineno; /**< The line count. */
590 int yy_bs_column; /**< The column count. */
593 /* Whether to try to fill the input buffer when we reach the
598 int yy_buffer_status;
599 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
601 #define YY_BUFFER_NEW 0
602 #define YY_BUFFER_NORMAL 1
603 /* When an EOF's been seen but there's still some text to process
604 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
605 * shouldn't try reading from the input source any more. We might
606 * still have a bunch of tokens to match, though, because of
607 * possible backing-up.
609 * When we actually see the EOF, we change the status to "new"
610 * (via yyrestart()), so that the user can continue scanning by
611 * just pointing yyin at a new input file.
613 #define YY_BUFFER_EOF_PENDING 2
616 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
618 %if-c-only Standard (non-C++) definition
622 /* Stack of input buffers. */
623 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
624 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
625 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
630 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
632 /* We provide macros for accessing buffer states in case in the
633 * future we want to put the buffer states in a more general
636 * Returns the top of the stack, or NULL.
638 #define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
639 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
641 #define yy_current_buffer YY_CURRENT_BUFFER
644 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
646 /* Same as previous macro, but useful when we know that the buffer stack is not
647 * NULL or when we need an lvalue. For internal use only.
649 #define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
652 %if-c-only Standard (non-C++) definition
656 /* yy_hold_char holds the character lost when yytext is formed. */
657 static char yy_hold_char;
658 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
661 /* Points to current character in buffer. */
662 static char *yy_c_buf_p = (char *) 0;
663 static int yy_init = 0; /* whether we need to initialize */
664 static int yy_start = 0; /* start state number */
666 /* Flag which is used to allow yywrap()'s to do buffer switches
667 * instead of setting up a fresh yyin. A bit of a hack ...
669 static int yy_did_buffer_switch_on_eof;
673 void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
674 void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
675 YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
676 void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
677 void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
678 void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
679 void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
681 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
683 static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
684 static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
685 static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
688 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
690 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
693 YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
694 YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
695 YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );
699 void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
700 void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
701 void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
703 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
705 #define yy_new_buffer yy_create_buffer
708 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
710 #define yy_set_interactive(is_interactive) \
712 if ( ! YY_CURRENT_BUFFER ){ \
713 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
714 YY_CURRENT_BUFFER_LVALUE = \
715 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
717 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
721 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
723 #define yy_set_bol(at_bol) \
725 if ( ! YY_CURRENT_BUFFER ){\
726 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
727 YY_CURRENT_BUFFER_LVALUE = \
728 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
730 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
734 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
736 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
739 %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
741 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
746 %if-c-only Standard (non-C++) definition
748 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
750 static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
751 static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
752 static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
753 static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG ) __dead2;
758 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
760 /* Done after the current pattern has been matched and before the
761 * corresponding action - sets up yytext.
763 #define YY_DO_BEFORE_ACTION \
764 YY_G(yytext_ptr) = yy_bp; \
765 %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
766 YY_G(yy_hold_char) = *yy_cp; \
768 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
769 YY_G(yy_c_buf_p) = yy_cp;
772 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
774 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
777 m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
779 m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
781 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
783 #ifndef YY_NO_UNISTD_H
784 /* Special case for "unistd.h", since it is non-ANSI. We include it way
785 * down here because we want the user's section 1 to have been scanned first.
786 * The user has a chance to override it with an option.
797 m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
799 #define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
802 #ifndef YY_EXTRA_TYPE
803 #define YY_EXTRA_TYPE void *
808 %if-c-only Reentrant structure and macros (non-C++).
811 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
813 /* Holds the entire state of the reentrant scanner. */
817 /* User-defined. Not touched by flex. */
818 YY_EXTRA_TYPE yyextra_r;
820 /* The rest are the same as the globals declared in the non-reentrant scanner. */
821 FILE *yyin_r, *yyout_r;
822 size_t yy_buffer_stack_top; /**< index of top of stack. */
823 size_t yy_buffer_stack_max; /**< capacity of stack. */
824 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
826 yy_size_t yy_n_chars;
831 int yy_did_buffer_switch_on_eof;
832 int yy_start_stack_ptr;
833 int yy_start_stack_depth;
835 yy_state_type yy_last_accepting_state;
836 char* yy_last_accepting_cpos;
841 m4_ifdef( [[M4_YY_USES_REJECT]],
843 yy_state_type *yy_state_buf;
844 yy_state_type *yy_state_ptr;
848 /* These are only needed for trailing context rules,
849 * but there's no conditional variable for that yet. */
850 int yy_looking_for_trail_begin;
855 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
857 char yytext_r[YYLMAX];
860 int yy_prev_more_offset;
868 m4_ifdef( [[M4_YY_BISON_LVAL]],
873 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
878 }; /* end struct yyguts_t */
883 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
885 static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
891 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
893 m4_ifdef( [[M4_YY_BISON_LVAL]],
895 /* This must go here because YYSTYPE and YYLTYPE are included
896 * from bison output in section 1.*/
897 # define yylval YY_G(yylval_r)
900 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
902 # define yylloc YY_G(yylloc_r)
906 int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
908 int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
912 %endif End reentrant structures and macros.
914 /* Accessor methods to globals.
915 These are made visible to non-reentrant scanners for convenience. */
917 m4_ifdef( [[M4_YY_NO_DESTROY]],,
919 int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
922 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
924 int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
927 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
929 void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
932 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
934 YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
937 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
939 void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
942 m4_ifdef( [[M4_YY_NO_GET_IN]],,
944 FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
947 m4_ifdef( [[M4_YY_NO_SET_IN]],,
949 void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );
952 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
954 FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
957 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
959 void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );
962 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
964 yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
967 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
969 char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
972 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
974 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
977 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
979 void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
982 m4_ifdef( [[M4_YY_REENTRANT]],
984 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
986 int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
990 m4_ifdef( [[M4_YY_REENTRANT]],
992 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
994 void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );
999 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
1001 YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1004 void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
1006 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1008 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
1010 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1013 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
1015 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
1020 /* Macros after this point can all be overridden by user definitions in
1024 #ifndef YY_SKIP_YYWRAP
1026 extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1028 extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1033 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1036 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
1043 static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1046 #ifdef YY_NEED_STRLEN
1047 static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1051 %if-c-only Standard (non-C++) definition
1054 static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1056 static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1064 %# TODO: This is messy.
1065 m4_ifdef( [[M4_YY_STACK_USED]],
1068 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1070 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1072 static int yy_start_stack_ptr = 0;
1073 static int yy_start_stack_depth = 0;
1074 static int *yy_start_stack = NULL;
1078 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1080 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1082 static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG);
1084 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1086 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1088 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1090 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1096 m4_define( [[M4_YY_NO_PUSH_STATE]])
1097 m4_define( [[M4_YY_NO_POP_STATE]])
1098 m4_define( [[M4_YY_NO_TOP_STATE]])
1102 /* Amount of stuff to slurp up with each read. */
1103 #ifndef YY_READ_BUF_SIZE
1104 #define YY_READ_BUF_SIZE 8192
1107 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1109 /* Copy whatever the last rule matched to the standard output. */
1111 %if-c-only Standard (non-C++) definition
1112 /* This used to be an fputs(), but since the string might contain NUL's,
1113 * we now use fwrite().
1115 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
1117 %if-c++-only C++ definition
1118 #define ECHO LexerOutput( yytext, yyleng )
1123 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1125 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1126 * is returned in "result".
1129 #define YY_INPUT(buf,result,max_size) \
1130 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1132 %if-c++-only C++ definition \
1133 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
1134 YY_FATAL_ERROR( "input in flex scanner failed" );
1140 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1142 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1143 * we don't want an extra ';' after the "return" because that will cause
1144 * some compilers to complain about unreachable statements.
1147 #define yyterminate() return YY_NULL
1151 /* Number of entries by which start-condition stack grows. */
1152 #ifndef YY_START_STACK_INCR
1153 #define YY_START_STACK_INCR 25
1156 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1158 /* Report a fatal error. */
1159 #ifndef YY_FATAL_ERROR
1161 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1164 #define YY_FATAL_ERROR(msg) LexerError( msg )
1169 %if-tables-serialization structures and prototypes
1170 m4preproc_include(`tables_shared.h')
1172 /* Load the DFA tables from the given stream. */
1173 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1175 /* Unload the tables from memory. */
1176 int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1179 /** Describes a mapping from a serialized table id to its deserialized state in
1180 * this scanner. This is the bridge between our "generic" deserialization code
1181 * and the specifics of this scanner.
1184 enum yytbl_id dm_id;/**< table identifier */
1185 void **dm_arr; /**< address of pointer to store the deserialized table. */
1186 size_t dm_sz; /**< local sizeof() each element in table. */
1189 /** A {0,0,0}-terminated list of structs, forming the map */
1190 static struct yytbl_dmap yydmap[] =
1192 %tables-yydmap generated elements
1196 /** A tables-reader object to maintain some state in the read. */
1197 struct yytbl_reader {
1198 FILE * fp; /**< input stream */
1199 flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1203 /* end tables serialization structures and prototypes */
1207 /* Default declaration of generated scanner - a define so the user can
1208 * easily add parameters.
1211 #define YY_DECL_IS_OURS 1
1212 %if-c-only Standard (non-C++) definition
1215 m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1216 m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1218 m4_ifdef( [[M4_YY_BISON_LVAL]],
1220 m4_dnl The bison pure parser is used. Redefine yylex to
1221 m4_dnl accept the lval parameter.
1223 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1224 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1225 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1226 [[YYFARGS1(YYSTYPE *,yylval_param)]])
1229 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1231 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
1233 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1234 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1235 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1236 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1239 extern int yylex M4_YY_LEX_PROTO;
1241 #define YY_DECL int yylex M4_YY_LEX_DECLARATION
1243 %if-c++-only C++ definition
1244 #define YY_DECL int yyFlexLexer::yylex()
1246 #endif /* !YY_DECL */
1248 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1250 /* Code executed at the beginning of each rule, after yytext and yyleng
1253 #ifndef YY_USER_ACTION
1254 #define YY_USER_ACTION
1258 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1260 /* Code executed at the end of each rule. */
1262 #define YY_BREAK break;
1266 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1268 %% [6.0] YY_RULE_SETUP definition goes here
1272 /** The main scanner function which does all the work.
1276 yy_state_type yy_current_state;
1277 char *yy_cp, *yy_bp;
1279 M4_YY_DECL_GUTS_VAR();
1281 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1283 m4_ifdef( [[M4_YY_BISON_LVAL]],
1287 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1293 %% [7.0] user's declarations go here
1295 m4_ifdef( [[M4_YY_BISON_LVAL]],
1297 yylval = yylval_param;
1300 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1302 yylloc = yylloc_param;
1305 if ( !YY_G(yy_init) )
1313 m4_ifdef( [[M4_YY_USES_REJECT]],
1315 /* Create the reject buffer large enough to save one state per allowed character. */
1316 if ( ! YY_G(yy_state_buf) )
1317 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
1318 if ( ! YY_G(yy_state_buf) )
1319 YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1322 if ( ! YY_G(yy_start) )
1323 YY_G(yy_start) = 1; /* first start state */
1338 yyout = & std::cout;
1341 if ( ! YY_CURRENT_BUFFER ) {
1342 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1343 YY_CURRENT_BUFFER_LVALUE =
1344 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1347 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1350 while ( 1 ) /* loops until end-of-file is reached */
1352 %% [8.0] yymore()-related code goes here
1353 yy_cp = YY_G(yy_c_buf_p);
1355 /* Support of yytext. */
1356 *yy_cp = YY_G(yy_hold_char);
1358 /* yy_bp points to the position in yy_ch_buf of the start of
1363 %% [9.0] code to set up and find next match goes here
1366 %% [10.0] code to find the action number goes here
1368 YY_DO_BEFORE_ACTION;
1370 %% [11.0] code for yylineno update goes here
1372 do_action: /* This label is used only to access EOF actions. */
1374 %% [12.0] debug code goes here
1377 { /* beginning of action switch */
1378 %% [13.0] actions go here
1380 case YY_END_OF_BUFFER:
1382 /* Amount of text matched not including the EOB char. */
1383 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1385 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1386 *yy_cp = YY_G(yy_hold_char);
1387 YY_RESTORE_YY_MORE_OFFSET
1389 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1391 /* We're scanning a new file or input source. It's
1392 * possible that this happened because the user
1393 * just pointed yyin at a new source and called
1394 * yylex(). If so, then we have to assure
1395 * consistency between YY_CURRENT_BUFFER and our
1396 * globals. Here is the right place to do so, because
1397 * this is the first action (other than possibly a
1398 * back-up) that will match for the new input source.
1400 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1401 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1402 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1405 /* Note that here we test for yy_c_buf_p "<=" to the position
1406 * of the first EOB in the buffer, since yy_c_buf_p will
1407 * already have been incremented past the NUL character
1408 * (since all states make transitions on EOB to the
1409 * end-of-buffer state). Contrast this with the test
1412 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1413 { /* This was really a NUL. */
1414 yy_state_type yy_next_state;
1416 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1418 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1420 /* Okay, we're now positioned to make the NUL
1421 * transition. We couldn't have
1422 * yy_get_previous_state() go ahead and do it
1423 * for us because it doesn't know how to deal
1424 * with the possibility of jamming (and we don't
1425 * want to build jamming into it because then it
1426 * will run more slowly).
1429 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1431 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1433 if ( yy_next_state )
1435 /* Consume the NUL. */
1436 yy_cp = ++YY_G(yy_c_buf_p);
1437 yy_current_state = yy_next_state;
1443 %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1444 goto yy_find_action;
1448 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1450 case EOB_ACT_END_OF_FILE:
1452 YY_G(yy_did_buffer_switch_on_eof) = 0;
1454 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1456 /* Note: because we've taken care in
1457 * yy_get_next_buffer() to have set up
1458 * yytext, we can now set up
1459 * yy_c_buf_p so that if some total
1460 * hoser (like flex itself) wants to
1461 * call the scanner after we return the
1462 * YY_NULL, it'll still work - another
1463 * YY_NULL will get returned.
1465 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1467 yy_act = YY_STATE_EOF(YY_START);
1473 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1479 case EOB_ACT_CONTINUE_SCAN:
1481 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1483 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1485 yy_cp = YY_G(yy_c_buf_p);
1486 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1489 case EOB_ACT_LAST_MATCH:
1491 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1493 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1495 yy_cp = YY_G(yy_c_buf_p);
1496 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1497 goto yy_find_action;
1504 "fatal flex scanner internal error--no action found" );
1505 } /* end of action switch */
1506 } /* end of scanning one token */
1507 } /* end of yylex */
1512 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1514 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1522 yylineno = 1; // this will only get updated if %option yylineno
1524 yy_did_buffer_switch_on_eof = 0;
1526 yy_looking_for_trail_begin = 0;
1529 yy_more_offset = yy_prev_more_offset = 0;
1531 yy_start_stack_ptr = yy_start_stack_depth = 0;
1532 yy_start_stack = NULL;
1534 yy_buffer_stack = 0;
1535 yy_buffer_stack_top = 0;
1536 yy_buffer_stack_max = 0;
1539 m4_ifdef( [[M4_YY_USES_REJECT]],
1541 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1548 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1550 yyFlexLexer::~yyFlexLexer()
1552 delete [] yy_state_buf;
1553 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1554 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1555 yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
1558 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1560 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1564 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1565 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1572 #ifdef YY_INTERACTIVE
1573 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1575 int yyFlexLexer::LexerInput( char* buf, int max_size )
1578 if ( yyin->eof() || yyin->fail() )
1581 #ifdef YY_INTERACTIVE
1582 yyin->get( buf[0] );
1593 (void) yyin->read( buf, max_size );
1598 return yyin->gcount();
1602 void yyFlexLexer::LexerOutput( const char* buf, int size )
1604 (void) yyout->write( buf, size );
1609 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1611 /* yy_get_next_buffer - try to read in a new buffer
1613 * Returns a code representing an action:
1614 * EOB_ACT_LAST_MATCH -
1615 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1616 * EOB_ACT_END_OF_FILE - end of file
1619 static int yy_get_next_buffer YYFARGS0(void)
1622 int yyFlexLexer::yy_get_next_buffer()
1625 M4_YY_DECL_GUTS_VAR();
1626 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1627 char *source = YY_G(yytext_ptr);
1628 int number_to_move, i;
1631 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1633 "fatal flex scanner internal error--end of buffer missed" );
1635 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1636 { /* Don't try to fill the buffer, so this is an EOF. */
1637 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1639 /* We matched a single character, the EOB, so
1640 * treat this as a final EOF.
1642 return EOB_ACT_END_OF_FILE;
1647 /* We matched some text prior to the EOB, first
1650 return EOB_ACT_LAST_MATCH;
1654 /* Try to read more data. */
1656 /* First move last chars to start of buffer. */
1657 number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
1659 for ( i = 0; i < number_to_move; ++i )
1660 *(dest++) = *(source++);
1662 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1663 /* don't do the read, it's not guaranteed to return an EOF,
1666 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1670 yy_size_t num_to_read =
1671 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1673 while ( num_to_read <= 0 )
1674 { /* Not enough room in the buffer - grow it. */
1675 m4_ifdef( [[M4_YY_USES_REJECT]],
1678 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1681 /* just a shorter name for the current buffer */
1682 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1684 int yy_c_buf_p_offset =
1685 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1687 if ( b->yy_is_our_buffer )
1689 yy_size_t new_size = b->yy_buf_size * 2;
1691 if ( new_size <= 0 )
1692 b->yy_buf_size += b->yy_buf_size / 8;
1694 b->yy_buf_size *= 2;
1696 b->yy_ch_buf = (char *)
1697 /* Include room in for 2 EOB chars. */
1698 yyrealloc( (void *) b->yy_ch_buf,
1699 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1702 /* Can't grow it, we don't own it. */
1705 if ( ! b->yy_ch_buf )
1707 "fatal error - scanner input buffer overflow" );
1709 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1711 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1716 if ( num_to_read > YY_READ_BUF_SIZE )
1717 num_to_read = YY_READ_BUF_SIZE;
1719 /* Read in more data. */
1720 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1721 YY_G(yy_n_chars), num_to_read );
1723 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1726 if ( YY_G(yy_n_chars) == 0 )
1728 if ( number_to_move == YY_MORE_ADJ )
1730 ret_val = EOB_ACT_END_OF_FILE;
1731 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1736 ret_val = EOB_ACT_LAST_MATCH;
1737 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1738 YY_BUFFER_EOF_PENDING;
1743 ret_val = EOB_ACT_CONTINUE_SCAN;
1745 if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1746 /* Extend the array by 50%, plus the number we really need. */
1747 yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
1748 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1749 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
1750 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1751 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1754 YY_G(yy_n_chars) += number_to_move;
1755 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1756 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1758 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1764 /* yy_get_previous_state - get the state just before the EOB char was reached */
1768 static yy_state_type yy_get_previous_state YYFARGS0(void)
1771 yy_state_type yyFlexLexer::yy_get_previous_state()
1774 yy_state_type yy_current_state;
1776 M4_YY_DECL_GUTS_VAR();
1778 %% [15.0] code to get the start state into yy_current_state goes here
1780 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1782 %% [16.0] code to find the next state goes here
1785 return yy_current_state;
1789 /* yy_try_NUL_trans - try to make a transition on the NUL character
1792 * next_state = yy_try_NUL_trans( current_state );
1795 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1798 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1802 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1803 %% [17.0] code to find the next state, and perhaps do backing up, goes here
1805 M4_YY_NOOP_GUTS_VAR();
1806 return yy_is_jam ? 0 : yy_current_state;
1811 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1814 static void yyunput YYFARGS2( int,c, char *,yy_bp)
1818 void yyFlexLexer::yyunput( int c, char* yy_bp)
1822 M4_YY_DECL_GUTS_VAR();
1824 yy_cp = YY_G(yy_c_buf_p);
1826 /* undo effects of setting up yytext */
1827 *yy_cp = YY_G(yy_hold_char);
1829 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1830 { /* need to shift things up to make room */
1831 /* +2 for EOB chars. */
1832 yy_size_t number_to_move = YY_G(yy_n_chars) + 2;
1833 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1834 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1836 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1838 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1839 *--dest = *--source;
1841 yy_cp += (int) (dest - source);
1842 yy_bp += (int) (dest - source);
1843 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1844 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1846 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1847 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1850 *--yy_cp = (char) c;
1852 %% [18.0] update yylineno here
1853 m4_ifdef( [[M4_YY_USE_LINENO]],
1860 YY_G(yytext_ptr) = yy_bp;
1861 YY_G(yy_hold_char) = *yy_cp;
1862 YY_G(yy_c_buf_p) = yy_cp;
1864 #endif /* ifndef YY_NO_UNPUT */
1872 static int yyinput YYFARGS0(void)
1874 static int input YYFARGS0(void)
1879 int yyFlexLexer::yyinput()
1883 M4_YY_DECL_GUTS_VAR();
1885 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1887 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1889 /* yy_c_buf_p now points to the character we want to return.
1890 * If this occurs *before* the EOB characters, then it's a
1891 * valid NUL; if not, then we've hit the end of the buffer.
1893 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1894 /* This was really a NUL. */
1895 *YY_G(yy_c_buf_p) = '\0';
1898 { /* need more input */
1899 yy_size_t offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1902 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1904 case EOB_ACT_LAST_MATCH:
1905 /* This happens because yy_g_n_b()
1906 * sees that we've accumulated a
1907 * token and flags that we need to
1908 * try matching the token before
1909 * proceeding. But for input(),
1910 * there's no matching to consider.
1911 * So convert the EOB_ACT_LAST_MATCH
1912 * to EOB_ACT_END_OF_FILE.
1915 /* Reset buffer status. */
1916 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1920 case EOB_ACT_END_OF_FILE:
1922 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1925 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1928 return yyinput(M4_YY_CALL_ONLY_ARG);
1930 return input(M4_YY_CALL_ONLY_ARG);
1934 case EOB_ACT_CONTINUE_SCAN:
1935 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1941 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
1942 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
1943 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1945 %% [19.0] update BOL and yylineno
1950 #endif /* ifndef YY_NO_INPUT */
1953 /** Immediately switch to a different input stream.
1954 * @param input_file A readable stream.
1956 * @note This function does not reset the start condition to @c INITIAL .
1959 void yyrestart YYFARGS1( FILE *,input_file)
1962 void yyFlexLexer::yyrestart( std::istream* input_file )
1965 M4_YY_DECL_GUTS_VAR();
1967 if ( ! YY_CURRENT_BUFFER ){
1968 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1969 YY_CURRENT_BUFFER_LVALUE =
1970 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1973 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1974 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1977 /** Switch to a different input buffer.
1978 * @param new_buffer The new input buffer.
1982 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1985 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1988 M4_YY_DECL_GUTS_VAR();
1990 /* TODO. We should be able to replace this entire function body
1992 * yypop_buffer_state();
1993 * yypush_buffer_state(new_buffer);
1995 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1996 if ( YY_CURRENT_BUFFER == new_buffer )
1999 if ( YY_CURRENT_BUFFER )
2001 /* Flush out information for old buffer. */
2002 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2003 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2004 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2007 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2008 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2010 /* We don't actually know whether we did this switch during
2011 * EOF (yywrap()) processing, but the only time this flag
2012 * is looked at is after yywrap() is called, so it's safe
2013 * to go ahead and always set it.
2015 YY_G(yy_did_buffer_switch_on_eof) = 1;
2020 static void yy_load_buffer_state YYFARGS0(void)
2023 void yyFlexLexer::yy_load_buffer_state()
2026 M4_YY_DECL_GUTS_VAR();
2027 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2028 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2029 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2030 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
2033 /** Allocate and initialize an input buffer state.
2034 * @param file A readable stream.
2035 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2037 * @return the allocated buffer state.
2040 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
2043 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2047 m4_dnl M4_YY_DECL_GUTS_VAR();
2049 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2051 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2053 b->yy_buf_size = size;
2055 /* yy_ch_buf has to be 2 characters longer than the size given because
2056 * we need to put in 2 end-of-buffer characters.
2058 b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
2059 if ( ! b->yy_ch_buf )
2060 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2062 b->yy_is_our_buffer = 1;
2064 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2069 /** Destroy the buffer.
2070 * @param b a buffer created with yy_create_buffer()
2074 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2077 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2080 M4_YY_DECL_GUTS_VAR();
2085 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2086 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2088 if ( b->yy_is_our_buffer )
2089 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2091 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2095 /* Initializes or reinitializes a buffer.
2096 * This function is sometimes called more than once on the same buffer,
2097 * such as during a yyrestart() or at EOF.
2100 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2103 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2108 M4_YY_DECL_GUTS_VAR();
2110 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2112 b->yy_input_file = file;
2113 b->yy_fill_buffer = 1;
2115 /* If b is the current buffer, then yy_init_buffer was _probably_
2116 * called from yyrestart() or through yy_get_next_buffer.
2117 * In that case, we don't want to reset the lineno or column.
2119 if (b != YY_CURRENT_BUFFER){
2120 b->yy_bs_lineno = 1;
2121 b->yy_bs_column = 0;
2125 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2127 b->yy_is_interactive = 1;
2130 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2132 b->yy_is_interactive = 0;
2135 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2140 b->yy_is_interactive = 0;
2145 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2146 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2150 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2153 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2156 M4_YY_DECL_GUTS_VAR();
2162 /* We always need two end-of-buffer characters. The first causes
2163 * a transition to the end-of-buffer state. The second causes
2164 * a jam in that state.
2166 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2167 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2169 b->yy_buf_pos = &b->yy_ch_buf[0];
2172 b->yy_buffer_status = YY_BUFFER_NEW;
2174 if ( b == YY_CURRENT_BUFFER )
2175 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2179 /** Pushes the new state onto the stack. The new state becomes
2180 * the current state. This function will allocate the stack
2182 * @param new_buffer The new state.
2186 void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2189 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2192 M4_YY_DECL_GUTS_VAR();
2193 if (new_buffer == NULL)
2196 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2198 /* This block is copied from yy_switch_to_buffer. */
2199 if ( YY_CURRENT_BUFFER )
2201 /* Flush out information for old buffer. */
2202 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2203 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2204 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2207 /* Only push if top exists. Otherwise, replace top. */
2208 if (YY_CURRENT_BUFFER)
2209 YY_G(yy_buffer_stack_top)++;
2210 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2212 /* copied from yy_switch_to_buffer. */
2213 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2214 YY_G(yy_did_buffer_switch_on_eof) = 1;
2220 /** Removes and deletes the top of the stack, if present.
2221 * The next element becomes the new top.
2225 void yypop_buffer_state YYFARGS0(void)
2228 void yyFlexLexer::yypop_buffer_state (void)
2231 M4_YY_DECL_GUTS_VAR();
2232 if (!YY_CURRENT_BUFFER)
2235 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2236 YY_CURRENT_BUFFER_LVALUE = NULL;
2237 if (YY_G(yy_buffer_stack_top) > 0)
2238 --YY_G(yy_buffer_stack_top);
2240 if (YY_CURRENT_BUFFER) {
2241 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2242 YY_G(yy_did_buffer_switch_on_eof) = 1;
2249 /* Allocates the stack if it does not exist.
2250 * Guarantees space for at least one push.
2253 static void yyensure_buffer_stack YYFARGS0(void)
2256 void yyFlexLexer::yyensure_buffer_stack(void)
2259 yy_size_t num_to_alloc;
2260 M4_YY_DECL_GUTS_VAR();
2262 if (!YY_G(yy_buffer_stack)) {
2264 /* First allocation is just for 2 elements, since we don't know if this
2265 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2266 * immediate realloc on the next call.
2269 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2270 (num_to_alloc * sizeof(struct yy_buffer_state*)
2271 M4_YY_CALL_LAST_ARG);
2272 if ( ! YY_G(yy_buffer_stack) )
2273 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2276 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2278 YY_G(yy_buffer_stack_max) = num_to_alloc;
2279 YY_G(yy_buffer_stack_top) = 0;
2283 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2285 /* Increase the buffer to prepare for a possible push. */
2286 int grow_size = 8 /* arbitrary grow size */;
2288 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2289 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2290 (YY_G(yy_buffer_stack),
2291 num_to_alloc * sizeof(struct yy_buffer_state*)
2292 M4_YY_CALL_LAST_ARG);
2293 if ( ! YY_G(yy_buffer_stack) )
2294 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2296 /* zero only the new slots.*/
2297 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2298 YY_G(yy_buffer_stack_max) = num_to_alloc;
2306 m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2309 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2310 * @param base the character buffer
2311 * @param size the size in bytes of the character buffer
2313 * @return the newly allocated buffer state object.
2315 YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2318 m4_dnl M4_YY_DECL_GUTS_VAR();
2321 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2322 base[size-1] != YY_END_OF_BUFFER_CHAR )
2323 /* They forgot to leave room for the EOB's. */
2326 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2328 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2330 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2331 b->yy_buf_pos = b->yy_ch_buf = base;
2332 b->yy_is_our_buffer = 0;
2333 b->yy_input_file = 0;
2334 b->yy_n_chars = b->yy_buf_size;
2335 b->yy_is_interactive = 0;
2337 b->yy_fill_buffer = 0;
2338 b->yy_buffer_status = YY_BUFFER_NEW;
2340 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2348 m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2351 /** Setup the input buffer state to scan a string. The next call to yylex() will
2352 * scan from a @e copy of @a str.
2353 * @param yystr a NUL-terminated string to scan
2355 * @return the newly allocated buffer state object.
2356 * @note If you want to scan bytes that may contain NUL values, then use
2357 * yy_scan_bytes() instead.
2359 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2361 m4_dnl M4_YY_DECL_GUTS_VAR();
2363 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2369 m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2372 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2373 * scan from a @e copy of @a bytes.
2374 * @param yybytes the byte buffer to scan
2375 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2377 * @return the newly allocated buffer state object.
2379 YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)
2385 m4_dnl M4_YY_DECL_GUTS_VAR();
2387 /* Get memory for full buffer, including space for trailing EOB's. */
2388 n = _yybytes_len + 2;
2389 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2391 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2393 for ( i = 0; i < _yybytes_len; ++i )
2394 buf[i] = yybytes[i];
2396 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2398 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2400 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2402 /* It's okay to grow etc. this buffer, and we should throw it
2403 * away when we're done.
2405 b->yy_is_our_buffer = 1;
2413 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2416 static void yy_push_state YYFARGS1( int ,new_state)
2419 void yyFlexLexer::yy_push_state( int new_state )
2422 M4_YY_DECL_GUTS_VAR();
2423 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2427 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2428 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2430 if ( ! YY_G(yy_start_stack) )
2431 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2434 YY_G(yy_start_stack) = (int *) yyrealloc(
2435 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2437 if ( ! YY_G(yy_start_stack) )
2438 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2441 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2448 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2451 static void yy_pop_state YYFARGS0(void)
2454 void yyFlexLexer::yy_pop_state()
2457 M4_YY_DECL_GUTS_VAR();
2458 if ( --YY_G(yy_start_stack_ptr) < 0 )
2459 YY_FATAL_ERROR( "start-condition stack underflow" );
2461 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2466 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2469 static int yy_top_state YYFARGS0(void)
2472 int yyFlexLexer::yy_top_state()
2475 M4_YY_DECL_GUTS_VAR();
2476 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2480 #ifndef YY_EXIT_FAILURE
2481 #define YY_EXIT_FAILURE 2
2485 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2487 m4_dnl M4_YY_DECL_GUTS_VAR();
2488 (void) fprintf( stderr, "%s\n", msg );
2489 exit( YY_EXIT_FAILURE );
2493 void yyFlexLexer::LexerError( yyconst char msg[] )
2495 M4_YY_DECL_GUTS_VAR();
2496 std::cerr << msg << std::endl;
2497 exit( YY_EXIT_FAILURE );
2501 /* Redefine yyless() so it works in section 3 code. */
2507 /* Undo effects of setting up yytext. */ \
2508 int yyless_macro_arg = (n); \
2509 YY_LESS_LINENO(yyless_macro_arg);\
2510 yytext[yyleng] = YY_G(yy_hold_char); \
2511 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2512 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2513 *YY_G(yy_c_buf_p) = '\0'; \
2514 yyleng = yyless_macro_arg; \
2520 /* Accessor methods (get/set functions) to struct members. */
2524 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2526 /** Get the user-defined data for this scanner.
2529 YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2531 M4_YY_DECL_GUTS_VAR();
2537 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2539 /** Get the current line number.
2542 int yyget_lineno YYFARGS0(void)
2544 M4_YY_DECL_GUTS_VAR();
2546 m4_ifdef( [[M4_YY_REENTRANT]],
2548 if (! YY_CURRENT_BUFFER)
2555 m4_ifdef( [[M4_YY_REENTRANT]],
2557 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2559 /** Get the current column number.
2562 int yyget_column YYFARGS0(void)
2564 M4_YY_DECL_GUTS_VAR();
2566 m4_ifdef( [[M4_YY_REENTRANT]],
2568 if (! YY_CURRENT_BUFFER)
2576 m4_ifdef( [[M4_YY_NO_GET_IN]],,
2578 /** Get the input stream.
2581 FILE *yyget_in YYFARGS0(void)
2583 M4_YY_DECL_GUTS_VAR();
2588 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2590 /** Get the output stream.
2593 FILE *yyget_out YYFARGS0(void)
2595 M4_YY_DECL_GUTS_VAR();
2600 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2602 /** Get the length of the current token.
2605 yy_size_t yyget_leng YYFARGS0(void)
2607 M4_YY_DECL_GUTS_VAR();
2612 /** Get the current token.
2615 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2617 char *yyget_text YYFARGS0(void)
2619 M4_YY_DECL_GUTS_VAR();
2625 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2627 /** Set the user-defined data. This data is never touched by the scanner.
2628 * @param user_defined The data to be associated with this scanner.
2631 void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2633 M4_YY_DECL_GUTS_VAR();
2634 yyextra = user_defined ;
2639 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2641 /** Set the current line number.
2642 * @param line_number
2645 void yyset_lineno YYFARGS1( int ,line_number)
2647 M4_YY_DECL_GUTS_VAR();
2649 m4_ifdef( [[M4_YY_REENTRANT]],
2651 /* lineno is only valid if an input buffer exists. */
2652 if (! YY_CURRENT_BUFFER )
2653 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2655 yylineno = line_number;
2659 m4_ifdef( [[M4_YY_REENTRANT]],
2661 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2663 /** Set the current column.
2664 * @param line_number
2667 void yyset_column YYFARGS1( int , column_no)
2669 M4_YY_DECL_GUTS_VAR();
2671 m4_ifdef( [[M4_YY_REENTRANT]],
2673 /* column is only valid if an input buffer exists. */
2674 if (! YY_CURRENT_BUFFER )
2675 YY_FATAL_ERROR( "yyset_column called with no buffer" );
2677 yycolumn = column_no;
2683 m4_ifdef( [[M4_YY_NO_SET_IN]],,
2685 /** Set the input stream. This does not discard the current
2687 * @param in_str A readable stream.
2689 * @see yy_switch_to_buffer
2691 void yyset_in YYFARGS1( FILE * ,in_str)
2693 M4_YY_DECL_GUTS_VAR();
2698 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2700 void yyset_out YYFARGS1( FILE * ,out_str)
2702 M4_YY_DECL_GUTS_VAR();
2708 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2710 int yyget_debug YYFARGS0(void)
2712 M4_YY_DECL_GUTS_VAR();
2713 return yy_flex_debug;
2717 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2719 void yyset_debug YYFARGS1( int ,bdebug)
2721 M4_YY_DECL_GUTS_VAR();
2722 yy_flex_debug = bdebug ;
2728 /* Accessor methods for yylval and yylloc */
2731 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2733 YYSTYPE * yyget_lval YYFARGS0(void)
2735 M4_YY_DECL_GUTS_VAR();
2740 m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2742 void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2744 M4_YY_DECL_GUTS_VAR();
2745 yylval = yylval_param;
2749 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2751 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2753 YYLTYPE *yyget_lloc YYFARGS0(void)
2755 M4_YY_DECL_GUTS_VAR();
2760 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2762 void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2764 M4_YY_DECL_GUTS_VAR();
2765 yylloc = yylloc_param;
2773 /* User-visible API */
2775 /* yylex_init is special because it creates the scanner itself, so it is
2776 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2777 * That's why we explicitly handle the declaration, instead of using our macros.
2779 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2781 int yylex_init( ptr_yy_globals )
2782 yyscan_t* ptr_yy_globals;
2785 int yylex_init(yyscan_t* ptr_yy_globals)
2788 if (ptr_yy_globals == NULL){
2793 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2795 if (*ptr_yy_globals == NULL){
2800 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2801 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2803 return yy_init_globals ( *ptr_yy_globals );
2807 /* yylex_init_extra has the same functionality as yylex_init, but follows the
2808 * convention of taking the scanner as the last argument. Note however, that
2809 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2810 * is the reason, too, why this function also must handle its own declaration).
2811 * The user defined value in the first argument will be available to yyalloc in
2812 * the yyextra field.
2814 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2816 int yylex_init_extra( yy_user_defined, ptr_yy_globals )
2817 YY_EXTRA_TYPE yy_user_defined;
2818 yyscan_t* ptr_yy_globals;
2821 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2824 struct yyguts_t dummy_yyguts;
2826 yyset_extra (yy_user_defined, &dummy_yyguts);
2828 if (ptr_yy_globals == NULL){
2833 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2835 if (*ptr_yy_globals == NULL){
2840 /* By setting to 0xAA, we expose bugs in
2841 yy_init_globals. Leave at 0x00 for releases. */
2842 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2844 yyset_extra (yy_user_defined, *ptr_yy_globals);
2846 return yy_init_globals ( *ptr_yy_globals );
2853 static int yy_init_globals YYFARGS0(void)
2855 M4_YY_DECL_GUTS_VAR();
2856 /* Initialization is the same as for the non-reentrant scanner.
2857 * This function is called from yylex_destroy(), so don't allocate here.
2860 m4_ifdef( [[M4_YY_USE_LINENO]],
2862 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2864 /* We do not touch yylineno unless the option is enabled. */
2868 YY_G(yy_buffer_stack) = 0;
2869 YY_G(yy_buffer_stack_top) = 0;
2870 YY_G(yy_buffer_stack_max) = 0;
2871 YY_G(yy_c_buf_p) = (char *) 0;
2875 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2877 YY_G(yy_start_stack_ptr) = 0;
2878 YY_G(yy_start_stack_depth) = 0;
2879 YY_G(yy_start_stack) = NULL;
2882 m4_ifdef( [[M4_YY_USES_REJECT]],
2884 YY_G(yy_state_buf) = 0;
2885 YY_G(yy_state_ptr) = 0;
2886 YY_G(yy_full_match) = 0;
2890 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2892 YY_G(yytext_ptr) = 0;
2893 YY_G(yy_more_offset) = 0;
2894 YY_G(yy_prev_more_offset) = 0;
2897 /* Defined in main.c */
2906 /* For future reference: Set errno on error, since we are called by
2914 %if-c-only SNIP! this currently causes conflicts with the c++ scanner
2915 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2916 int yylex_destroy YYFARGS0(void)
2918 M4_YY_DECL_GUTS_VAR();
2920 /* Pop the buffer stack, destroying each element. */
2921 while(YY_CURRENT_BUFFER){
2922 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2923 YY_CURRENT_BUFFER_LVALUE = NULL;
2924 yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2927 /* Destroy the stack itself. */
2928 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2929 YY_G(yy_buffer_stack) = NULL;
2931 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2933 /* Destroy the start condition stack. */
2934 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2935 YY_G(yy_start_stack) = NULL;
2938 m4_ifdef( [[M4_YY_USES_REJECT]],
2940 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2941 YY_G(yy_state_buf) = NULL;
2944 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2945 * yylex() is called, initialization will occur. */
2946 yy_init_globals( M4_YY_CALL_ONLY_ARG);
2949 /* Destroy the main struct (reentrant only). */
2950 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2958 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2961 * Internal utility routines.
2965 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2968 static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2971 for ( i = 0; i < n; ++i )
2977 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2979 #ifdef YY_NEED_STRLEN
2980 static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2983 for ( n = 0; s[n]; ++n )
2991 m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
2993 void *yyalloc YYFARGS1( yy_size_t ,size)
2995 return (void *) malloc( size );
2999 m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
3001 void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
3003 /* The cast to (char *) in the following accommodates both
3004 * implementations that use char* generic pointers, and those
3005 * that use void* generic pointers. It works with the latter
3006 * because both ANSI C and C++ allow castless assignment from
3007 * any pointer type to void*, and deal with argument conversions
3008 * as though doing an assignment.
3010 return (void *) realloc( (char *) ptr, size );
3014 m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
3016 void yyfree YYFARGS1( void *,ptr)
3018 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3022 %if-tables-serialization definitions
3023 m4preproc_include(`tables_shared.c')
3025 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
3028 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3032 rd->bread += sizeof(flex_uint8_t);
3036 static int yytbl_read16 (void *v, struct yytbl_reader * rd)
3039 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3043 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3044 rd->bread += sizeof(flex_uint16_t);
3048 static int yytbl_read32 (void *v, struct yytbl_reader * rd)
3051 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3055 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3056 rd->bread += sizeof(flex_uint32_t);
3060 /** Read the header */
3061 static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3064 memset (th, 0, sizeof (struct yytbl_hdr));
3066 if (yytbl_read32 (&(th->th_magic), rd) != 0)
3069 if (th->th_magic != YYTBL_MAGIC){
3070 YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */
3074 if (yytbl_read32 (&(th->th_hsize), rd) != 0
3075 || yytbl_read32 (&(th->th_ssize), rd) != 0
3076 || yytbl_read16 (&(th->th_flags), rd) != 0)
3079 /* Sanity check on header size. Greater than 1k suggests some funny business. */
3080 if (th->th_hsize < 16 || th->th_hsize > 1024){
3081 YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */
3085 /* Allocate enough space for the version and name fields */
3086 bytes = th->th_hsize - 14;
3087 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3088 if ( ! th->th_version )
3089 YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
3091 /* we read it all into th_version, and point th_name into that data */
3092 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
3094 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3095 th->th_version = NULL;
3101 th->th_name = th->th_version + strlen (th->th_version) + 1;
3105 /** lookup id in the dmap list.
3106 * @param dmap pointer to first element in list
3107 * @return NULL if not found.
3109 static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3113 if (dmap->dm_id == id)
3120 /** Read a table while mapping its contents to the local array.
3121 * @param dmap used to performing mapping
3122 * @return 0 on success
3124 static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3126 struct yytbl_data td;
3127 struct yytbl_dmap *transdmap=0;
3128 int len, i, rv, inner_loop_count;
3131 memset (&td, 0, sizeof (struct yytbl_data));
3133 if (yytbl_read16 (&td.td_id, rd) != 0
3134 || yytbl_read16 (&td.td_flags, rd) != 0
3135 || yytbl_read32 (&td.td_hilen, rd) != 0
3136 || yytbl_read32 (&td.td_lolen, rd) != 0)
3139 /* Lookup the map for the transition table so we have it in case we need it
3140 * inside the loop below. This scanner might not even have a transition
3141 * table, which is ok.
3143 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3145 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3146 YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */
3150 /* Allocate space for table.
3151 * The --full yy_transition table is a special case, since we
3152 * need the dmap.dm_sz entry to tell us the sizeof the individual
3158 if ((td.td_flags & YYTD_STRUCT))
3159 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3161 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3163 if(M4_YY_TABLES_VERIFY)
3164 /* We point to the array itself */
3167 /* We point to the address of a pointer. */
3168 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3170 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
3173 /* If it's a struct, we read 2 integers to get one element */
3174 if ((td.td_flags & YYTD_STRUCT) != 0)
3175 inner_loop_count = 2;
3177 inner_loop_count = 1;
3179 /* read and map each element.
3180 * This loop iterates once for each element of the td_data array.
3181 * Notice that we increment 'i' in the inner loop.
3183 len = yytbl_calc_total_len (&td);
3184 for (i = 0; i < len; ){
3188 /* This loop really executes exactly 1 or 2 times.
3189 * The second time is to handle the second member of the
3190 * YYTD_STRUCT for the yy_transition array.
3192 for (j = 0; j < inner_loop_count; j++, i++) {
3195 /* read into t32 no matter what the real size is. */
3200 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3201 case sizeof (flex_int32_t):
3202 rv = yytbl_read32 (&t32, rd);
3204 case sizeof (flex_int16_t):
3205 rv = yytbl_read16 (&t16, rd);
3208 case sizeof (flex_int8_t):
3209 rv = yytbl_read8 (&t8, rd);
3213 YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */
3220 /* copy into the deserialized array... */
3222 if ((td.td_flags & YYTD_STRUCT)) {
3223 /* t32 is the j'th member of a two-element struct. */
3226 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3227 : &(((struct yy_trans_info *) p)->yy_nxt);
3229 switch (dmap->dm_sz) {
3230 case sizeof (flex_int32_t):
3231 if (M4_YY_TABLES_VERIFY){
3232 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3233 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" );
3235 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3237 case sizeof (flex_int16_t):
3238 if (M4_YY_TABLES_VERIFY ){
3239 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3240 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" );
3242 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3244 case sizeof(flex_int8_t):
3245 if (M4_YY_TABLES_VERIFY ){
3246 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3247 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" );
3249 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3252 YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */
3256 /* if we're done with j, increment p */
3258 p = (struct yy_trans_info *) p + 1;
3260 else if ((td.td_flags & YYTD_PTRANS)) {
3261 /* t32 is an index into the transition array. */
3262 struct yy_trans_info *v;
3266 YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */
3270 if( M4_YY_TABLES_VERIFY)
3271 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3273 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3275 if(M4_YY_TABLES_VERIFY ){
3276 if( ((struct yy_trans_info **) p)[0] != v)
3277 YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
3279 ((struct yy_trans_info **) p)[0] = v;
3282 p = (struct yy_trans_info **) p + 1;
3285 /* t32 is a plain int. copy data, then incrememnt p. */
3286 switch (dmap->dm_sz) {
3287 case sizeof (flex_int32_t):
3288 if(M4_YY_TABLES_VERIFY ){
3289 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3290 YY_FATAL_ERROR( "tables verification failed at flex_int32_t" );
3292 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3293 p = ((flex_int32_t *) p) + 1;
3295 case sizeof (flex_int16_t):
3296 if(M4_YY_TABLES_VERIFY ){
3297 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3298 YY_FATAL_ERROR( "tables verification failed at flex_int16_t" );
3300 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3301 p = ((flex_int16_t *) p) + 1;
3303 case sizeof (flex_int8_t):
3304 if(M4_YY_TABLES_VERIFY ){
3305 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3306 YY_FATAL_ERROR( "tables verification failed at flex_int8_t" );
3308 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3309 p = ((flex_int8_t *) p) + 1;
3312 YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */
3320 /* Now eat padding. */
3323 pad = yypad64(rd->bread);
3326 if(yytbl_read8(&t8,rd) != 0)
3334 %define-yytables The name for this specific scanner's tables.
3336 /* Find the key and load the DFA tables from the given stream. */
3337 static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3340 struct yytbl_hdr th;
3341 struct yytbl_reader rd;
3344 th.th_version = NULL;
3346 /* Keep trying until we find the right set of tables or end of file. */
3347 while (!feof(rd.fp)) {
3349 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3354 /* A NULL key means choose the first set of tables. */
3358 if (strcmp(th.th_name,key) != 0){
3359 /* Skip ahead to next set */
3360 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3361 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3362 th.th_version = NULL;
3368 while (rd.bread < th.th_ssize){
3369 /* Load the data tables */
3370 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3378 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3379 th.th_version = NULL;
3385 /** Load the DFA tables for this scanner from the given stream. */
3386 int yytables_fload YYFARGS1(FILE *, fp)
3389 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3394 /** Destroy the loaded tables, freeing memory, etc.. */
3395 int yytables_destroy YYFARGS0(void)
3397 struct yytbl_dmap *dmap=0;
3399 if(!M4_YY_TABLES_VERIFY){
3400 /* Walk the dmap, freeing the pointers */
3401 for(dmap=yydmap; dmap->dm_id; dmap++) {
3404 if(v && *(char**)v){
3405 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3414 /* end table serialization code definitions */
3418 m4_ifdef([[M4_YY_MAIN]], [[
3419 int main M4_YY_PARAMS(void);
3428 yylex_destroy( lexer);
3440 m4_ifdef( [[M4_YY_IN_HEADER]],
3443 #undef YY_FLUSH_BUFFER
3445 #undef yy_new_buffer
3446 #undef yy_set_interactive
3447 #undef YY_DO_BEFORE_ACTION
3449 #ifdef YY_DECL_IS_OURS
3450 #undef YY_DECL_IS_OURS