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
58 #define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
59 #define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
60 #define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
61 #if YY_FLEX_SUBMINOR_VERSION > 0
65 %# Some negated symbols
66 m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])
67 m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])
69 %# This is the m4 way to say "(stack_used || is_reentrant)
70 m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
71 m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
74 %# The complexity here is necessary so that m4 preserves
75 %# the argument lists to each C function.
78 m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
80 m4preproc_define(`M4_GEN_PREFIX',
81 ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
84 /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
85 * following macro. This is required in order to pass the c++-multiple-scanners
86 * test in the regression suite. We get reports that it breaks inheritance.
87 * We will address this in a future release of flex, or omit the C++ scanner
90 #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
94 M4_GEN_PREFIX(`_create_buffer')
95 M4_GEN_PREFIX(`_delete_buffer')
96 M4_GEN_PREFIX(`_scan_buffer')
97 M4_GEN_PREFIX(`_scan_string')
98 M4_GEN_PREFIX(`_scan_bytes')
99 M4_GEN_PREFIX(`_init_buffer')
100 M4_GEN_PREFIX(`_flush_buffer')
101 M4_GEN_PREFIX(`_load_buffer_state')
102 M4_GEN_PREFIX(`_switch_to_buffer')
103 M4_GEN_PREFIX(`push_buffer_state')
104 M4_GEN_PREFIX(`pop_buffer_state')
105 M4_GEN_PREFIX(`ensure_buffer_stack')
107 M4_GEN_PREFIX(`restart')
108 M4_GEN_PREFIX(`lex_init')
109 M4_GEN_PREFIX(`lex_destroy')
110 M4_GEN_PREFIX(`get_debug')
111 M4_GEN_PREFIX(`set_debug')
112 M4_GEN_PREFIX(`get_extra')
113 M4_GEN_PREFIX(`set_extra')
114 M4_GEN_PREFIX(`get_in')
115 M4_GEN_PREFIX(`set_in')
116 M4_GEN_PREFIX(`get_out')
117 M4_GEN_PREFIX(`set_out')
118 M4_GEN_PREFIX(`get_leng')
119 M4_GEN_PREFIX(`get_text')
120 M4_GEN_PREFIX(`get_lineno')
121 M4_GEN_PREFIX(`set_lineno')
122 m4_ifdef( [[M4_YY_REENTRANT]],
124 M4_GEN_PREFIX(`get_column')
125 M4_GEN_PREFIX(`set_column')
127 M4_GEN_PREFIX(`wrap')
130 m4_ifdef( [[M4_YY_BISON_LVAL]],
132 M4_GEN_PREFIX(`get_lval')
133 M4_GEN_PREFIX(`set_lval')
136 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
138 M4_GEN_PREFIX(`get_lloc')
139 M4_GEN_PREFIX(`set_lloc')
143 M4_GEN_PREFIX(`alloc')
144 M4_GEN_PREFIX(`realloc')
145 M4_GEN_PREFIX(`free')
148 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
150 M4_GEN_PREFIX(`text')
151 M4_GEN_PREFIX(`leng')
154 M4_GEN_PREFIX(`_flex_debug')
155 M4_GEN_PREFIX(`lineno')
160 m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
162 M4_GEN_PREFIX(`tables_fload')
163 M4_GEN_PREFIX(`tables_destroy')
164 M4_GEN_PREFIX(`TABLES_NAME')
167 /* First, we deal with platform-specific or compiler-specific issues. */
169 /* begin standard C headers. */
177 %if-tables-serialization
178 #include <sys/types.h>
179 #include <netinet/in.h>
181 /* end standard C headers. */
184 m4preproc_include(`flexint.h')
188 /* begin standard C++ headers. */
193 /* end standard C++ headers. */
198 /* The "const" storage-class-modifier is valid. */
201 #else /* ! __cplusplus */
207 #endif /* __STDC__ */
208 #endif /* ! __cplusplus */
211 #define yyconst const
216 %# For compilers that can not handle prototypes.
218 %# The function prototype
219 %# int foo(int x, char* y);
221 %# ...should be written as
222 %# int foo M4_YY_PARAMS(int x, char* y);
224 %# ...which could possibly generate
227 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
229 m4_define( [[M4_YY_PARAMS]], [[()]])
232 m4_define( [[M4_YY_PARAMS]], [[($*)]])
236 /* Returned upon end-of-file. */
241 /* Promotes a possibly negative, possibly signed char to an unsigned
242 * integer for use as an array index. If the signed char is negative,
243 * we want to instead treat it as an 8-bit unsigned char, hence the
246 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
253 /* An opaque pointer. */
254 #ifndef YY_TYPEDEF_YY_SCANNER_T
255 #define YY_TYPEDEF_YY_SCANNER_T
256 typedef void* yyscan_t;
259 %# Declare yyguts variable
260 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
261 %# For use wherever a Global is accessed or assigned.
262 m4_define( [[YY_G]], [[yyg->$1]])
264 %# For use in function prototypes to append the additional argument.
265 m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
266 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
268 %# For use in function definitions to append the additional argument.
269 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
271 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
272 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
275 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
276 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
278 m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
280 %# For use in function calls to pass the additional argument.
281 m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
282 m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
284 %# For use in function documentation to adjust for additional argument.
285 m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
287 /* For convenience, these vars (plus the bison vars far below)
288 are macros in the reentrant scanner. */
289 #define yyin YY_G(yyin_r)
290 #define yyout YY_G(yyout_r)
291 #define yyextra YY_G(yyextra_r)
292 #define yyleng YY_G(yyleng_r)
293 #define yytext YY_G(yytext_r)
294 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
295 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
296 #define yy_flex_debug YY_G(yy_flex_debug_r)
298 m4_define( [[M4_YY_INCR_LINENO]],
305 int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
312 m4_define( [[M4_YY_INCR_LINENO]],
317 %# Define these macros to be no-ops.
318 m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
319 m4_define( [[YY_G]], [[($1)]])
320 m4_define( [[M4_YY_PROTO_LAST_ARG]])
321 m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
322 m4_define( [[M4_YY_DEF_LAST_ARG]])
324 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
326 m4_define( [[M4_YY_DEF_ONLY_ARG]])
329 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
331 m4_define([[M4_YY_DECL_LAST_ARG]])
332 m4_define([[M4_YY_CALL_LAST_ARG]])
333 m4_define([[M4_YY_CALL_ONLY_ARG]])
334 m4_define( [[M4_YY_DOC_PARAM]], [[]])
339 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
341 %# For compilers that need traditional function definitions.
343 %# The function prototype taking 2 arguments
344 %# int foo (int x, char* y)
346 %# ...should be written as
347 %# int foo YYFARGS2(int,x, char*,y)
349 %# ...which could possibly generate
350 %# int foo (x,y,yyscanner)
353 %# yyscan_t yyscanner;
355 %# Generate traditional function defs
356 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
357 M4_YY_DECL_LAST_ARG]])
358 m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
360 M4_YY_DECL_LAST_ARG]])
361 m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
364 M4_YY_DECL_LAST_ARG]])
365 m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
369 M4_YY_DECL_LAST_ARG]])
372 %# Generate C99 function defs.
373 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
374 m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
375 m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
376 m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
379 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
381 /* Enter a start condition. This macro really ought to take a parameter,
382 * but we do it the disgusting crufty way forced on us by the ()-less
383 * definition of BEGIN.
385 #define BEGIN YY_G(yy_start) = 1 + 2 *
388 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
390 /* Translate the current start state into a value that can be later handed
391 * to BEGIN to return to the state. The YYSTATE alias is for lex
394 #define YY_START ((YY_G(yy_start) - 1) / 2)
395 #define YYSTATE YY_START
398 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
400 /* Action number for EOF rule of a given start state. */
401 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
404 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
406 /* Special action meaning "start processing a new file". */
407 #define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
410 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
412 #define YY_END_OF_BUFFER_CHAR 0
415 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
417 /* Size of default input buffer. */
419 #define YY_BUF_SIZE 16384
422 /* The state buf must be large enough to hold one state per character in the main buffer.
424 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
428 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
429 #define YY_TYPEDEF_YY_BUFFER_STATE
430 typedef struct yy_buffer_state *YY_BUFFER_STATE;
439 extern FILE *yyin, *yyout;
443 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
445 #define EOB_ACT_CONTINUE_SCAN 0
446 #define EOB_ACT_END_OF_FILE 1
447 #define EOB_ACT_LAST_MATCH 2
450 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
452 m4_ifdef( [[M4_YY_USE_LINENO]],
454 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
455 * access to the local variable yy_act. Since yyless() is a macro, it would break
456 * existing scanners that call yyless() from OUTSIDE yylex.
457 * One obvious solution it to make yy_act a global. I tried that, and saw
458 * a 5% performance hit in a non-yylineno scanner, because yy_act is
459 * normally declared as a register variable-- so it is not worth it.
461 #define YY_LESS_LINENO(n) \
464 for ( yyl = n; yyl < yyleng; ++yyl )\
465 if ( yytext[yyl] == '\n' )\
470 #define YY_LESS_LINENO(n)
474 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
476 /* Return all but the first "n" matched characters back to the input stream. */
480 /* Undo effects of setting up yytext. */ \
481 int yyless_macro_arg = (n); \
482 YY_LESS_LINENO(yyless_macro_arg);\
483 *yy_cp = YY_G(yy_hold_char); \
484 YY_RESTORE_YY_MORE_OFFSET \
485 YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
486 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
491 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
493 #define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
496 /* The following is because we cannot portably get our hands on size_t
497 * (without autoconf's help, which isn't available because we want
498 * flex-generated scanners to compile on their own).
501 #ifndef YY_TYPEDEF_YY_SIZE_T
502 #define YY_TYPEDEF_YY_SIZE_T
503 typedef unsigned int yy_size_t;
506 #ifndef YY_STRUCT_YY_BUFFER_STATE
507 #define YY_STRUCT_YY_BUFFER_STATE
508 struct yy_buffer_state
515 std::istream* yy_input_file;
519 char *yy_ch_buf; /* input buffer */
520 char *yy_buf_pos; /* current position in input buffer */
522 /* Size of input buffer in bytes, not including room for EOB
525 yy_size_t yy_buf_size;
527 /* Number of characters read into yy_ch_buf, not including EOB
532 /* Whether we "own" the buffer - i.e., we know we created it,
533 * and can realloc() it to grow it, and should free() it to
536 int yy_is_our_buffer;
538 /* Whether this is an "interactive" input source; if so, and
539 * if we're using stdio for input, then we want to use getc()
540 * instead of fread(), to make sure we stop fetching input after
543 int yy_is_interactive;
545 /* Whether we're considered to be at the beginning of a line.
546 * If so, '^' rules will be active on the next match, otherwise
551 int yy_bs_lineno; /**< The line count. */
552 int yy_bs_column; /**< The column count. */
555 /* Whether to try to fill the input buffer when we reach the
560 int yy_buffer_status;
561 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
563 #define YY_BUFFER_NEW 0
564 #define YY_BUFFER_NORMAL 1
565 /* When an EOF's been seen but there's still some text to process
566 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
567 * shouldn't try reading from the input source any more. We might
568 * still have a bunch of tokens to match, though, because of
569 * possible backing-up.
571 * When we actually see the EOF, we change the status to "new"
572 * (via yyrestart()), so that the user can continue scanning by
573 * just pointing yyin at a new input file.
575 #define YY_BUFFER_EOF_PENDING 2
578 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
580 %if-c-only Standard (non-C++) definition
584 /* Stack of input buffers. */
585 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
586 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
587 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
592 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
594 /* We provide macros for accessing buffer states in case in the
595 * future we want to put the buffer states in a more general
598 * Returns the top of the stack, or NULL.
600 #define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
601 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
605 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
607 /* Same as previous macro, but useful when we know that the buffer stack is not
608 * NULL or when we need an lvalue. For internal use only.
610 #define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
613 %if-c-only Standard (non-C++) definition
617 /* yy_hold_char holds the character lost when yytext is formed. */
618 static char yy_hold_char;
619 static int yy_n_chars; /* number of characters read into yy_ch_buf */
622 /* Points to current character in buffer. */
623 static char *yy_c_buf_p = (char *) 0;
624 static int yy_init = 0; /* whether we need to initialize */
625 static int yy_start = 0; /* start state number */
627 /* Flag which is used to allow yywrap()'s to do buffer switches
628 * instead of setting up a fresh yyin. A bit of a hack ...
630 static int yy_did_buffer_switch_on_eof;
634 void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
635 void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
636 YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
637 void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
638 void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
639 void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
640 void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
642 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
644 static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
645 static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
646 static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
649 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
651 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
654 YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
655 YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
656 YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, int len M4_YY_PROTO_LAST_ARG );
660 void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
661 void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
662 void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
664 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
666 #define yy_new_buffer yy_create_buffer
669 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
671 #define yy_set_interactive(is_interactive) \
673 if ( ! YY_CURRENT_BUFFER ){ \
674 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
675 YY_CURRENT_BUFFER_LVALUE = \
676 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
678 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
682 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
684 #define yy_set_bol(at_bol) \
686 if ( ! YY_CURRENT_BUFFER ){\
687 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
688 YY_CURRENT_BUFFER_LVALUE = \
689 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
691 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
695 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
697 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
700 %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
702 %if-c-only Standard (non-C++) definition
704 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
706 static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
707 static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
708 static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
709 static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
714 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
716 /* Done after the current pattern has been matched and before the
717 * corresponding action - sets up yytext.
719 #define YY_DO_BEFORE_ACTION \
720 YY_G(yytext_ptr) = yy_bp; \
721 %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
722 YY_G(yy_hold_char) = *yy_cp; \
724 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
725 YY_G(yy_c_buf_p) = yy_cp;
728 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
730 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
733 m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
735 m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
737 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
739 #ifndef YY_NO_UNISTD_H
740 /* Special case for "unistd.h", since it is non-ANSI. We include it way
741 * down here because we want the user's section 1 to have been scanned first.
742 * The user has a chance to override it with an option.
753 #ifndef YY_EXTRA_TYPE
754 #define YY_EXTRA_TYPE void *
757 %if-c-only Reentrant structure and macros (non-C++).
760 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
762 /* Holds the entire state of the reentrant scanner. */
766 /* User-defined. Not touched by flex. */
767 YY_EXTRA_TYPE yyextra_r;
769 /* The rest are the same as the globals declared in the non-reentrant scanner. */
770 FILE *yyin_r, *yyout_r;
771 size_t yy_buffer_stack_top; /**< index of top of stack. */
772 size_t yy_buffer_stack_max; /**< capacity of stack. */
773 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
780 int yy_did_buffer_switch_on_eof;
781 int yy_start_stack_ptr;
782 int yy_start_stack_depth;
784 yy_state_type yy_last_accepting_state;
785 char* yy_last_accepting_cpos;
790 m4_ifdef( [[M4_YY_USES_REJECT]],
792 yy_state_type *yy_state_buf;
793 yy_state_type *yy_state_ptr;
798 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
800 char yytext_r[YYLMAX];
803 int yy_prev_more_offset;
811 m4_ifdef( [[M4_YY_BISON_LVAL]],
816 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
821 }; /* end struct yyguts_t */
826 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
828 static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
834 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
836 m4_ifdef( [[M4_YY_BISON_LVAL]],
838 /* This must go here because YYSTYPE and YYLTYPE are included
839 * from bison output in section 1.*/
840 # define yylval YY_G(yylval_r)
843 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
845 # define yylloc YY_G(yylloc_r)
851 /* Accessor methods to globals.
852 These are made visible to non-reentrant scanners for convenience. */
854 m4_ifdef( [[M4_YY_NO_DESTROY]],,
856 int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
859 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
861 int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
864 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
866 void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
869 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
871 YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
874 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
876 void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
879 m4_ifdef( [[M4_YY_NO_GET_IN]],,
881 FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
884 m4_ifdef( [[M4_YY_NO_SET_IN]],,
886 void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );
889 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
891 FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
894 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
896 void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );
899 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
901 int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
904 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
906 char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
909 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
911 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
914 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
916 void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
920 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
922 YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
925 void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
927 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
929 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
931 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
934 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
936 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
940 %endif End reentrant structures and macros.
942 /* Macros after this point can all be overridden by user definitions in
946 #ifndef YY_SKIP_YYWRAP
948 extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
950 extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
955 m4_ifdef( [[M4_YY_NO_UNPUT]],,
957 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
963 static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
966 #ifdef YY_NEED_STRLEN
967 static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
971 %if-c-only Standard (non-C++) definition
974 static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
976 static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
984 %# TODO: This is messy.
985 m4_ifdef( [[M4_YY_STACK_USED]],
988 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
990 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
992 static int yy_start_stack_ptr = 0;
993 static int yy_start_stack_depth = 0;
994 static int *yy_start_stack = NULL;
998 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1000 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1002 static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG);
1004 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1006 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1008 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1010 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1016 m4_define( [[M4_YY_NO_PUSH_STATE]])
1017 m4_define( [[M4_YY_NO_POP_STATE]])
1018 m4_define( [[M4_YY_NO_TOP_STATE]])
1022 /* Amount of stuff to slurp up with each read. */
1023 #ifndef YY_READ_BUF_SIZE
1024 #define YY_READ_BUF_SIZE 8192
1027 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1029 /* Copy whatever the last rule matched to the standard output. */
1031 %if-c-only Standard (non-C++) definition
1032 /* This used to be an fputs(), but since the string might contain NUL's,
1033 * we now use fwrite().
1035 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1037 %if-c++-only C++ definition
1038 #define ECHO LexerOutput( yytext, yyleng )
1043 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1045 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1046 * is returned in "result".
1049 #define YY_INPUT(buf,result,max_size) \
1050 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1052 %if-c++-only C++ definition \
1053 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
1054 YY_FATAL_ERROR( "input in flex scanner failed" );
1060 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1062 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1063 * we don't want an extra ';' after the "return" because that will cause
1064 * some compilers to complain about unreachable statements.
1067 #define yyterminate() return YY_NULL
1071 /* Number of entries by which start-condition stack grows. */
1072 #ifndef YY_START_STACK_INCR
1073 #define YY_START_STACK_INCR 25
1076 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1078 /* Report a fatal error. */
1079 #ifndef YY_FATAL_ERROR
1081 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1084 #define YY_FATAL_ERROR(msg) LexerError( msg )
1089 %if-tables-serialization structures and prototypes
1090 m4preproc_include(`tables_shared.h')
1092 /* Load the DFA tables from the given stream. */
1093 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1095 /* Unload the tables from memory. */
1096 int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1099 /** Describes a mapping from a serialized table id to its deserialized state in
1100 * this scanner. This is the bridge between our "generic" deserialization code
1101 * and the specifics of this scanner.
1104 enum yytbl_id dm_id;/**< table identifier */
1105 void **dm_arr; /**< address of pointer to store the deserialized table. */
1106 size_t dm_sz; /**< local sizeof() each element in table. */
1109 /** A {0,0,0}-terminated list of structs, forming the map */
1110 static struct yytbl_dmap yydmap[] =
1112 %tables-yydmap generated elements
1116 /** A tables-reader object to maintain some state in the read. */
1117 struct yytbl_reader {
1118 FILE * fp; /**< input stream */
1119 flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1123 /* end tables serialization structures and prototypes */
1127 /* Default declaration of generated scanner - a define so the user can
1128 * easily add parameters.
1131 #define YY_DECL_IS_OURS 1
1132 %if-c-only Standard (non-C++) definition
1135 m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1136 m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1138 m4_ifdef( [[M4_YY_BISON_LVAL]],
1140 m4_dnl The bison pure parser is used. Redefine yylex to
1141 m4_dnl accept the lval parameter.
1143 m4_define( [[M4_YY_LEX_PROTO]],
1144 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1145 m4_define( [[M4_YY_LEX_DECLARATION]],
1146 [[YYFARGS1(YYSTYPE *,yylval_param)]])
1149 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1151 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
1153 m4_define( [[M4_YY_LEX_PROTO]],
1154 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1155 m4_define( [[M4_YY_LEX_DECLARATION]],
1156 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1159 extern int yylex M4_YY_LEX_PROTO;
1161 #define YY_DECL int yylex M4_YY_LEX_DECLARATION
1163 %if-c++-only C++ definition
1164 #define YY_DECL int yyFlexLexer::yylex()
1166 #endif /* !YY_DECL */
1168 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1170 /* Code executed at the beginning of each rule, after yytext and yyleng
1173 #ifndef YY_USER_ACTION
1174 #define YY_USER_ACTION
1178 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1180 /* Code executed at the end of each rule. */
1182 #define YY_BREAK break;
1186 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1188 %% [6.0] YY_RULE_SETUP definition goes here
1192 /** The main scanner function which does all the work.
1196 register yy_state_type yy_current_state;
1197 register char *yy_cp, *yy_bp;
1198 register int yy_act;
1199 M4_YY_DECL_GUTS_VAR();
1201 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1203 m4_ifdef( [[M4_YY_BISON_LVAL]],
1207 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1213 %% [7.0] user's declarations go here
1215 m4_ifdef( [[M4_YY_BISON_LVAL]],
1217 yylval = yylval_param;
1220 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1222 yylloc = yylloc_param;
1225 if ( !YY_G(yy_init) )
1233 m4_ifdef( [[M4_YY_USES_REJECT]],
1235 /* Create the reject buffer large enough to save one state per allowed character. */
1236 if ( ! YY_G(yy_state_buf) )
1237 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
1240 if ( ! YY_G(yy_start) )
1241 YY_G(yy_start) = 1; /* first start state */
1256 yyout = & std::cout;
1259 if ( ! YY_CURRENT_BUFFER ) {
1260 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1261 YY_CURRENT_BUFFER_LVALUE =
1262 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1265 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1268 while ( 1 ) /* loops until end-of-file is reached */
1270 %% [8.0] yymore()-related code goes here
1271 yy_cp = YY_G(yy_c_buf_p);
1273 /* Support of yytext. */
1274 *yy_cp = YY_G(yy_hold_char);
1276 /* yy_bp points to the position in yy_ch_buf of the start of
1281 %% [9.0] code to set up and find next match goes here
1284 %% [10.0] code to find the action number goes here
1286 YY_DO_BEFORE_ACTION;
1288 %% [11.0] code for yylineno update goes here
1290 do_action: /* This label is used only to access EOF actions. */
1292 %% [12.0] debug code goes here
1295 { /* beginning of action switch */
1296 %% [13.0] actions go here
1298 case YY_END_OF_BUFFER:
1300 /* Amount of text matched not including the EOB char. */
1301 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1303 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1304 *yy_cp = YY_G(yy_hold_char);
1305 YY_RESTORE_YY_MORE_OFFSET
1307 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1309 /* We're scanning a new file or input source. It's
1310 * possible that this happened because the user
1311 * just pointed yyin at a new source and called
1312 * yylex(). If so, then we have to assure
1313 * consistency between YY_CURRENT_BUFFER and our
1314 * globals. Here is the right place to do so, because
1315 * this is the first action (other than possibly a
1316 * back-up) that will match for the new input source.
1318 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1319 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1320 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1323 /* Note that here we test for yy_c_buf_p "<=" to the position
1324 * of the first EOB in the buffer, since yy_c_buf_p will
1325 * already have been incremented past the NUL character
1326 * (since all states make transitions on EOB to the
1327 * end-of-buffer state). Contrast this with the test
1330 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1331 { /* This was really a NUL. */
1332 yy_state_type yy_next_state;
1334 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1336 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1338 /* Okay, we're now positioned to make the NUL
1339 * transition. We couldn't have
1340 * yy_get_previous_state() go ahead and do it
1341 * for us because it doesn't know how to deal
1342 * with the possibility of jamming (and we don't
1343 * want to build jamming into it because then it
1344 * will run more slowly).
1347 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1349 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1351 if ( yy_next_state )
1353 /* Consume the NUL. */
1354 yy_cp = ++YY_G(yy_c_buf_p);
1355 yy_current_state = yy_next_state;
1361 %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1362 goto yy_find_action;
1366 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1368 case EOB_ACT_END_OF_FILE:
1370 YY_G(yy_did_buffer_switch_on_eof) = 0;
1372 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1374 /* Note: because we've taken care in
1375 * yy_get_next_buffer() to have set up
1376 * yytext, we can now set up
1377 * yy_c_buf_p so that if some total
1378 * hoser (like flex itself) wants to
1379 * call the scanner after we return the
1380 * YY_NULL, it'll still work - another
1381 * YY_NULL will get returned.
1383 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1385 yy_act = YY_STATE_EOF(YY_START);
1391 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1397 case EOB_ACT_CONTINUE_SCAN:
1399 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1401 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1403 yy_cp = YY_G(yy_c_buf_p);
1404 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1407 case EOB_ACT_LAST_MATCH:
1409 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1411 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1413 yy_cp = YY_G(yy_c_buf_p);
1414 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1415 goto yy_find_action;
1422 "fatal flex scanner internal error--no action found" );
1423 } /* end of action switch */
1424 } /* end of scanning one token */
1425 } /* end of yylex */
1430 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1438 yylineno = 1; // this will only get updated if %option yylineno
1440 yy_did_buffer_switch_on_eof = 0;
1442 yy_looking_for_trail_begin = 0;
1445 yy_more_offset = yy_prev_more_offset = 0;
1447 yy_start_stack_ptr = yy_start_stack_depth = 0;
1448 yy_start_stack = NULL;
1450 YY_G(yy_buffer_stack) = 0;
1451 YY_G(yy_buffer_stack_top) = 0;
1452 YY_G(yy_buffer_stack_max) = 0;
1455 m4_ifdef( [[M4_YY_USES_REJECT]],
1457 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1464 yyFlexLexer::~yyFlexLexer()
1466 delete [] yy_state_buf;
1467 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1468 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1471 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1475 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1476 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1483 #ifdef YY_INTERACTIVE
1484 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1486 int yyFlexLexer::LexerInput( char* buf, int max_size )
1489 if ( yyin->eof() || yyin->fail() )
1492 #ifdef YY_INTERACTIVE
1493 yyin->get( buf[0] );
1504 (void) yyin->read( buf, max_size );
1509 return yyin->gcount();
1513 void yyFlexLexer::LexerOutput( const char* buf, int size )
1515 (void) yyout->write( buf, size );
1520 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1522 /* yy_get_next_buffer - try to read in a new buffer
1524 * Returns a code representing an action:
1525 * EOB_ACT_LAST_MATCH -
1526 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1527 * EOB_ACT_END_OF_FILE - end of file
1530 static int yy_get_next_buffer YYFARGS0(void)
1533 int yyFlexLexer::yy_get_next_buffer()
1536 M4_YY_DECL_GUTS_VAR();
1537 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1538 register char *source = YY_G(yytext_ptr);
1539 register int number_to_move, i;
1542 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1544 "fatal flex scanner internal error--end of buffer missed" );
1546 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1547 { /* Don't try to fill the buffer, so this is an EOF. */
1548 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1550 /* We matched a single character, the EOB, so
1551 * treat this as a final EOF.
1553 return EOB_ACT_END_OF_FILE;
1558 /* We matched some text prior to the EOB, first
1561 return EOB_ACT_LAST_MATCH;
1565 /* Try to read more data. */
1567 /* First move last chars to start of buffer. */
1568 number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
1570 for ( i = 0; i < number_to_move; ++i )
1571 *(dest++) = *(source++);
1573 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1574 /* don't do the read, it's not guaranteed to return an EOF,
1577 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1582 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1584 while ( num_to_read <= 0 )
1585 { /* Not enough room in the buffer - grow it. */
1586 m4_ifdef( [[M4_YY_USES_REJECT]],
1589 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1592 /* just a shorter name for the current buffer */
1593 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1595 int yy_c_buf_p_offset =
1596 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1598 if ( b->yy_is_our_buffer )
1600 int new_size = b->yy_buf_size * 2;
1602 if ( new_size <= 0 )
1603 b->yy_buf_size += b->yy_buf_size / 8;
1605 b->yy_buf_size *= 2;
1607 b->yy_ch_buf = (char *)
1608 /* Include room in for 2 EOB chars. */
1609 yyrealloc( (void *) b->yy_ch_buf,
1610 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1613 /* Can't grow it, we don't own it. */
1616 if ( ! b->yy_ch_buf )
1618 "fatal error - scanner input buffer overflow" );
1620 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1622 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1627 if ( num_to_read > YY_READ_BUF_SIZE )
1628 num_to_read = YY_READ_BUF_SIZE;
1630 /* Read in more data. */
1631 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1632 YY_G(yy_n_chars), num_to_read );
1634 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1637 if ( YY_G(yy_n_chars) == 0 )
1639 if ( number_to_move == YY_MORE_ADJ )
1641 ret_val = EOB_ACT_END_OF_FILE;
1642 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1647 ret_val = EOB_ACT_LAST_MATCH;
1648 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1649 YY_BUFFER_EOF_PENDING;
1654 ret_val = EOB_ACT_CONTINUE_SCAN;
1656 YY_G(yy_n_chars) += number_to_move;
1657 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1658 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1660 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1666 /* yy_get_previous_state - get the state just before the EOB char was reached */
1670 static yy_state_type yy_get_previous_state YYFARGS0(void)
1673 yy_state_type yyFlexLexer::yy_get_previous_state()
1676 register yy_state_type yy_current_state;
1677 register char *yy_cp;
1678 M4_YY_DECL_GUTS_VAR();
1680 %% [15.0] code to get the start state into yy_current_state goes here
1682 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1684 %% [16.0] code to find the next state goes here
1687 return yy_current_state;
1691 /* yy_try_NUL_trans - try to make a transition on the NUL character
1694 * next_state = yy_try_NUL_trans( current_state );
1697 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1700 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1703 register int yy_is_jam;
1704 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1705 %% [17.0] code to find the next state, and perhaps do backing up, goes here
1707 return yy_is_jam ? 0 : yy_current_state;
1712 m4_ifdef( [[M4_YY_NO_UNPUT]],,
1714 static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1717 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1720 register char *yy_cp;
1721 M4_YY_DECL_GUTS_VAR();
1723 yy_cp = YY_G(yy_c_buf_p);
1725 /* undo effects of setting up yytext */
1726 *yy_cp = YY_G(yy_hold_char);
1728 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1729 { /* need to shift things up to make room */
1730 /* +2 for EOB chars. */
1731 register int number_to_move = YY_G(yy_n_chars) + 2;
1732 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1733 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1734 register char *source =
1735 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1737 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1738 *--dest = *--source;
1740 yy_cp += (int) (dest - source);
1741 yy_bp += (int) (dest - source);
1742 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1743 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1745 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1746 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1749 *--yy_cp = (char) c;
1751 %% [18.0] update yylineno here
1752 m4_ifdef( [[M4_YY_USE_LINENO]],
1759 YY_G(yytext_ptr) = yy_bp;
1760 YY_G(yy_hold_char) = *yy_cp;
1761 YY_G(yy_c_buf_p) = yy_cp;
1770 static int yyinput YYFARGS0(void)
1772 static int input YYFARGS0(void)
1777 int yyFlexLexer::yyinput()
1781 M4_YY_DECL_GUTS_VAR();
1783 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1785 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1787 /* yy_c_buf_p now points to the character we want to return.
1788 * If this occurs *before* the EOB characters, then it's a
1789 * valid NUL; if not, then we've hit the end of the buffer.
1791 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1792 /* This was really a NUL. */
1793 *YY_G(yy_c_buf_p) = '\0';
1796 { /* need more input */
1797 int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1800 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1802 case EOB_ACT_LAST_MATCH:
1803 /* This happens because yy_g_n_b()
1804 * sees that we've accumulated a
1805 * token and flags that we need to
1806 * try matching the token before
1807 * proceeding. But for input(),
1808 * there's no matching to consider.
1809 * So convert the EOB_ACT_LAST_MATCH
1810 * to EOB_ACT_END_OF_FILE.
1813 /* Reset buffer status. */
1814 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1818 case EOB_ACT_END_OF_FILE:
1820 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1823 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1826 return yyinput(M4_YY_CALL_ONLY_ARG);
1828 return input(M4_YY_CALL_ONLY_ARG);
1832 case EOB_ACT_CONTINUE_SCAN:
1833 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1839 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
1840 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
1841 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1843 %% [19.0] update BOL and yylineno
1848 #endif /* ifndef YY_NO_INPUT */
1851 /** Immediately switch to a different input stream.
1852 * @param input_file A readable stream.
1854 * @note This function does not reset the start condition to @c INITIAL .
1857 void yyrestart YYFARGS1( FILE *,input_file)
1860 void yyFlexLexer::yyrestart( std::istream* input_file )
1863 M4_YY_DECL_GUTS_VAR();
1865 if ( ! YY_CURRENT_BUFFER ){
1866 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1867 YY_CURRENT_BUFFER_LVALUE =
1868 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1871 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1872 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1875 /** Switch to a different input buffer.
1876 * @param new_buffer The new input buffer.
1880 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1883 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1886 M4_YY_DECL_GUTS_VAR();
1888 /* TODO. We should be able to replace this entire function body
1890 * yypop_buffer_state();
1891 * yypush_buffer_state(new_buffer);
1893 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1894 if ( YY_CURRENT_BUFFER == new_buffer )
1897 if ( YY_CURRENT_BUFFER )
1899 /* Flush out information for old buffer. */
1900 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1901 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
1902 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1905 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1906 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1908 /* We don't actually know whether we did this switch during
1909 * EOF (yywrap()) processing, but the only time this flag
1910 * is looked at is after yywrap() is called, so it's safe
1911 * to go ahead and always set it.
1913 YY_G(yy_did_buffer_switch_on_eof) = 1;
1918 static void yy_load_buffer_state YYFARGS0(void)
1921 void yyFlexLexer::yy_load_buffer_state()
1924 M4_YY_DECL_GUTS_VAR();
1925 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1926 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1927 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1928 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
1931 /** Allocate and initialize an input buffer state.
1932 * @param file A readable stream.
1933 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1935 * @return the allocated buffer state.
1938 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
1941 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1945 m4_dnl M4_YY_DECL_GUTS_VAR();
1947 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
1949 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1951 b->yy_buf_size = size;
1953 /* yy_ch_buf has to be 2 characters longer than the size given because
1954 * we need to put in 2 end-of-buffer characters.
1956 b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1957 if ( ! b->yy_ch_buf )
1958 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1960 b->yy_is_our_buffer = 1;
1962 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
1967 /** Destroy the buffer.
1968 * @param b a buffer created with yy_create_buffer()
1972 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
1975 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1978 M4_YY_DECL_GUTS_VAR();
1983 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1984 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1986 if ( b->yy_is_our_buffer )
1987 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
1989 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
1994 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],,
1996 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
1999 extern int isatty M4_YY_PARAMS( int );
2000 #endif /* __cplusplus */
2006 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2008 extern "C" int isatty M4_YY_PARAMS( int );
2012 /* Initializes or reinitializes a buffer.
2013 * This function is sometimes called more than once on the same buffer,
2014 * such as during a yyrestart() or at EOF.
2017 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2020 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2025 M4_YY_DECL_GUTS_VAR();
2027 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2029 b->yy_input_file = file;
2030 b->yy_fill_buffer = 1;
2032 /* If b is the current buffer, then yy_init_buffer was _probably_
2033 * called from yyrestart() or through yy_get_next_buffer.
2034 * In that case, we don't want to reset the lineno or column.
2036 if (b != YY_CURRENT_BUFFER){
2037 b->yy_bs_lineno = 1;
2038 b->yy_bs_column = 0;
2042 m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2044 b->yy_is_interactive = 1;
2047 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2049 b->yy_is_interactive = 0;
2052 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2057 b->yy_is_interactive = 0;
2062 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2063 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2067 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2070 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2073 M4_YY_DECL_GUTS_VAR();
2079 /* We always need two end-of-buffer characters. The first causes
2080 * a transition to the end-of-buffer state. The second causes
2081 * a jam in that state.
2083 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2084 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2086 b->yy_buf_pos = &b->yy_ch_buf[0];
2089 b->yy_buffer_status = YY_BUFFER_NEW;
2091 if ( b == YY_CURRENT_BUFFER )
2092 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2096 /** Pushes the new state onto the stack. The new state becomes
2097 * the current state. This function will allocate the stack
2099 * @param new_buffer The new state.
2103 void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2106 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2109 M4_YY_DECL_GUTS_VAR();
2110 if (new_buffer == NULL)
2113 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2115 /* This block is copied from yy_switch_to_buffer. */
2116 if ( YY_CURRENT_BUFFER )
2118 /* Flush out information for old buffer. */
2119 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2120 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2121 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2124 /* Only push if top exists. Otherwise, replace top. */
2125 if (YY_CURRENT_BUFFER)
2126 YY_G(yy_buffer_stack_top)++;
2127 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2129 /* copied from yy_switch_to_buffer. */
2130 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2131 YY_G(yy_did_buffer_switch_on_eof) = 1;
2137 /** Removes and deletes the top of the stack, if present.
2138 * The next element becomes the new top.
2142 void yypop_buffer_state YYFARGS0(void)
2145 void yyFlexLexer::yypop_buffer_state (void)
2148 M4_YY_DECL_GUTS_VAR();
2149 if (!YY_CURRENT_BUFFER)
2152 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2153 YY_CURRENT_BUFFER_LVALUE = NULL;
2154 if (YY_G(yy_buffer_stack_top) > 0)
2155 --YY_G(yy_buffer_stack_top);
2157 if (YY_CURRENT_BUFFER) {
2158 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2159 YY_G(yy_did_buffer_switch_on_eof) = 1;
2166 /* Allocates the stack if it does not exist.
2167 * Guarantees space for at least one push.
2170 static void yyensure_buffer_stack YYFARGS0(void)
2173 void yyFlexLexer::yyensure_buffer_stack(void)
2177 M4_YY_DECL_GUTS_VAR();
2179 if (!YY_G(yy_buffer_stack)) {
2181 /* First allocation is just for 2 elements, since we don't know if this
2182 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2183 * immediate realloc on the next call.
2186 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2187 (num_to_alloc * sizeof(struct yy_buffer_state*)
2188 M4_YY_CALL_LAST_ARG);
2190 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2192 YY_G(yy_buffer_stack_max) = num_to_alloc;
2193 YY_G(yy_buffer_stack_top) = 0;
2197 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2199 /* Increase the buffer to prepare for a possible push. */
2200 int grow_size = 8 /* arbitrary grow size */;
2202 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2203 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2204 (YY_G(yy_buffer_stack),
2205 num_to_alloc * sizeof(struct yy_buffer_state*)
2206 M4_YY_CALL_LAST_ARG);
2208 /* zero only the new slots.*/
2209 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2210 YY_G(yy_buffer_stack_max) = num_to_alloc;
2218 m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2221 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2222 * @param base the character buffer
2223 * @param size the size in bytes of the character buffer
2225 * @return the newly allocated buffer state object.
2227 YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2230 m4_dnl M4_YY_DECL_GUTS_VAR();
2233 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2234 base[size-1] != YY_END_OF_BUFFER_CHAR )
2235 /* They forgot to leave room for the EOB's. */
2238 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2240 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2242 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2243 b->yy_buf_pos = b->yy_ch_buf = base;
2244 b->yy_is_our_buffer = 0;
2245 b->yy_input_file = 0;
2246 b->yy_n_chars = b->yy_buf_size;
2247 b->yy_is_interactive = 0;
2249 b->yy_fill_buffer = 0;
2250 b->yy_buffer_status = YY_BUFFER_NEW;
2252 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2260 m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2263 /** Setup the input buffer state to scan a string. The next call to yylex() will
2264 * scan from a @e copy of @a str.
2265 * @param str a NUL-terminated string to scan
2267 * @return the newly allocated buffer state object.
2268 * @note If you want to scan bytes that may contain NUL values, then use
2269 * yy_scan_bytes() instead.
2271 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2273 m4_dnl M4_YY_DECL_GUTS_VAR();
2275 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2281 m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2284 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2285 * scan from a @e copy of @a bytes.
2286 * @param bytes the byte buffer to scan
2287 * @param len the number of bytes in the buffer pointed to by @a bytes.
2289 * @return the newly allocated buffer state object.
2291 YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, int ,_yybytes_len)
2297 m4_dnl M4_YY_DECL_GUTS_VAR();
2299 /* Get memory for full buffer, including space for trailing EOB's. */
2300 n = _yybytes_len + 2;
2301 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2303 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2305 for ( i = 0; i < _yybytes_len; ++i )
2306 buf[i] = yybytes[i];
2308 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2310 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2312 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2314 /* It's okay to grow etc. this buffer, and we should throw it
2315 * away when we're done.
2317 b->yy_is_our_buffer = 1;
2325 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2328 static void yy_push_state YYFARGS1( int ,new_state)
2331 void yyFlexLexer::yy_push_state( int new_state )
2334 M4_YY_DECL_GUTS_VAR();
2335 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2339 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2340 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2342 if ( ! YY_G(yy_start_stack) )
2343 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2346 YY_G(yy_start_stack) = (int *) yyrealloc(
2347 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2349 if ( ! YY_G(yy_start_stack) )
2351 "out of memory expanding start-condition stack" );
2354 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2361 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2364 static void yy_pop_state YYFARGS0(void)
2367 void yyFlexLexer::yy_pop_state()
2370 M4_YY_DECL_GUTS_VAR();
2371 if ( --YY_G(yy_start_stack_ptr) < 0 )
2372 YY_FATAL_ERROR( "start-condition stack underflow" );
2374 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2379 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2382 static int yy_top_state YYFARGS0(void)
2385 int yyFlexLexer::yy_top_state()
2388 M4_YY_DECL_GUTS_VAR();
2389 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2393 #ifndef YY_EXIT_FAILURE
2394 #define YY_EXIT_FAILURE 2
2398 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2400 m4_dnl M4_YY_DECL_GUTS_VAR();
2401 (void) fprintf( stderr, "%s\n", msg );
2402 exit( YY_EXIT_FAILURE );
2406 void yyFlexLexer::LexerError( yyconst char msg[] )
2408 M4_YY_DECL_GUTS_VAR();
2409 std::cerr << msg << std::endl;
2410 exit( YY_EXIT_FAILURE );
2414 /* Redefine yyless() so it works in section 3 code. */
2420 /* Undo effects of setting up yytext. */ \
2421 int yyless_macro_arg = (n); \
2422 YY_LESS_LINENO(yyless_macro_arg);\
2423 yytext[yyleng] = YY_G(yy_hold_char); \
2424 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2425 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2426 *YY_G(yy_c_buf_p) = '\0'; \
2427 yyleng = yyless_macro_arg; \
2433 /* Accessor methods (get/set functions) to struct members. */
2437 m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2439 /** Get the user-defined data for this scanner.
2442 YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2444 M4_YY_DECL_GUTS_VAR();
2450 m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2452 /** Get the current line number.
2455 int yyget_lineno YYFARGS0(void)
2457 M4_YY_DECL_GUTS_VAR();
2459 m4_ifdef( [[M4_YY_REENTRANT]],
2461 if (! YY_CURRENT_BUFFER)
2468 m4_ifdef( [[M4_YY_REENTRANT]],
2470 m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2472 /** Get the current column number.
2475 int yyget_column YYFARGS0(void)
2477 M4_YY_DECL_GUTS_VAR();
2479 m4_ifdef( [[M4_YY_REENTRANT]],
2481 if (! YY_CURRENT_BUFFER)
2489 m4_ifdef( [[M4_YY_NO_GET_IN]],,
2491 /** Get the input stream.
2494 FILE *yyget_in YYFARGS0(void)
2496 M4_YY_DECL_GUTS_VAR();
2501 m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2503 /** Get the output stream.
2506 FILE *yyget_out YYFARGS0(void)
2508 M4_YY_DECL_GUTS_VAR();
2513 m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2515 /** Get the length of the current token.
2518 int yyget_leng YYFARGS0(void)
2520 M4_YY_DECL_GUTS_VAR();
2525 /** Get the current token.
2528 m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2530 char *yyget_text YYFARGS0(void)
2532 M4_YY_DECL_GUTS_VAR();
2538 m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2540 /** Set the user-defined data. This data is never touched by the scanner.
2541 * @param user_defined The data to be associated with this scanner.
2544 void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2546 M4_YY_DECL_GUTS_VAR();
2547 yyextra = user_defined ;
2552 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2554 /** Set the current line number.
2555 * @param line_number
2558 void yyset_lineno YYFARGS1( int ,line_number)
2560 M4_YY_DECL_GUTS_VAR();
2562 m4_ifdef( [[M4_YY_REENTRANT]],
2564 /* lineno is only valid if an input buffer exists. */
2565 if (! YY_CURRENT_BUFFER )
2566 yy_fatal_error( "yyset_lineno called with no buffer" M4_YY_CALL_LAST_ARG);
2568 yylineno = line_number;
2572 m4_ifdef( [[M4_YY_REENTRANT]],
2574 m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2576 /** Set the current column.
2577 * @param line_number
2580 void yyset_column YYFARGS1( int , column_no)
2582 M4_YY_DECL_GUTS_VAR();
2584 m4_ifdef( [[M4_YY_REENTRANT]],
2586 /* column is only valid if an input buffer exists. */
2587 if (! YY_CURRENT_BUFFER )
2588 yy_fatal_error( "yyset_column called with no buffer" M4_YY_CALL_LAST_ARG);
2590 yycolumn = column_no;
2596 m4_ifdef( [[M4_YY_NO_SET_IN]],,
2598 /** Set the input stream. This does not discard the current
2600 * @param in_str A readable stream.
2602 * @see yy_switch_to_buffer
2604 void yyset_in YYFARGS1( FILE * ,in_str)
2606 M4_YY_DECL_GUTS_VAR();
2611 m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2613 void yyset_out YYFARGS1( FILE * ,out_str)
2615 M4_YY_DECL_GUTS_VAR();
2621 m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2623 int yyget_debug YYFARGS0(void)
2625 M4_YY_DECL_GUTS_VAR();
2626 return yy_flex_debug;
2630 m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2632 void yyset_debug YYFARGS1( int ,bdebug)
2634 M4_YY_DECL_GUTS_VAR();
2635 yy_flex_debug = bdebug ;
2641 /* Accessor methods for yylval and yylloc */
2644 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2646 YYSTYPE * yyget_lval YYFARGS0(void)
2648 M4_YY_DECL_GUTS_VAR();
2653 m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2655 void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2657 M4_YY_DECL_GUTS_VAR();
2658 yylval = yylval_param;
2662 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2664 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2666 YYLTYPE *yyget_lloc YYFARGS0(void)
2668 M4_YY_DECL_GUTS_VAR();
2673 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2675 void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2677 M4_YY_DECL_GUTS_VAR();
2678 yylloc = yylloc_param;
2686 /* User-visible API */
2688 /* yylex_init is special because it creates the scanner itself, so it is
2689 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2690 * That's why we explicitly handle the declaration, instead of using our macros.
2692 m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2694 int yylex_init( ptr_yy_globals )
2695 yyscan_t* ptr_yy_globals;
2698 int yylex_init(yyscan_t* ptr_yy_globals)
2701 if (ptr_yy_globals == NULL){
2706 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2708 if (*ptr_yy_globals == NULL){
2713 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2714 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2716 return yy_init_globals ( *ptr_yy_globals );
2722 static int yy_init_globals YYFARGS0(void)
2724 M4_YY_DECL_GUTS_VAR();
2725 /* Initialization is the same as for the non-reentrant scanner.
2726 * This function is called from yylex_destroy(), so don't allocate here.
2729 m4_ifdef( [[M4_YY_USE_LINENO]],
2731 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2733 /* We do not touch yylineno unless the option is enabled. */
2737 YY_G(yy_buffer_stack) = 0;
2738 YY_G(yy_buffer_stack_top) = 0;
2739 YY_G(yy_buffer_stack_max) = 0;
2740 YY_G(yy_c_buf_p) = (char *) 0;
2744 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2746 YY_G(yy_start_stack_ptr) = 0;
2747 YY_G(yy_start_stack_depth) = 0;
2748 YY_G(yy_start_stack) = NULL;
2751 m4_ifdef( [[M4_YY_USES_REJECT]],
2753 YY_G(yy_state_buf) = 0;
2754 YY_G(yy_state_ptr) = 0;
2755 YY_G(yy_full_match) = 0;
2759 m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2761 YY_G(yytext_ptr) = 0;
2762 YY_G(yy_more_offset) = 0;
2763 YY_G(yy_prev_more_offset) = 0;
2766 /* Defined in main.c */
2775 /* For future reference: Set errno on error, since we are called by
2783 %if-c-only SNIP! this currently causes conflicts with the c++ scanner
2784 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2785 int yylex_destroy YYFARGS0(void)
2787 M4_YY_DECL_GUTS_VAR();
2789 /* Pop the buffer stack, destroying each element. */
2790 while(YY_CURRENT_BUFFER){
2791 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2792 YY_CURRENT_BUFFER_LVALUE = NULL;
2793 yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2796 /* Destroy the stack itself. */
2797 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2798 YY_G(yy_buffer_stack) = NULL;
2800 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2802 /* Destroy the start condition stack. */
2803 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2804 YY_G(yy_start_stack) = NULL;
2807 m4_ifdef( [[M4_YY_USES_REJECT]],
2809 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2810 YY_G(yy_state_buf) = NULL;
2813 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2814 * yylex() is called, initialization will occur. */
2815 yy_init_globals( M4_YY_CALL_ONLY_ARG);
2818 /* Destroy the main struct (reentrant only). */
2819 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2827 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2830 * Internal utility routines.
2834 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2837 static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2840 for ( i = 0; i < n; ++i )
2846 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2848 #ifdef YY_NEED_STRLEN
2849 static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2852 for ( n = 0; s[n]; ++n )
2860 m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
2862 void *yyalloc YYFARGS1( yy_size_t ,size)
2864 return (void *) malloc( size );
2868 m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
2870 void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
2872 /* The cast to (char *) in the following accommodates both
2873 * implementations that use char* generic pointers, and those
2874 * that use void* generic pointers. It works with the latter
2875 * because both ANSI C and C++ allow castless assignment from
2876 * any pointer type to void*, and deal with argument conversions
2877 * as though doing an assignment.
2879 return (void *) realloc( (char *) ptr, size );
2883 m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
2885 void yyfree YYFARGS1( void *,ptr)
2887 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2891 %if-tables-serialization definitions
2892 m4preproc_include(`tables_shared.c')
2894 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
2897 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
2901 rd->bread += sizeof(flex_uint8_t);
2905 static int yytbl_read16 (void *v, struct yytbl_reader * rd)
2908 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
2912 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
2913 rd->bread += sizeof(flex_uint16_t);
2917 static int yytbl_read32 (void *v, struct yytbl_reader * rd)
2920 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
2924 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
2925 rd->bread += sizeof(flex_uint32_t);
2929 /** Read the header */
2930 static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
2933 memset (th, 0, sizeof (struct yytbl_hdr));
2935 if (yytbl_read32 (&(th->th_magic), rd) != 0)
2938 if (th->th_magic != YYTBL_MAGIC){
2939 yy_fatal_error("bad magic number" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
2943 if (yytbl_read32 (&(th->th_hsize), rd) != 0
2944 || yytbl_read32 (&(th->th_ssize), rd) != 0
2945 || yytbl_read16 (&(th->th_flags), rd) != 0)
2948 /* Sanity check on header size. Greater than 1k suggests some funny business. */
2949 if (th->th_hsize < 16 || th->th_hsize > 1024){
2950 yy_fatal_error("insane header size detected" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
2954 /* Allocate enough space for the version and name fields */
2955 bytes = th->th_hsize - 14;
2956 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
2958 /* we read it all into th_version, and point th_name into that data */
2959 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
2961 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
2962 th->th_version = NULL;
2968 th->th_name = th->th_version + strlen (th->th_version) + 1;
2972 /** lookup id in the dmap list.
2973 * @param dmap pointer to first element in list
2974 * @return NULL if not found.
2976 static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
2980 if (dmap->dm_id == id)
2987 /** Read a table while mapping its contents to the local array.
2988 * @param dmap used to performing mapping
2989 * @return 0 on success
2991 static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
2993 struct yytbl_data td;
2994 struct yytbl_dmap *transdmap=0;
2995 int len, i, rv, inner_loop_count;
2998 memset (&td, 0, sizeof (struct yytbl_data));
3000 if (yytbl_read16 (&td.td_id, rd) != 0
3001 || yytbl_read16 (&td.td_flags, rd) != 0
3002 || yytbl_read32 (&td.td_hilen, rd) != 0
3003 || yytbl_read32 (&td.td_lolen, rd) != 0)
3006 /* Lookup the map for the transition table so we have it in case we need it
3007 * inside the loop below. This scanner might not even have a transition
3008 * table, which is ok.
3010 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3012 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3013 yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3017 /* Allocate space for table.
3018 * The --full yy_transition table is a special case, since we
3019 * need the dmap.dm_sz entry to tell us the sizeof the individual
3025 if ((td.td_flags & YYTD_STRUCT))
3026 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3028 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3030 if(M4_YY_TABLES_VERIFY)
3031 /* We point to the array itself */
3034 /* We point to the address of a pointer. */
3035 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3038 /* If it's a struct, we read 2 integers to get one element */
3039 if ((td.td_flags & YYTD_STRUCT) != 0)
3040 inner_loop_count = 2;
3042 inner_loop_count = 1;
3044 /* read and map each element.
3045 * This loop iterates once for each element of the td_data array.
3046 * Notice that we increment 'i' in the inner loop.
3048 len = yytbl_calc_total_len (&td);
3049 for (i = 0; i < len; ){
3053 /* This loop really executes exactly 1 or 2 times.
3054 * The second time is to handle the second member of the
3055 * YYTD_STRUCT for the yy_transition array.
3057 for (j = 0; j < inner_loop_count; j++, i++) {
3060 /* read into t32 no matter what the real size is. */
3065 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3066 case sizeof (flex_int32_t):
3067 rv = yytbl_read32 (&t32, rd);
3069 case sizeof (flex_int16_t):
3070 rv = yytbl_read16 (&t16, rd);
3073 case sizeof (flex_int8_t):
3074 rv = yytbl_read8 (&t8, rd);
3078 yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3085 /* copy into the deserialized array... */
3087 if ((td.td_flags & YYTD_STRUCT)) {
3088 /* t32 is the j'th member of a two-element struct. */
3091 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3092 : &(((struct yy_trans_info *) p)->yy_nxt);
3094 switch (dmap->dm_sz) {
3095 case sizeof (flex_int32_t):
3096 if (M4_YY_TABLES_VERIFY){
3097 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3098 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int32_t" M4_YY_CALL_LAST_ARG);
3100 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3102 case sizeof (flex_int16_t):
3103 if (M4_YY_TABLES_VERIFY ){
3104 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3105 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int16_t" M4_YY_CALL_LAST_ARG);
3107 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3109 case sizeof(flex_int8_t):
3110 if (M4_YY_TABLES_VERIFY ){
3111 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3112 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int8_t" M4_YY_CALL_LAST_ARG);
3114 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3117 yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3121 /* if we're done with j, increment p */
3123 p = (struct yy_trans_info *) p + 1;
3125 else if ((td.td_flags & YYTD_PTRANS)) {
3126 /* t32 is an index into the transition array. */
3127 struct yy_trans_info *v;
3131 yy_fatal_error("transition table not found" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3135 if( M4_YY_TABLES_VERIFY)
3136 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3138 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3140 if(M4_YY_TABLES_VERIFY ){
3141 if( ((struct yy_trans_info **) p)[0] != v)
3142 yy_fatal_error("tables verification failed at YYTD_PTRANS" M4_YY_CALL_LAST_ARG);
3144 ((struct yy_trans_info **) p)[0] = v;
3147 p = (struct yy_trans_info **) p + 1;
3150 /* t32 is a plain int. copy data, then incrememnt p. */
3151 switch (dmap->dm_sz) {
3152 case sizeof (flex_int32_t):
3153 if(M4_YY_TABLES_VERIFY ){
3154 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3155 yy_fatal_error("tables verification failed at flex_int32_t" M4_YY_CALL_LAST_ARG);
3157 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3158 p = ((flex_int32_t *) p) + 1;
3160 case sizeof (flex_int16_t):
3161 if(M4_YY_TABLES_VERIFY ){
3162 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3163 yy_fatal_error("tables verification failed at flex_int16_t" M4_YY_CALL_LAST_ARG);
3165 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3166 p = ((flex_int16_t *) p) + 1;
3168 case sizeof (flex_int8_t):
3169 if(M4_YY_TABLES_VERIFY ){
3170 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3171 yy_fatal_error("tables verification failed at flex_int8_t" M4_YY_CALL_LAST_ARG);
3173 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3174 p = ((flex_int8_t *) p) + 1;
3177 yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3185 /* Now eat padding. */
3188 pad = yypad64(rd->bread);
3191 if(yytbl_read8(&t8,rd) != 0)
3199 %define-yytables The name for this specific scanner's tables.
3201 /* Find the key and load the DFA tables from the given stream. */
3202 static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3205 struct yytbl_hdr th;
3206 struct yytbl_reader rd;
3209 th.th_version = NULL;
3211 /* Keep trying until we find the right set of tables or end of file. */
3212 while (!feof(rd.fp)) {
3214 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3219 /* A NULL key means choose the first set of tables. */
3223 if (strcmp(th.th_name,key) != 0){
3224 /* Skip ahead to next set */
3225 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3226 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3227 th.th_version = NULL;
3233 while (rd.bread < th.th_ssize){
3234 /* Load the data tables */
3235 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3243 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3244 th.th_version = NULL;
3250 /** Load the DFA tables for this scanner from the given stream. */
3251 int yytables_fload YYFARGS1(FILE *, fp)
3254 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3259 /** Destroy the loaded tables, freeing memory, etc.. */
3260 int yytables_destroy YYFARGS0(void)
3262 struct yytbl_dmap *dmap=0;
3264 if(!M4_YY_TABLES_VERIFY){
3265 /* Walk the dmap, freeing the pointers */
3266 for(dmap=yydmap; dmap->dm_id; dmap++) {
3269 if(v && *(char**)v){
3270 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3279 /* end table serialization code definitions */
3283 m4_ifdef([[M4_YY_MAIN]], [[
3284 int main M4_YY_PARAMS(void);
3293 yylex_destroy( lexer);
3305 m4_ifdef( [[M4_YY_IN_HEADER]],
3308 #undef YY_FLUSH_BUFFER
3310 #undef yy_new_buffer
3311 #undef yy_set_interactive
3312 #undef YY_DO_BEFORE_ACTION
3314 #ifdef YY_DECL_IS_OURS
3315 #undef YY_DECL_IS_OURS