1 %# -*-C-*- vi: set ft=c:
2 %# This file is processed in several stages.
3 %# Here are the stages, as best as I can describe:
5 %# 1. flex.skl is processed through GNU m4 during the
6 %# pre-compilation stage of flex. Only macros starting
7 %# with `m4preproc_' are processed, and quoting is normal.
9 %# 2. The preprocessed skeleton is translated verbatim into a
10 %# C array, saved as "skel.c" and compiled into the flex binary.
12 %# 3. At runtime, the skeleton is generated and filtered (again)
13 %# through m4. Macros beginning with `m4_' will be processed.
14 %# The quoting is "[[" and "]]" so we don't interfere with
17 %# All generate macros for the m4 stage contain the text "m4" or "M4"
18 %# in them. This is to distinguish them from CPP macros.
19 %# The exception to this rule is YY_G, which is an m4 macro,
20 %# but it needs to be remain short because it is used everywhere.
22 /* A lexical scanner generated by flex */
24 %# Macros for preproc stage.
27 %# Macros for runtime processing stage.
30 m4_changequote([[, ]])
33 %# Lines in this skeleton starting with a "%" character are "control lines"
34 %# and affect the generation of the scanner. The possible control codes are
35 %# listed and processed in misc.c.
37 %# %# - A comment. The current line is omitted from the generated scanner.
38 %# %if-c++-only - The following lines are printed for C++ scanners ONLY.
39 %# %if-c-only - The following lines are NOT printed for C++ scanners.
40 %# %if-c-or-c++ - The following lines are printed in BOTH C and C++ scanners.
41 %# %if-reentrant - Print for reentrant scanners.(push)
42 %# %if-not-reentrant - Print for non-reentrant scanners. (push)
43 %# %if-bison-bridge - Print for bison-bridge. (push)
44 %# %if-not-bison-bridge - Print for non-bison-bridge. (push)
45 %# %endif - pop from the previous if code.
46 %# %% - A stop-point, where code is inserted by flex.
47 %# Each stop-point is numbered here and also in the code generator.
48 %# (See gen.c, etc. for details.)
49 %# %not-for-header - Begin code that should NOT appear in a ".h" file.
50 %# %ok-for-header - %c and %e are used for building a header file.
51 %# %if-tables-serialization
53 %# All control-lines EXCEPT comment lines ("%#") will be inserted into
54 %# the generated scanner as a C-style comment. This is to aid those who
61 m4_ifelse(M4_YY_PREFIX,yy,,
62 #define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]
63 #define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]
64 #define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
65 #define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]
66 #define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]
67 #define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]
68 #define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]
69 #define yyin M4_YY_PREFIX[[in]]
70 #define yyleng M4_YY_PREFIX[[leng]]
71 #define yylex M4_YY_PREFIX[[lex]]
72 #define yylineno M4_YY_PREFIX[[lineno]]
73 #define yyout M4_YY_PREFIX[[out]]
74 #define yyrestart M4_YY_PREFIX[[restart]]
75 #define yytext M4_YY_PREFIX[[text]]
76 #define yywrap M4_YY_PREFIX[[wrap]]
77 #define yyalloc M4_YY_PREFIX[[alloc]]
78 #define yyrealloc M4_YY_PREFIX[[realloc]]
79 #define yyfree M4_YY_PREFIX[[free]]
86 #define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
87 #define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
88 #define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
89 #if YY_FLEX_SUBMINOR_VERSION > 0
93 %# Some negated symbols
94 m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])
95 m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])
97 %# This is the m4 way to say "(stack_used || is_reentrant)
98 m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
99 m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
102 %# The complexity here is necessary so that m4 preserves
103 %# the argument lists to each C function.
106 m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
108 m4preproc_define(`M4_GEN_PREFIX',
109 ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
112 /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
113 * following macro. This is required in order to pass the c++-multiple-scanners
114 * test in the regression suite. We get reports that it breaks inheritance.
115 * We will address this in a future release of flex, or omit the C++ scanner
118 #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
122 M4_GEN_PREFIX(`_create_buffer')
123 M4_GEN_PREFIX(`_delete_buffer')
124 M4_GEN_PREFIX(`_scan_buffer')
125 M4_GEN_PREFIX(`_scan_string')
126 M4_GEN_PREFIX(`_scan_bytes')
127 M4_GEN_PREFIX(`_init_buffer')
128 M4_GEN_PREFIX(`_flush_buffer')
129 M4_GEN_PREFIX(`_load_buffer_state')
130 M4_GEN_PREFIX(`_switch_to_buffer')
131 M4_GEN_PREFIX(`push_buffer_state')
132 M4_GEN_PREFIX(`pop_buffer_state')
133 M4_GEN_PREFIX(`ensure_buffer_stack')
135 M4_GEN_PREFIX(`restart')
136 M4_GEN_PREFIX(`lex_init')
137 M4_GEN_PREFIX(`lex_init_extra')
138 M4_GEN_PREFIX(`lex_destroy')
139 M4_GEN_PREFIX(`get_debug')
140 M4_GEN_PREFIX(`set_debug')
141 M4_GEN_PREFIX(`get_extra')
142 M4_GEN_PREFIX(`set_extra')
143 M4_GEN_PREFIX(`get_in')
144 M4_GEN_PREFIX(`set_in')
145 M4_GEN_PREFIX(`get_out')
146 M4_GEN_PREFIX(`set_out')
147 M4_GEN_PREFIX(`get_leng')
148 M4_GEN_PREFIX(`get_text')
149 M4_GEN_PREFIX(`get_lineno')
150 M4_GEN_PREFIX(`set_lineno')
151 m4_ifdef( [[M4_YY_REENTRANT]],
153 M4_GEN_PREFIX(`get_column')
154 M4_GEN_PREFIX(`set_column')
156 M4_GEN_PREFIX(`wrap')
159 m4_ifdef( [[M4_YY_BISON_LVAL]],
161 M4_GEN_PREFIX(`get_lval')
162 M4_GEN_PREFIX(`set_lval')
165 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
167 M4_GEN_PREFIX(`get_lloc')
168 M4_GEN_PREFIX(`set_lloc')
172 M4_GEN_PREFIX(`alloc')
173 M4_GEN_PREFIX(`realloc')
174 M4_GEN_PREFIX(`free')
177 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
179 M4_GEN_PREFIX(`text')
180 M4_GEN_PREFIX(`leng')
183 M4_GEN_PREFIX(`_flex_debug')
184 M4_GEN_PREFIX(`lineno')
189 m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
191 M4_GEN_PREFIX(`tables_fload')
192 M4_GEN_PREFIX(`tables_destroy')
193 M4_GEN_PREFIX(`TABLES_NAME')
196 /* First, we deal with platform-specific or compiler-specific issues. */
198 /* begin standard C headers. */
206 %if-tables-serialization
207 #include <sys/types.h>
208 #include <netinet/in.h>
210 /* end standard C headers. */
213 m4preproc_include(`flexint.h')
217 /* begin standard C++ headers. */
223 /* end standard C++ headers. */
228 /* The "const" storage-class-modifier is valid. */
231 #else /* ! __cplusplus */
233 /* C99 requires __STDC__ to be defined as 1. */
234 #if defined (__STDC__)
238 #endif /* defined (__STDC__) */
239 #endif /* ! __cplusplus */
242 #define yyconst const
247 %# For compilers that can not handle prototypes.
249 %# The function prototype
250 %# int foo(int x, char* y);
252 %# ...should be written as
253 %# int foo M4_YY_PARAMS(int x, char* y);
255 %# ...which could possibly generate
258 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
260 m4_define( [[M4_YY_PARAMS]], [[()]])
263 m4_define( [[M4_YY_PARAMS]], [[($*)]])
267 /* Returned upon end-of-file. */
272 /* Promotes a possibly negative, possibly signed char to an unsigned
273 * integer for use as an array index. If the signed char is negative,
274 * we want to instead treat it as an 8-bit unsigned char, hence the
277 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
284 /* An opaque pointer. */
285 #ifndef YY_TYPEDEF_YY_SCANNER_T
286 #define YY_TYPEDEF_YY_SCANNER_T
287 typedef void* yyscan_t;
290 %# Declare yyguts variable
291 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
292 %# Perform a noop access on yyguts to prevent unused variable complains
293 m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])
294 %# For use wherever a Global is accessed or assigned.
295 m4_define( [[YY_G]], [[yyg->$1]])
297 %# For use in function prototypes to append the additional argument.
298 m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
299 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
301 %# For use in function definitions to append the additional argument.
302 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
304 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
305 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
308 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
309 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
311 m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
313 %# For use in function calls to pass the additional argument.
314 m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
315 m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
317 %# For use in function documentation to adjust for additional argument.
318 m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
320 /* For convenience, these vars (plus the bison vars far below)
321 are macros in the reentrant scanner. */
322 #define yyin YY_G(yyin_r)
323 #define yyout YY_G(yyout_r)
324 #define yyextra YY_G(yyextra_r)
325 #define yyleng YY_G(yyleng_r)
326 #define yytext YY_G(yytext_r)
327 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
328 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
329 #define yy_flex_debug YY_G(yy_flex_debug_r)
331 m4_define( [[M4_YY_INCR_LINENO]],
344 m4_define( [[M4_YY_INCR_LINENO]],
349 %# Define these macros to be no-ops.
350 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
351 m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])
352 m4_define( [[YY_G]], [[($1)]])
353 m4_define( [[M4_YY_PROTO_LAST_ARG]])
354 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
355 m4_define( [[M4_YY_DEF_LAST_ARG]])
357 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
359 m4_define( [[M4_YY_DEF_ONLY_ARG]])
362 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
364 m4_define([[M4_YY_DECL_LAST_ARG]])
365 m4_define([[M4_YY_CALL_LAST_ARG]])
366 m4_define([[M4_YY_CALL_ONLY_ARG]])
367 m4_define( [[M4_YY_DOC_PARAM]], [[]])
372 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
374 %# For compilers that need traditional function definitions.
376 %# The function prototype taking 2 arguments
377 %# int foo (int x, char* y)
379 %# ...should be written as
380 %# int foo YYFARGS2(int,x, char*,y)
382 %# ...which could possibly generate
383 %# int foo (x,y,yyscanner)
386 %# yyscan_t yyscanner;
388 %# Generate traditional function defs
389 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
390 M4_YY_DECL_LAST_ARG]])
391 m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
393 M4_YY_DECL_LAST_ARG]])
394 m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
397 M4_YY_DECL_LAST_ARG]])
398 m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
402 M4_YY_DECL_LAST_ARG]])
405 %# Generate C99 function defs.
406 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
407 m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
408 m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
409 m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
412 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
414 /* Enter a start condition. This macro really ought to take a parameter,
415 * but we do it the disgusting crufty way forced on us by the ()-less
416 * definition of BEGIN.
418 #define BEGIN YY_G(yy_start) = 1 + 2 *
421 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
423 /* Translate the current start state into a value that can be later handed
424 * to BEGIN to return to the state. The YYSTATE alias is for lex
427 #define YY_START ((YY_G(yy_start) - 1) / 2)
428 #define YYSTATE YY_START
431 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
433 /* Action number for EOF rule of a given start state. */
434 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
437 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
439 /* Special action meaning "start processing a new file". */
440 #define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
443 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
445 #define YY_END_OF_BUFFER_CHAR 0
448 /* Size of default input buffer. */
450 #define YY_BUF_SIZE 16384
453 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
455 /* The state buf must be large enough to hold one state per character in the main buffer.
457 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
461 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
462 #define YY_TYPEDEF_YY_BUFFER_STATE
463 typedef struct yy_buffer_state *YY_BUFFER_STATE;
466 #ifndef YY_TYPEDEF_YY_SIZE_T
467 #define YY_TYPEDEF_YY_SIZE_T
468 typedef size_t yy_size_t;
472 extern yy_size_t yyleng;
477 extern FILE *yyin, *yyout;
481 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
483 #define EOB_ACT_CONTINUE_SCAN 0
484 #define EOB_ACT_END_OF_FILE 1
485 #define EOB_ACT_LAST_MATCH 2
488 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
490 m4_ifdef( [[M4_YY_USE_LINENO]],
492 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
493 * access to the local variable yy_act. Since yyless() is a macro, it would break
494 * existing scanners that call yyless() from OUTSIDE yylex.
495 * One obvious solution it to make yy_act a global. I tried that, and saw
496 * a 5% performance hit in a non-yylineno scanner, because yy_act is
497 * normally declared as a register variable-- so it is not worth it.
499 #define YY_LESS_LINENO(n) \
502 for ( yyl = n; yyl < yyleng; ++yyl )\
503 if ( yytext[yyl] == '\n' )\
508 #define YY_LESS_LINENO(n)
512 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
514 /* Return all but the first "n" matched characters back to the input stream. */
518 /* Undo effects of setting up yytext. */ \
519 int yyless_macro_arg = (n); \
520 YY_LESS_LINENO(yyless_macro_arg);\
521 *yy_cp = YY_G(yy_hold_char); \
522 YY_RESTORE_YY_MORE_OFFSET \
523 YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
524 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
529 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
531 #define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
534 #ifndef YY_STRUCT_YY_BUFFER_STATE
535 #define YY_STRUCT_YY_BUFFER_STATE
536 struct yy_buffer_state
543 std::istream* yy_input_file;
547 char *yy_ch_buf; /* input buffer */
548 char *yy_buf_pos; /* current position in input buffer */
550 /* Size of input buffer in bytes, not including room for EOB
553 yy_size_t yy_buf_size;
555 /* Number of characters read into yy_ch_buf, not including EOB
558 yy_size_t yy_n_chars;
560 /* Whether we "own" the buffer - i.e., we know we created it,
561 * and can realloc() it to grow it, and should free() it to
564 int yy_is_our_buffer;
566 /* Whether this is an "interactive" input source; if so, and
567 * if we're using stdio for input, then we want to use getc()
568 * instead of fread(), to make sure we stop fetching input after
571 int yy_is_interactive;
573 /* Whether we're considered to be at the beginning of a line.
574 * If so, '^' rules will be active on the next match, otherwise
579 int yy_bs_lineno; /**< The line count. */
580 int yy_bs_column; /**< The column count. */
583 /* Whether to try to fill the input buffer when we reach the
588 int yy_buffer_status;
589 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
591 #define YY_BUFFER_NEW 0
592 #define YY_BUFFER_NORMAL 1
593 /* When an EOF's been seen but there's still some text to process
594 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
595 * shouldn't try reading from the input source any more. We might
596 * still have a bunch of tokens to match, though, because of
597 * possible backing-up.
599 * When we actually see the EOF, we change the status to "new"
600 * (via yyrestart()), so that the user can continue scanning by
601 * just pointing yyin at a new input file.
603 #define YY_BUFFER_EOF_PENDING 2
606 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
608 %if-c-only Standard (non-C++) definition
612 /* Stack of input buffers. */
613 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
614 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
615 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
620 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
622 /* We provide macros for accessing buffer states in case in the
623 * future we want to put the buffer states in a more general
626 * Returns the top of the stack, or NULL.
628 #define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
629 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
633 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
635 /* Same as previous macro, but useful when we know that the buffer stack is not
636 * NULL or when we need an lvalue. For internal use only.
638 #define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
641 %if-c-only Standard (non-C++) definition
645 /* yy_hold_char holds the character lost when yytext is formed. */
646 static char yy_hold_char;
647 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
650 /* Points to current character in buffer. */
651 static char *yy_c_buf_p = (char *) 0;
652 static int yy_init = 0; /* whether we need to initialize */
653 static int yy_start = 0; /* start state number */
655 /* Flag which is used to allow yywrap()'s to do buffer switches
656 * instead of setting up a fresh yyin. A bit of a hack ...
658 static int yy_did_buffer_switch_on_eof;
662 void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
663 void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
664 YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
665 void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
666 void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
667 void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
668 void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
670 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
672 static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
673 static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
674 static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
677 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
679 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
682 YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
683 YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
684 YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );
688 void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
689 void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
690 void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
692 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
694 #define yy_new_buffer yy_create_buffer
697 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
699 #define yy_set_interactive(is_interactive) \
701 if ( ! YY_CURRENT_BUFFER ){ \
702 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
703 YY_CURRENT_BUFFER_LVALUE = \
704 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
706 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
710 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
712 #define yy_set_bol(at_bol) \
714 if ( ! YY_CURRENT_BUFFER ){\
715 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
716 YY_CURRENT_BUFFER_LVALUE = \
717 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
719 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
723 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
725 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
728 %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
730 %if-c-only Standard (non-C++) definition
732 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
734 static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
735 static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
736 static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
737 static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
742 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
744 /* Done after the current pattern has been matched and before the
745 * corresponding action - sets up yytext.
747 #define YY_DO_BEFORE_ACTION \
748 YY_G(yytext_ptr) = yy_bp; \
749 %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
750 YY_G(yy_hold_char) = *yy_cp; \
752 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
753 YY_G(yy_c_buf_p) = yy_cp;
756 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
758 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
761 m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
763 m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
765 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
767 #ifndef YY_NO_UNISTD_H
768 /* Special case for "unistd.h", since it is non-ANSI. We include it way
769 * down here because we want the user's section 1 to have been scanned first.
770 * The user has a chance to override it with an option.
781 m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
783 #define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
786 #ifndef YY_EXTRA_TYPE
787 #define YY_EXTRA_TYPE void *
792 %if-c-only Reentrant structure and macros (non-C++).
795 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
797 /* Holds the entire state of the reentrant scanner. */
801 /* User-defined. Not touched by flex. */
802 YY_EXTRA_TYPE yyextra_r;
804 /* The rest are the same as the globals declared in the non-reentrant scanner. */
805 FILE *yyin_r, *yyout_r;
806 size_t yy_buffer_stack_top; /**< index of top of stack. */
807 size_t yy_buffer_stack_max; /**< capacity of stack. */
808 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
810 yy_size_t yy_n_chars;
815 int yy_did_buffer_switch_on_eof;
816 int yy_start_stack_ptr;
817 int yy_start_stack_depth;
819 yy_state_type yy_last_accepting_state;
820 char* yy_last_accepting_cpos;
825 m4_ifdef( [[M4_YY_USES_REJECT]],
827 yy_state_type *yy_state_buf;
828 yy_state_type *yy_state_ptr;
832 /* These are only needed for trailing context rules,
833 * but there's no conditional variable for that yet. */
834 int yy_looking_for_trail_begin;
839 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
841 char yytext_r[YYLMAX];
844 int yy_prev_more_offset;
852 m4_ifdef( [[M4_YY_BISON_LVAL]],
857 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
862 }; /* end struct yyguts_t */
867 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
869 static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
875 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
877 m4_ifdef( [[M4_YY_BISON_LVAL]],
879 /* This must go here because YYSTYPE and YYLTYPE are included
880 * from bison output in section 1.*/
881 # define yylval YY_G(yylval_r)
884 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
886 # define yylloc YY_G(yylloc_r)
890 int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
892 int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
896 %endif End reentrant structures and macros.
898 /* Accessor methods to globals.
899 These are made visible to non-reentrant scanners for convenience. */
901 m4_ifdef( [[M4_YY_NO_DESTROY]],,
903 int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
906 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
908 int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
911 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
913 void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
916 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
918 YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
921 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
923 void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
926 m4_ifdef( [[M4_YY_NO_GET_IN]],,
928 FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
931 m4_ifdef( [[M4_YY_NO_SET_IN]],,
933 void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );
936 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
938 FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
941 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
943 void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );
946 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
948 yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
951 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
953 char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
956 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
958 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
961 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
963 void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
966 m4_ifdef( [[M4_YY_REENTRANT]],
968 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
970 int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
974 m4_ifdef( [[M4_YY_REENTRANT]],
976 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
978 void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );
983 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
985 YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
988 void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
990 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
992 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
994 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
997 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
999 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
1004 /* Macros after this point can all be overridden by user definitions in
1008 #ifndef YY_SKIP_YYWRAP
1010 extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1012 extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1017 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1019 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
1025 static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1028 #ifdef YY_NEED_STRLEN
1029 static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1033 %if-c-only Standard (non-C++) definition
1036 static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1038 static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1046 %# TODO: This is messy.
1047 m4_ifdef( [[M4_YY_STACK_USED]],
1050 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1052 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1054 static int yy_start_stack_ptr = 0;
1055 static int yy_start_stack_depth = 0;
1056 static int *yy_start_stack = NULL;
1060 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1062 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1064 static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG);
1066 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1068 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1070 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1072 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1078 m4_define( [[M4_YY_NO_PUSH_STATE]])
1079 m4_define( [[M4_YY_NO_POP_STATE]])
1080 m4_define( [[M4_YY_NO_TOP_STATE]])
1084 /* Amount of stuff to slurp up with each read. */
1085 #ifndef YY_READ_BUF_SIZE
1086 #define YY_READ_BUF_SIZE 8192
1089 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1091 /* Copy whatever the last rule matched to the standard output. */
1093 %if-c-only Standard (non-C++) definition
1094 /* This used to be an fputs(), but since the string might contain NUL's,
1095 * we now use fwrite().
1097 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
1099 %if-c++-only C++ definition
1100 #define ECHO LexerOutput( yytext, yyleng )
1105 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1107 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1108 * is returned in "result".
1111 #define YY_INPUT(buf,result,max_size) \
1112 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1114 %if-c++-only C++ definition \
1115 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
1116 YY_FATAL_ERROR( "input in flex scanner failed" );
1122 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1124 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1125 * we don't want an extra ';' after the "return" because that will cause
1126 * some compilers to complain about unreachable statements.
1129 #define yyterminate() return YY_NULL
1133 /* Number of entries by which start-condition stack grows. */
1134 #ifndef YY_START_STACK_INCR
1135 #define YY_START_STACK_INCR 25
1138 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1140 /* Report a fatal error. */
1141 #ifndef YY_FATAL_ERROR
1143 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1146 #define YY_FATAL_ERROR(msg) LexerError( msg )
1151 %if-tables-serialization structures and prototypes
1152 m4preproc_include(`tables_shared.h')
1154 /* Load the DFA tables from the given stream. */
1155 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1157 /* Unload the tables from memory. */
1158 int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1161 /** Describes a mapping from a serialized table id to its deserialized state in
1162 * this scanner. This is the bridge between our "generic" deserialization code
1163 * and the specifics of this scanner.
1166 enum yytbl_id dm_id;/**< table identifier */
1167 void **dm_arr; /**< address of pointer to store the deserialized table. */
1168 size_t dm_sz; /**< local sizeof() each element in table. */
1171 /** A {0,0,0}-terminated list of structs, forming the map */
1172 static struct yytbl_dmap yydmap[] =
1174 %tables-yydmap generated elements
1178 /** A tables-reader object to maintain some state in the read. */
1179 struct yytbl_reader {
1180 FILE * fp; /**< input stream */
1181 flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1185 /* end tables serialization structures and prototypes */
1189 /* Default declaration of generated scanner - a define so the user can
1190 * easily add parameters.
1193 #define YY_DECL_IS_OURS 1
1194 %if-c-only Standard (non-C++) definition
1197 m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1198 m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1200 m4_ifdef( [[M4_YY_BISON_LVAL]],
1202 m4_dnl The bison pure parser is used. Redefine yylex to
1203 m4_dnl accept the lval parameter.
1205 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1206 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1207 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1208 [[YYFARGS1(YYSTYPE *,yylval_param)]])
1211 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1213 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
1215 m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1216 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1217 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1218 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1221 extern int yylex M4_YY_LEX_PROTO;
1223 #define YY_DECL int yylex M4_YY_LEX_DECLARATION
1225 %if-c++-only C++ definition
1226 #define YY_DECL int yyFlexLexer::yylex()
1228 #endif /* !YY_DECL */
1230 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1232 /* Code executed at the beginning of each rule, after yytext and yyleng
1235 #ifndef YY_USER_ACTION
1236 #define YY_USER_ACTION
1240 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1242 /* Code executed at the end of each rule. */
1244 #define YY_BREAK break;
1248 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1250 %% [6.0] YY_RULE_SETUP definition goes here
1254 /** The main scanner function which does all the work.
1258 register yy_state_type yy_current_state;
1259 register char *yy_cp, *yy_bp;
1260 register int yy_act;
1261 M4_YY_DECL_GUTS_VAR();
1263 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1265 m4_ifdef( [[M4_YY_BISON_LVAL]],
1269 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1275 %% [7.0] user's declarations go here
1277 m4_ifdef( [[M4_YY_BISON_LVAL]],
1279 yylval = yylval_param;
1282 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1284 yylloc = yylloc_param;
1287 if ( !YY_G(yy_init) )
1295 m4_ifdef( [[M4_YY_USES_REJECT]],
1297 /* Create the reject buffer large enough to save one state per allowed character. */
1298 if ( ! YY_G(yy_state_buf) )
1299 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
1300 if ( ! YY_G(yy_state_buf) )
1301 YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1304 if ( ! YY_G(yy_start) )
1305 YY_G(yy_start) = 1; /* first start state */
1320 yyout = & std::cout;
1323 if ( ! YY_CURRENT_BUFFER ) {
1324 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1325 YY_CURRENT_BUFFER_LVALUE =
1326 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1329 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1332 while ( 1 ) /* loops until end-of-file is reached */
1334 %% [8.0] yymore()-related code goes here
1335 yy_cp = YY_G(yy_c_buf_p);
1337 /* Support of yytext. */
1338 *yy_cp = YY_G(yy_hold_char);
1340 /* yy_bp points to the position in yy_ch_buf of the start of
1345 %% [9.0] code to set up and find next match goes here
1348 %% [10.0] code to find the action number goes here
1350 YY_DO_BEFORE_ACTION;
1352 %% [11.0] code for yylineno update goes here
1354 do_action: /* This label is used only to access EOF actions. */
1356 %% [12.0] debug code goes here
1359 { /* beginning of action switch */
1360 %% [13.0] actions go here
1362 case YY_END_OF_BUFFER:
1364 /* Amount of text matched not including the EOB char. */
1365 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1367 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1368 *yy_cp = YY_G(yy_hold_char);
1369 YY_RESTORE_YY_MORE_OFFSET
1371 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1373 /* We're scanning a new file or input source. It's
1374 * possible that this happened because the user
1375 * just pointed yyin at a new source and called
1376 * yylex(). If so, then we have to assure
1377 * consistency between YY_CURRENT_BUFFER and our
1378 * globals. Here is the right place to do so, because
1379 * this is the first action (other than possibly a
1380 * back-up) that will match for the new input source.
1382 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1383 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1384 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1387 /* Note that here we test for yy_c_buf_p "<=" to the position
1388 * of the first EOB in the buffer, since yy_c_buf_p will
1389 * already have been incremented past the NUL character
1390 * (since all states make transitions on EOB to the
1391 * end-of-buffer state). Contrast this with the test
1394 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1395 { /* This was really a NUL. */
1396 yy_state_type yy_next_state;
1398 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1400 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1402 /* Okay, we're now positioned to make the NUL
1403 * transition. We couldn't have
1404 * yy_get_previous_state() go ahead and do it
1405 * for us because it doesn't know how to deal
1406 * with the possibility of jamming (and we don't
1407 * want to build jamming into it because then it
1408 * will run more slowly).
1411 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1413 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1415 if ( yy_next_state )
1417 /* Consume the NUL. */
1418 yy_cp = ++YY_G(yy_c_buf_p);
1419 yy_current_state = yy_next_state;
1425 %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1426 goto yy_find_action;
1430 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1432 case EOB_ACT_END_OF_FILE:
1434 YY_G(yy_did_buffer_switch_on_eof) = 0;
1436 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1438 /* Note: because we've taken care in
1439 * yy_get_next_buffer() to have set up
1440 * yytext, we can now set up
1441 * yy_c_buf_p so that if some total
1442 * hoser (like flex itself) wants to
1443 * call the scanner after we return the
1444 * YY_NULL, it'll still work - another
1445 * YY_NULL will get returned.
1447 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1449 yy_act = YY_STATE_EOF(YY_START);
1455 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1461 case EOB_ACT_CONTINUE_SCAN:
1463 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1465 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1467 yy_cp = YY_G(yy_c_buf_p);
1468 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1471 case EOB_ACT_LAST_MATCH:
1473 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1475 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1477 yy_cp = YY_G(yy_c_buf_p);
1478 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1479 goto yy_find_action;
1486 "fatal flex scanner internal error--no action found" );
1487 } /* end of action switch */
1488 } /* end of scanning one token */
1489 } /* end of yylex */
1494 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1496 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1504 yylineno = 1; // this will only get updated if %option yylineno
1506 yy_did_buffer_switch_on_eof = 0;
1508 yy_looking_for_trail_begin = 0;
1511 yy_more_offset = yy_prev_more_offset = 0;
1513 yy_start_stack_ptr = yy_start_stack_depth = 0;
1514 yy_start_stack = NULL;
1516 yy_buffer_stack = 0;
1517 yy_buffer_stack_top = 0;
1518 yy_buffer_stack_max = 0;
1521 m4_ifdef( [[M4_YY_USES_REJECT]],
1523 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1530 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1532 yyFlexLexer::~yyFlexLexer()
1534 delete [] yy_state_buf;
1535 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1536 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1537 yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
1540 /* The contents of this function are C++ specific, so the YY_G macro is not used.
1542 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1546 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1547 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1554 #ifdef YY_INTERACTIVE
1555 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1557 int yyFlexLexer::LexerInput( char* buf, int max_size )
1560 if ( yyin->eof() || yyin->fail() )
1563 #ifdef YY_INTERACTIVE
1564 yyin->get( buf[0] );
1575 (void) yyin->read( buf, max_size );
1580 return yyin->gcount();
1584 void yyFlexLexer::LexerOutput( const char* buf, int size )
1586 (void) yyout->write( buf, size );
1591 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1593 /* yy_get_next_buffer - try to read in a new buffer
1595 * Returns a code representing an action:
1596 * EOB_ACT_LAST_MATCH -
1597 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1598 * EOB_ACT_END_OF_FILE - end of file
1601 static int yy_get_next_buffer YYFARGS0(void)
1604 int yyFlexLexer::yy_get_next_buffer()
1607 M4_YY_DECL_GUTS_VAR();
1608 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1609 register char *source = YY_G(yytext_ptr);
1610 register int number_to_move, i;
1613 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1615 "fatal flex scanner internal error--end of buffer missed" );
1617 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1618 { /* Don't try to fill the buffer, so this is an EOF. */
1619 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1621 /* We matched a single character, the EOB, so
1622 * treat this as a final EOF.
1624 return EOB_ACT_END_OF_FILE;
1629 /* We matched some text prior to the EOB, first
1632 return EOB_ACT_LAST_MATCH;
1636 /* Try to read more data. */
1638 /* First move last chars to start of buffer. */
1639 number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
1641 for ( i = 0; i < number_to_move; ++i )
1642 *(dest++) = *(source++);
1644 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1645 /* don't do the read, it's not guaranteed to return an EOF,
1648 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1652 yy_size_t num_to_read =
1653 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1655 while ( num_to_read <= 0 )
1656 { /* Not enough room in the buffer - grow it. */
1657 m4_ifdef( [[M4_YY_USES_REJECT]],
1660 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1663 /* just a shorter name for the current buffer */
1664 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1666 int yy_c_buf_p_offset =
1667 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1669 if ( b->yy_is_our_buffer )
1671 yy_size_t new_size = b->yy_buf_size * 2;
1673 if ( new_size <= 0 )
1674 b->yy_buf_size += b->yy_buf_size / 8;
1676 b->yy_buf_size *= 2;
1678 b->yy_ch_buf = (char *)
1679 /* Include room in for 2 EOB chars. */
1680 yyrealloc( (void *) b->yy_ch_buf,
1681 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1684 /* Can't grow it, we don't own it. */
1687 if ( ! b->yy_ch_buf )
1689 "fatal error - scanner input buffer overflow" );
1691 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1693 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1698 if ( num_to_read > YY_READ_BUF_SIZE )
1699 num_to_read = YY_READ_BUF_SIZE;
1701 /* Read in more data. */
1702 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1703 YY_G(yy_n_chars), num_to_read );
1705 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1708 if ( YY_G(yy_n_chars) == 0 )
1710 if ( number_to_move == YY_MORE_ADJ )
1712 ret_val = EOB_ACT_END_OF_FILE;
1713 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1718 ret_val = EOB_ACT_LAST_MATCH;
1719 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1720 YY_BUFFER_EOF_PENDING;
1725 ret_val = EOB_ACT_CONTINUE_SCAN;
1727 if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1728 /* Extend the array by 50%, plus the number we really need. */
1729 yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
1730 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1731 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
1732 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1733 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1736 YY_G(yy_n_chars) += number_to_move;
1737 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1738 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1740 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1746 /* yy_get_previous_state - get the state just before the EOB char was reached */
1750 static yy_state_type yy_get_previous_state YYFARGS0(void)
1753 yy_state_type yyFlexLexer::yy_get_previous_state()
1756 register yy_state_type yy_current_state;
1757 register char *yy_cp;
1758 M4_YY_DECL_GUTS_VAR();
1760 %% [15.0] code to get the start state into yy_current_state goes here
1762 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1764 %% [16.0] code to find the next state goes here
1767 return yy_current_state;
1771 /* yy_try_NUL_trans - try to make a transition on the NUL character
1774 * next_state = yy_try_NUL_trans( current_state );
1777 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1780 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1783 register int yy_is_jam;
1784 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1785 %% [17.0] code to find the next state, and perhaps do backing up, goes here
1787 M4_YY_NOOP_GUTS_VAR();
1788 return yy_is_jam ? 0 : yy_current_state;
1793 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1795 static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1798 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1801 register char *yy_cp;
1802 M4_YY_DECL_GUTS_VAR();
1804 yy_cp = YY_G(yy_c_buf_p);
1806 /* undo effects of setting up yytext */
1807 *yy_cp = YY_G(yy_hold_char);
1809 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1810 { /* need to shift things up to make room */
1811 /* +2 for EOB chars. */
1812 register yy_size_t number_to_move = YY_G(yy_n_chars) + 2;
1813 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1814 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1815 register char *source =
1816 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1818 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1819 *--dest = *--source;
1821 yy_cp += (int) (dest - source);
1822 yy_bp += (int) (dest - source);
1823 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1824 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1826 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1827 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1830 *--yy_cp = (char) c;
1832 %% [18.0] update yylineno here
1833 m4_ifdef( [[M4_YY_USE_LINENO]],
1840 YY_G(yytext_ptr) = yy_bp;
1841 YY_G(yy_hold_char) = *yy_cp;
1842 YY_G(yy_c_buf_p) = yy_cp;
1851 static int yyinput YYFARGS0(void)
1853 static int input YYFARGS0(void)
1858 int yyFlexLexer::yyinput()
1862 M4_YY_DECL_GUTS_VAR();
1864 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1866 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1868 /* yy_c_buf_p now points to the character we want to return.
1869 * If this occurs *before* the EOB characters, then it's a
1870 * valid NUL; if not, then we've hit the end of the buffer.
1872 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1873 /* This was really a NUL. */
1874 *YY_G(yy_c_buf_p) = '\0';
1877 { /* need more input */
1878 yy_size_t offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1881 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1883 case EOB_ACT_LAST_MATCH:
1884 /* This happens because yy_g_n_b()
1885 * sees that we've accumulated a
1886 * token and flags that we need to
1887 * try matching the token before
1888 * proceeding. But for input(),
1889 * there's no matching to consider.
1890 * So convert the EOB_ACT_LAST_MATCH
1891 * to EOB_ACT_END_OF_FILE.
1894 /* Reset buffer status. */
1895 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1899 case EOB_ACT_END_OF_FILE:
1901 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1904 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1907 return yyinput(M4_YY_CALL_ONLY_ARG);
1909 return input(M4_YY_CALL_ONLY_ARG);
1913 case EOB_ACT_CONTINUE_SCAN:
1914 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1920 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
1921 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
1922 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1924 %% [19.0] update BOL and yylineno
1929 #endif /* ifndef YY_NO_INPUT */
1932 /** Immediately switch to a different input stream.
1933 * @param input_file A readable stream.
1935 * @note This function does not reset the start condition to @c INITIAL .
1938 void yyrestart YYFARGS1( FILE *,input_file)
1941 void yyFlexLexer::yyrestart( std::istream* input_file )
1944 M4_YY_DECL_GUTS_VAR();
1946 if ( ! YY_CURRENT_BUFFER ){
1947 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1948 YY_CURRENT_BUFFER_LVALUE =
1949 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1952 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1953 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1956 /** Switch to a different input buffer.
1957 * @param new_buffer The new input buffer.
1961 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1964 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1967 M4_YY_DECL_GUTS_VAR();
1969 /* TODO. We should be able to replace this entire function body
1971 * yypop_buffer_state();
1972 * yypush_buffer_state(new_buffer);
1974 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1975 if ( YY_CURRENT_BUFFER == new_buffer )
1978 if ( YY_CURRENT_BUFFER )
1980 /* Flush out information for old buffer. */
1981 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1982 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
1983 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1986 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1987 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1989 /* We don't actually know whether we did this switch during
1990 * EOF (yywrap()) processing, but the only time this flag
1991 * is looked at is after yywrap() is called, so it's safe
1992 * to go ahead and always set it.
1994 YY_G(yy_did_buffer_switch_on_eof) = 1;
1999 static void yy_load_buffer_state YYFARGS0(void)
2002 void yyFlexLexer::yy_load_buffer_state()
2005 M4_YY_DECL_GUTS_VAR();
2006 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2007 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2008 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2009 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
2012 /** Allocate and initialize an input buffer state.
2013 * @param file A readable stream.
2014 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2016 * @return the allocated buffer state.
2019 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
2022 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2026 m4_dnl M4_YY_DECL_GUTS_VAR();
2028 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2030 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2032 b->yy_buf_size = size;
2034 /* yy_ch_buf has to be 2 characters longer than the size given because
2035 * we need to put in 2 end-of-buffer characters.
2037 b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
2038 if ( ! b->yy_ch_buf )
2039 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2041 b->yy_is_our_buffer = 1;
2043 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2048 /** Destroy the buffer.
2049 * @param b a buffer created with yy_create_buffer()
2053 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2056 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2059 M4_YY_DECL_GUTS_VAR();
2064 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2065 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2067 if ( b->yy_is_our_buffer )
2068 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2070 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2074 /* Initializes or reinitializes a buffer.
2075 * This function is sometimes called more than once on the same buffer,
2076 * such as during a yyrestart() or at EOF.
2079 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2082 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2087 M4_YY_DECL_GUTS_VAR();
2089 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2091 b->yy_input_file = file;
2092 b->yy_fill_buffer = 1;
2094 /* If b is the current buffer, then yy_init_buffer was _probably_
2095 * called from yyrestart() or through yy_get_next_buffer.
2096 * In that case, we don't want to reset the lineno or column.
2098 if (b != YY_CURRENT_BUFFER){
2099 b->yy_bs_lineno = 1;
2100 b->yy_bs_column = 0;
2104 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2106 b->yy_is_interactive = 1;
2109 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2111 b->yy_is_interactive = 0;
2114 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2119 b->yy_is_interactive = 0;
2124 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2125 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2129 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2132 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2135 M4_YY_DECL_GUTS_VAR();
2141 /* We always need two end-of-buffer characters. The first causes
2142 * a transition to the end-of-buffer state. The second causes
2143 * a jam in that state.
2145 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2146 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2148 b->yy_buf_pos = &b->yy_ch_buf[0];
2151 b->yy_buffer_status = YY_BUFFER_NEW;
2153 if ( b == YY_CURRENT_BUFFER )
2154 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2158 /** Pushes the new state onto the stack. The new state becomes
2159 * the current state. This function will allocate the stack
2161 * @param new_buffer The new state.
2165 void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2168 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2171 M4_YY_DECL_GUTS_VAR();
2172 if (new_buffer == NULL)
2175 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2177 /* This block is copied from yy_switch_to_buffer. */
2178 if ( YY_CURRENT_BUFFER )
2180 /* Flush out information for old buffer. */
2181 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2182 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2183 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2186 /* Only push if top exists. Otherwise, replace top. */
2187 if (YY_CURRENT_BUFFER)
2188 YY_G(yy_buffer_stack_top)++;
2189 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2191 /* copied from yy_switch_to_buffer. */
2192 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2193 YY_G(yy_did_buffer_switch_on_eof) = 1;
2199 /** Removes and deletes the top of the stack, if present.
2200 * The next element becomes the new top.
2204 void yypop_buffer_state YYFARGS0(void)
2207 void yyFlexLexer::yypop_buffer_state (void)
2210 M4_YY_DECL_GUTS_VAR();
2211 if (!YY_CURRENT_BUFFER)
2214 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2215 YY_CURRENT_BUFFER_LVALUE = NULL;
2216 if (YY_G(yy_buffer_stack_top) > 0)
2217 --YY_G(yy_buffer_stack_top);
2219 if (YY_CURRENT_BUFFER) {
2220 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2221 YY_G(yy_did_buffer_switch_on_eof) = 1;
2228 /* Allocates the stack if it does not exist.
2229 * Guarantees space for at least one push.
2232 static void yyensure_buffer_stack YYFARGS0(void)
2235 void yyFlexLexer::yyensure_buffer_stack(void)
2238 yy_size_t num_to_alloc;
2239 M4_YY_DECL_GUTS_VAR();
2241 if (!YY_G(yy_buffer_stack)) {
2243 /* First allocation is just for 2 elements, since we don't know if this
2244 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2245 * immediate realloc on the next call.
2248 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2249 (num_to_alloc * sizeof(struct yy_buffer_state*)
2250 M4_YY_CALL_LAST_ARG);
2251 if ( ! YY_G(yy_buffer_stack) )
2252 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2255 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2257 YY_G(yy_buffer_stack_max) = num_to_alloc;
2258 YY_G(yy_buffer_stack_top) = 0;
2262 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2264 /* Increase the buffer to prepare for a possible push. */
2265 int grow_size = 8 /* arbitrary grow size */;
2267 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2268 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2269 (YY_G(yy_buffer_stack),
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()" );
2275 /* zero only the new slots.*/
2276 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2277 YY_G(yy_buffer_stack_max) = num_to_alloc;
2285 m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2288 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2289 * @param base the character buffer
2290 * @param size the size in bytes of the character buffer
2292 * @return the newly allocated buffer state object.
2294 YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2297 m4_dnl M4_YY_DECL_GUTS_VAR();
2300 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2301 base[size-1] != YY_END_OF_BUFFER_CHAR )
2302 /* They forgot to leave room for the EOB's. */
2305 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2307 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2309 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2310 b->yy_buf_pos = b->yy_ch_buf = base;
2311 b->yy_is_our_buffer = 0;
2312 b->yy_input_file = 0;
2313 b->yy_n_chars = b->yy_buf_size;
2314 b->yy_is_interactive = 0;
2316 b->yy_fill_buffer = 0;
2317 b->yy_buffer_status = YY_BUFFER_NEW;
2319 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2327 m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2330 /** Setup the input buffer state to scan a string. The next call to yylex() will
2331 * scan from a @e copy of @a str.
2332 * @param yystr a NUL-terminated string to scan
2334 * @return the newly allocated buffer state object.
2335 * @note If you want to scan bytes that may contain NUL values, then use
2336 * yy_scan_bytes() instead.
2338 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2340 m4_dnl M4_YY_DECL_GUTS_VAR();
2342 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2348 m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2351 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2352 * scan from a @e copy of @a bytes.
2353 * @param yybytes the byte buffer to scan
2354 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2356 * @return the newly allocated buffer state object.
2358 YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)
2364 m4_dnl M4_YY_DECL_GUTS_VAR();
2366 /* Get memory for full buffer, including space for trailing EOB's. */
2367 n = _yybytes_len + 2;
2368 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2370 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2372 for ( i = 0; i < _yybytes_len; ++i )
2373 buf[i] = yybytes[i];
2375 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2377 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2379 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2381 /* It's okay to grow etc. this buffer, and we should throw it
2382 * away when we're done.
2384 b->yy_is_our_buffer = 1;
2392 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2395 static void yy_push_state YYFARGS1( int ,new_state)
2398 void yyFlexLexer::yy_push_state( int new_state )
2401 M4_YY_DECL_GUTS_VAR();
2402 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2406 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2407 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2409 if ( ! YY_G(yy_start_stack) )
2410 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2413 YY_G(yy_start_stack) = (int *) yyrealloc(
2414 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2416 if ( ! YY_G(yy_start_stack) )
2417 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2420 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2427 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2430 static void yy_pop_state YYFARGS0(void)
2433 void yyFlexLexer::yy_pop_state()
2436 M4_YY_DECL_GUTS_VAR();
2437 if ( --YY_G(yy_start_stack_ptr) < 0 )
2438 YY_FATAL_ERROR( "start-condition stack underflow" );
2440 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2445 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2448 static int yy_top_state YYFARGS0(void)
2451 int yyFlexLexer::yy_top_state()
2454 M4_YY_DECL_GUTS_VAR();
2455 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2459 #ifndef YY_EXIT_FAILURE
2460 #define YY_EXIT_FAILURE 2
2464 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2466 m4_dnl M4_YY_DECL_GUTS_VAR();
2467 (void) fprintf( stderr, "%s\n", msg );
2468 exit( YY_EXIT_FAILURE );
2472 void yyFlexLexer::LexerError( yyconst char msg[] )
2474 M4_YY_DECL_GUTS_VAR();
2475 std::cerr << msg << std::endl;
2476 exit( YY_EXIT_FAILURE );
2480 /* Redefine yyless() so it works in section 3 code. */
2486 /* Undo effects of setting up yytext. */ \
2487 int yyless_macro_arg = (n); \
2488 YY_LESS_LINENO(yyless_macro_arg);\
2489 yytext[yyleng] = YY_G(yy_hold_char); \
2490 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2491 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2492 *YY_G(yy_c_buf_p) = '\0'; \
2493 yyleng = yyless_macro_arg; \
2499 /* Accessor methods (get/set functions) to struct members. */
2503 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2505 /** Get the user-defined data for this scanner.
2508 YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2510 M4_YY_DECL_GUTS_VAR();
2516 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2518 /** Get the current line number.
2521 int yyget_lineno YYFARGS0(void)
2523 M4_YY_DECL_GUTS_VAR();
2525 m4_ifdef( [[M4_YY_REENTRANT]],
2527 if (! YY_CURRENT_BUFFER)
2534 m4_ifdef( [[M4_YY_REENTRANT]],
2536 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2538 /** Get the current column number.
2541 int yyget_column YYFARGS0(void)
2543 M4_YY_DECL_GUTS_VAR();
2545 m4_ifdef( [[M4_YY_REENTRANT]],
2547 if (! YY_CURRENT_BUFFER)
2555 m4_ifdef( [[M4_YY_NO_GET_IN]],,
2557 /** Get the input stream.
2560 FILE *yyget_in YYFARGS0(void)
2562 M4_YY_DECL_GUTS_VAR();
2567 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2569 /** Get the output stream.
2572 FILE *yyget_out YYFARGS0(void)
2574 M4_YY_DECL_GUTS_VAR();
2579 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2581 /** Get the length of the current token.
2584 yy_size_t yyget_leng YYFARGS0(void)
2586 M4_YY_DECL_GUTS_VAR();
2591 /** Get the current token.
2594 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2596 char *yyget_text YYFARGS0(void)
2598 M4_YY_DECL_GUTS_VAR();
2604 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2606 /** Set the user-defined data. This data is never touched by the scanner.
2607 * @param user_defined The data to be associated with this scanner.
2610 void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2612 M4_YY_DECL_GUTS_VAR();
2613 yyextra = user_defined ;
2618 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2620 /** Set the current line number.
2621 * @param line_number
2624 void yyset_lineno YYFARGS1( int ,line_number)
2626 M4_YY_DECL_GUTS_VAR();
2628 m4_ifdef( [[M4_YY_REENTRANT]],
2630 /* lineno is only valid if an input buffer exists. */
2631 if (! YY_CURRENT_BUFFER )
2632 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2634 yylineno = line_number;
2638 m4_ifdef( [[M4_YY_REENTRANT]],
2640 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2642 /** Set the current column.
2643 * @param line_number
2646 void yyset_column YYFARGS1( int , column_no)
2648 M4_YY_DECL_GUTS_VAR();
2650 m4_ifdef( [[M4_YY_REENTRANT]],
2652 /* column is only valid if an input buffer exists. */
2653 if (! YY_CURRENT_BUFFER )
2654 YY_FATAL_ERROR( "yyset_column called with no buffer" );
2656 yycolumn = column_no;
2662 m4_ifdef( [[M4_YY_NO_SET_IN]],,
2664 /** Set the input stream. This does not discard the current
2666 * @param in_str A readable stream.
2668 * @see yy_switch_to_buffer
2670 void yyset_in YYFARGS1( FILE * ,in_str)
2672 M4_YY_DECL_GUTS_VAR();
2677 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2679 void yyset_out YYFARGS1( FILE * ,out_str)
2681 M4_YY_DECL_GUTS_VAR();
2687 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2689 int yyget_debug YYFARGS0(void)
2691 M4_YY_DECL_GUTS_VAR();
2692 return yy_flex_debug;
2696 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2698 void yyset_debug YYFARGS1( int ,bdebug)
2700 M4_YY_DECL_GUTS_VAR();
2701 yy_flex_debug = bdebug ;
2707 /* Accessor methods for yylval and yylloc */
2710 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2712 YYSTYPE * yyget_lval YYFARGS0(void)
2714 M4_YY_DECL_GUTS_VAR();
2719 m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2721 void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2723 M4_YY_DECL_GUTS_VAR();
2724 yylval = yylval_param;
2728 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2730 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2732 YYLTYPE *yyget_lloc YYFARGS0(void)
2734 M4_YY_DECL_GUTS_VAR();
2739 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2741 void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2743 M4_YY_DECL_GUTS_VAR();
2744 yylloc = yylloc_param;
2752 /* User-visible API */
2754 /* yylex_init is special because it creates the scanner itself, so it is
2755 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2756 * That's why we explicitly handle the declaration, instead of using our macros.
2758 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2760 int yylex_init( ptr_yy_globals )
2761 yyscan_t* ptr_yy_globals;
2764 int yylex_init(yyscan_t* ptr_yy_globals)
2767 if (ptr_yy_globals == NULL){
2772 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2774 if (*ptr_yy_globals == NULL){
2779 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2780 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2782 return yy_init_globals ( *ptr_yy_globals );
2786 /* yylex_init_extra has the same functionality as yylex_init, but follows the
2787 * convention of taking the scanner as the last argument. Note however, that
2788 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2789 * is the reason, too, why this function also must handle its own declaration).
2790 * The user defined value in the first argument will be available to yyalloc in
2791 * the yyextra field.
2793 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2795 int yylex_init_extra( yy_user_defined, ptr_yy_globals )
2796 YY_EXTRA_TYPE yy_user_defined;
2797 yyscan_t* ptr_yy_globals;
2800 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2803 struct yyguts_t dummy_yyguts;
2805 yyset_extra (yy_user_defined, &dummy_yyguts);
2807 if (ptr_yy_globals == NULL){
2812 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2814 if (*ptr_yy_globals == NULL){
2819 /* By setting to 0xAA, we expose bugs in
2820 yy_init_globals. Leave at 0x00 for releases. */
2821 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2823 yyset_extra (yy_user_defined, *ptr_yy_globals);
2825 return yy_init_globals ( *ptr_yy_globals );
2832 static int yy_init_globals YYFARGS0(void)
2834 M4_YY_DECL_GUTS_VAR();
2835 /* Initialization is the same as for the non-reentrant scanner.
2836 * This function is called from yylex_destroy(), so don't allocate here.
2839 m4_ifdef( [[M4_YY_USE_LINENO]],
2841 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2843 /* We do not touch yylineno unless the option is enabled. */
2847 YY_G(yy_buffer_stack) = 0;
2848 YY_G(yy_buffer_stack_top) = 0;
2849 YY_G(yy_buffer_stack_max) = 0;
2850 YY_G(yy_c_buf_p) = (char *) 0;
2854 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2856 YY_G(yy_start_stack_ptr) = 0;
2857 YY_G(yy_start_stack_depth) = 0;
2858 YY_G(yy_start_stack) = NULL;
2861 m4_ifdef( [[M4_YY_USES_REJECT]],
2863 YY_G(yy_state_buf) = 0;
2864 YY_G(yy_state_ptr) = 0;
2865 YY_G(yy_full_match) = 0;
2869 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2871 YY_G(yytext_ptr) = 0;
2872 YY_G(yy_more_offset) = 0;
2873 YY_G(yy_prev_more_offset) = 0;
2876 /* Defined in main.c */
2885 /* For future reference: Set errno on error, since we are called by
2893 %if-c-only SNIP! this currently causes conflicts with the c++ scanner
2894 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2895 int yylex_destroy YYFARGS0(void)
2897 M4_YY_DECL_GUTS_VAR();
2899 /* Pop the buffer stack, destroying each element. */
2900 while(YY_CURRENT_BUFFER){
2901 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2902 YY_CURRENT_BUFFER_LVALUE = NULL;
2903 yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2906 /* Destroy the stack itself. */
2907 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2908 YY_G(yy_buffer_stack) = NULL;
2910 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2912 /* Destroy the start condition stack. */
2913 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2914 YY_G(yy_start_stack) = NULL;
2917 m4_ifdef( [[M4_YY_USES_REJECT]],
2919 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2920 YY_G(yy_state_buf) = NULL;
2923 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2924 * yylex() is called, initialization will occur. */
2925 yy_init_globals( M4_YY_CALL_ONLY_ARG);
2928 /* Destroy the main struct (reentrant only). */
2929 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2937 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2940 * Internal utility routines.
2944 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2947 static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2950 for ( i = 0; i < n; ++i )
2956 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2958 #ifdef YY_NEED_STRLEN
2959 static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2962 for ( n = 0; s[n]; ++n )
2970 m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
2972 void *yyalloc YYFARGS1( yy_size_t ,size)
2974 return (void *) malloc( size );
2978 m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
2980 void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
2982 /* The cast to (char *) in the following accommodates both
2983 * implementations that use char* generic pointers, and those
2984 * that use void* generic pointers. It works with the latter
2985 * because both ANSI C and C++ allow castless assignment from
2986 * any pointer type to void*, and deal with argument conversions
2987 * as though doing an assignment.
2989 return (void *) realloc( (char *) ptr, size );
2993 m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
2995 void yyfree YYFARGS1( void *,ptr)
2997 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3001 %if-tables-serialization definitions
3002 m4preproc_include(`tables_shared.c')
3004 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
3007 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3011 rd->bread += sizeof(flex_uint8_t);
3015 static int yytbl_read16 (void *v, struct yytbl_reader * rd)
3018 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3022 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3023 rd->bread += sizeof(flex_uint16_t);
3027 static int yytbl_read32 (void *v, struct yytbl_reader * rd)
3030 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3034 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3035 rd->bread += sizeof(flex_uint32_t);
3039 /** Read the header */
3040 static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3043 memset (th, 0, sizeof (struct yytbl_hdr));
3045 if (yytbl_read32 (&(th->th_magic), rd) != 0)
3048 if (th->th_magic != YYTBL_MAGIC){
3049 YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */
3053 if (yytbl_read32 (&(th->th_hsize), rd) != 0
3054 || yytbl_read32 (&(th->th_ssize), rd) != 0
3055 || yytbl_read16 (&(th->th_flags), rd) != 0)
3058 /* Sanity check on header size. Greater than 1k suggests some funny business. */
3059 if (th->th_hsize < 16 || th->th_hsize > 1024){
3060 YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */
3064 /* Allocate enough space for the version and name fields */
3065 bytes = th->th_hsize - 14;
3066 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3067 if ( ! th->th_version )
3068 YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
3070 /* we read it all into th_version, and point th_name into that data */
3071 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
3073 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3074 th->th_version = NULL;
3080 th->th_name = th->th_version + strlen (th->th_version) + 1;
3084 /** lookup id in the dmap list.
3085 * @param dmap pointer to first element in list
3086 * @return NULL if not found.
3088 static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3092 if (dmap->dm_id == id)
3099 /** Read a table while mapping its contents to the local array.
3100 * @param dmap used to performing mapping
3101 * @return 0 on success
3103 static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3105 struct yytbl_data td;
3106 struct yytbl_dmap *transdmap=0;
3107 int len, i, rv, inner_loop_count;
3110 memset (&td, 0, sizeof (struct yytbl_data));
3112 if (yytbl_read16 (&td.td_id, rd) != 0
3113 || yytbl_read16 (&td.td_flags, rd) != 0
3114 || yytbl_read32 (&td.td_hilen, rd) != 0
3115 || yytbl_read32 (&td.td_lolen, rd) != 0)
3118 /* Lookup the map for the transition table so we have it in case we need it
3119 * inside the loop below. This scanner might not even have a transition
3120 * table, which is ok.
3122 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3124 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3125 YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */
3129 /* Allocate space for table.
3130 * The --full yy_transition table is a special case, since we
3131 * need the dmap.dm_sz entry to tell us the sizeof the individual
3137 if ((td.td_flags & YYTD_STRUCT))
3138 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3140 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3142 if(M4_YY_TABLES_VERIFY)
3143 /* We point to the array itself */
3146 /* We point to the address of a pointer. */
3147 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3149 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
3152 /* If it's a struct, we read 2 integers to get one element */
3153 if ((td.td_flags & YYTD_STRUCT) != 0)
3154 inner_loop_count = 2;
3156 inner_loop_count = 1;
3158 /* read and map each element.
3159 * This loop iterates once for each element of the td_data array.
3160 * Notice that we increment 'i' in the inner loop.
3162 len = yytbl_calc_total_len (&td);
3163 for (i = 0; i < len; ){
3167 /* This loop really executes exactly 1 or 2 times.
3168 * The second time is to handle the second member of the
3169 * YYTD_STRUCT for the yy_transition array.
3171 for (j = 0; j < inner_loop_count; j++, i++) {
3174 /* read into t32 no matter what the real size is. */
3179 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3180 case sizeof (flex_int32_t):
3181 rv = yytbl_read32 (&t32, rd);
3183 case sizeof (flex_int16_t):
3184 rv = yytbl_read16 (&t16, rd);
3187 case sizeof (flex_int8_t):
3188 rv = yytbl_read8 (&t8, rd);
3192 YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */
3199 /* copy into the deserialized array... */
3201 if ((td.td_flags & YYTD_STRUCT)) {
3202 /* t32 is the j'th member of a two-element struct. */
3205 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3206 : &(((struct yy_trans_info *) p)->yy_nxt);
3208 switch (dmap->dm_sz) {
3209 case sizeof (flex_int32_t):
3210 if (M4_YY_TABLES_VERIFY){
3211 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3212 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" );
3214 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3216 case sizeof (flex_int16_t):
3217 if (M4_YY_TABLES_VERIFY ){
3218 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3219 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" );
3221 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3223 case sizeof(flex_int8_t):
3224 if (M4_YY_TABLES_VERIFY ){
3225 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3226 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" );
3228 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3231 YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */
3235 /* if we're done with j, increment p */
3237 p = (struct yy_trans_info *) p + 1;
3239 else if ((td.td_flags & YYTD_PTRANS)) {
3240 /* t32 is an index into the transition array. */
3241 struct yy_trans_info *v;
3245 YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */
3249 if( M4_YY_TABLES_VERIFY)
3250 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3252 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3254 if(M4_YY_TABLES_VERIFY ){
3255 if( ((struct yy_trans_info **) p)[0] != v)
3256 YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
3258 ((struct yy_trans_info **) p)[0] = v;
3261 p = (struct yy_trans_info **) p + 1;
3264 /* t32 is a plain int. copy data, then incrememnt p. */
3265 switch (dmap->dm_sz) {
3266 case sizeof (flex_int32_t):
3267 if(M4_YY_TABLES_VERIFY ){
3268 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3269 YY_FATAL_ERROR( "tables verification failed at flex_int32_t" );
3271 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3272 p = ((flex_int32_t *) p) + 1;
3274 case sizeof (flex_int16_t):
3275 if(M4_YY_TABLES_VERIFY ){
3276 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3277 YY_FATAL_ERROR( "tables verification failed at flex_int16_t" );
3279 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3280 p = ((flex_int16_t *) p) + 1;
3282 case sizeof (flex_int8_t):
3283 if(M4_YY_TABLES_VERIFY ){
3284 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3285 YY_FATAL_ERROR( "tables verification failed at flex_int8_t" );
3287 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3288 p = ((flex_int8_t *) p) + 1;
3291 YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */
3299 /* Now eat padding. */
3302 pad = yypad64(rd->bread);
3305 if(yytbl_read8(&t8,rd) != 0)
3313 %define-yytables The name for this specific scanner's tables.
3315 /* Find the key and load the DFA tables from the given stream. */
3316 static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3319 struct yytbl_hdr th;
3320 struct yytbl_reader rd;
3323 th.th_version = NULL;
3325 /* Keep trying until we find the right set of tables or end of file. */
3326 while (!feof(rd.fp)) {
3328 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3333 /* A NULL key means choose the first set of tables. */
3337 if (strcmp(th.th_name,key) != 0){
3338 /* Skip ahead to next set */
3339 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3340 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3341 th.th_version = NULL;
3347 while (rd.bread < th.th_ssize){
3348 /* Load the data tables */
3349 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3357 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3358 th.th_version = NULL;
3364 /** Load the DFA tables for this scanner from the given stream. */
3365 int yytables_fload YYFARGS1(FILE *, fp)
3368 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3373 /** Destroy the loaded tables, freeing memory, etc.. */
3374 int yytables_destroy YYFARGS0(void)
3376 struct yytbl_dmap *dmap=0;
3378 if(!M4_YY_TABLES_VERIFY){
3379 /* Walk the dmap, freeing the pointers */
3380 for(dmap=yydmap; dmap->dm_id; dmap++) {
3383 if(v && *(char**)v){
3384 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3393 /* end table serialization code definitions */
3397 m4_ifdef([[M4_YY_MAIN]], [[
3398 int main M4_YY_PARAMS(void);
3407 yylex_destroy( lexer);
3419 m4_ifdef( [[M4_YY_IN_HEADER]],
3422 #undef YY_FLUSH_BUFFER
3424 #undef yy_new_buffer
3425 #undef yy_set_interactive
3426 #undef YY_DO_BEFORE_ACTION
3428 #ifdef YY_DECL_IS_OURS
3429 #undef YY_DECL_IS_OURS