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