diff options
author | Francis Dupont <fdupont@isc.org> | 2018-11-17 22:55:25 +0100 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2018-11-17 22:55:25 +0100 |
commit | e1def1242033065acf4462092636da6696cbdc44 (patch) | |
tree | 0a44687ef8c3a238cbd1fe2362096a1cd82eed58 /src/bin/agent | |
parent | [master] Fixed v4 -> v6 typo (cdf #262) (diff) | |
download | kea-e1def1242033065acf4462092636da6696cbdc44.tar.xz kea-e1def1242033065acf4462092636da6696cbdc44.zip |
[#270, !129] regen bison with 3.2.1
Diffstat (limited to 'src/bin/agent')
-rw-r--r-- | src/bin/agent/agent_parser.cc | 513 | ||||
-rw-r--r-- | src/bin/agent/agent_parser.h | 880 | ||||
-rw-r--r-- | src/bin/agent/location.hh | 151 | ||||
-rw-r--r-- | src/bin/agent/position.hh | 192 | ||||
-rw-r--r-- | src/bin/agent/stack.hh | 166 |
5 files changed, 972 insertions, 930 deletions
diff --git a/src/bin/agent/agent_parser.cc b/src/bin/agent/agent_parser.cc index 3523c1b440..37c6c4ff49 100644 --- a/src/bin/agent/agent_parser.cc +++ b/src/bin/agent/agent_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 agent_lex -// First part of user declarations. -#line 39 "agent_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 "agent_parser.h" -// User implementation prologue. -#line 53 "agent_parser.cc" // lalr1.cc:414 // Unqualified %code blocks. -#line 33 "agent_parser.yy" // lalr1.cc:415 +#line 33 "agent_parser.yy" // lalr1.cc:438 #include <agent/parser_context.h> -#line 59 "agent_parser.cc" // lalr1.cc:415 +#line 51 "agent_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 "agent_parser.yy" // lalr1.cc:481 +#line 14 "agent_parser.yy" // lalr1.cc:513 namespace isc { namespace agent { -#line 145 "agent_parser.cc" // lalr1.cc:481 +#line 146 "agent_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,64 +240,68 @@ namespace isc { namespace agent { AgentParser::stack_symbol_type::stack_symbol_type () {} - AgentParser::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that) - : super_type (that.state, that.location) + AgentParser::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 53: // value case 56: // map_value case 107: // socket_type_value - value.copy< ElementPtr > (that.value); + value.YY_MOVE_OR_COPY< ElementPtr > (YY_MOVE (that.value)); break; case 44: // "boolean" - value.copy< bool > (that.value); + value.YY_MOVE_OR_COPY< bool > (YY_MOVE (that.value)); break; case 43: // "floating point" - value.copy< double > (that.value); + value.YY_MOVE_OR_COPY< double > (YY_MOVE (that.value)); break; case 42: // "integer" - value.copy< int64_t > (that.value); + value.YY_MOVE_OR_COPY< int64_t > (YY_MOVE (that.value)); break; case 41: // "constant string" - value.copy< std::string > (that.value); + value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value)); break; default: break; } +#if defined __cplusplus && 201103L <= __cplusplus + // that is emptied. + that.state = empty_state; +#endif } - AgentParser::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that) - : super_type (s, that.location) + AgentParser::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 53: // value case 56: // map_value case 107: // socket_type_value - value.move< ElementPtr > (that.value); + value.move< ElementPtr > (YY_MOVE (that.value)); break; case 44: // "boolean" - value.move< bool > (that.value); + value.move< bool > (YY_MOVE (that.value)); break; case 43: // "floating point" - value.move< double > (that.value); + value.move< double > (YY_MOVE (that.value)); break; case 42: // "integer" - value.move< int64_t > (that.value); + value.move< int64_t > (YY_MOVE (that.value)); break; case 41: // "constant string" - value.move< std::string > (that.value); + value.move< std::string > (YY_MOVE (that.value)); break; default: @@ -307,8 +312,9 @@ namespace isc { namespace agent { that.type = empty_symbol; } +#if !defined __cplusplus || __cplusplus < 201103L AgentParser::stack_symbol_type& - AgentParser::stack_symbol_type::operator= (const stack_symbol_type& that) + AgentParser::stack_symbol_type::operator= (stack_symbol_type& that) { state = that.state; switch (that.type_get ()) @@ -316,23 +322,23 @@ namespace isc { namespace agent { case 53: // value case 56: // map_value case 107: // socket_type_value - value.copy< ElementPtr > (that.value); + value.move< ElementPtr > (that.value); break; case 44: // "boolean" - value.copy< bool > (that.value); + value.move< bool > (that.value); break; case 43: // "floating point" - value.copy< double > (that.value); + value.move< double > (that.value); break; case 42: // "integer" - value.copy< int64_t > (that.value); + value.move< int64_t > (that.value); break; case 41: // "constant string" - value.copy< std::string > (that.value); + value.move< std::string > (that.value); break; default: @@ -340,9 +346,11 @@ namespace isc { namespace agent { } location = that.location; + // that is emptied. + that.state = empty_state; return *this; } - +#endif template <typename Base> void @@ -372,51 +380,51 @@ namespace isc { namespace agent { { case 41: // "constant string" -#line 103 "agent_parser.yy" // lalr1.cc:635 +#line 103 "agent_parser.yy" // lalr1.cc:672 { yyoutput << yysym.value.template as< std::string > (); } -#line 378 "agent_parser.cc" // lalr1.cc:635 +#line 386 "agent_parser.cc" // lalr1.cc:672 break; case 42: // "integer" -#line 103 "agent_parser.yy" // lalr1.cc:635 +#line 103 "agent_parser.yy" // lalr1.cc:672 { yyoutput << yysym.value.template as< int64_t > (); } -#line 385 "agent_parser.cc" // lalr1.cc:635 +#line 393 "agent_parser.cc" // lalr1.cc:672 break; case 43: // "floating point" -#line 103 "agent_parser.yy" // lalr1.cc:635 +#line 103 "agent_parser.yy" // lalr1.cc:672 { yyoutput << yysym.value.template as< double > (); } -#line 392 "agent_parser.cc" // lalr1.cc:635 +#line 400 "agent_parser.cc" // lalr1.cc:672 break; case 44: // "boolean" -#line 103 "agent_parser.yy" // lalr1.cc:635 +#line 103 "agent_parser.yy" // lalr1.cc:672 { yyoutput << yysym.value.template as< bool > (); } -#line 399 "agent_parser.cc" // lalr1.cc:635 +#line 407 "agent_parser.cc" // lalr1.cc:672 break; case 53: // value -#line 103 "agent_parser.yy" // lalr1.cc:635 +#line 103 "agent_parser.yy" // lalr1.cc:672 { yyoutput << yysym.value.template as< ElementPtr > (); } -#line 406 "agent_parser.cc" // lalr1.cc:635 +#line 414 "agent_parser.cc" // lalr1.cc:672 break; case 56: // map_value -#line 103 "agent_parser.yy" // lalr1.cc:635 +#line 103 "agent_parser.yy" // lalr1.cc:672 { yyoutput << yysym.value.template as< ElementPtr > (); } -#line 413 "agent_parser.cc" // lalr1.cc:635 +#line 421 "agent_parser.cc" // lalr1.cc:672 break; case 107: // socket_type_value -#line 103 "agent_parser.yy" // lalr1.cc:635 +#line 103 "agent_parser.yy" // lalr1.cc:672 { yyoutput << yysym.value.template as< ElementPtr > (); } -#line 420 "agent_parser.cc" // lalr1.cc:635 +#line 428 "agent_parser.cc" // lalr1.cc:672 break; @@ -428,22 +436,26 @@ namespace isc { namespace agent { #endif void - AgentParser::yypush_ (const char* m, state_type s, symbol_type& sym) + AgentParser::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 - AgentParser::yypush_ (const char* m, stack_symbol_type& s) + AgentParser::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 - AgentParser::yypop_ (unsigned n) + AgentParser::yypop_ (int n) { yystack_.pop (n); } @@ -498,6 +510,12 @@ namespace isc { namespace agent { } int + AgentParser::operator() () + { + return parse (); + } + + int AgentParser::parse () { // State. @@ -518,9 +536,9 @@ namespace isc { namespace agent { /// 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"; @@ -530,7 +548,7 @@ namespace isc { namespace agent { 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: @@ -544,7 +562,6 @@ namespace isc { namespace agent { // Backup. yybackup: - // Try to take a decision without lookahead. yyn = yypact_[yystack_[0].state]; if (yy_pact_value_is_default_ (yyn)) @@ -554,16 +571,20 @@ namespace isc { namespace agent { 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); @@ -588,7 +609,7 @@ namespace isc { namespace agent { --yyerrstatus_; // Shift the lookahead token. - yypush_ ("Shifting", yyn, yyla); + yypush_ ("Shifting", yyn, YY_MOVE (yyla)); goto yynewstate; /*-----------------------------------------------------------. @@ -616,23 +637,23 @@ namespace isc { namespace agent { case 53: // value case 56: // map_value case 107: // socket_type_value - yylhs.value.build< ElementPtr > (); + yylhs.value.emplace< ElementPtr > (); break; case 44: // "boolean" - yylhs.value.build< bool > (); + yylhs.value.emplace< bool > (); break; case 43: // "floating point" - yylhs.value.build< double > (); + yylhs.value.emplace< double > (); break; case 42: // "integer" - yylhs.value.build< int64_t > (); + yylhs.value.emplace< int64_t > (); break; case 41: // "constant string" - yylhs.value.build< std::string > (); + yylhs.value.emplace< std::string > (); break; default: @@ -649,211 +670,213 @@ namespace isc { namespace agent { // Perform the reduction. YY_REDUCE_PRINT (yyn); +#if YY_EXCEPTIONS try +#endif // YY_EXCEPTIONS { switch (yyn) { case 2: -#line 114 "agent_parser.yy" // lalr1.cc:856 +#line 114 "agent_parser.yy" // lalr1.cc:907 { ctx.ctx_ = ctx.NO_KEYWORDS; } -#line 660 "agent_parser.cc" // lalr1.cc:856 +#line 683 "agent_parser.cc" // lalr1.cc:907 break; case 4: -#line 115 "agent_parser.yy" // lalr1.cc:856 +#line 115 "agent_parser.yy" // lalr1.cc:907 { ctx.ctx_ = ctx.CONFIG; } -#line 666 "agent_parser.cc" // lalr1.cc:856 +#line 689 "agent_parser.cc" // lalr1.cc:907 break; case 6: -#line 116 "agent_parser.yy" // lalr1.cc:856 +#line 116 "agent_parser.yy" // lalr1.cc:907 { ctx.ctx_ = ctx.AGENT; } -#line 672 "agent_parser.cc" // lalr1.cc:856 +#line 695 "agent_parser.cc" // lalr1.cc:907 break; case 8: -#line 124 "agent_parser.yy" // lalr1.cc:856 +#line 124 "agent_parser.yy" // lalr1.cc:907 { // Parse the Control-agent map ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.push_back(m); } -#line 682 "agent_parser.cc" // lalr1.cc:856 +#line 705 "agent_parser.cc" // lalr1.cc:907 break; case 9: -#line 128 "agent_parser.yy" // lalr1.cc:856 +#line 128 "agent_parser.yy" // lalr1.cc:907 { // parsing completed } -#line 690 "agent_parser.cc" // lalr1.cc:856 +#line 713 "agent_parser.cc" // lalr1.cc:907 break; case 10: -#line 135 "agent_parser.yy" // lalr1.cc:856 +#line 135 "agent_parser.yy" // lalr1.cc:907 { // Push back the JSON value on the stack ctx.stack_.push_back(yystack_[0].value.as< ElementPtr > ()); } -#line 699 "agent_parser.cc" // lalr1.cc:856 +#line 722 "agent_parser.cc" // lalr1.cc:907 break; case 11: -#line 141 "agent_parser.yy" // lalr1.cc:856 +#line 141 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ElementPtr(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location))); } -#line 705 "agent_parser.cc" // lalr1.cc:856 +#line 728 "agent_parser.cc" // lalr1.cc:907 break; case 12: -#line 142 "agent_parser.yy" // lalr1.cc:856 +#line 142 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ElementPtr(new DoubleElement(yystack_[0].value.as< double > (), ctx.loc2pos(yystack_[0].location))); } -#line 711 "agent_parser.cc" // lalr1.cc:856 +#line 734 "agent_parser.cc" // lalr1.cc:907 break; case 13: -#line 143 "agent_parser.yy" // lalr1.cc:856 +#line 143 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ElementPtr(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location))); } -#line 717 "agent_parser.cc" // lalr1.cc:856 +#line 740 "agent_parser.cc" // lalr1.cc:907 break; case 14: -#line 144 "agent_parser.yy" // lalr1.cc:856 +#line 144 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); } -#line 723 "agent_parser.cc" // lalr1.cc:856 +#line 746 "agent_parser.cc" // lalr1.cc:907 break; case 15: -#line 145 "agent_parser.yy" // lalr1.cc:856 +#line 145 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ElementPtr(new NullElement(ctx.loc2pos(yystack_[0].location))); } -#line 729 "agent_parser.cc" // lalr1.cc:856 +#line 752 "agent_parser.cc" // lalr1.cc:907 break; case 16: -#line 146 "agent_parser.yy" // lalr1.cc:856 +#line 146 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); } -#line 735 "agent_parser.cc" // lalr1.cc:856 +#line 758 "agent_parser.cc" // lalr1.cc:907 break; case 17: -#line 147 "agent_parser.yy" // lalr1.cc:856 +#line 147 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); } -#line 741 "agent_parser.cc" // lalr1.cc:856 +#line 764 "agent_parser.cc" // lalr1.cc:907 break; case 18: -#line 151 "agent_parser.yy" // lalr1.cc:856 +#line 151 "agent_parser.yy" // lalr1.cc:907 { // This code is executed when we're about to start parsing // the content of the map ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.push_back(m); } -#line 752 "agent_parser.cc" // lalr1.cc:856 +#line 775 "agent_parser.cc" // lalr1.cc:907 break; case 19: -#line 156 "agent_parser.yy" // lalr1.cc:856 +#line 156 "agent_parser.yy" // lalr1.cc:907 { // map parsing completed. If we ever want to do any wrap up // (maybe some sanity checking), this would be the best place // for it. } -#line 762 "agent_parser.cc" // lalr1.cc:856 +#line 785 "agent_parser.cc" // lalr1.cc:907 break; case 20: -#line 162 "agent_parser.yy" // lalr1.cc:856 +#line 162 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); } -#line 768 "agent_parser.cc" // lalr1.cc:856 +#line 791 "agent_parser.cc" // lalr1.cc:907 break; case 23: -#line 176 "agent_parser.yy" // lalr1.cc:856 +#line 176 "agent_parser.yy" // lalr1.cc:907 { // map containing a single entry ctx.stack_.back()->set(yystack_[2].value.as< std::string > (), yystack_[0].value.as< ElementPtr > ()); } -#line 777 "agent_parser.cc" // lalr1.cc:856 +#line 800 "agent_parser.cc" // lalr1.cc:907 break; case 24: -#line 180 "agent_parser.yy" // lalr1.cc:856 +#line 180 "agent_parser.yy" // lalr1.cc:907 { // map consisting of a shorter map followed by // comma and string:value ctx.stack_.back()->set(yystack_[2].value.as< std::string > (), yystack_[0].value.as< ElementPtr > ()); } -#line 787 "agent_parser.cc" // lalr1.cc:856 +#line 810 "agent_parser.cc" // lalr1.cc:907 break; case 25: -#line 187 "agent_parser.yy" // lalr1.cc:856 +#line 187 "agent_parser.yy" // lalr1.cc:907 { ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.push_back(l); } -#line 796 "agent_parser.cc" // lalr1.cc:856 +#line 819 "agent_parser.cc" // lalr1.cc:907 break; case 26: -#line 190 "agent_parser.yy" // lalr1.cc:856 +#line 190 "agent_parser.yy" // lalr1.cc:907 { } -#line 803 "agent_parser.cc" // lalr1.cc:856 +#line 826 "agent_parser.cc" // lalr1.cc:907 break; case 29: -#line 197 "agent_parser.yy" // lalr1.cc:856 +#line 197 "agent_parser.yy" // lalr1.cc:907 { // List consisting of a single element. ctx.stack_.back()->add(yystack_[0].value.as< ElementPtr > ()); } -#line 812 "agent_parser.cc" // lalr1.cc:856 +#line 835 "agent_parser.cc" // lalr1.cc:907 break; case 30: -#line 201 "agent_parser.yy" // lalr1.cc:856 +#line 201 "agent_parser.yy" // lalr1.cc:907 { // List ending with , and a value. ctx.stack_.back()->add(yystack_[0].value.as< ElementPtr > ()); } -#line 821 "agent_parser.cc" // lalr1.cc:856 +#line 844 "agent_parser.cc" // lalr1.cc:907 break; case 31: -#line 214 "agent_parser.yy" // lalr1.cc:856 +#line 214 "agent_parser.yy" // lalr1.cc:907 { const std::string& where = ctx.contextName(); const std::string& keyword = yystack_[1].value.as< std::string > (); error(yystack_[1].location, "got unexpected keyword \"" + keyword + "\" in " + where + " map."); } -#line 832 "agent_parser.cc" // lalr1.cc:856 +#line 855 "agent_parser.cc" // lalr1.cc:907 break; case 32: -#line 223 "agent_parser.yy" // lalr1.cc:856 +#line 223 "agent_parser.yy" // lalr1.cc:907 { // This code is executed when we're about to start parsing // the content of the map ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.push_back(m); } -#line 843 "agent_parser.cc" // lalr1.cc:856 +#line 866 "agent_parser.cc" // lalr1.cc:907 break; case 33: -#line 228 "agent_parser.yy" // lalr1.cc:856 +#line 228 "agent_parser.yy" // lalr1.cc:907 { // map parsing completed. If we ever want to do any wrap up // (maybe some sanity checking), this would be the best place // for it. } -#line 853 "agent_parser.cc" // lalr1.cc:856 +#line 876 "agent_parser.cc" // lalr1.cc:907 break; case 42: -#line 249 "agent_parser.yy" // lalr1.cc:856 +#line 249 "agent_parser.yy" // lalr1.cc:907 { // Let's create a MapElement that will represent it, add it to the @@ -865,57 +888,57 @@ namespace isc { namespace agent { ctx.stack_.push_back(m); ctx.enter(ctx.AGENT); } -#line 869 "agent_parser.cc" // lalr1.cc:856 +#line 892 "agent_parser.cc" // lalr1.cc:907 break; case 43: -#line 259 "agent_parser.yy" // lalr1.cc:856 +#line 259 "agent_parser.yy" // lalr1.cc:907 { // Ok, we're done with parsing control-agent. Let's take the map // off the stack. ctx.stack_.pop_back(); ctx.leave(); } -#line 880 "agent_parser.cc" // lalr1.cc:856 +#line 903 "agent_parser.cc" // lalr1.cc:907 break; case 53: -#line 281 "agent_parser.yy" // lalr1.cc:856 +#line 281 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 888 "agent_parser.cc" // lalr1.cc:856 +#line 911 "agent_parser.cc" // lalr1.cc:907 break; case 54: -#line 283 "agent_parser.yy" // lalr1.cc:856 +#line 283 "agent_parser.yy" // lalr1.cc:907 { ElementPtr host(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("http-host", host); ctx.leave(); } -#line 898 "agent_parser.cc" // lalr1.cc:856 +#line 921 "agent_parser.cc" // lalr1.cc:907 break; case 55: -#line 289 "agent_parser.yy" // lalr1.cc:856 +#line 289 "agent_parser.yy" // lalr1.cc:907 { ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("http-port", prf); } -#line 907 "agent_parser.cc" // lalr1.cc:856 +#line 930 "agent_parser.cc" // lalr1.cc:907 break; case 56: -#line 294 "agent_parser.yy" // lalr1.cc:856 +#line 294 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 915 "agent_parser.cc" // lalr1.cc:856 +#line 938 "agent_parser.cc" // lalr1.cc:907 break; case 57: -#line 296 "agent_parser.yy" // lalr1.cc:856 +#line 296 "agent_parser.yy" // lalr1.cc:907 { ElementPtr parent = ctx.stack_.back(); ElementPtr user_context = yystack_[0].value.as< ElementPtr > (); @@ -938,19 +961,19 @@ namespace isc { namespace agent { parent->set("user-context", user_context); ctx.leave(); } -#line 942 "agent_parser.cc" // lalr1.cc:856 +#line 965 "agent_parser.cc" // lalr1.cc:907 break; case 58: -#line 319 "agent_parser.yy" // lalr1.cc:856 +#line 319 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 950 "agent_parser.cc" // lalr1.cc:856 +#line 973 "agent_parser.cc" // lalr1.cc:907 break; case 59: -#line 321 "agent_parser.yy" // lalr1.cc:856 +#line 321 "agent_parser.yy" // lalr1.cc:907 { ElementPtr parent = ctx.stack_.back(); ElementPtr user_context(new MapElement(ctx.loc2pos(yystack_[3].location))); @@ -975,458 +998,460 @@ namespace isc { namespace agent { parent->set("user-context", user_context); ctx.leave(); } -#line 979 "agent_parser.cc" // lalr1.cc:856 +#line 1002 "agent_parser.cc" // lalr1.cc:907 break; case 60: -#line 347 "agent_parser.yy" // lalr1.cc:856 +#line 347 "agent_parser.yy" // lalr1.cc:907 { ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("hooks-libraries", l); ctx.stack_.push_back(l); ctx.enter(ctx.HOOKS_LIBRARIES); } -#line 990 "agent_parser.cc" // lalr1.cc:856 +#line 1013 "agent_parser.cc" // lalr1.cc:907 break; case 61: -#line 352 "agent_parser.yy" // lalr1.cc:856 +#line 352 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 999 "agent_parser.cc" // lalr1.cc:856 +#line 1022 "agent_parser.cc" // lalr1.cc:907 break; case 66: -#line 365 "agent_parser.yy" // lalr1.cc:856 +#line 365 "agent_parser.yy" // lalr1.cc:907 { ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->add(m); ctx.stack_.push_back(m); } -#line 1009 "agent_parser.cc" // lalr1.cc:856 +#line 1032 "agent_parser.cc" // lalr1.cc:907 break; case 67: -#line 369 "agent_parser.yy" // lalr1.cc:856 +#line 369 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); } -#line 1017 "agent_parser.cc" // lalr1.cc:856 +#line 1040 "agent_parser.cc" // lalr1.cc:907 break; case 73: -#line 382 "agent_parser.yy" // lalr1.cc:856 +#line 382 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1025 "agent_parser.cc" // lalr1.cc:856 +#line 1048 "agent_parser.cc" // lalr1.cc:907 break; case 74: -#line 384 "agent_parser.yy" // lalr1.cc:856 +#line 384 "agent_parser.yy" // lalr1.cc:907 { ElementPtr lib(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("library", lib); ctx.leave(); } -#line 1035 "agent_parser.cc" // lalr1.cc:856 +#line 1058 "agent_parser.cc" // lalr1.cc:907 break; case 75: -#line 390 "agent_parser.yy" // lalr1.cc:856 +#line 390 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1043 "agent_parser.cc" // lalr1.cc:856 +#line 1066 "agent_parser.cc" // lalr1.cc:907 break; case 76: -#line 392 "agent_parser.yy" // lalr1.cc:856 +#line 392 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.back()->set("parameters", yystack_[0].value.as< ElementPtr > ()); ctx.leave(); } -#line 1052 "agent_parser.cc" // lalr1.cc:856 +#line 1075 "agent_parser.cc" // lalr1.cc:907 break; case 77: -#line 400 "agent_parser.yy" // lalr1.cc:856 +#line 400 "agent_parser.yy" // lalr1.cc:907 { ElementPtr m(new MapElement(ctx.loc2pos(yystack_[2].location))); ctx.stack_.back()->set("control-sockets", m); ctx.stack_.push_back(m); ctx.enter(ctx.CONTROL_SOCKETS); } -#line 1063 "agent_parser.cc" // lalr1.cc:856 +#line 1086 "agent_parser.cc" // lalr1.cc:907 break; case 78: -#line 405 "agent_parser.yy" // lalr1.cc:856 +#line 405 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 1072 "agent_parser.cc" // lalr1.cc:856 +#line 1095 "agent_parser.cc" // lalr1.cc:907 break; case 85: -#line 426 "agent_parser.yy" // lalr1.cc:856 +#line 426 "agent_parser.yy" // lalr1.cc:907 { ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("dhcp4", m); ctx.stack_.push_back(m); ctx.enter(ctx.SERVER); } -#line 1083 "agent_parser.cc" // lalr1.cc:856 +#line 1106 "agent_parser.cc" // lalr1.cc:907 break; case 86: -#line 431 "agent_parser.yy" // lalr1.cc:856 +#line 431 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 1092 "agent_parser.cc" // lalr1.cc:856 +#line 1115 "agent_parser.cc" // lalr1.cc:907 break; case 87: -#line 437 "agent_parser.yy" // lalr1.cc:856 +#line 437 "agent_parser.yy" // lalr1.cc:907 { ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("dhcp6", m); ctx.stack_.push_back(m); ctx.enter(ctx.SERVER); } -#line 1103 "agent_parser.cc" // lalr1.cc:856 +#line 1126 "agent_parser.cc" // lalr1.cc:907 break; case 88: -#line 442 "agent_parser.yy" // lalr1.cc:856 +#line 442 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 1112 "agent_parser.cc" // lalr1.cc:856 +#line 1135 "agent_parser.cc" // lalr1.cc:907 break; case 89: -#line 448 "agent_parser.yy" // lalr1.cc:856 +#line 448 "agent_parser.yy" // lalr1.cc:907 { ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("d2", m); ctx.stack_.push_back(m); ctx.enter(ctx.SERVER); } -#line 1123 "agent_parser.cc" // lalr1.cc:856 +#line 1146 "agent_parser.cc" // lalr1.cc:907 break; case 90: -#line 453 "agent_parser.yy" // lalr1.cc:856 +#line 453 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 1132 "agent_parser.cc" // lalr1.cc:856 +#line 1155 "agent_parser.cc" // lalr1.cc:907 break; case 98: -#line 472 "agent_parser.yy" // lalr1.cc:856 +#line 472 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1140 "agent_parser.cc" // lalr1.cc:856 +#line 1163 "agent_parser.cc" // lalr1.cc:907 break; case 99: -#line 474 "agent_parser.yy" // lalr1.cc:856 +#line 474 "agent_parser.yy" // lalr1.cc:907 { ElementPtr name(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("socket-name", name); ctx.leave(); } -#line 1150 "agent_parser.cc" // lalr1.cc:856 +#line 1173 "agent_parser.cc" // lalr1.cc:907 break; case 100: -#line 481 "agent_parser.yy" // lalr1.cc:856 +#line 481 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.SOCKET_TYPE); } -#line 1158 "agent_parser.cc" // lalr1.cc:856 +#line 1181 "agent_parser.cc" // lalr1.cc:907 break; case 101: -#line 483 "agent_parser.yy" // lalr1.cc:856 +#line 483 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.back()->set("socket-type", yystack_[0].value.as< ElementPtr > ()); ctx.leave(); } -#line 1167 "agent_parser.cc" // lalr1.cc:856 +#line 1190 "agent_parser.cc" // lalr1.cc:907 break; case 102: -#line 489 "agent_parser.yy" // lalr1.cc:856 +#line 489 "agent_parser.yy" // lalr1.cc:907 { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("unix", ctx.loc2pos(yystack_[0].location))); } -#line 1173 "agent_parser.cc" // lalr1.cc:856 +#line 1196 "agent_parser.cc" // lalr1.cc:907 break; case 103: -#line 495 "agent_parser.yy" // lalr1.cc:856 +#line 495 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1181 "agent_parser.cc" // lalr1.cc:856 +#line 1204 "agent_parser.cc" // lalr1.cc:907 break; case 104: -#line 497 "agent_parser.yy" // lalr1.cc:856 +#line 497 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.back()->set("Dhcp4", yystack_[0].value.as< ElementPtr > ()); ctx.leave(); } -#line 1190 "agent_parser.cc" // lalr1.cc:856 +#line 1213 "agent_parser.cc" // lalr1.cc:907 break; case 105: -#line 502 "agent_parser.yy" // lalr1.cc:856 +#line 502 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1198 "agent_parser.cc" // lalr1.cc:856 +#line 1221 "agent_parser.cc" // lalr1.cc:907 break; case 106: -#line 504 "agent_parser.yy" // lalr1.cc:856 +#line 504 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.back()->set("Dhcp6", yystack_[0].value.as< ElementPtr > ()); ctx.leave(); } -#line 1207 "agent_parser.cc" // lalr1.cc:856 +#line 1230 "agent_parser.cc" // lalr1.cc:907 break; case 107: -#line 509 "agent_parser.yy" // lalr1.cc:856 +#line 509 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1215 "agent_parser.cc" // lalr1.cc:856 +#line 1238 "agent_parser.cc" // lalr1.cc:907 break; case 108: -#line 511 "agent_parser.yy" // lalr1.cc:856 +#line 511 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.back()->set("DhcpDdns", yystack_[0].value.as< ElementPtr > ()); ctx.leave(); } -#line 1224 "agent_parser.cc" // lalr1.cc:856 +#line 1247 "agent_parser.cc" // lalr1.cc:907 break; case 109: -#line 521 "agent_parser.yy" // lalr1.cc:856 +#line 521 "agent_parser.yy" // lalr1.cc:907 { ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("Logging", m); ctx.stack_.push_back(m); ctx.enter(ctx.LOGGING); } -#line 1235 "agent_parser.cc" // lalr1.cc:856 +#line 1258 "agent_parser.cc" // lalr1.cc:907 break; case 110: -#line 526 "agent_parser.yy" // lalr1.cc:856 +#line 526 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 1244 "agent_parser.cc" // lalr1.cc:856 +#line 1267 "agent_parser.cc" // lalr1.cc:907 break; case 114: -#line 543 "agent_parser.yy" // lalr1.cc:856 +#line 543 "agent_parser.yy" // lalr1.cc:907 { ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("loggers", l); ctx.stack_.push_back(l); ctx.enter(ctx.LOGGERS); } -#line 1255 "agent_parser.cc" // lalr1.cc:856 +#line 1278 "agent_parser.cc" // lalr1.cc:907 break; case 115: -#line 548 "agent_parser.yy" // lalr1.cc:856 +#line 548 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 1264 "agent_parser.cc" // lalr1.cc:856 +#line 1287 "agent_parser.cc" // lalr1.cc:907 break; case 118: -#line 560 "agent_parser.yy" // lalr1.cc:856 +#line 560 "agent_parser.yy" // lalr1.cc:907 { ElementPtr l(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->add(l); ctx.stack_.push_back(l); } -#line 1274 "agent_parser.cc" // lalr1.cc:856 +#line 1297 "agent_parser.cc" // lalr1.cc:907 break; case 119: -#line 564 "agent_parser.yy" // lalr1.cc:856 +#line 564 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); } -#line 1282 "agent_parser.cc" // lalr1.cc:856 +#line 1305 "agent_parser.cc" // lalr1.cc:907 break; case 129: -#line 581 "agent_parser.yy" // lalr1.cc:856 +#line 581 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1290 "agent_parser.cc" // lalr1.cc:856 +#line 1313 "agent_parser.cc" // lalr1.cc:907 break; case 130: -#line 583 "agent_parser.yy" // lalr1.cc:856 +#line 583 "agent_parser.yy" // lalr1.cc:907 { ElementPtr name(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("name", name); ctx.leave(); } -#line 1300 "agent_parser.cc" // lalr1.cc:856 +#line 1323 "agent_parser.cc" // lalr1.cc:907 break; case 131: -#line 589 "agent_parser.yy" // lalr1.cc:856 +#line 589 "agent_parser.yy" // lalr1.cc:907 { ElementPtr dl(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("debuglevel", dl); } -#line 1309 "agent_parser.cc" // lalr1.cc:856 +#line 1332 "agent_parser.cc" // lalr1.cc:907 break; case 132: -#line 594 "agent_parser.yy" // lalr1.cc:856 +#line 594 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1317 "agent_parser.cc" // lalr1.cc:856 +#line 1340 "agent_parser.cc" // lalr1.cc:907 break; case 133: -#line 596 "agent_parser.yy" // lalr1.cc:856 +#line 596 "agent_parser.yy" // lalr1.cc:907 { ElementPtr sev(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("severity", sev); ctx.leave(); } -#line 1327 "agent_parser.cc" // lalr1.cc:856 +#line 1350 "agent_parser.cc" // lalr1.cc:907 break; case 134: -#line 602 "agent_parser.yy" // lalr1.cc:856 +#line 602 "agent_parser.yy" // lalr1.cc:907 { ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("output_options", l); ctx.stack_.push_back(l); ctx.enter(ctx.OUTPUT_OPTIONS); } -#line 1338 "agent_parser.cc" // lalr1.cc:856 +#line 1361 "agent_parser.cc" // lalr1.cc:907 break; case 135: -#line 607 "agent_parser.yy" // lalr1.cc:856 +#line 607 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); ctx.leave(); } -#line 1347 "agent_parser.cc" // lalr1.cc:856 +#line 1370 "agent_parser.cc" // lalr1.cc:907 break; case 138: -#line 616 "agent_parser.yy" // lalr1.cc:856 +#line 616 "agent_parser.yy" // lalr1.cc:907 { ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->add(m); ctx.stack_.push_back(m); } -#line 1357 "agent_parser.cc" // lalr1.cc:856 +#line 1380 "agent_parser.cc" // lalr1.cc:907 break; case 139: -#line 620 "agent_parser.yy" // lalr1.cc:856 +#line 620 "agent_parser.yy" // lalr1.cc:907 { ctx.stack_.pop_back(); } -#line 1365 "agent_parser.cc" // lalr1.cc:856 +#line 1388 "agent_parser.cc" // lalr1.cc:907 break; case 146: -#line 634 "agent_parser.yy" // lalr1.cc:856 +#line 634 "agent_parser.yy" // lalr1.cc:907 { ctx.enter(ctx.NO_KEYWORDS); } -#line 1373 "agent_parser.cc" // lalr1.cc:856 +#line 1396 "agent_parser.cc" // lalr1.cc:907 break; case 147: -#line 636 "agent_parser.yy" // lalr1.cc:856 +#line 636 "agent_parser.yy" // lalr1.cc:907 { ElementPtr sev(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("output", sev); ctx.leave(); } -#line 1383 "agent_parser.cc" // lalr1.cc:856 +#line 1406 "agent_parser.cc" // lalr1.cc:907 break; case 148: -#line 642 "agent_parser.yy" // lalr1.cc:856 +#line 642 "agent_parser.yy" // lalr1.cc:907 { ElementPtr flush(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("flush", flush); } -#line 1392 "agent_parser.cc" // lalr1.cc:856 +#line 1415 "agent_parser.cc" // lalr1.cc:907 break; case 149: -#line 647 "agent_parser.yy" // lalr1.cc:856 +#line 647 "agent_parser.yy" // lalr1.cc:907 { ElementPtr maxsize(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("maxsize", maxsize); } -#line 1401 "agent_parser.cc" // lalr1.cc:856 +#line 1424 "agent_parser.cc" // lalr1.cc:907 break; case 150: -#line 652 "agent_parser.yy" // lalr1.cc:856 +#line 652 "agent_parser.yy" // lalr1.cc:907 { ElementPtr maxver(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location))); ctx.stack_.back()->set("maxver", maxver); } -#line 1410 "agent_parser.cc" // lalr1.cc:856 +#line 1433 "agent_parser.cc" // lalr1.cc:907 break; -#line 1414 "agent_parser.cc" // lalr1.cc:856 +#line 1437 "agent_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; @@ -1514,7 +1539,7 @@ namespace isc { namespace agent { // Shift the error token. error_token.state = yyn; - yypush_ ("Shifting", error_token); + yypush_ ("Shifting", YY_MOVE (error_token)); } goto yynewstate; @@ -1543,11 +1568,12 @@ namespace isc { namespace agent { 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); @@ -1558,6 +1584,7 @@ namespace isc { namespace agent { } throw; } +#endif // YY_EXCEPTIONS } void @@ -1668,7 +1695,7 @@ namespace isc { namespace agent { const signed char AgentParser::yytable_ninf_ = -1; - const short int + const short AgentParser::yypact_[] = { 59, -68, -68, -68, 6, 8, 9, 34, -68, -68, @@ -1745,7 +1772,7 @@ namespace isc { namespace agent { -68, -67, -68, -68, -68, -68, -68 }; - const short int + const short AgentParser::yydefgoto_[] = { -1, 4, 5, 6, 7, 23, 27, 16, 17, 18, @@ -1785,7 +1812,7 @@ namespace isc { namespace agent { 199 }; - const short int + const short AgentParser::yycheck_[] = { 26, 27, 27, 27, 24, 10, 0, 11, 12, 13, @@ -1924,7 +1951,7 @@ namespace isc { namespace agent { }; #if AGENT_DEBUG - const unsigned short int + const unsigned short AgentParser::yyrline_[] = { 0, 114, 114, 114, 115, 115, 116, 116, 124, 124, @@ -1975,10 +2002,10 @@ namespace isc { namespace agent { #endif // AGENT_DEBUG -#line 14 "agent_parser.yy" // lalr1.cc:1163 +#line 14 "agent_parser.yy" // lalr1.cc:1218 } } // isc::agent -#line 1981 "agent_parser.cc" // lalr1.cc:1163 -#line 657 "agent_parser.yy" // lalr1.cc:1164 +#line 2008 "agent_parser.cc" // lalr1.cc:1218 +#line 657 "agent_parser.yy" // lalr1.cc:1219 void diff --git a/src/bin/agent/agent_parser.h b/src/bin/agent/agent_parser.h index 3349b3b157..0b665060de 100644 --- a/src/bin/agent/agent_parser.h +++ b/src/bin/agent/agent_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 agent_parser.h ** Define the isc::agent::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_AGENT_AGENT_PARSER_H_INCLUDED # define YY_AGENT_AGENT_PARSER_H_INCLUDED // // "%code requires" blocks. -#line 17 "agent_parser.yy" // lalr1.cc:379 +#line 17 "agent_parser.yy" // lalr1.cc:404 #include <string> #include <cc/data.h> @@ -51,7 +55,7 @@ using namespace isc::agent; using namespace isc::data; using namespace std; -#line 55 "agent_parser.h" // lalr1.cc:379 +#line 59 "agent_parser.h" // lalr1.cc:404 # include <cassert> # include <cstdlib> // std::abort @@ -59,7 +63,21 @@ using namespace std; # 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 std; # 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 std; # 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 std; # 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 AGENT_DEBUG # if defined YYDEBUG @@ -134,9 +155,128 @@ using namespace std; # endif /* ! defined YYDEBUG */ #endif /* ! defined AGENT_DEBUG */ -#line 14 "agent_parser.yy" // lalr1.cc:379 +#line 14 "agent_parser.yy" // lalr1.cc:404 namespace isc { namespace agent { -#line 140 "agent_parser.h" // lalr1.cc:379 +#line 161 "agent_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 agent { /// 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 agent { /// 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 agent { const T& as () const { + YYASSERT (yytypeid_); YYASSERT (*yytypeid_ == typeid (T)); YYASSERT (sizeof (T) <= S); return *yyas_<T> (); @@ -218,7 +392,7 @@ namespace isc { namespace agent { /// 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 agent { 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 agent { 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. @@ -306,23 +495,23 @@ namespace isc { namespace agent { // value // map_value // socket_type_value - char dummy1[sizeof(ElementPtr)]; + char dummy1[sizeof (ElementPtr)]; // "boolean" - char dummy2[sizeof(bool)]; + char dummy2[sizeof (bool)]; // "floating point" - char dummy3[sizeof(double)]; + char dummy3[sizeof (double)]; // "integer" - char dummy4[sizeof(int64_t)]; + char dummy4[sizeof (int64_t)]; // "constant string" - char dummy5[sizeof(std::string)]; + char dummy5[sizeof (std::string)]; }; /// Symbol semantic values. - typedef variant<sizeof(union_type)> semantic_type; + typedef variant<sizeof (union_type)> semantic_type; #else typedef AGENT_STYPE semantic_type; #endif @@ -402,7 +591,7 @@ namespace isc { namespace agent { /// 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> @@ -414,28 +603,18 @@ namespace isc { namespace agent { /// 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 ElementPtr v, const location_type& l); + /// Move or copy constructor. + basic_symbol (YY_RVREF (basic_symbol) other); - basic_symbol (typename Base::kind_type t, const bool v, const location_type& l); - - basic_symbol (typename Base::kind_type t, const double v, const location_type& l); - - basic_symbol (typename Base::kind_type t, const int64_t v, const location_type& l); - - basic_symbol (typename Base::kind_type t, const std::string 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 (ElementPtr) v, YY_RVREF (location_type) l); + basic_symbol (typename Base::kind_type t, YY_RVREF (bool) v, YY_RVREF (location_type) l); + basic_symbol (typename Base::kind_type t, YY_RVREF (double) v, YY_RVREF (location_type) l); + basic_symbol (typename Base::kind_type t, YY_RVREF (int64_t) v, YY_RVREF (location_type) l); + basic_symbol (typename Base::kind_type t, YY_RVREF (std::string) 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 (); @@ -456,8 +635,10 @@ namespace isc { namespace agent { 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. @@ -497,209 +678,214 @@ namespace isc { namespace agent { /// "External" symbols: returned by the scanner. typedef basic_symbol<by_type> symbol_type; + /// Build a parser object. + AgentParser (isc::agent::ParserContext& ctx_yyarg); + virtual ~AgentParser (); + + /// Parse. An alias for parse (). + /// \returns 0 iff parsing succeeded. + int operator() (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if AGENT_DEBUG + /// 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_COMMA (const location_type& l); + make_COMMA (YY_COPY (location_type) l); - static inline + static symbol_type - make_COLON (const location_type& l); + make_COLON (YY_COPY (location_type) l); - static inline + static symbol_type - make_LSQUARE_BRACKET (const location_type& l); + make_LSQUARE_BRACKET (YY_COPY (location_type) l); - static inline + static symbol_type - make_RSQUARE_BRACKET (const location_type& l); + make_RSQUARE_BRACKET (YY_COPY (location_type) l); - static inline + static symbol_type - make_LCURLY_BRACKET (const location_type& l); + make_LCURLY_BRACKET (YY_COPY (location_type) l); - static inline + static symbol_type - make_RCURLY_BRACKET (const location_type& l); + make_RCURLY_BRACKET (YY_COPY (location_type) l); - static inline + static symbol_type - make_NULL_TYPE (const location_type& l); + make_NULL_TYPE (YY_COPY (location_type) l); - static inline + static symbol_type - make_CONTROL_AGENT (const location_type& l); + make_CONTROL_AGENT (YY_COPY (location_type) l); - static inline + static symbol_type - make_HTTP_HOST (const location_type& l); + make_HTTP_HOST (YY_COPY (location_type) l); - static inline + static symbol_type - make_HTTP_PORT (const location_type& l); + make_HTTP_PORT (YY_COPY (location_type) l); - static inline + static symbol_type - make_USER_CONTEXT (const location_type& l); + make_USER_CONTEXT (YY_COPY (location_type) l); - static inline + static symbol_type - make_COMMENT (const location_type& l); + make_COMMENT (YY_COPY (location_type) l); - static inline + static symbol_type - make_CONTROL_SOCKETS (const location_type& l); + make_CONTROL_SOCKETS (YY_COPY (location_type) l); - static inline + static symbol_type - make_DHCP4_SERVER (const location_type& l); + make_DHCP4_SERVER (YY_COPY (location_type) l); - static inline + static symbol_type - make_DHCP6_SERVER (const location_type& l); + make_DHCP6_SERVER (YY_COPY (location_type) l); - static inline + static symbol_type - make_D2_SERVER (const location_type& l); + make_D2_SERVER (YY_COPY (location_type) l); - static inline + static symbol_type - make_SOCKET_NAME (const location_type& l); + make_SOCKET_NAME (YY_COPY (location_type) l); - static inline + static symbol_type - make_SOCKET_TYPE (const location_type& l); + make_SOCKET_TYPE (YY_COPY (location_type) l); - static inline + static symbol_type - make_UNIX (const location_type& l); + make_UNIX (YY_COPY (location_type) l); - static inline + static symbol_type - make_HOOKS_LIBRARIES (const location_type& l); + make_HOOKS_LIBRARIES (YY_COPY (location_type) l); - static inline + static symbol_type - make_LIBRARY (const location_type& l); + make_LIBRARY (YY_COPY (location_type) l); - static inline + static symbol_type - make_PARAMETERS (const location_type& l); + make_PARAMETERS (YY_COPY (location_type) l); - static inline + static symbol_type - make_LOGGING (const location_type& l); + make_LOGGING (YY_COPY (location_type) l); - static inline + static symbol_type - make_LOGGERS (const location_type& l); + make_LOGGERS (YY_COPY (location_type) l); - static inline + static symbol_type - make_NAME (const location_type& l); + make_NAME (YY_COPY (location_type) l); - static inline + static symbol_type - make_OUTPUT_OPTIONS (const location_type& l); + make_OUTPUT_OPTIONS (YY_COPY (location_type) l); - static inline + static symbol_type - make_OUTPUT (const location_type& l); + make_OUTPUT (YY_COPY (location_type) l); - static inline + static symbol_type - make_DEBUGLEVEL (const location_type& l); + make_DEBUGLEVEL (YY_COPY (location_type) l); - static inline + static symbol_type - make_SEVERITY (const location_type& l); + make_SEVERITY (YY_COPY (location_type) l); - static inline + static symbol_type - make_FLUSH (const location_type& l); + make_FLUSH (YY_COPY (location_type) l); - static inline + static symbol_type - make_MAXSIZE (const location_type& l); + make_MAXSIZE (YY_COPY (location_type) l); - static inline + static symbol_type - make_MAXVER (const location_type& l); + make_MAXVER (YY_COPY (location_type) l); - static inline + static symbol_type - make_DHCP4 (const location_type& l); + make_DHCP4 (YY_COPY (location_type) l); - static inline + static symbol_type - make_DHCP6 (const location_type& l); + make_DHCP6 (YY_COPY (location_type) l); - static inline + static symbol_type - make_DHCPDDNS (const location_type& l); + make_DHCPDDNS (YY_COPY (location_type) l); - static inline + static symbol_type - make_START_JSON (const location_type& l); + make_START_JSON (YY_COPY (location_type) l); - static inline + static symbol_type - make_START_AGENT (const location_type& l); + make_START_AGENT (YY_COPY (location_type) l); - static inline + static symbol_type - make_START_SUB_AGENT (const location_type& l); + make_START_SUB_AGENT (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 int64_t& v, const location_type& l); + make_INTEGER (YY_COPY (int64_t) v, YY_COPY (location_type) l); - static inline + static symbol_type - make_FLOAT (const double& v, const location_type& l); + make_FLOAT (YY_COPY (double) v, YY_COPY (location_type) l); - static inline + static symbol_type - make_BOOLEAN (const bool& v, const location_type& l); - - - /// Build a parser object. - AgentParser (isc::agent::ParserContext& ctx_yyarg); - virtual ~AgentParser (); - - /// Parse. - /// \returns 0 iff parsing succeeded. - virtual int parse (); - -#if AGENT_DEBUG - /// 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_BOOLEAN (YY_COPY (bool) 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. @@ -737,7 +923,7 @@ namespace isc { namespace agent { // 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 @@ -748,14 +934,14 @@ namespace isc { namespace agent { static const signed char 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 // number is the opposite. If YYTABLE_NINF, syntax error. static const unsigned char yytable_[]; - static const short int yycheck_[]; + static const short yycheck_[]; // YYSTOS[STATE-NUM] -- The (internal number of the) accessing // symbol of state STATE-NUM. @@ -776,14 +962,15 @@ namespace isc { namespace agent { static const char* const yytname_[]; #if AGENT_DEBUG // 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. @@ -841,12 +1028,15 @@ namespace isc { namespace agent { 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. @@ -858,20 +1048,20 @@ namespace isc { namespace agent { /// 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 @@ -951,36 +1141,37 @@ namespace isc { namespace agent { template <typename Base> AgentParser::basic_symbol<Base>::basic_symbol () : value () + , location () {} template <typename Base> - AgentParser::basic_symbol<Base>::basic_symbol (const basic_symbol& other) - : Base (other) + AgentParser::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 53: // value case 56: // map_value case 107: // socket_type_value - value.copy< ElementPtr > (other.value); + value.YY_MOVE_OR_COPY< ElementPtr > (YY_MOVE (other.value)); break; case 44: // "boolean" - value.copy< bool > (other.value); + value.YY_MOVE_OR_COPY< bool > (YY_MOVE (other.value)); break; case 43: // "floating point" - value.copy< double > (other.value); + value.YY_MOVE_OR_COPY< double > (YY_MOVE (other.value)); break; case 42: // "integer" - value.copy< int64_t > (other.value); + value.YY_MOVE_OR_COPY< int64_t > (YY_MOVE (other.value)); break; case 41: // "constant string" - value.copy< std::string > (other.value); + value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (other.value)); break; default: @@ -989,88 +1180,51 @@ namespace isc { namespace agent { } - template <typename Base> - AgentParser::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 53: // value - case 56: // map_value - case 107: // socket_type_value - value.copy< ElementPtr > (v); - break; - - case 44: // "boolean" - value.copy< bool > (v); - break; - - case 43: // "floating point" - value.copy< double > (v); - break; - - case 42: // "integer" - value.copy< int64_t > (v); - break; - - case 41: // "constant string" - value.copy< std::string > (v); - break; - - default: - break; - } -} - // Implementation of basic_symbol constructor for each type. - template <typename Base> - AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l) + AgentParser::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> - AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const ElementPtr v, const location_type& l) + AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (ElementPtr) v, YY_RVREF (location_type) l) : Base (t) - , value (v) - , location (l) + , value (YY_MOVE (v)) + , location (YY_MOVE (l)) {} template <typename Base> - AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const bool v, const location_type& l) + AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (bool) v, YY_RVREF (location_type) l) : Base (t) - , value (v) - , location (l) + , value (YY_MOVE (v)) + , location (YY_MOVE (l)) {} template <typename Base> - AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const double v, const location_type& l) + AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (double) v, YY_RVREF (location_type) l) : Base (t) - , value (v) - , location (l) + , value (YY_MOVE (v)) + , location (YY_MOVE (l)) {} template <typename Base> - AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int64_t v, const location_type& l) + AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (int64_t) v, YY_RVREF (location_type) l) : Base (t) - , value (v) - , location (l) + , value (YY_MOVE (v)) + , location (YY_MOVE (l)) {} template <typename Base> - AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l) + AgentParser::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> AgentParser::basic_symbol<Base>::~basic_symbol () { @@ -1140,30 +1294,30 @@ namespace isc { namespace agent { case 53: // value case 56: // map_value case 107: // socket_type_value - value.move< ElementPtr > (s.value); + value.move< ElementPtr > (YY_MOVE (s.value)); break; case 44: // "boolean" - value.move< bool > (s.value); + value.move< bool > (YY_MOVE (s.value)); break; case 43: // "floating point" - value.move< double > (s.value); + value.move< double > (YY_MOVE (s.value)); break; case 42: // "integer" - value.move< int64_t > (s.value); + value.move< int64_t > (YY_MOVE (s.value)); break; case 41: // "constant string" - value.move< std::string > (s.value); + value.move< std::string > (YY_MOVE (s.value)); break; default: break; } - location = s.location; + location = YY_MOVE (s.location); } // by_type. @@ -1211,7 +1365,7 @@ namespace isc { namespace agent { // 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, @@ -1222,269 +1376,313 @@ namespace isc { namespace agent { }; return static_cast<token_type> (yytoken_number_[type]); } + // Implementation of make_symbol for each symbol type. + inline AgentParser::symbol_type - AgentParser::make_END (const location_type& l) + AgentParser::make_END (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_END, l); + return symbol_type (token::TOKEN_END, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_COMMA (const location_type& l) + AgentParser::make_COMMA (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_COMMA, l); + return symbol_type (token::TOKEN_COMMA, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_COLON (const location_type& l) + AgentParser::make_COLON (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_COLON, l); + return symbol_type (token::TOKEN_COLON, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_LSQUARE_BRACKET (const location_type& l) + AgentParser::make_LSQUARE_BRACKET (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_LSQUARE_BRACKET, l); + return symbol_type (token::TOKEN_LSQUARE_BRACKET, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_RSQUARE_BRACKET (const location_type& l) + AgentParser::make_RSQUARE_BRACKET (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_RSQUARE_BRACKET, l); + return symbol_type (token::TOKEN_RSQUARE_BRACKET, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_LCURLY_BRACKET (const location_type& l) + AgentParser::make_LCURLY_BRACKET (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_LCURLY_BRACKET, l); + return symbol_type (token::TOKEN_LCURLY_BRACKET, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_RCURLY_BRACKET (const location_type& l) + AgentParser::make_RCURLY_BRACKET (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_RCURLY_BRACKET, l); + return symbol_type (token::TOKEN_RCURLY_BRACKET, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_NULL_TYPE (const location_type& l) + AgentParser::make_NULL_TYPE (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_NULL_TYPE, l); + return symbol_type (token::TOKEN_NULL_TYPE, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_CONTROL_AGENT (const location_type& l) + AgentParser::make_CONTROL_AGENT (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_CONTROL_AGENT, l); + return symbol_type (token::TOKEN_CONTROL_AGENT, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_HTTP_HOST (const location_type& l) + AgentParser::make_HTTP_HOST (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_HTTP_HOST, l); + return symbol_type (token::TOKEN_HTTP_HOST, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_HTTP_PORT (const location_type& l) + AgentParser::make_HTTP_PORT (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_HTTP_PORT, l); + return symbol_type (token::TOKEN_HTTP_PORT, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_USER_CONTEXT (const location_type& l) + AgentParser::make_USER_CONTEXT (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_USER_CONTEXT, l); + return symbol_type (token::TOKEN_USER_CONTEXT, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_COMMENT (const location_type& l) + AgentParser::make_COMMENT (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_COMMENT, l); + return symbol_type (token::TOKEN_COMMENT, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_CONTROL_SOCKETS (const location_type& l) + AgentParser::make_CONTROL_SOCKETS (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_CONTROL_SOCKETS, l); + return symbol_type (token::TOKEN_CONTROL_SOCKETS, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_DHCP4_SERVER (const location_type& l) + AgentParser::make_DHCP4_SERVER (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_DHCP4_SERVER, l); + return symbol_type (token::TOKEN_DHCP4_SERVER, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_DHCP6_SERVER (const location_type& l) + AgentParser::make_DHCP6_SERVER (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_DHCP6_SERVER, l); + return symbol_type (token::TOKEN_DHCP6_SERVER, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_D2_SERVER (const location_type& l) + AgentParser::make_D2_SERVER (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_D2_SERVER, l); + return symbol_type (token::TOKEN_D2_SERVER, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_SOCKET_NAME (const location_type& l) + AgentParser::make_SOCKET_NAME (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_SOCKET_NAME, l); + return symbol_type (token::TOKEN_SOCKET_NAME, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_SOCKET_TYPE (const location_type& l) + AgentParser::make_SOCKET_TYPE (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_SOCKET_TYPE, l); + return symbol_type (token::TOKEN_SOCKET_TYPE, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_UNIX (const location_type& l) + AgentParser::make_UNIX (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_UNIX, l); + return symbol_type (token::TOKEN_UNIX, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_HOOKS_LIBRARIES (const location_type& l) + AgentParser::make_HOOKS_LIBRARIES (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_HOOKS_LIBRARIES, l); + return symbol_type (token::TOKEN_HOOKS_LIBRARIES, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_LIBRARY (const location_type& l) + AgentParser::make_LIBRARY (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_LIBRARY, l); + return symbol_type (token::TOKEN_LIBRARY, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_PARAMETERS (const location_type& l) + AgentParser::make_PARAMETERS (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_PARAMETERS, l); + return symbol_type (token::TOKEN_PARAMETERS, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_LOGGING (const location_type& l) + AgentParser::make_LOGGING (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_LOGGING, l); + return symbol_type (token::TOKEN_LOGGING, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_LOGGERS (const location_type& l) + AgentParser::make_LOGGERS (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_LOGGERS, l); + return symbol_type (token::TOKEN_LOGGERS, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_NAME (const location_type& l) + AgentParser::make_NAME (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_NAME, l); + return symbol_type (token::TOKEN_NAME, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_OUTPUT_OPTIONS (const location_type& l) + AgentParser::make_OUTPUT_OPTIONS (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_OUTPUT_OPTIONS, l); + return symbol_type (token::TOKEN_OUTPUT_OPTIONS, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_OUTPUT (const location_type& l) + AgentParser::make_OUTPUT (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_OUTPUT, l); + return symbol_type (token::TOKEN_OUTPUT, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_DEBUGLEVEL (const location_type& l) + AgentParser::make_DEBUGLEVEL (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_DEBUGLEVEL, l); + return symbol_type (token::TOKEN_DEBUGLEVEL, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_SEVERITY (const location_type& l) + AgentParser::make_SEVERITY (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_SEVERITY, l); + return symbol_type (token::TOKEN_SEVERITY, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_FLUSH (const location_type& l) + AgentParser::make_FLUSH (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_FLUSH, l); + return symbol_type (token::TOKEN_FLUSH, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_MAXSIZE (const location_type& l) + AgentParser::make_MAXSIZE (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_MAXSIZE, l); + return symbol_type (token::TOKEN_MAXSIZE, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_MAXVER (const location_type& l) + AgentParser::make_MAXVER (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_MAXVER, l); + return symbol_type (token::TOKEN_MAXVER, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_DHCP4 (const location_type& l) + AgentParser::make_DHCP4 (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_DHCP4, l); + return symbol_type (token::TOKEN_DHCP4, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_DHCP6 (const location_type& l) + AgentParser::make_DHCP6 (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_DHCP6, l); + return symbol_type (token::TOKEN_DHCP6, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_DHCPDDNS (const location_type& l) + AgentParser::make_DHCPDDNS (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_DHCPDDNS, l); + return symbol_type (token::TOKEN_DHCPDDNS, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_START_JSON (const location_type& l) + AgentParser::make_START_JSON (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_START_JSON, l); + return symbol_type (token::TOKEN_START_JSON, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_START_AGENT (const location_type& l) + AgentParser::make_START_AGENT (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_START_AGENT, l); + return symbol_type (token::TOKEN_START_AGENT, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_START_SUB_AGENT (const location_type& l) + AgentParser::make_START_SUB_AGENT (YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_START_SUB_AGENT, l); + return symbol_type (token::TOKEN_START_SUB_AGENT, YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_STRING (const std::string& v, const location_type& l) + AgentParser::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 AgentParser::symbol_type - AgentParser::make_INTEGER (const int64_t& v, const location_type& l) + AgentParser::make_INTEGER (YY_COPY (int64_t) 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 AgentParser::symbol_type - AgentParser::make_FLOAT (const double& v, const location_type& l) + AgentParser::make_FLOAT (YY_COPY (double) v, YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_FLOAT, v, l); + return symbol_type (token::TOKEN_FLOAT, YY_MOVE (v), YY_MOVE (l)); } + inline AgentParser::symbol_type - AgentParser::make_BOOLEAN (const bool& v, const location_type& l) + AgentParser::make_BOOLEAN (YY_COPY (bool) v, YY_COPY (location_type) l) { - return symbol_type (token::TOKEN_BOOLEAN, v, l); + return symbol_type (token::TOKEN_BOOLEAN, YY_MOVE (v), YY_MOVE (l)); } -#line 14 "agent_parser.yy" // lalr1.cc:379 +#line 14 "agent_parser.yy" // lalr1.cc:404 } } // isc::agent -#line 1488 "agent_parser.h" // lalr1.cc:379 +#line 1686 "agent_parser.h" // lalr1.cc:404 diff --git a/src/bin/agent/location.hh b/src/bin/agent/location.hh index 528b6b8ba6..997ac4d413 100644 --- a/src/bin/agent/location.hh +++ b/src/bin/agent/location.hh @@ -1,5 +1,5 @@ -// Generated 201811151407 -// A Bison parser, made by GNU Bison 3.0.5. +// Generated 201811172153 +// A Bison parser, made by GNU Bison 3.2.1. // Locations for Bison parsers in C++ @@ -39,12 +39,145 @@ #ifndef YY_AGENT_LOCATION_HH_INCLUDED # define YY_AGENT_LOCATION_HH_INCLUDED -# include "position.hh" +# include <algorithm> // std::max +# include <iostream> +# include <string> -#line 14 "agent_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 "agent_parser.yy" // location.cc:339 namespace isc { namespace agent { -#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 agent { ** 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 agent { return ostr; } -#line 14 "agent_parser.yy" // location.cc:292 +#line 14 "agent_parser.yy" // location.cc:339 } } // isc::agent -#line 189 "location.hh" // location.cc:292 +#line 322 "location.hh" // location.cc:339 #endif // !YY_AGENT_LOCATION_HH_INCLUDED diff --git a/src/bin/agent/position.hh b/src/bin/agent/position.hh index 1d9d64118f..9f3dfeedf8 100644 --- a/src/bin/agent/position.hh +++ b/src/bin/agent/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::agent::position class. - */ - -#ifndef YY_AGENT_POSITION_HH_INCLUDED -# define YY_AGENT_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 "agent_parser.yy" // location.cc:292 -namespace isc { namespace agent { -#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 "agent_parser.yy" // location.cc:292 -} } // isc::agent -#line 179 "position.hh" // location.cc:292 -#endif // !YY_AGENT_POSITION_HH_INCLUDED +// Generated 201811172153 +// 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/bin/agent/stack.hh b/src/bin/agent/stack.hh index 6c10366ac7..c0ca3f35b5 100644 --- a/src/bin/agent/stack.hh +++ b/src/bin/agent/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::agent::stack class. - */ - -#ifndef YY_AGENT_STACK_HH_INCLUDED -# define YY_AGENT_STACK_HH_INCLUDED - -# include <vector> - -#line 14 "agent_parser.yy" // stack.hh:131 -namespace isc { namespace agent { -#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 "agent_parser.yy" // stack.hh:131 -} } // isc::agent -#line 155 "stack.hh" // stack.hh:131 - -#endif // !YY_AGENT_STACK_HH_INCLUDED +// Generated 201811172153 +// 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. |