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: 4%# 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. 8%# 9%# 2. The preprocessed skeleton is translated into a C array, saved 10%# as "skel.c" and compiled into the flex binary. The %# comment 11%# lines are removed. 12%# 13%# 3. At runtime, the skeleton is generated and filtered (again) 14%# through m4. Macros beginning with `m4_' will be processed. 15%# The quoting is "[[" and "]]" so we don't interfere with 16%# user code. 17%# 18%# All generate macros for the m4 stage contain the text "m4" or "M4" 19%# in them. This is to distinguish them from CPP macros. 20%# The exception to this rule is YY_G, which is an m4 macro, 21%# but it needs to be remain short because it is used everywhere. 22%# 23/* A lexical scanner generated by flex */ 24 25%# Macros for preproc stage. 26m4preproc_changecom 27 28%# Macros for runtime processing stage. 29m4_changecom 30m4_changequote 31m4_changequote([[, ]]) 32 33%# 34%# Lines in this skeleton starting with a "%" character are "control lines" 35%# and affect the generation of the scanner. The possible control codes are 36%# listed and processed in misc.c. 37%# 38%# %# - A comment. The current line is omitted from the generated scanner. 39%# %if-c++-only - The following lines are printed for C++ scanners ONLY. 40%# %if-c-only - The following lines are NOT printed for C++ scanners. 41%# %if-c-or-c++ - The following lines are printed in BOTH C and C++ scanners. 42%# %if-reentrant - Print for reentrant scanners.(push) 43%# %if-not-reentrant - Print for non-reentrant scanners. (push) 44%# %if-bison-bridge - Print for bison-bridge. (push) 45%# %if-not-bison-bridge - Print for non-bison-bridge. (push) 46%# %endif - pop from the previous if code. 47%# %% - A stop-point, where code is inserted by flex. 48%# Each stop-point is numbered here and also in the code generator. 49%# (See gen.c, etc. for details.) 50%# %not-for-header - Begin code that should NOT appear in a ".h" file. 51%# %ok-for-header - %c and %e are used for building a header file. 52%# %if-tables-serialization 53%# 54%# All control-lines EXCEPT comment lines ("%#") will be inserted into 55%# the generated scanner as a C-style comment. This is to aid those who 56%# edit the skeleton. 57%# 58 59%not-for-header 60%if-c-only 61%if-not-reentrant 62m4_ifelse(M4_YY_PREFIX,yy,, 63#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]] 64#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]] 65#define yy_scan_buffer M4_YY_PREFIX[[_scan_buffer]] 66#define yy_scan_string M4_YY_PREFIX[[_scan_string]] 67#define yy_scan_bytes M4_YY_PREFIX[[_scan_bytes]] 68#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]] 69#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]] 70#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]] 71#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]] 72#define yypush_buffer_state M4_YY_PREFIX[[push_buffer_state]] 73#define yypop_buffer_state M4_YY_PREFIX[[pop_buffer_state]] 74#define yyensure_buffer_stack M4_YY_PREFIX[[ensure_buffer_stack]] 75#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]] 76#define yyin M4_YY_PREFIX[[in]] 77#define yyleng M4_YY_PREFIX[[leng]] 78#define yylex M4_YY_PREFIX[[lex]] 79#define yylineno M4_YY_PREFIX[[lineno]] 80#define yyout M4_YY_PREFIX[[out]] 81#define yyrestart M4_YY_PREFIX[[restart]] 82#define yytext M4_YY_PREFIX[[text]] 83#define yywrap M4_YY_PREFIX[[wrap]] 84#define yyalloc M4_YY_PREFIX[[alloc]] 85#define yyrealloc M4_YY_PREFIX[[realloc]] 86#define yyfree M4_YY_PREFIX[[free]] 87) 88%endif 89%endif 90%ok-for-header 91 92#define FLEX_SCANNER 93#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION 94#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION 95#define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION 96#if YY_FLEX_SUBMINOR_VERSION > 0 97#define FLEX_BETA 98#endif 99 100%# Some negated symbols 101m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]]) 102m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]]) 103 104%# This is the m4 way to say "(stack_used || is_reentrant) 105m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) 106m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) 107 108%# Prefixes. 109%# The complexity here is necessary so that m4 preserves 110%# the argument lists to each C function. 111 112 113m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]]) 114 115m4preproc_define(`M4_GEN_PREFIX',`` 116[[#ifdef yy$1 117#define ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED 118#else 119#define yy$1 ]]M4_YY_PREFIX[[$1 120#endif]] 121'm4preproc_divert(1)` 122[[#ifndef ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED 123#undef yy$1 124#endif]]'m4preproc_divert(0)') 125 126%if-c++-only 127 /* The c++ scanner is a mess. The FlexLexer.h header file relies on the 128 * following macro. This is required in order to pass the c++-multiple-scanners 129 * test in the regression suite. We get reports that it breaks inheritance. 130 * We will address this in a future release of flex, or omit the C++ scanner 131 * altogether. 132 */ 133 #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]] 134%endif 135 136%if-c-only 137m4_ifelse(M4_YY_PREFIX,yy,, 138 M4_GEN_PREFIX(`_create_buffer') 139 M4_GEN_PREFIX(`_delete_buffer') 140 M4_GEN_PREFIX(`_scan_buffer') 141 M4_GEN_PREFIX(`_scan_string') 142 M4_GEN_PREFIX(`_scan_bytes') 143 M4_GEN_PREFIX(`_init_buffer') 144 M4_GEN_PREFIX(`_flush_buffer') 145 M4_GEN_PREFIX(`_load_buffer_state') 146 M4_GEN_PREFIX(`_switch_to_buffer') 147 M4_GEN_PREFIX(`push_buffer_state') 148 M4_GEN_PREFIX(`pop_buffer_state') 149 M4_GEN_PREFIX(`ensure_buffer_stack') 150 M4_GEN_PREFIX(`lex') 151 M4_GEN_PREFIX(`restart') 152 M4_GEN_PREFIX(`lex_init') 153 M4_GEN_PREFIX(`lex_init_extra') 154 M4_GEN_PREFIX(`lex_destroy') 155 M4_GEN_PREFIX(`get_debug') 156 M4_GEN_PREFIX(`set_debug') 157 M4_GEN_PREFIX(`get_extra') 158 M4_GEN_PREFIX(`set_extra') 159 M4_GEN_PREFIX(`get_in') 160 M4_GEN_PREFIX(`set_in') 161 M4_GEN_PREFIX(`get_out') 162 M4_GEN_PREFIX(`set_out') 163 M4_GEN_PREFIX(`get_leng') 164 M4_GEN_PREFIX(`get_text') 165 M4_GEN_PREFIX(`get_lineno') 166 M4_GEN_PREFIX(`set_lineno') 167 m4_ifdef( [[M4_YY_REENTRANT]], 168 [[ 169 M4_GEN_PREFIX(`get_column') 170 M4_GEN_PREFIX(`set_column') 171 ]]) 172 M4_GEN_PREFIX(`wrap') 173) 174%endif 175 176m4_ifdef( [[M4_YY_BISON_LVAL]], 177[[ 178 M4_GEN_PREFIX(`get_lval') 179 M4_GEN_PREFIX(`set_lval') 180]]) 181 182m4_ifdef( [[<M4_YY_BISON_LLOC>]], 183[[ 184 M4_GEN_PREFIX(`get_lloc') 185 M4_GEN_PREFIX(`set_lloc') 186]]) 187 188 189m4_ifelse(M4_YY_PREFIX,yy,, 190 M4_GEN_PREFIX(`alloc') 191 M4_GEN_PREFIX(`realloc') 192 M4_GEN_PREFIX(`free') 193) 194 195%if-c-only 196m4_ifelse(M4_YY_PREFIX,yy,, 197m4_ifdef( [[M4_YY_NOT_REENTRANT]], 198[[ 199 M4_GEN_PREFIX(`text') 200 M4_GEN_PREFIX(`leng') 201 M4_GEN_PREFIX(`in') 202 M4_GEN_PREFIX(`out') 203 M4_GEN_PREFIX(`_flex_debug') 204 M4_GEN_PREFIX(`lineno') 205]]) 206) 207%endif 208 209 210m4_ifdef( [[M4_YY_TABLES_EXTERNAL]], 211[[ 212 M4_GEN_PREFIX(`tables_fload') 213 M4_GEN_PREFIX(`tables_destroy') 214 M4_GEN_PREFIX(`TABLES_NAME') 215]]) 216 217/* First, we deal with platform-specific or compiler-specific issues. */ 218 219#if defined(__FreeBSD__) 220#include <sys/cdefs.h> 221#else 222#define __dead2 223#endif 224 225/* begin standard C headers. */ 226%if-c-only 227#include <stdio.h> 228#include <string.h> 229#include <errno.h> 230#include <stdlib.h> 231%endif 232 233%if-tables-serialization 234#include <sys/types.h> 235#include <netinet/in.h> 236%endif 237/* end standard C headers. */ 238 239%if-c-or-c++ 240m4preproc_include(`flexint.h') 241%endif 242 243/* begin standard C++ headers. */ 244%if-c++-only 245#include <iostream> 246#include <errno.h> 247#include <cstdlib> 248#include <cstdio> 249#include <cstring> 250/* end standard C++ headers. */ 251%endif 252 253/* TODO: this is always defined, so inline it */ 254#define yyconst const 255 256#if defined(__GNUC__) && __GNUC__ >= 3 257#define yynoreturn __attribute__((__noreturn__)) 258#else 259#define yynoreturn 260#endif 261 262%not-for-header 263/* Returned upon end-of-file. */ 264#define YY_NULL 0 265%ok-for-header 266 267%not-for-header 268/* Promotes a possibly negative, possibly signed char to an 269 * integer in range [0..255] for use as an array index. 270 */ 271#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) 272%ok-for-header 273 274 275 276%if-reentrant 277 278/* An opaque pointer. */ 279#ifndef YY_TYPEDEF_YY_SCANNER_T 280#define YY_TYPEDEF_YY_SCANNER_T 281typedef void* yyscan_t; 282#endif 283 284%# Declare yyguts variable 285m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]]) 286%# Perform a noop access on yyguts to prevent unused variable complains 287m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]]) 288%# For use wherever a Global is accessed or assigned. 289m4_define( [[YY_G]], [[yyg->$1]]) 290 291%# For use in function prototypes to append the additional argument. 292m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]]) 293m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]]) 294 295m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]]) 296m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]]) 297m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]]) 298 299%# For use in function calls to pass the additional argument. 300m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]]) 301m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]]) 302 303%# For use in function documentation to adjust for additional argument. 304m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]]) 305 306/* For convenience, these vars (plus the bison vars far below) 307 are macros in the reentrant scanner. */ 308#define yyin YY_G(yyin_r) 309#define yyout YY_G(yyout_r) 310#define yyextra YY_G(yyextra_r) 311#define yyleng YY_G(yyleng_r) 312#define yytext YY_G(yytext_r) 313#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 314#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 315#define yy_flex_debug YY_G(yy_flex_debug_r) 316 317m4_define( [[M4_YY_INCR_LINENO]], 318[[ 319 do{ yylineno++; 320 yycolumn=0; 321 }while(0) 322]]) 323 324%endif 325 326 327 328%if-not-reentrant 329 330m4_define( [[M4_YY_INCR_LINENO]], 331[[ 332 yylineno++; 333]]) 334 335%# Define these macros to be no-ops. 336m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]]) 337m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]]) 338m4_define( [[YY_G]], [[($1)]]) 339m4_define( [[M4_YY_PROTO_LAST_ARG]]) 340m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]]) 341m4_define( [[M4_YY_DEF_LAST_ARG]]) 342 343m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]]) 344m4_define([[M4_YY_DECL_LAST_ARG]]) 345m4_define([[M4_YY_CALL_LAST_ARG]]) 346m4_define([[M4_YY_CALL_ONLY_ARG]]) 347m4_define( [[M4_YY_DOC_PARAM]], ) 348 349%endif 350 351 352%# Generate C99 function defs. 353m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]]) 354m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]]) 355m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]]) 356 357m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 358[[ 359/* Enter a start condition. This macro really ought to take a parameter, 360 * but we do it the disgusting crufty way forced on us by the ()-less 361 * definition of BEGIN. 362 */ 363#define BEGIN YY_G(yy_start) = 1 + 2 * 364/* Translate the current start state into a value that can be later handed 365 * to BEGIN to return to the state. The YYSTATE alias is for lex 366 * compatibility. 367 */ 368#define YY_START ((YY_G(yy_start) - 1) / 2) 369#define YYSTATE YY_START 370/* Action number for EOF rule of a given start state. */ 371#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 372/* Special action meaning "start processing a new file". */ 373#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG ) 374#define YY_END_OF_BUFFER_CHAR 0 375]]) 376 377/* Size of default input buffer. */ 378#ifndef YY_BUF_SIZE 379#ifdef __ia64__ 380/* On IA-64, the buffer size is 16k, not 8k. 381 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 382 * Ditto for the __ia64__ case accordingly. 383 */ 384#define YY_BUF_SIZE 32768 385#else 386#define YY_BUF_SIZE 16384 387#endif /* __ia64__ */ 388#endif 389 390m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 391[[ 392/* The state buf must be large enough to hold one state per character in the main buffer. 393 */ 394#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 395]]) 396 397 398#ifndef YY_TYPEDEF_YY_BUFFER_STATE 399#define YY_TYPEDEF_YY_BUFFER_STATE 400typedef struct yy_buffer_state *YY_BUFFER_STATE; 401#endif 402 403#ifndef YY_TYPEDEF_YY_SIZE_T 404#define YY_TYPEDEF_YY_SIZE_T 405typedef size_t yy_size_t; 406#endif 407 408%if-not-reentrant 409extern int yyleng; 410%endif 411 412%if-c-only 413%if-not-reentrant 414extern FILE *yyin, *yyout; 415%endif 416%endif 417 418m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 419[[ 420#define EOB_ACT_CONTINUE_SCAN 0 421#define EOB_ACT_END_OF_FILE 1 422#define EOB_ACT_LAST_MATCH 2 423 m4_ifdef( [[M4_YY_USE_LINENO]], 424 [[ 425 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires 426 * access to the local variable yy_act. Since yyless() is a macro, it would break 427 * existing scanners that call yyless() from OUTSIDE yylex. 428 * One obvious solution it to make yy_act a global. I tried that, and saw 429 * a 5% performance hit in a non-yylineno scanner, because yy_act is 430 * normally declared as a register variable-- so it is not worth it. 431 */ 432 #define YY_LESS_LINENO(n) \ 433 do { \ 434 int yyl;\ 435 for ( yyl = n; yyl < yyleng; ++yyl )\ 436 if ( yytext[yyl] == '\n' )\ 437 --yylineno;\ 438 }while(0) 439 #define YY_LINENO_REWIND_TO(dst) \ 440 do {\ 441 const char *p;\ 442 for ( p = yy_cp-1; p >= (dst); --p)\ 443 if ( *p == '\n' )\ 444 --yylineno;\ 445 }while(0) 446 ]], 447 [[ 448 #define YY_LESS_LINENO(n) 449 #define YY_LINENO_REWIND_TO(ptr) 450 ]]) 451/* Return all but the first "n" matched characters back to the input stream. */ 452#define yyless(n) \ 453 do \ 454 { \ 455 /* Undo effects of setting up yytext. */ \ 456 int yyless_macro_arg = (n); \ 457 YY_LESS_LINENO(yyless_macro_arg);\ 458 *yy_cp = YY_G(yy_hold_char); \ 459 YY_RESTORE_YY_MORE_OFFSET \ 460 YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 461 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 462 } \ 463 while ( 0 ) 464#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG ) 465]]) 466 467#ifndef YY_STRUCT_YY_BUFFER_STATE 468#define YY_STRUCT_YY_BUFFER_STATE 469struct yy_buffer_state 470 { 471%if-c-only 472 FILE *yy_input_file; 473%endif 474 475%if-c++-only 476 std::streambuf* yy_input_file; 477%endif 478 479 480 char *yy_ch_buf; /* input buffer */ 481 char *yy_buf_pos; /* current position in input buffer */ 482 483 /* Size of input buffer in bytes, not including room for EOB 484 * characters. 485 */ 486 int yy_buf_size; 487 488 /* Number of characters read into yy_ch_buf, not including EOB 489 * characters. 490 */ 491 int yy_n_chars; 492 493 /* Whether we "own" the buffer - i.e., we know we created it, 494 * and can realloc() it to grow it, and should free() it to 495 * delete it. 496 */ 497 int yy_is_our_buffer; 498 499 /* Whether this is an "interactive" input source; if so, and 500 * if we're using stdio for input, then we want to use getc() 501 * instead of fread(), to make sure we stop fetching input after 502 * each newline. 503 */ 504 int yy_is_interactive; 505 506 /* Whether we're considered to be at the beginning of a line. 507 * If so, '^' rules will be active on the next match, otherwise 508 * not. 509 */ 510 int yy_at_bol; 511 512 int yy_bs_lineno; /**< The line count. */ 513 int yy_bs_column; /**< The column count. */ 514 515 516 /* Whether to try to fill the input buffer when we reach the 517 * end of it. 518 */ 519 int yy_fill_buffer; 520 521 int yy_buffer_status; 522m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 523[[ 524#define YY_BUFFER_NEW 0 525#define YY_BUFFER_NORMAL 1 526 /* When an EOF's been seen but there's still some text to process 527 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 528 * shouldn't try reading from the input source any more. We might 529 * still have a bunch of tokens to match, though, because of 530 * possible backing-up. 531 * 532 * When we actually see the EOF, we change the status to "new" 533 * (via yyrestart()), so that the user can continue scanning by 534 * just pointing yyin at a new input file. 535 */ 536#define YY_BUFFER_EOF_PENDING 2 537]]) 538 }; 539#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 540 541%if-c-only Standard (non-C++) definition 542%not-for-header 543%if-not-reentrant 544 545/* Stack of input buffers. */ 546static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 547static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 548static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ 549%endif 550%ok-for-header 551%endif 552 553m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 554[[ 555/* We provide macros for accessing buffer states in case in the 556 * future we want to put the buffer states in a more general 557 * "scanner state". 558 * 559 * Returns the top of the stack, or NULL. 560 */ 561#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \ 562 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \ 563 : NULL) 564#define yy_current_buffer YY_CURRENT_BUFFER 565/* Same as previous macro, but useful when we know that the buffer stack is not 566 * NULL or when we need an lvalue. For internal use only. 567 */ 568#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] 569]]) 570 571%if-c-only Standard (non-C++) definition 572 573%if-not-reentrant 574%not-for-header 575/* yy_hold_char holds the character lost when yytext is formed. */ 576static char yy_hold_char; 577static int yy_n_chars; /* number of characters read into yy_ch_buf */ 578int yyleng; 579 580/* Points to current character in buffer. */ 581static char *yy_c_buf_p = NULL; 582static int yy_init = 0; /* whether we need to initialize */ 583static int yy_start = 0; /* start state number */ 584 585/* Flag which is used to allow yywrap()'s to do buffer switches 586 * instead of setting up a fresh yyin. A bit of a hack ... 587 */ 588static int yy_did_buffer_switch_on_eof; 589%ok-for-header 590%endif 591 592void yyrestart ( FILE *input_file M4_YY_PROTO_LAST_ARG ); 593void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ); 594YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size M4_YY_PROTO_LAST_ARG ); 595void yy_delete_buffer ( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ); 596void yy_flush_buffer ( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ); 597void yypush_buffer_state ( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ); 598void yypop_buffer_state ( M4_YY_PROTO_ONLY_ARG ); 599 600m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 601[[ 602static void yyensure_buffer_stack ( M4_YY_PROTO_ONLY_ARG ); 603static void yy_load_buffer_state ( M4_YY_PROTO_ONLY_ARG ); 604static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG ); 605#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG) 606]]) 607 608YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG ); 609YY_BUFFER_STATE yy_scan_string ( const char *yy_str M4_YY_PROTO_LAST_ARG ); 610YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len M4_YY_PROTO_LAST_ARG ); 611 612%endif 613 614void *yyalloc ( yy_size_t M4_YY_PROTO_LAST_ARG ); 615void *yyrealloc ( void *, yy_size_t M4_YY_PROTO_LAST_ARG ); 616void yyfree ( void * M4_YY_PROTO_LAST_ARG ); 617 618m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 619[[ 620#define yy_new_buffer yy_create_buffer 621#define yy_set_interactive(is_interactive) \ 622 { \ 623 if ( ! YY_CURRENT_BUFFER ){ \ 624 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \ 625 YY_CURRENT_BUFFER_LVALUE = \ 626 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \ 627 } \ 628 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 629 } 630#define yy_set_bol(at_bol) \ 631 { \ 632 if ( ! YY_CURRENT_BUFFER ){\ 633 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \ 634 YY_CURRENT_BUFFER_LVALUE = \ 635 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \ 636 } \ 637 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 638 } 639#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 640]]) 641 642%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here 643 644m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 645[[ 646%% [1.5] DFA 647]]) 648 649%if-c-only Standard (non-C++) definition 650 651m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 652[[ 653static yy_state_type yy_get_previous_state ( M4_YY_PROTO_ONLY_ARG ); 654static yy_state_type yy_try_NUL_trans ( yy_state_type current_state M4_YY_PROTO_LAST_ARG); 655static int yy_get_next_buffer ( M4_YY_PROTO_ONLY_ARG ); 656static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ) __dead2; 657]]) 658 659%endif 660 661m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 662[[ 663/* Done after the current pattern has been matched and before the 664 * corresponding action - sets up yytext. 665 */ 666#define YY_DO_BEFORE_ACTION \ 667 YY_G(yytext_ptr) = yy_bp; \ 668%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ 669 YY_G(yy_hold_char) = *yy_cp; \ 670 *yy_cp = '\0'; \ 671%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ 672 YY_G(yy_c_buf_p) = yy_cp; 673%% [4.0] data tables for the DFA and the user's section 1 definitions go here 674]]) 675 676m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]]) 677M4_YY_SC_DEFS 678m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]]) 679 680m4_ifdef( [[M4_YY_NO_UNISTD_H]],, 681[[ 682#ifndef YY_NO_UNISTD_H 683/* Special case for "unistd.h", since it is non-ANSI. We include it way 684 * down here because we want the user's section 1 to have been scanned first. 685 * The user has a chance to override it with an option. 686 */ 687%if-c-only 688#include <unistd.h> 689%endif 690%if-c++-only 691#include <unistd.h> 692%endif 693#endif 694]]) 695 696m4_ifdef( [[M4_EXTRA_TYPE_DEFS]], 697[[ 698#define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS 699]], 700[[ 701#ifndef YY_EXTRA_TYPE 702#define YY_EXTRA_TYPE void * 703#endif 704]] 705) 706 707%if-c-only Reentrant structure and macros (non-C++). 708%if-reentrant 709 710m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 711[[ 712/* Holds the entire state of the reentrant scanner. */ 713struct yyguts_t 714 { 715 716 /* User-defined. Not touched by flex. */ 717 YY_EXTRA_TYPE yyextra_r; 718 719 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 720 FILE *yyin_r, *yyout_r; 721 size_t yy_buffer_stack_top; /**< index of top of stack. */ 722 size_t yy_buffer_stack_max; /**< capacity of stack. */ 723 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 724 char yy_hold_char; 725 int yy_n_chars; 726 int yyleng_r; 727 char *yy_c_buf_p; 728 int yy_init; 729 int yy_start; 730 int yy_did_buffer_switch_on_eof; 731 int yy_start_stack_ptr; 732 int yy_start_stack_depth; 733 int *yy_start_stack; 734 yy_state_type yy_last_accepting_state; 735 char* yy_last_accepting_cpos; 736 737 int yylineno_r; 738 int yy_flex_debug_r; 739 740m4_ifdef( [[M4_YY_USES_REJECT]], 741[[ 742 yy_state_type *yy_state_buf; 743 yy_state_type *yy_state_ptr; 744 char *yy_full_match; 745 int yy_lp; 746 747 /* These are only needed for trailing context rules, 748 * but there's no conditional variable for that yet. */ 749 int yy_looking_for_trail_begin; 750 int yy_full_lp; 751 int *yy_full_state; 752]]) 753 754m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], 755[[ 756 char yytext_r[YYLMAX]; 757 char *yytext_ptr; 758 int yy_more_offset; 759 int yy_prev_more_offset; 760]], 761[[ 762 char *yytext_r; 763 int yy_more_flag; 764 int yy_more_len; 765]]) 766 767m4_ifdef( [[M4_YY_BISON_LVAL]], 768[[ 769 YYSTYPE * yylval_r; 770]]) 771 772m4_ifdef( [[<M4_YY_BISON_LLOC>]], 773[[ 774 YYLTYPE * yylloc_r; 775]]) 776 777 }; /* end struct yyguts_t */ 778]]) 779 780 781%if-c-only 782m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 783[[ 784static int yy_init_globals ( M4_YY_PROTO_ONLY_ARG ); 785]]) 786%endif 787 788%if-reentrant 789 790m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 791[[ 792 m4_ifdef( [[M4_YY_BISON_LVAL]], 793 [[ 794 /* This must go here because YYSTYPE and YYLTYPE are included 795 * from bison output in section 1.*/ 796 # define yylval YY_G(yylval_r) 797 ]]) 798 799 m4_ifdef( [[<M4_YY_BISON_LLOC>]], 800 [[ 801 # define yylloc YY_G(yylloc_r) 802 ]]) 803]]) 804 805int yylex_init (yyscan_t* scanner); 806 807int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); 808 809%endif 810 811%endif End reentrant structures and macros. 812 813/* Accessor methods to globals. 814 These are made visible to non-reentrant scanners for convenience. */ 815 816m4_ifdef( [[M4_YY_NO_DESTROY]],, 817[[ 818int yylex_destroy ( M4_YY_PROTO_ONLY_ARG ); 819]]) 820 821m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, 822[[ 823int yyget_debug ( M4_YY_PROTO_ONLY_ARG ); 824]]) 825 826m4_ifdef( [[M4_YY_NO_SET_DEBUG]],, 827[[ 828void yyset_debug ( int debug_flag M4_YY_PROTO_LAST_ARG ); 829]]) 830 831m4_ifdef( [[M4_YY_NO_GET_EXTRA]],, 832[[ 833YY_EXTRA_TYPE yyget_extra ( M4_YY_PROTO_ONLY_ARG ); 834]]) 835 836m4_ifdef( [[M4_YY_NO_SET_EXTRA]],, 837[[ 838void yyset_extra ( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG ); 839]]) 840 841m4_ifdef( [[M4_YY_NO_GET_IN]],, 842[[ 843FILE *yyget_in ( M4_YY_PROTO_ONLY_ARG ); 844]]) 845 846m4_ifdef( [[M4_YY_NO_SET_IN]],, 847[[ 848void yyset_in ( FILE * _in_str M4_YY_PROTO_LAST_ARG ); 849]]) 850 851m4_ifdef( [[M4_YY_NO_GET_OUT]],, 852[[ 853FILE *yyget_out ( M4_YY_PROTO_ONLY_ARG ); 854]]) 855 856m4_ifdef( [[M4_YY_NO_SET_OUT]],, 857[[ 858void yyset_out ( FILE * _out_str M4_YY_PROTO_LAST_ARG ); 859]]) 860 861m4_ifdef( [[M4_YY_NO_GET_LENG]],, 862[[ 863 int yyget_leng ( M4_YY_PROTO_ONLY_ARG ); 864]]) 865 866m4_ifdef( [[M4_YY_NO_GET_TEXT]],, 867[[ 868char *yyget_text ( M4_YY_PROTO_ONLY_ARG ); 869]]) 870 871m4_ifdef( [[M4_YY_NO_GET_LINENO]],, 872[[ 873int yyget_lineno ( M4_YY_PROTO_ONLY_ARG ); 874]]) 875 876m4_ifdef( [[M4_YY_NO_SET_LINENO]],, 877[[ 878void yyset_lineno ( int _line_number M4_YY_PROTO_LAST_ARG ); 879]]) 880 881m4_ifdef( [[M4_YY_REENTRANT]], 882[[ 883m4_ifdef( [[M4_YY_NO_GET_COLUMN]],, 884[[ 885int yyget_column ( M4_YY_PROTO_ONLY_ARG ); 886]]) 887]]) 888 889m4_ifdef( [[M4_YY_REENTRANT]], 890[[ 891m4_ifdef( [[M4_YY_NO_SET_COLUMN]],, 892[[ 893void yyset_column ( int _column_no M4_YY_PROTO_LAST_ARG ); 894]]) 895]]) 896 897%if-bison-bridge 898m4_ifdef( [[M4_YY_NO_GET_LVAL]],, 899[[ 900YYSTYPE * yyget_lval ( M4_YY_PROTO_ONLY_ARG ); 901]]) 902 903void yyset_lval ( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG ); 904 905m4_ifdef( [[<M4_YY_BISON_LLOC>]], 906[[ 907 m4_ifdef( [[M4_YY_NO_GET_LLOC]],, 908 [[ 909 YYLTYPE *yyget_lloc ( M4_YY_PROTO_ONLY_ARG ); 910 ]]) 911 912 m4_ifdef( [[M4_YY_NO_SET_LLOC]],, 913 [[ 914 void yyset_lloc ( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG ); 915 ]]) 916]]) 917%endif 918 919/* Macros after this point can all be overridden by user definitions in 920 * section 1. 921 */ 922 923#ifndef YY_SKIP_YYWRAP 924#ifdef __cplusplus 925extern "C" int yywrap ( M4_YY_PROTO_ONLY_ARG ); 926#else 927extern int yywrap ( M4_YY_PROTO_ONLY_ARG ); 928#endif 929#endif 930 931%not-for-header 932#ifndef YY_NO_UNPUT 933 m4_ifdef( [[M4_YY_NO_UNPUT]],, 934 [[ 935 static void yyunput ( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG); 936 ]]) 937#endif 938%ok-for-header 939%endif 940 941#ifndef yytext_ptr 942static void yy_flex_strncpy ( char *, const char *, int M4_YY_PROTO_LAST_ARG); 943#endif 944 945#ifdef YY_NEED_STRLEN 946static int yy_flex_strlen ( const char * M4_YY_PROTO_LAST_ARG); 947#endif 948 949#ifndef YY_NO_INPUT 950%if-c-only Standard (non-C++) definition 951%not-for-header 952#ifdef __cplusplus 953static int yyinput ( M4_YY_PROTO_ONLY_ARG ); 954#else 955static int input ( M4_YY_PROTO_ONLY_ARG ); 956#endif 957%ok-for-header 958%endif 959#endif 960 961 962%if-c-only 963%# TODO: This is messy. 964m4_ifdef( [[M4_YY_STACK_USED]], 965[[ 966 967m4_ifdef( [[M4_YY_NOT_REENTRANT]], 968[[ 969 m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 970 [[ 971 static int yy_start_stack_ptr = 0; 972 static int yy_start_stack_depth = 0; 973 static int *yy_start_stack = NULL; 974 ]]) 975]]) 976 977m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 978[[ 979 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, 980 [[ 981 static void yy_push_state ( int _new_state M4_YY_PROTO_LAST_ARG); 982 ]]) 983 m4_ifdef( [[M4_YY_NO_POP_STATE]],, 984 [[ 985 static void yy_pop_state ( M4_YY_PROTO_ONLY_ARG ); 986 ]]) 987 m4_ifdef( [[M4_YY_NO_TOP_STATE]],, 988 [[ 989 static int yy_top_state ( M4_YY_PROTO_ONLY_ARG ); 990 ]]) 991]]) 992 993]], 994[[ 995m4_define( [[M4_YY_NO_PUSH_STATE]]) 996m4_define( [[M4_YY_NO_POP_STATE]]) 997m4_define( [[M4_YY_NO_TOP_STATE]]) 998]]) 999%endif 1000 1001/* Amount of stuff to slurp up with each read. */ 1002#ifndef YY_READ_BUF_SIZE 1003#ifdef __ia64__ 1004/* On IA-64, the buffer size is 16k, not 8k */ 1005#define YY_READ_BUF_SIZE 16384 1006#else 1007#define YY_READ_BUF_SIZE 8192 1008#endif /* __ia64__ */ 1009#endif 1010 1011m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1012[[ 1013/* Copy whatever the last rule matched to the standard output. */ 1014#ifndef ECHO 1015%if-c-only Standard (non-C++) definition 1016/* This used to be an fputs(), but since the string might contain NUL's, 1017 * we now use fwrite(). 1018 */ 1019#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) 1020%endif 1021%if-c++-only C++ definition 1022#define ECHO LexerOutput( yytext, yyleng ) 1023%endif 1024#endif 1025]]) 1026 1027m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1028[[ 1029/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 1030 * is returned in "result". 1031 */ 1032#ifndef YY_INPUT 1033#define YY_INPUT(buf,result,max_size) \ 1034%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ 1035\ 1036%if-c++-only C++ definition \ 1037 if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \ 1038 YY_FATAL_ERROR( "input in flex scanner failed" ); 1039%endif 1040 1041#endif 1042]]) 1043 1044m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1045[[ 1046/* No semi-colon after return; correct usage is to write "yyterminate();" - 1047 * we don't want an extra ';' after the "return" because that will cause 1048 * some compilers to complain about unreachable statements. 1049 */ 1050#ifndef yyterminate 1051#define yyterminate() return YY_NULL 1052#endif 1053]]) 1054 1055/* Number of entries by which start-condition stack grows. */ 1056#ifndef YY_START_STACK_INCR 1057#define YY_START_STACK_INCR 25 1058#endif 1059 1060m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1061[[ 1062/* Report a fatal error. */ 1063#ifndef YY_FATAL_ERROR 1064%if-c-only 1065#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG) 1066%endif 1067%if-c++-only 1068#define YY_FATAL_ERROR(msg) LexerError( msg ) 1069%endif 1070#endif 1071]]) 1072 1073%if-tables-serialization structures and prototypes 1074m4preproc_include(`tables_shared.h') 1075 1076/* Load the DFA tables from the given stream. */ 1077int yytables_fload (FILE * fp M4_YY_PROTO_LAST_ARG); 1078 1079/* Unload the tables from memory. */ 1080int yytables_destroy (M4_YY_PROTO_ONLY_ARG); 1081%not-for-header 1082 1083/** Describes a mapping from a serialized table id to its deserialized state in 1084 * this scanner. This is the bridge between our "generic" deserialization code 1085 * and the specifics of this scanner. 1086 */ 1087struct yytbl_dmap { 1088 enum yytbl_id dm_id;/**< table identifier */ 1089 void **dm_arr; /**< address of pointer to store the deserialized table. */ 1090 size_t dm_sz; /**< local sizeof() each element in table. */ 1091}; 1092 1093/** A {0,0,0}-terminated list of structs, forming the map */ 1094static struct yytbl_dmap yydmap[] = 1095{ 1096%tables-yydmap generated elements 1097 {0,0,0} 1098}; 1099 1100/** A tables-reader object to maintain some state in the read. */ 1101struct yytbl_reader { 1102 FILE * fp; /**< input stream */ 1103 flex_uint32_t bread; /**< bytes read since beginning of current tableset */ 1104}; 1105 1106%endif 1107/* end tables serialization structures and prototypes */ 1108 1109%ok-for-header 1110 1111/* Default declaration of generated scanner - a define so the user can 1112 * easily add parameters. 1113 */ 1114#ifndef YY_DECL 1115#define YY_DECL_IS_OURS 1 1116%if-c-only Standard (non-C++) definition 1117 1118 1119m4_define( [[M4_YY_LEX_PROTO]], [[(M4_YY_PROTO_ONLY_ARG)]]) 1120m4_define( [[M4_YY_LEX_DECLARATION]], [[(M4_YY_DEF_ONLY_ARG)]]) 1121 1122m4_ifdef( [[M4_YY_BISON_LVAL]], 1123[[ 1124 m4_dnl The bison pure parser is used. Redefine yylex to 1125 m4_dnl accept the lval parameter. 1126 1127 m4_define( [[M4_YY_LEX_PROTO]], [[\]] 1128 [[(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]]) 1129 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]] 1130 [[YYFARGS1(YYSTYPE *,yylval_param)]]) 1131]]) 1132 1133m4_ifdef( [[<M4_YY_BISON_LLOC>]], 1134[[ 1135 m4_dnl Locations are used. yylex should also accept the ylloc parameter. 1136 1137 m4_define( [[M4_YY_LEX_PROTO]], [[\]] 1138 [[(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]]) 1139 m4_define( [[M4_YY_LEX_DECLARATION]], [[\]] 1140 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]]) 1141]]) 1142 1143extern int yylex M4_YY_LEX_PROTO; 1144 1145#define YY_DECL int yylex M4_YY_LEX_DECLARATION 1146%endif 1147%if-c++-only C++ definition 1148#define YY_DECL int yyFlexLexer::yylex() 1149%endif 1150#endif /* !YY_DECL */ 1151 1152m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1153[[ 1154/* Code executed at the beginning of each rule, after yytext and yyleng 1155 * have been set up. 1156 */ 1157#ifndef YY_USER_ACTION 1158#define YY_USER_ACTION 1159#endif 1160]]) 1161 1162m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1163[[ 1164/* Code executed at the end of each rule. */ 1165#ifndef YY_BREAK 1166#define YY_BREAK /*LINTED*/break; 1167#endif 1168]]) 1169 1170m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1171[[ 1172%% [6.0] YY_RULE_SETUP definition goes here 1173]]) 1174 1175%not-for-header 1176/** The main scanner function which does all the work. 1177 */ 1178YY_DECL 1179{ 1180 yy_state_type yy_current_state; 1181 char *yy_cp, *yy_bp; 1182 int yy_act; 1183 M4_YY_DECL_GUTS_VAR(); 1184 1185m4_ifdef( [[M4_YY_NOT_REENTRANT]], 1186[[ 1187 m4_ifdef( [[M4_YY_BISON_LVAL]], 1188 [[ 1189 YYSTYPE * yylval; 1190 ]]) 1191 m4_ifdef( [[<M4_YY_BISON_LLOC>]], 1192 [[ 1193 YYLTYPE * yylloc; 1194 ]]) 1195]]) 1196 1197m4_ifdef( [[M4_YY_BISON_LVAL]], 1198[[ 1199 yylval = yylval_param; 1200]]) 1201 1202m4_ifdef( [[<M4_YY_BISON_LLOC>]], 1203[[ 1204 yylloc = yylloc_param; 1205]]) 1206 1207 if ( !YY_G(yy_init) ) 1208 { 1209 YY_G(yy_init) = 1; 1210 1211#ifdef YY_USER_INIT 1212 YY_USER_INIT; 1213#endif 1214 1215m4_ifdef( [[M4_YY_USES_REJECT]], 1216[[ 1217 /* Create the reject buffer large enough to save one state per allowed character. */ 1218 if ( ! YY_G(yy_state_buf) ) 1219 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG); 1220 if ( ! YY_G(yy_state_buf) ) 1221 YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); 1222]]) 1223 1224 if ( ! YY_G(yy_start) ) 1225 YY_G(yy_start) = 1; /* first start state */ 1226 1227 if ( ! yyin ) 1228%if-c-only 1229 yyin = stdin; 1230%endif 1231%if-c++-only 1232 yyin.rdbuf(std::cin.rdbuf()); 1233%endif 1234 1235 if ( ! yyout ) 1236%if-c-only 1237 yyout = stdout; 1238%endif 1239%if-c++-only 1240 yyout.rdbuf(std::cout.rdbuf()); 1241%endif 1242 1243 if ( ! YY_CURRENT_BUFFER ) { 1244 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); 1245 YY_CURRENT_BUFFER_LVALUE = 1246 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); 1247 } 1248 1249 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 1250 } 1251 1252 { 1253%% [7.0] user's declarations go here 1254 1255 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ 1256 { 1257%% [8.0] yymore()-related code goes here 1258 yy_cp = YY_G(yy_c_buf_p); 1259 1260 /* Support of yytext. */ 1261 *yy_cp = YY_G(yy_hold_char); 1262 1263 /* yy_bp points to the position in yy_ch_buf of the start of 1264 * the current run. 1265 */ 1266 yy_bp = yy_cp; 1267 1268%% [9.0] code to set up and find next match goes here 1269 1270yy_find_action: 1271%% [10.0] code to find the action number goes here 1272 1273 YY_DO_BEFORE_ACTION; 1274 1275%% [11.0] code for yylineno update goes here 1276 1277do_action: /* This label is used only to access EOF actions. */ 1278 1279%% [12.0] debug code goes here 1280 1281 switch ( yy_act ) 1282 { /* beginning of action switch */ 1283%% [13.0] actions go here 1284 1285 case YY_END_OF_BUFFER: 1286 { 1287 /* Amount of text matched not including the EOB char. */ 1288 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1; 1289 1290 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1291 *yy_cp = YY_G(yy_hold_char); 1292 YY_RESTORE_YY_MORE_OFFSET 1293 1294 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1295 { 1296 /* We're scanning a new file or input source. It's 1297 * possible that this happened because the user 1298 * just pointed yyin at a new source and called 1299 * yylex(). If so, then we have to assure 1300 * consistency between YY_CURRENT_BUFFER and our 1301 * globals. Here is the right place to do so, because 1302 * this is the first action (other than possibly a 1303 * back-up) that will match for the new input source. 1304 */ 1305 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1306%if-c-only 1307 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1308%endif 1309%if-c++-only 1310 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf(); 1311%endif 1312 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1313 } 1314 1315 /* Note that here we test for yy_c_buf_p "<=" to the position 1316 * of the first EOB in the buffer, since yy_c_buf_p will 1317 * already have been incremented past the NUL character 1318 * (since all states make transitions on EOB to the 1319 * end-of-buffer state). Contrast this with the test 1320 * in input(). 1321 */ 1322 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) 1323 { /* This was really a NUL. */ 1324 yy_state_type yy_next_state; 1325 1326 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text; 1327 1328 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); 1329 1330 /* Okay, we're now positioned to make the NUL 1331 * transition. We couldn't have 1332 * yy_get_previous_state() go ahead and do it 1333 * for us because it doesn't know how to deal 1334 * with the possibility of jamming (and we don't 1335 * want to build jamming into it because then it 1336 * will run more slowly). 1337 */ 1338 1339 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG); 1340 1341 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; 1342 1343 if ( yy_next_state ) 1344 { 1345 /* Consume the NUL. */ 1346 yy_cp = ++YY_G(yy_c_buf_p); 1347 yy_current_state = yy_next_state; 1348 goto yy_match; 1349 } 1350 1351 else 1352 { 1353%% [14.0] code to do back-up for compressed tables and set up yy_cp goes here 1354 goto yy_find_action; 1355 } 1356 } 1357 1358 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) 1359 { 1360 case EOB_ACT_END_OF_FILE: 1361 { 1362 YY_G(yy_did_buffer_switch_on_eof) = 0; 1363 1364 if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) 1365 { 1366 /* Note: because we've taken care in 1367 * yy_get_next_buffer() to have set up 1368 * yytext, we can now set up 1369 * yy_c_buf_p so that if some total 1370 * hoser (like flex itself) wants to 1371 * call the scanner after we return the 1372 * YY_NULL, it'll still work - another 1373 * YY_NULL will get returned. 1374 */ 1375 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ; 1376 1377 yy_act = YY_STATE_EOF(YY_START); 1378 goto do_action; 1379 } 1380 1381 else 1382 { 1383 if ( ! YY_G(yy_did_buffer_switch_on_eof) ) 1384 YY_NEW_FILE; 1385 } 1386 break; 1387 } 1388 1389 case EOB_ACT_CONTINUE_SCAN: 1390 YY_G(yy_c_buf_p) = 1391 YY_G(yytext_ptr) + yy_amount_of_matched_text; 1392 1393 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); 1394 1395 yy_cp = YY_G(yy_c_buf_p); 1396 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; 1397 goto yy_match; 1398 1399 case EOB_ACT_LAST_MATCH: 1400 YY_G(yy_c_buf_p) = 1401 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)]; 1402 1403 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); 1404 1405 yy_cp = YY_G(yy_c_buf_p); 1406 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; 1407 goto yy_find_action; 1408 } 1409 break; 1410 } 1411 1412 default: 1413 YY_FATAL_ERROR( 1414 "fatal flex scanner internal error--no action found" ); 1415 } /* end of action switch */ 1416 } /* end of scanning one token */ 1417 } /* end of user's declarations */ 1418} /* end of yylex */ 1419%ok-for-header 1420 1421%if-c++-only 1422%not-for-header 1423/* The contents of this function are C++ specific, so the YY_G macro is not used. 1424 * This constructor simply maintains backward compatibility. 1425 * DEPRECATED 1426 */ 1427yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ): 1428 yyin(arg_yyin ? arg_yyin->rdbuf() : std::cin.rdbuf()), 1429 yyout(arg_yyout ? arg_yyout->rdbuf() : std::cout.rdbuf()) 1430{ 1431 ctor_common(); 1432} 1433 1434/* The contents of this function are C++ specific, so the YY_G macro is not used. 1435 */ 1436yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ): 1437 yyin(arg_yyin.rdbuf()), 1438 yyout(arg_yyout.rdbuf()) 1439{ 1440 ctor_common(); 1441} 1442 1443/* The contents of this function are C++ specific, so the YY_G macro is not used. 1444 */ 1445void yyFlexLexer::ctor_common() 1446{ 1447 yy_c_buf_p = 0; 1448 yy_init = 0; 1449 yy_start = 0; 1450 yy_flex_debug = 0; 1451 yylineno = 1; // this will only get updated if %option yylineno 1452 1453 yy_did_buffer_switch_on_eof = 0; 1454 1455 yy_looking_for_trail_begin = 0; 1456 yy_more_flag = 0; 1457 yy_more_len = 0; 1458 yy_more_offset = yy_prev_more_offset = 0; 1459 1460 yy_start_stack_ptr = yy_start_stack_depth = 0; 1461 yy_start_stack = NULL; 1462 1463 yy_buffer_stack = NULL; 1464 yy_buffer_stack_top = 0; 1465 yy_buffer_stack_max = 0; 1466 1467 1468m4_ifdef( [[M4_YY_USES_REJECT]], 1469[[ 1470 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE]; 1471]], 1472[[ 1473 yy_state_buf = 0; 1474]]) 1475} 1476 1477/* The contents of this function are C++ specific, so the YY_G macro is not used. 1478 */ 1479yyFlexLexer::~yyFlexLexer() 1480{ 1481 delete [] yy_state_buf; 1482 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG ); 1483 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); 1484 yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG ); 1485} 1486 1487/* The contents of this function are C++ specific, so the YY_G macro is not used. 1488 */ 1489void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out ) 1490{ 1491 // was if( new_in ) 1492 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); 1493 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG); 1494 1495 // was if( new_out ) 1496 yyout.rdbuf(new_out.rdbuf()); 1497} 1498 1499/* The contents of this function are C++ specific, so the YY_G macro is not used. 1500 */ 1501void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) 1502{ 1503 if( ! new_in ) { 1504 new_in = &yyin; 1505 } 1506 1507 if ( ! new_out ) { 1508 new_out = &yyout; 1509 } 1510 1511 switch_streams(*new_in, *new_out); 1512} 1513 1514#ifdef YY_INTERACTIVE 1515int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) 1516#else 1517int yyFlexLexer::LexerInput( char* buf, int max_size ) 1518#endif 1519{ 1520 if ( yyin.eof() || yyin.fail() ) 1521 return 0; 1522 1523#ifdef YY_INTERACTIVE 1524 yyin.get( buf[0] ); 1525 1526 if ( yyin.eof() ) 1527 return 0; 1528 1529 if ( yyin.bad() ) 1530 return -1; 1531 1532 return 1; 1533 1534#else 1535 (void) yyin.read( buf, max_size ); 1536 1537 if ( yyin.bad() ) 1538 return -1; 1539 else 1540 return yyin.gcount(); 1541#endif 1542} 1543 1544void yyFlexLexer::LexerOutput( const char* buf, int size ) 1545{ 1546 (void) yyout.write( buf, size ); 1547} 1548%ok-for-header 1549%endif 1550 1551m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 1552[[ 1553/* yy_get_next_buffer - try to read in a new buffer 1554 * 1555 * Returns a code representing an action: 1556 * EOB_ACT_LAST_MATCH - 1557 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1558 * EOB_ACT_END_OF_FILE - end of file 1559 */ 1560%if-c-only 1561static int yy_get_next_buffer (M4_YY_DEF_ONLY_ARG) 1562%endif 1563%if-c++-only 1564int yyFlexLexer::yy_get_next_buffer() 1565%endif 1566{ 1567 M4_YY_DECL_GUTS_VAR(); 1568 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1569 char *source = YY_G(yytext_ptr); 1570 int number_to_move, i; 1571 int ret_val; 1572 1573 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] ) 1574 YY_FATAL_ERROR( 1575 "fatal flex scanner internal error--end of buffer missed" ); 1576 1577 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1578 { /* Don't try to fill the buffer, so this is an EOF. */ 1579 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 ) 1580 { 1581 /* We matched a single character, the EOB, so 1582 * treat this as a final EOF. 1583 */ 1584 return EOB_ACT_END_OF_FILE; 1585 } 1586 1587 else 1588 { 1589 /* We matched some text prior to the EOB, first 1590 * process it. 1591 */ 1592 return EOB_ACT_LAST_MATCH; 1593 } 1594 } 1595 1596 /* Try to read more data. */ 1597 1598 /* First move last chars to start of buffer. */ 1599 number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - 1); 1600 1601 for ( i = 0; i < number_to_move; ++i ) 1602 *(dest++) = *(source++); 1603 1604 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1605 /* don't do the read, it's not guaranteed to return an EOF, 1606 * just force an EOF 1607 */ 1608 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0; 1609 1610 else 1611 { 1612 int num_to_read = 1613 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1614 1615 while ( num_to_read <= 0 ) 1616 { /* Not enough room in the buffer - grow it. */ 1617m4_ifdef( [[M4_YY_USES_REJECT]], 1618[[ 1619 YY_FATAL_ERROR( 1620"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); 1621]], 1622[[ 1623 /* just a shorter name for the current buffer */ 1624 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; 1625 1626 int yy_c_buf_p_offset = 1627 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf); 1628 1629 if ( b->yy_is_our_buffer ) 1630 { 1631 int new_size = b->yy_buf_size * 2; 1632 1633 if ( new_size <= 0 ) 1634 b->yy_buf_size += b->yy_buf_size / 8; 1635 else 1636 b->yy_buf_size *= 2; 1637 1638 b->yy_ch_buf = (char *) 1639 /* Include room in for 2 EOB chars. */ 1640 yyrealloc( (void *) b->yy_ch_buf, 1641 (yy_size_t) (b->yy_buf_size + 2) M4_YY_CALL_LAST_ARG ); 1642 } 1643 else 1644 /* Can't grow it, we don't own it. */ 1645 b->yy_ch_buf = NULL; 1646 1647 if ( ! b->yy_ch_buf ) 1648 YY_FATAL_ERROR( 1649 "fatal error - scanner input buffer overflow" ); 1650 1651 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1652 1653 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1654 number_to_move - 1; 1655]]) 1656 } 1657 1658 if ( num_to_read > YY_READ_BUF_SIZE ) 1659 num_to_read = YY_READ_BUF_SIZE; 1660 1661 /* Read in more data. */ 1662 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1663 YY_G(yy_n_chars), num_to_read ); 1664 1665 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); 1666 } 1667 1668 if ( YY_G(yy_n_chars) == 0 ) 1669 { 1670 if ( number_to_move == YY_MORE_ADJ ) 1671 { 1672 ret_val = EOB_ACT_END_OF_FILE; 1673 yyrestart( yyin M4_YY_CALL_LAST_ARG); 1674 } 1675 1676 else 1677 { 1678 ret_val = EOB_ACT_LAST_MATCH; 1679 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1680 YY_BUFFER_EOF_PENDING; 1681 } 1682 } 1683 1684 else 1685 ret_val = EOB_ACT_CONTINUE_SCAN; 1686 1687 if ((YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1688 /* Extend the array by 50%, plus the number we really need. */ 1689 int new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1); 1690 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( 1691 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size M4_YY_CALL_LAST_ARG ); 1692 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1693 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1694 /* "- 2" to take care of EOB's */ 1695 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); 1696 } 1697 1698 YY_G(yy_n_chars) += number_to_move; 1699 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1700 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1701 1702 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1703 1704 return ret_val; 1705} 1706]]) 1707 1708/* yy_get_previous_state - get the state just before the EOB char was reached */ 1709 1710%if-c-only 1711%not-for-header 1712 static yy_state_type yy_get_previous_state (M4_YY_DEF_ONLY_ARG) 1713%endif 1714%if-c++-only 1715 yy_state_type yyFlexLexer::yy_get_previous_state() 1716%endif 1717{ 1718 yy_state_type yy_current_state; 1719 char *yy_cp; 1720 M4_YY_DECL_GUTS_VAR(); 1721 1722%% [15.0] code to get the start state into yy_current_state goes here 1723 1724 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp ) 1725 { 1726%% [16.0] code to find the next state goes here 1727 } 1728 1729 return yy_current_state; 1730} 1731 1732 1733/* yy_try_NUL_trans - try to make a transition on the NUL character 1734 * 1735 * synopsis 1736 * next_state = yy_try_NUL_trans( current_state ); 1737 */ 1738%if-c-only 1739 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state) 1740%endif 1741%if-c++-only 1742 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) 1743%endif 1744{ 1745 int yy_is_jam; 1746 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */ 1747%% [17.0] code to find the next state, and perhaps do backing up, goes here 1748 1749 M4_YY_NOOP_GUTS_VAR(); 1750 return yy_is_jam ? 0 : yy_current_state; 1751} 1752 1753 1754#ifndef YY_NO_UNPUT 1755%if-c-only 1756m4_ifdef( [[M4_YY_NO_UNPUT]],, 1757[[ 1758 static void yyunput YYFARGS2( int,c, char *,yy_bp) 1759%endif 1760%if-c++-only 1761 void yyFlexLexer::yyunput( int c, char* yy_bp) 1762%endif 1763{ 1764 char *yy_cp; 1765 M4_YY_DECL_GUTS_VAR(); 1766 1767 yy_cp = YY_G(yy_c_buf_p); 1768 1769 /* undo effects of setting up yytext */ 1770 *yy_cp = YY_G(yy_hold_char); 1771 1772 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1773 { /* need to shift things up to make room */ 1774 /* +2 for EOB chars. */ 1775 int number_to_move = YY_G(yy_n_chars) + 2; 1776 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 1777 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 1778 char *source = 1779 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 1780 1781 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1782 *--dest = *--source; 1783 1784 yy_cp += (int) (dest - source); 1785 yy_bp += (int) (dest - source); 1786 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 1787 YY_G(yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 1788 1789 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1790 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 1791 } 1792 1793 *--yy_cp = (char) c; 1794 1795%% [18.0] update yylineno here 1796m4_ifdef( [[M4_YY_USE_LINENO]], 1797[[ 1798 if ( c == '\n' ){ 1799 --yylineno; 1800 } 1801]]) 1802 1803 YY_G(yytext_ptr) = yy_bp; 1804 YY_G(yy_hold_char) = *yy_cp; 1805 YY_G(yy_c_buf_p) = yy_cp; 1806} 1807%if-c-only 1808]]) 1809%endif 1810#endif 1811 1812%if-c-only 1813#ifndef YY_NO_INPUT 1814#ifdef __cplusplus 1815 static int yyinput (M4_YY_DEF_ONLY_ARG) 1816#else 1817 static int input (M4_YY_DEF_ONLY_ARG) 1818#endif 1819 1820%endif 1821%if-c++-only 1822 int yyFlexLexer::yyinput() 1823%endif 1824{ 1825 int c; 1826 M4_YY_DECL_GUTS_VAR(); 1827 1828 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); 1829 1830 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1831 { 1832 /* yy_c_buf_p now points to the character we want to return. 1833 * If this occurs *before* the EOB characters, then it's a 1834 * valid NUL; if not, then we've hit the end of the buffer. 1835 */ 1836 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) 1837 /* This was really a NUL. */ 1838 *YY_G(yy_c_buf_p) = '\0'; 1839 1840 else 1841 { /* need more input */ 1842 int offset = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)); 1843 ++YY_G(yy_c_buf_p); 1844 1845 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) 1846 { 1847 case EOB_ACT_LAST_MATCH: 1848 /* This happens because yy_g_n_b() 1849 * sees that we've accumulated a 1850 * token and flags that we need to 1851 * try matching the token before 1852 * proceeding. But for input(), 1853 * there's no matching to consider. 1854 * So convert the EOB_ACT_LAST_MATCH 1855 * to EOB_ACT_END_OF_FILE. 1856 */ 1857 1858 /* Reset buffer status. */ 1859 yyrestart( yyin M4_YY_CALL_LAST_ARG); 1860 1861 /*FALLTHROUGH*/ 1862 1863 case EOB_ACT_END_OF_FILE: 1864 { 1865 if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) 1866 return 0; 1867 1868 if ( ! YY_G(yy_did_buffer_switch_on_eof) ) 1869 YY_NEW_FILE; 1870#ifdef __cplusplus 1871 return yyinput(M4_YY_CALL_ONLY_ARG); 1872#else 1873 return input(M4_YY_CALL_ONLY_ARG); 1874#endif 1875 } 1876 1877 case EOB_ACT_CONTINUE_SCAN: 1878 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset; 1879 break; 1880 } 1881 } 1882 } 1883 1884 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */ 1885 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */ 1886 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p); 1887 1888%% [19.0] update BOL and yylineno 1889 1890 return c; 1891} 1892%if-c-only 1893#endif /* ifndef YY_NO_INPUT */ 1894%endif 1895 1896/** Immediately switch to a different input stream. 1897 * @param input_file A readable stream. 1898 * M4_YY_DOC_PARAM 1899 * @note This function does not reset the start condition to @c INITIAL . 1900 */ 1901%if-c-only 1902 void yyrestart YYFARGS1( FILE *,input_file) 1903%endif 1904%if-c++-only 1905 void yyFlexLexer::yyrestart( std::istream& input_file ) 1906%endif 1907{ 1908 M4_YY_DECL_GUTS_VAR(); 1909 1910 if ( ! YY_CURRENT_BUFFER ){ 1911 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); 1912 YY_CURRENT_BUFFER_LVALUE = 1913 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); 1914 } 1915 1916 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG); 1917 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 1918} 1919 1920%if-c++-only 1921/** Delegate to the new version that takes an istream reference. 1922 * @param input_file A readable stream. 1923 * M4_YY_DOC_PARAM 1924 * @note This function does not reset the start condition to @c INITIAL . 1925 */ 1926void yyFlexLexer::yyrestart( std::istream* input_file ) 1927{ 1928 if( ! input_file ) { 1929 input_file = &yyin; 1930 } 1931 yyrestart( *input_file ); 1932} 1933%endif 1934 1935/** Switch to a different input buffer. 1936 * @param new_buffer The new input buffer. 1937 * M4_YY_DOC_PARAM 1938 */ 1939%if-c-only 1940 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) 1941%endif 1942%if-c++-only 1943 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) 1944%endif 1945{ 1946 M4_YY_DECL_GUTS_VAR(); 1947 1948 /* TODO. We should be able to replace this entire function body 1949 * with 1950 * yypop_buffer_state(); 1951 * yypush_buffer_state(new_buffer); 1952 */ 1953 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); 1954 if ( YY_CURRENT_BUFFER == new_buffer ) 1955 return; 1956 1957 if ( YY_CURRENT_BUFFER ) 1958 { 1959 /* Flush out information for old buffer. */ 1960 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); 1961 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); 1962 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); 1963 } 1964 1965 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1966 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 1967 1968 /* We don't actually know whether we did this switch during 1969 * EOF (yywrap()) processing, but the only time this flag 1970 * is looked at is after yywrap() is called, so it's safe 1971 * to go ahead and always set it. 1972 */ 1973 YY_G(yy_did_buffer_switch_on_eof) = 1; 1974} 1975 1976 1977%if-c-only 1978static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) 1979%endif 1980%if-c++-only 1981 void yyFlexLexer::yy_load_buffer_state() 1982%endif 1983{ 1984 M4_YY_DECL_GUTS_VAR(); 1985 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1986 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1987%if-c-only 1988 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1989%endif 1990%if-c++-only 1991 yyin.rdbuf(YY_CURRENT_BUFFER_LVALUE->yy_input_file); 1992%endif 1993 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); 1994} 1995 1996/** Allocate and initialize an input buffer state. 1997 * @param file A readable stream. 1998 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1999 * M4_YY_DOC_PARAM 2000 * @return the allocated buffer state. 2001 */ 2002%if-c-only 2003 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size) 2004%endif 2005%if-c++-only 2006 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size ) 2007%endif 2008{ 2009 YY_BUFFER_STATE b; 2010 m4_dnl M4_YY_DECL_GUTS_VAR(); 2011 2012 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG ); 2013 if ( ! b ) 2014 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2015 2016 b->yy_buf_size = size; 2017 2018 /* yy_ch_buf has to be 2 characters longer than the size given because 2019 * we need to put in 2 end-of-buffer characters. 2020 */ 2021 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) M4_YY_CALL_LAST_ARG ); 2022 if ( ! b->yy_ch_buf ) 2023 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2024 2025 b->yy_is_our_buffer = 1; 2026 2027 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG); 2028 2029 return b; 2030} 2031 2032%if-c++-only 2033/** Delegate creation of buffers to the new version that takes an istream reference. 2034 * @param file A readable stream. 2035 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2036 * M4_YY_DOC_PARAM 2037 * @return the allocated buffer state. 2038 */ 2039 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) 2040{ 2041 return yy_create_buffer( *file, size ); 2042} 2043%endif 2044 2045/** Destroy the buffer. 2046 * @param b a buffer created with yy_create_buffer() 2047 * M4_YY_DOC_PARAM 2048 */ 2049%if-c-only 2050 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b) 2051%endif 2052%if-c++-only 2053 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) 2054%endif 2055{ 2056 M4_YY_DECL_GUTS_VAR(); 2057 2058 if ( ! b ) 2059 return; 2060 2061 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 2062 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 2063 2064 if ( b->yy_is_our_buffer ) 2065 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG ); 2066 2067 yyfree( (void *) b M4_YY_CALL_LAST_ARG ); 2068} 2069 2070 2071/* Initializes or reinitializes a buffer. 2072 * This function is sometimes called more than once on the same buffer, 2073 * such as during a yyrestart() or at EOF. 2074 */ 2075%if-c-only 2076 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file) 2077%endif 2078%if-c++-only 2079 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file ) 2080%endif 2081 2082{ 2083 int oerrno = errno; 2084 M4_YY_DECL_GUTS_VAR(); 2085 2086 yy_flush_buffer( b M4_YY_CALL_LAST_ARG); 2087 2088%if-c-only 2089 b->yy_input_file = file; 2090%endif 2091%if-c++-only 2092 b->yy_input_file = file.rdbuf(); 2093%endif 2094 b->yy_fill_buffer = 1; 2095 2096 /* If b is the current buffer, then yy_init_buffer was _probably_ 2097 * called from yyrestart() or through yy_get_next_buffer. 2098 * In that case, we don't want to reset the lineno or column. 2099 */ 2100 if (b != YY_CURRENT_BUFFER){ 2101 b->yy_bs_lineno = 1; 2102 b->yy_bs_column = 0; 2103 } 2104 2105%if-c-only 2106m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], 2107[[ 2108 b->yy_is_interactive = 1; 2109]], 2110[[ 2111 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]], 2112 [[ 2113 b->yy_is_interactive = 0; 2114 ]], 2115 [[ 2116 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 2117 ]]) 2118]]) 2119%endif 2120%if-c++-only 2121 b->yy_is_interactive = 0; 2122%endif 2123 errno = oerrno; 2124} 2125 2126/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 2127 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 2128 * M4_YY_DOC_PARAM 2129 */ 2130%if-c-only 2131 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b) 2132%endif 2133%if-c++-only 2134 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) 2135%endif 2136{ 2137 M4_YY_DECL_GUTS_VAR(); 2138 if ( ! b ) 2139 return; 2140 2141 b->yy_n_chars = 0; 2142 2143 /* We always need two end-of-buffer characters. The first causes 2144 * a transition to the end-of-buffer state. The second causes 2145 * a jam in that state. 2146 */ 2147 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 2148 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 2149 2150 b->yy_buf_pos = &b->yy_ch_buf[0]; 2151 2152 b->yy_at_bol = 1; 2153 b->yy_buffer_status = YY_BUFFER_NEW; 2154 2155 if ( b == YY_CURRENT_BUFFER ) 2156 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 2157} 2158 2159%if-c-or-c++ 2160/** Pushes the new state onto the stack. The new state becomes 2161 * the current state. This function will allocate the stack 2162 * if necessary. 2163 * @param new_buffer The new state. 2164 * M4_YY_DOC_PARAM 2165 */ 2166%if-c-only 2167void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer) 2168%endif 2169%if-c++-only 2170void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) 2171%endif 2172{ 2173 M4_YY_DECL_GUTS_VAR(); 2174 if (new_buffer == NULL) 2175 return; 2176 2177 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG); 2178 2179 /* This block is copied from yy_switch_to_buffer. */ 2180 if ( YY_CURRENT_BUFFER ) 2181 { 2182 /* Flush out information for old buffer. */ 2183 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); 2184 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); 2185 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); 2186 } 2187 2188 /* Only push if top exists. Otherwise, replace top. */ 2189 if (YY_CURRENT_BUFFER) 2190 YY_G(yy_buffer_stack_top)++; 2191 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2192 2193 /* copied from yy_switch_to_buffer. */ 2194 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 2195 YY_G(yy_did_buffer_switch_on_eof) = 1; 2196} 2197%endif 2198 2199 2200%if-c-or-c++ 2201/** Removes and deletes the top of the stack, if present. 2202 * The next element becomes the new top. 2203 * M4_YY_DOC_PARAM 2204 */ 2205%if-c-only 2206void yypop_buffer_state (M4_YY_DEF_ONLY_ARG) 2207%endif 2208%if-c++-only 2209void yyFlexLexer::yypop_buffer_state (void) 2210%endif 2211{ 2212 M4_YY_DECL_GUTS_VAR(); 2213 if (!YY_CURRENT_BUFFER) 2214 return; 2215 2216 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); 2217 YY_CURRENT_BUFFER_LVALUE = NULL; 2218 if (YY_G(yy_buffer_stack_top) > 0) 2219 --YY_G(yy_buffer_stack_top); 2220 2221 if (YY_CURRENT_BUFFER) { 2222 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 2223 YY_G(yy_did_buffer_switch_on_eof) = 1; 2224 } 2225} 2226%endif 2227 2228 2229%if-c-or-c++ 2230/* Allocates the stack if it does not exist. 2231 * Guarantees space for at least one push. 2232 */ 2233%if-c-only 2234static void yyensure_buffer_stack (M4_YY_DEF_ONLY_ARG) 2235%endif 2236%if-c++-only 2237void yyFlexLexer::yyensure_buffer_stack(void) 2238%endif 2239{ 2240 yy_size_t num_to_alloc; 2241 M4_YY_DECL_GUTS_VAR(); 2242 2243 if (!YY_G(yy_buffer_stack)) { 2244 2245 /* First allocation is just for 2 elements, since we don't know if this 2246 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2247 * immediate realloc on the next call. 2248 */ 2249 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ 2250 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 2251 (num_to_alloc * sizeof(struct yy_buffer_state*) 2252 M4_YY_CALL_LAST_ARG); 2253 if ( ! YY_G(yy_buffer_stack) ) 2254 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2255 2256 2257 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2258 2259 YY_G(yy_buffer_stack_max) = num_to_alloc; 2260 YY_G(yy_buffer_stack_top) = 0; 2261 return; 2262 } 2263 2264 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){ 2265 2266 /* Increase the buffer to prepare for a possible push. */ 2267 yy_size_t grow_size = 8 /* arbitrary grow size */; 2268 2269 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size; 2270 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 2271 (YY_G(yy_buffer_stack), 2272 num_to_alloc * sizeof(struct yy_buffer_state*) 2273 M4_YY_CALL_LAST_ARG); 2274 if ( ! YY_G(yy_buffer_stack) ) 2275 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2276 2277 /* zero only the new slots.*/ 2278 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 2279 YY_G(yy_buffer_stack_max) = num_to_alloc; 2280 } 2281} 2282%endif 2283 2284 2285 2286 2287m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],, 2288[[ 2289%if-c-only 2290/** Setup the input buffer state to scan directly from a user-specified character buffer. 2291 * @param base the character buffer 2292 * @param size the size in bytes of the character buffer 2293 * M4_YY_DOC_PARAM 2294 * @return the newly allocated buffer state object. 2295 */ 2296YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size) 2297{ 2298 YY_BUFFER_STATE b; 2299 m4_dnl M4_YY_DECL_GUTS_VAR(); 2300 2301 if ( size < 2 || 2302 base[size-2] != YY_END_OF_BUFFER_CHAR || 2303 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2304 /* They forgot to leave room for the EOB's. */ 2305 return NULL; 2306 2307 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG ); 2308 if ( ! b ) 2309 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 2310 2311 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ 2312 b->yy_buf_pos = b->yy_ch_buf = base; 2313 b->yy_is_our_buffer = 0; 2314 b->yy_input_file = NULL; 2315 b->yy_n_chars = b->yy_buf_size; 2316 b->yy_is_interactive = 0; 2317 b->yy_at_bol = 1; 2318 b->yy_fill_buffer = 0; 2319 b->yy_buffer_status = YY_BUFFER_NEW; 2320 2321 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG ); 2322 2323 return b; 2324} 2325%endif 2326]]) 2327 2328 2329m4_ifdef( [[M4_YY_NO_SCAN_STRING]],, 2330[[ 2331%if-c-only 2332/** Setup the input buffer state to scan a string. The next call to yylex() will 2333 * scan from a @e copy of @a str. 2334 * @param yystr a NUL-terminated string to scan 2335 * M4_YY_DOC_PARAM 2336 * @return the newly allocated buffer state object. 2337 * @note If you want to scan bytes that may contain NUL values, then use 2338 * yy_scan_bytes() instead. 2339 */ 2340YY_BUFFER_STATE yy_scan_string YYFARGS1( const char *, yystr) 2341{ 2342 m4_dnl M4_YY_DECL_GUTS_VAR(); 2343 2344 return yy_scan_bytes( yystr, (int) strlen(yystr) M4_YY_CALL_LAST_ARG); 2345} 2346%endif 2347]]) 2348 2349 2350m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],, 2351[[ 2352%if-c-only 2353/** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2354 * scan from a @e copy of @a bytes. 2355 * @param yybytes the byte buffer to scan 2356 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2357 * M4_YY_DOC_PARAM 2358 * @return the newly allocated buffer state object. 2359 */ 2360YY_BUFFER_STATE yy_scan_bytes YYFARGS2( const char *,yybytes, int ,_yybytes_len) 2361{ 2362 YY_BUFFER_STATE b; 2363 char *buf; 2364 yy_size_t n; 2365 int i; 2366 m4_dnl M4_YY_DECL_GUTS_VAR(); 2367 2368 /* Get memory for full buffer, including space for trailing EOB's. */ 2369 n = (yy_size_t) (_yybytes_len + 2); 2370 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG ); 2371 if ( ! buf ) 2372 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 2373 2374 for ( i = 0; i < _yybytes_len; ++i ) 2375 buf[i] = yybytes[i]; 2376 2377 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2378 2379 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG); 2380 if ( ! b ) 2381 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 2382 2383 /* It's okay to grow etc. this buffer, and we should throw it 2384 * away when we're done. 2385 */ 2386 b->yy_is_our_buffer = 1; 2387 2388 return b; 2389} 2390%endif 2391]]) 2392 2393 2394m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, 2395[[ 2396%if-c-only 2397 static void yy_push_state YYFARGS1( int ,_new_state) 2398%endif 2399%if-c++-only 2400 void yyFlexLexer::yy_push_state( int _new_state ) 2401%endif 2402{ 2403 M4_YY_DECL_GUTS_VAR(); 2404 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) ) 2405 { 2406 yy_size_t new_size; 2407 2408 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR; 2409 new_size = (yy_size_t) YY_G(yy_start_stack_depth) * sizeof( int ); 2410 2411 if ( ! YY_G(yy_start_stack) ) 2412 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG ); 2413 2414 else 2415 YY_G(yy_start_stack) = (int *) yyrealloc( 2416 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG ); 2417 2418 if ( ! YY_G(yy_start_stack) ) 2419 YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); 2420 } 2421 2422 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START; 2423 2424 BEGIN(_new_state); 2425} 2426]]) 2427 2428 2429m4_ifdef( [[M4_YY_NO_POP_STATE]],, 2430[[ 2431%if-c-only 2432 static void yy_pop_state (M4_YY_DEF_ONLY_ARG) 2433%endif 2434%if-c++-only 2435 void yyFlexLexer::yy_pop_state() 2436%endif 2437{ 2438 M4_YY_DECL_GUTS_VAR(); 2439 if ( --YY_G(yy_start_stack_ptr) < 0 ) 2440 YY_FATAL_ERROR( "start-condition stack underflow" ); 2441 2442 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]); 2443} 2444]]) 2445 2446 2447m4_ifdef( [[M4_YY_NO_TOP_STATE]],, 2448[[ 2449%if-c-only 2450 static int yy_top_state (M4_YY_DEF_ONLY_ARG) 2451%endif 2452%if-c++-only 2453 int yyFlexLexer::yy_top_state() 2454%endif 2455{ 2456 M4_YY_DECL_GUTS_VAR(); 2457 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1]; 2458} 2459]]) 2460 2461#ifndef YY_EXIT_FAILURE 2462#define YY_EXIT_FAILURE 2 2463#endif 2464 2465%if-c-only 2466static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) 2467{ 2468 M4_YY_DECL_GUTS_VAR(); 2469 M4_YY_NOOP_GUTS_VAR(); 2470 fprintf( stderr, "%s\n", msg ); 2471 exit( YY_EXIT_FAILURE ); 2472} 2473%endif 2474%if-c++-only 2475void yyFlexLexer::LexerError( const char* msg ) 2476{ 2477 M4_YY_DECL_GUTS_VAR(); 2478 std::cerr << msg << std::endl; 2479 exit( YY_EXIT_FAILURE ); 2480} 2481%endif 2482 2483/* Redefine yyless() so it works in section 3 code. */ 2484 2485#undef yyless 2486#define yyless(n) \ 2487 do \ 2488 { \ 2489 /* Undo effects of setting up yytext. */ \ 2490 int yyless_macro_arg = (n); \ 2491 YY_LESS_LINENO(yyless_macro_arg);\ 2492 yytext[yyleng] = YY_G(yy_hold_char); \ 2493 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \ 2494 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \ 2495 *YY_G(yy_c_buf_p) = '\0'; \ 2496 yyleng = yyless_macro_arg; \ 2497 } \ 2498 while ( 0 ) 2499 2500 2501 2502/* Accessor methods (get/set functions) to struct members. */ 2503 2504%if-c-only 2505%if-reentrant 2506m4_ifdef( [[M4_YY_NO_GET_EXTRA]],, 2507[[ 2508/** Get the user-defined data for this scanner. 2509 * M4_YY_DOC_PARAM 2510 */ 2511YY_EXTRA_TYPE yyget_extra (M4_YY_DEF_ONLY_ARG) 2512{ 2513 M4_YY_DECL_GUTS_VAR(); 2514 return yyextra; 2515} 2516]]) 2517%endif 2518 2519m4_ifdef( [[M4_YY_NO_GET_LINENO]],, 2520[[ 2521/** Get the current line number. 2522 * M4_YY_DOC_PARAM 2523 */ 2524int yyget_lineno (M4_YY_DEF_ONLY_ARG) 2525{ 2526 M4_YY_DECL_GUTS_VAR(); 2527 2528 m4_ifdef( [[M4_YY_REENTRANT]], 2529 [[ 2530 if (! YY_CURRENT_BUFFER) 2531 return 0; 2532 ]]) 2533 return yylineno; 2534} 2535]]) 2536 2537m4_ifdef( [[M4_YY_REENTRANT]], 2538[[ 2539m4_ifdef( [[M4_YY_NO_GET_COLUMN]],, 2540[[ 2541/** Get the current column number. 2542 * M4_YY_DOC_PARAM 2543 */ 2544int yyget_column (M4_YY_DEF_ONLY_ARG) 2545{ 2546 M4_YY_DECL_GUTS_VAR(); 2547 2548 m4_ifdef( [[M4_YY_REENTRANT]], 2549 [[ 2550 if (! YY_CURRENT_BUFFER) 2551 return 0; 2552 ]]) 2553 return yycolumn; 2554} 2555]]) 2556]]) 2557 2558m4_ifdef( [[M4_YY_NO_GET_IN]],, 2559[[ 2560/** Get the input stream. 2561 * M4_YY_DOC_PARAM 2562 */ 2563FILE *yyget_in (M4_YY_DEF_ONLY_ARG) 2564{ 2565 M4_YY_DECL_GUTS_VAR(); 2566 return yyin; 2567} 2568]]) 2569 2570m4_ifdef( [[M4_YY_NO_GET_OUT]],, 2571[[ 2572/** Get the output stream. 2573 * M4_YY_DOC_PARAM 2574 */ 2575FILE *yyget_out (M4_YY_DEF_ONLY_ARG) 2576{ 2577 M4_YY_DECL_GUTS_VAR(); 2578 return yyout; 2579} 2580]]) 2581 2582m4_ifdef( [[M4_YY_NO_GET_LENG]],, 2583[[ 2584/** Get the length of the current token. 2585 * M4_YY_DOC_PARAM 2586 */ 2587int yyget_leng (M4_YY_DEF_ONLY_ARG) 2588{ 2589 M4_YY_DECL_GUTS_VAR(); 2590 return yyleng; 2591} 2592]]) 2593 2594/** Get the current token. 2595 * M4_YY_DOC_PARAM 2596 */ 2597m4_ifdef( [[M4_YY_NO_GET_TEXT]],, 2598[[ 2599char *yyget_text (M4_YY_DEF_ONLY_ARG) 2600{ 2601 M4_YY_DECL_GUTS_VAR(); 2602 return yytext; 2603} 2604]]) 2605 2606%if-reentrant 2607m4_ifdef( [[M4_YY_NO_SET_EXTRA]],, 2608[[ 2609/** Set the user-defined data. This data is never touched by the scanner. 2610 * @param user_defined The data to be associated with this scanner. 2611 * M4_YY_DOC_PARAM 2612 */ 2613void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined) 2614{ 2615 M4_YY_DECL_GUTS_VAR(); 2616 yyextra = user_defined ; 2617} 2618]]) 2619%endif 2620 2621m4_ifdef( [[M4_YY_NO_SET_LINENO]],, 2622[[ 2623/** Set the current line number. 2624 * @param _line_number line number 2625 * M4_YY_DOC_PARAM 2626 */ 2627void yyset_lineno YYFARGS1( int ,_line_number) 2628{ 2629 M4_YY_DECL_GUTS_VAR(); 2630 2631 m4_ifdef( [[M4_YY_REENTRANT]], 2632 [[ 2633 /* lineno is only valid if an input buffer exists. */ 2634 if (! YY_CURRENT_BUFFER ) 2635 YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); 2636 ]]) 2637 yylineno = _line_number; 2638} 2639]]) 2640 2641m4_ifdef( [[M4_YY_REENTRANT]], 2642[[ 2643m4_ifdef( [[M4_YY_NO_SET_COLUMN]],, 2644[[ 2645/** Set the current column. 2646 * @param _column_no column number 2647 * M4_YY_DOC_PARAM 2648 */ 2649void yyset_column YYFARGS1( int , _column_no) 2650{ 2651 M4_YY_DECL_GUTS_VAR(); 2652 2653 m4_ifdef( [[M4_YY_REENTRANT]], 2654 [[ 2655 /* column is only valid if an input buffer exists. */ 2656 if (! YY_CURRENT_BUFFER ) 2657 YY_FATAL_ERROR( "yyset_column called with no buffer" ); 2658 ]]) 2659 yycolumn = _column_no; 2660} 2661]]) 2662]]) 2663 2664 2665m4_ifdef( [[M4_YY_NO_SET_IN]],, 2666[[ 2667/** Set the input stream. This does not discard the current 2668 * input buffer. 2669 * @param _in_str A readable stream. 2670 * M4_YY_DOC_PARAM 2671 * @see yy_switch_to_buffer 2672 */ 2673void yyset_in YYFARGS1( FILE * ,_in_str) 2674{ 2675 M4_YY_DECL_GUTS_VAR(); 2676 yyin = _in_str ; 2677} 2678]]) 2679 2680m4_ifdef( [[M4_YY_NO_SET_OUT]],, 2681[[ 2682void yyset_out YYFARGS1( FILE * ,_out_str) 2683{ 2684 M4_YY_DECL_GUTS_VAR(); 2685 yyout = _out_str ; 2686} 2687]]) 2688 2689 2690m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, 2691[[ 2692int yyget_debug (M4_YY_DEF_ONLY_ARG) 2693{ 2694 M4_YY_DECL_GUTS_VAR(); 2695 return yy_flex_debug; 2696} 2697]]) 2698 2699m4_ifdef( [[M4_YY_NO_SET_DEBUG]],, 2700[[ 2701void yyset_debug YYFARGS1( int ,_bdebug) 2702{ 2703 M4_YY_DECL_GUTS_VAR(); 2704 yy_flex_debug = _bdebug ; 2705} 2706]]) 2707%endif 2708 2709%if-reentrant 2710/* Accessor methods for yylval and yylloc */ 2711 2712%if-bison-bridge 2713m4_ifdef( [[M4_YY_NO_GET_LVAL]],, 2714[[ 2715YYSTYPE * yyget_lval (M4_YY_DEF_ONLY_ARG) 2716{ 2717 M4_YY_DECL_GUTS_VAR(); 2718 return yylval; 2719} 2720]]) 2721 2722m4_ifdef( [[M4_YY_NO_SET_LVAL]],, 2723[[ 2724void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param) 2725{ 2726 M4_YY_DECL_GUTS_VAR(); 2727 yylval = yylval_param; 2728} 2729]]) 2730 2731m4_ifdef( [[<M4_YY_BISON_LLOC>]], 2732[[ 2733 m4_ifdef( [[M4_YY_NO_GET_LLOC]],, 2734 [[ 2735YYLTYPE *yyget_lloc (M4_YY_DEF_ONLY_ARG) 2736{ 2737 M4_YY_DECL_GUTS_VAR(); 2738 return yylloc; 2739} 2740 ]]) 2741 2742 m4_ifdef( [[M4_YY_NO_SET_LLOC]],, 2743 [[ 2744void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param) 2745{ 2746 M4_YY_DECL_GUTS_VAR(); 2747 yylloc = yylloc_param; 2748} 2749 ]]) 2750]]) 2751 2752%endif 2753 2754 2755/* User-visible API */ 2756 2757/* yylex_init is special because it creates the scanner itself, so it is 2758 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2759 * That's why we explicitly handle the declaration, instead of using our macros. 2760 */ 2761int yylex_init(yyscan_t* ptr_yy_globals) 2762{ 2763 if (ptr_yy_globals == NULL){ 2764 errno = EINVAL; 2765 return 1; 2766 } 2767 2768 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); 2769 2770 if (*ptr_yy_globals == NULL){ 2771 errno = ENOMEM; 2772 return 1; 2773 } 2774 2775 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2776 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2777 2778 return yy_init_globals ( *ptr_yy_globals ); 2779} 2780 2781 2782/* yylex_init_extra has the same functionality as yylex_init, but follows the 2783 * convention of taking the scanner as the last argument. Note however, that 2784 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2785 * is the reason, too, why this function also must handle its own declaration). 2786 * The user defined value in the first argument will be available to yyalloc in 2787 * the yyextra field. 2788 */ 2789int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) 2790{ 2791 struct yyguts_t dummy_yyguts; 2792 2793 yyset_extra (yy_user_defined, &dummy_yyguts); 2794 2795 if (ptr_yy_globals == NULL){ 2796 errno = EINVAL; 2797 return 1; 2798 } 2799 2800 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2801 2802 if (*ptr_yy_globals == NULL){ 2803 errno = ENOMEM; 2804 return 1; 2805 } 2806 2807 /* By setting to 0xAA, we expose bugs in 2808 yy_init_globals. Leave at 0x00 for releases. */ 2809 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2810 2811 yyset_extra (yy_user_defined, *ptr_yy_globals); 2812 2813 return yy_init_globals ( *ptr_yy_globals ); 2814} 2815 2816%endif if-c-only 2817%# Actually, that ended an if-rentrant section 2818 2819%if-c-only 2820static int yy_init_globals (M4_YY_DEF_ONLY_ARG) 2821{ 2822 M4_YY_DECL_GUTS_VAR(); 2823 /* Initialization is the same as for the non-reentrant scanner. 2824 * This function is called from yylex_destroy(), so don't allocate here. 2825 */ 2826 2827m4_ifdef( [[M4_YY_USE_LINENO]], 2828[[ 2829 m4_ifdef( [[M4_YY_NOT_REENTRANT]], 2830 [[ 2831 /* We do not touch yylineno unless the option is enabled. */ 2832 yylineno = 1; 2833 ]]) 2834]]) 2835 YY_G(yy_buffer_stack) = NULL; 2836 YY_G(yy_buffer_stack_top) = 0; 2837 YY_G(yy_buffer_stack_max) = 0; 2838 YY_G(yy_c_buf_p) = NULL; 2839 YY_G(yy_init) = 0; 2840 YY_G(yy_start) = 0; 2841 2842m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], 2843[[ 2844 YY_G(yy_start_stack_ptr) = 0; 2845 YY_G(yy_start_stack_depth) = 0; 2846 YY_G(yy_start_stack) = NULL; 2847]]) 2848 2849m4_ifdef( [[M4_YY_USES_REJECT]], 2850[[ 2851 YY_G(yy_state_buf) = 0; 2852 YY_G(yy_state_ptr) = 0; 2853 YY_G(yy_full_match) = 0; 2854 YY_G(yy_lp) = 0; 2855]]) 2856 2857m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], 2858[[ 2859 YY_G(yytext_ptr) = 0; 2860 YY_G(yy_more_offset) = 0; 2861 YY_G(yy_prev_more_offset) = 0; 2862]]) 2863 2864/* Defined in main.c */ 2865#ifdef YY_STDINIT 2866 yyin = stdin; 2867 yyout = stdout; 2868#else 2869 yyin = NULL; 2870 yyout = NULL; 2871#endif 2872 2873 /* For future reference: Set errno on error, since we are called by 2874 * yylex_init() 2875 */ 2876 return 0; 2877} 2878%endif 2879 2880 2881%if-c-only SNIP! this currently causes conflicts with the c++ scanner 2882/* yylex_destroy is for both reentrant and non-reentrant scanners. */ 2883int yylex_destroy (M4_YY_DEF_ONLY_ARG) 2884{ 2885 M4_YY_DECL_GUTS_VAR(); 2886 2887 /* Pop the buffer stack, destroying each element. */ 2888 while(YY_CURRENT_BUFFER){ 2889 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG ); 2890 YY_CURRENT_BUFFER_LVALUE = NULL; 2891 yypop_buffer_state(M4_YY_CALL_ONLY_ARG); 2892 } 2893 2894 /* Destroy the stack itself. */ 2895 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG); 2896 YY_G(yy_buffer_stack) = NULL; 2897 2898m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], 2899[[ 2900 /* Destroy the start condition stack. */ 2901 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG ); 2902 YY_G(yy_start_stack) = NULL; 2903]]) 2904 2905m4_ifdef( [[M4_YY_USES_REJECT]], 2906[[ 2907 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG); 2908 YY_G(yy_state_buf) = NULL; 2909]]) 2910 2911 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2912 * yylex() is called, initialization will occur. */ 2913 yy_init_globals( M4_YY_CALL_ONLY_ARG); 2914 2915%if-reentrant 2916 /* Destroy the main struct (reentrant only). */ 2917 yyfree ( yyscanner M4_YY_CALL_LAST_ARG ); 2918 yyscanner = NULL; 2919%endif 2920 return 0; 2921} 2922%endif 2923 2924 2925m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 2926[[ 2927/* 2928 * Internal utility routines. 2929 */ 2930]]) 2931 2932m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 2933[[ 2934#ifndef yytext_ptr 2935static void yy_flex_strncpy YYFARGS3( char*,s1, const char *,s2, int,n) 2936{ 2937 M4_YY_DECL_GUTS_VAR(); 2938 M4_YY_NOOP_GUTS_VAR(); 2939 2940 int i; 2941 for ( i = 0; i < n; ++i ) 2942 s1[i] = s2[i]; 2943} 2944#endif 2945]]) 2946 2947m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 2948[[ 2949#ifdef YY_NEED_STRLEN 2950static int yy_flex_strlen YYFARGS1( const char *,s) 2951{ 2952 int n; 2953 for ( n = 0; s[n]; ++n ) 2954 ; 2955 2956 return n; 2957} 2958#endif 2959]]) 2960 2961m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],, 2962[[ 2963void *yyalloc YYFARGS1( yy_size_t ,size) 2964{ 2965 M4_YY_DECL_GUTS_VAR(); 2966 M4_YY_NOOP_GUTS_VAR(); 2967 return malloc(size); 2968} 2969]]) 2970 2971m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],, 2972[[ 2973void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size) 2974{ 2975 M4_YY_DECL_GUTS_VAR(); 2976 M4_YY_NOOP_GUTS_VAR(); 2977 2978 /* The cast to (char *) in the following accommodates both 2979 * implementations that use char* generic pointers, and those 2980 * that use void* generic pointers. It works with the latter 2981 * because both ANSI C and C++ allow castless assignment from 2982 * any pointer type to void*, and deal with argument conversions 2983 * as though doing an assignment. 2984 */ 2985 return realloc(ptr, size); 2986} 2987]]) 2988 2989m4_ifdef( [[M4_YY_NO_FLEX_FREE]],, 2990[[ 2991void yyfree YYFARGS1( void *,ptr) 2992{ 2993 M4_YY_DECL_GUTS_VAR(); 2994 M4_YY_NOOP_GUTS_VAR(); 2995 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 2996} 2997]]) 2998 2999%if-tables-serialization definitions 3000m4preproc_include(`tables_shared.c') 3001 3002static int yytbl_read8 (void *v, struct yytbl_reader * rd) 3003{ 3004 errno = 0; 3005 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){ 3006 errno = EIO; 3007 return -1; 3008 } 3009 rd->bread += (flex_uint32_t) sizeof(flex_uint8_t); 3010 return 0; 3011} 3012 3013static int yytbl_read16 (void *v, struct yytbl_reader * rd) 3014{ 3015 errno = 0; 3016 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){ 3017 errno = EIO; 3018 return -1; 3019 } 3020 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v)); 3021 rd->bread += (flex_uint32_t) sizeof(flex_uint16_t); 3022 return 0; 3023} 3024 3025static int yytbl_read32 (void *v, struct yytbl_reader * rd) 3026{ 3027 errno = 0; 3028 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){ 3029 errno = EIO; 3030 return -1; 3031 } 3032 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v)); 3033 rd->bread += (flex_uint32_t) sizeof(flex_uint32_t); 3034 return 0; 3035} 3036 3037/** Read the header */ 3038static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd) 3039{ 3040 size_t bytes; 3041 memset (th, 0, sizeof (struct yytbl_hdr)); 3042 3043 if (yytbl_read32 (&(th->th_magic), rd) != 0) 3044 return -1; 3045 3046 if (th->th_magic != YYTBL_MAGIC){ 3047 YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */ 3048 return -1; 3049 } 3050 3051 if (yytbl_read32 (&(th->th_hsize), rd) != 0 3052 || yytbl_read32 (&(th->th_ssize), rd) != 0 3053 || yytbl_read16 (&(th->th_flags), rd) != 0) 3054 return -1; 3055 3056 /* Sanity check on header size. Greater than 1k suggests some funny business. */ 3057 if (th->th_hsize < 16 || th->th_hsize > 1024){ 3058 YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */ 3059 return -1; 3060 } 3061 3062 /* Allocate enough space for the version and name fields */ 3063 bytes = th->th_hsize - 14; 3064 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG); 3065 if ( ! th->th_version ) 3066 YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" ); 3067 3068 /* we read it all into th_version, and point th_name into that data */ 3069 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){ 3070 errno = EIO; 3071 yyfree(th->th_version M4_YY_CALL_LAST_ARG); 3072 th->th_version = NULL; 3073 return -1; 3074 } 3075 else 3076 rd->bread += (flex_uint32_t) bytes; 3077 3078 th->th_name = th->th_version + strlen (th->th_version) + 1; 3079 return 0; 3080} 3081 3082/** lookup id in the dmap list. 3083 * @param dmap pointer to first element in list 3084 * @return NULL if not found. 3085 */ 3086static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap, 3087 int, id) 3088{ 3089 M4_YY_DECL_GUTS_VAR(); 3090 M4_YY_NOOP_GUTS_VAR(); 3091 3092 while (dmap->dm_id) 3093 if ((int)(dmap->dm_id) == id) 3094 return dmap; 3095 else 3096 dmap++; 3097 return NULL; 3098} 3099 3100/** Read a table while mapping its contents to the local array. 3101 * @param dmap used to performing mapping 3102 * @return 0 on success 3103 */ 3104static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd) 3105{ 3106 struct yytbl_data td; 3107 struct yytbl_dmap *transdmap=0; 3108 int len, i, rv, inner_loop_count; 3109 void *p=0; 3110 3111 memset (&td, 0, sizeof (struct yytbl_data)); 3112 3113 if (yytbl_read16 (&td.td_id, rd) != 0 3114 || yytbl_read16 (&td.td_flags, rd) != 0 3115 || yytbl_read32 (&td.td_hilen, rd) != 0 3116 || yytbl_read32 (&td.td_lolen, rd) != 0) 3117 return -1; 3118 3119 /* Lookup the map for the transition table so we have it in case we need it 3120 * inside the loop below. This scanner might not even have a transition 3121 * table, which is ok. 3122 */ 3123 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG); 3124 3125 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){ 3126 YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */ 3127 return -1; 3128 } 3129 3130 /* Allocate space for table. 3131 * The --full yy_transition table is a special case, since we 3132 * need the dmap.dm_sz entry to tell us the sizeof the individual 3133 * struct members. 3134 */ 3135 { 3136 size_t bytes; 3137 3138 if ((td.td_flags & YYTD_STRUCT)) 3139 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1); 3140 else 3141 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz; 3142 3143 if(M4_YY_TABLES_VERIFY) 3144 /* We point to the array itself */ 3145 p = dmap->dm_arr; 3146 else 3147 /* We point to the address of a pointer. */ 3148 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG); 3149 if ( ! p ) 3150 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" ); 3151 } 3152 3153 /* If it's a struct, we read 2 integers to get one element */ 3154 if ((td.td_flags & YYTD_STRUCT) != 0) 3155 inner_loop_count = 2; 3156 else 3157 inner_loop_count = 1; 3158 3159 /* read and map each element. 3160 * This loop iterates once for each element of the td_data array. 3161 * Notice that we increment 'i' in the inner loop. 3162 */ 3163 len = yytbl_calc_total_len (&td); 3164 for (i = 0; i < len; ){ 3165 int j; 3166 3167 3168 /* This loop really executes exactly 1 or 2 times. 3169 * The second time is to handle the second member of the 3170 * YYTD_STRUCT for the yy_transition array. 3171 */ 3172 for (j = 0; j < inner_loop_count; j++, i++) { 3173 flex_int32_t t32; 3174 3175 /* read into t32 no matter what the real size is. */ 3176 { 3177 flex_int16_t t16; 3178 flex_int8_t t8; 3179 3180 switch (YYTDFLAGS2BYTES (td.td_flags)) { 3181 case sizeof (flex_int32_t): 3182 rv = yytbl_read32 (&t32, rd); 3183 break; 3184 case sizeof (flex_int16_t): 3185 rv = yytbl_read16 (&t16, rd); 3186 t32 = t16; 3187 break; 3188 case sizeof (flex_int8_t): 3189 rv = yytbl_read8 (&t8, rd); 3190 t32 = t8; 3191 break; 3192 default: 3193 YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */ 3194 return -1; 3195 } 3196 } 3197 if (rv != 0) 3198 return -1; 3199 3200 /* copy into the deserialized array... */ 3201 3202 if ((td.td_flags & YYTD_STRUCT)) { 3203 /* t32 is the j'th member of a two-element struct. */ 3204 void *v; 3205 3206 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify) 3207 : &(((struct yy_trans_info *) p)->yy_nxt); 3208 3209 switch (dmap->dm_sz) { 3210 case sizeof (flex_int32_t): 3211 if (M4_YY_TABLES_VERIFY){ 3212 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32) 3213 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" ); 3214 }else 3215 ((flex_int32_t *) v)[0] = (flex_int32_t) t32; 3216 break; 3217 case sizeof (flex_int16_t): 3218 if (M4_YY_TABLES_VERIFY ){ 3219 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32) 3220 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" ); 3221 }else 3222 ((flex_int16_t *) v)[0] = (flex_int16_t) t32; 3223 break; 3224 case sizeof(flex_int8_t): 3225 if (M4_YY_TABLES_VERIFY ){ 3226 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32) 3227 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" ); 3228 }else 3229 ((flex_int8_t *) v)[0] = (flex_int8_t) t32; 3230 break; 3231 default: 3232 YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */ 3233 return -1; 3234 } 3235 3236 /* if we're done with j, increment p */ 3237 if (j == 1) 3238 p = (struct yy_trans_info *) p + 1; 3239 } 3240 else if ((td.td_flags & YYTD_PTRANS)) { 3241 /* t32 is an index into the transition array. */ 3242 struct yy_trans_info *v; 3243 3244 3245 if (!transdmap){ 3246 YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */ 3247 return -1; 3248 } 3249 3250 if( M4_YY_TABLES_VERIFY) 3251 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]); 3252 else 3253 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]); 3254 3255 if(M4_YY_TABLES_VERIFY ){ 3256 if( ((struct yy_trans_info **) p)[0] != v) 3257 YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" ); 3258 }else 3259 ((struct yy_trans_info **) p)[0] = v; 3260 3261 /* increment p */ 3262 p = (struct yy_trans_info **) p + 1; 3263 } 3264 else { 3265 /* t32 is a plain int. copy data, then incrememnt p. */ 3266 switch (dmap->dm_sz) { 3267 case sizeof (flex_int32_t): 3268 if(M4_YY_TABLES_VERIFY ){ 3269 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32) 3270 YY_FATAL_ERROR( "tables verification failed at flex_int32_t" ); 3271 }else 3272 ((flex_int32_t *) p)[0] = (flex_int32_t) t32; 3273 p = ((flex_int32_t *) p) + 1; 3274 break; 3275 case sizeof (flex_int16_t): 3276 if(M4_YY_TABLES_VERIFY ){ 3277 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32) 3278 YY_FATAL_ERROR( "tables verification failed at flex_int16_t" ); 3279 }else 3280 ((flex_int16_t *) p)[0] = (flex_int16_t) t32; 3281 p = ((flex_int16_t *) p) + 1; 3282 break; 3283 case sizeof (flex_int8_t): 3284 if(M4_YY_TABLES_VERIFY ){ 3285 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32) 3286 YY_FATAL_ERROR( "tables verification failed at flex_int8_t" ); 3287 }else 3288 ((flex_int8_t *) p)[0] = (flex_int8_t) t32; 3289 p = ((flex_int8_t *) p) + 1; 3290 break; 3291 default: 3292 YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */ 3293 return -1; 3294 } 3295 } 3296 } 3297 3298 } 3299 3300 /* Now eat padding. */ 3301 { 3302 int pad; 3303 pad = yypad64(rd->bread); 3304 while(--pad >= 0){ 3305 flex_int8_t t8; 3306 if(yytbl_read8(&t8,rd) != 0) 3307 return -1; 3308 } 3309 } 3310 3311 return 0; 3312} 3313 3314%define-yytables The name for this specific scanner's tables. 3315 3316/* Find the key and load the DFA tables from the given stream. */ 3317static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key) 3318{ 3319 int rv=0; 3320 struct yytbl_hdr th; 3321 struct yytbl_reader rd; 3322 3323 rd.fp = fp; 3324 th.th_version = NULL; 3325 3326 /* Keep trying until we find the right set of tables or end of file. */ 3327 while (!feof(rd.fp)) { 3328 rd.bread = 0; 3329 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){ 3330 rv = -1; 3331 goto return_rv; 3332 } 3333 3334 /* A NULL key means choose the first set of tables. */ 3335 if (key == NULL) 3336 break; 3337 3338 if (strcmp(th.th_name,key) != 0){ 3339 /* Skip ahead to next set */ 3340 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR); 3341 yyfree(th.th_version M4_YY_CALL_LAST_ARG); 3342 th.th_version = NULL; 3343 } 3344 else 3345 break; 3346 } 3347 3348 while (rd.bread < th.th_ssize){ 3349 /* Load the data tables */ 3350 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){ 3351 rv = -1; 3352 goto return_rv; 3353 } 3354 } 3355 3356return_rv: 3357 if(th.th_version){ 3358 yyfree(th.th_version M4_YY_CALL_LAST_ARG); 3359 th.th_version = NULL; 3360 } 3361 3362 return rv; 3363} 3364 3365/** Load the DFA tables for this scanner from the given stream. */ 3366int yytables_fload YYFARGS1(FILE *, fp) 3367{ 3368 3369 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0) 3370 return -1; 3371 return 0; 3372} 3373 3374/** Destroy the loaded tables, freeing memory, etc.. */ 3375int yytables_destroy (M4_YY_DEF_ONLY_ARG) 3376{ 3377 struct yytbl_dmap *dmap=0; 3378 3379 if(!M4_YY_TABLES_VERIFY){ 3380 /* Walk the dmap, freeing the pointers */ 3381 for(dmap=yydmap; dmap->dm_id; dmap++) { 3382 void * v; 3383 v = dmap->dm_arr; 3384 if(v && *(char**)v){ 3385 yyfree(*(char**)v M4_YY_CALL_LAST_ARG); 3386 *(char**)v = NULL; 3387 } 3388 } 3389 } 3390 3391 return 0; 3392} 3393 3394/* end table serialization code definitions */ 3395%endif 3396 3397 3398m4_ifdef([[M4_YY_MAIN]], [[ 3399int main (void); 3400 3401int main () 3402{ 3403 3404%if-reentrant 3405 yyscan_t lexer; 3406 yylex_init(&lexer); 3407 yylex( lexer ); 3408 yylex_destroy( lexer); 3409 3410%endif 3411%if-not-reentrant 3412 yylex(); 3413%endif 3414 3415 return 0; 3416} 3417]]) 3418 3419%ok-for-header 3420m4_ifdef( [[M4_YY_IN_HEADER]], 3421[[ 3422#undef YY_NEW_FILE 3423#undef YY_FLUSH_BUFFER 3424#undef yy_set_bol 3425#undef yy_new_buffer 3426#undef yy_set_interactive 3427#undef YY_DO_BEFORE_ACTION 3428 3429#ifdef YY_DECL_IS_OURS 3430#undef YY_DECL_IS_OURS 3431#undef YY_DECL 3432#endif 3433m4preproc_undivert(1) 3434]]) 3435