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