1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
37 #define yy_create_buffer Pk11Install_yy_create_buffer
38 #define yy_delete_buffer Pk11Install_yy_delete_buffer
39 #define yy_scan_buffer Pk11Install_yy_scan_buffer
40 #define yy_scan_string Pk11Install_yy_scan_string
41 #define yy_scan_bytes Pk11Install_yy_scan_bytes
42 #define yy_flex_debug Pk11Install_yy_flex_debug
43 #define yy_init_buffer Pk11Install_yy_init_buffer
44 #define yy_flush_buffer Pk11Install_yy_flush_buffer
45 #define yy_load_buffer_state Pk11Install_yy_load_buffer_state
46 #define yy_switch_to_buffer Pk11Install_yy_switch_to_buffer
47 #define yyin Pk11Install_yyin
48 #define yyleng Pk11Install_yyleng
49 #define yylex Pk11Install_yylex
50 #define yyout Pk11Install_yyout
51 #define yyrestart Pk11Install_yyrestart
52 #define yytext Pk11Install_yytext
53 #define yywrap Pk11Install_yywrap
55 #line 20 "lex.Pk11Install_yy.c"
56 /* A lexical scanner generated by flex */
58 /* Scanner skeleton version:
59 * $Header: /cvsroot/mozilla/security/nss/cmd/modutil/lex.Pk11Install_yy.c,v 1.2 2004/04/25 15:02:47 gerv%gerv.net Exp $
63 #define YY_FLEX_MAJOR_VERSION 2
64 #define YY_FLEX_MINOR_VERSION 5
69 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
82 /* Use prototypes in function declarations. */
85 /* The "const" storage-class-modifier is valid. */
88 #else /* ! __cplusplus */
96 #endif /* ! __cplusplus */
104 #define YY_USE_PROTOS
108 #define yyconst const
115 #define YY_PROTO(proto) proto
117 #define YY_PROTO(proto) ()
120 /* Returned upon end-of-file. */
123 /* Promotes a possibly negative, possibly signed char to an unsigned
124 * integer for use as an array index. If the signed char is negative,
125 * we want to instead treat it as an 8-bit unsigned char, hence the
128 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
130 /* Enter a start condition. This macro really ought to take a parameter,
131 * but we do it the disgusting crufty way forced on us by the ()-less
132 * definition of BEGIN.
134 #define BEGIN yy_start = 1 + 2 *
136 /* Translate the current start state into a value that can be later handed
137 * to BEGIN to return to the state. The YYSTATE alias is for lex
140 #define YY_START ((yy_start - 1) / 2)
141 #define YYSTATE YY_START
143 /* Action number for EOF rule of a given start state. */
144 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
146 /* Special action meaning "start processing a new file". */
147 #define YY_NEW_FILE yyrestart( yyin )
149 #define YY_END_OF_BUFFER_CHAR 0
151 /* Size of default input buffer. */
152 #define YY_BUF_SIZE 16384
154 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
157 extern FILE *yyin
, *yyout
;
159 #define EOB_ACT_CONTINUE_SCAN 0
160 #define EOB_ACT_END_OF_FILE 1
161 #define EOB_ACT_LAST_MATCH 2
163 /* The funky do-while in the following #define is used to turn the definition
164 * int a single C statement (which needs a semi-colon terminator). This
165 * avoids problems with code like:
167 * if ( condition_holds )
170 * do_something_else();
172 * Prior to using the do-while the compiler would get upset at the
173 * "else" because it interpreted the "if" statement as being all
174 * done when it reached the ';' after the yyless() call.
177 /* Return all but the first 'n' matched characters back to the input stream. */
182 /* Undo effects of setting up yytext. */ \
183 *yy_cp = yy_hold_char; \
184 YY_RESTORE_YY_MORE_OFFSET \
185 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
186 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
190 #define unput(c) yyunput( c, yytext_ptr )
192 /* The following is because we cannot portably get our hands on size_t
193 * (without autoconf's help, which isn't available because we want
194 * flex-generated scanners to compile on their own).
196 typedef unsigned int yy_size_t
;
199 struct yy_buffer_state
203 char *yy_ch_buf
; /* input buffer */
204 char *yy_buf_pos
; /* current position in input buffer */
206 /* Size of input buffer in bytes, not including room for EOB
209 yy_size_t yy_buf_size
;
211 /* Number of characters read into yy_ch_buf, not including EOB
216 /* Whether we "own" the buffer - i.e., we know we created it,
217 * and can realloc() it to grow it, and should free() it to
220 int yy_is_our_buffer
;
222 /* Whether this is an "interactive" input source; if so, and
223 * if we're using stdio for input, then we want to use getc()
224 * instead of fread(), to make sure we stop fetching input after
227 int yy_is_interactive
;
229 /* Whether we're considered to be at the beginning of a line.
230 * If so, '^' rules will be active on the next match, otherwise
235 /* Whether to try to fill the input buffer when we reach the
240 int yy_buffer_status
;
241 #define YY_BUFFER_NEW 0
242 #define YY_BUFFER_NORMAL 1
243 /* When an EOF's been seen but there's still some text to process
244 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
245 * shouldn't try reading from the input source any more. We might
246 * still have a bunch of tokens to match, though, because of
247 * possible backing-up.
249 * When we actually see the EOF, we change the status to "new"
250 * (via yyrestart()), so that the user can continue scanning by
251 * just pointing yyin at a new input file.
253 #define YY_BUFFER_EOF_PENDING 2
256 static YY_BUFFER_STATE yy_current_buffer
= 0;
258 /* We provide macros for accessing buffer states in case in the
259 * future we want to put the buffer states in a more general
262 #define YY_CURRENT_BUFFER yy_current_buffer
265 /* yy_hold_char holds the character lost when yytext is formed. */
266 static char yy_hold_char
;
268 static int yy_n_chars
; /* number of characters read into yy_ch_buf */
273 /* Points to current character in buffer. */
274 static char *yy_c_buf_p
= (char *) 0;
275 static int yy_init
= 1; /* whether we need to initialize */
276 static int yy_start
= 0; /* start state number */
278 /* Flag which is used to allow yywrap()'s to do buffer switches
279 * instead of setting up a fresh yyin. A bit of a hack ...
281 static int yy_did_buffer_switch_on_eof
;
283 void yyrestart
YY_PROTO(( FILE *input_file
));
285 void yy_switch_to_buffer
YY_PROTO(( YY_BUFFER_STATE new_buffer
));
286 void yy_load_buffer_state
YY_PROTO(( void ));
287 YY_BUFFER_STATE yy_create_buffer
YY_PROTO(( FILE *file
, int size
));
288 void yy_delete_buffer
YY_PROTO(( YY_BUFFER_STATE b
));
289 void yy_init_buffer
YY_PROTO(( YY_BUFFER_STATE b
, FILE *file
));
290 void yy_flush_buffer
YY_PROTO(( YY_BUFFER_STATE b
));
291 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
293 YY_BUFFER_STATE yy_scan_buffer
YY_PROTO(( char *base
, yy_size_t size
));
294 YY_BUFFER_STATE yy_scan_string
YY_PROTO(( yyconst
char *yy_str
));
295 YY_BUFFER_STATE yy_scan_bytes
YY_PROTO(( yyconst
char *bytes
, int len
));
297 static void *yy_flex_alloc
YY_PROTO(( yy_size_t
));
298 static void *yy_flex_realloc
YY_PROTO(( void *, yy_size_t
));
299 static void yy_flex_free
YY_PROTO(( void * ));
301 #define yy_new_buffer yy_create_buffer
303 #define yy_set_interactive(is_interactive) \
305 if ( ! yy_current_buffer ) \
306 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
307 yy_current_buffer->yy_is_interactive = is_interactive; \
310 #define yy_set_bol(at_bol) \
312 if ( ! yy_current_buffer ) \
313 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
314 yy_current_buffer->yy_at_bol = at_bol; \
317 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
319 typedef unsigned char YY_CHAR
;
320 FILE *yyin
= (FILE *) 0, *yyout
= (FILE *) 0;
321 typedef int yy_state_type
;
323 #define yytext_ptr yytext
325 static yy_state_type yy_get_previous_state
YY_PROTO(( void ));
326 static yy_state_type yy_try_NUL_trans
YY_PROTO(( yy_state_type current_state
));
327 static int yy_get_next_buffer
YY_PROTO(( void ));
328 static void yy_fatal_error
YY_PROTO(( yyconst
char msg
[] ));
330 /* Done after the current pattern has been matched and before the
331 * corresponding action - sets up yytext.
333 #define YY_DO_BEFORE_ACTION \
334 yytext_ptr = yy_bp; \
335 yyleng = (int) (yy_cp - yy_bp); \
336 yy_hold_char = *yy_cp; \
340 #define YY_NUM_RULES 8
341 #define YY_END_OF_BUFFER 9
342 static yyconst
short int yy_accept
[16] =
344 0, 0, 9, 3, 6, 5, 7, 1, 2, 3,
348 static yyconst
int yy_ec
[256] =
350 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
351 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 2, 1, 5, 1, 1, 1, 1, 1, 1,
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
355 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
356 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
358 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
359 1, 6, 1, 1, 1, 1, 1, 1, 1, 1,
361 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
362 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
363 1, 1, 7, 1, 8, 1, 1, 1, 1, 1,
364 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
365 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
366 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
367 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
368 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
369 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
370 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
372 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
373 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
374 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380 static yyconst
int yy_meta
[9] =
382 1, 2, 3, 4, 3, 1, 5, 5
385 static yyconst
short int yy_base
[19] =
387 0, 0, 19, 0, 0, 21, 12, 21, 21, 0,
388 0, 4, 6, 21, 21, 13, 11, 15
391 static yyconst
short int yy_def
[19] =
393 15, 1, 15, 16, 17, 15, 18, 15, 15, 16,
394 17, 18, 15, 15, 0, 15, 15, 15
397 static yyconst
short int yy_nxt
[30] =
399 4, 5, 6, 5, 7, 4, 8, 9, 14, 13,
400 12, 12, 11, 10, 11, 12, 12, 13, 15, 12,
401 3, 15, 15, 15, 15, 15, 15, 15, 15
404 static yyconst
short int yy_chk
[30] =
406 1, 1, 1, 1, 1, 1, 1, 1, 12, 12,
407 13, 13, 17, 16, 17, 18, 18, 7, 3, 18,
408 15, 15, 15, 15, 15, 15, 15, 15, 15
411 static yy_state_type yy_last_accepting_state
;
412 static char *yy_last_accepting_cpos
;
414 /* The intent behind this definition is that it'll catch
415 * any uses of REJECT which flex missed.
417 #define REJECT reject_used_but_not_detected
418 #define yymore() yymore_used_but_not_detected
419 #define YY_MORE_ADJ 0
420 #define YY_RESTORE_YY_MORE_OFFSET
422 #line 1 "installparse.l"
424 /* lex file for analyzing PKCS #11 Module installation instructions */
425 /*----------------------------- Definitions ---------------------------*/
426 #line 5 "installparse.l"
429 #include "install-ds.h" /* defines tokens and data structures */
430 #include "installparse.h" /* produced by yacc -d */
432 static char *putSimpleString(char*); /* return copy of string */
433 static char *putComplexString(char*); /* strip out quotes, deal with */
434 /* escaped characters */
436 void Pk11Install_yyerror(char *);
438 /* Overrides to use NSPR */
439 #define malloc PR_Malloc
440 #define realloc PR_Realloc
443 int Pk11Install_yylinenum
=1;
446 #define YY_NEVER_INTERACTIVE 1
447 #define yyunput Pkcs11Install_yyunput
449 /* This is the default YY_INPUT modified for NSPR */
450 #define YY_INPUT(buf,result,max_size) \
451 if ( yy_current_buffer->yy_is_interactive ) { \
454 for ( n = 0; n < max_size && \
455 PR_Read(Pk11Install_FD, &c, 1)==1 && c != '\n'; ++n ) { \
463 result = PR_Read(Pk11Install_FD, buf, max_size); \
466 /*** Regular expression definitions ***/
467 /* simple_string has no whitespace, quotes, or braces */
468 /* complex_string is enclosed in quotes. Inside the quotes, quotes and
469 backslashes must be backslash-escaped. Otherwise, anything goes. */
470 /* Standard whitespace */
471 /*---------------------------- Actions --------------------------------*/
472 #line 437 "lex.Pk11Install_yy.cpp"
474 /* Macros after this point can all be overridden by user definitions in
478 #ifndef YY_SKIP_YYWRAP
480 extern "C" int yywrap
YY_PROTO(( void ));
482 extern int yywrap
YY_PROTO(( void ));
487 static void yyunput
YY_PROTO(( int c
, char *buf_ptr
));
491 static void yy_flex_strncpy
YY_PROTO(( char *, yyconst
char *, int ));
494 #ifdef YY_NEED_STRLEN
495 static int yy_flex_strlen
YY_PROTO(( yyconst
char * ));
500 static int yyinput
YY_PROTO(( void ));
502 static int input
YY_PROTO(( void ));
507 static int yy_start_stack_ptr
= 0;
508 static int yy_start_stack_depth
= 0;
509 static int *yy_start_stack
= 0;
510 #ifndef YY_NO_PUSH_STATE
511 static void yy_push_state
YY_PROTO(( int new_state
));
513 #ifndef YY_NO_POP_STATE
514 static void yy_pop_state
YY_PROTO(( void ));
516 #ifndef YY_NO_TOP_STATE
517 static int yy_top_state
YY_PROTO(( void ));
521 #define YY_NO_PUSH_STATE 1
522 #define YY_NO_POP_STATE 1
523 #define YY_NO_TOP_STATE 1
526 #ifdef YY_MALLOC_DECL
534 /* Just try to get by without declaring the routines. This will fail
535 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
536 * or sizeof(void*) != sizeof(int).
541 /* Amount of stuff to slurp up with each read. */
542 #ifndef YY_READ_BUF_SIZE
543 #define YY_READ_BUF_SIZE 8192
546 /* Copy whatever the last rule matched to the standard output. */
549 /* This used to be an fputs(), but since the string might contain NUL's,
550 * we now use fwrite().
552 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
555 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
556 * is returned in "result".
559 #define YY_INPUT(buf,result,max_size) \
560 if ( yy_current_buffer->yy_is_interactive ) \
563 for ( n = 0; n < max_size && \
564 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
567 buf[n++] = (char) c; \
568 if ( c == EOF && ferror( yyin ) ) \
569 YY_FATAL_ERROR( "input in flex scanner failed" ); \
572 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
573 && ferror( yyin ) ) \
574 YY_FATAL_ERROR( "input in flex scanner failed" );
577 /* No semi-colon after return; correct usage is to write "yyterminate();" -
578 * we don't want an extra ';' after the "return" because that will cause
579 * some compilers to complain about unreachable statements.
582 #define yyterminate() return YY_NULL
585 /* Number of entries by which start-condition stack grows. */
586 #ifndef YY_START_STACK_INCR
587 #define YY_START_STACK_INCR 25
590 /* Report a fatal error. */
591 #ifndef YY_FATAL_ERROR
592 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
595 /* Default declaration of generated scanner - a define so the user can
596 * easily add parameters.
599 #define YY_DECL int yylex YY_PROTO(( void ))
602 /* Code executed at the beginning of each rule, after yytext and yyleng
605 #ifndef YY_USER_ACTION
606 #define YY_USER_ACTION
609 /* Code executed at the end of each rule. */
611 #define YY_BREAK break;
614 #define YY_RULE_SETUP \
619 register yy_state_type yy_current_state
;
620 register char *yy_cp
, *yy_bp
;
623 #line 60 "installparse.l"
626 #line 591 "lex.Pk11Install_yy.cpp"
637 yy_start
= 1; /* first start state */
645 if ( ! yy_current_buffer
)
647 yy_create_buffer( yyin
, YY_BUF_SIZE
);
649 yy_load_buffer_state();
652 while ( 1 ) /* loops until end-of-file is reached */
656 /* Support of yytext. */
657 *yy_cp
= yy_hold_char
;
659 /* yy_bp points to the position in yy_ch_buf of the start of
664 yy_current_state
= yy_start
;
668 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
669 if ( yy_accept
[yy_current_state
] )
671 yy_last_accepting_state
= yy_current_state
;
672 yy_last_accepting_cpos
= yy_cp
;
674 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
676 yy_current_state
= (int) yy_def
[yy_current_state
];
677 if ( yy_current_state
>= 16 )
678 yy_c
= yy_meta
[(unsigned int) yy_c
];
680 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
683 while ( yy_base
[yy_current_state
] != 21 );
686 yy_act
= yy_accept
[yy_current_state
];
688 { /* have to back up */
689 yy_cp
= yy_last_accepting_cpos
;
690 yy_current_state
= yy_last_accepting_state
;
691 yy_act
= yy_accept
[yy_current_state
];
697 do_action
: /* This label is used only to access EOF actions. */
701 { /* beginning of action switch */
702 case 0: /* must back up */
703 /* undo the effects of YY_DO_BEFORE_ACTION */
704 *yy_cp
= yy_hold_char
;
705 yy_cp
= yy_last_accepting_cpos
;
706 yy_current_state
= yy_last_accepting_state
;
711 #line 62 "installparse.l"
716 #line 63 "installparse.l"
721 #line 64 "installparse.l"
722 {Pk11Install_yylval
.string
=
723 putSimpleString(Pk11Install_yytext
);
728 #line 67 "installparse.l"
729 {Pk11Install_yylval
.string
=
730 putComplexString(Pk11Install_yytext
);
735 #line 71 "installparse.l"
736 Pk11Install_yylinenum
++;
740 #line 73 "installparse.l"
745 #line 75 "installparse.l"
746 {err
= PR_smprintf("Invalid lexeme: %s",Pk11Install_yytext
);
747 Pk11Install_yyerror(err
);
748 PR_smprintf_free(err
);
754 #line 81 "installparse.l"
757 #line 722 "lex.Pk11Install_yy.cpp"
758 case YY_STATE_EOF(INITIAL
):
761 case YY_END_OF_BUFFER
:
763 /* Amount of text matched not including the EOB char. */
764 int yy_amount_of_matched_text
= (int) (yy_cp
- yytext_ptr
) - 1;
766 /* Undo the effects of YY_DO_BEFORE_ACTION. */
767 *yy_cp
= yy_hold_char
;
768 YY_RESTORE_YY_MORE_OFFSET
770 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_NEW
)
772 /* We're scanning a new file or input source. It's
773 * possible that this happened because the user
774 * just pointed yyin at a new source and called
775 * yylex(). If so, then we have to assure
776 * consistency between yy_current_buffer and our
777 * globals. Here is the right place to do so, because
778 * this is the first action (other than possibly a
779 * back-up) that will match for the new input source.
781 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
782 yy_current_buffer
->yy_input_file
= yyin
;
783 yy_current_buffer
->yy_buffer_status
= YY_BUFFER_NORMAL
;
786 /* Note that here we test for yy_c_buf_p "<=" to the position
787 * of the first EOB in the buffer, since yy_c_buf_p will
788 * already have been incremented past the NUL character
789 * (since all states make transitions on EOB to the
790 * end-of-buffer state). Contrast this with the test
793 if ( yy_c_buf_p
<= &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
794 { /* This was really a NUL. */
795 yy_state_type yy_next_state
;
797 yy_c_buf_p
= yytext_ptr
+ yy_amount_of_matched_text
;
799 yy_current_state
= yy_get_previous_state();
801 /* Okay, we're now positioned to make the NUL
802 * transition. We couldn't have
803 * yy_get_previous_state() go ahead and do it
804 * for us because it doesn't know how to deal
805 * with the possibility of jamming (and we don't
806 * want to build jamming into it because then it
807 * will run more slowly).
810 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
812 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
816 /* Consume the NUL. */
817 yy_cp
= ++yy_c_buf_p
;
818 yy_current_state
= yy_next_state
;
829 else switch ( yy_get_next_buffer() )
831 case EOB_ACT_END_OF_FILE
:
833 yy_did_buffer_switch_on_eof
= 0;
837 /* Note: because we've taken care in
838 * yy_get_next_buffer() to have set up
839 * yytext, we can now set up
840 * yy_c_buf_p so that if some total
841 * hoser (like flex itself) wants to
842 * call the scanner after we return the
843 * YY_NULL, it'll still work - another
844 * YY_NULL will get returned.
846 yy_c_buf_p
= yytext_ptr
+ YY_MORE_ADJ
;
848 yy_act
= YY_STATE_EOF(YY_START
);
854 if ( ! yy_did_buffer_switch_on_eof
)
860 case EOB_ACT_CONTINUE_SCAN
:
862 yytext_ptr
+ yy_amount_of_matched_text
;
864 yy_current_state
= yy_get_previous_state();
867 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
870 case EOB_ACT_LAST_MATCH
:
872 &yy_current_buffer
->yy_ch_buf
[yy_n_chars
];
874 yy_current_state
= yy_get_previous_state();
877 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
885 "fatal flex scanner internal error--no action found" );
886 } /* end of action switch */
887 } /* end of scanning one token */
891 /* yy_get_next_buffer - try to read in a new buffer
893 * Returns a code representing an action:
894 * EOB_ACT_LAST_MATCH -
895 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
896 * EOB_ACT_END_OF_FILE - end of file
899 static int yy_get_next_buffer()
901 register char *dest
= yy_current_buffer
->yy_ch_buf
;
902 register char *source
= yytext_ptr
;
903 register int number_to_move
, i
;
906 if ( yy_c_buf_p
> &yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] )
908 "fatal flex scanner internal error--end of buffer missed" );
910 if ( yy_current_buffer
->yy_fill_buffer
== 0 )
911 { /* Don't try to fill the buffer, so this is an EOF. */
912 if ( yy_c_buf_p
- yytext_ptr
- YY_MORE_ADJ
== 1 )
914 /* We matched a single character, the EOB, so
915 * treat this as a final EOF.
917 return EOB_ACT_END_OF_FILE
;
922 /* We matched some text prior to the EOB, first
925 return EOB_ACT_LAST_MATCH
;
929 /* Try to read more data. */
931 /* First move last chars to start of buffer. */
932 number_to_move
= (int) (yy_c_buf_p
- yytext_ptr
) - 1;
934 for ( i
= 0; i
< number_to_move
; ++i
)
935 *(dest
++) = *(source
++);
937 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
938 /* don't do the read, it's not guaranteed to return an EOF,
941 yy_current_buffer
->yy_n_chars
= yy_n_chars
= 0;
946 yy_current_buffer
->yy_buf_size
- number_to_move
- 1;
948 while ( num_to_read
<= 0 )
949 { /* Not enough room in the buffer - grow it. */
950 #ifdef YY_USES_REJECT
952 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
955 /* just a shorter name for the current buffer */
956 YY_BUFFER_STATE b
= yy_current_buffer
;
958 int yy_c_buf_p_offset
=
959 (int) (yy_c_buf_p
- b
->yy_ch_buf
);
961 if ( b
->yy_is_our_buffer
)
963 int new_size
= b
->yy_buf_size
* 2;
966 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
970 b
->yy_ch_buf
= (char *)
971 /* Include room in for 2 EOB chars. */
972 yy_flex_realloc( (void *) b
->yy_ch_buf
,
973 b
->yy_buf_size
+ 2 );
976 /* Can't grow it, we don't own it. */
979 if ( ! b
->yy_ch_buf
)
981 "fatal error - scanner input buffer overflow" );
983 yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
985 num_to_read
= yy_current_buffer
->yy_buf_size
-
990 if ( num_to_read
> YY_READ_BUF_SIZE
)
991 num_to_read
= YY_READ_BUF_SIZE
;
993 /* Read in more data. */
994 YY_INPUT( (&yy_current_buffer
->yy_ch_buf
[number_to_move
]),
995 yy_n_chars
, num_to_read
);
997 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1000 if ( yy_n_chars
== 0 )
1002 if ( number_to_move
== YY_MORE_ADJ
)
1004 ret_val
= EOB_ACT_END_OF_FILE
;
1010 ret_val
= EOB_ACT_LAST_MATCH
;
1011 yy_current_buffer
->yy_buffer_status
=
1012 YY_BUFFER_EOF_PENDING
;
1017 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1019 yy_n_chars
+= number_to_move
;
1020 yy_current_buffer
->yy_ch_buf
[yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1021 yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1023 yytext_ptr
= &yy_current_buffer
->yy_ch_buf
[0];
1029 /* yy_get_previous_state - get the state just before the EOB char was reached */
1031 static yy_state_type
yy_get_previous_state()
1033 register yy_state_type yy_current_state
;
1034 register char *yy_cp
;
1036 yy_current_state
= yy_start
;
1038 for ( yy_cp
= yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yy_c_buf_p
; ++yy_cp
)
1040 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1041 if ( yy_accept
[yy_current_state
] )
1043 yy_last_accepting_state
= yy_current_state
;
1044 yy_last_accepting_cpos
= yy_cp
;
1046 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1048 yy_current_state
= (int) yy_def
[yy_current_state
];
1049 if ( yy_current_state
>= 16 )
1050 yy_c
= yy_meta
[(unsigned int) yy_c
];
1052 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1055 return yy_current_state
;
1059 /* yy_try_NUL_trans - try to make a transition on the NUL character
1062 * next_state = yy_try_NUL_trans( current_state );
1065 #ifdef YY_USE_PROTOS
1066 static yy_state_type
yy_try_NUL_trans( yy_state_type yy_current_state
)
1068 static yy_state_type
yy_try_NUL_trans( yy_current_state
)
1069 yy_state_type yy_current_state
;
1072 register int yy_is_jam
;
1073 register char *yy_cp
= yy_c_buf_p
;
1075 register YY_CHAR yy_c
= 1;
1076 if ( yy_accept
[yy_current_state
] )
1078 yy_last_accepting_state
= yy_current_state
;
1079 yy_last_accepting_cpos
= yy_cp
;
1081 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1083 yy_current_state
= (int) yy_def
[yy_current_state
];
1084 if ( yy_current_state
>= 16 )
1085 yy_c
= yy_meta
[(unsigned int) yy_c
];
1087 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1088 yy_is_jam
= (yy_current_state
== 15);
1090 return yy_is_jam
? 0 : yy_current_state
;
1095 #ifdef YY_USE_PROTOS
1096 static void yyunput( int c
, register char *yy_bp
)
1098 static void yyunput( c
, yy_bp
)
1100 register char *yy_bp
;
1103 register char *yy_cp
= yy_c_buf_p
;
1105 /* undo effects of setting up yytext */
1106 *yy_cp
= yy_hold_char
;
1108 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1109 { /* need to shift things up to make room */
1110 /* +2 for EOB chars. */
1111 register int number_to_move
= yy_n_chars
+ 2;
1112 register char *dest
= &yy_current_buffer
->yy_ch_buf
[
1113 yy_current_buffer
->yy_buf_size
+ 2];
1114 register char *source
=
1115 &yy_current_buffer
->yy_ch_buf
[number_to_move
];
1117 while ( source
> yy_current_buffer
->yy_ch_buf
)
1118 *--dest
= *--source
;
1120 yy_cp
+= (int) (dest
- source
);
1121 yy_bp
+= (int) (dest
- source
);
1122 yy_current_buffer
->yy_n_chars
=
1123 yy_n_chars
= yy_current_buffer
->yy_buf_size
;
1125 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1126 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1129 *--yy_cp
= (char) c
;
1133 yy_hold_char
= *yy_cp
;
1136 #endif /* ifndef YY_NO_UNPUT */
1140 static int yyinput()
1147 *yy_c_buf_p
= yy_hold_char
;
1149 if ( *yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1151 /* yy_c_buf_p now points to the character we want to return.
1152 * If this occurs *before* the EOB characters, then it's a
1153 * valid NUL; if not, then we've hit the end of the buffer.
1155 if ( yy_c_buf_p
< &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1156 /* This was really a NUL. */
1160 { /* need more input */
1161 int offset
= yy_c_buf_p
- yytext_ptr
;
1164 switch ( yy_get_next_buffer() )
1166 case EOB_ACT_LAST_MATCH
:
1167 /* This happens because yy_g_n_b()
1168 * sees that we've accumulated a
1169 * token and flags that we need to
1170 * try matching the token before
1171 * proceeding. But for input(),
1172 * there's no matching to consider.
1173 * So convert the EOB_ACT_LAST_MATCH
1174 * to EOB_ACT_END_OF_FILE.
1177 /* Reset buffer status. */
1182 case EOB_ACT_END_OF_FILE
:
1187 if ( ! yy_did_buffer_switch_on_eof
)
1196 case EOB_ACT_CONTINUE_SCAN
:
1197 yy_c_buf_p
= yytext_ptr
+ offset
;
1203 c
= *(unsigned char *) yy_c_buf_p
; /* cast for 8-bit char's */
1204 *yy_c_buf_p
= '\0'; /* preserve yytext */
1205 yy_hold_char
= *++yy_c_buf_p
;
1212 #ifdef YY_USE_PROTOS
1213 void yyrestart( FILE *input_file
)
1215 void yyrestart( input_file
)
1219 if ( ! yy_current_buffer
)
1220 yy_current_buffer
= yy_create_buffer( yyin
, YY_BUF_SIZE
);
1222 yy_init_buffer( yy_current_buffer
, input_file
);
1223 yy_load_buffer_state();
1227 #ifdef YY_USE_PROTOS
1228 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer
)
1230 void yy_switch_to_buffer( new_buffer
)
1231 YY_BUFFER_STATE new_buffer
;
1234 if ( yy_current_buffer
== new_buffer
)
1237 if ( yy_current_buffer
)
1239 /* Flush out information for old buffer. */
1240 *yy_c_buf_p
= yy_hold_char
;
1241 yy_current_buffer
->yy_buf_pos
= yy_c_buf_p
;
1242 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1245 yy_current_buffer
= new_buffer
;
1246 yy_load_buffer_state();
1248 /* We don't actually know whether we did this switch during
1249 * EOF (yywrap()) processing, but the only time this flag
1250 * is looked at is after yywrap() is called, so it's safe
1251 * to go ahead and always set it.
1253 yy_did_buffer_switch_on_eof
= 1;
1257 #ifdef YY_USE_PROTOS
1258 void yy_load_buffer_state( void )
1260 void yy_load_buffer_state()
1263 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1264 yytext_ptr
= yy_c_buf_p
= yy_current_buffer
->yy_buf_pos
;
1265 yyin
= yy_current_buffer
->yy_input_file
;
1266 yy_hold_char
= *yy_c_buf_p
;
1270 #ifdef YY_USE_PROTOS
1271 YY_BUFFER_STATE
yy_create_buffer( FILE *file
, int size
)
1273 YY_BUFFER_STATE
yy_create_buffer( file
, size
)
1280 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1282 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1284 b
->yy_buf_size
= size
;
1286 /* yy_ch_buf has to be 2 characters longer than the size given because
1287 * we need to put in 2 end-of-buffer characters.
1289 b
->yy_ch_buf
= (char *) yy_flex_alloc( b
->yy_buf_size
+ 2 );
1290 if ( ! b
->yy_ch_buf
)
1291 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1293 b
->yy_is_our_buffer
= 1;
1295 yy_init_buffer( b
, file
);
1301 #ifdef YY_USE_PROTOS
1302 void yy_delete_buffer( YY_BUFFER_STATE b
)
1304 void yy_delete_buffer( b
)
1311 if ( b
== yy_current_buffer
)
1312 yy_current_buffer
= (YY_BUFFER_STATE
) 0;
1314 if ( b
->yy_is_our_buffer
)
1315 yy_flex_free( (void *) b
->yy_ch_buf
);
1317 yy_flex_free( (void *) b
);
1321 #ifndef YY_ALWAYS_INTERACTIVE
1322 #ifndef YY_NEVER_INTERACTIVE
1323 extern int isatty
YY_PROTO(( int ));
1327 #ifdef YY_USE_PROTOS
1328 void yy_init_buffer( YY_BUFFER_STATE b
, FILE *file
)
1330 void yy_init_buffer( b
, file
)
1337 yy_flush_buffer( b
);
1339 b
->yy_input_file
= file
;
1340 b
->yy_fill_buffer
= 1;
1342 #if YY_ALWAYS_INTERACTIVE
1343 b
->yy_is_interactive
= 1;
1345 #if YY_NEVER_INTERACTIVE
1346 b
->yy_is_interactive
= 0;
1348 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1354 #ifdef YY_USE_PROTOS
1355 void yy_flush_buffer( YY_BUFFER_STATE b
)
1357 void yy_flush_buffer( b
)
1367 /* We always need two end-of-buffer characters. The first causes
1368 * a transition to the end-of-buffer state. The second causes
1369 * a jam in that state.
1371 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1372 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1374 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1377 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1379 if ( b
== yy_current_buffer
)
1380 yy_load_buffer_state();
1384 #ifndef YY_NO_SCAN_BUFFER
1385 #ifdef YY_USE_PROTOS
1386 YY_BUFFER_STATE
yy_scan_buffer( char *base
, yy_size_t size
)
1388 YY_BUFFER_STATE
yy_scan_buffer( base
, size
)
1396 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1397 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1398 /* They forgot to leave room for the EOB's. */
1401 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1403 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1405 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1406 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1407 b
->yy_is_our_buffer
= 0;
1408 b
->yy_input_file
= 0;
1409 b
->yy_n_chars
= b
->yy_buf_size
;
1410 b
->yy_is_interactive
= 0;
1412 b
->yy_fill_buffer
= 0;
1413 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1415 yy_switch_to_buffer( b
);
1422 #ifndef YY_NO_SCAN_STRING
1423 #ifdef YY_USE_PROTOS
1424 YY_BUFFER_STATE
yy_scan_string( yyconst
char *yy_str
)
1426 YY_BUFFER_STATE
yy_scan_string( yy_str
)
1427 yyconst
char *yy_str
;
1431 for ( len
= 0; yy_str
[len
]; ++len
)
1434 return yy_scan_bytes( yy_str
, len
);
1439 #ifndef YY_NO_SCAN_BYTES
1440 #ifdef YY_USE_PROTOS
1441 YY_BUFFER_STATE
yy_scan_bytes( yyconst
char *bytes
, int len
)
1443 YY_BUFFER_STATE
yy_scan_bytes( bytes
, len
)
1444 yyconst
char *bytes
;
1453 /* Get memory for full buffer, including space for trailing EOB's. */
1455 buf
= (char *) yy_flex_alloc( n
);
1457 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1459 for ( i
= 0; i
< len
; ++i
)
1462 buf
[len
] = buf
[len
+1] = YY_END_OF_BUFFER_CHAR
;
1464 b
= yy_scan_buffer( buf
, n
);
1466 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1468 /* It's okay to grow etc. this buffer, and we should throw it
1469 * away when we're done.
1471 b
->yy_is_our_buffer
= 1;
1478 #ifndef YY_NO_PUSH_STATE
1479 #ifdef YY_USE_PROTOS
1480 static void yy_push_state( int new_state
)
1482 static void yy_push_state( new_state
)
1486 if ( yy_start_stack_ptr
>= yy_start_stack_depth
)
1490 yy_start_stack_depth
+= YY_START_STACK_INCR
;
1491 new_size
= yy_start_stack_depth
* sizeof( int );
1493 if ( ! yy_start_stack
)
1494 yy_start_stack
= (int *) yy_flex_alloc( new_size
);
1497 yy_start_stack
= (int *) yy_flex_realloc(
1498 (void *) yy_start_stack
, new_size
);
1500 if ( ! yy_start_stack
)
1502 "out of memory expanding start-condition stack" );
1505 yy_start_stack
[yy_start_stack_ptr
++] = YY_START
;
1512 #ifndef YY_NO_POP_STATE
1513 static void yy_pop_state()
1515 if ( --yy_start_stack_ptr
< 0 )
1516 YY_FATAL_ERROR( "start-condition stack underflow" );
1518 BEGIN(yy_start_stack
[yy_start_stack_ptr
]);
1523 #ifndef YY_NO_TOP_STATE
1524 static int yy_top_state()
1526 return yy_start_stack
[yy_start_stack_ptr
- 1];
1530 #ifndef YY_EXIT_FAILURE
1531 #define YY_EXIT_FAILURE 2
1534 #ifdef YY_USE_PROTOS
1535 static void yy_fatal_error( yyconst
char msg
[] )
1537 static void yy_fatal_error( msg
)
1541 (void) fprintf( stderr
, "%s\n", msg
);
1542 exit( YY_EXIT_FAILURE
);
1547 /* Redefine yyless() so it works in section 3 code. */
1553 /* Undo effects of setting up yytext. */ \
1554 yytext[yyleng] = yy_hold_char; \
1555 yy_c_buf_p = yytext + n; \
1556 yy_hold_char = *yy_c_buf_p; \
1557 *yy_c_buf_p = '\0'; \
1563 /* Internal utility routines. */
1566 #ifdef YY_USE_PROTOS
1567 static void yy_flex_strncpy( char *s1
, yyconst
char *s2
, int n
)
1569 static void yy_flex_strncpy( s1
, s2
, n
)
1576 for ( i
= 0; i
< n
; ++i
)
1581 #ifdef YY_NEED_STRLEN
1582 #ifdef YY_USE_PROTOS
1583 static int yy_flex_strlen( yyconst
char *s
)
1585 static int yy_flex_strlen( s
)
1590 for ( n
= 0; s
[n
]; ++n
)
1598 #ifdef YY_USE_PROTOS
1599 static void *yy_flex_alloc( yy_size_t size
)
1601 static void *yy_flex_alloc( size
)
1605 return (void *) malloc( size
);
1608 #ifdef YY_USE_PROTOS
1609 static void *yy_flex_realloc( void *ptr
, yy_size_t size
)
1611 static void *yy_flex_realloc( ptr
, size
)
1616 /* The cast to (char *) in the following accommodates both
1617 * implementations that use char* generic pointers, and those
1618 * that use void* generic pointers. It works with the latter
1619 * because both ANSI C and C++ allow castless assignment from
1620 * any pointer type to void*, and deal with argument conversions
1621 * as though doing an assignment.
1623 return (void *) realloc( (char *) ptr
, size
);
1626 #ifdef YY_USE_PROTOS
1627 static void yy_flex_free( void *ptr
)
1629 static void yy_flex_free( ptr
)
1643 #line 81 "installparse.l"
1645 /*------------------------ Program Section ----------------------------*/
1647 PRFileDesc
*Pk11Install_FD
=NULL
;
1649 /*************************************************************************/
1650 /* dummy function required by lex */
1651 int Pk11Install_yywrap(void) { return 1;}
1653 /*************************************************************************/
1654 /* Return a copy of the given string */
1656 putSimpleString(char *str
)
1658 char *tmp
= (char*) PR_Malloc(strlen(str
)+1);
1663 /*************************************************************************/
1664 /* Strip out quotes, replace escaped characters with what they stand for.
1665 This function assumes that what is passed in is actually a complex
1666 string, so error checking is lax. */
1668 putComplexString(char *str
)
1678 /* Allocate the new space. This string will actually be too big,
1679 since quotes and backslashes will be stripped out. But that's ok. */
1680 tmp
= (char*) PR_Malloc(size
+1);
1683 for(i
=0, j
=0; i
< size
; i
++) {
1685 continue; /* skip un-escaped quotes */
1686 } else if(str
[i
]=='\\') {
1687 ++i
; /* escaped character. skip the backslash */