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