ls-sfparser.c revision a74702c6
1/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */ 2#line 2 "ls-sfparser.c" 3#line 2 "ls-sfparser.l" 4/* 5MIT License 6 7Copyright (c) 2020 LiteSpeed Technologies Inc 8 9Permission is hereby granted, free of charge, to any person obtaining a copy 10of this software and associated documentation files (the "Software"), to deal 11in the Software without restriction, including without limitation the rights 12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13copies of the Software, and to permit persons to whom the Software is 14furnished to do so, subject to the following conditions: 15 16The above copyright notice and this permission notice shall be included in all 17copies or substantial portions of the Software. 18 19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25SOFTWARE. 26*/ 27 28 29 30#line 30 "ls-sfparser.c" 31 32#define YY_INT_ALIGNED short int 33 34/* A lexical scanner generated by flex */ 35 36#define FLEX_SCANNER 37#define YY_FLEX_MAJOR_VERSION 2 38#define YY_FLEX_MINOR_VERSION 5 39#define YY_FLEX_SUBMINOR_VERSION 35 40#if YY_FLEX_SUBMINOR_VERSION > 0 41#define FLEX_BETA 42#endif 43 44/* First, we deal with platform-specific or compiler-specific issues. */ 45 46/* begin standard C headers. */ 47#include <stdio.h> 48#include <string.h> 49#include <errno.h> 50#include <stdlib.h> 51 52/* end standard C headers. */ 53 54/* flex integer type definitions */ 55 56#ifndef FLEXINT_H 57#define FLEXINT_H 58 59/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 60 61#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 62 63/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 64 * if you want the limit (max/min) macros for int types. 65 */ 66#ifndef __STDC_LIMIT_MACROS 67#define __STDC_LIMIT_MACROS 1 68#endif 69 70#include <inttypes.h> 71typedef int8_t flex_int8_t; 72typedef uint8_t flex_uint8_t; 73typedef int16_t flex_int16_t; 74typedef uint16_t flex_uint16_t; 75typedef int32_t flex_int32_t; 76typedef uint32_t flex_uint32_t; 77#else 78typedef signed char flex_int8_t; 79typedef short int flex_int16_t; 80typedef int flex_int32_t; 81typedef unsigned char flex_uint8_t; 82typedef unsigned short int flex_uint16_t; 83typedef unsigned int flex_uint32_t; 84 85/* Limits of integral types. */ 86#ifndef INT8_MIN 87#define INT8_MIN (-128) 88#endif 89#ifndef INT16_MIN 90#define INT16_MIN (-32767-1) 91#endif 92#ifndef INT32_MIN 93#define INT32_MIN (-2147483647-1) 94#endif 95#ifndef INT8_MAX 96#define INT8_MAX (127) 97#endif 98#ifndef INT16_MAX 99#define INT16_MAX (32767) 100#endif 101#ifndef INT32_MAX 102#define INT32_MAX (2147483647) 103#endif 104#ifndef UINT8_MAX 105#define UINT8_MAX (255U) 106#endif 107#ifndef UINT16_MAX 108#define UINT16_MAX (65535U) 109#endif 110#ifndef UINT32_MAX 111#define UINT32_MAX (4294967295U) 112#endif 113 114#endif /* ! C99 */ 115 116#endif /* ! FLEXINT_H */ 117 118#ifdef __cplusplus 119 120/* The "const" storage-class-modifier is valid. */ 121#define YY_USE_CONST 122 123#else /* ! __cplusplus */ 124 125/* C99 requires __STDC__ to be defined as 1. */ 126#if defined (__STDC__) 127 128#define YY_USE_CONST 129 130#endif /* defined (__STDC__) */ 131#endif /* ! __cplusplus */ 132 133#ifdef YY_USE_CONST 134#define yyconst const 135#else 136#define yyconst 137#endif 138 139/* Returned upon end-of-file. */ 140#define YY_NULL 0 141 142/* Promotes a possibly negative, possibly signed char to an unsigned 143 * integer for use as an array index. If the signed char is negative, 144 * we want to instead treat it as an 8-bit unsigned char, hence the 145 * double cast. 146 */ 147#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 148 149/* An opaque pointer. */ 150#ifndef YY_TYPEDEF_YY_SCANNER_T 151#define YY_TYPEDEF_YY_SCANNER_T 152typedef void* yyscan_t; 153#endif 154 155/* For convenience, these vars (plus the bison vars far below) 156 are macros in the reentrant scanner. */ 157#define yyin yyg->yyin_r 158#define yyout yyg->yyout_r 159#define yyextra yyg->yyextra_r 160#define yyleng yyg->yyleng_r 161#define yytext yyg->yytext_r 162#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 163#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 164#define yy_flex_debug yyg->yy_flex_debug_r 165 166/* Enter a start condition. This macro really ought to take a parameter, 167 * but we do it the disgusting crufty way forced on us by the ()-less 168 * definition of BEGIN. 169 */ 170#define BEGIN yyg->yy_start = 1 + 2 * 171 172/* Translate the current start state into a value that can be later handed 173 * to BEGIN to return to the state. The YYSTATE alias is for lex 174 * compatibility. 175 */ 176#define YY_START ((yyg->yy_start - 1) / 2) 177#define YYSTATE YY_START 178 179/* Action number for EOF rule of a given start state. */ 180#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 181 182/* Special action meaning "start processing a new file". */ 183#define YY_NEW_FILE ls_sfp_restart(yyin ,yyscanner ) 184 185#define YY_END_OF_BUFFER_CHAR 0 186 187/* Size of default input buffer. */ 188#ifndef YY_BUF_SIZE 189#ifdef __ia64__ 190/* On IA-64, the buffer size is 16k, not 8k. 191 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 192 * Ditto for the __ia64__ case accordingly. 193 */ 194#define YY_BUF_SIZE 32768 195#else 196#define YY_BUF_SIZE 16384 197#endif /* __ia64__ */ 198#endif 199 200/* The state buf must be large enough to hold one state per character in the main buffer. 201 */ 202#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 203 204#ifndef YY_TYPEDEF_YY_BUFFER_STATE 205#define YY_TYPEDEF_YY_BUFFER_STATE 206typedef struct yy_buffer_state *YY_BUFFER_STATE; 207#endif 208 209#define EOB_ACT_CONTINUE_SCAN 0 210#define EOB_ACT_END_OF_FILE 1 211#define EOB_ACT_LAST_MATCH 2 212 213 #define YY_LESS_LINENO(n) 214 215/* Return all but the first "n" matched characters back to the input stream. */ 216#define yyless(n) \ 217 do \ 218 { \ 219 /* Undo effects of setting up yytext. */ \ 220 int yyless_macro_arg = (n); \ 221 YY_LESS_LINENO(yyless_macro_arg);\ 222 *yy_cp = yyg->yy_hold_char; \ 223 YY_RESTORE_YY_MORE_OFFSET \ 224 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 225 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 226 } \ 227 while ( 0 ) 228 229#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 230 231#ifndef YY_TYPEDEF_YY_SIZE_T 232#define YY_TYPEDEF_YY_SIZE_T 233typedef size_t yy_size_t; 234#endif 235 236#ifndef YY_STRUCT_YY_BUFFER_STATE 237#define YY_STRUCT_YY_BUFFER_STATE 238struct yy_buffer_state 239 { 240 FILE *yy_input_file; 241 242 char *yy_ch_buf; /* input buffer */ 243 char *yy_buf_pos; /* current position in input buffer */ 244 245 /* Size of input buffer in bytes, not including room for EOB 246 * characters. 247 */ 248 yy_size_t yy_buf_size; 249 250 /* Number of characters read into yy_ch_buf, not including EOB 251 * characters. 252 */ 253 int yy_n_chars; 254 255 /* Whether we "own" the buffer - i.e., we know we created it, 256 * and can realloc() it to grow it, and should free() it to 257 * delete it. 258 */ 259 int yy_is_our_buffer; 260 261 /* Whether this is an "interactive" input source; if so, and 262 * if we're using stdio for input, then we want to use getc() 263 * instead of fread(), to make sure we stop fetching input after 264 * each newline. 265 */ 266 int yy_is_interactive; 267 268 /* Whether we're considered to be at the beginning of a line. 269 * If so, '^' rules will be active on the next match, otherwise 270 * not. 271 */ 272 int yy_at_bol; 273 274 int yy_bs_lineno; /**< The line count. */ 275 int yy_bs_column; /**< The column count. */ 276 277 /* Whether to try to fill the input buffer when we reach the 278 * end of it. 279 */ 280 int yy_fill_buffer; 281 282 int yy_buffer_status; 283 284#define YY_BUFFER_NEW 0 285#define YY_BUFFER_NORMAL 1 286 /* When an EOF's been seen but there's still some text to process 287 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 288 * shouldn't try reading from the input source any more. We might 289 * still have a bunch of tokens to match, though, because of 290 * possible backing-up. 291 * 292 * When we actually see the EOF, we change the status to "new" 293 * (via ls_sfp_restart()), so that the user can continue scanning by 294 * just pointing yyin at a new input file. 295 */ 296#define YY_BUFFER_EOF_PENDING 2 297 298 }; 299#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 300 301/* We provide macros for accessing buffer states in case in the 302 * future we want to put the buffer states in a more general 303 * "scanner state". 304 * 305 * Returns the top of the stack, or NULL. 306 */ 307#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ 308 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ 309 : NULL) 310 311/* Same as previous macro, but useful when we know that the buffer stack is not 312 * NULL or when we need an lvalue. For internal use only. 313 */ 314#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] 315 316void ls_sfp_restart (FILE *input_file ,yyscan_t yyscanner ); 317void ls_sfp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 318YY_BUFFER_STATE ls_sfp__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); 319void ls_sfp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 320void ls_sfp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 321void ls_sfp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 322void ls_sfp_pop_buffer_state (yyscan_t yyscanner ); 323 324static int ls_sfp_ensure_buffer_stack (yyscan_t yyscanner ); 325static void ls_sfp__load_buffer_state (yyscan_t yyscanner ); 326static void ls_sfp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 327 328#define YY_FLUSH_BUFFER ls_sfp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) 329 330YY_BUFFER_STATE ls_sfp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 331YY_BUFFER_STATE ls_sfp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 332YY_BUFFER_STATE ls_sfp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); 333 334void *ls_sfp_alloc (yy_size_t ,yyscan_t yyscanner ); 335void *ls_sfp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); 336void ls_sfp_free (void * ,yyscan_t yyscanner ); 337 338#define yy_new_buffer ls_sfp__create_buffer 339 340#define yy_set_interactive(is_interactive) \ 341 { \ 342 if ( ! YY_CURRENT_BUFFER ){ \ 343 ls_sfp_ensure_buffer_stack (yyscanner); \ 344 YY_CURRENT_BUFFER_LVALUE = \ 345 ls_sfp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 346 } \ 347 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 348 } 349 350#define yy_set_bol(at_bol) \ 351 { \ 352 if ( ! YY_CURRENT_BUFFER ){\ 353 ls_sfp_ensure_buffer_stack (yyscanner); \ 354 YY_CURRENT_BUFFER_LVALUE = \ 355 ls_sfp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 356 } \ 357 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 358 } 359 360#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 361 362/* Begin user sect3 */ 363 364#define ls_sfp_wrap(n) 1 365#define YY_SKIP_YYWRAP 366 367typedef unsigned char YY_CHAR; 368 369typedef int yy_state_type; 370 371#define yytext_ptr yytext_r 372 373static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 374static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); 375static int yy_get_next_buffer (yyscan_t yyscanner ); 376static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 377 378/* Done after the current pattern has been matched and before the 379 * corresponding action - sets up yytext. 380 */ 381#define YY_DO_BEFORE_ACTION \ 382 yyg->yytext_ptr = yy_bp; \ 383 yyleng = (size_t) (yy_cp - yy_bp); \ 384 yyg->yy_hold_char = *yy_cp; \ 385 *yy_cp = '\0'; \ 386 yyg->yy_c_buf_p = yy_cp; 387 388#define YY_NUM_RULES 93 389#define YY_END_OF_BUFFER 94 390/* This struct is not used in this scanner, 391 but its presence is necessary. */ 392struct yy_trans_info 393 { 394 flex_int32_t yy_verify; 395 flex_int32_t yy_nxt; 396 }; 397static yyconst flex_int16_t yy_accept[365] = 398 { 0, 399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 400 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 401 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 402 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 404 0, 0, 94, 93, 1, 2, 93, 93, 8, 7, 405 6, 93, 33, 93, 30, 93, 93, 3, 4, 37, 406 39, 38, 45, 43, 44, 42, 40, 41, 93, 49, 407 93, 46, 93, 93, 64, 66, 65, 54, 52, 53, 408 55, 93, 56, 60, 93, 57, 93, 93, 67, 93, 409 410 75, 93, 72, 93, 93, 69, 71, 70, 68, 78, 411 93, 82, 93, 79, 93, 93, 85, 86, 90, 91, 412 89, 87, 88, 93, 9, 13, 93, 10, 93, 93, 413 18, 17, 16, 19, 21, 23, 22, 20, 93, 27, 414 93, 24, 93, 93, 92, 1, 2, 0, 8, 0, 415 7, 8, 5, 0, 32, 0, 33, 30, 0, 30, 416 0, 34, 35, 3, 4, 37, 36, 38, 45, 40, 417 41, 0, 48, 0, 49, 46, 0, 46, 0, 50, 418 51, 64, 63, 65, 52, 55, 0, 59, 0, 56, 419 60, 57, 0, 57, 0, 61, 62, 67, 0, 74, 420 421 0, 75, 72, 0, 72, 0, 76, 77, 69, 78, 422 0, 81, 0, 82, 79, 0, 79, 0, 83, 84, 423 85, 86, 90, 87, 88, 0, 12, 0, 13, 10, 424 0, 10, 0, 14, 15, 18, 16, 16, 19, 21, 425 0, 26, 0, 27, 24, 0, 24, 0, 28, 29, 426 5, 31, 30, 47, 46, 58, 57, 73, 72, 80, 427 79, 11, 10, 25, 24, 31, 30, 47, 46, 58, 428 57, 73, 72, 80, 79, 11, 10, 25, 24, 31, 429 30, 47, 46, 58, 57, 73, 72, 80, 79, 11, 430 10, 25, 24, 30, 46, 57, 72, 79, 10, 24, 431 432 30, 46, 57, 72, 79, 10, 24, 30, 46, 57, 433 72, 79, 10, 24, 30, 46, 57, 72, 79, 10, 434 24, 30, 46, 57, 72, 79, 10, 24, 30, 46, 435 57, 72, 79, 10, 24, 30, 46, 57, 72, 79, 436 10, 24, 30, 46, 57, 72, 79, 10, 24, 30, 437 46, 57, 72, 79, 10, 24, 30, 46, 57, 72, 438 79, 10, 24, 0 439 } ; 440 441static yyconst flex_int32_t yy_ec[256] = 442 { 0, 443 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 444 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 446 1, 4, 5, 6, 7, 7, 7, 7, 7, 8, 447 9, 10, 11, 12, 13, 14, 11, 15, 15, 16, 448 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 449 20, 19, 21, 19, 22, 22, 22, 22, 22, 22, 450 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 451 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 452 19, 23, 24, 25, 26, 25, 27, 27, 27, 27, 453 454 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 455 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 456 27, 27, 24, 25, 24, 25, 1, 1, 1, 1, 457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 458 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 460 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 461 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 462 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 463 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 464 465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 469 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 470 1, 1, 1, 1, 1 471 } ; 472 473static yyconst flex_int32_t yy_meta[28] = 474 { 0, 475 1, 1, 1, 2, 3, 2, 3, 2, 2, 4, 476 5, 2, 4, 4, 6, 6, 5, 2, 2, 7, 477 2, 5, 2, 2, 3, 4, 6 478 } ; 479 480static yyconst flex_int16_t yy_base[395] = 481 { 0, 482 0, 0, 0, 1, 27, 46, 61, 0, 5, 10, 483 4, 22, 26, 31, 9, 52, 83, 0, 51, 68, 484 99, 104, 115, 0, 15, 58, 137, 0, 137, 156, 485 173, 0, 55, 57, 77, 109, 108, 129, 0, 0, 486 195, 0, 157, 163, 82, 124, 178, 205, 220, 0, 487 803, 802, 804, 807, 799, 0, 136, 195, 19, 807, 488 794, 139, 0, 2, 155, 784, 785, 50, 0, 216, 489 807, 795, 794, 807, 807, 807, 793, 0, 140, 0, 490 75, 177, 779, 780, 225, 807, 790, 807, 118, 807, 491 122, 179, 789, 0, 99, 224, 775, 776, 0, 209, 492 493 0, 229, 234, 773, 774, 784, 807, 807, 807, 783, 494 240, 0, 236, 239, 769, 770, 780, 779, 778, 807, 495 807, 777, 0, 250, 807, 0, 242, 245, 763, 764, 496 258, 807, 760, 0, 744, 807, 807, 807, 258, 0, 497 250, 253, 702, 675, 807, 683, 0, 268, 176, 273, 498 807, 217, 667, 265, 807, 272, 0, 268, 271, 278, 499 365, 807, 807, 294, 0, 295, 807, 374, 307, 275, 500 0, 283, 807, 284, 0, 286, 288, 294, 257, 807, 501 807, 310, 807, 227, 313, 314, 299, 807, 313, 224, 502 0, 309, 305, 315, 207, 807, 807, 0, 320, 807, 503 504 321, 0, 318, 322, 325, 189, 807, 807, 199, 180, 505 329, 807, 336, 0, 331, 333, 339, 156, 807, 807, 506 161, 140, 90, 83, 0, 344, 807, 345, 0, 342, 507 345, 348, 67, 807, 807, 361, 61, 56, 0, 53, 508 360, 807, 363, 0, 356, 358, 361, 24, 807, 807, 509 29, 365, 373, 369, 376, 378, 381, 383, 386, 388, 510 391, 393, 396, 398, 401, 403, 406, 408, 411, 413, 511 416, 418, 421, 423, 426, 428, 431, 433, 436, 807, 512 439, 807, 442, 807, 445, 807, 448, 807, 451, 807, 513 454, 807, 457, 460, 463, 466, 469, 472, 475, 478, 514 515 481, 484, 487, 490, 493, 496, 499, 502, 505, 508, 516 511, 514, 517, 520, 523, 526, 529, 532, 535, 538, 517 541, 544, 547, 550, 553, 556, 559, 562, 565, 568, 518 571, 574, 577, 580, 583, 586, 589, 592, 595, 598, 519 601, 604, 606, 608, 610, 612, 614, 616, 618, 620, 520 622, 624, 626, 628, 630, 632, 807, 807, 807, 807, 521 807, 807, 807, 807, 648, 655, 662, 666, 671, 676, 522 678, 682, 685, 690, 695, 697, 703, 708, 710, 714, 523 719, 724, 726, 732, 737, 739, 743, 748, 753, 755, 524 759, 764, 769, 771 525 526 } ; 527 528static yyconst flex_int16_t yy_def[395] = 529 { 0, 530 365, 365, 365, 365, 365, 365, 365, 7, 365, 365, 531 365, 365, 365, 365, 365, 365, 365, 17, 365, 365, 532 366, 366, 365, 23, 365, 365, 365, 27, 365, 365, 533 365, 31, 365, 365, 365, 365, 365, 365, 365, 365, 534 365, 41, 365, 365, 365, 365, 365, 365, 365, 49, 535 367, 367, 364, 364, 364, 368, 364, 364, 364, 364, 536 364, 369, 370, 364, 364, 371, 364, 364, 372, 364, 537 364, 364, 364, 364, 364, 364, 364, 373, 374, 375, 538 364, 364, 376, 364, 364, 364, 364, 364, 364, 364, 539 364, 377, 364, 378, 364, 364, 379, 364, 380, 381, 540 541 382, 364, 364, 383, 364, 364, 364, 364, 364, 364, 542 384, 385, 364, 364, 386, 364, 364, 364, 364, 364, 543 364, 364, 387, 388, 364, 389, 364, 364, 390, 364, 544 364, 364, 364, 391, 364, 364, 364, 364, 392, 393, 545 364, 364, 394, 364, 364, 364, 368, 364, 364, 364, 546 364, 364, 364, 369, 364, 364, 370, 364, 364, 364, 547 371, 364, 364, 364, 372, 364, 364, 364, 364, 364, 548 373, 374, 364, 364, 375, 364, 364, 364, 376, 364, 549 364, 364, 364, 364, 364, 364, 377, 364, 364, 364, 550 378, 364, 364, 364, 379, 364, 364, 380, 381, 364, 551 552 364, 382, 364, 364, 364, 383, 364, 364, 364, 364, 553 384, 364, 364, 385, 364, 364, 364, 386, 364, 364, 554 364, 364, 364, 364, 387, 388, 364, 364, 389, 364, 555 364, 364, 390, 364, 364, 364, 364, 364, 391, 364, 556 392, 364, 364, 393, 364, 364, 364, 394, 364, 364, 557 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 558 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 559 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 560 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 561 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 562 563 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 564 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 565 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 566 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 567 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 568 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 569 364, 364, 364, 0, 364, 364, 364, 364, 364, 364, 570 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 571 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 572 364, 364, 364, 364 573 574 } ; 575 576static yyconst flex_int16_t yy_nxt[835] = 577 { 0, 578 364, 364, 364, 55, 55, 70, 68, 70, 68, 56, 579 56, 68, 77, 68, 69, 71, 158, 158, 78, 69, 580 152, 72, 152, 70, 99, 70, 56, 56, 57, 73, 581 58, 69, 251, 71, 73, 78, 69, 74, 59, 72, 582 249, 99, 74, 75, 60, 76, 61, 57, 75, 58, 583 76, 164, 85, 164, 85, 77, 240, 59, 117, 238, 584 117, 78, 86, 60, 238, 61, 62, 99, 87, 85, 585 63, 85, 118, 64, 118, 65, 65, 66, 78, 86, 586 119, 67, 63, 234, 99, 87, 224, 63, 79, 176, 587 176, 134, 80, 223, 120, 81, 121, 82, 82, 83, 588 589 89, 54, 89, 84, 80, 89, 54, 89, 134, 80, 590 90, 122, 119, 192, 192, 90, 91, 123, 91, 185, 591 92, 185, 93, 186, 94, 186, 120, 95, 121, 96, 592 96, 97, 122, 134, 123, 98, 94, 148, 123, 148, 593 106, 94, 100, 222, 155, 173, 101, 149, 107, 102, 594 134, 103, 103, 104, 108, 123, 109, 105, 101, 106, 595 131, 156, 174, 101, 221, 132, 131, 107, 159, 160, 596 160, 132, 219, 108, 133, 109, 110, 152, 111, 152, 597 133, 135, 112, 210, 188, 113, 136, 114, 114, 115, 598 177, 178, 178, 116, 112, 137, 148, 138, 150, 112, 599 600 124, 189, 209, 125, 126, 207, 149, 127, 135, 128, 601 128, 129, 151, 136, 200, 130, 126, 166, 152, 166, 602 152, 126, 137, 196, 138, 139, 182, 190, 182, 140, 603 184, 201, 141, 167, 142, 142, 143, 193, 194, 194, 604 144, 140, 183, 203, 203, 212, 140, 204, 205, 205, 605 215, 215, 216, 217, 217, 227, 230, 230, 231, 232, 606 232, 236, 213, 242, 245, 245, 246, 247, 247, 148, 607 155, 148, 228, 180, 148, 237, 150, 154, 170, 149, 608 243, 159, 160, 160, 149, 252, 252, 156, 173, 172, 609 151, 159, 253, 253, 154, 164, 166, 164, 166, 177, 610 611 178, 178, 254, 254, 188, 174, 172, 177, 255, 255, 612 169, 182, 167, 182, 185, 186, 185, 186, 187, 256, 613 256, 189, 193, 194, 194, 200, 199, 183, 193, 257, 614 257, 204, 205, 205, 212, 187, 258, 258, 204, 259, 615 259, 211, 201, 199, 216, 217, 217, 260, 260, 227, 616 226, 213, 216, 261, 261, 231, 232, 232, 211, 262, 617 262, 231, 263, 263, 236, 242, 228, 226, 241, 246, 618 247, 247, 264, 264, 246, 265, 265, 168, 237, 266, 619 266, 162, 243, 268, 268, 241, 159, 267, 267, 177, 620 269, 269, 270, 270, 193, 271, 271, 272, 272, 204, 621 622 273, 273, 274, 274, 216, 275, 275, 276, 276, 231, 623 277, 277, 278, 278, 246, 279, 279, 280, 280, 159, 624 281, 281, 282, 282, 177, 283, 283, 284, 284, 193, 625 285, 285, 286, 286, 204, 287, 287, 288, 288, 216, 626 289, 289, 290, 290, 231, 291, 291, 292, 292, 246, 627 293, 293, 159, 294, 294, 177, 295, 295, 193, 296, 628 296, 204, 297, 297, 216, 298, 298, 231, 299, 299, 629 246, 300, 300, 159, 301, 301, 177, 302, 302, 193, 630 303, 303, 204, 304, 304, 216, 305, 305, 231, 306, 631 306, 246, 307, 307, 159, 308, 308, 177, 309, 309, 632 633 193, 310, 310, 204, 311, 311, 216, 312, 312, 231, 634 313, 313, 246, 314, 314, 159, 315, 315, 177, 316, 635 316, 193, 317, 317, 204, 318, 318, 216, 319, 319, 636 231, 320, 320, 246, 321, 321, 159, 322, 322, 177, 637 323, 323, 193, 324, 324, 204, 325, 325, 216, 326, 638 326, 231, 327, 327, 246, 328, 328, 159, 329, 329, 639 177, 330, 330, 193, 331, 331, 204, 332, 332, 216, 640 333, 333, 231, 334, 334, 246, 335, 335, 159, 336, 641 336, 177, 337, 337, 193, 338, 338, 204, 339, 339, 642 216, 340, 340, 231, 341, 341, 246, 342, 342, 159, 643 644 343, 343, 177, 344, 344, 193, 345, 345, 204, 346, 645 346, 216, 347, 347, 231, 348, 348, 246, 349, 349, 646 350, 350, 351, 351, 352, 352, 353, 353, 354, 354, 647 355, 355, 356, 356, 357, 357, 358, 358, 359, 359, 648 360, 360, 361, 361, 362, 362, 363, 363, 54, 54, 649 54, 54, 54, 54, 54, 88, 88, 88, 88, 88, 650 88, 88, 145, 145, 145, 145, 145, 145, 145, 147, 651 251, 147, 154, 154, 154, 154, 154, 154, 157, 157, 652 157, 157, 161, 161, 161, 165, 146, 165, 171, 250, 653 171, 172, 172, 172, 172, 172, 172, 175, 175, 175, 654 655 175, 179, 179, 179, 187, 187, 187, 187, 187, 187, 656 191, 191, 191, 191, 195, 195, 195, 198, 249, 198, 657 199, 199, 199, 199, 199, 199, 202, 202, 202, 202, 658 206, 206, 206, 211, 211, 211, 211, 211, 211, 214, 659 214, 214, 214, 218, 218, 218, 225, 240, 225, 226, 660 226, 226, 226, 226, 226, 229, 229, 229, 229, 233, 661 233, 233, 239, 238, 239, 241, 241, 241, 241, 241, 662 241, 244, 244, 244, 244, 248, 248, 248, 235, 234, 663 224, 223, 222, 221, 220, 219, 210, 209, 208, 207, 664 197, 196, 190, 184, 181, 180, 170, 169, 168, 163, 665 666 162, 153, 146, 364, 54, 54, 53, 364, 364, 364, 667 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 668 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 669 364, 364, 364, 364 670 } ; 671 672static yyconst flex_int16_t yy_chk[835] = 673 { 0, 674 0, 0, 0, 3, 4, 11, 9, 11, 9, 3, 675 4, 10, 15, 10, 9, 11, 64, 64, 15, 10, 676 59, 11, 59, 12, 25, 12, 3, 4, 5, 13, 677 5, 9, 251, 12, 14, 15, 10, 13, 5, 12, 678 248, 25, 14, 13, 5, 13, 5, 6, 14, 6, 679 14, 68, 19, 68, 19, 16, 240, 6, 33, 238, 680 34, 16, 19, 6, 237, 6, 7, 26, 19, 20, 681 7, 20, 33, 7, 34, 7, 7, 7, 16, 20, 682 35, 7, 7, 233, 26, 20, 224, 7, 17, 81, 683 81, 45, 17, 223, 35, 17, 35, 17, 17, 17, 684 685 21, 21, 21, 17, 17, 22, 22, 22, 45, 17, 686 21, 37, 36, 95, 95, 22, 23, 37, 23, 89, 687 23, 89, 23, 91, 23, 91, 36, 23, 36, 23, 688 23, 23, 38, 46, 37, 23, 23, 57, 38, 57, 689 29, 23, 27, 222, 62, 79, 27, 57, 29, 27, 690 46, 27, 27, 27, 29, 38, 29, 27, 27, 30, 691 43, 62, 79, 27, 221, 43, 44, 30, 65, 65, 692 65, 44, 218, 30, 43, 30, 31, 149, 31, 149, 693 44, 47, 31, 210, 92, 31, 47, 31, 31, 31, 694 82, 82, 82, 31, 31, 47, 58, 47, 58, 31, 695 696 41, 92, 209, 41, 41, 206, 58, 41, 48, 41, 697 41, 41, 58, 48, 100, 41, 41, 70, 152, 70, 698 152, 41, 48, 195, 48, 49, 85, 190, 85, 49, 699 184, 100, 49, 70, 49, 49, 49, 96, 96, 96, 700 49, 49, 85, 102, 102, 111, 49, 103, 103, 103, 701 113, 113, 114, 114, 114, 124, 127, 127, 128, 128, 702 128, 131, 111, 139, 141, 141, 142, 142, 142, 148, 703 154, 148, 124, 179, 150, 131, 150, 156, 170, 148, 704 139, 158, 158, 158, 150, 159, 159, 154, 172, 174, 705 150, 160, 160, 160, 156, 164, 166, 164, 166, 176, 706 707 176, 176, 177, 177, 187, 172, 174, 178, 178, 178, 708 169, 182, 166, 182, 185, 186, 185, 186, 189, 193, 709 193, 187, 192, 192, 192, 199, 201, 182, 194, 194, 710 194, 203, 203, 203, 211, 189, 204, 204, 205, 205, 711 205, 213, 199, 201, 215, 215, 215, 216, 216, 226, 712 228, 211, 217, 217, 217, 230, 230, 230, 213, 231, 713 231, 232, 232, 232, 236, 241, 226, 228, 243, 245, 714 245, 245, 246, 246, 247, 247, 247, 168, 236, 252, 715 252, 161, 241, 254, 254, 243, 253, 253, 253, 255, 716 255, 255, 256, 256, 257, 257, 257, 258, 258, 259, 717 718 259, 259, 260, 260, 261, 261, 261, 262, 262, 263, 719 263, 263, 264, 264, 265, 265, 265, 266, 266, 267, 720 267, 267, 268, 268, 269, 269, 269, 270, 270, 271, 721 271, 271, 272, 272, 273, 273, 273, 274, 274, 275, 722 275, 275, 276, 276, 277, 277, 277, 278, 278, 279, 723 279, 279, 281, 281, 281, 283, 283, 283, 285, 285, 724 285, 287, 287, 287, 289, 289, 289, 291, 291, 291, 725 293, 293, 293, 294, 294, 294, 295, 295, 295, 296, 726 296, 296, 297, 297, 297, 298, 298, 298, 299, 299, 727 299, 300, 300, 300, 301, 301, 301, 302, 302, 302, 728 729 303, 303, 303, 304, 304, 304, 305, 305, 305, 306, 730 306, 306, 307, 307, 307, 308, 308, 308, 309, 309, 731 309, 310, 310, 310, 311, 311, 311, 312, 312, 312, 732 313, 313, 313, 314, 314, 314, 315, 315, 315, 316, 733 316, 316, 317, 317, 317, 318, 318, 318, 319, 319, 734 319, 320, 320, 320, 321, 321, 321, 322, 322, 322, 735 323, 323, 323, 324, 324, 324, 325, 325, 325, 326, 736 326, 326, 327, 327, 327, 328, 328, 328, 329, 329, 737 329, 330, 330, 330, 331, 331, 331, 332, 332, 332, 738 333, 333, 333, 334, 334, 334, 335, 335, 335, 336, 739 740 336, 336, 337, 337, 337, 338, 338, 338, 339, 339, 741 339, 340, 340, 340, 341, 341, 341, 342, 342, 342, 742 343, 343, 344, 344, 345, 345, 346, 346, 347, 347, 743 348, 348, 349, 349, 350, 350, 351, 351, 352, 352, 744 353, 353, 354, 354, 355, 355, 356, 356, 365, 365, 745 365, 365, 365, 365, 365, 366, 366, 366, 366, 366, 746 366, 366, 367, 367, 367, 367, 367, 367, 367, 368, 747 153, 368, 369, 369, 369, 369, 369, 369, 370, 370, 748 370, 370, 371, 371, 371, 372, 146, 372, 373, 144, 749 373, 374, 374, 374, 374, 374, 374, 375, 375, 375, 750 751 375, 376, 376, 376, 377, 377, 377, 377, 377, 377, 752 378, 378, 378, 378, 379, 379, 379, 380, 143, 380, 753 381, 381, 381, 381, 381, 381, 382, 382, 382, 382, 754 383, 383, 383, 384, 384, 384, 384, 384, 384, 385, 755 385, 385, 385, 386, 386, 386, 387, 135, 387, 388, 756 388, 388, 388, 388, 388, 389, 389, 389, 389, 390, 757 390, 390, 391, 133, 391, 392, 392, 392, 392, 392, 758 392, 393, 393, 393, 393, 394, 394, 394, 130, 129, 759 122, 119, 118, 117, 116, 115, 110, 106, 105, 104, 760 98, 97, 93, 87, 84, 83, 77, 73, 72, 67, 761 762 66, 61, 55, 53, 52, 51, 364, 364, 364, 364, 763 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 764 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 765 364, 364, 364, 364 766 } ; 767 768/* The intent behind this definition is that it'll catch 769 * any uses of REJECT which flex missed. 770 */ 771#define REJECT reject_used_but_not_detected 772#define yymore() yymore_used_but_not_detected 773#define YY_MORE_ADJ 0 774#define YY_RESTORE_YY_MORE_OFFSET 775#line 1 "ls-sfparser.l" 776 777#line 27 "ls-sfparser.l" 778#include <stddef.h> 779#include "ls-sfparser.h" 780struct ls_sf_parser 781{ 782 /* Return 0 on success, -1 on error to stop parsing. */ 783 int (*callback)(void *user_data, enum ls_sf_dt, 784 char *str, size_t len, int off); 785 void *user_data; 786 const char *errmsg; 787 enum ls_sf_tlt top_level_type; 788 int mem_failed; 789 char *mem; 790 size_t mem_sz; 791 size_t mem_off; 792 /* XXX "last malloced" allows for a couple of rudimentary optimizations, 793 * but they never occurred in the input I tried. 794 */ 795 char *last_malloced; 796}; 797#define SFP ((struct ls_sf_parser *) yyextra) 798#define CALLBACK(dt_, str_, len_, addl_) do { \ 799 if (SFP->callback(SFP->user_data, (dt_), (str_), (len_), \ 800 (addl_) >= 0 ? \ 801 yyg->yy_c_buf_p - yyleng - YY_CURRENT_BUFFER->yy_ch_buf + (addl_) : \ 802 (addl_))) \ 803 return -1; \ 804} while (0) 805#define YY_FATAL_ERROR(msg_) do { \ 806 (void) yy_fatal_error /* silence compiler warning */; \ 807 ((struct ls_sf_parser *) \ 808 (ls_sfp_get_extra(yyscanner)))->errmsg = (msg_); \ 809 ((struct yyguts_t*)yyscanner)->yy_start = 1 + 2 * ERROR_STATE; \ 810} while (0) 811#define YY_NO_INPUT 1 812#define YY_NO_UNISTD_H 1 813/* TCHAR: RFC 7230, Section 3.2.6 */ 814 815 816 817 818 819 820 821#line 821 "ls-sfparser.c" 822 823#define INITIAL 0 824#define DICTIONARY 1 825#define DIC_MEMBER_EQ 2 826#define DIC_MEMBER_ITEM 3 827#define DIC_NEXT_ITEM 4 828#define DIC_OPTIONAL_PARAM 5 829#define DIC_PARAM_EQ 6 830#define DIC_PARAM_KEY 7 831#define DIC_PARAM_ITEM 8 832#define LIST_OPTIONAL_PARAM 9 833#define LIST 10 834#define LIST_NEXT_ITEM 11 835#define LIST_PARAM_KEY 12 836#define LIST_PARAM_ITEM 13 837#define LIST_PARAM_EQ 14 838#define ITEM 15 839#define ITEM_OPTIONAL_PARAM 16 840#define ITEM_PARAM_EQ 17 841#define ITEM_PARAM_KEY 18 842#define ITEM_BARE_ITEM 19 843#define INNER_LIST 20 844#define IL_OPTIONAL_PARAM 21 845#define IL_PARAM_KEY 22 846#define IL_PARAM_EQ 23 847#define IL_PARAM_ITEM 24 848#define ERROR_STATE 25 849 850#ifndef YY_NO_UNISTD_H 851/* Special case for "unistd.h", since it is non-ANSI. We include it way 852 * down here because we want the user's section 1 to have been scanned first. 853 * The user has a chance to override it with an option. 854 */ 855#include <unistd.h> 856#endif 857 858#ifndef YY_EXTRA_TYPE 859#define YY_EXTRA_TYPE void * 860#endif 861 862/* Holds the entire state of the reentrant scanner. */ 863struct yyguts_t 864 { 865 866 /* User-defined. Not touched by flex. */ 867 YY_EXTRA_TYPE yyextra_r; 868 869 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 870 FILE *yyin_r, *yyout_r; 871 size_t yy_buffer_stack_top; /**< index of top of stack. */ 872 size_t yy_buffer_stack_max; /**< capacity of stack. */ 873 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 874 char yy_hold_char; 875 int yy_n_chars; 876 int yyleng_r; 877 char *yy_c_buf_p; 878 int yy_init; 879 int yy_start; 880 int yy_did_buffer_switch_on_eof; 881 int yy_start_stack_ptr; 882 int yy_start_stack_depth; 883 int *yy_start_stack; 884 yy_state_type yy_last_accepting_state; 885 char* yy_last_accepting_cpos; 886 887 int yylineno_r; 888 int yy_flex_debug_r; 889 890 char *yytext_r; 891 int yy_more_flag; 892 int yy_more_len; 893 894 }; /* end struct yyguts_t */ 895 896static int yy_init_globals (yyscan_t yyscanner ); 897 898int ls_sfp_lex_init (yyscan_t* scanner); 899 900int ls_sfp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); 901 902/* Accessor methods to globals. 903 These are made visible to non-reentrant scanners for convenience. */ 904 905int ls_sfp_lex_destroy (yyscan_t yyscanner ); 906 907int ls_sfp_get_debug (yyscan_t yyscanner ); 908 909void ls_sfp_set_debug (int debug_flag ,yyscan_t yyscanner ); 910 911YY_EXTRA_TYPE ls_sfp_get_extra (yyscan_t yyscanner ); 912 913void ls_sfp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 914 915FILE *ls_sfp_get_in (yyscan_t yyscanner ); 916 917void ls_sfp_set_in (FILE * in_str ,yyscan_t yyscanner ); 918 919FILE *ls_sfp_get_out (yyscan_t yyscanner ); 920 921void ls_sfp_set_out (FILE * out_str ,yyscan_t yyscanner ); 922 923int ls_sfp_get_leng (yyscan_t yyscanner ); 924 925char *ls_sfp_get_text (yyscan_t yyscanner ); 926 927int ls_sfp_get_lineno (yyscan_t yyscanner ); 928 929void ls_sfp_set_lineno (int line_number ,yyscan_t yyscanner ); 930 931/* Macros after this point can all be overridden by user definitions in 932 * section 1. 933 */ 934 935#ifndef YY_SKIP_YYWRAP 936#ifdef __cplusplus 937extern "C" int ls_sfp_wrap (yyscan_t yyscanner ); 938#else 939extern int ls_sfp_wrap (yyscan_t yyscanner ); 940#endif 941#endif 942 943#ifndef yytext_ptr 944static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 945#endif 946 947#ifdef YY_NEED_STRLEN 948static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 949#endif 950 951#ifndef YY_NO_INPUT 952 953#ifdef __cplusplus 954static int yyinput (yyscan_t yyscanner ); 955#else 956static int input (yyscan_t yyscanner ); 957#endif 958 959#endif 960 961/* Amount of stuff to slurp up with each read. */ 962#ifndef YY_READ_BUF_SIZE 963#ifdef __ia64__ 964/* On IA-64, the buffer size is 16k, not 8k */ 965#define YY_READ_BUF_SIZE 16384 966#else 967#define YY_READ_BUF_SIZE 8192 968#endif /* __ia64__ */ 969#endif 970 971/* Copy whatever the last rule matched to the standard output. */ 972#ifndef ECHO 973/* This used to be an fputs(), but since the string might contain NUL's, 974 * we now use fwrite(). 975 */ 976#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 977#endif 978 979/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 980 * is returned in "result". 981 */ 982#ifndef YY_INPUT 983#define YY_INPUT(buf,result,max_size) \ 984 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 985 { \ 986 int c = '*'; \ 987 size_t n; \ 988 for ( n = 0; n < max_size && \ 989 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 990 buf[n] = (char) c; \ 991 if ( c == '\n' ) \ 992 buf[n++] = (char) c; \ 993 if ( c == EOF && ferror( yyin ) ) \ 994 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 995 result = n; \ 996 } \ 997 else \ 998 { \ 999 errno=0; \ 1000 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 1001 { \ 1002 if( errno != EINTR) \ 1003 { \ 1004 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 1005 break; \ 1006 } \ 1007 errno=0; \ 1008 clearerr(yyin); \ 1009 } \ 1010 }\ 1011\ 1012 1013#endif 1014 1015/* No semi-colon after return; correct usage is to write "yyterminate();" - 1016 * we don't want an extra ';' after the "return" because that will cause 1017 * some compilers to complain about unreachable statements. 1018 */ 1019#ifndef yyterminate 1020#define yyterminate() return YY_NULL 1021#endif 1022 1023/* Number of entries by which start-condition stack grows. */ 1024#ifndef YY_START_STACK_INCR 1025#define YY_START_STACK_INCR 25 1026#endif 1027 1028/* Report a fatal error. */ 1029#ifndef YY_FATAL_ERROR 1030#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) 1031#endif 1032 1033/* end tables serialization structures and prototypes */ 1034 1035/* Default declaration of generated scanner - a define so the user can 1036 * easily add parameters. 1037 */ 1038#ifndef YY_DECL 1039#define YY_DECL_IS_OURS 1 1040 1041extern int ls_sfp_lex (yyscan_t yyscanner); 1042 1043#define YY_DECL int ls_sfp_lex (yyscan_t yyscanner) 1044#endif /* !YY_DECL */ 1045 1046/* Code executed at the beginning of each rule, after yytext and yyleng 1047 * have been set up. 1048 */ 1049#ifndef YY_USER_ACTION 1050#define YY_USER_ACTION 1051#endif 1052 1053/* Code executed at the end of each rule. */ 1054#ifndef YY_BREAK 1055#define YY_BREAK break; 1056#endif 1057 1058#define YY_RULE_SETUP \ 1059 YY_USER_ACTION 1060 1061/** The main scanner function which does all the work. 1062 */ 1063YY_DECL 1064{ 1065 register yy_state_type yy_current_state; 1066 register char *yy_cp, *yy_bp; 1067 register int yy_act; 1068 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1069 1070#line 101 "ls-sfparser.l" 1071 1072 1073 char TRUE[] = "1"; 1074 1075 switch (SFP->top_level_type) 1076 { 1077 case LS_SF_TLT_DICTIONARY: 1078 BEGIN(DICTIONARY); 1079 break; 1080 case LS_SF_TLT_LIST: 1081 BEGIN(LIST); 1082 break; 1083 case LS_SF_TLT_ITEM: 1084 BEGIN(ITEM); 1085 break; 1086 default: 1087 SFP->errmsg = "invalid top-level type specified"; 1088 return -1; 1089 } 1090 1091#line 1091 "ls-sfparser.c" 1092 1093 if ( !yyg->yy_init ) 1094 { 1095 yyg->yy_init = 1; 1096 1097#ifdef YY_USER_INIT 1098 YY_USER_INIT; 1099#endif 1100 1101 if ( ! yyg->yy_start ) 1102 yyg->yy_start = 1; /* first start state */ 1103 1104 if ( ! yyin ) 1105 yyin = stdin; 1106 1107 if ( ! yyout ) 1108 yyout = stdout; 1109 1110 if ( ! YY_CURRENT_BUFFER ) { 1111 if (ls_sfp_ensure_buffer_stack (yyscanner)) 1112 return -1; 1113 YY_CURRENT_BUFFER_LVALUE = 1114 ls_sfp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1115 } 1116 1117 ls_sfp__load_buffer_state(yyscanner ); 1118 } 1119 1120 while ( 1 ) /* loops until end-of-file is reached */ 1121 { 1122 yy_cp = yyg->yy_c_buf_p; 1123 1124 /* Support of yytext. */ 1125 *yy_cp = yyg->yy_hold_char; 1126 1127 /* yy_bp points to the position in yy_ch_buf of the start of 1128 * the current run. 1129 */ 1130 yy_bp = yy_cp; 1131 1132 yy_current_state = yyg->yy_start; 1133yy_match: 1134 do 1135 { 1136 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 1137 if ( yy_accept[yy_current_state] ) 1138 { 1139 yyg->yy_last_accepting_state = yy_current_state; 1140 yyg->yy_last_accepting_cpos = yy_cp; 1141 } 1142 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1143 { 1144 yy_current_state = (int) yy_def[yy_current_state]; 1145 if ( yy_current_state >= 365 ) 1146 yy_c = yy_meta[(unsigned int) yy_c]; 1147 } 1148 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1149 ++yy_cp; 1150 } 1151 while ( yy_current_state != 364 ); 1152 yy_cp = yyg->yy_last_accepting_cpos; 1153 yy_current_state = yyg->yy_last_accepting_state; 1154 1155yy_find_action: 1156 yy_act = yy_accept[yy_current_state]; 1157 1158 YY_DO_BEFORE_ACTION; 1159 1160do_action: /* This label is used only to access EOF actions. */ 1161 1162 switch ( yy_act ) 1163 { /* beginning of action switch */ 1164 case 0: /* must back up */ 1165 /* undo the effects of YY_DO_BEFORE_ACTION */ 1166 *yy_cp = yyg->yy_hold_char; 1167 yy_cp = yyg->yy_last_accepting_cpos; 1168 yy_current_state = yyg->yy_last_accepting_state; 1169 goto yy_find_action; 1170 1171case 1: 1172YY_RULE_SETUP 1173#line 122 "ls-sfparser.l" 1174/* Eat up whitespace */ 1175 YY_BREAK 1176case 2: 1177YY_RULE_SETUP 1178#line 123 "ls-sfparser.l" 1179{ CALLBACK(LS_SF_DT_NAME, yytext, yyleng, 0); 1180 BEGIN(DIC_MEMBER_EQ); } 1181 YY_BREAK 1182 1183 1184case YY_STATE_EOF(DIC_NEXT_ITEM): 1185#line 128 "ls-sfparser.l" 1186{ return -1; } 1187 YY_BREAK 1188case 3: 1189YY_RULE_SETUP 1190#line 129 "ls-sfparser.l" 1191/* Eat up whitespace */ 1192 YY_BREAK 1193case 4: 1194YY_RULE_SETUP 1195#line 130 "ls-sfparser.l" 1196{ CALLBACK(LS_SF_DT_NAME, yytext, yyleng, 0); 1197 BEGIN(DIC_MEMBER_EQ); } 1198 YY_BREAK 1199 1200case 5: 1201YY_RULE_SETUP 1202#line 134 "ls-sfparser.l" 1203{ CALLBACK(LS_SF_DT_INNER_LIST_BEGIN, yytext + 1, yyleng - 1, 1); 1204 BEGIN(INNER_LIST); } 1205 YY_BREAK 1206case 6: 1207YY_RULE_SETUP 1208#line 137 "ls-sfparser.l" 1209{ BEGIN(DIC_MEMBER_ITEM); } 1210 YY_BREAK 1211case 7: 1212YY_RULE_SETUP 1213#line 139 "ls-sfparser.l" 1214{ TRUE[0] = '1'; 1215 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1216 BEGIN(DIC_PARAM_KEY); } 1217 YY_BREAK 1218case 8: 1219YY_RULE_SETUP 1220#line 143 "ls-sfparser.l" 1221{ TRUE[0] = '1'; 1222 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1223 BEGIN(DIC_NEXT_ITEM); } 1224 YY_BREAK 1225case YY_STATE_EOF(DIC_MEMBER_EQ): 1226#line 147 "ls-sfparser.l" 1227{ TRUE[0] = '1'; 1228 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1229 return 0; } 1230 YY_BREAK 1231 1232case 9: 1233YY_RULE_SETUP 1234#line 152 "ls-sfparser.l" 1235{ CALLBACK(LS_SF_DT_INNER_LIST_END, yytext, yyleng, 0); 1236 if (SFP->top_level_type == LS_SF_TLT_DICTIONARY) 1237 BEGIN(DIC_OPTIONAL_PARAM); 1238 else 1239 BEGIN(LIST_OPTIONAL_PARAM); } 1240 YY_BREAK 1241case 10: 1242YY_RULE_SETUP 1243#line 157 "ls-sfparser.l" 1244{ CALLBACK(LS_SF_DT_INTEGER, yytext, yyleng, 0); 1245 BEGIN(IL_OPTIONAL_PARAM); 1246 } 1247 YY_BREAK 1248case 11: 1249YY_RULE_SETUP 1250#line 160 "ls-sfparser.l" 1251{ CALLBACK(LS_SF_DT_DECIMAL, yytext, yyleng, 0); 1252 BEGIN(IL_OPTIONAL_PARAM); 1253 } 1254 YY_BREAK 1255case 12: 1256YY_RULE_SETUP 1257#line 163 "ls-sfparser.l" 1258{ 1259 yytext[yyleng - 1] = '\0'; 1260 CALLBACK(LS_SF_DT_STRING, yytext + 1, yyleng - 2, 1); 1261 BEGIN(IL_OPTIONAL_PARAM); 1262 } 1263 YY_BREAK 1264case 13: 1265YY_RULE_SETUP 1266#line 168 "ls-sfparser.l" 1267{ CALLBACK(LS_SF_DT_TOKEN, yytext, yyleng, 0); 1268 BEGIN(IL_OPTIONAL_PARAM); 1269 } 1270 YY_BREAK 1271case 14: 1272YY_RULE_SETUP 1273#line 171 "ls-sfparser.l" 1274{ 1275 yytext[yyleng - 1] = '\0'; 1276 CALLBACK(LS_SF_DT_BYTESEQ, yytext + 1, yyleng - 2, 1); 1277 BEGIN(IL_OPTIONAL_PARAM); 1278 } 1279 YY_BREAK 1280case 15: 1281YY_RULE_SETUP 1282#line 176 "ls-sfparser.l" 1283{ CALLBACK(LS_SF_DT_BOOLEAN, yytext + 1, yyleng - 1, 1); 1284 BEGIN(IL_OPTIONAL_PARAM); 1285 } 1286 YY_BREAK 1287case YY_STATE_EOF(INNER_LIST): 1288#line 179 "ls-sfparser.l" 1289{ return -1; } 1290 YY_BREAK 1291 1292 1293case 16: 1294YY_RULE_SETUP 1295#line 183 "ls-sfparser.l" 1296{ BEGIN(IL_PARAM_KEY); } 1297 YY_BREAK 1298case 17: 1299YY_RULE_SETUP 1300#line 184 "ls-sfparser.l" 1301{ CALLBACK(LS_SF_DT_INNER_LIST_END, yytext, yyleng, 0); 1302 if (SFP->top_level_type == LS_SF_TLT_DICTIONARY) 1303 BEGIN(DIC_OPTIONAL_PARAM); 1304 else 1305 BEGIN(LIST_OPTIONAL_PARAM); } 1306 YY_BREAK 1307case 18: 1308YY_RULE_SETUP 1309#line 189 "ls-sfparser.l" 1310{ BEGIN(INNER_LIST); } 1311 YY_BREAK 1312case YY_STATE_EOF(IL_OPTIONAL_PARAM): 1313#line 190 "ls-sfparser.l" 1314{ return -1; } 1315 YY_BREAK 1316 1317case 19: 1318YY_RULE_SETUP 1319#line 193 "ls-sfparser.l" 1320{ CALLBACK(LS_SF_DT_PARAM_NAME, yytext, yyleng, 0); 1321 BEGIN(IL_PARAM_EQ); } 1322 YY_BREAK 1323 1324case 20: 1325YY_RULE_SETUP 1326#line 197 "ls-sfparser.l" 1327{ BEGIN(IL_PARAM_ITEM); } 1328 YY_BREAK 1329case 21: 1330YY_RULE_SETUP 1331#line 198 "ls-sfparser.l" 1332{ TRUE[0] = '1'; 1333 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1334 BEGIN(IL_OPTIONAL_PARAM); } 1335 YY_BREAK 1336case 22: 1337YY_RULE_SETUP 1338#line 201 "ls-sfparser.l" 1339{ TRUE[0] = '1'; 1340 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1341 BEGIN(IL_PARAM_KEY); } 1342 YY_BREAK 1343case 23: 1344YY_RULE_SETUP 1345#line 204 "ls-sfparser.l" 1346{ TRUE[0] = '1'; 1347 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1348 CALLBACK(LS_SF_DT_INNER_LIST_END, yytext, yyleng, 0); 1349 if (SFP->top_level_type == LS_SF_TLT_DICTIONARY) 1350 BEGIN(DIC_OPTIONAL_PARAM); 1351 else 1352 BEGIN(LIST_OPTIONAL_PARAM); } 1353 YY_BREAK 1354 1355 1356case 24: 1357YY_RULE_SETUP 1358#line 214 "ls-sfparser.l" 1359{ CALLBACK(LS_SF_DT_INTEGER, yytext, yyleng, 0); 1360 BEGIN(IL_OPTIONAL_PARAM); 1361 } 1362 YY_BREAK 1363case 25: 1364YY_RULE_SETUP 1365#line 217 "ls-sfparser.l" 1366{ CALLBACK(LS_SF_DT_DECIMAL, yytext, yyleng, 0); 1367 BEGIN(IL_OPTIONAL_PARAM); 1368 } 1369 YY_BREAK 1370case 26: 1371YY_RULE_SETUP 1372#line 220 "ls-sfparser.l" 1373{ 1374 yytext[yyleng - 1] = '\0'; 1375 CALLBACK(LS_SF_DT_STRING, yytext + 1, yyleng - 2, 1); 1376 BEGIN(IL_OPTIONAL_PARAM); 1377 } 1378 YY_BREAK 1379case 27: 1380YY_RULE_SETUP 1381#line 225 "ls-sfparser.l" 1382{ CALLBACK(LS_SF_DT_TOKEN, yytext, yyleng, 0); 1383 BEGIN(IL_OPTIONAL_PARAM); 1384 } 1385 YY_BREAK 1386case 28: 1387YY_RULE_SETUP 1388#line 228 "ls-sfparser.l" 1389{ 1390 yytext[yyleng - 1] = '\0'; 1391 CALLBACK(LS_SF_DT_BYTESEQ, yytext + 1, yyleng - 2, 1); 1392 BEGIN(IL_OPTIONAL_PARAM); 1393 } 1394 YY_BREAK 1395case 29: 1396YY_RULE_SETUP 1397#line 233 "ls-sfparser.l" 1398{ CALLBACK(LS_SF_DT_BOOLEAN, yytext + 1, yyleng - 1, 1); 1399 BEGIN(IL_OPTIONAL_PARAM); 1400 } 1401 YY_BREAK 1402case YY_STATE_EOF(IL_PARAM_ITEM): 1403#line 236 "ls-sfparser.l" 1404{ return -1; } 1405 YY_BREAK 1406 1407 1408case 30: 1409YY_RULE_SETUP 1410#line 240 "ls-sfparser.l" 1411{ CALLBACK(LS_SF_DT_INTEGER, yytext, yyleng, 0); 1412 BEGIN(DIC_OPTIONAL_PARAM); 1413 } 1414 YY_BREAK 1415case 31: 1416YY_RULE_SETUP 1417#line 243 "ls-sfparser.l" 1418{ CALLBACK(LS_SF_DT_DECIMAL, yytext, yyleng, 0); 1419 BEGIN(DIC_OPTIONAL_PARAM); 1420 } 1421 YY_BREAK 1422case 32: 1423YY_RULE_SETUP 1424#line 246 "ls-sfparser.l" 1425{ 1426 yytext[yyleng - 1] = '\0'; 1427 CALLBACK(LS_SF_DT_STRING, yytext + 1, yyleng - 2, 1); 1428 BEGIN(DIC_OPTIONAL_PARAM); 1429 } 1430 YY_BREAK 1431case 33: 1432YY_RULE_SETUP 1433#line 251 "ls-sfparser.l" 1434{ CALLBACK(LS_SF_DT_TOKEN, yytext, yyleng, 0); 1435 BEGIN(DIC_OPTIONAL_PARAM); 1436 } 1437 YY_BREAK 1438case 34: 1439YY_RULE_SETUP 1440#line 254 "ls-sfparser.l" 1441{ 1442 yytext[yyleng - 1] = '\0'; 1443 CALLBACK(LS_SF_DT_BYTESEQ, yytext + 1, yyleng - 2, 1); 1444 BEGIN(DIC_OPTIONAL_PARAM); 1445 } 1446 YY_BREAK 1447case 35: 1448YY_RULE_SETUP 1449#line 259 "ls-sfparser.l" 1450{ CALLBACK(LS_SF_DT_BOOLEAN, yytext + 1, yyleng - 1, 1); 1451 BEGIN(DIC_OPTIONAL_PARAM); 1452 } 1453 YY_BREAK 1454case YY_STATE_EOF(DIC_MEMBER_ITEM): 1455#line 262 "ls-sfparser.l" 1456{ return -1; } 1457 YY_BREAK 1458 1459 1460case 36: 1461YY_RULE_SETUP 1462#line 266 "ls-sfparser.l" 1463{ return -1; } 1464 YY_BREAK 1465case 37: 1466YY_RULE_SETUP 1467#line 267 "ls-sfparser.l" 1468/* Eat up whitespace */ 1469 YY_BREAK 1470case 38: 1471YY_RULE_SETUP 1472#line 268 "ls-sfparser.l" 1473{ BEGIN(DIC_PARAM_KEY); } 1474 YY_BREAK 1475case 39: 1476YY_RULE_SETUP 1477#line 269 "ls-sfparser.l" 1478{ BEGIN(DIC_NEXT_ITEM); } 1479 YY_BREAK 1480case YY_STATE_EOF(DIC_OPTIONAL_PARAM): 1481#line 270 "ls-sfparser.l" 1482{ return 0; } 1483 YY_BREAK 1484 1485 1486case 40: 1487YY_RULE_SETUP 1488#line 274 "ls-sfparser.l" 1489/* Eat up whitespace */ 1490 YY_BREAK 1491case 41: 1492YY_RULE_SETUP 1493#line 275 "ls-sfparser.l" 1494{ CALLBACK(LS_SF_DT_PARAM_NAME, yytext, yyleng, 0); 1495 BEGIN(DIC_PARAM_EQ); } 1496 YY_BREAK 1497 1498 1499case 42: 1500YY_RULE_SETUP 1501#line 280 "ls-sfparser.l" 1502{ BEGIN(DIC_PARAM_ITEM); } 1503 YY_BREAK 1504case 43: 1505YY_RULE_SETUP 1506#line 281 "ls-sfparser.l" 1507{ TRUE[0] = '1'; 1508 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1509 BEGIN(DIC_NEXT_ITEM); 1510 } 1511 YY_BREAK 1512case 44: 1513YY_RULE_SETUP 1514#line 285 "ls-sfparser.l" 1515{ TRUE[0] = '1'; 1516 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1517 BEGIN(DIC_PARAM_KEY); 1518 } 1519 YY_BREAK 1520case 45: 1521YY_RULE_SETUP 1522#line 289 "ls-sfparser.l" 1523{ TRUE[0] = '1'; 1524 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1525 BEGIN(DIC_OPTIONAL_PARAM); 1526 } 1527 YY_BREAK 1528case YY_STATE_EOF(DIC_PARAM_EQ): 1529#line 293 "ls-sfparser.l" 1530{ TRUE[0] = '1'; 1531 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1532 return 0; 1533 } 1534 YY_BREAK 1535 1536 1537case 46: 1538YY_RULE_SETUP 1539#line 300 "ls-sfparser.l" 1540{ CALLBACK(LS_SF_DT_INTEGER, yytext, yyleng, 0); 1541 BEGIN(DIC_OPTIONAL_PARAM); 1542 } 1543 YY_BREAK 1544case 47: 1545YY_RULE_SETUP 1546#line 303 "ls-sfparser.l" 1547{ CALLBACK(LS_SF_DT_DECIMAL, yytext, yyleng, 0); 1548 BEGIN(DIC_OPTIONAL_PARAM); 1549 } 1550 YY_BREAK 1551case 48: 1552YY_RULE_SETUP 1553#line 306 "ls-sfparser.l" 1554{ 1555 yytext[yyleng - 1] = '\0'; 1556 CALLBACK(LS_SF_DT_STRING, yytext + 1, yyleng - 2, 1); 1557 BEGIN(DIC_OPTIONAL_PARAM); 1558 } 1559 YY_BREAK 1560case 49: 1561YY_RULE_SETUP 1562#line 311 "ls-sfparser.l" 1563{ CALLBACK(LS_SF_DT_TOKEN, yytext, yyleng, 0); 1564 BEGIN(DIC_OPTIONAL_PARAM); 1565 } 1566 YY_BREAK 1567case 50: 1568YY_RULE_SETUP 1569#line 314 "ls-sfparser.l" 1570{ 1571 yytext[yyleng - 1] = '\0'; 1572 CALLBACK(LS_SF_DT_BYTESEQ, yytext + 1, yyleng - 2, 1); 1573 BEGIN(DIC_OPTIONAL_PARAM); 1574 } 1575 YY_BREAK 1576case 51: 1577YY_RULE_SETUP 1578#line 319 "ls-sfparser.l" 1579{ CALLBACK(LS_SF_DT_BOOLEAN, yytext + 1, yyleng - 1, 1); 1580 BEGIN(DIC_OPTIONAL_PARAM); 1581 } 1582 YY_BREAK 1583case YY_STATE_EOF(DIC_PARAM_ITEM): 1584#line 322 "ls-sfparser.l" 1585{ return -1; } 1586 YY_BREAK 1587 1588 1589case 52: 1590YY_RULE_SETUP 1591#line 326 "ls-sfparser.l" 1592/* Eat up whitespace */ 1593 YY_BREAK 1594case 53: 1595YY_RULE_SETUP 1596#line 327 "ls-sfparser.l" 1597{ return -1; } 1598 YY_BREAK 1599case 54: 1600YY_RULE_SETUP 1601#line 328 "ls-sfparser.l" 1602{ yyless(0); BEGIN(LIST_NEXT_ITEM); } 1603 YY_BREAK 1604 1605 1606case YY_STATE_EOF(LIST_NEXT_ITEM): 1607#line 332 "ls-sfparser.l" 1608{ return -1; } 1609 YY_BREAK 1610case 55: 1611YY_RULE_SETUP 1612#line 333 "ls-sfparser.l" 1613/* Eat up whitespace */ 1614 YY_BREAK 1615case 56: 1616YY_RULE_SETUP 1617#line 334 "ls-sfparser.l" 1618{ CALLBACK(LS_SF_DT_INNER_LIST_BEGIN, yytext, yyleng, 0); 1619 BEGIN(INNER_LIST); } 1620 YY_BREAK 1621case 57: 1622YY_RULE_SETUP 1623#line 336 "ls-sfparser.l" 1624{ CALLBACK(LS_SF_DT_INTEGER, yytext, yyleng, 0); 1625 BEGIN(LIST_OPTIONAL_PARAM); 1626 } 1627 YY_BREAK 1628case 58: 1629YY_RULE_SETUP 1630#line 339 "ls-sfparser.l" 1631{ CALLBACK(LS_SF_DT_DECIMAL, yytext, yyleng, 0); 1632 BEGIN(LIST_OPTIONAL_PARAM); 1633 } 1634 YY_BREAK 1635case 59: 1636YY_RULE_SETUP 1637#line 342 "ls-sfparser.l" 1638{ 1639 yytext[yyleng - 1] = '\0'; 1640 CALLBACK(LS_SF_DT_STRING, yytext + 1, yyleng - 2, 1); 1641 BEGIN(LIST_OPTIONAL_PARAM); 1642 } 1643 YY_BREAK 1644case 60: 1645YY_RULE_SETUP 1646#line 347 "ls-sfparser.l" 1647{ CALLBACK(LS_SF_DT_TOKEN, yytext, yyleng, 0); 1648 BEGIN(LIST_OPTIONAL_PARAM); 1649 } 1650 YY_BREAK 1651case 61: 1652YY_RULE_SETUP 1653#line 350 "ls-sfparser.l" 1654{ 1655 yytext[yyleng - 1] = '\0'; 1656 CALLBACK(LS_SF_DT_BYTESEQ, yytext + 1, yyleng - 2, 1); 1657 BEGIN(LIST_OPTIONAL_PARAM); 1658 } 1659 YY_BREAK 1660case 62: 1661YY_RULE_SETUP 1662#line 355 "ls-sfparser.l" 1663{ CALLBACK(LS_SF_DT_BOOLEAN, yytext + 1, yyleng - 1, 1); 1664 BEGIN(LIST_OPTIONAL_PARAM); 1665 } 1666 YY_BREAK 1667 1668 1669case 63: 1670YY_RULE_SETUP 1671#line 361 "ls-sfparser.l" 1672{ return -1; } 1673 YY_BREAK 1674case 64: 1675YY_RULE_SETUP 1676#line 362 "ls-sfparser.l" 1677/* Eat up whitespace */ 1678 YY_BREAK 1679case 65: 1680YY_RULE_SETUP 1681#line 363 "ls-sfparser.l" 1682{ BEGIN(LIST_PARAM_KEY); } 1683 YY_BREAK 1684case 66: 1685YY_RULE_SETUP 1686#line 364 "ls-sfparser.l" 1687{ BEGIN(LIST_NEXT_ITEM); } 1688 YY_BREAK 1689 1690case 67: 1691YY_RULE_SETUP 1692#line 367 "ls-sfparser.l" 1693{ CALLBACK(LS_SF_DT_PARAM_NAME, yytext, yyleng, 0); 1694 BEGIN(LIST_PARAM_EQ); } 1695 YY_BREAK 1696 1697case 68: 1698YY_RULE_SETUP 1699#line 371 "ls-sfparser.l" 1700{ BEGIN(LIST_PARAM_ITEM); } 1701 YY_BREAK 1702case 69: 1703YY_RULE_SETUP 1704#line 372 "ls-sfparser.l" 1705{ TRUE[0] = '1'; 1706 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1707 BEGIN(LIST_OPTIONAL_PARAM); } 1708 YY_BREAK 1709case 70: 1710YY_RULE_SETUP 1711#line 375 "ls-sfparser.l" 1712{ TRUE[0] = '1'; 1713 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1714 BEGIN(LIST_PARAM_KEY); } 1715 YY_BREAK 1716case 71: 1717YY_RULE_SETUP 1718#line 378 "ls-sfparser.l" 1719{ TRUE[0] = '1'; 1720 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1721 BEGIN(LIST_NEXT_ITEM); } 1722 YY_BREAK 1723 1724 1725case 72: 1726YY_RULE_SETUP 1727#line 384 "ls-sfparser.l" 1728{ CALLBACK(LS_SF_DT_INTEGER, yytext, yyleng, 0); 1729 BEGIN(LIST_OPTIONAL_PARAM); 1730 } 1731 YY_BREAK 1732case 73: 1733YY_RULE_SETUP 1734#line 387 "ls-sfparser.l" 1735{ CALLBACK(LS_SF_DT_DECIMAL, yytext, yyleng, 0); 1736 BEGIN(LIST_OPTIONAL_PARAM); 1737 } 1738 YY_BREAK 1739case 74: 1740YY_RULE_SETUP 1741#line 390 "ls-sfparser.l" 1742{ 1743 yytext[yyleng - 1] = '\0'; 1744 CALLBACK(LS_SF_DT_STRING, yytext + 1, yyleng - 2, 1); 1745 BEGIN(LIST_OPTIONAL_PARAM); 1746 } 1747 YY_BREAK 1748case 75: 1749YY_RULE_SETUP 1750#line 395 "ls-sfparser.l" 1751{ CALLBACK(LS_SF_DT_TOKEN, yytext, yyleng, 0); 1752 BEGIN(LIST_OPTIONAL_PARAM); 1753 } 1754 YY_BREAK 1755case 76: 1756YY_RULE_SETUP 1757#line 398 "ls-sfparser.l" 1758{ 1759 yytext[yyleng - 1] = '\0'; 1760 CALLBACK(LS_SF_DT_BYTESEQ, yytext + 1, yyleng - 2, 1); 1761 BEGIN(LIST_OPTIONAL_PARAM); 1762 } 1763 YY_BREAK 1764case 77: 1765YY_RULE_SETUP 1766#line 403 "ls-sfparser.l" 1767{ CALLBACK(LS_SF_DT_BOOLEAN, yytext + 1, yyleng - 1, 1); 1768 BEGIN(LIST_OPTIONAL_PARAM); 1769 } 1770 YY_BREAK 1771 1772 1773case 78: 1774YY_RULE_SETUP 1775#line 409 "ls-sfparser.l" 1776/* Eat up whitespace */ 1777 YY_BREAK 1778case 79: 1779YY_RULE_SETUP 1780#line 410 "ls-sfparser.l" 1781{ CALLBACK(LS_SF_DT_INTEGER, yytext, yyleng, 0); 1782 BEGIN(ITEM_OPTIONAL_PARAM); 1783 } 1784 YY_BREAK 1785case 80: 1786YY_RULE_SETUP 1787#line 413 "ls-sfparser.l" 1788{ CALLBACK(LS_SF_DT_DECIMAL, yytext, yyleng, 0); 1789 BEGIN(ITEM_OPTIONAL_PARAM); 1790 } 1791 YY_BREAK 1792case 81: 1793YY_RULE_SETUP 1794#line 416 "ls-sfparser.l" 1795{ 1796 yytext[yyleng - 1] = '\0'; 1797 CALLBACK(LS_SF_DT_STRING, yytext + 1, yyleng - 2, 1); 1798 BEGIN(ITEM_OPTIONAL_PARAM); 1799 } 1800 YY_BREAK 1801case 82: 1802YY_RULE_SETUP 1803#line 421 "ls-sfparser.l" 1804{ CALLBACK(LS_SF_DT_TOKEN, yytext, yyleng, 0); 1805 BEGIN(ITEM_OPTIONAL_PARAM); 1806 } 1807 YY_BREAK 1808case 83: 1809YY_RULE_SETUP 1810#line 424 "ls-sfparser.l" 1811{ 1812 yytext[yyleng - 1] = '\0'; 1813 CALLBACK(LS_SF_DT_BYTESEQ, yytext + 1, yyleng - 2, 1); 1814 BEGIN(ITEM_OPTIONAL_PARAM); 1815 } 1816 YY_BREAK 1817case 84: 1818YY_RULE_SETUP 1819#line 429 "ls-sfparser.l" 1820{ CALLBACK(LS_SF_DT_BOOLEAN, yytext + 1, yyleng - 1, 1); 1821 BEGIN(ITEM_OPTIONAL_PARAM); 1822 } 1823 YY_BREAK 1824case YY_STATE_EOF(ITEM): 1825#line 432 "ls-sfparser.l" 1826{ return -1; } 1827 YY_BREAK 1828 1829 1830case 85: 1831YY_RULE_SETUP 1832#line 436 "ls-sfparser.l" 1833/* Eat up whitespace */ 1834 YY_BREAK 1835case 86: 1836YY_RULE_SETUP 1837#line 437 "ls-sfparser.l" 1838{ BEGIN(ITEM_PARAM_KEY); } 1839 YY_BREAK 1840 1841 1842case 87: 1843YY_RULE_SETUP 1844#line 441 "ls-sfparser.l" 1845/* Eat up whitespace */ 1846 YY_BREAK 1847case 88: 1848YY_RULE_SETUP 1849#line 442 "ls-sfparser.l" 1850{ CALLBACK(LS_SF_DT_PARAM_NAME, yytext, yyleng, 0); 1851 BEGIN(ITEM_PARAM_EQ); } 1852 YY_BREAK 1853 1854 1855case 89: 1856YY_RULE_SETUP 1857#line 447 "ls-sfparser.l" 1858{ BEGIN(ITEM); } 1859 YY_BREAK 1860case 90: 1861YY_RULE_SETUP 1862#line 448 "ls-sfparser.l" 1863{ TRUE[0] = '1'; 1864 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1865 BEGIN(ITEM_OPTIONAL_PARAM); 1866 } 1867 YY_BREAK 1868case 91: 1869YY_RULE_SETUP 1870#line 452 "ls-sfparser.l" 1871{ TRUE[0] = '1'; 1872 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1873 BEGIN(ITEM_PARAM_KEY); 1874 } 1875 YY_BREAK 1876case YY_STATE_EOF(ITEM_PARAM_EQ): 1877#line 456 "ls-sfparser.l" 1878{ TRUE[0] = '1'; 1879 CALLBACK(LS_SF_DT_BOOLEAN, TRUE, 1, -1); 1880 return 0; 1881 } 1882 YY_BREAK 1883 1884case 92: 1885YY_RULE_SETUP 1886#line 462 "ls-sfparser.l" 1887{ return -1; } 1888 YY_BREAK 1889case 93: 1890YY_RULE_SETUP 1891#line 464 "ls-sfparser.l" 1892YY_FATAL_ERROR( "flex scanner jammed" ); 1893 YY_BREAK 1894#line 1893 "ls-sfparser.c" 1895case YY_STATE_EOF(INITIAL): 1896case YY_STATE_EOF(DICTIONARY): 1897case YY_STATE_EOF(DIC_PARAM_KEY): 1898case YY_STATE_EOF(LIST_OPTIONAL_PARAM): 1899case YY_STATE_EOF(LIST): 1900case YY_STATE_EOF(LIST_PARAM_KEY): 1901case YY_STATE_EOF(LIST_PARAM_ITEM): 1902case YY_STATE_EOF(LIST_PARAM_EQ): 1903case YY_STATE_EOF(ITEM_OPTIONAL_PARAM): 1904case YY_STATE_EOF(ITEM_PARAM_KEY): 1905case YY_STATE_EOF(ITEM_BARE_ITEM): 1906case YY_STATE_EOF(IL_PARAM_KEY): 1907case YY_STATE_EOF(IL_PARAM_EQ): 1908case YY_STATE_EOF(ERROR_STATE): 1909 yyterminate(); 1910 1911 case YY_END_OF_BUFFER: 1912 { 1913 /* Amount of text matched not including the EOB char. */ 1914 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1915 1916 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1917 *yy_cp = yyg->yy_hold_char; 1918 YY_RESTORE_YY_MORE_OFFSET 1919 1920 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1921 { 1922 /* We're scanning a new file or input source. It's 1923 * possible that this happened because the user 1924 * just pointed yyin at a new source and called 1925 * ls_sfp_lex(). If so, then we have to assure 1926 * consistency between YY_CURRENT_BUFFER and our 1927 * globals. Here is the right place to do so, because 1928 * this is the first action (other than possibly a 1929 * back-up) that will match for the new input source. 1930 */ 1931 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1932 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1933 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1934 } 1935 1936 /* Note that here we test for yy_c_buf_p "<=" to the position 1937 * of the first EOB in the buffer, since yy_c_buf_p will 1938 * already have been incremented past the NUL character 1939 * (since all states make transitions on EOB to the 1940 * end-of-buffer state). Contrast this with the test 1941 * in input(). 1942 */ 1943 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1944 { /* This was really a NUL. */ 1945 yy_state_type yy_next_state; 1946 1947 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1948 1949 yy_current_state = yy_get_previous_state( yyscanner ); 1950 1951 /* Okay, we're now positioned to make the NUL 1952 * transition. We couldn't have 1953 * yy_get_previous_state() go ahead and do it 1954 * for us because it doesn't know how to deal 1955 * with the possibility of jamming (and we don't 1956 * want to build jamming into it because then it 1957 * will run more slowly). 1958 */ 1959 1960 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1961 1962 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1963 1964 if ( yy_next_state ) 1965 { 1966 /* Consume the NUL. */ 1967 yy_cp = ++yyg->yy_c_buf_p; 1968 yy_current_state = yy_next_state; 1969 goto yy_match; 1970 } 1971 1972 else 1973 { 1974 yy_cp = yyg->yy_last_accepting_cpos; 1975 yy_current_state = yyg->yy_last_accepting_state; 1976 goto yy_find_action; 1977 } 1978 } 1979 1980 else switch ( yy_get_next_buffer( yyscanner ) ) 1981 { 1982 case EOB_ACT_END_OF_FILE: 1983 { 1984 yyg->yy_did_buffer_switch_on_eof = 0; 1985 1986 if ( ls_sfp_wrap(yyscanner ) ) 1987 { 1988 /* Note: because we've taken care in 1989 * yy_get_next_buffer() to have set up 1990 * yytext, we can now set up 1991 * yy_c_buf_p so that if some total 1992 * hoser (like flex itself) wants to 1993 * call the scanner after we return the 1994 * YY_NULL, it'll still work - another 1995 * YY_NULL will get returned. 1996 */ 1997 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1998 1999 yy_act = YY_STATE_EOF(YY_START); 2000 goto do_action; 2001 } 2002 2003 else 2004 { 2005 if ( ! yyg->yy_did_buffer_switch_on_eof ) 2006 YY_NEW_FILE; 2007 } 2008 break; 2009 } 2010 2011 case EOB_ACT_CONTINUE_SCAN: 2012 yyg->yy_c_buf_p = 2013 yyg->yytext_ptr + yy_amount_of_matched_text; 2014 2015 yy_current_state = yy_get_previous_state( yyscanner ); 2016 2017 yy_cp = yyg->yy_c_buf_p; 2018 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 2019 goto yy_match; 2020 2021 case EOB_ACT_LAST_MATCH: 2022 yyg->yy_c_buf_p = 2023 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 2024 2025 yy_current_state = yy_get_previous_state( yyscanner ); 2026 2027 yy_cp = yyg->yy_c_buf_p; 2028 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 2029 goto yy_find_action; 2030 } 2031 break; 2032 } 2033 2034 default: 2035 YY_FATAL_ERROR( 2036 "fatal flex scanner internal error--no action found" ); 2037 } /* end of action switch */ 2038 } /* end of scanning one token */ 2039} /* end of ls_sfp_lex */ 2040 2041/* yy_get_next_buffer - try to read in a new buffer 2042 * 2043 * Returns a code representing an action: 2044 * EOB_ACT_LAST_MATCH - 2045 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 2046 * EOB_ACT_END_OF_FILE - end of file 2047 */ 2048static int yy_get_next_buffer (yyscan_t yyscanner) 2049{ 2050 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2051 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 2052 register char *source = yyg->yytext_ptr; 2053 register int number_to_move, i; 2054 int ret_val; 2055 2056 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 2057 YY_FATAL_ERROR( 2058 "fatal flex scanner internal error--end of buffer missed" ); 2059 2060 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 2061 { /* Don't try to fill the buffer, so this is an EOF. */ 2062 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 2063 { 2064 /* We matched a single character, the EOB, so 2065 * treat this as a final EOF. 2066 */ 2067 return EOB_ACT_END_OF_FILE; 2068 } 2069 2070 else 2071 { 2072 /* We matched some text prior to the EOB, first 2073 * process it. 2074 */ 2075 return EOB_ACT_LAST_MATCH; 2076 } 2077 } 2078 2079 /* Try to read more data. */ 2080 2081 /* First move last chars to start of buffer. */ 2082 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 2083 2084 for ( i = 0; i < number_to_move; ++i ) 2085 *(dest++) = *(source++); 2086 2087 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 2088 /* don't do the read, it's not guaranteed to return an EOF, 2089 * just force an EOF 2090 */ 2091 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 2092 2093 else 2094 { 2095 int num_to_read = 2096 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 2097 2098 while ( num_to_read <= 0 ) 2099 { /* Not enough room in the buffer - grow it. */ 2100 2101 /* just a shorter name for the current buffer */ 2102 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 2103 2104 int yy_c_buf_p_offset = 2105 (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 2106 2107 if ( b->yy_is_our_buffer ) 2108 { 2109 int new_size = b->yy_buf_size * 2; 2110 2111 if ( new_size <= 0 ) 2112 b->yy_buf_size += b->yy_buf_size / 8; 2113 else 2114 b->yy_buf_size *= 2; 2115 2116 b->yy_ch_buf = (char *) 2117 /* Include room in for 2 EOB chars. */ 2118 ls_sfp_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 2119 } 2120 else 2121 /* Can't grow it, we don't own it. */ 2122 b->yy_ch_buf = 0; 2123 2124 if ( ! b->yy_ch_buf ) 2125 { 2126 YY_FATAL_ERROR( 2127 "fatal error - scanner input buffer overflow" ); 2128 return EOB_ACT_END_OF_FILE; 2129 } 2130 2131 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 2132 2133 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 2134 number_to_move - 1; 2135 2136 } 2137 2138 if ( num_to_read > YY_READ_BUF_SIZE ) 2139 num_to_read = YY_READ_BUF_SIZE; 2140 2141 /* Read in more data. */ 2142 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 2143 yyg->yy_n_chars, (size_t) num_to_read ); 2144 2145 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2146 } 2147 2148 if ( yyg->yy_n_chars == 0 ) 2149 { 2150 if ( number_to_move == YY_MORE_ADJ ) 2151 { 2152 ret_val = EOB_ACT_END_OF_FILE; 2153 ls_sfp_restart(yyin ,yyscanner); 2154 } 2155 2156 else 2157 { 2158 ret_val = EOB_ACT_LAST_MATCH; 2159 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 2160 YY_BUFFER_EOF_PENDING; 2161 } 2162 } 2163 2164 else 2165 ret_val = EOB_ACT_CONTINUE_SCAN; 2166 2167 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 2168 /* Extend the array by 50%, plus the number we really need. */ 2169 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 2170 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ls_sfp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 2171 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 2172 { 2173 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 2174 return EOB_ACT_END_OF_FILE; 2175 } 2176 } 2177 2178 yyg->yy_n_chars += number_to_move; 2179 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 2180 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 2181 2182 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 2183 2184 return ret_val; 2185} 2186 2187/* yy_get_previous_state - get the state just before the EOB char was reached */ 2188 2189 static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 2190{ 2191 register yy_state_type yy_current_state; 2192 register char *yy_cp; 2193 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2194 2195 yy_current_state = yyg->yy_start; 2196 2197 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 2198 { 2199 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 2200 if ( yy_accept[yy_current_state] ) 2201 { 2202 yyg->yy_last_accepting_state = yy_current_state; 2203 yyg->yy_last_accepting_cpos = yy_cp; 2204 } 2205 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2206 { 2207 yy_current_state = (int) yy_def[yy_current_state]; 2208 if ( yy_current_state >= 365 ) 2209 yy_c = yy_meta[(unsigned int) yy_c]; 2210 } 2211 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2212 } 2213 2214 return yy_current_state; 2215} 2216 2217/* yy_try_NUL_trans - try to make a transition on the NUL character 2218 * 2219 * synopsis 2220 * next_state = yy_try_NUL_trans( current_state ); 2221 */ 2222 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 2223{ 2224 register int yy_is_jam; 2225 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ 2226 register char *yy_cp = yyg->yy_c_buf_p; 2227 2228 register YY_CHAR yy_c = 1; 2229 if ( yy_accept[yy_current_state] ) 2230 { 2231 yyg->yy_last_accepting_state = yy_current_state; 2232 yyg->yy_last_accepting_cpos = yy_cp; 2233 } 2234 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2235 { 2236 yy_current_state = (int) yy_def[yy_current_state]; 2237 if ( yy_current_state >= 365 ) 2238 yy_c = yy_meta[(unsigned int) yy_c]; 2239 } 2240 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2241 yy_is_jam = (yy_current_state == 364); 2242 2243 return yy_is_jam ? 0 : yy_current_state; 2244} 2245 2246#ifndef YY_NO_INPUT 2247#ifdef __cplusplus 2248 static int yyinput (yyscan_t yyscanner) 2249#else 2250 static int input (yyscan_t yyscanner) 2251#endif 2252 2253{ 2254 int c; 2255 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2256 2257 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2258 2259 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 2260 { 2261 /* yy_c_buf_p now points to the character we want to return. 2262 * If this occurs *before* the EOB characters, then it's a 2263 * valid NUL; if not, then we've hit the end of the buffer. 2264 */ 2265 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 2266 /* This was really a NUL. */ 2267 *yyg->yy_c_buf_p = '\0'; 2268 2269 else 2270 { /* need more input */ 2271 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 2272 ++yyg->yy_c_buf_p; 2273 2274 switch ( yy_get_next_buffer( yyscanner ) ) 2275 { 2276 case EOB_ACT_LAST_MATCH: 2277 /* This happens because yy_g_n_b() 2278 * sees that we've accumulated a 2279 * token and flags that we need to 2280 * try matching the token before 2281 * proceeding. But for input(), 2282 * there's no matching to consider. 2283 * So convert the EOB_ACT_LAST_MATCH 2284 * to EOB_ACT_END_OF_FILE. 2285 */ 2286 2287 /* Reset buffer status. */ 2288 ls_sfp_restart(yyin ,yyscanner); 2289 2290 /*FALLTHROUGH*/ 2291 2292 case EOB_ACT_END_OF_FILE: 2293 { 2294 if ( ls_sfp_wrap(yyscanner ) ) 2295 return EOF; 2296 2297 if ( ! yyg->yy_did_buffer_switch_on_eof ) 2298 YY_NEW_FILE; 2299#ifdef __cplusplus 2300 return yyinput(yyscanner); 2301#else 2302 return input(yyscanner); 2303#endif 2304 } 2305 2306 case EOB_ACT_CONTINUE_SCAN: 2307 yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 2308 break; 2309 } 2310 } 2311 } 2312 2313 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 2314 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 2315 yyg->yy_hold_char = *++yyg->yy_c_buf_p; 2316 2317 return c; 2318} 2319#endif /* ifndef YY_NO_INPUT */ 2320 2321/** Immediately switch to a different input stream. 2322 * @param input_file A readable stream. 2323 * @param yyscanner The scanner object. 2324 * @note This function does not reset the start condition to @c INITIAL . 2325 */ 2326 void ls_sfp_restart (FILE * input_file , yyscan_t yyscanner) 2327{ 2328 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2329 2330 if ( ! YY_CURRENT_BUFFER ){ 2331 if (ls_sfp_ensure_buffer_stack (yyscanner)) 2332 return; 2333 YY_CURRENT_BUFFER_LVALUE = 2334 ls_sfp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 2335 } 2336 2337 ls_sfp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 2338 ls_sfp__load_buffer_state(yyscanner ); 2339} 2340 2341/** Switch to a different input buffer. 2342 * @param new_buffer The new input buffer. 2343 * @param yyscanner The scanner object. 2344 */ 2345 void ls_sfp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2346{ 2347 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2348 2349 /* TODO. We should be able to replace this entire function body 2350 * with 2351 * ls_sfp_pop_buffer_state(); 2352 * ls_sfp_push_buffer_state(new_buffer); 2353 */ 2354 if (ls_sfp_ensure_buffer_stack (yyscanner)) 2355 return; 2356 if ( YY_CURRENT_BUFFER == new_buffer ) 2357 return; 2358 2359 if ( YY_CURRENT_BUFFER ) 2360 { 2361 /* Flush out information for old buffer. */ 2362 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2363 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2364 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2365 } 2366 2367 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2368 ls_sfp__load_buffer_state(yyscanner ); 2369 2370 /* We don't actually know whether we did this switch during 2371 * EOF (ls_sfp_wrap()) processing, but the only time this flag 2372 * is looked at is after ls_sfp_wrap() is called, so it's safe 2373 * to go ahead and always set it. 2374 */ 2375 yyg->yy_did_buffer_switch_on_eof = 1; 2376} 2377 2378static void ls_sfp__load_buffer_state (yyscan_t yyscanner) 2379{ 2380 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2381 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 2382 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 2383 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 2384 yyg->yy_hold_char = *yyg->yy_c_buf_p; 2385} 2386 2387/** Allocate and initialize an input buffer state. 2388 * @param file A readable stream. 2389 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2390 * @param yyscanner The scanner object. 2391 * @return the allocated buffer state. 2392 */ 2393 YY_BUFFER_STATE ls_sfp__create_buffer (FILE * file, int size , yyscan_t yyscanner) 2394{ 2395 YY_BUFFER_STATE b; 2396 2397 b = (YY_BUFFER_STATE) ls_sfp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2398 if ( ! b ) 2399 { 2400 YY_FATAL_ERROR( "out of dynamic memory in ls_sfp__create_buffer()" ); 2401 return NULL; 2402 } 2403 2404 b->yy_buf_size = size; 2405 2406 /* yy_ch_buf has to be 2 characters longer than the size given because 2407 * we need to put in 2 end-of-buffer characters. 2408 */ 2409 b->yy_ch_buf = (char *) ls_sfp_alloc(b->yy_buf_size + 2 ,yyscanner ); 2410 if ( ! b->yy_ch_buf ) 2411 { 2412 YY_FATAL_ERROR( "out of dynamic memory in ls_sfp__create_buffer()" ); 2413 return NULL; 2414 } 2415 2416 b->yy_is_our_buffer = 1; 2417 2418 ls_sfp__init_buffer(b,file ,yyscanner); 2419 2420 return b; 2421} 2422 2423/** Destroy the buffer. 2424 * @param b a buffer created with ls_sfp__create_buffer() 2425 * @param yyscanner The scanner object. 2426 */ 2427 void ls_sfp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2428{ 2429 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2430 2431 if ( ! b ) 2432 return; 2433 2434 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 2435 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 2436 2437 if ( b->yy_is_our_buffer ) 2438 ls_sfp_free((void *) b->yy_ch_buf ,yyscanner ); 2439 2440 ls_sfp_free((void *) b ,yyscanner ); 2441} 2442 2443/* Initializes or reinitializes a buffer. 2444 * This function is sometimes called more than once on the same buffer, 2445 * such as during a ls_sfp_restart() or at EOF. 2446 */ 2447 static void ls_sfp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 2448 2449{ 2450 int oerrno = errno; 2451 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2452 2453 ls_sfp__flush_buffer(b ,yyscanner); 2454 2455 b->yy_input_file = file; 2456 b->yy_fill_buffer = 1; 2457 2458 /* If b is the current buffer, then ls_sfp__init_buffer was _probably_ 2459 * called from ls_sfp_restart() or through yy_get_next_buffer. 2460 * In that case, we don't want to reset the lineno or column. 2461 */ 2462 if (b != YY_CURRENT_BUFFER){ 2463 b->yy_bs_lineno = 1; 2464 b->yy_bs_column = 0; 2465 } 2466 2467 b->yy_is_interactive = 0; 2468 2469 errno = oerrno; 2470} 2471 2472/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 2473 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 2474 * @param yyscanner The scanner object. 2475 */ 2476 void ls_sfp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2477{ 2478 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2479 if ( ! b ) 2480 return; 2481 2482 b->yy_n_chars = 0; 2483 2484 /* We always need two end-of-buffer characters. The first causes 2485 * a transition to the end-of-buffer state. The second causes 2486 * a jam in that state. 2487 */ 2488 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 2489 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 2490 2491 b->yy_buf_pos = &b->yy_ch_buf[0]; 2492 2493 b->yy_at_bol = 1; 2494 b->yy_buffer_status = YY_BUFFER_NEW; 2495 2496 if ( b == YY_CURRENT_BUFFER ) 2497 ls_sfp__load_buffer_state(yyscanner ); 2498} 2499 2500/** Pushes the new state onto the stack. The new state becomes 2501 * the current state. This function will allocate the stack 2502 * if necessary. 2503 * @param new_buffer The new state. 2504 * @param yyscanner The scanner object. 2505 */ 2506void ls_sfp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2507{ 2508 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2509 if (new_buffer == NULL) 2510 return; 2511 2512 if (ls_sfp_ensure_buffer_stack(yyscanner)) 2513 return; 2514 2515 /* This block is copied from ls_sfp__switch_to_buffer. */ 2516 if ( YY_CURRENT_BUFFER ) 2517 { 2518 /* Flush out information for old buffer. */ 2519 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2520 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2521 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2522 } 2523 2524 /* Only push if top exists. Otherwise, replace top. */ 2525 if (YY_CURRENT_BUFFER) 2526 yyg->yy_buffer_stack_top++; 2527 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2528 2529 /* copied from ls_sfp__switch_to_buffer. */ 2530 ls_sfp__load_buffer_state(yyscanner ); 2531 yyg->yy_did_buffer_switch_on_eof = 1; 2532} 2533 2534/** Removes and deletes the top of the stack, if present. 2535 * The next element becomes the new top. 2536 * @param yyscanner The scanner object. 2537 */ 2538void ls_sfp_pop_buffer_state (yyscan_t yyscanner) 2539{ 2540 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2541 if (!YY_CURRENT_BUFFER) 2542 return; 2543 2544 ls_sfp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 2545 YY_CURRENT_BUFFER_LVALUE = NULL; 2546 if (yyg->yy_buffer_stack_top > 0) 2547 --yyg->yy_buffer_stack_top; 2548 2549 if (YY_CURRENT_BUFFER) { 2550 ls_sfp__load_buffer_state(yyscanner ); 2551 yyg->yy_did_buffer_switch_on_eof = 1; 2552 } 2553} 2554 2555/* Allocates the stack if it does not exist. 2556 * Guarantees space for at least one push. 2557 */ 2558static int ls_sfp_ensure_buffer_stack (yyscan_t yyscanner) 2559{ 2560 int num_to_alloc; 2561 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2562 2563 if (!yyg->yy_buffer_stack) { 2564 2565 /* First allocation is just for 2 elements, since we don't know if this 2566 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2567 * immediate realloc on the next call. 2568 */ 2569 num_to_alloc = 1; 2570 yyg->yy_buffer_stack = (struct yy_buffer_state**)ls_sfp_alloc 2571 (num_to_alloc * sizeof(struct yy_buffer_state*) 2572 , yyscanner); 2573 if ( ! yyg->yy_buffer_stack ) 2574 { 2575 YY_FATAL_ERROR( "out of dynamic memory in ls_sfp_ensure_buffer_stack()" ); 2576 return -1; 2577 } 2578 2579 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2580 2581 yyg->yy_buffer_stack_max = num_to_alloc; 2582 yyg->yy_buffer_stack_top = 0; 2583 return 0; 2584 } 2585 2586 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 2587 2588 /* Increase the buffer to prepare for a possible push. */ 2589 int grow_size = 8 /* arbitrary grow size */; 2590 2591 num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 2592 yyg->yy_buffer_stack = (struct yy_buffer_state**)ls_sfp_realloc 2593 (yyg->yy_buffer_stack, 2594 num_to_alloc * sizeof(struct yy_buffer_state*) 2595 , yyscanner); 2596 if ( ! yyg->yy_buffer_stack ) 2597 { 2598 YY_FATAL_ERROR( "out of dynamic memory in ls_sfp_ensure_buffer_stack()" ); 2599 return -1; 2600 } 2601 2602 /* zero only the new slots.*/ 2603 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 2604 yyg->yy_buffer_stack_max = num_to_alloc; 2605 } 2606 2607 return 0; 2608} 2609 2610/** Setup the input buffer state to scan directly from a user-specified character buffer. 2611 * @param base the character buffer 2612 * @param size the size in bytes of the character buffer 2613 * @param yyscanner The scanner object. 2614 * @return the newly allocated buffer state object. 2615 */ 2616YY_BUFFER_STATE ls_sfp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 2617{ 2618 YY_BUFFER_STATE b; 2619 2620 if ( size < 2 || 2621 base[size-2] != YY_END_OF_BUFFER_CHAR || 2622 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2623 /* They forgot to leave room for the EOB's. */ 2624 return 0; 2625 2626 b = (YY_BUFFER_STATE) ls_sfp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2627 if ( ! b ) 2628 { 2629 YY_FATAL_ERROR( "out of dynamic memory in ls_sfp__scan_buffer()" ); 2630 return 0; 2631 } 2632 2633 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 2634 b->yy_buf_pos = b->yy_ch_buf = base; 2635 b->yy_is_our_buffer = 0; 2636 b->yy_input_file = 0; 2637 b->yy_n_chars = b->yy_buf_size; 2638 b->yy_is_interactive = 0; 2639 b->yy_at_bol = 1; 2640 b->yy_fill_buffer = 0; 2641 b->yy_buffer_status = YY_BUFFER_NEW; 2642 2643 ls_sfp__switch_to_buffer(b ,yyscanner ); 2644 2645 return b; 2646} 2647 2648/** Setup the input buffer state to scan a string. The next call to ls_sfp_lex() will 2649 * scan from a @e copy of @a str. 2650 * @param yystr a NUL-terminated string to scan 2651 * @param yyscanner The scanner object. 2652 * @return the newly allocated buffer state object. 2653 * @note If you want to scan bytes that may contain NUL values, then use 2654 * ls_sfp__scan_bytes() instead. 2655 */ 2656YY_BUFFER_STATE ls_sfp__scan_string (yyconst char * yystr , yyscan_t yyscanner) 2657{ 2658 2659 return ls_sfp__scan_bytes(yystr,strlen(yystr) ,yyscanner); 2660} 2661 2662/** Setup the input buffer state to scan the given bytes. The next call to ls_sfp_lex() will 2663 * scan from a @e copy of @a bytes. 2664 * @param yybytes the byte buffer to scan 2665 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2666 * @param yyscanner The scanner object. 2667 * @return the newly allocated buffer state object. 2668 */ 2669YY_BUFFER_STATE ls_sfp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) 2670{ 2671 YY_BUFFER_STATE b; 2672 char *buf; 2673 yy_size_t n; 2674 int i; 2675 2676 /* Get memory for full buffer, including space for trailing EOB's. */ 2677 n = _yybytes_len + 2; 2678 buf = (char *) ls_sfp_alloc(n ,yyscanner ); 2679 if ( ! buf ) 2680 { 2681 YY_FATAL_ERROR( "out of dynamic memory in ls_sfp__scan_bytes()" ); 2682 return NULL; 2683 } 2684 2685 for ( i = 0; i < _yybytes_len; ++i ) 2686 buf[i] = yybytes[i]; 2687 2688 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2689 2690 b = ls_sfp__scan_buffer(buf,n ,yyscanner); 2691 if ( ! b ) 2692 { 2693 YY_FATAL_ERROR( "bad buffer in ls_sfp__scan_bytes()" ); 2694 return NULL; 2695 } 2696 2697 /* It's okay to grow etc. this buffer, and we should throw it 2698 * away when we're done. 2699 */ 2700 b->yy_is_our_buffer = 1; 2701 2702 return b; 2703} 2704 2705#ifndef YY_EXIT_FAILURE 2706#define YY_EXIT_FAILURE 2 2707#endif 2708 2709static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) 2710{ 2711 (void) fprintf( stderr, "%s\n", msg ); 2712 exit( YY_EXIT_FAILURE ); 2713} 2714 2715/* Redefine yyless() so it works in section 3 code. */ 2716 2717#undef yyless 2718#define yyless(n) \ 2719 do \ 2720 { \ 2721 /* Undo effects of setting up yytext. */ \ 2722 int yyless_macro_arg = (n); \ 2723 YY_LESS_LINENO(yyless_macro_arg);\ 2724 yytext[yyleng] = yyg->yy_hold_char; \ 2725 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 2726 yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 2727 *yyg->yy_c_buf_p = '\0'; \ 2728 yyleng = yyless_macro_arg; \ 2729 } \ 2730 while ( 0 ) 2731 2732/* Accessor methods (get/set functions) to struct members. */ 2733 2734/** Get the user-defined data for this scanner. 2735 * @param yyscanner The scanner object. 2736 */ 2737YY_EXTRA_TYPE ls_sfp_get_extra (yyscan_t yyscanner) 2738{ 2739 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2740 return yyextra; 2741} 2742 2743/** Get the current line number. 2744 * @param yyscanner The scanner object. 2745 */ 2746int ls_sfp_get_lineno (yyscan_t yyscanner) 2747{ 2748 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2749 2750 if (! YY_CURRENT_BUFFER) 2751 return 0; 2752 2753 return yylineno; 2754} 2755 2756/** Get the current column number. 2757 * @param yyscanner The scanner object. 2758 */ 2759int ls_sfp_get_column (yyscan_t yyscanner) 2760{ 2761 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2762 2763 if (! YY_CURRENT_BUFFER) 2764 return 0; 2765 2766 return yycolumn; 2767} 2768 2769/** Get the input stream. 2770 * @param yyscanner The scanner object. 2771 */ 2772FILE *ls_sfp_get_in (yyscan_t yyscanner) 2773{ 2774 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2775 return yyin; 2776} 2777 2778/** Get the output stream. 2779 * @param yyscanner The scanner object. 2780 */ 2781FILE *ls_sfp_get_out (yyscan_t yyscanner) 2782{ 2783 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2784 return yyout; 2785} 2786 2787/** Get the length of the current token. 2788 * @param yyscanner The scanner object. 2789 */ 2790int ls_sfp_get_leng (yyscan_t yyscanner) 2791{ 2792 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2793 return yyleng; 2794} 2795 2796/** Get the current token. 2797 * @param yyscanner The scanner object. 2798 */ 2799 2800char *ls_sfp_get_text (yyscan_t yyscanner) 2801{ 2802 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2803 return yytext; 2804} 2805 2806/** Set the user-defined data. This data is never touched by the scanner. 2807 * @param user_defined The data to be associated with this scanner. 2808 * @param yyscanner The scanner object. 2809 */ 2810void ls_sfp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 2811{ 2812 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2813 yyextra = user_defined ; 2814} 2815 2816/** Set the current line number. 2817 * @param line_number 2818 * @param yyscanner The scanner object. 2819 */ 2820void ls_sfp_set_lineno (int line_number , yyscan_t yyscanner) 2821{ 2822 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2823 2824 /* lineno is only valid if an input buffer exists. */ 2825 if (! YY_CURRENT_BUFFER ) 2826 yy_fatal_error( "ls_sfp_set_lineno called with no buffer" , yyscanner); 2827 2828 yylineno = line_number; 2829} 2830 2831/** Set the current column. 2832 * @param line_number 2833 * @param yyscanner The scanner object. 2834 */ 2835void ls_sfp_set_column (int column_no , yyscan_t yyscanner) 2836{ 2837 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2838 2839 /* column is only valid if an input buffer exists. */ 2840 if (! YY_CURRENT_BUFFER ) 2841 yy_fatal_error( "ls_sfp_set_column called with no buffer" , yyscanner); 2842 2843 yycolumn = column_no; 2844} 2845 2846/** Set the input stream. This does not discard the current 2847 * input buffer. 2848 * @param in_str A readable stream. 2849 * @param yyscanner The scanner object. 2850 * @see ls_sfp__switch_to_buffer 2851 */ 2852void ls_sfp_set_in (FILE * in_str , yyscan_t yyscanner) 2853{ 2854 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2855 yyin = in_str ; 2856} 2857 2858void ls_sfp_set_out (FILE * out_str , yyscan_t yyscanner) 2859{ 2860 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2861 yyout = out_str ; 2862} 2863 2864int ls_sfp_get_debug (yyscan_t yyscanner) 2865{ 2866 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2867 return yy_flex_debug; 2868} 2869 2870void ls_sfp_set_debug (int bdebug , yyscan_t yyscanner) 2871{ 2872 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2873 yy_flex_debug = bdebug ; 2874} 2875 2876/* Accessor methods for yylval and yylloc */ 2877 2878/* User-visible API */ 2879 2880/* ls_sfp_lex_init is special because it creates the scanner itself, so it is 2881 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2882 * That's why we explicitly handle the declaration, instead of using our macros. 2883 */ 2884 2885int ls_sfp_lex_init(yyscan_t* ptr_yy_globals) 2886 2887{ 2888 if (ptr_yy_globals == NULL){ 2889 errno = EINVAL; 2890 return 1; 2891 } 2892 2893 *ptr_yy_globals = (yyscan_t) ls_sfp_alloc ( sizeof( struct yyguts_t ), NULL ); 2894 2895 if (*ptr_yy_globals == NULL){ 2896 errno = ENOMEM; 2897 return 1; 2898 } 2899 2900 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2901 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2902 2903 return yy_init_globals ( *ptr_yy_globals ); 2904} 2905 2906/* ls_sfp_lex_init_extra has the same functionality as ls_sfp_lex_init, but follows the 2907 * convention of taking the scanner as the last argument. Note however, that 2908 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2909 * is the reason, too, why this function also must handle its own declaration). 2910 * The user defined value in the first argument will be available to ls_sfp_alloc in 2911 * the yyextra field. 2912 */ 2913 2914int ls_sfp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) 2915 2916{ 2917 struct yyguts_t dummy_yyguts; 2918 2919 ls_sfp_set_extra (yy_user_defined, &dummy_yyguts); 2920 2921 if (ptr_yy_globals == NULL){ 2922 errno = EINVAL; 2923 return 1; 2924 } 2925 2926 *ptr_yy_globals = (yyscan_t) ls_sfp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2927 2928 if (*ptr_yy_globals == NULL){ 2929 errno = ENOMEM; 2930 return 1; 2931 } 2932 2933 /* By setting to 0xAA, we expose bugs in 2934 yy_init_globals. Leave at 0x00 for releases. */ 2935 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2936 2937 ls_sfp_set_extra (yy_user_defined, *ptr_yy_globals); 2938 2939 return yy_init_globals ( *ptr_yy_globals ); 2940} 2941 2942static int yy_init_globals (yyscan_t yyscanner) 2943{ 2944 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2945 /* Initialization is the same as for the non-reentrant scanner. 2946 * This function is called from ls_sfp_lex_destroy(), so don't allocate here. 2947 */ 2948 2949 yyg->yy_buffer_stack = 0; 2950 yyg->yy_buffer_stack_top = 0; 2951 yyg->yy_buffer_stack_max = 0; 2952 yyg->yy_c_buf_p = (char *) 0; 2953 yyg->yy_init = 0; 2954 yyg->yy_start = 0; 2955 2956 yyg->yy_start_stack_ptr = 0; 2957 yyg->yy_start_stack_depth = 0; 2958 yyg->yy_start_stack = NULL; 2959 2960/* Defined in main.c */ 2961#ifdef YY_STDINIT 2962 yyin = stdin; 2963 yyout = stdout; 2964#else 2965 yyin = (FILE *) 0; 2966 yyout = (FILE *) 0; 2967#endif 2968 2969 /* For future reference: Set errno on error, since we are called by 2970 * ls_sfp_lex_init() 2971 */ 2972 return 0; 2973} 2974 2975/* ls_sfp_lex_destroy is for both reentrant and non-reentrant scanners. */ 2976int ls_sfp_lex_destroy (yyscan_t yyscanner) 2977{ 2978 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2979 2980 /* Pop the buffer stack, destroying each element. */ 2981 while(YY_CURRENT_BUFFER){ 2982 ls_sfp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 2983 YY_CURRENT_BUFFER_LVALUE = NULL; 2984 ls_sfp_pop_buffer_state(yyscanner); 2985 } 2986 2987 /* Destroy the stack itself. */ 2988 ls_sfp_free(yyg->yy_buffer_stack ,yyscanner); 2989 yyg->yy_buffer_stack = NULL; 2990 2991 /* Destroy the start condition stack. */ 2992 ls_sfp_free(yyg->yy_start_stack ,yyscanner ); 2993 yyg->yy_start_stack = NULL; 2994 2995 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2996 * ls_sfp_lex() is called, initialization will occur. */ 2997 yy_init_globals( yyscanner); 2998 2999 /* Destroy the main struct (reentrant only). */ 3000 ls_sfp_free ( yyscanner , yyscanner ); 3001 yyscanner = NULL; 3002 return 0; 3003} 3004 3005/* 3006 * Internal utility routines. 3007 */ 3008 3009#ifndef yytext_ptr 3010static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 3011{ 3012 register int i; 3013 for ( i = 0; i < n; ++i ) 3014 s1[i] = s2[i]; 3015} 3016#endif 3017 3018#ifdef YY_NEED_STRLEN 3019static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 3020{ 3021 register int n; 3022 for ( n = 0; s[n]; ++n ) 3023 ; 3024 3025 return n; 3026} 3027#endif 3028 3029#define YYTABLES_NAME "yytables" 3030 3031#line 464 "ls-sfparser.l" 3032 3033 3034 3035const char *const ls_sf_dt2str[] = 3036{ 3037 [LS_SF_DT_INTEGER] = "INTEGER", 3038 [LS_SF_DT_DECIMAL] = "DECIMAL", 3039 [LS_SF_DT_NAME] = "NAME", 3040 [LS_SF_DT_PARAM_NAME] = "PARAM_NAME", 3041 [LS_SF_DT_STRING] = "STRING", 3042 [LS_SF_DT_TOKEN] = "TOKEN", 3043 [LS_SF_DT_BYTESEQ] = "BYTESEQ", 3044 [LS_SF_DT_BOOLEAN] = "BOOLEAN", 3045 [LS_SF_DT_INNER_LIST_BEGIN] = "INNER_LIST_BEGIN", 3046 [LS_SF_DT_INNER_LIST_END] = "INNER_LIST_END", 3047}; 3048 3049 3050int 3051ls_sf_parse (enum ls_sf_tlt top_level_type, const char *input, size_t input_sz, 3052 int (*callback)(void *user_data, enum ls_sf_dt, char *str, size_t, int), 3053 void *user_data, char *mem_buf, size_t mem_buf_sz) 3054{ 3055 struct ls_sf_parser parser; 3056 yyscan_t scanner; 3057 YY_BUFFER_STATE buf; 3058 int ret; 3059 3060 parser.top_level_type = top_level_type; 3061 parser.callback = callback; 3062 parser.user_data = user_data; 3063 parser.errmsg = NULL; 3064 parser.mem_failed = 0; 3065 3066 if (mem_buf && mem_buf_sz) 3067 { 3068 parser.mem = mem_buf; 3069 parser.mem_off = 0; 3070 parser.mem_sz = mem_buf_sz; 3071 parser.last_malloced = NULL; 3072 } 3073 else 3074 parser.mem = NULL; 3075 3076 if (0 != ls_sfp_lex_init_extra(&parser, &scanner)) 3077 return -1; 3078 3079 buf = ls_sfp__scan_bytes(input, input_sz, scanner); 3080 if (buf) 3081 { 3082 ret = ls_sfp_lex(scanner); 3083 if (parser.mem_failed) 3084 ret = -2; 3085 else if (parser.errmsg) 3086 ret = -1; 3087 ls_sfp__delete_buffer(buf, scanner); 3088 } 3089 else 3090 ret = -2; 3091 3092 ls_sfp_lex_destroy(scanner); 3093 return ret; 3094} 3095 3096 3097void * 3098ls_sfp_alloc (size_t bytes, void *yyscanner) 3099{ 3100 struct ls_sf_parser *const parser = ls_sfp_get_extra(yyscanner); 3101 3102 if (parser->mem) 3103 { 3104 if (bytes + parser->mem_off < parser->mem_sz) 3105 { 3106 parser->last_malloced = parser->mem + parser->mem_off; 3107 parser->mem_off += bytes; 3108 return parser->last_malloced; 3109 } 3110 else 3111 { 3112 parser->mem_failed = 1; 3113 return NULL; 3114 } 3115 } 3116 else 3117 return malloc(bytes); 3118} 3119 3120 3121#define MAX(a, b) ((a) > (b) ? (a) : (b)) 3122 3123void * 3124ls_sfp_realloc (void *ptr, size_t bytes, void *yyscanner) 3125{ 3126 struct ls_sf_parser *const parser = ls_sfp_get_extra(yyscanner); 3127 void *ret; 3128 3129 if (parser->mem) 3130 { 3131 if ((char *) ptr == parser->last_malloced) 3132 { 3133 if (parser->last_malloced + bytes <= parser->mem + parser->mem_sz) 3134 return ptr; 3135 else 3136 { 3137 parser->mem_failed = 1; 3138 return NULL; 3139 } 3140 } 3141 else if (ret = ls_sfp_alloc(bytes, yyscanner), ret != NULL) 3142 { 3143 memcpy(ret, ptr, 3144 /* We don't know how large it was, so just copy the max */ 3145 MAX(bytes, (size_t) ( 3146 parser->mem + parser->mem_sz - (char *) ptr))); 3147 return ret; 3148 } 3149 else 3150 { 3151 parser->mem_failed = 1; 3152 return NULL; 3153 } 3154 } 3155 else 3156 return realloc(ptr, bytes); 3157} 3158 3159 3160void 3161ls_sfp_free (void *ptr, void *yyscanner) 3162{ 3163 struct ls_sf_parser *const parser = ls_sfp_get_extra(yyscanner); 3164 3165 if (parser->mem) 3166 { 3167 if ((char *) ptr == parser->last_malloced) 3168 parser->mem_off = parser->last_malloced - parser->mem; 3169 } 3170 else 3171 free(ptr); 3172} 3173 3174