1#line 2 "util_expr_scan.c" 2 3#line 4 "util_expr_scan.c" 4 5#define YY_INT_ALIGNED short int 6 7/* A lexical scanner generated by flex */ 8 9#define FLEX_SCANNER 10#define YY_FLEX_MAJOR_VERSION 2 11#define YY_FLEX_MINOR_VERSION 5 12#define YY_FLEX_SUBMINOR_VERSION 35 13#if YY_FLEX_SUBMINOR_VERSION > 0 14#define FLEX_BETA 15#endif 16 17/* First, we deal with platform-specific or compiler-specific issues. */ 18 19/* begin standard C headers. */ 20#include <stdio.h> 21#include <string.h> 22#include <errno.h> 23#include <stdlib.h> 24 25/* end standard C headers. */ 26 27/* flex integer type definitions */ 28 29#ifndef FLEXINT_H 30#define FLEXINT_H 31 32/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 33 34#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 35 36/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 37 * if you want the limit (max/min) macros for int types. 38 */ 39#ifndef __STDC_LIMIT_MACROS 40#define __STDC_LIMIT_MACROS 1 41#endif 42 43#include <inttypes.h> 44typedef int8_t flex_int8_t; 45typedef uint8_t flex_uint8_t; 46typedef int16_t flex_int16_t; 47typedef uint16_t flex_uint16_t; 48typedef int32_t flex_int32_t; 49typedef uint32_t flex_uint32_t; 50#else 51typedef signed char flex_int8_t; 52typedef short int flex_int16_t; 53typedef int flex_int32_t; 54typedef unsigned char flex_uint8_t; 55typedef unsigned short int flex_uint16_t; 56typedef unsigned int flex_uint32_t; 57 58/* Limits of integral types. */ 59#ifndef INT8_MIN 60#define INT8_MIN (-128) 61#endif 62#ifndef INT16_MIN 63#define INT16_MIN (-32767-1) 64#endif 65#ifndef INT32_MIN 66#define INT32_MIN (-2147483647-1) 67#endif 68#ifndef INT8_MAX 69#define INT8_MAX (127) 70#endif 71#ifndef INT16_MAX 72#define INT16_MAX (32767) 73#endif 74#ifndef INT32_MAX 75#define INT32_MAX (2147483647) 76#endif 77#ifndef UINT8_MAX 78#define UINT8_MAX (255U) 79#endif 80#ifndef UINT16_MAX 81#define UINT16_MAX (65535U) 82#endif 83#ifndef UINT32_MAX 84#define UINT32_MAX (4294967295U) 85#endif 86 87#endif /* ! C99 */ 88 89#endif /* ! FLEXINT_H */ 90 91#ifdef __cplusplus 92 93/* The "const" storage-class-modifier is valid. */ 94#define YY_USE_CONST 95 96#else /* ! __cplusplus */ 97 98/* C99 requires __STDC__ to be defined as 1. */ 99#if defined (__STDC__) 100 101#define YY_USE_CONST 102 103#endif /* defined (__STDC__) */ 104#endif /* ! __cplusplus */ 105 106#ifdef YY_USE_CONST 107#define yyconst const 108#else 109#define yyconst 110#endif 111 112/* Returned upon end-of-file. */ 113#define YY_NULL 0 114 115/* Promotes a possibly negative, possibly signed char to an unsigned 116 * integer for use as an array index. If the signed char is negative, 117 * we want to instead treat it as an 8-bit unsigned char, hence the 118 * double cast. 119 */ 120#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 121 122/* An opaque pointer. */ 123#ifndef YY_TYPEDEF_YY_SCANNER_T 124#define YY_TYPEDEF_YY_SCANNER_T 125typedef void* yyscan_t; 126#endif 127 128/* For convenience, these vars (plus the bison vars far below) 129 are macros in the reentrant scanner. */ 130#define yyin yyg->yyin_r 131#define yyout yyg->yyout_r 132#define yyextra yyg->yyextra_r 133#define yyleng yyg->yyleng_r 134#define yytext yyg->yytext_r 135#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 136#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 137#define yy_flex_debug yyg->yy_flex_debug_r 138 139/* Enter a start condition. This macro really ought to take a parameter, 140 * but we do it the disgusting crufty way forced on us by the ()-less 141 * definition of BEGIN. 142 */ 143#define BEGIN yyg->yy_start = 1 + 2 * 144 145/* Translate the current start state into a value that can be later handed 146 * to BEGIN to return to the state. The YYSTATE alias is for lex 147 * compatibility. 148 */ 149#define YY_START ((yyg->yy_start - 1) / 2) 150#define YYSTATE YY_START 151 152/* Action number for EOF rule of a given start state. */ 153#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 154 155/* Special action meaning "start processing a new file". */ 156#define YY_NEW_FILE ap_expr_yyrestart(yyin ,yyscanner ) 157 158#define YY_END_OF_BUFFER_CHAR 0 159 160/* Size of default input buffer. */ 161#ifndef YY_BUF_SIZE 162#ifdef __ia64__ 163/* On IA-64, the buffer size is 16k, not 8k. 164 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 165 * Ditto for the __ia64__ case accordingly. 166 */ 167#define YY_BUF_SIZE 32768 168#else 169#define YY_BUF_SIZE 16384 170#endif /* __ia64__ */ 171#endif 172 173/* The state buf must be large enough to hold one state per character in the main buffer. 174 */ 175#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 176 177#ifndef YY_TYPEDEF_YY_BUFFER_STATE 178#define YY_TYPEDEF_YY_BUFFER_STATE 179typedef struct yy_buffer_state *YY_BUFFER_STATE; 180#endif 181 182#define EOB_ACT_CONTINUE_SCAN 0 183#define EOB_ACT_END_OF_FILE 1 184#define EOB_ACT_LAST_MATCH 2 185 186 #define YY_LESS_LINENO(n) 187 188/* Return all but the first "n" matched characters back to the input stream. */ 189#define yyless(n) \ 190 do \ 191 { \ 192 /* Undo effects of setting up yytext. */ \ 193 int yyless_macro_arg = (n); \ 194 YY_LESS_LINENO(yyless_macro_arg);\ 195 *yy_cp = yyg->yy_hold_char; \ 196 YY_RESTORE_YY_MORE_OFFSET \ 197 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 198 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 199 } \ 200 while ( 0 ) 201 202#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 203 204#ifndef YY_TYPEDEF_YY_SIZE_T 205#define YY_TYPEDEF_YY_SIZE_T 206typedef size_t yy_size_t; 207#endif 208 209#ifndef YY_STRUCT_YY_BUFFER_STATE 210#define YY_STRUCT_YY_BUFFER_STATE 211struct yy_buffer_state 212 { 213 FILE *yy_input_file; 214 215 char *yy_ch_buf; /* input buffer */ 216 char *yy_buf_pos; /* current position in input buffer */ 217 218 /* Size of input buffer in bytes, not including room for EOB 219 * characters. 220 */ 221 yy_size_t yy_buf_size; 222 223 /* Number of characters read into yy_ch_buf, not including EOB 224 * characters. 225 */ 226 int yy_n_chars; 227 228 /* Whether we "own" the buffer - i.e., we know we created it, 229 * and can realloc() it to grow it, and should free() it to 230 * delete it. 231 */ 232 int yy_is_our_buffer; 233 234 /* Whether this is an "interactive" input source; if so, and 235 * if we're using stdio for input, then we want to use getc() 236 * instead of fread(), to make sure we stop fetching input after 237 * each newline. 238 */ 239 int yy_is_interactive; 240 241 /* Whether we're considered to be at the beginning of a line. 242 * If so, '^' rules will be active on the next match, otherwise 243 * not. 244 */ 245 int yy_at_bol; 246 247 int yy_bs_lineno; /**< The line count. */ 248 int yy_bs_column; /**< The column count. */ 249 250 /* Whether to try to fill the input buffer when we reach the 251 * end of it. 252 */ 253 int yy_fill_buffer; 254 255 int yy_buffer_status; 256 257#define YY_BUFFER_NEW 0 258#define YY_BUFFER_NORMAL 1 259 /* When an EOF's been seen but there's still some text to process 260 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 261 * shouldn't try reading from the input source any more. We might 262 * still have a bunch of tokens to match, though, because of 263 * possible backing-up. 264 * 265 * When we actually see the EOF, we change the status to "new" 266 * (via ap_expr_yyrestart()), so that the user can continue scanning by 267 * just pointing yyin at a new input file. 268 */ 269#define YY_BUFFER_EOF_PENDING 2 270 271 }; 272#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 273 274/* We provide macros for accessing buffer states in case in the 275 * future we want to put the buffer states in a more general 276 * "scanner state". 277 * 278 * Returns the top of the stack, or NULL. 279 */ 280#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ 281 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ 282 : NULL) 283 284/* Same as previous macro, but useful when we know that the buffer stack is not 285 * NULL or when we need an lvalue. For internal use only. 286 */ 287#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] 288 289void ap_expr_yyrestart (FILE *input_file ,yyscan_t yyscanner ); 290void ap_expr_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 291YY_BUFFER_STATE ap_expr_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); 292void ap_expr_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 293void ap_expr_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 294void ap_expr_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 295void ap_expr_yypop_buffer_state (yyscan_t yyscanner ); 296 297static void ap_expr_yyensure_buffer_stack (yyscan_t yyscanner ); 298static void ap_expr_yy_load_buffer_state (yyscan_t yyscanner ); 299static void ap_expr_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 300 301#define YY_FLUSH_BUFFER ap_expr_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) 302 303YY_BUFFER_STATE ap_expr_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 304YY_BUFFER_STATE ap_expr_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 305YY_BUFFER_STATE ap_expr_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); 306 307void *ap_expr_yyalloc (yy_size_t ,yyscan_t yyscanner ); 308void *ap_expr_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); 309void ap_expr_yyfree (void * ,yyscan_t yyscanner ); 310 311#define yy_new_buffer ap_expr_yy_create_buffer 312 313#define yy_set_interactive(is_interactive) \ 314 { \ 315 if ( ! YY_CURRENT_BUFFER ){ \ 316 ap_expr_yyensure_buffer_stack (yyscanner); \ 317 YY_CURRENT_BUFFER_LVALUE = \ 318 ap_expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 319 } \ 320 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 321 } 322 323#define yy_set_bol(at_bol) \ 324 { \ 325 if ( ! YY_CURRENT_BUFFER ){\ 326 ap_expr_yyensure_buffer_stack (yyscanner); \ 327 YY_CURRENT_BUFFER_LVALUE = \ 328 ap_expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 329 } \ 330 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 331 } 332 333#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 334 335/* Begin user sect3 */ 336 337#define ap_expr_yywrap(n) 1 338#define YY_SKIP_YYWRAP 339 340typedef unsigned char YY_CHAR; 341 342typedef int yy_state_type; 343 344#define yytext_ptr yytext_r 345 346static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 347static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); 348static int yy_get_next_buffer (yyscan_t yyscanner ); 349static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 350 351/* Done after the current pattern has been matched and before the 352 * corresponding action - sets up yytext. 353 */ 354#define YY_DO_BEFORE_ACTION \ 355 yyg->yytext_ptr = yy_bp; \ 356 yyleng = (size_t) (yy_cp - yy_bp); \ 357 yyg->yy_hold_char = *yy_cp; \ 358 *yy_cp = '\0'; \ 359 yyg->yy_c_buf_p = yy_cp; 360 361#define YY_NUM_RULES 67 362#define YY_END_OF_BUFFER 68 363/* This struct is not used in this scanner, 364 but its presence is necessary. */ 365struct yy_trans_info 366 { 367 flex_int32_t yy_verify; 368 flex_int32_t yy_nxt; 369 }; 370static yyconst flex_int16_t yy_accept[124] = 371 { 0, 372 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 373 0, 0, 68, 66, 1, 43, 2, 66, 66, 66, 374 65, 66, 44, 26, 63, 32, 30, 34, 64, 64, 375 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 376 14, 4, 3, 17, 17, 67, 17, 23, 4, 22, 377 20, 21, 67, 16, 16, 24, 27, 29, 28, 1, 378 31, 37, 19, 18, 39, 63, 59, 59, 59, 59, 379 59, 59, 33, 30, 36, 35, 64, 64, 57, 64, 380 55, 54, 58, 53, 52, 25, 25, 56, 64, 40, 381 64, 41, 14, 13, 15, 12, 5, 6, 10, 11, 382 383 7, 8, 9, 20, 60, 46, 48, 50, 45, 49, 384 51, 47, 38, 64, 42, 64, 5, 6, 64, 61, 385 5, 62, 0 386 } ; 387 388static yyconst flex_int32_t yy_ec[256] = 389 { 0, 390 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 393 1, 2, 4, 5, 6, 7, 8, 9, 5, 10, 394 10, 1, 1, 11, 12, 13, 14, 15, 15, 15, 395 15, 15, 15, 15, 15, 16, 16, 17, 6, 18, 396 19, 20, 6, 1, 21, 21, 21, 21, 21, 21, 397 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 398 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 399 1, 22, 1, 6, 23, 1, 24, 25, 21, 26, 400 401 27, 28, 29, 21, 30, 21, 21, 31, 32, 33, 402 34, 21, 35, 36, 37, 38, 39, 21, 21, 21, 403 21, 21, 40, 41, 42, 43, 1, 1, 1, 1, 404 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 411 412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 417 1, 1, 1, 1, 1 418 } ; 419 420static yyconst flex_int32_t yy_meta[44] = 421 { 0, 422 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 423 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 424 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 425 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 426 1, 2, 1 427 } ; 428 429static yyconst flex_int16_t yy_base[133] = 430 { 0, 431 0, 0, 41, 47, 89, 0, 130, 136, 0, 0, 432 147, 146, 175, 275, 54, 28, 275, 43, 134, 164, 433 275, 164, 275, 275, 45, 152, 32, 151, 0, 136, 434 133, 143, 26, 133, 35, 194, 38, 129, 128, 122, 435 0, 275, 275, 51, 122, 221, 275, 275, 275, 275, 436 0, 275, 275, 61, 121, 275, 275, 275, 275, 76, 437 275, 275, 275, 275, 275, 65, 0, 125, 47, 126, 438 107, 130, 275, 275, 275, 275, 0, 130, 0, 124, 439 0, 0, 0, 0, 0, 275, 0, 0, 104, 0, 440 101, 275, 0, 275, 275, 275, 71, 131, 275, 275, 441 442 275, 275, 275, 0, 0, 0, 0, 0, 0, 0, 443 0, 0, 0, 99, 0, 61, 133, 135, 57, 0, 444 138, 0, 275, 259, 262, 265, 79, 67, 268, 271, 445 65, 42 446 } ; 447 448static yyconst flex_int16_t yy_def[133] = 449 { 0, 450 123, 1, 124, 124, 123, 5, 124, 124, 125, 125, 451 126, 126, 123, 123, 123, 123, 123, 123, 123, 123, 452 123, 127, 123, 123, 123, 123, 123, 123, 128, 128, 453 128, 128, 128, 128, 128, 128, 128, 128, 128, 123, 454 129, 123, 123, 123, 123, 130, 123, 123, 123, 123, 455 131, 123, 123, 123, 123, 123, 123, 123, 123, 123, 456 123, 123, 123, 123, 123, 123, 132, 132, 132, 132, 457 132, 132, 123, 123, 123, 123, 128, 128, 128, 128, 458 128, 128, 128, 128, 128, 123, 128, 128, 128, 128, 459 128, 123, 129, 123, 123, 123, 123, 123, 123, 123, 460 461 123, 123, 123, 131, 132, 132, 132, 132, 132, 132, 462 132, 132, 128, 128, 128, 128, 123, 123, 128, 128, 463 123, 128, 0, 123, 123, 123, 123, 123, 123, 123, 464 123, 123 465 } ; 466 467static yyconst flex_int16_t yy_nxt[319] = 468 { 0, 469 14, 15, 15, 16, 17, 14, 18, 19, 20, 21, 470 21, 22, 23, 24, 25, 25, 21, 26, 27, 28, 471 29, 14, 14, 30, 29, 29, 31, 32, 33, 34, 472 35, 36, 37, 38, 29, 29, 29, 39, 29, 21, 473 40, 21, 14, 42, 105, 43, 61, 44, 45, 42, 474 74, 43, 81, 44, 45, 60, 60, 63, 63, 66, 475 66, 84, 46, 82, 88, 94, 94, 104, 46, 77, 476 62, 89, 85, 107, 75, 94, 94, 60, 60, 66, 477 66, 67, 47, 122, 108, 117, 118, 120, 47, 48, 478 48, 49, 48, 48, 48, 48, 48, 48, 48, 48, 479 480 48, 48, 48, 48, 48, 50, 48, 48, 48, 51, 481 48, 48, 51, 51, 51, 51, 51, 51, 51, 51, 482 51, 51, 51, 51, 51, 51, 51, 51, 48, 48, 483 52, 48, 42, 110, 53, 119, 54, 55, 42, 116, 484 53, 115, 54, 55, 111, 118, 118, 121, 118, 118, 485 118, 46, 118, 118, 114, 113, 112, 46, 109, 106, 486 95, 95, 92, 91, 90, 83, 80, 79, 78, 76, 487 73, 56, 65, 64, 123, 59, 59, 56, 66, 66, 488 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 489 68, 123, 69, 70, 71, 123, 72, 86, 86, 86, 490 491 86, 86, 123, 123, 86, 86, 86, 86, 123, 123, 492 86, 123, 123, 123, 123, 123, 87, 123, 123, 123, 493 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 494 123, 123, 123, 123, 86, 97, 98, 123, 123, 123, 495 123, 123, 123, 123, 123, 99, 123, 123, 100, 123, 496 123, 123, 123, 101, 123, 123, 102, 123, 103, 41, 497 41, 41, 57, 57, 57, 58, 58, 58, 93, 123, 498 93, 96, 96, 96, 13, 123, 123, 123, 123, 123, 499 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 500 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 501 502 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 503 123, 123, 123, 123, 123, 123, 123, 123 504 } ; 505 506static yyconst flex_int16_t yy_chk[319] = 507 { 0, 508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 509 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 510 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 511 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 512 1, 1, 1, 3, 132, 3, 16, 3, 3, 4, 513 27, 4, 33, 4, 4, 15, 15, 18, 18, 25, 514 25, 35, 3, 33, 37, 44, 44, 131, 4, 128, 515 16, 37, 35, 69, 27, 54, 54, 60, 60, 66, 516 66, 127, 3, 119, 69, 97, 97, 116, 4, 5, 517 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 518 519 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 520 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 521 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 522 5, 5, 7, 71, 7, 114, 7, 7, 8, 91, 523 8, 89, 8, 8, 71, 98, 98, 117, 117, 118, 524 118, 7, 121, 121, 80, 78, 72, 8, 70, 68, 525 55, 45, 40, 39, 38, 34, 32, 31, 30, 28, 526 26, 7, 20, 19, 13, 12, 11, 8, 22, 22, 527 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 528 22, 0, 22, 22, 22, 0, 22, 36, 36, 36, 529 530 36, 36, 0, 0, 36, 36, 36, 36, 0, 0, 531 36, 0, 0, 0, 0, 0, 36, 0, 0, 0, 532 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 533 0, 0, 0, 0, 36, 46, 46, 0, 0, 0, 534 0, 0, 0, 0, 0, 46, 0, 0, 46, 0, 535 0, 0, 0, 46, 0, 0, 46, 0, 46, 124, 536 124, 124, 125, 125, 125, 126, 126, 126, 129, 0, 537 129, 130, 130, 130, 123, 123, 123, 123, 123, 123, 538 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 539 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 540 541 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 542 123, 123, 123, 123, 123, 123, 123, 123 543 } ; 544 545/* The intent behind this definition is that it'll catch 546 * any uses of REJECT which flex missed. 547 */ 548#define REJECT reject_used_but_not_detected 549#define yymore() yymore_used_but_not_detected 550#define YY_MORE_ADJ 0 551#define YY_RESTORE_YY_MORE_OFFSET 552#line 1 "util_expr_scan.l" 553/* Licensed to the Apache Software Foundation (ASF) under one or more 554 * contributor license agreements. See the NOTICE file distributed with 555 * this work for additional information regarding copyright ownership. 556 * The ASF licenses this file to You under the Apache License, Version 2.0 557 * (the "License"); you may not use this file except in compliance with 558 * the License. You may obtain a copy of the License at 559 * 560 * http://www.apache.org/licenses/LICENSE-2.0 561 * 562 * Unless required by applicable law or agreed to in writing, software 563 * distributed under the License is distributed on an "AS IS" BASIS, 564 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 565 * See the License for the specific language governing permissions and 566 * limitations under the License. 567 */ 568/* 569 * ap_expr_scan.l, based on ssl_expr_scan.l from mod_ssl 570 */ 571/* _________________________________________________________________ 572** 573** Expression Scanner 574** _________________________________________________________________ 575*/ 576#define YY_NO_INPUT 1 577 578 579 580 581#line 43 "util_expr_scan.l" 582#include "util_expr_private.h" 583#include "util_expr_parse.h" 584 585#undef YY_INPUT 586#define YY_INPUT(buf,result,max_size) \ 587{ \ 588 if ((result = MIN(max_size, yyextra->inputbuf \ 589 + yyextra->inputlen \ 590 - yyextra->inputptr)) <= 0) \ 591 { \ 592 result = YY_NULL; \ 593 } \ 594 else { \ 595 memcpy(buf, yyextra->inputptr, result); \ 596 yyextra->inputptr += result; \ 597 } \ 598} 599 600#define YY_EXTRA_TYPE ap_expr_parse_ctx_t* 601 602#define PERROR(msg) do { yyextra->error2 = msg ; return T_ERROR; } while (0) 603 604#define str_ptr (yyextra->scan_ptr) 605#define str_buf (yyextra->scan_buf) 606#define str_del (yyextra->scan_del) 607 608#define STR_APPEND(c) do { \ 609 *str_ptr++ = (c); \ 610 if (str_ptr >= str_buf + sizeof(str_buf)) \ 611 PERROR("String too long"); \ 612 } while (0) 613 614#line 615 "util_expr_scan.c" 615 616#define INITIAL 0 617#define str 1 618#define var 2 619#define vararg 3 620#define regex 4 621#define regex_flags 5 622 623#ifndef YY_NO_UNISTD_H 624/* Special case for "unistd.h", since it is non-ANSI. We include it way 625 * down here because we want the user's section 1 to have been scanned first. 626 * The user has a chance to override it with an option. 627 */ 628#include <unistd.h> 629#endif 630 631#ifndef YY_EXTRA_TYPE 632#define YY_EXTRA_TYPE void * 633#endif 634 635/* Holds the entire state of the reentrant scanner. */ 636struct yyguts_t 637 { 638 639 /* User-defined. Not touched by flex. */ 640 YY_EXTRA_TYPE yyextra_r; 641 642 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 643 FILE *yyin_r, *yyout_r; 644 size_t yy_buffer_stack_top; /**< index of top of stack. */ 645 size_t yy_buffer_stack_max; /**< capacity of stack. */ 646 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 647 char yy_hold_char; 648 int yy_n_chars; 649 int yyleng_r; 650 char *yy_c_buf_p; 651 int yy_init; 652 int yy_start; 653 int yy_did_buffer_switch_on_eof; 654 int yy_start_stack_ptr; 655 int yy_start_stack_depth; 656 int *yy_start_stack; 657 yy_state_type yy_last_accepting_state; 658 char* yy_last_accepting_cpos; 659 660 int yylineno_r; 661 int yy_flex_debug_r; 662 663 char *yytext_r; 664 int yy_more_flag; 665 int yy_more_len; 666 667 YYSTYPE * yylval_r; 668 669 }; /* end struct yyguts_t */ 670 671static int yy_init_globals (yyscan_t yyscanner ); 672 673 /* This must go here because YYSTYPE and YYLTYPE are included 674 * from bison output in section 1.*/ 675 # define yylval yyg->yylval_r 676 677int ap_expr_yylex_init (yyscan_t* scanner); 678 679int ap_expr_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); 680 681/* Accessor methods to globals. 682 These are made visible to non-reentrant scanners for convenience. */ 683 684int ap_expr_yylex_destroy (yyscan_t yyscanner ); 685 686int ap_expr_yyget_debug (yyscan_t yyscanner ); 687 688void ap_expr_yyset_debug (int debug_flag ,yyscan_t yyscanner ); 689 690YY_EXTRA_TYPE ap_expr_yyget_extra (yyscan_t yyscanner ); 691 692void ap_expr_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 693 694FILE *ap_expr_yyget_in (yyscan_t yyscanner ); 695 696void ap_expr_yyset_in (FILE * in_str ,yyscan_t yyscanner ); 697 698FILE *ap_expr_yyget_out (yyscan_t yyscanner ); 699 700void ap_expr_yyset_out (FILE * out_str ,yyscan_t yyscanner ); 701 702int ap_expr_yyget_leng (yyscan_t yyscanner ); 703 704char *ap_expr_yyget_text (yyscan_t yyscanner ); 705 706int ap_expr_yyget_lineno (yyscan_t yyscanner ); 707 708void ap_expr_yyset_lineno (int line_number ,yyscan_t yyscanner ); 709 710YYSTYPE * ap_expr_yyget_lval (yyscan_t yyscanner ); 711 712void ap_expr_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); 713 714/* Macros after this point can all be overridden by user definitions in 715 * section 1. 716 */ 717 718#ifndef YY_SKIP_YYWRAP 719#ifdef __cplusplus 720extern "C" int ap_expr_yywrap (yyscan_t yyscanner ); 721#else 722extern int ap_expr_yywrap (yyscan_t yyscanner ); 723#endif 724#endif 725 726#ifndef yytext_ptr 727static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 728#endif 729 730#ifdef YY_NEED_STRLEN 731static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 732#endif 733 734#ifndef YY_NO_INPUT 735 736#ifdef __cplusplus 737static int yyinput (yyscan_t yyscanner ); 738#else 739static int input (yyscan_t yyscanner ); 740#endif 741 742#endif 743 744 static void yy_push_state (int new_state ,yyscan_t yyscanner); 745 746 static void yy_pop_state (yyscan_t yyscanner ); 747 748/* Amount of stuff to slurp up with each read. */ 749#ifndef YY_READ_BUF_SIZE 750#ifdef __ia64__ 751/* On IA-64, the buffer size is 16k, not 8k */ 752#define YY_READ_BUF_SIZE 16384 753#else 754#define YY_READ_BUF_SIZE 8192 755#endif /* __ia64__ */ 756#endif 757 758/* Copy whatever the last rule matched to the standard output. */ 759#ifndef ECHO 760/* This used to be an fputs(), but since the string might contain NUL's, 761 * we now use fwrite(). 762 */ 763#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 764#endif 765 766/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 767 * is returned in "result". 768 */ 769#ifndef YY_INPUT 770#define YY_INPUT(buf,result,max_size) \ 771 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 772 { \ 773 int c = '*'; \ 774 size_t n; \ 775 for ( n = 0; n < max_size && \ 776 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 777 buf[n] = (char) c; \ 778 if ( c == '\n' ) \ 779 buf[n++] = (char) c; \ 780 if ( c == EOF && ferror( yyin ) ) \ 781 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 782 result = n; \ 783 } \ 784 else \ 785 { \ 786 errno=0; \ 787 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 788 { \ 789 if( errno != EINTR) \ 790 { \ 791 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 792 break; \ 793 } \ 794 errno=0; \ 795 clearerr(yyin); \ 796 } \ 797 }\ 798\ 799 800#endif 801 802/* No semi-colon after return; correct usage is to write "yyterminate();" - 803 * we don't want an extra ';' after the "return" because that will cause 804 * some compilers to complain about unreachable statements. 805 */ 806#ifndef yyterminate 807#define yyterminate() return YY_NULL 808#endif 809 810/* Number of entries by which start-condition stack grows. */ 811#ifndef YY_START_STACK_INCR 812#define YY_START_STACK_INCR 25 813#endif 814 815/* Report a fatal error. */ 816#ifndef YY_FATAL_ERROR 817#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) 818#endif 819 820/* end tables serialization structures and prototypes */ 821 822/* Default declaration of generated scanner - a define so the user can 823 * easily add parameters. 824 */ 825#ifndef YY_DECL 826#define YY_DECL_IS_OURS 1 827 828extern int ap_expr_yylex \ 829 (YYSTYPE * yylval_param ,yyscan_t yyscanner); 830 831#define YY_DECL int ap_expr_yylex \ 832 (YYSTYPE * yylval_param , yyscan_t yyscanner) 833#endif /* !YY_DECL */ 834 835/* Code executed at the beginning of each rule, after yytext and yyleng 836 * have been set up. 837 */ 838#ifndef YY_USER_ACTION 839#define YY_USER_ACTION 840#endif 841 842/* Code executed at the end of each rule. */ 843#ifndef YY_BREAK 844#define YY_BREAK break; 845#endif 846 847#define YY_RULE_SETUP \ 848 YY_USER_ACTION 849 850/** The main scanner function which does all the work. 851 */ 852YY_DECL 853{ 854 register yy_state_type yy_current_state; 855 register char *yy_cp, *yy_bp; 856 register int yy_act; 857 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 858 859#line 78 "util_expr_scan.l" 860 861 862 char regex_buf[MAX_STRING_LEN]; 863 char *regex_ptr = NULL; 864 char regex_del = '\0'; 865 866 867 /* 868 * Set initial state for string expressions 869 */ 870 if (yyextra->at_start) { 871 yyextra->at_start = 0; 872 if (yyextra->flags & AP_EXPR_FLAG_STRING_RESULT) { 873 BEGIN(str); 874 return T_EXPR_STRING; 875 } 876 else { 877 return T_EXPR_BOOL; 878 } 879 } 880 881 882 /* 883 * Whitespaces 884 */ 885#line 886 "util_expr_scan.c" 886 887 yylval = yylval_param; 888 889 if ( !yyg->yy_init ) 890 { 891 yyg->yy_init = 1; 892 893#ifdef YY_USER_INIT 894 YY_USER_INIT; 895#endif 896 897 if ( ! yyg->yy_start ) 898 yyg->yy_start = 1; /* first start state */ 899 900 if ( ! yyin ) 901 yyin = stdin; 902 903 if ( ! yyout ) 904 yyout = stdout; 905 906 if ( ! YY_CURRENT_BUFFER ) { 907 ap_expr_yyensure_buffer_stack (yyscanner); 908 YY_CURRENT_BUFFER_LVALUE = 909 ap_expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 910 } 911 912 ap_expr_yy_load_buffer_state(yyscanner ); 913 } 914 915 while ( 1 ) /* loops until end-of-file is reached */ 916 { 917 yy_cp = yyg->yy_c_buf_p; 918 919 /* Support of yytext. */ 920 *yy_cp = yyg->yy_hold_char; 921 922 /* yy_bp points to the position in yy_ch_buf of the start of 923 * the current run. 924 */ 925 yy_bp = yy_cp; 926 927 yy_current_state = yyg->yy_start; 928yy_match: 929 do 930 { 931 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 932 if ( yy_accept[yy_current_state] ) 933 { 934 yyg->yy_last_accepting_state = yy_current_state; 935 yyg->yy_last_accepting_cpos = yy_cp; 936 } 937 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 938 { 939 yy_current_state = (int) yy_def[yy_current_state]; 940 if ( yy_current_state >= 124 ) 941 yy_c = yy_meta[(unsigned int) yy_c]; 942 } 943 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 944 ++yy_cp; 945 } 946 while ( yy_current_state != 123 ); 947 yy_cp = yyg->yy_last_accepting_cpos; 948 yy_current_state = yyg->yy_last_accepting_state; 949 950yy_find_action: 951 yy_act = yy_accept[yy_current_state]; 952 953 YY_DO_BEFORE_ACTION; 954 955do_action: /* This label is used only to access EOF actions. */ 956 957 switch ( yy_act ) 958 { /* beginning of action switch */ 959 case 0: /* must back up */ 960 /* undo the effects of YY_DO_BEFORE_ACTION */ 961 *yy_cp = yyg->yy_hold_char; 962 yy_cp = yyg->yy_last_accepting_cpos; 963 yy_current_state = yyg->yy_last_accepting_state; 964 goto yy_find_action; 965 966case 1: 967/* rule 1 can match eol */ 968YY_RULE_SETUP 969#line 103 "util_expr_scan.l" 970{ 971 /* NOP */ 972} 973 YY_BREAK 974/* 975 * strings ("..." and '...') 976 */ 977case 2: 978YY_RULE_SETUP 979#line 110 "util_expr_scan.l" 980{ 981 str_ptr = str_buf; 982 str_del = yytext[0]; 983 BEGIN(str); 984 return T_STR_BEGIN; 985} 986 YY_BREAK 987case 3: 988YY_RULE_SETUP 989#line 116 "util_expr_scan.l" 990{ 991 if (yytext[0] == str_del) { 992 if (YY_START == var) { 993 PERROR("Unterminated variable in string"); 994 } 995 else if (str_ptr == str_buf) { 996 BEGIN(INITIAL); 997 return T_STR_END; 998 } 999 else { 1000 /* return what we have so far and scan delimiter again */ 1001 *str_ptr = '\0'; 1002 yylval->cpVal = apr_pstrdup(yyextra->pool, str_buf); 1003 yyless(0); 1004 str_ptr = str_buf; 1005 return T_STRING; 1006 } 1007 } 1008 else { 1009 STR_APPEND(yytext[0]); 1010 } 1011} 1012 YY_BREAK 1013case 4: 1014/* rule 4 can match eol */ 1015YY_RULE_SETUP 1016#line 138 "util_expr_scan.l" 1017{ 1018 PERROR("Unterminated string or variable"); 1019} 1020 YY_BREAK 1021case YY_STATE_EOF(var): 1022case YY_STATE_EOF(vararg): 1023#line 141 "util_expr_scan.l" 1024{ 1025 PERROR("Unterminated string or variable"); 1026} 1027 YY_BREAK 1028case YY_STATE_EOF(str): 1029#line 144 "util_expr_scan.l" 1030{ 1031 if (!(yyextra->flags & AP_EXPR_FLAG_STRING_RESULT)) { 1032 PERROR("Unterminated string or variable"); 1033 } 1034 else { 1035 *str_ptr = '\0'; 1036 yylval->cpVal = apr_pstrdup(yyextra->pool, str_buf); 1037 str_ptr = str_buf; 1038 BEGIN(INITIAL); 1039 return T_STRING; 1040 } 1041} 1042 YY_BREAK 1043case 5: 1044YY_RULE_SETUP 1045#line 157 "util_expr_scan.l" 1046{ 1047 int result; 1048 1049 (void)sscanf(yytext+1, "%o", &result); 1050 if (result > 0xff) { 1051 PERROR("Escape sequence out of bound"); 1052 } 1053 else { 1054 STR_APPEND(result); 1055 } 1056} 1057 YY_BREAK 1058case 6: 1059YY_RULE_SETUP 1060#line 168 "util_expr_scan.l" 1061{ 1062 PERROR("Bad escape sequence"); 1063} 1064 YY_BREAK 1065case 7: 1066YY_RULE_SETUP 1067#line 171 "util_expr_scan.l" 1068{ STR_APPEND('\n'); } 1069 YY_BREAK 1070case 8: 1071YY_RULE_SETUP 1072#line 172 "util_expr_scan.l" 1073{ STR_APPEND('\r'); } 1074 YY_BREAK 1075case 9: 1076YY_RULE_SETUP 1077#line 173 "util_expr_scan.l" 1078{ STR_APPEND('\t'); } 1079 YY_BREAK 1080case 10: 1081YY_RULE_SETUP 1082#line 174 "util_expr_scan.l" 1083{ STR_APPEND('\b'); } 1084 YY_BREAK 1085case 11: 1086YY_RULE_SETUP 1087#line 175 "util_expr_scan.l" 1088{ STR_APPEND('\f'); } 1089 YY_BREAK 1090case 12: 1091/* rule 12 can match eol */ 1092YY_RULE_SETUP 1093#line 176 "util_expr_scan.l" 1094{ STR_APPEND(yytext[1]); } 1095 YY_BREAK 1096/* regexp backref inside string/arg */ 1097case 13: 1098YY_RULE_SETUP 1099#line 179 "util_expr_scan.l" 1100{ 1101 if (str_ptr != str_buf) { 1102 /* return what we have so far and scan '$x' again */ 1103 *str_ptr = '\0'; 1104 yylval->cpVal = apr_pstrdup(yyextra->pool, str_buf); 1105 str_ptr = str_buf; 1106 yyless(0); 1107 return T_STRING; 1108 } 1109 else { 1110 yylval->num = yytext[1] - '0'; 1111 return T_REGEX_BACKREF; 1112 } 1113} 1114 YY_BREAK 1115case 14: 1116YY_RULE_SETUP 1117#line 194 "util_expr_scan.l" 1118{ 1119 char *cp = yytext; 1120 while (*cp != '\0') { 1121 STR_APPEND(*cp); 1122 cp++; 1123 } 1124} 1125 YY_BREAK 1126/* variable inside string/arg */ 1127case 15: 1128YY_RULE_SETUP 1129#line 203 "util_expr_scan.l" 1130{ 1131 if (str_ptr != str_buf) { 1132 /* return what we have so far and scan '%{' again */ 1133 *str_ptr = '\0'; 1134 yylval->cpVal = apr_pstrdup(yyextra->pool, str_buf); 1135 yyless(0); 1136 str_ptr = str_buf; 1137 return T_STRING; 1138 } 1139 else { 1140 yy_push_state(var, yyscanner); 1141 return T_VAR_BEGIN; 1142 } 1143} 1144 YY_BREAK 1145case 16: 1146YY_RULE_SETUP 1147#line 218 "util_expr_scan.l" 1148{ 1149 STR_APPEND(yytext[0]); 1150} 1151 YY_BREAK 1152case 17: 1153YY_RULE_SETUP 1154#line 222 "util_expr_scan.l" 1155{ 1156 STR_APPEND(yytext[0]); 1157} 1158 YY_BREAK 1159case 18: 1160YY_RULE_SETUP 1161#line 226 "util_expr_scan.l" 1162{ 1163 yy_push_state(var, yyscanner); 1164 return T_VAR_BEGIN; 1165} 1166 YY_BREAK 1167case 19: 1168YY_RULE_SETUP 1169#line 231 "util_expr_scan.l" 1170{ 1171 yylval->num = yytext[1] - '0'; 1172 return T_REGEX_BACKREF; 1173} 1174 YY_BREAK 1175/* 1176 * fixed name variable expansion %{XXX} and function call in %{func:arg} syntax 1177 */ 1178case 20: 1179YY_RULE_SETUP 1180#line 239 "util_expr_scan.l" 1181{ 1182 yylval->cpVal = apr_pstrdup(yyextra->pool, yytext); 1183 return T_ID; 1184} 1185 YY_BREAK 1186case 21: 1187YY_RULE_SETUP 1188#line 244 "util_expr_scan.l" 1189{ 1190 yy_pop_state(yyscanner); 1191 return T_VAR_END; 1192} 1193 YY_BREAK 1194case 22: 1195YY_RULE_SETUP 1196#line 249 "util_expr_scan.l" 1197{ 1198 BEGIN(vararg); 1199 return yytext[0]; 1200} 1201 YY_BREAK 1202case 23: 1203/* rule 23 can match eol */ 1204YY_RULE_SETUP 1205#line 254 "util_expr_scan.l" 1206{ 1207 char *msg = apr_psprintf(yyextra->pool, 1208 "Invalid character in variable name '%c'", yytext[0]); 1209 PERROR(msg); 1210} 1211 YY_BREAK 1212case 24: 1213YY_RULE_SETUP 1214#line 260 "util_expr_scan.l" 1215{ 1216 if (str_ptr != str_buf) { 1217 /* return what we have so far and scan '}' again */ 1218 *str_ptr = '\0'; 1219 yylval->cpVal = apr_pstrdup(yyextra->pool, str_buf); 1220 str_ptr = str_buf; 1221 yyless(0); 1222 return T_STRING; 1223 } 1224 else { 1225 yy_pop_state(yyscanner); 1226 return T_VAR_END; 1227 } 1228} 1229 YY_BREAK 1230/* 1231 * Regular Expression 1232 */ 1233case 25: 1234YY_RULE_SETUP 1235#line 278 "util_expr_scan.l" 1236{ 1237 regex_del = yytext[1]; 1238 regex_ptr = regex_buf; 1239 BEGIN(regex); 1240} 1241 YY_BREAK 1242case 26: 1243YY_RULE_SETUP 1244#line 283 "util_expr_scan.l" 1245{ 1246 regex_del = yytext[0]; 1247 regex_ptr = regex_buf; 1248 BEGIN(regex); 1249} 1250 YY_BREAK 1251case 27: 1252/* rule 27 can match eol */ 1253YY_RULE_SETUP 1254#line 288 "util_expr_scan.l" 1255{ 1256 if (yytext[0] == regex_del) { 1257 *regex_ptr = '\0'; 1258 BEGIN(regex_flags); 1259 } 1260 else { 1261 *regex_ptr++ = yytext[0]; 1262 if (regex_ptr >= regex_buf + sizeof(regex_buf)) 1263 PERROR("Regexp too long"); 1264 } 1265} 1266 YY_BREAK 1267case 28: 1268YY_RULE_SETUP 1269#line 299 "util_expr_scan.l" 1270{ 1271 yylval->cpVal = apr_pstrdup(yyextra->pool, regex_buf); 1272 BEGIN(INITIAL); 1273 return T_REGEX_I; 1274} 1275 YY_BREAK 1276case 29: 1277/* rule 29 can match eol */ 1278YY_RULE_SETUP 1279#line 304 "util_expr_scan.l" 1280{ 1281 yylval->cpVal = apr_pstrdup(yyextra->pool, regex_buf); 1282 yyless(0); 1283 BEGIN(INITIAL); 1284 return T_REGEX; 1285} 1286 YY_BREAK 1287case YY_STATE_EOF(regex_flags): 1288#line 310 "util_expr_scan.l" 1289{ 1290 yylval->cpVal = apr_pstrdup(yyextra->pool, regex_buf); 1291 BEGIN(INITIAL); 1292 return T_REGEX; 1293} 1294 YY_BREAK 1295/* 1296 * Operators 1297 */ 1298case 30: 1299YY_RULE_SETUP 1300#line 319 "util_expr_scan.l" 1301{ return T_OP_STR_EQ; } 1302 YY_BREAK 1303case 31: 1304YY_RULE_SETUP 1305#line 320 "util_expr_scan.l" 1306{ return T_OP_STR_NE; } 1307 YY_BREAK 1308case 32: 1309YY_RULE_SETUP 1310#line 321 "util_expr_scan.l" 1311{ return T_OP_STR_LT; } 1312 YY_BREAK 1313case 33: 1314YY_RULE_SETUP 1315#line 322 "util_expr_scan.l" 1316{ return T_OP_STR_LE; } 1317 YY_BREAK 1318case 34: 1319YY_RULE_SETUP 1320#line 323 "util_expr_scan.l" 1321{ return T_OP_STR_GT; } 1322 YY_BREAK 1323case 35: 1324YY_RULE_SETUP 1325#line 324 "util_expr_scan.l" 1326{ return T_OP_STR_GE; } 1327 YY_BREAK 1328case 36: 1329YY_RULE_SETUP 1330#line 325 "util_expr_scan.l" 1331{ return T_OP_REG; } 1332 YY_BREAK 1333case 37: 1334YY_RULE_SETUP 1335#line 326 "util_expr_scan.l" 1336{ return T_OP_NRE; } 1337 YY_BREAK 1338case 38: 1339YY_RULE_SETUP 1340#line 327 "util_expr_scan.l" 1341{ return T_OP_AND; } 1342 YY_BREAK 1343case 39: 1344YY_RULE_SETUP 1345#line 328 "util_expr_scan.l" 1346{ return T_OP_AND; } 1347 YY_BREAK 1348case 40: 1349YY_RULE_SETUP 1350#line 329 "util_expr_scan.l" 1351{ return T_OP_OR; } 1352 YY_BREAK 1353case 41: 1354YY_RULE_SETUP 1355#line 330 "util_expr_scan.l" 1356{ return T_OP_OR; } 1357 YY_BREAK 1358case 42: 1359YY_RULE_SETUP 1360#line 331 "util_expr_scan.l" 1361{ return T_OP_NOT; } 1362 YY_BREAK 1363case 43: 1364YY_RULE_SETUP 1365#line 332 "util_expr_scan.l" 1366{ return T_OP_NOT; } 1367 YY_BREAK 1368case 44: 1369YY_RULE_SETUP 1370#line 333 "util_expr_scan.l" 1371{ return T_OP_CONCAT; } 1372 YY_BREAK 1373case 45: 1374YY_RULE_SETUP 1375#line 334 "util_expr_scan.l" 1376{ return T_OP_IN; } 1377 YY_BREAK 1378case 46: 1379YY_RULE_SETUP 1380#line 335 "util_expr_scan.l" 1381{ return T_OP_EQ; } 1382 YY_BREAK 1383case 47: 1384YY_RULE_SETUP 1385#line 336 "util_expr_scan.l" 1386{ return T_OP_NE; } 1387 YY_BREAK 1388case 48: 1389YY_RULE_SETUP 1390#line 337 "util_expr_scan.l" 1391{ return T_OP_GE; } 1392 YY_BREAK 1393case 49: 1394YY_RULE_SETUP 1395#line 338 "util_expr_scan.l" 1396{ return T_OP_LE; } 1397 YY_BREAK 1398case 50: 1399YY_RULE_SETUP 1400#line 339 "util_expr_scan.l" 1401{ return T_OP_GT; } 1402 YY_BREAK 1403case 51: 1404YY_RULE_SETUP 1405#line 340 "util_expr_scan.l" 1406{ return T_OP_LT; } 1407 YY_BREAK 1408/* for compatibility with ssl_expr */ 1409case 52: 1410YY_RULE_SETUP 1411#line 343 "util_expr_scan.l" 1412{ return T_OP_LT; } 1413 YY_BREAK 1414case 53: 1415YY_RULE_SETUP 1416#line 344 "util_expr_scan.l" 1417{ return T_OP_LE; } 1418 YY_BREAK 1419case 54: 1420YY_RULE_SETUP 1421#line 345 "util_expr_scan.l" 1422{ return T_OP_GT; } 1423 YY_BREAK 1424case 55: 1425YY_RULE_SETUP 1426#line 346 "util_expr_scan.l" 1427{ return T_OP_GE; } 1428 YY_BREAK 1429case 56: 1430YY_RULE_SETUP 1431#line 347 "util_expr_scan.l" 1432{ return T_OP_NE; } 1433 YY_BREAK 1434case 57: 1435YY_RULE_SETUP 1436#line 348 "util_expr_scan.l" 1437{ return T_OP_EQ; } 1438 YY_BREAK 1439case 58: 1440YY_RULE_SETUP 1441#line 349 "util_expr_scan.l" 1442{ return T_OP_IN; } 1443 YY_BREAK 1444case 59: 1445YY_RULE_SETUP 1446#line 351 "util_expr_scan.l" 1447{ 1448 yylval->cpVal = apr_pstrdup(yyextra->pool, yytext + 1); 1449 return T_OP_UNARY; 1450} 1451 YY_BREAK 1452case 60: 1453YY_RULE_SETUP 1454#line 356 "util_expr_scan.l" 1455{ 1456 yylval->cpVal = apr_pstrdup(yyextra->pool, yytext + 1); 1457 return T_OP_BINARY; 1458} 1459 YY_BREAK 1460/* 1461 * Specials 1462 */ 1463case 61: 1464YY_RULE_SETUP 1465#line 364 "util_expr_scan.l" 1466{ return T_TRUE; } 1467 YY_BREAK 1468case 62: 1469YY_RULE_SETUP 1470#line 365 "util_expr_scan.l" 1471{ return T_FALSE; } 1472 YY_BREAK 1473/* 1474 * Digits 1475 */ 1476case 63: 1477YY_RULE_SETUP 1478#line 370 "util_expr_scan.l" 1479{ 1480 yylval->cpVal = apr_pstrdup(yyextra->pool, yytext); 1481 return T_DIGIT; 1482} 1483 YY_BREAK 1484/* 1485 * Identifiers 1486 */ 1487case 64: 1488YY_RULE_SETUP 1489#line 378 "util_expr_scan.l" 1490{ 1491 yylval->cpVal = apr_pstrdup(yyextra->pool, yytext); 1492 return T_ID; 1493} 1494 YY_BREAK 1495/* 1496 * These are parts of the grammar and are returned as is 1497 */ 1498case 65: 1499YY_RULE_SETUP 1500#line 386 "util_expr_scan.l" 1501{ 1502 return yytext[0]; 1503} 1504 YY_BREAK 1505/* 1506 * Anything else is an error 1507 */ 1508case 66: 1509/* rule 66 can match eol */ 1510YY_RULE_SETUP 1511#line 393 "util_expr_scan.l" 1512{ 1513 char *msg = apr_psprintf(yyextra->pool, "Parse error near '%c'", yytext[0]); 1514 PERROR(msg); 1515} 1516 YY_BREAK 1517case 67: 1518YY_RULE_SETUP 1519#line 398 "util_expr_scan.l" 1520YY_FATAL_ERROR( "flex scanner jammed" ); 1521 YY_BREAK 1522#line 1523 "util_expr_scan.c" 1523case YY_STATE_EOF(INITIAL): 1524case YY_STATE_EOF(regex): 1525 yyterminate(); 1526 1527 case YY_END_OF_BUFFER: 1528 { 1529 /* Amount of text matched not including the EOB char. */ 1530 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1531 1532 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1533 *yy_cp = yyg->yy_hold_char; 1534 YY_RESTORE_YY_MORE_OFFSET 1535 1536 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1537 { 1538 /* We're scanning a new file or input source. It's 1539 * possible that this happened because the user 1540 * just pointed yyin at a new source and called 1541 * ap_expr_yylex(). If so, then we have to assure 1542 * consistency between YY_CURRENT_BUFFER and our 1543 * globals. Here is the right place to do so, because 1544 * this is the first action (other than possibly a 1545 * back-up) that will match for the new input source. 1546 */ 1547 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1548 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1549 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1550 } 1551 1552 /* Note that here we test for yy_c_buf_p "<=" to the position 1553 * of the first EOB in the buffer, since yy_c_buf_p will 1554 * already have been incremented past the NUL character 1555 * (since all states make transitions on EOB to the 1556 * end-of-buffer state). Contrast this with the test 1557 * in input(). 1558 */ 1559 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1560 { /* This was really a NUL. */ 1561 yy_state_type yy_next_state; 1562 1563 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1564 1565 yy_current_state = yy_get_previous_state( yyscanner ); 1566 1567 /* Okay, we're now positioned to make the NUL 1568 * transition. We couldn't have 1569 * yy_get_previous_state() go ahead and do it 1570 * for us because it doesn't know how to deal 1571 * with the possibility of jamming (and we don't 1572 * want to build jamming into it because then it 1573 * will run more slowly). 1574 */ 1575 1576 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1577 1578 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1579 1580 if ( yy_next_state ) 1581 { 1582 /* Consume the NUL. */ 1583 yy_cp = ++yyg->yy_c_buf_p; 1584 yy_current_state = yy_next_state; 1585 goto yy_match; 1586 } 1587 1588 else 1589 { 1590 yy_cp = yyg->yy_last_accepting_cpos; 1591 yy_current_state = yyg->yy_last_accepting_state; 1592 goto yy_find_action; 1593 } 1594 } 1595 1596 else switch ( yy_get_next_buffer( yyscanner ) ) 1597 { 1598 case EOB_ACT_END_OF_FILE: 1599 { 1600 yyg->yy_did_buffer_switch_on_eof = 0; 1601 1602 if ( ap_expr_yywrap(yyscanner ) ) 1603 { 1604 /* Note: because we've taken care in 1605 * yy_get_next_buffer() to have set up 1606 * yytext, we can now set up 1607 * yy_c_buf_p so that if some total 1608 * hoser (like flex itself) wants to 1609 * call the scanner after we return the 1610 * YY_NULL, it'll still work - another 1611 * YY_NULL will get returned. 1612 */ 1613 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1614 1615 yy_act = YY_STATE_EOF(YY_START); 1616 goto do_action; 1617 } 1618 1619 else 1620 { 1621 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1622 YY_NEW_FILE; 1623 } 1624 break; 1625 } 1626 1627 case EOB_ACT_CONTINUE_SCAN: 1628 yyg->yy_c_buf_p = 1629 yyg->yytext_ptr + yy_amount_of_matched_text; 1630 1631 yy_current_state = yy_get_previous_state( yyscanner ); 1632 1633 yy_cp = yyg->yy_c_buf_p; 1634 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1635 goto yy_match; 1636 1637 case EOB_ACT_LAST_MATCH: 1638 yyg->yy_c_buf_p = 1639 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 1640 1641 yy_current_state = yy_get_previous_state( yyscanner ); 1642 1643 yy_cp = yyg->yy_c_buf_p; 1644 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1645 goto yy_find_action; 1646 } 1647 break; 1648 } 1649 1650 default: 1651 YY_FATAL_ERROR( 1652 "fatal flex scanner internal error--no action found" ); 1653 } /* end of action switch */ 1654 } /* end of scanning one token */ 1655} /* end of ap_expr_yylex */ 1656 1657/* yy_get_next_buffer - try to read in a new buffer 1658 * 1659 * Returns a code representing an action: 1660 * EOB_ACT_LAST_MATCH - 1661 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1662 * EOB_ACT_END_OF_FILE - end of file 1663 */ 1664static int yy_get_next_buffer (yyscan_t yyscanner) 1665{ 1666 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1667 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1668 register char *source = yyg->yytext_ptr; 1669 register int number_to_move, i; 1670 int ret_val; 1671 1672 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 1673 YY_FATAL_ERROR( 1674 "fatal flex scanner internal error--end of buffer missed" ); 1675 1676 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1677 { /* Don't try to fill the buffer, so this is an EOF. */ 1678 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 1679 { 1680 /* We matched a single character, the EOB, so 1681 * treat this as a final EOF. 1682 */ 1683 return EOB_ACT_END_OF_FILE; 1684 } 1685 1686 else 1687 { 1688 /* We matched some text prior to the EOB, first 1689 * process it. 1690 */ 1691 return EOB_ACT_LAST_MATCH; 1692 } 1693 } 1694 1695 /* Try to read more data. */ 1696 1697 /* First move last chars to start of buffer. */ 1698 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 1699 1700 for ( i = 0; i < number_to_move; ++i ) 1701 *(dest++) = *(source++); 1702 1703 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1704 /* don't do the read, it's not guaranteed to return an EOF, 1705 * just force an EOF 1706 */ 1707 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 1708 1709 else 1710 { 1711 int num_to_read = 1712 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1713 1714 while ( num_to_read <= 0 ) 1715 { /* Not enough room in the buffer - grow it. */ 1716 1717 /* just a shorter name for the current buffer */ 1718 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1719 1720 int yy_c_buf_p_offset = 1721 (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 1722 1723 if ( b->yy_is_our_buffer ) 1724 { 1725 int new_size = b->yy_buf_size * 2; 1726 1727 if ( new_size <= 0 ) 1728 b->yy_buf_size += b->yy_buf_size / 8; 1729 else 1730 b->yy_buf_size *= 2; 1731 1732 b->yy_ch_buf = (char *) 1733 /* Include room in for 2 EOB chars. */ 1734 ap_expr_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 1735 } 1736 else 1737 /* Can't grow it, we don't own it. */ 1738 b->yy_ch_buf = 0; 1739 1740 if ( ! b->yy_ch_buf ) 1741 YY_FATAL_ERROR( 1742 "fatal error - scanner input buffer overflow" ); 1743 1744 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 1745 1746 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1747 number_to_move - 1; 1748 1749 } 1750 1751 if ( num_to_read > YY_READ_BUF_SIZE ) 1752 num_to_read = YY_READ_BUF_SIZE; 1753 1754 /* Read in more data. */ 1755 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1756 yyg->yy_n_chars, (size_t) num_to_read ); 1757 1758 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1759 } 1760 1761 if ( yyg->yy_n_chars == 0 ) 1762 { 1763 if ( number_to_move == YY_MORE_ADJ ) 1764 { 1765 ret_val = EOB_ACT_END_OF_FILE; 1766 ap_expr_yyrestart(yyin ,yyscanner); 1767 } 1768 1769 else 1770 { 1771 ret_val = EOB_ACT_LAST_MATCH; 1772 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1773 YY_BUFFER_EOF_PENDING; 1774 } 1775 } 1776 1777 else 1778 ret_val = EOB_ACT_CONTINUE_SCAN; 1779 1780 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1781 /* Extend the array by 50%, plus the number we really need. */ 1782 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 1783 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ap_expr_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 1784 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1785 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1786 } 1787 1788 yyg->yy_n_chars += number_to_move; 1789 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 1790 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 1791 1792 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1793 1794 return ret_val; 1795} 1796 1797/* yy_get_previous_state - get the state just before the EOB char was reached */ 1798 1799 static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 1800{ 1801 register yy_state_type yy_current_state; 1802 register char *yy_cp; 1803 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1804 1805 yy_current_state = yyg->yy_start; 1806 1807 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 1808 { 1809 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1810 if ( yy_accept[yy_current_state] ) 1811 { 1812 yyg->yy_last_accepting_state = yy_current_state; 1813 yyg->yy_last_accepting_cpos = yy_cp; 1814 } 1815 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1816 { 1817 yy_current_state = (int) yy_def[yy_current_state]; 1818 if ( yy_current_state >= 124 ) 1819 yy_c = yy_meta[(unsigned int) yy_c]; 1820 } 1821 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1822 } 1823 1824 return yy_current_state; 1825} 1826 1827/* yy_try_NUL_trans - try to make a transition on the NUL character 1828 * 1829 * synopsis 1830 * next_state = yy_try_NUL_trans( current_state ); 1831 */ 1832 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 1833{ 1834 register int yy_is_jam; 1835 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ 1836 register char *yy_cp = yyg->yy_c_buf_p; 1837 1838 register YY_CHAR yy_c = 1; 1839 if ( yy_accept[yy_current_state] ) 1840 { 1841 yyg->yy_last_accepting_state = yy_current_state; 1842 yyg->yy_last_accepting_cpos = yy_cp; 1843 } 1844 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1845 { 1846 yy_current_state = (int) yy_def[yy_current_state]; 1847 if ( yy_current_state >= 124 ) 1848 yy_c = yy_meta[(unsigned int) yy_c]; 1849 } 1850 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1851 yy_is_jam = (yy_current_state == 123); 1852 1853 return yy_is_jam ? 0 : yy_current_state; 1854} 1855 1856#ifndef YY_NO_INPUT 1857#ifdef __cplusplus 1858 static int yyinput (yyscan_t yyscanner) 1859#else 1860 static int input (yyscan_t yyscanner) 1861#endif 1862 1863{ 1864 int c; 1865 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1866 1867 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1868 1869 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 1870 { 1871 /* yy_c_buf_p now points to the character we want to return. 1872 * If this occurs *before* the EOB characters, then it's a 1873 * valid NUL; if not, then we've hit the end of the buffer. 1874 */ 1875 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1876 /* This was really a NUL. */ 1877 *yyg->yy_c_buf_p = '\0'; 1878 1879 else 1880 { /* need more input */ 1881 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1882 ++yyg->yy_c_buf_p; 1883 1884 switch ( yy_get_next_buffer( yyscanner ) ) 1885 { 1886 case EOB_ACT_LAST_MATCH: 1887 /* This happens because yy_g_n_b() 1888 * sees that we've accumulated a 1889 * token and flags that we need to 1890 * try matching the token before 1891 * proceeding. But for input(), 1892 * there's no matching to consider. 1893 * So convert the EOB_ACT_LAST_MATCH 1894 * to EOB_ACT_END_OF_FILE. 1895 */ 1896 1897 /* Reset buffer status. */ 1898 ap_expr_yyrestart(yyin ,yyscanner); 1899 1900 /*FALLTHROUGH*/ 1901 1902 case EOB_ACT_END_OF_FILE: 1903 { 1904 if ( ap_expr_yywrap(yyscanner ) ) 1905 return EOF; 1906 1907 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1908 YY_NEW_FILE; 1909#ifdef __cplusplus 1910 return yyinput(yyscanner); 1911#else 1912 return input(yyscanner); 1913#endif 1914 } 1915 1916 case EOB_ACT_CONTINUE_SCAN: 1917 yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 1918 break; 1919 } 1920 } 1921 } 1922 1923 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 1924 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 1925 yyg->yy_hold_char = *++yyg->yy_c_buf_p; 1926 1927 return c; 1928} 1929#endif /* ifndef YY_NO_INPUT */ 1930 1931/** Immediately switch to a different input stream. 1932 * @param input_file A readable stream. 1933 * @param yyscanner The scanner object. 1934 * @note This function does not reset the start condition to @c INITIAL . 1935 */ 1936 void ap_expr_yyrestart (FILE * input_file , yyscan_t yyscanner) 1937{ 1938 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1939 1940 if ( ! YY_CURRENT_BUFFER ){ 1941 ap_expr_yyensure_buffer_stack (yyscanner); 1942 YY_CURRENT_BUFFER_LVALUE = 1943 ap_expr_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1944 } 1945 1946 ap_expr_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 1947 ap_expr_yy_load_buffer_state(yyscanner ); 1948} 1949 1950/** Switch to a different input buffer. 1951 * @param new_buffer The new input buffer. 1952 * @param yyscanner The scanner object. 1953 */ 1954 void ap_expr_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 1955{ 1956 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1957 1958 /* TODO. We should be able to replace this entire function body 1959 * with 1960 * ap_expr_yypop_buffer_state(); 1961 * ap_expr_yypush_buffer_state(new_buffer); 1962 */ 1963 ap_expr_yyensure_buffer_stack (yyscanner); 1964 if ( YY_CURRENT_BUFFER == new_buffer ) 1965 return; 1966 1967 if ( YY_CURRENT_BUFFER ) 1968 { 1969 /* Flush out information for old buffer. */ 1970 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1971 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 1972 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1973 } 1974 1975 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1976 ap_expr_yy_load_buffer_state(yyscanner ); 1977 1978 /* We don't actually know whether we did this switch during 1979 * EOF (ap_expr_yywrap()) processing, but the only time this flag 1980 * is looked at is after ap_expr_yywrap() is called, so it's safe 1981 * to go ahead and always set it. 1982 */ 1983 yyg->yy_did_buffer_switch_on_eof = 1; 1984} 1985 1986static void ap_expr_yy_load_buffer_state (yyscan_t yyscanner) 1987{ 1988 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1989 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1990 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1991 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1992 yyg->yy_hold_char = *yyg->yy_c_buf_p; 1993} 1994 1995/** Allocate and initialize an input buffer state. 1996 * @param file A readable stream. 1997 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1998 * @param yyscanner The scanner object. 1999 * @return the allocated buffer state. 2000 */ 2001 YY_BUFFER_STATE ap_expr_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) 2002{ 2003 YY_BUFFER_STATE b; 2004 2005 b = (YY_BUFFER_STATE) ap_expr_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2006 if ( ! b ) 2007 YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yy_create_buffer()" ); 2008 2009 b->yy_buf_size = size; 2010 2011 /* yy_ch_buf has to be 2 characters longer than the size given because 2012 * we need to put in 2 end-of-buffer characters. 2013 */ 2014 b->yy_ch_buf = (char *) ap_expr_yyalloc(b->yy_buf_size + 2 ,yyscanner ); 2015 if ( ! b->yy_ch_buf ) 2016 YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yy_create_buffer()" ); 2017 2018 b->yy_is_our_buffer = 1; 2019 2020 ap_expr_yy_init_buffer(b,file ,yyscanner); 2021 2022 return b; 2023} 2024 2025/** Destroy the buffer. 2026 * @param b a buffer created with ap_expr_yy_create_buffer() 2027 * @param yyscanner The scanner object. 2028 */ 2029 void ap_expr_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2030{ 2031 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2032 2033 if ( ! b ) 2034 return; 2035 2036 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 2037 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 2038 2039 if ( b->yy_is_our_buffer ) 2040 ap_expr_yyfree((void *) b->yy_ch_buf ,yyscanner ); 2041 2042 ap_expr_yyfree((void *) b ,yyscanner ); 2043} 2044 2045/* Initializes or reinitializes a buffer. 2046 * This function is sometimes called more than once on the same buffer, 2047 * such as during a ap_expr_yyrestart() or at EOF. 2048 */ 2049 static void ap_expr_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 2050 2051{ 2052 int oerrno = errno; 2053 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2054 2055 ap_expr_yy_flush_buffer(b ,yyscanner); 2056 2057 b->yy_input_file = file; 2058 b->yy_fill_buffer = 1; 2059 2060 /* If b is the current buffer, then ap_expr_yy_init_buffer was _probably_ 2061 * called from ap_expr_yyrestart() or through yy_get_next_buffer. 2062 * In that case, we don't want to reset the lineno or column. 2063 */ 2064 if (b != YY_CURRENT_BUFFER){ 2065 b->yy_bs_lineno = 1; 2066 b->yy_bs_column = 0; 2067 } 2068 2069 b->yy_is_interactive = 0; 2070 2071 errno = oerrno; 2072} 2073 2074/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 2075 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 2076 * @param yyscanner The scanner object. 2077 */ 2078 void ap_expr_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2079{ 2080 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2081 if ( ! b ) 2082 return; 2083 2084 b->yy_n_chars = 0; 2085 2086 /* We always need two end-of-buffer characters. The first causes 2087 * a transition to the end-of-buffer state. The second causes 2088 * a jam in that state. 2089 */ 2090 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 2091 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 2092 2093 b->yy_buf_pos = &b->yy_ch_buf[0]; 2094 2095 b->yy_at_bol = 1; 2096 b->yy_buffer_status = YY_BUFFER_NEW; 2097 2098 if ( b == YY_CURRENT_BUFFER ) 2099 ap_expr_yy_load_buffer_state(yyscanner ); 2100} 2101 2102/** Pushes the new state onto the stack. The new state becomes 2103 * the current state. This function will allocate the stack 2104 * if necessary. 2105 * @param new_buffer The new state. 2106 * @param yyscanner The scanner object. 2107 */ 2108void ap_expr_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2109{ 2110 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2111 if (new_buffer == NULL) 2112 return; 2113 2114 ap_expr_yyensure_buffer_stack(yyscanner); 2115 2116 /* This block is copied from ap_expr_yy_switch_to_buffer. */ 2117 if ( YY_CURRENT_BUFFER ) 2118 { 2119 /* Flush out information for old buffer. */ 2120 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2121 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2122 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2123 } 2124 2125 /* Only push if top exists. Otherwise, replace top. */ 2126 if (YY_CURRENT_BUFFER) 2127 yyg->yy_buffer_stack_top++; 2128 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2129 2130 /* copied from ap_expr_yy_switch_to_buffer. */ 2131 ap_expr_yy_load_buffer_state(yyscanner ); 2132 yyg->yy_did_buffer_switch_on_eof = 1; 2133} 2134 2135/** Removes and deletes the top of the stack, if present. 2136 * The next element becomes the new top. 2137 * @param yyscanner The scanner object. 2138 */ 2139void ap_expr_yypop_buffer_state (yyscan_t yyscanner) 2140{ 2141 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2142 if (!YY_CURRENT_BUFFER) 2143 return; 2144 2145 ap_expr_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 2146 YY_CURRENT_BUFFER_LVALUE = NULL; 2147 if (yyg->yy_buffer_stack_top > 0) 2148 --yyg->yy_buffer_stack_top; 2149 2150 if (YY_CURRENT_BUFFER) { 2151 ap_expr_yy_load_buffer_state(yyscanner ); 2152 yyg->yy_did_buffer_switch_on_eof = 1; 2153 } 2154} 2155 2156/* Allocates the stack if it does not exist. 2157 * Guarantees space for at least one push. 2158 */ 2159static void ap_expr_yyensure_buffer_stack (yyscan_t yyscanner) 2160{ 2161 int num_to_alloc; 2162 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2163 2164 if (!yyg->yy_buffer_stack) { 2165 2166 /* First allocation is just for 2 elements, since we don't know if this 2167 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2168 * immediate realloc on the next call. 2169 */ 2170 num_to_alloc = 1; 2171 yyg->yy_buffer_stack = (struct yy_buffer_state**)ap_expr_yyalloc 2172 (num_to_alloc * sizeof(struct yy_buffer_state*) 2173 , yyscanner); 2174 if ( ! yyg->yy_buffer_stack ) 2175 YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yyensure_buffer_stack()" ); 2176 2177 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2178 2179 yyg->yy_buffer_stack_max = num_to_alloc; 2180 yyg->yy_buffer_stack_top = 0; 2181 return; 2182 } 2183 2184 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 2185 2186 /* Increase the buffer to prepare for a possible push. */ 2187 int grow_size = 8 /* arbitrary grow size */; 2188 2189 num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 2190 yyg->yy_buffer_stack = (struct yy_buffer_state**)ap_expr_yyrealloc 2191 (yyg->yy_buffer_stack, 2192 num_to_alloc * sizeof(struct yy_buffer_state*) 2193 , yyscanner); 2194 if ( ! yyg->yy_buffer_stack ) 2195 YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yyensure_buffer_stack()" ); 2196 2197 /* zero only the new slots.*/ 2198 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 2199 yyg->yy_buffer_stack_max = num_to_alloc; 2200 } 2201} 2202 2203/** Setup the input buffer state to scan directly from a user-specified character buffer. 2204 * @param base the character buffer 2205 * @param size the size in bytes of the character buffer 2206 * @param yyscanner The scanner object. 2207 * @return the newly allocated buffer state object. 2208 */ 2209YY_BUFFER_STATE ap_expr_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 2210{ 2211 YY_BUFFER_STATE b; 2212 2213 if ( size < 2 || 2214 base[size-2] != YY_END_OF_BUFFER_CHAR || 2215 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2216 /* They forgot to leave room for the EOB's. */ 2217 return 0; 2218 2219 b = (YY_BUFFER_STATE) ap_expr_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2220 if ( ! b ) 2221 YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yy_scan_buffer()" ); 2222 2223 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 2224 b->yy_buf_pos = b->yy_ch_buf = base; 2225 b->yy_is_our_buffer = 0; 2226 b->yy_input_file = 0; 2227 b->yy_n_chars = b->yy_buf_size; 2228 b->yy_is_interactive = 0; 2229 b->yy_at_bol = 1; 2230 b->yy_fill_buffer = 0; 2231 b->yy_buffer_status = YY_BUFFER_NEW; 2232 2233 ap_expr_yy_switch_to_buffer(b ,yyscanner ); 2234 2235 return b; 2236} 2237 2238/** Setup the input buffer state to scan a string. The next call to ap_expr_yylex() will 2239 * scan from a @e copy of @a str. 2240 * @param yystr a NUL-terminated string to scan 2241 * @param yyscanner The scanner object. 2242 * @return the newly allocated buffer state object. 2243 * @note If you want to scan bytes that may contain NUL values, then use 2244 * ap_expr_yy_scan_bytes() instead. 2245 */ 2246YY_BUFFER_STATE ap_expr_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) 2247{ 2248 2249 return ap_expr_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); 2250} 2251 2252/** Setup the input buffer state to scan the given bytes. The next call to ap_expr_yylex() will 2253 * scan from a @e copy of @a bytes. 2254 * @param yybytes the byte buffer to scan 2255 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2256 * @param yyscanner The scanner object. 2257 * @return the newly allocated buffer state object. 2258 */ 2259YY_BUFFER_STATE ap_expr_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) 2260{ 2261 YY_BUFFER_STATE b; 2262 char *buf; 2263 yy_size_t n; 2264 int i; 2265 2266 /* Get memory for full buffer, including space for trailing EOB's. */ 2267 n = _yybytes_len + 2; 2268 buf = (char *) ap_expr_yyalloc(n ,yyscanner ); 2269 if ( ! buf ) 2270 YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yy_scan_bytes()" ); 2271 2272 for ( i = 0; i < _yybytes_len; ++i ) 2273 buf[i] = yybytes[i]; 2274 2275 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2276 2277 b = ap_expr_yy_scan_buffer(buf,n ,yyscanner); 2278 if ( ! b ) 2279 YY_FATAL_ERROR( "bad buffer in ap_expr_yy_scan_bytes()" ); 2280 2281 /* It's okay to grow etc. this buffer, and we should throw it 2282 * away when we're done. 2283 */ 2284 b->yy_is_our_buffer = 1; 2285 2286 return b; 2287} 2288 2289 static void yy_push_state (int new_state , yyscan_t yyscanner) 2290{ 2291 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2292 if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) 2293 { 2294 yy_size_t new_size; 2295 2296 yyg->yy_start_stack_depth += YY_START_STACK_INCR; 2297 new_size = yyg->yy_start_stack_depth * sizeof( int ); 2298 2299 if ( ! yyg->yy_start_stack ) 2300 yyg->yy_start_stack = (int *) ap_expr_yyalloc(new_size ,yyscanner ); 2301 2302 else 2303 yyg->yy_start_stack = (int *) ap_expr_yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); 2304 2305 if ( ! yyg->yy_start_stack ) 2306 YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); 2307 } 2308 2309 yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; 2310 2311 BEGIN(new_state); 2312} 2313 2314 static void yy_pop_state (yyscan_t yyscanner) 2315{ 2316 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2317 if ( --yyg->yy_start_stack_ptr < 0 ) 2318 YY_FATAL_ERROR( "start-condition stack underflow" ); 2319 2320 BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); 2321} 2322 2323#ifndef YY_EXIT_FAILURE 2324#define YY_EXIT_FAILURE 2 2325#endif 2326 2327static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) 2328{ 2329 (void) fprintf( stderr, "%s\n", msg ); 2330 exit( YY_EXIT_FAILURE ); 2331} 2332 2333/* Redefine yyless() so it works in section 3 code. */ 2334 2335#undef yyless 2336#define yyless(n) \ 2337 do \ 2338 { \ 2339 /* Undo effects of setting up yytext. */ \ 2340 int yyless_macro_arg = (n); \ 2341 YY_LESS_LINENO(yyless_macro_arg);\ 2342 yytext[yyleng] = yyg->yy_hold_char; \ 2343 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 2344 yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 2345 *yyg->yy_c_buf_p = '\0'; \ 2346 yyleng = yyless_macro_arg; \ 2347 } \ 2348 while ( 0 ) 2349 2350/* Accessor methods (get/set functions) to struct members. */ 2351 2352/** Get the user-defined data for this scanner. 2353 * @param yyscanner The scanner object. 2354 */ 2355YY_EXTRA_TYPE ap_expr_yyget_extra (yyscan_t yyscanner) 2356{ 2357 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2358 return yyextra; 2359} 2360 2361/** Get the current line number. 2362 * @param yyscanner The scanner object. 2363 */ 2364int ap_expr_yyget_lineno (yyscan_t yyscanner) 2365{ 2366 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2367 2368 if (! YY_CURRENT_BUFFER) 2369 return 0; 2370 2371 return yylineno; 2372} 2373 2374/** Get the current column number. 2375 * @param yyscanner The scanner object. 2376 */ 2377 2378/** Get the input stream. 2379 * @param yyscanner The scanner object. 2380 */ 2381FILE *ap_expr_yyget_in (yyscan_t yyscanner) 2382{ 2383 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2384 return yyin; 2385} 2386 2387/** Get the output stream. 2388 * @param yyscanner The scanner object. 2389 */ 2390FILE *ap_expr_yyget_out (yyscan_t yyscanner) 2391{ 2392 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2393 return yyout; 2394} 2395 2396/** Get the length of the current token. 2397 * @param yyscanner The scanner object. 2398 */ 2399int ap_expr_yyget_leng (yyscan_t yyscanner) 2400{ 2401 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2402 return yyleng; 2403} 2404 2405/** Get the current token. 2406 * @param yyscanner The scanner object. 2407 */ 2408 2409char *ap_expr_yyget_text (yyscan_t yyscanner) 2410{ 2411 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2412 return yytext; 2413} 2414 2415/** Set the user-defined data. This data is never touched by the scanner. 2416 * @param user_defined The data to be associated with this scanner. 2417 * @param yyscanner The scanner object. 2418 */ 2419void ap_expr_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 2420{ 2421 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2422 yyextra = user_defined ; 2423} 2424 2425/** Set the current line number. 2426 * @param line_number 2427 * @param yyscanner The scanner object. 2428 */ 2429void ap_expr_yyset_lineno (int line_number , yyscan_t yyscanner) 2430{ 2431 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2432 2433 /* lineno is only valid if an input buffer exists. */ 2434 if (! YY_CURRENT_BUFFER ) 2435 yy_fatal_error( "ap_expr_yyset_lineno called with no buffer" , yyscanner); 2436 2437 yylineno = line_number; 2438} 2439 2440/** Set the current column. 2441 * @param line_number 2442 * @param yyscanner The scanner object. 2443 */ 2444 2445/** Set the input stream. This does not discard the current 2446 * input buffer. 2447 * @param in_str A readable stream. 2448 * @param yyscanner The scanner object. 2449 * @see ap_expr_yy_switch_to_buffer 2450 */ 2451void ap_expr_yyset_in (FILE * in_str , yyscan_t yyscanner) 2452{ 2453 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2454 yyin = in_str ; 2455} 2456 2457void ap_expr_yyset_out (FILE * out_str , yyscan_t yyscanner) 2458{ 2459 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2460 yyout = out_str ; 2461} 2462 2463int ap_expr_yyget_debug (yyscan_t yyscanner) 2464{ 2465 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2466 return yy_flex_debug; 2467} 2468 2469void ap_expr_yyset_debug (int bdebug , yyscan_t yyscanner) 2470{ 2471 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2472 yy_flex_debug = bdebug ; 2473} 2474 2475/* Accessor methods for yylval and yylloc */ 2476 2477YYSTYPE * ap_expr_yyget_lval (yyscan_t yyscanner) 2478{ 2479 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2480 return yylval; 2481} 2482 2483void ap_expr_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) 2484{ 2485 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2486 yylval = yylval_param; 2487} 2488 2489/* User-visible API */ 2490 2491/* ap_expr_yylex_init is special because it creates the scanner itself, so it is 2492 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2493 * That's why we explicitly handle the declaration, instead of using our macros. 2494 */ 2495 2496int ap_expr_yylex_init(yyscan_t* ptr_yy_globals) 2497 2498{ 2499 if (ptr_yy_globals == NULL){ 2500 errno = EINVAL; 2501 return 1; 2502 } 2503 2504 *ptr_yy_globals = (yyscan_t) ap_expr_yyalloc ( sizeof( struct yyguts_t ), NULL ); 2505 2506 if (*ptr_yy_globals == NULL){ 2507 errno = ENOMEM; 2508 return 1; 2509 } 2510 2511 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2512 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2513 2514 return yy_init_globals ( *ptr_yy_globals ); 2515} 2516 2517/* ap_expr_yylex_init_extra has the same functionality as ap_expr_yylex_init, but follows the 2518 * convention of taking the scanner as the last argument. Note however, that 2519 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2520 * is the reason, too, why this function also must handle its own declaration). 2521 * The user defined value in the first argument will be available to ap_expr_yyalloc in 2522 * the yyextra field. 2523 */ 2524 2525int ap_expr_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) 2526 2527{ 2528 struct yyguts_t dummy_yyguts; 2529 2530 ap_expr_yyset_extra (yy_user_defined, &dummy_yyguts); 2531 2532 if (ptr_yy_globals == NULL){ 2533 errno = EINVAL; 2534 return 1; 2535 } 2536 2537 *ptr_yy_globals = (yyscan_t) ap_expr_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2538 2539 if (*ptr_yy_globals == NULL){ 2540 errno = ENOMEM; 2541 return 1; 2542 } 2543 2544 /* By setting to 0xAA, we expose bugs in 2545 yy_init_globals. Leave at 0x00 for releases. */ 2546 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2547 2548 ap_expr_yyset_extra (yy_user_defined, *ptr_yy_globals); 2549 2550 return yy_init_globals ( *ptr_yy_globals ); 2551} 2552 2553static int yy_init_globals (yyscan_t yyscanner) 2554{ 2555 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2556 /* Initialization is the same as for the non-reentrant scanner. 2557 * This function is called from ap_expr_yylex_destroy(), so don't allocate here. 2558 */ 2559 2560 yyg->yy_buffer_stack = 0; 2561 yyg->yy_buffer_stack_top = 0; 2562 yyg->yy_buffer_stack_max = 0; 2563 yyg->yy_c_buf_p = (char *) 0; 2564 yyg->yy_init = 0; 2565 yyg->yy_start = 0; 2566 2567 yyg->yy_start_stack_ptr = 0; 2568 yyg->yy_start_stack_depth = 0; 2569 yyg->yy_start_stack = NULL; 2570 2571/* Defined in main.c */ 2572#ifdef YY_STDINIT 2573 yyin = stdin; 2574 yyout = stdout; 2575#else 2576 yyin = (FILE *) 0; 2577 yyout = (FILE *) 0; 2578#endif 2579 2580 /* For future reference: Set errno on error, since we are called by 2581 * ap_expr_yylex_init() 2582 */ 2583 return 0; 2584} 2585 2586/* ap_expr_yylex_destroy is for both reentrant and non-reentrant scanners. */ 2587int ap_expr_yylex_destroy (yyscan_t yyscanner) 2588{ 2589 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2590 2591 /* Pop the buffer stack, destroying each element. */ 2592 while(YY_CURRENT_BUFFER){ 2593 ap_expr_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 2594 YY_CURRENT_BUFFER_LVALUE = NULL; 2595 ap_expr_yypop_buffer_state(yyscanner); 2596 } 2597 2598 /* Destroy the stack itself. */ 2599 ap_expr_yyfree(yyg->yy_buffer_stack ,yyscanner); 2600 yyg->yy_buffer_stack = NULL; 2601 2602 /* Destroy the start condition stack. */ 2603 ap_expr_yyfree(yyg->yy_start_stack ,yyscanner ); 2604 yyg->yy_start_stack = NULL; 2605 2606 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2607 * ap_expr_yylex() is called, initialization will occur. */ 2608 yy_init_globals( yyscanner); 2609 2610 /* Destroy the main struct (reentrant only). */ 2611 ap_expr_yyfree ( yyscanner , yyscanner ); 2612 yyscanner = NULL; 2613 return 0; 2614} 2615 2616/* 2617 * Internal utility routines. 2618 */ 2619 2620#ifndef yytext_ptr 2621static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 2622{ 2623 register int i; 2624 for ( i = 0; i < n; ++i ) 2625 s1[i] = s2[i]; 2626} 2627#endif 2628 2629#ifdef YY_NEED_STRLEN 2630static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 2631{ 2632 register int n; 2633 for ( n = 0; s[n]; ++n ) 2634 ; 2635 2636 return n; 2637} 2638#endif 2639 2640void *ap_expr_yyalloc (yy_size_t size , yyscan_t yyscanner) 2641{ 2642 return (void *) malloc( size ); 2643} 2644 2645void *ap_expr_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) 2646{ 2647 /* The cast to (char *) in the following accommodates both 2648 * implementations that use char* generic pointers, and those 2649 * that use void* generic pointers. It works with the latter 2650 * because both ANSI C and C++ allow castless assignment from 2651 * any pointer type to void*, and deal with argument conversions 2652 * as though doing an assignment. 2653 */ 2654 return (void *) realloc( (char *) ptr, size ); 2655} 2656 2657void ap_expr_yyfree (void * ptr , yyscan_t yyscanner) 2658{ 2659 free( (char *) ptr ); /* see ap_expr_yyrealloc() for (char *) cast */ 2660} 2661 2662#define YYTABLES_NAME "yytables" 2663 2664#line 398 "util_expr_scan.l" 2665 2666 2667 2668 2669 2670