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#ifdef YY_FLEX_LEX_COMPAT 1867 return 0; 1868#else 1869 return EOF; 1870#endif 1871 1872 if ( ! YY_G(yy_did_buffer_switch_on_eof) ) 1873 YY_NEW_FILE; 1874#ifdef __cplusplus 1875 return yyinput(M4_YY_CALL_ONLY_ARG); 1876#else 1877 return input(M4_YY_CALL_ONLY_ARG); 1878#endif 1879 } 1880 1881 case EOB_ACT_CONTINUE_SCAN: 1882 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset; 1883 break; 1884 } 1885 } 1886 } 1887 1888 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */ 1889 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */ 1890 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p); 1891 1892%% [19.0] update BOL and yylineno 1893 1894 return c; 1895} 1896%if-c-only 1897#endif /* ifndef YY_NO_INPUT */ 1898%endif 1899 1900/** Immediately switch to a different input stream. 1901 * @param input_file A readable stream. 1902 * M4_YY_DOC_PARAM 1903 * @note This function does not reset the start condition to @c INITIAL . 1904 */ 1905%if-c-only 1906 void yyrestart YYFARGS1( FILE *,input_file) 1907%endif 1908%if-c++-only 1909 void yyFlexLexer::yyrestart( std::istream& input_file ) 1910%endif 1911{ 1912 M4_YY_DECL_GUTS_VAR(); 1913 1914 if ( ! YY_CURRENT_BUFFER ){ 1915 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); 1916 YY_CURRENT_BUFFER_LVALUE = 1917 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); 1918 } 1919 1920 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG); 1921 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 1922} 1923 1924%if-c++-only 1925/** Delegate to the new version that takes an istream reference. 1926 * @param input_file A readable stream. 1927 * M4_YY_DOC_PARAM 1928 * @note This function does not reset the start condition to @c INITIAL . 1929 */ 1930void yyFlexLexer::yyrestart( std::istream* input_file ) 1931{ 1932 if( ! input_file ) { 1933 input_file = &yyin; 1934 } 1935 yyrestart( *input_file ); 1936} 1937%endif 1938 1939/** Switch to a different input buffer. 1940 * @param new_buffer The new input buffer. 1941 * M4_YY_DOC_PARAM 1942 */ 1943%if-c-only 1944 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) 1945%endif 1946%if-c++-only 1947 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) 1948%endif 1949{ 1950 M4_YY_DECL_GUTS_VAR(); 1951 1952 /* TODO. We should be able to replace this entire function body 1953 * with 1954 * yypop_buffer_state(); 1955 * yypush_buffer_state(new_buffer); 1956 */ 1957 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); 1958 if ( YY_CURRENT_BUFFER == new_buffer ) 1959 return; 1960 1961 if ( YY_CURRENT_BUFFER ) 1962 { 1963 /* Flush out information for old buffer. */ 1964 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); 1965 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); 1966 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); 1967 } 1968 1969 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1970 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 1971 1972 /* We don't actually know whether we did this switch during 1973 * EOF (yywrap()) processing, but the only time this flag 1974 * is looked at is after yywrap() is called, so it's safe 1975 * to go ahead and always set it. 1976 */ 1977 YY_G(yy_did_buffer_switch_on_eof) = 1; 1978} 1979 1980 1981%if-c-only 1982static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) 1983%endif 1984%if-c++-only 1985 void yyFlexLexer::yy_load_buffer_state() 1986%endif 1987{ 1988 M4_YY_DECL_GUTS_VAR(); 1989 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1990 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1991%if-c-only 1992 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1993%endif 1994%if-c++-only 1995 yyin.rdbuf(YY_CURRENT_BUFFER_LVALUE->yy_input_file); 1996%endif 1997 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); 1998} 1999 2000/** Allocate and initialize an input buffer state. 2001 * @param file A readable stream. 2002 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2003 * M4_YY_DOC_PARAM 2004 * @return the allocated buffer state. 2005 */ 2006%if-c-only 2007 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size) 2008%endif 2009%if-c++-only 2010 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size ) 2011%endif 2012{ 2013 YY_BUFFER_STATE b; 2014 m4_dnl M4_YY_DECL_GUTS_VAR(); 2015 2016 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG ); 2017 if ( ! b ) 2018 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2019 2020 b->yy_buf_size = size; 2021 2022 /* yy_ch_buf has to be 2 characters longer than the size given because 2023 * we need to put in 2 end-of-buffer characters. 2024 */ 2025 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) M4_YY_CALL_LAST_ARG ); 2026 if ( ! b->yy_ch_buf ) 2027 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2028 2029 b->yy_is_our_buffer = 1; 2030 2031 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG); 2032 2033 return b; 2034} 2035 2036%if-c++-only 2037/** Delegate creation of buffers to the new version that takes an istream reference. 2038 * @param file A readable stream. 2039 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2040 * M4_YY_DOC_PARAM 2041 * @return the allocated buffer state. 2042 */ 2043 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) 2044{ 2045 return yy_create_buffer( *file, size ); 2046} 2047%endif 2048 2049/** Destroy the buffer. 2050 * @param b a buffer created with yy_create_buffer() 2051 * M4_YY_DOC_PARAM 2052 */ 2053%if-c-only 2054 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b) 2055%endif 2056%if-c++-only 2057 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) 2058%endif 2059{ 2060 M4_YY_DECL_GUTS_VAR(); 2061 2062 if ( ! b ) 2063 return; 2064 2065 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 2066 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 2067 2068 if ( b->yy_is_our_buffer ) 2069 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG ); 2070 2071 yyfree( (void *) b M4_YY_CALL_LAST_ARG ); 2072} 2073 2074 2075/* Initializes or reinitializes a buffer. 2076 * This function is sometimes called more than once on the same buffer, 2077 * such as during a yyrestart() or at EOF. 2078 */ 2079%if-c-only 2080 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file) 2081%endif 2082%if-c++-only 2083 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file ) 2084%endif 2085 2086{ 2087 int oerrno = errno; 2088 M4_YY_DECL_GUTS_VAR(); 2089 2090 yy_flush_buffer( b M4_YY_CALL_LAST_ARG); 2091 2092%if-c-only 2093 b->yy_input_file = file; 2094%endif 2095%if-c++-only 2096 b->yy_input_file = file.rdbuf(); 2097%endif 2098 b->yy_fill_buffer = 1; 2099 2100 /* If b is the current buffer, then yy_init_buffer was _probably_ 2101 * called from yyrestart() or through yy_get_next_buffer. 2102 * In that case, we don't want to reset the lineno or column. 2103 */ 2104 if (b != YY_CURRENT_BUFFER){ 2105 b->yy_bs_lineno = 1; 2106 b->yy_bs_column = 0; 2107 } 2108 2109%if-c-only 2110m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], 2111[[ 2112 b->yy_is_interactive = 1; 2113]], 2114[[ 2115 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]], 2116 [[ 2117 b->yy_is_interactive = 0; 2118 ]], 2119 [[ 2120 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 2121 ]]) 2122]]) 2123%endif 2124%if-c++-only 2125 b->yy_is_interactive = 0; 2126%endif 2127 errno = oerrno; 2128} 2129 2130/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 2131 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 2132 * M4_YY_DOC_PARAM 2133 */ 2134%if-c-only 2135 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b) 2136%endif 2137%if-c++-only 2138 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) 2139%endif 2140{ 2141 M4_YY_DECL_GUTS_VAR(); 2142 if ( ! b ) 2143 return; 2144 2145 b->yy_n_chars = 0; 2146 2147 /* We always need two end-of-buffer characters. The first causes 2148 * a transition to the end-of-buffer state. The second causes 2149 * a jam in that state. 2150 */ 2151 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 2152 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 2153 2154 b->yy_buf_pos = &b->yy_ch_buf[0]; 2155 2156 b->yy_at_bol = 1; 2157 b->yy_buffer_status = YY_BUFFER_NEW; 2158 2159 if ( b == YY_CURRENT_BUFFER ) 2160 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 2161} 2162 2163%if-c-or-c++ 2164/** Pushes the new state onto the stack. The new state becomes 2165 * the current state. This function will allocate the stack 2166 * if necessary. 2167 * @param new_buffer The new state. 2168 * M4_YY_DOC_PARAM 2169 */ 2170%if-c-only 2171void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer) 2172%endif 2173%if-c++-only 2174void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) 2175%endif 2176{ 2177 M4_YY_DECL_GUTS_VAR(); 2178 if (new_buffer == NULL) 2179 return; 2180 2181 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG); 2182 2183 /* This block is copied from yy_switch_to_buffer. */ 2184 if ( YY_CURRENT_BUFFER ) 2185 { 2186 /* Flush out information for old buffer. */ 2187 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); 2188 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); 2189 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); 2190 } 2191 2192 /* Only push if top exists. Otherwise, replace top. */ 2193 if (YY_CURRENT_BUFFER) 2194 YY_G(yy_buffer_stack_top)++; 2195 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2196 2197 /* copied from yy_switch_to_buffer. */ 2198 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 2199 YY_G(yy_did_buffer_switch_on_eof) = 1; 2200} 2201%endif 2202 2203 2204%if-c-or-c++ 2205/** Removes and deletes the top of the stack, if present. 2206 * The next element becomes the new top. 2207 * M4_YY_DOC_PARAM 2208 */ 2209%if-c-only 2210void yypop_buffer_state (M4_YY_DEF_ONLY_ARG) 2211%endif 2212%if-c++-only 2213void yyFlexLexer::yypop_buffer_state (void) 2214%endif 2215{ 2216 M4_YY_DECL_GUTS_VAR(); 2217 if (!YY_CURRENT_BUFFER) 2218 return; 2219 2220 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); 2221 YY_CURRENT_BUFFER_LVALUE = NULL; 2222 if (YY_G(yy_buffer_stack_top) > 0) 2223 --YY_G(yy_buffer_stack_top); 2224 2225 if (YY_CURRENT_BUFFER) { 2226 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); 2227 YY_G(yy_did_buffer_switch_on_eof) = 1; 2228 } 2229} 2230%endif 2231 2232 2233%if-c-or-c++ 2234/* Allocates the stack if it does not exist. 2235 * Guarantees space for at least one push. 2236 */ 2237%if-c-only 2238static void yyensure_buffer_stack (M4_YY_DEF_ONLY_ARG) 2239%endif 2240%if-c++-only 2241void yyFlexLexer::yyensure_buffer_stack(void) 2242%endif 2243{ 2244 yy_size_t num_to_alloc; 2245 M4_YY_DECL_GUTS_VAR(); 2246 2247 if (!YY_G(yy_buffer_stack)) { 2248 2249 /* First allocation is just for 2 elements, since we don't know if this 2250 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2251 * immediate realloc on the next call. 2252 */ 2253 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ 2254 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 2255 (num_to_alloc * sizeof(struct yy_buffer_state*) 2256 M4_YY_CALL_LAST_ARG); 2257 if ( ! YY_G(yy_buffer_stack) ) 2258 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2259 2260 2261 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2262 2263 YY_G(yy_buffer_stack_max) = num_to_alloc; 2264 YY_G(yy_buffer_stack_top) = 0; 2265 return; 2266 } 2267 2268 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){ 2269 2270 /* Increase the buffer to prepare for a possible push. */ 2271 yy_size_t grow_size = 8 /* arbitrary grow size */; 2272 2273 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size; 2274 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 2275 (YY_G(yy_buffer_stack), 2276 num_to_alloc * sizeof(struct yy_buffer_state*) 2277 M4_YY_CALL_LAST_ARG); 2278 if ( ! YY_G(yy_buffer_stack) ) 2279 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2280 2281 /* zero only the new slots.*/ 2282 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 2283 YY_G(yy_buffer_stack_max) = num_to_alloc; 2284 } 2285} 2286%endif 2287 2288 2289 2290 2291m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],, 2292[[ 2293%if-c-only 2294/** Setup the input buffer state to scan directly from a user-specified character buffer. 2295 * @param base the character buffer 2296 * @param size the size in bytes of the character buffer 2297 * M4_YY_DOC_PARAM 2298 * @return the newly allocated buffer state object. 2299 */ 2300YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size) 2301{ 2302 YY_BUFFER_STATE b; 2303 m4_dnl M4_YY_DECL_GUTS_VAR(); 2304 2305 if ( size < 2 || 2306 base[size-2] != YY_END_OF_BUFFER_CHAR || 2307 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2308 /* They forgot to leave room for the EOB's. */ 2309 return NULL; 2310 2311 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG ); 2312 if ( ! b ) 2313 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 2314 2315 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ 2316 b->yy_buf_pos = b->yy_ch_buf = base; 2317 b->yy_is_our_buffer = 0; 2318 b->yy_input_file = NULL; 2319 b->yy_n_chars = b->yy_buf_size; 2320 b->yy_is_interactive = 0; 2321 b->yy_at_bol = 1; 2322 b->yy_fill_buffer = 0; 2323 b->yy_buffer_status = YY_BUFFER_NEW; 2324 2325 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG ); 2326 2327 return b; 2328} 2329%endif 2330]]) 2331 2332 2333m4_ifdef( [[M4_YY_NO_SCAN_STRING]],, 2334[[ 2335%if-c-only 2336/** Setup the input buffer state to scan a string. The next call to yylex() will 2337 * scan from a @e copy of @a str. 2338 * @param yystr a NUL-terminated string to scan 2339 * M4_YY_DOC_PARAM 2340 * @return the newly allocated buffer state object. 2341 * @note If you want to scan bytes that may contain NUL values, then use 2342 * yy_scan_bytes() instead. 2343 */ 2344YY_BUFFER_STATE yy_scan_string YYFARGS1( const char *, yystr) 2345{ 2346 m4_dnl M4_YY_DECL_GUTS_VAR(); 2347 2348 return yy_scan_bytes( yystr, (int) strlen(yystr) M4_YY_CALL_LAST_ARG); 2349} 2350%endif 2351]]) 2352 2353 2354m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],, 2355[[ 2356%if-c-only 2357/** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2358 * scan from a @e copy of @a bytes. 2359 * @param yybytes the byte buffer to scan 2360 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2361 * M4_YY_DOC_PARAM 2362 * @return the newly allocated buffer state object. 2363 */ 2364YY_BUFFER_STATE yy_scan_bytes YYFARGS2( const char *,yybytes, int ,_yybytes_len) 2365{ 2366 YY_BUFFER_STATE b; 2367 char *buf; 2368 yy_size_t n; 2369 int i; 2370 m4_dnl M4_YY_DECL_GUTS_VAR(); 2371 2372 /* Get memory for full buffer, including space for trailing EOB's. */ 2373 n = (yy_size_t) (_yybytes_len + 2); 2374 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG ); 2375 if ( ! buf ) 2376 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 2377 2378 for ( i = 0; i < _yybytes_len; ++i ) 2379 buf[i] = yybytes[i]; 2380 2381 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2382 2383 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG); 2384 if ( ! b ) 2385 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 2386 2387 /* It's okay to grow etc. this buffer, and we should throw it 2388 * away when we're done. 2389 */ 2390 b->yy_is_our_buffer = 1; 2391 2392 return b; 2393} 2394%endif 2395]]) 2396 2397 2398m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, 2399[[ 2400%if-c-only 2401 static void yy_push_state YYFARGS1( int ,_new_state) 2402%endif 2403%if-c++-only 2404 void yyFlexLexer::yy_push_state( int _new_state ) 2405%endif 2406{ 2407 M4_YY_DECL_GUTS_VAR(); 2408 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) ) 2409 { 2410 yy_size_t new_size; 2411 2412 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR; 2413 new_size = (yy_size_t) YY_G(yy_start_stack_depth) * sizeof( int ); 2414 2415 if ( ! YY_G(yy_start_stack) ) 2416 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG ); 2417 2418 else 2419 YY_G(yy_start_stack) = (int *) yyrealloc( 2420 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG ); 2421 2422 if ( ! YY_G(yy_start_stack) ) 2423 YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); 2424 } 2425 2426 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START; 2427 2428 BEGIN(_new_state); 2429} 2430]]) 2431 2432 2433m4_ifdef( [[M4_YY_NO_POP_STATE]],, 2434[[ 2435%if-c-only 2436 static void yy_pop_state (M4_YY_DEF_ONLY_ARG) 2437%endif 2438%if-c++-only 2439 void yyFlexLexer::yy_pop_state() 2440%endif 2441{ 2442 M4_YY_DECL_GUTS_VAR(); 2443 if ( --YY_G(yy_start_stack_ptr) < 0 ) 2444 YY_FATAL_ERROR( "start-condition stack underflow" ); 2445 2446 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]); 2447} 2448]]) 2449 2450 2451m4_ifdef( [[M4_YY_NO_TOP_STATE]],, 2452[[ 2453%if-c-only 2454 static int yy_top_state (M4_YY_DEF_ONLY_ARG) 2455%endif 2456%if-c++-only 2457 int yyFlexLexer::yy_top_state() 2458%endif 2459{ 2460 M4_YY_DECL_GUTS_VAR(); 2461 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1]; 2462} 2463]]) 2464 2465#ifndef YY_EXIT_FAILURE 2466#define YY_EXIT_FAILURE 2 2467#endif 2468 2469%if-c-only 2470static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) 2471{ 2472 M4_YY_DECL_GUTS_VAR(); 2473 M4_YY_NOOP_GUTS_VAR(); 2474 fprintf( stderr, "%s\n", msg ); 2475 exit( YY_EXIT_FAILURE ); 2476} 2477%endif 2478%if-c++-only 2479void yyFlexLexer::LexerError( const char* msg ) 2480{ 2481 M4_YY_DECL_GUTS_VAR(); 2482 std::cerr << msg << std::endl; 2483 exit( YY_EXIT_FAILURE ); 2484} 2485%endif 2486 2487/* Redefine yyless() so it works in section 3 code. */ 2488 2489#undef yyless 2490#define yyless(n) \ 2491 do \ 2492 { \ 2493 /* Undo effects of setting up yytext. */ \ 2494 int yyless_macro_arg = (n); \ 2495 YY_LESS_LINENO(yyless_macro_arg);\ 2496 yytext[yyleng] = YY_G(yy_hold_char); \ 2497 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \ 2498 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \ 2499 *YY_G(yy_c_buf_p) = '\0'; \ 2500 yyleng = yyless_macro_arg; \ 2501 } \ 2502 while ( 0 ) 2503 2504 2505 2506/* Accessor methods (get/set functions) to struct members. */ 2507 2508%if-c-only 2509%if-reentrant 2510m4_ifdef( [[M4_YY_NO_GET_EXTRA]],, 2511[[ 2512/** Get the user-defined data for this scanner. 2513 * M4_YY_DOC_PARAM 2514 */ 2515YY_EXTRA_TYPE yyget_extra (M4_YY_DEF_ONLY_ARG) 2516{ 2517 M4_YY_DECL_GUTS_VAR(); 2518 return yyextra; 2519} 2520]]) 2521%endif 2522 2523m4_ifdef( [[M4_YY_NO_GET_LINENO]],, 2524[[ 2525/** Get the current line number. 2526 * M4_YY_DOC_PARAM 2527 */ 2528int yyget_lineno (M4_YY_DEF_ONLY_ARG) 2529{ 2530 M4_YY_DECL_GUTS_VAR(); 2531 2532 m4_ifdef( [[M4_YY_REENTRANT]], 2533 [[ 2534 if (! YY_CURRENT_BUFFER) 2535 return 0; 2536 ]]) 2537 return yylineno; 2538} 2539]]) 2540 2541m4_ifdef( [[M4_YY_REENTRANT]], 2542[[ 2543m4_ifdef( [[M4_YY_NO_GET_COLUMN]],, 2544[[ 2545/** Get the current column number. 2546 * M4_YY_DOC_PARAM 2547 */ 2548int yyget_column (M4_YY_DEF_ONLY_ARG) 2549{ 2550 M4_YY_DECL_GUTS_VAR(); 2551 2552 m4_ifdef( [[M4_YY_REENTRANT]], 2553 [[ 2554 if (! YY_CURRENT_BUFFER) 2555 return 0; 2556 ]]) 2557 return yycolumn; 2558} 2559]]) 2560]]) 2561 2562m4_ifdef( [[M4_YY_NO_GET_IN]],, 2563[[ 2564/** Get the input stream. 2565 * M4_YY_DOC_PARAM 2566 */ 2567FILE *yyget_in (M4_YY_DEF_ONLY_ARG) 2568{ 2569 M4_YY_DECL_GUTS_VAR(); 2570 return yyin; 2571} 2572]]) 2573 2574m4_ifdef( [[M4_YY_NO_GET_OUT]],, 2575[[ 2576/** Get the output stream. 2577 * M4_YY_DOC_PARAM 2578 */ 2579FILE *yyget_out (M4_YY_DEF_ONLY_ARG) 2580{ 2581 M4_YY_DECL_GUTS_VAR(); 2582 return yyout; 2583} 2584]]) 2585 2586m4_ifdef( [[M4_YY_NO_GET_LENG]],, 2587[[ 2588/** Get the length of the current token. 2589 * M4_YY_DOC_PARAM 2590 */ 2591int yyget_leng (M4_YY_DEF_ONLY_ARG) 2592{ 2593 M4_YY_DECL_GUTS_VAR(); 2594 return yyleng; 2595} 2596]]) 2597 2598/** Get the current token. 2599 * M4_YY_DOC_PARAM 2600 */ 2601m4_ifdef( [[M4_YY_NO_GET_TEXT]],, 2602[[ 2603char *yyget_text (M4_YY_DEF_ONLY_ARG) 2604{ 2605 M4_YY_DECL_GUTS_VAR(); 2606 return yytext; 2607} 2608]]) 2609 2610%if-reentrant 2611m4_ifdef( [[M4_YY_NO_SET_EXTRA]],, 2612[[ 2613/** Set the user-defined data. This data is never touched by the scanner. 2614 * @param user_defined The data to be associated with this scanner. 2615 * M4_YY_DOC_PARAM 2616 */ 2617void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined) 2618{ 2619 M4_YY_DECL_GUTS_VAR(); 2620 yyextra = user_defined ; 2621} 2622]]) 2623%endif 2624 2625m4_ifdef( [[M4_YY_NO_SET_LINENO]],, 2626[[ 2627/** Set the current line number. 2628 * @param _line_number line number 2629 * M4_YY_DOC_PARAM 2630 */ 2631void yyset_lineno YYFARGS1( int ,_line_number) 2632{ 2633 M4_YY_DECL_GUTS_VAR(); 2634 2635 m4_ifdef( [[M4_YY_REENTRANT]], 2636 [[ 2637 /* lineno is only valid if an input buffer exists. */ 2638 if (! YY_CURRENT_BUFFER ) 2639 YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); 2640 ]]) 2641 yylineno = _line_number; 2642} 2643]]) 2644 2645m4_ifdef( [[M4_YY_REENTRANT]], 2646[[ 2647m4_ifdef( [[M4_YY_NO_SET_COLUMN]],, 2648[[ 2649/** Set the current column. 2650 * @param _column_no column number 2651 * M4_YY_DOC_PARAM 2652 */ 2653void yyset_column YYFARGS1( int , _column_no) 2654{ 2655 M4_YY_DECL_GUTS_VAR(); 2656 2657 m4_ifdef( [[M4_YY_REENTRANT]], 2658 [[ 2659 /* column is only valid if an input buffer exists. */ 2660 if (! YY_CURRENT_BUFFER ) 2661 YY_FATAL_ERROR( "yyset_column called with no buffer" ); 2662 ]]) 2663 yycolumn = _column_no; 2664} 2665]]) 2666]]) 2667 2668 2669m4_ifdef( [[M4_YY_NO_SET_IN]],, 2670[[ 2671/** Set the input stream. This does not discard the current 2672 * input buffer. 2673 * @param _in_str A readable stream. 2674 * M4_YY_DOC_PARAM 2675 * @see yy_switch_to_buffer 2676 */ 2677void yyset_in YYFARGS1( FILE * ,_in_str) 2678{ 2679 M4_YY_DECL_GUTS_VAR(); 2680 yyin = _in_str ; 2681} 2682]]) 2683 2684m4_ifdef( [[M4_YY_NO_SET_OUT]],, 2685[[ 2686void yyset_out YYFARGS1( FILE * ,_out_str) 2687{ 2688 M4_YY_DECL_GUTS_VAR(); 2689 yyout = _out_str ; 2690} 2691]]) 2692 2693 2694m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, 2695[[ 2696int yyget_debug (M4_YY_DEF_ONLY_ARG) 2697{ 2698 M4_YY_DECL_GUTS_VAR(); 2699 return yy_flex_debug; 2700} 2701]]) 2702 2703m4_ifdef( [[M4_YY_NO_SET_DEBUG]],, 2704[[ 2705void yyset_debug YYFARGS1( int ,_bdebug) 2706{ 2707 M4_YY_DECL_GUTS_VAR(); 2708 yy_flex_debug = _bdebug ; 2709} 2710]]) 2711%endif 2712 2713%if-reentrant 2714/* Accessor methods for yylval and yylloc */ 2715 2716%if-bison-bridge 2717m4_ifdef( [[M4_YY_NO_GET_LVAL]],, 2718[[ 2719YYSTYPE * yyget_lval (M4_YY_DEF_ONLY_ARG) 2720{ 2721 M4_YY_DECL_GUTS_VAR(); 2722 return yylval; 2723} 2724]]) 2725 2726m4_ifdef( [[M4_YY_NO_SET_LVAL]],, 2727[[ 2728void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param) 2729{ 2730 M4_YY_DECL_GUTS_VAR(); 2731 yylval = yylval_param; 2732} 2733]]) 2734 2735m4_ifdef( [[<M4_YY_BISON_LLOC>]], 2736[[ 2737 m4_ifdef( [[M4_YY_NO_GET_LLOC]],, 2738 [[ 2739YYLTYPE *yyget_lloc (M4_YY_DEF_ONLY_ARG) 2740{ 2741 M4_YY_DECL_GUTS_VAR(); 2742 return yylloc; 2743} 2744 ]]) 2745 2746 m4_ifdef( [[M4_YY_NO_SET_LLOC]],, 2747 [[ 2748void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param) 2749{ 2750 M4_YY_DECL_GUTS_VAR(); 2751 yylloc = yylloc_param; 2752} 2753 ]]) 2754]]) 2755 2756%endif 2757 2758 2759/* User-visible API */ 2760 2761/* yylex_init is special because it creates the scanner itself, so it is 2762 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2763 * That's why we explicitly handle the declaration, instead of using our macros. 2764 */ 2765int yylex_init(yyscan_t* ptr_yy_globals) 2766{ 2767 if (ptr_yy_globals == NULL){ 2768 errno = EINVAL; 2769 return 1; 2770 } 2771 2772 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); 2773 2774 if (*ptr_yy_globals == NULL){ 2775 errno = ENOMEM; 2776 return 1; 2777 } 2778 2779 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2780 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2781 2782 return yy_init_globals ( *ptr_yy_globals ); 2783} 2784 2785 2786/* yylex_init_extra has the same functionality as yylex_init, but follows the 2787 * convention of taking the scanner as the last argument. Note however, that 2788 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2789 * is the reason, too, why this function also must handle its own declaration). 2790 * The user defined value in the first argument will be available to yyalloc in 2791 * the yyextra field. 2792 */ 2793int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) 2794{ 2795 struct yyguts_t dummy_yyguts; 2796 2797 yyset_extra (yy_user_defined, &dummy_yyguts); 2798 2799 if (ptr_yy_globals == NULL){ 2800 errno = EINVAL; 2801 return 1; 2802 } 2803 2804 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2805 2806 if (*ptr_yy_globals == NULL){ 2807 errno = ENOMEM; 2808 return 1; 2809 } 2810 2811 /* By setting to 0xAA, we expose bugs in 2812 yy_init_globals. Leave at 0x00 for releases. */ 2813 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2814 2815 yyset_extra (yy_user_defined, *ptr_yy_globals); 2816 2817 return yy_init_globals ( *ptr_yy_globals ); 2818} 2819 2820%endif if-c-only 2821%# Actually, that ended an if-rentrant section 2822 2823%if-c-only 2824static int yy_init_globals (M4_YY_DEF_ONLY_ARG) 2825{ 2826 M4_YY_DECL_GUTS_VAR(); 2827 /* Initialization is the same as for the non-reentrant scanner. 2828 * This function is called from yylex_destroy(), so don't allocate here. 2829 */ 2830 2831m4_ifdef( [[M4_YY_USE_LINENO]], 2832[[ 2833 m4_ifdef( [[M4_YY_NOT_REENTRANT]], 2834 [[ 2835 /* We do not touch yylineno unless the option is enabled. */ 2836 yylineno = 1; 2837 ]]) 2838]]) 2839 YY_G(yy_buffer_stack) = NULL; 2840 YY_G(yy_buffer_stack_top) = 0; 2841 YY_G(yy_buffer_stack_max) = 0; 2842 YY_G(yy_c_buf_p) = NULL; 2843 YY_G(yy_init) = 0; 2844 YY_G(yy_start) = 0; 2845 2846m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], 2847[[ 2848 YY_G(yy_start_stack_ptr) = 0; 2849 YY_G(yy_start_stack_depth) = 0; 2850 YY_G(yy_start_stack) = NULL; 2851]]) 2852 2853m4_ifdef( [[M4_YY_USES_REJECT]], 2854[[ 2855 YY_G(yy_state_buf) = 0; 2856 YY_G(yy_state_ptr) = 0; 2857 YY_G(yy_full_match) = 0; 2858 YY_G(yy_lp) = 0; 2859]]) 2860 2861m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], 2862[[ 2863 YY_G(yytext_ptr) = 0; 2864 YY_G(yy_more_offset) = 0; 2865 YY_G(yy_prev_more_offset) = 0; 2866]]) 2867 2868/* Defined in main.c */ 2869#ifdef YY_STDINIT 2870 yyin = stdin; 2871 yyout = stdout; 2872#else 2873 yyin = NULL; 2874 yyout = NULL; 2875#endif 2876 2877 /* For future reference: Set errno on error, since we are called by 2878 * yylex_init() 2879 */ 2880 return 0; 2881} 2882%endif 2883 2884 2885%if-c-only SNIP! this currently causes conflicts with the c++ scanner 2886/* yylex_destroy is for both reentrant and non-reentrant scanners. */ 2887int yylex_destroy (M4_YY_DEF_ONLY_ARG) 2888{ 2889 M4_YY_DECL_GUTS_VAR(); 2890 2891 /* Pop the buffer stack, destroying each element. */ 2892 while(YY_CURRENT_BUFFER){ 2893 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG ); 2894 YY_CURRENT_BUFFER_LVALUE = NULL; 2895 yypop_buffer_state(M4_YY_CALL_ONLY_ARG); 2896 } 2897 2898 /* Destroy the stack itself. */ 2899 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG); 2900 YY_G(yy_buffer_stack) = NULL; 2901 2902m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], 2903[[ 2904 /* Destroy the start condition stack. */ 2905 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG ); 2906 YY_G(yy_start_stack) = NULL; 2907]]) 2908 2909m4_ifdef( [[M4_YY_USES_REJECT]], 2910[[ 2911 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG); 2912 YY_G(yy_state_buf) = NULL; 2913]]) 2914 2915 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2916 * yylex() is called, initialization will occur. */ 2917 yy_init_globals( M4_YY_CALL_ONLY_ARG); 2918 2919%if-reentrant 2920 /* Destroy the main struct (reentrant only). */ 2921 yyfree ( yyscanner M4_YY_CALL_LAST_ARG ); 2922 yyscanner = NULL; 2923%endif 2924 return 0; 2925} 2926%endif 2927 2928 2929m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 2930[[ 2931/* 2932 * Internal utility routines. 2933 */ 2934]]) 2935 2936m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 2937[[ 2938#ifndef yytext_ptr 2939static void yy_flex_strncpy YYFARGS3( char*,s1, const char *,s2, int,n) 2940{ 2941 M4_YY_DECL_GUTS_VAR(); 2942 M4_YY_NOOP_GUTS_VAR(); 2943 2944 int i; 2945 for ( i = 0; i < n; ++i ) 2946 s1[i] = s2[i]; 2947} 2948#endif 2949]]) 2950 2951m4_ifdef( [[M4_YY_NOT_IN_HEADER]], 2952[[ 2953#ifdef YY_NEED_STRLEN 2954static int yy_flex_strlen YYFARGS1( const char *,s) 2955{ 2956 int n; 2957 for ( n = 0; s[n]; ++n ) 2958 ; 2959 2960 return n; 2961} 2962#endif 2963]]) 2964 2965m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],, 2966[[ 2967void *yyalloc YYFARGS1( yy_size_t ,size) 2968{ 2969 M4_YY_DECL_GUTS_VAR(); 2970 M4_YY_NOOP_GUTS_VAR(); 2971 return malloc(size); 2972} 2973]]) 2974 2975m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],, 2976[[ 2977void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size) 2978{ 2979 M4_YY_DECL_GUTS_VAR(); 2980 M4_YY_NOOP_GUTS_VAR(); 2981 2982 /* The cast to (char *) in the following accommodates both 2983 * implementations that use char* generic pointers, and those 2984 * that use void* generic pointers. It works with the latter 2985 * because both ANSI C and C++ allow castless assignment from 2986 * any pointer type to void*, and deal with argument conversions 2987 * as though doing an assignment. 2988 */ 2989 return realloc(ptr, size); 2990} 2991]]) 2992 2993m4_ifdef( [[M4_YY_NO_FLEX_FREE]],, 2994[[ 2995void yyfree YYFARGS1( void *,ptr) 2996{ 2997 M4_YY_DECL_GUTS_VAR(); 2998 M4_YY_NOOP_GUTS_VAR(); 2999 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 3000} 3001]]) 3002 3003%if-tables-serialization definitions 3004m4preproc_include(`tables_shared.c') 3005 3006static int yytbl_read8 (void *v, struct yytbl_reader * rd) 3007{ 3008 errno = 0; 3009 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){ 3010 errno = EIO; 3011 return -1; 3012 } 3013 rd->bread += (flex_uint32_t) sizeof(flex_uint8_t); 3014 return 0; 3015} 3016 3017static int yytbl_read16 (void *v, struct yytbl_reader * rd) 3018{ 3019 errno = 0; 3020 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){ 3021 errno = EIO; 3022 return -1; 3023 } 3024 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v)); 3025 rd->bread += (flex_uint32_t) sizeof(flex_uint16_t); 3026 return 0; 3027} 3028 3029static int yytbl_read32 (void *v, struct yytbl_reader * rd) 3030{ 3031 errno = 0; 3032 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){ 3033 errno = EIO; 3034 return -1; 3035 } 3036 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v)); 3037 rd->bread += (flex_uint32_t) sizeof(flex_uint32_t); 3038 return 0; 3039} 3040 3041/** Read the header */ 3042static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd) 3043{ 3044 size_t bytes; 3045 memset (th, 0, sizeof (struct yytbl_hdr)); 3046 3047 if (yytbl_read32 (&(th->th_magic), rd) != 0) 3048 return -1; 3049 3050 if (th->th_magic != YYTBL_MAGIC){ 3051 YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */ 3052 return -1; 3053 } 3054 3055 if (yytbl_read32 (&(th->th_hsize), rd) != 0 3056 || yytbl_read32 (&(th->th_ssize), rd) != 0 3057 || yytbl_read16 (&(th->th_flags), rd) != 0) 3058 return -1; 3059 3060 /* Sanity check on header size. Greater than 1k suggests some funny business. */ 3061 if (th->th_hsize < 16 || th->th_hsize > 1024){ 3062 YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */ 3063 return -1; 3064 } 3065 3066 /* Allocate enough space for the version and name fields */ 3067 bytes = th->th_hsize - 14; 3068 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG); 3069 if ( ! th->th_version ) 3070 YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" ); 3071 3072 /* we read it all into th_version, and point th_name into that data */ 3073 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){ 3074 errno = EIO; 3075 yyfree(th->th_version M4_YY_CALL_LAST_ARG); 3076 th->th_version = NULL; 3077 return -1; 3078 } 3079 else 3080 rd->bread += (flex_uint32_t) bytes; 3081 3082 th->th_name = th->th_version + strlen (th->th_version) + 1; 3083 return 0; 3084} 3085 3086/** lookup id in the dmap list. 3087 * @param dmap pointer to first element in list 3088 * @return NULL if not found. 3089 */ 3090static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap, 3091 int, id) 3092{ 3093 M4_YY_DECL_GUTS_VAR(); 3094 M4_YY_NOOP_GUTS_VAR(); 3095 3096 while (dmap->dm_id) 3097 if ((int)(dmap->dm_id) == id) 3098 return dmap; 3099 else 3100 dmap++; 3101 return NULL; 3102} 3103 3104/** Read a table while mapping its contents to the local array. 3105 * @param dmap used to performing mapping 3106 * @return 0 on success 3107 */ 3108static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd) 3109{ 3110 struct yytbl_data td; 3111 struct yytbl_dmap *transdmap=0; 3112 int len, i, rv, inner_loop_count; 3113 void *p=0; 3114 3115 memset (&td, 0, sizeof (struct yytbl_data)); 3116 3117 if (yytbl_read16 (&td.td_id, rd) != 0 3118 || yytbl_read16 (&td.td_flags, rd) != 0 3119 || yytbl_read32 (&td.td_hilen, rd) != 0 3120 || yytbl_read32 (&td.td_lolen, rd) != 0) 3121 return -1; 3122 3123 /* Lookup the map for the transition table so we have it in case we need it 3124 * inside the loop below. This scanner might not even have a transition 3125 * table, which is ok. 3126 */ 3127 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG); 3128 3129 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){ 3130 YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */ 3131 return -1; 3132 } 3133 3134 /* Allocate space for table. 3135 * The --full yy_transition table is a special case, since we 3136 * need the dmap.dm_sz entry to tell us the sizeof the individual 3137 * struct members. 3138 */ 3139 { 3140 size_t bytes; 3141 3142 if ((td.td_flags & YYTD_STRUCT)) 3143 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1); 3144 else 3145 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz; 3146 3147 if(M4_YY_TABLES_VERIFY) 3148 /* We point to the array itself */ 3149 p = dmap->dm_arr; 3150 else 3151 /* We point to the address of a pointer. */ 3152 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG); 3153 if ( ! p ) 3154 YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" ); 3155 } 3156 3157 /* If it's a struct, we read 2 integers to get one element */ 3158 if ((td.td_flags & YYTD_STRUCT) != 0) 3159 inner_loop_count = 2; 3160 else 3161 inner_loop_count = 1; 3162 3163 /* read and map each element. 3164 * This loop iterates once for each element of the td_data array. 3165 * Notice that we increment 'i' in the inner loop. 3166 */ 3167 len = yytbl_calc_total_len (&td); 3168 for (i = 0; i < len; ){ 3169 int j; 3170 3171 3172 /* This loop really executes exactly 1 or 2 times. 3173 * The second time is to handle the second member of the 3174 * YYTD_STRUCT for the yy_transition array. 3175 */ 3176 for (j = 0; j < inner_loop_count; j++, i++) { 3177 flex_int32_t t32; 3178 3179 /* read into t32 no matter what the real size is. */ 3180 { 3181 flex_int16_t t16; 3182 flex_int8_t t8; 3183 3184 switch (YYTDFLAGS2BYTES (td.td_flags)) { 3185 case sizeof (flex_int32_t): 3186 rv = yytbl_read32 (&t32, rd); 3187 break; 3188 case sizeof (flex_int16_t): 3189 rv = yytbl_read16 (&t16, rd); 3190 t32 = t16; 3191 break; 3192 case sizeof (flex_int8_t): 3193 rv = yytbl_read8 (&t8, rd); 3194 t32 = t8; 3195 break; 3196 default: 3197 YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */ 3198 return -1; 3199 } 3200 } 3201 if (rv != 0) 3202 return -1; 3203 3204 /* copy into the deserialized array... */ 3205 3206 if ((td.td_flags & YYTD_STRUCT)) { 3207 /* t32 is the j'th member of a two-element struct. */ 3208 void *v; 3209 3210 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify) 3211 : &(((struct yy_trans_info *) p)->yy_nxt); 3212 3213 switch (dmap->dm_sz) { 3214 case sizeof (flex_int32_t): 3215 if (M4_YY_TABLES_VERIFY){ 3216 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32) 3217 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" ); 3218 }else 3219 ((flex_int32_t *) v)[0] = (flex_int32_t) t32; 3220 break; 3221 case sizeof (flex_int16_t): 3222 if (M4_YY_TABLES_VERIFY ){ 3223 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32) 3224 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" ); 3225 }else 3226 ((flex_int16_t *) v)[0] = (flex_int16_t) t32; 3227 break; 3228 case sizeof(flex_int8_t): 3229 if (M4_YY_TABLES_VERIFY ){ 3230 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32) 3231 YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" ); 3232 }else 3233 ((flex_int8_t *) v)[0] = (flex_int8_t) t32; 3234 break; 3235 default: 3236 YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */ 3237 return -1; 3238 } 3239 3240 /* if we're done with j, increment p */ 3241 if (j == 1) 3242 p = (struct yy_trans_info *) p + 1; 3243 } 3244 else if ((td.td_flags & YYTD_PTRANS)) { 3245 /* t32 is an index into the transition array. */ 3246 struct yy_trans_info *v; 3247 3248 3249 if (!transdmap){ 3250 YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */ 3251 return -1; 3252 } 3253 3254 if( M4_YY_TABLES_VERIFY) 3255 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]); 3256 else 3257 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]); 3258 3259 if(M4_YY_TABLES_VERIFY ){ 3260 if( ((struct yy_trans_info **) p)[0] != v) 3261 YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" ); 3262 }else 3263 ((struct yy_trans_info **) p)[0] = v; 3264 3265 /* increment p */ 3266 p = (struct yy_trans_info **) p + 1; 3267 } 3268 else { 3269 /* t32 is a plain int. copy data, then incrememnt p. */ 3270 switch (dmap->dm_sz) { 3271 case sizeof (flex_int32_t): 3272 if(M4_YY_TABLES_VERIFY ){ 3273 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32) 3274 YY_FATAL_ERROR( "tables verification failed at flex_int32_t" ); 3275 }else 3276 ((flex_int32_t *) p)[0] = (flex_int32_t) t32; 3277 p = ((flex_int32_t *) p) + 1; 3278 break; 3279 case sizeof (flex_int16_t): 3280 if(M4_YY_TABLES_VERIFY ){ 3281 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32) 3282 YY_FATAL_ERROR( "tables verification failed at flex_int16_t" ); 3283 }else 3284 ((flex_int16_t *) p)[0] = (flex_int16_t) t32; 3285 p = ((flex_int16_t *) p) + 1; 3286 break; 3287 case sizeof (flex_int8_t): 3288 if(M4_YY_TABLES_VERIFY ){ 3289 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32) 3290 YY_FATAL_ERROR( "tables verification failed at flex_int8_t" ); 3291 }else 3292 ((flex_int8_t *) p)[0] = (flex_int8_t) t32; 3293 p = ((flex_int8_t *) p) + 1; 3294 break; 3295 default: 3296 YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */ 3297 return -1; 3298 } 3299 } 3300 } 3301 3302 } 3303 3304 /* Now eat padding. */ 3305 { 3306 int pad; 3307 pad = yypad64(rd->bread); 3308 while(--pad >= 0){ 3309 flex_int8_t t8; 3310 if(yytbl_read8(&t8,rd) != 0) 3311 return -1; 3312 } 3313 } 3314 3315 return 0; 3316} 3317 3318%define-yytables The name for this specific scanner's tables. 3319 3320/* Find the key and load the DFA tables from the given stream. */ 3321static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key) 3322{ 3323 int rv=0; 3324 struct yytbl_hdr th; 3325 struct yytbl_reader rd; 3326 3327 rd.fp = fp; 3328 th.th_version = NULL; 3329 3330 /* Keep trying until we find the right set of tables or end of file. */ 3331 while (!feof(rd.fp)) { 3332 rd.bread = 0; 3333 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){ 3334 rv = -1; 3335 goto return_rv; 3336 } 3337 3338 /* A NULL key means choose the first set of tables. */ 3339 if (key == NULL) 3340 break; 3341 3342 if (strcmp(th.th_name,key) != 0){ 3343 /* Skip ahead to next set */ 3344 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR); 3345 yyfree(th.th_version M4_YY_CALL_LAST_ARG); 3346 th.th_version = NULL; 3347 } 3348 else 3349 break; 3350 } 3351 3352 while (rd.bread < th.th_ssize){ 3353 /* Load the data tables */ 3354 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){ 3355 rv = -1; 3356 goto return_rv; 3357 } 3358 } 3359 3360return_rv: 3361 if(th.th_version){ 3362 yyfree(th.th_version M4_YY_CALL_LAST_ARG); 3363 th.th_version = NULL; 3364 } 3365 3366 return rv; 3367} 3368 3369/** Load the DFA tables for this scanner from the given stream. */ 3370int yytables_fload YYFARGS1(FILE *, fp) 3371{ 3372 3373 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0) 3374 return -1; 3375 return 0; 3376} 3377 3378/** Destroy the loaded tables, freeing memory, etc.. */ 3379int yytables_destroy (M4_YY_DEF_ONLY_ARG) 3380{ 3381 struct yytbl_dmap *dmap=0; 3382 3383 if(!M4_YY_TABLES_VERIFY){ 3384 /* Walk the dmap, freeing the pointers */ 3385 for(dmap=yydmap; dmap->dm_id; dmap++) { 3386 void * v; 3387 v = dmap->dm_arr; 3388 if(v && *(char**)v){ 3389 yyfree(*(char**)v M4_YY_CALL_LAST_ARG); 3390 *(char**)v = NULL; 3391 } 3392 } 3393 } 3394 3395 return 0; 3396} 3397 3398/* end table serialization code definitions */ 3399%endif 3400 3401 3402m4_ifdef([[M4_YY_MAIN]], [[ 3403int main (void); 3404 3405int main () 3406{ 3407 3408%if-reentrant 3409 yyscan_t lexer; 3410 yylex_init(&lexer); 3411 yylex( lexer ); 3412 yylex_destroy( lexer); 3413 3414%endif 3415%if-not-reentrant 3416 yylex(); 3417%endif 3418 3419 return 0; 3420} 3421]]) 3422 3423%ok-for-header 3424m4_ifdef( [[M4_YY_IN_HEADER]], 3425[[ 3426#undef YY_NEW_FILE 3427#undef YY_FLUSH_BUFFER 3428#undef yy_set_bol 3429#undef yy_new_buffer 3430#undef yy_set_interactive 3431#undef YY_DO_BEFORE_ACTION 3432 3433#ifdef YY_DECL_IS_OURS 3434#undef YY_DECL_IS_OURS 3435#undef YY_DECL 3436#endif 3437m4preproc_undivert(1) 3438]]) 3439