"Fossies" - the Fresh Open Source Software Archive

Member "nsd-4.3.6/zlexer.c" (6 Apr 2021, 59429 Bytes) of package /linux/misc/dns/nsd-4.3.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "zlexer.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 4.3.5_vs_4.3.6.

    1 #include "config.h"
    2 
    3 #line 2 "<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 4
   13 #if YY_FLEX_SUBMINOR_VERSION > 0
   14 #define FLEX_BETA
   15 #endif
   16 
   17 /* First, we deal with  platform-specific or compiler-specific issues. */
   18 
   19 /* begin standard C headers. */
   20 #include <stdio.h>
   21 #include <string.h>
   22 #include <errno.h>
   23 #include <stdlib.h>
   24 
   25 /* end standard C headers. */
   26 
   27 /* flex integer type definitions */
   28 
   29 #ifndef FLEXINT_H
   30 #define FLEXINT_H
   31 
   32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
   33 
   34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
   35 
   36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
   37  * if you want the limit (max/min) macros for int types. 
   38  */
   39 #ifndef __STDC_LIMIT_MACROS
   40 #define __STDC_LIMIT_MACROS 1
   41 #endif
   42 
   43 #include <inttypes.h>
   44 typedef int8_t flex_int8_t;
   45 typedef uint8_t flex_uint8_t;
   46 typedef int16_t flex_int16_t;
   47 typedef uint16_t flex_uint16_t;
   48 typedef int32_t flex_int32_t;
   49 typedef uint32_t flex_uint32_t;
   50 #else
   51 typedef signed char flex_int8_t;
   52 typedef short int flex_int16_t;
   53 typedef int flex_int32_t;
   54 typedef unsigned char flex_uint8_t; 
   55 typedef unsigned short int flex_uint16_t;
   56 typedef unsigned int flex_uint32_t;
   57 
   58 /* Limits of integral types. */
   59 #ifndef INT8_MIN
   60 #define INT8_MIN               (-128)
   61 #endif
   62 #ifndef INT16_MIN
   63 #define INT16_MIN              (-32767-1)
   64 #endif
   65 #ifndef INT32_MIN
   66 #define INT32_MIN              (-2147483647-1)
   67 #endif
   68 #ifndef INT8_MAX
   69 #define INT8_MAX               (127)
   70 #endif
   71 #ifndef INT16_MAX
   72 #define INT16_MAX              (32767)
   73 #endif
   74 #ifndef INT32_MAX
   75 #define INT32_MAX              (2147483647)
   76 #endif
   77 #ifndef UINT8_MAX
   78 #define UINT8_MAX              (255U)
   79 #endif
   80 #ifndef UINT16_MAX
   81 #define UINT16_MAX             (65535U)
   82 #endif
   83 #ifndef UINT32_MAX
   84 #define UINT32_MAX             (4294967295U)
   85 #endif
   86 
   87 #ifndef SIZE_MAX
   88 #define SIZE_MAX               (~(size_t)0)
   89 #endif
   90 
   91 #endif /* ! C99 */
   92 
   93 #endif /* ! FLEXINT_H */
   94 
   95 /* begin standard C++ headers. */
   96 
   97 /* TODO: this is always defined, so inline it */
   98 #define yyconst const
   99 
  100 #if defined(__GNUC__) && __GNUC__ >= 3
  101 #define yynoreturn __attribute__((__noreturn__))
  102 #else
  103 #define yynoreturn
  104 #endif
  105 
  106 /* Returned upon end-of-file. */
  107 #define YY_NULL 0
  108 
  109 /* Promotes a possibly negative, possibly signed char to an
  110  *   integer in range [0..255] for use as an array index.
  111  */
  112 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
  113 
  114 /* Enter a start condition.  This macro really ought to take a parameter,
  115  * but we do it the disgusting crufty way forced on us by the ()-less
  116  * definition of BEGIN.
  117  */
  118 #define BEGIN (yy_start) = 1 + 2 *
  119 /* Translate the current start state into a value that can be later handed
  120  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  121  * compatibility.
  122  */
  123 #define YY_START (((yy_start) - 1) / 2)
  124 #define YYSTATE YY_START
  125 /* Action number for EOF rule of a given start state. */
  126 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  127 /* Special action meaning "start processing a new file". */
  128 #define YY_NEW_FILE yyrestart( yyin  )
  129 #define YY_END_OF_BUFFER_CHAR 0
  130 
  131 /* Size of default input buffer. */
  132 #ifndef YY_BUF_SIZE
  133 #ifdef __ia64__
  134 /* On IA-64, the buffer size is 16k, not 8k.
  135  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
  136  * Ditto for the __ia64__ case accordingly.
  137  */
  138 #define YY_BUF_SIZE 32768
  139 #else
  140 #define YY_BUF_SIZE 16384
  141 #endif /* __ia64__ */
  142 #endif
  143 
  144 /* The state buf must be large enough to hold one state per character in the main buffer.
  145  */
  146 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  147 
  148 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  149 #define YY_TYPEDEF_YY_BUFFER_STATE
  150 typedef struct yy_buffer_state *YY_BUFFER_STATE;
  151 #endif
  152 
  153 #ifndef YY_TYPEDEF_YY_SIZE_T
  154 #define YY_TYPEDEF_YY_SIZE_T
  155 typedef size_t yy_size_t;
  156 #endif
  157 
  158 extern int yyleng;
  159 
  160 extern FILE *yyin, *yyout;
  161 
  162 #define EOB_ACT_CONTINUE_SCAN 0
  163 #define EOB_ACT_END_OF_FILE 1
  164 #define EOB_ACT_LAST_MATCH 2
  165     
  166     #define YY_LESS_LINENO(n)
  167     #define YY_LINENO_REWIND_TO(ptr)
  168     
  169 /* Return all but the first "n" matched characters back to the input stream. */
  170 #define yyless(n) \
  171     do \
  172         { \
  173         /* Undo effects of setting up yytext. */ \
  174         int yyless_macro_arg = (n); \
  175         YY_LESS_LINENO(yyless_macro_arg);\
  176         *yy_cp = (yy_hold_char); \
  177         YY_RESTORE_YY_MORE_OFFSET \
  178         (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  179         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  180         } \
  181     while ( 0 )
  182 #define unput(c) yyunput( c, (yytext_ptr)  )
  183 
  184 #ifndef YY_STRUCT_YY_BUFFER_STATE
  185 #define YY_STRUCT_YY_BUFFER_STATE
  186 struct yy_buffer_state
  187     {
  188     FILE *yy_input_file;
  189 
  190     char *yy_ch_buf;        /* input buffer */
  191     char *yy_buf_pos;       /* current position in input buffer */
  192 
  193     /* Size of input buffer in bytes, not including room for EOB
  194      * characters.
  195      */
  196     int yy_buf_size;
  197 
  198     /* Number of characters read into yy_ch_buf, not including EOB
  199      * characters.
  200      */
  201     int yy_n_chars;
  202 
  203     /* Whether we "own" the buffer - i.e., we know we created it,
  204      * and can realloc() it to grow it, and should free() it to
  205      * delete it.
  206      */
  207     int yy_is_our_buffer;
  208 
  209     /* Whether this is an "interactive" input source; if so, and
  210      * if we're using stdio for input, then we want to use getc()
  211      * instead of fread(), to make sure we stop fetching input after
  212      * each newline.
  213      */
  214     int yy_is_interactive;
  215 
  216     /* Whether we're considered to be at the beginning of a line.
  217      * If so, '^' rules will be active on the next match, otherwise
  218      * not.
  219      */
  220     int yy_at_bol;
  221 
  222     int yy_bs_lineno; /**< The line count. */
  223     int yy_bs_column; /**< The column count. */
  224 
  225     /* Whether to try to fill the input buffer when we reach the
  226      * end of it.
  227      */
  228     int yy_fill_buffer;
  229 
  230     int yy_buffer_status;
  231 
  232 #define YY_BUFFER_NEW 0
  233 #define YY_BUFFER_NORMAL 1
  234     /* When an EOF's been seen but there's still some text to process
  235      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  236      * shouldn't try reading from the input source any more.  We might
  237      * still have a bunch of tokens to match, though, because of
  238      * possible backing-up.
  239      *
  240      * When we actually see the EOF, we change the status to "new"
  241      * (via yyrestart()), so that the user can continue scanning by
  242      * just pointing yyin at a new input file.
  243      */
  244 #define YY_BUFFER_EOF_PENDING 2
  245 
  246     };
  247 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  248 
  249 /* Stack of input buffers. */
  250 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  251 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  252 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
  253 
  254 /* We provide macros for accessing buffer states in case in the
  255  * future we want to put the buffer states in a more general
  256  * "scanner state".
  257  *
  258  * Returns the top of the stack, or NULL.
  259  */
  260 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  261                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  262                           : NULL)
  263 /* Same as previous macro, but useful when we know that the buffer stack is not
  264  * NULL or when we need an lvalue. For internal use only.
  265  */
  266 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  267 
  268 /* yy_hold_char holds the character lost when yytext is formed. */
  269 static char yy_hold_char;
  270 static int yy_n_chars;      /* number of characters read into yy_ch_buf */
  271 int yyleng;
  272 
  273 /* Points to current character in buffer. */
  274 static char *yy_c_buf_p = NULL;
  275 static int yy_init = 0;     /* whether we need to initialize */
  276 static int yy_start = 0;    /* start state number */
  277 
  278 /* Flag which is used to allow yywrap()'s to do buffer switches
  279  * instead of setting up a fresh yyin.  A bit of a hack ...
  280  */
  281 static int yy_did_buffer_switch_on_eof;
  282 
  283 void yyrestart ( FILE *input_file  );
  284 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer  );
  285 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size  );
  286 void yy_delete_buffer ( YY_BUFFER_STATE b  );
  287 void yy_flush_buffer ( YY_BUFFER_STATE b  );
  288 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer  );
  289 void yypop_buffer_state ( void );
  290 
  291 static void yyensure_buffer_stack ( void );
  292 static void yy_load_buffer_state ( void );
  293 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
  294 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
  295 
  296 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size  );
  297 YY_BUFFER_STATE yy_scan_string ( const char *yy_str  );
  298 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len  );
  299 
  300 void *yyalloc ( yy_size_t  );
  301 void *yyrealloc ( void *, yy_size_t  );
  302 void yyfree ( void *  );
  303 
  304 #define yy_new_buffer yy_create_buffer
  305 #define yy_set_interactive(is_interactive) \
  306     { \
  307     if ( ! YY_CURRENT_BUFFER ){ \
  308         yyensure_buffer_stack (); \
  309         YY_CURRENT_BUFFER_LVALUE =    \
  310             yy_create_buffer( yyin, YY_BUF_SIZE ); \
  311     } \
  312     YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  313     }
  314 #define yy_set_bol(at_bol) \
  315     { \
  316     if ( ! YY_CURRENT_BUFFER ){\
  317         yyensure_buffer_stack (); \
  318         YY_CURRENT_BUFFER_LVALUE =    \
  319             yy_create_buffer( yyin, YY_BUF_SIZE ); \
  320     } \
  321     YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  322     }
  323 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  324 
  325 /* Begin user sect3 */
  326 typedef flex_uint8_t YY_CHAR;
  327 
  328 FILE *yyin = NULL, *yyout = NULL;
  329 
  330 typedef int yy_state_type;
  331 
  332 extern int yylineno;
  333 int yylineno = 1;
  334 
  335 extern char *yytext;
  336 #ifdef yytext_ptr
  337 #undef yytext_ptr
  338 #endif
  339 #define yytext_ptr yytext
  340 
  341 static yy_state_type yy_get_previous_state ( void );
  342 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  );
  343 static int yy_get_next_buffer ( void );
  344 static void yynoreturn yy_fatal_error ( const char* msg  );
  345 
  346 /* Done after the current pattern has been matched and before the
  347  * corresponding action - sets up yytext.
  348  */
  349 #define YY_DO_BEFORE_ACTION \
  350     (yytext_ptr) = yy_bp; \
  351     (yytext_ptr) -= (yy_more_len); \
  352     yyleng = (int) (yy_cp - (yytext_ptr)); \
  353     (yy_hold_char) = *yy_cp; \
  354     *yy_cp = '\0'; \
  355     (yy_c_buf_p) = yy_cp;
  356 #define YY_NUM_RULES 25
  357 #define YY_END_OF_BUFFER 26
  358 /* This struct is not used in this scanner,
  359    but its presence is necessary. */
  360 struct yy_trans_info
  361     {
  362     flex_int32_t yy_verify;
  363     flex_int32_t yy_nxt;
  364     };
  365 static const flex_int16_t yy_accept[70] =
  366     {   0,
  367         0,    0,    0,    0,   16,   16,   20,   20,   26,   23,
  368        14,   11,   11,   19,   24,   12,   13,    8,    1,    9,
  369        23,   24,    6,    5,   16,   17,   16,   18,   20,   21,
  370        22,   25,   23,   23,   14,    1,    1,   23,   23,   10,
  371        15,   23,    7,    7,    7,    7,    6,   16,   16,   16,
  372        16,   20,    0,   23,   23,    7,    7,    7,    7,    7,
  373         2,    7,    7,    7,    7,    7,    3,    4,    0
  374     } ;
  375 
  376 static const YY_CHAR yy_ec[256] =
  377     {   0,
  378         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  379         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
  380         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  381         1,    2,    1,    5,    6,    7,    1,    1,    1,    8,
  382         9,    1,    1,    1,    1,   10,    1,    1,    1,    1,
  383         1,    1,    1,    1,    1,    1,    1,    1,   11,    1,
  384         1,    1,    1,   12,   13,   13,   14,   15,   16,   13,
  385        17,   13,   18,   13,   13,   19,   13,   20,   21,   13,
  386        13,   22,   13,   23,   24,   13,   13,   13,   13,   13,
  387        25,   26,   27,    1,    1,    1,   13,   13,   28,   29,
  388 
  389        30,   13,   31,   13,   32,   13,   13,   33,   13,   34,
  390        35,   13,   13,   36,   13,   37,   38,   13,   13,   13,
  391        13,   13,    1,    1,    1,    1,    1,    1,    1,    1,
  392         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  393         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  394         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  395         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  396         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  397         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  398         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  399 
  400         1,    1,    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
  406     } ;
  407 
  408 static const YY_CHAR yy_meta[39] =
  409     {   0,
  410         1,    2,    3,    2,    4,    1,    1,    2,    2,    2,
  411         2,    1,    5,    5,    5,    5,    5,    5,    5,    5,
  412         5,    5,    5,    5,    1,    1,    6,    5,    5,    5,
  413         5,    5,    5,    5,    5,    5,    5,    5
  414     } ;
  415 
  416 static const flex_int16_t yy_base[83] =
  417     {   0,
  418         0,   25,  115,  114,   12,   14,   16,   17,  116,   89,
  419        12,  218,  218,  218,  218,  218,  218,  218,    0,   88,
  420        50,   59,    0,  218,   87,  218,   18,  218,   86,  218,
  421       218,  106,   84,   95,   14,    0,    0,   82,   81,   76,
  422        75,  120,    0,   28,   27,   27,    0,   64,   20,   63,
  423        39,   59,   63,    5,    0,   43,   49,   50,   51,   55,
  424         0,   49,   56,   63,   59,   79,    0,    0,  218,  146,
  425       152,  158,  164,  170,  176,  182,    1,  188,  194,  199,
  426       205,  211
  427     } ;
  428 
  429 static const flex_int16_t yy_def[83] =
  430     {   0,
  431        70,   70,   71,   71,   72,   72,   73,   73,   69,   74,
  432        69,   69,   69,   69,   69,   69,   69,   69,   75,   74,
  433        76,   77,   78,   69,   79,   69,   80,   69,   81,   69,
  434        69,   81,   74,   82,   69,   75,   75,   74,   74,   74,
  435        74,   82,   77,   77,   77,   77,   78,   79,   80,   79,
  436        80,   81,   81,   74,   42,   77,   77,   77,   77,   77,
  437        77,   77,   77,   77,   77,   77,   77,   77,    0,   69,
  438        69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  439        69,   69
  440     } ;
  441 
  442 static const flex_int16_t yy_nxt[257] =
  443     {   0,
  444        69,   11,   12,   13,   14,   43,   15,   16,   17,   18,
  445        19,   20,   69,   35,   26,   35,   26,   69,   30,   30,
  446        31,   31,   36,   69,   36,   21,   11,   12,   13,   14,
  447        34,   22,   16,   17,   18,   19,   20,   27,   28,   27,
  448        28,   32,   32,   51,   48,   51,   48,   56,   57,   58,
  449        21,   39,   39,   39,   39,   40,   59,   39,   39,   39,
  450        39,   56,   57,   58,   51,   48,   60,   52,   61,   62,
  451        59,   63,   64,   65,   41,   42,   44,   66,   67,   45,
  452        60,   46,   61,   62,   53,   63,   64,   65,   49,   49,
  453        44,   66,   67,   45,   68,   46,   33,   33,   33,   33,
  454 
  455        34,   34,   33,   33,   33,   33,   34,   34,   68,   34,
  456        52,   53,   49,   34,   34,   69,   24,   24,   69,   69,
  457        55,   33,   33,   33,   33,   69,   69,   33,   33,   33,
  458        33,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  459        69,   69,   69,   69,   69,   55,   10,   10,   10,   10,
  460        10,   10,   23,   23,   23,   23,   23,   23,   25,   25,
  461        25,   25,   25,   25,   29,   29,   29,   29,   29,   29,
  462        33,   69,   69,   69,   33,   33,   37,   37,   69,   37,
  463        37,   37,   38,   38,   38,   38,   38,   38,   47,   47,
  464        69,   47,   47,   47,   48,   48,   69,   48,   48,   50,
  465 
  466        50,   69,   50,   50,   50,   52,   52,   69,   69,   52,
  467        52,   54,   54,   54,   54,   54,   54,    9,   69,   69,
  468        69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  469        69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  470        69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  471        69,   69,   69,   69,   69,   69
  472     } ;
  473 
  474 static const flex_int16_t yy_chk[257] =
  475     {   0,
  476         0,    1,    1,    1,    1,   77,    1,    1,    1,    1,
  477         1,    1,    0,   11,    5,   35,    6,    0,    7,    8,
  478         7,    8,   11,    0,   35,    1,    2,    2,    2,    2,
  479        54,    2,    2,    2,    2,    2,    2,    5,    5,    6,
  480         6,    7,    8,   27,   27,   49,   49,   44,   45,   46,
  481         2,   21,   21,   21,   21,   21,   56,   21,   21,   21,
  482        21,   44,   45,   46,   51,   51,   57,   53,   58,   59,
  483        56,   60,   62,   63,   21,   21,   22,   64,   65,   22,
  484        57,   22,   58,   59,   52,   60,   62,   63,   50,   48,
  485        22,   64,   65,   22,   66,   22,   34,   34,   34,   34,
  486 
  487        41,   40,   34,   34,   34,   34,   39,   38,   66,   33,
  488        32,   29,   25,   20,   10,    9,    4,    3,    0,    0,
  489        34,   42,   42,   42,   42,    0,    0,   42,   42,   42,
  490        42,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  491         0,    0,    0,    0,    0,   42,   70,   70,   70,   70,
  492        70,   70,   71,   71,   71,   71,   71,   71,   72,   72,
  493        72,   72,   72,   72,   73,   73,   73,   73,   73,   73,
  494        74,    0,    0,    0,   74,   74,   75,   75,    0,   75,
  495        75,   75,   76,   76,   76,   76,   76,   76,   78,   78,
  496         0,   78,   78,   78,   79,   79,    0,   79,   79,   80,
  497 
  498        80,    0,   80,   80,   80,   81,   81,    0,    0,   81,
  499        81,   82,   82,   82,   82,   82,   82,   69,   69,   69,
  500        69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  501        69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  502        69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
  503        69,   69,   69,   69,   69,   69
  504     } ;
  505 
  506 static yy_state_type yy_last_accepting_state;
  507 static char *yy_last_accepting_cpos;
  508 
  509 extern int yy_flex_debug;
  510 int yy_flex_debug = 0;
  511 
  512 /* The intent behind this definition is that it'll catch
  513  * any uses of REJECT which flex missed.
  514  */
  515 #define REJECT reject_used_but_not_detected
  516 static int yy_more_flag = 0;
  517 static int yy_more_len = 0;
  518 #define yymore() ((yy_more_flag) = 1)
  519 #define YY_MORE_ADJ (yy_more_len)
  520 #define YY_RESTORE_YY_MORE_OFFSET
  521 char *yytext;
  522 #line 1 "zlexer.lex"
  523 #line 2 "zlexer.lex"
  524 /*
  525  * zlexer.lex - lexical analyzer for (DNS) zone files
  526  * 
  527  * Copyright (c) 2001-2006, NLnet Labs. All rights reserved
  528  *
  529  * See LICENSE for the license.
  530  *
  531  */
  532 /* because flex keeps having sign-unsigned compare problems that are unfixed*/
  533 #if defined(__clang__)||(defined(__GNUC__)&&((__GNUC__ >4)||(defined(__GNUC_MINOR__)&&(__GNUC__ ==4)&&(__GNUC_MINOR__ >=2))))
  534 #pragma GCC diagnostic ignored "-Wsign-compare"
  535 #endif
  536 /* ignore fallthrough warnings in the generated parse code case statements */
  537 #if defined(__clang__)||(defined(__GNUC__)&&(__GNUC__ >=7))
  538 #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
  539 #endif
  540 
  541 #include "config.h"
  542 
  543 #include <ctype.h>
  544 #include <errno.h>
  545 #include <string.h>
  546 #include <strings.h>
  547 
  548 #include "zonec.h"
  549 #include "dname.h"
  550 #include "zparser.h"
  551 
  552 #if 0
  553 #define LEXOUT(s)  printf s /* used ONLY when debugging */
  554 #else
  555 #define LEXOUT(s)
  556 #endif
  557 
  558 enum lexer_state {
  559     EXPECT_OWNER,
  560     PARSING_OWNER,
  561     PARSING_TTL_CLASS_TYPE,
  562     PARSING_RDATA
  563 };
  564 
  565 static int parse_token(int token, char *yytext, enum lexer_state *lexer_state);
  566 
  567 static YY_BUFFER_STATE include_stack[MAXINCLUDES];
  568 static zparser_type zparser_stack[MAXINCLUDES];
  569 static int include_stack_ptr = 0;
  570 
  571 /*
  572  * Saves the file specific variables on the include stack.
  573  */
  574 static void
  575 push_parser_state(FILE *input)
  576 {
  577     zparser_stack[include_stack_ptr].filename = parser->filename;
  578     zparser_stack[include_stack_ptr].line = parser->line;
  579     zparser_stack[include_stack_ptr].origin = parser->origin;
  580     include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
  581     yy_switch_to_buffer(yy_create_buffer(input, YY_BUF_SIZE));
  582     ++include_stack_ptr;
  583 }
  584 
  585 /*
  586  * Restores the file specific variables from the include stack.
  587  */
  588 static void
  589 pop_parser_state(void)
  590 {
  591     if (parser->filename)
  592         region_recycle(parser->region, (void *)parser->filename,
  593             strlen(parser->filename)+1);
  594 
  595     --include_stack_ptr;
  596     parser->filename = zparser_stack[include_stack_ptr].filename;
  597     parser->line = zparser_stack[include_stack_ptr].line;
  598     parser->origin = zparser_stack[include_stack_ptr].origin;
  599     yy_delete_buffer(YY_CURRENT_BUFFER);
  600     yy_switch_to_buffer(include_stack[include_stack_ptr]);
  601 }
  602 
  603 static YY_BUFFER_STATE oldstate;
  604 /* Start string scan */
  605 void
  606 parser_push_stringbuf(char* str)
  607 {
  608     oldstate = YY_CURRENT_BUFFER;
  609     yy_switch_to_buffer(yy_scan_string(str));
  610 }
  611 
  612 void
  613 parser_pop_stringbuf(void)
  614 {
  615     yy_delete_buffer(YY_CURRENT_BUFFER);
  616     yy_switch_to_buffer(oldstate);
  617     oldstate = NULL;
  618 }
  619 
  620     static int paren_open = 0;
  621     static enum lexer_state lexer_state = EXPECT_OWNER;
  622 void
  623 parser_flush(void)
  624 {
  625     YY_FLUSH_BUFFER;
  626     paren_open = 0;
  627     lexer_state = EXPECT_OWNER;
  628 }
  629 
  630 #ifndef yy_set_bol /* compat definition, for flex 2.4.6 */
  631 #define yy_set_bol(at_bol) \
  632     { \
  633         if ( ! yy_current_buffer ) \
  634             yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  635         yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \
  636     }
  637 #endif
  638     
  639 #line 638 "<stdout>"
  640 #define YY_NO_INPUT 1
  641 #line 121 "zlexer.lex"
  642 #ifndef YY_NO_UNPUT
  643 #define YY_NO_UNPUT 1
  644 #endif
  645 #ifndef YY_NO_INPUT
  646 #define YY_NO_INPUT 1
  647 #endif
  648 #line 647 "<stdout>"
  649 
  650 #line 649 "<stdout>"
  651 
  652 #define INITIAL 0
  653 #define incl 1
  654 #define bitlabel 2
  655 #define quotedstring 3
  656 
  657 #ifndef YY_NO_UNISTD_H
  658 /* Special case for "unistd.h", since it is non-ANSI. We include it way
  659  * down here because we want the user's section 1 to have been scanned first.
  660  * The user has a chance to override it with an option.
  661  */
  662 #include <unistd.h>
  663 #endif
  664 
  665 #ifndef YY_EXTRA_TYPE
  666 #define YY_EXTRA_TYPE void *
  667 #endif
  668 
  669 static int yy_init_globals ( void );
  670 
  671 /* Accessor methods to globals.
  672    These are made visible to non-reentrant scanners for convenience. */
  673 
  674 int yylex_destroy ( void );
  675 
  676 int yyget_debug ( void );
  677 
  678 void yyset_debug ( int debug_flag  );
  679 
  680 YY_EXTRA_TYPE yyget_extra ( void );
  681 
  682 void yyset_extra ( YY_EXTRA_TYPE user_defined  );
  683 
  684 FILE *yyget_in ( void );
  685 
  686 void yyset_in  ( FILE * _in_str  );
  687 
  688 FILE *yyget_out ( void );
  689 
  690 void yyset_out  ( FILE * _out_str  );
  691 
  692             int yyget_leng ( void );
  693 
  694 char *yyget_text ( void );
  695 
  696 int yyget_lineno ( void );
  697 
  698 void yyset_lineno ( int _line_number  );
  699 
  700 /* Macros after this point can all be overridden by user definitions in
  701  * section 1.
  702  */
  703 
  704 #ifndef YY_SKIP_YYWRAP
  705 #ifdef __cplusplus
  706 extern "C" int yywrap ( void );
  707 #else
  708 extern int yywrap ( void );
  709 #endif
  710 #endif
  711 
  712 #ifndef YY_NO_UNPUT
  713     
  714 #endif
  715 
  716 #ifndef yytext_ptr
  717 static void yy_flex_strncpy ( char *, const char *, int );
  718 #endif
  719 
  720 #ifdef YY_NEED_STRLEN
  721 static int yy_flex_strlen ( const char * );
  722 #endif
  723 
  724 #ifndef YY_NO_INPUT
  725 #ifdef __cplusplus
  726 static int yyinput ( void );
  727 #else
  728 static int input ( void );
  729 #endif
  730 
  731 #endif
  732 
  733 /* Amount of stuff to slurp up with each read. */
  734 #ifndef YY_READ_BUF_SIZE
  735 #ifdef __ia64__
  736 /* On IA-64, the buffer size is 16k, not 8k */
  737 #define YY_READ_BUF_SIZE 16384
  738 #else
  739 #define YY_READ_BUF_SIZE 8192
  740 #endif /* __ia64__ */
  741 #endif
  742 
  743 /* Copy whatever the last rule matched to the standard output. */
  744 #ifndef ECHO
  745 /* This used to be an fputs(), but since the string might contain NUL's,
  746  * we now use fwrite().
  747  */
  748 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
  749 #endif
  750 
  751 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  752  * is returned in "result".
  753  */
  754 #ifndef YY_INPUT
  755 #define YY_INPUT(buf,result,max_size) \
  756     if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  757         { \
  758         int c = '*'; \
  759         int n; \
  760         for ( n = 0; n < max_size && \
  761                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  762             buf[n] = (char) c; \
  763         if ( c == '\n' ) \
  764             buf[n++] = (char) c; \
  765         if ( c == EOF && ferror( yyin ) ) \
  766             YY_FATAL_ERROR( "input in flex scanner failed" ); \
  767         result = n; \
  768         } \
  769     else \
  770         { \
  771         errno=0; \
  772         while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
  773             { \
  774             if( errno != EINTR) \
  775                 { \
  776                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
  777                 break; \
  778                 } \
  779             errno=0; \
  780             clearerr(yyin); \
  781             } \
  782         }\
  783 \
  784 
  785 #endif
  786 
  787 /* No semi-colon after return; correct usage is to write "yyterminate();" -
  788  * we don't want an extra ';' after the "return" because that will cause
  789  * some compilers to complain about unreachable statements.
  790  */
  791 #ifndef yyterminate
  792 #define yyterminate() return YY_NULL
  793 #endif
  794 
  795 /* Number of entries by which start-condition stack grows. */
  796 #ifndef YY_START_STACK_INCR
  797 #define YY_START_STACK_INCR 25
  798 #endif
  799 
  800 /* Report a fatal error. */
  801 #ifndef YY_FATAL_ERROR
  802 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  803 #endif
  804 
  805 /* end tables serialization structures and prototypes */
  806 
  807 /* Default declaration of generated scanner - a define so the user can
  808  * easily add parameters.
  809  */
  810 #ifndef YY_DECL
  811 #define YY_DECL_IS_OURS 1
  812 
  813 extern int yylex (void);
  814 
  815 #define YY_DECL int yylex (void)
  816 #endif /* !YY_DECL */
  817 
  818 /* Code executed at the beginning of each rule, after yytext and yyleng
  819  * have been set up.
  820  */
  821 #ifndef YY_USER_ACTION
  822 #define YY_USER_ACTION
  823 #endif
  824 
  825 /* Code executed at the end of each rule. */
  826 #ifndef YY_BREAK
  827 #define YY_BREAK /*LINTED*/break;
  828 #endif
  829 
  830 #define YY_RULE_SETUP \
  831     if ( yyleng > 0 ) \
  832         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
  833                 (yytext[yyleng - 1] == '\n'); \
  834     YY_USER_ACTION
  835 
  836 /** The main scanner function which does all the work.
  837  */
  838 YY_DECL
  839 {
  840     yy_state_type yy_current_state;
  841     char *yy_cp, *yy_bp;
  842     int yy_act;
  843     
  844     if ( !(yy_init) )
  845         {
  846         (yy_init) = 1;
  847 
  848 #ifdef YY_USER_INIT
  849         YY_USER_INIT;
  850 #endif
  851 
  852         if ( ! (yy_start) )
  853             (yy_start) = 1; /* first start state */
  854 
  855         if ( ! yyin )
  856             yyin = stdin;
  857 
  858         if ( ! yyout )
  859             yyout = stdout;
  860 
  861         if ( ! YY_CURRENT_BUFFER ) {
  862             yyensure_buffer_stack ();
  863             YY_CURRENT_BUFFER_LVALUE =
  864                 yy_create_buffer( yyin, YY_BUF_SIZE );
  865         }
  866 
  867         yy_load_buffer_state(  );
  868         }
  869 
  870     {
  871 #line 143 "zlexer.lex"
  872 
  873 #line 872 "<stdout>"
  874 
  875     while ( /*CONSTCOND*/1 )        /* loops until end-of-file is reached */
  876         {
  877         (yy_more_len) = 0;
  878         if ( (yy_more_flag) )
  879             {
  880             (yy_more_len) = (int) ((yy_c_buf_p) - (yytext_ptr));
  881             (yy_more_flag) = 0;
  882             }
  883         yy_cp = (yy_c_buf_p);
  884 
  885         /* Support of yytext. */
  886         *yy_cp = (yy_hold_char);
  887 
  888         /* yy_bp points to the position in yy_ch_buf of the start of
  889          * the current run.
  890          */
  891         yy_bp = yy_cp;
  892 
  893         yy_current_state = (yy_start);
  894         yy_current_state += YY_AT_BOL();
  895 yy_match:
  896         do
  897             {
  898             YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
  899             if ( yy_accept[yy_current_state] )
  900                 {
  901                 (yy_last_accepting_state) = yy_current_state;
  902                 (yy_last_accepting_cpos) = yy_cp;
  903                 }
  904             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  905                 {
  906                 yy_current_state = (int) yy_def[yy_current_state];
  907                 if ( yy_current_state >= 70 )
  908                     yy_c = yy_meta[yy_c];
  909                 }
  910             yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  911             ++yy_cp;
  912             }
  913         while ( yy_base[yy_current_state] != 218 );
  914 
  915 yy_find_action:
  916         yy_act = yy_accept[yy_current_state];
  917         if ( yy_act == 0 )
  918             { /* have to back up */
  919             yy_cp = (yy_last_accepting_cpos);
  920             yy_current_state = (yy_last_accepting_state);
  921             yy_act = yy_accept[yy_current_state];
  922             }
  923 
  924         YY_DO_BEFORE_ACTION;
  925 
  926 do_action:  /* This label is used only to access EOF actions. */
  927 
  928         switch ( yy_act )
  929     { /* beginning of action switch */
  930             case 0: /* must back up */
  931             /* undo the effects of YY_DO_BEFORE_ACTION */
  932             *yy_cp = (yy_hold_char);
  933             yy_cp = (yy_last_accepting_cpos);
  934             yy_current_state = (yy_last_accepting_state);
  935             goto yy_find_action;
  936 
  937 case 1:
  938 YY_RULE_SETUP
  939 #line 144 "zlexer.lex"
  940 /* ignore */
  941     YY_BREAK
  942 case 2:
  943 YY_RULE_SETUP
  944 #line 145 "zlexer.lex"
  945 { lexer_state = PARSING_RDATA; return DOLLAR_TTL; }
  946     YY_BREAK
  947 case 3:
  948 YY_RULE_SETUP
  949 #line 146 "zlexer.lex"
  950 { lexer_state = PARSING_RDATA; return DOLLAR_ORIGIN; }
  951     YY_BREAK
  952 /*
  953      * Handle $INCLUDE directives.  See
  954      * http://dinosaur.compilertools.net/flex/flex_12.html#SEC12.
  955      */
  956 case 4:
  957 YY_RULE_SETUP
  958 #line 152 "zlexer.lex"
  959 {
  960     BEGIN(incl);
  961     /* ignore case statement fallthrough on incl<EOF> flex rule */
  962 }
  963     YY_BREAK
  964 case 5:
  965 /* rule 5 can match eol */
  966 #line 157 "zlexer.lex"
  967 YY_RULE_SETUP
  968 case YY_STATE_EOF(incl):
  969 #line 157 "zlexer.lex"
  970 {
  971     int error_occurred = parser->error_occurred;
  972     BEGIN(INITIAL);
  973     zc_error("missing file name in $INCLUDE directive");
  974     yy_set_bol(1); /* Set beginning of line, so "^" rules match.  */
  975     ++parser->line;
  976     parser->error_occurred = error_occurred;
  977 }
  978     YY_BREAK
  979 case 6:
  980 YY_RULE_SETUP
  981 #line 165 "zlexer.lex"
  982 {   
  983     char *tmp;
  984     domain_type *origin = parser->origin;
  985     int error_occurred = parser->error_occurred;
  986     
  987     BEGIN(INITIAL);
  988     if (include_stack_ptr >= MAXINCLUDES ) {
  989         zc_error("includes nested too deeply, skipped (>%d)",
  990              MAXINCLUDES);
  991     } else {
  992         FILE *input;
  993 
  994         /* Remove trailing comment.  */
  995         tmp = strrchr(yytext, ';');
  996         if (tmp) {
  997             *tmp = '\0';
  998         }
  999         strip_string(yytext);
 1000         
 1001         /* Parse origin for include file.  */
 1002         tmp = strrchr(yytext, ' ');
 1003         if (!tmp) {
 1004             tmp = strrchr(yytext, '\t');
 1005         }
 1006         if (tmp) {
 1007             const dname_type *dname;
 1008             
 1009             /* split the original yytext */
 1010             *tmp = '\0';
 1011             strip_string(yytext);
 1012 
 1013             dname = dname_parse(parser->region, tmp + 1);
 1014             if (!dname) {
 1015                 zc_error("incorrect include origin '%s'",
 1016                      tmp + 1);
 1017             } else if (*(tmp + strlen(tmp + 1)) != '.') {
 1018                 zc_error("$INCLUDE directive requires absolute domain name");
 1019             } else {
 1020                 origin = domain_table_insert(
 1021                     parser->db->domains, dname);
 1022             }
 1023         }
 1024         
 1025         if (strlen(yytext) == 0) {
 1026             zc_error("missing file name in $INCLUDE directive");
 1027         } else if (!(input = fopen(yytext, "r"))) {
 1028             zc_error("cannot open include file '%s': %s",
 1029                  yytext, strerror(errno));
 1030         } else {
 1031             /* Initialize parser for include file.  */
 1032             char *filename = region_strdup(parser->region, yytext);
 1033             push_parser_state(input); /* Destroys yytext.  */
 1034             parser->filename = filename;
 1035             parser->line = 1;
 1036             parser->origin = origin;
 1037             lexer_state = EXPECT_OWNER;
 1038         }
 1039     }
 1040 
 1041     parser->error_occurred = error_occurred;
 1042 }
 1043     YY_BREAK
 1044 case YY_STATE_EOF(INITIAL):
 1045 #line 226 "zlexer.lex"
 1046 {
 1047     yy_set_bol(1); /* Set beginning of line, so "^" rules match.  */
 1048     if (include_stack_ptr == 0) {
 1049         yyterminate();
 1050     } else {
 1051         fclose(yyin);
 1052         pop_parser_state();
 1053     }
 1054 }
 1055     YY_BREAK
 1056 case 7:
 1057 YY_RULE_SETUP
 1058 #line 235 "zlexer.lex"
 1059 { zc_warning("Unknown directive: %s", yytext); }
 1060     YY_BREAK
 1061 case 8:
 1062 YY_RULE_SETUP
 1063 #line 236 "zlexer.lex"
 1064 {
 1065     LEXOUT((". "));
 1066     return parse_token('.', yytext, &lexer_state);
 1067 }
 1068     YY_BREAK
 1069 case 9:
 1070 YY_RULE_SETUP
 1071 #line 240 "zlexer.lex"
 1072 {
 1073     LEXOUT(("@ "));
 1074     return parse_token('@', yytext, &lexer_state);
 1075 }
 1076     YY_BREAK
 1077 case 10:
 1078 YY_RULE_SETUP
 1079 #line 244 "zlexer.lex"
 1080 {
 1081     LEXOUT(("\\# "));
 1082     return parse_token(URR, yytext, &lexer_state);
 1083 }
 1084     YY_BREAK
 1085 case 11:
 1086 /* rule 11 can match eol */
 1087 YY_RULE_SETUP
 1088 #line 248 "zlexer.lex"
 1089 {
 1090     ++parser->line;
 1091     if (!paren_open) { 
 1092         lexer_state = EXPECT_OWNER;
 1093         LEXOUT(("NL\n"));
 1094         return NL;
 1095     } else {
 1096         LEXOUT(("SP "));
 1097         return SP;
 1098     }
 1099 }
 1100     YY_BREAK
 1101 case 12:
 1102 YY_RULE_SETUP
 1103 #line 259 "zlexer.lex"
 1104 {
 1105     if (paren_open) {
 1106         zc_error("nested parentheses");
 1107         yyterminate();
 1108     }
 1109     LEXOUT(("( "));
 1110     paren_open = 1;
 1111     return SP;
 1112 }
 1113     YY_BREAK
 1114 case 13:
 1115 YY_RULE_SETUP
 1116 #line 268 "zlexer.lex"
 1117 {
 1118     if (!paren_open) {
 1119         zc_error("closing parentheses without opening parentheses");
 1120         yyterminate();
 1121     }
 1122     LEXOUT((") "));
 1123     paren_open = 0;
 1124     return SP;
 1125 }
 1126     YY_BREAK
 1127 case 14:
 1128 YY_RULE_SETUP
 1129 #line 277 "zlexer.lex"
 1130 {
 1131     if (!paren_open && lexer_state == EXPECT_OWNER) {
 1132         lexer_state = PARSING_TTL_CLASS_TYPE;
 1133         LEXOUT(("PREV "));
 1134         return PREV;
 1135     }
 1136     if (lexer_state == PARSING_OWNER) {
 1137         lexer_state = PARSING_TTL_CLASS_TYPE;
 1138     }
 1139     LEXOUT(("SP "));
 1140     return SP;
 1141 }
 1142     YY_BREAK
 1143 /* Bitlabels.  Strip leading and ending brackets.  */
 1144 case 15:
 1145 YY_RULE_SETUP
 1146 #line 291 "zlexer.lex"
 1147 { BEGIN(bitlabel); }
 1148     YY_BREAK
 1149 case YY_STATE_EOF(bitlabel):
 1150 #line 292 "zlexer.lex"
 1151 {
 1152     zc_error("EOF inside bitlabel");
 1153     BEGIN(INITIAL);
 1154     yyrestart(yyin); /* this is so that lex does not give an internal err */
 1155     yyterminate();
 1156 }
 1157     YY_BREAK
 1158 case 16:
 1159 YY_RULE_SETUP
 1160 #line 298 "zlexer.lex"
 1161 { yymore(); }
 1162     YY_BREAK
 1163 case 17:
 1164 /* rule 17 can match eol */
 1165 YY_RULE_SETUP
 1166 #line 299 "zlexer.lex"
 1167 { ++parser->line; yymore(); }
 1168     YY_BREAK
 1169 case 18:
 1170 YY_RULE_SETUP
 1171 #line 300 "zlexer.lex"
 1172 {
 1173     BEGIN(INITIAL);
 1174     yytext[yyleng - 1] = '\0';
 1175     return parse_token(BITLAB, yytext, &lexer_state);
 1176 }
 1177     YY_BREAK
 1178 /* Quoted strings.  Strip leading and ending quotes.  */
 1179 case 19:
 1180 YY_RULE_SETUP
 1181 #line 307 "zlexer.lex"
 1182 { BEGIN(quotedstring); LEXOUT(("\" ")); }
 1183     YY_BREAK
 1184 case YY_STATE_EOF(quotedstring):
 1185 #line 308 "zlexer.lex"
 1186 {
 1187     zc_error("EOF inside quoted string");
 1188     BEGIN(INITIAL);
 1189     yyrestart(yyin); /* this is so that lex does not give an internal err */
 1190     yyterminate();
 1191 }
 1192     YY_BREAK
 1193 case 20:
 1194 YY_RULE_SETUP
 1195 #line 314 "zlexer.lex"
 1196 { LEXOUT(("QSTR ")); yymore(); }
 1197     YY_BREAK
 1198 case 21:
 1199 /* rule 21 can match eol */
 1200 YY_RULE_SETUP
 1201 #line 315 "zlexer.lex"
 1202 { ++parser->line; yymore(); }
 1203     YY_BREAK
 1204 case 22:
 1205 YY_RULE_SETUP
 1206 #line 316 "zlexer.lex"
 1207 {
 1208     LEXOUT(("\" "));
 1209     BEGIN(INITIAL);
 1210     yytext[yyleng - 1] = '\0';
 1211     return parse_token(QSTR, yytext, &lexer_state);
 1212 }
 1213     YY_BREAK
 1214 case 23:
 1215 /* rule 23 can match eol */
 1216 YY_RULE_SETUP
 1217 #line 323 "zlexer.lex"
 1218 {
 1219     /* Any allowed word.  */
 1220     return parse_token(STR, yytext, &lexer_state);
 1221 }
 1222     YY_BREAK
 1223 case 24:
 1224 YY_RULE_SETUP
 1225 #line 327 "zlexer.lex"
 1226 {
 1227     zc_error("unknown character '%c' (\\%03d) seen - is this a zonefile?",
 1228          (int) yytext[0], (int) yytext[0]);
 1229 }
 1230     YY_BREAK
 1231 case 25:
 1232 YY_RULE_SETUP
 1233 #line 331 "zlexer.lex"
 1234 ECHO;
 1235     YY_BREAK
 1236 #line 1235 "<stdout>"
 1237 
 1238     case YY_END_OF_BUFFER:
 1239         {
 1240         /* Amount of text matched not including the EOB char. */
 1241         int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
 1242 
 1243         /* Undo the effects of YY_DO_BEFORE_ACTION. */
 1244         *yy_cp = (yy_hold_char);
 1245         YY_RESTORE_YY_MORE_OFFSET
 1246 
 1247         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
 1248             {
 1249             /* We're scanning a new file or input source.  It's
 1250              * possible that this happened because the user
 1251              * just pointed yyin at a new source and called
 1252              * yylex().  If so, then we have to assure
 1253              * consistency between YY_CURRENT_BUFFER and our
 1254              * globals.  Here is the right place to do so, because
 1255              * this is the first action (other than possibly a
 1256              * back-up) that will match for the new input source.
 1257              */
 1258             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 1259             YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
 1260             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
 1261             }
 1262 
 1263         /* Note that here we test for yy_c_buf_p "<=" to the position
 1264          * of the first EOB in the buffer, since yy_c_buf_p will
 1265          * already have been incremented past the NUL character
 1266          * (since all states make transitions on EOB to the
 1267          * end-of-buffer state).  Contrast this with the test
 1268          * in input().
 1269          */
 1270         if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
 1271             { /* This was really a NUL. */
 1272             yy_state_type yy_next_state;
 1273 
 1274             (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
 1275 
 1276             yy_current_state = yy_get_previous_state(  );
 1277 
 1278             /* Okay, we're now positioned to make the NUL
 1279              * transition.  We couldn't have
 1280              * yy_get_previous_state() go ahead and do it
 1281              * for us because it doesn't know how to deal
 1282              * with the possibility of jamming (and we don't
 1283              * want to build jamming into it because then it
 1284              * will run more slowly).
 1285              */
 1286 
 1287             yy_next_state = yy_try_NUL_trans( yy_current_state );
 1288 
 1289             yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 1290 
 1291             if ( yy_next_state )
 1292                 {
 1293                 /* Consume the NUL. */
 1294                 yy_cp = ++(yy_c_buf_p);
 1295                 yy_current_state = yy_next_state;
 1296                 goto yy_match;
 1297                 }
 1298 
 1299             else
 1300                 {
 1301                 yy_cp = (yy_c_buf_p);
 1302                 goto yy_find_action;
 1303                 }
 1304             }
 1305 
 1306         else switch ( yy_get_next_buffer(  ) )
 1307             {
 1308             case EOB_ACT_END_OF_FILE:
 1309                 {
 1310                 (yy_did_buffer_switch_on_eof) = 0;
 1311 
 1312                 if ( yywrap(  ) )
 1313                     {
 1314                     /* Note: because we've taken care in
 1315                      * yy_get_next_buffer() to have set up
 1316                      * yytext, we can now set up
 1317                      * yy_c_buf_p so that if some total
 1318                      * hoser (like flex itself) wants to
 1319                      * call the scanner after we return the
 1320                      * YY_NULL, it'll still work - another
 1321                      * YY_NULL will get returned.
 1322                      */
 1323                     (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
 1324 
 1325                     yy_act = YY_STATE_EOF(YY_START);
 1326                     goto do_action;
 1327                     }
 1328 
 1329                 else
 1330                     {
 1331                     if ( ! (yy_did_buffer_switch_on_eof) )
 1332                         YY_NEW_FILE;
 1333                     }
 1334                 break;
 1335                 }
 1336 
 1337             case EOB_ACT_CONTINUE_SCAN:
 1338                 (yy_c_buf_p) =
 1339                     (yytext_ptr) + yy_amount_of_matched_text;
 1340 
 1341                 yy_current_state = yy_get_previous_state(  );
 1342 
 1343                 yy_cp = (yy_c_buf_p);
 1344                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 1345                 goto yy_match;
 1346 
 1347             case EOB_ACT_LAST_MATCH:
 1348                 (yy_c_buf_p) =
 1349                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
 1350 
 1351                 yy_current_state = yy_get_previous_state(  );
 1352 
 1353                 yy_cp = (yy_c_buf_p);
 1354                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 1355                 goto yy_find_action;
 1356             }
 1357         break;
 1358         }
 1359 
 1360     default:
 1361         YY_FATAL_ERROR(
 1362             "fatal flex scanner internal error--no action found" );
 1363     } /* end of action switch */
 1364         } /* end of scanning one token */
 1365     } /* end of user's declarations */
 1366 } /* end of yylex */
 1367 
 1368 /* yy_get_next_buffer - try to read in a new buffer
 1369  *
 1370  * Returns a code representing an action:
 1371  *  EOB_ACT_LAST_MATCH -
 1372  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 1373  *  EOB_ACT_END_OF_FILE - end of file
 1374  */
 1375 static int yy_get_next_buffer (void)
 1376 {
 1377         char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 1378     char *source = (yytext_ptr);
 1379     int number_to_move, i;
 1380     int ret_val;
 1381 
 1382     if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 1383         YY_FATAL_ERROR(
 1384         "fatal flex scanner internal error--end of buffer missed" );
 1385 
 1386     if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 1387         { /* Don't try to fill the buffer, so this is an EOF. */
 1388         if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 1389             {
 1390             /* We matched a single character, the EOB, so
 1391              * treat this as a final EOF.
 1392              */
 1393             return EOB_ACT_END_OF_FILE;
 1394             }
 1395 
 1396         else
 1397             {
 1398             /* We matched some text prior to the EOB, first
 1399              * process it.
 1400              */
 1401             return EOB_ACT_LAST_MATCH;
 1402             }
 1403         }
 1404 
 1405     /* Try to read more data. */
 1406 
 1407     /* First move last chars to start of buffer. */
 1408     number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
 1409 
 1410     for ( i = 0; i < number_to_move; ++i )
 1411         *(dest++) = *(source++);
 1412 
 1413     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 1414         /* don't do the read, it's not guaranteed to return an EOF,
 1415          * just force an EOF
 1416          */
 1417         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 1418 
 1419     else
 1420         {
 1421             int num_to_read =
 1422             YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 1423 
 1424         while ( num_to_read <= 0 )
 1425             { /* Not enough room in the buffer - grow it. */
 1426 
 1427             /* just a shorter name for the current buffer */
 1428             YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 1429 
 1430             int yy_c_buf_p_offset =
 1431                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
 1432 
 1433             if ( b->yy_is_our_buffer )
 1434                 {
 1435                 int new_size = b->yy_buf_size * 2;
 1436 
 1437                 if ( new_size <= 0 )
 1438                     b->yy_buf_size += b->yy_buf_size / 8;
 1439                 else
 1440                     b->yy_buf_size *= 2;
 1441 
 1442                 b->yy_ch_buf = (char *)
 1443                     /* Include room in for 2 EOB chars. */
 1444                     yyrealloc( (void *) b->yy_ch_buf,
 1445                              (yy_size_t) (b->yy_buf_size + 2)  );
 1446                 }
 1447             else
 1448                 /* Can't grow it, we don't own it. */
 1449                 b->yy_ch_buf = NULL;
 1450 
 1451             if ( ! b->yy_ch_buf )
 1452                 YY_FATAL_ERROR(
 1453                 "fatal error - scanner input buffer overflow" );
 1454 
 1455             (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
 1456 
 1457             num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
 1458                         number_to_move - 1;
 1459 
 1460             }
 1461 
 1462         if ( num_to_read > YY_READ_BUF_SIZE )
 1463             num_to_read = YY_READ_BUF_SIZE;
 1464 
 1465         /* Read in more data. */
 1466         YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
 1467             (yy_n_chars), num_to_read );
 1468 
 1469         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 1470         }
 1471 
 1472     if ( (yy_n_chars) == 0 )
 1473         {
 1474         if ( number_to_move == YY_MORE_ADJ )
 1475             {
 1476             ret_val = EOB_ACT_END_OF_FILE;
 1477             yyrestart( yyin  );
 1478             }
 1479 
 1480         else
 1481             {
 1482             ret_val = EOB_ACT_LAST_MATCH;
 1483             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
 1484                 YY_BUFFER_EOF_PENDING;
 1485             }
 1486         }
 1487 
 1488     else
 1489         ret_val = EOB_ACT_CONTINUE_SCAN;
 1490 
 1491     if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 1492         /* Extend the array by 50%, plus the number we really need. */
 1493         int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
 1494         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
 1495             (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size  );
 1496         if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 1497             YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
 1498         /* "- 2" to take care of EOB's */
 1499         YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
 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[yy_c];
 1534             }
 1535         yy_current_state = yy_nxt[yy_base[yy_current_state] + 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[yy_c];
 1562         }
 1563     yy_current_state = yy_nxt[yy_base[yy_current_state] + 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 = (int) ((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 
 1702 static 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  */
 1820 void 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  */
 1850 void 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  */
 1869 static void yyensure_buffer_stack (void)
 1870 {
 1871     yy_size_t 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  */
 1918 YY_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  */
 1955 YY_BUFFER_STATE yy_scan_string (const 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  */
 1968 YY_BUFFER_STATE yy_scan_bytes  (const 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 
 2002 static void yynoreturn yy_fatal_error (const char* msg )
 2003 {
 2004             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         int 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  */
 2030 int yyget_lineno  (void)
 2031 {
 2032     
 2033     return yylineno;
 2034 }
 2035 
 2036 /** Get the input stream.
 2037  * 
 2038  */
 2039 FILE *yyget_in  (void)
 2040 {
 2041         return yyin;
 2042 }
 2043 
 2044 /** Get the output stream.
 2045  * 
 2046  */
 2047 FILE *yyget_out  (void)
 2048 {
 2049         return yyout;
 2050 }
 2051 
 2052 /** Get the length of the current token.
 2053  * 
 2054  */
 2055 int yyget_leng  (void)
 2056 {
 2057         return yyleng;
 2058 }
 2059 
 2060 /** Get the current token.
 2061  * 
 2062  */
 2063 
 2064 char *yyget_text  (void)
 2065 {
 2066         return yytext;
 2067 }
 2068 
 2069 /** Set the current line number.
 2070  * @param _line_number line number
 2071  * 
 2072  */
 2073 void 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  */
 2085 void yyset_in (FILE *  _in_str )
 2086 {
 2087         yyin = _in_str ;
 2088 }
 2089 
 2090 void yyset_out (FILE *  _out_str )
 2091 {
 2092         yyout = _out_str ;
 2093 }
 2094 
 2095 int yyget_debug  (void)
 2096 {
 2097         return yy_flex_debug;
 2098 }
 2099 
 2100 void yyset_debug (int  _bdebug )
 2101 {
 2102         yy_flex_debug = _bdebug ;
 2103 }
 2104 
 2105 static 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. */
 2134 int 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
 2160 static void yy_flex_strncpy (char* s1, const 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
 2170 static int yy_flex_strlen (const char * s )
 2171 {
 2172     int n;
 2173     for ( n = 0; s[n]; ++n )
 2174         ;
 2175 
 2176     return n;
 2177 }
 2178 #endif
 2179 
 2180 void *yyalloc (yy_size_t  size )
 2181 {
 2182             return malloc(size);
 2183 }
 2184 
 2185 void *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 
 2198 void yyfree (void * ptr )
 2199 {
 2200             free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
 2201 }
 2202 
 2203 #define YYTABLES_NAME "yytables"
 2204 
 2205 #line 331 "zlexer.lex"
 2206 
 2207 
 2208 /*
 2209  * Analyze "word" to see if it matches an RR type, possibly by using
 2210  * the "TYPExxx" notation.  If it matches, the corresponding token is
 2211  * returned and the TYPE parameter is set to the RR type value.
 2212  */
 2213 static int
 2214 rrtype_to_token(const char *word, uint16_t *type) 
 2215 {
 2216     uint16_t t = rrtype_from_string(word);
 2217     if (t != 0) {
 2218         rrtype_descriptor_type *entry = rrtype_descriptor_by_type(t);
 2219         *type = t;
 2220         return entry->token;
 2221     }
 2222 
 2223     return 0;
 2224 }
 2225 
 2226 
 2227 /*
 2228  * Remove \DDD constructs from the input. See RFC 1035, section 5.1.
 2229  */
 2230 static size_t
 2231 zoctet(char *text) 
 2232 {
 2233     /*
 2234      * s follows the string, p lags behind and rebuilds the new
 2235      * string
 2236      */
 2237     char *s;
 2238     char *p;
 2239     
 2240     for (s = p = text; *s; ++s, ++p) {
 2241         assert(p <= s);
 2242         if (s[0] != '\\') {
 2243             /* Ordinary character.  */
 2244             *p = *s;
 2245         } else if (isdigit((unsigned char)s[1]) && isdigit((unsigned char)s[2]) && isdigit((unsigned char)s[3])) {
 2246             /* \DDD escape.  */
 2247             int val = (hexdigit_to_int(s[1]) * 100 +
 2248                    hexdigit_to_int(s[2]) * 10 +
 2249                    hexdigit_to_int(s[3]));
 2250             if (0 <= val && val <= 255) {
 2251                 s += 3;
 2252                 *p = val;
 2253             } else {
 2254                 zc_warning("text escape \\DDD overflow");
 2255                 *p = *++s;
 2256             }
 2257         } else if (s[1] != '\0') {
 2258             /* \X where X is any character, keep X.  */
 2259             *p = *++s;
 2260         } else {
 2261             /* Trailing backslash, ignore it.  */
 2262             zc_warning("trailing backslash ignored");
 2263             --p;
 2264         }
 2265     }
 2266     *p = '\0';
 2267     return p - text;
 2268 }
 2269 
 2270 static int
 2271 parse_token(int token, char *yytext, enum lexer_state *lexer_state)
 2272 {
 2273     size_t len;
 2274     char *str;
 2275 
 2276     if (*lexer_state == EXPECT_OWNER) {
 2277         *lexer_state = PARSING_OWNER;
 2278     } else if (*lexer_state == PARSING_TTL_CLASS_TYPE) {
 2279         const char *t;
 2280         int token;
 2281         uint16_t rrclass;
 2282         
 2283         /* type */
 2284         token = rrtype_to_token(yytext, &yylval.type);
 2285         if (token != 0) {
 2286             *lexer_state = PARSING_RDATA;
 2287             LEXOUT(("%d[%s] ", token, yytext));
 2288             return token;
 2289         }
 2290 
 2291         /* class */
 2292         rrclass = rrclass_from_string(yytext);
 2293         if (rrclass != 0) {
 2294             yylval.klass = rrclass;
 2295             LEXOUT(("CLASS "));
 2296             return T_RRCLASS;
 2297         }
 2298 
 2299         /* ttl */
 2300         yylval.ttl = strtottl(yytext, &t);
 2301         if (*t == '\0') {
 2302             LEXOUT(("TTL "));
 2303             return T_TTL;
 2304         }
 2305     }
 2306 
 2307     str = region_strdup(parser->rr_region, yytext);
 2308     len = zoctet(str);
 2309 
 2310     yylval.data.str = str;
 2311     yylval.data.len = len;
 2312     
 2313     LEXOUT(("%d[%s] ", token, yytext));
 2314     return token;
 2315 }
 2316