summaryrefslogtreecommitdiffstats
path: root/src/lib/eval
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2018-11-17 22:55:25 +0100
committerFrancis Dupont <fdupont@isc.org>2018-11-17 22:55:25 +0100
commite1def1242033065acf4462092636da6696cbdc44 (patch)
tree0a44687ef8c3a238cbd1fe2362096a1cd82eed58 /src/lib/eval
parent[master] Fixed v4 -> v6 typo (cdf #262) (diff)
downloadkea-e1def1242033065acf4462092636da6696cbdc44.tar.xz
kea-e1def1242033065acf4462092636da6696cbdc44.zip
[#270, !129] regen bison with 3.2.1
Diffstat (limited to 'src/lib/eval')
-rw-r--r--src/lib/eval/location.hh151
-rw-r--r--src/lib/eval/parser.cc485
-rw-r--r--src/lib/eval/parser.h1049
-rw-r--r--src/lib/eval/position.hh192
-rw-r--r--src/lib/eval/stack.hh166
5 files changed, 1036 insertions, 1007 deletions
diff --git a/src/lib/eval/location.hh b/src/lib/eval/location.hh
index 7f3490b371..a41ad5249b 100644
--- a/src/lib/eval/location.hh
+++ b/src/lib/eval/location.hh
@@ -1,5 +1,5 @@
-// Generated 201811151407
-// A Bison parser, made by GNU Bison 3.0.5.
+// Generated 201811172152
+// A Bison parser, made by GNU Bison 3.2.1.
// Locations for Bison parsers in C++
@@ -39,12 +39,145 @@
#ifndef YY_EVAL_LOCATION_HH_INCLUDED
# define YY_EVAL_LOCATION_HH_INCLUDED
-# include "position.hh"
+# include <algorithm> // std::max
+# include <iostream>
+# include <string>
-#line 14 "parser.yy" // location.cc:292
+# ifndef YY_NULLPTR
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# else
+# define YY_NULLPTR ((void*)0)
+# endif
+# endif
+
+#line 14 "parser.yy" // location.cc:339
namespace isc { namespace eval {
-#line 46 "location.hh" // location.cc:292
- /// Abstract a location.
+#line 60 "location.hh" // location.cc:339
+ /// A point in a source file.
+ class position
+ {
+ public:
+ /// Construct a position.
+ explicit position (std::string* f = YY_NULLPTR,
+ unsigned l = 1u,
+ unsigned c = 1u)
+ : filename (f)
+ , line (l)
+ , column (c)
+ {}
+
+
+ /// Initialization.
+ void initialize (std::string* fn = YY_NULLPTR,
+ unsigned l = 1u,
+ unsigned c = 1u)
+ {
+ filename = fn;
+ line = l;
+ column = c;
+ }
+
+ /** \name Line and Column related manipulators
+ ** \{ */
+ /// (line related) Advance to the COUNT next lines.
+ void lines (int count = 1)
+ {
+ if (count)
+ {
+ column = 1u;
+ line = add_ (line, count, 1);
+ }
+ }
+
+ /// (column related) Advance to the COUNT next columns.
+ void columns (int count = 1)
+ {
+ column = add_ (column, count, 1);
+ }
+ /** \} */
+
+ /// File name to which this position refers.
+ std::string* filename;
+ /// Current line number.
+ unsigned line;
+ /// Current column number.
+ unsigned column;
+
+ private:
+ /// Compute max (min, lhs+rhs).
+ static unsigned add_ (unsigned lhs, int rhs, int min)
+ {
+ return static_cast<unsigned> (std::max (min,
+ static_cast<int> (lhs) + rhs));
+ }
+ };
+
+ /// Add \a width columns, in place.
+ inline position&
+ operator+= (position& res, int width)
+ {
+ res.columns (width);
+ return res;
+ }
+
+ /// Add \a width columns.
+ inline position
+ operator+ (position res, int width)
+ {
+ return res += width;
+ }
+
+ /// Subtract \a width columns, in place.
+ inline position&
+ operator-= (position& res, int width)
+ {
+ return res += -width;
+ }
+
+ /// Subtract \a width columns.
+ inline position
+ operator- (position res, int width)
+ {
+ return res -= width;
+ }
+
+ /// Compare two position objects.
+ inline bool
+ operator== (const position& pos1, const position& pos2)
+ {
+ return (pos1.line == pos2.line
+ && pos1.column == pos2.column
+ && (pos1.filename == pos2.filename
+ || (pos1.filename && pos2.filename
+ && *pos1.filename == *pos2.filename)));
+ }
+
+ /// Compare two position objects.
+ inline bool
+ operator!= (const position& pos1, const position& pos2)
+ {
+ return !(pos1 == pos2);
+ }
+
+ /** \brief Intercept output stream redirection.
+ ** \param ostr the destination output stream
+ ** \param pos a reference to the position to redirect
+ */
+ template <typename YYChar>
+ std::basic_ostream<YYChar>&
+ operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
+ {
+ if (pos.filename)
+ ostr << *pos.filename << ':';
+ return ostr << pos.line << '.' << pos.column;
+ }
+
+ /// Two points in a source file.
class location
{
public:
@@ -168,7 +301,7 @@ namespace isc { namespace eval {
** Avoid duplicate information.
*/
template <typename YYChar>
- inline std::basic_ostream<YYChar>&
+ std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
@@ -184,7 +317,7 @@ namespace isc { namespace eval {
return ostr;
}
-#line 14 "parser.yy" // location.cc:292
+#line 14 "parser.yy" // location.cc:339
} } // isc::eval
-#line 189 "location.hh" // location.cc:292
+#line 322 "location.hh" // location.cc:339
#endif // !YY_EVAL_LOCATION_HH_INCLUDED
diff --git a/src/lib/eval/parser.cc b/src/lib/eval/parser.cc
index 86a9b2345f..402a987d1c 100644
--- a/src/lib/eval/parser.cc
+++ b/src/lib/eval/parser.cc
@@ -1,4 +1,4 @@
-// A Bison parser, made by GNU Bison 3.0.5.
+// A Bison parser, made by GNU Bison 3.2.1.
// Skeleton implementation for Bison LALR(1) parsers in C++
@@ -30,32 +30,24 @@
// 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.
+
+
// Take the name prefix into account.
#define yylex evallex
-// First part of user declarations.
-
-#line 39 "parser.cc" // lalr1.cc:406
-# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# endif
#include "parser.h"
-// User implementation prologue.
-#line 53 "parser.cc" // lalr1.cc:414
// Unqualified %code blocks.
-#line 33 "parser.yy" // lalr1.cc:415
+#line 33 "parser.yy" // lalr1.cc:438
# include "eval_context.h"
-#line 59 "parser.cc" // lalr1.cc:415
+#line 51 "parser.cc" // lalr1.cc:438
#ifndef YY_
@@ -70,6 +62,15 @@
# endif
#endif
+// Whether we are compiled with exception support.
+#ifndef YY_EXCEPTIONS
+# if defined __GNUC__ && !defined __EXCEPTIONS
+# define YY_EXCEPTIONS 0
+# else
+# define YY_EXCEPTIONS 1
+# endif
+#endif
+
#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
@@ -139,9 +140,9 @@
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus_)
-#line 14 "parser.yy" // lalr1.cc:481
+#line 14 "parser.yy" // lalr1.cc:513
namespace isc { namespace eval {
-#line 145 "parser.cc" // lalr1.cc:481
+#line 146 "parser.cc" // lalr1.cc:513
/* Return YYSTR after stripping away unnecessary quotes and
backslashes, so that it's suitable for yyerror. The heuristic is
@@ -239,33 +240,33 @@ namespace isc { namespace eval {
EvalParser::stack_symbol_type::stack_symbol_type ()
{}
- EvalParser::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
- : super_type (that.state, that.location)
+ 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 ())
{
case 62: // option_repr_type
- value.copy< TokenOption::RepresentationType > (that.value);
+ value.YY_MOVE_OR_COPY< TokenOption::RepresentationType > (YY_MOVE (that.value));
break;
case 66: // pkt4_field
- value.copy< TokenPkt4::FieldType > (that.value);
+ value.YY_MOVE_OR_COPY< TokenPkt4::FieldType > (YY_MOVE (that.value));
break;
case 67: // pkt6_field
- value.copy< TokenPkt6::FieldType > (that.value);
+ value.YY_MOVE_OR_COPY< TokenPkt6::FieldType > (YY_MOVE (that.value));
break;
case 64: // pkt_metadata
- value.copy< TokenPkt::MetadataType > (that.value);
+ value.YY_MOVE_OR_COPY< TokenPkt::MetadataType > (YY_MOVE (that.value));
break;
case 68: // relay6_field
- value.copy< TokenRelay6Field::FieldType > (that.value);
+ value.YY_MOVE_OR_COPY< TokenRelay6Field::FieldType > (YY_MOVE (that.value));
break;
case 63: // nest_level
- value.copy< int8_t > (that.value);
+ value.YY_MOVE_OR_COPY< int8_t > (YY_MOVE (that.value));
break;
case 50: // "constant string"
@@ -273,51 +274,55 @@ namespace isc { namespace eval {
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
- value.copy< std::string > (that.value);
+ value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value));
break;
case 61: // option_code
- value.copy< uint16_t > (that.value);
+ value.YY_MOVE_OR_COPY< uint16_t > (YY_MOVE (that.value));
break;
case 60: // integer_expr
case 65: // enterprise_id
- value.copy< uint32_t > (that.value);
+ value.YY_MOVE_OR_COPY< uint32_t > (YY_MOVE (that.value));
break;
default:
break;
}
+#if defined __cplusplus && 201103L <= __cplusplus
+ // that is emptied.
+ that.state = empty_state;
+#endif
}
- EvalParser::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
- : super_type (s, that.location)
+ 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 ())
{
case 62: // option_repr_type
- value.move< TokenOption::RepresentationType > (that.value);
+ value.move< TokenOption::RepresentationType > (YY_MOVE (that.value));
break;
case 66: // pkt4_field
- value.move< TokenPkt4::FieldType > (that.value);
+ value.move< TokenPkt4::FieldType > (YY_MOVE (that.value));
break;
case 67: // pkt6_field
- value.move< TokenPkt6::FieldType > (that.value);
+ value.move< TokenPkt6::FieldType > (YY_MOVE (that.value));
break;
case 64: // pkt_metadata
- value.move< TokenPkt::MetadataType > (that.value);
+ value.move< TokenPkt::MetadataType > (YY_MOVE (that.value));
break;
case 68: // relay6_field
- value.move< TokenRelay6Field::FieldType > (that.value);
+ value.move< TokenRelay6Field::FieldType > (YY_MOVE (that.value));
break;
case 63: // nest_level
- value.move< int8_t > (that.value);
+ value.move< int8_t > (YY_MOVE (that.value));
break;
case 50: // "constant string"
@@ -325,16 +330,16 @@ namespace isc { namespace eval {
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
- value.move< std::string > (that.value);
+ value.move< std::string > (YY_MOVE (that.value));
break;
case 61: // option_code
- value.move< uint16_t > (that.value);
+ value.move< uint16_t > (YY_MOVE (that.value));
break;
case 60: // integer_expr
case 65: // enterprise_id
- value.move< uint32_t > (that.value);
+ value.move< uint32_t > (YY_MOVE (that.value));
break;
default:
@@ -345,34 +350,35 @@ namespace isc { namespace eval {
that.type = empty_symbol;
}
+#if !defined __cplusplus || __cplusplus < 201103L
EvalParser::stack_symbol_type&
- EvalParser::stack_symbol_type::operator= (const stack_symbol_type& that)
+ EvalParser::stack_symbol_type::operator= (stack_symbol_type& that)
{
state = that.state;
switch (that.type_get ())
{
case 62: // option_repr_type
- value.copy< TokenOption::RepresentationType > (that.value);
+ value.move< TokenOption::RepresentationType > (that.value);
break;
case 66: // pkt4_field
- value.copy< TokenPkt4::FieldType > (that.value);
+ value.move< TokenPkt4::FieldType > (that.value);
break;
case 67: // pkt6_field
- value.copy< TokenPkt6::FieldType > (that.value);
+ value.move< TokenPkt6::FieldType > (that.value);
break;
case 64: // pkt_metadata
- value.copy< TokenPkt::MetadataType > (that.value);
+ value.move< TokenPkt::MetadataType > (that.value);
break;
case 68: // relay6_field
- value.copy< TokenRelay6Field::FieldType > (that.value);
+ value.move< TokenRelay6Field::FieldType > (that.value);
break;
case 63: // nest_level
- value.copy< int8_t > (that.value);
+ value.move< int8_t > (that.value);
break;
case 50: // "constant string"
@@ -380,16 +386,16 @@ namespace isc { namespace eval {
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
- value.copy< std::string > (that.value);
+ value.move< std::string > (that.value);
break;
case 61: // option_code
- value.copy< uint16_t > (that.value);
+ value.move< uint16_t > (that.value);
break;
case 60: // integer_expr
case 65: // enterprise_id
- value.copy< uint32_t > (that.value);
+ value.move< uint32_t > (that.value);
break;
default:
@@ -397,9 +403,11 @@ namespace isc { namespace eval {
}
location = that.location;
+ // that is emptied.
+ that.state = empty_state;
return *this;
}
-
+#endif
template <typename Base>
void
@@ -429,100 +437,100 @@ namespace isc { namespace eval {
{
case 50: // "constant string"
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< std::string > (); }
-#line 435 "parser.cc" // lalr1.cc:635
+#line 443 "parser.cc" // lalr1.cc:672
break;
case 51: // "integer"
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< std::string > (); }
-#line 442 "parser.cc" // lalr1.cc:635
+#line 450 "parser.cc" // lalr1.cc:672
break;
case 52: // "constant hexstring"
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< std::string > (); }
-#line 449 "parser.cc" // lalr1.cc:635
+#line 457 "parser.cc" // lalr1.cc:672
break;
case 53: // "option name"
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< std::string > (); }
-#line 456 "parser.cc" // lalr1.cc:635
+#line 464 "parser.cc" // lalr1.cc:672
break;
case 54: // "ip address"
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< std::string > (); }
-#line 463 "parser.cc" // lalr1.cc:635
+#line 471 "parser.cc" // lalr1.cc:672
break;
case 60: // integer_expr
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< uint32_t > (); }
-#line 470 "parser.cc" // lalr1.cc:635
+#line 478 "parser.cc" // lalr1.cc:672
break;
case 61: // option_code
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< uint16_t > (); }
-#line 477 "parser.cc" // lalr1.cc:635
+#line 485 "parser.cc" // lalr1.cc:672
break;
case 62: // option_repr_type
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< TokenOption::RepresentationType > (); }
-#line 484 "parser.cc" // lalr1.cc:635
+#line 492 "parser.cc" // lalr1.cc:672
break;
case 63: // nest_level
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< int8_t > (); }
-#line 491 "parser.cc" // lalr1.cc:635
+#line 499 "parser.cc" // lalr1.cc:672
break;
case 64: // pkt_metadata
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< TokenPkt::MetadataType > (); }
-#line 498 "parser.cc" // lalr1.cc:635
+#line 506 "parser.cc" // lalr1.cc:672
break;
case 65: // enterprise_id
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< uint32_t > (); }
-#line 505 "parser.cc" // lalr1.cc:635
+#line 513 "parser.cc" // lalr1.cc:672
break;
case 66: // pkt4_field
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< TokenPkt4::FieldType > (); }
-#line 512 "parser.cc" // lalr1.cc:635
+#line 520 "parser.cc" // lalr1.cc:672
break;
case 67: // pkt6_field
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< TokenPkt6::FieldType > (); }
-#line 519 "parser.cc" // lalr1.cc:635
+#line 527 "parser.cc" // lalr1.cc:672
break;
case 68: // relay6_field
-#line 111 "parser.yy" // lalr1.cc:635
+#line 111 "parser.yy" // lalr1.cc:672
{ yyoutput << yysym.value.template as< TokenRelay6Field::FieldType > (); }
-#line 526 "parser.cc" // lalr1.cc:635
+#line 534 "parser.cc" // lalr1.cc:672
break;
@@ -534,22 +542,26 @@ namespace isc { namespace eval {
#endif
void
- EvalParser::yypush_ (const char* m, state_type s, symbol_type& sym)
+ EvalParser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
{
- stack_symbol_type t (s, sym);
- yypush_ (m, t);
+ if (m)
+ YY_SYMBOL_PRINT (m, sym);
+ yystack_.push (YY_MOVE (sym));
}
void
- EvalParser::yypush_ (const char* m, stack_symbol_type& s)
+ EvalParser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
{
- if (m)
- YY_SYMBOL_PRINT (m, s);
- yystack_.push (s);
+#if defined __cplusplus && 201103L <= __cplusplus
+ yypush_ (m, stack_symbol_type (s, std::move (sym)));
+#else
+ stack_symbol_type ss (s, sym);
+ yypush_ (m, ss);
+#endif
}
void
- EvalParser::yypop_ (unsigned n)
+ EvalParser::yypop_ (int n)
{
yystack_.pop (n);
}
@@ -604,6 +616,12 @@ namespace isc { namespace eval {
}
int
+ EvalParser::operator() ()
+ {
+ return parse ();
+ }
+
+ int
EvalParser::parse ()
{
// State.
@@ -624,9 +642,9 @@ namespace isc { namespace eval {
/// The return value of parse ().
int yyresult;
- // FIXME: This shoud be completely indented. It is not yet to
- // avoid gratuitous conflicts when merging into the master branch.
+#if YY_EXCEPTIONS
try
+#endif // YY_EXCEPTIONS
{
YYCDEBUG << "Starting parse\n";
@@ -636,7 +654,7 @@ namespace isc { namespace eval {
location values to have been already stored, initialize these
stacks with a primary value. */
yystack_.clear ();
- yypush_ (YY_NULLPTR, 0, yyla);
+ yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
// A new symbol was pushed on the stack.
yynewstate:
@@ -650,7 +668,6 @@ namespace isc { namespace eval {
// Backup.
yybackup:
-
// Try to take a decision without lookahead.
yyn = yypact_[yystack_[0].state];
if (yy_pact_value_is_default_ (yyn))
@@ -660,16 +677,20 @@ namespace isc { namespace eval {
if (yyla.empty ())
{
YYCDEBUG << "Reading a token: ";
+#if YY_EXCEPTIONS
try
+#endif // YY_EXCEPTIONS
{
symbol_type yylookahead (yylex (ctx));
yyla.move (yylookahead);
}
+#if YY_EXCEPTIONS
catch (const syntax_error& yyexc)
{
error (yyexc);
goto yyerrlab1;
}
+#endif // YY_EXCEPTIONS
}
YY_SYMBOL_PRINT ("Next token is", yyla);
@@ -694,7 +715,7 @@ namespace isc { namespace eval {
--yyerrstatus_;
// Shift the lookahead token.
- yypush_ ("Shifting", yyn, yyla);
+ yypush_ ("Shifting", yyn, YY_MOVE (yyla));
goto yynewstate;
/*-----------------------------------------------------------.
@@ -720,27 +741,27 @@ namespace isc { namespace eval {
switch (yyr1_[yyn])
{
case 62: // option_repr_type
- yylhs.value.build< TokenOption::RepresentationType > ();
+ yylhs.value.emplace< TokenOption::RepresentationType > ();
break;
case 66: // pkt4_field
- yylhs.value.build< TokenPkt4::FieldType > ();
+ yylhs.value.emplace< TokenPkt4::FieldType > ();
break;
case 67: // pkt6_field
- yylhs.value.build< TokenPkt6::FieldType > ();
+ yylhs.value.emplace< TokenPkt6::FieldType > ();
break;
case 64: // pkt_metadata
- yylhs.value.build< TokenPkt::MetadataType > ();
+ yylhs.value.emplace< TokenPkt::MetadataType > ();
break;
case 68: // relay6_field
- yylhs.value.build< TokenRelay6Field::FieldType > ();
+ yylhs.value.emplace< TokenRelay6Field::FieldType > ();
break;
case 63: // nest_level
- yylhs.value.build< int8_t > ();
+ yylhs.value.emplace< int8_t > ();
break;
case 50: // "constant string"
@@ -748,16 +769,16 @@ namespace isc { namespace eval {
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
- yylhs.value.build< std::string > ();
+ yylhs.value.emplace< std::string > ();
break;
case 61: // option_code
- yylhs.value.build< uint16_t > ();
+ yylhs.value.emplace< uint16_t > ();
break;
case 60: // integer_expr
case 65: // enterprise_id
- yylhs.value.build< uint32_t > ();
+ yylhs.value.emplace< uint32_t > ();
break;
default:
@@ -774,57 +795,59 @@ namespace isc { namespace eval {
// Perform the reduction.
YY_REDUCE_PRINT (yyn);
+#if YY_EXCEPTIONS
try
+#endif // YY_EXCEPTIONS
{
switch (yyn)
{
case 6:
-#line 131 "parser.yy" // lalr1.cc:856
+#line 131 "parser.yy" // lalr1.cc:907
{
TokenPtr neg(new TokenNot());
ctx.expression.push_back(neg);
}
-#line 788 "parser.cc" // lalr1.cc:856
+#line 811 "parser.cc" // lalr1.cc:907
break;
case 7:
-#line 136 "parser.yy" // lalr1.cc:856
+#line 136 "parser.yy" // lalr1.cc:907
{
TokenPtr neg(new TokenAnd());
ctx.expression.push_back(neg);
}
-#line 797 "parser.cc" // lalr1.cc:856
+#line 820 "parser.cc" // lalr1.cc:907
break;
case 8:
-#line 141 "parser.yy" // lalr1.cc:856
+#line 141 "parser.yy" // lalr1.cc:907
{
TokenPtr neg(new TokenOr());
ctx.expression.push_back(neg);
}
-#line 806 "parser.cc" // lalr1.cc:856
+#line 829 "parser.cc" // lalr1.cc:907
break;
case 9:
-#line 146 "parser.yy" // lalr1.cc:856
+#line 146 "parser.yy" // lalr1.cc:907
{
TokenPtr eq(new TokenEqual());
ctx.expression.push_back(eq);
}
-#line 815 "parser.cc" // lalr1.cc:856
+#line 838 "parser.cc" // lalr1.cc:907
break;
case 10:
-#line 151 "parser.yy" // lalr1.cc:856
+#line 151 "parser.yy" // lalr1.cc:907
{
TokenPtr opt(new TokenOption(yystack_[3].value.as< uint16_t > (), TokenOption::EXISTS));
ctx.expression.push_back(opt);
}
-#line 824 "parser.cc" // lalr1.cc:856
+#line 847 "parser.cc" // lalr1.cc:907
break;
case 11:
-#line 156 "parser.yy" // lalr1.cc:856
+#line 156 "parser.yy" // lalr1.cc:907
{
switch (ctx.getUniverse()) {
case Option::V4:
@@ -844,11 +867,11 @@ namespace isc { namespace eval {
error(yystack_[5].location, "relay4 can only be used in DHCPv4.");
}
}
-#line 848 "parser.cc" // lalr1.cc:856
+#line 871 "parser.cc" // lalr1.cc:907
break;
case 12:
-#line 176 "parser.yy" // lalr1.cc:856
+#line 176 "parser.yy" // lalr1.cc:907
{
switch (ctx.getUniverse()) {
case Option::V6:
@@ -862,11 +885,11 @@ namespace isc { namespace eval {
error(yystack_[10].location, "relay6 can only be used in DHCPv6.");
}
}
-#line 866 "parser.cc" // lalr1.cc:856
+#line 889 "parser.cc" // lalr1.cc:907
break;
case 13:
-#line 190 "parser.yy" // lalr1.cc:856
+#line 190 "parser.yy" // lalr1.cc:907
{
// Expression: vendor-class[1234].exists
//
@@ -875,11 +898,11 @@ namespace isc { namespace eval {
TokenPtr exist(new TokenVendorClass(ctx.getUniverse(), yystack_[3].value.as< uint32_t > (), TokenOption::EXISTS));
ctx.expression.push_back(exist);
}
-#line 879 "parser.cc" // lalr1.cc:856
+#line 902 "parser.cc" // lalr1.cc:907
break;
case 14:
-#line 199 "parser.yy" // lalr1.cc:856
+#line 199 "parser.yy" // lalr1.cc:907
{
// Expression: vendor[1234].exists
//
@@ -888,11 +911,11 @@ namespace isc { namespace eval {
TokenPtr exist(new TokenVendor(ctx.getUniverse(), yystack_[3].value.as< uint32_t > (), TokenOption::EXISTS));
ctx.expression.push_back(exist);
}
-#line 892 "parser.cc" // lalr1.cc:856
+#line 915 "parser.cc" // lalr1.cc:907
break;
case 15:
-#line 208 "parser.yy" // lalr1.cc:856
+#line 208 "parser.yy" // lalr1.cc:907
{
// Expression vendor[1234].option[123].exists
//
@@ -902,11 +925,11 @@ namespace isc { namespace eval {
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 906 "parser.cc" // lalr1.cc:856
+#line 929 "parser.cc" // lalr1.cc:907
break;
case 16:
-#line 218 "parser.yy" // lalr1.cc:856
+#line 218 "parser.yy" // lalr1.cc:907
{
// Expression member('foo')
//
@@ -921,47 +944,47 @@ namespace isc { namespace eval {
TokenPtr member(new TokenMember(cc));
ctx.expression.push_back(member);
}
-#line 925 "parser.cc" // lalr1.cc:856
+#line 948 "parser.cc" // lalr1.cc:907
break;
case 17:
-#line 235 "parser.yy" // lalr1.cc:856
+#line 235 "parser.yy" // lalr1.cc:907
{
TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(str);
}
-#line 934 "parser.cc" // lalr1.cc:856
+#line 957 "parser.cc" // lalr1.cc:907
break;
case 18:
-#line 240 "parser.yy" // lalr1.cc:856
+#line 240 "parser.yy" // lalr1.cc:907
{
TokenPtr hex(new TokenHexString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(hex);
}
-#line 943 "parser.cc" // lalr1.cc:856
+#line 966 "parser.cc" // lalr1.cc:907
break;
case 19:
-#line 245 "parser.yy" // lalr1.cc:856
+#line 245 "parser.yy" // lalr1.cc:907
{
TokenPtr ip(new TokenIpAddress(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(ip);
}
-#line 952 "parser.cc" // lalr1.cc:856
+#line 975 "parser.cc" // lalr1.cc:907
break;
case 20:
-#line 250 "parser.yy" // lalr1.cc:856
+#line 250 "parser.yy" // lalr1.cc:907
{
TokenPtr opt(new TokenOption(yystack_[3].value.as< uint16_t > (), yystack_[0].value.as< TokenOption::RepresentationType > ()));
ctx.expression.push_back(opt);
}
-#line 961 "parser.cc" // lalr1.cc:856
+#line 984 "parser.cc" // lalr1.cc:907
break;
case 21:
-#line 255 "parser.yy" // lalr1.cc:856
+#line 255 "parser.yy" // lalr1.cc:907
{
switch (ctx.getUniverse()) {
case Option::V4:
@@ -981,11 +1004,11 @@ namespace isc { namespace eval {
error(yystack_[5].location, "relay4 can only be used in DHCPv4.");
}
}
-#line 985 "parser.cc" // lalr1.cc:856
+#line 1008 "parser.cc" // lalr1.cc:907
break;
case 22:
-#line 276 "parser.yy" // lalr1.cc:856
+#line 276 "parser.yy" // lalr1.cc:907
{
switch (ctx.getUniverse()) {
case Option::V6:
@@ -999,20 +1022,20 @@ namespace isc { namespace eval {
error(yystack_[10].location, "relay6 can only be used in DHCPv6.");
}
}
-#line 1003 "parser.cc" // lalr1.cc:856
+#line 1026 "parser.cc" // lalr1.cc:907
break;
case 23:
-#line 291 "parser.yy" // lalr1.cc:856
+#line 291 "parser.yy" // lalr1.cc:907
{
TokenPtr pkt_metadata(new TokenPkt(yystack_[0].value.as< TokenPkt::MetadataType > ()));
ctx.expression.push_back(pkt_metadata);
}
-#line 1012 "parser.cc" // lalr1.cc:856
+#line 1035 "parser.cc" // lalr1.cc:907
break;
case 24:
-#line 296 "parser.yy" // lalr1.cc:856
+#line 296 "parser.yy" // lalr1.cc:907
{
switch (ctx.getUniverse()) {
case Option::V4:
@@ -1026,11 +1049,11 @@ namespace isc { namespace eval {
error(yystack_[2].location, "pkt4 can only be used in DHCPv4.");
}
}
-#line 1030 "parser.cc" // lalr1.cc:856
+#line 1053 "parser.cc" // lalr1.cc:907
break;
case 25:
-#line 310 "parser.yy" // lalr1.cc:856
+#line 310 "parser.yy" // lalr1.cc:907
{
switch (ctx.getUniverse()) {
case Option::V6:
@@ -1044,11 +1067,11 @@ namespace isc { namespace eval {
error(yystack_[2].location, "pkt6 can only be used in DHCPv6.");
}
}
-#line 1048 "parser.cc" // lalr1.cc:856
+#line 1071 "parser.cc" // lalr1.cc:907
break;
case 26:
-#line 324 "parser.yy" // lalr1.cc:856
+#line 324 "parser.yy" // lalr1.cc:907
{
switch (ctx.getUniverse()) {
case Option::V6:
@@ -1062,47 +1085,47 @@ namespace isc { namespace eval {
error(yystack_[5].location, "relay6 can only be used in DHCPv6.");
}
}
-#line 1066 "parser.cc" // lalr1.cc:856
+#line 1089 "parser.cc" // lalr1.cc:907
break;
case 27:
-#line 339 "parser.yy" // lalr1.cc:856
+#line 339 "parser.yy" // lalr1.cc:907
{
TokenPtr sub(new TokenSubstring());
ctx.expression.push_back(sub);
}
-#line 1075 "parser.cc" // lalr1.cc:856
+#line 1098 "parser.cc" // lalr1.cc:907
break;
case 28:
-#line 344 "parser.yy" // lalr1.cc:856
+#line 344 "parser.yy" // lalr1.cc:907
{
TokenPtr conc(new TokenConcat());
ctx.expression.push_back(conc);
}
-#line 1084 "parser.cc" // lalr1.cc:856
+#line 1107 "parser.cc" // lalr1.cc:907
break;
case 29:
-#line 349 "parser.yy" // lalr1.cc:856
+#line 349 "parser.yy" // lalr1.cc:907
{
TokenPtr cond(new TokenIfElse());
ctx.expression.push_back(cond);
}
-#line 1093 "parser.cc" // lalr1.cc:856
+#line 1116 "parser.cc" // lalr1.cc:907
break;
case 30:
-#line 354 "parser.yy" // lalr1.cc:856
+#line 354 "parser.yy" // lalr1.cc:907
{
TokenPtr tohex(new TokenToHexString());
ctx.expression.push_back(tohex);
}
-#line 1102 "parser.cc" // lalr1.cc:856
+#line 1125 "parser.cc" // lalr1.cc:907
break;
case 31:
-#line 359 "parser.yy" // lalr1.cc:856
+#line 359 "parser.yy" // lalr1.cc:907
{
// expression: vendor.enterprise
//
@@ -1111,11 +1134,11 @@ namespace isc { namespace eval {
TokenPtr vendor(new TokenVendor(ctx.getUniverse(), 0, TokenVendor::ENTERPRISE_ID));
ctx.expression.push_back(vendor);
}
-#line 1115 "parser.cc" // lalr1.cc:856
+#line 1138 "parser.cc" // lalr1.cc:907
break;
case 32:
-#line 368 "parser.yy" // lalr1.cc:856
+#line 368 "parser.yy" // lalr1.cc:907
{
// expression: vendor-class.enterprise
//
@@ -1125,11 +1148,11 @@ namespace isc { namespace eval {
TokenVendor::ENTERPRISE_ID));
ctx.expression.push_back(vendor);
}
-#line 1129 "parser.cc" // lalr1.cc:856
+#line 1152 "parser.cc" // lalr1.cc:907
break;
case 33:
-#line 378 "parser.yy" // lalr1.cc:856
+#line 378 "parser.yy" // lalr1.cc:907
{
// This token will search for vendor option with
// specified enterprise-id. If found, will search
@@ -1138,11 +1161,11 @@ namespace isc { namespace eval {
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 1142 "parser.cc" // lalr1.cc:856
+#line 1165 "parser.cc" // lalr1.cc:907
break;
case 34:
-#line 387 "parser.yy" // lalr1.cc:856
+#line 387 "parser.yy" // lalr1.cc:907
{
// expression: vendor-class[1234].data
//
@@ -1155,11 +1178,11 @@ namespace isc { namespace eval {
TokenVendor::DATA, 0));
ctx.expression.push_back(vendor_class);
}
-#line 1159 "parser.cc" // lalr1.cc:856
+#line 1182 "parser.cc" // lalr1.cc:907
break;
case 35:
-#line 400 "parser.yy" // lalr1.cc:856
+#line 400 "parser.yy" // lalr1.cc:907
{
// expression: vendor-class[1234].data[5]
//
@@ -1172,263 +1195,265 @@ namespace isc { namespace eval {
TokenVendor::DATA, index));
ctx.expression.push_back(vendor_class);
}
-#line 1176 "parser.cc" // lalr1.cc:856
+#line 1199 "parser.cc" // lalr1.cc:907
break;
case 36:
-#line 413 "parser.yy" // lalr1.cc:856
+#line 413 "parser.yy" // lalr1.cc:907
{
TokenPtr integer(new TokenInteger(yystack_[0].value.as< uint32_t > ()));
ctx.expression.push_back(integer);
}
-#line 1185 "parser.cc" // lalr1.cc:856
+#line 1208 "parser.cc" // lalr1.cc:907
break;
case 37:
-#line 420 "parser.yy" // lalr1.cc:856
+#line 420 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< uint32_t > () = ctx.convertUint32(yystack_[0].value.as< std::string > (), yystack_[0].location);
}
-#line 1193 "parser.cc" // lalr1.cc:856
+#line 1216 "parser.cc" // lalr1.cc:907
break;
case 38:
-#line 426 "parser.yy" // lalr1.cc:856
+#line 426 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< uint16_t > () = ctx.convertOptionCode(yystack_[0].value.as< std::string > (), yystack_[0].location);
}
-#line 1201 "parser.cc" // lalr1.cc:856
+#line 1224 "parser.cc" // lalr1.cc:907
break;
case 39:
-#line 430 "parser.yy" // lalr1.cc:856
+#line 430 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< uint16_t > () = ctx.convertOptionName(yystack_[0].value.as< std::string > (), yystack_[0].location);
}
-#line 1209 "parser.cc" // lalr1.cc:856
+#line 1232 "parser.cc" // lalr1.cc:907
break;
case 40:
-#line 436 "parser.yy" // lalr1.cc:856
+#line 436 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenOption::RepresentationType > () = TokenOption::TEXTUAL;
}
-#line 1217 "parser.cc" // lalr1.cc:856
+#line 1240 "parser.cc" // lalr1.cc:907
break;
case 41:
-#line 440 "parser.yy" // lalr1.cc:856
+#line 440 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenOption::RepresentationType > () = TokenOption::HEXADECIMAL;
}
-#line 1225 "parser.cc" // lalr1.cc:856
+#line 1248 "parser.cc" // lalr1.cc:907
break;
case 42:
-#line 446 "parser.yy" // lalr1.cc:856
+#line 446 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< int8_t > () = ctx.convertNestLevelNumber(yystack_[0].value.as< std::string > (), yystack_[0].location);
}
-#line 1233 "parser.cc" // lalr1.cc:856
+#line 1256 "parser.cc" // lalr1.cc:907
break;
case 43:
-#line 455 "parser.yy" // lalr1.cc:856
+#line 455 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::IFACE;
}
-#line 1241 "parser.cc" // lalr1.cc:856
+#line 1264 "parser.cc" // lalr1.cc:907
break;
case 44:
-#line 459 "parser.yy" // lalr1.cc:856
+#line 459 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::SRC;
}
-#line 1249 "parser.cc" // lalr1.cc:856
+#line 1272 "parser.cc" // lalr1.cc:907
break;
case 45:
-#line 463 "parser.yy" // lalr1.cc:856
+#line 463 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::DST;
}
-#line 1257 "parser.cc" // lalr1.cc:856
+#line 1280 "parser.cc" // lalr1.cc:907
break;
case 46:
-#line 467 "parser.yy" // lalr1.cc:856
+#line 467 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::LEN;
}
-#line 1265 "parser.cc" // lalr1.cc:856
+#line 1288 "parser.cc" // lalr1.cc:907
break;
case 47:
-#line 473 "parser.yy" // lalr1.cc:856
+#line 473 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< uint32_t > () = ctx.convertUint32(yystack_[0].value.as< std::string > (), yystack_[0].location);
}
-#line 1273 "parser.cc" // lalr1.cc:856
+#line 1296 "parser.cc" // lalr1.cc:907
break;
case 48:
-#line 477 "parser.yy" // lalr1.cc:856
+#line 477 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< uint32_t > () = 0;
}
-#line 1281 "parser.cc" // lalr1.cc:856
+#line 1304 "parser.cc" // lalr1.cc:907
break;
case 49:
-#line 483 "parser.yy" // lalr1.cc:856
+#line 483 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::CHADDR;
}
-#line 1289 "parser.cc" // lalr1.cc:856
+#line 1312 "parser.cc" // lalr1.cc:907
break;
case 50:
-#line 487 "parser.yy" // lalr1.cc:856
+#line 487 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::HLEN;
}
-#line 1297 "parser.cc" // lalr1.cc:856
+#line 1320 "parser.cc" // lalr1.cc:907
break;
case 51:
-#line 491 "parser.yy" // lalr1.cc:856
+#line 491 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::HTYPE;
}
-#line 1305 "parser.cc" // lalr1.cc:856
+#line 1328 "parser.cc" // lalr1.cc:907
break;
case 52:
-#line 495 "parser.yy" // lalr1.cc:856
+#line 495 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::CIADDR;
}
-#line 1313 "parser.cc" // lalr1.cc:856
+#line 1336 "parser.cc" // lalr1.cc:907
break;
case 53:
-#line 499 "parser.yy" // lalr1.cc:856
+#line 499 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::GIADDR;
}
-#line 1321 "parser.cc" // lalr1.cc:856
+#line 1344 "parser.cc" // lalr1.cc:907
break;
case 54:
-#line 503 "parser.yy" // lalr1.cc:856
+#line 503 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::YIADDR;
}
-#line 1329 "parser.cc" // lalr1.cc:856
+#line 1352 "parser.cc" // lalr1.cc:907
break;
case 55:
-#line 507 "parser.yy" // lalr1.cc:856
+#line 507 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::SIADDR;
}
-#line 1337 "parser.cc" // lalr1.cc:856
+#line 1360 "parser.cc" // lalr1.cc:907
break;
case 56:
-#line 511 "parser.yy" // lalr1.cc:856
+#line 511 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::MSGTYPE;
}
-#line 1345 "parser.cc" // lalr1.cc:856
+#line 1368 "parser.cc" // lalr1.cc:907
break;
case 57:
-#line 515 "parser.yy" // lalr1.cc:856
+#line 515 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::TRANSID;
}
-#line 1353 "parser.cc" // lalr1.cc:856
+#line 1376 "parser.cc" // lalr1.cc:907
break;
case 58:
-#line 521 "parser.yy" // lalr1.cc:856
+#line 521 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt6::FieldType > () = TokenPkt6::MSGTYPE;
}
-#line 1361 "parser.cc" // lalr1.cc:856
+#line 1384 "parser.cc" // lalr1.cc:907
break;
case 59:
-#line 525 "parser.yy" // lalr1.cc:856
+#line 525 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenPkt6::FieldType > () = TokenPkt6::TRANSID;
}
-#line 1369 "parser.cc" // lalr1.cc:856
+#line 1392 "parser.cc" // lalr1.cc:907
break;
case 60:
-#line 531 "parser.yy" // lalr1.cc:856
+#line 531 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenRelay6Field::FieldType > () = TokenRelay6Field::PEERADDR;
}
-#line 1377 "parser.cc" // lalr1.cc:856
+#line 1400 "parser.cc" // lalr1.cc:907
break;
case 61:
-#line 535 "parser.yy" // lalr1.cc:856
+#line 535 "parser.yy" // lalr1.cc:907
{
yylhs.value.as< TokenRelay6Field::FieldType > () = TokenRelay6Field::LINKADDR;
}
-#line 1385 "parser.cc" // lalr1.cc:856
+#line 1408 "parser.cc" // lalr1.cc:907
break;
case 62:
-#line 541 "parser.yy" // lalr1.cc:856
+#line 541 "parser.yy" // lalr1.cc:907
{
TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(str);
}
-#line 1394 "parser.cc" // lalr1.cc:856
+#line 1417 "parser.cc" // lalr1.cc:907
break;
case 63:
-#line 548 "parser.yy" // lalr1.cc:856
+#line 548 "parser.yy" // lalr1.cc:907
{
TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
ctx.expression.push_back(str);
}
-#line 1403 "parser.cc" // lalr1.cc:856
+#line 1426 "parser.cc" // lalr1.cc:907
break;
case 64:
-#line 553 "parser.yy" // lalr1.cc:856
+#line 553 "parser.yy" // lalr1.cc:907
{
TokenPtr str(new TokenString("all"));
ctx.expression.push_back(str);
}
-#line 1412 "parser.cc" // lalr1.cc:856
+#line 1435 "parser.cc" // lalr1.cc:907
break;
-#line 1416 "parser.cc" // lalr1.cc:856
+#line 1439 "parser.cc" // lalr1.cc:907
default:
break;
}
}
+#if YY_EXCEPTIONS
catch (const syntax_error& yyexc)
{
error (yyexc);
YYERROR;
}
+#endif // YY_EXCEPTIONS
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
yypop_ (yylen);
yylen = 0;
YY_STACK_PRINT ();
// Shift the result of the reduction.
- yypush_ (YY_NULLPTR, yylhs);
+ yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
}
goto yynewstate;
@@ -1516,7 +1541,7 @@ namespace isc { namespace eval {
// Shift the error token.
error_token.state = yyn;
- yypush_ ("Shifting", error_token);
+ yypush_ ("Shifting", YY_MOVE (error_token));
}
goto yynewstate;
@@ -1545,11 +1570,12 @@ namespace isc { namespace eval {
return yyresult;
}
+#if YY_EXCEPTIONS
catch (...)
{
YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
// Do not try to display the values of the reclaimed symbols,
- // as their printer might throw an exception.
+ // as their printers might throw an exception.
if (!yyla.empty ())
yy_destroy_ (YY_NULLPTR, yyla);
@@ -1560,6 +1586,7 @@ namespace isc { namespace eval {
}
throw;
}
+#endif // YY_EXCEPTIONS
}
void
@@ -1670,7 +1697,7 @@ namespace isc { namespace eval {
const signed char EvalParser::yytable_ninf_ = -1;
- const short int
+ const short
EvalParser::yypact_[] =
{
-14, 27, 76, 17, 27, 27, 37, 41, 53, 39,
@@ -1718,14 +1745,14 @@ namespace isc { namespace eval {
15, 33
};
- const short int
+ const short
EvalParser::yypgoto_[] =
{
-118, -118, -118, 3, -2, -118, -36, -117, 138, -118,
-34, -118, -118, -118, -118, -118
};
- const short int
+ const short
EvalParser::yydefgoto_[] =
{
-1, 3, 23, 24, 25, 26, 62, 136, 65, 71,
@@ -1855,7 +1882,7 @@ namespace isc { namespace eval {
};
#if EVALDEBUG
- const unsigned short int
+ const unsigned short
EvalParser::yyrline_[] =
{
0, 120, 120, 121, 126, 129, 130, 135, 140, 145,
@@ -1897,10 +1924,10 @@ namespace isc { namespace eval {
#endif // EVALDEBUG
-#line 14 "parser.yy" // lalr1.cc:1163
+#line 14 "parser.yy" // lalr1.cc:1218
} } // isc::eval
-#line 1903 "parser.cc" // lalr1.cc:1163
-#line 559 "parser.yy" // lalr1.cc:1164
+#line 1930 "parser.cc" // lalr1.cc:1218
+#line 559 "parser.yy" // lalr1.cc:1219
void
isc::eval::EvalParser::error(const location_type& loc,
diff --git a/src/lib/eval/parser.h b/src/lib/eval/parser.h
index c79f0fddbb..7a3a14c82f 100644
--- a/src/lib/eval/parser.h
+++ b/src/lib/eval/parser.h
@@ -1,4 +1,4 @@
-// A Bison parser, made by GNU Bison 3.0.5.
+// A Bison parser, made by GNU Bison 3.2.1.
// Skeleton interface for Bison LALR(1) parsers in C++
@@ -30,6 +30,7 @@
// This special exception was added by the Free Software Foundation in
// version 2.2 of Bison.
+
/**
** \file parser.h
** Define the isc::eval::parser class.
@@ -37,10 +38,13 @@
// 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.
+
#ifndef YY_EVAL_PARSER_H_INCLUDED
# define YY_EVAL_PARSER_H_INCLUDED
// // "%code requires" blocks.
-#line 17 "parser.yy" // lalr1.cc:379
+#line 17 "parser.yy" // lalr1.cc:404
#include <string>
#include <eval/token.h>
@@ -51,7 +55,7 @@
using namespace isc::dhcp;
using namespace isc::eval;
-#line 55 "parser.h" // lalr1.cc:379
+#line 59 "parser.h" // lalr1.cc:404
# include <cassert>
# include <cstdlib> // std::abort
@@ -59,7 +63,21 @@ using namespace isc::eval;
# include <stdexcept>
# include <string>
# include <vector>
-# include "stack.hh"
+
+// Support move semantics when possible.
+#if defined __cplusplus && 201103L <= __cplusplus
+# define YY_MOVE std::move
+# define YY_MOVE_OR_COPY move
+# define YY_MOVE_REF(Type) Type&&
+# define YY_RVREF(Type) Type&&
+# define YY_COPY(Type) Type
+#else
+# define YY_MOVE
+# define YY_MOVE_OR_COPY copy
+# define YY_MOVE_REF(Type) Type&
+# define YY_RVREF(Type) const Type&
+# define YY_COPY(Type) const Type&
+#endif
# include "location.hh"
#include <typeinfo>
#ifndef YYASSERT
@@ -86,15 +104,6 @@ using namespace isc::eval;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -102,7 +111,7 @@ using namespace isc::eval;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
@@ -121,6 +130,18 @@ using namespace isc::eval;
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# else
+# define YY_NULLPTR ((void*)0)
+# endif
+# endif
+
/* Debug traces. */
#ifndef EVALDEBUG
# if defined YYDEBUG
@@ -134,9 +155,128 @@ using namespace isc::eval;
# endif /* ! defined YYDEBUG */
#endif /* ! defined EVALDEBUG */
-#line 14 "parser.yy" // lalr1.cc:379
+#line 14 "parser.yy" // lalr1.cc:404
namespace isc { namespace eval {
-#line 140 "parser.h" // lalr1.cc:379
+#line 161 "parser.h" // lalr1.cc:404
+
+ /// A stack with random access from its top.
+ template <typename T, typename S = std::vector<T> >
+ class stack
+ {
+ public:
+ // Hide our reversed order.
+ typedef typename S::reverse_iterator iterator;
+ typedef typename S::const_reverse_iterator const_iterator;
+ typedef typename S::size_type size_type;
+
+ stack (size_type n = 200)
+ : seq_ (n)
+ {}
+
+ /// Random access.
+ ///
+ /// Index 0 returns the topmost element.
+ T&
+ operator[] (size_type i)
+ {
+ return seq_[size () - 1 - i];
+ }
+
+ /// Random access.
+ ///
+ /// Index 0 returns the topmost element.
+ T&
+ operator[] (int i)
+ {
+ return operator[] (size_type (i));
+ }
+
+ /// Random access.
+ ///
+ /// Index 0 returns the topmost element.
+ const T&
+ operator[] (size_type i) const
+ {
+ return seq_[size () - 1 - i];
+ }
+
+ /// Random access.
+ ///
+ /// Index 0 returns the topmost element.
+ const T&
+ operator[] (int i) const
+ {
+ return operator[] (size_type (i));
+ }
+
+ /// Steal the contents of \a t.
+ ///
+ /// Close to move-semantics.
+ void
+ push (YY_MOVE_REF (T) t)
+ {
+ seq_.push_back (T ());
+ operator[](0).move (t);
+ }
+
+ void
+ pop (int n = 1)
+ {
+ for (; 0 < n; --n)
+ seq_.pop_back ();
+ }
+
+ void
+ clear ()
+ {
+ seq_.clear ();
+ }
+
+ size_type
+ size () const
+ {
+ return seq_.size ();
+ }
+
+ const_iterator
+ begin () const
+ {
+ return seq_.rbegin ();
+ }
+
+ const_iterator
+ end () const
+ {
+ return seq_.rend ();
+ }
+
+ private:
+ stack (const stack&);
+ stack& operator= (const stack&);
+ /// The wrapped container.
+ S seq_;
+ };
+
+ /// Present a slice of the top of a stack.
+ template <typename T, typename S = stack<T> >
+ class slice
+ {
+ public:
+ slice (const S& stack, int range)
+ : stack_ (stack)
+ , range_ (range)
+ {}
+
+ const T&
+ operator[] (int i) const
+ {
+ return stack_[range_ - i];
+ }
+
+ private:
+ const S& stack_;
+ int range_;
+ };
@@ -153,16 +293,17 @@ namespace isc { namespace eval {
/// Empty construction.
variant ()
- : yytypeid_ (YY_NULLPTR)
+ : yybuffer_ ()
+ , yytypeid_ (YY_NULLPTR)
{}
/// Construct and fill.
template <typename T>
- variant (const T& t)
+ variant (YY_RVREF (T) t)
: yytypeid_ (&typeid (T))
{
YYASSERT (sizeof (T) <= S);
- new (yyas_<T> ()) T (t);
+ new (yyas_<T> ()) T (YY_MOVE (t));
}
/// Destruction, allowed only if empty.
@@ -174,30 +315,62 @@ namespace isc { namespace eval {
/// Instantiate an empty \a T in here.
template <typename T>
T&
- build ()
+ emplace ()
{
YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);
- return *new (yyas_<T> ()) T;
+ return *new (yyas_<T> ()) T ();
}
+# if defined __cplusplus && 201103L <= __cplusplus
+ /// Instantiate a \a T in here from \a t.
+ template <typename T, typename U>
+ T&
+ emplace (U&& u)
+ {
+ YYASSERT (!yytypeid_);
+ YYASSERT (sizeof (T) <= S);
+ yytypeid_ = & typeid (T);
+ return *new (yyas_<T> ()) T (std::forward <U>(u));
+ }
+# else
/// Instantiate a \a T in here from \a t.
template <typename T>
T&
- build (const T& t)
+ emplace (const T& t)
{
YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);
return *new (yyas_<T> ()) T (t);
}
+# endif
+
+ /// Instantiate an empty \a T in here.
+ /// Obsolete, use emplace.
+ template <typename T>
+ T&
+ build ()
+ {
+ return emplace<T> ();
+ }
+
+ /// Instantiate a \a T in here from \a t.
+ /// Obsolete, use emplace.
+ template <typename T>
+ T&
+ build (const T& t)
+ {
+ return emplace<T> (t);
+ }
/// Accessor to a built \a T.
template <typename T>
T&
as ()
{
+ YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
@@ -208,6 +381,7 @@ namespace isc { namespace eval {
const T&
as () const
{
+ YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
@@ -218,7 +392,7 @@ namespace isc { namespace eval {
/// Both variants must be built beforehand, because swapping the actual
/// data requires reading it (with as()), and this is not possible on
/// unconstructed variants: it would require some dynamic testing, which
- /// should not be the variant's responsability.
+ /// should not be the variant's responsibility.
/// Swapping between built and (possibly) non-built is done with
/// variant::move ().
template <typename T>
@@ -237,17 +411,32 @@ namespace isc { namespace eval {
void
move (self_type& other)
{
- build<T> ();
+# if defined __cplusplus && 201103L <= __cplusplus
+ emplace<T> (std::move (other.as<T> ()));
+# else
+ emplace<T> ();
swap<T> (other);
+# endif
+ other.destroy<T> ();
+ }
+
+# if defined __cplusplus && 201103L <= __cplusplus
+ /// Move the content of \a other to this.
+ template <typename T>
+ void
+ move (self_type&& other)
+ {
+ emplace<T> (std::move (other.as<T> ()));
other.destroy<T> ();
}
+#endif
/// Copy the content of \a other to this.
template <typename T>
void
copy (const self_type& other)
{
- build<T> (other.as<T> ());
+ emplace<T> (other.as<T> ());
}
/// Destroy the stored \a T.
@@ -261,7 +450,7 @@ namespace isc { namespace eval {
private:
/// Prohibit blind copies.
- self_type& operator=(const self_type&);
+ self_type& operator= (const self_type&);
variant (const self_type&);
/// Accessor to raw memory as \a T.
@@ -304,40 +493,40 @@ namespace isc { namespace eval {
union union_type
{
// option_repr_type
- char dummy1[sizeof(TokenOption::RepresentationType)];
+ char dummy1[sizeof (TokenOption::RepresentationType)];
// pkt4_field
- char dummy2[sizeof(TokenPkt4::FieldType)];
+ char dummy2[sizeof (TokenPkt4::FieldType)];
// pkt6_field
- char dummy3[sizeof(TokenPkt6::FieldType)];
+ char dummy3[sizeof (TokenPkt6::FieldType)];
// pkt_metadata
- char dummy4[sizeof(TokenPkt::MetadataType)];
+ char dummy4[sizeof (TokenPkt::MetadataType)];
// relay6_field
- char dummy5[sizeof(TokenRelay6Field::FieldType)];
+ char dummy5[sizeof (TokenRelay6Field::FieldType)];
// nest_level
- char dummy6[sizeof(int8_t)];
+ char dummy6[sizeof (int8_t)];
// "constant string"
// "integer"
// "constant hexstring"
// "option name"
// "ip address"
- char dummy7[sizeof(std::string)];
+ char dummy7[sizeof (std::string)];
// option_code
- char dummy8[sizeof(uint16_t)];
+ char dummy8[sizeof (uint16_t)];
// integer_expr
// enterprise_id
- char dummy9[sizeof(uint32_t)];
+ char dummy9[sizeof (uint32_t)];
};
/// Symbol semantic values.
- typedef variant<sizeof(union_type)> semantic_type;
+ typedef variant<sizeof (union_type)> semantic_type;
#else
typedef EVALSTYPE semantic_type;
#endif
@@ -427,7 +616,7 @@ namespace isc { namespace eval {
/// A complete symbol.
///
/// Expects its Base type to provide access to the symbol type
- /// via type_get().
+ /// via type_get ().
///
/// Provide access to semantic value and location.
template <typename Base>
@@ -439,36 +628,22 @@ namespace isc { namespace eval {
/// Default constructor.
basic_symbol ();
- /// Copy constructor.
- basic_symbol (const basic_symbol& other);
-
- /// Constructor for valueless symbols, and symbols from each type.
-
- basic_symbol (typename Base::kind_type t, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const TokenOption::RepresentationType v, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const TokenPkt4::FieldType v, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const TokenPkt6::FieldType v, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const TokenPkt::MetadataType v, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const TokenRelay6Field::FieldType v, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const int8_t v, const location_type& l);
+ /// Move or copy constructor.
+ basic_symbol (YY_RVREF (basic_symbol) other);
- basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const uint16_t v, const location_type& l);
-
- basic_symbol (typename Base::kind_type t, const uint32_t v, const location_type& l);
+ /// Constructor for valueless symbols, and symbols from each type.
+ basic_symbol (typename Base::kind_type t, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (TokenOption::RepresentationType) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (TokenPkt4::FieldType) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (TokenPkt6::FieldType) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (TokenPkt::MetadataType) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (TokenRelay6Field::FieldType) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (int8_t) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (std::string) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (uint16_t) v, YY_RVREF (location_type) l);
+ basic_symbol (typename Base::kind_type t, YY_RVREF (uint32_t) v, YY_RVREF (location_type) l);
- /// Constructor for symbols with semantic value.
- basic_symbol (typename Base::kind_type t,
- const semantic_type& v,
- const location_type& l);
/// Destroy the symbol.
~basic_symbol ();
@@ -489,8 +664,10 @@ namespace isc { namespace eval {
location_type location;
private:
+#if !defined __cplusplus || __cplusplus < 201103L
/// Assignment operator.
basic_symbol& operator= (const basic_symbol& other);
+#endif
};
/// Type access provider for token (enum) based symbols.
@@ -530,249 +707,254 @@ namespace isc { namespace eval {
/// "External" symbols: returned by the scanner.
typedef basic_symbol<by_type> symbol_type;
+ /// Build a parser object.
+ EvalParser (EvalContext& ctx_yyarg);
+ virtual ~EvalParser ();
+
+ /// Parse. An alias for parse ().
+ /// \returns 0 iff parsing succeeded.
+ int operator() ();
+
+ /// Parse.
+ /// \returns 0 iff parsing succeeded.
+ virtual int parse ();
+
+#if EVALDEBUG
+ /// The current debugging stream.
+ std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
+ /// Set the current debugging stream.
+ void set_debug_stream (std::ostream &);
+
+ /// Type for debugging levels.
+ typedef int debug_level_type;
+ /// The current debugging level.
+ debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
+ /// Set the current debugging level.
+ void set_debug_level (debug_level_type l);
+#endif
+
+ /// Report a syntax error.
+ /// \param loc where the syntax error is found.
+ /// \param msg a description of the syntax error.
+ virtual void error (const location_type& loc, const std::string& msg);
+
+ /// Report a syntax error.
+ void error (const syntax_error& err);
+
// Symbol constructors declarations.
- static inline
+ static
symbol_type
- make_END (const location_type& l);
+ make_END (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_LPAREN (const location_type& l);
+ make_LPAREN (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_RPAREN (const location_type& l);
+ make_RPAREN (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_NOT (const location_type& l);
+ make_NOT (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_AND (const location_type& l);
+ make_AND (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_OR (const location_type& l);
+ make_OR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_EQUAL (const location_type& l);
+ make_EQUAL (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_OPTION (const location_type& l);
+ make_OPTION (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_RELAY4 (const location_type& l);
+ make_RELAY4 (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_RELAY6 (const location_type& l);
+ make_RELAY6 (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_MEMBER (const location_type& l);
+ make_MEMBER (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_PEERADDR (const location_type& l);
+ make_PEERADDR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_LINKADDR (const location_type& l);
+ make_LINKADDR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_LBRACKET (const location_type& l);
+ make_LBRACKET (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_RBRACKET (const location_type& l);
+ make_RBRACKET (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_DOT (const location_type& l);
+ make_DOT (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_TEXT (const location_type& l);
+ make_TEXT (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_HEX (const location_type& l);
+ make_HEX (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_EXISTS (const location_type& l);
+ make_EXISTS (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_PKT (const location_type& l);
+ make_PKT (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_IFACE (const location_type& l);
+ make_IFACE (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_SRC (const location_type& l);
+ make_SRC (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_DST (const location_type& l);
+ make_DST (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_LEN (const location_type& l);
+ make_LEN (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_PKT4 (const location_type& l);
+ make_PKT4 (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_CHADDR (const location_type& l);
+ make_CHADDR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_HLEN (const location_type& l);
+ make_HLEN (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_HTYPE (const location_type& l);
+ make_HTYPE (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_CIADDR (const location_type& l);
+ make_CIADDR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_GIADDR (const location_type& l);
+ make_GIADDR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_YIADDR (const location_type& l);
+ make_YIADDR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_SIADDR (const location_type& l);
+ make_SIADDR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_SUBSTRING (const location_type& l);
+ make_SUBSTRING (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_ALL (const location_type& l);
+ make_ALL (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_COMA (const location_type& l);
+ make_COMA (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_CONCAT (const location_type& l);
+ make_CONCAT (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_IFELSE (const location_type& l);
+ make_IFELSE (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_TOHEXSTRING (const location_type& l);
+ make_TOHEXSTRING (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_PKT6 (const location_type& l);
+ make_PKT6 (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_MSGTYPE (const location_type& l);
+ make_MSGTYPE (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_TRANSID (const location_type& l);
+ make_TRANSID (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_VENDOR_CLASS (const location_type& l);
+ make_VENDOR_CLASS (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_VENDOR (const location_type& l);
+ make_VENDOR (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_ANY (const location_type& l);
+ make_ANY (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_DATA (const location_type& l);
+ make_DATA (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_ENTERPRISE (const location_type& l);
+ make_ENTERPRISE (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_TOPLEVEL_BOOL (const location_type& l);
+ make_TOPLEVEL_BOOL (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_TOPLEVEL_STRING (const location_type& l);
+ make_TOPLEVEL_STRING (YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_STRING (const std::string& v, const location_type& l);
+ make_STRING (YY_COPY (std::string) v, YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_INTEGER (const std::string& v, const location_type& l);
+ make_INTEGER (YY_COPY (std::string) v, YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_HEXSTRING (const std::string& v, const location_type& l);
+ make_HEXSTRING (YY_COPY (std::string) v, YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_OPTION_NAME (const std::string& v, const location_type& l);
+ make_OPTION_NAME (YY_COPY (std::string) v, YY_COPY (location_type) l);
- static inline
+ static
symbol_type
- make_IP_ADDRESS (const std::string& v, const location_type& l);
-
-
- /// Build a parser object.
- EvalParser (EvalContext& ctx_yyarg);
- virtual ~EvalParser ();
-
- /// Parse.
- /// \returns 0 iff parsing succeeded.
- virtual int parse ();
-
-#if EVALDEBUG
- /// The current debugging stream.
- std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
- /// Set the current debugging stream.
- void set_debug_stream (std::ostream &);
-
- /// Type for debugging levels.
- typedef int debug_level_type;
- /// The current debugging level.
- debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
- /// Set the current debugging level.
- void set_debug_level (debug_level_type l);
-#endif
+ make_IP_ADDRESS (YY_COPY (std::string) v, YY_COPY (location_type) l);
- /// Report a syntax error.
- /// \param loc where the syntax error is found.
- /// \param msg a description of the syntax error.
- virtual void error (const location_type& loc, const std::string& msg);
- /// Report a syntax error.
- void error (const syntax_error& err);
private:
/// This class is not copyable.
@@ -810,7 +992,7 @@ namespace isc { namespace eval {
// Tables.
// YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
// STATE-NUM.
- static const short int yypact_[];
+ static const short yypact_[];
// YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
// Performed when YYTABLE does not specify something else to do. Zero
@@ -818,10 +1000,10 @@ namespace isc { namespace eval {
static const unsigned char yydefact_[];
// YYPGOTO[NTERM-NUM].
- static const short int yypgoto_[];
+ static const short yypgoto_[];
// YYDEFGOTO[NTERM-NUM].
- static const short int yydefgoto_[];
+ static const short yydefgoto_[];
// YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
// positive, shift that token. If negative, reduce the rule whose
@@ -849,14 +1031,15 @@ namespace isc { namespace eval {
static const char* const yytname_[];
#if EVALDEBUG
// YYRLINE[YYN] -- Source line where rule number YYN was defined.
- static const unsigned short int yyrline_[];
+ static const unsigned short yyrline_[];
/// Report on the debug stream that the rule \a r is going to be reduced.
virtual void yy_reduce_print_ (int r);
/// Print the state stack on the debug stream.
virtual void yystack_print_ ();
- // Debugging.
+ /// Debugging level.
int yydebug_;
+ /// Debug stream.
std::ostream* yycdebug_;
/// \brief Display a symbol type, value and location.
@@ -914,12 +1097,15 @@ namespace isc { namespace eval {
typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol.
stack_symbol_type ();
- /// Copy construct.
- stack_symbol_type (const stack_symbol_type& that);
+ /// Move or copy construction.
+ stack_symbol_type (YY_RVREF (stack_symbol_type) that);
/// Steal the contents from \a sym to build this.
- stack_symbol_type (state_type s, symbol_type& sym);
- /// Assignment, needed by push_back.
- stack_symbol_type& operator= (const stack_symbol_type& that);
+ stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
+#if !defined __cplusplus || __cplusplus < 201103L
+ /// Assignment, needed by push_back by some old implementations.
+ /// Moves the contents of that.
+ stack_symbol_type& operator= (stack_symbol_type& that);
+#endif
};
/// Stack type.
@@ -931,20 +1117,20 @@ namespace isc { namespace eval {
/// Push a new state on the stack.
/// \param m a debug message to display
/// if null, no trace is output.
- /// \param s the symbol
+ /// \param sym the symbol
/// \warning the contents of \a s.value is stolen.
- void yypush_ (const char* m, stack_symbol_type& s);
+ void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
/// Push a new look ahead token on the state on the stack.
/// \param m a debug message to display
/// if null, no trace is output.
/// \param s the state
/// \param sym the symbol (for its value and location).
- /// \warning the contents of \a s.value is stolen.
- void yypush_ (const char* m, state_type s, symbol_type& sym);
+ /// \warning the contents of \a sym.value is stolen.
+ void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
- /// Pop \a n symbols the three stacks.
- void yypop_ (unsigned n = 1);
+ /// Pop \a n symbols from the stack.
+ void yypop_ (int n = 1);
/// Constants.
enum
@@ -1025,38 +1211,39 @@ namespace isc { namespace eval {
template <typename Base>
EvalParser::basic_symbol<Base>::basic_symbol ()
: value ()
+ , location ()
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
- : Base (other)
+ EvalParser::basic_symbol<Base>::basic_symbol (YY_RVREF (basic_symbol) other)
+ : Base (YY_MOVE (other))
, value ()
- , location (other.location)
+ , location (YY_MOVE (other.location))
{
switch (other.type_get ())
{
case 62: // option_repr_type
- value.copy< TokenOption::RepresentationType > (other.value);
+ value.YY_MOVE_OR_COPY< TokenOption::RepresentationType > (YY_MOVE (other.value));
break;
case 66: // pkt4_field
- value.copy< TokenPkt4::FieldType > (other.value);
+ value.YY_MOVE_OR_COPY< TokenPkt4::FieldType > (YY_MOVE (other.value));
break;
case 67: // pkt6_field
- value.copy< TokenPkt6::FieldType > (other.value);
+ value.YY_MOVE_OR_COPY< TokenPkt6::FieldType > (YY_MOVE (other.value));
break;
case 64: // pkt_metadata
- value.copy< TokenPkt::MetadataType > (other.value);
+ value.YY_MOVE_OR_COPY< TokenPkt::MetadataType > (YY_MOVE (other.value));
break;
case 68: // relay6_field
- value.copy< TokenRelay6Field::FieldType > (other.value);
+ value.YY_MOVE_OR_COPY< TokenRelay6Field::FieldType > (YY_MOVE (other.value));
break;
case 63: // nest_level
- value.copy< int8_t > (other.value);
+ value.YY_MOVE_OR_COPY< int8_t > (YY_MOVE (other.value));
break;
case 50: // "constant string"
@@ -1064,16 +1251,16 @@ namespace isc { namespace eval {
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
- value.copy< std::string > (other.value);
+ value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (other.value));
break;
case 61: // option_code
- value.copy< uint16_t > (other.value);
+ value.YY_MOVE_OR_COPY< uint16_t > (YY_MOVE (other.value));
break;
case 60: // integer_expr
case 65: // enterprise_id
- value.copy< uint32_t > (other.value);
+ value.YY_MOVE_OR_COPY< uint32_t > (YY_MOVE (other.value));
break;
default:
@@ -1082,135 +1269,79 @@ namespace isc { namespace eval {
}
- template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
- : Base (t)
- , value ()
- , location (l)
- {
- (void) v;
- switch (this->type_get ())
- {
- case 62: // option_repr_type
- value.copy< TokenOption::RepresentationType > (v);
- break;
-
- case 66: // pkt4_field
- value.copy< TokenPkt4::FieldType > (v);
- break;
-
- case 67: // pkt6_field
- value.copy< TokenPkt6::FieldType > (v);
- break;
-
- case 64: // pkt_metadata
- value.copy< TokenPkt::MetadataType > (v);
- break;
-
- case 68: // relay6_field
- value.copy< TokenRelay6Field::FieldType > (v);
- break;
-
- case 63: // nest_level
- value.copy< int8_t > (v);
- break;
-
- case 50: // "constant string"
- case 51: // "integer"
- case 52: // "constant hexstring"
- case 53: // "option name"
- case 54: // "ip address"
- value.copy< std::string > (v);
- break;
-
- case 61: // option_code
- value.copy< uint16_t > (v);
- break;
-
- case 60: // integer_expr
- case 65: // enterprise_id
- value.copy< uint32_t > (v);
- break;
-
- default:
- break;
- }
-}
-
// Implementation of basic_symbol constructor for each type.
-
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (location_type) l)
: Base (t)
- , value ()
- , location (l)
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenOption::RepresentationType v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (TokenOption::RepresentationType) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenPkt4::FieldType v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (TokenPkt4::FieldType) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenPkt6::FieldType v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (TokenPkt6::FieldType) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenPkt::MetadataType v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (TokenPkt::MetadataType) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenRelay6Field::FieldType v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (TokenRelay6Field::FieldType) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int8_t v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (int8_t) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (std::string) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const uint16_t v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (uint16_t) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
template <typename Base>
- EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const uint32_t v, const location_type& l)
+ EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (uint32_t) v, YY_RVREF (location_type) l)
: Base (t)
- , value (v)
- , location (l)
+ , value (YY_MOVE (v))
+ , location (YY_MOVE (l))
{}
+
template <typename Base>
EvalParser::basic_symbol<Base>::~basic_symbol ()
{
@@ -1297,27 +1428,27 @@ namespace isc { namespace eval {
switch (this->type_get ())
{
case 62: // option_repr_type
- value.move< TokenOption::RepresentationType > (s.value);
+ value.move< TokenOption::RepresentationType > (YY_MOVE (s.value));
break;
case 66: // pkt4_field
- value.move< TokenPkt4::FieldType > (s.value);
+ value.move< TokenPkt4::FieldType > (YY_MOVE (s.value));
break;
case 67: // pkt6_field
- value.move< TokenPkt6::FieldType > (s.value);
+ value.move< TokenPkt6::FieldType > (YY_MOVE (s.value));
break;
case 64: // pkt_metadata
- value.move< TokenPkt::MetadataType > (s.value);
+ value.move< TokenPkt::MetadataType > (YY_MOVE (s.value));
break;
case 68: // relay6_field
- value.move< TokenRelay6Field::FieldType > (s.value);
+ value.move< TokenRelay6Field::FieldType > (YY_MOVE (s.value));
break;
case 63: // nest_level
- value.move< int8_t > (s.value);
+ value.move< int8_t > (YY_MOVE (s.value));
break;
case 50: // "constant string"
@@ -1325,23 +1456,23 @@ namespace isc { namespace eval {
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
- value.move< std::string > (s.value);
+ value.move< std::string > (YY_MOVE (s.value));
break;
case 61: // option_code
- value.move< uint16_t > (s.value);
+ value.move< uint16_t > (YY_MOVE (s.value));
break;
case 60: // integer_expr
case 65: // enterprise_id
- value.move< uint32_t > (s.value);
+ value.move< uint32_t > (YY_MOVE (s.value));
break;
default:
break;
}
- location = s.location;
+ location = YY_MOVE (s.location);
}
// by_type.
@@ -1389,7 +1520,7 @@ namespace isc { namespace eval {
// YYTOKNUM[NUM] -- (External) token number corresponding to the
// (internal) symbol number NUM (which must be that of a token). */
static
- const unsigned short int
+ const unsigned short
yytoken_number_[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -1401,329 +1532,383 @@ namespace isc { namespace eval {
};
return static_cast<token_type> (yytoken_number_[type]);
}
+
// Implementation of make_symbol for each symbol type.
+ inline
EvalParser::symbol_type
- EvalParser::make_END (const location_type& l)
+ EvalParser::make_END (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_END, l);
+ return symbol_type (token::TOKEN_END, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_LPAREN (const location_type& l)
+ EvalParser::make_LPAREN (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_LPAREN, l);
+ return symbol_type (token::TOKEN_LPAREN, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_RPAREN (const location_type& l)
+ EvalParser::make_RPAREN (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_RPAREN, l);
+ return symbol_type (token::TOKEN_RPAREN, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_NOT (const location_type& l)
+ EvalParser::make_NOT (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_NOT, l);
+ return symbol_type (token::TOKEN_NOT, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_AND (const location_type& l)
+ EvalParser::make_AND (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_AND, l);
+ return symbol_type (token::TOKEN_AND, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_OR (const location_type& l)
+ EvalParser::make_OR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_OR, l);
+ return symbol_type (token::TOKEN_OR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_EQUAL (const location_type& l)
+ EvalParser::make_EQUAL (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_EQUAL, l);
+ return symbol_type (token::TOKEN_EQUAL, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_OPTION (const location_type& l)
+ EvalParser::make_OPTION (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_OPTION, l);
+ return symbol_type (token::TOKEN_OPTION, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_RELAY4 (const location_type& l)
+ EvalParser::make_RELAY4 (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_RELAY4, l);
+ return symbol_type (token::TOKEN_RELAY4, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_RELAY6 (const location_type& l)
+ EvalParser::make_RELAY6 (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_RELAY6, l);
+ return symbol_type (token::TOKEN_RELAY6, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_MEMBER (const location_type& l)
+ EvalParser::make_MEMBER (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_MEMBER, l);
+ return symbol_type (token::TOKEN_MEMBER, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_PEERADDR (const location_type& l)
+ EvalParser::make_PEERADDR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_PEERADDR, l);
+ return symbol_type (token::TOKEN_PEERADDR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_LINKADDR (const location_type& l)
+ EvalParser::make_LINKADDR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_LINKADDR, l);
+ return symbol_type (token::TOKEN_LINKADDR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_LBRACKET (const location_type& l)
+ EvalParser::make_LBRACKET (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_LBRACKET, l);
+ return symbol_type (token::TOKEN_LBRACKET, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_RBRACKET (const location_type& l)
+ EvalParser::make_RBRACKET (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_RBRACKET, l);
+ return symbol_type (token::TOKEN_RBRACKET, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_DOT (const location_type& l)
+ EvalParser::make_DOT (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_DOT, l);
+ return symbol_type (token::TOKEN_DOT, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_TEXT (const location_type& l)
+ EvalParser::make_TEXT (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_TEXT, l);
+ return symbol_type (token::TOKEN_TEXT, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_HEX (const location_type& l)
+ EvalParser::make_HEX (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_HEX, l);
+ return symbol_type (token::TOKEN_HEX, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_EXISTS (const location_type& l)
+ EvalParser::make_EXISTS (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_EXISTS, l);
+ return symbol_type (token::TOKEN_EXISTS, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_PKT (const location_type& l)
+ EvalParser::make_PKT (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_PKT, l);
+ return symbol_type (token::TOKEN_PKT, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_IFACE (const location_type& l)
+ EvalParser::make_IFACE (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_IFACE, l);
+ return symbol_type (token::TOKEN_IFACE, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_SRC (const location_type& l)
+ EvalParser::make_SRC (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_SRC, l);
+ return symbol_type (token::TOKEN_SRC, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_DST (const location_type& l)
+ EvalParser::make_DST (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_DST, l);
+ return symbol_type (token::TOKEN_DST, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_LEN (const location_type& l)
+ EvalParser::make_LEN (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_LEN, l);
+ return symbol_type (token::TOKEN_LEN, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_PKT4 (const location_type& l)
+ EvalParser::make_PKT4 (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_PKT4, l);
+ return symbol_type (token::TOKEN_PKT4, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_CHADDR (const location_type& l)
+ EvalParser::make_CHADDR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_CHADDR, l);
+ return symbol_type (token::TOKEN_CHADDR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_HLEN (const location_type& l)
+ EvalParser::make_HLEN (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_HLEN, l);
+ return symbol_type (token::TOKEN_HLEN, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_HTYPE (const location_type& l)
+ EvalParser::make_HTYPE (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_HTYPE, l);
+ return symbol_type (token::TOKEN_HTYPE, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_CIADDR (const location_type& l)
+ EvalParser::make_CIADDR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_CIADDR, l);
+ return symbol_type (token::TOKEN_CIADDR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_GIADDR (const location_type& l)
+ EvalParser::make_GIADDR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_GIADDR, l);
+ return symbol_type (token::TOKEN_GIADDR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_YIADDR (const location_type& l)
+ EvalParser::make_YIADDR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_YIADDR, l);
+ return symbol_type (token::TOKEN_YIADDR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_SIADDR (const location_type& l)
+ EvalParser::make_SIADDR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_SIADDR, l);
+ return symbol_type (token::TOKEN_SIADDR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_SUBSTRING (const location_type& l)
+ EvalParser::make_SUBSTRING (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_SUBSTRING, l);
+ return symbol_type (token::TOKEN_SUBSTRING, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_ALL (const location_type& l)
+ EvalParser::make_ALL (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_ALL, l);
+ return symbol_type (token::TOKEN_ALL, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_COMA (const location_type& l)
+ EvalParser::make_COMA (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_COMA, l);
+ return symbol_type (token::TOKEN_COMA, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_CONCAT (const location_type& l)
+ EvalParser::make_CONCAT (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_CONCAT, l);
+ return symbol_type (token::TOKEN_CONCAT, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_IFELSE (const location_type& l)
+ EvalParser::make_IFELSE (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_IFELSE, l);
+ return symbol_type (token::TOKEN_IFELSE, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_TOHEXSTRING (const location_type& l)
+ EvalParser::make_TOHEXSTRING (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_TOHEXSTRING, l);
+ return symbol_type (token::TOKEN_TOHEXSTRING, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_PKT6 (const location_type& l)
+ EvalParser::make_PKT6 (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_PKT6, l);
+ return symbol_type (token::TOKEN_PKT6, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_MSGTYPE (const location_type& l)
+ EvalParser::make_MSGTYPE (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_MSGTYPE, l);
+ return symbol_type (token::TOKEN_MSGTYPE, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_TRANSID (const location_type& l)
+ EvalParser::make_TRANSID (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_TRANSID, l);
+ return symbol_type (token::TOKEN_TRANSID, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_VENDOR_CLASS (const location_type& l)
+ EvalParser::make_VENDOR_CLASS (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_VENDOR_CLASS, l);
+ return symbol_type (token::TOKEN_VENDOR_CLASS, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_VENDOR (const location_type& l)
+ EvalParser::make_VENDOR (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_VENDOR, l);
+ return symbol_type (token::TOKEN_VENDOR, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_ANY (const location_type& l)
+ EvalParser::make_ANY (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_ANY, l);
+ return symbol_type (token::TOKEN_ANY, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_DATA (const location_type& l)
+ EvalParser::make_DATA (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_DATA, l);
+ return symbol_type (token::TOKEN_DATA, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_ENTERPRISE (const location_type& l)
+ EvalParser::make_ENTERPRISE (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_ENTERPRISE, l);
+ return symbol_type (token::TOKEN_ENTERPRISE, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_TOPLEVEL_BOOL (const location_type& l)
+ EvalParser::make_TOPLEVEL_BOOL (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_TOPLEVEL_BOOL, l);
+ return symbol_type (token::TOKEN_TOPLEVEL_BOOL, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_TOPLEVEL_STRING (const location_type& l)
+ EvalParser::make_TOPLEVEL_STRING (YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_TOPLEVEL_STRING, l);
+ return symbol_type (token::TOKEN_TOPLEVEL_STRING, YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_STRING (const std::string& v, const location_type& l)
+ EvalParser::make_STRING (YY_COPY (std::string) v, YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_STRING, v, l);
+ return symbol_type (token::TOKEN_STRING, YY_MOVE (v), YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_INTEGER (const std::string& v, const location_type& l)
+ EvalParser::make_INTEGER (YY_COPY (std::string) v, YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_INTEGER, v, l);
+ return symbol_type (token::TOKEN_INTEGER, YY_MOVE (v), YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_HEXSTRING (const std::string& v, const location_type& l)
+ EvalParser::make_HEXSTRING (YY_COPY (std::string) v, YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_HEXSTRING, v, l);
+ return symbol_type (token::TOKEN_HEXSTRING, YY_MOVE (v), YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_OPTION_NAME (const std::string& v, const location_type& l)
+ EvalParser::make_OPTION_NAME (YY_COPY (std::string) v, YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_OPTION_NAME, v, l);
+ return symbol_type (token::TOKEN_OPTION_NAME, YY_MOVE (v), YY_MOVE (l));
}
+ inline
EvalParser::symbol_type
- EvalParser::make_IP_ADDRESS (const std::string& v, const location_type& l)
+ EvalParser::make_IP_ADDRESS (YY_COPY (std::string) v, YY_COPY (location_type) l)
{
- return symbol_type (token::TOKEN_IP_ADDRESS, v, l);
+ return symbol_type (token::TOKEN_IP_ADDRESS, YY_MOVE (v), YY_MOVE (l));
}
-#line 14 "parser.yy" // lalr1.cc:379
+#line 14 "parser.yy" // lalr1.cc:404
} } // isc::eval
-#line 1727 "parser.h" // lalr1.cc:379
+#line 1912 "parser.h" // lalr1.cc:404
diff --git a/src/lib/eval/position.hh b/src/lib/eval/position.hh
index f47e64df0f..65e51f41eb 100644
--- a/src/lib/eval/position.hh
+++ b/src/lib/eval/position.hh
@@ -1,180 +1,12 @@
-// Generated 201811151407
-// A Bison parser, made by GNU Bison 3.0.5.
-
-// Positions for Bison parsers in C++
-
-// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-// As a special exception, you may create a larger work that contains
-// part or all of the Bison parser skeleton and distribute that work
-// under terms of your choice, so long as that work isn't itself a
-// parser generator using the skeleton or a modified version thereof
-// as a parser skeleton. Alternatively, if you modify or redistribute
-// the parser skeleton itself, you may (at your option) remove this
-// special exception, which will cause the skeleton and the resulting
-// Bison output files to be licensed under the GNU General Public
-// License without this special exception.
-
-// This special exception was added by the Free Software Foundation in
-// version 2.2 of Bison.
-
-/**
- ** \file position.hh
- ** Define the isc::eval::position class.
- */
-
-#ifndef YY_EVAL_POSITION_HH_INCLUDED
-# define YY_EVAL_POSITION_HH_INCLUDED
-
-# include <algorithm> // std::max
-# include <iostream>
-# include <string>
-
-# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# endif
-
-#line 14 "parser.yy" // location.cc:292
-namespace isc { namespace eval {
-#line 56 "position.hh" // location.cc:292
- /// Abstract a position.
- class position
- {
- public:
- /// Construct a position.
- explicit position (std::string* f = YY_NULLPTR,
- unsigned l = 1u,
- unsigned c = 1u)
- : filename (f)
- , line (l)
- , column (c)
- {}
-
-
- /// Initialization.
- void initialize (std::string* fn = YY_NULLPTR,
- unsigned l = 1u,
- unsigned c = 1u)
- {
- filename = fn;
- line = l;
- column = c;
- }
-
- /** \name Line and Column related manipulators
- ** \{ */
- /// (line related) Advance to the COUNT next lines.
- void lines (int count = 1)
- {
- if (count)
- {
- column = 1u;
- line = add_ (line, count, 1);
- }
- }
-
- /// (column related) Advance to the COUNT next columns.
- void columns (int count = 1)
- {
- column = add_ (column, count, 1);
- }
- /** \} */
-
- /// File name to which this position refers.
- std::string* filename;
- /// Current line number.
- unsigned line;
- /// Current column number.
- unsigned column;
-
- private:
- /// Compute max(min, lhs+rhs) (provided min <= lhs).
- static unsigned add_ (unsigned lhs, int rhs, unsigned min)
- {
- return (0 < rhs || -static_cast<unsigned>(rhs) < lhs
- ? rhs + lhs
- : min);
- }
- };
-
- /// Add \a width columns, in place.
- inline position&
- operator+= (position& res, int width)
- {
- res.columns (width);
- return res;
- }
-
- /// Add \a width columns.
- inline position
- operator+ (position res, int width)
- {
- return res += width;
- }
-
- /// Subtract \a width columns, in place.
- inline position&
- operator-= (position& res, int width)
- {
- return res += -width;
- }
-
- /// Subtract \a width columns.
- inline position
- operator- (position res, int width)
- {
- return res -= width;
- }
-
- /// Compare two position objects.
- inline bool
- operator== (const position& pos1, const position& pos2)
- {
- return (pos1.line == pos2.line
- && pos1.column == pos2.column
- && (pos1.filename == pos2.filename
- || (pos1.filename && pos2.filename
- && *pos1.filename == *pos2.filename)));
- }
-
- /// Compare two position objects.
- inline bool
- operator!= (const position& pos1, const position& pos2)
- {
- return !(pos1 == pos2);
- }
-
- /** \brief Intercept output stream redirection.
- ** \param ostr the destination output stream
- ** \param pos a reference to the position to redirect
- */
- template <typename YYChar>
- inline std::basic_ostream<YYChar>&
- operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
- {
- if (pos.filename)
- ostr << *pos.filename << ':';
- return ostr << pos.line << '.' << pos.column;
- }
-
-#line 14 "parser.yy" // location.cc:292
-} } // isc::eval
-#line 179 "position.hh" // location.cc:292
-#endif // !YY_EVAL_POSITION_HH_INCLUDED
+// Generated 201811172152
+// A Bison parser, made by GNU Bison 3.2.1.
+
+// Starting with Bison 3.2, this file is useless: the structure it
+// used to define is now defined in "location.hh".
+//
+// To get rid of this file:
+// 1. add 'require "3.2"' (or newer) to your grammar file
+// 2. remove references to this file from your build system
+// 3. if you used to include it, include "location.hh" instead.
+
+#include "location.hh"
diff --git a/src/lib/eval/stack.hh b/src/lib/eval/stack.hh
index 9e064c6588..e1904b0494 100644
--- a/src/lib/eval/stack.hh
+++ b/src/lib/eval/stack.hh
@@ -1,157 +1,9 @@
-// Generated 201811151407
-// A Bison parser, made by GNU Bison 3.0.5.
-
-// Stack handling for Bison parsers in C++
-
-// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-// As a special exception, you may create a larger work that contains
-// part or all of the Bison parser skeleton and distribute that work
-// under terms of your choice, so long as that work isn't itself a
-// parser generator using the skeleton or a modified version thereof
-// as a parser skeleton. Alternatively, if you modify or redistribute
-// the parser skeleton itself, you may (at your option) remove this
-// special exception, which will cause the skeleton and the resulting
-// Bison output files to be licensed under the GNU General Public
-// License without this special exception.
-
-// This special exception was added by the Free Software Foundation in
-// version 2.2 of Bison.
-
-/**
- ** \file stack.hh
- ** Define the isc::eval::stack class.
- */
-
-#ifndef YY_EVAL_STACK_HH_INCLUDED
-# define YY_EVAL_STACK_HH_INCLUDED
-
-# include <vector>
-
-#line 14 "parser.yy" // stack.hh:131
-namespace isc { namespace eval {
-#line 46 "stack.hh" // stack.hh:131
- /// A stack with random access from its top.
- template <class T, class S = std::vector<T> >
- class stack
- {
- public:
- // Hide our reversed order.
- typedef typename S::reverse_iterator iterator;
- typedef typename S::const_reverse_iterator const_iterator;
-
- stack ()
- : seq_ ()
- {
- seq_.reserve (200);
- }
-
- stack (unsigned n)
- : seq_ (n)
- {}
-
- /// Random access.
- ///
- /// Index 0 returns the topmost element.
- T&
- operator[] (unsigned i)
- {
- return seq_[seq_.size () - 1 - i];
- }
-
- /// Random access.
- ///
- /// Index 0 returns the topmost element.
- const T&
- operator[] (unsigned i) const
- {
- return seq_[seq_.size () - 1 - i];
- }
-
- /// Steal the contents of \a t.
- ///
- /// Close to move-semantics.
- void
- push (T& t)
- {
- seq_.push_back (T());
- operator[](0).move (t);
- }
-
- void
- pop (unsigned n = 1)
- {
- for (; n; --n)
- seq_.pop_back ();
- }
-
- void
- clear ()
- {
- seq_.clear ();
- }
-
- typename S::size_type
- size () const
- {
- return seq_.size ();
- }
-
- const_iterator
- begin () const
- {
- return seq_.rbegin ();
- }
-
- const_iterator
- end () const
- {
- return seq_.rend ();
- }
-
- private:
- stack (const stack&);
- stack& operator= (const stack&);
- /// The wrapped container.
- S seq_;
- };
-
- /// Present a slice of the top of a stack.
- template <class T, class S = stack<T> >
- class slice
- {
- public:
- slice (const S& stack, unsigned range)
- : stack_ (stack)
- , range_ (range)
- {}
-
- const T&
- operator [] (unsigned i) const
- {
- return stack_[range_ - i];
- }
-
- private:
- const S& stack_;
- unsigned range_;
- };
-
-#line 14 "parser.yy" // stack.hh:131
-} } // isc::eval
-#line 155 "stack.hh" // stack.hh:131
-
-#endif // !YY_EVAL_STACK_HH_INCLUDED
+// Generated 201811172152
+// A Bison parser, made by GNU Bison 3.2.1.
+
+// Starting with Bison 3.2, this file is useless: the structure it
+// used to define is now defined with the parser itself.
+//
+// To get rid of this file:
+// 1. add 'require "3.2"' (or newer) to your grammar file
+// 2. remove references to this file from your build system.