-// A Bison parser, made by GNU Bison 3.5.1.
+// A Bison parser, made by GNU Bison 3.7.5.
// Locations for Bison parsers in C++
-// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
+// Copyright (C) 2002-2015, 2018-2021 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
class position
{
public:
+ /// Type for file name.
+ typedef const std::string filename_type;
/// Type for line and column numbers.
typedef int counter_type;
/// Construct a position.
- explicit position (std::string* f = YY_NULLPTR,
+ explicit position (filename_type* f = YY_NULLPTR,
counter_type l = 1,
counter_type c = 1)
: filename (f)
/// Initialization.
- void initialize (std::string* fn = YY_NULLPTR,
+ void initialize (filename_type* fn = YY_NULLPTR,
counter_type l = 1,
counter_type c = 1)
{
/** \} */
/// File name to which this position refers.
- std::string* filename;
+ filename_type* filename;
/// Current line number.
counter_type line;
/// Current column number.
return res -= width;
}
- /// Compare two position objects.
- inline bool
- operator== (const position& pos1, const position& pos2)
- {
- return (pos1.line == pos2.line
- && pos1.column == pos2.column
- && (pos1.filename == pos2.filename
- || (pos1.filename && pos2.filename
- && *pos1.filename == *pos2.filename)));
- }
-
- /// Compare two position objects.
- inline bool
- operator!= (const position& pos1, const position& pos2)
- {
- return !(pos1 == pos2);
- }
-
/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param pos a reference to the position to redirect
class location
{
public:
+ /// Type for file name.
+ typedef position::filename_type filename_type;
/// Type for line and column numbers.
typedef position::counter_type counter_type;
{}
/// Construct a 0-width location in \a f, \a l, \a c.
- explicit location (std::string* f,
+ explicit location (filename_type* f,
counter_type l = 1,
counter_type c = 1)
: begin (f, l, c)
/// Initialization.
- void initialize (std::string* f = YY_NULLPTR,
+ void initialize (filename_type* f = YY_NULLPTR,
counter_type l = 1,
counter_type c = 1)
{
return res -= width;
}
- /// Compare two location objects.
- inline bool
- operator== (const location& loc1, const location& loc2)
- {
- return loc1.begin == loc2.begin && loc1.end == loc2.end;
- }
-
- /// Compare two location objects.
- inline bool
- operator!= (const location& loc1, const location& loc2)
- {
- return !(loc1 == loc2);
- }
-
/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param loc a reference to the location to redirect
#line 14 "parser.yy"
} } // isc::eval
-#line 333 "location.hh"
+#line 305 "location.hh"
#endif // !YY_EVAL_LOCATION_HH_INCLUDED
-// A Bison parser, made by GNU Bison 3.5.1.
+// A Bison parser, made by GNU Bison 3.7.5.
// Skeleton implementation for Bison LALR(1) parsers in C++
-// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
+// Copyright (C) 2002-2015, 2018-2021 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
// This special exception was added by the Free Software Foundation in
// version 2.2 of Bison.
-// Undocumented macros, especially those whose name start with YY_,
-// are private implementation details. Do not rely on them.
+// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+// especially those whose name start with YY_ or yy_. They are
+// private implementation details that can be changed or removed.
// Take the name prefix into account.
# include "eval_context.h"
-#line 51 "parser.cc"
+#line 52 "parser.cc"
#ifndef YY_
# endif
#endif
+
// Whether we are compiled with exception support.
#ifndef YY_EXCEPTIONS
# if defined __GNUC__ && !defined __EXCEPTIONS
# define YY_STACK_PRINT() \
do { \
if (yydebug_) \
- yystack_print_ (); \
+ yy_stack_print_ (); \
} while (false)
#else // !EVALDEBUG
# define YYCDEBUG if (false) std::cerr
-# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
+# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol)
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
# define YY_STACK_PRINT() static_cast<void> (0)
#line 14 "parser.yy"
namespace isc { namespace eval {
-#line 143 "parser.cc"
-
-
- /* Return YYSTR after stripping away unnecessary quotes and
- backslashes, so that it's suitable for yyerror. The heuristic is
- that double-quoting is unnecessary unless the string contains an
- apostrophe, a comma, or backslash (other than backslash-backslash).
- YYSTR is taken from yytname. */
- std::string
- EvalParser::yytnamerr_ (const char *yystr)
- {
- if (*yystr == '"')
- {
- std::string yyr;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- else
- goto append;
-
- append:
- default:
- yyr += *yyp;
- break;
-
- case '"':
- return yyr;
- }
- do_not_strip_quotes: ;
- }
-
- return yystr;
- }
-
+#line 145 "parser.cc"
/// Build a parser object.
EvalParser::EvalParser (EvalContext& ctx_yyarg)
{}
/*---------------.
- | Symbol types. |
+ | symbol kinds. |
`---------------*/
: state (s)
{}
- EvalParser::symbol_number_type
- EvalParser::by_state::type_get () const YY_NOEXCEPT
+ EvalParser::symbol_kind_type
+ EvalParser::by_state::kind () const YY_NOEXCEPT
{
if (state == empty_state)
- return empty_symbol;
+ return symbol_kind::S_YYEMPTY;
else
- return yystos_[+state];
+ return YY_CAST (symbol_kind_type, yystos_[+state]);
}
EvalParser::stack_symbol_type::stack_symbol_type ()
EvalParser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
: super_type (YY_MOVE (that.state), YY_MOVE (that.location))
{
- switch (that.type_get ())
+ switch (that.kind ())
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
value.YY_MOVE_OR_COPY< TokenOption::RepresentationType > (YY_MOVE (that.value));
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
value.YY_MOVE_OR_COPY< TokenPkt4::FieldType > (YY_MOVE (that.value));
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
value.YY_MOVE_OR_COPY< TokenPkt6::FieldType > (YY_MOVE (that.value));
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
value.YY_MOVE_OR_COPY< TokenPkt::MetadataType > (YY_MOVE (that.value));
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
value.YY_MOVE_OR_COPY< TokenRelay6Field::FieldType > (YY_MOVE (that.value));
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
value.YY_MOVE_OR_COPY< int8_t > (YY_MOVE (that.value));
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value));
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
value.YY_MOVE_OR_COPY< uint16_t > (YY_MOVE (that.value));
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
value.YY_MOVE_OR_COPY< uint32_t > (YY_MOVE (that.value));
break;
EvalParser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
: super_type (s, YY_MOVE (that.location))
{
- switch (that.type_get ())
+ switch (that.kind ())
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
value.move< TokenOption::RepresentationType > (YY_MOVE (that.value));
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
value.move< TokenPkt4::FieldType > (YY_MOVE (that.value));
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
value.move< TokenPkt6::FieldType > (YY_MOVE (that.value));
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
value.move< TokenPkt::MetadataType > (YY_MOVE (that.value));
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
value.move< TokenRelay6Field::FieldType > (YY_MOVE (that.value));
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
value.move< int8_t > (YY_MOVE (that.value));
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
value.move< std::string > (YY_MOVE (that.value));
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
value.move< uint16_t > (YY_MOVE (that.value));
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
value.move< uint32_t > (YY_MOVE (that.value));
break;
}
// that is emptied.
- that.type = empty_symbol;
+ that.kind_ = symbol_kind::S_YYEMPTY;
}
#if YY_CPLUSPLUS < 201103L
EvalParser::stack_symbol_type::operator= (const stack_symbol_type& that)
{
state = that.state;
- switch (that.type_get ())
+ switch (that.kind ())
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
value.copy< TokenOption::RepresentationType > (that.value);
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
value.copy< TokenPkt4::FieldType > (that.value);
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
value.copy< TokenPkt6::FieldType > (that.value);
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
value.copy< TokenPkt::MetadataType > (that.value);
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
value.copy< TokenRelay6Field::FieldType > (that.value);
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
value.copy< int8_t > (that.value);
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
value.copy< std::string > (that.value);
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
value.copy< uint16_t > (that.value);
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
value.copy< uint32_t > (that.value);
break;
EvalParser::stack_symbol_type::operator= (stack_symbol_type& that)
{
state = that.state;
- switch (that.type_get ())
+ switch (that.kind ())
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
value.move< TokenOption::RepresentationType > (that.value);
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
value.move< TokenPkt4::FieldType > (that.value);
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
value.move< TokenPkt6::FieldType > (that.value);
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
value.move< TokenPkt::MetadataType > (that.value);
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
value.move< TokenRelay6Field::FieldType > (that.value);
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
value.move< int8_t > (that.value);
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
value.move< std::string > (that.value);
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
value.move< uint16_t > (that.value);
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
value.move< uint32_t > (that.value);
break;
#if EVALDEBUG
template <typename Base>
void
- EvalParser::yy_print_ (std::ostream& yyo,
- const basic_symbol<Base>& yysym) const
+ EvalParser::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
{
std::ostream& yyoutput = yyo;
- YYUSE (yyoutput);
- symbol_number_type yytype = yysym.type_get ();
-#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408
- // Avoid a (spurious) G++ 4.8 warning about "array subscript is
- // below array bounds".
+ YY_USE (yyoutput);
if (yysym.empty ())
- std::abort ();
-#endif
- yyo << (yytype < yyntokens_ ? "token" : "nterm")
- << ' ' << yytname_[yytype] << " ("
- << yysym.location << ": ";
- switch (yytype)
+ yyo << "empty symbol";
+ else
+ {
+ symbol_kind_type yykind = yysym.kind ();
+ yyo << (yykind < YYNTOKENS ? "token" : "nterm")
+ << ' ' << yysym.name () << " ("
+ << yysym.location << ": ";
+ switch (yykind)
{
- case 57: // "constant string"
+ case symbol_kind::S_STRING: // "constant string"
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < std::string > (); }
-#line 507 "parser.cc"
+#line 464 "parser.cc"
break;
- case 58: // "integer"
+ case symbol_kind::S_INTEGER: // "integer"
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < std::string > (); }
-#line 513 "parser.cc"
+#line 470 "parser.cc"
break;
- case 59: // "constant hexstring"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < std::string > (); }
-#line 519 "parser.cc"
+#line 476 "parser.cc"
break;
- case 60: // "option name"
+ case symbol_kind::S_OPTION_NAME: // "option name"
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < std::string > (); }
-#line 525 "parser.cc"
+#line 482 "parser.cc"
break;
- case 61: // "ip address"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < std::string > (); }
-#line 531 "parser.cc"
+#line 488 "parser.cc"
break;
- case 67: // integer_expr
+ case symbol_kind::S_integer_expr: // integer_expr
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < uint32_t > (); }
-#line 537 "parser.cc"
+#line 494 "parser.cc"
break;
- case 68: // option_code
+ case symbol_kind::S_option_code: // option_code
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < uint16_t > (); }
-#line 543 "parser.cc"
+#line 500 "parser.cc"
break;
- case 69: // sub_option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < uint16_t > (); }
-#line 549 "parser.cc"
+#line 506 "parser.cc"
break;
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < TokenOption::RepresentationType > (); }
-#line 555 "parser.cc"
+#line 512 "parser.cc"
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < int8_t > (); }
-#line 561 "parser.cc"
+#line 518 "parser.cc"
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < TokenPkt::MetadataType > (); }
-#line 567 "parser.cc"
+#line 524 "parser.cc"
break;
- case 73: // enterprise_id
+ case symbol_kind::S_enterprise_id: // enterprise_id
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < uint32_t > (); }
-#line 573 "parser.cc"
+#line 530 "parser.cc"
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < TokenPkt4::FieldType > (); }
-#line 579 "parser.cc"
+#line 536 "parser.cc"
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < TokenPkt6::FieldType > (); }
-#line 585 "parser.cc"
+#line 542 "parser.cc"
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
#line 119 "parser.yy"
{ yyoutput << yysym.value.template as < TokenRelay6Field::FieldType > (); }
-#line 591 "parser.cc"
+#line 548 "parser.cc"
break;
default:
break;
}
- yyo << ')';
+ yyo << ')';
+ }
}
#endif
EvalParser::state_type
EvalParser::yy_lr_goto_state_ (state_type yystate, int yysym)
{
- int yyr = yypgoto_[yysym - yyntokens_] + yystate;
+ int yyr = yypgoto_[yysym - YYNTOKENS] + yystate;
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
return yytable_[yyr];
else
- return yydefgoto_[yysym - yyntokens_];
+ return yydefgoto_[yysym - YYNTOKENS];
}
bool
`-----------------------------------------------*/
yynewstate:
YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
+ YY_STACK_PRINT ();
// Accept?
if (yystack_[0].state == yyfinal_)
// Read a lookahead token.
if (yyla.empty ())
{
- YYCDEBUG << "Reading a token: ";
+ YYCDEBUG << "Reading a token\n";
#if YY_EXCEPTIONS
try
#endif // YY_EXCEPTIONS
}
YY_SYMBOL_PRINT ("Next token is", yyla);
+ if (yyla.kind () == symbol_kind::S_YYerror)
+ {
+ // The scanner already issued an error message, process directly
+ // to error recovery. But do not keep the error token as
+ // lookahead, it is too special and may lead us to an endless
+ // loop in error recovery. */
+ yyla.kind_ = symbol_kind::S_YYUNDEF;
+ goto yyerrlab1;
+ }
+
/* If the proper action on seeing token YYLA.TYPE is to reduce or
to detect an error, take that action. */
- yyn += yyla.type_get ();
- if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ())
+ yyn += yyla.kind ();
+ if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
{
goto yydefault;
}
when using variants. */
switch (yyr1_[yyn])
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
yylhs.value.emplace< TokenOption::RepresentationType > ();
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
yylhs.value.emplace< TokenPkt4::FieldType > ();
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
yylhs.value.emplace< TokenPkt6::FieldType > ();
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
yylhs.value.emplace< TokenPkt::MetadataType > ();
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
yylhs.value.emplace< TokenRelay6Field::FieldType > ();
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
yylhs.value.emplace< int8_t > ();
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
yylhs.value.emplace< std::string > ();
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
yylhs.value.emplace< uint16_t > ();
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
yylhs.value.emplace< uint32_t > ();
break;
{
switch (yyn)
{
- case 6:
+ case 6: // bool_expr: "not" bool_expr
#line 139 "parser.yy"
{
TokenPtr neg(new TokenNot());
ctx.expression.push_back(neg);
}
-#line 877 "parser.cc"
+#line 846 "parser.cc"
break;
- case 7:
+ case 7: // bool_expr: bool_expr "and" bool_expr
#line 144 "parser.yy"
{
TokenPtr neg(new TokenAnd());
ctx.expression.push_back(neg);
}
-#line 886 "parser.cc"
+#line 855 "parser.cc"
break;
- case 8:
+ case 8: // bool_expr: bool_expr "or" bool_expr
#line 149 "parser.yy"
{
TokenPtr neg(new TokenOr());
ctx.expression.push_back(neg);
}
-#line 895 "parser.cc"
+#line 864 "parser.cc"
break;
- case 9:
+ case 9: // bool_expr: string_expr "==" string_expr
#line 154 "parser.yy"
{
TokenPtr eq(new TokenEqual());
ctx.expression.push_back(eq);
}
-#line 904 "parser.cc"
+#line 873 "parser.cc"
break;
- case 10:
+ case 10: // bool_expr: "option" "[" option_code "]" "." "exists"
#line 159 "parser.yy"
{
TokenPtr opt(new TokenOption(yystack_[3].value.as < uint16_t > (), TokenOption::EXISTS));
ctx.expression.push_back(opt);
}
-#line 913 "parser.cc"
+#line 882 "parser.cc"
break;
- case 11:
+ case 11: // bool_expr: "option" "[" option_code "]" "." "option" "[" sub_option_code "]" "." "exists"
#line 164 "parser.yy"
{
TokenPtr opt(new TokenSubOption(yystack_[8].value.as < uint16_t > (), yystack_[3].value.as < uint16_t > (), TokenOption::EXISTS));
ctx.expression.push_back(opt);
}
-#line 922 "parser.cc"
+#line 891 "parser.cc"
break;
- case 12:
+ case 12: // bool_expr: "relay4" "[" sub_option_code "]" "." "exists"
#line 169 "parser.yy"
{
switch (ctx.getUniverse()) {
error(yystack_[5].location, "relay4 can only be used in DHCPv4.");
}
}
-#line 946 "parser.cc"
+#line 915 "parser.cc"
break;
- case 13:
+ case 13: // bool_expr: "relay6" "[" nest_level "]" "." "option" "[" sub_option_code "]" "." "exists"
#line 189 "parser.yy"
{
switch (ctx.getUniverse()) {
error(yystack_[10].location, "relay6 can only be used in DHCPv6.");
}
}
-#line 964 "parser.cc"
+#line 933 "parser.cc"
break;
- case 14:
+ case 14: // bool_expr: "vendor-class" "[" enterprise_id "]" "." "exists"
#line 203 "parser.yy"
{
// Expression: vendor-class[1234].exists
TokenPtr exist(new TokenVendorClass(ctx.getUniverse(), yystack_[3].value.as < uint32_t > (), TokenOption::EXISTS));
ctx.expression.push_back(exist);
}
-#line 977 "parser.cc"
+#line 946 "parser.cc"
break;
- case 15:
+ case 15: // bool_expr: "vendor" "[" enterprise_id "]" "." "exists"
#line 212 "parser.yy"
{
// Expression: vendor[1234].exists
TokenPtr exist(new TokenVendor(ctx.getUniverse(), yystack_[3].value.as < uint32_t > (), TokenOption::EXISTS));
ctx.expression.push_back(exist);
}
-#line 990 "parser.cc"
+#line 959 "parser.cc"
break;
- case 16:
+ case 16: // bool_expr: "vendor" "[" enterprise_id "]" "." "option" "[" sub_option_code "]" "." "exists"
#line 221 "parser.yy"
{
// Expression vendor[1234].option[123].exists
TokenPtr exist(new TokenVendor(ctx.getUniverse(), yystack_[8].value.as < uint32_t > (), TokenOption::EXISTS, yystack_[3].value.as < uint16_t > ()));
ctx.expression.push_back(exist);
}
-#line 1004 "parser.cc"
+#line 973 "parser.cc"
break;
- case 17:
+ case 17: // bool_expr: "member" "(" "constant string" ")"
#line 231 "parser.yy"
{
// Expression member('foo')
TokenPtr member(new TokenMember(cc));
ctx.expression.push_back(member);
}
-#line 1023 "parser.cc"
+#line 992 "parser.cc"
break;
- case 18:
+ case 18: // string_expr: "constant string"
#line 248 "parser.yy"
{
TokenPtr str(new TokenString(yystack_[0].value.as < std::string > ()));
ctx.expression.push_back(str);
}
-#line 1032 "parser.cc"
+#line 1001 "parser.cc"
break;
- case 19:
+ case 19: // string_expr: "constant hexstring"
#line 253 "parser.yy"
{
TokenPtr hex(new TokenHexString(yystack_[0].value.as < std::string > ()));
ctx.expression.push_back(hex);
}
-#line 1041 "parser.cc"
+#line 1010 "parser.cc"
break;
- case 20:
+ case 20: // string_expr: "ip address"
#line 258 "parser.yy"
{
TokenPtr ip(new TokenIpAddress(yystack_[0].value.as < std::string > ()));
ctx.expression.push_back(ip);
}
-#line 1050 "parser.cc"
+#line 1019 "parser.cc"
break;
- case 21:
+ case 21: // string_expr: "option" "[" option_code "]" "." option_repr_type
#line 263 "parser.yy"
{
TokenPtr opt(new TokenOption(yystack_[3].value.as < uint16_t > (), yystack_[0].value.as < TokenOption::RepresentationType > ()));
ctx.expression.push_back(opt);
}
-#line 1059 "parser.cc"
+#line 1028 "parser.cc"
break;
- case 22:
+ case 22: // string_expr: "option" "[" option_code "]" "." "option" "[" sub_option_code "]" "." option_repr_type
#line 268 "parser.yy"
{
TokenPtr opt(new TokenSubOption(yystack_[8].value.as < uint16_t > (), yystack_[3].value.as < uint16_t > (), yystack_[0].value.as < TokenOption::RepresentationType > ()));
ctx.expression.push_back(opt);
}
-#line 1068 "parser.cc"
+#line 1037 "parser.cc"
break;
- case 23:
+ case 23: // string_expr: "relay4" "[" sub_option_code "]" "." option_repr_type
#line 273 "parser.yy"
{
switch (ctx.getUniverse()) {
error(yystack_[5].location, "relay4 can only be used in DHCPv4.");
}
}
-#line 1092 "parser.cc"
+#line 1061 "parser.cc"
break;
- case 24:
+ case 24: // string_expr: "relay6" "[" nest_level "]" "." "option" "[" sub_option_code "]" "." option_repr_type
#line 294 "parser.yy"
{
switch (ctx.getUniverse()) {
error(yystack_[10].location, "relay6 can only be used in DHCPv6.");
}
}
-#line 1110 "parser.cc"
+#line 1079 "parser.cc"
break;
- case 25:
+ case 25: // string_expr: "pkt" "." pkt_metadata
#line 309 "parser.yy"
{
TokenPtr pkt_metadata(new TokenPkt(yystack_[0].value.as < TokenPkt::MetadataType > ()));
ctx.expression.push_back(pkt_metadata);
}
-#line 1119 "parser.cc"
+#line 1088 "parser.cc"
break;
- case 26:
+ case 26: // string_expr: "pkt4" "." pkt4_field
#line 314 "parser.yy"
{
switch (ctx.getUniverse()) {
error(yystack_[2].location, "pkt4 can only be used in DHCPv4.");
}
}
-#line 1137 "parser.cc"
+#line 1106 "parser.cc"
break;
- case 27:
+ case 27: // string_expr: "pkt6" "." pkt6_field
#line 328 "parser.yy"
{
switch (ctx.getUniverse()) {
error(yystack_[2].location, "pkt6 can only be used in DHCPv6.");
}
}
-#line 1155 "parser.cc"
+#line 1124 "parser.cc"
break;
- case 28:
+ case 28: // string_expr: "relay6" "[" nest_level "]" "." relay6_field
#line 342 "parser.yy"
{
switch (ctx.getUniverse()) {
error(yystack_[5].location, "relay6 can only be used in DHCPv6.");
}
}
-#line 1173 "parser.cc"
+#line 1142 "parser.cc"
break;
- case 29:
+ case 29: // string_expr: "substring" "(" string_expr "," start_expr "," length_expr ")"
#line 357 "parser.yy"
{
TokenPtr sub(new TokenSubstring());
ctx.expression.push_back(sub);
}
-#line 1182 "parser.cc"
+#line 1151 "parser.cc"
break;
- case 30:
+ case 30: // string_expr: "concat" "(" string_expr "," string_expr ")"
#line 362 "parser.yy"
{
TokenPtr conc(new TokenConcat());
ctx.expression.push_back(conc);
}
-#line 1191 "parser.cc"
+#line 1160 "parser.cc"
break;
- case 31:
+ case 31: // string_expr: "ifelse" "(" bool_expr "," string_expr "," string_expr ")"
#line 367 "parser.yy"
{
TokenPtr cond(new TokenIfElse());
ctx.expression.push_back(cond);
}
-#line 1200 "parser.cc"
+#line 1169 "parser.cc"
break;
- case 32:
+ case 32: // string_expr: "hexstring" "(" string_expr "," string_expr ")"
#line 372 "parser.yy"
{
TokenPtr tohex(new TokenToHexString());
ctx.expression.push_back(tohex);
}
-#line 1209 "parser.cc"
+#line 1178 "parser.cc"
break;
- case 33:
+ case 33: // string_expr: "addrtotext" "(" string_expr ")"
#line 377 "parser.yy"
{
TokenPtr addrtotext(new TokenIpAddressToText());
ctx.expression.push_back(addrtotext);
}
-#line 1218 "parser.cc"
+#line 1187 "parser.cc"
break;
- case 34:
+ case 34: // string_expr: "int8totext" "(" string_expr ")"
#line 382 "parser.yy"
{
TokenPtr int8totext(new TokenInt8ToText());
ctx.expression.push_back(int8totext);
}
-#line 1227 "parser.cc"
+#line 1196 "parser.cc"
break;
- case 35:
+ case 35: // string_expr: "int16totext" "(" string_expr ")"
#line 387 "parser.yy"
{
TokenPtr int16totext(new TokenInt16ToText());
ctx.expression.push_back(int16totext);
}
-#line 1236 "parser.cc"
+#line 1205 "parser.cc"
break;
- case 36:
+ case 36: // string_expr: "int32totext" "(" string_expr ")"
#line 392 "parser.yy"
{
TokenPtr int32totext(new TokenInt32ToText());
ctx.expression.push_back(int32totext);
}
-#line 1245 "parser.cc"
+#line 1214 "parser.cc"
break;
- case 37:
+ case 37: // string_expr: "uint8totext" "(" string_expr ")"
#line 397 "parser.yy"
{
TokenPtr uint8totext(new TokenUInt8ToText());
ctx.expression.push_back(uint8totext);
}
-#line 1254 "parser.cc"
+#line 1223 "parser.cc"
break;
- case 38:
+ case 38: // string_expr: "uint16totext" "(" string_expr ")"
#line 402 "parser.yy"
{
TokenPtr uint16totext(new TokenUInt16ToText());
ctx.expression.push_back(uint16totext);
}
-#line 1263 "parser.cc"
+#line 1232 "parser.cc"
break;
- case 39:
+ case 39: // string_expr: "uint32totext" "(" string_expr ")"
#line 407 "parser.yy"
{
TokenPtr uint32totext(new TokenUInt32ToText());
ctx.expression.push_back(uint32totext);
}
-#line 1272 "parser.cc"
+#line 1241 "parser.cc"
break;
- case 40:
+ case 40: // string_expr: "vendor" "." "enterprise"
#line 412 "parser.yy"
{
// expression: vendor.enterprise
TokenPtr vendor(new TokenVendor(ctx.getUniverse(), 0, TokenVendor::ENTERPRISE_ID));
ctx.expression.push_back(vendor);
}
-#line 1285 "parser.cc"
+#line 1254 "parser.cc"
break;
- case 41:
+ case 41: // string_expr: "vendor-class" "." "enterprise"
#line 421 "parser.yy"
{
// expression: vendor-class.enterprise
TokenVendor::ENTERPRISE_ID));
ctx.expression.push_back(vendor);
}
-#line 1299 "parser.cc"
+#line 1268 "parser.cc"
break;
- case 42:
+ case 42: // string_expr: "vendor" "[" enterprise_id "]" "." "option" "[" sub_option_code "]" "." option_repr_type
#line 431 "parser.yy"
{
// This token will search for vendor option with
TokenPtr opt(new TokenVendor(ctx.getUniverse(), yystack_[8].value.as < uint32_t > (), yystack_[0].value.as < TokenOption::RepresentationType > (), yystack_[3].value.as < uint16_t > ()));
ctx.expression.push_back(opt);
}
-#line 1312 "parser.cc"
+#line 1281 "parser.cc"
break;
- case 43:
+ case 43: // string_expr: "vendor-class" "[" enterprise_id "]" "." "data"
#line 440 "parser.yy"
{
// expression: vendor-class[1234].data
TokenVendor::DATA, 0));
ctx.expression.push_back(vendor_class);
}
-#line 1329 "parser.cc"
+#line 1298 "parser.cc"
break;
- case 44:
+ case 44: // string_expr: "vendor-class" "[" enterprise_id "]" "." "data" "[" "integer" "]"
#line 453 "parser.yy"
{
// expression: vendor-class[1234].data[5]
TokenVendor::DATA, index));
ctx.expression.push_back(vendor_class);
}
-#line 1346 "parser.cc"
+#line 1315 "parser.cc"
break;
- case 45:
+ case 45: // string_expr: integer_expr
#line 466 "parser.yy"
{
TokenPtr integer(new TokenInteger(yystack_[0].value.as < uint32_t > ()));
ctx.expression.push_back(integer);
}
-#line 1355 "parser.cc"
+#line 1324 "parser.cc"
break;
- case 46:
+ case 46: // integer_expr: "integer"
#line 473 "parser.yy"
{
yylhs.value.as < uint32_t > () = ctx.convertUint32(yystack_[0].value.as < std::string > (), yystack_[0].location);
}
-#line 1363 "parser.cc"
+#line 1332 "parser.cc"
break;
- case 47:
+ case 47: // option_code: "integer"
#line 479 "parser.yy"
{
yylhs.value.as < uint16_t > () = ctx.convertOptionCode(yystack_[0].value.as < std::string > (), yystack_[0].location);
}
-#line 1371 "parser.cc"
+#line 1340 "parser.cc"
break;
- case 48:
+ case 48: // option_code: "option name"
#line 483 "parser.yy"
{
yylhs.value.as < uint16_t > () = ctx.convertOptionName(yystack_[0].value.as < std::string > (), yystack_[0].location);
}
-#line 1379 "parser.cc"
+#line 1348 "parser.cc"
break;
- case 49:
+ case 49: // sub_option_code: "integer"
#line 489 "parser.yy"
{
yylhs.value.as < uint16_t > () = ctx.convertOptionCode(yystack_[0].value.as < std::string > (), yystack_[0].location);
}
-#line 1387 "parser.cc"
+#line 1356 "parser.cc"
break;
- case 50:
+ case 50: // option_repr_type: "text"
#line 495 "parser.yy"
{
yylhs.value.as < TokenOption::RepresentationType > () = TokenOption::TEXTUAL;
}
-#line 1395 "parser.cc"
+#line 1364 "parser.cc"
break;
- case 51:
+ case 51: // option_repr_type: "hex"
#line 499 "parser.yy"
{
yylhs.value.as < TokenOption::RepresentationType > () = TokenOption::HEXADECIMAL;
}
-#line 1403 "parser.cc"
+#line 1372 "parser.cc"
break;
- case 52:
+ case 52: // nest_level: "integer"
#line 505 "parser.yy"
{
yylhs.value.as < int8_t > () = ctx.convertNestLevelNumber(yystack_[0].value.as < std::string > (), yystack_[0].location);
}
-#line 1411 "parser.cc"
+#line 1380 "parser.cc"
break;
- case 53:
+ case 53: // pkt_metadata: "iface"
#line 514 "parser.yy"
{
yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::IFACE;
}
-#line 1419 "parser.cc"
+#line 1388 "parser.cc"
break;
- case 54:
+ case 54: // pkt_metadata: "src"
#line 518 "parser.yy"
{
yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::SRC;
}
-#line 1427 "parser.cc"
+#line 1396 "parser.cc"
break;
- case 55:
+ case 55: // pkt_metadata: "dst"
#line 522 "parser.yy"
{
yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::DST;
}
-#line 1435 "parser.cc"
+#line 1404 "parser.cc"
break;
- case 56:
+ case 56: // pkt_metadata: "len"
#line 526 "parser.yy"
{
yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::LEN;
}
-#line 1443 "parser.cc"
+#line 1412 "parser.cc"
break;
- case 57:
+ case 57: // enterprise_id: "integer"
#line 532 "parser.yy"
{
yylhs.value.as < uint32_t > () = ctx.convertUint32(yystack_[0].value.as < std::string > (), yystack_[0].location);
}
-#line 1451 "parser.cc"
+#line 1420 "parser.cc"
break;
- case 58:
+ case 58: // enterprise_id: "*"
#line 536 "parser.yy"
{
yylhs.value.as < uint32_t > () = 0;
}
-#line 1459 "parser.cc"
+#line 1428 "parser.cc"
break;
- case 59:
+ case 59: // pkt4_field: "mac"
#line 542 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::CHADDR;
}
-#line 1467 "parser.cc"
+#line 1436 "parser.cc"
break;
- case 60:
+ case 60: // pkt4_field: "hlen"
#line 546 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::HLEN;
}
-#line 1475 "parser.cc"
+#line 1444 "parser.cc"
break;
- case 61:
+ case 61: // pkt4_field: "htype"
#line 550 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::HTYPE;
}
-#line 1483 "parser.cc"
+#line 1452 "parser.cc"
break;
- case 62:
+ case 62: // pkt4_field: "ciaddr"
#line 554 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::CIADDR;
}
-#line 1491 "parser.cc"
+#line 1460 "parser.cc"
break;
- case 63:
+ case 63: // pkt4_field: "giaddr"
#line 558 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::GIADDR;
}
-#line 1499 "parser.cc"
+#line 1468 "parser.cc"
break;
- case 64:
+ case 64: // pkt4_field: "yiaddr"
#line 562 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::YIADDR;
}
-#line 1507 "parser.cc"
+#line 1476 "parser.cc"
break;
- case 65:
+ case 65: // pkt4_field: "siaddr"
#line 566 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::SIADDR;
}
-#line 1515 "parser.cc"
+#line 1484 "parser.cc"
break;
- case 66:
+ case 66: // pkt4_field: "msgtype"
#line 570 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::MSGTYPE;
}
-#line 1523 "parser.cc"
+#line 1492 "parser.cc"
break;
- case 67:
+ case 67: // pkt4_field: "transid"
#line 574 "parser.yy"
{
yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::TRANSID;
}
-#line 1531 "parser.cc"
+#line 1500 "parser.cc"
break;
- case 68:
+ case 68: // pkt6_field: "msgtype"
#line 580 "parser.yy"
{
yylhs.value.as < TokenPkt6::FieldType > () = TokenPkt6::MSGTYPE;
}
-#line 1539 "parser.cc"
+#line 1508 "parser.cc"
break;
- case 69:
+ case 69: // pkt6_field: "transid"
#line 584 "parser.yy"
{
yylhs.value.as < TokenPkt6::FieldType > () = TokenPkt6::TRANSID;
}
-#line 1547 "parser.cc"
+#line 1516 "parser.cc"
break;
- case 70:
+ case 70: // relay6_field: "peeraddr"
#line 590 "parser.yy"
{
yylhs.value.as < TokenRelay6Field::FieldType > () = TokenRelay6Field::PEERADDR;
}
-#line 1555 "parser.cc"
+#line 1524 "parser.cc"
break;
- case 71:
+ case 71: // relay6_field: "linkaddr"
#line 594 "parser.yy"
{
yylhs.value.as < TokenRelay6Field::FieldType > () = TokenRelay6Field::LINKADDR;
}
-#line 1563 "parser.cc"
+#line 1532 "parser.cc"
break;
- case 72:
+ case 72: // start_expr: "integer"
#line 600 "parser.yy"
{
TokenPtr str(new TokenString(yystack_[0].value.as < std::string > ()));
ctx.expression.push_back(str);
}
-#line 1572 "parser.cc"
+#line 1541 "parser.cc"
break;
- case 73:
+ case 73: // length_expr: "integer"
#line 607 "parser.yy"
{
TokenPtr str(new TokenString(yystack_[0].value.as < std::string > ()));
ctx.expression.push_back(str);
}
-#line 1581 "parser.cc"
+#line 1550 "parser.cc"
break;
- case 74:
+ case 74: // length_expr: "all"
#line 612 "parser.yy"
{
TokenPtr str(new TokenString("all"));
ctx.expression.push_back(str);
}
-#line 1590 "parser.cc"
+#line 1559 "parser.cc"
break;
-#line 1594 "parser.cc"
+#line 1563 "parser.cc"
default:
break;
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
yypop_ (yylen);
yylen = 0;
- YY_STACK_PRINT ();
// Shift the result of the reduction.
yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
if (!yyerrstatus_)
{
++yynerrs_;
- error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla));
+ context yyctx (*this, yyla);
+ std::string msg = yysyntax_error_ (yyctx);
+ error (yyla.location, YY_MOVE (msg));
}
error, discard it. */
// Return failure if at end of input.
- if (yyla.type_get () == yyeof_)
+ if (yyla.kind () == symbol_kind::S_YYEOF)
YYABORT;
else if (!yyla.empty ())
{
this YYERROR. */
yypop_ (yylen);
yylen = 0;
+ YY_STACK_PRINT ();
goto yyerrlab1;
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus_ = 3; // Each real token shifted decrements this.
- {
- stack_symbol_type error_token;
- for (;;)
- {
- yyn = yypact_[+yystack_[0].state];
- if (!yy_pact_value_is_default_ (yyn))
- {
- yyn += yy_error_token_;
- if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
- {
- yyn = yytable_[yyn];
- if (0 < yyn)
- break;
- }
- }
+ // Pop stack until we find a state that shifts the error token.
+ for (;;)
+ {
+ yyn = yypact_[+yystack_[0].state];
+ if (!yy_pact_value_is_default_ (yyn))
+ {
+ yyn += symbol_kind::S_YYerror;
+ if (0 <= yyn && yyn <= yylast_
+ && yycheck_[yyn] == symbol_kind::S_YYerror)
+ {
+ yyn = yytable_[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
- // Pop the current state because it cannot handle the error token.
- if (yystack_.size () == 1)
- YYABORT;
+ // Pop the current state because it cannot handle the error token.
+ if (yystack_.size () == 1)
+ YYABORT;
- yyerror_range[1].location = yystack_[0].location;
- yy_destroy_ ("Error: popping", yystack_[0]);
- yypop_ ();
- YY_STACK_PRINT ();
- }
+ yyerror_range[1].location = yystack_[0].location;
+ yy_destroy_ ("Error: popping", yystack_[0]);
+ yypop_ ();
+ YY_STACK_PRINT ();
+ }
+ {
+ stack_symbol_type error_token;
yyerror_range[2].location = yyla.location;
YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);
/* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
yypop_ (yylen);
+ YY_STACK_PRINT ();
while (1 < yystack_.size ())
{
yy_destroy_ ("Cleanup: popping", yystack_[0]);
error (yyexc.location, yyexc.what ());
}
- // Generate an error message.
+ /* Return YYSTR after stripping away unnecessary quotes and
+ backslashes, so that it's suitable for yyerror. The heuristic is
+ that double-quoting is unnecessary unless the string contains an
+ apostrophe, a comma, or backslash (other than backslash-backslash).
+ YYSTR is taken from yytname. */
std::string
- EvalParser::yysyntax_error_ (state_type yystate, const symbol_type& yyla) const
+ EvalParser::yytnamerr_ (const char *yystr)
{
- // Number of reported tokens (one for the "unexpected", one per
- // "expected").
- std::ptrdiff_t yycount = 0;
- // Its maximum.
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- // Arguments of yyformat.
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ if (*yystr == '"')
+ {
+ std::string yyr;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ else
+ goto append;
+
+ append:
+ default:
+ yyr += *yyp;
+ break;
+
+ case '"':
+ return yyr;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ return yystr;
+ }
+
+ std::string
+ EvalParser::symbol_name (symbol_kind_type yysymbol)
+ {
+ return yytnamerr_ (yytname_[yysymbol]);
+ }
+
+
+ // EvalParser::context.
+ EvalParser::context::context (const EvalParser& yyparser, const symbol_type& yyla)
+ : yyparser_ (yyparser)
+ , yyla_ (yyla)
+ {}
+
+ int
+ EvalParser::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const
+ {
+ // Actual number of expected tokens
+ int yycount = 0;
+
+ int yyn = yypact_[+yyparser_.yystack_[0].state];
+ if (!yy_pact_value_is_default_ (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ // Stay within bounds of both yycheck and yytname.
+ int yychecklim = yylast_ - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::S_YYerror
+ && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
+ {
+ if (!yyarg)
+ ++yycount;
+ else if (yycount == yyargn)
+ return 0;
+ else
+ yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
+ }
+ }
+
+ if (yyarg && yycount == 0 && 0 < yyargn)
+ yyarg[0] = symbol_kind::S_YYEMPTY;
+ return yycount;
+ }
+
+
+
+ int
+ EvalParser::yy_syntax_error_arguments_ (const context& yyctx,
+ symbol_kind_type yyarg[], int yyargn) const
+ {
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
- if (!yyla.empty ())
- {
- symbol_number_type yytoken = yyla.type_get ();
- yyarg[yycount++] = yytname_[yytoken];
- int yyn = yypact_[+yystate];
- if (!yy_pact_value_is_default_ (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- // Stay within bounds of both yycheck and yytname.
- int yychecklim = yylast_ - yyn + 1;
- int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
- for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck_[yyx + yyn] == yyx && yyx != yy_error_token_
- && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- break;
- }
- else
- yyarg[yycount++] = yytname_[yyx];
- }
- }
+ if (!yyctx.lookahead ().empty ())
+ {
+ if (yyarg)
+ yyarg[0] = yyctx.token ();
+ int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
+ return yyn + 1;
}
+ return 0;
+ }
+
+ // Generate an error message.
+ std::string
+ EvalParser::yysyntax_error_ (const context& yyctx) const
+ {
+ // Its maximum.
+ enum { YYARGS_MAX = 5 };
+ // Arguments of yyformat.
+ symbol_kind_type yyarg[YYARGS_MAX];
+ int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
char const* yyformat = YY_NULLPTR;
switch (yycount)
for (char const* yyp = yyformat; *yyp; ++yyp)
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
{
- yyres += yytnamerr_ (yyarg[yyi++]);
+ yyres += symbol_name (yyarg[yyi++]);
++yyp;
}
else
-146, -30, -146, -146, -146, -146, -146
};
- const short
+ const unsigned char
EvalParser::yydefgoto_[] =
{
- -1, 3, 30, 31, 32, 33, 76, 78, 166, 80,
+ 0, 3, 30, 31, 32, 33, 76, 78, 166, 80,
86, 113, 96, 110, 172, 151, 188
};
};
-
+#if EVALDEBUG || 1
// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- // First, the terminals, then, starting at \a yyntokens_, nonterminals.
+ // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
const char*
const EvalParser::yytname_[] =
{
- "\"end of file\"", "error", "$undefined", "\"(\"", "\")\"", "\"not\"",
- "\"and\"", "\"or\"", "\"==\"", "\"option\"", "\"relay4\"", "\"relay6\"",
- "\"member\"", "\"peeraddr\"", "\"linkaddr\"", "\"[\"", "\"]\"", "\".\"",
- "\"text\"", "\"hex\"", "\"exists\"", "\"pkt\"", "\"iface\"", "\"src\"",
- "\"dst\"", "\"len\"", "\"pkt4\"", "\"mac\"", "\"hlen\"", "\"htype\"",
- "\"ciaddr\"", "\"giaddr\"", "\"yiaddr\"", "\"siaddr\"", "\"substring\"",
- "\"all\"", "\",\"", "\"concat\"", "\"ifelse\"", "\"hexstring\"",
- "\"addrtotext\"", "\"int8totext\"", "\"int16totext\"", "\"int32totext\"",
- "\"uint8totext\"", "\"uint16totext\"", "\"uint32totext\"", "\"pkt6\"",
- "\"msgtype\"", "\"transid\"", "\"vendor-class\"", "\"vendor\"", "\"*\"",
- "\"data\"", "\"enterprise\"", "\"top-level bool\"",
- "\"top-level string\"", "\"constant string\"", "\"integer\"",
- "\"constant hexstring\"", "\"option name\"", "\"ip address\"", "$accept",
- "start", "expression", "bool_expr", "string_expr", "integer_expr",
- "option_code", "sub_option_code", "option_repr_type", "nest_level",
- "pkt_metadata", "enterprise_id", "pkt4_field", "pkt6_field",
- "relay6_field", "start_expr", "length_expr", YY_NULLPTR
+ "\"end of file\"", "error", "\"invalid token\"", "\"(\"", "\")\"",
+ "\"not\"", "\"and\"", "\"or\"", "\"==\"", "\"option\"", "\"relay4\"",
+ "\"relay6\"", "\"member\"", "\"peeraddr\"", "\"linkaddr\"", "\"[\"",
+ "\"]\"", "\".\"", "\"text\"", "\"hex\"", "\"exists\"", "\"pkt\"",
+ "\"iface\"", "\"src\"", "\"dst\"", "\"len\"", "\"pkt4\"", "\"mac\"",
+ "\"hlen\"", "\"htype\"", "\"ciaddr\"", "\"giaddr\"", "\"yiaddr\"",
+ "\"siaddr\"", "\"substring\"", "\"all\"", "\",\"", "\"concat\"",
+ "\"ifelse\"", "\"hexstring\"", "\"addrtotext\"", "\"int8totext\"",
+ "\"int16totext\"", "\"int32totext\"", "\"uint8totext\"",
+ "\"uint16totext\"", "\"uint32totext\"", "\"pkt6\"", "\"msgtype\"",
+ "\"transid\"", "\"vendor-class\"", "\"vendor\"", "\"*\"", "\"data\"",
+ "\"enterprise\"", "\"top-level bool\"", "\"top-level string\"",
+ "\"constant string\"", "\"integer\"", "\"constant hexstring\"",
+ "\"option name\"", "\"ip address\"", "$accept", "start", "expression",
+ "bool_expr", "string_expr", "integer_expr", "option_code",
+ "sub_option_code", "option_repr_type", "nest_level", "pkt_metadata",
+ "enterprise_id", "pkt4_field", "pkt6_field", "relay6_field",
+ "start_expr", "length_expr", YY_NULLPTR
};
+#endif
+
#if EVALDEBUG
const short
589, 593, 599, 606, 611
};
- // Print the state stack on the debug stream.
void
- EvalParser::yystack_print_ ()
+ EvalParser::yy_stack_print_ () const
{
*yycdebug_ << "Stack now";
for (stack_type::const_iterator
*yycdebug_ << '\n';
}
- // Report on the debug stream that the rule \a yyrule is going to be reduced.
void
- EvalParser::yy_reduce_print_ (int yyrule)
+ EvalParser::yy_reduce_print_ (int yyrule) const
{
int yylno = yyrline_[yyrule];
int yynrhs = yyr2_[yyrule];
#line 14 "parser.yy"
} } // isc::eval
-#line 2127 "parser.cc"
+#line 2175 "parser.cc"
#line 618 "parser.yy"
-// A Bison parser, made by GNU Bison 3.5.1.
+// A Bison parser, made by GNU Bison 3.7.5.
// Skeleton interface for Bison LALR(1) parsers in C++
-// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
+// Copyright (C) 2002-2015, 2018-2021 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
// C++ LALR(1) parser skeleton written by Akim Demaille.
-// Undocumented macros, especially those whose name start with YY_,
-// are private implementation details. Do not rely on them.
+// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+// especially those whose name start with YY_ or yy_. They are
+// private implementation details that can be changed or removed.
#ifndef YY_EVAL_PARSER_H_INCLUDED
# define YY_EVAL_PARSER_H_INCLUDED
using namespace isc::dhcp;
using namespace isc::eval;
-#line 59 "parser.h"
+#line 60 "parser.h"
# include <cassert>
# include <cstdlib> // std::abort
#endif
# include "location.hh"
#include <typeinfo>
-#ifndef YY_ASSERT
+#ifndef EVAL_ASSERT
# include <cassert>
-# define YY_ASSERT assert
+# define EVAL_ASSERT assert
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YY_USE(E) ((void) (E))
#else
-# define YYUSE(E) /* empty */
+# define YY_USE(E) /* empty */
#endif
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
#line 14 "parser.yy"
namespace isc { namespace eval {
-#line 202 "parser.h"
+#line 203 "parser.h"
semantic_type (YY_RVREF (T) t)
: yytypeid_ (&typeid (T))
{
- YY_ASSERT (sizeof (T) <= size);
+ EVAL_ASSERT (sizeof (T) <= size);
new (yyas_<T> ()) T (YY_MOVE (t));
}
+#if 201103L <= YY_CPLUSPLUS
+ /// Non copyable.
+ semantic_type (const self_type&) = delete;
+ /// Non copyable.
+ self_type& operator= (const self_type&) = delete;
+#endif
+
/// Destruction, allowed only if empty.
~semantic_type () YY_NOEXCEPT
{
- YY_ASSERT (!yytypeid_);
+ EVAL_ASSERT (!yytypeid_);
}
# if 201103L <= YY_CPLUSPLUS
T&
emplace (U&&... u)
{
- YY_ASSERT (!yytypeid_);
- YY_ASSERT (sizeof (T) <= size);
+ EVAL_ASSERT (!yytypeid_);
+ EVAL_ASSERT (sizeof (T) <= size);
yytypeid_ = & typeid (T);
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
}
T&
emplace ()
{
- YY_ASSERT (!yytypeid_);
- YY_ASSERT (sizeof (T) <= size);
+ EVAL_ASSERT (!yytypeid_);
+ EVAL_ASSERT (sizeof (T) <= size);
yytypeid_ = & typeid (T);
return *new (yyas_<T> ()) T ();
}
T&
emplace (const T& t)
{
- YY_ASSERT (!yytypeid_);
- YY_ASSERT (sizeof (T) <= size);
+ EVAL_ASSERT (!yytypeid_);
+ EVAL_ASSERT (sizeof (T) <= size);
yytypeid_ = & typeid (T);
return *new (yyas_<T> ()) T (t);
}
T&
as () YY_NOEXCEPT
{
- YY_ASSERT (yytypeid_);
- YY_ASSERT (*yytypeid_ == typeid (T));
- YY_ASSERT (sizeof (T) <= size);
+ EVAL_ASSERT (yytypeid_);
+ EVAL_ASSERT (*yytypeid_ == typeid (T));
+ EVAL_ASSERT (sizeof (T) <= size);
return *yyas_<T> ();
}
const T&
as () const YY_NOEXCEPT
{
- YY_ASSERT (yytypeid_);
- YY_ASSERT (*yytypeid_ == typeid (T));
- YY_ASSERT (sizeof (T) <= size);
+ EVAL_ASSERT (yytypeid_);
+ EVAL_ASSERT (*yytypeid_ == typeid (T));
+ EVAL_ASSERT (sizeof (T) <= size);
return *yyas_<T> ();
}
void
swap (self_type& that) YY_NOEXCEPT
{
- YY_ASSERT (yytypeid_);
- YY_ASSERT (*yytypeid_ == *that.yytypeid_);
+ EVAL_ASSERT (yytypeid_);
+ EVAL_ASSERT (*yytypeid_ == *that.yytypeid_);
std::swap (as<T> (), that.as<T> ());
}
}
private:
- /// Prohibit blind copies.
- self_type& operator= (const self_type&);
+#if YY_CPLUSPLUS < 201103L
+ /// Non copyable.
semantic_type (const self_type&);
+ /// Non copyable.
+ self_type& operator= (const self_type&);
+#endif
/// Accessor to raw memory as \a T.
template <typename T>
location_type location;
};
- /// Tokens.
+ /// Token kinds.
struct token
{
- enum yytokentype
- {
- TOKEN_END = 0,
- TOKEN_LPAREN = 258,
- TOKEN_RPAREN = 259,
- TOKEN_NOT = 260,
- TOKEN_AND = 261,
- TOKEN_OR = 262,
- TOKEN_EQUAL = 263,
- TOKEN_OPTION = 264,
- TOKEN_RELAY4 = 265,
- TOKEN_RELAY6 = 266,
- TOKEN_MEMBER = 267,
- TOKEN_PEERADDR = 268,
- TOKEN_LINKADDR = 269,
- TOKEN_LBRACKET = 270,
- TOKEN_RBRACKET = 271,
- TOKEN_DOT = 272,
- TOKEN_TEXT = 273,
- TOKEN_HEX = 274,
- TOKEN_EXISTS = 275,
- TOKEN_PKT = 276,
- TOKEN_IFACE = 277,
- TOKEN_SRC = 278,
- TOKEN_DST = 279,
- TOKEN_LEN = 280,
- TOKEN_PKT4 = 281,
- TOKEN_CHADDR = 282,
- TOKEN_HLEN = 283,
- TOKEN_HTYPE = 284,
- TOKEN_CIADDR = 285,
- TOKEN_GIADDR = 286,
- TOKEN_YIADDR = 287,
- TOKEN_SIADDR = 288,
- TOKEN_SUBSTRING = 289,
- TOKEN_ALL = 290,
- TOKEN_COMA = 291,
- TOKEN_CONCAT = 292,
- TOKEN_IFELSE = 293,
- TOKEN_TOHEXSTRING = 294,
- TOKEN_ADDRTOTEXT = 295,
- TOKEN_INT8TOTEXT = 296,
- TOKEN_INT16TOTEXT = 297,
- TOKEN_INT32TOTEXT = 298,
- TOKEN_UINT8TOTEXT = 299,
- TOKEN_UINT16TOTEXT = 300,
- TOKEN_UINT32TOTEXT = 301,
- TOKEN_PKT6 = 302,
- TOKEN_MSGTYPE = 303,
- TOKEN_TRANSID = 304,
- TOKEN_VENDOR_CLASS = 305,
- TOKEN_VENDOR = 306,
- TOKEN_ANY = 307,
- TOKEN_DATA = 308,
- TOKEN_ENTERPRISE = 309,
- TOKEN_TOPLEVEL_BOOL = 310,
- TOKEN_TOPLEVEL_STRING = 311,
- TOKEN_STRING = 312,
- TOKEN_INTEGER = 313,
- TOKEN_HEXSTRING = 314,
- TOKEN_OPTION_NAME = 315,
- TOKEN_IP_ADDRESS = 316
+ enum token_kind_type
+ {
+ TOKEN_EVALEMPTY = -2,
+ TOKEN_END = 0, // "end of file"
+ TOKEN_EVALerror = 256, // error
+ TOKEN_EVALUNDEF = 257, // "invalid token"
+ TOKEN_LPAREN = 258, // "("
+ TOKEN_RPAREN = 259, // ")"
+ TOKEN_NOT = 260, // "not"
+ TOKEN_AND = 261, // "and"
+ TOKEN_OR = 262, // "or"
+ TOKEN_EQUAL = 263, // "=="
+ TOKEN_OPTION = 264, // "option"
+ TOKEN_RELAY4 = 265, // "relay4"
+ TOKEN_RELAY6 = 266, // "relay6"
+ TOKEN_MEMBER = 267, // "member"
+ TOKEN_PEERADDR = 268, // "peeraddr"
+ TOKEN_LINKADDR = 269, // "linkaddr"
+ TOKEN_LBRACKET = 270, // "["
+ TOKEN_RBRACKET = 271, // "]"
+ TOKEN_DOT = 272, // "."
+ TOKEN_TEXT = 273, // "text"
+ TOKEN_HEX = 274, // "hex"
+ TOKEN_EXISTS = 275, // "exists"
+ TOKEN_PKT = 276, // "pkt"
+ TOKEN_IFACE = 277, // "iface"
+ TOKEN_SRC = 278, // "src"
+ TOKEN_DST = 279, // "dst"
+ TOKEN_LEN = 280, // "len"
+ TOKEN_PKT4 = 281, // "pkt4"
+ TOKEN_CHADDR = 282, // "mac"
+ TOKEN_HLEN = 283, // "hlen"
+ TOKEN_HTYPE = 284, // "htype"
+ TOKEN_CIADDR = 285, // "ciaddr"
+ TOKEN_GIADDR = 286, // "giaddr"
+ TOKEN_YIADDR = 287, // "yiaddr"
+ TOKEN_SIADDR = 288, // "siaddr"
+ TOKEN_SUBSTRING = 289, // "substring"
+ TOKEN_ALL = 290, // "all"
+ TOKEN_COMA = 291, // ","
+ TOKEN_CONCAT = 292, // "concat"
+ TOKEN_IFELSE = 293, // "ifelse"
+ TOKEN_TOHEXSTRING = 294, // "hexstring"
+ TOKEN_ADDRTOTEXT = 295, // "addrtotext"
+ TOKEN_INT8TOTEXT = 296, // "int8totext"
+ TOKEN_INT16TOTEXT = 297, // "int16totext"
+ TOKEN_INT32TOTEXT = 298, // "int32totext"
+ TOKEN_UINT8TOTEXT = 299, // "uint8totext"
+ TOKEN_UINT16TOTEXT = 300, // "uint16totext"
+ TOKEN_UINT32TOTEXT = 301, // "uint32totext"
+ TOKEN_PKT6 = 302, // "pkt6"
+ TOKEN_MSGTYPE = 303, // "msgtype"
+ TOKEN_TRANSID = 304, // "transid"
+ TOKEN_VENDOR_CLASS = 305, // "vendor-class"
+ TOKEN_VENDOR = 306, // "vendor"
+ TOKEN_ANY = 307, // "*"
+ TOKEN_DATA = 308, // "data"
+ TOKEN_ENTERPRISE = 309, // "enterprise"
+ TOKEN_TOPLEVEL_BOOL = 310, // "top-level bool"
+ TOKEN_TOPLEVEL_STRING = 311, // "top-level string"
+ TOKEN_STRING = 312, // "constant string"
+ TOKEN_INTEGER = 313, // "integer"
+ TOKEN_HEXSTRING = 314, // "constant hexstring"
+ TOKEN_OPTION_NAME = 315, // "option name"
+ TOKEN_IP_ADDRESS = 316 // "ip address"
};
+ /// Backward compatibility alias (Bison 3.6).
+ typedef token_kind_type yytokentype;
};
- /// (External) token type, as returned by yylex.
- typedef token::yytokentype token_type;
+ /// Token kind, as returned by yylex.
+ typedef token::yytokentype token_kind_type;
+
+ /// Backward compatibility alias (Bison 3.6).
+ typedef token_kind_type token_type;
- /// Symbol type: an internal symbol number.
- typedef int symbol_number_type;
+ /// Symbol kinds.
+ struct symbol_kind
+ {
+ enum symbol_kind_type
+ {
+ YYNTOKENS = 62, ///< Number of tokens.
+ S_YYEMPTY = -2,
+ S_YYEOF = 0, // "end of file"
+ S_YYerror = 1, // error
+ S_YYUNDEF = 2, // "invalid token"
+ S_LPAREN = 3, // "("
+ S_RPAREN = 4, // ")"
+ S_NOT = 5, // "not"
+ S_AND = 6, // "and"
+ S_OR = 7, // "or"
+ S_EQUAL = 8, // "=="
+ S_OPTION = 9, // "option"
+ S_RELAY4 = 10, // "relay4"
+ S_RELAY6 = 11, // "relay6"
+ S_MEMBER = 12, // "member"
+ S_PEERADDR = 13, // "peeraddr"
+ S_LINKADDR = 14, // "linkaddr"
+ S_LBRACKET = 15, // "["
+ S_RBRACKET = 16, // "]"
+ S_DOT = 17, // "."
+ S_TEXT = 18, // "text"
+ S_HEX = 19, // "hex"
+ S_EXISTS = 20, // "exists"
+ S_PKT = 21, // "pkt"
+ S_IFACE = 22, // "iface"
+ S_SRC = 23, // "src"
+ S_DST = 24, // "dst"
+ S_LEN = 25, // "len"
+ S_PKT4 = 26, // "pkt4"
+ S_CHADDR = 27, // "mac"
+ S_HLEN = 28, // "hlen"
+ S_HTYPE = 29, // "htype"
+ S_CIADDR = 30, // "ciaddr"
+ S_GIADDR = 31, // "giaddr"
+ S_YIADDR = 32, // "yiaddr"
+ S_SIADDR = 33, // "siaddr"
+ S_SUBSTRING = 34, // "substring"
+ S_ALL = 35, // "all"
+ S_COMA = 36, // ","
+ S_CONCAT = 37, // "concat"
+ S_IFELSE = 38, // "ifelse"
+ S_TOHEXSTRING = 39, // "hexstring"
+ S_ADDRTOTEXT = 40, // "addrtotext"
+ S_INT8TOTEXT = 41, // "int8totext"
+ S_INT16TOTEXT = 42, // "int16totext"
+ S_INT32TOTEXT = 43, // "int32totext"
+ S_UINT8TOTEXT = 44, // "uint8totext"
+ S_UINT16TOTEXT = 45, // "uint16totext"
+ S_UINT32TOTEXT = 46, // "uint32totext"
+ S_PKT6 = 47, // "pkt6"
+ S_MSGTYPE = 48, // "msgtype"
+ S_TRANSID = 49, // "transid"
+ S_VENDOR_CLASS = 50, // "vendor-class"
+ S_VENDOR = 51, // "vendor"
+ S_ANY = 52, // "*"
+ S_DATA = 53, // "data"
+ S_ENTERPRISE = 54, // "enterprise"
+ S_TOPLEVEL_BOOL = 55, // "top-level bool"
+ S_TOPLEVEL_STRING = 56, // "top-level string"
+ S_STRING = 57, // "constant string"
+ S_INTEGER = 58, // "integer"
+ S_HEXSTRING = 59, // "constant hexstring"
+ S_OPTION_NAME = 60, // "option name"
+ S_IP_ADDRESS = 61, // "ip address"
+ S_YYACCEPT = 62, // $accept
+ S_start = 63, // start
+ S_expression = 64, // expression
+ S_bool_expr = 65, // bool_expr
+ S_string_expr = 66, // string_expr
+ S_integer_expr = 67, // integer_expr
+ S_option_code = 68, // option_code
+ S_sub_option_code = 69, // sub_option_code
+ S_option_repr_type = 70, // option_repr_type
+ S_nest_level = 71, // nest_level
+ S_pkt_metadata = 72, // pkt_metadata
+ S_enterprise_id = 73, // enterprise_id
+ S_pkt4_field = 74, // pkt4_field
+ S_pkt6_field = 75, // pkt6_field
+ S_relay6_field = 76, // relay6_field
+ S_start_expr = 77, // start_expr
+ S_length_expr = 78 // length_expr
+ };
+ };
- /// The symbol type number to denote an empty symbol.
- enum { empty_symbol = -2 };
+ /// (Internal) symbol kind.
+ typedef symbol_kind::symbol_kind_type symbol_kind_type;
- /// Internal symbol number for tokens (subsumed by symbol_number_type).
- typedef signed char token_number_type;
+ /// The number of tokens.
+ static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
/// A complete symbol.
///
- /// Expects its Base type to provide access to the symbol type
- /// via type_get ().
+ /// Expects its Base type to provide access to the symbol kind
+ /// via kind ().
///
/// Provide access to semantic value and location.
template <typename Base>
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
- basic_symbol (basic_symbol&& that);
+ basic_symbol (basic_symbol&& that)
+ : Base (std::move (that))
+ , value ()
+ , location (std::move (that.location))
+ {
+ switch (this->kind ())
+ {
+ case symbol_kind::S_option_repr_type: // option_repr_type
+ value.move< TokenOption::RepresentationType > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_pkt4_field: // pkt4_field
+ value.move< TokenPkt4::FieldType > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_pkt6_field: // pkt6_field
+ value.move< TokenPkt6::FieldType > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
+ value.move< TokenPkt::MetadataType > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_relay6_field: // relay6_field
+ value.move< TokenRelay6Field::FieldType > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_nest_level: // nest_level
+ value.move< int8_t > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
+ value.move< std::string > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
+ value.move< uint16_t > (std::move (that.value));
+ break;
+
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
+ value.move< uint32_t > (std::move (that.value));
+ break;
+
+ default:
+ break;
+ }
+
+ }
#endif
/// Copy constructor.
basic_symbol (const basic_symbol& that);
- /// Constructor for valueless symbols, and symbols from each type.
+ /// Constructors for typed symbols.
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, TokenOption::RepresentationType&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, TokenPkt4::FieldType&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, TokenPkt6::FieldType&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, TokenPkt::MetadataType&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, TokenRelay6Field::FieldType&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, int8_t&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, uint16_t&& v, location_type&& l)
: Base (t)
, location (l)
{}
#endif
+
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, uint32_t&& v, location_type&& l)
: Base (t)
}
/// Destroy contents, and record that is empty.
- void clear ()
+ void clear () YY_NOEXCEPT
{
// User destructor.
- symbol_number_type yytype = this->type_get ();
+ symbol_kind_type yykind = this->kind ();
basic_symbol<Base>& yysym = *this;
(void) yysym;
- switch (yytype)
+ switch (yykind)
{
default:
break;
}
- // Type destructor.
-switch (yytype)
+ // Value type destructor.
+switch (yykind)
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
value.template destroy< TokenOption::RepresentationType > ();
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
value.template destroy< TokenPkt4::FieldType > ();
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
value.template destroy< TokenPkt6::FieldType > ();
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
value.template destroy< TokenPkt::MetadataType > ();
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
value.template destroy< TokenRelay6Field::FieldType > ();
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
value.template destroy< int8_t > ();
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
value.template destroy< std::string > ();
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
value.template destroy< uint16_t > ();
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
value.template destroy< uint32_t > ();
break;
Base::clear ();
}
+ /// The user-facing name of this symbol.
+ std::string name () const YY_NOEXCEPT
+ {
+ return EvalParser::symbol_name (this->kind ());
+ }
+
+ /// Backward compatibility (Bison 3.6).
+ symbol_kind_type type_get () const YY_NOEXCEPT;
+
/// Whether empty.
bool empty () const YY_NOEXCEPT;
};
/// Type access provider for token (enum) based symbols.
- struct by_type
+ struct by_kind
{
/// Default constructor.
- by_type ();
+ by_kind ();
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
- by_type (by_type&& that);
+ by_kind (by_kind&& that);
#endif
/// Copy constructor.
- by_type (const by_type& that);
+ by_kind (const by_kind& that);
- /// The symbol type as needed by the constructor.
- typedef token_type kind_type;
+ /// The symbol kind as needed by the constructor.
+ typedef token_kind_type kind_type;
/// Constructor from (external) token numbers.
- by_type (kind_type t);
+ by_kind (kind_type t);
/// Record that this symbol is empty.
- void clear ();
+ void clear () YY_NOEXCEPT;
- /// Steal the symbol type from \a that.
- void move (by_type& that);
+ /// Steal the symbol kind from \a that.
+ void move (by_kind& that);
/// The (internal) type number (corresponding to \a type).
/// \a empty when empty.
- symbol_number_type type_get () const YY_NOEXCEPT;
+ symbol_kind_type kind () const YY_NOEXCEPT;
+
+ /// Backward compatibility (Bison 3.6).
+ symbol_kind_type type_get () const YY_NOEXCEPT;
- /// The symbol type.
- /// \a empty_symbol when empty.
- /// An int, not token_number_type, to be able to store empty_symbol.
- int type;
+ /// The symbol kind.
+ /// \a S_YYEMPTY when empty.
+ symbol_kind_type kind_;
};
+ /// Backward compatibility for a private implementation detail (Bison 3.6).
+ typedef by_kind by_type;
+
/// "External" symbols: returned by the scanner.
- struct symbol_type : basic_symbol<by_type>
+ struct symbol_type : basic_symbol<by_kind>
{
/// Superclass.
- typedef basic_symbol<by_type> super_type;
+ typedef basic_symbol<by_kind> super_type;
/// Empty symbol.
symbol_type () {}
#if 201103L <= YY_CPLUSPLUS
symbol_type (int tok, location_type l)
: super_type(token_type (tok), std::move (l))
- {
- YY_ASSERT (tok == token::TOKEN_END || tok == token::TOKEN_LPAREN || tok == token::TOKEN_RPAREN || tok == token::TOKEN_NOT || tok == token::TOKEN_AND || tok == token::TOKEN_OR || tok == token::TOKEN_EQUAL || tok == token::TOKEN_OPTION || tok == token::TOKEN_RELAY4 || tok == token::TOKEN_RELAY6 || tok == token::TOKEN_MEMBER || tok == token::TOKEN_PEERADDR || tok == token::TOKEN_LINKADDR || tok == token::TOKEN_LBRACKET || tok == token::TOKEN_RBRACKET || tok == token::TOKEN_DOT || tok == token::TOKEN_TEXT || tok == token::TOKEN_HEX || tok == token::TOKEN_EXISTS || tok == token::TOKEN_PKT || tok == token::TOKEN_IFACE || tok == token::TOKEN_SRC || tok == token::TOKEN_DST || tok == token::TOKEN_LEN || tok == token::TOKEN_PKT4 || tok == token::TOKEN_CHADDR || tok == token::TOKEN_HLEN || tok == token::TOKEN_HTYPE || tok == token::TOKEN_CIADDR || tok == token::TOKEN_GIADDR || tok == token::TOKEN_YIADDR || tok == token::TOKEN_SIADDR || tok == token::TOKEN_SUBSTRING || tok == token::TOKEN_ALL || tok == token::TOKEN_COMA || tok == token::TOKEN_CONCAT || tok == token::TOKEN_IFELSE || tok == token::TOKEN_TOHEXSTRING || tok == token::TOKEN_ADDRTOTEXT || tok == token::TOKEN_INT8TOTEXT || tok == token::TOKEN_INT16TOTEXT || tok == token::TOKEN_INT32TOTEXT || tok == token::TOKEN_UINT8TOTEXT || tok == token::TOKEN_UINT16TOTEXT || tok == token::TOKEN_UINT32TOTEXT || tok == token::TOKEN_PKT6 || tok == token::TOKEN_MSGTYPE || tok == token::TOKEN_TRANSID || tok == token::TOKEN_VENDOR_CLASS || tok == token::TOKEN_VENDOR || tok == token::TOKEN_ANY || tok == token::TOKEN_DATA || tok == token::TOKEN_ENTERPRISE || tok == token::TOKEN_TOPLEVEL_BOOL || tok == token::TOKEN_TOPLEVEL_STRING);
- }
#else
symbol_type (int tok, const location_type& l)
: super_type(token_type (tok), l)
+#endif
{
- YY_ASSERT (tok == token::TOKEN_END || tok == token::TOKEN_LPAREN || tok == token::TOKEN_RPAREN || tok == token::TOKEN_NOT || tok == token::TOKEN_AND || tok == token::TOKEN_OR || tok == token::TOKEN_EQUAL || tok == token::TOKEN_OPTION || tok == token::TOKEN_RELAY4 || tok == token::TOKEN_RELAY6 || tok == token::TOKEN_MEMBER || tok == token::TOKEN_PEERADDR || tok == token::TOKEN_LINKADDR || tok == token::TOKEN_LBRACKET || tok == token::TOKEN_RBRACKET || tok == token::TOKEN_DOT || tok == token::TOKEN_TEXT || tok == token::TOKEN_HEX || tok == token::TOKEN_EXISTS || tok == token::TOKEN_PKT || tok == token::TOKEN_IFACE || tok == token::TOKEN_SRC || tok == token::TOKEN_DST || tok == token::TOKEN_LEN || tok == token::TOKEN_PKT4 || tok == token::TOKEN_CHADDR || tok == token::TOKEN_HLEN || tok == token::TOKEN_HTYPE || tok == token::TOKEN_CIADDR || tok == token::TOKEN_GIADDR || tok == token::TOKEN_YIADDR || tok == token::TOKEN_SIADDR || tok == token::TOKEN_SUBSTRING || tok == token::TOKEN_ALL || tok == token::TOKEN_COMA || tok == token::TOKEN_CONCAT || tok == token::TOKEN_IFELSE || tok == token::TOKEN_TOHEXSTRING || tok == token::TOKEN_ADDRTOTEXT || tok == token::TOKEN_INT8TOTEXT || tok == token::TOKEN_INT16TOTEXT || tok == token::TOKEN_INT32TOTEXT || tok == token::TOKEN_UINT8TOTEXT || tok == token::TOKEN_UINT16TOTEXT || tok == token::TOKEN_UINT32TOTEXT || tok == token::TOKEN_PKT6 || tok == token::TOKEN_MSGTYPE || tok == token::TOKEN_TRANSID || tok == token::TOKEN_VENDOR_CLASS || tok == token::TOKEN_VENDOR || tok == token::TOKEN_ANY || tok == token::TOKEN_DATA || tok == token::TOKEN_ENTERPRISE || tok == token::TOKEN_TOPLEVEL_BOOL || tok == token::TOKEN_TOPLEVEL_STRING);
+ EVAL_ASSERT (tok == token::TOKEN_END
+ || (token::TOKEN_EVALerror <= tok && tok <= token::TOKEN_TOPLEVEL_STRING));
}
-#endif
#if 201103L <= YY_CPLUSPLUS
symbol_type (int tok, std::string v, location_type l)
: super_type(token_type (tok), std::move (v), std::move (l))
- {
- YY_ASSERT (tok == token::TOKEN_STRING || tok == token::TOKEN_INTEGER || tok == token::TOKEN_HEXSTRING || tok == token::TOKEN_OPTION_NAME || tok == token::TOKEN_IP_ADDRESS);
- }
#else
symbol_type (int tok, const std::string& v, const location_type& l)
: super_type(token_type (tok), v, l)
+#endif
{
- YY_ASSERT (tok == token::TOKEN_STRING || tok == token::TOKEN_INTEGER || tok == token::TOKEN_HEXSTRING || tok == token::TOKEN_OPTION_NAME || tok == token::TOKEN_IP_ADDRESS);
+ EVAL_ASSERT ((token::TOKEN_STRING <= tok && tok <= token::TOKEN_IP_ADDRESS));
}
-#endif
};
/// Build a parser object.
EvalParser (EvalContext& ctx_yyarg);
virtual ~EvalParser ();
+#if 201103L <= YY_CPLUSPLUS
+ /// Non copyable.
+ EvalParser (const EvalParser&) = delete;
+ /// Non copyable.
+ EvalParser& operator= (const EvalParser&) = delete;
+#endif
+
/// Parse. An alias for parse ().
/// \returns 0 iff parsing succeeded.
int operator() ();
/// Report a syntax error.
void error (const syntax_error& err);
+ /// The user-facing name of the symbol whose (internal) number is
+ /// YYSYMBOL. No bounds checking.
+ static std::string symbol_name (symbol_kind_type yysymbol);
+
// Implementation of make_symbol for each symbol type.
#if 201103L <= YY_CPLUSPLUS
static
return symbol_type (token::TOKEN_END, l);
}
#endif
+#if 201103L <= YY_CPLUSPLUS
+ static
+ symbol_type
+ make_EVALerror (location_type l)
+ {
+ return symbol_type (token::TOKEN_EVALerror, std::move (l));
+ }
+#else
+ static
+ symbol_type
+ make_EVALerror (const location_type& l)
+ {
+ return symbol_type (token::TOKEN_EVALerror, l);
+ }
+#endif
+#if 201103L <= YY_CPLUSPLUS
+ static
+ symbol_type
+ make_EVALUNDEF (location_type l)
+ {
+ return symbol_type (token::TOKEN_EVALUNDEF, std::move (l));
+ }
+#else
+ static
+ symbol_type
+ make_EVALUNDEF (const location_type& l)
+ {
+ return symbol_type (token::TOKEN_EVALUNDEF, l);
+ }
+#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
#endif
+ class context
+ {
+ public:
+ context (const EvalParser& yyparser, const symbol_type& yyla);
+ const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; }
+ symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }
+ const location_type& location () const YY_NOEXCEPT { return yyla_.location; }
+
+ /// Put in YYARG at most YYARGN of the expected tokens, and return the
+ /// number of tokens stored in YYARG. If YYARG is null, return the
+ /// number of expected tokens (guaranteed to be less than YYNTOKENS).
+ int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
+
+ private:
+ const EvalParser& yyparser_;
+ const symbol_type& yyla_;
+ };
+
private:
- /// This class is not copyable.
+#if YY_CPLUSPLUS < 201103L
+ /// Non copyable.
EvalParser (const EvalParser&);
+ /// Non copyable.
EvalParser& operator= (const EvalParser&);
+#endif
+
/// Stored state numbers (used for stacks).
typedef unsigned char state_type;
- /// Generate an error message.
- /// \param yystate the state where the error occurred.
- /// \param yyla the lookahead token.
- virtual std::string yysyntax_error_ (state_type yystate,
- const symbol_type& yyla) const;
+ /// The arguments of the error message.
+ int yy_syntax_error_arguments_ (const context& yyctx,
+ symbol_kind_type yyarg[], int yyargn) const;
+ /// Generate an error message.
+ /// \param yyctx the context in which the error occurred.
+ virtual std::string yysyntax_error_ (const context& yyctx) const;
/// Compute post-reduction state.
/// \param yystate the current state
/// \param yysym the nonterminal to push on the stack
static const short yypact_ninf_;
static const signed char yytable_ninf_;
- /// Convert a scanner token number \a t to a symbol number.
- /// In theory \a t should be a token_type, but character literals
+ /// Convert a scanner token kind \a t to a symbol kind.
+ /// In theory \a t should be a token_kind_type, but character literals
/// are valid, yet not members of the token_type enum.
- static token_number_type yytranslate_ (int t);
+ static symbol_kind_type yytranslate_ (int t);
+
+ /// Convert the symbol name \a n to a form suitable for a diagnostic.
+ static std::string yytnamerr_ (const char *yystr);
+
+ /// For a symbol, its name in clear.
+ static const char* const yytname_[];
+
// Tables.
// YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
static const short yypgoto_[];
// YYDEFGOTO[NTERM-NUM].
- static const short yydefgoto_[];
+ static const unsigned char yydefgoto_[];
// YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
// positive, shift that token. If negative, reduce the rule whose
static const signed char yyr2_[];
- /// Convert the symbol name \a n to a form suitable for a diagnostic.
- static std::string yytnamerr_ (const char *n);
-
-
- /// For a symbol, its name in clear.
- static const char* const yytname_[];
#if EVALDEBUG
// YYRLINE[YYN] -- Source line where rule number YYN was defined.
static const short yyrline_[];
/// Report on the debug stream that the rule \a r is going to be reduced.
- virtual void yy_reduce_print_ (int r);
+ virtual void yy_reduce_print_ (int r) const;
/// Print the state stack on the debug stream.
- virtual void yystack_print_ ();
+ virtual void yy_stack_print_ () const;
/// Debugging level.
int yydebug_;
/// Debug stream.
std::ostream* yycdebug_;
- /// \brief Display a symbol type, value and location.
+ /// \brief Display a symbol kind, value and location.
/// \param yyo The output stream.
/// \param yysym The symbol.
template <typename Base>
/// Default constructor.
by_state () YY_NOEXCEPT;
- /// The symbol type as needed by the constructor.
+ /// The symbol kind as needed by the constructor.
typedef state_type kind_type;
/// Constructor.
/// Record that this symbol is empty.
void clear () YY_NOEXCEPT;
- /// Steal the symbol type from \a that.
+ /// Steal the symbol kind from \a that.
void move (by_state& that);
- /// The (internal) type number (corresponding to \a state).
- /// \a empty_symbol when empty.
- symbol_number_type type_get () const YY_NOEXCEPT;
+ /// The symbol kind (corresponding to \a state).
+ /// \a symbol_kind::S_YYEMPTY when empty.
+ symbol_kind_type kind () const YY_NOEXCEPT;
/// The state number used to denote an empty symbol.
/// We use the initial state, as it does not have a value.
{
public:
// Hide our reversed order.
- typedef typename S::reverse_iterator iterator;
- typedef typename S::const_reverse_iterator const_iterator;
+ typedef typename S::iterator iterator;
+ typedef typename S::const_iterator const_iterator;
typedef typename S::size_type size_type;
typedef typename std::ptrdiff_t index_type;
: seq_ (n)
{}
+#if 201103L <= YY_CPLUSPLUS
+ /// Non copyable.
+ stack (const stack&) = delete;
+ /// Non copyable.
+ stack& operator= (const stack&) = delete;
+#endif
+
/// Random access.
///
/// Index 0 returns the topmost element.
return index_type (seq_.size ());
}
- std::ptrdiff_t
- ssize () const YY_NOEXCEPT
- {
- return std::ptrdiff_t (size ());
- }
-
/// Iterator on top of the stack (going downwards).
const_iterator
begin () const YY_NOEXCEPT
{
- return seq_.rbegin ();
+ return seq_.begin ();
}
/// Bottom of the stack.
const_iterator
end () const YY_NOEXCEPT
{
- return seq_.rend ();
+ return seq_.end ();
}
/// Present a slice of the top of a stack.
};
private:
+#if YY_CPLUSPLUS < 201103L
+ /// Non copyable.
stack (const stack&);
+ /// Non copyable.
stack& operator= (const stack&);
+#endif
/// The wrapped container.
S seq_;
};
/// Pop \a n symbols from the stack.
void yypop_ (int n = 1);
- /// Some specific tokens.
- static const token_number_type yy_error_token_ = 1;
- static const token_number_type yy_undef_token_ = 2;
-
/// Constants.
enum
{
- yyeof_ = 0,
yylast_ = 252, ///< Last index in yytable_.
yynnts_ = 17, ///< Number of nonterminal symbols.
- yyfinal_ = 40, ///< Termination state number.
- yyntokens_ = 62 ///< Number of tokens.
+ yyfinal_ = 40 ///< Termination state number.
};
// User arguments.
EvalContext& ctx;
+
};
inline
- EvalParser::token_number_type
+ EvalParser::symbol_kind_type
EvalParser::yytranslate_ (int t)
{
// YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
// TOKEN-NUM as returned by yylex.
static
- const token_number_type
+ const signed char
translate_table[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61
};
- const int user_token_number_max_ = 316;
+ // Last valid token kind.
+ const int code_max = 316;
if (t <= 0)
- return yyeof_;
- else if (t <= user_token_number_max_)
- return translate_table[t];
+ return symbol_kind::S_YYEOF;
+ else if (t <= code_max)
+ return YY_CAST (symbol_kind_type, translate_table[t]);
else
- return yy_undef_token_;
+ return symbol_kind::S_YYUNDEF;
}
// basic_symbol.
-#if 201103L <= YY_CPLUSPLUS
- template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
- : Base (std::move (that))
- , value ()
- , location (std::move (that.location))
- {
- switch (this->type_get ())
- {
- case 70: // option_repr_type
- value.move< TokenOption::RepresentationType > (std::move (that.value));
- break;
-
- case 74: // pkt4_field
- value.move< TokenPkt4::FieldType > (std::move (that.value));
- break;
-
- case 75: // pkt6_field
- value.move< TokenPkt6::FieldType > (std::move (that.value));
- break;
-
- case 72: // pkt_metadata
- value.move< TokenPkt::MetadataType > (std::move (that.value));
- break;
-
- case 76: // relay6_field
- value.move< TokenRelay6Field::FieldType > (std::move (that.value));
- break;
-
- case 71: // nest_level
- value.move< int8_t > (std::move (that.value));
- break;
-
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
- value.move< std::string > (std::move (that.value));
- break;
-
- case 68: // option_code
- case 69: // sub_option_code
- value.move< uint16_t > (std::move (that.value));
- break;
-
- case 67: // integer_expr
- case 73: // enterprise_id
- value.move< uint32_t > (std::move (that.value));
- break;
-
- default:
- break;
- }
-
- }
-#endif
-
template <typename Base>
EvalParser::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
: Base (that)
, value ()
, location (that.location)
{
- switch (this->type_get ())
+ switch (this->kind ())
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
value.copy< TokenOption::RepresentationType > (YY_MOVE (that.value));
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
value.copy< TokenPkt4::FieldType > (YY_MOVE (that.value));
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
value.copy< TokenPkt6::FieldType > (YY_MOVE (that.value));
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
value.copy< TokenPkt::MetadataType > (YY_MOVE (that.value));
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
value.copy< TokenRelay6Field::FieldType > (YY_MOVE (that.value));
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
value.copy< int8_t > (YY_MOVE (that.value));
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
value.copy< std::string > (YY_MOVE (that.value));
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
value.copy< uint16_t > (YY_MOVE (that.value));
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
value.copy< uint32_t > (YY_MOVE (that.value));
break;
+ template <typename Base>
+ EvalParser::symbol_kind_type
+ EvalParser::basic_symbol<Base>::type_get () const YY_NOEXCEPT
+ {
+ return this->kind ();
+ }
+
template <typename Base>
bool
EvalParser::basic_symbol<Base>::empty () const YY_NOEXCEPT
{
- return Base::type_get () == empty_symbol;
+ return this->kind () == symbol_kind::S_YYEMPTY;
}
template <typename Base>
EvalParser::basic_symbol<Base>::move (basic_symbol& s)
{
super_type::move (s);
- switch (this->type_get ())
+ switch (this->kind ())
{
- case 70: // option_repr_type
+ case symbol_kind::S_option_repr_type: // option_repr_type
value.move< TokenOption::RepresentationType > (YY_MOVE (s.value));
break;
- case 74: // pkt4_field
+ case symbol_kind::S_pkt4_field: // pkt4_field
value.move< TokenPkt4::FieldType > (YY_MOVE (s.value));
break;
- case 75: // pkt6_field
+ case symbol_kind::S_pkt6_field: // pkt6_field
value.move< TokenPkt6::FieldType > (YY_MOVE (s.value));
break;
- case 72: // pkt_metadata
+ case symbol_kind::S_pkt_metadata: // pkt_metadata
value.move< TokenPkt::MetadataType > (YY_MOVE (s.value));
break;
- case 76: // relay6_field
+ case symbol_kind::S_relay6_field: // relay6_field
value.move< TokenRelay6Field::FieldType > (YY_MOVE (s.value));
break;
- case 71: // nest_level
+ case symbol_kind::S_nest_level: // nest_level
value.move< int8_t > (YY_MOVE (s.value));
break;
- case 57: // "constant string"
- case 58: // "integer"
- case 59: // "constant hexstring"
- case 60: // "option name"
- case 61: // "ip address"
+ case symbol_kind::S_STRING: // "constant string"
+ case symbol_kind::S_INTEGER: // "integer"
+ case symbol_kind::S_HEXSTRING: // "constant hexstring"
+ case symbol_kind::S_OPTION_NAME: // "option name"
+ case symbol_kind::S_IP_ADDRESS: // "ip address"
value.move< std::string > (YY_MOVE (s.value));
break;
- case 68: // option_code
- case 69: // sub_option_code
+ case symbol_kind::S_option_code: // option_code
+ case symbol_kind::S_sub_option_code: // sub_option_code
value.move< uint16_t > (YY_MOVE (s.value));
break;
- case 67: // integer_expr
- case 73: // enterprise_id
+ case symbol_kind::S_integer_expr: // integer_expr
+ case symbol_kind::S_enterprise_id: // enterprise_id
value.move< uint32_t > (YY_MOVE (s.value));
break;
location = YY_MOVE (s.location);
}
- // by_type.
+ // by_kind.
inline
- EvalParser::by_type::by_type ()
- : type (empty_symbol)
+ EvalParser::by_kind::by_kind ()
+ : kind_ (symbol_kind::S_YYEMPTY)
{}
#if 201103L <= YY_CPLUSPLUS
inline
- EvalParser::by_type::by_type (by_type&& that)
- : type (that.type)
+ EvalParser::by_kind::by_kind (by_kind&& that)
+ : kind_ (that.kind_)
{
that.clear ();
}
#endif
inline
- EvalParser::by_type::by_type (const by_type& that)
- : type (that.type)
+ EvalParser::by_kind::by_kind (const by_kind& that)
+ : kind_ (that.kind_)
{}
inline
- EvalParser::by_type::by_type (token_type t)
- : type (yytranslate_ (t))
+ EvalParser::by_kind::by_kind (token_kind_type t)
+ : kind_ (yytranslate_ (t))
{}
inline
void
- EvalParser::by_type::clear ()
+ EvalParser::by_kind::clear () YY_NOEXCEPT
{
- type = empty_symbol;
+ kind_ = symbol_kind::S_YYEMPTY;
}
inline
void
- EvalParser::by_type::move (by_type& that)
+ EvalParser::by_kind::move (by_kind& that)
{
- type = that.type;
+ kind_ = that.kind_;
that.clear ();
}
inline
- int
- EvalParser::by_type::type_get () const YY_NOEXCEPT
+ EvalParser::symbol_kind_type
+ EvalParser::by_kind::kind () const YY_NOEXCEPT
{
- return type;
+ return kind_;
+ }
+
+ inline
+ EvalParser::symbol_kind_type
+ EvalParser::by_kind::type_get () const YY_NOEXCEPT
+ {
+ return this->kind ();
}
#line 14 "parser.yy"
} } // isc::eval
-#line 2414 "parser.h"
-
+#line 2612 "parser.h"
-// A Bison parser, made by GNU Bison 3.5.1.
+// A Bison parser, made by GNU Bison 3.7.5.
// Starting with Bison 3.2, this file is useless: the structure it
// used to define is now defined in "location.hh".
-// A Bison parser, made by GNU Bison 3.5.1.
+// A Bison parser, made by GNU Bison 3.7.5.
// Starting with Bison 3.2, this file is useless: the structure it
// used to define is now defined with the parser itself.