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