From: Tomek Mrugalski Date: Tue, 7 Feb 2017 12:36:33 +0000 (+0000) Subject: [5076] Flex/Bison files regenerated X-Git-Tag: trac3590_base~3^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=06221bba8bb8f4d0eaebddedff96d4149975cec0;p=thirdparty%2Fkea.git [5076] Flex/Bison files regenerated --- diff --git a/src/bin/agent/agent_lexer.cc b/src/bin/agent/agent_lexer.cc new file mode 100644 index 0000000000..ec6bead9df --- /dev/null +++ b/src/bin/agent/agent_lexer.cc @@ -0,0 +1,3418 @@ +#line 1 "agent_lexer.cc" + +#line 3 "agent_lexer.cc" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-for-header */ +/* %if-c-only */ +/* %if-not-reentrant */ +#define yy_create_buffer parser6__create_buffer +#define yy_delete_buffer parser6__delete_buffer +#define yy_flex_debug parser6__flex_debug +#define yy_init_buffer parser6__init_buffer +#define yy_flush_buffer parser6__flush_buffer +#define yy_load_buffer_state parser6__load_buffer_state +#define yy_switch_to_buffer parser6__switch_to_buffer +#define yyin parser6_in +#define yyleng parser6_leng +#define yylex parser6_lex +#define yylineno parser6_lineno +#define yyout parser6_out +#define yyrestart parser6_restart +#define yytext parser6_text +#define yywrap parser6_wrap +#define yyalloc parser6_alloc +#define yyrealloc parser6_realloc +#define yyfree parser6_free + +/* %endif */ +/* %endif */ +/* %ok-for-header */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 3 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + #define yy_create_buffer parser6__create_buffer + + #define yy_delete_buffer parser6__delete_buffer + + #define yy_scan_buffer parser6__scan_buffer + + #define yy_scan_string parser6__scan_string + + #define yy_scan_bytes parser6__scan_bytes + + #define yy_init_buffer parser6__init_buffer + + #define yy_flush_buffer parser6__flush_buffer + + #define yy_load_buffer_state parser6__load_buffer_state + + #define yy_switch_to_buffer parser6__switch_to_buffer + + #define yypush_buffer_state parser6_push_buffer_state + + #define yypop_buffer_state parser6_pop_buffer_state + + #define yyensure_buffer_stack parser6_ensure_buffer_stack + + #define yylex parser6_lex + + #define yyrestart parser6_restart + + #define yylex_init parser6_lex_init + + #define yylex_init_extra parser6_lex_init_extra + + #define yylex_destroy parser6_lex_destroy + + #define yyget_debug parser6_get_debug + + #define yyset_debug parser6_set_debug + + #define yyget_extra parser6_get_extra + + #define yyset_extra parser6_set_extra + + #define yyget_in parser6_get_in + + #define yyset_in parser6_set_in + + #define yyget_out parser6_get_out + + #define yyset_out parser6_set_out + + #define yyget_leng parser6_get_leng + + #define yyget_text parser6_get_text + + #define yyget_lineno parser6_get_lineno + + #define yyset_lineno parser6_set_lineno + + #define yywrap parser6_wrap + +/* %endif */ + + #define yyalloc parser6_alloc + + #define yyrealloc parser6_realloc + + #define yyfree parser6_free + +/* %if-c-only */ + + #define yytext parser6_text + + #define yyleng parser6_leng + + #define yyin parser6_in + + #define yyout parser6_out + + #define yy_flex_debug parser6__flex_debug + + #define yylineno parser6_lineno + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ +#include +#include +#include +#include +/* %endif */ + +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* %not-for-header */ +/* Returned upon end-of-file. */ +#define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE parser6_restart(parser6_in ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +/* %if-not-reentrant */ +extern int parser6_leng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *parser6_in, *parser6_out; +/* %endif */ +/* %endif */ + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up parser6_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up parser6_text again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { +/* %if-c-only */ + FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via parser6_restart()), so that the user can continue scanning by + * just pointing parser6_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ +/* yy_hold_char holds the character lost when parser6_text is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int parser6_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow parser6_wrap()'s to do buffer switches + * instead of setting up a fresh parser6_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ + +/* %endif */ + +void parser6_restart ( FILE *input_file ); +void parser6__switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE parser6__create_buffer ( FILE *file, int size ); +void parser6__delete_buffer ( YY_BUFFER_STATE b ); +void parser6__flush_buffer ( YY_BUFFER_STATE b ); +void parser6_push_buffer_state ( YY_BUFFER_STATE new_buffer ); +void parser6_pop_buffer_state ( void ); + +static void parser6_ensure_buffer_stack ( void ); +static void parser6__load_buffer_state ( void ); +static void parser6__init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER parser6__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE parser6__scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE parser6__scan_string ( const char *yy_str ); +YY_BUFFER_STATE parser6__scan_bytes ( const char *bytes, int len ); + +/* %endif */ + +void *parser6_alloc ( yy_size_t ); +void *parser6_realloc ( void *, yy_size_t ); +void parser6_free ( void * ); + +#define yy_new_buffer parser6__create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + parser6_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + parser6__create_buffer(parser6_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + parser6_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + parser6__create_buffer(parser6_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* %% [1.0] parser6_text/parser6_in/parser6_out/yy_state_type/parser6_lineno etc. def's & init go here */ +/* Begin user sect3 */ + +#define parser6_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG +typedef flex_uint8_t YY_CHAR; + +FILE *parser6_in = NULL, *parser6_out = NULL; + +typedef int yy_state_type; + +extern int parser6_lineno; +int parser6_lineno = 1; + +extern char *parser6_text; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr parser6_text + +/* %% [1.5] DFA */ + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up parser6_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle parser6_text and parser6_leng for yymore() goes here \ */\ + parser6_leng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to parser6_text[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ +#define YY_NUM_RULES 52 +#define YY_END_OF_BUFFER 53 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[300] = + { 0, + 45, 45, 0, 0, 0, 0, 0, 0, 0, 0, + 53, 51, 10, 11, 51, 1, 45, 42, 45, 45, + 51, 44, 43, 51, 51, 51, 51, 51, 38, 39, + 51, 51, 51, 40, 41, 5, 5, 5, 51, 51, + 51, 10, 11, 0, 0, 34, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 45, 45, 0, 44, 45, 3, 2, 6, 0, 45, + 0, 0, 0, 0, 0, 0, 4, 0, 0, 9, + 0, 35, 0, 0, 0, 0, 0, 37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, + 0, 8, 0, 0, 0, 0, 0, 36, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 48, 0, 47, 46, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, + 0, 0, 18, 0, 0, 0, 32, 33, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, + 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, + 0, 28, 21, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 0, 0, 0, 0, 17, 0, 0, 0, 0, 13, + 14, 0, 0, 0, 0, 0, 0, 24, 0, 0, + 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 30, 0, 0, 15, 16, 0, 0, 12, + 0, 0, 0, 0, 0, 22, 29, 26, 0 + + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 5, 6, 7, 5, 5, 5, 5, 5, + 5, 8, 9, 10, 11, 12, 13, 14, 14, 15, + 14, 16, 14, 17, 14, 14, 14, 18, 5, 19, + 5, 20, 21, 5, 22, 23, 24, 25, 26, 27, + 5, 5, 5, 5, 5, 28, 5, 29, 5, 5, + 5, 30, 31, 32, 33, 5, 5, 5, 5, 5, + 34, 35, 36, 5, 37, 5, 38, 39, 40, 41, + + 42, 43, 44, 45, 46, 5, 47, 48, 49, 50, + 51, 52, 5, 53, 54, 55, 56, 57, 5, 58, + 59, 5, 60, 5, 61, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5 + } ; + +static const YY_CHAR yy_meta[62] = + { 0, + 1, 1, 2, 3, 3, 4, 3, 3, 3, 3, + 3, 3, 3, 5, 5, 5, 5, 3, 3, 3, + 3, 5, 5, 5, 5, 5, 5, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, + 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3 + } ; + +static const flex_int16_t yy_base[312] = + { 0, + 0, 0, 60, 63, 66, 0, 64, 68, 48, 65, + 287, 1953, 85, 279, 127, 0, 89, 1953, 108, 121, + 83, 127, 1953, 260, 171, 75, 84, 118, 1953, 1953, + 123, 133, 140, 1953, 1953, 1953, 86, 263, 225, 0, + 249, 152, 245, 159, 189, 1953, 195, 202, 208, 210, + 216, 226, 271, 277, 283, 289, 295, 301, 307, 0, + 323, 344, 241, 352, 357, 1953, 0, 1953, 143, 219, + 71, 136, 143, 172, 178, 169, 1953, 200, 225, 1953, + 207, 1953, 342, 387, 399, 405, 215, 411, 436, 422, + 430, 465, 479, 485, 491, 500, 506, 521, 527, 541, + + 551, 557, 563, 0, 184, 216, 228, 208, 266, 273, + 164, 1953, 0, 571, 577, 587, 201, 1953, 618, 612, + 601, 618, 648, 662, 669, 675, 683, 689, 700, 710, + 731, 737, 748, 274, 1953, 1953, 285, 1953, 1953, 118, + 0, 754, 761, 768, 801, 784, 796, 844, 850, 856, + 862, 868, 874, 880, 892, 898, 911, 917, 923, 1953, + 1953, 132, 0, 933, 939, 948, 954, 991, 960, 974, + 990, 1034, 1040, 1046, 1018, 1053, 1059, 1953, 1065, 1076, + 1084, 1090, 1953, 107, 0, 1096, 1953, 1953, 1102, 1120, + 1126, 1132, 1146, 1156, 1163, 1169, 1183, 1191, 1200, 1206, + + 1213, 1221, 1227, 1953, 1258, 1243, 1264, 1271, 1279, 1285, + 1295, 1306, 1315, 1322, 1332, 1341, 1953, 1352, 1358, 1371, + 1377, 1383, 1953, 1389, 1396, 1413, 1407, 1432, 1438, 1444, + 1451, 1953, 1953, 1460, 1468, 1481, 1487, 1495, 1507, 1517, + 1525, 1531, 1537, 1543, 1555, 1561, 1568, 1574, 1580, 1953, + 1586, 1596, 1604, 1610, 1953, 1616, 1622, 1635, 1641, 1953, + 1953, 1652, 1659, 1665, 1679, 1687, 1700, 1953, 1707, 1714, + 1722, 1728, 1953, 1737, 1749, 1763, 1775, 1784, 1790, 1798, + 1805, 1953, 1953, 1821, 1828, 1953, 1953, 1835, 1844, 1953, + 1851, 1858, 1865, 1872, 1879, 1953, 1953, 1953, 1953, 1914, + + 1919, 1924, 1929, 1934, 1939, 1944, 1947, 141, 127, 113, + 102 + } ; + +static const flex_int16_t yy_def[312] = + { 0, + 299, 1, 300, 300, 1, 5, 5, 5, 5, 5, + 299, 299, 299, 299, 301, 302, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 303, + 299, 299, 299, 304, 301, 299, 301, 301, 301, 305, + 301, 301, 301, 301, 301, 301, 301, 301, 301, 302, + 299, 299, 299, 299, 299, 299, 306, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 303, 299, + 304, 299, 299, 301, 301, 301, 307, 301, 305, 301, + 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, + + 301, 301, 301, 306, 299, 299, 299, 299, 299, 299, + 299, 299, 308, 301, 301, 301, 307, 299, 305, 301, + 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, + 301, 301, 301, 299, 299, 299, 299, 299, 299, 299, + 309, 301, 301, 301, 305, 301, 301, 301, 301, 301, + 301, 301, 301, 301, 301, 301, 301, 301, 301, 299, + 299, 299, 310, 301, 301, 301, 301, 305, 301, 301, + 301, 301, 301, 301, 301, 301, 301, 299, 301, 301, + 301, 301, 299, 299, 311, 301, 299, 299, 301, 301, + 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, + + 301, 301, 301, 299, 301, 301, 301, 301, 301, 301, + 301, 301, 301, 301, 301, 301, 299, 301, 301, 301, + 301, 301, 299, 301, 301, 301, 301, 301, 301, 301, + 301, 299, 299, 301, 301, 301, 301, 301, 301, 301, + 301, 301, 301, 301, 301, 301, 301, 301, 301, 299, + 301, 301, 301, 301, 299, 301, 301, 301, 301, 299, + 299, 301, 301, 301, 301, 301, 301, 299, 301, 301, + 301, 301, 299, 301, 301, 301, 301, 301, 301, 301, + 301, 299, 299, 301, 301, 299, 299, 301, 301, 299, + 301, 301, 301, 301, 301, 299, 299, 299, 0, 299, + + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299 + } ; + +static const flex_int16_t yy_nxt[2015] = + { 0, + 12, 13, 14, 13, 12, 15, 16, 12, 17, 18, + 19, 20, 21, 22, 22, 22, 22, 23, 24, 12, + 12, 12, 12, 12, 12, 25, 26, 12, 27, 12, + 12, 28, 12, 29, 12, 30, 12, 12, 12, 12, + 12, 25, 31, 12, 12, 12, 12, 12, 12, 32, + 12, 12, 12, 12, 33, 12, 12, 12, 12, 34, + 35, 37, 14, 37, 37, 14, 37, 38, 41, 40, + 38, 12, 12, 40, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 41, 42, 42, 42, 42, + 66, 12, 12, 12, 12, 67, 71, 12, 105, 12, + + 61, 12, 62, 62, 62, 62, 81, 12, 12, 12, + 12, 39, 71, 12, 63, 12, 72, 185, 105, 61, + 12, 64, 64, 64, 64, 12, 12, 44, 44, 44, + 63, 163, 46, 63, 65, 65, 65, 65, 61, 72, + 64, 64, 64, 64, 71, 141, 63, 73, 204, 63, + 47, 48, 63, 42, 49, 42, 70, 70, 70, 70, + 74, 50, 63, 106, 82, 72, 51, 52, 63, 73, + 73, 53, 184, 162, 54, 107, 55, 56, 57, 69, + 58, 69, 59, 106, 70, 70, 70, 70, 75, 44, + 44, 44, 76, 83, 46, 44, 44, 44, 107, 105, + + 46, 107, 44, 44, 44, 106, 118, 46, 44, 44, + 44, 140, 82, 46, 134, 88, 44, 44, 44, 108, + 118, 46, 45, 50, 110, 109, 44, 44, 44, 50, + 112, 46, 70, 70, 70, 70, 50, 134, 134, 111, + 91, 83, 50, 135, 45, 84, 85, 43, 45, 69, + 50, 69, 45, 136, 70, 70, 70, 70, 86, 45, + 50, 137, 45, 135, 45, 89, 90, 92, 80, 136, + 93, 44, 44, 44, 78, 77, 46, 44, 44, 44, + 68, 43, 46, 44, 44, 44, 299, 299, 46, 44, + 44, 44, 299, 135, 46, 44, 44, 44, 136, 160, + + 46, 44, 44, 44, 299, 50, 46, 44, 44, 44, + 160, 50, 46, 138, 139, 160, 299, 50, 299, 299, + 98, 94, 96, 50, 299, 95, 161, 97, 299, 50, + 299, 299, 100, 299, 299, 50, 65, 65, 65, 65, + 299, 50, 101, 299, 99, 299, 299, 81, 63, 299, + 299, 102, 299, 299, 81, 61, 103, 62, 62, 62, + 62, 299, 299, 61, 63, 64, 64, 64, 64, 63, + 65, 65, 65, 65, 299, 299, 81, 63, 299, 299, + 81, 299, 63, 299, 81, 63, 299, 44, 44, 44, + 299, 81, 46, 63, 81, 299, 81, 113, 63, 44, + + 44, 44, 299, 299, 46, 44, 44, 44, 299, 299, + 46, 44, 44, 44, 299, 299, 46, 299, 299, 299, + 299, 50, 44, 44, 44, 299, 299, 46, 299, 299, + 44, 44, 44, 50, 299, 46, 114, 299, 115, 50, + 121, 299, 299, 299, 299, 50, 299, 299, 116, 119, + 119, 119, 119, 299, 299, 299, 50, 119, 119, 119, + 119, 119, 119, 299, 50, 44, 44, 44, 299, 299, + 46, 120, 299, 119, 119, 119, 119, 119, 119, 44, + 44, 44, 299, 299, 46, 44, 44, 44, 299, 299, + 46, 44, 44, 44, 299, 299, 46, 299, 299, 50, + + 44, 44, 44, 122, 299, 46, 44, 44, 44, 299, + 299, 46, 299, 50, 299, 299, 299, 299, 123, 50, + 299, 44, 44, 44, 299, 50, 46, 44, 44, 44, + 299, 299, 46, 299, 50, 124, 299, 299, 126, 299, + 50, 44, 44, 44, 299, 125, 46, 299, 299, 127, + 299, 44, 44, 44, 299, 50, 46, 44, 44, 44, + 299, 50, 46, 44, 44, 44, 299, 299, 46, 128, + 299, 44, 44, 44, 299, 50, 46, 44, 44, 44, + 299, 129, 46, 299, 299, 50, 299, 44, 44, 44, + 299, 50, 46, 130, 299, 299, 132, 50, 299, 299, + + 299, 44, 44, 44, 299, 50, 46, 131, 133, 299, + 299, 50, 44, 44, 44, 299, 299, 46, 44, 44, + 44, 50, 299, 46, 299, 142, 299, 299, 143, 299, + 144, 145, 145, 145, 145, 50, 299, 299, 299, 145, + 145, 145, 145, 145, 145, 299, 50, 299, 44, 44, + 44, 299, 50, 46, 147, 145, 145, 145, 145, 145, + 145, 299, 44, 44, 44, 299, 146, 46, 299, 44, + 44, 44, 299, 148, 46, 44, 44, 44, 299, 299, + 46, 299, 50, 44, 44, 44, 299, 299, 46, 44, + 44, 44, 299, 299, 46, 299, 50, 299, 299, 149, + + 44, 44, 44, 50, 299, 46, 299, 299, 150, 50, + 44, 44, 44, 299, 299, 46, 299, 50, 299, 299, + 151, 299, 299, 50, 299, 299, 153, 152, 299, 299, + 154, 44, 44, 44, 50, 299, 46, 44, 44, 44, + 299, 299, 46, 299, 50, 299, 299, 156, 44, 44, + 44, 155, 299, 46, 44, 44, 44, 299, 299, 46, + 299, 44, 44, 44, 299, 50, 46, 299, 44, 44, + 44, 50, 157, 46, 299, 299, 165, 166, 299, 299, + 299, 299, 50, 158, 44, 44, 44, 299, 50, 46, + 299, 299, 299, 299, 299, 50, 44, 44, 44, 299, + + 299, 46, 50, 299, 299, 159, 164, 299, 299, 299, + 299, 299, 299, 167, 168, 168, 168, 168, 50, 299, + 299, 299, 168, 168, 168, 168, 168, 168, 299, 299, + 50, 299, 299, 299, 299, 299, 169, 170, 168, 168, + 168, 168, 168, 168, 44, 44, 44, 299, 299, 46, + 44, 44, 44, 299, 299, 46, 44, 44, 44, 299, + 299, 46, 44, 44, 44, 172, 173, 46, 44, 44, + 44, 299, 175, 46, 44, 44, 44, 299, 50, 46, + 44, 44, 44, 299, 50, 178, 299, 171, 299, 299, + 50, 299, 44, 44, 44, 299, 50, 46, 44, 44, + + 44, 299, 50, 46, 299, 176, 299, 299, 50, 174, + 299, 44, 44, 44, 50, 177, 46, 44, 44, 44, + 299, 299, 46, 44, 44, 44, 50, 299, 183, 299, + 299, 299, 50, 44, 44, 44, 299, 299, 46, 44, + 44, 44, 299, 299, 187, 50, 180, 179, 44, 44, + 44, 50, 299, 188, 44, 44, 44, 50, 182, 46, + 44, 44, 44, 181, 299, 46, 299, 50, 299, 299, + 299, 299, 299, 50, 44, 44, 44, 299, 299, 46, + 299, 299, 50, 186, 299, 299, 299, 299, 50, 299, + 44, 44, 44, 299, 50, 46, 299, 299, 299, 299, + + 299, 299, 299, 189, 45, 45, 45, 45, 50, 299, + 190, 299, 45, 45, 45, 45, 45, 45, 44, 44, + 44, 299, 299, 46, 50, 299, 191, 299, 45, 45, + 45, 45, 45, 45, 44, 44, 44, 192, 299, 46, + 44, 44, 44, 299, 193, 46, 44, 44, 44, 299, + 194, 46, 50, 44, 44, 44, 195, 299, 46, 44, + 44, 44, 196, 299, 46, 44, 44, 44, 50, 197, + 46, 299, 299, 299, 50, 299, 44, 44, 44, 299, + 50, 46, 299, 299, 44, 44, 44, 50, 299, 46, + 44, 44, 44, 50, 299, 46, 44, 44, 44, 50, + + 299, 46, 44, 44, 44, 198, 299, 46, 299, 299, + 50, 199, 299, 299, 299, 299, 299, 201, 50, 200, + 44, 44, 44, 299, 50, 46, 44, 44, 44, 202, + 50, 46, 44, 44, 44, 299, 50, 46, 299, 299, + 299, 299, 299, 205, 203, 206, 44, 44, 44, 299, + 299, 46, 299, 299, 50, 299, 44, 44, 44, 299, + 50, 46, 299, 44, 44, 44, 50, 207, 46, 44, + 44, 44, 299, 209, 46, 299, 299, 299, 299, 299, + 50, 299, 208, 44, 44, 44, 299, 299, 46, 299, + 50, 44, 44, 44, 299, 299, 46, 50, 299, 210, + + 44, 44, 44, 50, 299, 46, 44, 44, 44, 211, + 212, 217, 299, 44, 44, 44, 299, 50, 46, 213, + 299, 44, 44, 44, 299, 50, 46, 44, 44, 44, + 299, 299, 46, 214, 50, 299, 299, 221, 299, 299, + 50, 299, 218, 44, 44, 44, 299, 50, 223, 215, + 299, 299, 299, 216, 299, 50, 299, 299, 44, 44, + 44, 50, 299, 46, 44, 44, 44, 219, 222, 46, + 299, 44, 44, 44, 224, 220, 46, 50, 299, 44, + 44, 44, 299, 299, 46, 44, 44, 44, 299, 299, + 46, 299, 50, 299, 299, 44, 44, 44, 50, 299, + + 46, 299, 299, 299, 299, 50, 44, 44, 44, 299, + 299, 46, 225, 50, 299, 44, 44, 44, 299, 50, + 46, 299, 44, 44, 44, 299, 227, 46, 299, 50, + 299, 299, 44, 44, 44, 226, 228, 232, 299, 299, + 50, 44, 44, 44, 299, 299, 233, 299, 299, 50, + 299, 229, 44, 44, 44, 299, 50, 46, 44, 44, + 44, 299, 299, 46, 299, 299, 50, 299, 230, 299, + 299, 44, 44, 44, 231, 50, 46, 44, 44, 44, + 299, 299, 46, 44, 44, 44, 50, 299, 46, 44, + 44, 44, 50, 299, 46, 299, 44, 44, 44, 235, + + 299, 46, 234, 299, 299, 50, 299, 44, 44, 44, + 299, 50, 46, 44, 44, 44, 299, 50, 46, 299, + 239, 299, 299, 50, 299, 299, 237, 299, 299, 236, + 50, 238, 44, 44, 44, 299, 299, 46, 44, 44, + 44, 50, 240, 46, 44, 44, 44, 50, 241, 46, + 299, 44, 44, 44, 242, 299, 46, 299, 299, 243, + 44, 44, 44, 299, 299, 46, 50, 299, 44, 44, + 44, 299, 50, 46, 299, 299, 245, 299, 50, 299, + 299, 44, 44, 44, 244, 50, 250, 44, 44, 44, + 299, 299, 46, 299, 50, 44, 44, 44, 246, 299, + + 46, 299, 50, 299, 299, 247, 299, 44, 44, 44, + 299, 248, 46, 299, 299, 50, 299, 44, 44, 44, + 249, 50, 46, 299, 251, 44, 44, 44, 299, 50, + 255, 44, 44, 44, 299, 299, 46, 44, 44, 44, + 299, 50, 46, 44, 44, 44, 299, 299, 46, 299, + 253, 50, 299, 252, 299, 44, 44, 44, 299, 50, + 46, 44, 44, 44, 299, 50, 260, 254, 44, 44, + 44, 50, 299, 261, 44, 44, 44, 50, 256, 46, + 44, 44, 44, 299, 299, 46, 44, 44, 44, 50, + 299, 46, 299, 257, 299, 50, 44, 44, 44, 258, + + 299, 46, 50, 299, 44, 44, 44, 259, 50, 46, + 44, 44, 44, 299, 50, 46, 44, 44, 44, 299, + 50, 268, 44, 44, 44, 299, 299, 46, 262, 299, + 50, 299, 299, 263, 264, 44, 44, 44, 50, 299, + 46, 44, 44, 44, 50, 266, 46, 265, 299, 267, + 50, 299, 44, 44, 44, 299, 50, 46, 299, 44, + 44, 44, 299, 269, 273, 44, 44, 44, 299, 50, + 46, 299, 299, 299, 299, 50, 270, 299, 271, 44, + 44, 44, 299, 299, 46, 299, 50, 44, 44, 44, + 299, 299, 46, 50, 299, 299, 299, 272, 299, 50, + + 44, 44, 44, 299, 299, 46, 274, 44, 44, 44, + 299, 299, 46, 50, 44, 44, 44, 299, 299, 46, + 275, 50, 44, 44, 44, 299, 299, 46, 44, 44, + 44, 299, 299, 46, 50, 299, 276, 44, 44, 44, + 299, 50, 282, 299, 299, 299, 277, 299, 50, 44, + 44, 44, 299, 299, 283, 299, 50, 299, 299, 278, + 299, 299, 50, 44, 44, 44, 279, 299, 46, 299, + 299, 50, 299, 299, 280, 44, 44, 44, 281, 299, + 46, 299, 299, 50, 44, 44, 44, 299, 299, 286, + 44, 44, 44, 299, 299, 287, 299, 50, 44, 44, + + 44, 299, 299, 46, 299, 44, 44, 44, 299, 50, + 46, 299, 299, 299, 299, 299, 285, 284, 50, 299, + 299, 44, 44, 44, 50, 299, 290, 299, 44, 44, + 44, 299, 50, 46, 299, 44, 44, 44, 299, 50, + 46, 299, 299, 288, 44, 44, 44, 299, 299, 46, + 299, 44, 44, 44, 289, 50, 46, 299, 44, 44, + 44, 299, 50, 46, 299, 44, 44, 44, 299, 50, + 296, 299, 44, 44, 44, 299, 292, 297, 50, 44, + 44, 44, 291, 299, 298, 50, 299, 299, 299, 299, + 299, 299, 50, 299, 299, 299, 299, 293, 299, 50, + + 299, 299, 299, 299, 294, 299, 50, 299, 299, 299, + 299, 295, 299, 50, 36, 36, 36, 36, 36, 45, + 45, 45, 45, 45, 60, 299, 60, 60, 60, 79, + 299, 79, 299, 79, 81, 81, 81, 81, 81, 87, + 87, 87, 87, 87, 104, 299, 104, 104, 104, 117, + 117, 117, 11, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299 + } ; + +static const flex_int16_t yy_chk[2015] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 3, 4, 4, 4, 3, 9, 7, + 4, 5, 5, 8, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 10, 13, 37, 13, 37, + 21, 5, 5, 9, 5, 21, 26, 5, 71, 5, + + 17, 5, 17, 17, 17, 17, 311, 5, 5, 7, + 10, 5, 26, 8, 17, 5, 27, 310, 71, 19, + 5, 19, 19, 19, 19, 5, 5, 15, 15, 15, + 17, 309, 15, 19, 20, 20, 20, 20, 22, 27, + 22, 22, 22, 22, 31, 308, 20, 28, 184, 19, + 15, 15, 22, 42, 15, 42, 69, 69, 69, 69, + 31, 15, 20, 72, 44, 32, 15, 15, 22, 33, + 28, 15, 162, 140, 15, 73, 15, 15, 15, 25, + 15, 25, 15, 72, 25, 25, 25, 25, 32, 45, + 45, 45, 33, 44, 45, 47, 47, 47, 73, 74, + + 47, 76, 48, 48, 48, 75, 117, 48, 49, 49, + 49, 111, 81, 49, 105, 50, 51, 51, 51, 74, + 87, 51, 50, 45, 76, 75, 52, 52, 52, 47, + 79, 52, 70, 70, 70, 70, 48, 105, 108, 78, + 52, 81, 49, 106, 50, 47, 48, 43, 50, 63, + 51, 63, 50, 107, 63, 63, 63, 63, 49, 50, + 52, 108, 50, 106, 50, 50, 51, 52, 41, 107, + 52, 53, 53, 53, 39, 38, 53, 54, 54, 54, + 24, 14, 54, 55, 55, 55, 11, 0, 55, 56, + 56, 56, 0, 109, 56, 57, 57, 57, 110, 134, + + 57, 58, 58, 58, 0, 53, 58, 59, 59, 59, + 137, 54, 59, 109, 110, 134, 0, 55, 0, 0, + 55, 53, 54, 56, 0, 53, 137, 54, 0, 57, + 0, 0, 57, 0, 0, 58, 61, 61, 61, 61, + 0, 59, 58, 0, 56, 0, 0, 83, 61, 0, + 0, 58, 0, 0, 83, 62, 59, 62, 62, 62, + 62, 0, 0, 64, 61, 64, 64, 64, 64, 62, + 65, 65, 65, 65, 0, 0, 83, 64, 0, 0, + 83, 0, 65, 0, 83, 62, 0, 84, 84, 84, + 0, 83, 84, 64, 83, 0, 83, 83, 65, 85, + + 85, 85, 0, 0, 85, 86, 86, 86, 0, 0, + 86, 88, 88, 88, 0, 0, 88, 0, 0, 0, + 0, 84, 90, 90, 90, 0, 0, 90, 0, 0, + 91, 91, 91, 85, 0, 91, 84, 0, 85, 86, + 91, 0, 0, 0, 0, 88, 0, 0, 86, 89, + 89, 89, 89, 0, 0, 0, 90, 89, 89, 89, + 89, 89, 89, 0, 91, 92, 92, 92, 0, 0, + 92, 90, 0, 89, 89, 89, 89, 89, 89, 93, + 93, 93, 0, 0, 93, 94, 94, 94, 0, 0, + 94, 95, 95, 95, 0, 0, 95, 0, 0, 92, + + 96, 96, 96, 92, 0, 96, 97, 97, 97, 0, + 0, 97, 0, 93, 0, 0, 0, 0, 93, 94, + 0, 98, 98, 98, 0, 95, 98, 99, 99, 99, + 0, 0, 99, 0, 96, 94, 0, 0, 96, 0, + 97, 100, 100, 100, 0, 95, 100, 0, 0, 97, + 0, 101, 101, 101, 0, 98, 101, 102, 102, 102, + 0, 99, 102, 103, 103, 103, 0, 0, 103, 98, + 0, 114, 114, 114, 0, 100, 114, 115, 115, 115, + 0, 99, 115, 0, 0, 101, 0, 116, 116, 116, + 0, 102, 116, 100, 0, 0, 102, 103, 0, 0, + + 0, 121, 121, 121, 0, 114, 121, 101, 103, 0, + 0, 115, 120, 120, 120, 0, 0, 120, 122, 122, + 122, 116, 0, 122, 0, 114, 0, 0, 115, 0, + 116, 119, 119, 119, 119, 121, 0, 0, 0, 119, + 119, 119, 119, 119, 119, 0, 120, 0, 123, 123, + 123, 0, 122, 123, 121, 119, 119, 119, 119, 119, + 119, 0, 124, 124, 124, 0, 120, 124, 0, 125, + 125, 125, 0, 122, 125, 126, 126, 126, 0, 0, + 126, 0, 123, 127, 127, 127, 0, 0, 127, 128, + 128, 128, 0, 0, 128, 0, 124, 0, 0, 123, + + 129, 129, 129, 125, 0, 129, 0, 0, 124, 126, + 130, 130, 130, 0, 0, 130, 0, 127, 0, 0, + 125, 0, 0, 128, 0, 0, 127, 126, 0, 0, + 128, 131, 131, 131, 129, 0, 131, 132, 132, 132, + 0, 0, 132, 0, 130, 0, 0, 130, 133, 133, + 133, 129, 0, 133, 142, 142, 142, 0, 0, 142, + 0, 143, 143, 143, 0, 131, 143, 0, 144, 144, + 144, 132, 131, 144, 0, 0, 143, 143, 0, 0, + 0, 0, 133, 132, 146, 146, 146, 0, 142, 146, + 0, 0, 0, 0, 0, 143, 147, 147, 147, 0, + + 0, 147, 144, 0, 0, 133, 142, 0, 0, 0, + 0, 0, 0, 144, 145, 145, 145, 145, 146, 0, + 0, 0, 145, 145, 145, 145, 145, 145, 0, 0, + 147, 0, 0, 0, 0, 0, 146, 147, 145, 145, + 145, 145, 145, 145, 148, 148, 148, 0, 0, 148, + 149, 149, 149, 0, 0, 149, 150, 150, 150, 0, + 0, 150, 151, 151, 151, 149, 149, 151, 152, 152, + 152, 0, 151, 152, 153, 153, 153, 0, 148, 153, + 154, 154, 154, 0, 149, 154, 0, 148, 0, 0, + 150, 0, 155, 155, 155, 0, 151, 155, 156, 156, + + 156, 0, 152, 156, 0, 152, 0, 0, 153, 150, + 0, 157, 157, 157, 154, 153, 157, 158, 158, 158, + 0, 0, 158, 159, 159, 159, 155, 0, 159, 0, + 0, 0, 156, 164, 164, 164, 0, 0, 164, 165, + 165, 165, 0, 0, 165, 157, 156, 155, 166, 166, + 166, 158, 0, 166, 167, 167, 167, 159, 158, 167, + 169, 169, 169, 157, 0, 169, 0, 164, 0, 0, + 0, 0, 0, 165, 170, 170, 170, 0, 0, 170, + 0, 0, 166, 164, 0, 0, 0, 0, 167, 0, + 171, 171, 171, 0, 169, 171, 0, 0, 0, 0, + + 0, 0, 0, 167, 168, 168, 168, 168, 170, 0, + 169, 0, 168, 168, 168, 168, 168, 168, 175, 175, + 175, 0, 0, 175, 171, 0, 170, 0, 168, 168, + 168, 168, 168, 168, 172, 172, 172, 171, 0, 172, + 173, 173, 173, 0, 172, 173, 174, 174, 174, 0, + 173, 174, 175, 176, 176, 176, 174, 0, 176, 177, + 177, 177, 175, 0, 177, 179, 179, 179, 172, 175, + 179, 0, 0, 0, 173, 0, 180, 180, 180, 0, + 174, 180, 0, 0, 181, 181, 181, 176, 0, 181, + 182, 182, 182, 177, 0, 182, 186, 186, 186, 179, + + 0, 186, 189, 189, 189, 176, 0, 189, 0, 0, + 180, 177, 0, 0, 0, 0, 0, 180, 181, 179, + 190, 190, 190, 0, 182, 190, 191, 191, 191, 181, + 186, 191, 192, 192, 192, 0, 189, 192, 0, 0, + 0, 0, 0, 186, 182, 189, 193, 193, 193, 0, + 0, 193, 0, 0, 190, 0, 194, 194, 194, 0, + 191, 194, 0, 195, 195, 195, 192, 190, 195, 196, + 196, 196, 0, 192, 196, 0, 0, 0, 0, 0, + 193, 0, 191, 197, 197, 197, 0, 0, 197, 0, + 194, 198, 198, 198, 0, 0, 198, 195, 0, 193, + + 199, 199, 199, 196, 0, 199, 200, 200, 200, 194, + 195, 200, 0, 201, 201, 201, 0, 197, 201, 196, + 0, 202, 202, 202, 0, 198, 202, 203, 203, 203, + 0, 0, 203, 197, 199, 0, 0, 203, 0, 0, + 200, 0, 200, 206, 206, 206, 0, 201, 206, 198, + 0, 0, 0, 199, 0, 202, 0, 0, 205, 205, + 205, 203, 0, 205, 207, 207, 207, 201, 205, 207, + 0, 208, 208, 208, 207, 202, 208, 206, 0, 209, + 209, 209, 0, 0, 209, 210, 210, 210, 0, 0, + 210, 0, 205, 0, 0, 211, 211, 211, 207, 0, + + 211, 0, 0, 0, 0, 208, 212, 212, 212, 0, + 0, 212, 208, 209, 0, 213, 213, 213, 0, 210, + 213, 0, 214, 214, 214, 0, 210, 214, 0, 211, + 0, 0, 215, 215, 215, 209, 211, 215, 0, 0, + 212, 216, 216, 216, 0, 0, 216, 0, 0, 213, + 0, 212, 218, 218, 218, 0, 214, 218, 219, 219, + 219, 0, 0, 219, 0, 0, 215, 0, 213, 0, + 0, 220, 220, 220, 214, 216, 220, 221, 221, 221, + 0, 0, 221, 222, 222, 222, 218, 0, 222, 224, + 224, 224, 219, 0, 224, 0, 225, 225, 225, 219, + + 0, 225, 218, 0, 0, 220, 0, 227, 227, 227, + 0, 221, 227, 226, 226, 226, 0, 222, 226, 0, + 222, 0, 0, 224, 0, 0, 221, 0, 0, 220, + 225, 221, 228, 228, 228, 0, 0, 228, 229, 229, + 229, 227, 224, 229, 230, 230, 230, 226, 225, 230, + 0, 231, 231, 231, 226, 0, 231, 0, 0, 227, + 234, 234, 234, 0, 0, 234, 228, 0, 235, 235, + 235, 0, 229, 235, 0, 0, 229, 0, 230, 0, + 0, 236, 236, 236, 228, 231, 236, 237, 237, 237, + 0, 0, 237, 0, 234, 238, 238, 238, 230, 0, + + 238, 0, 235, 0, 0, 231, 0, 239, 239, 239, + 0, 234, 239, 0, 0, 236, 0, 240, 240, 240, + 235, 237, 240, 0, 237, 241, 241, 241, 0, 238, + 241, 242, 242, 242, 0, 0, 242, 243, 243, 243, + 0, 239, 243, 244, 244, 244, 0, 0, 244, 0, + 239, 240, 0, 238, 0, 245, 245, 245, 0, 241, + 245, 246, 246, 246, 0, 242, 246, 240, 247, 247, + 247, 243, 0, 247, 248, 248, 248, 244, 242, 248, + 249, 249, 249, 0, 0, 249, 251, 251, 251, 245, + 0, 251, 0, 243, 0, 246, 252, 252, 252, 244, + + 0, 252, 247, 0, 253, 253, 253, 245, 248, 253, + 254, 254, 254, 0, 249, 254, 256, 256, 256, 0, + 251, 256, 257, 257, 257, 0, 0, 257, 248, 0, + 252, 0, 0, 249, 251, 258, 258, 258, 253, 0, + 258, 259, 259, 259, 254, 253, 259, 252, 0, 254, + 256, 0, 262, 262, 262, 0, 257, 262, 0, 263, + 263, 263, 0, 257, 263, 264, 264, 264, 0, 258, + 264, 0, 0, 0, 0, 259, 258, 0, 259, 265, + 265, 265, 0, 0, 265, 0, 262, 266, 266, 266, + 0, 0, 266, 263, 0, 0, 0, 262, 0, 264, + + 267, 267, 267, 0, 0, 267, 264, 269, 269, 269, + 0, 0, 269, 265, 270, 270, 270, 0, 0, 270, + 265, 266, 271, 271, 271, 0, 0, 271, 272, 272, + 272, 0, 0, 272, 267, 0, 266, 274, 274, 274, + 0, 269, 274, 0, 0, 0, 267, 0, 270, 275, + 275, 275, 0, 0, 275, 0, 271, 0, 0, 269, + 0, 0, 272, 276, 276, 276, 270, 0, 276, 0, + 0, 274, 0, 0, 271, 277, 277, 277, 272, 0, + 277, 0, 0, 275, 278, 278, 278, 0, 0, 278, + 279, 279, 279, 0, 0, 279, 0, 276, 280, 280, + + 280, 0, 0, 280, 0, 281, 281, 281, 0, 277, + 281, 0, 0, 0, 0, 0, 277, 276, 278, 0, + 0, 284, 284, 284, 279, 0, 284, 0, 285, 285, + 285, 0, 280, 285, 0, 288, 288, 288, 0, 281, + 288, 0, 0, 280, 289, 289, 289, 0, 0, 289, + 0, 291, 291, 291, 281, 284, 291, 0, 292, 292, + 292, 0, 285, 292, 0, 293, 293, 293, 0, 288, + 293, 0, 294, 294, 294, 0, 288, 294, 289, 295, + 295, 295, 285, 0, 295, 291, 0, 0, 0, 0, + 0, 0, 292, 0, 0, 0, 0, 289, 0, 293, + + 0, 0, 0, 0, 291, 0, 294, 0, 0, 0, + 0, 292, 0, 295, 300, 300, 300, 300, 300, 301, + 301, 301, 301, 301, 302, 0, 302, 302, 302, 303, + 0, 303, 0, 303, 304, 304, 304, 304, 304, 305, + 305, 305, 305, 305, 306, 0, 306, 306, 306, 307, + 307, 307, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int parser6__flex_debug; +int parser6__flex_debug = 1; + +static const flex_int16_t yy_rule_linenum[52] = + { 0, + 127, 129, 131, 136, 137, 142, 143, 144, 156, 159, + 164, 171, 179, 187, 195, 203, 211, 219, 228, 237, + 245, 253, 261, 269, 277, 285, 294, 302, 311, 319, + 327, 335, 343, 351, 449, 454, 459, 464, 465, 466, + 467, 468, 469, 471, 489, 502, 507, 511, 513, 515, + 517 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *parser6_text; +#line 1 "agent_lexer.ll" +/* Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#line 8 "agent_lexer.ll" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Work around an incompatibility in flex (at least versions +// 2.5.31 through 2.5.33): it generates code that does +// not conform to C89. See Debian bug 333231 +// . +# undef yywrap +# define yywrap() 1 + +namespace { + +bool start_token_flag = false; + +isc::agent::ParserContext::ParserType start_token_value; +unsigned int comment_start_line = 0; + +using namespace isc; +using isc::agent::AgentParser; + +}; + +// To avoid the call to exit... oops! +#define YY_FATAL_ERROR(msg) isc::agent::ParserContext::fatal(msg) +#line 1208 "agent_lexer.cc" +/* noyywrap disables automatic rewinding for the next file to parse. Since we + always parse only a single string, there's no need to do any wraps. And + using yywrap requires linking with -lfl, which provides the default yywrap + implementation that always returns 1 anyway. */ +/* nounput simplifies the lexer, by removing support for putting a character + back into the input stream. We never use such capability anyway. */ +/* batch means that we'll never use the generated lexer interactively. */ +/* avoid to get static global variables to remain with C++. */ +/* in last resort %option reentrant */ +/* Enables debug mode. To see the debug messages, one needs to also set + yy_flex_debug to 1, then the debug messages will be printed on stderr. */ +/* I have no idea what this option does, except it was specified in the bison + examples and Postgres folks added it to remove gcc 4.3 warnings. Let's + be on the safe side and keep it. */ +#define YY_NO_INPUT 1 + +/* These are not token expressions yet, just convenience expressions that + can be used during actual token definitions. Note some can match + incorrect inputs (e.g., IP addresses) which must be checked. */ +/* for errors */ +#line 90 "agent_lexer.ll" +// This code run each time a pattern is matched. It updates the location +// by moving it ahead by yyleng bytes. yyleng specifies the length of the +// currently matched token. +#define YY_USER_ACTION driver.loc_.columns(yyleng); +#line 1234 "agent_lexer.cc" +#line 1235 "agent_lexer.cc" + +#define INITIAL 0 +#define COMMENT 1 +#define DIR_ENTER 2 +#define DIR_INCLUDE 3 +#define DIR_EXIT 4 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-c-only */ + +static int yy_init_globals ( void ); + +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int parser6_lex_destroy ( void ); + +int parser6_get_debug ( void ); + +void parser6_set_debug ( int debug_flag ); + +YY_EXTRA_TYPE parser6_get_extra ( void ); + +void parser6_set_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *parser6_get_in ( void ); + +void parser6_set_in ( FILE * _in_str ); + +FILE *parser6_get_out ( void ); + +void parser6_set_out ( FILE * _out_str ); + + int parser6_get_leng ( void ); + +char *parser6_get_text ( void ); + +int parser6_get_lineno ( void ); + +void parser6_set_lineno ( int _line_number ); + +/* %if-bison-bridge */ +/* %endif */ + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int parser6_wrap ( void ); +#else +extern int parser6_wrap ( void ); +#endif +#endif + +/* %not-for-header */ +#ifndef YY_NO_UNPUT + +#endif +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif +/* %ok-for-header */ + +/* %endif */ +#endif + +/* %if-c-only */ + +/* %endif */ + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( parser6_text, (size_t) parser6_leng, 1, parser6_out )) {} } while (0) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( parser6_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( parser6_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, parser6_in)) == 0 && ferror(parser6_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(parser6_in); \ + } \ + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +/* %if-c-only */ +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ +/* %ok-for-header */ + +/* %not-for-header */ +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ + +extern int parser6_lex (void); + +#define YY_DECL int parser6_lex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after parser6_text and parser6_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +/* %% [6.0] YY_RULE_SETUP definition goes here */ +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/* %not-for-header */ +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! parser6_in ) +/* %if-c-only */ + parser6_in = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! parser6_out ) +/* %if-c-only */ + parser6_out = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! YY_CURRENT_BUFFER ) { + parser6_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + parser6__create_buffer(parser6_in,YY_BUF_SIZE ); + } + + parser6__load_buffer_state( ); + } + + { +/* %% [7.0] user's declarations go here */ +#line 96 "agent_lexer.ll" + + + +#line 100 "agent_lexer.ll" + // This part of the code is copied over to the verbatim to the top + // of the generated yylex function. Explanation: + // http://www.gnu.org/software/bison/manual/html_node/Multiple-start_002dsymbols.html + + // Code run each time yylex is called. + driver.loc_.step(); + + // We currently have 3 points of entries defined: + // START_JSON - which expects any valid JSON + // START_AGENT - which expects full configuration (with outer map and Control-agent + // object in it. + // START_SUB_AGENT - which expects only content of the Control-agent, this is + // primarily useful for testing. + if (start_token_flag) { + start_token_flag = false; + switch (start_token_value) { + case ParserContext::PARSER_JSON: + default: + return isc::agent::AgentParser::make_START_JSON(driver.loc_); + case ParserContext::PARSER_AGENT: + return isc::agent::AgentParser::make_START_AGENT(driver.loc_); + case ParserContext::PARSER_SUB_AGENT: + return isc::agent::AgentParser::make_START_SUB_AGENT(driver.loc_); + } + } + + +#line 1549 "agent_lexer.cc" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); + + /* Support of parser6_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 300 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 299 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +/* %% [11.0] code for parser6_lineno update goes here */ + +do_action: /* This label is used only to access EOF actions. */ + +/* %% [12.0] debug code goes here */ + if ( parser6__flex_debug ) + { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 52 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], parser6_text ); + else if ( yy_act == 52 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + parser6_text ); + else if ( yy_act == 53 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } + + switch ( yy_act ) + { /* beginning of action switch */ +/* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 127 "agent_lexer.ll" +; + YY_BREAK +case 2: +YY_RULE_SETUP +#line 129 "agent_lexer.ll" +; + YY_BREAK +case 3: +YY_RULE_SETUP +#line 131 "agent_lexer.ll" +{ + BEGIN(COMMENT); + comment_start_line = driver.loc_.end.line;; +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 136 "agent_lexer.ll" +BEGIN(INITIAL); + YY_BREAK +case 5: +YY_RULE_SETUP +#line 137 "agent_lexer.ll" +; + YY_BREAK +case YY_STATE_EOF(COMMENT): +#line 138 "agent_lexer.ll" +{ + isc_throw(ParseError, "Comment not closed. (/* in line " << comment_start_line); +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 142 "agent_lexer.ll" +BEGIN(DIR_ENTER); + YY_BREAK +case 7: +YY_RULE_SETUP +#line 143 "agent_lexer.ll" +BEGIN(DIR_INCLUDE); + YY_BREAK +case 8: +YY_RULE_SETUP +#line 144 "agent_lexer.ll" +{ + // Include directive. + + // Extract the filename. + std::string tmp(yytext+1); + tmp.resize(tmp.size() - 1); + + driver.includeFile(tmp); +} + YY_BREAK +case YY_STATE_EOF(DIR_ENTER): +case YY_STATE_EOF(DIR_INCLUDE): +case YY_STATE_EOF(DIR_EXIT): +#line 153 "agent_lexer.ll" +{ + isc_throw(ParseError, "Directive not closed."); +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 156 "agent_lexer.ll" +BEGIN(INITIAL); + YY_BREAK +case 10: +YY_RULE_SETUP +#line 159 "agent_lexer.ll" +{ + // Ok, we found a with space. Let's ignore it and update loc variable. + driver.loc_.step(); +} + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 164 "agent_lexer.ll" +{ + // Newline found. Let's update the location and continue. + driver.loc_.lines(yyleng); + driver.loc_.step(); +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 171 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_CONTROL_AGENT(driver.loc_); + } else { + return AgentParser::make_STRING("Control-agent", driver.loc_); + } +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 179 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_HTTP_HOST(driver.loc_); + } else { + return AgentParser::make_STRING("http-host", driver.loc_); + } +} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 187 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_HTTP_PORT(driver.loc_); + } else { + return AgentParser::make_STRING("http-port", driver.loc_); + } +} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 195 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_DHCP4_SERVER(driver.loc_); + } else { + return AgentParser::make_STRING("dhcp4-server", driver.loc_); + } +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 203 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_DHCP6_SERVER(driver.loc_); + } else { + return AgentParser::make_STRING("dhcp6-server", driver.loc_); + } +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 211 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_D2_SERVER(driver.loc_); + } else { + return AgentParser::make_STRING("d2-server", driver.loc_); + } +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 219 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_UNIX(driver.loc_); + } + std::string tmp(yytext+1); + tmp.resize(tmp.size() - 1); + return AgentParser::make_STRING(tmp, driver.loc_); +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 228 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_NAME(driver.loc_); + } else { + return AgentParser::make_STRING("name", driver.loc_); + } +} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 237 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_LOGGING(driver.loc_); + } else { + return AgentParser::make_STRING("Logging", driver.loc_); + } +} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 245 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_LOGGERS(driver.loc_); + } else { + return AgentParser::make_STRING("loggers", driver.loc_); + } +} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 253 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_OUTPUT_OPTIONS(driver.loc_); + } else { + return AgentParser::make_STRING("output_options", driver.loc_); + } +} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 261 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_OUTPUT(driver.loc_); + } else { + return AgentParser::make_STRING("output", driver.loc_); + } +} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 269 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_DEBUGLEVEL(driver.loc_); + } else { + return AgentParser::make_STRING("debuglevel", driver.loc_); + } +} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 277 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_SEVERITY(driver.loc_); + } else { + return AgentParser::make_STRING("severity", driver.loc_); + } +} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 285 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_HOOKS_LIBRARIES(driver.loc_); + } else { + return AgentParser::make_STRING("hooks-libraries", driver.loc_); + } +} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 294 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_PARAMETERS(driver.loc_); + } else { + return AgentParser::make_STRING("parameters", driver.loc_); + } +} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 302 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_LIBRARY(driver.loc_); + } else { + return AgentParser::make_STRING("library", driver.loc_); + } +} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 311 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_CONTROL_SOCKETS(driver.loc_); + } else { + return AgentParser::make_STRING("control-sockets", driver.loc_); + } +} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 319 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_SOCKET_TYPE(driver.loc_); + } else { + return AgentParser::make_STRING("socket-type", driver.loc_); + } +} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 327 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_SOCKET_NAME(driver.loc_); + } else { + return AgentParser::make_STRING("socket-name", driver.loc_); + } +} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 335 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_DHCP4(driver.loc_); + } else { + return AgentParser::make_STRING("Dhcp4", driver.loc_); + } +} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 343 "agent_lexer.ll" +{ + if (driver.ctx_ != ParserContext::NO_KEYWORDS) { + return AgentParser::make_DHCP4(driver.loc_); + } else { + return AgentParser::make_STRING("Dhcp4", driver.loc_); + } +} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 351 "agent_lexer.ll" +{ + // A string has been matched. It contains the actual string and single quotes. + // We need to get those quotes out of the way and just use its content, e.g. + // for 'foo' we should get foo + std::string raw(yytext+1); + size_t len = raw.size() - 1; + raw.resize(len); + std::string decoded; + decoded.reserve(len); + for (size_t pos = 0; pos < len; ++pos) { + int b = 0; + char c = raw[pos]; + switch (c) { + case '"': + // impossible condition + driver.error(driver.loc_, "Bad quote in \"" + raw + "\""); + case '\\': + ++pos; + if (pos >= len) { + // impossible condition + driver.error(driver.loc_, "Overflow escape in \"" + raw + "\""); + } + c = raw[pos]; + switch (c) { + case '"': + case '\\': + case '/': + decoded.push_back(c); + break; + case 'b': + decoded.push_back('\b'); + break; + case 'f': + decoded.push_back('\f'); + break; + case 'n': + decoded.push_back('\n'); + break; + case 'r': + decoded.push_back('\r'); + break; + case 't': + decoded.push_back('\t'); + break; + case 'u': + // support only \u0000 to \u00ff + ++pos; + if (pos + 4 > len) { + // impossible condition + driver.error(driver.loc_, + "Overflow unicode escape in \"" + raw + "\""); + } + if ((raw[pos] != '0') || (raw[pos + 1] != '0')) { + driver.error(driver.loc_, "Unsupported unicode escape in \"" + raw + "\""); + } + pos += 2; + c = raw[pos]; + if ((c >= '0') && (c <= '9')) { + b = (c - '0') << 4; + } else if ((c >= 'A') && (c <= 'F')) { + b = (c - 'A' + 10) << 4; + } else if ((c >= 'a') && (c <= 'f')) { + b = (c - 'a' + 10) << 4; + } else { + // impossible condition + driver.error(driver.loc_, "Not hexadecimal in unicode escape in \"" + raw + "\""); + } + pos++; + c = raw[pos]; + if ((c >= '0') && (c <= '9')) { + b |= c - '0'; + } else if ((c >= 'A') && (c <= 'F')) { + b |= c - 'A' + 10; + } else if ((c >= 'a') && (c <= 'f')) { + b |= c - 'a' + 10; + } else { + // impossible condition + driver.error(driver.loc_, "Not hexadecimal in unicode escape in \"" + raw + "\""); + } + decoded.push_back(static_cast(b & 0xff)); + break; + default: + // impossible condition + driver.error(driver.loc_, "Bad escape in \"" + raw + "\""); + } + break; + default: + if ((c >= 0) && (c < 0x20)) { + // impossible condition + driver.error(driver.loc_, "Invalid control in \"" + raw + "\""); + } + decoded.push_back(c); + } + } + + return AgentParser::make_STRING(decoded, driver.loc_); +} + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 449 "agent_lexer.ll" +{ + // Bad string with a forbidden control character inside + driver.error(driver.loc_, "Invalid control in " + std::string(yytext)); +} + YY_BREAK +case 36: +/* rule 36 can match eol */ +YY_RULE_SETUP +#line 454 "agent_lexer.ll" +{ + // Bad string with a bad escape inside + driver.error(driver.loc_, "Bad escape in " + std::string(yytext)); +} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 459 "agent_lexer.ll" +{ + // Bad string with an open escape at the end + driver.error(driver.loc_, "Overflow escape in " + std::string(yytext)); +} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 464 "agent_lexer.ll" +{ return AgentParser::make_LSQUARE_BRACKET(driver.loc_); } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 465 "agent_lexer.ll" +{ return AgentParser::make_RSQUARE_BRACKET(driver.loc_); } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 466 "agent_lexer.ll" +{ return AgentParser::make_LCURLY_BRACKET(driver.loc_); } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 467 "agent_lexer.ll" +{ return AgentParser::make_RCURLY_BRACKET(driver.loc_); } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 468 "agent_lexer.ll" +{ return AgentParser::make_COMMA(driver.loc_); } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 469 "agent_lexer.ll" +{ return AgentParser::make_COLON(driver.loc_); } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 471 "agent_lexer.ll" +{ + // An integer was found. + std::string tmp(yytext); + int64_t integer = 0; + try { + // In substring we want to use negative values (e.g. -1). + // In enterprise-id we need to use values up to 0xffffffff. + // To cover both of those use cases, we need at least + // int64_t. + integer = boost::lexical_cast(tmp); + } catch (const boost::bad_lexical_cast &) { + driver.error(driver.loc_, "Failed to convert " + tmp + " to an integer."); + } + + // The parser needs the string form as double conversion is no lossless + return AgentParser::make_INTEGER(integer, driver.loc_); +} + YY_BREAK +case 45: +YY_RULE_SETUP +#line 489 "agent_lexer.ll" +{ + // A floating point was found. + std::string tmp(yytext); + double fp = 0.0; + try { + fp = boost::lexical_cast(tmp); + } catch (const boost::bad_lexical_cast &) { + driver.error(driver.loc_, "Failed to convert " + tmp + " to a floating point."); + } + + return AgentParser::make_FLOAT(fp, driver.loc_); +} + YY_BREAK +case 46: +YY_RULE_SETUP +#line 502 "agent_lexer.ll" +{ + string tmp(yytext); + return AgentParser::make_BOOLEAN(tmp == "true", driver.loc_); +} + YY_BREAK +case 47: +YY_RULE_SETUP +#line 507 "agent_lexer.ll" +{ + return AgentParser::make_NULL_TYPE(driver.loc_); +} + YY_BREAK +case 48: +YY_RULE_SETUP +#line 511 "agent_lexer.ll" +driver.error (driver.loc_, "JSON true reserved keyword is lower case only"); + YY_BREAK +case 49: +YY_RULE_SETUP +#line 513 "agent_lexer.ll" +driver.error (driver.loc_, "JSON false reserved keyword is lower case only"); + YY_BREAK +case 50: +YY_RULE_SETUP +#line 515 "agent_lexer.ll" +driver.error (driver.loc_, "JSON null reserved keyword is lower case only"); + YY_BREAK +case 51: +YY_RULE_SETUP +#line 517 "agent_lexer.ll" +driver.error (driver.loc_, "Invalid character: " + std::string(yytext)); + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 519 "agent_lexer.ll" +{ + if (driver.states_.empty()) { + return AgentParser::make_END(driver.loc_); + } + driver.loc_ = driver.locs_.back(); + driver.locs_.pop_back(); + driver.file_ = driver.files_.back(); + driver.files_.pop_back(); + if (driver.sfile_) { + fclose(driver.sfile_); + driver.sfile_ = 0; + } + if (!driver.sfiles_.empty()) { + driver.sfile_ = driver.sfiles_.back(); + driver.sfiles_.pop_back(); + } + parser6__delete_buffer(YY_CURRENT_BUFFER); + parser6__switch_to_buffer(driver.states_.back()); + driver.states_.pop_back(); + + BEGIN(DIR_EXIT); +} + YY_BREAK +case 52: +YY_RULE_SETUP +#line 542 "agent_lexer.ll" +ECHO; + YY_BREAK +#line 2215 "agent_lexer.cc" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed parser6_in at a new source and called + * parser6_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; +/* %if-c-only */ + YY_CURRENT_BUFFER_LVALUE->yy_input_file = parser6_in; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( parser6_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * parser6_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of parser6_lex */ +/* %ok-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ +/* %ok-for-header */ + +/* %endif */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + parser6_realloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + parser6_restart(parser6_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) parser6_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + yy_state_type yy_current_state; + char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { +/* %% [16.0] code to find the next state goes here */ + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 300 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int yy_is_jam; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 300 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 299); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT +/* %if-c-only */ + +/* %endif */ +#endif + +/* %if-c-only */ +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + parser6_restart(parser6_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( parser6_wrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve parser6_text */ + (yy_hold_char) = *++(yy_c_buf_p); + +/* %% [19.0] update BOL and parser6_lineno */ + + return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void parser6_restart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + parser6_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + parser6__create_buffer(parser6_in,YY_BUF_SIZE ); + } + + parser6__init_buffer(YY_CURRENT_BUFFER,input_file ); + parser6__load_buffer_state( ); +} + +/* %if-c++-only */ +/* %endif */ + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void parser6__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * parser6_pop_buffer_state(); + * parser6_push_buffer_state(new_buffer); + */ + parser6_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + parser6__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (parser6_wrap()) processing, but the only time this flag + * is looked at is after parser6_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +/* %if-c-only */ +static void parser6__load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; +/* %if-c-only */ + parser6_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE parser6__create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) parser6_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in parser6__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) parser6_alloc((yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in parser6__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + parser6__init_buffer(b,file ); + + return b; +} + +/* %if-c++-only */ +/* %endif */ + +/** Destroy the buffer. + * @param b a buffer created with parser6__create_buffer() + * + */ +/* %if-c-only */ + void parser6__delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + parser6_free((void *) b->yy_ch_buf ); + + parser6_free((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a parser6_restart() or at EOF. + */ +/* %if-c-only */ + static void parser6__init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +{ + int oerrno = errno; + + parser6__flush_buffer(b ); + +/* %if-c-only */ + b->yy_input_file = file; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then parser6__init_buffer was _probably_ + * called from parser6_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + +/* %if-c-only */ + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void parser6__flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + parser6__load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void parser6_push_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + parser6_ensure_buffer_stack(); + + /* This block is copied from parser6__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from parser6__switch_to_buffer. */ + parser6__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void parser6_pop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + parser6__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + parser6__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void parser6_ensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)parser6_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in parser6_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)parser6_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in parser6_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE parser6__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) parser6_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in parser6__scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + parser6__switch_to_buffer(b ); + + return b; +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to parser6_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * parser6__scan_bytes() instead. + */ +YY_BUFFER_STATE parser6__scan_string (const char * yystr ) +{ + + return parser6__scan_bytes(yystr,(int) strlen(yystr) ); +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to parser6_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE parser6__scan_bytes (const char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) parser6_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in parser6__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = parser6__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in parser6__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} +/* %endif */ + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +/* %if-c-only */ +static void yynoreturn yy_fatal_error (const char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up parser6_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + parser6_text[parser6_leng] = (yy_hold_char); \ + (yy_c_buf_p) = parser6_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + parser6_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int parser6_get_lineno (void) +{ + + return parser6_lineno; +} + +/** Get the input stream. + * + */ +FILE *parser6_get_in (void) +{ + return parser6_in; +} + +/** Get the output stream. + * + */ +FILE *parser6_get_out (void) +{ + return parser6_out; +} + +/** Get the length of the current token. + * + */ +int parser6_get_leng (void) +{ + return parser6_leng; +} + +/** Get the current token. + * + */ + +char *parser6_get_text (void) +{ + return parser6_text; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param _line_number line number + * + */ +void parser6_set_lineno (int _line_number ) +{ + + parser6_lineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see parser6__switch_to_buffer + */ +void parser6_set_in (FILE * _in_str ) +{ + parser6_in = _in_str ; +} + +void parser6_set_out (FILE * _out_str ) +{ + parser6_out = _out_str ; +} + +int parser6_get_debug (void) +{ + return parser6__flex_debug; +} + +void parser6_set_debug (int _bdebug ) +{ + parser6__flex_debug = _bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif if-c-only */ + +/* %if-c-only */ +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from parser6_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + parser6_in = stdin; + parser6_out = stdout; +#else + parser6_in = NULL; + parser6_out = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * parser6_lex_init() + */ + return 0; +} +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* parser6_lex_destroy is for both reentrant and non-reentrant scanners. */ +int parser6_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + parser6__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + parser6_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + parser6_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * parser6_lex() is called, initialization will occur. */ + yy_init_globals( ); + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *parser6_alloc (yy_size_t size ) +{ + return malloc(size); +} + +void *parser6_realloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void parser6_free (void * ptr ) +{ + free( (char *) ptr ); /* see parser6_realloc() for (char *) cast */ +} + +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#line 542 "agent_lexer.ll" + + +using namespace isc::dhcp; + +void +ParserContext::scanStringBegin(const std::string& str, ParserType parser_type) +{ + start_token_flag = true; + start_token_value = parser_type; + + file_ = ""; + sfile_ = 0; + loc_.initialize(&file_); + yy_flex_debug = trace_scanning_; + YY_BUFFER_STATE buffer; + buffer = parser6__scan_bytes(str.c_str(), str.size()); + if (!buffer) { + fatal("cannot scan string"); + // fatal() throws an exception so this can't be reached + } +} + +void +ParserContext::scanFileBegin(FILE * f, + const std::string& filename, + ParserType parser_type) +{ + start_token_flag = true; + start_token_value = parser_type; + + file_ = filename; + sfile_ = f; + loc_.initialize(&file_); + yy_flex_debug = trace_scanning_; + YY_BUFFER_STATE buffer; + + // See dhcp6_lexer.cc header for available definitions + buffer = parser6__create_buffer(f, 65536 /*buffer size*/); + if (!buffer) { + fatal("cannot scan file " + filename); + } + parser6__switch_to_buffer(buffer); +} + +void +ParserContext::scanEnd() { + if (sfile_) + fclose(sfile_); + sfile_ = 0; + static_cast(parser6_lex_destroy()); + // Close files + while (!sfiles_.empty()) { + FILE* f = sfiles_.back(); + if (f) { + fclose(f); + } + sfiles_.pop_back(); + } + // Delete states + while (!states_.empty()) { + parser6__delete_buffer(states_.back()); + states_.pop_back(); + } +} + +void +ParserContext::includeFile(const std::string& filename) { + if (states_.size() > 10) { + fatal("Too many nested include."); + } + + FILE* f = fopen(filename.c_str(), "r"); + if (!f) { + fatal("Can't open include file " + filename); + } + if (sfile_) { + sfiles_.push_back(sfile_); + } + sfile_ = f; + states_.push_back(YY_CURRENT_BUFFER); + YY_BUFFER_STATE buffer; + buffer = parser6__create_buffer(f, 65536 /*buffer size*/); + if (!buffer) { + fatal( "Can't scan include file " + filename); + } + parser6__switch_to_buffer(buffer); + files_.push_back(file_); + file_ = filename; + locs_.push_back(loc_); + loc_.initialize(&file_); + + BEGIN(INITIAL); +} + +namespace { +/// To avoid unused function error +class Dummy { + // cppcheck-suppress unusedPrivateFunction + void dummy() { yy_fatal_error("Fix me: how to disable its definition?"); } +}; +} + diff --git a/src/bin/agent/agent_parser.h b/src/bin/agent/agent_parser.h new file mode 100644 index 0000000000..a1345c0171 --- /dev/null +++ b/src/bin/agent/agent_parser.h @@ -0,0 +1,1437 @@ +// A Bison parser, made by GNU Bison 3.0.4. + +// Skeleton interface for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file agent_parser.h + ** Define the isc::agent::parser class. + */ + +// C++ LALR(1) parser skeleton written by Akim Demaille. + +#ifndef YY_AGENT_AGENT_PARSER_H_INCLUDED +# define YY_AGENT_AGENT_PARSER_H_INCLUDED +// // "%code requires" blocks. +#line 17 "agent_parser.yy" // lalr1.cc:377 + +#include +#include +#include +#include + +using namespace isc::agent; +using namespace isc::data; +using namespace std; + +#line 55 "agent_parser.h" // lalr1.cc:377 + +# include +# include // std::abort +# include +# include +# include +# include +# include "stack.hh" +# include "location.hh" +#include +#ifndef YYASSERT +# include +# define YYASSERT assert +#endif + + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +/* Debug traces. */ +#ifndef AGENT_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define AGENT_DEBUG 1 +# else +# define AGENT_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define AGENT_DEBUG 1 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined AGENT_DEBUG */ + +#line 14 "agent_parser.yy" // lalr1.cc:377 +namespace isc { namespace agent { +#line 140 "agent_parser.h" // lalr1.cc:377 + + + + /// A char[S] buffer to store and retrieve objects. + /// + /// Sort of a variant, but does not keep track of the nature + /// of the stored data, since that knowledge is available + /// via the current state. + template + struct variant + { + /// Type of *this. + typedef variant self_type; + + /// Empty construction. + variant () + : yytypeid_ (YY_NULLPTR) + {} + + /// Construct and fill. + template + variant (const T& t) + : yytypeid_ (&typeid (T)) + { + YYASSERT (sizeof (T) <= S); + new (yyas_ ()) T (t); + } + + /// Destruction, allowed only if empty. + ~variant () + { + YYASSERT (!yytypeid_); + } + + /// Instantiate an empty \a T in here. + template + T& + build () + { + YYASSERT (!yytypeid_); + YYASSERT (sizeof (T) <= S); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T; + } + + /// Instantiate a \a T in here from \a t. + template + T& + build (const T& t) + { + YYASSERT (!yytypeid_); + YYASSERT (sizeof (T) <= S); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T (t); + } + + /// Accessor to a built \a T. + template + T& + as () + { + YYASSERT (*yytypeid_ == typeid (T)); + YYASSERT (sizeof (T) <= S); + return *yyas_ (); + } + + /// Const accessor to a built \a T (for %printer). + template + const T& + as () const + { + YYASSERT (*yytypeid_ == typeid (T)); + YYASSERT (sizeof (T) <= S); + return *yyas_ (); + } + + /// Swap the content with \a other, of same type. + /// + /// Both variants must be built beforehand, because swapping the actual + /// data requires reading it (with as()), and this is not possible on + /// unconstructed variants: it would require some dynamic testing, which + /// should not be the variant's responsability. + /// Swapping between built and (possibly) non-built is done with + /// variant::move (). + template + void + swap (self_type& other) + { + YYASSERT (yytypeid_); + YYASSERT (*yytypeid_ == *other.yytypeid_); + std::swap (as (), other.as ()); + } + + /// Move the content of \a other to this. + /// + /// Destroys \a other. + template + void + move (self_type& other) + { + build (); + swap (other); + other.destroy (); + } + + /// Copy the content of \a other to this. + template + void + copy (const self_type& other) + { + build (other.as ()); + } + + /// Destroy the stored \a T. + template + void + destroy () + { + as ().~T (); + yytypeid_ = YY_NULLPTR; + } + + private: + /// Prohibit blind copies. + self_type& operator=(const self_type&); + variant (const self_type&); + + /// Accessor to raw memory as \a T. + template + T* + yyas_ () + { + void *yyp = yybuffer_.yyraw; + return static_cast (yyp); + } + + /// Const accessor to raw memory as \a T. + template + const T* + yyas_ () const + { + const void *yyp = yybuffer_.yyraw; + return static_cast (yyp); + } + + union + { + /// Strongest alignment constraints. + long double yyalign_me; + /// A buffer large enough to store any of the semantic values. + char yyraw[S]; + } yybuffer_; + + /// Whether the content is built: if defined, the name of the stored type. + const std::type_info *yytypeid_; + }; + + + /// A Bison parser. + class AgentParser + { + public: +#ifndef AGENT_STYPE + /// An auxiliary type to compute the largest semantic type. + union union_type + { + // value + // socket_type_value + char dummy1[sizeof(ElementPtr)]; + + // "boolean" + char dummy2[sizeof(bool)]; + + // "floating point" + char dummy3[sizeof(double)]; + + // "integer" + char dummy4[sizeof(int64_t)]; + + // "constant string" + char dummy5[sizeof(std::string)]; +}; + + /// Symbol semantic values. + typedef variant semantic_type; +#else + typedef AGENT_STYPE semantic_type; +#endif + /// Symbol locations. + typedef location location_type; + + /// Syntax errors thrown from user actions. + struct syntax_error : std::runtime_error + { + syntax_error (const location_type& l, const std::string& m); + location_type location; + }; + + /// Tokens. + struct token + { + enum yytokentype + { + TOKEN_END = 0, + TOKEN_COMMA = 258, + TOKEN_COLON = 259, + TOKEN_LSQUARE_BRACKET = 260, + TOKEN_RSQUARE_BRACKET = 261, + TOKEN_LCURLY_BRACKET = 262, + TOKEN_RCURLY_BRACKET = 263, + TOKEN_NULL_TYPE = 264, + TOKEN_CONTROL_AGENT = 265, + TOKEN_CONTROL_SOCKETS = 266, + TOKEN_HTTP_HOST = 267, + TOKEN_HTTP_PORT = 268, + TOKEN_DHCP4_SERVER = 269, + TOKEN_DHCP6_SERVER = 270, + TOKEN_D2_SERVER = 271, + TOKEN_HOOKS_LIBRARIES = 272, + TOKEN_LIBRARY = 273, + TOKEN_PARAMETERS = 274, + TOKEN_SOCKET_TYPE = 275, + TOKEN_SOCKET_NAME = 276, + TOKEN_UNIX = 277, + TOKEN_LOGGING = 278, + TOKEN_LOGGERS = 279, + TOKEN_OUTPUT_OPTIONS = 280, + TOKEN_OUTPUT = 281, + TOKEN_DEBUGLEVEL = 282, + TOKEN_SEVERITY = 283, + TOKEN_NAME = 284, + TOKEN_DHCP4 = 285, + TOKEN_DHCP6 = 286, + TOKEN_DHCPDDNS = 287, + TOKEN_START_JSON = 288, + TOKEN_START_AGENT = 289, + TOKEN_START_SUB_AGENT = 290, + TOKEN_STRING = 291, + TOKEN_INTEGER = 292, + TOKEN_FLOAT = 293, + TOKEN_BOOLEAN = 294 + }; + }; + + /// (External) token type, as returned by yylex. + typedef token::yytokentype token_type; + + /// Symbol type: an internal symbol number. + typedef int symbol_number_type; + + /// The symbol type number to denote an empty symbol. + enum { empty_symbol = -2 }; + + /// Internal symbol number for tokens (subsumed by symbol_number_type). + typedef unsigned char token_number_type; + + /// A complete symbol. + /// + /// Expects its Base type to provide access to the symbol type + /// via type_get(). + /// + /// Provide access to semantic value and location. + template + struct basic_symbol : Base + { + /// Alias to Base. + typedef Base super_type; + + /// Default constructor. + basic_symbol (); + + /// Copy constructor. + basic_symbol (const basic_symbol& other); + + /// Constructor for valueless symbols, and symbols from each type. + + basic_symbol (typename Base::kind_type t, const location_type& l); + + basic_symbol (typename Base::kind_type t, const ElementPtr v, const location_type& l); + + basic_symbol (typename Base::kind_type t, const bool v, const location_type& l); + + basic_symbol (typename Base::kind_type t, const double v, const location_type& l); + + basic_symbol (typename Base::kind_type t, const int64_t v, const location_type& l); + + basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l); + + + /// Constructor for symbols with semantic value. + basic_symbol (typename Base::kind_type t, + const semantic_type& v, + const location_type& l); + + /// Destroy the symbol. + ~basic_symbol (); + + /// Destroy contents, and record that is empty. + void clear (); + + /// Whether empty. + bool empty () const; + + /// Destructive move, \a s is emptied into this. + void move (basic_symbol& s); + + /// The semantic value. + semantic_type value; + + /// The location. + location_type location; + + private: + /// Assignment operator. + basic_symbol& operator= (const basic_symbol& other); + }; + + /// Type access provider for token (enum) based symbols. + struct by_type + { + /// Default constructor. + by_type (); + + /// Copy constructor. + by_type (const by_type& other); + + /// The symbol type as needed by the constructor. + typedef token_type kind_type; + + /// Constructor from (external) token numbers. + by_type (kind_type t); + + /// Record that this symbol is empty. + void clear (); + + /// Steal the symbol type from \a that. + void move (by_type& that); + + /// The (internal) type number (corresponding to \a type). + /// \a empty when empty. + symbol_number_type type_get () const; + + /// The token. + token_type token () const; + + /// The symbol type. + /// \a empty_symbol when empty. + /// An int, not token_number_type, to be able to store empty_symbol. + int type; + }; + + /// "External" symbols: returned by the scanner. + typedef basic_symbol symbol_type; + + // Symbol constructors declarations. + static inline + symbol_type + make_END (const location_type& l); + + static inline + symbol_type + make_COMMA (const location_type& l); + + static inline + symbol_type + make_COLON (const location_type& l); + + static inline + symbol_type + make_LSQUARE_BRACKET (const location_type& l); + + static inline + symbol_type + make_RSQUARE_BRACKET (const location_type& l); + + static inline + symbol_type + make_LCURLY_BRACKET (const location_type& l); + + static inline + symbol_type + make_RCURLY_BRACKET (const location_type& l); + + static inline + symbol_type + make_NULL_TYPE (const location_type& l); + + static inline + symbol_type + make_CONTROL_AGENT (const location_type& l); + + static inline + symbol_type + make_CONTROL_SOCKETS (const location_type& l); + + static inline + symbol_type + make_HTTP_HOST (const location_type& l); + + static inline + symbol_type + make_HTTP_PORT (const location_type& l); + + static inline + symbol_type + make_DHCP4_SERVER (const location_type& l); + + static inline + symbol_type + make_DHCP6_SERVER (const location_type& l); + + static inline + symbol_type + make_D2_SERVER (const location_type& l); + + static inline + symbol_type + make_HOOKS_LIBRARIES (const location_type& l); + + static inline + symbol_type + make_LIBRARY (const location_type& l); + + static inline + symbol_type + make_PARAMETERS (const location_type& l); + + static inline + symbol_type + make_SOCKET_TYPE (const location_type& l); + + static inline + symbol_type + make_SOCKET_NAME (const location_type& l); + + static inline + symbol_type + make_UNIX (const location_type& l); + + static inline + symbol_type + make_LOGGING (const location_type& l); + + static inline + symbol_type + make_LOGGERS (const location_type& l); + + static inline + symbol_type + make_OUTPUT_OPTIONS (const location_type& l); + + static inline + symbol_type + make_OUTPUT (const location_type& l); + + static inline + symbol_type + make_DEBUGLEVEL (const location_type& l); + + static inline + symbol_type + make_SEVERITY (const location_type& l); + + static inline + symbol_type + make_NAME (const location_type& l); + + static inline + symbol_type + make_DHCP4 (const location_type& l); + + static inline + symbol_type + make_DHCP6 (const location_type& l); + + static inline + symbol_type + make_DHCPDDNS (const location_type& l); + + static inline + symbol_type + make_START_JSON (const location_type& l); + + static inline + symbol_type + make_START_AGENT (const location_type& l); + + static inline + symbol_type + make_START_SUB_AGENT (const location_type& l); + + static inline + symbol_type + make_STRING (const std::string& v, const location_type& l); + + static inline + symbol_type + make_INTEGER (const int64_t& v, const location_type& l); + + static inline + symbol_type + make_FLOAT (const double& v, const location_type& l); + + static inline + symbol_type + make_BOOLEAN (const bool& v, const location_type& l); + + + /// Build a parser object. + AgentParser (isc::agent::ParserContext& ctx_yyarg); + virtual ~AgentParser (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if AGENT_DEBUG + /// The current debugging stream. + std::ostream& debug_stream () const YY_ATTRIBUTE_PURE; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const YY_ATTRIBUTE_PURE; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Report a syntax error. + void error (const syntax_error& err); + + private: + /// This class is not copyable. + AgentParser (const AgentParser&); + AgentParser& operator= (const AgentParser&); + + /// State numbers. + typedef int state_type; + + /// Generate an error message. + /// \param yystate the state where the error occurred. + /// \param yyla the lookahead token. + virtual std::string yysyntax_error_ (state_type yystate, + const symbol_type& yyla) const; + + /// Compute post-reduction state. + /// \param yystate the current state + /// \param yysym the nonterminal to push on the stack + state_type yy_lr_goto_state_ (state_type yystate, int yysym); + + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue); + + static const signed char yypact_ninf_; + static const signed char yytable_ninf_; + + /// Convert a scanner token number \a t to a symbol number. + static token_number_type yytranslate_ (token_type t); + + // Tables. + // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + // STATE-NUM. + static const short int yypact_[]; + + // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + // Performed when YYTABLE does not specify something else to do. Zero + // means the default is an error. + static const unsigned char yydefact_[]; + + // YYPGOTO[NTERM-NUM]. + static const signed char yypgoto_[]; + + // YYDEFGOTO[NTERM-NUM]. + static const short int yydefgoto_[]; + + // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + // positive, shift that token. If negative, reduce the rule whose + // number is the opposite. If YYTABLE_NINF, syntax error. + static const unsigned char yytable_[]; + + static const short int yycheck_[]; + + // YYSTOS[STATE-NUM] -- The (internal number of the) accessing + // symbol of state STATE-NUM. + static const unsigned char yystos_[]; + + // YYR1[YYN] -- Symbol number of symbol that rule YYN derives. + static const unsigned char yyr1_[]; + + // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. + static const unsigned char yyr2_[]; + + + /// Convert the symbol name \a n to a form suitable for a diagnostic. + static std::string yytnamerr_ (const char *n); + + + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#if AGENT_DEBUG + // YYRLINE[YYN] -- Source line where rule number YYN was defined. + static const unsigned short int yyrline_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); + + // Debugging. + int yydebug_; + std::ostream* yycdebug_; + + /// \brief Display a symbol type, value and location. + /// \param yyo The output stream. + /// \param yysym The symbol. + template + void yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const; +#endif + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, print nothing. + /// \param yysym The symbol. + template + void yy_destroy_ (const char* yymsg, basic_symbol& yysym) const; + + private: + /// Type access provider for state based symbols. + struct by_state + { + /// Default constructor. + by_state (); + + /// The symbol type as needed by the constructor. + typedef state_type kind_type; + + /// Constructor. + by_state (kind_type s); + + /// Copy constructor. + by_state (const by_state& other); + + /// Record that this symbol is empty. + void clear (); + + /// Steal the symbol type from \a that. + void move (by_state& that); + + /// The (internal) type number (corresponding to \a state). + /// \a empty_symbol when empty. + symbol_number_type type_get () const; + + /// The state number used to denote an empty symbol. + enum { empty_state = -1 }; + + /// The state. + /// \a empty when empty. + state_type state; + }; + + /// "Internal" symbol: element of the stack. + struct stack_symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + /// Construct an empty symbol. + stack_symbol_type (); + /// Steal the contents from \a sym to build this. + stack_symbol_type (state_type s, symbol_type& sym); + /// Assignment, needed by push_back. + stack_symbol_type& operator= (const stack_symbol_type& that); + }; + + /// Stack type. + typedef stack stack_type; + + /// The stack. + stack_type yystack_; + + /// Push a new state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the symbol + /// \warning the contents of \a s.value is stolen. + void yypush_ (const char* m, stack_symbol_type& s); + + /// Push a new look ahead token on the state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the state + /// \param sym the symbol (for its value and location). + /// \warning the contents of \a s.value is stolen. + void yypush_ (const char* m, state_type s, symbol_type& sym); + + /// Pop \a n symbols the three stacks. + void yypop_ (unsigned int n = 1); + + /// Constants. + enum + { + yyeof_ = 0, + yylast_ = 171, ///< Last index in yytable_. + yynnts_ = 87, ///< Number of nonterminal symbols. + yyfinal_ = 8, ///< Termination state number. + yyterror_ = 1, + yyerrcode_ = 256, + yyntokens_ = 40 ///< Number of tokens. + }; + + + // User arguments. + isc::agent::ParserContext& ctx; + }; + + // Symbol number corresponding to token number t. + inline + AgentParser::token_number_type + AgentParser::yytranslate_ (token_type t) + { + static + const token_number_type + translate_table[] = + { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39 + }; + const unsigned int user_token_number_max_ = 294; + const token_number_type undef_token_ = 2; + + if (static_cast(t) <= yyeof_) + return yyeof_; + else if (static_cast (t) <= user_token_number_max_) + return translate_table[t]; + else + return undef_token_; + } + + inline + AgentParser::syntax_error::syntax_error (const location_type& l, const std::string& m) + : std::runtime_error (m) + , location (l) + {} + + // basic_symbol. + template + inline + AgentParser::basic_symbol::basic_symbol () + : value () + {} + + template + inline + AgentParser::basic_symbol::basic_symbol (const basic_symbol& other) + : Base (other) + , value () + , location (other.location) + { + switch (other.type_get ()) + { + case 48: // value + case 94: // socket_type_value + value.copy< ElementPtr > (other.value); + break; + + case 39: // "boolean" + value.copy< bool > (other.value); + break; + + case 38: // "floating point" + value.copy< double > (other.value); + break; + + case 37: // "integer" + value.copy< int64_t > (other.value); + break; + + case 36: // "constant string" + value.copy< std::string > (other.value); + break; + + default: + break; + } + + } + + + template + inline + AgentParser::basic_symbol::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l) + : Base (t) + , value () + , location (l) + { + (void) v; + switch (this->type_get ()) + { + case 48: // value + case 94: // socket_type_value + value.copy< ElementPtr > (v); + break; + + case 39: // "boolean" + value.copy< bool > (v); + break; + + case 38: // "floating point" + value.copy< double > (v); + break; + + case 37: // "integer" + value.copy< int64_t > (v); + break; + + case 36: // "constant string" + value.copy< std::string > (v); + break; + + default: + break; + } +} + + + // Implementation of basic_symbol constructor for each type. + + template + AgentParser::basic_symbol::basic_symbol (typename Base::kind_type t, const location_type& l) + : Base (t) + , value () + , location (l) + {} + + template + AgentParser::basic_symbol::basic_symbol (typename Base::kind_type t, const ElementPtr v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} + + template + AgentParser::basic_symbol::basic_symbol (typename Base::kind_type t, const bool v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} + + template + AgentParser::basic_symbol::basic_symbol (typename Base::kind_type t, const double v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} + + template + AgentParser::basic_symbol::basic_symbol (typename Base::kind_type t, const int64_t v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} + + template + AgentParser::basic_symbol::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} + + + template + inline + AgentParser::basic_symbol::~basic_symbol () + { + clear (); + } + + template + inline + void + AgentParser::basic_symbol::clear () + { + // User destructor. + symbol_number_type yytype = this->type_get (); + basic_symbol& yysym = *this; + (void) yysym; + switch (yytype) + { + default: + break; + } + + // Type destructor. + switch (yytype) + { + case 48: // value + case 94: // socket_type_value + value.template destroy< ElementPtr > (); + break; + + case 39: // "boolean" + value.template destroy< bool > (); + break; + + case 38: // "floating point" + value.template destroy< double > (); + break; + + case 37: // "integer" + value.template destroy< int64_t > (); + break; + + case 36: // "constant string" + value.template destroy< std::string > (); + break; + + default: + break; + } + + Base::clear (); + } + + template + inline + bool + AgentParser::basic_symbol::empty () const + { + return Base::type_get () == empty_symbol; + } + + template + inline + void + AgentParser::basic_symbol::move (basic_symbol& s) + { + super_type::move(s); + switch (this->type_get ()) + { + case 48: // value + case 94: // socket_type_value + value.move< ElementPtr > (s.value); + break; + + case 39: // "boolean" + value.move< bool > (s.value); + break; + + case 38: // "floating point" + value.move< double > (s.value); + break; + + case 37: // "integer" + value.move< int64_t > (s.value); + break; + + case 36: // "constant string" + value.move< std::string > (s.value); + break; + + default: + break; + } + + location = s.location; + } + + // by_type. + inline + AgentParser::by_type::by_type () + : type (empty_symbol) + {} + + inline + AgentParser::by_type::by_type (const by_type& other) + : type (other.type) + {} + + inline + AgentParser::by_type::by_type (token_type t) + : type (yytranslate_ (t)) + {} + + inline + void + AgentParser::by_type::clear () + { + type = empty_symbol; + } + + inline + void + AgentParser::by_type::move (by_type& that) + { + type = that.type; + that.clear (); + } + + inline + int + AgentParser::by_type::type_get () const + { + return type; + } + + inline + AgentParser::token_type + AgentParser::by_type::token () const + { + // YYTOKNUM[NUM] -- (External) token number corresponding to the + // (internal) symbol number NUM (which must be that of a token). */ + static + const unsigned short int + yytoken_number_[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294 + }; + return static_cast (yytoken_number_[type]); + } + // Implementation of make_symbol for each symbol type. + AgentParser::symbol_type + AgentParser::make_END (const location_type& l) + { + return symbol_type (token::TOKEN_END, l); + } + + AgentParser::symbol_type + AgentParser::make_COMMA (const location_type& l) + { + return symbol_type (token::TOKEN_COMMA, l); + } + + AgentParser::symbol_type + AgentParser::make_COLON (const location_type& l) + { + return symbol_type (token::TOKEN_COLON, l); + } + + AgentParser::symbol_type + AgentParser::make_LSQUARE_BRACKET (const location_type& l) + { + return symbol_type (token::TOKEN_LSQUARE_BRACKET, l); + } + + AgentParser::symbol_type + AgentParser::make_RSQUARE_BRACKET (const location_type& l) + { + return symbol_type (token::TOKEN_RSQUARE_BRACKET, l); + } + + AgentParser::symbol_type + AgentParser::make_LCURLY_BRACKET (const location_type& l) + { + return symbol_type (token::TOKEN_LCURLY_BRACKET, l); + } + + AgentParser::symbol_type + AgentParser::make_RCURLY_BRACKET (const location_type& l) + { + return symbol_type (token::TOKEN_RCURLY_BRACKET, l); + } + + AgentParser::symbol_type + AgentParser::make_NULL_TYPE (const location_type& l) + { + return symbol_type (token::TOKEN_NULL_TYPE, l); + } + + AgentParser::symbol_type + AgentParser::make_CONTROL_AGENT (const location_type& l) + { + return symbol_type (token::TOKEN_CONTROL_AGENT, l); + } + + AgentParser::symbol_type + AgentParser::make_CONTROL_SOCKETS (const location_type& l) + { + return symbol_type (token::TOKEN_CONTROL_SOCKETS, l); + } + + AgentParser::symbol_type + AgentParser::make_HTTP_HOST (const location_type& l) + { + return symbol_type (token::TOKEN_HTTP_HOST, l); + } + + AgentParser::symbol_type + AgentParser::make_HTTP_PORT (const location_type& l) + { + return symbol_type (token::TOKEN_HTTP_PORT, l); + } + + AgentParser::symbol_type + AgentParser::make_DHCP4_SERVER (const location_type& l) + { + return symbol_type (token::TOKEN_DHCP4_SERVER, l); + } + + AgentParser::symbol_type + AgentParser::make_DHCP6_SERVER (const location_type& l) + { + return symbol_type (token::TOKEN_DHCP6_SERVER, l); + } + + AgentParser::symbol_type + AgentParser::make_D2_SERVER (const location_type& l) + { + return symbol_type (token::TOKEN_D2_SERVER, l); + } + + AgentParser::symbol_type + AgentParser::make_HOOKS_LIBRARIES (const location_type& l) + { + return symbol_type (token::TOKEN_HOOKS_LIBRARIES, l); + } + + AgentParser::symbol_type + AgentParser::make_LIBRARY (const location_type& l) + { + return symbol_type (token::TOKEN_LIBRARY, l); + } + + AgentParser::symbol_type + AgentParser::make_PARAMETERS (const location_type& l) + { + return symbol_type (token::TOKEN_PARAMETERS, l); + } + + AgentParser::symbol_type + AgentParser::make_SOCKET_TYPE (const location_type& l) + { + return symbol_type (token::TOKEN_SOCKET_TYPE, l); + } + + AgentParser::symbol_type + AgentParser::make_SOCKET_NAME (const location_type& l) + { + return symbol_type (token::TOKEN_SOCKET_NAME, l); + } + + AgentParser::symbol_type + AgentParser::make_UNIX (const location_type& l) + { + return symbol_type (token::TOKEN_UNIX, l); + } + + AgentParser::symbol_type + AgentParser::make_LOGGING (const location_type& l) + { + return symbol_type (token::TOKEN_LOGGING, l); + } + + AgentParser::symbol_type + AgentParser::make_LOGGERS (const location_type& l) + { + return symbol_type (token::TOKEN_LOGGERS, l); + } + + AgentParser::symbol_type + AgentParser::make_OUTPUT_OPTIONS (const location_type& l) + { + return symbol_type (token::TOKEN_OUTPUT_OPTIONS, l); + } + + AgentParser::symbol_type + AgentParser::make_OUTPUT (const location_type& l) + { + return symbol_type (token::TOKEN_OUTPUT, l); + } + + AgentParser::symbol_type + AgentParser::make_DEBUGLEVEL (const location_type& l) + { + return symbol_type (token::TOKEN_DEBUGLEVEL, l); + } + + AgentParser::symbol_type + AgentParser::make_SEVERITY (const location_type& l) + { + return symbol_type (token::TOKEN_SEVERITY, l); + } + + AgentParser::symbol_type + AgentParser::make_NAME (const location_type& l) + { + return symbol_type (token::TOKEN_NAME, l); + } + + AgentParser::symbol_type + AgentParser::make_DHCP4 (const location_type& l) + { + return symbol_type (token::TOKEN_DHCP4, l); + } + + AgentParser::symbol_type + AgentParser::make_DHCP6 (const location_type& l) + { + return symbol_type (token::TOKEN_DHCP6, l); + } + + AgentParser::symbol_type + AgentParser::make_DHCPDDNS (const location_type& l) + { + return symbol_type (token::TOKEN_DHCPDDNS, l); + } + + AgentParser::symbol_type + AgentParser::make_START_JSON (const location_type& l) + { + return symbol_type (token::TOKEN_START_JSON, l); + } + + AgentParser::symbol_type + AgentParser::make_START_AGENT (const location_type& l) + { + return symbol_type (token::TOKEN_START_AGENT, l); + } + + AgentParser::symbol_type + AgentParser::make_START_SUB_AGENT (const location_type& l) + { + return symbol_type (token::TOKEN_START_SUB_AGENT, l); + } + + AgentParser::symbol_type + AgentParser::make_STRING (const std::string& v, const location_type& l) + { + return symbol_type (token::TOKEN_STRING, v, l); + } + + AgentParser::symbol_type + AgentParser::make_INTEGER (const int64_t& v, const location_type& l) + { + return symbol_type (token::TOKEN_INTEGER, v, l); + } + + AgentParser::symbol_type + AgentParser::make_FLOAT (const double& v, const location_type& l) + { + return symbol_type (token::TOKEN_FLOAT, v, l); + } + + AgentParser::symbol_type + AgentParser::make_BOOLEAN (const bool& v, const location_type& l) + { + return symbol_type (token::TOKEN_BOOLEAN, v, l); + } + + +#line 14 "agent_parser.yy" // lalr1.cc:377 +} } // isc::agent +#line 1433 "agent_parser.h" // lalr1.cc:377 + + + + +#endif // !YY_AGENT_AGENT_PARSER_H_INCLUDED diff --git a/src/bin/agent/location.hh b/src/bin/agent/location.hh new file mode 100644 index 0000000000..6ecc3752ba --- /dev/null +++ b/src/bin/agent/location.hh @@ -0,0 +1,193 @@ +// Generated 201702071235 +// A Bison parser, made by GNU Bison 3.0.4. + +// Locations for Bison parsers in C++ + +// Copyright (C) 2002-2015 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file location.hh + ** Define the isc::agent::location class. + */ + +#ifndef YY_AGENT_LOCATION_HH_INCLUDED +# define YY_AGENT_LOCATION_HH_INCLUDED + +# include "position.hh" + +#line 14 "agent_parser.yy" // location.cc:296 +namespace isc { namespace agent { +#line 46 "location.hh" // location.cc:296 + /// Abstract a location. + class location + { + public: + + /// Construct a location from \a b to \a e. + location (const position& b, const position& e) + : begin (b) + , end (e) + { + } + + /// Construct a 0-width location in \a p. + explicit location (const position& p = position ()) + : begin (p) + , end (p) + { + } + + /// Construct a 0-width location in \a f, \a l, \a c. + explicit location (std::string* f, + unsigned int l = 1u, + unsigned int c = 1u) + : begin (f, l, c) + , end (f, l, c) + { + } + + + /// Initialization. + void initialize (std::string* f = YY_NULLPTR, + unsigned int l = 1u, + unsigned int c = 1u) + { + begin.initialize (f, l, c); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + void columns (int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + void lines (int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two locations, in place. + inline location& operator+= (location& res, const location& end) + { + res.end = end.end; + return res; + } + + /// Join two locations. + inline location operator+ (location res, const location& end) + { + return res += end; + } + + /// Add \a width columns to the end position, in place. + inline location& operator+= (location& res, int width) + { + res.columns (width); + return res; + } + + /// Add \a width columns to the end position. + inline location operator+ (location res, int width) + { + return res += width; + } + + /// Subtract \a width columns to the end position, in place. + inline location& operator-= (location& res, int width) + { + return res += -width; + } + + /// Subtract \a width columns to the end position. + inline location operator- (location res, int width) + { + return res -= width; + } + + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const location& loc) + { + unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; + ostr << loc.begin; + if (loc.end.filename + && (!loc.begin.filename + || *loc.begin.filename != *loc.end.filename)) + ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col; + else if (loc.begin.line < loc.end.line) + ostr << '-' << loc.end.line << '.' << end_col; + else if (loc.begin.column < end_col) + ostr << '-' << end_col; + return ostr; + } + +#line 14 "agent_parser.yy" // location.cc:296 +} } // isc::agent +#line 192 "location.hh" // location.cc:296 +#endif // !YY_AGENT_LOCATION_HH_INCLUDED diff --git a/src/bin/agent/position.hh b/src/bin/agent/position.hh new file mode 100644 index 0000000000..299235ff55 --- /dev/null +++ b/src/bin/agent/position.hh @@ -0,0 +1,181 @@ +// Generated 201702071235 +// A Bison parser, made by GNU Bison 3.0.4. + +// Positions for Bison parsers in C++ + +// Copyright (C) 2002-2015 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file position.hh + ** Define the isc::agent::position class. + */ + +#ifndef YY_AGENT_POSITION_HH_INCLUDED +# define YY_AGENT_POSITION_HH_INCLUDED + +# include // std::max +# include +# include + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +#line 14 "agent_parser.yy" // location.cc:296 +namespace isc { namespace agent { +#line 56 "position.hh" // location.cc:296 + /// Abstract a position. + class position + { + public: + /// Construct a position. + explicit position (std::string* f = YY_NULLPTR, + unsigned int l = 1u, + unsigned int c = 1u) + : filename (f) + , line (l) + , column (c) + { + } + + + /// Initialization. + void initialize (std::string* fn = YY_NULLPTR, + unsigned int l = 1u, + unsigned int c = 1u) + { + filename = fn; + line = l; + column = c; + } + + /** \name Line and Column related manipulators + ** \{ */ + /// (line related) Advance to the COUNT next lines. + void lines (int count = 1) + { + if (count) + { + column = 1u; + line = add_ (line, count, 1); + } + } + + /// (column related) Advance to the COUNT next columns. + void columns (int count = 1) + { + column = add_ (column, count, 1); + } + /** \} */ + + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + + private: + /// Compute max(min, lhs+rhs) (provided min <= lhs). + static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min) + { + return (0 < rhs || -static_cast(rhs) < lhs + ? rhs + lhs + : min); + } + }; + + /// Add \a width columns, in place. + inline position& + operator+= (position& res, int width) + { + res.columns (width); + return res; + } + + /// Add \a width columns. + inline position + operator+ (position res, int width) + { + return res += width; + } + + /// Subtract \a width columns, in place. + inline position& + operator-= (position& res, int width) + { + return res += -width; + } + + /// Subtract \a width columns. + inline position + operator- (position res, int width) + { + return res -= width; + } + + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return (pos1.line == pos2.line + && pos1.column == pos2.column + && (pos1.filename == pos2.filename + || (pos1.filename && pos2.filename + && *pos1.filename == *pos2.filename))); + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + +#line 14 "agent_parser.yy" // location.cc:296 +} } // isc::agent +#line 180 "position.hh" // location.cc:296 +#endif // !YY_AGENT_POSITION_HH_INCLUDED diff --git a/src/bin/agent/stack.hh b/src/bin/agent/stack.hh new file mode 100644 index 0000000000..5ef2ff3b8f --- /dev/null +++ b/src/bin/agent/stack.hh @@ -0,0 +1,158 @@ +// Generated 201702071235 +// A Bison parser, made by GNU Bison 3.0.4. + +// Stack handling for Bison parsers in C++ + +// Copyright (C) 2002-2015 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file stack.hh + ** Define the isc::agent::stack class. + */ + +#ifndef YY_AGENT_STACK_HH_INCLUDED +# define YY_AGENT_STACK_HH_INCLUDED + +# include + +#line 14 "agent_parser.yy" // stack.hh:132 +namespace isc { namespace agent { +#line 46 "stack.hh" // stack.hh:132 + template > + class stack + { + public: + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + + stack () + : seq_ () + { + seq_.reserve (200); + } + + stack (unsigned int n) + : seq_ (n) + {} + + inline + T& + operator[] (unsigned int i) + { + return seq_[seq_.size () - 1 - i]; + } + + inline + const T& + operator[] (unsigned int i) const + { + return seq_[seq_.size () - 1 - i]; + } + + /// Steal the contents of \a t. + /// + /// Close to move-semantics. + inline + void + push (T& t) + { + seq_.push_back (T()); + operator[](0).move (t); + } + + inline + void + pop (unsigned int n = 1) + { + for (; n; --n) + seq_.pop_back (); + } + + void + clear () + { + seq_.clear (); + } + + inline + typename S::size_type + size () const + { + return seq_.size (); + } + + inline + const_iterator + begin () const + { + return seq_.rbegin (); + } + + inline + const_iterator + end () const + { + return seq_.rend (); + } + + private: + stack (const stack&); + stack& operator= (const stack&); + /// The wrapped container. + S seq_; + }; + + /// Present a slice of the top of a stack. + template > + class slice + { + public: + slice (const S& stack, unsigned int range) + : stack_ (stack) + , range_ (range) + {} + + inline + const T& + operator [] (unsigned int i) const + { + return stack_[range_ - i]; + } + + private: + const S& stack_; + unsigned int range_; + }; + +#line 14 "agent_parser.yy" // stack.hh:132 +} } // isc::agent +#line 156 "stack.hh" // stack.hh:132 + +#endif // !YY_AGENT_STACK_HH_INCLUDED