1 2 #line 3 "lex.yy.c" 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 31 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 #include <inttypes.h> 35 typedef int8_t flex_int8_t; 36 typedef uint8_t flex_uint8_t; 37 typedef int16_t flex_int16_t; 38 typedef uint16_t flex_uint16_t; 39 typedef int32_t flex_int32_t; 40 typedef uint32_t flex_uint32_t; 41 #else 42 typedef signed char flex_int8_t; 43 typedef short int flex_int16_t; 44 typedef int flex_int32_t; 45 typedef unsigned char flex_uint8_t; 46 typedef unsigned short int flex_uint16_t; 47 typedef unsigned int flex_uint32_t; 48 #endif /* ! C99 */ 49 50 /* Limits of integral types. */ 51 #ifndef INT8_MIN 52 #define INT8_MIN (-128) 53 #endif 54 #ifndef INT16_MIN 55 #define INT16_MIN (-32767-1) 56 #endif 57 #ifndef INT32_MIN 58 #define INT32_MIN (-2147483647-1) 59 #endif 60 #ifndef INT8_MAX 61 #define INT8_MAX (127) 62 #endif 63 #ifndef INT16_MAX 64 #define INT16_MAX (32767) 65 #endif 66 #ifndef INT32_MAX 67 #define INT32_MAX (2147483647) 68 #endif 69 #ifndef UINT8_MAX 70 #define UINT8_MAX (255U) 71 #endif 72 #ifndef UINT16_MAX 73 #define UINT16_MAX (65535U) 74 #endif 75 #ifndef UINT32_MAX 76 #define UINT32_MAX (4294967295U) 77 #endif 78 79 #endif /* ! FLEXINT_H */ 80 81 #ifdef __cplusplus 82 83 /* The "const" storage-class-modifier is valid. */ 84 #define YY_USE_CONST 85 86 #else /* ! __cplusplus */ 87 88 #if __STDC__ 89 90 #define YY_USE_CONST 91 92 #endif /* __STDC__ */ 93 #endif /* ! __cplusplus */ 94 95 #ifdef YY_USE_CONST 96 #define yyconst const 97 #else 98 #define yyconst 99 #endif 100 101 /* Returned upon end-of-file. */ 102 #define YY_NULL 0 103 104 /* Promotes a possibly negative, possibly signed char to an unsigned 105 * integer for use as an array index. If the signed char is negative, 106 * we want to instead treat it as an 8-bit unsigned char, hence the 107 * double cast. 108 */ 109 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 110 111 /* Enter a start condition. This macro really ought to take a parameter, 112 * but we do it the disgusting crufty way forced on us by the ()-less 113 * definition of BEGIN. 114 */ 115 #define BEGIN (yy_start) = 1 + 2 * 116 117 /* Translate the current start state into a value that can be later handed 118 * to BEGIN to return to the state. The YYSTATE alias is for lex 119 * compatibility. 120 */ 121 #define YY_START (((yy_start) - 1) / 2) 122 #define YYSTATE YY_START 123 124 /* Action number for EOF rule of a given start state. */ 125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 126 127 /* Special action meaning "start processing a new file". */ 128 #define YY_NEW_FILE yyrestart(yyin ) 129 130 #define YY_END_OF_BUFFER_CHAR 0 131 132 /* Size of default input buffer. */ 133 #ifndef YY_BUF_SIZE 134 #define YY_BUF_SIZE 16384 135 #endif 136 137 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 138 #define YY_TYPEDEF_YY_BUFFER_STATE 139 typedef struct yy_buffer_state *YY_BUFFER_STATE; 140 #endif 141 142 extern int yyleng; 143 144 extern FILE *yyin, *yyout; 145 146 #define EOB_ACT_CONTINUE_SCAN 0 147 #define EOB_ACT_END_OF_FILE 1 148 #define EOB_ACT_LAST_MATCH 2 149 150 #define YY_LESS_LINENO(n) 151 152 /* Return all but the first "n" matched characters back to the input stream. */ 153 #define yyless(n) \ 154 do \ 155 { \ 156 /* Undo effects of setting up yytext. */ \ 157 int yyless_macro_arg = (n); \ 158 YY_LESS_LINENO(yyless_macro_arg);\ 159 *yy_cp = (yy_hold_char); \ 160 YY_RESTORE_YY_MORE_OFFSET \ 161 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 162 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 163 } \ 164 while ( 0 ) 165 166 #define unput(c) yyunput( c, (yytext_ptr) ) 167 168 /* The following is because we cannot portably get our hands on size_t 169 * (without autoconf's help, which isn't available because we want 170 * flex-generated scanners to compile on their own). 171 */ 172 173 #ifndef YY_TYPEDEF_YY_SIZE_T 174 #define YY_TYPEDEF_YY_SIZE_T 175 typedef unsigned int yy_size_t; 176 #endif 177 178 #ifndef YY_STRUCT_YY_BUFFER_STATE 179 #define YY_STRUCT_YY_BUFFER_STATE 180 struct yy_buffer_state 181 { 182 FILE *yy_input_file; 183 184 char *yy_ch_buf; /* input buffer */ 185 char *yy_buf_pos; /* current position in input buffer */ 186 187 /* Size of input buffer in bytes, not including room for EOB 188 * characters. 189 */ 190 yy_size_t yy_buf_size; 191 192 /* Number of characters read into yy_ch_buf, not including EOB 193 * characters. 194 */ 195 int yy_n_chars; 196 197 /* Whether we "own" the buffer - i.e., we know we created it, 198 * and can realloc() it to grow it, and should free() it to 199 * delete it. 200 */ 201 int yy_is_our_buffer; 202 203 /* Whether this is an "interactive" input source; if so, and 204 * if we're using stdio for input, then we want to use getc() 205 * instead of fread(), to make sure we stop fetching input after 206 * each newline. 207 */ 208 int yy_is_interactive; 209 210 /* Whether we're considered to be at the beginning of a line. 211 * If so, '^' rules will be active on the next match, otherwise 212 * not. 213 */ 214 int yy_at_bol; 215 216 int yy_bs_lineno; /**< The line count. */ 217 int yy_bs_column; /**< The column count. */ 218 219 /* Whether to try to fill the input buffer when we reach the 220 * end of it. 221 */ 222 int yy_fill_buffer; 223 224 int yy_buffer_status; 225 226 #define YY_BUFFER_NEW 0 227 #define YY_BUFFER_NORMAL 1 228 /* When an EOF's been seen but there's still some text to process 229 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 230 * shouldn't try reading from the input source any more. We might 231 * still have a bunch of tokens to match, though, because of 232 * possible backing-up. 233 * 234 * When we actually see the EOF, we change the status to "new" 235 * (via yyrestart()), so that the user can continue scanning by 236 * just pointing yyin at a new input file. 237 */ 238 #define YY_BUFFER_EOF_PENDING 2 239 240 }; 241 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 242 243 /* Stack of input buffers. */ 244 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 245 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 246 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 247 248 /* We provide macros for accessing buffer states in case in the 249 * future we want to put the buffer states in a more general 250 * "scanner state". 251 * 252 * Returns the top of the stack, or NULL. 253 */ 254 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 255 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 256 : NULL) 257 258 /* Same as previous macro, but useful when we know that the buffer stack is not 259 * NULL or when we need an lvalue. For internal use only. 260 */ 261 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 262 263 /* yy_hold_char holds the character lost when yytext is formed. */ 264 static char yy_hold_char; 265 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 266 int yyleng; 267 268 /* Points to current character in buffer. */ 269 static char *yy_c_buf_p = (char *) 0; 270 static int yy_init = 1; /* whether we need to initialize */ 271 static int yy_start = 0; /* start state number */ 272 273 /* Flag which is used to allow yywrap()'s to do buffer switches 274 * instead of setting up a fresh yyin. A bit of a hack ... 275 */ 276 static int yy_did_buffer_switch_on_eof; 277 278 void yyrestart (FILE *input_file ); 279 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 280 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 281 void yy_delete_buffer (YY_BUFFER_STATE b ); 282 void yy_flush_buffer (YY_BUFFER_STATE b ); 283 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 284 void yypop_buffer_state (void ); 285 286 static void yyensure_buffer_stack (void ); 287 static void yy_load_buffer_state (void ); 288 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 289 290 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 291 292 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 293 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 294 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); 295 296 void *yyalloc (yy_size_t ); 297 void *yyrealloc (void *,yy_size_t ); 298 void yyfree (void * ); 299 300 #define yy_new_buffer yy_create_buffer 301 302 #define yy_set_interactive(is_interactive) \ 303 { \ 304 if ( ! YY_CURRENT_BUFFER ){ \ 305 yyensure_buffer_stack (); \ 306 YY_CURRENT_BUFFER_LVALUE = \ 307 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 308 } \ 309 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 310 } 311 312 #define yy_set_bol(at_bol) \ 313 { \ 314 if ( ! YY_CURRENT_BUFFER ){\ 315 yyensure_buffer_stack (); \ 316 YY_CURRENT_BUFFER_LVALUE = \ 317 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 318 } \ 319 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 320 } 321 322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 323 324 /* Begin user sect3 */ 325 326 typedef unsigned char YY_CHAR; 327 328 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 329 330 typedef int yy_state_type; 331 332 extern int yylineno; 333 334 int yylineno = 1; 335 336 extern char *yytext; 337 #define yytext_ptr yytext 338 339 static yy_state_type yy_get_previous_state (void ); 340 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 341 static int yy_get_next_buffer (void ); 342 static void yy_fatal_error (yyconst char msg[] ); 343 344 /* Done after the current pattern has been matched and before the 345 * corresponding action - sets up yytext. 346 */ 347 #define YY_DO_BEFORE_ACTION \ 348 (yytext_ptr) = yy_bp; \ 349 yyleng = (size_t) (yy_cp - yy_bp); \ 350 (yy_hold_char) = *yy_cp; \ 351 *yy_cp = '\0'; \ 352 (yy_c_buf_p) = yy_cp; 353 354 #define YY_NUM_RULES 9 355 #define YY_END_OF_BUFFER 10 356 /* This struct is not used in this scanner, 357 but its presence is necessary. */ 358 struct yy_trans_info 359 { 360 flex_int32_t yy_verify; 361 flex_int32_t yy_nxt; 362 }; 363 static yyconst flex_int16_t yy_accept[36] = 364 { 0, 365 0, 0, 10, 8, 1, 7, 8, 8, 6, 3, 366 6, 0, 4, 0, 2, 6, 3, 6, 3, 0, 367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 368 0, 0, 0, 5, 0 369 } ; 370 371 static yyconst flex_int32_t yy_ec[256] = 372 { 0, 373 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 374 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 375 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 376 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, 377 1, 1, 1, 1, 6, 1, 1, 7, 7, 7, 378 7, 7, 7, 7, 7, 7, 7, 8, 1, 1, 379 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 380 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 381 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 382 1, 1, 1, 1, 6, 1, 9, 9, 9, 9, 383 384 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 385 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 386 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 387 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 388 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 389 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 394 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 401 } ; 402 403 static yyconst flex_int32_t yy_meta[10] = 404 { 0, 405 1, 1, 2, 1, 1, 3, 4, 1, 4 406 } ; 407 408 static yyconst flex_int16_t yy_base[49] = 409 { 0, 410 0, 0, 46, 47, 47, 47, 41, 41, 0, 4, 411 36, 38, 37, 37, 47, 0, 7, 31, 31, 0, 412 0, 29, 0, 0, 28, 0, 0, 27, 0, 0, 413 26, 0, 0, 47, 47, 15, 19, 21, 29, 28, 414 27, 26, 25, 24, 23, 22, 13, 8 415 } ; 416 417 static yyconst flex_int16_t yy_def[49] = 418 { 0, 419 35, 1, 35, 35, 35, 35, 36, 37, 38, 35, 420 10, 36, 36, 37, 35, 38, 38, 38, 38, 39, 421 40, 35, 41, 42, 35, 43, 44, 35, 45, 46, 422 35, 47, 48, 35, 0, 35, 35, 35, 35, 35, 423 35, 35, 35, 35, 35, 35, 35, 35 424 } ; 425 426 static yyconst flex_int16_t yy_nxt[57] = 427 { 0, 428 4, 5, 6, 7, 8, 9, 10, 4, 11, 16, 429 17, 34, 18, 19, 20, 12, 33, 12, 12, 14, 430 14, 14, 14, 16, 16, 31, 30, 28, 27, 25, 431 24, 22, 21, 32, 29, 26, 23, 19, 20, 15, 432 13, 13, 18, 15, 13, 35, 3, 35, 35, 35, 433 35, 35, 35, 35, 35, 35 434 } ; 435 436 static yyconst flex_int16_t yy_chk[57] = 437 { 0, 438 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 439 10, 48, 10, 17, 17, 36, 47, 36, 36, 37, 440 37, 37, 37, 38, 38, 46, 45, 44, 43, 42, 441 41, 40, 39, 31, 28, 25, 22, 19, 18, 14, 442 13, 12, 11, 8, 7, 3, 35, 35, 35, 35, 443 35, 35, 35, 35, 35, 35 444 } ; 445 446 static yy_state_type yy_last_accepting_state; 447 static char *yy_last_accepting_cpos; 448 449 extern int yy_flex_debug; 450 int yy_flex_debug = 0; 451 452 /* The intent behind this definition is that it'll catch 453 * any uses of REJECT which flex missed. 454 */ 455 #define REJECT reject_used_but_not_detected 456 #define yymore() yymore_used_but_not_detected 457 #define YY_MORE_ADJ 0 458 #define YY_RESTORE_YY_MORE_OFFSET 459 char *yytext; 460 #line 1 "lexer.l" 461 #line 2 "lexer.l" 462 /* 463 * 464 * BlueZ - Bluetooth protocol stack for Linux 465 * 466 * Copyright (C) 2002-2008 Marcel Holtmann <marcel (at) holtmann.org> 467 * 468 * 469 * This program is free software; you can redistribute it and/or modify 470 * it under the terms of the GNU General Public License as published by 471 * the Free Software Foundation; either version 2 of the License, or 472 * (at your option) any later version. 473 * 474 * This program is distributed in the hope that it will be useful, 475 * but WITHOUT ANY WARRANTY; without even the implied warranty of 476 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 477 * GNU General Public License for more details. 478 * 479 * You should have received a copy of the GNU General Public License 480 * along with this program; if not, write to the Free Software 481 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 482 * 483 */ 484 485 #ifdef HAVE_CONFIG_H 486 #include <config.h> 487 #endif 488 489 /* Nasty workaround, but flex defines isatty() twice */ 490 #define _UNISTD_H 491 492 #include <stdio.h> 493 #include <errno.h> 494 #include <sys/socket.h> 495 496 #include <bluetooth/bluetooth.h> 497 #include <bluetooth/rfcomm.h> 498 499 #include "kword.h" 500 #include "parser.h" 501 502 int yylex(void); 503 504 #define YY_NO_INPUT 505 506 #define ECHO {;} 507 #define YY_DECL int yylex(void) 508 509 int yyerror(char *str); 510 511 #line 512 "lex.yy.c" 512 513 #define INITIAL 0 514 515 #ifndef YY_NO_UNISTD_H 516 /* Special case for "unistd.h", since it is non-ANSI. We include it way 517 * down here because we want the user's section 1 to have been scanned first. 518 * The user has a chance to override it with an option. 519 */ 520 #include <unistd.h> 521 #endif 522 523 #ifndef YY_EXTRA_TYPE 524 #define YY_EXTRA_TYPE void * 525 #endif 526 527 /* Macros after this point can all be overridden by user definitions in 528 * section 1. 529 */ 530 531 #ifndef YY_SKIP_YYWRAP 532 #ifdef __cplusplus 533 extern "C" int yywrap (void ); 534 #else 535 extern int yywrap (void ); 536 #endif 537 #endif 538 539 #ifndef yytext_ptr 540 static void yy_flex_strncpy (char *,yyconst char *,int ); 541 #endif 542 543 #ifdef YY_NEED_STRLEN 544 static int yy_flex_strlen (yyconst char * ); 545 #endif 546 547 #ifndef YY_NO_INPUT 548 549 #ifdef __cplusplus 550 static int yyinput (void ); 551 #else 552 static int input (void ); 553 #endif 554 555 #endif 556 557 /* Amount of stuff to slurp up with each read. */ 558 #ifndef YY_READ_BUF_SIZE 559 #define YY_READ_BUF_SIZE 8192 560 #endif 561 562 /* Copy whatever the last rule matched to the standard output. */ 563 #ifndef ECHO 564 /* This used to be an fputs(), but since the string might contain NUL's, 565 * we now use fwrite(). 566 */ 567 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) 568 #endif 569 570 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 571 * is returned in "result". 572 */ 573 #ifndef YY_INPUT 574 #define YY_INPUT(buf,result,max_size) \ 575 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 576 { \ 577 int c = '*'; \ 578 size_t n; \ 579 for ( n = 0; n < max_size && \ 580 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 581 buf[n] = (char) c; \ 582 if ( c == '\n' ) \ 583 buf[n++] = (char) c; \ 584 if ( c == EOF && ferror( yyin ) ) \ 585 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 586 result = n; \ 587 } \ 588 else \ 589 { \ 590 errno=0; \ 591 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 592 { \ 593 if( errno != EINTR) \ 594 { \ 595 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 596 break; \ 597 } \ 598 errno=0; \ 599 clearerr(yyin); \ 600 } \ 601 }\ 602 \ 603 604 #endif 605 606 /* No semi-colon after return; correct usage is to write "yyterminate();" - 607 * we don't want an extra ';' after the "return" because that will cause 608 * some compilers to complain about unreachable statements. 609 */ 610 #ifndef yyterminate 611 #define yyterminate() return YY_NULL 612 #endif 613 614 /* Number of entries by which start-condition stack grows. */ 615 #ifndef YY_START_STACK_INCR 616 #define YY_START_STACK_INCR 25 617 #endif 618 619 /* Report a fatal error. */ 620 #ifndef YY_FATAL_ERROR 621 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 622 #endif 623 624 /* end tables serialization structures and prototypes */ 625 626 /* Default declaration of generated scanner - a define so the user can 627 * easily add parameters. 628 */ 629 #ifndef YY_DECL 630 #define YY_DECL_IS_OURS 1 631 632 extern int yylex (void); 633 634 #define YY_DECL int yylex (void) 635 #endif /* !YY_DECL */ 636 637 /* Code executed at the beginning of each rule, after yytext and yyleng 638 * have been set up. 639 */ 640 #ifndef YY_USER_ACTION 641 #define YY_USER_ACTION 642 #endif 643 644 /* Code executed at the end of each rule. */ 645 #ifndef YY_BREAK 646 #define YY_BREAK break; 647 #endif 648 649 #define YY_RULE_SETUP \ 650 YY_USER_ACTION 651 652 /** The main scanner function which does all the work. 653 */ 654 YY_DECL 655 { 656 register yy_state_type yy_current_state; 657 register char *yy_cp, *yy_bp; 658 register int yy_act; 659 660 #line 64 "lexer.l" 661 662 663 #line 664 "lex.yy.c" 664 665 if ( (yy_init) ) 666 { 667 (yy_init) = 0; 668 669 #ifdef YY_USER_INIT 670 YY_USER_INIT; 671 #endif 672 673 if ( ! (yy_start) ) 674 (yy_start) = 1; /* first start state */ 675 676 if ( ! yyin ) 677 yyin = stdin; 678 679 if ( ! yyout ) 680 yyout = stdout; 681 682 if ( ! YY_CURRENT_BUFFER ) { 683 yyensure_buffer_stack (); 684 YY_CURRENT_BUFFER_LVALUE = 685 yy_create_buffer(yyin,YY_BUF_SIZE ); 686 } 687 688 yy_load_buffer_state( ); 689 } 690 691 while ( 1 ) /* loops until end-of-file is reached */ 692 { 693 yy_cp = (yy_c_buf_p); 694 695 /* Support of yytext. */ 696 *yy_cp = (yy_hold_char); 697 698 /* yy_bp points to the position in yy_ch_buf of the start of 699 * the current run. 700 */ 701 yy_bp = yy_cp; 702 703 yy_current_state = (yy_start); 704 yy_match: 705 do 706 { 707 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 708 if ( yy_accept[yy_current_state] ) 709 { 710 (yy_last_accepting_state) = yy_current_state; 711 (yy_last_accepting_cpos) = yy_cp; 712 } 713 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 714 { 715 yy_current_state = (int) yy_def[yy_current_state]; 716 if ( yy_current_state >= 36 ) 717 yy_c = yy_meta[(unsigned int) yy_c]; 718 } 719 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 720 ++yy_cp; 721 } 722 while ( yy_base[yy_current_state] != 47 ); 723 724 yy_find_action: 725 yy_act = yy_accept[yy_current_state]; 726 if ( yy_act == 0 ) 727 { /* have to back up */ 728 yy_cp = (yy_last_accepting_cpos); 729 yy_current_state = (yy_last_accepting_state); 730 yy_act = yy_accept[yy_current_state]; 731 } 732 733 YY_DO_BEFORE_ACTION; 734 735 do_action: /* This label is used only to access EOF actions. */ 736 737 switch ( yy_act ) 738 { /* beginning of action switch */ 739 case 0: /* must back up */ 740 /* undo the effects of YY_DO_BEFORE_ACTION */ 741 *yy_cp = (yy_hold_char); 742 yy_cp = (yy_last_accepting_cpos); 743 yy_current_state = (yy_last_accepting_state); 744 goto yy_find_action; 745 746 case 1: 747 YY_RULE_SETUP 748 #line 66 "lexer.l" 749 { 750 /* Skip spaces and tabs */ 751 ; 752 } 753 YY_BREAK 754 case 2: 755 /* rule 2 can match eol */ 756 YY_RULE_SETUP 757 #line 71 "lexer.l" 758 { 759 /* Skip comments */ 760 lineno++; 761 } 762 YY_BREAK 763 case 3: 764 YY_RULE_SETUP 765 #line 76 "lexer.l" 766 { 767 yylval.number = atoi(yytext); 768 return NUMBER; 769 } 770 YY_BREAK 771 case 4: 772 YY_RULE_SETUP 773 #line 81 "lexer.l" 774 { 775 yylval.string = yytext; 776 return STRING; 777 } 778 YY_BREAK 779 case 5: 780 YY_RULE_SETUP 781 #line 86 "lexer.l" 782 { 783 bdaddr_t *ba = malloc(sizeof(bdaddr_t)); 784 str2ba(yytext, ba); 785 yylval.bdaddr = ba; 786 return BDADDR; 787 } 788 YY_BREAK 789 case 6: 790 YY_RULE_SETUP 791 #line 93 "lexer.l" 792 { 793 int keyword = rfcomm_find_keyword(rfcomm_keyword, yytext); 794 if (keyword != -1) 795 return keyword; 796 797 if (strncmp(yytext, "rfcomm", 6) == 0) { 798 yylval.number = atoi(yytext + 6); 799 return RFCOMM; 800 } 801 802 yylval.string = yytext; 803 return WORD; 804 } 805 YY_BREAK 806 case 7: 807 /* rule 7 can match eol */ 808 YY_RULE_SETUP 809 #line 107 "lexer.l" 810 { 811 lineno++; 812 } 813 YY_BREAK 814 case 8: 815 YY_RULE_SETUP 816 #line 111 "lexer.l" 817 { 818 return *yytext; 819 } 820 YY_BREAK 821 case 9: 822 YY_RULE_SETUP 823 #line 115 "lexer.l" 824 ECHO; 825 YY_BREAK 826 #line 827 "lex.yy.c" 827 case YY_STATE_EOF(INITIAL): 828 yyterminate(); 829 830 case YY_END_OF_BUFFER: 831 { 832 /* Amount of text matched not including the EOB char. */ 833 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 834 835 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 836 *yy_cp = (yy_hold_char); 837 YY_RESTORE_YY_MORE_OFFSET 838 839 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 840 { 841 /* We're scanning a new file or input source. It's 842 * possible that this happened because the user 843 * just pointed yyin at a new source and called 844 * yylex(). If so, then we have to assure 845 * consistency between YY_CURRENT_BUFFER and our 846 * globals. Here is the right place to do so, because 847 * this is the first action (other than possibly a 848 * back-up) that will match for the new input source. 849 */ 850 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 851 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 852 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 853 } 854 855 /* Note that here we test for yy_c_buf_p "<=" to the position 856 * of the first EOB in the buffer, since yy_c_buf_p will 857 * already have been incremented past the NUL character 858 * (since all states make transitions on EOB to the 859 * end-of-buffer state). Contrast this with the test 860 * in input(). 861 */ 862 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 863 { /* This was really a NUL. */ 864 yy_state_type yy_next_state; 865 866 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 867 868 yy_current_state = yy_get_previous_state( ); 869 870 /* Okay, we're now positioned to make the NUL 871 * transition. We couldn't have 872 * yy_get_previous_state() go ahead and do it 873 * for us because it doesn't know how to deal 874 * with the possibility of jamming (and we don't 875 * want to build jamming into it because then it 876 * will run more slowly). 877 */ 878 879 yy_next_state = yy_try_NUL_trans( yy_current_state ); 880 881 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 882 883 if ( yy_next_state ) 884 { 885 /* Consume the NUL. */ 886 yy_cp = ++(yy_c_buf_p); 887 yy_current_state = yy_next_state; 888 goto yy_match; 889 } 890 891 else 892 { 893 yy_cp = (yy_c_buf_p); 894 goto yy_find_action; 895 } 896 } 897 898 else switch ( yy_get_next_buffer( ) ) 899 { 900 case EOB_ACT_END_OF_FILE: 901 { 902 (yy_did_buffer_switch_on_eof) = 0; 903 904 if ( yywrap( ) ) 905 { 906 /* Note: because we've taken care in 907 * yy_get_next_buffer() to have set up 908 * yytext, we can now set up 909 * yy_c_buf_p so that if some total 910 * hoser (like flex itself) wants to 911 * call the scanner after we return the 912 * YY_NULL, it'll still work - another 913 * YY_NULL will get returned. 914 */ 915 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 916 917 yy_act = YY_STATE_EOF(YY_START); 918 goto do_action; 919 } 920 921 else 922 { 923 if ( ! (yy_did_buffer_switch_on_eof) ) 924 YY_NEW_FILE; 925 } 926 break; 927 } 928 929 case EOB_ACT_CONTINUE_SCAN: 930 (yy_c_buf_p) = 931 (yytext_ptr) + yy_amount_of_matched_text; 932 933 yy_current_state = yy_get_previous_state( ); 934 935 yy_cp = (yy_c_buf_p); 936 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 937 goto yy_match; 938 939 case EOB_ACT_LAST_MATCH: 940 (yy_c_buf_p) = 941 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 942 943 yy_current_state = yy_get_previous_state( ); 944 945 yy_cp = (yy_c_buf_p); 946 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 947 goto yy_find_action; 948 } 949 break; 950 } 951 952 default: 953 YY_FATAL_ERROR( 954 "fatal flex scanner internal error--no action found" ); 955 } /* end of action switch */ 956 } /* end of scanning one token */ 957 } /* end of yylex */ 958 959 /* yy_get_next_buffer - try to read in a new buffer 960 * 961 * Returns a code representing an action: 962 * EOB_ACT_LAST_MATCH - 963 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 964 * EOB_ACT_END_OF_FILE - end of file 965 */ 966 static int yy_get_next_buffer (void) 967 { 968 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 969 register char *source = (yytext_ptr); 970 register int number_to_move, i; 971 int ret_val; 972 973 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 974 YY_FATAL_ERROR( 975 "fatal flex scanner internal error--end of buffer missed" ); 976 977 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 978 { /* Don't try to fill the buffer, so this is an EOF. */ 979 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 980 { 981 /* We matched a single character, the EOB, so 982 * treat this as a final EOF. 983 */ 984 return EOB_ACT_END_OF_FILE; 985 } 986 987 else 988 { 989 /* We matched some text prior to the EOB, first 990 * process it. 991 */ 992 return EOB_ACT_LAST_MATCH; 993 } 994 } 995 996 /* Try to read more data. */ 997 998 /* First move last chars to start of buffer. */ 999 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 1000 1001 for ( i = 0; i < number_to_move; ++i ) 1002 *(dest++) = *(source++); 1003 1004 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1005 /* don't do the read, it's not guaranteed to return an EOF, 1006 * just force an EOF 1007 */ 1008 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 1009 1010 else 1011 { 1012 int num_to_read = 1013 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1014 1015 while ( num_to_read <= 0 ) 1016 { /* Not enough room in the buffer - grow it. */ 1017 1018 /* just a shorter name for the current buffer */ 1019 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1020 1021 int yy_c_buf_p_offset = 1022 (int) ((yy_c_buf_p) - b->yy_ch_buf); 1023 1024 if ( b->yy_is_our_buffer ) 1025 { 1026 int new_size = b->yy_buf_size * 2; 1027 1028 if ( new_size <= 0 ) 1029 b->yy_buf_size += b->yy_buf_size / 8; 1030 else 1031 b->yy_buf_size *= 2; 1032 1033 b->yy_ch_buf = (char *) 1034 /* Include room in for 2 EOB chars. */ 1035 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 1036 } 1037 else 1038 /* Can't grow it, we don't own it. */ 1039 b->yy_ch_buf = 0; 1040 1041 if ( ! b->yy_ch_buf ) 1042 YY_FATAL_ERROR( 1043 "fatal error - scanner input buffer overflow" ); 1044 1045 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1046 1047 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1048 number_to_move - 1; 1049 1050 } 1051 1052 if ( num_to_read > YY_READ_BUF_SIZE ) 1053 num_to_read = YY_READ_BUF_SIZE; 1054 1055 /* Read in more data. */ 1056 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1057 (yy_n_chars), num_to_read ); 1058 1059 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1060 } 1061 1062 if ( (yy_n_chars) == 0 ) 1063 { 1064 if ( number_to_move == YY_MORE_ADJ ) 1065 { 1066 ret_val = EOB_ACT_END_OF_FILE; 1067 yyrestart(yyin ); 1068 } 1069 1070 else 1071 { 1072 ret_val = EOB_ACT_LAST_MATCH; 1073 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1074 YY_BUFFER_EOF_PENDING; 1075 } 1076 } 1077 1078 else 1079 ret_val = EOB_ACT_CONTINUE_SCAN; 1080 1081 (yy_n_chars) += number_to_move; 1082 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1083 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1084 1085 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1086 1087 return ret_val; 1088 } 1089 1090 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1091 1092 static yy_state_type yy_get_previous_state (void) 1093 { 1094 register yy_state_type yy_current_state; 1095 register char *yy_cp; 1096 1097 yy_current_state = (yy_start); 1098 1099 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1100 { 1101 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1102 if ( yy_accept[yy_current_state] ) 1103 { 1104 (yy_last_accepting_state) = yy_current_state; 1105 (yy_last_accepting_cpos) = yy_cp; 1106 } 1107 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1108 { 1109 yy_current_state = (int) yy_def[yy_current_state]; 1110 if ( yy_current_state >= 36 ) 1111 yy_c = yy_meta[(unsigned int) yy_c]; 1112 } 1113 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1114 } 1115 1116 return yy_current_state; 1117 } 1118 1119 /* yy_try_NUL_trans - try to make a transition on the NUL character 1120 * 1121 * synopsis 1122 * next_state = yy_try_NUL_trans( current_state ); 1123 */ 1124 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1125 { 1126 register int yy_is_jam; 1127 register char *yy_cp = (yy_c_buf_p); 1128 1129 register YY_CHAR yy_c = 1; 1130 if ( yy_accept[yy_current_state] ) 1131 { 1132 (yy_last_accepting_state) = yy_current_state; 1133 (yy_last_accepting_cpos) = yy_cp; 1134 } 1135 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1136 { 1137 yy_current_state = (int) yy_def[yy_current_state]; 1138 if ( yy_current_state >= 36 ) 1139 yy_c = yy_meta[(unsigned int) yy_c]; 1140 } 1141 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1142 yy_is_jam = (yy_current_state == 35); 1143 1144 return yy_is_jam ? 0 : yy_current_state; 1145 } 1146 1147 #ifndef YY_NO_INPUT 1148 #ifdef __cplusplus 1149 static int yyinput (void) 1150 #else 1151 static int input (void) 1152 #endif 1153 1154 { 1155 int c; 1156 1157 *(yy_c_buf_p) = (yy_hold_char); 1158 1159 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1160 { 1161 /* yy_c_buf_p now points to the character we want to return. 1162 * If this occurs *before* the EOB characters, then it's a 1163 * valid NUL; if not, then we've hit the end of the buffer. 1164 */ 1165 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1166 /* This was really a NUL. */ 1167 *(yy_c_buf_p) = '\0'; 1168 1169 else 1170 { /* need more input */ 1171 int offset = (yy_c_buf_p) - (yytext_ptr); 1172 ++(yy_c_buf_p); 1173 1174 switch ( yy_get_next_buffer( ) ) 1175 { 1176 case EOB_ACT_LAST_MATCH: 1177 /* This happens because yy_g_n_b() 1178 * sees that we've accumulated a 1179 * token and flags that we need to 1180 * try matching the token before 1181 * proceeding. But for input(), 1182 * there's no matching to consider. 1183 * So convert the EOB_ACT_LAST_MATCH 1184 * to EOB_ACT_END_OF_FILE. 1185 */ 1186 1187 /* Reset buffer status. */ 1188 yyrestart(yyin ); 1189 1190 /*FALLTHROUGH*/ 1191 1192 case EOB_ACT_END_OF_FILE: 1193 { 1194 if ( yywrap( ) ) 1195 return EOF; 1196 1197 if ( ! (yy_did_buffer_switch_on_eof) ) 1198 YY_NEW_FILE; 1199 #ifdef __cplusplus 1200 return yyinput(); 1201 #else 1202 return input(); 1203 #endif 1204 } 1205 1206 case EOB_ACT_CONTINUE_SCAN: 1207 (yy_c_buf_p) = (yytext_ptr) + offset; 1208 break; 1209 } 1210 } 1211 } 1212 1213 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1214 *(yy_c_buf_p) = '\0'; /* preserve yytext */ 1215 (yy_hold_char) = *++(yy_c_buf_p); 1216 1217 return c; 1218 } 1219 #endif /* ifndef YY_NO_INPUT */ 1220 1221 /** Immediately switch to a different input stream. 1222 * @param input_file A readable stream. 1223 * 1224 * @note This function does not reset the start condition to @c INITIAL . 1225 */ 1226 void yyrestart (FILE * input_file ) 1227 { 1228 1229 if ( ! YY_CURRENT_BUFFER ){ 1230 yyensure_buffer_stack (); 1231 YY_CURRENT_BUFFER_LVALUE = 1232 yy_create_buffer(yyin,YY_BUF_SIZE ); 1233 } 1234 1235 yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 1236 yy_load_buffer_state( ); 1237 } 1238 1239 /** Switch to a different input buffer. 1240 * @param new_buffer The new input buffer. 1241 * 1242 */ 1243 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1244 { 1245 1246 /* TODO. We should be able to replace this entire function body 1247 * with 1248 * yypop_buffer_state(); 1249 * yypush_buffer_state(new_buffer); 1250 */ 1251 yyensure_buffer_stack (); 1252 if ( YY_CURRENT_BUFFER == new_buffer ) 1253 return; 1254 1255 if ( YY_CURRENT_BUFFER ) 1256 { 1257 /* Flush out information for old buffer. */ 1258 *(yy_c_buf_p) = (yy_hold_char); 1259 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1260 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1261 } 1262 1263 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1264 yy_load_buffer_state( ); 1265 1266 /* We don't actually know whether we did this switch during 1267 * EOF (yywrap()) processing, but the only time this flag 1268 * is looked at is after yywrap() is called, so it's safe 1269 * to go ahead and always set it. 1270 */ 1271 (yy_did_buffer_switch_on_eof) = 1; 1272 } 1273 1274 static void yy_load_buffer_state (void) 1275 { 1276 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1277 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1278 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1279 (yy_hold_char) = *(yy_c_buf_p); 1280 } 1281 1282 /** Allocate and initialize an input buffer state. 1283 * @param file A readable stream. 1284 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1285 * 1286 * @return the allocated buffer state. 1287 */ 1288 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 1289 { 1290 YY_BUFFER_STATE b; 1291 1292 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1293 if ( ! b ) 1294 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1295 1296 b->yy_buf_size = size; 1297 1298 /* yy_ch_buf has to be 2 characters longer than the size given because 1299 * we need to put in 2 end-of-buffer characters. 1300 */ 1301 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 1302 if ( ! b->yy_ch_buf ) 1303 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1304 1305 b->yy_is_our_buffer = 1; 1306 1307 yy_init_buffer(b,file ); 1308 1309 return b; 1310 } 1311 1312 /** Destroy the buffer. 1313 * @param b a buffer created with yy_create_buffer() 1314 * 1315 */ 1316 void yy_delete_buffer (YY_BUFFER_STATE b ) 1317 { 1318 1319 if ( ! b ) 1320 return; 1321 1322 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1323 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1324 1325 if ( b->yy_is_our_buffer ) 1326 yyfree((void *) b->yy_ch_buf ); 1327 1328 yyfree((void *) b ); 1329 } 1330 1331 #ifndef __cplusplus 1332 extern int isatty (int ); 1333 #endif /* __cplusplus */ 1334 1335 /* Initializes or reinitializes a buffer. 1336 * This function is sometimes called more than once on the same buffer, 1337 * such as during a yyrestart() or at EOF. 1338 */ 1339 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1340 1341 { 1342 int oerrno = errno; 1343 1344 yy_flush_buffer(b ); 1345 1346 b->yy_input_file = file; 1347 b->yy_fill_buffer = 1; 1348 1349 /* If b is the current buffer, then yy_init_buffer was _probably_ 1350 * called from yyrestart() or through yy_get_next_buffer. 1351 * In that case, we don't want to reset the lineno or column. 1352 */ 1353 if (b != YY_CURRENT_BUFFER){ 1354 b->yy_bs_lineno = 1; 1355 b->yy_bs_column = 0; 1356 } 1357 1358 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1359 1360 errno = oerrno; 1361 } 1362 1363 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1364 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1365 * 1366 */ 1367 void yy_flush_buffer (YY_BUFFER_STATE b ) 1368 { 1369 if ( ! b ) 1370 return; 1371 1372 b->yy_n_chars = 0; 1373 1374 /* We always need two end-of-buffer characters. The first causes 1375 * a transition to the end-of-buffer state. The second causes 1376 * a jam in that state. 1377 */ 1378 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1379 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1380 1381 b->yy_buf_pos = &b->yy_ch_buf[0]; 1382 1383 b->yy_at_bol = 1; 1384 b->yy_buffer_status = YY_BUFFER_NEW; 1385 1386 if ( b == YY_CURRENT_BUFFER ) 1387 yy_load_buffer_state( ); 1388 } 1389 1390 /** Pushes the new state onto the stack. The new state becomes 1391 * the current state. This function will allocate the stack 1392 * if necessary. 1393 * @param new_buffer The new state. 1394 * 1395 */ 1396 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1397 { 1398 if (new_buffer == NULL) 1399 return; 1400 1401 yyensure_buffer_stack(); 1402 1403 /* This block is copied from yy_switch_to_buffer. */ 1404 if ( YY_CURRENT_BUFFER ) 1405 { 1406 /* Flush out information for old buffer. */ 1407 *(yy_c_buf_p) = (yy_hold_char); 1408 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1409 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1410 } 1411 1412 /* Only push if top exists. Otherwise, replace top. */ 1413 if (YY_CURRENT_BUFFER) 1414 (yy_buffer_stack_top)++; 1415 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1416 1417 /* copied from yy_switch_to_buffer. */ 1418 yy_load_buffer_state( ); 1419 (yy_did_buffer_switch_on_eof) = 1; 1420 } 1421 1422 /** Removes and deletes the top of the stack, if present. 1423 * The next element becomes the new top. 1424 * 1425 */ 1426 void yypop_buffer_state (void) 1427 { 1428 if (!YY_CURRENT_BUFFER) 1429 return; 1430 1431 yy_delete_buffer(YY_CURRENT_BUFFER ); 1432 YY_CURRENT_BUFFER_LVALUE = NULL; 1433 if ((yy_buffer_stack_top) > 0) 1434 --(yy_buffer_stack_top); 1435 1436 if (YY_CURRENT_BUFFER) { 1437 yy_load_buffer_state( ); 1438 (yy_did_buffer_switch_on_eof) = 1; 1439 } 1440 } 1441 1442 /* Allocates the stack if it does not exist. 1443 * Guarantees space for at least one push. 1444 */ 1445 static void yyensure_buffer_stack (void) 1446 { 1447 int num_to_alloc; 1448 1449 if (!(yy_buffer_stack)) { 1450 1451 /* First allocation is just for 2 elements, since we don't know if this 1452 * scanner will even need a stack. We use 2 instead of 1 to avoid an 1453 * immediate realloc on the next call. 1454 */ 1455 num_to_alloc = 1; 1456 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1457 (num_to_alloc * sizeof(struct yy_buffer_state*) 1458 ); 1459 1460 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1461 1462 (yy_buffer_stack_max) = num_to_alloc; 1463 (yy_buffer_stack_top) = 0; 1464 return; 1465 } 1466 1467 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1468 1469 /* Increase the buffer to prepare for a possible push. */ 1470 int grow_size = 8 /* arbitrary grow size */; 1471 1472 num_to_alloc = (yy_buffer_stack_max) + grow_size; 1473 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 1474 ((yy_buffer_stack), 1475 num_to_alloc * sizeof(struct yy_buffer_state*) 1476 ); 1477 1478 /* zero only the new slots.*/ 1479 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1480 (yy_buffer_stack_max) = num_to_alloc; 1481 } 1482 } 1483 1484 /** Setup the input buffer state to scan directly from a user-specified character buffer. 1485 * @param base the character buffer 1486 * @param size the size in bytes of the character buffer 1487 * 1488 * @return the newly allocated buffer state object. 1489 */ 1490 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 1491 { 1492 YY_BUFFER_STATE b; 1493 1494 if ( size < 2 || 1495 base[size-2] != YY_END_OF_BUFFER_CHAR || 1496 base[size-1] != YY_END_OF_BUFFER_CHAR ) 1497 /* They forgot to leave room for the EOB's. */ 1498 return 0; 1499 1500 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1501 if ( ! b ) 1502 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 1503 1504 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1505 b->yy_buf_pos = b->yy_ch_buf = base; 1506 b->yy_is_our_buffer = 0; 1507 b->yy_input_file = 0; 1508 b->yy_n_chars = b->yy_buf_size; 1509 b->yy_is_interactive = 0; 1510 b->yy_at_bol = 1; 1511 b->yy_fill_buffer = 0; 1512 b->yy_buffer_status = YY_BUFFER_NEW; 1513 1514 yy_switch_to_buffer(b ); 1515 1516 return b; 1517 } 1518 1519 /** Setup the input buffer state to scan a string. The next call to yylex() will 1520 * scan from a @e copy of @a str. 1521 * @param str a NUL-terminated string to scan 1522 * 1523 * @return the newly allocated buffer state object. 1524 * @note If you want to scan bytes that may contain NUL values, then use 1525 * yy_scan_bytes() instead. 1526 */ 1527 YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) 1528 { 1529 1530 return yy_scan_bytes(yy_str,strlen(yy_str) ); 1531 } 1532 1533 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 1534 * scan from a @e copy of @a bytes. 1535 * @param bytes the byte buffer to scan 1536 * @param len the number of bytes in the buffer pointed to by @a bytes. 1537 * 1538 * @return the newly allocated buffer state object. 1539 */ 1540 YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) 1541 { 1542 YY_BUFFER_STATE b; 1543 char *buf; 1544 yy_size_t n; 1545 int i; 1546 1547 /* Get memory for full buffer, including space for trailing EOB's. */ 1548 n = len + 2; 1549 buf = (char *) yyalloc(n ); 1550 if ( ! buf ) 1551 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 1552 1553 for ( i = 0; i < len; ++i ) 1554 buf[i] = bytes[i]; 1555 1556 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; 1557 1558 b = yy_scan_buffer(buf,n ); 1559 if ( ! b ) 1560 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 1561 1562 /* It's okay to grow etc. this buffer, and we should throw it 1563 * away when we're done. 1564 */ 1565 b->yy_is_our_buffer = 1; 1566 1567 return b; 1568 } 1569 1570 #ifndef YY_EXIT_FAILURE 1571 #define YY_EXIT_FAILURE 2 1572 #endif 1573 1574 static void yy_fatal_error (yyconst char* msg ) 1575 { 1576 (void) fprintf( stderr, "%s\n", msg ); 1577 exit( YY_EXIT_FAILURE ); 1578 } 1579 1580 /* Redefine yyless() so it works in section 3 code. */ 1581 1582 #undef yyless 1583 #define yyless(n) \ 1584 do \ 1585 { \ 1586 /* Undo effects of setting up yytext. */ \ 1587 int yyless_macro_arg = (n); \ 1588 YY_LESS_LINENO(yyless_macro_arg);\ 1589 yytext[yyleng] = (yy_hold_char); \ 1590 (yy_c_buf_p) = yytext + yyless_macro_arg; \ 1591 (yy_hold_char) = *(yy_c_buf_p); \ 1592 *(yy_c_buf_p) = '\0'; \ 1593 yyleng = yyless_macro_arg; \ 1594 } \ 1595 while ( 0 ) 1596 1597 /* Accessor methods (get/set functions) to struct members. */ 1598 1599 /** Get the current line number. 1600 * 1601 */ 1602 int yyget_lineno (void) 1603 { 1604 1605 return yylineno; 1606 } 1607 1608 /** Get the input stream. 1609 * 1610 */ 1611 FILE *yyget_in (void) 1612 { 1613 return yyin; 1614 } 1615 1616 /** Get the output stream. 1617 * 1618 */ 1619 FILE *yyget_out (void) 1620 { 1621 return yyout; 1622 } 1623 1624 /** Get the length of the current token. 1625 * 1626 */ 1627 int yyget_leng (void) 1628 { 1629 return yyleng; 1630 } 1631 1632 /** Get the current token. 1633 * 1634 */ 1635 1636 char *yyget_text (void) 1637 { 1638 return yytext; 1639 } 1640 1641 /** Set the current line number. 1642 * @param line_number 1643 * 1644 */ 1645 void yyset_lineno (int line_number ) 1646 { 1647 1648 yylineno = line_number; 1649 } 1650 1651 /** Set the input stream. This does not discard the current 1652 * input buffer. 1653 * @param in_str A readable stream. 1654 * 1655 * @see yy_switch_to_buffer 1656 */ 1657 void yyset_in (FILE * in_str ) 1658 { 1659 yyin = in_str ; 1660 } 1661 1662 void yyset_out (FILE * out_str ) 1663 { 1664 yyout = out_str ; 1665 } 1666 1667 int yyget_debug (void) 1668 { 1669 return yy_flex_debug; 1670 } 1671 1672 void yyset_debug (int bdebug ) 1673 { 1674 yy_flex_debug = bdebug ; 1675 } 1676 1677 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 1678 int yylex_destroy (void) 1679 { 1680 1681 /* Pop the buffer stack, destroying each element. */ 1682 while(YY_CURRENT_BUFFER){ 1683 yy_delete_buffer(YY_CURRENT_BUFFER ); 1684 YY_CURRENT_BUFFER_LVALUE = NULL; 1685 yypop_buffer_state(); 1686 } 1687 1688 /* Destroy the stack itself. */ 1689 yyfree((yy_buffer_stack) ); 1690 (yy_buffer_stack) = NULL; 1691 1692 return 0; 1693 } 1694 1695 /* 1696 * Internal utility routines. 1697 */ 1698 1699 #ifndef yytext_ptr 1700 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 1701 { 1702 register int i; 1703 for ( i = 0; i < n; ++i ) 1704 s1[i] = s2[i]; 1705 } 1706 #endif 1707 1708 #ifdef YY_NEED_STRLEN 1709 static int yy_flex_strlen (yyconst char * s ) 1710 { 1711 register int n; 1712 for ( n = 0; s[n]; ++n ) 1713 ; 1714 1715 return n; 1716 } 1717 #endif 1718 1719 void *yyalloc (yy_size_t size ) 1720 { 1721 return (void *) malloc( size ); 1722 } 1723 1724 void *yyrealloc (void * ptr, yy_size_t size ) 1725 { 1726 /* The cast to (char *) in the following accommodates both 1727 * implementations that use char* generic pointers, and those 1728 * that use void* generic pointers. It works with the latter 1729 * because both ANSI C and C++ allow castless assignment from 1730 * any pointer type to void*, and deal with argument conversions 1731 * as though doing an assignment. 1732 */ 1733 return (void *) realloc( (char *) ptr, size ); 1734 } 1735 1736 void yyfree (void * ptr ) 1737 { 1738 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 1739 } 1740 1741 #define YYTABLES_NAME "yytables" 1742 1743 #undef YY_NEW_FILE 1744 #undef YY_FLUSH_BUFFER 1745 #undef yy_set_bol 1746 #undef yy_new_buffer 1747 #undef yy_set_interactive 1748 #undef yytext_ptr 1749 #undef YY_DO_BEFORE_ACTION 1750 1751 #ifdef YY_DECL_IS_OURS 1752 #undef YY_DECL_IS_OURS 1753 #undef YY_DECL 1754 #endif 1755 #line 115 "lexer.l" 1756 1757 1758 1759 int yywrap(void) 1760 { 1761 return 1; 1762 } 1763 1764