Kea 1.5.0
agent_parser.h
Go to the documentation of this file.
1// A Bison parser, made by GNU Bison 3.2.1.
2
3// Skeleton interface for Bison LALR(1) parsers in C++
4
5// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
6
7// This program is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20// As a special exception, you may create a larger work that contains
21// part or all of the Bison parser skeleton and distribute that work
22// under terms of your choice, so long as that work isn't itself a
23// parser generator using the skeleton or a modified version thereof
24// as a parser skeleton. Alternatively, if you modify or redistribute
25// the parser skeleton itself, you may (at your option) remove this
26// special exception, which will cause the skeleton and the resulting
27// Bison output files to be licensed under the GNU General Public
28// License without this special exception.
29
30// This special exception was added by the Free Software Foundation in
31// version 2.2 of Bison.
32
33
39// C++ LALR(1) parser skeleton written by Akim Demaille.
40
41// Undocumented macros, especially those whose name start with YY_,
42// are private implementation details. Do not rely on them.
43
44#ifndef YY_AGENT_AGENT_PARSER_H_INCLUDED
45# define YY_AGENT_AGENT_PARSER_H_INCLUDED
46// // "%code requires" blocks.
47#line 17 "agent_parser.yy" // lalr1.cc:404
48
49#include <string>
50#include <cc/data.h>
51#include <boost/lexical_cast.hpp>
53
54using namespace isc::agent;
55using namespace isc::data;
56using namespace std;
57
58#line 59 "agent_parser.h" // lalr1.cc:404
59
60# include <cassert>
61# include <cstdlib> // std::abort
62# include <iostream>
63# include <stdexcept>
64# include <string>
65# include <vector>
66
67#if defined __cplusplus
68# define YY_CPLUSPLUS __cplusplus
69#else
70# define YY_CPLUSPLUS 199711L
71#endif
72
73// Support move semantics when possible.
74#if 201103L <= YY_CPLUSPLUS
75# define YY_MOVE std::move
76# define YY_MOVE_OR_COPY move
77# define YY_MOVE_REF(Type) Type&&
78# define YY_RVREF(Type) Type&&
79# define YY_COPY(Type) Type
80#else
81# define YY_MOVE
82# define YY_MOVE_OR_COPY copy
83# define YY_MOVE_REF(Type) Type&
84# define YY_RVREF(Type) const Type&
85# define YY_COPY(Type) const Type&
86#endif
87# include "location.hh"
88#include <typeinfo>
89#ifndef YYASSERT
90# include <cassert>
91# define YYASSERT assert
92#endif
93
94
95#ifndef YY_ATTRIBUTE
96# if (defined __GNUC__ \
97 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
98 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
99# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
100# else
101# define YY_ATTRIBUTE(Spec) /* empty */
102# endif
103#endif
104
105#ifndef YY_ATTRIBUTE_PURE
106# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
107#endif
108
109#ifndef YY_ATTRIBUTE_UNUSED
110# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
111#endif
112
113/* Suppress unused-variable warnings by "using" E. */
114#if ! defined lint || defined __GNUC__
115# define YYUSE(E) ((void) (E))
116#else
117# define YYUSE(E) /* empty */
118#endif
119
120#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
121/* Suppress an incorrect diagnostic about yylval being uninitialized. */
122# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
123 _Pragma ("GCC diagnostic push") \
124 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
125 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
126# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
127 _Pragma ("GCC diagnostic pop")
128#else
129# define YY_INITIAL_VALUE(Value) Value
130#endif
131#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
132# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
133# define YY_IGNORE_MAYBE_UNINITIALIZED_END
134#endif
135#ifndef YY_INITIAL_VALUE
136# define YY_INITIAL_VALUE(Value) /* Nothing. */
137#endif
138
139# ifndef YY_NULLPTR
140# if defined __cplusplus
141# if 201103L <= __cplusplus
142# define YY_NULLPTR nullptr
143# else
144# define YY_NULLPTR 0
145# endif
146# else
147# define YY_NULLPTR ((void*)0)
148# endif
149# endif
150
151/* Debug traces. */
152#ifndef AGENT_DEBUG
153# if defined YYDEBUG
154#if YYDEBUG
155# define AGENT_DEBUG 1
156# else
157# define AGENT_DEBUG 0
158# endif
159# else /* ! defined YYDEBUG */
160# define AGENT_DEBUG 1
161# endif /* ! defined YYDEBUG */
162#endif /* ! defined AGENT_DEBUG */
163
164#line 14 "agent_parser.yy" // lalr1.cc:404
165namespace isc { namespace agent {
166#line 167 "agent_parser.h" // lalr1.cc:404
167
169 template <typename T, typename S = std::vector<T> >
170 class stack
171 {
172 public:
173 // Hide our reversed order.
174 typedef typename S::reverse_iterator iterator;
175 typedef typename S::const_reverse_iterator const_iterator;
176 typedef typename S::size_type size_type;
177
178 stack (size_type n = 200)
179 : seq_ (n)
180 {}
181
185 T&
187 {
188 return seq_[size () - 1 - i];
189 }
190
194 T&
196 {
197 return operator[] (size_type (i));
198 }
199
203 const T&
205 {
206 return seq_[size () - 1 - i];
207 }
208
212 const T&
213 operator[] (int i) const
214 {
215 return operator[] (size_type (i));
216 }
217
221 void
223 {
224 seq_.push_back (T ());
225 operator[](0).move (t);
226 }
227
228 void
229 pop (int n = 1)
230 {
231 for (; 0 < n; --n)
232 seq_.pop_back ();
233 }
234
235 void
237 {
238 seq_.clear ();
239 }
240
242 size () const
243 {
244 return seq_.size ();
245 }
246
248 begin () const
249 {
250 return seq_.rbegin ();
251 }
252
254 end () const
255 {
256 return seq_.rend ();
257 }
258
259 private:
260 stack (const stack&);
261 stack& operator= (const stack&);
263 S seq_;
264 };
265
267 template <typename T, typename S = stack<T> >
268 class slice
269 {
270 public:
271 slice (const S& stack, int range)
272 : stack_ (stack)
273 , range_ (range)
274 {}
275
276 const T&
277 operator[] (int i) const
278 {
279 return stack_[range_ - i];
280 }
281
282 private:
283 const S& stack_;
284 int range_;
285 };
286
287
288
294 template <size_t S>
295 struct variant
296 {
299
302 : yybuffer_ ()
303 , yytypeid_ (YY_NULLPTR)
304 {}
305
307 template <typename T>
309 : yytypeid_ (&typeid (T))
310 {
311 YYASSERT (sizeof (T) <= S);
312 new (yyas_<T> ()) T (YY_MOVE (t));
313 }
314
317 {
318 YYASSERT (!yytypeid_);
319 }
320
322 template <typename T>
323 T&
325 {
326 YYASSERT (!yytypeid_);
327 YYASSERT (sizeof (T) <= S);
328 yytypeid_ = & typeid (T);
329 return *new (yyas_<T> ()) T ();
330 }
331
332# if 201103L <= YY_CPLUSPLUS
334 template <typename T, typename U>
335 T&
336 emplace (U&& u)
337 {
338 YYASSERT (!yytypeid_);
339 YYASSERT (sizeof (T) <= S);
340 yytypeid_ = & typeid (T);
341 return *new (yyas_<T> ()) T (std::forward <U>(u));
342 }
343# else
345 template <typename T>
346 T&
347 emplace (const T& t)
348 {
349 YYASSERT (!yytypeid_);
350 YYASSERT (sizeof (T) <= S);
351 yytypeid_ = & typeid (T);
352 return *new (yyas_<T> ()) T (t);
353 }
354# endif
355
358 template <typename T>
359 T&
361 {
362 return emplace<T> ();
363 }
364
367 template <typename T>
368 T&
369 build (const T& t)
370 {
371 return emplace<T> (t);
372 }
373
375 template <typename T>
376 T&
377 as ()
378 {
379 YYASSERT (yytypeid_);
380 YYASSERT (*yytypeid_ == typeid (T));
381 YYASSERT (sizeof (T) <= S);
382 return *yyas_<T> ();
383 }
384
386 template <typename T>
387 const T&
388 as () const
389 {
390 YYASSERT (yytypeid_);
391 YYASSERT (*yytypeid_ == typeid (T));
392 YYASSERT (sizeof (T) <= S);
393 return *yyas_<T> ();
394 }
395
404 template <typename T>
405 void
407 {
408 YYASSERT (yytypeid_);
409 YYASSERT (*yytypeid_ == *other.yytypeid_);
410 std::swap (as<T> (), other.as<T> ());
411 }
412
416 template <typename T>
417 void
419 {
420# if 201103L <= YY_CPLUSPLUS
421 emplace<T> (std::move (other.as<T> ()));
422# else
423 emplace<T> ();
424 swap<T> (other);
425# endif
426 other.destroy<T> ();
427 }
428
429# if 201103L <= YY_CPLUSPLUS
431 template <typename T>
432 void
433 move (self_type&& other)
434 {
435 emplace<T> (std::move (other.as<T> ()));
436 other.destroy<T> ();
437 }
438#endif
439
441 template <typename T>
442 void
443 copy (const self_type& other)
444 {
445 emplace<T> (other.as<T> ());
446 }
447
449 template <typename T>
450 void
452 {
453 as<T> ().~T ();
454 yytypeid_ = YY_NULLPTR;
455 }
456
457 private:
459 self_type& operator= (const self_type&);
460 variant (const self_type&);
461
463 template <typename T>
464 T*
465 yyas_ ()
466 {
467 void *yyp = yybuffer_.yyraw;
468 return static_cast<T*> (yyp);
469 }
470
472 template <typename T>
473 const T*
474 yyas_ () const
475 {
476 const void *yyp = yybuffer_.yyraw;
477 return static_cast<const T*> (yyp);
478 }
479
480 union
481 {
483 long double yyalign_me;
485 char yyraw[S];
486 } yybuffer_;
487
489 const std::type_info *yytypeid_;
490 };
491
492
495 {
496 public:
497#ifndef AGENT_STYPE
500 {
501 // value
502 // map_value
503 // socket_type_value
504 char dummy1[sizeof (ElementPtr)];
505
506 // "boolean"
507 char dummy2[sizeof (bool)];
508
509 // "floating point"
510 char dummy3[sizeof (double)];
511
512 // "integer"
513 char dummy4[sizeof (int64_t)];
514
515 // "constant string"
516 char dummy5[sizeof (std::string)];
517};
518
521#else
522 typedef AGENT_STYPE semantic_type;
523#endif
525 typedef location location_type;
526
528 struct syntax_error : std::runtime_error
529 {
530 syntax_error (const location_type& l, const std::string& m);
532 };
533
535 struct token
536 {
538 {
581 TOKEN_BOOLEAN = 299
582 };
583 };
584
587
590
592 enum { empty_symbol = -2 };
593
595 typedef unsigned char token_number_type;
596
603 template <typename Base>
604 struct basic_symbol : Base
605 {
607 typedef Base super_type;
608
611
614
615
617# if 201103L <= YY_CPLUSPLUS
618 basic_symbol (typename Base::kind_type t, location_type&& l);
619#else
620 basic_symbol (typename Base::kind_type t, const location_type& l);
621#endif
622# if 201103L <= YY_CPLUSPLUS
623 basic_symbol (typename Base::kind_type t, ElementPtr&& v, location_type&& l);
624#else
625 basic_symbol (typename Base::kind_type t, const ElementPtr& v, const location_type& l);
626#endif
627# if 201103L <= YY_CPLUSPLUS
628 basic_symbol (typename Base::kind_type t, bool&& v, location_type&& l);
629#else
630 basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l);
631#endif
632# if 201103L <= YY_CPLUSPLUS
633 basic_symbol (typename Base::kind_type t, double&& v, location_type&& l);
634#else
635 basic_symbol (typename Base::kind_type t, const double& v, const location_type& l);
636#endif
637# if 201103L <= YY_CPLUSPLUS
638 basic_symbol (typename Base::kind_type t, int64_t&& v, location_type&& l);
639#else
640 basic_symbol (typename Base::kind_type t, const int64_t& v, const location_type& l);
641#endif
642# if 201103L <= YY_CPLUSPLUS
643 basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l);
644#else
645 basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l);
646#endif
647
648
651
653 void clear ();
654
656 bool empty () const;
657
660
663
666
667 private:
668#if YY_CPLUSPLUS < 201103L
670 basic_symbol& operator= (const basic_symbol& other);
671#endif
672 };
673
675 struct by_type
676 {
678 by_type ();
679
681 by_type (const by_type& other);
682
685
687 by_type (kind_type t);
688
690 void clear ();
691
693 void move (by_type& that);
694
698
700 token_type token () const;
701
705 int type;
706 };
707
710
713 virtual ~AgentParser ();
714
717 int operator() ();
718
721 virtual int parse ();
722
723#if AGENT_DEBUG
725 std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
727 void set_debug_stream (std::ostream &);
728
730 typedef int debug_level_type;
732 debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
734 void set_debug_level (debug_level_type l);
735#endif
736
740 virtual void error (const location_type& loc, const std::string& msg);
741
743 void error (const syntax_error& err);
744
745 // Symbol constructors declarations.
746 static
749
750 static
753
754 static
757
758 static
761
762 static
765
766 static
769
770 static
773
774 static
777
778 static
781
782 static
785
786 static
789
790 static
793
794 static
797
798 static
801
802 static
805
806 static
809
810 static
813
814 static
817
818 static
821
822 static
825
826 static
829
830 static
833
834 static
837
838 static
841
842 static
845
846 static
849
850 static
853
854 static
857
858 static
861
862 static
865
866 static
869
870 static
873
874 static
877
878 static
881
882 static
885
886 static
889
890 static
893
894 static
897
898 static
901
902 static
904 make_STRING (YY_COPY (std::string) v, YY_COPY (location_type) l);
905
906 static
908 make_INTEGER (YY_COPY (int64_t) v, YY_COPY (location_type) l);
909
910 static
912 make_FLOAT (YY_COPY (double) v, YY_COPY (location_type) l);
913
914 static
917
918
919
920 private:
922 AgentParser (const AgentParser&);
923 AgentParser& operator= (const AgentParser&);
924
926 typedef int state_type;
927
931 virtual std::string yysyntax_error_ (state_type yystate,
932 const symbol_type& yyla) const;
933
937 state_type yy_lr_goto_state_ (state_type yystate, int yysym);
938
941 static bool yy_pact_value_is_default_ (int yyvalue);
942
945 static bool yy_table_value_is_error_ (int yyvalue);
946
947 static const signed char yypact_ninf_;
948 static const signed char yytable_ninf_;
949
951 static token_number_type yytranslate_ (token_type t);
952
953 // Tables.
954 // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
955 // STATE-NUM.
956 static const short yypact_[];
957
958 // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
959 // Performed when YYTABLE does not specify something else to do. Zero
960 // means the default is an error.
961 static const unsigned char yydefact_[];
962
963 // YYPGOTO[NTERM-NUM].
964 static const signed char yypgoto_[];
965
966 // YYDEFGOTO[NTERM-NUM].
967 static const short yydefgoto_[];
968
969 // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
970 // positive, shift that token. If negative, reduce the rule whose
971 // number is the opposite. If YYTABLE_NINF, syntax error.
972 static const unsigned char yytable_[];
973
974 static const short yycheck_[];
975
976 // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
977 // symbol of state STATE-NUM.
978 static const unsigned char yystos_[];
979
980 // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
981 static const unsigned char yyr1_[];
982
983 // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
984 static const unsigned char yyr2_[];
985
986
988 static std::string yytnamerr_ (const char *n);
989
990
992 static const char* const yytname_[];
993#if AGENT_DEBUG
994 // YYRLINE[YYN] -- Source line where rule number YYN was defined.
995 static const unsigned short yyrline_[];
997 virtual void yy_reduce_print_ (int r);
999 virtual void yystack_print_ ();
1000
1002 int yydebug_;
1004 std::ostream* yycdebug_;
1005
1009 template <typename Base>
1010 void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
1011#endif
1012
1017 template <typename Base>
1018 void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
1019
1020 private:
1022 struct by_state
1023 {
1025 by_state ();
1026
1028 typedef state_type kind_type;
1029
1031 by_state (kind_type s);
1032
1034 by_state (const by_state& other);
1035
1037 void clear ();
1038
1040 void move (by_state& that);
1041
1044 symbol_number_type type_get () const;
1045
1047 enum { empty_state = -1 };
1048
1051 state_type state;
1052 };
1053
1055 struct stack_symbol_type : basic_symbol<by_state>
1056 {
1058 typedef basic_symbol<by_state> super_type;
1060 stack_symbol_type ();
1062 stack_symbol_type (YY_RVREF (stack_symbol_type) that);
1064 stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
1065#if YY_CPLUSPLUS < 201103L
1068 stack_symbol_type& operator= (stack_symbol_type& that);
1069#endif
1070 };
1071
1073 typedef stack<stack_symbol_type> stack_type;
1074
1076 stack_type yystack_;
1077
1083 void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
1084
1091 void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
1092
1094 void yypop_ (int n = 1);
1095
1097 enum
1098 {
1099 yyeof_ = 0,
1100 yylast_ = 190,
1101 yynnts_ = 97,
1102 yyfinal_ = 8,
1103 yyterror_ = 1,
1104 yyerrcode_ = 256,
1105 yyntokens_ = 45
1106 };
1107
1108
1109 // User arguments.
1111 };
1112
1113 // Symbol number corresponding to token number t.
1114 inline
1116 AgentParser::yytranslate_ (token_type t)
1117 {
1118 static
1119 const token_number_type
1120 translate_table[] =
1121 {
1122 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1123 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1125 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1126 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1127 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1132 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1133 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1134 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1135 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1136 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1137 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1143 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1144 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1145 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1146 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1147 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1148 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1149 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1150 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1151 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
1152 };
1153 const unsigned user_token_number_max_ = 299;
1154 const token_number_type undef_token_ = 2;
1155
1156 if (static_cast<int> (t) <= yyeof_)
1157 return yyeof_;
1158 else if (static_cast<unsigned> (t) <= user_token_number_max_)
1159 return translate_table[t];
1160 else
1161 return undef_token_;
1162 }
1163
1164 inline
1166 : std::runtime_error (m)
1167 , location (l)
1168 {}
1169
1170 // basic_symbol.
1171 template <typename Base>
1173 : value ()
1174 , location ()
1175 {}
1176
1177 template <typename Base>
1179 : Base (YY_MOVE (other))
1180 , value ()
1181 , location (YY_MOVE (other.location))
1182 {
1183 switch (other.type_get ())
1184 {
1185 case 53: // value
1186 case 56: // map_value
1187 case 107: // socket_type_value
1188 value.YY_MOVE_OR_COPY< ElementPtr > (YY_MOVE (other.value));
1189 break;
1190
1191 case 44: // "boolean"
1192 value.YY_MOVE_OR_COPY< bool > (YY_MOVE (other.value));
1193 break;
1194
1195 case 43: // "floating point"
1196 value.YY_MOVE_OR_COPY< double > (YY_MOVE (other.value));
1197 break;
1198
1199 case 42: // "integer"
1200 value.YY_MOVE_OR_COPY< int64_t > (YY_MOVE (other.value));
1201 break;
1202
1203 case 41: // "constant string"
1204 value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (other.value));
1205 break;
1206
1207 default:
1208 break;
1209 }
1210
1211 }
1212
1213
1214 // Implementation of basic_symbol constructor for each type.
1215# if 201103L <= YY_CPLUSPLUS
1216 template <typename Base>
1217 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, location_type&& l)
1218 : Base (t)
1219 , location (std::move (l))
1220 {}
1221#else
1222 template <typename Base>
1224 : Base (t)
1225 , location (l)
1226 {}
1227#endif
1228# if 201103L <= YY_CPLUSPLUS
1229 template <typename Base>
1230 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, ElementPtr&& v, location_type&& l)
1231 : Base (t)
1232 , value (std::move (v))
1233 , location (std::move (l))
1234 {}
1235#else
1236 template <typename Base>
1237 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const ElementPtr& v, const location_type& l)
1238 : Base (t)
1239 , value (v)
1240 , location (l)
1241 {}
1242#endif
1243# if 201103L <= YY_CPLUSPLUS
1244 template <typename Base>
1245 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, bool&& v, location_type&& l)
1246 : Base (t)
1247 , value (std::move (v))
1248 , location (std::move (l))
1249 {}
1250#else
1251 template <typename Base>
1252 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l)
1253 : Base (t)
1254 , value (v)
1255 , location (l)
1256 {}
1257#endif
1258# if 201103L <= YY_CPLUSPLUS
1259 template <typename Base>
1260 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, double&& v, location_type&& l)
1261 : Base (t)
1262 , value (std::move (v))
1263 , location (std::move (l))
1264 {}
1265#else
1266 template <typename Base>
1267 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const double& v, const location_type& l)
1268 : Base (t)
1269 , value (v)
1270 , location (l)
1271 {}
1272#endif
1273# if 201103L <= YY_CPLUSPLUS
1274 template <typename Base>
1275 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, int64_t&& v, location_type&& l)
1276 : Base (t)
1277 , value (std::move (v))
1278 , location (std::move (l))
1279 {}
1280#else
1281 template <typename Base>
1282 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int64_t& v, const location_type& l)
1283 : Base (t)
1284 , value (v)
1285 , location (l)
1286 {}
1287#endif
1288# if 201103L <= YY_CPLUSPLUS
1289 template <typename Base>
1290 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l)
1291 : Base (t)
1292 , value (std::move (v))
1293 , location (std::move (l))
1294 {}
1295#else
1296 template <typename Base>
1297 AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l)
1298 : Base (t)
1299 , value (v)
1300 , location (l)
1301 {}
1302#endif
1303
1304
1305 template <typename Base>
1307 {
1308 clear ();
1309 }
1310
1311 template <typename Base>
1312 void
1314 {
1315 // User destructor.
1316 symbol_number_type yytype = this->type_get ();
1317 basic_symbol<Base>& yysym = *this;
1318 (void) yysym;
1319 switch (yytype)
1320 {
1321 default:
1322 break;
1323 }
1324
1325 // Type destructor.
1326 switch (yytype)
1327 {
1328 case 53: // value
1329 case 56: // map_value
1330 case 107: // socket_type_value
1331 value.template destroy< ElementPtr > ();
1332 break;
1333
1334 case 44: // "boolean"
1335 value.template destroy< bool > ();
1336 break;
1337
1338 case 43: // "floating point"
1339 value.template destroy< double > ();
1340 break;
1341
1342 case 42: // "integer"
1343 value.template destroy< int64_t > ();
1344 break;
1345
1346 case 41: // "constant string"
1347 value.template destroy< std::string > ();
1348 break;
1349
1350 default:
1351 break;
1352 }
1353
1354 Base::clear ();
1355 }
1356
1357 template <typename Base>
1358 bool
1360 {
1361 return Base::type_get () == empty_symbol;
1362 }
1363
1364 template <typename Base>
1365 void
1367 {
1368 super_type::move (s);
1369 switch (this->type_get ())
1370 {
1371 case 53: // value
1372 case 56: // map_value
1373 case 107: // socket_type_value
1374 value.move< ElementPtr > (YY_MOVE (s.value));
1375 break;
1376
1377 case 44: // "boolean"
1378 value.move< bool > (YY_MOVE (s.value));
1379 break;
1380
1381 case 43: // "floating point"
1382 value.move< double > (YY_MOVE (s.value));
1383 break;
1384
1385 case 42: // "integer"
1386 value.move< int64_t > (YY_MOVE (s.value));
1387 break;
1388
1389 case 41: // "constant string"
1390 value.move< std::string > (YY_MOVE (s.value));
1391 break;
1392
1393 default:
1394 break;
1395 }
1396
1397 location = YY_MOVE (s.location);
1398 }
1399
1400 // by_type.
1401 inline
1403 : type (empty_symbol)
1404 {}
1405
1406 inline
1408 : type (other.type)
1409 {}
1410
1411 inline
1413 : type (yytranslate_ (t))
1414 {}
1415
1416 inline
1417 void
1419 {
1420 type = empty_symbol;
1421 }
1422
1423 inline
1424 void
1426 {
1427 type = that.type;
1428 that.clear ();
1429 }
1430
1431 inline
1432 int
1434 {
1435 return type;
1436 }
1437
1438 inline
1441 {
1442 // YYTOKNUM[NUM] -- (External) token number corresponding to the
1443 // (internal) symbol number NUM (which must be that of a token). */
1444 static
1445 const unsigned short
1446 yytoken_number_[] =
1447 {
1448 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1449 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1450 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1451 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1452 295, 296, 297, 298, 299
1453 };
1454 return static_cast<token_type> (yytoken_number_[type]);
1455 }
1456
1457 // Implementation of make_symbol for each symbol type.
1458 inline
1461 {
1462 return symbol_type (token::TOKEN_END, YY_MOVE (l));
1463 }
1464
1465 inline
1468 {
1470 }
1471
1472 inline
1475 {
1477 }
1478
1479 inline
1482 {
1484 }
1485
1486 inline
1489 {
1491 }
1492
1493 inline
1496 {
1498 }
1499
1500 inline
1503 {
1505 }
1506
1507 inline
1510 {
1512 }
1513
1514 inline
1517 {
1519 }
1520
1521 inline
1524 {
1526 }
1527
1528 inline
1531 {
1533 }
1534
1535 inline
1538 {
1540 }
1541
1542 inline
1545 {
1547 }
1548
1549 inline
1552 {
1554 }
1555
1556 inline
1559 {
1561 }
1562
1563 inline
1566 {
1568 }
1569
1570 inline
1573 {
1575 }
1576
1577 inline
1580 {
1582 }
1583
1584 inline
1587 {
1589 }
1590
1591 inline
1594 {
1596 }
1597
1598 inline
1601 {
1603 }
1604
1605 inline
1608 {
1610 }
1611
1612 inline
1615 {
1617 }
1618
1619 inline
1622 {
1624 }
1625
1626 inline
1629 {
1631 }
1632
1633 inline
1636 {
1638 }
1639
1640 inline
1643 {
1645 }
1646
1647 inline
1650 {
1652 }
1653
1654 inline
1657 {
1659 }
1660
1661 inline
1664 {
1666 }
1667
1668 inline
1671 {
1673 }
1674
1675 inline
1678 {
1680 }
1681
1682 inline
1685 {
1687 }
1688
1689 inline
1692 {
1694 }
1695
1696 inline
1699 {
1701 }
1702
1703 inline
1706 {
1708 }
1709
1710 inline
1713 {
1715 }
1716
1717 inline
1720 {
1722 }
1723
1724 inline
1727 {
1729 }
1730
1731 inline
1734 {
1736 }
1737
1738 inline
1741 {
1743 }
1744
1745 inline
1748 {
1749 return symbol_type (token::TOKEN_FLOAT, YY_MOVE (v), YY_MOVE (l));
1750 }
1751
1752 inline
1755 {
1757 }
1758
1759
1760#line 14 "agent_parser.yy" // lalr1.cc:404
1761} } // isc::agent
1762#line 1763 "agent_parser.h" // lalr1.cc:404
1763
1764
1765
1766
1767#endif // !YY_AGENT_AGENT_PARSER_H_INCLUDED
Forward declaration of the ParserContext class.
#define YY_RVREF(Type)
Definition: agent_parser.h:84
#define YY_COPY(Type)
Definition: agent_parser.h:85
#define YY_MOVE_REF(Type)
Definition: agent_parser.h:83
#define YY_ATTRIBUTE_PURE
Definition: agent_parser.h:106
#define YY_MOVE
Definition: agent_parser.h:81
#define YYASSERT
Definition: agent_parser.h:91
static symbol_type make_OUTPUT_OPTIONS(YY_COPY(location_type) l)
static symbol_type make_DEBUGLEVEL(YY_COPY(location_type) l)
static symbol_type make_FLUSH(YY_COPY(location_type) l)
static symbol_type make_LOGGING(YY_COPY(location_type) l)
static symbol_type make_USER_CONTEXT(YY_COPY(location_type) l)
static symbol_type make_DHCP4(YY_COPY(location_type) l)
static symbol_type make_SOCKET_NAME(YY_COPY(location_type) l)
static symbol_type make_START_JSON(YY_COPY(location_type) l)
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
static symbol_type make_START_SUB_AGENT(YY_COPY(location_type) l)
static symbol_type make_COMMENT(YY_COPY(location_type) l)
location location_type
Symbol locations.
Definition: agent_parser.h:525
static symbol_type make_CONTROL_SOCKETS(YY_COPY(location_type) l)
static symbol_type make_STRING(YY_COPY(std::string) v, YY_COPY(location_type) l)
static symbol_type make_D2_SERVER(YY_COPY(location_type) l)
virtual int parse()
Parse.
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: agent_parser.h:709
static symbol_type make_BOOLEAN(YY_COPY(bool) v, YY_COPY(location_type) l)
static symbol_type make_START_AGENT(YY_COPY(location_type) l)
static symbol_type make_DHCP6(YY_COPY(location_type) l)
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: agent_parser.h:595
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: agent_parser.h:520
static symbol_type make_HTTP_HOST(YY_COPY(location_type) l)
static symbol_type make_END(YY_COPY(location_type) l)
static symbol_type make_LSQUARE_BRACKET(YY_COPY(location_type) l)
static symbol_type make_MAXSIZE(YY_COPY(location_type) l)
static symbol_type make_RCURLY_BRACKET(YY_COPY(location_type) l)
static symbol_type make_DHCP6_SERVER(YY_COPY(location_type) l)
static symbol_type make_COMMA(YY_COPY(location_type) l)
static symbol_type make_HTTP_PORT(YY_COPY(location_type) l)
static symbol_type make_OUTPUT(YY_COPY(location_type) l)
int symbol_number_type
Symbol type: an internal symbol number.
Definition: agent_parser.h:589
static symbol_type make_DHCP4_SERVER(YY_COPY(location_type) l)
static symbol_type make_HOOKS_LIBRARIES(YY_COPY(location_type) l)
static symbol_type make_LIBRARY(YY_COPY(location_type) l)
static symbol_type make_LCURLY_BRACKET(YY_COPY(location_type) l)
static symbol_type make_FLOAT(YY_COPY(double) v, YY_COPY(location_type) l)
static symbol_type make_MAXVER(YY_COPY(location_type) l)
static symbol_type make_UNIX(YY_COPY(location_type) l)
static symbol_type make_INTEGER(YY_COPY(int64_t) v, YY_COPY(location_type) l)
static symbol_type make_PARAMETERS(YY_COPY(location_type) l)
static symbol_type make_COLON(YY_COPY(location_type) l)
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: agent_parser.h:586
static symbol_type make_SOCKET_TYPE(YY_COPY(location_type) l)
static symbol_type make_CONTROL_AGENT(YY_COPY(location_type) l)
static symbol_type make_NAME(YY_COPY(location_type) l)
static symbol_type make_LOGGERS(YY_COPY(location_type) l)
static symbol_type make_NULL_TYPE(YY_COPY(location_type) l)
static symbol_type make_DHCPDDNS(YY_COPY(location_type) l)
static symbol_type make_RSQUARE_BRACKET(YY_COPY(location_type) l)
static symbol_type make_SEVERITY(YY_COPY(location_type) l)
Parser context is a wrapper around flex/bison instances dedicated to Control-agent config file parser...
Present a slice of the top of a stack.
Definition: agent_parser.h:269
slice(const S &stack, int range)
Definition: agent_parser.h:271
const T & operator[](int i) const
Definition: agent_parser.h:277
A stack with random access from its top.
Definition: agent_parser.h:171
void pop(int n=1)
Definition: agent_parser.h:229
const_iterator begin() const
Definition: agent_parser.h:248
S::size_type size_type
Definition: agent_parser.h:176
T & operator[](size_type i)
Random access.
Definition: agent_parser.h:186
S::reverse_iterator iterator
Definition: agent_parser.h:174
S::const_reverse_iterator const_iterator
Definition: agent_parser.h:175
const_iterator end() const
Definition: agent_parser.h:254
size_type size() const
Definition: agent_parser.h:242
void push(YY_MOVE_REF(T) t)
Steal the contents of t.
Definition: agent_parser.h:222
stack(size_type n=200)
Definition: agent_parser.h:178
boost::shared_ptr< Element > ElementPtr
Definition: data.h:22
Defines the logger used by the top-level component of kea-dhcp-ddns.
semantic_type value
The semantic value.
Definition: agent_parser.h:662
basic_symbol(typename Base::kind_type t, const int64_t &v, const location_type &l)
location_type location
The location.
Definition: agent_parser.h:665
void move(basic_symbol &s)
Destructive move, s is emptied into this.
basic_symbol(typename Base::kind_type t, const location_type &l)
Constructor for valueless symbols, and symbols from each type.
basic_symbol(typename Base::kind_type t, const std::string &v, const location_type &l)
void clear()
Destroy contents, and record that is empty.
basic_symbol(typename Base::kind_type t, const ElementPtr &v, const location_type &l)
basic_symbol(typename Base::kind_type t, const double &v, const location_type &l)
basic_symbol(YY_RVREF(basic_symbol) other)
Move or copy constructor.
bool empty() const
Whether empty.
basic_symbol(typename Base::kind_type t, const bool &v, const location_type &l)
Type access provider for token (enum) based symbols.
Definition: agent_parser.h:676
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
token_type kind_type
The symbol type as needed by the constructor.
Definition: agent_parser.h:684
void clear()
Record that this symbol is empty.
void move(by_type &that)
Steal the symbol type from that.
by_type()
Default constructor.
token_type token() const
The token.
Syntax errors thrown from user actions.
Definition: agent_parser.h:529
syntax_error(const location_type &l, const std::string &m)
A char[S] buffer to store and retrieve objects.
Definition: agent_parser.h:296
variant()
Empty construction.
Definition: agent_parser.h:301
variant< S > self_type
Type of *this.
Definition: agent_parser.h:298
T & build()
Instantiate an empty T in here.
Definition: agent_parser.h:360
T & emplace(const T &t)
Instantiate a T in here from t.
Definition: agent_parser.h:347
void destroy()
Destroy the stored T.
Definition: agent_parser.h:451
const T & as() const
Const accessor to a built T (for printer).
Definition: agent_parser.h:388
void copy(const self_type &other)
Copy the content of other to this.
Definition: agent_parser.h:443
variant(YY_RVREF(T) t)
Construct and fill.
Definition: agent_parser.h:308
T & as()
Accessor to a built T.
Definition: agent_parser.h:377
void move(self_type &other)
Move the content of other to this.
Definition: agent_parser.h:418
long double yyalign_me
Strongest alignment constraints.
Definition: agent_parser.h:483
T & emplace()
Instantiate an empty T in here.
Definition: agent_parser.h:324
char yyraw[S]
A buffer large enough to store any of the semantic values.
Definition: agent_parser.h:485
~variant()
Destruction, allowed only if empty.
Definition: agent_parser.h:316
T & build(const T &t)
Instantiate a T in here from t.
Definition: agent_parser.h:369
void swap(self_type &other)
Swap the content with other, of same type.
Definition: agent_parser.h:406
An auxiliary type to compute the largest semantic type.
Definition: agent_parser.h:500
char dummy1[sizeof(ElementPtr)]
Definition: agent_parser.h:504
char dummy5[sizeof(std::string)]
Definition: agent_parser.h:516