zlexer.c revision 1.4
1#include "config.h"
2
3#line 3 "<stdout>"
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>
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
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
150typedef struct yy_buffer_state *YY_BUFFER_STATE;
151#endif
152
153#ifndef YY_TYPEDEF_YY_SIZE_T
154#define YY_TYPEDEF_YY_SIZE_T
155typedef size_t yy_size_t;
156#endif
157
158extern int yyleng;
159
160extern 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
187struct 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. */
251static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
252static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
253static 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. */
271static char yy_hold_char;
272static int yy_n_chars;		/* number of characters read into yy_ch_buf */
273int yyleng;
274
275/* Points to current character in buffer. */
276static char *yy_c_buf_p = NULL;
277static int yy_init = 0;		/* whether we need to initialize */
278static 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 */
283static int yy_did_buffer_switch_on_eof;
284
285void yyrestart (FILE *input_file  );
286void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
287YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
288void yy_delete_buffer (YY_BUFFER_STATE b  );
289void yy_flush_buffer (YY_BUFFER_STATE b  );
290void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
291void yypop_buffer_state (void );
292
293static void yyensure_buffer_stack (void );
294static void yy_load_buffer_state (void );
295static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
296
297#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
298
299YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
300YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
301YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
302
303void *yyalloc (yy_size_t  );
304void *yyrealloc (void *,yy_size_t  );
305void 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
333typedef unsigned char YY_CHAR;
334
335FILE *yyin = NULL, *yyout = NULL;
336
337typedef int yy_state_type;
338
339extern int yylineno;
340
341int yylineno = 1;
342
343extern char *yytext;
344#ifdef yytext_ptr
345#undef yytext_ptr
346#endif
347#define yytext_ptr yytext
348
349static yy_state_type yy_get_previous_state (void );
350static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
351static int yy_get_next_buffer (void );
352static 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	(yytext_ptr) -= (yy_more_len); \
360	yyleng = (int) (yy_cp - (yytext_ptr)); \
361	(yy_hold_char) = *yy_cp; \
362	*yy_cp = '\0'; \
363	(yy_c_buf_p) = yy_cp;
364
365#define YY_NUM_RULES 25
366#define YY_END_OF_BUFFER 26
367/* This struct is not used in this scanner,
368   but its presence is necessary. */
369struct yy_trans_info
370	{
371	flex_int32_t yy_verify;
372	flex_int32_t yy_nxt;
373	};
374static yyconst flex_int16_t yy_accept[70] =
375    {   0,
376        0,    0,    0,    0,   16,   16,   20,   20,   26,   23,
377       14,   11,   11,   19,   24,   12,   13,    8,    1,    9,
378       23,   24,    6,    5,   16,   17,   16,   18,   20,   21,
379       22,   25,   23,   23,   14,    1,    1,   23,   23,   10,
380       15,   23,    7,    7,    7,    7,    6,   16,   16,   16,
381       16,   20,    0,   23,   23,    7,    7,    7,    7,    7,
382        2,    7,    7,    7,    7,    7,    3,    4,    0
383    } ;
384
385static yyconst YY_CHAR yy_ec[256] =
386    {   0,
387        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
388        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
389        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
390        1,    2,    1,    5,    6,    7,    1,    1,    1,    8,
391        9,    1,    1,    1,    1,   10,    1,    1,    1,    1,
392        1,    1,    1,    1,    1,    1,    1,    1,   11,    1,
393        1,    1,    1,   12,   13,   13,   14,   15,   16,   13,
394       17,   13,   18,   13,   13,   19,   13,   20,   21,   13,
395       13,   22,   13,   23,   24,   13,   13,   13,   13,   13,
396       25,   26,   27,    1,    1,    1,   13,   13,   28,   29,
397
398       30,   13,   31,   13,   32,   13,   13,   33,   13,   34,
399       35,   13,   13,   36,   13,   37,   38,   13,   13,   13,
400       13,   13,    1,    1,    1,    1,    1,    1,    1,    1,
401        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
402        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
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
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        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
413        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
414        1,    1,    1,    1,    1
415    } ;
416
417static yyconst YY_CHAR yy_meta[39] =
418    {   0,
419        1,    2,    3,    2,    4,    1,    1,    2,    2,    2,
420        2,    1,    5,    5,    5,    5,    5,    5,    5,    5,
421        5,    5,    5,    5,    1,    1,    6,    5,    5,    5,
422        5,    5,    5,    5,    5,    5,    5,    5
423    } ;
424
425static yyconst flex_uint16_t yy_base[83] =
426    {   0,
427        0,   25,  113,  112,   12,   14,   16,   17,  114,   87,
428       12,  218,  218,  218,  218,  218,  218,  218,    0,   86,
429       50,   59,    0,  218,   85,  218,   18,  218,   84,  218,
430      218,  103,   81,   95,   14,    0,    0,   76,   75,   74,
431       64,  120,    0,   28,   27,   27,    0,   63,   20,   59,
432       39,   57,   63,    5,    0,   41,   39,   48,   51,   55,
433        0,   49,   56,   63,   59,   79,    0,    0,  218,  146,
434      152,  158,  164,  170,  176,  182,    1,  188,  194,  199,
435      205,  211
436    } ;
437
438static yyconst flex_int16_t yy_def[83] =
439    {   0,
440       70,   70,   71,   71,   72,   72,   73,   73,   69,   74,
441       69,   69,   69,   69,   69,   69,   69,   69,   75,   74,
442       76,   77,   78,   69,   79,   69,   80,   69,   81,   69,
443       69,   81,   74,   82,   69,   75,   75,   74,   74,   74,
444       74,   82,   77,   77,   77,   77,   78,   79,   80,   79,
445       80,   81,   81,   74,   42,   77,   77,   77,   77,   77,
446       77,   77,   77,   77,   77,   77,   77,   77,    0,   69,
447       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
448       69,   69
449    } ;
450
451static yyconst flex_uint16_t yy_nxt[257] =
452    {   0,
453       69,   11,   12,   13,   14,   43,   15,   16,   17,   18,
454       19,   20,   69,   35,   26,   35,   26,   69,   30,   30,
455       31,   31,   36,   69,   36,   21,   11,   12,   13,   14,
456       34,   22,   16,   17,   18,   19,   20,   27,   28,   27,
457       28,   32,   32,   51,   48,   51,   48,   56,   57,   58,
458       21,   39,   39,   39,   59,   40,   60,   39,   39,   39,
459       39,   56,   57,   58,   51,   48,   61,   52,   59,   62,
460       60,   63,   64,   65,   41,   42,   44,   66,   67,   45,
461       61,   46,   53,   62,   49,   63,   64,   65,   49,   34,
462       44,   66,   67,   45,   68,   46,   33,   33,   33,   34,
463
464       34,   34,   33,   33,   33,   33,   34,   52,   68,   53,
465       49,   34,   34,   69,   24,   24,   69,   69,   69,   69,
466       55,   33,   33,   33,   69,   69,   69,   33,   33,   33,
467       33,   69,   69,   69,   69,   69,   69,   69,   69,   69,
468       69,   69,   69,   69,   69,   55,   10,   10,   10,   10,
469       10,   10,   23,   23,   23,   23,   23,   23,   25,   25,
470       25,   25,   25,   25,   29,   29,   29,   29,   29,   29,
471       33,   69,   69,   33,   33,   33,   37,   37,   69,   37,
472       37,   37,   38,   38,   38,   38,   38,   38,   47,   47,
473       69,   47,   47,   47,   48,   48,   69,   48,   48,   50,
474
475       50,   69,   50,   50,   50,   52,   52,   69,   69,   52,
476       52,   54,   54,   54,   54,   54,   54,    9,   69,   69,
477       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
478       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
479       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
480       69,   69,   69,   69,   69,   69
481    } ;
482
483static yyconst flex_int16_t yy_chk[257] =
484    {   0,
485        0,    1,    1,    1,    1,   77,    1,    1,    1,    1,
486        1,    1,    0,   11,    5,   35,    6,    0,    7,    8,
487        7,    8,   11,    0,   35,    1,    2,    2,    2,    2,
488       54,    2,    2,    2,    2,    2,    2,    5,    5,    6,
489        6,    7,    8,   27,   27,   49,   49,   44,   45,   46,
490        2,   21,   21,   21,   56,   21,   57,   21,   21,   21,
491       21,   44,   45,   46,   51,   51,   58,   53,   56,   59,
492       57,   60,   62,   63,   21,   21,   22,   64,   65,   22,
493       58,   22,   52,   59,   50,   60,   62,   63,   48,   41,
494       22,   64,   65,   22,   66,   22,   34,   34,   34,   40,
495
496       39,   38,   34,   34,   34,   34,   33,   32,   66,   29,
497       25,   20,   10,    9,    4,    3,    0,    0,    0,    0,
498       34,   42,   42,   42,    0,    0,    0,   42,   42,   42,
499       42,    0,    0,    0,    0,    0,    0,    0,    0,    0,
500        0,    0,    0,    0,    0,   42,   70,   70,   70,   70,
501       70,   70,   71,   71,   71,   71,   71,   71,   72,   72,
502       72,   72,   72,   72,   73,   73,   73,   73,   73,   73,
503       74,    0,    0,   74,   74,   74,   75,   75,    0,   75,
504       75,   75,   76,   76,   76,   76,   76,   76,   78,   78,
505        0,   78,   78,   78,   79,   79,    0,   79,   79,   80,
506
507       80,    0,   80,   80,   80,   81,   81,    0,    0,   81,
508       81,   82,   82,   82,   82,   82,   82,   69,   69,   69,
509       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
510       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
511       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
512       69,   69,   69,   69,   69,   69
513    } ;
514
515static yy_state_type yy_last_accepting_state;
516static char *yy_last_accepting_cpos;
517
518extern int yy_flex_debug;
519int yy_flex_debug = 0;
520
521/* The intent behind this definition is that it'll catch
522 * any uses of REJECT which flex missed.
523 */
524#define REJECT reject_used_but_not_detected
525static int yy_more_flag = 0;
526static int yy_more_len = 0;
527#define yymore() ((yy_more_flag) = 1)
528#define YY_MORE_ADJ (yy_more_len)
529#define YY_RESTORE_YY_MORE_OFFSET
530char *yytext;
531#line 1 "zlexer.lex"
532#line 2 "zlexer.lex"
533/*
534 * zlexer.lex - lexical analyzer for (DNS) zone files
535 *
536 * Copyright (c) 2001-2006, NLnet Labs. All rights reserved
537 *
538 * See LICENSE for the license.
539 *
540 */
541/* because flex keeps having sign-unsigned compare problems that are unfixed*/
542#if defined(__clang__)||(defined(__GNUC__)&&((__GNUC__ >4)||(defined(__GNUC_MINOR__)&&(__GNUC__ ==4)&&(__GNUC_MINOR__ >=2))))
543#pragma GCC diagnostic ignored "-Wsign-compare"
544#endif
545/* ignore fallthrough warnings in the generated parse code case statements */
546#if defined(__clang__)||(defined(__GNUC__)&&(__GNUC__ >=7))
547#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
548#endif
549
550#include "config.h"
551
552#include <ctype.h>
553#include <errno.h>
554#include <string.h>
555#include <strings.h>
556
557#include "zonec.h"
558#include "dname.h"
559#include "zparser.h"
560
561#if 0
562#define LEXOUT(s)  printf s /* used ONLY when debugging */
563#else
564#define LEXOUT(s)
565#endif
566
567enum lexer_state {
568	EXPECT_OWNER,
569	PARSING_OWNER,
570	PARSING_TTL_CLASS_TYPE,
571	PARSING_RDATA
572};
573
574static int parse_token(int token, char *yytext, enum lexer_state *lexer_state);
575
576static YY_BUFFER_STATE include_stack[MAXINCLUDES];
577static zparser_type zparser_stack[MAXINCLUDES];
578static int include_stack_ptr = 0;
579
580/*
581 * Saves the file specific variables on the include stack.
582 */
583static void
584push_parser_state(FILE *input)
585{
586	zparser_stack[include_stack_ptr].filename = parser->filename;
587	zparser_stack[include_stack_ptr].line = parser->line;
588	zparser_stack[include_stack_ptr].origin = parser->origin;
589	include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
590	yy_switch_to_buffer(yy_create_buffer(input,YY_BUF_SIZE));
591	++include_stack_ptr;
592}
593
594/*
595 * Restores the file specific variables from the include stack.
596 */
597static void
598pop_parser_state(void)
599{
600	--include_stack_ptr;
601	parser->filename = zparser_stack[include_stack_ptr].filename;
602	parser->line = zparser_stack[include_stack_ptr].line;
603	parser->origin = zparser_stack[include_stack_ptr].origin;
604	yy_delete_buffer(YY_CURRENT_BUFFER);
605	yy_switch_to_buffer(include_stack[include_stack_ptr]);
606}
607
608static YY_BUFFER_STATE oldstate;
609/* Start string scan */
610void
611parser_push_stringbuf(char* str)
612{
613	oldstate = YY_CURRENT_BUFFER;
614	yy_switch_to_buffer(yy_scan_string(str));
615}
616
617void
618parser_pop_stringbuf(void)
619{
620	yy_delete_buffer(YY_CURRENT_BUFFER);
621	yy_switch_to_buffer(oldstate);
622	oldstate = NULL;
623}
624
625	static int paren_open = 0;
626	static enum lexer_state lexer_state = EXPECT_OWNER;
627void
628parser_flush(void)
629{
630	YY_FLUSH_BUFFER;
631	paren_open = 0;
632	lexer_state = EXPECT_OWNER;
633}
634
635#ifndef yy_set_bol /* compat definition, for flex 2.4.6 */
636#define yy_set_bol(at_bol) \
637	{ \
638		if ( ! yy_current_buffer ) \
639			yy_current_buffer = yy_create_buffer(yyin,YY_BUF_SIZE ); \
640		yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \
641	}
642#endif
643
644#define YY_NO_INPUT 1
645#line 117 "zlexer.lex"
646#ifndef YY_NO_UNPUT
647#define YY_NO_UNPUT 1
648#endif
649#ifndef YY_NO_INPUT
650#define YY_NO_INPUT 1
651#endif
652
653#line 653 "<stdout>"
654
655#define INITIAL 0
656#define incl 1
657#define bitlabel 2
658#define quotedstring 3
659
660#ifndef YY_NO_UNISTD_H
661/* Special case for "unistd.h", since it is non-ANSI. We include it way
662 * down here because we want the user's section 1 to have been scanned first.
663 * The user has a chance to override it with an option.
664 */
665#include <unistd.h>
666#endif
667
668#ifndef YY_EXTRA_TYPE
669#define YY_EXTRA_TYPE void *
670#endif
671
672static int yy_init_globals (void );
673
674/* Accessor methods to globals.
675   These are made visible to non-reentrant scanners for convenience. */
676
677int yylex_destroy (void );
678
679int yyget_debug (void );
680
681void yyset_debug (int debug_flag  );
682
683YY_EXTRA_TYPE yyget_extra (void );
684
685void yyset_extra (YY_EXTRA_TYPE user_defined  );
686
687FILE *yyget_in (void );
688
689void yyset_in  (FILE * _in_str  );
690
691FILE *yyget_out (void );
692
693void yyset_out  (FILE * _out_str  );
694
695			int yyget_leng (void );
696
697char *yyget_text (void );
698
699int yyget_lineno (void );
700
701void yyset_lineno (int _line_number  );
702
703/* Macros after this point can all be overridden by user definitions in
704 * section 1.
705 */
706
707#ifndef YY_SKIP_YYWRAP
708#ifdef __cplusplus
709extern "C" int yywrap (void );
710#else
711extern int yywrap (void );
712#endif
713#endif
714
715#ifndef YY_NO_UNPUT
716
717#endif
718
719#ifndef yytext_ptr
720static void yy_flex_strncpy (char *,yyconst char *,int );
721#endif
722
723#ifdef YY_NEED_STRLEN
724static int yy_flex_strlen (yyconst char * );
725#endif
726
727#ifndef YY_NO_INPUT
728
729#ifdef __cplusplus
730static int yyinput (void );
731#else
732static int input (void );
733#endif
734
735#endif
736
737/* Amount of stuff to slurp up with each read. */
738#ifndef YY_READ_BUF_SIZE
739#ifdef __ia64__
740/* On IA-64, the buffer size is 16k, not 8k */
741#define YY_READ_BUF_SIZE 16384
742#else
743#define YY_READ_BUF_SIZE 8192
744#endif /* __ia64__ */
745#endif
746
747/* Copy whatever the last rule matched to the standard output. */
748#ifndef ECHO
749/* This used to be an fputs(), but since the string might contain NUL's,
750 * we now use fwrite().
751 */
752#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
753#endif
754
755/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
756 * is returned in "result".
757 */
758#ifndef YY_INPUT
759#define YY_INPUT(buf,result,max_size) \
760	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
761		{ \
762		int c = '*'; \
763		int n; \
764		for ( n = 0; n < max_size && \
765			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
766			buf[n] = (char) c; \
767		if ( c == '\n' ) \
768			buf[n++] = (char) c; \
769		if ( c == EOF && ferror( yyin ) ) \
770			YY_FATAL_ERROR( "input in flex scanner failed" ); \
771		result = n; \
772		} \
773	else \
774		{ \
775		errno=0; \
776		while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
777			{ \
778			if( errno != EINTR) \
779				{ \
780				YY_FATAL_ERROR( "input in flex scanner failed" ); \
781				break; \
782				} \
783			errno=0; \
784			clearerr(yyin); \
785			} \
786		}\
787\
788
789#endif
790
791/* No semi-colon after return; correct usage is to write "yyterminate();" -
792 * we don't want an extra ';' after the "return" because that will cause
793 * some compilers to complain about unreachable statements.
794 */
795#ifndef yyterminate
796#define yyterminate() return YY_NULL
797#endif
798
799/* Number of entries by which start-condition stack grows. */
800#ifndef YY_START_STACK_INCR
801#define YY_START_STACK_INCR 25
802#endif
803
804/* Report a fatal error. */
805#ifndef YY_FATAL_ERROR
806#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
807#endif
808
809/* end tables serialization structures and prototypes */
810
811/* Default declaration of generated scanner - a define so the user can
812 * easily add parameters.
813 */
814#ifndef YY_DECL
815#define YY_DECL_IS_OURS 1
816
817extern int yylex (void);
818
819#define YY_DECL int yylex (void)
820#endif /* !YY_DECL */
821
822/* Code executed at the beginning of each rule, after yytext and yyleng
823 * have been set up.
824 */
825#ifndef YY_USER_ACTION
826#define YY_USER_ACTION
827#endif
828
829/* Code executed at the end of each rule. */
830#ifndef YY_BREAK
831#define YY_BREAK /*LINTED*/break;
832#endif
833
834#define YY_RULE_SETUP \
835	if ( yyleng > 0 ) \
836		YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
837				(yytext[yyleng - 1] == '\n'); \
838	YY_USER_ACTION
839
840/** The main scanner function which does all the work.
841 */
842YY_DECL
843{
844	yy_state_type yy_current_state;
845	char *yy_cp, *yy_bp;
846	int yy_act;
847
848	if ( !(yy_init) )
849		{
850		(yy_init) = 1;
851
852#ifdef YY_USER_INIT
853		YY_USER_INIT;
854#endif
855
856		if ( ! (yy_start) )
857			(yy_start) = 1;	/* first start state */
858
859		if ( ! yyin )
860			yyin = stdin;
861
862		if ( ! yyout )
863			yyout = stdout;
864
865		if ( ! YY_CURRENT_BUFFER ) {
866			yyensure_buffer_stack ();
867			YY_CURRENT_BUFFER_LVALUE =
868				yy_create_buffer(yyin,YY_BUF_SIZE );
869		}
870
871		yy_load_buffer_state( );
872		}
873
874	{
875#line 139 "zlexer.lex"
876
877#line 877 "<stdout>"
878
879	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
880		{
881		(yy_more_len) = 0;
882		if ( (yy_more_flag) )
883			{
884			(yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
885			(yy_more_flag) = 0;
886			}
887		yy_cp = (yy_c_buf_p);
888
889		/* Support of yytext. */
890		*yy_cp = (yy_hold_char);
891
892		/* yy_bp points to the position in yy_ch_buf of the start of
893		 * the current run.
894		 */
895		yy_bp = yy_cp;
896
897		yy_current_state = (yy_start);
898		yy_current_state += YY_AT_BOL();
899yy_match:
900		do
901			{
902			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
903			if ( yy_accept[yy_current_state] )
904				{
905				(yy_last_accepting_state) = yy_current_state;
906				(yy_last_accepting_cpos) = yy_cp;
907				}
908			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
909				{
910				yy_current_state = (int) yy_def[yy_current_state];
911				if ( yy_current_state >= 70 )
912					yy_c = yy_meta[(unsigned int) yy_c];
913				}
914			yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
915			++yy_cp;
916			}
917		while ( yy_base[yy_current_state] != 218 );
918
919yy_find_action:
920		yy_act = yy_accept[yy_current_state];
921		if ( yy_act == 0 )
922			{ /* have to back up */
923			yy_cp = (yy_last_accepting_cpos);
924			yy_current_state = (yy_last_accepting_state);
925			yy_act = yy_accept[yy_current_state];
926			}
927
928		YY_DO_BEFORE_ACTION;
929
930do_action:	/* This label is used only to access EOF actions. */
931
932		switch ( yy_act )
933	{ /* beginning of action switch */
934			case 0: /* must back up */
935			/* undo the effects of YY_DO_BEFORE_ACTION */
936			*yy_cp = (yy_hold_char);
937			yy_cp = (yy_last_accepting_cpos);
938			yy_current_state = (yy_last_accepting_state);
939			goto yy_find_action;
940
941case 1:
942YY_RULE_SETUP
943#line 140 "zlexer.lex"
944/* ignore */
945	YY_BREAK
946case 2:
947YY_RULE_SETUP
948#line 141 "zlexer.lex"
949{ lexer_state = PARSING_RDATA; return DOLLAR_TTL; }
950	YY_BREAK
951case 3:
952YY_RULE_SETUP
953#line 142 "zlexer.lex"
954{ lexer_state = PARSING_RDATA; return DOLLAR_ORIGIN; }
955	YY_BREAK
956/*
957	 * Handle $INCLUDE directives.  See
958	 * http://dinosaur.compilertools.net/flex/flex_12.html#SEC12.
959	 */
960case 4:
961YY_RULE_SETUP
962#line 148 "zlexer.lex"
963{
964	BEGIN(incl);
965	/* ignore case statement fallthrough on incl<EOF> flex rule */
966}
967	YY_BREAK
968case 5:
969/* rule 5 can match eol */
970#line 153 "zlexer.lex"
971YY_RULE_SETUP
972case YY_STATE_EOF(incl):
973#line 153 "zlexer.lex"
974{
975	int error_occurred = parser->error_occurred;
976	BEGIN(INITIAL);
977	zc_error("missing file name in $INCLUDE directive");
978	yy_set_bol(1); /* Set beginning of line, so "^" rules match.  */
979	++parser->line;
980	parser->error_occurred = error_occurred;
981}
982	YY_BREAK
983case 6:
984YY_RULE_SETUP
985#line 161 "zlexer.lex"
986{
987	char *tmp;
988	domain_type *origin = parser->origin;
989	int error_occurred = parser->error_occurred;
990
991	BEGIN(INITIAL);
992	if (include_stack_ptr >= MAXINCLUDES ) {
993		zc_error("includes nested too deeply, skipped (>%d)",
994			 MAXINCLUDES);
995	} else {
996		FILE *input;
997
998		/* Remove trailing comment.  */
999		tmp = strrchr(yytext, ';');
1000		if (tmp) {
1001			*tmp = '\0';
1002		}
1003		strip_string(yytext);
1004
1005		/* Parse origin for include file.  */
1006		tmp = strrchr(yytext, ' ');
1007		if (!tmp) {
1008			tmp = strrchr(yytext, '\t');
1009		}
1010		if (tmp) {
1011			const dname_type *dname;
1012
1013			/* split the original yytext */
1014			*tmp = '\0';
1015			strip_string(yytext);
1016
1017			dname = dname_parse(parser->region, tmp + 1);
1018			if (!dname) {
1019				zc_error("incorrect include origin '%s'",
1020					 tmp + 1);
1021			} else if (*(tmp + strlen(tmp + 1)) != '.') {
1022				zc_error("$INCLUDE directive requires absolute domain name");
1023			} else {
1024				origin = domain_table_insert(
1025					parser->db->domains, dname);
1026			}
1027		}
1028
1029		if (strlen(yytext) == 0) {
1030			zc_error("missing file name in $INCLUDE directive");
1031		} else if (!(input = fopen(yytext, "r"))) {
1032			zc_error("cannot open include file '%s': %s",
1033				 yytext, strerror(errno));
1034		} else {
1035			/* Initialize parser for include file.  */
1036			char *filename = region_strdup(parser->region, yytext);
1037			push_parser_state(input); /* Destroys yytext.  */
1038			parser->filename = filename;
1039			parser->line = 1;
1040			parser->origin = origin;
1041			lexer_state = EXPECT_OWNER;
1042		}
1043	}
1044
1045	parser->error_occurred = error_occurred;
1046}
1047	YY_BREAK
1048case YY_STATE_EOF(INITIAL):
1049#line 222 "zlexer.lex"
1050{
1051	yy_set_bol(1); /* Set beginning of line, so "^" rules match.  */
1052	if (include_stack_ptr == 0) {
1053		yyterminate();
1054	} else {
1055		fclose(yyin);
1056		pop_parser_state();
1057	}
1058}
1059	YY_BREAK
1060case 7:
1061YY_RULE_SETUP
1062#line 231 "zlexer.lex"
1063{ zc_warning("Unknown directive: %s", yytext); }
1064	YY_BREAK
1065case 8:
1066YY_RULE_SETUP
1067#line 232 "zlexer.lex"
1068{
1069	LEXOUT((". "));
1070	return parse_token('.', yytext, &lexer_state);
1071}
1072	YY_BREAK
1073case 9:
1074YY_RULE_SETUP
1075#line 236 "zlexer.lex"
1076{
1077	LEXOUT(("@ "));
1078	return parse_token('@', yytext, &lexer_state);
1079}
1080	YY_BREAK
1081case 10:
1082YY_RULE_SETUP
1083#line 240 "zlexer.lex"
1084{
1085	LEXOUT(("\\# "));
1086	return parse_token(URR, yytext, &lexer_state);
1087}
1088	YY_BREAK
1089case 11:
1090/* rule 11 can match eol */
1091YY_RULE_SETUP
1092#line 244 "zlexer.lex"
1093{
1094	++parser->line;
1095	if (!paren_open) {
1096		lexer_state = EXPECT_OWNER;
1097		LEXOUT(("NL\n"));
1098		return NL;
1099	} else {
1100		LEXOUT(("SP "));
1101		return SP;
1102	}
1103}
1104	YY_BREAK
1105case 12:
1106YY_RULE_SETUP
1107#line 255 "zlexer.lex"
1108{
1109	if (paren_open) {
1110		zc_error("nested parentheses");
1111		yyterminate();
1112	}
1113	LEXOUT(("( "));
1114	paren_open = 1;
1115	return SP;
1116}
1117	YY_BREAK
1118case 13:
1119YY_RULE_SETUP
1120#line 264 "zlexer.lex"
1121{
1122	if (!paren_open) {
1123		zc_error("closing parentheses without opening parentheses");
1124		yyterminate();
1125	}
1126	LEXOUT((") "));
1127	paren_open = 0;
1128	return SP;
1129}
1130	YY_BREAK
1131case 14:
1132YY_RULE_SETUP
1133#line 273 "zlexer.lex"
1134{
1135	if (!paren_open && lexer_state == EXPECT_OWNER) {
1136		lexer_state = PARSING_TTL_CLASS_TYPE;
1137		LEXOUT(("PREV "));
1138		return PREV;
1139	}
1140	if (lexer_state == PARSING_OWNER) {
1141		lexer_state = PARSING_TTL_CLASS_TYPE;
1142	}
1143	LEXOUT(("SP "));
1144	return SP;
1145}
1146	YY_BREAK
1147/* Bitlabels.  Strip leading and ending brackets.  */
1148case 15:
1149YY_RULE_SETUP
1150#line 287 "zlexer.lex"
1151{ BEGIN(bitlabel); }
1152	YY_BREAK
1153case YY_STATE_EOF(bitlabel):
1154#line 288 "zlexer.lex"
1155{
1156	zc_error("EOF inside bitlabel");
1157	BEGIN(INITIAL);
1158	yyrestart(yyin); /* this is so that lex does not give an internal err */
1159	yyterminate();
1160}
1161	YY_BREAK
1162case 16:
1163YY_RULE_SETUP
1164#line 294 "zlexer.lex"
1165{ yymore(); }
1166	YY_BREAK
1167case 17:
1168/* rule 17 can match eol */
1169YY_RULE_SETUP
1170#line 295 "zlexer.lex"
1171{ ++parser->line; yymore(); }
1172	YY_BREAK
1173case 18:
1174YY_RULE_SETUP
1175#line 296 "zlexer.lex"
1176{
1177	BEGIN(INITIAL);
1178	yytext[yyleng - 1] = '\0';
1179	return parse_token(BITLAB, yytext, &lexer_state);
1180}
1181	YY_BREAK
1182/* Quoted strings.  Strip leading and ending quotes.  */
1183case 19:
1184YY_RULE_SETUP
1185#line 303 "zlexer.lex"
1186{ BEGIN(quotedstring); LEXOUT(("\" ")); }
1187	YY_BREAK
1188case YY_STATE_EOF(quotedstring):
1189#line 304 "zlexer.lex"
1190{
1191	zc_error("EOF inside quoted string");
1192	BEGIN(INITIAL);
1193	yyrestart(yyin); /* this is so that lex does not give an internal err */
1194	yyterminate();
1195}
1196	YY_BREAK
1197case 20:
1198YY_RULE_SETUP
1199#line 310 "zlexer.lex"
1200{ LEXOUT(("STR ")); yymore(); }
1201	YY_BREAK
1202case 21:
1203/* rule 21 can match eol */
1204YY_RULE_SETUP
1205#line 311 "zlexer.lex"
1206{ ++parser->line; yymore(); }
1207	YY_BREAK
1208case 22:
1209YY_RULE_SETUP
1210#line 312 "zlexer.lex"
1211{
1212	LEXOUT(("\" "));
1213	BEGIN(INITIAL);
1214	yytext[yyleng - 1] = '\0';
1215	return parse_token(STR, yytext, &lexer_state);
1216}
1217	YY_BREAK
1218case 23:
1219/* rule 23 can match eol */
1220YY_RULE_SETUP
1221#line 319 "zlexer.lex"
1222{
1223	/* Any allowed word.  */
1224	return parse_token(STR, yytext, &lexer_state);
1225}
1226	YY_BREAK
1227case 24:
1228YY_RULE_SETUP
1229#line 323 "zlexer.lex"
1230{
1231	zc_error("unknown character '%c' (\\%03d) seen - is this a zonefile?",
1232		 (int) yytext[0], (int) yytext[0]);
1233}
1234	YY_BREAK
1235case 25:
1236YY_RULE_SETUP
1237#line 327 "zlexer.lex"
1238ECHO;
1239	YY_BREAK
1240#line 1240 "<stdout>"
1241
1242	case YY_END_OF_BUFFER:
1243		{
1244		/* Amount of text matched not including the EOB char. */
1245		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1246
1247		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1248		*yy_cp = (yy_hold_char);
1249		YY_RESTORE_YY_MORE_OFFSET
1250
1251		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1252			{
1253			/* We're scanning a new file or input source.  It's
1254			 * possible that this happened because the user
1255			 * just pointed yyin at a new source and called
1256			 * yylex().  If so, then we have to assure
1257			 * consistency between YY_CURRENT_BUFFER and our
1258			 * globals.  Here is the right place to do so, because
1259			 * this is the first action (other than possibly a
1260			 * back-up) that will match for the new input source.
1261			 */
1262			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1263			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1264			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1265			}
1266
1267		/* Note that here we test for yy_c_buf_p "<=" to the position
1268		 * of the first EOB in the buffer, since yy_c_buf_p will
1269		 * already have been incremented past the NUL character
1270		 * (since all states make transitions on EOB to the
1271		 * end-of-buffer state).  Contrast this with the test
1272		 * in input().
1273		 */
1274		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1275			{ /* This was really a NUL. */
1276			yy_state_type yy_next_state;
1277
1278			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1279
1280			yy_current_state = yy_get_previous_state(  );
1281
1282			/* Okay, we're now positioned to make the NUL
1283			 * transition.  We couldn't have
1284			 * yy_get_previous_state() go ahead and do it
1285			 * for us because it doesn't know how to deal
1286			 * with the possibility of jamming (and we don't
1287			 * want to build jamming into it because then it
1288			 * will run more slowly).
1289			 */
1290
1291			yy_next_state = yy_try_NUL_trans( yy_current_state );
1292
1293			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1294
1295			if ( yy_next_state )
1296				{
1297				/* Consume the NUL. */
1298				yy_cp = ++(yy_c_buf_p);
1299				yy_current_state = yy_next_state;
1300				goto yy_match;
1301				}
1302
1303			else
1304				{
1305				yy_cp = (yy_c_buf_p);
1306				goto yy_find_action;
1307				}
1308			}
1309
1310		else switch ( yy_get_next_buffer(  ) )
1311			{
1312			case EOB_ACT_END_OF_FILE:
1313				{
1314				(yy_did_buffer_switch_on_eof) = 0;
1315
1316				if ( yywrap( ) )
1317					{
1318					/* Note: because we've taken care in
1319					 * yy_get_next_buffer() to have set up
1320					 * yytext, we can now set up
1321					 * yy_c_buf_p so that if some total
1322					 * hoser (like flex itself) wants to
1323					 * call the scanner after we return the
1324					 * YY_NULL, it'll still work - another
1325					 * YY_NULL will get returned.
1326					 */
1327					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1328
1329					yy_act = YY_STATE_EOF(YY_START);
1330					goto do_action;
1331					}
1332
1333				else
1334					{
1335					if ( ! (yy_did_buffer_switch_on_eof) )
1336						YY_NEW_FILE;
1337					}
1338				break;
1339				}
1340
1341			case EOB_ACT_CONTINUE_SCAN:
1342				(yy_c_buf_p) =
1343					(yytext_ptr) + yy_amount_of_matched_text;
1344
1345				yy_current_state = yy_get_previous_state(  );
1346
1347				yy_cp = (yy_c_buf_p);
1348				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1349				goto yy_match;
1350
1351			case EOB_ACT_LAST_MATCH:
1352				(yy_c_buf_p) =
1353				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1354
1355				yy_current_state = yy_get_previous_state(  );
1356
1357				yy_cp = (yy_c_buf_p);
1358				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1359				goto yy_find_action;
1360			}
1361		break;
1362		}
1363
1364	default:
1365		YY_FATAL_ERROR(
1366			"fatal flex scanner internal error--no action found" );
1367	} /* end of action switch */
1368		} /* end of scanning one token */
1369	} /* end of user's declarations */
1370} /* end of yylex */
1371
1372/* yy_get_next_buffer - try to read in a new buffer
1373 *
1374 * Returns a code representing an action:
1375 *	EOB_ACT_LAST_MATCH -
1376 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1377 *	EOB_ACT_END_OF_FILE - end of file
1378 */
1379static int yy_get_next_buffer (void)
1380{
1381    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1382	char *source = (yytext_ptr);
1383	yy_size_t number_to_move, i;
1384	int ret_val;
1385
1386	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1387		YY_FATAL_ERROR(
1388		"fatal flex scanner internal error--end of buffer missed" );
1389
1390	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1391		{ /* Don't try to fill the buffer, so this is an EOF. */
1392		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1393			{
1394			/* We matched a single character, the EOB, so
1395			 * treat this as a final EOF.
1396			 */
1397			return EOB_ACT_END_OF_FILE;
1398			}
1399
1400		else
1401			{
1402			/* We matched some text prior to the EOB, first
1403			 * process it.
1404			 */
1405			return EOB_ACT_LAST_MATCH;
1406			}
1407		}
1408
1409	/* Try to read more data. */
1410
1411	/* First move last chars to start of buffer. */
1412	number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1413
1414	for ( i = 0; i < number_to_move; ++i )
1415		*(dest++) = *(source++);
1416
1417	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1418		/* don't do the read, it's not guaranteed to return an EOF,
1419		 * just force an EOF
1420		 */
1421		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1422
1423	else
1424		{
1425			int num_to_read =
1426			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1427
1428		while ( num_to_read <= 0 )
1429			{ /* Not enough room in the buffer - grow it. */
1430
1431			/* just a shorter name for the current buffer */
1432			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1433
1434			int yy_c_buf_p_offset =
1435				(int) ((yy_c_buf_p) - b->yy_ch_buf);
1436
1437			if ( b->yy_is_our_buffer )
1438				{
1439				int new_size = b->yy_buf_size * 2;
1440
1441				if ( new_size <= 0 )
1442					b->yy_buf_size += b->yy_buf_size / 8;
1443				else
1444					b->yy_buf_size *= 2;
1445
1446				b->yy_ch_buf = (char *)
1447					/* Include room in for 2 EOB chars. */
1448					yyrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2)  );
1449				}
1450			else
1451				/* Can't grow it, we don't own it. */
1452				b->yy_ch_buf = NULL;
1453
1454			if ( ! b->yy_ch_buf )
1455				YY_FATAL_ERROR(
1456				"fatal error - scanner input buffer overflow" );
1457
1458			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1459
1460			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1461						number_to_move - 1;
1462
1463			}
1464
1465		if ( num_to_read > YY_READ_BUF_SIZE )
1466			num_to_read = YY_READ_BUF_SIZE;
1467
1468		/* Read in more data. */
1469		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1470			(yy_n_chars), num_to_read );
1471
1472		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1473		}
1474
1475	if ( (yy_n_chars) == 0 )
1476		{
1477		if ( number_to_move == YY_MORE_ADJ )
1478			{
1479			ret_val = EOB_ACT_END_OF_FILE;
1480			yyrestart(yyin  );
1481			}
1482
1483		else
1484			{
1485			ret_val = EOB_ACT_LAST_MATCH;
1486			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1487				YY_BUFFER_EOF_PENDING;
1488			}
1489		}
1490
1491	else
1492		ret_val = EOB_ACT_CONTINUE_SCAN;
1493
1494	if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1495		/* Extend the array by 50%, plus the number we really need. */
1496		int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1497		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size  );
1498		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1499			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1500	}
1501
1502	(yy_n_chars) += number_to_move;
1503	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1504	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1505
1506	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1507
1508	return ret_val;
1509}
1510
1511/* yy_get_previous_state - get the state just before the EOB char was reached */
1512
1513    static yy_state_type yy_get_previous_state (void)
1514{
1515	yy_state_type yy_current_state;
1516	char *yy_cp;
1517
1518	yy_current_state = (yy_start);
1519	yy_current_state += YY_AT_BOL();
1520
1521	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1522		{
1523		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1524		if ( yy_accept[yy_current_state] )
1525			{
1526			(yy_last_accepting_state) = yy_current_state;
1527			(yy_last_accepting_cpos) = yy_cp;
1528			}
1529		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1530			{
1531			yy_current_state = (int) yy_def[yy_current_state];
1532			if ( yy_current_state >= 70 )
1533				yy_c = yy_meta[(unsigned int) yy_c];
1534			}
1535		yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1536		}
1537
1538	return yy_current_state;
1539}
1540
1541/* yy_try_NUL_trans - try to make a transition on the NUL character
1542 *
1543 * synopsis
1544 *	next_state = yy_try_NUL_trans( current_state );
1545 */
1546    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1547{
1548	int yy_is_jam;
1549    	char *yy_cp = (yy_c_buf_p);
1550
1551	YY_CHAR yy_c = 1;
1552	if ( yy_accept[yy_current_state] )
1553		{
1554		(yy_last_accepting_state) = yy_current_state;
1555		(yy_last_accepting_cpos) = yy_cp;
1556		}
1557	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1558		{
1559		yy_current_state = (int) yy_def[yy_current_state];
1560		if ( yy_current_state >= 70 )
1561			yy_c = yy_meta[(unsigned int) yy_c];
1562		}
1563	yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1564	yy_is_jam = (yy_current_state == 69);
1565
1566		return yy_is_jam ? 0 : yy_current_state;
1567}
1568
1569#ifndef YY_NO_UNPUT
1570
1571#endif
1572
1573#ifndef YY_NO_INPUT
1574#ifdef __cplusplus
1575    static int yyinput (void)
1576#else
1577    static int input  (void)
1578#endif
1579
1580{
1581	int c;
1582
1583	*(yy_c_buf_p) = (yy_hold_char);
1584
1585	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1586		{
1587		/* yy_c_buf_p now points to the character we want to return.
1588		 * If this occurs *before* the EOB characters, then it's a
1589		 * valid NUL; if not, then we've hit the end of the buffer.
1590		 */
1591		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1592			/* This was really a NUL. */
1593			*(yy_c_buf_p) = '\0';
1594
1595		else
1596			{ /* need more input */
1597			int offset = (yy_c_buf_p) - (yytext_ptr);
1598			++(yy_c_buf_p);
1599
1600			switch ( yy_get_next_buffer(  ) )
1601				{
1602				case EOB_ACT_LAST_MATCH:
1603					/* This happens because yy_g_n_b()
1604					 * sees that we've accumulated a
1605					 * token and flags that we need to
1606					 * try matching the token before
1607					 * proceeding.  But for input(),
1608					 * there's no matching to consider.
1609					 * So convert the EOB_ACT_LAST_MATCH
1610					 * to EOB_ACT_END_OF_FILE.
1611					 */
1612
1613					/* Reset buffer status. */
1614					yyrestart(yyin );
1615
1616					/*FALLTHROUGH*/
1617
1618				case EOB_ACT_END_OF_FILE:
1619					{
1620					if ( yywrap( ) )
1621						return 0;
1622
1623					if ( ! (yy_did_buffer_switch_on_eof) )
1624						YY_NEW_FILE;
1625#ifdef __cplusplus
1626					return yyinput();
1627#else
1628					return input();
1629#endif
1630					}
1631
1632				case EOB_ACT_CONTINUE_SCAN:
1633					(yy_c_buf_p) = (yytext_ptr) + offset;
1634					break;
1635				}
1636			}
1637		}
1638
1639	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
1640	*(yy_c_buf_p) = '\0';	/* preserve yytext */
1641	(yy_hold_char) = *++(yy_c_buf_p);
1642
1643	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1644
1645	return c;
1646}
1647#endif	/* ifndef YY_NO_INPUT */
1648
1649/** Immediately switch to a different input stream.
1650 * @param input_file A readable stream.
1651 *
1652 * @note This function does not reset the start condition to @c INITIAL .
1653 */
1654    void yyrestart  (FILE * input_file )
1655{
1656
1657	if ( ! YY_CURRENT_BUFFER ){
1658        yyensure_buffer_stack ();
1659		YY_CURRENT_BUFFER_LVALUE =
1660            yy_create_buffer(yyin,YY_BUF_SIZE );
1661	}
1662
1663	yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1664	yy_load_buffer_state( );
1665}
1666
1667/** Switch to a different input buffer.
1668 * @param new_buffer The new input buffer.
1669 *
1670 */
1671    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1672{
1673
1674	/* TODO. We should be able to replace this entire function body
1675	 * with
1676	 *		yypop_buffer_state();
1677	 *		yypush_buffer_state(new_buffer);
1678     */
1679	yyensure_buffer_stack ();
1680	if ( YY_CURRENT_BUFFER == new_buffer )
1681		return;
1682
1683	if ( YY_CURRENT_BUFFER )
1684		{
1685		/* Flush out information for old buffer. */
1686		*(yy_c_buf_p) = (yy_hold_char);
1687		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1688		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1689		}
1690
1691	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1692	yy_load_buffer_state( );
1693
1694	/* We don't actually know whether we did this switch during
1695	 * EOF (yywrap()) processing, but the only time this flag
1696	 * is looked at is after yywrap() is called, so it's safe
1697	 * to go ahead and always set it.
1698	 */
1699	(yy_did_buffer_switch_on_eof) = 1;
1700}
1701
1702static void yy_load_buffer_state  (void)
1703{
1704    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1705	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1706	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1707	(yy_hold_char) = *(yy_c_buf_p);
1708}
1709
1710/** Allocate and initialize an input buffer state.
1711 * @param file A readable stream.
1712 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1713 *
1714 * @return the allocated buffer state.
1715 */
1716    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1717{
1718	YY_BUFFER_STATE b;
1719
1720	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1721	if ( ! b )
1722		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1723
1724	b->yy_buf_size = size;
1725
1726	/* yy_ch_buf has to be 2 characters longer than the size given because
1727	 * we need to put in 2 end-of-buffer characters.
1728	 */
1729	b->yy_ch_buf = (char *) yyalloc((yy_size_t) (b->yy_buf_size + 2)  );
1730	if ( ! b->yy_ch_buf )
1731		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1732
1733	b->yy_is_our_buffer = 1;
1734
1735	yy_init_buffer(b,file );
1736
1737	return b;
1738}
1739
1740/** Destroy the buffer.
1741 * @param b a buffer created with yy_create_buffer()
1742 *
1743 */
1744    void yy_delete_buffer (YY_BUFFER_STATE  b )
1745{
1746
1747	if ( ! b )
1748		return;
1749
1750	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1751		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1752
1753	if ( b->yy_is_our_buffer )
1754		yyfree((void *) b->yy_ch_buf  );
1755
1756	yyfree((void *) b  );
1757}
1758
1759/* Initializes or reinitializes a buffer.
1760 * This function is sometimes called more than once on the same buffer,
1761 * such as during a yyrestart() or at EOF.
1762 */
1763    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1764
1765{
1766	int oerrno = errno;
1767
1768	yy_flush_buffer(b );
1769
1770	b->yy_input_file = file;
1771	b->yy_fill_buffer = 1;
1772
1773    /* If b is the current buffer, then yy_init_buffer was _probably_
1774     * called from yyrestart() or through yy_get_next_buffer.
1775     * In that case, we don't want to reset the lineno or column.
1776     */
1777    if (b != YY_CURRENT_BUFFER){
1778        b->yy_bs_lineno = 1;
1779        b->yy_bs_column = 0;
1780    }
1781
1782        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1783
1784	errno = oerrno;
1785}
1786
1787/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1788 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1789 *
1790 */
1791    void yy_flush_buffer (YY_BUFFER_STATE  b )
1792{
1793    	if ( ! b )
1794		return;
1795
1796	b->yy_n_chars = 0;
1797
1798	/* We always need two end-of-buffer characters.  The first causes
1799	 * a transition to the end-of-buffer state.  The second causes
1800	 * a jam in that state.
1801	 */
1802	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1803	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1804
1805	b->yy_buf_pos = &b->yy_ch_buf[0];
1806
1807	b->yy_at_bol = 1;
1808	b->yy_buffer_status = YY_BUFFER_NEW;
1809
1810	if ( b == YY_CURRENT_BUFFER )
1811		yy_load_buffer_state( );
1812}
1813
1814/** Pushes the new state onto the stack. The new state becomes
1815 *  the current state. This function will allocate the stack
1816 *  if necessary.
1817 *  @param new_buffer The new state.
1818 *
1819 */
1820void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1821{
1822    	if (new_buffer == NULL)
1823		return;
1824
1825	yyensure_buffer_stack();
1826
1827	/* This block is copied from yy_switch_to_buffer. */
1828	if ( YY_CURRENT_BUFFER )
1829		{
1830		/* Flush out information for old buffer. */
1831		*(yy_c_buf_p) = (yy_hold_char);
1832		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1833		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1834		}
1835
1836	/* Only push if top exists. Otherwise, replace top. */
1837	if (YY_CURRENT_BUFFER)
1838		(yy_buffer_stack_top)++;
1839	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1840
1841	/* copied from yy_switch_to_buffer. */
1842	yy_load_buffer_state( );
1843	(yy_did_buffer_switch_on_eof) = 1;
1844}
1845
1846/** Removes and deletes the top of the stack, if present.
1847 *  The next element becomes the new top.
1848 *
1849 */
1850void yypop_buffer_state (void)
1851{
1852    	if (!YY_CURRENT_BUFFER)
1853		return;
1854
1855	yy_delete_buffer(YY_CURRENT_BUFFER );
1856	YY_CURRENT_BUFFER_LVALUE = NULL;
1857	if ((yy_buffer_stack_top) > 0)
1858		--(yy_buffer_stack_top);
1859
1860	if (YY_CURRENT_BUFFER) {
1861		yy_load_buffer_state( );
1862		(yy_did_buffer_switch_on_eof) = 1;
1863	}
1864}
1865
1866/* Allocates the stack if it does not exist.
1867 *  Guarantees space for at least one push.
1868 */
1869static void yyensure_buffer_stack (void)
1870{
1871	int num_to_alloc;
1872
1873	if (!(yy_buffer_stack)) {
1874
1875		/* First allocation is just for 2 elements, since we don't know if this
1876		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1877		 * immediate realloc on the next call.
1878         */
1879      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1880		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1881								(num_to_alloc * sizeof(struct yy_buffer_state*)
1882								);
1883		if ( ! (yy_buffer_stack) )
1884			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1885
1886		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1887
1888		(yy_buffer_stack_max) = num_to_alloc;
1889		(yy_buffer_stack_top) = 0;
1890		return;
1891	}
1892
1893	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1894
1895		/* Increase the buffer to prepare for a possible push. */
1896		yy_size_t grow_size = 8 /* arbitrary grow size */;
1897
1898		num_to_alloc = (yy_buffer_stack_max) + grow_size;
1899		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1900								((yy_buffer_stack),
1901								num_to_alloc * sizeof(struct yy_buffer_state*)
1902								);
1903		if ( ! (yy_buffer_stack) )
1904			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1905
1906		/* zero only the new slots.*/
1907		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1908		(yy_buffer_stack_max) = num_to_alloc;
1909	}
1910}
1911
1912/** Setup the input buffer state to scan directly from a user-specified character buffer.
1913 * @param base the character buffer
1914 * @param size the size in bytes of the character buffer
1915 *
1916 * @return the newly allocated buffer state object.
1917 */
1918YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
1919{
1920	YY_BUFFER_STATE b;
1921
1922	if ( size < 2 ||
1923	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
1924	     base[size-1] != YY_END_OF_BUFFER_CHAR )
1925		/* They forgot to leave room for the EOB's. */
1926		return NULL;
1927
1928	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1929	if ( ! b )
1930		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1931
1932	b->yy_buf_size = (int) (size - 2);	/* "- 2" to take care of EOB's */
1933	b->yy_buf_pos = b->yy_ch_buf = base;
1934	b->yy_is_our_buffer = 0;
1935	b->yy_input_file = NULL;
1936	b->yy_n_chars = b->yy_buf_size;
1937	b->yy_is_interactive = 0;
1938	b->yy_at_bol = 1;
1939	b->yy_fill_buffer = 0;
1940	b->yy_buffer_status = YY_BUFFER_NEW;
1941
1942	yy_switch_to_buffer(b  );
1943
1944	return b;
1945}
1946
1947/** Setup the input buffer state to scan a string. The next call to yylex() will
1948 * scan from a @e copy of @a str.
1949 * @param yystr a NUL-terminated string to scan
1950 *
1951 * @return the newly allocated buffer state object.
1952 * @note If you want to scan bytes that may contain NUL values, then use
1953 *       yy_scan_bytes() instead.
1954 */
1955YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1956{
1957
1958	return yy_scan_bytes(yystr,(int) strlen(yystr) );
1959}
1960
1961/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1962 * scan from a @e copy of @a bytes.
1963 * @param yybytes the byte buffer to scan
1964 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1965 *
1966 * @return the newly allocated buffer state object.
1967 */
1968YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
1969{
1970	YY_BUFFER_STATE b;
1971	char *buf;
1972	yy_size_t n;
1973	int i;
1974
1975	/* Get memory for full buffer, including space for trailing EOB's. */
1976	n = (yy_size_t) (_yybytes_len + 2);
1977	buf = (char *) yyalloc(n  );
1978	if ( ! buf )
1979		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1980
1981	for ( i = 0; i < _yybytes_len; ++i )
1982		buf[i] = yybytes[i];
1983
1984	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1985
1986	b = yy_scan_buffer(buf,n );
1987	if ( ! b )
1988		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1989
1990	/* It's okay to grow etc. this buffer, and we should throw it
1991	 * away when we're done.
1992	 */
1993	b->yy_is_our_buffer = 1;
1994
1995	return b;
1996}
1997
1998#ifndef YY_EXIT_FAILURE
1999#define YY_EXIT_FAILURE 2
2000#endif
2001
2002static void yynoreturn yy_fatal_error (yyconst char* msg )
2003{
2004			(void) fprintf( stderr, "%s\n", msg );
2005	exit( YY_EXIT_FAILURE );
2006}
2007
2008/* Redefine yyless() so it works in section 3 code. */
2009
2010#undef yyless
2011#define yyless(n) \
2012	do \
2013		{ \
2014		/* Undo effects of setting up yytext. */ \
2015        yy_size_t yyless_macro_arg = (n); \
2016        YY_LESS_LINENO(yyless_macro_arg);\
2017		yytext[yyleng] = (yy_hold_char); \
2018		(yy_c_buf_p) = yytext + yyless_macro_arg; \
2019		(yy_hold_char) = *(yy_c_buf_p); \
2020		*(yy_c_buf_p) = '\0'; \
2021		yyleng = yyless_macro_arg; \
2022		} \
2023	while ( 0 )
2024
2025/* Accessor  methods (get/set functions) to struct members. */
2026
2027/** Get the current line number.
2028 *
2029 */
2030int yyget_lineno  (void)
2031{
2032
2033    return yylineno;
2034}
2035
2036/** Get the input stream.
2037 *
2038 */
2039FILE *yyget_in  (void)
2040{
2041        return yyin;
2042}
2043
2044/** Get the output stream.
2045 *
2046 */
2047FILE *yyget_out  (void)
2048{
2049        return yyout;
2050}
2051
2052/** Get the length of the current token.
2053 *
2054 */
2055int yyget_leng  (void)
2056{
2057        return yyleng;
2058}
2059
2060/** Get the current token.
2061 *
2062 */
2063
2064char *yyget_text  (void)
2065{
2066        return yytext;
2067}
2068
2069/** Set the current line number.
2070 * @param _line_number line number
2071 *
2072 */
2073void yyset_lineno (int  _line_number )
2074{
2075
2076    yylineno = _line_number;
2077}
2078
2079/** Set the input stream. This does not discard the current
2080 * input buffer.
2081 * @param _in_str A readable stream.
2082 *
2083 * @see yy_switch_to_buffer
2084 */
2085void yyset_in (FILE *  _in_str )
2086{
2087        yyin = _in_str ;
2088}
2089
2090void yyset_out (FILE *  _out_str )
2091{
2092        yyout = _out_str ;
2093}
2094
2095int yyget_debug  (void)
2096{
2097        return yy_flex_debug;
2098}
2099
2100void yyset_debug (int  _bdebug )
2101{
2102        yy_flex_debug = _bdebug ;
2103}
2104
2105static int yy_init_globals (void)
2106{
2107        /* Initialization is the same as for the non-reentrant scanner.
2108     * This function is called from yylex_destroy(), so don't allocate here.
2109     */
2110
2111    (yy_buffer_stack) = NULL;
2112    (yy_buffer_stack_top) = 0;
2113    (yy_buffer_stack_max) = 0;
2114    (yy_c_buf_p) = NULL;
2115    (yy_init) = 0;
2116    (yy_start) = 0;
2117
2118/* Defined in main.c */
2119#ifdef YY_STDINIT
2120    yyin = stdin;
2121    yyout = stdout;
2122#else
2123    yyin = NULL;
2124    yyout = NULL;
2125#endif
2126
2127    /* For future reference: Set errno on error, since we are called by
2128     * yylex_init()
2129     */
2130    return 0;
2131}
2132
2133/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2134int yylex_destroy  (void)
2135{
2136
2137    /* Pop the buffer stack, destroying each element. */
2138	while(YY_CURRENT_BUFFER){
2139		yy_delete_buffer(YY_CURRENT_BUFFER  );
2140		YY_CURRENT_BUFFER_LVALUE = NULL;
2141		yypop_buffer_state();
2142	}
2143
2144	/* Destroy the stack itself. */
2145	yyfree((yy_buffer_stack) );
2146	(yy_buffer_stack) = NULL;
2147
2148    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2149     * yylex() is called, initialization will occur. */
2150    yy_init_globals( );
2151
2152    return 0;
2153}
2154
2155/*
2156 * Internal utility routines.
2157 */
2158
2159#ifndef yytext_ptr
2160static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2161{
2162
2163	int i;
2164	for ( i = 0; i < n; ++i )
2165		s1[i] = s2[i];
2166}
2167#endif
2168
2169#ifdef YY_NEED_STRLEN
2170static int yy_flex_strlen (yyconst char * s )
2171{
2172	int n;
2173	for ( n = 0; s[n]; ++n )
2174		;
2175
2176	return n;
2177}
2178#endif
2179
2180void *yyalloc (yy_size_t  size )
2181{
2182			return malloc(size);
2183}
2184
2185void *yyrealloc  (void * ptr, yy_size_t  size )
2186{
2187
2188	/* The cast to (char *) in the following accommodates both
2189	 * implementations that use char* generic pointers, and those
2190	 * that use void* generic pointers.  It works with the latter
2191	 * because both ANSI C and C++ allow castless assignment from
2192	 * any pointer type to void*, and deal with argument conversions
2193	 * as though doing an assignment.
2194	 */
2195	return realloc(ptr, size);
2196}
2197
2198void yyfree (void * ptr )
2199{
2200			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
2201}
2202
2203#define YYTABLES_NAME "yytables"
2204
2205#line 327 "zlexer.lex"
2206
2207
2208
2209/*
2210 * Analyze "word" to see if it matches an RR type, possibly by using
2211 * the "TYPExxx" notation.  If it matches, the corresponding token is
2212 * returned and the TYPE parameter is set to the RR type value.
2213 */
2214static int
2215rrtype_to_token(const char *word, uint16_t *type)
2216{
2217	uint16_t t = rrtype_from_string(word);
2218	if (t != 0) {
2219		rrtype_descriptor_type *entry = rrtype_descriptor_by_type(t);
2220		*type = t;
2221		return entry->token;
2222	}
2223
2224	return 0;
2225}
2226
2227
2228/*
2229 * Remove \DDD constructs from the input. See RFC 1035, section 5.1.
2230 */
2231static size_t
2232zoctet(char *text)
2233{
2234	/*
2235	 * s follows the string, p lags behind and rebuilds the new
2236	 * string
2237	 */
2238	char *s;
2239	char *p;
2240
2241	for (s = p = text; *s; ++s, ++p) {
2242		assert(p <= s);
2243		if (s[0] != '\\') {
2244			/* Ordinary character.  */
2245			*p = *s;
2246		} else if (isdigit((unsigned char)s[1]) && isdigit((unsigned char)s[2]) && isdigit((unsigned char)s[3])) {
2247			/* \DDD escape.  */
2248			int val = (hexdigit_to_int(s[1]) * 100 +
2249				   hexdigit_to_int(s[2]) * 10 +
2250				   hexdigit_to_int(s[3]));
2251			if (0 <= val && val <= 255) {
2252				s += 3;
2253				*p = val;
2254			} else {
2255				zc_warning("text escape \\DDD overflow");
2256				*p = *++s;
2257			}
2258		} else if (s[1] != '\0') {
2259			/* \X where X is any character, keep X.  */
2260			*p = *++s;
2261		} else {
2262			/* Trailing backslash, ignore it.  */
2263			zc_warning("trailing backslash ignored");
2264			--p;
2265		}
2266	}
2267	*p = '\0';
2268	return p - text;
2269}
2270
2271static int
2272parse_token(int token, char *yytext, enum lexer_state *lexer_state)
2273{
2274	size_t len;
2275	char *str;
2276
2277	if (*lexer_state == EXPECT_OWNER) {
2278		*lexer_state = PARSING_OWNER;
2279	} else if (*lexer_state == PARSING_TTL_CLASS_TYPE) {
2280		const char *t;
2281		int token;
2282		uint16_t rrclass;
2283
2284		/* type */
2285		token = rrtype_to_token(yytext, &yylval.type);
2286		if (token != 0) {
2287			*lexer_state = PARSING_RDATA;
2288			LEXOUT(("%d[%s] ", token, yytext));
2289			return token;
2290		}
2291
2292		/* class */
2293		rrclass = rrclass_from_string(yytext);
2294		if (rrclass != 0) {
2295			yylval.klass = rrclass;
2296			LEXOUT(("CLASS "));
2297			return T_RRCLASS;
2298		}
2299
2300		/* ttl */
2301		yylval.ttl = strtottl(yytext, &t);
2302		if (*t == '\0') {
2303			LEXOUT(("TTL "));
2304			return T_TTL;
2305		}
2306	}
2307
2308	str = region_strdup(parser->rr_region, yytext);
2309	len = zoctet(str);
2310
2311	yylval.data.str = str;
2312	yylval.data.len = len;
2313
2314	LEXOUT(("%d[%s] ", token, yytext));
2315	return token;
2316}
2317
2318