From: Tomek Mrugalski Date: Tue, 2 Feb 2016 22:17:46 +0000 (+0100) Subject: [4264] Parser regenerated. X-Git-Tag: trac4267_base0~8^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1c2e8ed0a540551275371033757df3fc7ef10be;p=thirdparty%2Fkea.git [4264] Parser regenerated. --- diff --git a/src/lib/eval/lexer.cc b/src/lib/eval/lexer.cc index 8b18ebe05e..06f7bb0f5a 100644 --- a/src/lib/eval/lexer.cc +++ b/src/lib/eval/lexer.cc @@ -18,7 +18,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 39 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -72,7 +72,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -80,7 +79,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -111,6 +109,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ /* %endif */ @@ -185,7 +185,15 @@ typedef unsigned int flex_uint32_t; /* 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. @@ -225,11 +233,18 @@ extern FILE *yyin, *yyout; */ #define YY_LESS_LINENO(n) \ do { \ - yy_size_t yyl;\ + int yyl;\ for ( yyl = n; yyl < yyleng; ++yyl )\ if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --yylineno;\ + }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -420,7 +435,7 @@ void yyfree (void * ); /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ /* Begin user sect3 */ -#define yywrap(n) 1 +#define yywrap() 1 #define YY_SKIP_YYWRAP #define FLEX_DEBUG @@ -438,6 +453,8 @@ int yylineno = 1; extern char *yytext; #define yytext_ptr yytext +/* %% [1.5] DFA */ + /* %if-c-only Standard (non-C++) definition */ static yy_state_type yy_get_previous_state (void ); @@ -453,15 +470,15 @@ static void yy_fatal_error (yyconst char msg[] ); #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ /* %% [3.0] code to copy yytext_ptr to yytext[] 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 20 -#define YY_END_OF_BUFFER 21 +#define YY_NUM_RULES 21 +#define YY_END_OF_BUFFER 22 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -469,27 +486,30 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[90] = +static yyconst flex_int16_t yy_acclist[98] = { 0, - 21, 19, 20, 1, 19, 20, 2, 20, 19, 20, - 14, 19, 20, 15, 19, 20, 18, 19, 20, 19, - 20, 13, 19, 20, 5, 19, 20, 5, 19, 20, - 19, 20, 19, 20,16390, 16, 19, 20, 17, 19, - 20, 19, 20,16390, 19, 20,16390, 19, 20,16390, - 19, 20,16390, 19, 20,16390, 1, 2, 3, 5, - 7,16390, 8198,16390,16390,16390,16390,16390, 4, 12, - 16390, 10,16390,16390,16390,16390,16390,16390, 9,16390, - 16390,16390, 8,16390,16390,16390,16390, 11,16390 + 22, 20, 21, 1, 20, 21, 2, 21, 20, 21, + 15, 20, 21, 16, 20, 21, 19, 20, 21, 20, + 21, 14, 20, 21, 5, 20, 21, 5, 20, 21, + 20, 21, 20, 21,16390, 17, 20, 21, 18, 20, + 21, 20, 21,16390, 20, 21,16390, 20, 21,16390, + 20, 21,16390, 20, 21,16390, 20, 21,16390, 1, + 2, 3, 5, 7,16390, 8198,16390,16390,16390,16390, + 16390,16390, 4, 13,16390, 10,16390,16390,16390,16390, + 16390,16390,16390,16390, 9,16390,16390, 12,16390,16390, + 8,16390,16390,16390,16390, 11,16390 + } ; -static yyconst flex_int16_t yy_accept[58] = +static yyconst flex_int16_t yy_accept[63] = { 0, 1, 1, 1, 2, 4, 7, 9, 11, 14, 17, 20, 22, 25, 28, 31, 33, 36, 39, 42, 45, - 48, 51, 54, 57, 58, 59, 59, 60, 61, 61, - 62, 62, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 72, 74, 75, 76, 77, 78, 79, 81, 82, - 83, 85, 86, 87, 88, 90, 90 + 48, 51, 54, 57, 60, 61, 62, 62, 63, 64, + 64, 65, 65, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 76, 78, 79, 80, 81, 82, 83, + 84, 85, 87, 88, 90, 91, 93, 94, 95, 96, + 98, 98 } ; static yyconst flex_int32_t yy_ec[256] = @@ -507,7 +527,7 @@ static yyconst flex_int32_t yy_ec[256] = 21, 13, 22, 23, 24, 14, 14, 25, 14, 26, 27, 28, 14, 29, 30, 31, 32, 14, 14, 33, - 14, 14, 1, 1, 1, 1, 1, 1, 1, 1, + 34, 14, 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, @@ -524,89 +544,93 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[34] = +static yyconst flex_int32_t yy_meta[35] = { 0, 1, 2, 3, 1, 1, 1, 1, 2, 1, 4, 4, 1, 4, 2, 2, 1, 2, 2, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2 + 2, 2, 2, 2 } ; -static yyconst flex_int16_t yy_base[60] = +static yyconst flex_int16_t yy_base[65] = { 0, - 0, 0, 119, 120, 116, 114, 112, 120, 120, 120, - 24, 120, 26, 28, 103, 58, 120, 120, 75, 19, - 17, 18, 26, 112, 110, 108, 120, 38, 0, 120, - 50, 54, 86, 120, 85, 21, 33, 43, 37, 0, - 80, 76, 48, 44, 55, 57, 56, 66, 63, 65, - 60, 71, 72, 77, 40, 120, 102, 105, 51 + 0, 0, 128, 129, 125, 123, 121, 129, 129, 129, + 25, 129, 27, 29, 112, 41, 129, 129, 59, 20, + 22, 27, 21, 30, 121, 119, 117, 129, 46, 0, + 129, 61, 63, 95, 129, 94, 46, 43, 93, 50, + 48, 0, 92, 91, 58, 66, 62, 64, 69, 65, + 72, 90, 75, 85, 73, 68, 80, 81, 47, 61, + 129, 107, 110, 50 } ; -static yyconst flex_int16_t yy_def[60] = +static yyconst flex_int16_t yy_def[65] = { 0, - 56, 1, 56, 56, 56, 56, 57, 56, 56, 56, - 56, 56, 56, 56, 56, 58, 56, 56, 58, 19, - 19, 19, 19, 56, 56, 57, 56, 56, 59, 56, - 56, 19, 19, 56, 19, 19, 19, 19, 19, 59, + 61, 1, 61, 61, 61, 61, 62, 61, 61, 61, + 61, 61, 61, 61, 61, 63, 61, 61, 63, 19, + 19, 19, 19, 19, 61, 61, 62, 61, 61, 64, + 61, 61, 19, 19, 61, 19, 19, 19, 19, 19, + 19, 64, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 0, 56, 56, 56 + 0, 61, 61, 61 } ; -static yyconst flex_int16_t yy_nxt[154] = +static yyconst flex_int16_t yy_nxt[164] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 16, 17, 18, 4, 19, 16, - 16, 16, 20, 16, 16, 16, 21, 16, 16, 22, - 23, 16, 16, 28, 28, 28, 28, 28, 28, 36, - 29, 33, 33, 33, 37, 33, 39, 28, 28, 38, - 33, 31, 31, 42, 40, 56, 56, 33, 29, 31, - 31, 33, 44, 43, 33, 32, 34, 33, 33, 45, - 56, 46, 33, 47, 34, 32, 31, 31, 33, 33, - 33, 33, 32, 49, 33, 48, 50, 33, 51, 33, - 33, 34, 32, 52, 53, 33, 33, 54, 55, 35, - - 33, 33, 26, 26, 33, 26, 33, 33, 33, 41, - 33, 27, 25, 24, 30, 27, 25, 24, 56, 3, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56 + 16, 16, 20, 16, 16, 16, 21, 16, 22, 23, + 24, 16, 16, 16, 29, 29, 29, 29, 29, 29, + 37, 30, 32, 32, 34, 34, 34, 39, 33, 38, + 41, 34, 40, 42, 34, 29, 29, 35, 33, 30, + 32, 32, 32, 32, 61, 61, 33, 34, 60, 47, + 34, 34, 34, 45, 34, 35, 33, 35, 44, 61, + 48, 49, 34, 36, 50, 34, 34, 34, 34, 34, + 34, 51, 34, 34, 52, 53, 34, 34, 54, 34, + + 56, 57, 55, 58, 34, 34, 59, 27, 27, 34, + 27, 34, 34, 34, 34, 34, 34, 46, 43, 34, + 28, 26, 25, 31, 28, 26, 25, 61, 3, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61 } ; -static yyconst flex_int16_t yy_chk[154] = +static yyconst flex_int16_t yy_chk[164] = { 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, 11, 11, 13, 13, 14, 14, 20, - 13, 21, 22, 20, 21, 36, 23, 28, 28, 22, - 23, 31, 31, 36, 59, 32, 32, 37, 13, 16, - 16, 39, 38, 37, 55, 16, 31, 38, 44, 39, - 32, 43, 43, 44, 16, 16, 19, 19, 32, 45, - 47, 46, 19, 46, 51, 45, 47, 49, 49, 50, - 48, 19, 19, 50, 52, 52, 53, 53, 54, 19, - - 42, 54, 57, 57, 41, 57, 58, 58, 58, 35, - 33, 26, 25, 24, 15, 7, 6, 5, 3, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56 + 1, 1, 1, 1, 11, 11, 13, 13, 14, 14, + 20, 13, 16, 16, 20, 23, 21, 22, 16, 21, + 24, 22, 23, 64, 24, 29, 29, 16, 16, 13, + 19, 19, 32, 32, 33, 33, 19, 38, 59, 40, + 37, 59, 41, 38, 40, 19, 19, 32, 37, 33, + 41, 45, 45, 19, 46, 60, 47, 33, 48, 50, + 46, 47, 56, 49, 48, 49, 51, 55, 50, 53, + + 53, 55, 51, 57, 57, 58, 58, 62, 62, 54, + 62, 63, 63, 63, 52, 44, 43, 39, 36, 34, + 27, 26, 25, 15, 7, 6, 5, 3, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[21] = +static yyconst flex_int32_t yy_rule_can_match_eol[22] = { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, }; + 0, 0, }; extern int yy_flex_debug; int yy_flex_debug = 1; -static yyconst flex_int16_t yy_rule_linenum[20] = +static yyconst flex_int16_t yy_rule_linenum[21] = { 0, - 86, 90, 96, 106, 112, 126, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 146 + 78, 82, 88, 98, 104, 118, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 139 } ; static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; @@ -638,8 +662,7 @@ char *yytext; 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 16 "lexer.ll" +#line 8 "lexer.ll" #include #include #include @@ -679,12 +702,12 @@ static isc::eval::location loc; useful in more complex cases. */ /* These are not token expressions yet, just convenience expressions that can be used during actual token definitions. */ -#line 73 "lexer.ll" +#line 65 "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 loc.columns(yyleng); -#line 695 "lexer.cc" +#line 711 "lexer.cc" #define INITIAL 0 @@ -793,7 +816,12 @@ static int input (void ); /* 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. */ @@ -802,7 +830,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ @@ -817,7 +845,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -923,17 +951,6 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -/* %% [7.0] user's declarations go here */ -#line 79 "lexer.ll" - - - - // Code run each time yylex is called. - loc.step(); - - -#line 943 "lexer.cc" - if ( !(yy_init) ) { (yy_init) = 1; @@ -974,6 +991,18 @@ YY_DECL yy_load_buffer_state( ); } + { +/* %% [7.0] user's declarations go here */ +#line 71 "lexer.ll" + + + + // Code run each time yylex is called. + loc.step(); + + +#line 1005 "lexer.cc" + while ( 1 ) /* loops until end-of-file is reached */ { /* %% [8.0] yymore()-related code goes here */ @@ -996,24 +1025,23 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*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 >= 57 ) + if ( yy_current_state >= 62 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } - while ( yy_current_state != 56 ); + while ( yy_current_state != 61 ); yy_find_action: /* %% [10.0] code to find the action number goes here */ yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; -goto find_rule; /* Shut up GCC warning -Wall */ find_rule: /* we branch to this label when backing up */ for ( ; ; ) /* until we find what rule we matched */ { @@ -1071,13 +1099,13 @@ do_action: /* This label is used only to access EOF actions. */ { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 20 ) + else if ( yy_act < 21 ) fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 20 ) + else if ( yy_act == 21 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", yytext ); - else if ( yy_act == 21 ) + else if ( yy_act == 22 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); @@ -1088,7 +1116,7 @@ do_action: /* This label is used only to access EOF actions. */ /* %% [13.0] actions go here */ case 1: YY_RULE_SETUP -#line 86 "lexer.ll" +#line 78 "lexer.ll" { // Ok, we found a with space. Let's ignore it and update loc variable. loc.step(); @@ -1097,7 +1125,7 @@ YY_RULE_SETUP case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 90 "lexer.ll" +#line 82 "lexer.ll" { // Newline found. Let's update the location and continue. loc.lines(yyleng); @@ -1106,7 +1134,7 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 96 "lexer.ll" +#line 88 "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. @@ -1119,7 +1147,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 106 "lexer.ll" +#line 98 "lexer.ll" { // A hex string has been matched. It contains the '0x' or '0X' header // followed by at least one hexadecimal digit. @@ -1128,7 +1156,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 112 "lexer.ll" +#line 104 "lexer.ll" { // An integer was found. std::string tmp(yytext); @@ -1146,7 +1174,7 @@ YY_RULE_SETUP case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 126 "lexer.ll" +#line 118 "lexer.ll" { // This string specifies option name starting with a letter // and further containing letters, digits, hyphens and @@ -1156,79 +1184,84 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 133 "lexer.ll" +#line 125 "lexer.ll" return isc::eval::EvalParser::make_EQUAL(loc); YY_BREAK case 8: YY_RULE_SETUP -#line 134 "lexer.ll" +#line 126 "lexer.ll" return isc::eval::EvalParser::make_OPTION(loc); YY_BREAK case 9: YY_RULE_SETUP -#line 135 "lexer.ll" +#line 127 "lexer.ll" return isc::eval::EvalParser::make_TEXT(loc); YY_BREAK case 10: YY_RULE_SETUP -#line 136 "lexer.ll" +#line 128 "lexer.ll" return isc::eval::EvalParser::make_HEX(loc); YY_BREAK case 11: YY_RULE_SETUP -#line 137 "lexer.ll" +#line 129 "lexer.ll" return isc::eval::EvalParser::make_SUBSTRING(loc); YY_BREAK case 12: YY_RULE_SETUP -#line 138 "lexer.ll" -return isc::eval::EvalParser::make_ALL(loc); +#line 130 "lexer.ll" +return isc::eval::EvalParser::make_RELAY(loc); YY_BREAK case 13: YY_RULE_SETUP -#line 139 "lexer.ll" -return isc::eval::EvalParser::make_DOT(loc); +#line 131 "lexer.ll" +return isc::eval::EvalParser::make_ALL(loc); YY_BREAK case 14: YY_RULE_SETUP -#line 140 "lexer.ll" -return isc::eval::EvalParser::make_LPAREN(loc); +#line 132 "lexer.ll" +return isc::eval::EvalParser::make_DOT(loc); YY_BREAK case 15: YY_RULE_SETUP -#line 141 "lexer.ll" -return isc::eval::EvalParser::make_RPAREN(loc); +#line 133 "lexer.ll" +return isc::eval::EvalParser::make_LPAREN(loc); YY_BREAK case 16: YY_RULE_SETUP -#line 142 "lexer.ll" -return isc::eval::EvalParser::make_LBRACKET(loc); +#line 134 "lexer.ll" +return isc::eval::EvalParser::make_RPAREN(loc); YY_BREAK case 17: YY_RULE_SETUP -#line 143 "lexer.ll" -return isc::eval::EvalParser::make_RBRACKET(loc); +#line 135 "lexer.ll" +return isc::eval::EvalParser::make_LBRACKET(loc); YY_BREAK case 18: YY_RULE_SETUP -#line 144 "lexer.ll" -return isc::eval::EvalParser::make_COMA(loc); +#line 136 "lexer.ll" +return isc::eval::EvalParser::make_RBRACKET(loc); YY_BREAK case 19: YY_RULE_SETUP -#line 146 "lexer.ll" +#line 137 "lexer.ll" +return isc::eval::EvalParser::make_COMA(loc); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 139 "lexer.ll" driver.error (loc, "Invalid character: " + std::string(yytext)); YY_BREAK case YY_STATE_EOF(INITIAL): -#line 147 "lexer.ll" +#line 140 "lexer.ll" return isc::eval::EvalParser::make_END(loc); YY_BREAK -case 20: +case 21: YY_RULE_SETUP -#line 148 "lexer.ll" +#line 141 "lexer.ll" ECHO; YY_BREAK -#line 1239 "lexer.cc" +#line 1265 "lexer.cc" case YY_END_OF_BUFFER: { @@ -1358,6 +1391,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* %ok-for-header */ @@ -1508,7 +1542,7 @@ static int yy_get_next_buffer (void) 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 >= 57 ) + if ( yy_current_state >= 62 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1536,15 +1570,15 @@ static int yy_get_next_buffer (void) 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 >= 57 ) + if ( yy_current_state >= 62 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 56); + yy_is_jam = (yy_current_state == 61); if ( ! yy_is_jam ) *(yy_state_ptr)++ = yy_current_state; - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } /* %if-c-only */ @@ -1603,7 +1637,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) - return 0; + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1767,17 +1801,6 @@ static void yy_load_buffer_state (void) yyfree((void *) b ); } -/* %if-c-only */ - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* %endif */ - -/* %if-c++-only */ -/* %endif */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -2018,8 +2041,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /* %if-c-only */ /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @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. */ @@ -2027,7 +2050,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2298,7 +2322,7 @@ void yyfree (void * ptr ) /* %ok-for-header */ -#line 148 "lexer.ll" +#line 140 "lexer.ll" diff --git a/src/lib/eval/location.hh b/src/lib/eval/location.hh index ce1f953704..c01735e7bd 100644 --- a/src/lib/eval/location.hh +++ b/src/lib/eval/location.hh @@ -1,9 +1,8 @@ -// Generated 20151216 -// A Bison parser, made by GNU Bison 3.0.4. +// A Bison parser, made by GNU Bison 3.0.2. // Locations for Bison parsers in C++ -// Copyright (C) 2002-2015 Free Software Foundation, Inc. +// Copyright (C) 2002-2013 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 @@ -41,9 +40,9 @@ # include "position.hh" -#line 13 "parser.yy" // location.cc:337 +#line 13 "parser.yy" // location.cc:291 namespace isc { namespace eval { -#line 46 "location.hh" // location.cc:337 +#line 46 "location.hh" // location.cc:291 /// Abstract a location. class location { @@ -112,42 +111,36 @@ namespace isc { namespace eval { position end; }; - /// Join two locations, in place. - inline location& operator+= (location& res, const location& end) + /// Join two location objects to create a location. + 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. + /// Change end position in place. inline location& operator+= (location& res, int width) { res.columns (width); return res; } - /// Add \a width columns to the end position. + /// Change end position. inline location operator+ (location res, int width) { return res += width; } - /// Subtract \a width columns to the end position, in place. + /// Change 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) + /// Change end position. + inline location operator- (const location& begin, int width) { - return res -= width; + return begin + -width; } /// Compare two location objects. @@ -175,7 +168,8 @@ namespace isc { namespace eval { operator<< (std::basic_ostream& ostr, const location& loc) { unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; - ostr << loc.begin; + ostr << loc.begin// << "(" << loc.end << ") " +; if (loc.end.filename && (!loc.begin.filename || *loc.begin.filename != *loc.end.filename)) @@ -187,7 +181,7 @@ namespace isc { namespace eval { return ostr; } -#line 13 "parser.yy" // location.cc:337 +#line 13 "parser.yy" // location.cc:291 } } // isc::eval -#line 192 "location.hh" // location.cc:337 +#line 187 "location.hh" // location.cc:291 #endif // !YY_YY_LOCATION_HH_INCLUDED diff --git a/src/lib/eval/parser.cc b/src/lib/eval/parser.cc index 70b4f334fe..fdd7f0ecd4 100644 --- a/src/lib/eval/parser.cc +++ b/src/lib/eval/parser.cc @@ -1,8 +1,8 @@ -// A Bison parser, made by GNU Bison 3.0.4. +// A Bison parser, made by GNU Bison 3.0.2. // Skeleton implementation for Bison LALR(1) parsers in C++ -// Copyright (C) 2002-2015 Free Software Foundation, Inc. +// Copyright (C) 2002-2013 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 @@ -33,7 +33,7 @@ // First part of user declarations. -#line 37 "parser.cc" // lalr1.cc:404 +#line 37 "parser.cc" // lalr1.cc:399 # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -47,13 +47,13 @@ // User implementation prologue. -#line 51 "parser.cc" // lalr1.cc:412 +#line 51 "parser.cc" // lalr1.cc:407 // Unqualified %code blocks. -#line 32 "parser.yy" // lalr1.cc:413 +#line 32 "parser.yy" // lalr1.cc:408 # include "eval_context.h" -#line 57 "parser.cc" // lalr1.cc:413 +#line 57 "parser.cc" // lalr1.cc:408 #ifndef YY_ @@ -130,16 +130,16 @@ #endif // !YYDEBUG #define yyerrok (yyerrstatus_ = 0) -#define yyclearin (yyla.clear ()) +#define yyclearin (yyempty = true) #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus_) -#line 13 "parser.yy" // lalr1.cc:479 +#line 13 "parser.yy" // lalr1.cc:474 namespace isc { namespace eval { -#line 143 "parser.cc" // lalr1.cc:479 +#line 143 "parser.cc" // lalr1.cc:474 /* Return YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is @@ -202,7 +202,7 @@ namespace isc { namespace eval { // by_state. inline EvalParser::by_state::by_state () - : state (empty_state) + : state (empty) {} inline @@ -210,19 +210,12 @@ namespace isc { namespace eval { : state (other.state) {} - inline - void - EvalParser::by_state::clear () - { - state = empty_state; - } - inline void EvalParser::by_state::move (by_state& that) { state = that.state; - that.clear (); + that.state = empty; } inline @@ -234,10 +227,7 @@ namespace isc { namespace eval { EvalParser::symbol_number_type EvalParser::by_state::type_get () const { - if (state == empty_state) - return empty_symbol; - else - return yystos_[state]; + return state == empty ? 0 : yystos_[state]; } inline @@ -251,19 +241,19 @@ namespace isc { namespace eval { { switch (that.type_get ()) { - case 25: // option_repr_type + case 26: // option_repr_type value.move< TokenOption::RepresentationType > (that.value); break; - case 15: // "constant string" - case 16: // "integer" - case 17: // "constant hexstring" - case 18: // "option name" - case 19: // TOKEN + case 16: // "constant string" + case 17: // "integer" + case 18: // "constant hexstring" + case 19: // "option name" + case 20: // TOKEN value.move< std::string > (that.value); break; - case 24: // option_code + case 25: // option_code value.move< uint16_t > (that.value); break; @@ -272,7 +262,7 @@ namespace isc { namespace eval { } // that is emptied. - that.type = empty_symbol; + that.type = empty; } inline @@ -282,19 +272,19 @@ namespace isc { namespace eval { state = that.state; switch (that.type_get ()) { - case 25: // option_repr_type + case 26: // option_repr_type value.copy< TokenOption::RepresentationType > (that.value); break; - case 15: // "constant string" - case 16: // "integer" - case 17: // "constant hexstring" - case 18: // "option name" - case 19: // TOKEN + case 16: // "constant string" + case 17: // "integer" + case 18: // "constant hexstring" + case 19: // "option name" + case 20: // TOKEN value.copy< std::string > (that.value); break; - case 24: // option_code + case 25: // option_code value.copy< uint16_t > (that.value); break; @@ -325,62 +315,58 @@ namespace isc { namespace eval { std::ostream& yyoutput = yyo; YYUSE (yyoutput); symbol_number_type yytype = yysym.type_get (); - // Avoid a (spurious) G++ 4.8 warning about "array subscript is - // below array bounds". - if (yysym.empty ()) - std::abort (); yyo << (yytype < yyntokens_ ? "token" : "nterm") << ' ' << yytname_[yytype] << " (" << yysym.location << ": "; switch (yytype) { - case 15: // "constant string" + case 16: // "constant string" -#line 62 "parser.yy" // lalr1.cc:636 +#line 63 "parser.yy" // lalr1.cc:617 { yyoutput << yysym.value.template as< std::string > (); } -#line 342 "parser.cc" // lalr1.cc:636 +#line 328 "parser.cc" // lalr1.cc:617 break; - case 16: // "integer" + case 17: // "integer" -#line 62 "parser.yy" // lalr1.cc:636 +#line 63 "parser.yy" // lalr1.cc:617 { yyoutput << yysym.value.template as< std::string > (); } -#line 349 "parser.cc" // lalr1.cc:636 +#line 335 "parser.cc" // lalr1.cc:617 break; - case 17: // "constant hexstring" + case 18: // "constant hexstring" -#line 62 "parser.yy" // lalr1.cc:636 +#line 63 "parser.yy" // lalr1.cc:617 { yyoutput << yysym.value.template as< std::string > (); } -#line 356 "parser.cc" // lalr1.cc:636 +#line 342 "parser.cc" // lalr1.cc:617 break; - case 18: // "option name" + case 19: // "option name" -#line 62 "parser.yy" // lalr1.cc:636 +#line 63 "parser.yy" // lalr1.cc:617 { yyoutput << yysym.value.template as< std::string > (); } -#line 363 "parser.cc" // lalr1.cc:636 +#line 349 "parser.cc" // lalr1.cc:617 break; - case 19: // TOKEN + case 20: // TOKEN -#line 62 "parser.yy" // lalr1.cc:636 +#line 63 "parser.yy" // lalr1.cc:617 { yyoutput << yysym.value.template as< std::string > (); } -#line 370 "parser.cc" // lalr1.cc:636 +#line 356 "parser.cc" // lalr1.cc:617 break; - case 24: // option_code + case 25: // option_code -#line 62 "parser.yy" // lalr1.cc:636 +#line 63 "parser.yy" // lalr1.cc:617 { yyoutput << yysym.value.template as< uint16_t > (); } -#line 377 "parser.cc" // lalr1.cc:636 +#line 363 "parser.cc" // lalr1.cc:617 break; - case 25: // option_repr_type + case 26: // option_repr_type -#line 62 "parser.yy" // lalr1.cc:636 +#line 63 "parser.yy" // lalr1.cc:617 { yyoutput << yysym.value.template as< TokenOption::RepresentationType > (); } -#line 384 "parser.cc" // lalr1.cc:636 +#line 370 "parser.cc" // lalr1.cc:617 break; @@ -467,6 +453,9 @@ namespace isc { namespace eval { int EvalParser::parse () { + /// Whether yyla contains a lookahead. + bool yyempty = true; + // State. int yyn; /// Length of the RHS of the rule being reduced. @@ -518,7 +507,7 @@ namespace isc { namespace eval { goto yydefault; // Read a lookahead token. - if (yyla.empty ()) + if (yyempty) { YYCDEBUG << "Reading a token: "; try @@ -531,6 +520,7 @@ namespace isc { namespace eval { error (yyexc); goto yyerrlab1; } + yyempty = false; } YY_SYMBOL_PRINT ("Next token is", yyla); @@ -550,6 +540,9 @@ namespace isc { namespace eval { goto yyreduce; } + // Discard the token being shifted. + yyempty = true; + // Count tokens shifted since error; after three, turn off error status. if (yyerrstatus_) --yyerrstatus_; @@ -580,19 +573,19 @@ namespace isc { namespace eval { when using variants. */ switch (yyr1_[yyn]) { - case 25: // option_repr_type + case 26: // option_repr_type yylhs.value.build< TokenOption::RepresentationType > (); break; - case 15: // "constant string" - case 16: // "integer" - case 17: // "constant hexstring" - case 18: // "option name" - case 19: // TOKEN + case 16: // "constant string" + case 17: // "integer" + case 18: // "constant hexstring" + case 19: // "option name" + case 20: // TOKEN yylhs.value.build< std::string > (); break; - case 24: // option_code + case 25: // option_code yylhs.value.build< uint16_t > (); break; @@ -614,111 +607,128 @@ namespace isc { namespace eval { switch (yyn) { case 3: -#line 75 "parser.yy" // lalr1.cc:859 +#line 76 "parser.yy" // lalr1.cc:847 { TokenPtr eq(new TokenEqual()); ctx.expression.push_back(eq); } -#line 623 "parser.cc" // lalr1.cc:859 +#line 616 "parser.cc" // lalr1.cc:847 break; case 4: -#line 82 "parser.yy" // lalr1.cc:859 +#line 83 "parser.yy" // lalr1.cc:847 { TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ())); ctx.expression.push_back(str); } -#line 632 "parser.cc" // lalr1.cc:859 +#line 625 "parser.cc" // lalr1.cc:847 break; case 5: -#line 87 "parser.yy" // lalr1.cc:859 +#line 88 "parser.yy" // lalr1.cc:847 { TokenPtr hex(new TokenHexString(yystack_[0].value.as< std::string > ())); ctx.expression.push_back(hex); } -#line 641 "parser.cc" // lalr1.cc:859 +#line 634 "parser.cc" // lalr1.cc:847 break; case 6: -#line 92 "parser.yy" // lalr1.cc:859 +#line 93 "parser.yy" // lalr1.cc:847 { TokenPtr opt(new TokenOption(yystack_[3].value.as< uint16_t > (), yystack_[0].value.as< TokenOption::RepresentationType > ())); ctx.expression.push_back(opt); } -#line 650 "parser.cc" // lalr1.cc:859 +#line 643 "parser.cc" // lalr1.cc:847 break; case 7: -#line 97 "parser.yy" // lalr1.cc:859 +#line 98 "parser.yy" // lalr1.cc:847 + { + switch (ctx.getUniverse()) { + case Option::V4: + { + TokenPtr opt(new TokenRelay4Option(yystack_[3].value.as< uint16_t > (), yystack_[0].value.as< TokenOption::RepresentationType > ())); + ctx.expression.push_back(opt); + break; + } + case Option::V6: + error(yystack_[5].location, "relay support for v6 is not implemented"); + } + } +#line 660 "parser.cc" // lalr1.cc:847 + break; + + case 8: +#line 111 "parser.yy" // lalr1.cc:847 { TokenPtr sub(new TokenSubstring()); ctx.expression.push_back(sub); } -#line 659 "parser.cc" // lalr1.cc:859 +#line 669 "parser.cc" // lalr1.cc:847 break; - case 9: -#line 106 "parser.yy" // lalr1.cc:859 + case 10: +#line 120 "parser.yy" // lalr1.cc:847 { yylhs.value.as< uint16_t > () = ctx.convertOptionCode(yystack_[0].value.as< std::string > (), yystack_[0].location); } -#line 667 "parser.cc" // lalr1.cc:859 +#line 677 "parser.cc" // lalr1.cc:847 break; - case 10: -#line 110 "parser.yy" // lalr1.cc:859 + case 11: +#line 124 "parser.yy" // lalr1.cc:847 { yylhs.value.as< uint16_t > () = ctx.convertOptionName(yystack_[0].value.as< std::string > (), yystack_[0].location); } -#line 675 "parser.cc" // lalr1.cc:859 +#line 685 "parser.cc" // lalr1.cc:847 break; - case 11: -#line 116 "parser.yy" // lalr1.cc:859 + case 12: +#line 130 "parser.yy" // lalr1.cc:847 { yylhs.value.as< TokenOption::RepresentationType > () = TokenOption::TEXTUAL; } -#line 683 "parser.cc" // lalr1.cc:859 +#line 693 "parser.cc" // lalr1.cc:847 break; - case 12: -#line 120 "parser.yy" // lalr1.cc:859 + case 13: +#line 134 "parser.yy" // lalr1.cc:847 { yylhs.value.as< TokenOption::RepresentationType > () = TokenOption::HEXADECIMAL; } -#line 691 "parser.cc" // lalr1.cc:859 +#line 701 "parser.cc" // lalr1.cc:847 break; - case 13: -#line 126 "parser.yy" // lalr1.cc:859 + case 14: +#line 140 "parser.yy" // lalr1.cc:847 { TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ())); ctx.expression.push_back(str); } -#line 700 "parser.cc" // lalr1.cc:859 +#line 710 "parser.cc" // lalr1.cc:847 break; - case 14: -#line 133 "parser.yy" // lalr1.cc:859 + case 15: +#line 147 "parser.yy" // lalr1.cc:847 { TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ())); ctx.expression.push_back(str); } -#line 709 "parser.cc" // lalr1.cc:859 +#line 719 "parser.cc" // lalr1.cc:847 break; - case 15: -#line 138 "parser.yy" // lalr1.cc:859 + case 16: +#line 152 "parser.yy" // lalr1.cc:847 { TokenPtr str(new TokenString("all")); ctx.expression.push_back(str); } -#line 718 "parser.cc" // lalr1.cc:859 +#line 728 "parser.cc" // lalr1.cc:847 break; -#line 722 "parser.cc" // lalr1.cc:859 +#line 732 "parser.cc" // lalr1.cc:847 default: break; } @@ -746,7 +756,8 @@ namespace isc { namespace eval { if (!yyerrstatus_) { ++yynerrs_; - error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla)); + error (yyla.location, yysyntax_error_ (yystack_[0].state, + yyempty ? yyempty_ : yyla.type_get ())); } @@ -759,10 +770,10 @@ namespace isc { namespace eval { // Return failure if at end of input. if (yyla.type_get () == yyeof_) YYABORT; - else if (!yyla.empty ()) + else if (!yyempty) { yy_destroy_ ("Error: discarding", yyla); - yyla.clear (); + yyempty = true; } } @@ -838,7 +849,7 @@ namespace isc { namespace eval { goto yyreturn; yyreturn: - if (!yyla.empty ()) + if (!yyempty) yy_destroy_ ("Cleanup: discarding lookahead", yyla); /* Do not reclaim the symbols of the rule whose action triggered @@ -858,7 +869,7 @@ namespace isc { namespace eval { << std::endl; // Do not try to display the values of the reclaimed symbols, // as their printer might throw an exception. - if (!yyla.empty ()) + if (!yyempty) yy_destroy_ (YY_NULLPTR, yyla); while (1 < yystack_.size ()) @@ -878,8 +889,9 @@ namespace isc { namespace eval { // Generate an error message. std::string - EvalParser::yysyntax_error_ (state_type yystate, const symbol_type& yyla) const + EvalParser::yysyntax_error_ (state_type yystate, symbol_number_type yytoken) const { + std::string yyres; // Number of reported tokens (one for the "unexpected", one per // "expected"). size_t yycount = 0; @@ -893,7 +905,7 @@ namespace isc { namespace eval { the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - - The only way there can be no lookahead present (in yyla) is + - The only way there can be no lookahead present (in yytoken) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to @@ -913,9 +925,8 @@ namespace isc { namespace eval { token that will not be accepted due to an error action in a later state. */ - if (!yyla.empty ()) + if (yytoken != yyempty_) { - int yytoken = yyla.type_get (); yyarg[yycount++] = yytname_[yytoken]; int yyn = yypact_[yystate]; if (!yy_pact_value_is_default_ (yyn)) @@ -958,7 +969,6 @@ namespace isc { namespace eval { #undef YYCASE_ } - std::string yyres; // Argument number. size_t yyi = 0; for (char const* yyp = yyformat; *yyp; ++yyp) @@ -980,70 +990,72 @@ namespace isc { namespace eval { const signed char EvalParser::yypact_[] = { - -4, -9, -5, -14, -14, -14, 8, -14, 9, -13, - -4, -14, -4, -14, -14, 0, 11, -14, 13, 2, - 10, -14, 14, -14, -14, -14, -6, -14, -14, 7, - -14 + -4, -3, 3, -1, -14, -14, -14, 17, -14, 15, + -13, -4, -13, -14, -4, -14, -14, 4, 9, 6, + -14, 12, 7, 13, 1, -14, 14, 1, -14, -14, + -14, -7, -14, -14, -14, 16, -14 }; const unsigned char EvalParser::yydefact_[] = { - 0, 0, 0, 4, 5, 8, 0, 2, 0, 0, - 0, 1, 0, 9, 10, 0, 0, 3, 0, 0, - 0, 13, 0, 11, 12, 6, 0, 15, 14, 0, - 7 + 0, 0, 0, 0, 4, 5, 9, 0, 2, 0, + 0, 0, 0, 1, 0, 10, 11, 0, 0, 0, + 3, 0, 0, 0, 0, 14, 0, 0, 12, 13, + 6, 0, 7, 16, 15, 0, 8 }; const signed char EvalParser::yypgoto_[] = { - -14, -14, -14, -3, -14, -14, -14, -14 + -14, -14, -14, -6, 18, 0, -14, -14 }; const signed char EvalParser::yydefgoto_[] = { - -1, 6, 7, 8, 15, 25, 22, 29 + -1, 7, 8, 9, 17, 30, 26, 35 }; const unsigned char EvalParser::yytable_[] = { - 1, 2, 27, 13, 9, 14, 10, 16, 11, 17, - 28, 3, 12, 4, 18, 5, 23, 24, 21, 30, - 0, 19, 20, 0, 26 + 1, 2, 33, 3, 15, 18, 16, 28, 20, 29, + 34, 10, 4, 12, 5, 11, 6, 13, 14, 21, + 22, 23, 24, 27, 25, 31, 0, 32, 0, 36, + 19 }; const signed char EvalParser::yycheck_[] = { - 4, 5, 8, 16, 13, 18, 11, 10, 0, 12, - 16, 15, 3, 17, 14, 19, 6, 7, 16, 12, - -1, 10, 9, -1, 10 + 4, 5, 9, 7, 17, 11, 19, 6, 14, 8, + 17, 14, 16, 14, 18, 12, 20, 0, 3, 15, + 11, 15, 10, 10, 17, 11, -1, 27, -1, 13, + 12 }; const unsigned char EvalParser::yystos_[] = { - 0, 4, 5, 15, 17, 19, 21, 22, 23, 13, - 11, 0, 3, 16, 18, 24, 23, 23, 14, 10, - 9, 16, 26, 6, 7, 25, 10, 8, 16, 27, - 12 + 0, 4, 5, 7, 16, 18, 20, 22, 23, 24, + 14, 12, 14, 0, 3, 17, 19, 25, 24, 25, + 24, 15, 11, 15, 10, 17, 27, 10, 6, 8, + 26, 11, 26, 9, 17, 28, 13 }; const unsigned char EvalParser::yyr1_[] = { - 0, 20, 21, 22, 23, 23, 23, 23, 23, 24, - 24, 25, 25, 26, 27, 27 + 0, 21, 22, 23, 24, 24, 24, 24, 24, 24, + 25, 25, 26, 26, 27, 28, 28 }; const unsigned char EvalParser::yyr2_[] = { - 0, 2, 1, 3, 1, 1, 6, 8, 1, 1, - 1, 1, 1, 1, 1, 1 + 0, 2, 1, 3, 1, 1, 6, 6, 8, 1, + 1, 1, 1, 1, 1, 1, 1 }; @@ -1054,10 +1066,10 @@ namespace isc { namespace eval { const EvalParser::yytname_[] = { "\"end of file\"", "error", "$undefined", "\"==\"", "\"option\"", - "\"substring\"", "\"text\"", "\"hex\"", "\"all\"", "\".\"", "\",\"", - "\"(\"", "\")\"", "\"[\"", "\"]\"", "\"constant string\"", "\"integer\"", - "\"constant hexstring\"", "\"option name\"", "TOKEN", "$accept", - "expression", "bool_expr", "string_expr", "option_code", + "\"substring\"", "\"text\"", "\"relay\"", "\"hex\"", "\"all\"", "\".\"", + "\",\"", "\"(\"", "\")\"", "\"[\"", "\"]\"", "\"constant string\"", + "\"integer\"", "\"constant hexstring\"", "\"option name\"", "TOKEN", + "$accept", "expression", "bool_expr", "string_expr", "option_code", "option_repr_type", "start_expr", "length_expr", YY_NULLPTR }; @@ -1065,8 +1077,8 @@ namespace isc { namespace eval { const unsigned char EvalParser::yyrline_[] = { - 0, 71, 71, 74, 81, 86, 91, 96, 101, 105, - 109, 115, 119, 125, 132, 137 + 0, 72, 72, 75, 82, 87, 92, 97, 110, 115, + 119, 123, 129, 133, 139, 146, 151 }; // Print the state stack on the debug stream. @@ -1099,10 +1111,10 @@ namespace isc { namespace eval { #endif // YYDEBUG -#line 13 "parser.yy" // lalr1.cc:1167 +#line 13 "parser.yy" // lalr1.cc:1155 } } // isc::eval -#line 1105 "parser.cc" // lalr1.cc:1167 -#line 144 "parser.yy" // lalr1.cc:1168 +#line 1117 "parser.cc" // lalr1.cc:1155 +#line 158 "parser.yy" // lalr1.cc:1156 void isc::eval::EvalParser::error(const location_type& loc, diff --git a/src/lib/eval/parser.h b/src/lib/eval/parser.h index d1388d79ce..8c3fada9bd 100644 --- a/src/lib/eval/parser.h +++ b/src/lib/eval/parser.h @@ -1,8 +1,8 @@ -// A Bison parser, made by GNU Bison 3.0.4. +// A Bison parser, made by GNU Bison 3.0.2. // Skeleton interface for Bison LALR(1) parsers in C++ -// Copyright (C) 2002-2015 Free Software Foundation, Inc. +// Copyright (C) 2002-2013 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 @@ -40,7 +40,7 @@ #ifndef YY_YY_PARSER_H_INCLUDED # define YY_YY_PARSER_H_INCLUDED // // "%code requires" blocks. -#line 16 "parser.yy" // lalr1.cc:392 +#line 16 "parser.yy" // lalr1.cc:372 #include #include @@ -51,14 +51,13 @@ using namespace isc::dhcp; using namespace isc::eval; -#line 55 "parser.h" // lalr1.cc:392 +#line 55 "parser.h" // lalr1.cc:372 # include -# include // std::abort +# include # include # include # include -# include # include "stack.hh" # include "location.hh" #include @@ -126,9 +125,9 @@ using namespace isc::eval; # define YYDEBUG 1 #endif -#line 13 "parser.yy" // lalr1.cc:392 +#line 13 "parser.yy" // lalr1.cc:372 namespace isc { namespace eval { -#line 132 "parser.h" // lalr1.cc:392 +#line 131 "parser.h" // lalr1.cc:372 @@ -145,13 +144,13 @@ namespace isc { namespace eval { /// Empty construction. variant () - : yytypeid_ (YY_NULLPTR) + : yytname_ (YY_NULLPTR) {} /// Construct and fill. template variant (const T& t) - : yytypeid_ (&typeid (T)) + : yytname_ (typeid (T).name ()) { YYASSERT (sizeof (T) <= S); new (yyas_ ()) T (t); @@ -160,7 +159,7 @@ namespace isc { namespace eval { /// Destruction, allowed only if empty. ~variant () { - YYASSERT (!yytypeid_); + YYASSERT (!yytname_); } /// Instantiate an empty \a T in here. @@ -168,9 +167,9 @@ namespace isc { namespace eval { T& build () { - YYASSERT (!yytypeid_); + YYASSERT (!yytname_); YYASSERT (sizeof (T) <= S); - yytypeid_ = & typeid (T); + yytname_ = typeid (T).name (); return *new (yyas_ ()) T; } @@ -179,9 +178,9 @@ namespace isc { namespace eval { T& build (const T& t) { - YYASSERT (!yytypeid_); + YYASSERT (!yytname_); YYASSERT (sizeof (T) <= S); - yytypeid_ = & typeid (T); + yytname_ = typeid (T).name (); return *new (yyas_ ()) T (t); } @@ -190,7 +189,7 @@ namespace isc { namespace eval { T& as () { - YYASSERT (*yytypeid_ == typeid (T)); + YYASSERT (yytname_ == typeid (T).name ()); YYASSERT (sizeof (T) <= S); return *yyas_ (); } @@ -200,7 +199,7 @@ namespace isc { namespace eval { const T& as () const { - YYASSERT (*yytypeid_ == typeid (T)); + YYASSERT (yytname_ == typeid (T).name ()); YYASSERT (sizeof (T) <= S); return *yyas_ (); } @@ -217,8 +216,8 @@ namespace isc { namespace eval { void swap (self_type& other) { - YYASSERT (yytypeid_); - YYASSERT (*yytypeid_ == *other.yytypeid_); + YYASSERT (yytname_); + YYASSERT (yytname_ == other.yytname_); std::swap (as (), other.as ()); } @@ -248,7 +247,7 @@ namespace isc { namespace eval { destroy () { as ().~T (); - yytypeid_ = YY_NULLPTR; + yytname_ = YY_NULLPTR; } private: @@ -283,7 +282,7 @@ namespace isc { namespace eval { } yybuffer_; /// Whether the content is built: if defined, the name of the stored type. - const std::type_info *yytypeid_; + const char *yytname_; }; @@ -334,31 +333,29 @@ namespace isc { namespace eval { TOKEN_OPTION = 259, TOKEN_SUBSTRING = 260, TOKEN_TEXT = 261, - TOKEN_HEX = 262, - TOKEN_ALL = 263, - TOKEN_DOT = 264, - TOKEN_COMA = 265, - TOKEN_LPAREN = 266, - TOKEN_RPAREN = 267, - TOKEN_LBRACKET = 268, - TOKEN_RBRACKET = 269, - TOKEN_STRING = 270, - TOKEN_INTEGER = 271, - TOKEN_HEXSTRING = 272, - TOKEN_OPTION_NAME = 273, - TOKEN_TOKEN = 274 + TOKEN_RELAY = 262, + TOKEN_HEX = 263, + TOKEN_ALL = 264, + TOKEN_DOT = 265, + TOKEN_COMA = 266, + TOKEN_LPAREN = 267, + TOKEN_RPAREN = 268, + TOKEN_LBRACKET = 269, + TOKEN_RBRACKET = 270, + TOKEN_STRING = 271, + TOKEN_INTEGER = 272, + TOKEN_HEXSTRING = 273, + TOKEN_OPTION_NAME = 274, + TOKEN_TOKEN = 275 }; }; /// (External) token type, as returned by yylex. typedef token::yytokentype token_type; - /// Symbol type: an internal symbol number. + /// 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; @@ -396,15 +393,8 @@ namespace isc { namespace eval { 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); @@ -434,23 +424,21 @@ namespace isc { namespace eval { /// 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. + /// -1 when this symbol is empty. symbol_number_type type_get () const; /// The token. token_type token () const; + enum { empty = 0 }; + /// The symbol type. - /// \a empty_symbol when empty. - /// An int, not token_number_type, to be able to store empty_symbol. - int type; + /// -1 when this symbol is empty. + token_number_type type; }; /// "External" symbols: returned by the scanner. @@ -477,6 +465,10 @@ namespace isc { namespace eval { symbol_type make_TEXT (const location_type& l); + static inline + symbol_type + make_RELAY (const location_type& l); + static inline symbol_type make_HEX (const location_type& l); @@ -570,9 +562,9 @@ namespace isc { namespace eval { /// Generate an error message. /// \param yystate the state where the error occurred. - /// \param yyla the lookahead token. + /// \param yytoken the lookahead token type, or yyempty_. virtual std::string yysyntax_error_ (state_type yystate, - const symbol_type& yyla) const; + symbol_number_type yytoken) const; /// Compute post-reduction state. /// \param yystate the current state @@ -675,21 +667,16 @@ namespace isc { namespace eval { /// 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. + /// "empty" when empty. symbol_number_type type_get () const; - /// The state number used to denote an empty symbol. - enum { empty_state = -1 }; + enum { empty = 0 }; /// The state. - /// \a empty when empty. state_type state; }; @@ -730,16 +717,17 @@ namespace isc { namespace eval { /// Pop \a n symbols the three stacks. void yypop_ (unsigned int n = 1); - /// Constants. + // Constants. enum { yyeof_ = 0, - yylast_ = 24, ///< Last index in yytable_. + yylast_ = 30, ///< Last index in yytable_. yynnts_ = 8, ///< Number of nonterminal symbols. - yyfinal_ = 11, ///< Termination state number. + yyempty_ = -2, + yyfinal_ = 13, ///< Termination state number. yyterror_ = 1, yyerrcode_ = 256, - yyntokens_ = 20 ///< Number of tokens. + yyntokens_ = 21 ///< Number of tokens. }; @@ -783,9 +771,9 @@ namespace isc { namespace eval { 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 + 15, 16, 17, 18, 19, 20 }; - const unsigned int user_token_number_max_ = 274; + const unsigned int user_token_number_max_ = 275; const token_number_type undef_token_ = 2; if (static_cast(t) <= yyeof_) @@ -818,19 +806,19 @@ namespace isc { namespace eval { { switch (other.type_get ()) { - case 25: // option_repr_type + case 26: // option_repr_type value.copy< TokenOption::RepresentationType > (other.value); break; - case 15: // "constant string" - case 16: // "integer" - case 17: // "constant hexstring" - case 18: // "option name" - case 19: // TOKEN + case 16: // "constant string" + case 17: // "integer" + case 18: // "constant hexstring" + case 19: // "option name" + case 20: // TOKEN value.copy< std::string > (other.value); break; - case 24: // option_code + case 25: // option_code value.copy< uint16_t > (other.value); break; @@ -851,19 +839,19 @@ namespace isc { namespace eval { (void) v; switch (this->type_get ()) { - case 25: // option_repr_type + case 26: // option_repr_type value.copy< TokenOption::RepresentationType > (v); break; - case 15: // "constant string" - case 16: // "integer" - case 17: // "constant hexstring" - case 18: // "option name" - case 19: // TOKEN + case 16: // "constant string" + case 17: // "integer" + case 18: // "constant hexstring" + case 19: // "option name" + case 20: // TOKEN value.copy< std::string > (v); break; - case 24: // option_code + case 25: // option_code value.copy< uint16_t > (v); break; @@ -907,19 +895,9 @@ namespace isc { namespace eval { template inline EvalParser::basic_symbol::~basic_symbol () - { - clear (); - } - - template - inline - void - EvalParser::basic_symbol::clear () { // User destructor. symbol_number_type yytype = this->type_get (); - basic_symbol& yysym = *this; - (void) yysym; switch (yytype) { default: @@ -929,19 +907,19 @@ namespace isc { namespace eval { // Type destructor. switch (yytype) { - case 25: // option_repr_type + case 26: // option_repr_type value.template destroy< TokenOption::RepresentationType > (); break; - case 15: // "constant string" - case 16: // "integer" - case 17: // "constant hexstring" - case 18: // "option name" - case 19: // TOKEN + case 16: // "constant string" + case 17: // "integer" + case 18: // "constant hexstring" + case 19: // "option name" + case 20: // TOKEN value.template destroy< std::string > (); break; - case 24: // option_code + case 25: // option_code value.template destroy< uint16_t > (); break; @@ -949,15 +927,6 @@ namespace isc { namespace eval { break; } - Base::clear (); - } - - template - inline - bool - EvalParser::basic_symbol::empty () const - { - return Base::type_get () == empty_symbol; } template @@ -968,19 +937,19 @@ namespace isc { namespace eval { super_type::move(s); switch (this->type_get ()) { - case 25: // option_repr_type + case 26: // option_repr_type value.move< TokenOption::RepresentationType > (s.value); break; - case 15: // "constant string" - case 16: // "integer" - case 17: // "constant hexstring" - case 18: // "option name" - case 19: // TOKEN + case 16: // "constant string" + case 17: // "integer" + case 18: // "constant hexstring" + case 19: // "option name" + case 20: // TOKEN value.move< std::string > (s.value); break; - case 24: // option_code + case 25: // option_code value.move< uint16_t > (s.value); break; @@ -994,7 +963,7 @@ namespace isc { namespace eval { // by_type. inline EvalParser::by_type::by_type () - : type (empty_symbol) + : type (empty) {} inline @@ -1007,19 +976,12 @@ namespace isc { namespace eval { : type (yytranslate_ (t)) {} - inline - void - EvalParser::by_type::clear () - { - type = empty_symbol; - } - inline void EvalParser::by_type::move (by_type& that) { type = that.type; - that.clear (); + that.type = empty; } inline @@ -1040,7 +1002,8 @@ namespace isc { namespace eval { yytoken_number_[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274 + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275 }; return static_cast (yytoken_number_[type]); } @@ -1075,6 +1038,12 @@ namespace isc { namespace eval { return symbol_type (token::TOKEN_TEXT, l); } + EvalParser::symbol_type + EvalParser::make_RELAY (const location_type& l) + { + return symbol_type (token::TOKEN_RELAY, l); + } + EvalParser::symbol_type EvalParser::make_HEX (const location_type& l) { @@ -1154,9 +1123,9 @@ namespace isc { namespace eval { } -#line 13 "parser.yy" // lalr1.cc:392 +#line 13 "parser.yy" // lalr1.cc:372 } } // isc::eval -#line 1160 "parser.h" // lalr1.cc:392 +#line 1129 "parser.h" // lalr1.cc:372 diff --git a/src/lib/eval/position.hh b/src/lib/eval/position.hh index 4a17cb947c..ba6f717461 100644 --- a/src/lib/eval/position.hh +++ b/src/lib/eval/position.hh @@ -1,9 +1,8 @@ -// Generated 20151216 -// A Bison parser, made by GNU Bison 3.0.4. +// A Bison parser, made by GNU Bison 3.0.2. // Positions for Bison parsers in C++ -// Copyright (C) 2002-2015 Free Software Foundation, Inc. +// Copyright (C) 2002-2013 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 @@ -51,9 +50,9 @@ # endif # endif -#line 13 "parser.yy" // location.cc:337 +#line 13 "parser.yy" // location.cc:291 namespace isc { namespace eval { -#line 56 "position.hh" // location.cc:337 +#line 56 "position.hh" // location.cc:291 /// Abstract a position. class position { @@ -115,7 +114,7 @@ namespace isc { namespace eval { } }; - /// Add \a width columns, in place. + /// Add and assign a position. inline position& operator+= (position& res, int width) { @@ -123,21 +122,21 @@ namespace isc { namespace eval { return res; } - /// Add \a width columns. + /// Add two position objects. inline position operator+ (position res, int width) { return res += width; } - /// Subtract \a width columns, in place. + /// Add and assign a position. inline position& operator-= (position& res, int width) { return res += -width; } - /// Subtract \a width columns. + /// Add two position objects. inline position operator- (position res, int width) { @@ -175,7 +174,7 @@ namespace isc { namespace eval { return ostr << pos.line << '.' << pos.column; } -#line 13 "parser.yy" // location.cc:337 +#line 13 "parser.yy" // location.cc:291 } } // isc::eval -#line 180 "position.hh" // location.cc:337 +#line 180 "position.hh" // location.cc:291 #endif // !YY_YY_POSITION_HH_INCLUDED diff --git a/src/lib/eval/stack.hh b/src/lib/eval/stack.hh index 5530bf77ea..246a2cdd1a 100644 --- a/src/lib/eval/stack.hh +++ b/src/lib/eval/stack.hh @@ -1,9 +1,8 @@ -// Generated 20151216 -// A Bison parser, made by GNU Bison 3.0.4. +// A Bison parser, made by GNU Bison 3.0.2. // Stack handling for Bison parsers in C++ -// Copyright (C) 2002-2015 Free Software Foundation, Inc. +// Copyright (C) 2002-2013 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 @@ -41,9 +40,9 @@ # include -#line 13 "parser.yy" // stack.hh:151 +#line 13 "parser.yy" // stack.hh:133 namespace isc { namespace eval { -#line 46 "stack.hh" // stack.hh:151 +#line 46 "stack.hh" // stack.hh:133 template > class stack { @@ -55,12 +54,12 @@ namespace isc { namespace eval { stack () : seq_ () { - seq_.reserve (200); } stack (unsigned int n) : seq_ (n) - {} + { + } inline T& @@ -137,7 +136,8 @@ namespace isc { namespace eval { slice (const S& stack, unsigned int range) : stack_ (stack) , range_ (range) - {} + { + } inline const T& @@ -151,8 +151,8 @@ namespace isc { namespace eval { unsigned int range_; }; -#line 13 "parser.yy" // stack.hh:151 +#line 13 "parser.yy" // stack.hh:133 } } // isc::eval -#line 156 "stack.hh" // stack.hh:151 +#line 157 "stack.hh" // stack.hh:133 #endif // !YY_YY_STACK_HH_INCLUDED