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