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