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__
53
54 #define YY_USE_PROTOS
55 #define YY_USE_CONST
56
57 #endif /* __STDC__ */
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] =
298 { 0,
299 0, 0, 9, 3, 6, 5, 7, 1, 2, 3,
300 6, 0, 0, 4, 0 };
301
302 static yyconst int yy_ec[256] =
303 { 0,
304 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
305 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
306 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
307 1, 2, 1, 5, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1,
312 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
313 1, 6, 1, 1, 1, 1, 1, 1, 1, 1,
314
315 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
317 1, 1, 7, 1, 8, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
324 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
325
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, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 1, 1, 1, 1 };
332
333 static yyconst int yy_meta[9] =
334 { 0,
335 1, 2, 3, 4, 3, 1, 5, 5 };
336
337 static yyconst short int yy_base[19] =
338 { 0,
339 0, 0, 19, 0, 0, 21, 12, 21, 21, 0,
340 0, 4, 6, 21, 21, 13, 11, 15 };
341
342 static yyconst short int yy_def[19] =
343 { 0,
344 15, 1, 15, 16, 17, 15, 18, 15, 15, 16,
345 17, 18, 15, 15, 0, 15, 15, 15 };
346
347 static yyconst short int yy_nxt[30] =
348 { 0,
349 4, 5, 6, 5, 7, 4, 8, 9, 14, 13,
350 12, 12, 11, 10, 11, 12, 12, 13, 15, 12,
351 3, 15, 15, 15, 15, 15, 15, 15, 15 };
352
353 static yyconst short int yy_chk[30] =
354 { 0,
355 1, 1, 1, 1, 1, 1, 1, 1, 12, 12,
356 13, 13, 17, 16, 17, 18, 18, 7, 3, 18,
357 15, 15, 15, 15, 15, 15, 15, 15, 15 };
358
359 static yy_state_type yy_last_accepting_state;
360 static char *yy_last_accepting_cpos;
361
362 /* The intent behind this definition is that it'll catch
363 * any uses of REJECT which flex missed.
364 */
365 #define REJECT reject_used_but_not_detected
366 #define yymore() yymore_used_but_not_detected
367 #define YY_MORE_ADJ 0
368 #define YY_RESTORE_YY_MORE_OFFSET
369 char *yytext;
370 #line 1 "installparse.l"
371 #define INITIAL 0
372 /* lex file for analyzing PKCS #11 Module installation instructions */
373 /*----------------------------- Definitions ---------------------------*/
374 #line 5 "installparse.l"
375 #include <string.h>
376
377 #include "install-ds.h" /* defines tokens and data structures */
378 #include "installparse.h" /* produced by yacc -d */
379 #include <prprf.h>
380 static char *putSimpleString(char *); /* return copy of string */
381 static char *putComplexString(char *); /* strip out quotes, deal with */
382 /* escaped characters */
383
384 void Pk11Install_yyerror(char *);
385
386 /* Overrides to use NSPR */
387 #define malloc PR_Malloc
388 #define realloc PR_Realloc
389 #define free PR_Free
390
391 int Pk11Install_yylinenum = 1;
392 static char *err;
393
394 #define YY_NEVER_INTERACTIVE 1
395 #define yyunput Pkcs11Install_yyunput
396
397 /* This is the default YY_INPUT modified for NSPR */
398 #define YY_INPUT(buf, result, max_size) \
399 if (yy_current_buffer->yy_is_interactive) { \
400 char c; \
401 int n; \
402 for (n = 0; n < max_size && \
403 PR_Read(Pk11Install_FD, &c, 1) == 1 && c != '\n'; \
404 ++n) { \
405 buf[n] = c; \
406 } \
407 if (c == '\n') { \
408 buf[n++] = c; \
409 } \
410 result = n; \
411 } else { \
412 result = PR_Read(Pk11Install_FD, buf, max_size); \
413 }
414
415 /*** Regular expression definitions ***/
416 /* simple_string has no whitespace, quotes, or braces */
417 /* complex_string is enclosed in quotes. Inside the quotes, quotes and
418 backslashes must be backslash-escaped. Otherwise, anything goes. */
419 /* Standard whitespace */
420 /*---------------------------- Actions --------------------------------*/
421 #line 437 "lex.Pk11Install_yy.cpp"
422
423 /* Macros after this point can all be overridden by user definitions in
424 * section 1.
425 */
426
427 #ifndef YY_SKIP_YYWRAP
428 #ifdef __cplusplus
429 extern "C" int yywrap YY_PROTO((void));
430 #else
431 extern int yywrap YY_PROTO((void));
432 #endif
433 #endif
434
435 #ifndef YY_NO_UNPUT
436 static void yyunput YY_PROTO((int c, char *buf_ptr));
437 #endif
438
439 #ifndef yytext_ptr
440 static void yy_flex_strncpy YY_PROTO((char *, yyconst char *, int));
441 #endif
442
443 #ifdef YY_NEED_STRLEN
444 static int yy_flex_strlen YY_PROTO((yyconst char *));
445 #endif
446
447 #ifndef YY_NO_INPUT
448 #ifdef __cplusplus
449 static int yyinput YY_PROTO((void));
450 #else
451 static int input YY_PROTO((void));
452 #endif
453 #endif
454
455 #if YY_STACK_USED
456 static int yy_start_stack_ptr = 0;
457 static int yy_start_stack_depth = 0;
458 static int *yy_start_stack = 0;
459 #ifndef YY_NO_PUSH_STATE
460 static void yy_push_state YY_PROTO((int new_state));
461 #endif
462 #ifndef YY_NO_POP_STATE
463 static void yy_pop_state YY_PROTO((void));
464 #endif
465 #ifndef YY_NO_TOP_STATE
466 static int yy_top_state YY_PROTO((void));
467 #endif
468
469 #else
470 #define YY_NO_PUSH_STATE 1
471 #define YY_NO_POP_STATE 1
472 #define YY_NO_TOP_STATE 1
473 #endif
474
475 #ifdef YY_MALLOC_DECL
476 YY_MALLOC_DECL
477 #else
478 #if __STDC__
479 #ifndef __cplusplus
480 #include <stdlib.h>
481 #endif
482 #else
483 /* Just try to get by without declaring the routines. This will fail
484 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
485 * or sizeof(void*) != sizeof(int).
486 */
487 #endif
488 #endif
489
490 /* Amount of stuff to slurp up with each read. */
491 #ifndef YY_READ_BUF_SIZE
492 #define YY_READ_BUF_SIZE 8192
493 #endif
494
495 /* Copy whatever the last rule matched to the standard output. */
496
497 #ifndef ECHO
498 /* This used to be an fputs(), but since the string might contain NUL's,
499 * we now use fwrite().
500 */
501 #define ECHO (void)fwrite(yytext, yyleng, 1, yyout)
502 #endif
503
504 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
505 * is returned in "result".
506 */
507 #ifndef YY_INPUT
508 #define YY_INPUT(buf, result, max_size) \
509 if (yy_current_buffer->yy_is_interactive) { \
510 int c = '*', n; \
511 for (n = 0; n < max_size && \
512 (c = getc(yyin)) != EOF && c != '\n'; \
513 ++n) \
514 buf[n] = (char)c; \
515 if (c == '\n') \
516 buf[n++] = (char)c; \
517 if (c == EOF && ferror(yyin)) \
518 YY_FATAL_ERROR("input in flex scanner failed"); \
519 result = n; \
520 } else if (((result = fread(buf, 1, max_size, yyin)) == 0) && \
521 ferror(yyin)) \
522 YY_FATAL_ERROR("input in flex scanner failed");
523 #endif
524
525 /* No semi-colon after return; correct usage is to write "yyterminate();" -
526 * we don't want an extra ';' after the "return" because that will cause
527 * some compilers to complain about unreachable statements.
528 */
529 #ifndef yyterminate
530 #define yyterminate() return YY_NULL
531 #endif
532
533 /* Number of entries by which start-condition stack grows. */
534 #ifndef YY_START_STACK_INCR
535 #define YY_START_STACK_INCR 25
536 #endif
537
538 /* Report a fatal error. */
539 #ifndef YY_FATAL_ERROR
540 #define YY_FATAL_ERROR(msg) yy_fatal_error(msg)
541 #endif
542
543 /* Default declaration of generated scanner - a define so the user can
544 * easily add parameters.
545 */
546 #ifndef YY_DECL
547 #define YY_DECL int yylex YY_PROTO((void))
548 #endif
549
550 /* Code executed at the beginning of each rule, after yytext and yyleng
551 * have been set up.
552 */
553 #ifndef YY_USER_ACTION
554 #define YY_USER_ACTION
555 #endif
556
557 /* Code executed at the end of each rule. */
558 #ifndef YY_BREAK
559 #define YY_BREAK break;
560 #endif
561
562 #define YY_RULE_SETUP \
563 YY_USER_ACTION
564
565 YY_DECL
566 {
567 register yy_state_type yy_current_state;
568 register char *yy_cp, *yy_bp;
569 register int yy_act;
570
571 #line 60 "installparse.l"
572
573 #line 591 "lex.Pk11Install_yy.cpp"
574
575 if (yy_init) {
576 yy_init = 0;
577
578 #ifdef YY_USER_INIT
579 YY_USER_INIT;
580 #endif
581
582 if (!yy_start)
583 yy_start = 1; /* first start state */
584
585 if (!yyin)
586 yyin = stdin;
587
588 if (!yyout)
589 yyout = stdout;
590
591 if (!yy_current_buffer)
592 yy_current_buffer =
593 yy_create_buffer(yyin, YY_BUF_SIZE);
594
595 yy_load_buffer_state();
596 }
597
598 while (1) /* loops until end-of-file is reached */
599 {
600 yy_cp = yy_c_buf_p;
601
602 /* Support of yytext. */
603 *yy_cp = yy_hold_char;
604
605 /* yy_bp points to the position in yy_ch_buf of the start of
606 * the current run.
607 */
608 yy_bp = yy_cp;
609
610 yy_current_state = yy_start;
611 yy_match:
612 do {
613 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
614 if (yy_accept[yy_current_state]) {
615 yy_last_accepting_state = yy_current_state;
616 yy_last_accepting_cpos = yy_cp;
617 }
618 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
619 yy_current_state = (int)yy_def[yy_current_state];
620 if (yy_current_state >= 16)
621 yy_c = yy_meta[(unsigned int)yy_c];
622 }
623 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
624 ++yy_cp;
625 } while (yy_base[yy_current_state] != 21);
626
627 yy_find_action:
628 yy_act = yy_accept[yy_current_state];
629 if (yy_act == 0) { /* have to back up */
630 yy_cp = yy_last_accepting_cpos;
631 yy_current_state = yy_last_accepting_state;
632 yy_act = yy_accept[yy_current_state];
633 }
634
635 YY_DO_BEFORE_ACTION;
636
637 do_action: /* This label is used only to access EOF actions. */
638
639 switch (yy_act) { /* beginning of action switch */
640 case 0: /* must back up */
641 /* undo the effects of YY_DO_BEFORE_ACTION */
642 *yy_cp = yy_hold_char;
643 yy_cp = yy_last_accepting_cpos;
644 yy_current_state = yy_last_accepting_state;
645 goto yy_find_action;
646
647 case 1:
648 YY_RULE_SETUP
649 #line 62 "installparse.l"
650 return OPENBRACE;
651 YY_BREAK
652 case 2:
653 YY_RULE_SETUP
654 #line 63 "installparse.l"
655 return CLOSEBRACE;
656 YY_BREAK
657 case 3:
658 YY_RULE_SETUP
659 #line 64 "installparse.l"
660 {
661 Pk11Install_yylval.string =
662 putSimpleString(Pk11Install_yytext);
663 return STRING;
664 }
665 YY_BREAK
666 case 4:
667 YY_RULE_SETUP
668 #line 67 "installparse.l"
669 {
670 Pk11Install_yylval.string =
671 putComplexString(Pk11Install_yytext);
672 return STRING;
673 }
674 YY_BREAK
675 case 5:
676 YY_RULE_SETUP
677 #line 71 "installparse.l"
678 Pk11Install_yylinenum++;
679 YY_BREAK
680 case 6:
681 YY_RULE_SETUP
682 #line 73 "installparse.l"
683 ;
684 YY_BREAK
685 case 7:
686 YY_RULE_SETUP
687 #line 75 "installparse.l"
688 {
689 err =
690 PR_smprintf("Invalid lexeme: %s", Pk11Install_yytext);
691 Pk11Install_yyerror(err);
692 PR_smprintf_free(err);
693 return 1;
694 }
695 YY_BREAK
696 case 8:
697 YY_RULE_SETUP
698 #line 81 "installparse.l"
699 ECHO;
700 YY_BREAK
701 #line 722 "lex.Pk11Install_yy.cpp"
702 case YY_STATE_EOF(INITIAL):
703 yyterminate();
704
705 case YY_END_OF_BUFFER: {
706 /* Amount of text matched not including the EOB char. */
707 int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr) - 1;
708
709 /* Undo the effects of YY_DO_BEFORE_ACTION. */
710 *yy_cp = yy_hold_char;
711 YY_RESTORE_YY_MORE_OFFSET
712
713 if (yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW) {
714 /* We're scanning a new file or input source. It's
715 * possible that this happened because the user
716 * just pointed yyin at a new source and called
717 * yylex(). If so, then we have to assure
718 * consistency between yy_current_buffer and our
719 * globals. Here is the right place to do so, because
720 * this is the first action (other than possibly a
721 * back-up) that will match for the new input source.
722 */
723 yy_n_chars = yy_current_buffer->yy_n_chars;
724 yy_current_buffer->yy_input_file = yyin;
725 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
726 }
727
728 /* Note that here we test for yy_c_buf_p "<=" to the position
729 * of the first EOB in the buffer, since yy_c_buf_p will
730 * already have been incremented past the NUL character
731 * (since all states make transitions on EOB to the
732 * end-of-buffer state). Contrast this with the test
733 * in input().
734 */
735 if (yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars]) { /* This was really a NUL. */
736 yy_state_type yy_next_state;
737
738 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
739
740 yy_current_state = yy_get_previous_state();
741
742 /* Okay, we're now positioned to make the NUL
743 * transition. We couldn't have
744 * yy_get_previous_state() go ahead and do it
745 * for us because it doesn't know how to deal
746 * with the possibility of jamming (and we don't
747 * want to build jamming into it because then it
748 * will run more slowly).
749 */
750
751 yy_next_state = yy_try_NUL_trans(yy_current_state);
752
753 yy_bp = yytext_ptr + YY_MORE_ADJ;
754
755 if (yy_next_state) {
756 /* Consume the NUL. */
757 yy_cp = ++yy_c_buf_p;
758 yy_current_state = yy_next_state;
759 goto yy_match;
760 }
761
762 else {
763 yy_cp = yy_c_buf_p;
764 goto yy_find_action;
765 }
766 }
767
768 else
769 switch (yy_get_next_buffer()) {
770 case EOB_ACT_END_OF_FILE: {
771 yy_did_buffer_switch_on_eof = 0;
772
773 if (yywrap()) {
774 /* Note: because we've taken care in
775 * yy_get_next_buffer() to have set up
776 * yytext, we can now set up
777 * yy_c_buf_p so that if some total
778 * hoser (like flex itself) wants to
779 * call the scanner after we return the
780 * YY_NULL, it'll still work - another
781 * YY_NULL will get returned.
782 */
783 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
784
785 yy_act = YY_STATE_EOF(YY_START);
786 goto do_action;
787 }
788
789 else {
790 if (!yy_did_buffer_switch_on_eof)
791 YY_NEW_FILE;
792 }
793 break;
794 }
795
796 case EOB_ACT_CONTINUE_SCAN:
797 yy_c_buf_p =
798 yytext_ptr + yy_amount_of_matched_text;
799
800 yy_current_state = yy_get_previous_state();
801
802 yy_cp = yy_c_buf_p;
803 yy_bp = yytext_ptr + YY_MORE_ADJ;
804 goto yy_match;
805
806 case EOB_ACT_LAST_MATCH:
807 yy_c_buf_p =
808 &yy_current_buffer->yy_ch_buf[yy_n_chars];
809
810 yy_current_state = yy_get_previous_state();
811
812 yy_cp = yy_c_buf_p;
813 yy_bp = yytext_ptr + YY_MORE_ADJ;
814 goto yy_find_action;
815 }
816 break;
817 }
818
819 default:
820 YY_FATAL_ERROR(
821 "fatal flex scanner internal error--no action found");
822 } /* end of action switch */
823 } /* end of scanning one token */
824 } /* end of yylex */
825
826 /* yy_get_next_buffer - try to read in a new buffer
827 *
828 * Returns a code representing an action:
829 * EOB_ACT_LAST_MATCH -
830 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
831 * EOB_ACT_END_OF_FILE - end of file
832 */
833
834 static int
yy_get_next_buffer()835 yy_get_next_buffer()
836 {
837 register char *dest = yy_current_buffer->yy_ch_buf;
838 register char *source = yytext_ptr;
839 register int number_to_move, i;
840 int ret_val;
841
842 if (yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1])
843 YY_FATAL_ERROR(
844 "fatal flex scanner internal error--end of buffer missed");
845
846 if (yy_current_buffer->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */
847 if (yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1) {
848 /* We matched a single character, the EOB, so
849 * treat this as a final EOF.
850 */
851 return EOB_ACT_END_OF_FILE;
852 }
853
854 else {
855 /* We matched some text prior to the EOB, first
856 * process it.
857 */
858 return EOB_ACT_LAST_MATCH;
859 }
860 }
861
862 /* Try to read more data. */
863
864 /* First move last chars to start of buffer. */
865 number_to_move = (int)(yy_c_buf_p - yytext_ptr) - 1;
866
867 for (i = 0; i < number_to_move; ++i)
868 *(dest++) = *(source++);
869
870 if (yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING)
871 /* don't do the read, it's not guaranteed to return an EOF,
872 * just force an EOF
873 */
874 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
875
876 else {
877 int num_to_read =
878 yy_current_buffer->yy_buf_size - number_to_move - 1;
879
880 while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */
881 #ifdef YY_USES_REJECT
882 YY_FATAL_ERROR(
883 "input buffer overflow, can't enlarge buffer because scanner uses REJECT");
884 #else
885
886 /* just a shorter name for the current buffer */
887 YY_BUFFER_STATE b = yy_current_buffer;
888
889 int yy_c_buf_p_offset =
890 (int)(yy_c_buf_p - b->yy_ch_buf);
891
892 if (b->yy_is_our_buffer) {
893 int new_size = b->yy_buf_size * 2;
894
895 if (new_size <= 0)
896 b->yy_buf_size += b->yy_buf_size / 8;
897 else
898 b->yy_buf_size *= 2;
899
900 b->yy_ch_buf = (char *)
901 /* Include room in for 2 EOB chars. */
902 yy_flex_realloc((void *)b->yy_ch_buf,
903 b->yy_buf_size + 2);
904 } else
905 /* Can't grow it, we don't own it. */
906 b->yy_ch_buf = 0;
907
908 if (!b->yy_ch_buf)
909 YY_FATAL_ERROR(
910 "fatal error - scanner input buffer overflow");
911
912 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
913
914 num_to_read = yy_current_buffer->yy_buf_size -
915 number_to_move - 1;
916 #endif
917 }
918
919 if (num_to_read > YY_READ_BUF_SIZE)
920 num_to_read = YY_READ_BUF_SIZE;
921
922 /* Read in more data. */
923 YY_INPUT((&yy_current_buffer->yy_ch_buf[number_to_move]),
924 yy_n_chars, num_to_read);
925
926 yy_current_buffer->yy_n_chars = yy_n_chars;
927 }
928
929 if (yy_n_chars == 0) {
930 if (number_to_move == YY_MORE_ADJ) {
931 ret_val = EOB_ACT_END_OF_FILE;
932 yyrestart(yyin);
933 }
934
935 else {
936 ret_val = EOB_ACT_LAST_MATCH;
937 yy_current_buffer->yy_buffer_status =
938 YY_BUFFER_EOF_PENDING;
939 }
940 }
941
942 else
943 ret_val = EOB_ACT_CONTINUE_SCAN;
944
945 yy_n_chars += number_to_move;
946 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
947 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
948
949 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
950
951 return ret_val;
952 }
953
954 /* yy_get_previous_state - get the state just before the EOB char was reached */
955
956 static yy_state_type
yy_get_previous_state()957 yy_get_previous_state()
958 {
959 register yy_state_type yy_current_state;
960 register char *yy_cp;
961
962 yy_current_state = yy_start;
963
964 for (yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp) {
965 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
966 if (yy_accept[yy_current_state]) {
967 yy_last_accepting_state = yy_current_state;
968 yy_last_accepting_cpos = yy_cp;
969 }
970 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
971 yy_current_state = (int)yy_def[yy_current_state];
972 if (yy_current_state >= 16)
973 yy_c = yy_meta[(unsigned int)yy_c];
974 }
975 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
976 }
977
978 return yy_current_state;
979 }
980
981 /* yy_try_NUL_trans - try to make a transition on the NUL character
982 *
983 * synopsis
984 * next_state = yy_try_NUL_trans( current_state );
985 */
986
987 #ifdef YY_USE_PROTOS
988 static yy_state_type
yy_try_NUL_trans(yy_state_type yy_current_state)989 yy_try_NUL_trans(yy_state_type yy_current_state)
990 #else
991 static yy_state_type yy_try_NUL_trans(yy_current_state)
992 yy_state_type yy_current_state;
993 #endif
994 {
995 register int yy_is_jam;
996 register char *yy_cp = yy_c_buf_p;
997
998 register YY_CHAR yy_c = 1;
999 if (yy_accept[yy_current_state]) {
1000 yy_last_accepting_state = yy_current_state;
1001 yy_last_accepting_cpos = yy_cp;
1002 }
1003 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
1004 yy_current_state = (int)yy_def[yy_current_state];
1005 if (yy_current_state >= 16)
1006 yy_c = yy_meta[(unsigned int)yy_c];
1007 }
1008 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
1009 yy_is_jam = (yy_current_state == 15);
1010
1011 return yy_is_jam ? 0 : yy_current_state;
1012 }
1013
1014 #ifndef YY_NO_UNPUT
1015 #ifdef YY_USE_PROTOS
1016 static void
yyunput(int c,register char * yy_bp)1017 yyunput(int c, register char *yy_bp)
1018 #else
1019 static void yyunput(c, yy_bp) int c;
1020 register char *yy_bp;
1021 #endif
1022 {
1023 register char *yy_cp = yy_c_buf_p;
1024
1025 /* undo effects of setting up yytext */
1026 *yy_cp = yy_hold_char;
1027
1028 if (yy_cp < yy_current_buffer->yy_ch_buf + 2) { /* need to shift things up to make room */
1029 /* +2 for EOB chars. */
1030 register int number_to_move = yy_n_chars + 2;
1031 register char *dest = &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size +
1032 2];
1033 register char *source =
1034 &yy_current_buffer->yy_ch_buf[number_to_move];
1035
1036 while (source > yy_current_buffer->yy_ch_buf)
1037 *--dest = *--source;
1038
1039 yy_cp += (int)(dest - source);
1040 yy_bp += (int)(dest - source);
1041 yy_current_buffer->yy_n_chars =
1042 yy_n_chars = yy_current_buffer->yy_buf_size;
1043
1044 if (yy_cp < yy_current_buffer->yy_ch_buf + 2)
1045 YY_FATAL_ERROR("flex scanner push-back overflow");
1046 }
1047
1048 *--yy_cp = (char)c;
1049
1050 yytext_ptr = yy_bp;
1051 yy_hold_char = *yy_cp;
1052 yy_c_buf_p = yy_cp;
1053 }
1054 #endif /* ifndef YY_NO_UNPUT */
1055
1056 #ifndef YY_NO_INPUT
1057 #ifdef __cplusplus
1058 static int
yyinput()1059 yyinput()
1060 #else
1061 static int
1062 input()
1063 #endif
1064 {
1065 int c;
1066
1067 *yy_c_buf_p = yy_hold_char;
1068
1069 if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR) {
1070 /* yy_c_buf_p now points to the character we want to return.
1071 * If this occurs *before* the EOB characters, then it's a
1072 * valid NUL; if not, then we've hit the end of the buffer.
1073 */
1074 if (yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars])
1075 /* This was really a NUL. */
1076 *yy_c_buf_p = '\0';
1077
1078 else { /* need more input */
1079 int offset = yy_c_buf_p - yytext_ptr;
1080 ++yy_c_buf_p;
1081
1082 switch (yy_get_next_buffer()) {
1083 case EOB_ACT_LAST_MATCH:
1084 /* This happens because yy_g_n_b()
1085 * sees that we've accumulated a
1086 * token and flags that we need to
1087 * try matching the token before
1088 * proceeding. But for input(),
1089 * there's no matching to consider.
1090 * So convert the EOB_ACT_LAST_MATCH
1091 * to EOB_ACT_END_OF_FILE.
1092 */
1093
1094 /* Reset buffer status. */
1095 yyrestart(yyin);
1096
1097 /* fall through */
1098
1099 case EOB_ACT_END_OF_FILE: {
1100 if (yywrap())
1101 return EOF;
1102
1103 if (!yy_did_buffer_switch_on_eof)
1104 YY_NEW_FILE;
1105 #ifdef __cplusplus
1106 return yyinput();
1107 #else
1108 return input();
1109 #endif
1110 }
1111
1112 case EOB_ACT_CONTINUE_SCAN:
1113 yy_c_buf_p = yytext_ptr + offset;
1114 break;
1115 }
1116 }
1117 }
1118
1119 c = *(unsigned char *)yy_c_buf_p; /* cast for 8-bit char's */
1120 *yy_c_buf_p = '\0'; /* preserve yytext */
1121 yy_hold_char = *++yy_c_buf_p;
1122
1123 return c;
1124 }
1125 #endif /* ifndef YY_NO_INPUT */
1126
1127 #ifdef YY_USE_PROTOS
1128 void
yyrestart(FILE * input_file)1129 yyrestart(FILE *input_file)
1130 #else
1131 void yyrestart(input_file)
1132 FILE *input_file;
1133 #endif
1134 {
1135 if (!yy_current_buffer)
1136 yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE);
1137
1138 yy_init_buffer(yy_current_buffer, input_file);
1139 yy_load_buffer_state();
1140 }
1141
1142 #ifdef YY_USE_PROTOS
1143 void
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1144 yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)
1145 #else
1146 void yy_switch_to_buffer(new_buffer)
1147 YY_BUFFER_STATE new_buffer;
1148 #endif
1149 {
1150 if (yy_current_buffer == new_buffer)
1151 return;
1152
1153 if (yy_current_buffer) {
1154 /* Flush out information for old buffer. */
1155 *yy_c_buf_p = yy_hold_char;
1156 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1157 yy_current_buffer->yy_n_chars = yy_n_chars;
1158 }
1159
1160 yy_current_buffer = new_buffer;
1161 yy_load_buffer_state();
1162
1163 /* We don't actually know whether we did this switch during
1164 * EOF (yywrap()) processing, but the only time this flag
1165 * is looked at is after yywrap() is called, so it's safe
1166 * to go ahead and always set it.
1167 */
1168 yy_did_buffer_switch_on_eof = 1;
1169 }
1170
1171 #ifdef YY_USE_PROTOS
1172 void
yy_load_buffer_state(void)1173 yy_load_buffer_state(void)
1174 #else
1175 void
1176 yy_load_buffer_state()
1177 #endif
1178 {
1179 yy_n_chars = yy_current_buffer->yy_n_chars;
1180 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1181 yyin = yy_current_buffer->yy_input_file;
1182 yy_hold_char = *yy_c_buf_p;
1183 }
1184
1185 #ifdef YY_USE_PROTOS
1186 YY_BUFFER_STATE
yy_create_buffer(FILE * file,int size)1187 yy_create_buffer(FILE *file, int size)
1188 #else
1189 YY_BUFFER_STATE yy_create_buffer(file, size)
1190 FILE *file;
1191 int size;
1192 #endif
1193 {
1194 YY_BUFFER_STATE b;
1195
1196 b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state));
1197 if (!b)
1198 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1199
1200 b->yy_buf_size = size;
1201
1202 /* yy_ch_buf has to be 2 characters longer than the size given because
1203 * we need to put in 2 end-of-buffer characters.
1204 */
1205 b->yy_ch_buf = (char *)yy_flex_alloc(b->yy_buf_size + 2);
1206 if (!b->yy_ch_buf)
1207 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1208
1209 b->yy_is_our_buffer = 1;
1210
1211 yy_init_buffer(b, file);
1212
1213 return b;
1214 }
1215
1216 #ifdef YY_USE_PROTOS
1217 void
yy_delete_buffer(YY_BUFFER_STATE b)1218 yy_delete_buffer(YY_BUFFER_STATE b)
1219 #else
1220 void yy_delete_buffer(b)
1221 YY_BUFFER_STATE b;
1222 #endif
1223 {
1224 if (!b)
1225 return;
1226
1227 if (b == yy_current_buffer)
1228 yy_current_buffer = (YY_BUFFER_STATE)0;
1229
1230 if (b->yy_is_our_buffer)
1231 yy_flex_free((void *)b->yy_ch_buf);
1232
1233 yy_flex_free((void *)b);
1234 }
1235
1236 #ifndef YY_ALWAYS_INTERACTIVE
1237 #ifndef YY_NEVER_INTERACTIVE
1238 extern int isatty YY_PROTO((int));
1239 #endif
1240 #endif
1241
1242 #ifdef YY_USE_PROTOS
1243 void
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1244 yy_init_buffer(YY_BUFFER_STATE b, FILE *file)
1245 #else
1246 void yy_init_buffer(b, file)
1247 YY_BUFFER_STATE b;
1248 FILE *file;
1249 #endif
1250
1251 {
1252 yy_flush_buffer(b);
1253
1254 b->yy_input_file = file;
1255 b->yy_fill_buffer = 1;
1256
1257 #if YY_ALWAYS_INTERACTIVE
1258 b->yy_is_interactive = 1;
1259 #else
1260 #if YY_NEVER_INTERACTIVE
1261 b->yy_is_interactive = 0;
1262 #else
1263 b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
1264 #endif
1265 #endif
1266 }
1267
1268 #ifdef YY_USE_PROTOS
1269 void
yy_flush_buffer(YY_BUFFER_STATE b)1270 yy_flush_buffer(YY_BUFFER_STATE b)
1271 #else
1272 void yy_flush_buffer(b)
1273 YY_BUFFER_STATE b;
1274 #endif
1275
1276 {
1277 if (!b)
1278 return;
1279
1280 b->yy_n_chars = 0;
1281
1282 /* We always need two end-of-buffer characters. The first causes
1283 * a transition to the end-of-buffer state. The second causes
1284 * a jam in that state.
1285 */
1286 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1287 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1288
1289 b->yy_buf_pos = &b->yy_ch_buf[0];
1290
1291 b->yy_at_bol = 1;
1292 b->yy_buffer_status = YY_BUFFER_NEW;
1293
1294 if (b == yy_current_buffer)
1295 yy_load_buffer_state();
1296 }
1297
1298 #ifndef YY_NO_SCAN_BUFFER
1299 #ifdef YY_USE_PROTOS
1300 YY_BUFFER_STATE
yy_scan_buffer(char * base,yy_size_t size)1301 yy_scan_buffer(char *base, yy_size_t size)
1302 #else
1303 YY_BUFFER_STATE yy_scan_buffer(base, size) char *base;
1304 yy_size_t size;
1305 #endif
1306 {
1307 YY_BUFFER_STATE b;
1308
1309 if (size < 2 ||
1310 base[size - 2] != YY_END_OF_BUFFER_CHAR ||
1311 base[size - 1] != YY_END_OF_BUFFER_CHAR)
1312 /* They forgot to leave room for the EOB's. */
1313 return 0;
1314
1315 b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state));
1316 if (!b)
1317 YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
1318
1319 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1320 b->yy_buf_pos = b->yy_ch_buf = base;
1321 b->yy_is_our_buffer = 0;
1322 b->yy_input_file = 0;
1323 b->yy_n_chars = b->yy_buf_size;
1324 b->yy_is_interactive = 0;
1325 b->yy_at_bol = 1;
1326 b->yy_fill_buffer = 0;
1327 b->yy_buffer_status = YY_BUFFER_NEW;
1328
1329 yy_switch_to_buffer(b);
1330
1331 return b;
1332 }
1333 #endif
1334
1335 #ifndef YY_NO_SCAN_STRING
1336 #ifdef YY_USE_PROTOS
1337 YY_BUFFER_STATE
yy_scan_string(yyconst char * yy_str)1338 yy_scan_string(yyconst char *yy_str)
1339 #else
1340 YY_BUFFER_STATE yy_scan_string(yy_str)
1341 yyconst char *yy_str;
1342 #endif
1343 {
1344 int len;
1345 for (len = 0; yy_str[len]; ++len)
1346 ;
1347
1348 return yy_scan_bytes(yy_str, len);
1349 }
1350 #endif
1351
1352 #ifndef YY_NO_SCAN_BYTES
1353 #ifdef YY_USE_PROTOS
1354 YY_BUFFER_STATE
yy_scan_bytes(yyconst char * bytes,int len)1355 yy_scan_bytes(yyconst char *bytes, int len)
1356 #else
1357 YY_BUFFER_STATE yy_scan_bytes(bytes, len)
1358 yyconst char *bytes;
1359 int len;
1360 #endif
1361 {
1362 YY_BUFFER_STATE b;
1363 char *buf;
1364 yy_size_t n;
1365 int i;
1366
1367 /* Get memory for full buffer, including space for trailing EOB's. */
1368 n = len + 2;
1369 buf = (char *)yy_flex_alloc(n);
1370 if (!buf)
1371 YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
1372
1373 for (i = 0; i < len; ++i)
1374 buf[i] = bytes[i];
1375
1376 buf[len] = buf[len + 1] = YY_END_OF_BUFFER_CHAR;
1377
1378 b = yy_scan_buffer(buf, n);
1379 if (!b)
1380 YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
1381
1382 /* It's okay to grow etc. this buffer, and we should throw it
1383 * away when we're done.
1384 */
1385 b->yy_is_our_buffer = 1;
1386
1387 return b;
1388 }
1389 #endif
1390
1391 #ifndef YY_NO_PUSH_STATE
1392 #ifdef YY_USE_PROTOS
1393 static void
yy_push_state(int new_state)1394 yy_push_state(int new_state)
1395 #else
1396 static void yy_push_state(new_state) int new_state;
1397 #endif
1398 {
1399 if (yy_start_stack_ptr >= yy_start_stack_depth) {
1400 yy_size_t new_size;
1401
1402 yy_start_stack_depth += YY_START_STACK_INCR;
1403 new_size = yy_start_stack_depth * sizeof(int);
1404
1405 if (!yy_start_stack)
1406 yy_start_stack = (int *)yy_flex_alloc(new_size);
1407
1408 else
1409 yy_start_stack = (int *)yy_flex_realloc(
1410 (void *)yy_start_stack, new_size);
1411
1412 if (!yy_start_stack)
1413 YY_FATAL_ERROR(
1414 "out of memory expanding start-condition stack");
1415 }
1416
1417 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1418
1419 BEGIN(new_state);
1420 }
1421 #endif
1422
1423 #ifndef YY_NO_POP_STATE
1424 static void
yy_pop_state()1425 yy_pop_state()
1426 {
1427 if (--yy_start_stack_ptr < 0)
1428 YY_FATAL_ERROR("start-condition stack underflow");
1429
1430 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1431 }
1432 #endif
1433
1434 #ifndef YY_NO_TOP_STATE
1435 static int
yy_top_state()1436 yy_top_state()
1437 {
1438 return yy_start_stack[yy_start_stack_ptr - 1];
1439 }
1440 #endif
1441
1442 #ifndef YY_EXIT_FAILURE
1443 #define YY_EXIT_FAILURE 2
1444 #endif
1445
1446 #ifdef YY_USE_PROTOS
1447 static void
yy_fatal_error(yyconst char msg[])1448 yy_fatal_error(yyconst char msg[])
1449 #else
1450 static void yy_fatal_error(msg) char msg[];
1451 #endif
1452 {
1453 (void)fprintf(stderr, "%s\n", msg);
1454 exit(YY_EXIT_FAILURE);
1455 }
1456
1457 /* Redefine yyless() so it works in section 3 code. */
1458
1459 #undef yyless
1460 #define yyless(n) \
1461 do { \
1462 /* Undo effects of setting up yytext. */ \
1463 yytext[yyleng] = yy_hold_char; \
1464 yy_c_buf_p = yytext + n; \
1465 yy_hold_char = *yy_c_buf_p; \
1466 *yy_c_buf_p = '\0'; \
1467 yyleng = n; \
1468 } while (0)
1469
1470 /* Internal utility routines. */
1471
1472 #ifndef yytext_ptr
1473 #ifdef YY_USE_PROTOS
1474 static void
yy_flex_strncpy(char * s1,yyconst char * s2,int n)1475 yy_flex_strncpy(char *s1, yyconst char *s2, int n)
1476 #else
1477 static void yy_flex_strncpy(s1, s2, n) char *s1;
1478 yyconst char *s2;
1479 int n;
1480 #endif
1481 {
1482 register int i;
1483 for (i = 0; i < n; ++i)
1484 s1[i] = s2[i];
1485 }
1486 #endif
1487
1488 #ifdef YY_NEED_STRLEN
1489 #ifdef YY_USE_PROTOS
1490 static int
yy_flex_strlen(yyconst char * s)1491 yy_flex_strlen(yyconst char *s)
1492 #else
1493 static int yy_flex_strlen(s)
1494 yyconst char *s;
1495 #endif
1496 {
1497 register int n;
1498 for (n = 0; s[n]; ++n)
1499 ;
1500
1501 return n;
1502 }
1503 #endif
1504
1505 #ifdef YY_USE_PROTOS
1506 static void *
yy_flex_alloc(yy_size_t size)1507 yy_flex_alloc(yy_size_t size)
1508 #else
1509 static void *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 *
yy_flex_realloc(void * ptr,yy_size_t size)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
yy_flex_free(void * ptr)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
main()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
Pk11Install_yywrap(void)1561 Pk11Install_yywrap(void)
1562 {
1563 return 1;
1564 }
1565
1566 /*************************************************************************/
1567 /* Return a copy of the given string */
1568 static char *
putSimpleString(char * str)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 *
putComplexString(char * str)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 }
1608