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