const uint8_t* option_data = static_cast<const uint8_t*>(buf.getData());
std::vector<uint8_t> option_vec;
- // Exclude header.
- if (!include_header) {
- if (buf.getLength() > getHeaderLen()) {
- option_vec.assign(option_data + getHeaderLen(),
- option_data + buf.getLength());
- }
-
- } else {
- option_vec.assign(option_data, option_data + buf.getLength());
- }
+ // Assign option data to a vector, with or without option header depending
+ // on the value of "include_header" flag.
+ option_vec.assign(option_data + (include_header ? 0 : getHeaderLen()),
+ option_data + buf.getLength());
// Return hexadecimal representation prepended with 0x or empty string
// if option has no payload and the header fields are excluded.
14. TokenPtr hex(new TokenHexString($1));
15. ctx.expression.push_back(hex);
16. }
-17. | OPTION '[' INTEGER ']' DOTTEXT
+17. | OPTION '[' INTEGER ']' DOT TEXT
18. {
19. TokenPtr opt(new TokenOption($3, TokenOption::TEXTUAL));
20. ctx.expression.push_back(opt);
21. }
-22. | OPTION '[' INTEGER ']' DOTHEX
+22. | OPTION '[' INTEGER ']' DOT HEX
23. {
24. TokenPtr opt(new TokenOption($3, TokenOption::HEXADECIMAL));
25. ctx.expression.push_back(opt);
(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 18
-#define YY_END_OF_BUFFER 19
+#define YY_NUM_RULES 19
+#define YY_END_OF_BUFFER 20
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
};
static yyconst flex_int16_t yy_accept[52] =
{ 0,
- 0, 0, 19, 17, 1, 2, 17, 12, 13, 16,
- 17, 17, 5, 5, 17, 14, 15, 17, 17, 17,
- 1, 2, 0, 3, 5, 0, 0, 0, 6, 0,
- 0, 0, 0, 0, 4, 11, 0, 0, 9, 0,
+ 0, 0, 20, 18, 1, 2, 18, 13, 14, 17,
+ 18, 12, 5, 5, 18, 15, 16, 18, 18, 18,
+ 18, 18, 1, 2, 0, 3, 5, 0, 6, 0,
+ 0, 0, 0, 0, 4, 11, 9, 0, 0, 0,
0, 0, 8, 0, 0, 7, 0, 0, 0, 10,
0
} ;
static yyconst flex_int16_t yy_base[54] =
{ 0,
- 0, 0, 74, 75, 71, 69, 67, 75, 75, 75,
- 22, 13, 25, 27, 58, 75, 75, 46, 42, 37,
- 64, 62, 60, 75, 30, 44, 43, 0, 75, 38,
- 31, 40, 24, 23, 0, 75, 31, 24, 75, 22,
- 25, 20, 75, 24, 20, 75, 24, 21, 24, 75,
- 75, 56, 40
+ 0, 0, 72, 73, 69, 67, 65, 73, 73, 73,
+ 22, 73, 24, 26, 56, 73, 73, 44, 47, 39,
+ 34, 44, 60, 58, 56, 73, 29, 0, 73, 36,
+ 26, 25, 35, 21, 0, 73, 73, 29, 22, 20,
+ 23, 18, 73, 22, 18, 73, 22, 19, 22, 73,
+ 73, 55, 38
} ;
static yyconst flex_int16_t yy_def[54] =
{ 0,
51, 1, 51, 51, 51, 51, 52, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 52, 51, 51, 51, 51, 53, 51, 51,
+ 51, 51, 51, 51, 52, 51, 51, 53, 51, 51,
51, 51, 51, 51, 53, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
0, 51, 51
} ;
-static yyconst flex_int16_t yy_nxt[107] =
+static yyconst flex_int16_t yy_nxt[105] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 4, 4, 16, 17, 18, 4, 4, 4,
- 4, 4, 4, 4, 19, 4, 4, 20, 4, 4,
- 4, 25, 25, 26, 25, 25, 25, 25, 28, 25,
- 25, 27, 35, 50, 49, 48, 47, 46, 45, 44,
- 43, 42, 41, 40, 39, 28, 23, 38, 23, 37,
- 36, 34, 33, 24, 22, 21, 32, 31, 30, 29,
- 24, 22, 21, 51, 3, 51, 51, 51, 51, 51,
+ 19, 4, 4, 4, 20, 4, 4, 21, 22, 4,
+ 4, 27, 27, 27, 27, 27, 27, 28, 27, 27,
+ 35, 50, 49, 48, 47, 46, 45, 44, 43, 42,
+ 41, 40, 39, 38, 28, 25, 37, 25, 36, 26,
+ 24, 23, 34, 33, 32, 31, 30, 29, 26, 24,
+ 23, 51, 3, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 51, 51, 51, 51
+ 51, 51, 51, 51
} ;
-static yyconst flex_int16_t yy_chk[107] =
+static yyconst flex_int16_t yy_chk[105] =
{ 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, 11, 11, 12, 13, 13, 14, 14, 13, 25,
- 25, 12, 53, 49, 48, 47, 45, 44, 42, 41,
- 40, 38, 37, 34, 33, 13, 52, 32, 52, 31,
- 30, 27, 26, 23, 22, 21, 20, 19, 18, 15,
- 7, 6, 5, 3, 51, 51, 51, 51, 51, 51,
+ 1, 11, 11, 13, 13, 14, 14, 13, 27, 27,
+ 53, 49, 48, 47, 45, 44, 42, 41, 40, 39,
+ 38, 34, 33, 32, 13, 52, 31, 52, 30, 25,
+ 24, 23, 22, 21, 20, 19, 18, 15, 7, 6,
+ 5, 3, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 51, 51, 51, 51
+ 51, 51, 51, 51
} ;
/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[19] =
+static yyconst flex_int32_t yy_rule_can_match_eol[20] =
{ 0,
-0, 1, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0,
+ };
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
extern int yy_flex_debug;
int yy_flex_debug = 1;
-static yyconst flex_int16_t yy_rule_linenum[18] =
+static yyconst flex_int16_t yy_rule_linenum[19] =
{ 0,
83, 87, 93, 103, 109, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 135
+ 128, 129, 130, 131, 132, 133, 134, 136
} ;
/* The intent behind this definition is that it'll catch
// by moving it ahead by yyleng bytes. yyleng specifies the length of the
// currently matched token.
#define YY_USER_ACTION loc.columns(yyleng);
-#line 656 "lexer.cc"
+#line 657 "lexer.cc"
#define INITIAL 0
loc.step();
-#line 904 "lexer.cc"
+#line 905 "lexer.cc"
if ( !(yy_init) )
{
{
if ( yy_act == 0 )
fprintf( stderr, "--scanner backing up\n" );
- else if ( yy_act < 18 )
+ else if ( yy_act < 19 )
fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
(long)yy_rule_linenum[yy_act], yytext );
- else if ( yy_act == 18 )
+ else if ( yy_act == 19 )
fprintf( stderr, "--accepting default rule (\"%s\")\n",
yytext );
- else if ( yy_act == 19 )
+ else if ( yy_act == 20 )
fprintf( stderr, "--(end of buffer or a NUL)\n" );
else
fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
case 8:
YY_RULE_SETUP
#line 125 "lexer.ll"
-return isc::eval::EvalParser::make_DOTTEXT(loc);
+return isc::eval::EvalParser::make_TEXT(loc);
YY_BREAK
case 9:
YY_RULE_SETUP
#line 126 "lexer.ll"
-return isc::eval::EvalParser::make_DOTHEX(loc);
+return isc::eval::EvalParser::make_HEX(loc);
YY_BREAK
case 10:
YY_RULE_SETUP
case 12:
YY_RULE_SETUP
#line 129 "lexer.ll"
-return isc::eval::EvalParser::make_LPAREN(loc);
+return isc::eval::EvalParser::make_DOT(loc);
YY_BREAK
case 13:
YY_RULE_SETUP
#line 130 "lexer.ll"
-return isc::eval::EvalParser::make_RPAREN(loc);
+return isc::eval::EvalParser::make_LPAREN(loc);
YY_BREAK
case 14:
YY_RULE_SETUP
#line 131 "lexer.ll"
-return isc::eval::EvalParser::make_LBRACKET(loc);
+return isc::eval::EvalParser::make_RPAREN(loc);
YY_BREAK
case 15:
YY_RULE_SETUP
#line 132 "lexer.ll"
-return isc::eval::EvalParser::make_RBRACKET(loc);
+return isc::eval::EvalParser::make_LBRACKET(loc);
YY_BREAK
case 16:
YY_RULE_SETUP
#line 133 "lexer.ll"
-return isc::eval::EvalParser::make_COMA(loc);
+return isc::eval::EvalParser::make_RBRACKET(loc);
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 135 "lexer.ll"
+#line 134 "lexer.ll"
+return isc::eval::EvalParser::make_COMA(loc);
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 136 "lexer.ll"
driver.error (loc, "Invalid character: " + std::string(yytext));
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 136 "lexer.ll"
+#line 137 "lexer.ll"
return isc::eval::EvalParser::make_END(loc);
YY_BREAK
-case 18:
+case 19:
YY_RULE_SETUP
-#line 137 "lexer.ll"
+#line 138 "lexer.ll"
ECHO;
YY_BREAK
-#line 1150 "lexer.cc"
+#line 1156 "lexer.cc"
case YY_END_OF_BUFFER:
{
/* %ok-for-header */
-#line 137 "lexer.ll"
+#line 138 "lexer.ll"
"==" return isc::eval::EvalParser::make_EQUAL(loc);
"option" return isc::eval::EvalParser::make_OPTION(loc);
-".text" return isc::eval::EvalParser::make_DOTTEXT(loc);
-".hex" return isc::eval::EvalParser::make_DOTHEX(loc);
+"text" return isc::eval::EvalParser::make_TEXT(loc);
+"hex" return isc::eval::EvalParser::make_HEX(loc);
"substring" return isc::eval::EvalParser::make_SUBSTRING(loc);
"all" return isc::eval::EvalParser::make_ALL(loc);
+"." return isc::eval::EvalParser::make_DOT(loc);
"(" return isc::eval::EvalParser::make_LPAREN(loc);
")" return isc::eval::EvalParser::make_RPAREN(loc);
"[" return isc::eval::EvalParser::make_LBRACKET(loc);
#line 39 "parser.yy" // lalr1.cc:413
# include "eval_context.h"
-#line 66 "parser.yy" // lalr1.cc:413
+#line 67 "parser.yy" // lalr1.cc:413
namespace {
{
switch (that.type_get ())
{
- case 14: // "constant string"
- case 15: // "integer"
- case 16: // "constant hexstring"
- case 17: // TOKEN
+ case 15: // "constant string"
+ case 16: // "integer"
+ case 17: // "constant hexstring"
+ case 18: // TOKEN
value.move< std::string > (that.value);
break;
state = that.state;
switch (that.type_get ())
{
- case 14: // "constant string"
- case 15: // "integer"
- case 16: // "constant hexstring"
- case 17: // TOKEN
+ case 15: // "constant string"
+ case 16: // "integer"
+ case 17: // "constant hexstring"
+ case 18: // TOKEN
value.copy< std::string > (that.value);
break;
<< yysym.location << ": ";
switch (yytype)
{
- case 14: // "constant string"
+ case 15: // "constant string"
-#line 63 "parser.yy" // lalr1.cc:636
+#line 64 "parser.yy" // lalr1.cc:636
{ yyoutput << yysym.value.template as< std::string > (); }
#line 350 "parser.cc" // lalr1.cc:636
break;
- case 15: // "integer"
+ case 16: // "integer"
-#line 63 "parser.yy" // lalr1.cc:636
+#line 64 "parser.yy" // lalr1.cc:636
{ yyoutput << yysym.value.template as< std::string > (); }
#line 357 "parser.cc" // lalr1.cc:636
break;
- case 16: // "constant hexstring"
+ case 17: // "constant hexstring"
-#line 63 "parser.yy" // lalr1.cc:636
+#line 64 "parser.yy" // lalr1.cc:636
{ yyoutput << yysym.value.template as< std::string > (); }
#line 364 "parser.cc" // lalr1.cc:636
break;
- case 17: // TOKEN
+ case 18: // TOKEN
-#line 63 "parser.yy" // lalr1.cc:636
+#line 64 "parser.yy" // lalr1.cc:636
{ yyoutput << yysym.value.template as< std::string > (); }
#line 371 "parser.cc" // lalr1.cc:636
break;
when using variants. */
switch (yyr1_[yyn])
{
- case 14: // "constant string"
- case 15: // "integer"
- case 16: // "constant hexstring"
- case 17: // TOKEN
+ case 15: // "constant string"
+ case 16: // "integer"
+ case 17: // "constant hexstring"
+ case 18: // TOKEN
yylhs.value.build< std::string > ();
break;
switch (yyn)
{
case 3:
-#line 104 "parser.yy" // lalr1.cc:859
+#line 105 "parser.yy" // lalr1.cc:859
{
TokenPtr eq(new TokenEqual());
ctx.expression.push_back(eq);
break;
case 4:
-#line 111 "parser.yy" // lalr1.cc:859
+#line 112 "parser.yy" // lalr1.cc:859
{
TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(str);
break;
case 5:
-#line 116 "parser.yy" // lalr1.cc:859
+#line 117 "parser.yy" // lalr1.cc:859
{
TokenPtr hex(new TokenHexString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(hex);
break;
case 6:
-#line 121 "parser.yy" // lalr1.cc:859
+#line 122 "parser.yy" // lalr1.cc:859
{
- uint16_t numeric_code = convert_option_code(yystack_[2].value.as< std::string > (), yystack_[2].location, ctx);
+ uint16_t numeric_code = convert_option_code(yystack_[3].value.as< std::string > (), yystack_[3].location, ctx);
TokenPtr opt(new TokenOption(numeric_code, TokenOption::TEXTUAL));
ctx.expression.push_back(opt);
}
break;
case 7:
-#line 127 "parser.yy" // lalr1.cc:859
+#line 128 "parser.yy" // lalr1.cc:859
{
- uint16_t numeric_code = convert_option_code(yystack_[2].value.as< std::string > (), yystack_[2].location, ctx);
+ uint16_t numeric_code = convert_option_code(yystack_[3].value.as< std::string > (), yystack_[3].location, ctx);
TokenPtr opt(new TokenOption(numeric_code, TokenOption::HEXADECIMAL));
ctx.expression.push_back(opt);
}
break;
case 8:
-#line 133 "parser.yy" // lalr1.cc:859
+#line 134 "parser.yy" // lalr1.cc:859
{
TokenPtr sub(new TokenSubstring());
ctx.expression.push_back(sub);
break;
case 10:
-#line 142 "parser.yy" // lalr1.cc:859
+#line 143 "parser.yy" // lalr1.cc:859
{
TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(str);
break;
case 11:
-#line 149 "parser.yy" // lalr1.cc:859
+#line 150 "parser.yy" // lalr1.cc:859
{
TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(str);
break;
case 12:
-#line 154 "parser.yy" // lalr1.cc:859
+#line 155 "parser.yy" // lalr1.cc:859
{
TokenPtr str(new TokenString("all"));
ctx.expression.push_back(str);
}
- const signed char EvalParser::yypact_ninf_ = -9;
+ const signed char EvalParser::yypact_ninf_ = -10;
const signed char EvalParser::yytable_ninf_ = -1;
const signed char
EvalParser::yypact_[] =
{
- -4, -8, -2, -9, -9, -9, 11, -9, 12, -1,
- -4, -9, -4, 3, 8, -9, 0, 4, -9, -9,
- -9, 9, -6, -9, -9, 10, -9
+ -4, -9, -3, -10, -10, -10, 9, -10, 12, 1,
+ -4, -10, -4, -2, 6, -10, 10, 2, 0, -10,
+ 11, -10, -10, -6, -10, -10, 8, -10
};
const unsigned char
EvalParser::yydefact_[] =
{
0, 0, 0, 4, 5, 9, 0, 2, 0, 0,
- 0, 1, 0, 0, 0, 3, 0, 0, 6, 7,
- 10, 0, 0, 12, 11, 0, 8
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 10,
+ 0, 6, 7, 0, 12, 11, 0, 8
};
const signed char
EvalParser::yypgoto_[] =
{
- -9, -9, -9, -7, -9, -9
+ -10, -10, -10, -7, -10, -10
};
const signed char
EvalParser::yydefgoto_[] =
{
- -1, 6, 7, 8, 21, 25
+ -1, 6, 7, 8, 20, 26
};
const unsigned char
EvalParser::yytable_[] =
{
- 1, 2, 23, 14, 9, 15, 18, 19, 10, 24,
- 3, 11, 4, 5, 13, 12, 16, 17, 22, 20,
- 0, 26
+ 1, 2, 24, 14, 9, 15, 21, 22, 10, 11,
+ 25, 3, 16, 4, 5, 12, 17, 13, 19, 18,
+ 27, 23
};
- const signed char
+ const unsigned char
EvalParser::yycheck_[] =
{
- 4, 5, 8, 10, 12, 12, 6, 7, 10, 15,
- 14, 0, 16, 17, 15, 3, 13, 9, 9, 15,
- -1, 11
+ 4, 5, 8, 10, 13, 12, 6, 7, 11, 0,
+ 16, 15, 14, 17, 18, 3, 10, 16, 16, 9,
+ 12, 10
};
const unsigned char
EvalParser::yystos_[] =
{
- 0, 4, 5, 14, 16, 17, 19, 20, 21, 12,
- 10, 0, 3, 15, 21, 21, 13, 9, 6, 7,
- 15, 22, 9, 8, 15, 23, 11
+ 0, 4, 5, 15, 17, 18, 20, 21, 22, 13,
+ 11, 0, 3, 16, 22, 22, 14, 10, 9, 16,
+ 23, 6, 7, 10, 8, 16, 24, 12
};
const unsigned char
EvalParser::yyr1_[] =
{
- 0, 18, 19, 20, 21, 21, 21, 21, 21, 21,
- 22, 23, 23
+ 0, 19, 20, 21, 22, 22, 22, 22, 22, 22,
+ 23, 24, 24
};
const unsigned char
EvalParser::yyr2_[] =
{
- 0, 2, 1, 3, 1, 1, 5, 5, 8, 1,
+ 0, 2, 1, 3, 1, 1, 6, 6, 8, 1,
1, 1, 1
};
const EvalParser::yytname_[] =
{
"\"end of file\"", "error", "$undefined", "\"==\"", "\"option\"",
- "\"substring\"", "\".text\"", "\".hex\"", "\"all\"", "\",\"", "\"(\"",
- "\")\"", "\"[\"", "\"]\"", "\"constant string\"", "\"integer\"",
+ "\"substring\"", "\"text\"", "\"hex\"", "\"all\"", "\".\"", "\",\"",
+ "\"(\"", "\")\"", "\"[\"", "\"]\"", "\"constant string\"", "\"integer\"",
"\"constant hexstring\"", "TOKEN", "$accept", "expression", "bool_expr",
"string_expr", "start_expr", "length_expr", YY_NULLPTR
};
const unsigned char
EvalParser::yyrline_[] =
{
- 0, 100, 100, 103, 110, 115, 120, 126, 132, 137,
- 141, 148, 153
+ 0, 101, 101, 104, 111, 116, 121, 127, 133, 138,
+ 142, 149, 154
};
// Print the state stack on the debug stream.
#line 21 "parser.yy" // lalr1.cc:1167
} } // isc::eval
#line 1058 "parser.cc" // lalr1.cc:1167
-#line 160 "parser.yy" // lalr1.cc:1168
+#line 161 "parser.yy" // lalr1.cc:1168
void
isc::eval::EvalParser::error(const location_type& loc,
TOKEN_EQUAL = 258,
TOKEN_OPTION = 259,
TOKEN_SUBSTRING = 260,
- TOKEN_DOTTEXT = 261,
- TOKEN_DOTHEX = 262,
+ TOKEN_TEXT = 261,
+ TOKEN_HEX = 262,
TOKEN_ALL = 263,
- TOKEN_COMA = 264,
- TOKEN_LPAREN = 265,
- TOKEN_RPAREN = 266,
- TOKEN_LBRACKET = 267,
- TOKEN_RBRACKET = 268,
- TOKEN_STRING = 269,
- TOKEN_INTEGER = 270,
- TOKEN_HEXSTRING = 271,
- TOKEN_TOKEN = 272
+ 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_TOKEN = 273
};
};
static inline
symbol_type
- make_DOTTEXT (const location_type& l);
+ make_TEXT (const location_type& l);
static inline
symbol_type
- make_DOTHEX (const location_type& l);
+ make_HEX (const location_type& l);
static inline
symbol_type
make_ALL (const location_type& l);
+ static inline
+ symbol_type
+ make_DOT (const location_type& l);
+
static inline
symbol_type
make_COMA (const location_type& l);
// number is the opposite. If YYTABLE_NINF, syntax error.
static const unsigned char yytable_[];
- static const signed char yycheck_[];
+ static const unsigned char yycheck_[];
// YYSTOS[STATE-NUM] -- The (internal number of the) accessing
// symbol of state STATE-NUM.
yyfinal_ = 11, ///< Termination state number.
yyterror_ = 1,
yyerrcode_ = 256,
- yyntokens_ = 18 ///< Number of tokens.
+ yyntokens_ = 19 ///< Number of tokens.
};
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
+ 15, 16, 17, 18
};
- const unsigned int user_token_number_max_ = 272;
+ const unsigned int user_token_number_max_ = 273;
const token_number_type undef_token_ = 2;
if (static_cast<int>(t) <= yyeof_)
{
switch (other.type_get ())
{
- case 14: // "constant string"
- case 15: // "integer"
- case 16: // "constant hexstring"
- case 17: // TOKEN
+ case 15: // "constant string"
+ case 16: // "integer"
+ case 17: // "constant hexstring"
+ case 18: // TOKEN
value.copy< std::string > (other.value);
break;
(void) v;
switch (this->type_get ())
{
- case 14: // "constant string"
- case 15: // "integer"
- case 16: // "constant hexstring"
- case 17: // TOKEN
+ case 15: // "constant string"
+ case 16: // "integer"
+ case 17: // "constant hexstring"
+ case 18: // TOKEN
value.copy< std::string > (v);
break;
// Type destructor.
switch (yytype)
{
- case 14: // "constant string"
- case 15: // "integer"
- case 16: // "constant hexstring"
- case 17: // TOKEN
+ case 15: // "constant string"
+ case 16: // "integer"
+ case 17: // "constant hexstring"
+ case 18: // TOKEN
value.template destroy< std::string > ();
break;
super_type::move(s);
switch (this->type_get ())
{
- case 14: // "constant string"
- case 15: // "integer"
- case 16: // "constant hexstring"
- case 17: // TOKEN
+ case 15: // "constant string"
+ case 16: // "integer"
+ case 17: // "constant hexstring"
+ case 18: // TOKEN
value.move< std::string > (s.value);
break;
yytoken_number_[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272
+ 265, 266, 267, 268, 269, 270, 271, 272, 273
};
return static_cast<token_type> (yytoken_number_[type]);
}
}
EvalParser::symbol_type
- EvalParser::make_DOTTEXT (const location_type& l)
+ EvalParser::make_TEXT (const location_type& l)
{
- return symbol_type (token::TOKEN_DOTTEXT, l);
+ return symbol_type (token::TOKEN_TEXT, l);
}
EvalParser::symbol_type
- EvalParser::make_DOTHEX (const location_type& l)
+ EvalParser::make_HEX (const location_type& l)
{
- return symbol_type (token::TOKEN_DOTHEX, l);
+ return symbol_type (token::TOKEN_HEX, l);
}
EvalParser::symbol_type
return symbol_type (token::TOKEN_ALL, l);
}
+ EvalParser::symbol_type
+ EvalParser::make_DOT (const location_type& l)
+ {
+ return symbol_type (token::TOKEN_DOT, l);
+ }
+
EvalParser::symbol_type
EvalParser::make_COMA (const location_type& l)
{
#line 21 "parser.yy" // lalr1.cc:392
} } // isc::eval
-#line 1076 "parser.h" // lalr1.cc:392
+#line 1087 "parser.h" // lalr1.cc:392
EQUAL "=="
OPTION "option"
SUBSTRING "substring"
- DOTTEXT ".text"
- DOTHEX ".hex"
+ TEXT "text"
+ HEX "hex"
ALL "all"
+ DOT "."
COMA ","
LPAREN "("
RPAREN ")"
TokenPtr hex(new TokenHexString($1));
ctx.expression.push_back(hex);
}
- | OPTION "[" INTEGER "]" DOTTEXT
+ | OPTION "[" INTEGER "]" DOT TEXT
{
uint16_t numeric_code = convert_option_code($3, @3, ctx);
TokenPtr opt(new TokenOption(numeric_code, TokenOption::TEXTUAL));
ctx.expression.push_back(opt);
}
- | OPTION "[" INTEGER "]" DOTHEX
+ | OPTION "[" INTEGER "]" DOT HEX
{
uint16_t numeric_code = convert_option_code($3, @3, ctx);
TokenPtr opt(new TokenOption(numeric_code, TokenOption::HEXADECIMAL));
EvalContext tmp;
- try {
- tmp.parseString("option[123].text == 'MSFT'");
- } catch (const std::exception& ex) {
- std::cout << ex.what() << std::endl;
- }
EXPECT_NO_THROW(parsed_ = tmp.parseString("option[123].text == 'MSFT'"));
EXPECT_TRUE(parsed_);
}
checkError("option[65536].text",
"<string>:1.8-12: Option code has invalid "
"value in 65536. Allowed range: 0..65535");
- checkError("option[12345678901234567890]",
+ checkError("option[12345678901234567890].text",
"<string>:1.8-27: Failed to convert 12345678901234567890 "
"to an integer.");
- checkError("option[123].text < 'foo'", "<string>:1.18: Invalid character: <");
+ checkError("option[123]",
+ "<string>:1.12: syntax error, unexpected end of file,"
+ " expecting .");
+ checkError("option[123].text < 'foo'", "<string>:1.18: Invalid"
+ " character: <");
checkError("substring('foo',12345678901234567890,1)",
"<string>:1.17-36: Failed to convert 12345678901234567890 "
"to an integer.");