Kea 1.5.0
d2_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_D2_PARSER_D2_PARSER_H_INCLUDED
45# define YY_D2_PARSER_D2_PARSER_H_INCLUDED
46// // "%code requires" blocks.
47#line 17 "d2_parser.yy" // lalr1.cc:404
48
49#include <string>
50#include <cc/data.h>
51#include <d2/d2_config.h>
52#include <boost/lexical_cast.hpp>
54
55using namespace isc::d2;
56using namespace isc::data;
57using namespace std;
58
59#line 60 "d2_parser.h" // lalr1.cc:404
60
61# include <cassert>
62# include <cstdlib> // std::abort
63# include <iostream>
64# include <stdexcept>
65# include <string>
66# include <vector>
67
68#if defined __cplusplus
69# define YY_CPLUSPLUS __cplusplus
70#else
71# define YY_CPLUSPLUS 199711L
72#endif
73
74// Support move semantics when possible.
75#if 201103L <= YY_CPLUSPLUS
76# define YY_MOVE std::move
77# define YY_MOVE_OR_COPY move
78# define YY_MOVE_REF(Type) Type&&
79# define YY_RVREF(Type) Type&&
80# define YY_COPY(Type) Type
81#else
82# define YY_MOVE
83# define YY_MOVE_OR_COPY copy
84# define YY_MOVE_REF(Type) Type&
85# define YY_RVREF(Type) const Type&
86# define YY_COPY(Type) const Type&
87#endif
88# include "location.hh"
89#include <typeinfo>
90#ifndef YYASSERT
91# include <cassert>
92# define YYASSERT assert
93#endif
94
95
96#ifndef YY_ATTRIBUTE
97# if (defined __GNUC__ \
98 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
99 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
100# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
101# else
102# define YY_ATTRIBUTE(Spec) /* empty */
103# endif
104#endif
105
106#ifndef YY_ATTRIBUTE_PURE
107# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
108#endif
109
110#ifndef YY_ATTRIBUTE_UNUSED
111# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
112#endif
113
114/* Suppress unused-variable warnings by "using" E. */
115#if ! defined lint || defined __GNUC__
116# define YYUSE(E) ((void) (E))
117#else
118# define YYUSE(E) /* empty */
119#endif
120
121#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
122/* Suppress an incorrect diagnostic about yylval being uninitialized. */
123# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
124 _Pragma ("GCC diagnostic push") \
125 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
126 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
127# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
128 _Pragma ("GCC diagnostic pop")
129#else
130# define YY_INITIAL_VALUE(Value) Value
131#endif
132#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
133# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
134# define YY_IGNORE_MAYBE_UNINITIALIZED_END
135#endif
136#ifndef YY_INITIAL_VALUE
137# define YY_INITIAL_VALUE(Value) /* Nothing. */
138#endif
139
140# ifndef YY_NULLPTR
141# if defined __cplusplus
142# if 201103L <= __cplusplus
143# define YY_NULLPTR nullptr
144# else
145# define YY_NULLPTR 0
146# endif
147# else
148# define YY_NULLPTR ((void*)0)
149# endif
150# endif
151
152/* Debug traces. */
153#ifndef D2_PARSER_DEBUG
154# if defined YYDEBUG
155#if YYDEBUG
156# define D2_PARSER_DEBUG 1
157# else
158# define D2_PARSER_DEBUG 0
159# endif
160# else /* ! defined YYDEBUG */
161# define D2_PARSER_DEBUG 1
162# endif /* ! defined YYDEBUG */
163#endif /* ! defined D2_PARSER_DEBUG */
164
165#line 14 "d2_parser.yy" // lalr1.cc:404
166namespace isc { namespace d2 {
167#line 168 "d2_parser.h" // lalr1.cc:404
168
170 template <typename T, typename S = std::vector<T> >
171 class stack
172 {
173 public:
174 // Hide our reversed order.
175 typedef typename S::reverse_iterator iterator;
176 typedef typename S::const_reverse_iterator const_iterator;
177 typedef typename S::size_type size_type;
178
179 stack (size_type n = 200)
180 : seq_ (n)
181 {}
182
186 T&
188 {
189 return seq_[size () - 1 - i];
190 }
191
195 T&
197 {
198 return operator[] (size_type (i));
199 }
200
204 const T&
206 {
207 return seq_[size () - 1 - i];
208 }
209
213 const T&
214 operator[] (int i) const
215 {
216 return operator[] (size_type (i));
217 }
218
222 void
224 {
225 seq_.push_back (T ());
226 operator[](0).move (t);
227 }
228
229 void
230 pop (int n = 1)
231 {
232 for (; 0 < n; --n)
233 seq_.pop_back ();
234 }
235
236 void
238 {
239 seq_.clear ();
240 }
241
243 size () const
244 {
245 return seq_.size ();
246 }
247
249 begin () const
250 {
251 return seq_.rbegin ();
252 }
253
255 end () const
256 {
257 return seq_.rend ();
258 }
259
260 private:
261 stack (const stack&);
262 stack& operator= (const stack&);
264 S seq_;
265 };
266
268 template <typename T, typename S = stack<T> >
269 class slice
270 {
271 public:
272 slice (const S& stack, int range)
273 : stack_ (stack)
274 , range_ (range)
275 {}
276
277 const T&
278 operator[] (int i) const
279 {
280 return stack_[range_ - i];
281 }
282
283 private:
284 const S& stack_;
285 int range_;
286 };
287
288
289
295 template <size_t S>
296 struct variant
297 {
300
303 : yybuffer_ ()
304 , yytypeid_ (YY_NULLPTR)
305 {}
306
308 template <typename T>
310 : yytypeid_ (&typeid (T))
311 {
312 YYASSERT (sizeof (T) <= S);
313 new (yyas_<T> ()) T (YY_MOVE (t));
314 }
315
318 {
319 YYASSERT (!yytypeid_);
320 }
321
323 template <typename T>
324 T&
326 {
327 YYASSERT (!yytypeid_);
328 YYASSERT (sizeof (T) <= S);
329 yytypeid_ = & typeid (T);
330 return *new (yyas_<T> ()) T ();
331 }
332
333# if 201103L <= YY_CPLUSPLUS
335 template <typename T, typename U>
336 T&
337 emplace (U&& u)
338 {
339 YYASSERT (!yytypeid_);
340 YYASSERT (sizeof (T) <= S);
341 yytypeid_ = & typeid (T);
342 return *new (yyas_<T> ()) T (std::forward <U>(u));
343 }
344# else
346 template <typename T>
347 T&
348 emplace (const T& t)
349 {
350 YYASSERT (!yytypeid_);
351 YYASSERT (sizeof (T) <= S);
352 yytypeid_ = & typeid (T);
353 return *new (yyas_<T> ()) T (t);
354 }
355# endif
356
359 template <typename T>
360 T&
362 {
363 return emplace<T> ();
364 }
365
368 template <typename T>
369 T&
370 build (const T& t)
371 {
372 return emplace<T> (t);
373 }
374
376 template <typename T>
377 T&
378 as ()
379 {
380 YYASSERT (yytypeid_);
381 YYASSERT (*yytypeid_ == typeid (T));
382 YYASSERT (sizeof (T) <= S);
383 return *yyas_<T> ();
384 }
385
387 template <typename T>
388 const T&
389 as () const
390 {
391 YYASSERT (yytypeid_);
392 YYASSERT (*yytypeid_ == typeid (T));
393 YYASSERT (sizeof (T) <= S);
394 return *yyas_<T> ();
395 }
396
405 template <typename T>
406 void
408 {
409 YYASSERT (yytypeid_);
410 YYASSERT (*yytypeid_ == *other.yytypeid_);
411 std::swap (as<T> (), other.as<T> ());
412 }
413
417 template <typename T>
418 void
420 {
421# if 201103L <= YY_CPLUSPLUS
422 emplace<T> (std::move (other.as<T> ()));
423# else
424 emplace<T> ();
425 swap<T> (other);
426# endif
427 other.destroy<T> ();
428 }
429
430# if 201103L <= YY_CPLUSPLUS
432 template <typename T>
433 void
434 move (self_type&& other)
435 {
436 emplace<T> (std::move (other.as<T> ()));
437 other.destroy<T> ();
438 }
439#endif
440
442 template <typename T>
443 void
444 copy (const self_type& other)
445 {
446 emplace<T> (other.as<T> ());
447 }
448
450 template <typename T>
451 void
453 {
454 as<T> ().~T ();
455 yytypeid_ = YY_NULLPTR;
456 }
457
458 private:
460 self_type& operator= (const self_type&);
461 variant (const self_type&);
462
464 template <typename T>
465 T*
466 yyas_ ()
467 {
468 void *yyp = yybuffer_.yyraw;
469 return static_cast<T*> (yyp);
470 }
471
473 template <typename T>
474 const T*
475 yyas_ () const
476 {
477 const void *yyp = yybuffer_.yyraw;
478 return static_cast<const T*> (yyp);
479 }
480
481 union
482 {
484 long double yyalign_me;
486 char yyraw[S];
487 } yybuffer_;
488
490 const std::type_info *yytypeid_;
491 };
492
493
496 {
497 public:
498#ifndef D2_PARSER_STYPE
501 {
502 // value
503 // map_value
504 // ncr_protocol_value
505 char dummy1[sizeof (ElementPtr)];
506
507 // "boolean"
508 char dummy2[sizeof (bool)];
509
510 // "floating point"
511 char dummy3[sizeof (double)];
512
513 // "integer"
514 char dummy4[sizeof (int64_t)];
515
516 // "constant string"
517 char dummy5[sizeof (std::string)];
518};
519
522#else
523 typedef D2_PARSER_STYPE semantic_type;
524#endif
526 typedef location location_type;
527
529 struct syntax_error : std::runtime_error
530 {
531 syntax_error (const location_type& l, const std::string& m);
533 };
534
536 struct token
537 {
539 {
594 TOKEN_BOOLEAN = 311
595 };
596 };
597
600
603
605 enum { empty_symbol = -2 };
606
608 typedef unsigned char token_number_type;
609
616 template <typename Base>
617 struct basic_symbol : Base
618 {
620 typedef Base super_type;
621
623 basic_symbol ();
624
627
628
630# if 201103L <= YY_CPLUSPLUS
631 basic_symbol (typename Base::kind_type t, location_type&& l);
632#else
633 basic_symbol (typename Base::kind_type t, const location_type& l);
634#endif
635# if 201103L <= YY_CPLUSPLUS
636 basic_symbol (typename Base::kind_type t, ElementPtr&& v, location_type&& l);
637#else
638 basic_symbol (typename Base::kind_type t, const ElementPtr& v, const location_type& l);
639#endif
640# if 201103L <= YY_CPLUSPLUS
641 basic_symbol (typename Base::kind_type t, bool&& v, location_type&& l);
642#else
643 basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l);
644#endif
645# if 201103L <= YY_CPLUSPLUS
646 basic_symbol (typename Base::kind_type t, double&& v, location_type&& l);
647#else
648 basic_symbol (typename Base::kind_type t, const double& v, const location_type& l);
649#endif
650# if 201103L <= YY_CPLUSPLUS
651 basic_symbol (typename Base::kind_type t, int64_t&& v, location_type&& l);
652#else
653 basic_symbol (typename Base::kind_type t, const int64_t& v, const location_type& l);
654#endif
655# if 201103L <= YY_CPLUSPLUS
656 basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l);
657#else
658 basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l);
659#endif
660
661
663 ~basic_symbol ();
664
666 void clear ();
667
669 bool empty () const;
670
672 void move (basic_symbol& s);
673
676
679
680 private:
681#if YY_CPLUSPLUS < 201103L
683 basic_symbol& operator= (const basic_symbol& other);
684#endif
685 };
686
688 struct by_type
689 {
691 by_type ();
692
694 by_type (const by_type& other);
695
698
700 by_type (kind_type t);
701
703 void clear ();
704
706 void move (by_type& that);
707
711
713 token_type token () const;
714
718 int type;
719 };
720
723
726 virtual ~D2Parser ();
727
730 int operator() ();
731
734 virtual int parse ();
735
736#if D2_PARSER_DEBUG
738 std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
740 void set_debug_stream (std::ostream &);
741
743 typedef int debug_level_type;
745 debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
747 void set_debug_level (debug_level_type l);
748#endif
749
753 virtual void error (const location_type& loc, const std::string& msg);
754
756 void error (const syntax_error& err);
757
758 // Symbol constructors declarations.
759 static
762
763 static
766
767 static
770
771 static
774
775 static
778
779 static
782
783 static
786
787 static
790
791 static
794
795 static
798
799 static
802
803 static
806
807 static
810
811 static
814
815 static
818
819 static
822
823 static
826
827 static
830
831 static
834
835 static
838
839 static
842
843 static
846
847 static
850
851 static
854
855 static
858
859 static
862
863 static
866
867 static
870
871 static
874
875 static
878
879 static
882
883 static
886
887 static
890
891 static
894
895 static
898
899 static
902
903 static
906
907 static
910
911 static
914
915 static
918
919 static
922
923 static
926
927 static
930
931 static
934
935 static
938
939 static
942
943 static
946
947 static
950
951 static
954
955 static
958
959 static
962
963 static
965 make_STRING (YY_COPY (std::string) v, YY_COPY (location_type) l);
966
967 static
969 make_INTEGER (YY_COPY (int64_t) v, YY_COPY (location_type) l);
970
971 static
973 make_FLOAT (YY_COPY (double) v, YY_COPY (location_type) l);
974
975 static
978
979
980
981 private:
983 D2Parser (const D2Parser&);
984 D2Parser& operator= (const D2Parser&);
985
987 typedef int state_type;
988
992 virtual std::string yysyntax_error_ (state_type yystate,
993 const symbol_type& yyla) const;
994
998 state_type yy_lr_goto_state_ (state_type yystate, int yysym);
999
1002 static bool yy_pact_value_is_default_ (int yyvalue);
1003
1006 static bool yy_table_value_is_error_ (int yyvalue);
1007
1008 static const signed char yypact_ninf_;
1009 static const signed char yytable_ninf_;
1010
1012 static token_number_type yytranslate_ (token_type t);
1013
1014 // Tables.
1015 // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1016 // STATE-NUM.
1017 static const short yypact_[];
1018
1019 // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1020 // Performed when YYTABLE does not specify something else to do. Zero
1021 // means the default is an error.
1022 static const unsigned char yydefact_[];
1023
1024 // YYPGOTO[NTERM-NUM].
1025 static const signed char yypgoto_[];
1026
1027 // YYDEFGOTO[NTERM-NUM].
1028 static const short yydefgoto_[];
1029
1030 // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
1031 // positive, shift that token. If negative, reduce the rule whose
1032 // number is the opposite. If YYTABLE_NINF, syntax error.
1033 static const unsigned short yytable_[];
1034
1035 static const short yycheck_[];
1036
1037 // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1038 // symbol of state STATE-NUM.
1039 static const unsigned char yystos_[];
1040
1041 // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
1042 static const unsigned char yyr1_[];
1043
1044 // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
1045 static const unsigned char yyr2_[];
1046
1047
1049 static std::string yytnamerr_ (const char *n);
1050
1051
1053 static const char* const yytname_[];
1054#if D2_PARSER_DEBUG
1055 // YYRLINE[YYN] -- Source line where rule number YYN was defined.
1056 static const unsigned short yyrline_[];
1058 virtual void yy_reduce_print_ (int r);
1060 virtual void yystack_print_ ();
1061
1063 int yydebug_;
1065 std::ostream* yycdebug_;
1066
1070 template <typename Base>
1071 void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
1072#endif
1073
1078 template <typename Base>
1079 void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
1080
1081 private:
1083 struct by_state
1084 {
1086 by_state ();
1087
1089 typedef state_type kind_type;
1090
1092 by_state (kind_type s);
1093
1095 by_state (const by_state& other);
1096
1098 void clear ();
1099
1101 void move (by_state& that);
1102
1105 symbol_number_type type_get () const;
1106
1108 enum { empty_state = -1 };
1109
1112 state_type state;
1113 };
1114
1116 struct stack_symbol_type : basic_symbol<by_state>
1117 {
1119 typedef basic_symbol<by_state> super_type;
1121 stack_symbol_type ();
1123 stack_symbol_type (YY_RVREF (stack_symbol_type) that);
1125 stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
1126#if YY_CPLUSPLUS < 201103L
1129 stack_symbol_type& operator= (stack_symbol_type& that);
1130#endif
1131 };
1132
1134 typedef stack<stack_symbol_type> stack_type;
1135
1137 stack_type yystack_;
1138
1144 void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
1145
1152 void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
1153
1155 void yypop_ (int n = 1);
1156
1158 enum
1159 {
1160 yyeof_ = 0,
1161 yylast_ = 282,
1162 yynnts_ = 138,
1163 yyfinal_ = 20,
1164 yyterror_ = 1,
1165 yyerrcode_ = 256,
1166 yyntokens_ = 57
1167 };
1168
1169
1170 // User arguments.
1172 };
1173
1174 // Symbol number corresponding to token number t.
1175 inline
1177 D2Parser::yytranslate_ (token_type t)
1178 {
1179 static
1180 const token_number_type
1181 translate_table[] =
1182 {
1183 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1208 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1209 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1210 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1211 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1212 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1213 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1214 55, 56
1215 };
1216 const unsigned user_token_number_max_ = 311;
1217 const token_number_type undef_token_ = 2;
1218
1219 if (static_cast<int> (t) <= yyeof_)
1220 return yyeof_;
1221 else if (static_cast<unsigned> (t) <= user_token_number_max_)
1222 return translate_table[t];
1223 else
1224 return undef_token_;
1225 }
1226
1227 inline
1229 : std::runtime_error (m)
1230 , location (l)
1231 {}
1232
1233 // basic_symbol.
1234 template <typename Base>
1236 : value ()
1237 , location ()
1238 {}
1239
1240 template <typename Base>
1242 : Base (YY_MOVE (other))
1243 , value ()
1244 , location (YY_MOVE (other.location))
1245 {
1246 switch (other.type_get ())
1247 {
1248 case 68: // value
1249 case 72: // map_value
1250 case 96: // ncr_protocol_value
1251 value.YY_MOVE_OR_COPY< ElementPtr > (YY_MOVE (other.value));
1252 break;
1253
1254 case 56: // "boolean"
1255 value.YY_MOVE_OR_COPY< bool > (YY_MOVE (other.value));
1256 break;
1257
1258 case 55: // "floating point"
1259 value.YY_MOVE_OR_COPY< double > (YY_MOVE (other.value));
1260 break;
1261
1262 case 54: // "integer"
1263 value.YY_MOVE_OR_COPY< int64_t > (YY_MOVE (other.value));
1264 break;
1265
1266 case 53: // "constant string"
1267 value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (other.value));
1268 break;
1269
1270 default:
1271 break;
1272 }
1273
1274 }
1275
1276
1277 // Implementation of basic_symbol constructor for each type.
1278# if 201103L <= YY_CPLUSPLUS
1279 template <typename Base>
1280 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, location_type&& l)
1281 : Base (t)
1282 , location (std::move (l))
1283 {}
1284#else
1285 template <typename Base>
1286 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
1287 : Base (t)
1288 , location (l)
1289 {}
1290#endif
1291# if 201103L <= YY_CPLUSPLUS
1292 template <typename Base>
1293 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, ElementPtr&& v, location_type&& l)
1294 : Base (t)
1295 , value (std::move (v))
1296 , location (std::move (l))
1297 {}
1298#else
1299 template <typename Base>
1300 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const ElementPtr& v, const location_type& l)
1301 : Base (t)
1302 , value (v)
1303 , location (l)
1304 {}
1305#endif
1306# if 201103L <= YY_CPLUSPLUS
1307 template <typename Base>
1308 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, bool&& v, location_type&& l)
1309 : Base (t)
1310 , value (std::move (v))
1311 , location (std::move (l))
1312 {}
1313#else
1314 template <typename Base>
1315 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l)
1316 : Base (t)
1317 , value (v)
1318 , location (l)
1319 {}
1320#endif
1321# if 201103L <= YY_CPLUSPLUS
1322 template <typename Base>
1323 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, double&& v, location_type&& l)
1324 : Base (t)
1325 , value (std::move (v))
1326 , location (std::move (l))
1327 {}
1328#else
1329 template <typename Base>
1330 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const double& v, const location_type& l)
1331 : Base (t)
1332 , value (v)
1333 , location (l)
1334 {}
1335#endif
1336# if 201103L <= YY_CPLUSPLUS
1337 template <typename Base>
1338 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, int64_t&& v, location_type&& l)
1339 : Base (t)
1340 , value (std::move (v))
1341 , location (std::move (l))
1342 {}
1343#else
1344 template <typename Base>
1345 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int64_t& v, const location_type& l)
1346 : Base (t)
1347 , value (v)
1348 , location (l)
1349 {}
1350#endif
1351# if 201103L <= YY_CPLUSPLUS
1352 template <typename Base>
1353 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l)
1354 : Base (t)
1355 , value (std::move (v))
1356 , location (std::move (l))
1357 {}
1358#else
1359 template <typename Base>
1360 D2Parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l)
1361 : Base (t)
1362 , value (v)
1363 , location (l)
1364 {}
1365#endif
1366
1367
1368 template <typename Base>
1370 {
1371 clear ();
1372 }
1373
1374 template <typename Base>
1375 void
1377 {
1378 // User destructor.
1379 symbol_number_type yytype = this->type_get ();
1380 basic_symbol<Base>& yysym = *this;
1381 (void) yysym;
1382 switch (yytype)
1383 {
1384 default:
1385 break;
1386 }
1387
1388 // Type destructor.
1389 switch (yytype)
1390 {
1391 case 68: // value
1392 case 72: // map_value
1393 case 96: // ncr_protocol_value
1394 value.template destroy< ElementPtr > ();
1395 break;
1396
1397 case 56: // "boolean"
1398 value.template destroy< bool > ();
1399 break;
1400
1401 case 55: // "floating point"
1402 value.template destroy< double > ();
1403 break;
1404
1405 case 54: // "integer"
1406 value.template destroy< int64_t > ();
1407 break;
1408
1409 case 53: // "constant string"
1410 value.template destroy< std::string > ();
1411 break;
1412
1413 default:
1414 break;
1415 }
1416
1417 Base::clear ();
1418 }
1419
1420 template <typename Base>
1421 bool
1423 {
1424 return Base::type_get () == empty_symbol;
1425 }
1426
1427 template <typename Base>
1428 void
1430 {
1431 super_type::move (s);
1432 switch (this->type_get ())
1433 {
1434 case 68: // value
1435 case 72: // map_value
1436 case 96: // ncr_protocol_value
1437 value.move< ElementPtr > (YY_MOVE (s.value));
1438 break;
1439
1440 case 56: // "boolean"
1441 value.move< bool > (YY_MOVE (s.value));
1442 break;
1443
1444 case 55: // "floating point"
1445 value.move< double > (YY_MOVE (s.value));
1446 break;
1447
1448 case 54: // "integer"
1449 value.move< int64_t > (YY_MOVE (s.value));
1450 break;
1451
1452 case 53: // "constant string"
1453 value.move< std::string > (YY_MOVE (s.value));
1454 break;
1455
1456 default:
1457 break;
1458 }
1459
1460 location = YY_MOVE (s.location);
1461 }
1462
1463 // by_type.
1464 inline
1466 : type (empty_symbol)
1467 {}
1468
1469 inline
1471 : type (other.type)
1472 {}
1473
1474 inline
1476 : type (yytranslate_ (t))
1477 {}
1478
1479 inline
1480 void
1482 {
1483 type = empty_symbol;
1484 }
1485
1486 inline
1487 void
1489 {
1490 type = that.type;
1491 that.clear ();
1492 }
1493
1494 inline
1495 int
1497 {
1498 return type;
1499 }
1500
1501 inline
1504 {
1505 // YYTOKNUM[NUM] -- (External) token number corresponding to the
1506 // (internal) symbol number NUM (which must be that of a token). */
1507 static
1508 const unsigned short
1509 yytoken_number_[] =
1510 {
1511 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1512 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1513 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1514 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1515 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1516 305, 306, 307, 308, 309, 310, 311
1517 };
1518 return static_cast<token_type> (yytoken_number_[type]);
1519 }
1520
1521 // Implementation of make_symbol for each symbol type.
1522 inline
1525 {
1526 return symbol_type (token::TOKEN_END, YY_MOVE (l));
1527 }
1528
1529 inline
1532 {
1534 }
1535
1536 inline
1539 {
1541 }
1542
1543 inline
1546 {
1548 }
1549
1550 inline
1553 {
1555 }
1556
1557 inline
1560 {
1562 }
1563
1564 inline
1567 {
1569 }
1570
1571 inline
1574 {
1576 }
1577
1578 inline
1581 {
1583 }
1584
1585 inline
1588 {
1590 }
1591
1592 inline
1595 {
1597 }
1598
1599 inline
1602 {
1604 }
1605
1606 inline
1609 {
1611 }
1612
1613 inline
1616 {
1618 }
1619
1620 inline
1623 {
1625 }
1626
1627 inline
1630 {
1632 }
1633
1634 inline
1637 {
1638 return symbol_type (token::TOKEN_UDP, YY_MOVE (l));
1639 }
1640
1641 inline
1644 {
1645 return symbol_type (token::TOKEN_TCP, YY_MOVE (l));
1646 }
1647
1648 inline
1651 {
1653 }
1654
1655 inline
1658 {
1660 }
1661
1662 inline
1665 {
1667 }
1668
1669 inline
1672 {
1674 }
1675
1676 inline
1679 {
1681 }
1682
1683 inline
1686 {
1688 }
1689
1690 inline
1693 {
1695 }
1696
1697 inline
1700 {
1702 }
1703
1704 inline
1707 {
1709 }
1710
1711 inline
1714 {
1716 }
1717
1718 inline
1721 {
1723 }
1724
1725 inline
1728 {
1730 }
1731
1732 inline
1735 {
1737 }
1738
1739 inline
1742 {
1744 }
1745
1746 inline
1749 {
1751 }
1752
1753 inline
1756 {
1758 }
1759
1760 inline
1763 {
1765 }
1766
1767 inline
1770 {
1772 }
1773
1774 inline
1777 {
1779 }
1780
1781 inline
1784 {
1786 }
1787
1788 inline
1791 {
1793 }
1794
1795 inline
1798 {
1800 }
1801
1802 inline
1805 {
1807 }
1808
1809 inline
1812 {
1814 }
1815
1816 inline
1819 {
1821 }
1822
1823 inline
1826 {
1828 }
1829
1830 inline
1833 {
1835 }
1836
1837 inline
1840 {
1842 }
1843
1844 inline
1847 {
1849 }
1850
1851 inline
1854 {
1856 }
1857
1858 inline
1861 {
1863 }
1864
1865 inline
1868 {
1870 }
1871
1872 inline
1875 {
1877 }
1878
1879 inline
1882 {
1884 }
1885
1886 inline
1889 {
1891 }
1892
1893 inline
1896 {
1897 return symbol_type (token::TOKEN_FLOAT, YY_MOVE (v), YY_MOVE (l));
1898 }
1899
1900 inline
1903 {
1905 }
1906
1907
1908#line 14 "d2_parser.yy" // lalr1.cc:404
1909} } // isc::d2
1910#line 1911 "d2_parser.h" // lalr1.cc:404
1911
1912
1913
1914
1915#endif // !YY_D2_PARSER_D2_PARSER_H_INCLUDED
#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
Evaluation context, an interface to the expression evaluation.
A Bison parser.
Definition: d2_parser.h:496
static symbol_type make_DHCP6(YY_COPY(location_type) l)
Definition: d2_parser.h:1580
static symbol_type make_SUB_DHCPDDNS(YY_COPY(location_type) l)
Definition: d2_parser.h:1832
static symbol_type make_FLUSH(YY_COPY(location_type) l)
Definition: d2_parser.h:1797
static symbol_type make_SUB_DDNS_DOMAIN(YY_COPY(location_type) l)
Definition: d2_parser.h:1853
virtual ~D2Parser()
Definition: d2_parser.cc:195
static symbol_type make_NULL_TYPE(YY_COPY(location_type) l)
Definition: d2_parser.h:1573
static symbol_type make_UDP(YY_COPY(location_type) l)
Definition: d2_parser.h:1636
static symbol_type make_LCURLY_BRACKET(YY_COPY(location_type) l)
Definition: d2_parser.h:1559
static symbol_type make_RSQUARE_BRACKET(YY_COPY(location_type) l)
Definition: d2_parser.h:1552
static symbol_type make_LSQUARE_BRACKET(YY_COPY(location_type) l)
Definition: d2_parser.h:1545
static symbol_type make_DDNS_DOMAINS(YY_COPY(location_type) l)
Definition: d2_parser.h:1692
static symbol_type make_HOSTNAME(YY_COPY(location_type) l)
Definition: d2_parser.h:1713
static symbol_type make_CONTROL_AGENT(YY_COPY(location_type) l)
Definition: d2_parser.h:1594
static symbol_type make_DHCPDDNS(YY_COPY(location_type) l)
Definition: d2_parser.h:1601
static symbol_type make_PORT(YY_COPY(location_type) l)
Definition: d2_parser.h:1615
location location_type
Symbol locations.
Definition: d2_parser.h:526
static symbol_type make_TOPLEVEL_DHCPDDNS(YY_COPY(location_type) l)
Definition: d2_parser.h:1825
static symbol_type make_IP_ADDRESS(YY_COPY(location_type) l)
Definition: d2_parser.h:1608
static symbol_type make_TSIG_KEYS(YY_COPY(location_type) l)
Definition: d2_parser.h:1720
int symbol_number_type
Symbol type: an internal symbol number.
Definition: d2_parser.h:602
static symbol_type make_OUTPUT(YY_COPY(location_type) l)
Definition: d2_parser.h:1776
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: d2_parser.h:608
static symbol_type make_COMMENT(YY_COPY(location_type) l)
Definition: d2_parser.h:1671
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: d2_parser.h:722
static symbol_type make_USER_CONTEXT(YY_COPY(location_type) l)
Definition: d2_parser.h:1664
static symbol_type make_FORWARD_DDNS(YY_COPY(location_type) l)
Definition: d2_parser.h:1678
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: d2_parser.h:521
static symbol_type make_DHCP4(YY_COPY(location_type) l)
Definition: d2_parser.h:1587
static symbol_type make_BOOLEAN(YY_COPY(bool) v, YY_COPY(location_type) l)
Definition: d2_parser.h:1902
static symbol_type make_DNS_SERVER_TIMEOUT(YY_COPY(location_type) l)
Definition: d2_parser.h:1622
static symbol_type make_LOGGERS(YY_COPY(location_type) l)
Definition: d2_parser.h:1755
static symbol_type make_SECRET(YY_COPY(location_type) l)
Definition: d2_parser.h:1741
static symbol_type make_SUB_DNS_SERVER(YY_COPY(location_type) l)
Definition: d2_parser.h:1867
static symbol_type make_COLON(YY_COPY(location_type) l)
Definition: d2_parser.h:1538
static symbol_type make_COMMA(YY_COPY(location_type) l)
Definition: d2_parser.h:1531
static symbol_type make_ALGORITHM(YY_COPY(location_type) l)
Definition: d2_parser.h:1727
static symbol_type make_NCR_PROTOCOL(YY_COPY(location_type) l)
Definition: d2_parser.h:1629
static symbol_type make_JSON(YY_COPY(location_type) l)
Definition: d2_parser.h:1657
static symbol_type make_DEBUGLEVEL(YY_COPY(location_type) l)
Definition: d2_parser.h:1783
static symbol_type make_SUB_TSIG_KEY(YY_COPY(location_type) l)
Definition: d2_parser.h:1839
static symbol_type make_SUB_TSIG_KEYS(YY_COPY(location_type) l)
Definition: d2_parser.h:1846
static symbol_type make_LOGGING(YY_COPY(location_type) l)
Definition: d2_parser.h:1748
virtual int parse()
Parse.
Definition: d2_parser.cc:519
static symbol_type make_DNS_SERVERS(YY_COPY(location_type) l)
Definition: d2_parser.h:1706
static symbol_type make_KEY_NAME(YY_COPY(location_type) l)
Definition: d2_parser.h:1699
static symbol_type make_MAXSIZE(YY_COPY(location_type) l)
Definition: d2_parser.h:1804
static symbol_type make_RCURLY_BRACKET(YY_COPY(location_type) l)
Definition: d2_parser.h:1566
static symbol_type make_SUB_DNS_SERVERS(YY_COPY(location_type) l)
Definition: d2_parser.h:1874
static symbol_type make_NCR_FORMAT(YY_COPY(location_type) l)
Definition: d2_parser.h:1650
static symbol_type make_INTEGER(YY_COPY(int64_t) v, YY_COPY(location_type) l)
Definition: d2_parser.h:1888
static symbol_type make_MAXVER(YY_COPY(location_type) l)
Definition: d2_parser.h:1811
static symbol_type make_NAME(YY_COPY(location_type) l)
Definition: d2_parser.h:1762
static symbol_type make_DIGEST_BITS(YY_COPY(location_type) l)
Definition: d2_parser.h:1734
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: d2_parser.h:599
static symbol_type make_END(YY_COPY(location_type) l)
Definition: d2_parser.h:1524
static symbol_type make_SEVERITY(YY_COPY(location_type) l)
Definition: d2_parser.h:1790
static symbol_type make_OUTPUT_OPTIONS(YY_COPY(location_type) l)
Definition: d2_parser.h:1769
static symbol_type make_SUB_DDNS_DOMAINS(YY_COPY(location_type) l)
Definition: d2_parser.h:1860
static symbol_type make_TOPLEVEL_JSON(YY_COPY(location_type) l)
Definition: d2_parser.h:1818
static symbol_type make_TCP(YY_COPY(location_type) l)
Definition: d2_parser.h:1643
static symbol_type make_REVERSE_DDNS(YY_COPY(location_type) l)
Definition: d2_parser.h:1685
int operator()()
Parse.
Definition: d2_parser.cc:513
static symbol_type make_FLOAT(YY_COPY(double) v, YY_COPY(location_type) l)
Definition: d2_parser.h:1895
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: d2_parser.cc:2423
static symbol_type make_STRING(YY_COPY(std::string) v, YY_COPY(location_type) l)
Definition: d2_parser.h:1881
Present a slice of the top of a stack.
Definition: d2_parser.h:270
const T & operator[](int i) const
Definition: d2_parser.h:278
slice(const S &stack, int range)
Definition: d2_parser.h:272
A stack with random access from its top.
Definition: d2_parser.h:172
T & operator[](size_type i)
Random access.
Definition: d2_parser.h:187
S::const_reverse_iterator const_iterator
Definition: d2_parser.h:176
size_type size() const
Definition: d2_parser.h:243
void push(YY_MOVE_REF(T) t)
Steal the contents of t.
Definition: d2_parser.h:223
S::size_type size_type
Definition: d2_parser.h:177
const_iterator begin() const
Definition: d2_parser.h:249
stack(size_type n=200)
Definition: d2_parser.h:179
void pop(int n=1)
Definition: d2_parser.h:230
S::reverse_iterator iterator
Definition: d2_parser.h:175
const_iterator end() const
Definition: d2_parser.h:255
void clear()
Definition: d2_parser.h:237
Forward declaration of the ParserContext class.
A collection of classes for housing and parsing the application configuration necessary for the DHCP-...
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: d2_parser.h:675
void clear()
Destroy contents, and record that is empty.
Definition: d2_parser.h:1376
bool empty() const
Whether empty.
Definition: d2_parser.h:1422
Base super_type
Alias to Base.
Definition: d2_parser.h:620
basic_symbol()
Default constructor.
Definition: d2_parser.h:1235
location_type location
The location.
Definition: d2_parser.h:678
~basic_symbol()
Destroy the symbol.
Definition: d2_parser.h:1369
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: d2_parser.h:1429
Type access provider for token (enum) based symbols.
Definition: d2_parser.h:689
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
Definition: d2_parser.h:1496
void move(by_type &that)
Steal the symbol type from that.
Definition: d2_parser.h:1488
token_type kind_type
The symbol type as needed by the constructor.
Definition: d2_parser.h:697
void clear()
Record that this symbol is empty.
Definition: d2_parser.h:1481
by_type()
Default constructor.
Definition: d2_parser.h:1465
int type
The symbol type.
Definition: d2_parser.h:718
token_type token() const
The token.
Definition: d2_parser.h:1503
Syntax errors thrown from user actions.
Definition: d2_parser.h:530
syntax_error(const location_type &l, const std::string &m)
Definition: d2_parser.h:1228
A char[S] buffer to store and retrieve objects.
Definition: d2_parser.h:297
void swap(self_type &other)
Swap the content with other, of same type.
Definition: d2_parser.h:407
~variant()
Destruction, allowed only if empty.
Definition: d2_parser.h:317
T & as()
Accessor to a built T.
Definition: d2_parser.h:378
const T & as() const
Const accessor to a built T (for printer).
Definition: d2_parser.h:389
T & build()
Instantiate an empty T in here.
Definition: d2_parser.h:361
void move(self_type &other)
Move the content of other to this.
Definition: d2_parser.h:419
char yyraw[S]
A buffer large enough to store any of the semantic values.
Definition: d2_parser.h:486
T & emplace(const T &t)
Instantiate a T in here from t.
Definition: d2_parser.h:348
T & emplace()
Instantiate an empty T in here.
Definition: d2_parser.h:325
variant(YY_RVREF(T) t)
Construct and fill.
Definition: d2_parser.h:309
long double yyalign_me
Strongest alignment constraints.
Definition: d2_parser.h:484
void destroy()
Destroy the stored T.
Definition: d2_parser.h:452
void copy(const self_type &other)
Copy the content of other to this.
Definition: d2_parser.h:444
T & build(const T &t)
Instantiate a T in here from t.
Definition: d2_parser.h:370
variant()
Empty construction.
Definition: d2_parser.h:302
variant< S > self_type
Type of *this.
Definition: d2_parser.h:299
An auxiliary type to compute the largest semantic type.
Definition: d2_parser.h:501
char dummy1[sizeof(ElementPtr)]
Definition: d2_parser.h:505
char dummy4[sizeof(int64_t)]
Definition: d2_parser.h:514
char dummy5[sizeof(std::string)]
Definition: d2_parser.h:517
char dummy3[sizeof(double)]
Definition: d2_parser.h:511
char dummy2[sizeof(bool)]
Definition: d2_parser.h:508