From 4c9be73b01f5ada8a3aa3a17109d1e96e8d2b7cc Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Fri, 6 Nov 2015 03:32:26 +0100 Subject: [PATCH] [4088fd] Regenerated flex/bison --- src/lib/eval/lexer.cc | 189 +++++++++++++++++++---------------------- src/lib/eval/parser.cc | 98 ++++++++++----------- src/lib/eval/parser.h | 125 +++++++++++++++++---------- 3 files changed, 216 insertions(+), 196 deletions(-) diff --git a/src/lib/eval/lexer.cc b/src/lib/eval/lexer.cc index 8a9d2f0eed..78117d26cc 100644 --- a/src/lib/eval/lexer.cc +++ b/src/lib/eval/lexer.cc @@ -469,8 +469,8 @@ static void yy_fatal_error (yyconst char msg[] ); (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 12 -#define YY_END_OF_BUFFER 13 +#define YY_NUM_RULES 15 +#define YY_END_OF_BUFFER 16 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -478,12 +478,12 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[39] = +static yyconst flex_int16_t yy_accept[40] = { 0, - 0, 0, 13, 11, 1, 2, 11, 8, 9, 10, - 11, 11, 11, 11, 1, 2, 3, 0, 0, 6, - 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 5, 7, 0 + 0, 0, 16, 14, 1, 2, 14, 9, 10, 13, + 5, 5, 14, 11, 12, 14, 14, 1, 2, 3, + 0, 5, 0, 6, 0, 0, 4, 0, 0, 0, + 0, 0, 0, 7, 0, 0, 0, 8, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -527,52 +527,52 @@ static yyconst flex_int32_t yy_meta[26] = static yyconst flex_int16_t yy_base[42] = { 0, - 0, 22, 58, 59, 55, 53, 51, 59, 59, 59, - 41, 43, 31, 26, 42, 40, 59, 37, 0, 59, - 16, 23, 0, 20, 14, 16, 11, 15, 11, 17, - 4, 3, 0, 6, 0, 59, 59, 59, 45, 47, - 6 + 0, 0, 56, 57, 53, 51, 49, 57, 57, 57, + 18, 20, 42, 57, 57, 30, 25, 47, 45, 57, + 43, 24, 0, 57, 22, 29, 0, 26, 20, 22, + 17, 21, 17, 57, 20, 18, 19, 57, 57, 32, + 27 } ; static yyconst flex_int16_t yy_def[42] = { 0, - 39, 39, 38, 38, 38, 38, 40, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 40, 41, 38, - 38, 38, 41, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 0, 38, 38, - 38 + 39, 1, 39, 39, 39, 39, 40, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 40, 39, 41, 39, 39, 39, 41, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 0, 39, + 39 } ; -static yyconst flex_int16_t yy_nxt[85] = +static yyconst flex_int16_t yy_nxt[83] = { 0, - 38, 5, 6, 7, 8, 9, 10, 11, 23, 12, - 34, 34, 38, 34, 34, 38, 37, 38, 35, 13, - 36, 33, 14, 5, 6, 7, 8, 9, 10, 11, - 32, 12, 31, 30, 29, 28, 27, 26, 25, 24, - 17, 13, 16, 15, 14, 4, 4, 4, 18, 18, - 22, 21, 20, 19, 17, 16, 15, 38, 3, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38 + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 4, 4, 4, 14, 15, 4, 4, 4, 4, 16, + 4, 4, 17, 4, 4, 22, 22, 22, 22, 27, + 23, 22, 22, 21, 21, 38, 37, 36, 35, 34, + 33, 32, 31, 30, 29, 28, 20, 19, 18, 26, + 25, 24, 20, 19, 18, 39, 3, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39 } ; -static yyconst flex_int16_t yy_chk[85] = +static yyconst flex_int16_t yy_chk[83] = { 0, - 0, 1, 1, 1, 1, 1, 1, 1, 41, 1, - 32, 32, 0, 34, 34, 0, 35, 0, 33, 1, - 34, 31, 1, 2, 2, 2, 2, 2, 2, 2, - 30, 2, 29, 28, 27, 26, 25, 24, 22, 21, - 18, 2, 16, 15, 2, 39, 39, 39, 40, 40, - 14, 13, 12, 11, 7, 6, 5, 3, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38 + 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, 12, 12, 41, + 11, 22, 22, 40, 40, 37, 36, 35, 33, 32, + 31, 30, 29, 28, 26, 25, 21, 19, 18, 17, + 16, 13, 7, 6, 5, 3, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[13] = +static yyconst flex_int32_t yy_rule_can_match_eol[16] = { 0, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; +0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; @@ -580,10 +580,10 @@ static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 1; -static yyconst flex_int16_t yy_rule_linenum[12] = +static yyconst flex_int16_t yy_rule_linenum[15] = { 0, - 84, 88, 94, 104, 110, 161, 162, 163, 164, 165, - 167 + 84, 88, 94, 104, 110, 133, 134, 135, 136, 137, + 138, 139, 140, 142 } ; /* The intent behind this definition is that it'll catch @@ -962,13 +962,13 @@ yy_match: 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 >= 39 ) + if ( yy_current_state >= 40 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 38 ); + while ( yy_current_state != 39 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -997,13 +997,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 < 12 ) + else if ( yy_act < 15 ) fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 12 ) + else if ( yy_act == 15 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", yytext ); - else if ( yy_act == 13 ) + else if ( yy_act == 16 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); @@ -1063,96 +1063,83 @@ case 5: YY_RULE_SETUP #line 110 "lexer.ll" { - // option[123] token found. Let's see if the numeric value can be - // converted to integer and if it has a reasonable value. - // yytext contains the whole expression (.e.g. option[123]). We need - // to trim it down to just the code, which will be transformed to - // integer. + // A code (16 bit unsigned integer) was found. std::string tmp(yytext); - // Sanity check if the token is at least 9 (strlen("option[X]")) long. - // This should never happen as it would indicate bison bug. - if (tmp.length() < 9) { - driver.error(loc, "The string matched (" + tmp + ") is too short," - " expected at least 9 (option[X]) characters"); - } - size_t pos = tmp.find("["); - if (pos == std::string::npos) { - driver.error(loc, "The string matched (" + tmp + ") is invalid," - " as it does not contain opening bracket."); - } - // Let's get rid of all the text before [, including [. - tmp = tmp.substr(pos + 1); - - // And finally remove the trailing ]. - pos = tmp.find("]"); - if (pos == std::string::npos) { - driver.error(loc, "The string matched (" + tmp + ") is invalid," - " as it does not contain closing bracket."); - } - tmp = tmp.substr(0, pos); - - uint16_t n = 0; + int n; try { n = boost::lexical_cast(tmp); } catch (const boost::bad_lexical_cast &) { driver.error(loc, "Failed to convert specified option code to " - "number ('" + tmp + "' in expression " + std::string(yytext)); + "number in " + tmp + "."); } // 65535 is the maximum value of the option code in DHCPv6. We want the // code to be the same for v4 and v6, so let's ignore for a moment that // max. option code in DHCPv4 is 255. - /// @todo: Maybe add a flag somewhere in EvalContext to indicate if we're - /// running in v4 (allowed max 255) or v6 (allowed max 65535). - if (n<0 || n>65535) { + if (n < 0 || n > 65535) { driver.error(loc, "Option code has invalid value in " + std::string(yytext) + ". Allowed range: 0..65535"); } - return isc::eval::EvalParser::make_OPTION(n, loc); + return isc::eval::EvalParser::make_CODE(static_cast(n), loc); } YY_BREAK case 6: YY_RULE_SETUP -#line 161 "lexer.ll" +#line 133 "lexer.ll" return isc::eval::EvalParser::make_EQUAL(loc); YY_BREAK case 7: YY_RULE_SETUP -#line 162 "lexer.ll" -return isc::eval::EvalParser::make_SUBSTRING(loc); +#line 134 "lexer.ll" +return isc::eval::EvalParser::make_OPTION(loc); YY_BREAK case 8: YY_RULE_SETUP -#line 163 "lexer.ll" -return isc::eval::EvalParser::make_LPAREN(loc); +#line 135 "lexer.ll" +return isc::eval::EvalParser::make_SUBSTRING(loc); YY_BREAK case 9: YY_RULE_SETUP -#line 164 "lexer.ll" -return isc::eval::EvalParser::make_RPAREN(loc); +#line 136 "lexer.ll" +return isc::eval::EvalParser::make_LPAREN(loc); YY_BREAK case 10: YY_RULE_SETUP -#line 165 "lexer.ll" -return isc::eval::EvalParser::make_COMA(loc); +#line 137 "lexer.ll" +return isc::eval::EvalParser::make_RPAREN(loc); YY_BREAK case 11: YY_RULE_SETUP -#line 167 "lexer.ll" -driver.error (loc, "Invalid character: " + std::string(yytext)); - YY_BREAK -case YY_STATE_EOF(INITIAL): -#line 168 "lexer.ll" -return isc::eval::EvalParser::make_END(loc); +#line 138 "lexer.ll" +return isc::eval::EvalParser::make_LBRACKET(loc); YY_BREAK case 12: YY_RULE_SETUP -#line 169 "lexer.ll" +#line 139 "lexer.ll" +return isc::eval::EvalParser::make_RBRACKET(loc); + YY_BREAK +case 13: +YY_RULE_SETUP +#line 140 "lexer.ll" +return isc::eval::EvalParser::make_COMA(loc); + YY_BREAK +case 14: +YY_RULE_SETUP +#line 142 "lexer.ll" +driver.error (loc, "Invalid character: " + std::string(yytext)); + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 143 "lexer.ll" +return isc::eval::EvalParser::make_END(loc); + YY_BREAK +case 15: +YY_RULE_SETUP +#line 144 "lexer.ll" ECHO; YY_BREAK -#line 1156 "lexer.cc" +#line 1143 "lexer.cc" case YY_END_OF_BUFFER: { @@ -1465,7 +1452,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 >= 39 ) + if ( yy_current_state >= 40 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1498,11 +1485,11 @@ 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 >= 39 ) + if ( yy_current_state >= 40 ) 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 == 38); + yy_is_jam = (yy_current_state == 39); return yy_is_jam ? 0 : yy_current_state; } @@ -2240,7 +2227,7 @@ void yyfree (void * ptr ) /* %ok-for-header */ -#line 169 "lexer.ll" +#line 144 "lexer.ll" diff --git a/src/lib/eval/parser.cc b/src/lib/eval/parser.cc index 034419dc1e..1f5066914d 100644 --- a/src/lib/eval/parser.cc +++ b/src/lib/eval/parser.cc @@ -251,13 +251,13 @@ namespace isc { namespace eval { { switch (that.type_get ()) { - case 10: // "option code" - value.move< int > (that.value); + case 11: // "constant string" + case 12: // "constant hexstring" + value.move< std::string > (that.value); break; - case 8: // "constant string" - case 9: // "constant hexstring" - value.move< std::string > (that.value); + case 13: // "option code" + value.move< uint16_t > (that.value); break; default: @@ -275,13 +275,13 @@ namespace isc { namespace eval { state = that.state; switch (that.type_get ()) { - case 10: // "option code" - value.copy< int > (that.value); + case 11: // "constant string" + case 12: // "constant hexstring" + value.copy< std::string > (that.value); break; - case 8: // "constant string" - case 9: // "constant hexstring" - value.copy< std::string > (that.value); + case 13: // "option code" + value.copy< uint16_t > (that.value); break; default: @@ -320,24 +320,24 @@ namespace isc { namespace eval { << yysym.location << ": "; switch (yytype) { - case 8: // "constant string" + case 11: // "constant string" -#line 58 "parser.yy" // lalr1.cc:636 +#line 61 "parser.yy" // lalr1.cc:636 { yyoutput << yysym.value.template as< std::string > (); } #line 328 "parser.cc" // lalr1.cc:636 break; - case 9: // "constant hexstring" + case 12: // "constant hexstring" -#line 58 "parser.yy" // lalr1.cc:636 +#line 61 "parser.yy" // lalr1.cc:636 { yyoutput << yysym.value.template as< std::string > (); } #line 335 "parser.cc" // lalr1.cc:636 break; - case 10: // "option code" + case 13: // "option code" -#line 58 "parser.yy" // lalr1.cc:636 - { yyoutput << yysym.value.template as< int > (); } +#line 61 "parser.yy" // lalr1.cc:636 + { yyoutput << yysym.value.template as< uint16_t > (); } #line 342 "parser.cc" // lalr1.cc:636 break; @@ -547,13 +547,13 @@ namespace isc { namespace eval { when using variants. */ switch (yyr1_[yyn]) { - case 10: // "option code" - yylhs.value.build< int > (); + case 11: // "constant string" + case 12: // "constant hexstring" + yylhs.value.build< std::string > (); break; - case 8: // "constant string" - case 9: // "constant hexstring" - yylhs.value.build< std::string > (); + case 13: // "option code" + yylhs.value.build< uint16_t > (); break; default: @@ -574,7 +574,7 @@ namespace isc { namespace eval { switch (yyn) { case 2: -#line 67 "parser.yy" // lalr1.cc:859 +#line 70 "parser.yy" // lalr1.cc:859 { TokenPtr eq(new TokenEqual()); ctx.expression.push_back(eq); @@ -583,7 +583,7 @@ namespace isc { namespace eval { break; case 4: -#line 75 "parser.yy" // lalr1.cc:859 +#line 78 "parser.yy" // lalr1.cc:859 { TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ())); ctx.expression.push_back(str); @@ -592,7 +592,7 @@ namespace isc { namespace eval { break; case 5: -#line 79 "parser.yy" // lalr1.cc:859 +#line 82 "parser.yy" // lalr1.cc:859 { TokenPtr hex(new TokenHexString(yystack_[0].value.as< std::string > ())); ctx.expression.push_back(hex); @@ -601,16 +601,16 @@ namespace isc { namespace eval { break; case 6: -#line 83 "parser.yy" // lalr1.cc:859 +#line 86 "parser.yy" // lalr1.cc:859 { - TokenPtr opt(new TokenOption(yystack_[0].value.as< int > ())); + TokenPtr opt(new TokenOption(yystack_[1].value.as< uint16_t > ())); ctx.expression.push_back(opt); } #line 610 "parser.cc" // lalr1.cc:859 break; case 7: -#line 87 "parser.yy" // lalr1.cc:859 +#line 90 "parser.yy" // lalr1.cc:859 { /* push back TokenSubstring */ } @@ -873,28 +873,28 @@ namespace isc { namespace eval { } - const signed char EvalParser::yypact_ninf_ = -8; + const signed char EvalParser::yypact_ninf_ = -9; const signed char EvalParser::yytable_ninf_ = -1; const signed char EvalParser::yypact_[] = { - 0, -5, -8, -8, -8, 3, 8, 0, -8, 0, - 1, -8, 0, 7, 0, 6, -8 + -1, -4, -6, -9, -9, 6, 5, 0, -1, -9, + -1, 2, 8, -9, -9, -1, 9, -1, 10, -9 }; const unsigned char EvalParser::yydefact_[] = { - 0, 0, 4, 5, 6, 0, 3, 0, 1, 0, - 0, 2, 0, 0, 0, 0, 7 + 0, 0, 0, 4, 5, 0, 3, 0, 0, 1, + 0, 0, 0, 2, 6, 0, 0, 0, 0, 7 }; const signed char EvalParser::yypgoto_[] = { - -8, -8, -7 + -9, -9, -8 }; const signed char @@ -906,34 +906,34 @@ namespace isc { namespace eval { const unsigned char EvalParser::yytable_[] = { - 10, 7, 11, 8, 1, 13, 12, 15, 2, 3, - 4, 9, 14, 16 + 12, 8, 13, 1, 2, 7, 9, 16, 10, 18, + 3, 4, 14, 11, 15, 17, 0, 0, 19 }; - const unsigned char + const signed char EvalParser::yycheck_[] = { - 7, 6, 9, 0, 4, 12, 5, 14, 8, 9, - 10, 3, 5, 7 + 8, 7, 10, 4, 5, 9, 0, 15, 3, 17, + 11, 12, 10, 13, 6, 6, -1, -1, 8 }; const unsigned char EvalParser::yystos_[] = { - 0, 4, 8, 9, 10, 12, 13, 6, 0, 3, - 13, 13, 5, 13, 5, 13, 7 + 0, 4, 5, 11, 12, 15, 16, 9, 7, 0, + 3, 13, 16, 16, 10, 6, 16, 6, 16, 8 }; const unsigned char EvalParser::yyr1_[] = { - 0, 11, 12, 12, 13, 13, 13, 13 + 0, 14, 15, 15, 16, 16, 16, 16 }; const unsigned char EvalParser::yyr2_[] = { - 0, 2, 3, 1, 1, 1, 1, 8 + 0, 2, 3, 1, 1, 1, 4, 8 }; @@ -943,17 +943,17 @@ namespace isc { namespace eval { const char* const EvalParser::yytname_[] = { - "\"end of file\"", "error", "$undefined", "\"==\"", "\"substring\"", - "\",\"", "\"(\"", "\")\"", "\"constant string\"", - "\"constant hexstring\"", "\"option code\"", "$accept", "expression", - "token", YY_NULLPTR + "\"end of file\"", "error", "$undefined", "\"==\"", "\"option\"", + "\"substring\"", "\",\"", "\"(\"", "\")\"", "\"[\"", "\"]\"", + "\"constant string\"", "\"constant hexstring\"", "\"option code\"", + "$accept", "expression", "token", YY_NULLPTR }; #if YYDEBUG const unsigned char EvalParser::yyrline_[] = { - 0, 67, 67, 71, 75, 79, 83, 87 + 0, 70, 70, 74, 78, 82, 86, 90 }; // Print the state stack on the debug stream. @@ -989,7 +989,7 @@ namespace isc { namespace eval { #line 21 "parser.yy" // lalr1.cc:1167 } } // isc::eval #line 992 "parser.cc" // lalr1.cc:1167 -#line 92 "parser.yy" // lalr1.cc:1168 +#line 95 "parser.yy" // lalr1.cc:1168 void isc::eval::EvalParser::error(const location_type& l, diff --git a/src/lib/eval/parser.h b/src/lib/eval/parser.h index c40a0283c0..01ec9e26bf 100644 --- a/src/lib/eval/parser.h +++ b/src/lib/eval/parser.h @@ -293,12 +293,12 @@ namespace isc { namespace eval { /// An auxiliary type to compute the largest semantic type. union union_type { - // "option code" - char dummy1[sizeof(int)]; - // "constant string" // "constant hexstring" - char dummy2[sizeof(std::string)]; + char dummy1[sizeof(std::string)]; + + // "option code" + char dummy2[sizeof(uint16_t)]; }; /// Symbol semantic values. @@ -323,13 +323,16 @@ namespace isc { namespace eval { { TOKEN_END = 0, TOKEN_EQUAL = 258, - TOKEN_SUBSTRING = 259, - TOKEN_COMA = 260, - TOKEN_LPAREN = 261, - TOKEN_RPAREN = 262, - TOKEN_STRING = 263, - TOKEN_HEXSTRING = 264, - TOKEN_OPTION = 265 + TOKEN_OPTION = 259, + TOKEN_SUBSTRING = 260, + TOKEN_COMA = 261, + TOKEN_LPAREN = 262, + TOKEN_RPAREN = 263, + TOKEN_LBRACKET = 264, + TOKEN_RBRACKET = 265, + TOKEN_STRING = 266, + TOKEN_HEXSTRING = 267, + TOKEN_CODE = 268 }; }; @@ -367,10 +370,10 @@ namespace isc { namespace eval { basic_symbol (typename Base::kind_type t, const location_type& l); - basic_symbol (typename Base::kind_type t, const int v, const location_type& l); - basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l); + basic_symbol (typename Base::kind_type t, const uint16_t v, const location_type& l); + /// Constructor for symbols with semantic value. basic_symbol (typename Base::kind_type t, @@ -446,6 +449,10 @@ namespace isc { namespace eval { symbol_type make_EQUAL (const location_type& l); + static inline + symbol_type + make_OPTION (const location_type& l); + static inline symbol_type make_SUBSTRING (const location_type& l); @@ -462,6 +469,14 @@ namespace isc { namespace eval { symbol_type make_RPAREN (const location_type& l); + static inline + symbol_type + make_LBRACKET (const location_type& l); + + static inline + symbol_type + make_RBRACKET (const location_type& l); + static inline symbol_type make_STRING (const std::string& v, const location_type& l); @@ -472,7 +487,7 @@ namespace isc { namespace eval { static inline symbol_type - make_OPTION (const int& v, const location_type& l); + make_CODE (const uint16_t& v, const location_type& l); /// Build a parser object. @@ -559,7 +574,7 @@ namespace isc { namespace eval { // number is the opposite. If YYTABLE_NINF, syntax error. static const unsigned char yytable_[]; - static const unsigned char yycheck_[]; + static const signed char yycheck_[]; // YYSTOS[STATE-NUM] -- The (internal number of the) accessing // symbol of state STATE-NUM. @@ -679,12 +694,12 @@ namespace isc { namespace eval { enum { yyeof_ = 0, - yylast_ = 13, ///< Last index in yytable_. + yylast_ = 18, ///< Last index in yytable_. yynnts_ = 3, ///< Number of nonterminal symbols. - yyfinal_ = 8, ///< Termination state number. + yyfinal_ = 9, ///< Termination state number. yyterror_ = 1, yyerrcode_ = 256, - yyntokens_ = 11 ///< Number of tokens. + yyntokens_ = 14 ///< Number of tokens. }; @@ -727,9 +742,9 @@ namespace isc { namespace eval { 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 + 5, 6, 7, 8, 9, 10, 11, 12, 13 }; - const unsigned int user_token_number_max_ = 265; + const unsigned int user_token_number_max_ = 268; const token_number_type undef_token_ = 2; if (static_cast(t) <= yyeof_) @@ -762,13 +777,13 @@ namespace isc { namespace eval { { switch (other.type_get ()) { - case 10: // "option code" - value.copy< int > (other.value); + case 11: // "constant string" + case 12: // "constant hexstring" + value.copy< std::string > (other.value); break; - case 8: // "constant string" - case 9: // "constant hexstring" - value.copy< std::string > (other.value); + case 13: // "option code" + value.copy< uint16_t > (other.value); break; default: @@ -788,13 +803,13 @@ namespace isc { namespace eval { (void) v; switch (this->type_get ()) { - case 10: // "option code" - value.copy< int > (v); + case 11: // "constant string" + case 12: // "constant hexstring" + value.copy< std::string > (v); break; - case 8: // "constant string" - case 9: // "constant hexstring" - value.copy< std::string > (v); + case 13: // "option code" + value.copy< uint16_t > (v); break; default: @@ -813,14 +828,14 @@ namespace isc { namespace eval { {} template - EvalParser::basic_symbol::basic_symbol (typename Base::kind_type t, const int v, const location_type& l) + EvalParser::basic_symbol::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l) : Base (t) , value (v) , location (l) {} template - EvalParser::basic_symbol::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l) + EvalParser::basic_symbol::basic_symbol (typename Base::kind_type t, const uint16_t v, const location_type& l) : Base (t) , value (v) , location (l) @@ -852,13 +867,13 @@ namespace isc { namespace eval { // Type destructor. switch (yytype) { - case 10: // "option code" - value.template destroy< int > (); + case 11: // "constant string" + case 12: // "constant hexstring" + value.template destroy< std::string > (); break; - case 8: // "constant string" - case 9: // "constant hexstring" - value.template destroy< std::string > (); + case 13: // "option code" + value.template destroy< uint16_t > (); break; default: @@ -884,13 +899,13 @@ namespace isc { namespace eval { super_type::move(s); switch (this->type_get ()) { - case 10: // "option code" - value.move< int > (s.value); + case 11: // "constant string" + case 12: // "constant hexstring" + value.move< std::string > (s.value); break; - case 8: // "constant string" - case 9: // "constant hexstring" - value.move< std::string > (s.value); + case 13: // "option code" + value.move< uint16_t > (s.value); break; default: @@ -949,7 +964,7 @@ namespace isc { namespace eval { yytoken_number_[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265 + 265, 266, 267, 268 }; return static_cast (yytoken_number_[type]); } @@ -966,6 +981,12 @@ namespace isc { namespace eval { return symbol_type (token::TOKEN_EQUAL, l); } + EvalParser::symbol_type + EvalParser::make_OPTION (const location_type& l) + { + return symbol_type (token::TOKEN_OPTION, l); + } + EvalParser::symbol_type EvalParser::make_SUBSTRING (const location_type& l) { @@ -990,6 +1011,18 @@ namespace isc { namespace eval { return symbol_type (token::TOKEN_RPAREN, l); } + EvalParser::symbol_type + EvalParser::make_LBRACKET (const location_type& l) + { + return symbol_type (token::TOKEN_LBRACKET, l); + } + + EvalParser::symbol_type + EvalParser::make_RBRACKET (const location_type& l) + { + return symbol_type (token::TOKEN_RBRACKET, l); + } + EvalParser::symbol_type EvalParser::make_STRING (const std::string& v, const location_type& l) { @@ -1003,15 +1036,15 @@ namespace isc { namespace eval { } EvalParser::symbol_type - EvalParser::make_OPTION (const int& v, const location_type& l) + EvalParser::make_CODE (const uint16_t& v, const location_type& l) { - return symbol_type (token::TOKEN_OPTION, v, l); + return symbol_type (token::TOKEN_CODE, v, l); } #line 21 "parser.yy" // lalr1.cc:392 } } // isc::eval -#line 1015 "parser.h" // lalr1.cc:392 +#line 1048 "parser.h" // lalr1.cc:392