root/bdm/libconfig/scanner.c @ 363

Revision 248, 68.5 kB (checked in by smidl, 15 years ago)

doc

Line 
1#line 2 "scanner.c"
2
3#line 4 "scanner.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 5
12#define YY_FLEX_SUBMINOR_VERSION 35
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>
44typedef int8_t flex_int8_t;
45typedef uint8_t flex_uint8_t;
46typedef int16_t flex_int16_t;
47typedef uint16_t flex_uint16_t;
48typedef int32_t flex_int32_t;
49typedef uint32_t flex_uint32_t;
50#else
51typedef signed char flex_int8_t;
52typedef short int flex_int16_t;
53typedef int flex_int32_t;
54typedef unsigned char flex_uint8_t; 
55typedef unsigned short int flex_uint16_t;
56typedef unsigned int flex_uint32_t;
57#endif /* ! C99 */
58
59/* Limits of integral types. */
60#ifndef INT8_MIN
61#define INT8_MIN               (-128)
62#endif
63#ifndef INT16_MIN
64#define INT16_MIN              (-32767-1)
65#endif
66#ifndef INT32_MIN
67#define INT32_MIN              (-2147483647-1)
68#endif
69#ifndef INT8_MAX
70#define INT8_MAX               (127)
71#endif
72#ifndef INT16_MAX
73#define INT16_MAX              (32767)
74#endif
75#ifndef INT32_MAX
76#define INT32_MAX              (2147483647)
77#endif
78#ifndef UINT8_MAX
79#define UINT8_MAX              (255U)
80#endif
81#ifndef UINT16_MAX
82#define UINT16_MAX             (65535U)
83#endif
84#ifndef UINT32_MAX
85#define UINT32_MAX             (4294967295U)
86#endif
87
88#endif /* ! FLEXINT_H */
89
90#ifdef __cplusplus
91
92/* The "const" storage-class-modifier is valid. */
93#define YY_USE_CONST
94
95#else   /* ! __cplusplus */
96
97/* C99 requires __STDC__ to be defined as 1. */
98#if defined (__STDC__)
99
100#define YY_USE_CONST
101
102#endif  /* defined (__STDC__) */
103#endif  /* ! __cplusplus */
104
105#ifdef YY_USE_CONST
106#define yyconst const
107#else
108#define yyconst
109#endif
110
111/* Returned upon end-of-file. */
112#define YY_NULL 0
113
114/* Promotes a possibly negative, possibly signed char to an unsigned
115 * integer for use as an array index.  If the signed char is negative,
116 * we want to instead treat it as an 8-bit unsigned char, hence the
117 * double cast.
118 */
119#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
120
121/* An opaque pointer. */
122#ifndef YY_TYPEDEF_YY_SCANNER_T
123#define YY_TYPEDEF_YY_SCANNER_T
124typedef void* yyscan_t;
125#endif
126
127/* For convenience, these vars (plus the bison vars far below)
128   are macros in the reentrant scanner. */
129#define yyin yyg->yyin_r
130#define yyout yyg->yyout_r
131#define yyextra yyg->yyextra_r
132#define yyleng yyg->yyleng_r
133#define yytext yyg->yytext_r
134#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
135#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
136#define yy_flex_debug yyg->yy_flex_debug_r
137
138/* Enter a start condition.  This macro really ought to take a parameter,
139 * but we do it the disgusting crufty way forced on us by the ()-less
140 * definition of BEGIN.
141 */
142#define BEGIN yyg->yy_start = 1 + 2 *
143
144/* Translate the current start state into a value that can be later handed
145 * to BEGIN to return to the state.  The YYSTATE alias is for lex
146 * compatibility.
147 */
148#define YY_START ((yyg->yy_start - 1) / 2)
149#define YYSTATE YY_START
150
151/* Action number for EOF rule of a given start state. */
152#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
153
154/* Special action meaning "start processing a new file". */
155#define YY_NEW_FILE libconfig_yyrestart(yyin ,yyscanner )
156
157#define YY_END_OF_BUFFER_CHAR 0
158
159/* Size of default input buffer. */
160#ifndef YY_BUF_SIZE
161#define YY_BUF_SIZE 16384
162#endif
163
164/* The state buf must be large enough to hold one state per character in the main buffer.
165 */
166#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
167
168#ifndef YY_TYPEDEF_YY_BUFFER_STATE
169#define YY_TYPEDEF_YY_BUFFER_STATE
170typedef struct yy_buffer_state *YY_BUFFER_STATE;
171#endif
172
173#define EOB_ACT_CONTINUE_SCAN 0
174#define EOB_ACT_END_OF_FILE 1
175#define EOB_ACT_LAST_MATCH 2
176
177    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
178     *       access to the local variable yy_act. Since yyless() is a macro, it would break
179     *       existing scanners that call yyless() from OUTSIDE libconfig_yylex.
180     *       One obvious solution it to make yy_act a global. I tried that, and saw
181     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
182     *       normally declared as a register variable-- so it is not worth it.
183     */
184    #define  YY_LESS_LINENO(n) \
185            do { \
186                int yyl;\
187                for ( yyl = n; yyl < yyleng; ++yyl )\
188                    if ( yytext[yyl] == '\n' )\
189                        --yylineno;\
190            }while(0)
191   
192/* Return all but the first "n" matched characters back to the input stream. */
193#define yyless(n) \
194        do \
195                { \
196                /* Undo effects of setting up yytext. */ \
197        int yyless_macro_arg = (n); \
198        YY_LESS_LINENO(yyless_macro_arg);\
199                *yy_cp = yyg->yy_hold_char; \
200                YY_RESTORE_YY_MORE_OFFSET \
201                yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
202                YY_DO_BEFORE_ACTION; /* set up yytext again */ \
203                } \
204        while ( 0 )
205
206#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
207
208#ifndef YY_TYPEDEF_YY_SIZE_T
209#define YY_TYPEDEF_YY_SIZE_T
210typedef size_t yy_size_t;
211#endif
212
213#ifndef YY_STRUCT_YY_BUFFER_STATE
214#define YY_STRUCT_YY_BUFFER_STATE
215struct yy_buffer_state
216        {
217        FILE *yy_input_file;
218
219        char *yy_ch_buf;                /* input buffer */
220        char *yy_buf_pos;               /* current position in input buffer */
221
222        /* Size of input buffer in bytes, not including room for EOB
223         * characters.
224         */
225        yy_size_t yy_buf_size;
226
227        /* Number of characters read into yy_ch_buf, not including EOB
228         * characters.
229         */
230        int yy_n_chars;
231
232        /* Whether we "own" the buffer - i.e., we know we created it,
233         * and can realloc() it to grow it, and should free() it to
234         * delete it.
235         */
236        int yy_is_our_buffer;
237
238        /* Whether this is an "interactive" input source; if so, and
239         * if we're using stdio for input, then we want to use getc()
240         * instead of fread(), to make sure we stop fetching input after
241         * each newline.
242         */
243        int yy_is_interactive;
244
245        /* Whether we're considered to be at the beginning of a line.
246         * If so, '^' rules will be active on the next match, otherwise
247         * not.
248         */
249        int yy_at_bol;
250
251    int yy_bs_lineno; /**< The line count. */
252    int yy_bs_column; /**< The column count. */
253   
254        /* Whether to try to fill the input buffer when we reach the
255         * end of it.
256         */
257        int yy_fill_buffer;
258
259        int yy_buffer_status;
260
261#define YY_BUFFER_NEW 0
262#define YY_BUFFER_NORMAL 1
263        /* When an EOF's been seen but there's still some text to process
264         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
265         * shouldn't try reading from the input source any more.  We might
266         * still have a bunch of tokens to match, though, because of
267         * possible backing-up.
268         *
269         * When we actually see the EOF, we change the status to "new"
270         * (via libconfig_yyrestart()), so that the user can continue scanning by
271         * just pointing yyin at a new input file.
272         */
273#define YY_BUFFER_EOF_PENDING 2
274
275        };
276#endif /* !YY_STRUCT_YY_BUFFER_STATE */
277
278/* We provide macros for accessing buffer states in case in the
279 * future we want to put the buffer states in a more general
280 * "scanner state".
281 *
282 * Returns the top of the stack, or NULL.
283 */
284#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
285                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
286                          : NULL)
287
288/* Same as previous macro, but useful when we know that the buffer stack is not
289 * NULL or when we need an lvalue. For internal use only.
290 */
291#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
292
293void libconfig_yyrestart (FILE *input_file ,yyscan_t yyscanner );
294void libconfig_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
295YY_BUFFER_STATE libconfig_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
296void libconfig_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
297void libconfig_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
298void libconfig_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
299void libconfig_yypop_buffer_state (yyscan_t yyscanner );
300
301static void libconfig_yyensure_buffer_stack (yyscan_t yyscanner );
302static void libconfig_yy_load_buffer_state (yyscan_t yyscanner );
303static void libconfig_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
304
305#define YY_FLUSH_BUFFER libconfig_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
306
307YY_BUFFER_STATE libconfig_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
308YY_BUFFER_STATE libconfig_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
309YY_BUFFER_STATE libconfig_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
310
311void *libconfig_yyalloc (yy_size_t ,yyscan_t yyscanner );
312void *libconfig_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
313void libconfig_yyfree (void * ,yyscan_t yyscanner );
314
315#define yy_new_buffer libconfig_yy_create_buffer
316
317#define yy_set_interactive(is_interactive) \
318        { \
319        if ( ! YY_CURRENT_BUFFER ){ \
320        libconfig_yyensure_buffer_stack (yyscanner); \
321                YY_CURRENT_BUFFER_LVALUE =    \
322            libconfig_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
323        } \
324        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
325        }
326
327#define yy_set_bol(at_bol) \
328        { \
329        if ( ! YY_CURRENT_BUFFER ){\
330        libconfig_yyensure_buffer_stack (yyscanner); \
331                YY_CURRENT_BUFFER_LVALUE =    \
332            libconfig_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
333        } \
334        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
335        }
336
337#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
338
339#define libconfig_yywrap(n) 1
340#define YY_SKIP_YYWRAP
341
342typedef unsigned char YY_CHAR;
343
344typedef int yy_state_type;
345
346#define yytext_ptr yytext_r
347
348static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
349static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
350static int yy_get_next_buffer (yyscan_t yyscanner );
351static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
352
353/* Done after the current pattern has been matched and before the
354 * corresponding action - sets up yytext.
355 */
356#define YY_DO_BEFORE_ACTION \
357        yyg->yytext_ptr = yy_bp; \
358        yyleng = (size_t) (yy_cp - yy_bp); \
359        yyg->yy_hold_char = *yy_cp; \
360        *yy_cp = '\0'; \
361        yyg->yy_c_buf_p = yy_cp;
362
363#define YY_NUM_RULES 26
364#define YY_END_OF_BUFFER 27
365/* This struct is not used in this scanner,
366   but its presence is necessary. */
367struct yy_trans_info
368        {
369        flex_int32_t yy_verify;
370        flex_int32_t yy_nxt;
371        };
372static yyconst flex_int16_t yy_accept[117] =
373    {   0,
374        0,    0,    0,    0,   27,   25,    5,    5,   25,   25,
375       21,   22,   12,   25,    7,   13,   25,   14,   14,    6,
376       23,   12,   12,   19,   20,    8,    9,    3,    4,    3,
377        5,    0,   18,    0,    0,   24,   12,   13,   14,   13,
378        0,    1,    0,   13,    0,   15,    0,   12,   12,    2,
379        0,    0,    0,    0,    0,   13,   13,    0,    0,   13,
380       15,   16,   12,   12,    0,   18,    0,    0,    0,    0,
381        0,   13,   17,   12,   10,    0,    0,   17,   11,    0,
382        0,    0,    0,    0,    0,   18,    0,    0,    0,    0,
383        0,    0,    0,    0,   18,    0,    0,    0,    0,    0,
384
385        0,    0,    0,   18,    0,    0,    0,    0,    0,    0,
386        0,   18,    0,    0,    0,    0
387    } ;
388
389static yyconst flex_int32_t yy_ec[256] =
390    {   0,
391        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
392        1,    2,    2,    1,    1,    1,    1,    1,    1,    1,
393        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
394        1,    2,    1,    4,    5,    1,    1,    1,    1,    6,
395        7,    8,    9,   10,   11,   12,   13,   14,   15,   15,
396       15,   15,   15,   15,   15,   15,   15,   16,   17,    1,
397       18,    1,    1,    1,   19,   20,   20,   20,   21,   22,
398       23,   23,   23,   23,   23,   24,   23,   23,   23,   23,
399       23,   25,   26,   27,   28,   23,   23,   29,   23,   23,
400       30,   31,   32,    1,   33,    1,   19,   20,   20,   20,
401
402       21,   22,   23,   23,   23,   23,   23,   34,   23,   23,
403       23,   23,   23,   25,   26,   27,   28,   23,   23,   29,
404       23,   23,   35,    1,   36,    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,    1,    1,    1,    1,    1,
409        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
410        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
411        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
412
413        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
414        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
415        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
416        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
417        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
418        1,    1,    1,    1,    1
419    } ;
420
421static yyconst flex_int32_t yy_meta[37] =
422    {   0,
423        1,    1,    1,    1,    1,    1,    1,    2,    1,    1,
424        2,    1,    1,    3,    3,    1,    1,    1,    3,    3,
425        3,    3,    2,    2,    2,    2,    2,    2,    2,    1,
426        1,    1,    2,    2,    1,    1
427    } ;
428
429static yyconst flex_int16_t yy_base[128] =
430    {   0,
431        0,    0,   34,   35,  199,  503,   37,   42,   37,  195,
432      503,  503,    0,   34,  503,   36,   39,   57,   41,  503,
433      503,  163,  150,  503,  503,  503,  503,  503,  503,  152,
434       56,   56,   71,  160,  151,  503,    0,   49,   68,   76,
435       84,  503,  150,   86,   94,  128,    0,   43,  118,  503,
436      108,   57,  125,  106,  101,  103,  108,  116,  118,  120,
437      503,  102,   98,   99,   75,  134,  101,   99,  138,   88,
438      130,  134,   70,   64,    0,   58,  142,  503,    0,  154,
439      166,  156,  158,  164,  172,  202,  177,  170,  180,  181,
440      178,  214,  244,  256,  286,  189,  220,  316,  328,  192,
441
442      206,  218,  231,  340,  262,  222,  264,  229,  352,  382,
443      412,  442,  270,  294,  358,  503,  473,  476,  479,  481,
444       51,  484,  487,  490,  493,  496,  499
445    } ;
446
447static yyconst flex_int16_t yy_def[128] =
448    {   0,
449      116,    1,  117,  117,  116,  116,  116,  116,  118,  119,
450      116,  116,  120,  116,  116,  116,  116,  116,  116,  116,
451      116,  120,  120,  116,  116,  116,  116,  116,  116,  116,
452      116,  118,  116,  118,  119,  116,  120,  116,  116,  116,
453      116,  116,  119,  116,  116,  116,  121,  120,  120,  116,
454      116,  122,  123,  116,  116,  116,  116,  116,  116,  116,
455      116,  121,  120,  120,  122,  116,  122,  123,  116,  124,
456      116,  116,  116,  120,  120,  124,  124,  116,  120,  124,
457      124,  125,  126,  124,  125,  124,  125,  125,  126,  126,
458      124,  125,  126,  125,  125,  127,  125,  126,  124,  127,
459
460      126,  126,  127,  126,  127,  127,  125,  126,  127,  127,
461      125,  127,  127,  127,  127,    0,  116,  116,  116,  116,
462      116,  116,  116,  116,  116,  116,  116
463    } ;
464
465static yyconst flex_int16_t yy_nxt[540] =
466    {   0,
467        6,    7,    8,    9,   10,   11,   12,   13,   14,   15,
468       14,   16,   17,   18,   19,   20,   21,   20,   13,   13,
469       13,   22,   13,   13,   13,   13,   23,   13,   13,   24,
470        6,   25,    6,   13,   26,   27,   29,   29,   31,   31,
471       33,   30,   30,   31,   31,   38,   42,   39,   39,   40,
472       40,   43,   44,   62,   39,   39,   41,   31,   31,   33,
473       66,   45,   40,   40,   46,   77,   63,   34,   44,   41,
474       39,   39,   51,   51,   52,   53,   63,   45,   66,   44,
475       46,   39,   39,   54,   79,   47,   34,   67,   45,   40,
476       40,   46,   55,   78,   55,   77,   41,   56,   56,   57,
477
478       57,   69,   59,  116,   59,   67,   58,   60,   60,   51,
479       51,   52,   53,   70,   56,   56,   56,   56,   53,   75,
480       54,   57,   57,   74,   71,   73,   71,   69,   58,   72,
481       72,   60,   60,   60,   60,   51,   51,   52,   53,   51,
482       51,   52,   53,   72,   72,   64,   54,   72,   72,   77,
483       54,   61,   36,   36,   80,   81,   81,   82,   83,   86,
484       80,   77,  116,   87,   50,   90,   84,   81,   81,   82,
485       83,   91,   76,   77,   49,   86,   83,   87,   84,   87,
486       86,   48,   80,   80,   87,   77,   88,   90,   90,   92,
487       80,   92,  104,   93,   92,  104,  105,   36,  116,  105,
488
489      116,  116,   88,   81,   81,   82,   83,   88,   80,   77,
490      116,  116,  116,   90,   84,   94,   94,   95,   96,  106,
491       80,   87,  106,   86,   80,  108,   97,  107,  116,  105,
492      101,   80,   96,   92,  104,  116,   90,  116,  105,  116,
493      116,   93,  116,  116,   88,   98,   99,  100,  101,  116,
494       88,   90,  116,  116,  116,  116,  102,   94,   94,   95,
495       96,  106,  116,   87,   92,  104,  116,   86,   97,  105,
496      116,   87,   92,  104,  109,  116,   92,  105,  116,  116,
497      116,  116,  116,  116,  116,  116,   88,   94,   94,   95,
498       96,  116,  106,   87,   88,  116,   92,  104,   97,  116,
499
500      106,  115,  116,  116,  116,  116,  113,  116,  116,  116,
501      116,  116,  116,  116,  116,  116,   88,   98,   99,  100,
502      101,  116,  116,   90,  106,  116,  116,  116,  102,   81,
503       81,   82,   83,  116,  116,   77,  116,  116,  116,  116,
504       84,   98,   99,  100,  101,  116,  116,   90,  116,  116,
505      116,  116,  102,  110,  111,  112,  113,  116,  116,  105,
506       92,  104,  116,  116,  114,  105,  116,  116,  116,  116,
507      109,  116,  116,  116,  116,  116,  116,  116,  116,  116,
508      116,  116,  106,  110,  111,  112,  113,  116,  106,  105,
509      116,  116,  116,  116,  114,  116,  116,  116,  116,  116,
510
511      116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
512      116,  116,  106,   94,   94,   95,   96,  116,  116,   87,
513      116,  116,  116,  116,   97,  116,  116,  116,  116,  116,
514      116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
515      116,  116,   88,  110,  111,  112,  113,  116,  116,  105,
516      116,  116,  116,  116,  114,  116,  116,  116,  116,  116,
517      116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
518      116,  116,  106,   28,   28,   28,   32,   32,   32,   35,
519       35,   35,   37,   37,   65,   65,   65,   68,   68,   68,
520       76,   76,   76,   85,   85,   85,   89,   89,   89,  103,
521
522      103,  103,    5,  116,  116,  116,  116,  116,  116,  116,
523      116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
524      116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
525      116,  116,  116,  116,  116,  116,  116,  116,  116
526    } ;
527
528static yyconst flex_int16_t yy_chk[540] =
529    {   0,
530        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
531        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
532        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
533        1,    1,    1,    1,    1,    1,    3,    4,    7,    7,
534        9,    3,    4,    8,    8,   14,   17,   14,   14,   16,
535       16,   17,   19,  121,   19,   19,   16,   31,   31,   32,
536       52,   19,   38,   38,   19,   76,   48,    9,   18,   38,
537       18,   18,   33,   33,   33,   33,   48,   18,   65,   39,
538       18,   39,   39,   33,   74,   18,   32,   52,   39,   40,
539       40,   39,   41,   73,   41,   70,   40,   41,   41,   44,
540
541       44,   68,   45,   67,   45,   65,   44,   45,   45,   51,
542       51,   51,   51,   54,   55,   55,   56,   56,   54,   64,
543       51,   57,   57,   63,   58,   62,   58,   53,   57,   58,
544       58,   59,   59,   60,   60,   66,   66,   66,   66,   69,
545       69,   69,   69,   71,   71,   49,   66,   72,   72,   77,
546       69,   46,   43,   35,   77,   80,   80,   80,   80,   82,
547       83,   80,   34,   82,   30,   83,   80,   81,   81,   81,
548       81,   84,   88,   81,   23,   85,   84,   88,   81,   85,
549       87,   22,   89,   90,   87,   91,   82,   89,   90,   87,
550       91,   96,   96,   90,  100,  100,   96,   10,    5,  100,
551
552        0,    0,   85,   86,   86,   86,   86,   87,  101,   86,
553        0,    0,    0,  101,   86,   92,   92,   92,   92,   96,
554      102,   92,  100,   97,  106,  102,   92,   97,    0,  106,
555      102,  108,   97,  103,  103,    0,  108,    0,  103,    0,
556        0,  108,    0,    0,   92,   93,   93,   93,   93,    0,
557       97,   93,    0,    0,    0,    0,   93,   94,   94,   94,
558       94,  103,    0,   94,  105,  105,    0,  107,   94,  105,
559        0,  107,  113,  113,  105,    0,  107,  113,    0,    0,
560        0,    0,    0,    0,    0,    0,   94,   95,   95,   95,
561       95,    0,  105,   95,  107,    0,  114,  114,   95,    0,
562
563      113,  114,    0,    0,    0,    0,  114,    0,    0,    0,
564        0,    0,    0,    0,    0,    0,   95,   98,   98,   98,
565       98,    0,    0,   98,  114,    0,    0,    0,   98,   99,
566       99,   99,   99,    0,    0,   99,    0,    0,    0,    0,
567       99,  104,  104,  104,  104,    0,    0,  104,    0,    0,
568        0,    0,  104,  109,  109,  109,  109,    0,    0,  109,
569      115,  115,    0,    0,  109,  115,    0,    0,    0,    0,
570      115,    0,    0,    0,    0,    0,    0,    0,    0,    0,
571        0,    0,  109,  110,  110,  110,  110,    0,  115,  110,
572        0,    0,    0,    0,  110,    0,    0,    0,    0,    0,
573
574        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
575        0,    0,  110,  111,  111,  111,  111,    0,    0,  111,
576        0,    0,    0,    0,  111,    0,    0,    0,    0,    0,
577        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
578        0,    0,  111,  112,  112,  112,  112,    0,    0,  112,
579        0,    0,    0,    0,  112,    0,    0,    0,    0,    0,
580        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
581        0,    0,  112,  117,  117,  117,  118,  118,  118,  119,
582      119,  119,  120,  120,  122,  122,  122,  123,  123,  123,
583      124,  124,  124,  125,  125,  125,  126,  126,  126,  127,
584
585      127,  127,  116,  116,  116,  116,  116,  116,  116,  116,
586      116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
587      116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
588      116,  116,  116,  116,  116,  116,  116,  116,  116
589    } ;
590
591/* Table of booleans, true if rule could match eol. */
592static yyconst flex_int32_t yy_rule_can_match_eol[27] =
593    {   0,
5940, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 
595    0, 0, 0, 0, 0, 0, 0,     };
596
597/* The intent behind this definition is that it'll catch
598 * any uses of REJECT which flex missed.
599 */
600#define REJECT reject_used_but_not_detected
601#define yymore() yymore_used_but_not_detected
602#define YY_MORE_ADJ 0
603#define YY_RESTORE_YY_MORE_OFFSET
604#line 1 "scanner.l"
605/* -*- mode: C -*- */
606/* --------------------------------------------------------------------------
607   libconfig - A library for processing structured configuration files
608   Copyright (C) 2005-2008  Mark A Lindner
609 
610   This file is part of libconfig.
611   
612   This library is free software; you can redistribute it and/or
613   modify it under the terms of the GNU Lesser General Public License
614   as published by the Free Software Foundation; either version 2.1 of
615   the License, or (at your option) any later version.
616   
617   This library is distributed in the hope that it will be useful, but
618   WITHOUT ANY WARRANTY; without even the implied warranty of
619   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
620   Lesser General Public License for more details.
621   
622   You should have received a copy of the GNU Library General Public
623   License along with this library; if not, see
624   <http://www.gnu.org/licenses/>.
625   ----------------------------------------------------------------------------
626*/
627#line 25 "scanner.l"
628#define YY_EXTRA_TYPE void*
629#define YY_NO_UNISTD_H 1
630#line 38 "scanner.l"
631
632#ifdef _MSC_VER
633#pragma warning (disable: 4996)
634#endif
635
636#include <stdlib.h>
637#include <ctype.h>
638#include <string.h>
639#include "grammar.h"
640#include "wincompat.h"
641
642/* this is somewhat kludgy, but I wanted to avoid building strings
643  dynamically during scanning */
644
645static char *make_string(char *s)
646{
647  char *r = ++s;
648  char *p, *q = r;
649  size_t len = strlen(r);
650  int esc = 0;
651
652  *(r + --len) = 0;
653
654  for(p = r; *p; p++)
655  {
656    if(*p == '\\')
657    {
658      if(! esc)
659      {
660        esc = 1;
661        continue;
662      }
663    }
664     
665    if(esc)
666    {
667      if(*p == 'n')
668        *(q++) = '\n';
669      else if(*p == 'r')
670        *(q++) = '\r';
671      else if(*p == 'f')
672        *(q++) = '\f';
673      else if(*p == 't')
674        *(q++) = '\t';
675      else
676        *(q++) = *p;
677
678      esc = 0;
679    }
680   
681    else if(*p == '\"') /* if we reached the end of a string segment, ... */
682    {
683       /* This construction allows for C-style string concatenation.
684          We don't bother to check for end-of-string here, as we depend
685          on the {string} definition to ensure a new opening quote exists.
686          We do, however, check for and discard all forms of comments
687          [that is, (#...$|//...$|[/][*]...[*][/])] between string segments. */
688
689      while (*++p != '\"') /* ... look for the start of the next segment */
690      {
691        if(*p == '#') /* check for #...$ comment */
692        {
693          while(*++p != '\n') 
694          {
695            /* skip the rest of the line */
696          }
697        }
698        else if (*p == '/')
699        {
700          if(*++p == '/') /* check for //...$ comment */
701          {
702            while (*++p != '\n') 
703            {
704              /* skip the rest of the line */
705            }
706          }
707          else /* must be '*', lead-in to an old C-style comment */
708          {
709            while (*++p != '*' || *(p+1) != '/')
710            {
711              /* skip all comment content */
712            }
713            ++p; /* step to the trailing slash, to skip it as well */
714          }
715        }
716      }
717    }
718    else
719      *(q++) = *p;
720  }
721
722  *q = 0;
723
724  return(r);
725}
726
727static unsigned long long fromhex(const char *s)
728{
729#ifdef __MINGW32__
730
731  // MinGW's strtoull() seems to be broken; it only returns the lower
732  // 32 bits...
733
734  const char *p = s;
735  unsigned long long val = 0;
736
737  if(*p != '0')
738    return(0);
739
740  ++p;
741
742  if(*p != 'x' && *p != 'X')
743    return(0);
744
745  for(++p; isxdigit(*p); ++p)
746  {
747    val <<= 4;
748    val |= ((*p < 'A') ? (*p & 0xF) : (9 + (*p & 0x7)));
749  }
750 
751  return(val); 
752
753#else // ! __MINGW32__
754
755  return(strtoull(s, NULL, 16));
756 
757#endif // __MINGW32__
758}
759
760
761#line 762 "scanner.c"
762
763#define INITIAL 0
764#define COMMENT 1
765
766#ifndef YY_NO_UNISTD_H
767/* Special case for "unistd.h", since it is non-ANSI. We include it way
768 * down here because we want the user's section 1 to have been scanned first.
769 * The user has a chance to override it with an option.
770 */
771#include <unistd.h>
772#endif
773
774#ifndef YY_EXTRA_TYPE
775#define YY_EXTRA_TYPE void *
776#endif
777
778/* Holds the entire state of the reentrant scanner. */
779struct yyguts_t
780    {
781
782    /* User-defined. Not touched by flex. */
783    YY_EXTRA_TYPE yyextra_r;
784
785    /* The rest are the same as the globals declared in the non-reentrant scanner. */
786    FILE *yyin_r, *yyout_r;
787    size_t yy_buffer_stack_top; /**< index of top of stack. */
788    size_t yy_buffer_stack_max; /**< capacity of stack. */
789    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
790    char yy_hold_char;
791    int yy_n_chars;
792    int yyleng_r;
793    char *yy_c_buf_p;
794    int yy_init;
795    int yy_start;
796    int yy_did_buffer_switch_on_eof;
797    int yy_start_stack_ptr;
798    int yy_start_stack_depth;
799    int *yy_start_stack;
800    yy_state_type yy_last_accepting_state;
801    char* yy_last_accepting_cpos;
802
803    int yylineno_r;
804    int yy_flex_debug_r;
805
806    char *yytext_r;
807    int yy_more_flag;
808    int yy_more_len;
809
810    YYSTYPE * yylval_r;
811
812    }; /* end struct yyguts_t */
813
814static int yy_init_globals (yyscan_t yyscanner );
815
816    /* This must go here because YYSTYPE and YYLTYPE are included
817     * from bison output in section 1.*/
818    #    define yylval yyg->yylval_r
819   
820int libconfig_yylex_init (yyscan_t* scanner);
821
822int libconfig_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
823
824/* Accessor methods to globals.
825   These are made visible to non-reentrant scanners for convenience. */
826
827int libconfig_yylex_destroy (yyscan_t yyscanner );
828
829int libconfig_yyget_debug (yyscan_t yyscanner );
830
831void libconfig_yyset_debug (int debug_flag ,yyscan_t yyscanner );
832
833YY_EXTRA_TYPE libconfig_yyget_extra (yyscan_t yyscanner );
834
835void libconfig_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
836
837FILE *libconfig_yyget_in (yyscan_t yyscanner );
838
839void libconfig_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
840
841FILE *libconfig_yyget_out (yyscan_t yyscanner );
842
843void libconfig_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
844
845int libconfig_yyget_leng (yyscan_t yyscanner );
846
847char *libconfig_yyget_text (yyscan_t yyscanner );
848
849int libconfig_yyget_lineno (yyscan_t yyscanner );
850
851void libconfig_yyset_lineno (int line_number ,yyscan_t yyscanner );
852
853YYSTYPE * libconfig_yyget_lval (yyscan_t yyscanner );
854
855void libconfig_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
856
857/* Macros after this point can all be overridden by user definitions in
858 * section 1.
859 */
860
861#ifndef YY_SKIP_YYWRAP
862#ifdef __cplusplus
863extern "C" int libconfig_yywrap (yyscan_t yyscanner );
864#else
865extern int libconfig_yywrap (yyscan_t yyscanner );
866#endif
867#endif
868
869#ifndef yytext_ptr
870static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
871#endif
872
873#ifdef YY_NEED_STRLEN
874static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
875#endif
876
877#ifndef YY_NO_INPUT
878
879#ifdef __cplusplus
880static int yyinput (yyscan_t yyscanner );
881#else
882static int input (yyscan_t yyscanner );
883#endif
884
885#endif
886
887/* Amount of stuff to slurp up with each read. */
888#ifndef YY_READ_BUF_SIZE
889#define YY_READ_BUF_SIZE 8192
890#endif
891
892/* Copy whatever the last rule matched to the standard output. */
893#ifndef ECHO
894/* This used to be an fputs(), but since the string might contain NUL's,
895 * we now use fwrite().
896 */
897#define ECHO fwrite( yytext, yyleng, 1, yyout )
898#endif
899
900/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
901 * is returned in "result".
902 */
903#ifndef YY_INPUT
904#define YY_INPUT(buf,result,max_size) \
905        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
906                { \
907                int c = '*'; \
908                unsigned n; \
909                for ( n = 0; n < max_size && \
910                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
911                        buf[n] = (char) c; \
912                if ( c == '\n' ) \
913                        buf[n++] = (char) c; \
914                if ( c == EOF && ferror( yyin ) ) \
915                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
916                result = n; \
917                } \
918        else \
919                { \
920                errno=0; \
921                while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
922                        { \
923                        if( errno != EINTR) \
924                                { \
925                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
926                                break; \
927                                } \
928                        errno=0; \
929                        clearerr(yyin); \
930                        } \
931                }\
932\
933
934#endif
935
936/* No semi-colon after return; correct usage is to write "yyterminate();" -
937 * we don't want an extra ';' after the "return" because that will cause
938 * some compilers to complain about unreachable statements.
939 */
940#ifndef yyterminate
941#define yyterminate() return YY_NULL
942#endif
943
944/* Number of entries by which start-condition stack grows. */
945#ifndef YY_START_STACK_INCR
946#define YY_START_STACK_INCR 25
947#endif
948
949/* Report a fatal error. */
950#ifndef YY_FATAL_ERROR
951#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
952#endif
953
954/* end tables serialization structures and prototypes */
955
956/* Default declaration of generated scanner - a define so the user can
957 * easily add parameters.
958 */
959#ifndef YY_DECL
960#define YY_DECL_IS_OURS 1
961
962extern int libconfig_yylex \
963               (YYSTYPE * yylval_param ,yyscan_t yyscanner);
964
965#define YY_DECL int libconfig_yylex \
966               (YYSTYPE * yylval_param , yyscan_t yyscanner)
967#endif /* !YY_DECL */
968
969/* Code executed at the beginning of each rule, after yytext and yyleng
970 * have been set up.
971 */
972#ifndef YY_USER_ACTION
973#define YY_USER_ACTION
974#endif
975
976/* Code executed at the end of each rule. */
977#ifndef YY_BREAK
978#define YY_BREAK break;
979#endif
980
981#define YY_RULE_SETUP \
982        YY_USER_ACTION
983
984/** The main scanner function which does all the work.
985 */
986YY_DECL
987{
988        register yy_state_type yy_current_state;
989        register char *yy_cp, *yy_bp;
990        register int yy_act;
991    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
992
993#line 194 "scanner.l"
994
995
996#line 997 "scanner.c"
997
998    yylval = yylval_param;
999
1000        if ( !yyg->yy_init )
1001                {
1002                yyg->yy_init = 1;
1003
1004#ifdef YY_USER_INIT
1005                YY_USER_INIT;
1006#endif
1007
1008                if ( ! yyg->yy_start )
1009                        yyg->yy_start = 1;      /* first start state */
1010
1011                if ( ! yyin )
1012                        yyin = stdin;
1013
1014                if ( ! yyout )
1015                        yyout = stdout;
1016
1017                if ( ! YY_CURRENT_BUFFER ) {
1018                        libconfig_yyensure_buffer_stack (yyscanner);
1019                        YY_CURRENT_BUFFER_LVALUE =
1020                                libconfig_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1021                }
1022
1023                libconfig_yy_load_buffer_state(yyscanner );
1024                }
1025
1026        while ( 1 )             /* loops until end-of-file is reached */
1027                {
1028                yy_cp = yyg->yy_c_buf_p;
1029
1030                /* Support of yytext. */
1031                *yy_cp = yyg->yy_hold_char;
1032
1033                /* yy_bp points to the position in yy_ch_buf of the start of
1034                 * the current run.
1035                 */
1036                yy_bp = yy_cp;
1037
1038                yy_current_state = yyg->yy_start;
1039yy_match:
1040                do
1041                        {
1042                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1043                        if ( yy_accept[yy_current_state] )
1044                                {
1045                                yyg->yy_last_accepting_state = yy_current_state;
1046                                yyg->yy_last_accepting_cpos = yy_cp;
1047                                }
1048                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1049                                {
1050                                yy_current_state = (int) yy_def[yy_current_state];
1051                                if ( yy_current_state >= 117 )
1052                                        yy_c = yy_meta[(unsigned int) yy_c];
1053                                }
1054                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1055                        ++yy_cp;
1056                        }
1057                while ( yy_base[yy_current_state] != 503 );
1058
1059yy_find_action:
1060                yy_act = yy_accept[yy_current_state];
1061                if ( yy_act == 0 )
1062                        { /* have to back up */
1063                        yy_cp = yyg->yy_last_accepting_cpos;
1064                        yy_current_state = yyg->yy_last_accepting_state;
1065                        yy_act = yy_accept[yy_current_state];
1066                        }
1067
1068                YY_DO_BEFORE_ACTION;
1069
1070                if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1071                        {
1072                        int yyl;
1073                        for ( yyl = 0; yyl < yyleng; ++yyl )
1074                                if ( yytext[yyl] == '\n' )
1075                                           
1076    do{ yylineno++;
1077        yycolumn=0;
1078    }while(0)
1079;
1080                        }
1081
1082do_action:      /* This label is used only to access EOF actions. */
1083
1084                switch ( yy_act )
1085        { /* beginning of action switch */
1086                        case 0: /* must back up */
1087                        /* undo the effects of YY_DO_BEFORE_ACTION */
1088                        *yy_cp = yyg->yy_hold_char;
1089                        yy_cp = yyg->yy_last_accepting_cpos;
1090                        yy_current_state = yyg->yy_last_accepting_state;
1091                        goto yy_find_action;
1092
1093case 1:
1094YY_RULE_SETUP
1095#line 196 "scanner.l"
1096{ BEGIN COMMENT; }
1097        YY_BREAK
1098case 2:
1099YY_RULE_SETUP
1100#line 197 "scanner.l"
1101{ BEGIN INITIAL; }
1102        YY_BREAK
1103case 3:
1104YY_RULE_SETUP
1105#line 198 "scanner.l"
1106{ /* ignore */ }
1107        YY_BREAK
1108case 4:
1109/* rule 4 can match eol */
1110YY_RULE_SETUP
1111#line 199 "scanner.l"
1112{  }
1113        YY_BREAK
1114case 5:
1115/* rule 5 can match eol */
1116YY_RULE_SETUP
1117#line 201 "scanner.l"
1118{ /* skip */ }
1119        YY_BREAK
1120case 6:
1121YY_RULE_SETUP
1122#line 203 "scanner.l"
1123{ return(TOK_EQUALS); }
1124        YY_BREAK
1125case 7:
1126YY_RULE_SETUP
1127#line 204 "scanner.l"
1128{ return(TOK_COMMA); }
1129        YY_BREAK
1130case 8:
1131YY_RULE_SETUP
1132#line 205 "scanner.l"
1133{ return(TOK_GROUP_START); }
1134        YY_BREAK
1135case 9:
1136YY_RULE_SETUP
1137#line 206 "scanner.l"
1138{ return(TOK_GROUP_END); }
1139        YY_BREAK
1140case 10:
1141YY_RULE_SETUP
1142#line 207 "scanner.l"
1143{ yylval->ival = 1; return(TOK_BOOLEAN); }
1144        YY_BREAK
1145case 11:
1146YY_RULE_SETUP
1147#line 208 "scanner.l"
1148{ yylval->ival = 0; return(TOK_BOOLEAN); }
1149        YY_BREAK
1150case 12:
1151YY_RULE_SETUP
1152#line 209 "scanner.l"
1153{ yylval->sval = strdup(yytext); return(TOK_NAME); }
1154        YY_BREAK
1155case 13:
1156YY_RULE_SETUP
1157#line 210 "scanner.l"
1158{ yylval->fval = atof(yytext); return(TOK_FLOAT); }
1159        YY_BREAK
1160case 14:
1161YY_RULE_SETUP
1162#line 211 "scanner.l"
1163{ yylval->ival = atoi(yytext); return(TOK_INTEGER); }
1164        YY_BREAK
1165case 15:
1166YY_RULE_SETUP
1167#line 212 "scanner.l"
1168{ yylval->llval = atoll(yytext); return(TOK_INTEGER64); }
1169        YY_BREAK
1170case 16:
1171YY_RULE_SETUP
1172#line 213 "scanner.l"
1173{ yylval->ival = strtoul(yytext, NULL, 16); return(TOK_HEX); }
1174        YY_BREAK
1175case 17:
1176YY_RULE_SETUP
1177#line 214 "scanner.l"
1178{ yylval->llval = fromhex(yytext); return(TOK_HEX64); }
1179        YY_BREAK
1180case 18:
1181/* rule 18 can match eol */
1182YY_RULE_SETUP
1183#line 215 "scanner.l"
1184{ yylval->sval = strdup(make_string(yytext)); return(TOK_STRING); }
1185        YY_BREAK
1186case 19:
1187YY_RULE_SETUP
1188#line 216 "scanner.l"
1189{ return(TOK_ARRAY_START); }
1190        YY_BREAK
1191case 20:
1192YY_RULE_SETUP
1193#line 217 "scanner.l"
1194{ return(TOK_ARRAY_END); }
1195        YY_BREAK
1196case 21:
1197YY_RULE_SETUP
1198#line 218 "scanner.l"
1199{ return(TOK_LIST_START); }
1200        YY_BREAK
1201case 22:
1202YY_RULE_SETUP
1203#line 219 "scanner.l"
1204{ return(TOK_LIST_END); }
1205        YY_BREAK
1206case 23:
1207YY_RULE_SETUP
1208#line 220 "scanner.l"
1209{ return(TOK_END); }
1210        YY_BREAK
1211case 24:
1212*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1213yyg->yy_c_buf_p = yy_cp -= 1;
1214YY_DO_BEFORE_ACTION; /* set up yytext again */
1215YY_RULE_SETUP
1216#line 221 "scanner.l"
1217{ /* ignore */ }
1218        YY_BREAK
1219case 25:
1220YY_RULE_SETUP
1221#line 222 "scanner.l"
1222{ return(TOK_GARBAGE); }
1223        YY_BREAK
1224case 26:
1225YY_RULE_SETUP
1226#line 223 "scanner.l"
1227ECHO;
1228        YY_BREAK
1229#line 1230 "scanner.c"
1230case YY_STATE_EOF(INITIAL):
1231case YY_STATE_EOF(COMMENT):
1232        yyterminate();
1233
1234        case YY_END_OF_BUFFER:
1235                {
1236                /* Amount of text matched not including the EOB char. */
1237                int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1238
1239                /* Undo the effects of YY_DO_BEFORE_ACTION. */
1240                *yy_cp = yyg->yy_hold_char;
1241                YY_RESTORE_YY_MORE_OFFSET
1242
1243                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1244                        {
1245                        /* We're scanning a new file or input source.  It's
1246                         * possible that this happened because the user
1247                         * just pointed yyin at a new source and called
1248                         * libconfig_yylex().  If so, then we have to assure
1249                         * consistency between YY_CURRENT_BUFFER and our
1250                         * globals.  Here is the right place to do so, because
1251                         * this is the first action (other than possibly a
1252                         * back-up) that will match for the new input source.
1253                         */
1254                        yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1255                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1256                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1257                        }
1258
1259                /* Note that here we test for yy_c_buf_p "<=" to the position
1260                 * of the first EOB in the buffer, since yy_c_buf_p will
1261                 * already have been incremented past the NUL character
1262                 * (since all states make transitions on EOB to the
1263                 * end-of-buffer state).  Contrast this with the test
1264                 * in input().
1265                 */
1266                if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1267                        { /* This was really a NUL. */
1268                        yy_state_type yy_next_state;
1269
1270                        yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1271
1272                        yy_current_state = yy_get_previous_state( yyscanner );
1273
1274                        /* Okay, we're now positioned to make the NUL
1275                         * transition.  We couldn't have
1276                         * yy_get_previous_state() go ahead and do it
1277                         * for us because it doesn't know how to deal
1278                         * with the possibility of jamming (and we don't
1279                         * want to build jamming into it because then it
1280                         * will run more slowly).
1281                         */
1282
1283                        yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1284
1285                        yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1286
1287                        if ( yy_next_state )
1288                                {
1289                                /* Consume the NUL. */
1290                                yy_cp = ++yyg->yy_c_buf_p;
1291                                yy_current_state = yy_next_state;
1292                                goto yy_match;
1293                                }
1294
1295                        else
1296                                {
1297                                yy_cp = yyg->yy_c_buf_p;
1298                                goto yy_find_action;
1299                                }
1300                        }
1301
1302                else switch ( yy_get_next_buffer( yyscanner ) )
1303                        {
1304                        case EOB_ACT_END_OF_FILE:
1305                                {
1306                                yyg->yy_did_buffer_switch_on_eof = 0;
1307
1308                                if ( libconfig_yywrap(yyscanner ) )
1309                                        {
1310                                        /* Note: because we've taken care in
1311                                         * yy_get_next_buffer() to have set up
1312                                         * yytext, we can now set up
1313                                         * yy_c_buf_p so that if some total
1314                                         * hoser (like flex itself) wants to
1315                                         * call the scanner after we return the
1316                                         * YY_NULL, it'll still work - another
1317                                         * YY_NULL will get returned.
1318                                         */
1319                                        yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1320
1321                                        yy_act = YY_STATE_EOF(YY_START);
1322                                        goto do_action;
1323                                        }
1324
1325                                else
1326                                        {
1327                                        if ( ! yyg->yy_did_buffer_switch_on_eof )
1328                                                YY_NEW_FILE;
1329                                        }
1330                                break;
1331                                }
1332
1333                        case EOB_ACT_CONTINUE_SCAN:
1334                                yyg->yy_c_buf_p =
1335                                        yyg->yytext_ptr + yy_amount_of_matched_text;
1336
1337                                yy_current_state = yy_get_previous_state( yyscanner );
1338
1339                                yy_cp = yyg->yy_c_buf_p;
1340                                yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1341                                goto yy_match;
1342
1343                        case EOB_ACT_LAST_MATCH:
1344                                yyg->yy_c_buf_p =
1345                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1346
1347                                yy_current_state = yy_get_previous_state( yyscanner );
1348
1349                                yy_cp = yyg->yy_c_buf_p;
1350                                yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1351                                goto yy_find_action;
1352                        }
1353                break;
1354                }
1355
1356        default:
1357                YY_FATAL_ERROR(
1358                        "fatal flex scanner internal error--no action found" );
1359        } /* end of action switch */
1360                } /* end of scanning one token */
1361} /* end of libconfig_yylex */
1362
1363/* yy_get_next_buffer - try to read in a new buffer
1364 *
1365 * Returns a code representing an action:
1366 *      EOB_ACT_LAST_MATCH -
1367 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1368 *      EOB_ACT_END_OF_FILE - end of file
1369 */
1370static int yy_get_next_buffer (yyscan_t yyscanner)
1371{
1372    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1373        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1374        register char *source = yyg->yytext_ptr;
1375        register int number_to_move, i;
1376        int ret_val;
1377
1378        if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1379                YY_FATAL_ERROR(
1380                "fatal flex scanner internal error--end of buffer missed" );
1381
1382        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1383                { /* Don't try to fill the buffer, so this is an EOF. */
1384                if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1385                        {
1386                        /* We matched a single character, the EOB, so
1387                         * treat this as a final EOF.
1388                         */
1389                        return EOB_ACT_END_OF_FILE;
1390                        }
1391
1392                else
1393                        {
1394                        /* We matched some text prior to the EOB, first
1395                         * process it.
1396                         */
1397                        return EOB_ACT_LAST_MATCH;
1398                        }
1399                }
1400
1401        /* Try to read more data. */
1402
1403        /* First move last chars to start of buffer. */
1404        number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1405
1406        for ( i = 0; i < number_to_move; ++i )
1407                *(dest++) = *(source++);
1408
1409        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1410                /* don't do the read, it's not guaranteed to return an EOF,
1411                 * just force an EOF
1412                 */
1413                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1414
1415        else
1416                {
1417                        int num_to_read =
1418                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1419
1420                while ( num_to_read <= 0 )
1421                        { /* Not enough room in the buffer - grow it. */
1422
1423                        /* just a shorter name for the current buffer */
1424                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1425
1426                        int yy_c_buf_p_offset =
1427                                (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1428
1429                        if ( b->yy_is_our_buffer )
1430                                {
1431                                int new_size = b->yy_buf_size * 2;
1432
1433                                if ( new_size <= 0 )
1434                                        b->yy_buf_size += b->yy_buf_size / 8;
1435                                else
1436                                        b->yy_buf_size *= 2;
1437
1438                                b->yy_ch_buf = (char *)
1439                                        /* Include room in for 2 EOB chars. */
1440                                        libconfig_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1441                                }
1442                        else
1443                                /* Can't grow it, we don't own it. */
1444                                b->yy_ch_buf = 0;
1445
1446                        if ( ! b->yy_ch_buf )
1447                                YY_FATAL_ERROR(
1448                                "fatal error - scanner input buffer overflow" );
1449
1450                        yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1451
1452                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1453                                                number_to_move - 1;
1454
1455                        }
1456
1457                if ( num_to_read > YY_READ_BUF_SIZE )
1458                        num_to_read = YY_READ_BUF_SIZE;
1459
1460                /* Read in more data. */
1461                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1462                        yyg->yy_n_chars, (size_t) num_to_read );
1463
1464                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1465                }
1466
1467        if ( yyg->yy_n_chars == 0 )
1468                {
1469                if ( number_to_move == YY_MORE_ADJ )
1470                        {
1471                        ret_val = EOB_ACT_END_OF_FILE;
1472                        libconfig_yyrestart(yyin  ,yyscanner);
1473                        }
1474
1475                else
1476                        {
1477                        ret_val = EOB_ACT_LAST_MATCH;
1478                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1479                                YY_BUFFER_EOF_PENDING;
1480                        }
1481                }
1482
1483        else
1484                ret_val = EOB_ACT_CONTINUE_SCAN;
1485
1486        if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1487                /* Extend the array by 50%, plus the number we really need. */
1488                yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1489                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) libconfig_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1490                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1491                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1492        }
1493
1494        yyg->yy_n_chars += number_to_move;
1495        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1496        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1497
1498        yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1499
1500        return ret_val;
1501}
1502
1503/* yy_get_previous_state - get the state just before the EOB char was reached */
1504
1505    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1506{
1507        register yy_state_type yy_current_state;
1508        register char *yy_cp;
1509    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1510
1511        yy_current_state = yyg->yy_start;
1512
1513        for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1514                {
1515                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1516                if ( yy_accept[yy_current_state] )
1517                        {
1518                        yyg->yy_last_accepting_state = yy_current_state;
1519                        yyg->yy_last_accepting_cpos = yy_cp;
1520                        }
1521                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1522                        {
1523                        yy_current_state = (int) yy_def[yy_current_state];
1524                        if ( yy_current_state >= 117 )
1525                                yy_c = yy_meta[(unsigned int) yy_c];
1526                        }
1527                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1528                }
1529
1530        return yy_current_state;
1531}
1532
1533/* yy_try_NUL_trans - try to make a transition on the NUL character
1534 *
1535 * synopsis
1536 *      next_state = yy_try_NUL_trans( current_state );
1537 */
1538    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
1539{
1540        register int yy_is_jam;
1541    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1542        register char *yy_cp = yyg->yy_c_buf_p;
1543
1544        register YY_CHAR yy_c = 1;
1545        if ( yy_accept[yy_current_state] )
1546                {
1547                yyg->yy_last_accepting_state = yy_current_state;
1548                yyg->yy_last_accepting_cpos = yy_cp;
1549                }
1550        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1551                {
1552                yy_current_state = (int) yy_def[yy_current_state];
1553                if ( yy_current_state >= 117 )
1554                        yy_c = yy_meta[(unsigned int) yy_c];
1555                }
1556        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1557        yy_is_jam = (yy_current_state == 116);
1558
1559        return yy_is_jam ? 0 : yy_current_state;
1560}
1561
1562#ifndef YY_NO_INPUT
1563#ifdef __cplusplus
1564    static int yyinput (yyscan_t yyscanner)
1565#else
1566    static int input  (yyscan_t yyscanner)
1567#endif
1568
1569{
1570        int c;
1571    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1572
1573        *yyg->yy_c_buf_p = yyg->yy_hold_char;
1574
1575        if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1576                {
1577                /* yy_c_buf_p now points to the character we want to return.
1578                 * If this occurs *before* the EOB characters, then it's a
1579                 * valid NUL; if not, then we've hit the end of the buffer.
1580                 */
1581                if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1582                        /* This was really a NUL. */
1583                        *yyg->yy_c_buf_p = '\0';
1584
1585                else
1586                        { /* need more input */
1587                        int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1588                        ++yyg->yy_c_buf_p;
1589
1590                        switch ( yy_get_next_buffer( yyscanner ) )
1591                                {
1592                                case EOB_ACT_LAST_MATCH:
1593                                        /* This happens because yy_g_n_b()
1594                                         * sees that we've accumulated a
1595                                         * token and flags that we need to
1596                                         * try matching the token before
1597                                         * proceeding.  But for input(),
1598                                         * there's no matching to consider.
1599                                         * So convert the EOB_ACT_LAST_MATCH
1600                                         * to EOB_ACT_END_OF_FILE.
1601                                         */
1602
1603                                        /* Reset buffer status. */
1604                                        libconfig_yyrestart(yyin ,yyscanner);
1605
1606                                        /*FALLTHROUGH*/
1607
1608                                case EOB_ACT_END_OF_FILE:
1609                                        {
1610                                        if ( libconfig_yywrap(yyscanner ) )
1611                                                return EOF;
1612
1613                                        if ( ! yyg->yy_did_buffer_switch_on_eof )
1614                                                YY_NEW_FILE;
1615#ifdef __cplusplus
1616                                        return yyinput(yyscanner);
1617#else
1618                                        return input(yyscanner);
1619#endif
1620                                        }
1621
1622                                case EOB_ACT_CONTINUE_SCAN:
1623                                        yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1624                                        break;
1625                                }
1626                        }
1627                }
1628
1629        c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1630        *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
1631        yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1632
1633        if ( c == '\n' )
1634                   
1635    do{ yylineno++;
1636        yycolumn=0;
1637    }while(0)
1638;
1639
1640        return c;
1641}
1642#endif  /* ifndef YY_NO_INPUT */
1643
1644/** Immediately switch to a different input stream.
1645 * @param input_file A readable stream.
1646 * @param yyscanner The scanner object.
1647 * @note This function does not reset the start condition to @c INITIAL .
1648 */
1649    void libconfig_yyrestart  (FILE * input_file , yyscan_t yyscanner)
1650{
1651    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1652
1653        if ( ! YY_CURRENT_BUFFER ){
1654        libconfig_yyensure_buffer_stack (yyscanner);
1655                YY_CURRENT_BUFFER_LVALUE =
1656            libconfig_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1657        }
1658
1659        libconfig_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1660        libconfig_yy_load_buffer_state(yyscanner );
1661}
1662
1663/** Switch to a different input buffer.
1664 * @param new_buffer The new input buffer.
1665 * @param yyscanner The scanner object.
1666 */
1667    void libconfig_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
1668{
1669    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1670
1671        /* TODO. We should be able to replace this entire function body
1672         * with
1673         *              libconfig_yypop_buffer_state();
1674         *              libconfig_yypush_buffer_state(new_buffer);
1675     */
1676        libconfig_yyensure_buffer_stack (yyscanner);
1677        if ( YY_CURRENT_BUFFER == new_buffer )
1678                return;
1679
1680        if ( YY_CURRENT_BUFFER )
1681                {
1682                /* Flush out information for old buffer. */
1683                *yyg->yy_c_buf_p = yyg->yy_hold_char;
1684                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1685                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1686                }
1687
1688        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1689        libconfig_yy_load_buffer_state(yyscanner );
1690
1691        /* We don't actually know whether we did this switch during
1692         * EOF (libconfig_yywrap()) processing, but the only time this flag
1693         * is looked at is after libconfig_yywrap() is called, so it's safe
1694         * to go ahead and always set it.
1695         */
1696        yyg->yy_did_buffer_switch_on_eof = 1;
1697}
1698
1699static void libconfig_yy_load_buffer_state  (yyscan_t yyscanner)
1700{
1701    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1702        yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1703        yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1704        yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1705        yyg->yy_hold_char = *yyg->yy_c_buf_p;
1706}
1707
1708/** Allocate and initialize an input buffer state.
1709 * @param file A readable stream.
1710 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1711 * @param yyscanner The scanner object.
1712 * @return the allocated buffer state.
1713 */
1714    YY_BUFFER_STATE libconfig_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
1715{
1716        YY_BUFFER_STATE b;
1717   
1718        b = (YY_BUFFER_STATE) libconfig_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1719        if ( ! b )
1720                YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_create_buffer()" );
1721
1722        b->yy_buf_size = size;
1723
1724        /* yy_ch_buf has to be 2 characters longer than the size given because
1725         * we need to put in 2 end-of-buffer characters.
1726         */
1727        b->yy_ch_buf = (char *) libconfig_yyalloc(b->yy_buf_size + 2 ,yyscanner );
1728        if ( ! b->yy_ch_buf )
1729                YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_create_buffer()" );
1730
1731        b->yy_is_our_buffer = 1;
1732
1733        libconfig_yy_init_buffer(b,file ,yyscanner);
1734
1735        return b;
1736}
1737
1738/** Destroy the buffer.
1739 * @param b a buffer created with libconfig_yy_create_buffer()
1740 * @param yyscanner The scanner object.
1741 */
1742    void libconfig_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1743{
1744    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1745
1746        if ( ! b )
1747                return;
1748
1749        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1750                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1751
1752        if ( b->yy_is_our_buffer )
1753                libconfig_yyfree((void *) b->yy_ch_buf ,yyscanner );
1754
1755        libconfig_yyfree((void *) b ,yyscanner );
1756}
1757
1758#ifndef __cplusplus
1759extern int isatty (int );
1760#endif /* __cplusplus */
1761   
1762/* Initializes or reinitializes a buffer.
1763 * This function is sometimes called more than once on the same buffer,
1764 * such as during a libconfig_yyrestart() or at EOF.
1765 */
1766    static void libconfig_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
1767
1768{
1769        int oerrno = errno;
1770    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1771
1772        libconfig_yy_flush_buffer(b ,yyscanner);
1773
1774        b->yy_input_file = file;
1775        b->yy_fill_buffer = 1;
1776
1777    /* If b is the current buffer, then libconfig_yy_init_buffer was _probably_
1778     * called from libconfig_yyrestart() or through yy_get_next_buffer.
1779     * In that case, we don't want to reset the lineno or column.
1780     */
1781    if (b != YY_CURRENT_BUFFER){
1782        b->yy_bs_lineno = 1;
1783        b->yy_bs_column = 0;
1784    }
1785
1786        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1787   
1788        errno = oerrno;
1789}
1790
1791/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1792 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1793 * @param yyscanner The scanner object.
1794 */
1795    void libconfig_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1796{
1797    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1798        if ( ! b )
1799                return;
1800
1801        b->yy_n_chars = 0;
1802
1803        /* We always need two end-of-buffer characters.  The first causes
1804         * a transition to the end-of-buffer state.  The second causes
1805         * a jam in that state.
1806         */
1807        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1808        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1809
1810        b->yy_buf_pos = &b->yy_ch_buf[0];
1811
1812        b->yy_at_bol = 1;
1813        b->yy_buffer_status = YY_BUFFER_NEW;
1814
1815        if ( b == YY_CURRENT_BUFFER )
1816                libconfig_yy_load_buffer_state(yyscanner );
1817}
1818
1819/** Pushes the new state onto the stack. The new state becomes
1820 *  the current state. This function will allocate the stack
1821 *  if necessary.
1822 *  @param new_buffer The new state.
1823 *  @param yyscanner The scanner object.
1824 */
1825void libconfig_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1826{
1827    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1828        if (new_buffer == NULL)
1829                return;
1830
1831        libconfig_yyensure_buffer_stack(yyscanner);
1832
1833        /* This block is copied from libconfig_yy_switch_to_buffer. */
1834        if ( YY_CURRENT_BUFFER )
1835                {
1836                /* Flush out information for old buffer. */
1837                *yyg->yy_c_buf_p = yyg->yy_hold_char;
1838                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1839                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1840                }
1841
1842        /* Only push if top exists. Otherwise, replace top. */
1843        if (YY_CURRENT_BUFFER)
1844                yyg->yy_buffer_stack_top++;
1845        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1846
1847        /* copied from libconfig_yy_switch_to_buffer. */
1848        libconfig_yy_load_buffer_state(yyscanner );
1849        yyg->yy_did_buffer_switch_on_eof = 1;
1850}
1851
1852/** Removes and deletes the top of the stack, if present.
1853 *  The next element becomes the new top.
1854 *  @param yyscanner The scanner object.
1855 */
1856void libconfig_yypop_buffer_state (yyscan_t yyscanner)
1857{
1858    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1859        if (!YY_CURRENT_BUFFER)
1860                return;
1861
1862        libconfig_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1863        YY_CURRENT_BUFFER_LVALUE = NULL;
1864        if (yyg->yy_buffer_stack_top > 0)
1865                --yyg->yy_buffer_stack_top;
1866
1867        if (YY_CURRENT_BUFFER) {
1868                libconfig_yy_load_buffer_state(yyscanner );
1869                yyg->yy_did_buffer_switch_on_eof = 1;
1870        }
1871}
1872
1873/* Allocates the stack if it does not exist.
1874 *  Guarantees space for at least one push.
1875 */
1876static void libconfig_yyensure_buffer_stack (yyscan_t yyscanner)
1877{
1878        int num_to_alloc;
1879    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1880
1881        if (!yyg->yy_buffer_stack) {
1882
1883                /* First allocation is just for 2 elements, since we don't know if this
1884                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1885                 * immediate realloc on the next call.
1886         */
1887                num_to_alloc = 1;
1888                yyg->yy_buffer_stack = (struct yy_buffer_state**)libconfig_yyalloc
1889                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
1890                                                                , yyscanner);
1891                if ( ! yyg->yy_buffer_stack )
1892                        YY_FATAL_ERROR( "out of dynamic memory in libconfig_yyensure_buffer_stack()" );
1893                                                                 
1894                memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1895                               
1896                yyg->yy_buffer_stack_max = num_to_alloc;
1897                yyg->yy_buffer_stack_top = 0;
1898                return;
1899        }
1900
1901        if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1902
1903                /* Increase the buffer to prepare for a possible push. */
1904                int grow_size = 8 /* arbitrary grow size */;
1905
1906                num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1907                yyg->yy_buffer_stack = (struct yy_buffer_state**)libconfig_yyrealloc
1908                                                                (yyg->yy_buffer_stack,
1909                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
1910                                                                , yyscanner);
1911                if ( ! yyg->yy_buffer_stack )
1912                        YY_FATAL_ERROR( "out of dynamic memory in libconfig_yyensure_buffer_stack()" );
1913
1914                /* zero only the new slots.*/
1915                memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1916                yyg->yy_buffer_stack_max = num_to_alloc;
1917        }
1918}
1919
1920/** Setup the input buffer state to scan directly from a user-specified character buffer.
1921 * @param base the character buffer
1922 * @param size the size in bytes of the character buffer
1923 * @param yyscanner The scanner object.
1924 * @return the newly allocated buffer state object.
1925 */
1926YY_BUFFER_STATE libconfig_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
1927{
1928        YY_BUFFER_STATE b;
1929   
1930        if ( size < 2 ||
1931             base[size-2] != YY_END_OF_BUFFER_CHAR ||
1932             base[size-1] != YY_END_OF_BUFFER_CHAR )
1933                /* They forgot to leave room for the EOB's. */
1934                return 0;
1935
1936        b = (YY_BUFFER_STATE) libconfig_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1937        if ( ! b )
1938                YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_scan_buffer()" );
1939
1940        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1941        b->yy_buf_pos = b->yy_ch_buf = base;
1942        b->yy_is_our_buffer = 0;
1943        b->yy_input_file = 0;
1944        b->yy_n_chars = b->yy_buf_size;
1945        b->yy_is_interactive = 0;
1946        b->yy_at_bol = 1;
1947        b->yy_fill_buffer = 0;
1948        b->yy_buffer_status = YY_BUFFER_NEW;
1949
1950        libconfig_yy_switch_to_buffer(b ,yyscanner );
1951
1952        return b;
1953}
1954
1955/** Setup the input buffer state to scan a string. The next call to libconfig_yylex() will
1956 * scan from a @e copy of @a str.
1957 * @param yystr a NUL-terminated string to scan
1958 * @param yyscanner The scanner object.
1959 * @return the newly allocated buffer state object.
1960 * @note If you want to scan bytes that may contain NUL values, then use
1961 *       libconfig_yy_scan_bytes() instead.
1962 */
1963YY_BUFFER_STATE libconfig_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
1964{
1965   
1966        return libconfig_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
1967}
1968
1969/** Setup the input buffer state to scan the given bytes. The next call to libconfig_yylex() will
1970 * scan from a @e copy of @a bytes.
1971 * @param bytes the byte buffer to scan
1972 * @param len the number of bytes in the buffer pointed to by @a bytes.
1973 * @param yyscanner The scanner object.
1974 * @return the newly allocated buffer state object.
1975 */
1976YY_BUFFER_STATE libconfig_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
1977{
1978        YY_BUFFER_STATE b;
1979        char *buf;
1980        yy_size_t n;
1981        int i;
1982   
1983        /* Get memory for full buffer, including space for trailing EOB's. */
1984        n = _yybytes_len + 2;
1985        buf = (char *) libconfig_yyalloc(n ,yyscanner );
1986        if ( ! buf )
1987                YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_scan_bytes()" );
1988
1989        for ( i = 0; i < _yybytes_len; ++i )
1990                buf[i] = yybytes[i];
1991
1992        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1993
1994        b = libconfig_yy_scan_buffer(buf,n ,yyscanner);
1995        if ( ! b )
1996                YY_FATAL_ERROR( "bad buffer in libconfig_yy_scan_bytes()" );
1997
1998        /* It's okay to grow etc. this buffer, and we should throw it
1999         * away when we're done.
2000         */
2001        b->yy_is_our_buffer = 1;
2002
2003        return b;
2004}
2005
2006#ifndef YY_EXIT_FAILURE
2007#define YY_EXIT_FAILURE 2
2008#endif
2009
2010static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2011{
2012        (void) fprintf( stderr, "%s\n", msg );
2013        exit( YY_EXIT_FAILURE );
2014}
2015
2016/* Redefine yyless() so it works in section 3 code. */
2017
2018#undef yyless
2019#define yyless(n) \
2020        do \
2021                { \
2022                /* Undo effects of setting up yytext. */ \
2023        int yyless_macro_arg = (n); \
2024        YY_LESS_LINENO(yyless_macro_arg);\
2025                yytext[yyleng] = yyg->yy_hold_char; \
2026                yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2027                yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2028                *yyg->yy_c_buf_p = '\0'; \
2029                yyleng = yyless_macro_arg; \
2030                } \
2031        while ( 0 )
2032
2033/* Accessor  methods (get/set functions) to struct members. */
2034
2035/** Get the user-defined data for this scanner.
2036 * @param yyscanner The scanner object.
2037 */
2038YY_EXTRA_TYPE libconfig_yyget_extra  (yyscan_t yyscanner)
2039{
2040    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2041    return yyextra;
2042}
2043
2044/** Get the current line number.
2045 * @param yyscanner The scanner object.
2046 */
2047int libconfig_yyget_lineno  (yyscan_t yyscanner)
2048{
2049    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2050   
2051        if (! YY_CURRENT_BUFFER)
2052            return 0;
2053   
2054    return yylineno;
2055}
2056
2057/** Get the current column number.
2058 * @param yyscanner The scanner object.
2059 */
2060int libconfig_yyget_column  (yyscan_t yyscanner)
2061{
2062    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2063   
2064        if (! YY_CURRENT_BUFFER)
2065            return 0;
2066   
2067    return yycolumn;
2068}
2069
2070/** Get the input stream.
2071 * @param yyscanner The scanner object.
2072 */
2073FILE *libconfig_yyget_in  (yyscan_t yyscanner)
2074{
2075    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2076    return yyin;
2077}
2078
2079/** Get the output stream.
2080 * @param yyscanner The scanner object.
2081 */
2082FILE *libconfig_yyget_out  (yyscan_t yyscanner)
2083{
2084    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2085    return yyout;
2086}
2087
2088/** Get the length of the current token.
2089 * @param yyscanner The scanner object.
2090 */
2091int libconfig_yyget_leng  (yyscan_t yyscanner)
2092{
2093    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2094    return yyleng;
2095}
2096
2097/** Get the current token.
2098 * @param yyscanner The scanner object.
2099 */
2100
2101char *libconfig_yyget_text  (yyscan_t yyscanner)
2102{
2103    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2104    return yytext;
2105}
2106
2107/** Set the user-defined data. This data is never touched by the scanner.
2108 * @param user_defined The data to be associated with this scanner.
2109 * @param yyscanner The scanner object.
2110 */
2111void libconfig_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
2112{
2113    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2114    yyextra = user_defined ;
2115}
2116
2117/** Set the current line number.
2118 * @param line_number
2119 * @param yyscanner The scanner object.
2120 */
2121void libconfig_yyset_lineno (int  line_number , yyscan_t yyscanner)
2122{
2123    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2124
2125        /* lineno is only valid if an input buffer exists. */
2126        if (! YY_CURRENT_BUFFER )
2127           yy_fatal_error( "libconfig_yyset_lineno called with no buffer" , yyscanner); 
2128   
2129    yylineno = line_number;
2130}
2131
2132/** Set the current column.
2133 * @param line_number
2134 * @param yyscanner The scanner object.
2135 */
2136void libconfig_yyset_column (int  column_no , yyscan_t yyscanner)
2137{
2138    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2139
2140        /* column is only valid if an input buffer exists. */
2141        if (! YY_CURRENT_BUFFER )
2142           yy_fatal_error( "libconfig_yyset_column called with no buffer" , yyscanner); 
2143   
2144    yycolumn = column_no;
2145}
2146
2147/** Set the input stream. This does not discard the current
2148 * input buffer.
2149 * @param in_str A readable stream.
2150 * @param yyscanner The scanner object.
2151 * @see libconfig_yy_switch_to_buffer
2152 */
2153void libconfig_yyset_in (FILE *  in_str , yyscan_t yyscanner)
2154{
2155    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2156    yyin = in_str ;
2157}
2158
2159void libconfig_yyset_out (FILE *  out_str , yyscan_t yyscanner)
2160{
2161    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2162    yyout = out_str ;
2163}
2164
2165int libconfig_yyget_debug  (yyscan_t yyscanner)
2166{
2167    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2168    return yy_flex_debug;
2169}
2170
2171void libconfig_yyset_debug (int  bdebug , yyscan_t yyscanner)
2172{
2173    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2174    yy_flex_debug = bdebug ;
2175}
2176
2177/* Accessor methods for yylval and yylloc */
2178
2179YYSTYPE * libconfig_yyget_lval  (yyscan_t yyscanner)
2180{
2181    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2182    return yylval;
2183}
2184
2185void libconfig_yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
2186{
2187    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2188    yylval = yylval_param;
2189}
2190
2191/* User-visible API */
2192
2193/* libconfig_yylex_init is special because it creates the scanner itself, so it is
2194 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2195 * That's why we explicitly handle the declaration, instead of using our macros.
2196 */
2197
2198int libconfig_yylex_init(yyscan_t* ptr_yy_globals)
2199
2200{
2201    if (ptr_yy_globals == NULL){
2202        errno = EINVAL;
2203        return 1;
2204    }
2205
2206    *ptr_yy_globals = (yyscan_t) libconfig_yyalloc ( sizeof( struct yyguts_t ), NULL );
2207
2208    if (*ptr_yy_globals == NULL){
2209        errno = ENOMEM;
2210        return 1;
2211    }
2212
2213    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2214    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2215
2216    return yy_init_globals ( *ptr_yy_globals );
2217}
2218
2219/* libconfig_yylex_init_extra has the same functionality as libconfig_yylex_init, but follows the
2220 * convention of taking the scanner as the last argument. Note however, that
2221 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2222 * is the reason, too, why this function also must handle its own declaration).
2223 * The user defined value in the first argument will be available to libconfig_yyalloc in
2224 * the yyextra field.
2225 */
2226
2227int libconfig_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2228
2229{
2230    struct yyguts_t dummy_yyguts;
2231
2232    libconfig_yyset_extra (yy_user_defined, &dummy_yyguts);
2233
2234    if (ptr_yy_globals == NULL){
2235        errno = EINVAL;
2236        return 1;
2237    }
2238       
2239    *ptr_yy_globals = (yyscan_t) libconfig_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2240       
2241    if (*ptr_yy_globals == NULL){
2242        errno = ENOMEM;
2243        return 1;
2244    }
2245   
2246    /* By setting to 0xAA, we expose bugs in
2247    yy_init_globals. Leave at 0x00 for releases. */
2248    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2249   
2250    libconfig_yyset_extra (yy_user_defined, *ptr_yy_globals);
2251   
2252    return yy_init_globals ( *ptr_yy_globals );
2253}
2254
2255static int yy_init_globals (yyscan_t yyscanner)
2256{
2257    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2258    /* Initialization is the same as for the non-reentrant scanner.
2259     * This function is called from libconfig_yylex_destroy(), so don't allocate here.
2260     */
2261
2262    yyg->yy_buffer_stack = 0;
2263    yyg->yy_buffer_stack_top = 0;
2264    yyg->yy_buffer_stack_max = 0;
2265    yyg->yy_c_buf_p = (char *) 0;
2266    yyg->yy_init = 0;
2267    yyg->yy_start = 0;
2268
2269    yyg->yy_start_stack_ptr = 0;
2270    yyg->yy_start_stack_depth = 0;
2271    yyg->yy_start_stack =  NULL;
2272
2273/* Defined in main.c */
2274#ifdef YY_STDINIT
2275    yyin = stdin;
2276    yyout = stdout;
2277#else
2278    yyin = (FILE *) 0;
2279    yyout = (FILE *) 0;
2280#endif
2281
2282    /* For future reference: Set errno on error, since we are called by
2283     * libconfig_yylex_init()
2284     */
2285    return 0;
2286}
2287
2288/* libconfig_yylex_destroy is for both reentrant and non-reentrant scanners. */
2289int libconfig_yylex_destroy  (yyscan_t yyscanner)
2290{
2291    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2292
2293    /* Pop the buffer stack, destroying each element. */
2294        while(YY_CURRENT_BUFFER){
2295                libconfig_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2296                YY_CURRENT_BUFFER_LVALUE = NULL;
2297                libconfig_yypop_buffer_state(yyscanner);
2298        }
2299
2300        /* Destroy the stack itself. */
2301        libconfig_yyfree(yyg->yy_buffer_stack ,yyscanner);
2302        yyg->yy_buffer_stack = NULL;
2303
2304    /* Destroy the start condition stack. */
2305        libconfig_yyfree(yyg->yy_start_stack ,yyscanner );
2306        yyg->yy_start_stack = NULL;
2307
2308    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2309     * libconfig_yylex() is called, initialization will occur. */
2310    yy_init_globals( yyscanner);
2311
2312    /* Destroy the main struct (reentrant only). */
2313    libconfig_yyfree ( yyscanner , yyscanner );
2314    yyscanner = NULL;
2315    return 0;
2316}
2317
2318/*
2319 * Internal utility routines.
2320 */
2321
2322#ifndef yytext_ptr
2323static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2324{
2325        register int i;
2326        for ( i = 0; i < n; ++i )
2327                s1[i] = s2[i];
2328}
2329#endif
2330
2331#ifdef YY_NEED_STRLEN
2332static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2333{
2334        register int n;
2335        for ( n = 0; s[n]; ++n )
2336                ;
2337
2338        return n;
2339}
2340#endif
2341
2342void *libconfig_yyalloc (yy_size_t  size , yyscan_t yyscanner)
2343{
2344        return (void *) malloc( size );
2345}
2346
2347void *libconfig_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
2348{
2349        /* The cast to (char *) in the following accommodates both
2350         * implementations that use char* generic pointers, and those
2351         * that use void* generic pointers.  It works with the latter
2352         * because both ANSI C and C++ allow castless assignment from
2353         * any pointer type to void*, and deal with argument conversions
2354         * as though doing an assignment.
2355         */
2356        return (void *) realloc( (char *) ptr, size );
2357}
2358
2359void libconfig_yyfree (void * ptr , yyscan_t yyscanner)
2360{
2361        free( (char *) ptr );   /* see libconfig_yyrealloc() for (char *) cast */
2362}
2363
2364#define YYTABLES_NAME "yytables"
2365
2366#line 223 "scanner.l"
Note: See TracBrowser for help on using the browser.