lex.Pk11Install_yy.c (47524B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #define yy_create_buffer Pk11Install_yy_create_buffer 6 #define yy_delete_buffer Pk11Install_yy_delete_buffer 7 #define yy_scan_buffer Pk11Install_yy_scan_buffer 8 #define yy_scan_string Pk11Install_yy_scan_string 9 #define yy_scan_bytes Pk11Install_yy_scan_bytes 10 #define yy_flex_debug Pk11Install_yy_flex_debug 11 #define yy_init_buffer Pk11Install_yy_init_buffer 12 #define yy_flush_buffer Pk11Install_yy_flush_buffer 13 #define yy_load_buffer_state Pk11Install_yy_load_buffer_state 14 #define yy_switch_to_buffer Pk11Install_yy_switch_to_buffer 15 #define yyin Pk11Install_yyin 16 #define yyleng Pk11Install_yyleng 17 #define yylex Pk11Install_yylex 18 #define yyout Pk11Install_yyout 19 #define yyrestart Pk11Install_yyrestart 20 #define yytext Pk11Install_yytext 21 #define yywrap Pk11Install_yywrap 22 23 #line 20 "lex.Pk11Install_yy.c" 24 /* A lexical scanner generated by flex */ 25 26 #define FLEX_SCANNER 27 #define YY_FLEX_MAJOR_VERSION 2 28 #define YY_FLEX_MINOR_VERSION 5 29 30 #include <stdio.h> 31 32 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ 33 #ifdef c_plusplus 34 #ifndef __cplusplus 35 #define __cplusplus 36 #endif 37 #endif 38 39 #ifdef __cplusplus 40 41 #include <stdlib.h> 42 //#include <unistd.h> 43 44 /* Use prototypes in function declarations. */ 45 #define YY_USE_PROTOS 46 47 /* The "const" storage-class-modifier is valid. */ 48 #define YY_USE_CONST 49 50 #else /* ! __cplusplus */ 51 52 #if __STDC_VERSION__ 53 54 #define YY_USE_PROTOS 55 #define YY_USE_CONST 56 57 #endif /* __STDC_VERSION__ */ 58 #endif /* ! __cplusplus */ 59 60 #ifdef __TURBOC__ 61 #pragma warn - rch 62 #pragma warn - use 63 #include <io.h> 64 #include <stdlib.h> 65 #define YY_USE_CONST 66 #define YY_USE_PROTOS 67 #endif 68 69 #ifdef YY_USE_CONST 70 #define yyconst const 71 #else 72 #define yyconst 73 #endif 74 75 #ifdef YY_USE_PROTOS 76 #define YY_PROTO(proto) proto 77 #else 78 #define YY_PROTO(proto) () 79 #endif 80 81 /* Returned upon end-of-file. */ 82 #define YY_NULL 0 83 84 /* Promotes a possibly negative, possibly signed char to an unsigned 85 * integer for use as an array index. If the signed char is negative, 86 * we want to instead treat it as an 8-bit unsigned char, hence the 87 * double cast. 88 */ 89 #define YY_SC_TO_UI(c) ((unsigned int)(unsigned char)c) 90 91 /* Enter a start condition. This macro really ought to take a parameter, 92 * but we do it the disgusting crufty way forced on us by the ()-less 93 * definition of BEGIN. 94 */ 95 #define BEGIN yy_start = 1 + 2 * 96 97 /* Translate the current start state into a value that can be later handed 98 * to BEGIN to return to the state. The YYSTATE alias is for lex 99 * compatibility. 100 */ 101 #define YY_START ((yy_start - 1) / 2) 102 #define YYSTATE YY_START 103 104 /* Action number for EOF rule of a given start state. */ 105 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 106 107 /* Special action meaning "start processing a new file". */ 108 #define YY_NEW_FILE yyrestart(yyin) 109 110 #define YY_END_OF_BUFFER_CHAR 0 111 112 /* Size of default input buffer. */ 113 #define YY_BUF_SIZE 16384 114 115 typedef struct yy_buffer_state *YY_BUFFER_STATE; 116 117 extern int yyleng; 118 extern FILE *yyin, *yyout; 119 120 #define EOB_ACT_CONTINUE_SCAN 0 121 #define EOB_ACT_END_OF_FILE 1 122 #define EOB_ACT_LAST_MATCH 2 123 124 /* The funky do-while in the following #define is used to turn the definition 125 * int a single C statement (which needs a semi-colon terminator). This 126 * avoids problems with code like: 127 * 128 * if ( condition_holds ) 129 * yyless( 5 ); 130 * else 131 * do_something_else(); 132 * 133 * Prior to using the do-while the compiler would get upset at the 134 * "else" because it interpreted the "if" statement as being all 135 * done when it reached the ';' after the yyless() call. 136 */ 137 138 /* Return all but the first 'n' matched characters back to the input stream. */ 139 140 #define yyless(n) \ 141 do { \ 142 /* Undo effects of setting up yytext. */ \ 143 *yy_cp = yy_hold_char; \ 144 YY_RESTORE_YY_MORE_OFFSET \ 145 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ 146 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 147 } while (0) 148 149 #define unput(c) yyunput(c, yytext_ptr) 150 151 /* The following is because we cannot portably get our hands on size_t 152 * (without autoconf's help, which isn't available because we want 153 * flex-generated scanners to compile on their own). 154 */ 155 typedef unsigned int yy_size_t; 156 157 struct yy_buffer_state { 158 FILE *yy_input_file; 159 160 char *yy_ch_buf; /* input buffer */ 161 char *yy_buf_pos; /* current position in input buffer */ 162 163 /* Size of input buffer in bytes, not including room for EOB 164 * characters. 165 */ 166 yy_size_t yy_buf_size; 167 168 /* Number of characters read into yy_ch_buf, not including EOB 169 * characters. 170 */ 171 int yy_n_chars; 172 173 /* Whether we "own" the buffer - i.e., we know we created it, 174 * and can realloc() it to grow it, and should free() it to 175 * delete it. 176 */ 177 int yy_is_our_buffer; 178 179 /* Whether this is an "interactive" input source; if so, and 180 * if we're using stdio for input, then we want to use getc() 181 * instead of fread(), to make sure we stop fetching input after 182 * each newline. 183 */ 184 int yy_is_interactive; 185 186 /* Whether we're considered to be at the beginning of a line. 187 * If so, '^' rules will be active on the next match, otherwise 188 * not. 189 */ 190 int yy_at_bol; 191 192 /* Whether to try to fill the input buffer when we reach the 193 * end of it. 194 */ 195 int yy_fill_buffer; 196 197 int yy_buffer_status; 198 #define YY_BUFFER_NEW 0 199 #define YY_BUFFER_NORMAL 1 200 /* When an EOF's been seen but there's still some text to process 201 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 202 * shouldn't try reading from the input source any more. We might 203 * still have a bunch of tokens to match, though, because of 204 * possible backing-up. 205 * 206 * When we actually see the EOF, we change the status to "new" 207 * (via yyrestart()), so that the user can continue scanning by 208 * just pointing yyin at a new input file. 209 */ 210 #define YY_BUFFER_EOF_PENDING 2 211 }; 212 213 static YY_BUFFER_STATE yy_current_buffer = 0; 214 215 /* We provide macros for accessing buffer states in case in the 216 * future we want to put the buffer states in a more general 217 * "scanner state". 218 */ 219 #define YY_CURRENT_BUFFER yy_current_buffer 220 221 /* yy_hold_char holds the character lost when yytext is formed. */ 222 static char yy_hold_char; 223 224 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 225 226 int yyleng; 227 228 /* Points to current character in buffer. */ 229 static char *yy_c_buf_p = (char *)0; 230 static int yy_init = 1; /* whether we need to initialize */ 231 static int yy_start = 0; /* start state number */ 232 233 /* Flag which is used to allow yywrap()'s to do buffer switches 234 * instead of setting up a fresh yyin. A bit of a hack ... 235 */ 236 static int yy_did_buffer_switch_on_eof; 237 238 void yyrestart YY_PROTO((FILE * input_file)); 239 240 void yy_switch_to_buffer YY_PROTO((YY_BUFFER_STATE new_buffer)); 241 void yy_load_buffer_state YY_PROTO((void)); 242 YY_BUFFER_STATE yy_create_buffer YY_PROTO((FILE * file, int size)); 243 void yy_delete_buffer YY_PROTO((YY_BUFFER_STATE b)); 244 void yy_init_buffer YY_PROTO((YY_BUFFER_STATE b, FILE *file)); 245 void yy_flush_buffer YY_PROTO((YY_BUFFER_STATE b)); 246 #define YY_FLUSH_BUFFER yy_flush_buffer(yy_current_buffer) 247 248 YY_BUFFER_STATE yy_scan_buffer YY_PROTO((char *base, yy_size_t size)); 249 YY_BUFFER_STATE yy_scan_string YY_PROTO((yyconst char *yy_str)); 250 YY_BUFFER_STATE yy_scan_bytes YY_PROTO((yyconst char *bytes, int len)); 251 252 static void *yy_flex_alloc YY_PROTO((yy_size_t)); 253 static void *yy_flex_realloc YY_PROTO((void *, yy_size_t)); 254 static void yy_flex_free YY_PROTO((void *)); 255 256 #define yy_new_buffer yy_create_buffer 257 258 #define yy_set_interactive(is_interactive) \ 259 { \ 260 if (!yy_current_buffer) \ 261 yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); \ 262 yy_current_buffer->yy_is_interactive = is_interactive; \ 263 } 264 265 #define yy_set_bol(at_bol) \ 266 { \ 267 if (!yy_current_buffer) \ 268 yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); \ 269 yy_current_buffer->yy_at_bol = at_bol; \ 270 } 271 272 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) 273 274 typedef unsigned char YY_CHAR; 275 FILE *yyin = (FILE *)0, *yyout = (FILE *)0; 276 typedef int yy_state_type; 277 extern char *yytext; 278 #define yytext_ptr yytext 279 280 static yy_state_type yy_get_previous_state YY_PROTO((void)); 281 static yy_state_type yy_try_NUL_trans YY_PROTO((yy_state_type current_state)); 282 static int yy_get_next_buffer YY_PROTO((void)); 283 static void yy_fatal_error YY_PROTO((yyconst char msg[])); 284 285 /* Done after the current pattern has been matched and before the 286 * corresponding action - sets up yytext. 287 */ 288 #define YY_DO_BEFORE_ACTION \ 289 yytext_ptr = yy_bp; \ 290 yyleng = (int)(yy_cp - yy_bp); \ 291 yy_hold_char = *yy_cp; \ 292 *yy_cp = '\0'; \ 293 yy_c_buf_p = yy_cp; 294 295 #define YY_NUM_RULES 8 296 #define YY_END_OF_BUFFER 9 297 static yyconst short int yy_accept[16] = { 0, 298 0, 0, 9, 3, 6, 5, 7, 1, 2, 3, 299 6, 0, 0, 4, 0 }; 300 301 static yyconst int yy_ec[256] = { 0, 302 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 303 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 304 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 305 1, 2, 1, 5, 1, 1, 1, 1, 1, 1, 306 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 307 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 308 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 309 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 310 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 311 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 312 313 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 314 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 315 1, 1, 7, 1, 8, 1, 1, 1, 1, 1, 316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 317 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 318 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 319 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 320 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 323 324 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 325 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 327 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 328 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 329 1, 1, 1, 1, 1 }; 330 331 static yyconst int yy_meta[9] = { 0, 332 1, 2, 3, 4, 3, 1, 5, 5 }; 333 334 static yyconst short int yy_base[19] = { 0, 335 0, 0, 19, 0, 0, 21, 12, 21, 21, 0, 336 0, 4, 6, 21, 21, 13, 11, 15 }; 337 338 static yyconst short int yy_def[19] = { 0, 339 15, 1, 15, 16, 17, 15, 18, 15, 15, 16, 340 17, 18, 15, 15, 0, 15, 15, 15 }; 341 342 static yyconst short int yy_nxt[30] = { 0, 343 4, 5, 6, 5, 7, 4, 8, 9, 14, 13, 344 12, 12, 11, 10, 11, 12, 12, 13, 15, 12, 345 3, 15, 15, 15, 15, 15, 15, 15, 15 }; 346 347 static yyconst short int yy_chk[30] = { 0, 348 1, 1, 1, 1, 1, 1, 1, 1, 12, 12, 349 13, 13, 17, 16, 17, 18, 18, 7, 3, 18, 350 15, 15, 15, 15, 15, 15, 15, 15, 15 }; 351 352 static yy_state_type yy_last_accepting_state; 353 static char *yy_last_accepting_cpos; 354 355 /* The intent behind this definition is that it'll catch 356 * any uses of REJECT which flex missed. 357 */ 358 #define REJECT reject_used_but_not_detected 359 #define yymore() yymore_used_but_not_detected 360 #define YY_MORE_ADJ 0 361 #define YY_RESTORE_YY_MORE_OFFSET 362 char *yytext; 363 #line 1 "installparse.l" 364 #define INITIAL 0 365 /* lex file for analyzing PKCS #11 Module installation instructions */ 366 /*----------------------------- Definitions ---------------------------*/ 367 #line 5 "installparse.l" 368 #include <string.h> 369 370 #include "install-ds.h" /* defines tokens and data structures */ 371 #include "installparse.h" /* produced by yacc -d */ 372 #include <prprf.h> 373 static char *putSimpleString(char *); /* return copy of string */ 374 static char *putComplexString(char *); /* strip out quotes, deal with */ 375 /* escaped characters */ 376 377 void Pk11Install_yyerror(char *); 378 379 /* Overrides to use NSPR */ 380 #define malloc PR_Malloc 381 #define realloc PR_Realloc 382 #define free PR_Free 383 384 int Pk11Install_yylinenum = 1; 385 static char *err; 386 387 #define YY_NEVER_INTERACTIVE 1 388 #define yyunput Pkcs11Install_yyunput 389 390 /* This is the default YY_INPUT modified for NSPR */ 391 #define YY_INPUT(buf, result, max_size) \ 392 if (yy_current_buffer->yy_is_interactive) { \ 393 char c; \ 394 int n; \ 395 for (n = 0; n < max_size && \ 396 PR_Read(Pk11Install_FD, &c, 1) == 1 && c != '\n'; \ 397 ++n) { \ 398 buf[n] = c; \ 399 } \ 400 if (c == '\n') { \ 401 buf[n++] = c; \ 402 } \ 403 result = n; \ 404 } else { \ 405 result = PR_Read(Pk11Install_FD, buf, max_size); \ 406 } 407 408 /*** Regular expression definitions ***/ 409 /* simple_string has no whitespace, quotes, or braces */ 410 /* complex_string is enclosed in quotes. Inside the quotes, quotes and 411 backslashes must be backslash-escaped. Otherwise, anything goes. */ 412 /* Standard whitespace */ 413 /*---------------------------- Actions --------------------------------*/ 414 #line 437 "lex.Pk11Install_yy.cpp" 415 416 /* Macros after this point can all be overridden by user definitions in 417 * section 1. 418 */ 419 420 #ifndef YY_SKIP_YYWRAP 421 #ifdef __cplusplus 422 extern "C" int yywrap YY_PROTO((void)); 423 #else 424 extern int yywrap YY_PROTO((void)); 425 #endif 426 #endif 427 428 #ifndef YY_NO_UNPUT 429 static void yyunput YY_PROTO((int c, char *buf_ptr)); 430 #endif 431 432 #ifndef yytext_ptr 433 static void yy_flex_strncpy YY_PROTO((char *, yyconst char *, int)); 434 #endif 435 436 #ifdef YY_NEED_STRLEN 437 static int yy_flex_strlen YY_PROTO((yyconst char *)); 438 #endif 439 440 #ifndef YY_NO_INPUT 441 #ifdef __cplusplus 442 static int yyinput YY_PROTO((void)); 443 #else 444 static int input YY_PROTO((void)); 445 #endif 446 #endif 447 448 #if YY_STACK_USED 449 static int yy_start_stack_ptr = 0; 450 static int yy_start_stack_depth = 0; 451 static int *yy_start_stack = 0; 452 #ifndef YY_NO_PUSH_STATE 453 static void yy_push_state YY_PROTO((int new_state)); 454 #endif 455 #ifndef YY_NO_POP_STATE 456 static void yy_pop_state YY_PROTO((void)); 457 #endif 458 #ifndef YY_NO_TOP_STATE 459 static int yy_top_state YY_PROTO((void)); 460 #endif 461 462 #else 463 #define YY_NO_PUSH_STATE 1 464 #define YY_NO_POP_STATE 1 465 #define YY_NO_TOP_STATE 1 466 #endif 467 468 #ifdef YY_MALLOC_DECL 469 YY_MALLOC_DECL 470 #else 471 #if __STDC_VERSION__ 472 #ifndef __cplusplus 473 #include <stdlib.h> 474 #endif 475 #else 476 /* Just try to get by without declaring the routines. This will fail 477 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) 478 * or sizeof(void*) != sizeof(int). 479 */ 480 #endif 481 #endif 482 483 /* Amount of stuff to slurp up with each read. */ 484 #ifndef YY_READ_BUF_SIZE 485 #define YY_READ_BUF_SIZE 8192 486 #endif 487 488 /* Copy whatever the last rule matched to the standard output. */ 489 490 #ifndef ECHO 491 /* This used to be an fputs(), but since the string might contain NUL's, 492 * we now use fwrite(). 493 */ 494 #define ECHO (void)fwrite(yytext, yyleng, 1, yyout) 495 #endif 496 497 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 498 * is returned in "result". 499 */ 500 #ifndef YY_INPUT 501 #define YY_INPUT(buf, result, max_size) \ 502 if (yy_current_buffer->yy_is_interactive) { \ 503 int c = '*', n; \ 504 for (n = 0; n < max_size && \ 505 (c = getc(yyin)) != EOF && c != '\n'; \ 506 ++n) \ 507 buf[n] = (char)c; \ 508 if (c == '\n') \ 509 buf[n++] = (char)c; \ 510 if (c == EOF && ferror(yyin)) \ 511 YY_FATAL_ERROR("input in flex scanner failed"); \ 512 result = n; \ 513 } else if (((result = fread(buf, 1, max_size, yyin)) == 0) && \ 514 ferror(yyin)) \ 515 YY_FATAL_ERROR("input in flex scanner failed"); 516 #endif 517 518 /* No semi-colon after return; correct usage is to write "yyterminate();" - 519 * we don't want an extra ';' after the "return" because that will cause 520 * some compilers to complain about unreachable statements. 521 */ 522 #ifndef yyterminate 523 #define yyterminate() return YY_NULL 524 #endif 525 526 /* Number of entries by which start-condition stack grows. */ 527 #ifndef YY_START_STACK_INCR 528 #define YY_START_STACK_INCR 25 529 #endif 530 531 /* Report a fatal error. */ 532 #ifndef YY_FATAL_ERROR 533 #define YY_FATAL_ERROR(msg) yy_fatal_error(msg) 534 #endif 535 536 /* Default declaration of generated scanner - a define so the user can 537 * easily add parameters. 538 */ 539 #ifndef YY_DECL 540 #define YY_DECL int yylex YY_PROTO((void)) 541 #endif 542 543 /* Code executed at the beginning of each rule, after yytext and yyleng 544 * have been set up. 545 */ 546 #ifndef YY_USER_ACTION 547 #define YY_USER_ACTION 548 #endif 549 550 /* Code executed at the end of each rule. */ 551 #ifndef YY_BREAK 552 #define YY_BREAK break; 553 #endif 554 555 #define YY_RULE_SETUP \ 556 YY_USER_ACTION 557 558 YY_DECL 559 { 560 register yy_state_type yy_current_state; 561 register char *yy_cp, *yy_bp; 562 register int yy_act; 563 564 #line 60 "installparse.l" 565 566 #line 591 "lex.Pk11Install_yy.cpp" 567 568 if (yy_init) { 569 yy_init = 0; 570 571 #ifdef YY_USER_INIT 572 YY_USER_INIT; 573 #endif 574 575 if (!yy_start) 576 yy_start = 1; /* first start state */ 577 578 if (!yyin) 579 yyin = stdin; 580 581 if (!yyout) 582 yyout = stdout; 583 584 if (!yy_current_buffer) 585 yy_current_buffer = 586 yy_create_buffer(yyin, YY_BUF_SIZE); 587 588 yy_load_buffer_state(); 589 } 590 591 while (1) /* loops until end-of-file is reached */ 592 { 593 yy_cp = yy_c_buf_p; 594 595 /* Support of yytext. */ 596 *yy_cp = yy_hold_char; 597 598 /* yy_bp points to the position in yy_ch_buf of the start of 599 * the current run. 600 */ 601 yy_bp = yy_cp; 602 603 yy_current_state = yy_start; 604 yy_match: 605 do { 606 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 607 if (yy_accept[yy_current_state]) { 608 yy_last_accepting_state = yy_current_state; 609 yy_last_accepting_cpos = yy_cp; 610 } 611 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { 612 yy_current_state = (int)yy_def[yy_current_state]; 613 if (yy_current_state >= 16) 614 yy_c = yy_meta[(unsigned int)yy_c]; 615 } 616 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; 617 ++yy_cp; 618 } while (yy_base[yy_current_state] != 21); 619 620 yy_find_action: 621 yy_act = yy_accept[yy_current_state]; 622 if (yy_act == 0) { /* have to back up */ 623 yy_cp = yy_last_accepting_cpos; 624 yy_current_state = yy_last_accepting_state; 625 yy_act = yy_accept[yy_current_state]; 626 } 627 628 YY_DO_BEFORE_ACTION; 629 630 do_action: /* This label is used only to access EOF actions. */ 631 632 switch (yy_act) { /* beginning of action switch */ 633 case 0: /* must back up */ 634 /* undo the effects of YY_DO_BEFORE_ACTION */ 635 *yy_cp = yy_hold_char; 636 yy_cp = yy_last_accepting_cpos; 637 yy_current_state = yy_last_accepting_state; 638 goto yy_find_action; 639 640 case 1: 641 YY_RULE_SETUP 642 #line 62 "installparse.l" 643 return OPENBRACE; 644 YY_BREAK 645 case 2: 646 YY_RULE_SETUP 647 #line 63 "installparse.l" 648 return CLOSEBRACE; 649 YY_BREAK 650 case 3: 651 YY_RULE_SETUP 652 #line 64 "installparse.l" 653 { 654 Pk11Install_yylval.string = 655 putSimpleString(Pk11Install_yytext); 656 return STRING; 657 } 658 YY_BREAK 659 case 4: 660 YY_RULE_SETUP 661 #line 67 "installparse.l" 662 { 663 Pk11Install_yylval.string = 664 putComplexString(Pk11Install_yytext); 665 return STRING; 666 } 667 YY_BREAK 668 case 5: 669 YY_RULE_SETUP 670 #line 71 "installparse.l" 671 Pk11Install_yylinenum++; 672 YY_BREAK 673 case 6: 674 YY_RULE_SETUP 675 #line 73 "installparse.l" 676 ; 677 YY_BREAK 678 case 7: 679 YY_RULE_SETUP 680 #line 75 "installparse.l" 681 { 682 err = 683 PR_smprintf("Invalid lexeme: %s", Pk11Install_yytext); 684 Pk11Install_yyerror(err); 685 PR_smprintf_free(err); 686 return 1; 687 } 688 YY_BREAK 689 case 8: 690 YY_RULE_SETUP 691 #line 81 "installparse.l" 692 ECHO; 693 YY_BREAK 694 #line 722 "lex.Pk11Install_yy.cpp" 695 case YY_STATE_EOF(INITIAL): 696 yyterminate(); 697 698 case YY_END_OF_BUFFER: { 699 /* Amount of text matched not including the EOB char. */ 700 int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr) - 1; 701 702 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 703 *yy_cp = yy_hold_char; 704 YY_RESTORE_YY_MORE_OFFSET 705 706 if (yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW) { 707 /* We're scanning a new file or input source. It's 708 * possible that this happened because the user 709 * just pointed yyin at a new source and called 710 * yylex(). If so, then we have to assure 711 * consistency between yy_current_buffer and our 712 * globals. Here is the right place to do so, because 713 * this is the first action (other than possibly a 714 * back-up) that will match for the new input source. 715 */ 716 yy_n_chars = yy_current_buffer->yy_n_chars; 717 yy_current_buffer->yy_input_file = yyin; 718 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; 719 } 720 721 /* Note that here we test for yy_c_buf_p "<=" to the position 722 * of the first EOB in the buffer, since yy_c_buf_p will 723 * already have been incremented past the NUL character 724 * (since all states make transitions on EOB to the 725 * end-of-buffer state). Contrast this with the test 726 * in input(). 727 */ 728 if (yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars]) { /* This was really a NUL. */ 729 yy_state_type yy_next_state; 730 731 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; 732 733 yy_current_state = yy_get_previous_state(); 734 735 /* Okay, we're now positioned to make the NUL 736 * transition. We couldn't have 737 * yy_get_previous_state() go ahead and do it 738 * for us because it doesn't know how to deal 739 * with the possibility of jamming (and we don't 740 * want to build jamming into it because then it 741 * will run more slowly). 742 */ 743 744 yy_next_state = yy_try_NUL_trans(yy_current_state); 745 746 yy_bp = yytext_ptr + YY_MORE_ADJ; 747 748 if (yy_next_state) { 749 /* Consume the NUL. */ 750 yy_cp = ++yy_c_buf_p; 751 yy_current_state = yy_next_state; 752 goto yy_match; 753 } 754 755 else { 756 yy_cp = yy_c_buf_p; 757 goto yy_find_action; 758 } 759 } 760 761 else 762 switch (yy_get_next_buffer()) { 763 case EOB_ACT_END_OF_FILE: { 764 yy_did_buffer_switch_on_eof = 0; 765 766 if (yywrap()) { 767 /* Note: because we've taken care in 768 * yy_get_next_buffer() to have set up 769 * yytext, we can now set up 770 * yy_c_buf_p so that if some total 771 * hoser (like flex itself) wants to 772 * call the scanner after we return the 773 * YY_NULL, it'll still work - another 774 * YY_NULL will get returned. 775 */ 776 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; 777 778 yy_act = YY_STATE_EOF(YY_START); 779 goto do_action; 780 } 781 782 else { 783 if (!yy_did_buffer_switch_on_eof) 784 YY_NEW_FILE; 785 } 786 break; 787 } 788 789 case EOB_ACT_CONTINUE_SCAN: 790 yy_c_buf_p = 791 yytext_ptr + yy_amount_of_matched_text; 792 793 yy_current_state = yy_get_previous_state(); 794 795 yy_cp = yy_c_buf_p; 796 yy_bp = yytext_ptr + YY_MORE_ADJ; 797 goto yy_match; 798 799 case EOB_ACT_LAST_MATCH: 800 yy_c_buf_p = 801 &yy_current_buffer->yy_ch_buf[yy_n_chars]; 802 803 yy_current_state = yy_get_previous_state(); 804 805 yy_cp = yy_c_buf_p; 806 yy_bp = yytext_ptr + YY_MORE_ADJ; 807 goto yy_find_action; 808 } 809 break; 810 } 811 812 default: 813 YY_FATAL_ERROR( 814 "fatal flex scanner internal error--no action found"); 815 } /* end of action switch */ 816 } /* end of scanning one token */ 817 } /* end of yylex */ 818 819 /* yy_get_next_buffer - try to read in a new buffer 820 * 821 * Returns a code representing an action: 822 * EOB_ACT_LAST_MATCH - 823 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 824 * EOB_ACT_END_OF_FILE - end of file 825 */ 826 827 static int 828 yy_get_next_buffer() 829 { 830 register char *dest = yy_current_buffer->yy_ch_buf; 831 register char *source = yytext_ptr; 832 register int number_to_move, i; 833 int ret_val; 834 835 if (yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1]) 836 YY_FATAL_ERROR( 837 "fatal flex scanner internal error--end of buffer missed"); 838 839 if (yy_current_buffer->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */ 840 if (yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1) { 841 /* We matched a single character, the EOB, so 842 * treat this as a final EOF. 843 */ 844 return EOB_ACT_END_OF_FILE; 845 } 846 847 else { 848 /* We matched some text prior to the EOB, first 849 * process it. 850 */ 851 return EOB_ACT_LAST_MATCH; 852 } 853 } 854 855 /* Try to read more data. */ 856 857 /* First move last chars to start of buffer. */ 858 number_to_move = (int)(yy_c_buf_p - yytext_ptr) - 1; 859 860 for (i = 0; i < number_to_move; ++i) 861 *(dest++) = *(source++); 862 863 if (yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING) 864 /* don't do the read, it's not guaranteed to return an EOF, 865 * just force an EOF 866 */ 867 yy_current_buffer->yy_n_chars = yy_n_chars = 0; 868 869 else { 870 int num_to_read = 871 yy_current_buffer->yy_buf_size - number_to_move - 1; 872 873 while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */ 874 #ifdef YY_USES_REJECT 875 YY_FATAL_ERROR( 876 "input buffer overflow, can't enlarge buffer because scanner uses REJECT"); 877 #else 878 879 /* just a shorter name for the current buffer */ 880 YY_BUFFER_STATE b = yy_current_buffer; 881 882 int yy_c_buf_p_offset = 883 (int)(yy_c_buf_p - b->yy_ch_buf); 884 885 if (b->yy_is_our_buffer) { 886 int new_size = b->yy_buf_size * 2; 887 888 if (new_size <= 0) 889 b->yy_buf_size += b->yy_buf_size / 8; 890 else 891 b->yy_buf_size *= 2; 892 893 b->yy_ch_buf = (char *) 894 /* Include room in for 2 EOB chars. */ 895 yy_flex_realloc((void *)b->yy_ch_buf, 896 b->yy_buf_size + 2); 897 } else 898 /* Can't grow it, we don't own it. */ 899 b->yy_ch_buf = 0; 900 901 if (!b->yy_ch_buf) 902 YY_FATAL_ERROR( 903 "fatal error - scanner input buffer overflow"); 904 905 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 906 907 num_to_read = yy_current_buffer->yy_buf_size - 908 number_to_move - 1; 909 #endif 910 } 911 912 if (num_to_read > YY_READ_BUF_SIZE) 913 num_to_read = YY_READ_BUF_SIZE; 914 915 /* Read in more data. */ 916 YY_INPUT((&yy_current_buffer->yy_ch_buf[number_to_move]), 917 yy_n_chars, num_to_read); 918 919 yy_current_buffer->yy_n_chars = yy_n_chars; 920 } 921 922 if (yy_n_chars == 0) { 923 if (number_to_move == YY_MORE_ADJ) { 924 ret_val = EOB_ACT_END_OF_FILE; 925 yyrestart(yyin); 926 } 927 928 else { 929 ret_val = EOB_ACT_LAST_MATCH; 930 yy_current_buffer->yy_buffer_status = 931 YY_BUFFER_EOF_PENDING; 932 } 933 } 934 935 else 936 ret_val = EOB_ACT_CONTINUE_SCAN; 937 938 yy_n_chars += number_to_move; 939 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; 940 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 941 942 yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; 943 944 return ret_val; 945 } 946 947 /* yy_get_previous_state - get the state just before the EOB char was reached */ 948 949 static yy_state_type 950 yy_get_previous_state() 951 { 952 register yy_state_type yy_current_state; 953 register char *yy_cp; 954 955 yy_current_state = yy_start; 956 957 for (yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp) { 958 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 959 if (yy_accept[yy_current_state]) { 960 yy_last_accepting_state = yy_current_state; 961 yy_last_accepting_cpos = yy_cp; 962 } 963 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { 964 yy_current_state = (int)yy_def[yy_current_state]; 965 if (yy_current_state >= 16) 966 yy_c = yy_meta[(unsigned int)yy_c]; 967 } 968 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; 969 } 970 971 return yy_current_state; 972 } 973 974 /* yy_try_NUL_trans - try to make a transition on the NUL character 975 * 976 * synopsis 977 * next_state = yy_try_NUL_trans( current_state ); 978 */ 979 980 #ifdef YY_USE_PROTOS 981 static yy_state_type 982 yy_try_NUL_trans(yy_state_type yy_current_state) 983 #else 984 static yy_state_type 985 yy_try_NUL_trans(yy_current_state) 986 yy_state_type yy_current_state; 987 #endif 988 { 989 register int yy_is_jam; 990 register char *yy_cp = yy_c_buf_p; 991 992 register YY_CHAR yy_c = 1; 993 if (yy_accept[yy_current_state]) { 994 yy_last_accepting_state = yy_current_state; 995 yy_last_accepting_cpos = yy_cp; 996 } 997 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { 998 yy_current_state = (int)yy_def[yy_current_state]; 999 if (yy_current_state >= 16) 1000 yy_c = yy_meta[(unsigned int)yy_c]; 1001 } 1002 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; 1003 yy_is_jam = (yy_current_state == 15); 1004 1005 return yy_is_jam ? 0 : yy_current_state; 1006 } 1007 1008 #ifndef YY_NO_UNPUT 1009 #ifdef YY_USE_PROTOS 1010 static void 1011 yyunput(int c, register char *yy_bp) 1012 #else 1013 static void yyunput(c, yy_bp) int c; 1014 register char *yy_bp; 1015 #endif 1016 { 1017 register char *yy_cp = yy_c_buf_p; 1018 1019 /* undo effects of setting up yytext */ 1020 *yy_cp = yy_hold_char; 1021 1022 if (yy_cp < yy_current_buffer->yy_ch_buf + 2) { /* need to shift things up to make room */ 1023 /* +2 for EOB chars. */ 1024 register int number_to_move = yy_n_chars + 2; 1025 register char *dest = &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 1026 2]; 1027 register char *source = 1028 &yy_current_buffer->yy_ch_buf[number_to_move]; 1029 1030 while (source > yy_current_buffer->yy_ch_buf) 1031 *--dest = *--source; 1032 1033 yy_cp += (int)(dest - source); 1034 yy_bp += (int)(dest - source); 1035 yy_current_buffer->yy_n_chars = 1036 yy_n_chars = yy_current_buffer->yy_buf_size; 1037 1038 if (yy_cp < yy_current_buffer->yy_ch_buf + 2) 1039 YY_FATAL_ERROR("flex scanner push-back overflow"); 1040 } 1041 1042 *--yy_cp = (char)c; 1043 1044 yytext_ptr = yy_bp; 1045 yy_hold_char = *yy_cp; 1046 yy_c_buf_p = yy_cp; 1047 } 1048 #endif /* ifndef YY_NO_UNPUT */ 1049 1050 #ifndef YY_NO_INPUT 1051 #ifdef __cplusplus 1052 static int 1053 yyinput() 1054 #else 1055 static int 1056 input() 1057 #endif 1058 { 1059 int c; 1060 1061 *yy_c_buf_p = yy_hold_char; 1062 1063 if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR) { 1064 /* yy_c_buf_p now points to the character we want to return. 1065 * If this occurs *before* the EOB characters, then it's a 1066 * valid NUL; if not, then we've hit the end of the buffer. 1067 */ 1068 if (yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars]) 1069 /* This was really a NUL. */ 1070 *yy_c_buf_p = '\0'; 1071 1072 else { /* need more input */ 1073 int offset = yy_c_buf_p - yytext_ptr; 1074 ++yy_c_buf_p; 1075 1076 switch (yy_get_next_buffer()) { 1077 case EOB_ACT_LAST_MATCH: 1078 /* This happens because yy_g_n_b() 1079 * sees that we've accumulated a 1080 * token and flags that we need to 1081 * try matching the token before 1082 * proceeding. But for input(), 1083 * there's no matching to consider. 1084 * So convert the EOB_ACT_LAST_MATCH 1085 * to EOB_ACT_END_OF_FILE. 1086 */ 1087 1088 /* Reset buffer status. */ 1089 yyrestart(yyin); 1090 1091 /* fall through */ 1092 1093 case EOB_ACT_END_OF_FILE: { 1094 if (yywrap()) 1095 return EOF; 1096 1097 if (!yy_did_buffer_switch_on_eof) 1098 YY_NEW_FILE; 1099 #ifdef __cplusplus 1100 return yyinput(); 1101 #else 1102 return input(); 1103 #endif 1104 } 1105 1106 case EOB_ACT_CONTINUE_SCAN: 1107 yy_c_buf_p = yytext_ptr + offset; 1108 break; 1109 } 1110 } 1111 } 1112 1113 c = *(unsigned char *)yy_c_buf_p; /* cast for 8-bit char's */ 1114 *yy_c_buf_p = '\0'; /* preserve yytext */ 1115 yy_hold_char = *++yy_c_buf_p; 1116 1117 return c; 1118 } 1119 #endif /* ifndef YY_NO_INPUT */ 1120 1121 #ifdef YY_USE_PROTOS 1122 void 1123 yyrestart(FILE *input_file) 1124 #else 1125 void yyrestart(input_file) 1126 FILE *input_file; 1127 #endif 1128 { 1129 if (!yy_current_buffer) 1130 yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); 1131 1132 yy_init_buffer(yy_current_buffer, input_file); 1133 yy_load_buffer_state(); 1134 } 1135 1136 #ifdef YY_USE_PROTOS 1137 void 1138 yy_switch_to_buffer(YY_BUFFER_STATE new_buffer) 1139 #else 1140 void yy_switch_to_buffer(new_buffer) 1141 YY_BUFFER_STATE new_buffer; 1142 #endif 1143 { 1144 if (yy_current_buffer == new_buffer) 1145 return; 1146 1147 if (yy_current_buffer) { 1148 /* Flush out information for old buffer. */ 1149 *yy_c_buf_p = yy_hold_char; 1150 yy_current_buffer->yy_buf_pos = yy_c_buf_p; 1151 yy_current_buffer->yy_n_chars = yy_n_chars; 1152 } 1153 1154 yy_current_buffer = new_buffer; 1155 yy_load_buffer_state(); 1156 1157 /* We don't actually know whether we did this switch during 1158 * EOF (yywrap()) processing, but the only time this flag 1159 * is looked at is after yywrap() is called, so it's safe 1160 * to go ahead and always set it. 1161 */ 1162 yy_did_buffer_switch_on_eof = 1; 1163 } 1164 1165 #ifdef YY_USE_PROTOS 1166 void 1167 yy_load_buffer_state(void) 1168 #else 1169 void 1170 yy_load_buffer_state() 1171 #endif 1172 { 1173 yy_n_chars = yy_current_buffer->yy_n_chars; 1174 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; 1175 yyin = yy_current_buffer->yy_input_file; 1176 yy_hold_char = *yy_c_buf_p; 1177 } 1178 1179 #ifdef YY_USE_PROTOS 1180 YY_BUFFER_STATE 1181 yy_create_buffer(FILE *file, int size) 1182 #else 1183 YY_BUFFER_STATE 1184 yy_create_buffer(file, size) 1185 FILE *file; 1186 int size; 1187 #endif 1188 { 1189 YY_BUFFER_STATE b; 1190 1191 b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state)); 1192 if (!b) 1193 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); 1194 1195 b->yy_buf_size = size; 1196 1197 /* yy_ch_buf has to be 2 characters longer than the size given because 1198 * we need to put in 2 end-of-buffer characters. 1199 */ 1200 b->yy_ch_buf = (char *)yy_flex_alloc(b->yy_buf_size + 2); 1201 if (!b->yy_ch_buf) 1202 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); 1203 1204 b->yy_is_our_buffer = 1; 1205 1206 yy_init_buffer(b, file); 1207 1208 return b; 1209 } 1210 1211 #ifdef YY_USE_PROTOS 1212 void 1213 yy_delete_buffer(YY_BUFFER_STATE b) 1214 #else 1215 void yy_delete_buffer(b) 1216 YY_BUFFER_STATE b; 1217 #endif 1218 { 1219 if (!b) 1220 return; 1221 1222 if (b == yy_current_buffer) 1223 yy_current_buffer = (YY_BUFFER_STATE)0; 1224 1225 if (b->yy_is_our_buffer) 1226 yy_flex_free((void *)b->yy_ch_buf); 1227 1228 yy_flex_free((void *)b); 1229 } 1230 1231 #ifndef YY_ALWAYS_INTERACTIVE 1232 #ifndef YY_NEVER_INTERACTIVE 1233 extern int isatty YY_PROTO((int)); 1234 #endif 1235 #endif 1236 1237 #ifdef YY_USE_PROTOS 1238 void 1239 yy_init_buffer(YY_BUFFER_STATE b, FILE *file) 1240 #else 1241 void yy_init_buffer(b, file) 1242 YY_BUFFER_STATE b; 1243 FILE *file; 1244 #endif 1245 1246 { 1247 yy_flush_buffer(b); 1248 1249 b->yy_input_file = file; 1250 b->yy_fill_buffer = 1; 1251 1252 #if YY_ALWAYS_INTERACTIVE 1253 b->yy_is_interactive = 1; 1254 #else 1255 #if YY_NEVER_INTERACTIVE 1256 b->yy_is_interactive = 0; 1257 #else 1258 b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; 1259 #endif 1260 #endif 1261 } 1262 1263 #ifdef YY_USE_PROTOS 1264 void 1265 yy_flush_buffer(YY_BUFFER_STATE b) 1266 #else 1267 void yy_flush_buffer(b) 1268 YY_BUFFER_STATE b; 1269 #endif 1270 1271 { 1272 if (!b) 1273 return; 1274 1275 b->yy_n_chars = 0; 1276 1277 /* We always need two end-of-buffer characters. The first causes 1278 * a transition to the end-of-buffer state. The second causes 1279 * a jam in that state. 1280 */ 1281 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1282 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1283 1284 b->yy_buf_pos = &b->yy_ch_buf[0]; 1285 1286 b->yy_at_bol = 1; 1287 b->yy_buffer_status = YY_BUFFER_NEW; 1288 1289 if (b == yy_current_buffer) 1290 yy_load_buffer_state(); 1291 } 1292 1293 #ifndef YY_NO_SCAN_BUFFER 1294 #ifdef YY_USE_PROTOS 1295 YY_BUFFER_STATE 1296 yy_scan_buffer(char *base, yy_size_t size) 1297 #else 1298 YY_BUFFER_STATE 1299 yy_scan_buffer(base, size) char *base; 1300 yy_size_t size; 1301 #endif 1302 { 1303 YY_BUFFER_STATE b; 1304 1305 if (size < 2 || 1306 base[size - 2] != YY_END_OF_BUFFER_CHAR || 1307 base[size - 1] != YY_END_OF_BUFFER_CHAR) 1308 /* They forgot to leave room for the EOB's. */ 1309 return 0; 1310 1311 b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state)); 1312 if (!b) 1313 YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()"); 1314 1315 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1316 b->yy_buf_pos = b->yy_ch_buf = base; 1317 b->yy_is_our_buffer = 0; 1318 b->yy_input_file = 0; 1319 b->yy_n_chars = b->yy_buf_size; 1320 b->yy_is_interactive = 0; 1321 b->yy_at_bol = 1; 1322 b->yy_fill_buffer = 0; 1323 b->yy_buffer_status = YY_BUFFER_NEW; 1324 1325 yy_switch_to_buffer(b); 1326 1327 return b; 1328 } 1329 #endif 1330 1331 #ifndef YY_NO_SCAN_STRING 1332 #ifdef YY_USE_PROTOS 1333 YY_BUFFER_STATE 1334 yy_scan_string(yyconst char *yy_str) 1335 #else 1336 YY_BUFFER_STATE 1337 yy_scan_string(yy_str) 1338 yyconst char *yy_str; 1339 #endif 1340 { 1341 int len; 1342 for (len = 0; yy_str[len]; ++len) 1343 ; 1344 1345 return yy_scan_bytes(yy_str, len); 1346 } 1347 #endif 1348 1349 #ifndef YY_NO_SCAN_BYTES 1350 #ifdef YY_USE_PROTOS 1351 YY_BUFFER_STATE 1352 yy_scan_bytes(yyconst char *bytes, int len) 1353 #else 1354 YY_BUFFER_STATE 1355 yy_scan_bytes(bytes, len) 1356 yyconst char *bytes; 1357 int len; 1358 #endif 1359 { 1360 YY_BUFFER_STATE b; 1361 char *buf; 1362 yy_size_t n; 1363 int i; 1364 1365 /* Get memory for full buffer, including space for trailing EOB's. */ 1366 n = len + 2; 1367 buf = (char *)yy_flex_alloc(n); 1368 if (!buf) 1369 YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); 1370 1371 for (i = 0; i < len; ++i) 1372 buf[i] = bytes[i]; 1373 1374 buf[len] = buf[len + 1] = YY_END_OF_BUFFER_CHAR; 1375 1376 b = yy_scan_buffer(buf, n); 1377 if (!b) 1378 YY_FATAL_ERROR("bad buffer in yy_scan_bytes()"); 1379 1380 /* It's okay to grow etc. this buffer, and we should throw it 1381 * away when we're done. 1382 */ 1383 b->yy_is_our_buffer = 1; 1384 1385 return b; 1386 } 1387 #endif 1388 1389 #ifndef YY_NO_PUSH_STATE 1390 #ifdef YY_USE_PROTOS 1391 static void 1392 yy_push_state(int new_state) 1393 #else 1394 static void yy_push_state(new_state) int new_state; 1395 #endif 1396 { 1397 if (yy_start_stack_ptr >= yy_start_stack_depth) { 1398 yy_size_t new_size; 1399 1400 yy_start_stack_depth += YY_START_STACK_INCR; 1401 new_size = yy_start_stack_depth * sizeof(int); 1402 1403 if (!yy_start_stack) 1404 yy_start_stack = (int *)yy_flex_alloc(new_size); 1405 1406 else 1407 yy_start_stack = (int *)yy_flex_realloc( 1408 (void *)yy_start_stack, new_size); 1409 1410 if (!yy_start_stack) 1411 YY_FATAL_ERROR( 1412 "out of memory expanding start-condition stack"); 1413 } 1414 1415 yy_start_stack[yy_start_stack_ptr++] = YY_START; 1416 1417 BEGIN(new_state); 1418 } 1419 #endif 1420 1421 #ifndef YY_NO_POP_STATE 1422 static void 1423 yy_pop_state() 1424 { 1425 if (--yy_start_stack_ptr < 0) 1426 YY_FATAL_ERROR("start-condition stack underflow"); 1427 1428 BEGIN(yy_start_stack[yy_start_stack_ptr]); 1429 } 1430 #endif 1431 1432 #ifndef YY_NO_TOP_STATE 1433 static int 1434 yy_top_state() 1435 { 1436 return yy_start_stack[yy_start_stack_ptr - 1]; 1437 } 1438 #endif 1439 1440 #ifndef YY_EXIT_FAILURE 1441 #define YY_EXIT_FAILURE 2 1442 #endif 1443 1444 #ifdef YY_USE_PROTOS 1445 static void 1446 yy_fatal_error(yyconst char msg[]) 1447 #else 1448 static void yy_fatal_error(msg) char msg[]; 1449 #endif 1450 { 1451 (void)fprintf(stderr, "%s\n", msg); 1452 exit(YY_EXIT_FAILURE); 1453 } 1454 1455 /* Redefine yyless() so it works in section 3 code. */ 1456 1457 #undef yyless 1458 #define yyless(n) \ 1459 do { \ 1460 /* Undo effects of setting up yytext. */ \ 1461 yytext[yyleng] = yy_hold_char; \ 1462 yy_c_buf_p = yytext + n; \ 1463 yy_hold_char = *yy_c_buf_p; \ 1464 *yy_c_buf_p = '\0'; \ 1465 yyleng = n; \ 1466 } while (0) 1467 1468 /* Internal utility routines. */ 1469 1470 #ifndef yytext_ptr 1471 #ifdef YY_USE_PROTOS 1472 static void 1473 yy_flex_strncpy(char *s1, yyconst char *s2, int n) 1474 #else 1475 static void yy_flex_strncpy(s1, s2, n) char *s1; 1476 yyconst char *s2; 1477 int n; 1478 #endif 1479 { 1480 register int i; 1481 for (i = 0; i < n; ++i) 1482 s1[i] = s2[i]; 1483 } 1484 #endif 1485 1486 #ifdef YY_NEED_STRLEN 1487 #ifdef YY_USE_PROTOS 1488 static int 1489 yy_flex_strlen(yyconst char *s) 1490 #else 1491 static int 1492 yy_flex_strlen(s) 1493 yyconst char *s; 1494 #endif 1495 { 1496 register int n; 1497 for (n = 0; s[n]; ++n) 1498 ; 1499 1500 return n; 1501 } 1502 #endif 1503 1504 #ifdef YY_USE_PROTOS 1505 static void * 1506 yy_flex_alloc(yy_size_t size) 1507 #else 1508 static void * 1509 yy_flex_alloc(size) 1510 yy_size_t size; 1511 #endif 1512 { 1513 return (void *)malloc(size); 1514 } 1515 1516 #ifdef YY_USE_PROTOS 1517 static void * 1518 yy_flex_realloc(void *ptr, yy_size_t size) 1519 #else 1520 static void *yy_flex_realloc(ptr, size) void *ptr; 1521 yy_size_t size; 1522 #endif 1523 { 1524 /* The cast to (char *) in the following accommodates both 1525 * implementations that use char* generic pointers, and those 1526 * that use void* generic pointers. It works with the latter 1527 * because both ANSI C and C++ allow castless assignment from 1528 * any pointer type to void*, and deal with argument conversions 1529 * as though doing an assignment. 1530 */ 1531 return (void *)realloc((char *)ptr, size); 1532 } 1533 1534 #ifdef YY_USE_PROTOS 1535 static void 1536 yy_flex_free(void *ptr) 1537 #else 1538 static void yy_flex_free(ptr) void *ptr; 1539 #endif 1540 { 1541 free(ptr); 1542 } 1543 1544 #if YY_MAIN 1545 int 1546 main() 1547 { 1548 yylex(); 1549 return 0; 1550 } 1551 #endif 1552 #line 81 "installparse.l" 1553 1554 /*------------------------ Program Section ----------------------------*/ 1555 1556 PRFileDesc *Pk11Install_FD = NULL; 1557 1558 /*************************************************************************/ 1559 /* dummy function required by lex */ 1560 int 1561 Pk11Install_yywrap(void) 1562 { 1563 return 1; 1564 } 1565 1566 /*************************************************************************/ 1567 /* Return a copy of the given string */ 1568 static char * 1569 putSimpleString(char *str) 1570 { 1571 char *tmp = (char *)PR_Malloc(strlen(str) + 1); 1572 strcpy(tmp, str); 1573 return tmp; 1574 } 1575 1576 /*************************************************************************/ 1577 /* Strip out quotes, replace escaped characters with what they stand for. 1578 This function assumes that what is passed in is actually a complex 1579 string, so error checking is lax. */ 1580 static char * 1581 putComplexString(char *str) 1582 { 1583 int size, i, j; 1584 char *tmp; 1585 1586 if (!str) { 1587 return NULL; 1588 } 1589 size = strlen(str); 1590 1591 /* Allocate the new space. This string will actually be too big, 1592 since quotes and backslashes will be stripped out. But that's ok. */ 1593 tmp = (char *)PR_Malloc(size + 1); 1594 1595 /* Copy it over */ 1596 for (i = 0, j = 0; i < size; i++) { 1597 if (str[i] == '\"') { 1598 continue; /* skip un-escaped quotes */ 1599 } else if (str[i] == '\\') { 1600 ++i; /* escaped character. skip the backslash */ 1601 } 1602 tmp[j++] = str[i]; 1603 } 1604 tmp[j] = '\0'; 1605 1606 return tmp; 1607 }