Kea  1.9.9-git
d2_parser.cc
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.7.6.
2 
3 // Skeleton implementation for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2015, 2018-2021 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 <https://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 // DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
34 // especially those whose name start with YY_ or yy_. They are
35 // private implementation details that can be changed or removed.
36 
37 
38 // Take the name prefix into account.
39 #define yylex d2_parser_lex
40 
41 
42 
43 #include "d2_parser.h"
44 
45 
46 // Unqualified %code blocks.
47 #line 34 "d2_parser.yy"
48 
49 #include <d2/parser_context.h>
50 
51 #line 52 "d2_parser.cc"
52 
53 
54 #ifndef YY_
55 # if defined YYENABLE_NLS && YYENABLE_NLS
56 # if ENABLE_NLS
57 # include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
58 # define YY_(msgid) dgettext ("bison-runtime", msgid)
59 # endif
60 # endif
61 # ifndef YY_
62 # define YY_(msgid) msgid
63 # endif
64 #endif
65 
66 
67 // Whether we are compiled with exception support.
68 #ifndef YY_EXCEPTIONS
69 # if defined __GNUC__ && !defined __EXCEPTIONS
70 # define YY_EXCEPTIONS 0
71 # else
72 # define YY_EXCEPTIONS 1
73 # endif
74 #endif
75 
76 #define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
77 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
78  If N is 0, then set CURRENT to the empty location which ends
79  the previous symbol: RHS[0] (always defined). */
80 
81 # ifndef YYLLOC_DEFAULT
82 # define YYLLOC_DEFAULT(Current, Rhs, N) \
83  do \
84  if (N) \
85  { \
86  (Current).begin = YYRHSLOC (Rhs, 1).begin; \
87  (Current).end = YYRHSLOC (Rhs, N).end; \
88  } \
89  else \
90  { \
91  (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
92  } \
93  while (false)
94 # endif
95 
96 
97 // Enable debugging if requested.
98 #if D2_PARSER_DEBUG
99 
100 // A pseudo ostream that takes yydebug_ into account.
101 # define YYCDEBUG if (yydebug_) (*yycdebug_)
102 
103 # define YY_SYMBOL_PRINT(Title, Symbol) \
104  do { \
105  if (yydebug_) \
106  { \
107  *yycdebug_ << Title << ' '; \
108  yy_print_ (*yycdebug_, Symbol); \
109  *yycdebug_ << '\n'; \
110  } \
111  } while (false)
112 
113 # define YY_REDUCE_PRINT(Rule) \
114  do { \
115  if (yydebug_) \
116  yy_reduce_print_ (Rule); \
117  } while (false)
118 
119 # define YY_STACK_PRINT() \
120  do { \
121  if (yydebug_) \
122  yy_stack_print_ (); \
123  } while (false)
124 
125 #else // !D2_PARSER_DEBUG
126 
127 # define YYCDEBUG if (false) std::cerr
128 # define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol)
129 # define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
130 # define YY_STACK_PRINT() static_cast<void> (0)
131 
132 #endif // !D2_PARSER_DEBUG
133 
134 #define yyerrok (yyerrstatus_ = 0)
135 #define yyclearin (yyla.clear ())
136 
137 #define YYACCEPT goto yyacceptlab
138 #define YYABORT goto yyabortlab
139 #define YYERROR goto yyerrorlab
140 #define YYRECOVERING() (!!yyerrstatus_)
141 
142 #line 14 "d2_parser.yy"
143 namespace isc { namespace d2 {
144 #line 145 "d2_parser.cc"
145 
148 #if D2_PARSER_DEBUG
149  : yydebug_ (false),
150  yycdebug_ (&std::cerr),
151 #else
152  :
153 #endif
154  ctx (ctx_yyarg)
155  {}
156 
158  {}
159 
161  {}
162 
163  /*---------------.
164  | symbol kinds. |
165  `---------------*/
166 
167 
168 
169  // by_state.
170  D2Parser::by_state::by_state () YY_NOEXCEPT
171  : state (empty_state)
172  {}
173 
174  D2Parser::by_state::by_state (const by_state& that) YY_NOEXCEPT
175  : state (that.state)
176  {}
177 
178  void
179  D2Parser::by_state::clear () YY_NOEXCEPT
180  {
181  state = empty_state;
182  }
183 
184  void
185  D2Parser::by_state::move (by_state& that)
186  {
187  state = that.state;
188  that.clear ();
189  }
190 
191  D2Parser::by_state::by_state (state_type s) YY_NOEXCEPT
192  : state (s)
193  {}
194 
196  D2Parser::by_state::kind () const YY_NOEXCEPT
197  {
198  if (state == empty_state)
199  return symbol_kind::S_YYEMPTY;
200  else
201  return YY_CAST (symbol_kind_type, yystos_[+state]);
202  }
203 
204  D2Parser::stack_symbol_type::stack_symbol_type ()
205  {}
206 
207  D2Parser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
208  : super_type (YY_MOVE (that.state), YY_MOVE (that.location))
209  {
210  switch (that.kind ())
211  {
212  case symbol_kind::S_value: // value
213  case symbol_kind::S_map_value: // map_value
214  case symbol_kind::S_ncr_protocol_value: // ncr_protocol_value
215  value.YY_MOVE_OR_COPY< ElementPtr > (YY_MOVE (that.value));
216  break;
217 
218  case symbol_kind::S_BOOLEAN: // "boolean"
219  value.YY_MOVE_OR_COPY< bool > (YY_MOVE (that.value));
220  break;
221 
222  case symbol_kind::S_FLOAT: // "floating point"
223  value.YY_MOVE_OR_COPY< double > (YY_MOVE (that.value));
224  break;
225 
226  case symbol_kind::S_INTEGER: // "integer"
227  value.YY_MOVE_OR_COPY< int64_t > (YY_MOVE (that.value));
228  break;
229 
230  case symbol_kind::S_STRING: // "constant string"
231  value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value));
232  break;
233 
234  default:
235  break;
236  }
237 
238 #if 201103L <= YY_CPLUSPLUS
239  // that is emptied.
240  that.state = empty_state;
241 #endif
242  }
243 
244  D2Parser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
245  : super_type (s, YY_MOVE (that.location))
246  {
247  switch (that.kind ())
248  {
249  case symbol_kind::S_value: // value
250  case symbol_kind::S_map_value: // map_value
251  case symbol_kind::S_ncr_protocol_value: // ncr_protocol_value
252  value.move< ElementPtr > (YY_MOVE (that.value));
253  break;
254 
255  case symbol_kind::S_BOOLEAN: // "boolean"
256  value.move< bool > (YY_MOVE (that.value));
257  break;
258 
259  case symbol_kind::S_FLOAT: // "floating point"
260  value.move< double > (YY_MOVE (that.value));
261  break;
262 
263  case symbol_kind::S_INTEGER: // "integer"
264  value.move< int64_t > (YY_MOVE (that.value));
265  break;
266 
267  case symbol_kind::S_STRING: // "constant string"
268  value.move< std::string > (YY_MOVE (that.value));
269  break;
270 
271  default:
272  break;
273  }
274 
275  // that is emptied.
276  that.kind_ = symbol_kind::S_YYEMPTY;
277  }
278 
279 #if YY_CPLUSPLUS < 201103L
280  D2Parser::stack_symbol_type&
281  D2Parser::stack_symbol_type::operator= (const stack_symbol_type& that)
282  {
283  state = that.state;
284  switch (that.kind ())
285  {
286  case symbol_kind::S_value: // value
287  case symbol_kind::S_map_value: // map_value
288  case symbol_kind::S_ncr_protocol_value: // ncr_protocol_value
289  value.copy< ElementPtr > (that.value);
290  break;
291 
292  case symbol_kind::S_BOOLEAN: // "boolean"
293  value.copy< bool > (that.value);
294  break;
295 
296  case symbol_kind::S_FLOAT: // "floating point"
297  value.copy< double > (that.value);
298  break;
299 
300  case symbol_kind::S_INTEGER: // "integer"
301  value.copy< int64_t > (that.value);
302  break;
303 
304  case symbol_kind::S_STRING: // "constant string"
305  value.copy< std::string > (that.value);
306  break;
307 
308  default:
309  break;
310  }
311 
312  location = that.location;
313  return *this;
314  }
315 
316  D2Parser::stack_symbol_type&
317  D2Parser::stack_symbol_type::operator= (stack_symbol_type& that)
318  {
319  state = that.state;
320  switch (that.kind ())
321  {
322  case symbol_kind::S_value: // value
323  case symbol_kind::S_map_value: // map_value
324  case symbol_kind::S_ncr_protocol_value: // ncr_protocol_value
325  value.move< ElementPtr > (that.value);
326  break;
327 
328  case symbol_kind::S_BOOLEAN: // "boolean"
329  value.move< bool > (that.value);
330  break;
331 
332  case symbol_kind::S_FLOAT: // "floating point"
333  value.move< double > (that.value);
334  break;
335 
336  case symbol_kind::S_INTEGER: // "integer"
337  value.move< int64_t > (that.value);
338  break;
339 
340  case symbol_kind::S_STRING: // "constant string"
341  value.move< std::string > (that.value);
342  break;
343 
344  default:
345  break;
346  }
347 
348  location = that.location;
349  // that is emptied.
350  that.state = empty_state;
351  return *this;
352  }
353 #endif
354 
355  template <typename Base>
356  void
357  D2Parser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
358  {
359  if (yymsg)
360  YY_SYMBOL_PRINT (yymsg, yysym);
361  }
362 
363 #if D2_PARSER_DEBUG
364  template <typename Base>
365  void
366  D2Parser::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
367  {
368  std::ostream& yyoutput = yyo;
369  YY_USE (yyoutput);
370  if (yysym.empty ())
371  yyo << "empty symbol";
372  else
373  {
374  symbol_kind_type yykind = yysym.kind ();
375  yyo << (yykind < YYNTOKENS ? "token" : "nterm")
376  << ' ' << yysym.name () << " ("
377  << yysym.location << ": ";
378  switch (yykind)
379  {
380  case symbol_kind::S_STRING: // "constant string"
381 #line 116 "d2_parser.yy"
382  { yyoutput << yysym.value.template as < std::string > (); }
383 #line 384 "d2_parser.cc"
384  break;
385 
386  case symbol_kind::S_INTEGER: // "integer"
387 #line 116 "d2_parser.yy"
388  { yyoutput << yysym.value.template as < int64_t > (); }
389 #line 390 "d2_parser.cc"
390  break;
391 
392  case symbol_kind::S_FLOAT: // "floating point"
393 #line 116 "d2_parser.yy"
394  { yyoutput << yysym.value.template as < double > (); }
395 #line 396 "d2_parser.cc"
396  break;
397 
398  case symbol_kind::S_BOOLEAN: // "boolean"
399 #line 116 "d2_parser.yy"
400  { yyoutput << yysym.value.template as < bool > (); }
401 #line 402 "d2_parser.cc"
402  break;
403 
404  case symbol_kind::S_value: // value
405 #line 116 "d2_parser.yy"
406  { yyoutput << yysym.value.template as < ElementPtr > (); }
407 #line 408 "d2_parser.cc"
408  break;
409 
410  case symbol_kind::S_map_value: // map_value
411 #line 116 "d2_parser.yy"
412  { yyoutput << yysym.value.template as < ElementPtr > (); }
413 #line 414 "d2_parser.cc"
414  break;
415 
416  case symbol_kind::S_ncr_protocol_value: // ncr_protocol_value
417 #line 116 "d2_parser.yy"
418  { yyoutput << yysym.value.template as < ElementPtr > (); }
419 #line 420 "d2_parser.cc"
420  break;
421 
422  default:
423  break;
424  }
425  yyo << ')';
426  }
427  }
428 #endif
429 
430  void
431  D2Parser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
432  {
433  if (m)
434  YY_SYMBOL_PRINT (m, sym);
435  yystack_.push (YY_MOVE (sym));
436  }
437 
438  void
439  D2Parser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
440  {
441 #if 201103L <= YY_CPLUSPLUS
442  yypush_ (m, stack_symbol_type (s, std::move (sym)));
443 #else
444  stack_symbol_type ss (s, sym);
445  yypush_ (m, ss);
446 #endif
447  }
448 
449  void
450  D2Parser::yypop_ (int n)
451  {
452  yystack_.pop (n);
453  }
454 
455 #if D2_PARSER_DEBUG
456  std::ostream&
458  {
459  return *yycdebug_;
460  }
461 
462  void
463  D2Parser::set_debug_stream (std::ostream& o)
464  {
465  yycdebug_ = &o;
466  }
467 
468 
471  {
472  return yydebug_;
473  }
474 
475  void
477  {
478  yydebug_ = l;
479  }
480 #endif // D2_PARSER_DEBUG
481 
482  D2Parser::state_type
483  D2Parser::yy_lr_goto_state_ (state_type yystate, int yysym)
484  {
485  int yyr = yypgoto_[yysym - YYNTOKENS] + yystate;
486  if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
487  return yytable_[yyr];
488  else
489  return yydefgoto_[yysym - YYNTOKENS];
490  }
491 
492  bool
493  D2Parser::yy_pact_value_is_default_ (int yyvalue)
494  {
495  return yyvalue == yypact_ninf_;
496  }
497 
498  bool
499  D2Parser::yy_table_value_is_error_ (int yyvalue)
500  {
501  return yyvalue == yytable_ninf_;
502  }
503 
504  int
506  {
507  return parse ();
508  }
509 
510  int
512  {
513  int yyn;
515  int yylen = 0;
516 
517  // Error handling.
518  int yynerrs_ = 0;
519  int yyerrstatus_ = 0;
520 
522  symbol_type yyla;
523 
525  stack_symbol_type yyerror_range[3];
526 
528  int yyresult;
529 
530 #if YY_EXCEPTIONS
531  try
532 #endif // YY_EXCEPTIONS
533  {
534  YYCDEBUG << "Starting parse\n";
535 
536 
537  /* Initialize the stack. The initial state will be set in
538  yynewstate, since the latter expects the semantical and the
539  location values to have been already stored, initialize these
540  stacks with a primary value. */
541  yystack_.clear ();
542  yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
543 
544  /*-----------------------------------------------.
545  | yynewstate -- push a new symbol on the stack. |
546  `-----------------------------------------------*/
547  yynewstate:
548  YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
549  YY_STACK_PRINT ();
550 
551  // Accept?
552  if (yystack_[0].state == yyfinal_)
553  YYACCEPT;
554 
555  goto yybackup;
556 
557 
558  /*-----------.
559  | yybackup. |
560  `-----------*/
561  yybackup:
562  // Try to take a decision without lookahead.
563  yyn = yypact_[+yystack_[0].state];
564  if (yy_pact_value_is_default_ (yyn))
565  goto yydefault;
566 
567  // Read a lookahead token.
568  if (yyla.empty ())
569  {
570  YYCDEBUG << "Reading a token\n";
571 #if YY_EXCEPTIONS
572  try
573 #endif // YY_EXCEPTIONS
574  {
575  symbol_type yylookahead (yylex (ctx));
576  yyla.move (yylookahead);
577  }
578 #if YY_EXCEPTIONS
579  catch (const syntax_error& yyexc)
580  {
581  YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
582  error (yyexc);
583  goto yyerrlab1;
584  }
585 #endif // YY_EXCEPTIONS
586  }
587  YY_SYMBOL_PRINT ("Next token is", yyla);
588 
589  if (yyla.kind () == symbol_kind::S_YYerror)
590  {
591  // The scanner already issued an error message, process directly
592  // to error recovery. But do not keep the error token as
593  // lookahead, it is too special and may lead us to an endless
594  // loop in error recovery. */
596  goto yyerrlab1;
597  }
598 
599  /* If the proper action on seeing token YYLA.TYPE is to reduce or
600  to detect an error, take that action. */
601  yyn += yyla.kind ();
602  if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
603  {
604  goto yydefault;
605  }
606 
607  // Reduce or error.
608  yyn = yytable_[yyn];
609  if (yyn <= 0)
610  {
611  if (yy_table_value_is_error_ (yyn))
612  goto yyerrlab;
613  yyn = -yyn;
614  goto yyreduce;
615  }
616 
617  // Count tokens shifted since error; after three, turn off error status.
618  if (yyerrstatus_)
619  --yyerrstatus_;
620 
621  // Shift the lookahead token.
622  yypush_ ("Shifting", state_type (yyn), YY_MOVE (yyla));
623  goto yynewstate;
624 
625 
626  /*-----------------------------------------------------------.
627  | yydefault -- do the default action for the current state. |
628  `-----------------------------------------------------------*/
629  yydefault:
630  yyn = yydefact_[+yystack_[0].state];
631  if (yyn == 0)
632  goto yyerrlab;
633  goto yyreduce;
634 
635 
636  /*-----------------------------.
637  | yyreduce -- do a reduction. |
638  `-----------------------------*/
639  yyreduce:
640  yylen = yyr2_[yyn];
641  {
642  stack_symbol_type yylhs;
643  yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);
644  /* Variants are always initialized to an empty instance of the
645  correct type. The default '$$ = $1' action is NOT applied
646  when using variants. */
647  switch (yyr1_[yyn])
648  {
649  case symbol_kind::S_value: // value
650  case symbol_kind::S_map_value: // map_value
651  case symbol_kind::S_ncr_protocol_value: // ncr_protocol_value
652  yylhs.value.emplace< ElementPtr > ();
653  break;
654 
655  case symbol_kind::S_BOOLEAN: // "boolean"
656  yylhs.value.emplace< bool > ();
657  break;
658 
659  case symbol_kind::S_FLOAT: // "floating point"
660  yylhs.value.emplace< double > ();
661  break;
662 
663  case symbol_kind::S_INTEGER: // "integer"
664  yylhs.value.emplace< int64_t > ();
665  break;
666 
667  case symbol_kind::S_STRING: // "constant string"
668  yylhs.value.emplace< std::string > ();
669  break;
670 
671  default:
672  break;
673  }
674 
675 
676  // Default location.
677  {
678  stack_type::slice range (yystack_, yylen);
679  YYLLOC_DEFAULT (yylhs.location, range, yylen);
680  yyerror_range[1].location = yylhs.location;
681  }
682 
683  // Perform the reduction.
684  YY_REDUCE_PRINT (yyn);
685 #if YY_EXCEPTIONS
686  try
687 #endif // YY_EXCEPTIONS
688  {
689  switch (yyn)
690  {
691  case 2: // $@1: %empty
692 #line 125 "d2_parser.yy"
693  { ctx.ctx_ = ctx.NO_KEYWORD; }
694 #line 695 "d2_parser.cc"
695  break;
696 
697  case 4: // $@2: %empty
698 #line 126 "d2_parser.yy"
699  { ctx.ctx_ = ctx.CONFIG; }
700 #line 701 "d2_parser.cc"
701  break;
702 
703  case 6: // $@3: %empty
704 #line 127 "d2_parser.yy"
705  { ctx.ctx_ = ctx.DHCPDDNS; }
706 #line 707 "d2_parser.cc"
707  break;
708 
709  case 8: // $@4: %empty
710 #line 128 "d2_parser.yy"
711  { ctx.ctx_ = ctx.TSIG_KEY; }
712 #line 713 "d2_parser.cc"
713  break;
714 
715  case 10: // $@5: %empty
716 #line 129 "d2_parser.yy"
717  { ctx.ctx_ = ctx.TSIG_KEYS; }
718 #line 719 "d2_parser.cc"
719  break;
720 
721  case 12: // $@6: %empty
722 #line 130 "d2_parser.yy"
723  { ctx.ctx_ = ctx.DDNS_DOMAIN; }
724 #line 725 "d2_parser.cc"
725  break;
726 
727  case 14: // $@7: %empty
728 #line 131 "d2_parser.yy"
729  { ctx.ctx_ = ctx.DDNS_DOMAINS; }
730 #line 731 "d2_parser.cc"
731  break;
732 
733  case 16: // $@8: %empty
734 #line 132 "d2_parser.yy"
735  { ctx.ctx_ = ctx.DNS_SERVERS; }
736 #line 737 "d2_parser.cc"
737  break;
738 
739  case 18: // $@9: %empty
740 #line 133 "d2_parser.yy"
741  { ctx.ctx_ = ctx.DNS_SERVERS; }
742 #line 743 "d2_parser.cc"
743  break;
744 
745  case 20: // $@10: %empty
746 #line 134 "d2_parser.yy"
747  { ctx.ctx_ = ctx.HOOKS_LIBRARIES; }
748 #line 749 "d2_parser.cc"
749  break;
750 
751  case 22: // value: "integer"
752 #line 142 "d2_parser.yy"
753  { yylhs.value.as < ElementPtr > () = ElementPtr(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location))); }
754 #line 755 "d2_parser.cc"
755  break;
756 
757  case 23: // value: "floating point"
758 #line 143 "d2_parser.yy"
759  { yylhs.value.as < ElementPtr > () = ElementPtr(new DoubleElement(yystack_[0].value.as < double > (), ctx.loc2pos(yystack_[0].location))); }
760 #line 761 "d2_parser.cc"
761  break;
762 
763  case 24: // value: "boolean"
764 #line 144 "d2_parser.yy"
765  { yylhs.value.as < ElementPtr > () = ElementPtr(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location))); }
766 #line 767 "d2_parser.cc"
767  break;
768 
769  case 25: // value: "constant string"
770 #line 145 "d2_parser.yy"
771  { yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location))); }
772 #line 773 "d2_parser.cc"
773  break;
774 
775  case 26: // value: "null"
776 #line 146 "d2_parser.yy"
777  { yylhs.value.as < ElementPtr > () = ElementPtr(new NullElement(ctx.loc2pos(yystack_[0].location))); }
778 #line 779 "d2_parser.cc"
779  break;
780 
781  case 27: // value: map2
782 #line 147 "d2_parser.yy"
783  { yylhs.value.as < ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
784 #line 785 "d2_parser.cc"
785  break;
786 
787  case 28: // value: list_generic
788 #line 148 "d2_parser.yy"
789  { yylhs.value.as < ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
790 #line 791 "d2_parser.cc"
791  break;
792 
793  case 29: // sub_json: value
794 #line 151 "d2_parser.yy"
795  {
796  // Push back the JSON value on the stack
797  ctx.stack_.push_back(yystack_[0].value.as < ElementPtr > ());
798 }
799 #line 800 "d2_parser.cc"
800  break;
801 
802  case 30: // $@11: %empty
803 #line 156 "d2_parser.yy"
804  {
805  // This code is executed when we're about to start parsing
806  // the content of the map
807  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
808  ctx.stack_.push_back(m);
809 }
810 #line 811 "d2_parser.cc"
811  break;
812 
813  case 31: // map2: "{" $@11 map_content "}"
814 #line 161 "d2_parser.yy"
815  {
816  // map parsing completed. If we ever want to do any wrap up
817  // (maybe some sanity checking), this would be the best place
818  // for it.
819 }
820 #line 821 "d2_parser.cc"
821  break;
822 
823  case 32: // map_value: map2
824 #line 167 "d2_parser.yy"
825  { yylhs.value.as < ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
826 #line 827 "d2_parser.cc"
827  break;
828 
829  case 35: // not_empty_map: "constant string" ":" value
830 #line 174 "d2_parser.yy"
831  {
832  // map containing a single entry
833  ctx.unique(yystack_[2].value.as < std::string > (), ctx.loc2pos(yystack_[2].location));
834  ctx.stack_.back()->set(yystack_[2].value.as < std::string > (), yystack_[0].value.as < ElementPtr > ());
835  }
836 #line 837 "d2_parser.cc"
837  break;
838 
839  case 36: // not_empty_map: not_empty_map "," "constant string" ":" value
840 #line 179 "d2_parser.yy"
841  {
842  // map consisting of a shorter map followed by
843  // comma and string:value
844  ctx.unique(yystack_[2].value.as < std::string > (), ctx.loc2pos(yystack_[2].location));
845  ctx.stack_.back()->set(yystack_[2].value.as < std::string > (), yystack_[0].value.as < ElementPtr > ());
846  }
847 #line 848 "d2_parser.cc"
848  break;
849 
850  case 37: // $@12: %empty
851 #line 187 "d2_parser.yy"
852  {
853  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
854  ctx.stack_.push_back(l);
855 }
856 #line 857 "d2_parser.cc"
857  break;
858 
859  case 38: // list_generic: "[" $@12 list_content "]"
860 #line 190 "d2_parser.yy"
861  {
862  // list parsing complete. Put any sanity checking here
863 }
864 #line 865 "d2_parser.cc"
865  break;
866 
867  case 41: // not_empty_list: value
868 #line 198 "d2_parser.yy"
869  {
870  // List consisting of a single element.
871  ctx.stack_.back()->add(yystack_[0].value.as < ElementPtr > ());
872  }
873 #line 874 "d2_parser.cc"
874  break;
875 
876  case 42: // not_empty_list: not_empty_list "," value
877 #line 202 "d2_parser.yy"
878  {
879  // List ending with , and a value.
880  ctx.stack_.back()->add(yystack_[0].value.as < ElementPtr > ());
881  }
882 #line 883 "d2_parser.cc"
883  break;
884 
885  case 43: // unknown_map_entry: "constant string" ":"
886 #line 213 "d2_parser.yy"
887  {
888  const std::string& where = ctx.contextName();
889  const std::string& keyword = yystack_[1].value.as < std::string > ();
890  error(yystack_[1].location,
891  "got unexpected keyword \"" + keyword + "\" in " + where + " map.");
892 }
893 #line 894 "d2_parser.cc"
894  break;
895 
896  case 44: // $@13: %empty
897 #line 222 "d2_parser.yy"
898  {
899  // This code is executed when we're about to start parsing
900  // the content of the map
901  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
902  ctx.stack_.push_back(m);
903 }
904 #line 905 "d2_parser.cc"
905  break;
906 
907  case 45: // syntax_map: "{" $@13 global_object "}"
908 #line 227 "d2_parser.yy"
909  {
910  // map parsing completed. If we ever want to do any wrap up
911  // (maybe some sanity checking), this would be the best place
912  // for it.
913 }
914 #line 915 "d2_parser.cc"
915  break;
916 
917  case 46: // $@14: %empty
918 #line 235 "d2_parser.yy"
919  {
920  ctx.unique("DhcpDdns", ctx.loc2pos(yystack_[0].location));
921  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
922  ctx.stack_.back()->set("DhcpDdns", m);
923  ctx.stack_.push_back(m);
924  ctx.enter(ctx.DHCPDDNS);
925 }
926 #line 927 "d2_parser.cc"
927  break;
928 
929  case 47: // global_object: "DhcpDdns" $@14 ":" "{" dhcpddns_params "}"
930 #line 241 "d2_parser.yy"
931  {
932  ctx.stack_.pop_back();
933  ctx.leave();
934 }
935 #line 936 "d2_parser.cc"
936  break;
937 
938  case 48: // $@15: %empty
939 #line 246 "d2_parser.yy"
940  {
941  // Parse the dhcpddns map
942  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
943  ctx.stack_.push_back(m);
944 }
945 #line 946 "d2_parser.cc"
946  break;
947 
948  case 49: // sub_dhcpddns: "{" $@15 dhcpddns_params "}"
949 #line 250 "d2_parser.yy"
950  {
951  // parsing completed
952 }
953 #line 954 "d2_parser.cc"
954  break;
955 
956  case 66: // $@16: %empty
957 #line 275 "d2_parser.yy"
958  {
959  ctx.unique("ip-address", ctx.loc2pos(yystack_[0].location));
960  ctx.enter(ctx.NO_KEYWORD);
961 }
962 #line 963 "d2_parser.cc"
963  break;
964 
965  case 67: // ip_address: "ip-address" $@16 ":" "constant string"
966 #line 278 "d2_parser.yy"
967  {
968  ElementPtr s(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
969  ctx.stack_.back()->set("ip-address", s);
970  ctx.leave();
971 }
972 #line 973 "d2_parser.cc"
973  break;
974 
975  case 68: // port: "port" ":" "integer"
976 #line 284 "d2_parser.yy"
977  {
978  ctx.unique("port", ctx.loc2pos(yystack_[2].location));
979  if (yystack_[0].value.as < int64_t > () <= 0 || yystack_[0].value.as < int64_t > () >= 65536 ) {
980  error(yystack_[0].location, "port must be greater than zero but less than 65536");
981  }
982  ElementPtr i(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
983  ctx.stack_.back()->set("port", i);
984 }
985 #line 986 "d2_parser.cc"
986  break;
987 
988  case 69: // dns_server_timeout: "dns-server-timeout" ":" "integer"
989 #line 293 "d2_parser.yy"
990  {
991  ctx.unique("dns-server-timeout", ctx.loc2pos(yystack_[2].location));
992  if (yystack_[0].value.as < int64_t > () <= 0) {
993  error(yystack_[0].location, "dns-server-timeout must be greater than zero");
994  } else {
995  ElementPtr i(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
996  ctx.stack_.back()->set("dns-server-timeout", i);
997  }
998 }
999 #line 1000 "d2_parser.cc"
1000  break;
1001 
1002  case 70: // $@17: %empty
1003 #line 303 "d2_parser.yy"
1004  {
1005  ctx.unique("ncr-protocol", ctx.loc2pos(yystack_[0].location));
1006  ctx.enter(ctx.NCR_PROTOCOL);
1007 }
1008 #line 1009 "d2_parser.cc"
1009  break;
1010 
1011  case 71: // ncr_protocol: "ncr-protocol" $@17 ":" ncr_protocol_value
1012 #line 306 "d2_parser.yy"
1013  {
1014  ctx.stack_.back()->set("ncr-protocol", yystack_[0].value.as < ElementPtr > ());
1015  ctx.leave();
1016 }
1017 #line 1018 "d2_parser.cc"
1018  break;
1019 
1020  case 72: // ncr_protocol_value: "UDP"
1021 #line 312 "d2_parser.yy"
1022  { yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement("UDP", ctx.loc2pos(yystack_[0].location))); }
1023 #line 1024 "d2_parser.cc"
1024  break;
1025 
1026  case 73: // ncr_protocol_value: "TCP"
1027 #line 313 "d2_parser.yy"
1028  { yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement("TCP", ctx.loc2pos(yystack_[0].location))); }
1029 #line 1030 "d2_parser.cc"
1030  break;
1031 
1032  case 74: // $@18: %empty
1033 #line 316 "d2_parser.yy"
1034  {
1035  ctx.unique("ncr-format", ctx.loc2pos(yystack_[0].location));
1036  ctx.enter(ctx.NCR_FORMAT);
1037 }
1038 #line 1039 "d2_parser.cc"
1039  break;
1040 
1041  case 75: // ncr_format: "ncr-format" $@18 ":" "JSON"
1042 #line 319 "d2_parser.yy"
1043  {
1044  ElementPtr json(new StringElement("JSON", ctx.loc2pos(yystack_[0].location)));
1045  ctx.stack_.back()->set("ncr-format", json);
1046  ctx.leave();
1047 }
1048 #line 1049 "d2_parser.cc"
1049  break;
1050 
1051  case 76: // $@19: %empty
1052 #line 325 "d2_parser.yy"
1053  {
1054  ctx.enter(ctx.NO_KEYWORD);
1055 }
1056 #line 1057 "d2_parser.cc"
1057  break;
1058 
1059  case 77: // user_context: "user-context" $@19 ":" map_value
1060 #line 327 "d2_parser.yy"
1061  {
1062  ElementPtr parent = ctx.stack_.back();
1063  ElementPtr user_context = yystack_[0].value.as < ElementPtr > ();
1064  ConstElementPtr old = parent->get("user-context");
1065 
1066  // Handle already existing user context
1067  if (old) {
1068  // Check if it was a comment or a duplicate
1069  if ((old->size() != 1) || !old->contains("comment")) {
1070  std::stringstream msg;
1071  msg << "duplicate user-context entries (previous at "
1072  << old->getPosition().str() << ")";
1073  error(yystack_[3].location, msg.str());
1074  }
1075  // Merge the comment
1076  user_context->set("comment", old->get("comment"));
1077  }
1078 
1079  // Set the user context
1080  parent->set("user-context", user_context);
1081  ctx.leave();
1082 }
1083 #line 1084 "d2_parser.cc"
1084  break;
1085 
1086  case 78: // $@20: %empty
1087 #line 350 "d2_parser.yy"
1088  {
1089  ctx.enter(ctx.NO_KEYWORD);
1090 }
1091 #line 1092 "d2_parser.cc"
1092  break;
1093 
1094  case 79: // comment: "comment" $@20 ":" "constant string"
1095 #line 352 "d2_parser.yy"
1096  {
1097  ElementPtr parent = ctx.stack_.back();
1098  ElementPtr user_context(new MapElement(ctx.loc2pos(yystack_[3].location)));
1099  ElementPtr comment(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1100  user_context->set("comment", comment);
1101 
1102  // Handle already existing user context
1103  ConstElementPtr old = parent->get("user-context");
1104  if (old) {
1105  // Check for duplicate comment
1106  if (old->contains("comment")) {
1107  std::stringstream msg;
1108  msg << "duplicate user-context/comment entries (previous at "
1109  << old->getPosition().str() << ")";
1110  error(yystack_[3].location, msg.str());
1111  }
1112  // Merge the user context in the comment
1113  merge(user_context, old);
1114  }
1115 
1116  // Set the user context
1117  parent->set("user-context", user_context);
1118  ctx.leave();
1119 }
1120 #line 1121 "d2_parser.cc"
1121  break;
1122 
1123  case 80: // $@21: %empty
1124 #line 377 "d2_parser.yy"
1125  {
1126  ctx.unique("forward-ddns", ctx.loc2pos(yystack_[0].location));
1127  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1128  ctx.stack_.back()->set("forward-ddns", m);
1129  ctx.stack_.push_back(m);
1130  ctx.enter(ctx.FORWARD_DDNS);
1131 }
1132 #line 1133 "d2_parser.cc"
1133  break;
1134 
1135  case 81: // forward_ddns: "forward-ddns" $@21 ":" "{" ddns_mgr_params "}"
1136 #line 383 "d2_parser.yy"
1137  {
1138  ctx.stack_.pop_back();
1139  ctx.leave();
1140 }
1141 #line 1142 "d2_parser.cc"
1142  break;
1143 
1144  case 82: // $@22: %empty
1145 #line 388 "d2_parser.yy"
1146  {
1147  ctx.unique("reverse-ddns", ctx.loc2pos(yystack_[0].location));
1148  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1149  ctx.stack_.back()->set("reverse-ddns", m);
1150  ctx.stack_.push_back(m);
1151  ctx.enter(ctx.REVERSE_DDNS);
1152 }
1153 #line 1154 "d2_parser.cc"
1154  break;
1155 
1156  case 83: // reverse_ddns: "reverse-ddns" $@22 ":" "{" ddns_mgr_params "}"
1157 #line 394 "d2_parser.yy"
1158  {
1159  ctx.stack_.pop_back();
1160  ctx.leave();
1161 }
1162 #line 1163 "d2_parser.cc"
1163  break;
1164 
1165  case 90: // $@23: %empty
1166 #line 413 "d2_parser.yy"
1167  {
1168  ctx.unique("ddns-domains", ctx.loc2pos(yystack_[0].location));
1169  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1170  ctx.stack_.back()->set("ddns-domains", l);
1171  ctx.stack_.push_back(l);
1172  ctx.enter(ctx.DDNS_DOMAINS);
1173 }
1174 #line 1175 "d2_parser.cc"
1175  break;
1176 
1177  case 91: // ddns_domains: "ddns-domains" $@23 ":" "[" ddns_domain_list "]"
1178 #line 419 "d2_parser.yy"
1179  {
1180  ctx.stack_.pop_back();
1181  ctx.leave();
1182 }
1183 #line 1184 "d2_parser.cc"
1184  break;
1185 
1186  case 92: // $@24: %empty
1187 #line 424 "d2_parser.yy"
1188  {
1189  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1190  ctx.stack_.push_back(l);
1191 }
1192 #line 1193 "d2_parser.cc"
1193  break;
1194 
1195  case 93: // sub_ddns_domains: "[" $@24 ddns_domain_list "]"
1196 #line 427 "d2_parser.yy"
1197  {
1198  // parsing completed
1199 }
1200 #line 1201 "d2_parser.cc"
1201  break;
1202 
1203  case 98: // $@25: %empty
1204 #line 439 "d2_parser.yy"
1205  {
1206  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1207  ctx.stack_.back()->add(m);
1208  ctx.stack_.push_back(m);
1209 }
1210 #line 1211 "d2_parser.cc"
1211  break;
1212 
1213  case 99: // ddns_domain: "{" $@25 ddns_domain_params "}"
1214 #line 443 "d2_parser.yy"
1215  {
1216  ctx.stack_.pop_back();
1217 }
1218 #line 1219 "d2_parser.cc"
1219  break;
1220 
1221  case 100: // $@26: %empty
1222 #line 447 "d2_parser.yy"
1223  {
1224  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1225  ctx.stack_.push_back(m);
1226 }
1227 #line 1228 "d2_parser.cc"
1228  break;
1229 
1230  case 101: // sub_ddns_domain: "{" $@26 ddns_domain_params "}"
1231 #line 450 "d2_parser.yy"
1232  {
1233  // parsing completed
1234 }
1235 #line 1236 "d2_parser.cc"
1236  break;
1237 
1238  case 110: // $@27: %empty
1239 #line 467 "d2_parser.yy"
1240  {
1241  ctx.unique("name", ctx.loc2pos(yystack_[0].location));
1242  ctx.enter(ctx.NO_KEYWORD);
1243 }
1244 #line 1245 "d2_parser.cc"
1245  break;
1246 
1247  case 111: // ddns_domain_name: "name" $@27 ":" "constant string"
1248 #line 470 "d2_parser.yy"
1249  {
1250  if (yystack_[0].value.as < std::string > () == "") {
1251  error(yystack_[1].location, "Ddns domain name cannot be blank");
1252  }
1253  ElementPtr elem(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1254  ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1255  ctx.stack_.back()->set("name", name);
1256  ctx.leave();
1257 }
1258 #line 1259 "d2_parser.cc"
1259  break;
1260 
1261  case 112: // $@28: %empty
1262 #line 480 "d2_parser.yy"
1263  {
1264  ctx.unique("key-name", ctx.loc2pos(yystack_[0].location));
1265  ctx.enter(ctx.NO_KEYWORD);
1266 }
1267 #line 1268 "d2_parser.cc"
1268  break;
1269 
1270  case 113: // ddns_domain_key_name: "key-name" $@28 ":" "constant string"
1271 #line 483 "d2_parser.yy"
1272  {
1273  ElementPtr elem(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1274  ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1275  ctx.stack_.back()->set("key-name", name);
1276  ctx.leave();
1277 }
1278 #line 1279 "d2_parser.cc"
1279  break;
1280 
1281  case 114: // $@29: %empty
1282 #line 493 "d2_parser.yy"
1283  {
1284  ctx.unique("dns-servers", ctx.loc2pos(yystack_[0].location));
1285  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1286  ctx.stack_.back()->set("dns-servers", l);
1287  ctx.stack_.push_back(l);
1288  ctx.enter(ctx.DNS_SERVERS);
1289 }
1290 #line 1291 "d2_parser.cc"
1291  break;
1292 
1293  case 115: // dns_servers: "dns-servers" $@29 ":" "[" dns_server_list "]"
1294 #line 499 "d2_parser.yy"
1295  {
1296  ctx.stack_.pop_back();
1297  ctx.leave();
1298 }
1299 #line 1300 "d2_parser.cc"
1300  break;
1301 
1302  case 116: // $@30: %empty
1303 #line 504 "d2_parser.yy"
1304  {
1305  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1306  ctx.stack_.push_back(l);
1307 }
1308 #line 1309 "d2_parser.cc"
1309  break;
1310 
1311  case 117: // sub_dns_servers: "[" $@30 dns_server_list "]"
1312 #line 507 "d2_parser.yy"
1313  {
1314  // parsing completed
1315 }
1316 #line 1317 "d2_parser.cc"
1317  break;
1318 
1319  case 120: // $@31: %empty
1320 #line 515 "d2_parser.yy"
1321  {
1322  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1323  ctx.stack_.back()->add(m);
1324  ctx.stack_.push_back(m);
1325 }
1326 #line 1327 "d2_parser.cc"
1327  break;
1328 
1329  case 121: // dns_server: "{" $@31 dns_server_params "}"
1330 #line 519 "d2_parser.yy"
1331  {
1332  ctx.stack_.pop_back();
1333 }
1334 #line 1335 "d2_parser.cc"
1335  break;
1336 
1337  case 122: // $@32: %empty
1338 #line 523 "d2_parser.yy"
1339  {
1340  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1341  ctx.stack_.push_back(m);
1342 }
1343 #line 1344 "d2_parser.cc"
1344  break;
1345 
1346  case 123: // sub_dns_server: "{" $@32 dns_server_params "}"
1347 #line 526 "d2_parser.yy"
1348  {
1349  // parsing completed
1350 }
1351 #line 1352 "d2_parser.cc"
1352  break;
1353 
1354  case 132: // $@33: %empty
1355 #line 542 "d2_parser.yy"
1356  {
1357  ctx.unique("hostname", ctx.loc2pos(yystack_[0].location));
1358  ctx.enter(ctx.NO_KEYWORD);
1359 }
1360 #line 1361 "d2_parser.cc"
1361  break;
1362 
1363  case 133: // dns_server_hostname: "hostname" $@33 ":" "constant string"
1364 #line 545 "d2_parser.yy"
1365  {
1366  if (yystack_[0].value.as < std::string > () != "") {
1367  error(yystack_[1].location, "hostname is not yet supported");
1368  }
1369  ElementPtr elem(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1370  ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1371  ctx.stack_.back()->set("hostname", name);
1372  ctx.leave();
1373 }
1374 #line 1375 "d2_parser.cc"
1375  break;
1376 
1377  case 134: // $@34: %empty
1378 #line 555 "d2_parser.yy"
1379  {
1380  ctx.unique("ip-address", ctx.loc2pos(yystack_[0].location));
1381  ctx.enter(ctx.NO_KEYWORD);
1382 }
1383 #line 1384 "d2_parser.cc"
1384  break;
1385 
1386  case 135: // dns_server_ip_address: "ip-address" $@34 ":" "constant string"
1387 #line 558 "d2_parser.yy"
1388  {
1389  ElementPtr s(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1390  ctx.stack_.back()->set("ip-address", s);
1391  ctx.leave();
1392 }
1393 #line 1394 "d2_parser.cc"
1394  break;
1395 
1396  case 136: // dns_server_port: "port" ":" "integer"
1397 #line 564 "d2_parser.yy"
1398  {
1399  ctx.unique("port", ctx.loc2pos(yystack_[2].location));
1400  if (yystack_[0].value.as < int64_t > () <= 0 || yystack_[0].value.as < int64_t > () >= 65536 ) {
1401  error(yystack_[0].location, "port must be greater than zero but less than 65536");
1402  }
1403  ElementPtr i(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
1404  ctx.stack_.back()->set("port", i);
1405 }
1406 #line 1407 "d2_parser.cc"
1407  break;
1408 
1409  case 137: // $@35: %empty
1410 #line 579 "d2_parser.yy"
1411  {
1412  ctx.unique("tsig-keys", ctx.loc2pos(yystack_[0].location));
1413  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1414  ctx.stack_.back()->set("tsig-keys", l);
1415  ctx.stack_.push_back(l);
1416  ctx.enter(ctx.TSIG_KEYS);
1417 }
1418 #line 1419 "d2_parser.cc"
1419  break;
1420 
1421  case 138: // tsig_keys: "tsig-keys" $@35 ":" "[" tsig_keys_list "]"
1422 #line 585 "d2_parser.yy"
1423  {
1424  ctx.stack_.pop_back();
1425  ctx.leave();
1426 }
1427 #line 1428 "d2_parser.cc"
1428  break;
1429 
1430  case 139: // $@36: %empty
1431 #line 590 "d2_parser.yy"
1432  {
1433  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1434  ctx.stack_.push_back(l);
1435 }
1436 #line 1437 "d2_parser.cc"
1437  break;
1438 
1439  case 140: // sub_tsig_keys: "[" $@36 tsig_keys_list "]"
1440 #line 593 "d2_parser.yy"
1441  {
1442  // parsing completed
1443 }
1444 #line 1445 "d2_parser.cc"
1445  break;
1446 
1447  case 145: // $@37: %empty
1448 #line 605 "d2_parser.yy"
1449  {
1450  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1451  ctx.stack_.back()->add(m);
1452  ctx.stack_.push_back(m);
1453 }
1454 #line 1455 "d2_parser.cc"
1455  break;
1456 
1457  case 146: // tsig_key: "{" $@37 tsig_key_params "}"
1458 #line 609 "d2_parser.yy"
1459  {
1460  ctx.stack_.pop_back();
1461 }
1462 #line 1463 "d2_parser.cc"
1463  break;
1464 
1465  case 147: // $@38: %empty
1466 #line 613 "d2_parser.yy"
1467  {
1468  // Parse tsig key list entry map
1469  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1470  ctx.stack_.push_back(m);
1471 }
1472 #line 1473 "d2_parser.cc"
1473  break;
1474 
1475  case 148: // sub_tsig_key: "{" $@38 tsig_key_params "}"
1476 #line 617 "d2_parser.yy"
1477  {
1478  // parsing completed
1479 }
1480 #line 1481 "d2_parser.cc"
1481  break;
1482 
1483  case 158: // $@39: %empty
1484 #line 635 "d2_parser.yy"
1485  {
1486  ctx.unique("name", ctx.loc2pos(yystack_[0].location));
1487  ctx.enter(ctx.NO_KEYWORD);
1488 }
1489 #line 1490 "d2_parser.cc"
1490  break;
1491 
1492  case 159: // tsig_key_name: "name" $@39 ":" "constant string"
1493 #line 638 "d2_parser.yy"
1494  {
1495  if (yystack_[0].value.as < std::string > () == "") {
1496  error(yystack_[1].location, "TSIG key name cannot be blank");
1497  }
1498  ElementPtr elem(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1499  ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1500  ctx.stack_.back()->set("name", name);
1501  ctx.leave();
1502 }
1503 #line 1504 "d2_parser.cc"
1504  break;
1505 
1506  case 160: // $@40: %empty
1507 #line 648 "d2_parser.yy"
1508  {
1509  ctx.unique("algorithm", ctx.loc2pos(yystack_[0].location));
1510  ctx.enter(ctx.NO_KEYWORD);
1511 }
1512 #line 1513 "d2_parser.cc"
1513  break;
1514 
1515  case 161: // tsig_key_algorithm: "algorithm" $@40 ":" "constant string"
1516 #line 651 "d2_parser.yy"
1517  {
1518  if (yystack_[0].value.as < std::string > () == "") {
1519  error(yystack_[1].location, "TSIG key algorithm cannot be blank");
1520  }
1521  ElementPtr elem(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1522  ctx.stack_.back()->set("algorithm", elem);
1523  ctx.leave();
1524 }
1525 #line 1526 "d2_parser.cc"
1526  break;
1527 
1528  case 162: // tsig_key_digest_bits: "digest-bits" ":" "integer"
1529 #line 660 "d2_parser.yy"
1530  {
1531  ctx.unique("digest-bits", ctx.loc2pos(yystack_[2].location));
1532  if (yystack_[0].value.as < int64_t > () < 0 || (yystack_[0].value.as < int64_t > () > 0 && (yystack_[0].value.as < int64_t > () % 8 != 0))) {
1533  error(yystack_[0].location, "TSIG key digest-bits must either be zero or a positive, multiple of eight");
1534  }
1535  ElementPtr elem(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
1536  ctx.stack_.back()->set("digest-bits", elem);
1537 }
1538 #line 1539 "d2_parser.cc"
1539  break;
1540 
1541  case 163: // $@41: %empty
1542 #line 669 "d2_parser.yy"
1543  {
1544  ctx.unique("secret", ctx.loc2pos(yystack_[0].location));
1545  ctx.enter(ctx.NO_KEYWORD);
1546 }
1547 #line 1548 "d2_parser.cc"
1548  break;
1549 
1550  case 164: // tsig_key_secret: "secret" $@41 ":" "constant string"
1551 #line 672 "d2_parser.yy"
1552  {
1553  if (yystack_[0].value.as < std::string > () == "") {
1554  error(yystack_[1].location, "TSIG key secret cannot be blank");
1555  }
1556  ElementPtr elem(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1557  ctx.stack_.back()->set("secret", elem);
1558  ctx.leave();
1559 }
1560 #line 1561 "d2_parser.cc"
1561  break;
1562 
1563  case 165: // $@42: %empty
1564 #line 686 "d2_parser.yy"
1565  {
1566  ctx.unique("control-socket", ctx.loc2pos(yystack_[0].location));
1567  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1568  ctx.stack_.back()->set("control-socket", m);
1569  ctx.stack_.push_back(m);
1570  ctx.enter(ctx.CONTROL_SOCKET);
1571 }
1572 #line 1573 "d2_parser.cc"
1573  break;
1574 
1575  case 166: // control_socket: "control-socket" $@42 ":" "{" control_socket_params "}"
1576 #line 692 "d2_parser.yy"
1577  {
1578  ctx.stack_.pop_back();
1579  ctx.leave();
1580 }
1581 #line 1582 "d2_parser.cc"
1582  break;
1583 
1584  case 174: // $@43: %empty
1585 #line 708 "d2_parser.yy"
1586  {
1587  ctx.unique("socket-type", ctx.loc2pos(yystack_[0].location));
1588  ctx.enter(ctx.NO_KEYWORD);
1589 }
1590 #line 1591 "d2_parser.cc"
1591  break;
1592 
1593  case 175: // control_socket_type: "socket-type" $@43 ":" "constant string"
1594 #line 711 "d2_parser.yy"
1595  {
1596  ElementPtr stype(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1597  ctx.stack_.back()->set("socket-type", stype);
1598  ctx.leave();
1599 }
1600 #line 1601 "d2_parser.cc"
1601  break;
1602 
1603  case 176: // $@44: %empty
1604 #line 717 "d2_parser.yy"
1605  {
1606  ctx.unique("socket-name", ctx.loc2pos(yystack_[0].location));
1607  ctx.enter(ctx.NO_KEYWORD);
1608 }
1609 #line 1610 "d2_parser.cc"
1610  break;
1611 
1612  case 177: // control_socket_name: "socket-name" $@44 ":" "constant string"
1613 #line 720 "d2_parser.yy"
1614  {
1615  ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1616  ctx.stack_.back()->set("socket-name", name);
1617  ctx.leave();
1618 }
1619 #line 1620 "d2_parser.cc"
1620  break;
1621 
1622  case 178: // $@45: %empty
1623 #line 728 "d2_parser.yy"
1624  {
1625  ctx.unique("hooks-libraries", ctx.loc2pos(yystack_[0].location));
1626  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1627  ctx.stack_.back()->set("hooks-libraries", l);
1628  ctx.stack_.push_back(l);
1629  ctx.enter(ctx.HOOKS_LIBRARIES);
1630 }
1631 #line 1632 "d2_parser.cc"
1632  break;
1633 
1634  case 179: // hooks_libraries: "hooks-libraries" $@45 ":" "[" hooks_libraries_list "]"
1635 #line 734 "d2_parser.yy"
1636  {
1637  ctx.stack_.pop_back();
1638  ctx.leave();
1639 }
1640 #line 1641 "d2_parser.cc"
1641  break;
1642 
1643  case 184: // $@46: %empty
1644 #line 747 "d2_parser.yy"
1645  {
1646  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1647  ctx.stack_.back()->add(m);
1648  ctx.stack_.push_back(m);
1649 }
1650 #line 1651 "d2_parser.cc"
1651  break;
1652 
1653  case 185: // hooks_library: "{" $@46 hooks_params "}"
1654 #line 751 "d2_parser.yy"
1655  {
1656  // The library hooks parameter is required
1657  ctx.require("library", ctx.loc2pos(yystack_[3].location), ctx.loc2pos(yystack_[0].location));
1658  ctx.stack_.pop_back();
1659 }
1660 #line 1661 "d2_parser.cc"
1661  break;
1662 
1663  case 186: // $@47: %empty
1664 #line 757 "d2_parser.yy"
1665  {
1666  // Parse the hooks-libraries list entry map
1667  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1668  ctx.stack_.push_back(m);
1669 }
1670 #line 1671 "d2_parser.cc"
1671  break;
1672 
1673  case 187: // sub_hooks_library: "{" $@47 hooks_params "}"
1674 #line 761 "d2_parser.yy"
1675  {
1676  // The library hooks parameter is required
1677  ctx.require("library", ctx.loc2pos(yystack_[3].location), ctx.loc2pos(yystack_[0].location));
1678  // parsing completed
1679 }
1680 #line 1681 "d2_parser.cc"
1681  break;
1682 
1683  case 193: // $@48: %empty
1684 #line 776 "d2_parser.yy"
1685  {
1686  ctx.unique("library", ctx.loc2pos(yystack_[0].location));
1687  ctx.enter(ctx.NO_KEYWORD);
1688 }
1689 #line 1690 "d2_parser.cc"
1690  break;
1691 
1692  case 194: // library: "library" $@48 ":" "constant string"
1693 #line 779 "d2_parser.yy"
1694  {
1695  ElementPtr lib(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1696  ctx.stack_.back()->set("library", lib);
1697  ctx.leave();
1698 }
1699 #line 1700 "d2_parser.cc"
1700  break;
1701 
1702  case 195: // $@49: %empty
1703 #line 785 "d2_parser.yy"
1704  {
1705  ctx.unique("parameters", ctx.loc2pos(yystack_[0].location));
1706  ctx.enter(ctx.NO_KEYWORD);
1707 }
1708 #line 1709 "d2_parser.cc"
1709  break;
1710 
1711  case 196: // parameters: "parameters" $@49 ":" map_value
1712 #line 788 "d2_parser.yy"
1713  {
1714  ctx.stack_.back()->set("parameters", yystack_[0].value.as < ElementPtr > ());
1715  ctx.leave();
1716 }
1717 #line 1718 "d2_parser.cc"
1718  break;
1719 
1720  case 197: // $@50: %empty
1721 #line 795 "d2_parser.yy"
1722  {
1723  ctx.unique("loggers", ctx.loc2pos(yystack_[0].location));
1724  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1725  ctx.stack_.back()->set("loggers", l);
1726  ctx.stack_.push_back(l);
1727  ctx.enter(ctx.LOGGERS);
1728 }
1729 #line 1730 "d2_parser.cc"
1730  break;
1731 
1732  case 198: // loggers: "loggers" $@50 ":" "[" loggers_entries "]"
1733 #line 801 "d2_parser.yy"
1734  {
1735  ctx.stack_.pop_back();
1736  ctx.leave();
1737 }
1738 #line 1739 "d2_parser.cc"
1739  break;
1740 
1741  case 201: // $@51: %empty
1742 #line 813 "d2_parser.yy"
1743  {
1744  ElementPtr l(new MapElement(ctx.loc2pos(yystack_[0].location)));
1745  ctx.stack_.back()->add(l);
1746  ctx.stack_.push_back(l);
1747 }
1748 #line 1749 "d2_parser.cc"
1749  break;
1750 
1751  case 202: // logger_entry: "{" $@51 logger_params "}"
1752 #line 817 "d2_parser.yy"
1753  {
1754  ctx.stack_.pop_back();
1755 }
1756 #line 1757 "d2_parser.cc"
1757  break;
1758 
1759  case 212: // $@52: %empty
1760 #line 834 "d2_parser.yy"
1761  {
1762  ctx.unique("name", ctx.loc2pos(yystack_[0].location));
1763  ctx.enter(ctx.NO_KEYWORD);
1764 }
1765 #line 1766 "d2_parser.cc"
1766  break;
1767 
1768  case 213: // name: "name" $@52 ":" "constant string"
1769 #line 837 "d2_parser.yy"
1770  {
1771  ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1772  ctx.stack_.back()->set("name", name);
1773  ctx.leave();
1774 }
1775 #line 1776 "d2_parser.cc"
1776  break;
1777 
1778  case 214: // debuglevel: "debuglevel" ":" "integer"
1779 #line 843 "d2_parser.yy"
1780  {
1781  ctx.unique("debuglevel", ctx.loc2pos(yystack_[2].location));
1782  ElementPtr dl(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
1783  ctx.stack_.back()->set("debuglevel", dl);
1784 }
1785 #line 1786 "d2_parser.cc"
1786  break;
1787 
1788  case 215: // $@53: %empty
1789 #line 849 "d2_parser.yy"
1790  {
1791  ctx.unique("severity", ctx.loc2pos(yystack_[0].location));
1792  ctx.enter(ctx.NO_KEYWORD);
1793 }
1794 #line 1795 "d2_parser.cc"
1795  break;
1796 
1797  case 216: // severity: "severity" $@53 ":" "constant string"
1798 #line 852 "d2_parser.yy"
1799  {
1800  ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1801  ctx.stack_.back()->set("severity", sev);
1802  ctx.leave();
1803 }
1804 #line 1805 "d2_parser.cc"
1805  break;
1806 
1807  case 217: // $@54: %empty
1808 #line 858 "d2_parser.yy"
1809  {
1810  ctx.unique("output_options", ctx.loc2pos(yystack_[0].location));
1811  ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1812  ctx.stack_.back()->set("output_options", l);
1813  ctx.stack_.push_back(l);
1814  ctx.enter(ctx.OUTPUT_OPTIONS);
1815 }
1816 #line 1817 "d2_parser.cc"
1817  break;
1818 
1819  case 218: // output_options_list: "output_options" $@54 ":" "[" output_options_list_content "]"
1820 #line 864 "d2_parser.yy"
1821  {
1822  ctx.stack_.pop_back();
1823  ctx.leave();
1824 }
1825 #line 1826 "d2_parser.cc"
1826  break;
1827 
1828  case 221: // $@55: %empty
1829 #line 873 "d2_parser.yy"
1830  {
1831  ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1832  ctx.stack_.back()->add(m);
1833  ctx.stack_.push_back(m);
1834 }
1835 #line 1836 "d2_parser.cc"
1836  break;
1837 
1838  case 222: // output_entry: "{" $@55 output_params_list "}"
1839 #line 877 "d2_parser.yy"
1840  {
1841  ctx.stack_.pop_back();
1842 }
1843 #line 1844 "d2_parser.cc"
1844  break;
1845 
1846  case 230: // $@56: %empty
1847 #line 892 "d2_parser.yy"
1848  {
1849  ctx.unique("output", ctx.loc2pos(yystack_[0].location));
1850  ctx.enter(ctx.NO_KEYWORD);
1851 }
1852 #line 1853 "d2_parser.cc"
1853  break;
1854 
1855  case 231: // output: "output" $@56 ":" "constant string"
1856 #line 895 "d2_parser.yy"
1857  {
1858  ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1859  ctx.stack_.back()->set("output", sev);
1860  ctx.leave();
1861 }
1862 #line 1863 "d2_parser.cc"
1863  break;
1864 
1865  case 232: // flush: "flush" ":" "boolean"
1866 #line 901 "d2_parser.yy"
1867  {
1868  ctx.unique("flush", ctx.loc2pos(yystack_[2].location));
1869  ElementPtr flush(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
1870  ctx.stack_.back()->set("flush", flush);
1871 }
1872 #line 1873 "d2_parser.cc"
1873  break;
1874 
1875  case 233: // maxsize: "maxsize" ":" "integer"
1876 #line 907 "d2_parser.yy"
1877  {
1878  ctx.unique("maxsize", ctx.loc2pos(yystack_[2].location));
1879  ElementPtr maxsize(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
1880  ctx.stack_.back()->set("maxsize", maxsize);
1881 }
1882 #line 1883 "d2_parser.cc"
1883  break;
1884 
1885  case 234: // maxver: "maxver" ":" "integer"
1886 #line 913 "d2_parser.yy"
1887  {
1888  ctx.unique("maxver", ctx.loc2pos(yystack_[2].location));
1889  ElementPtr maxver(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
1890  ctx.stack_.back()->set("maxver", maxver);
1891 }
1892 #line 1893 "d2_parser.cc"
1893  break;
1894 
1895  case 235: // $@57: %empty
1896 #line 919 "d2_parser.yy"
1897  {
1898  ctx.unique("pattern", ctx.loc2pos(yystack_[0].location));
1899  ctx.enter(ctx.NO_KEYWORD);
1900 }
1901 #line 1902 "d2_parser.cc"
1902  break;
1903 
1904  case 236: // pattern: "pattern" $@57 ":" "constant string"
1905 #line 922 "d2_parser.yy"
1906  {
1907  ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1908  ctx.stack_.back()->set("pattern", sev);
1909  ctx.leave();
1910 }
1911 #line 1912 "d2_parser.cc"
1912  break;
1913 
1914 
1915 #line 1916 "d2_parser.cc"
1916 
1917  default:
1918  break;
1919  }
1920  }
1921 #if YY_EXCEPTIONS
1922  catch (const syntax_error& yyexc)
1923  {
1924  YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
1925  error (yyexc);
1926  YYERROR;
1927  }
1928 #endif // YY_EXCEPTIONS
1929  YY_SYMBOL_PRINT ("-> $$ =", yylhs);
1930  yypop_ (yylen);
1931  yylen = 0;
1932 
1933  // Shift the result of the reduction.
1934  yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
1935  }
1936  goto yynewstate;
1937 
1938 
1939  /*--------------------------------------.
1940  | yyerrlab -- here on detecting error. |
1941  `--------------------------------------*/
1942  yyerrlab:
1943  // If not already recovering from an error, report this error.
1944  if (!yyerrstatus_)
1945  {
1946  ++yynerrs_;
1947  context yyctx (*this, yyla);
1948  std::string msg = yysyntax_error_ (yyctx);
1949  error (yyla.location, YY_MOVE (msg));
1950  }
1951 
1952 
1953  yyerror_range[1].location = yyla.location;
1954  if (yyerrstatus_ == 3)
1955  {
1956  /* If just tried and failed to reuse lookahead token after an
1957  error, discard it. */
1958 
1959  // Return failure if at end of input.
1960  if (yyla.kind () == symbol_kind::S_YYEOF)
1961  YYABORT;
1962  else if (!yyla.empty ())
1963  {
1964  yy_destroy_ ("Error: discarding", yyla);
1965  yyla.clear ();
1966  }
1967  }
1968 
1969  // Else will try to reuse lookahead token after shifting the error token.
1970  goto yyerrlab1;
1971 
1972 
1973  /*---------------------------------------------------.
1974  | yyerrorlab -- error raised explicitly by YYERROR. |
1975  `---------------------------------------------------*/
1976  yyerrorlab:
1977  /* Pacify compilers when the user code never invokes YYERROR and
1978  the label yyerrorlab therefore never appears in user code. */
1979  if (false)
1980  YYERROR;
1981 
1982  /* Do not reclaim the symbols of the rule whose action triggered
1983  this YYERROR. */
1984  yypop_ (yylen);
1985  yylen = 0;
1986  YY_STACK_PRINT ();
1987  goto yyerrlab1;
1988 
1989 
1990  /*-------------------------------------------------------------.
1991  | yyerrlab1 -- common code for both syntax error and YYERROR. |
1992  `-------------------------------------------------------------*/
1993  yyerrlab1:
1994  yyerrstatus_ = 3; // Each real token shifted decrements this.
1995  // Pop stack until we find a state that shifts the error token.
1996  for (;;)
1997  {
1998  yyn = yypact_[+yystack_[0].state];
1999  if (!yy_pact_value_is_default_ (yyn))
2000  {
2001  yyn += symbol_kind::S_YYerror;
2002  if (0 <= yyn && yyn <= yylast_
2003  && yycheck_[yyn] == symbol_kind::S_YYerror)
2004  {
2005  yyn = yytable_[yyn];
2006  if (0 < yyn)
2007  break;
2008  }
2009  }
2010 
2011  // Pop the current state because it cannot handle the error token.
2012  if (yystack_.size () == 1)
2013  YYABORT;
2014 
2015  yyerror_range[1].location = yystack_[0].location;
2016  yy_destroy_ ("Error: popping", yystack_[0]);
2017  yypop_ ();
2018  YY_STACK_PRINT ();
2019  }
2020  {
2021  stack_symbol_type error_token;
2022 
2023  yyerror_range[2].location = yyla.location;
2024  YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);
2025 
2026  // Shift the error token.
2027  error_token.state = state_type (yyn);
2028  yypush_ ("Shifting", YY_MOVE (error_token));
2029  }
2030  goto yynewstate;
2031 
2032 
2033  /*-------------------------------------.
2034  | yyacceptlab -- YYACCEPT comes here. |
2035  `-------------------------------------*/
2036  yyacceptlab:
2037  yyresult = 0;
2038  goto yyreturn;
2039 
2040 
2041  /*-----------------------------------.
2042  | yyabortlab -- YYABORT comes here. |
2043  `-----------------------------------*/
2044  yyabortlab:
2045  yyresult = 1;
2046  goto yyreturn;
2047 
2048 
2049  /*-----------------------------------------------------.
2050  | yyreturn -- parsing is finished, return the result. |
2051  `-----------------------------------------------------*/
2052  yyreturn:
2053  if (!yyla.empty ())
2054  yy_destroy_ ("Cleanup: discarding lookahead", yyla);
2055 
2056  /* Do not reclaim the symbols of the rule whose action triggered
2057  this YYABORT or YYACCEPT. */
2058  yypop_ (yylen);
2059  YY_STACK_PRINT ();
2060  while (1 < yystack_.size ())
2061  {
2062  yy_destroy_ ("Cleanup: popping", yystack_[0]);
2063  yypop_ ();
2064  }
2065 
2066  return yyresult;
2067  }
2068 #if YY_EXCEPTIONS
2069  catch (...)
2070  {
2071  YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
2072  // Do not try to display the values of the reclaimed symbols,
2073  // as their printers might throw an exception.
2074  if (!yyla.empty ())
2075  yy_destroy_ (YY_NULLPTR, yyla);
2076 
2077  while (1 < yystack_.size ())
2078  {
2079  yy_destroy_ (YY_NULLPTR, yystack_[0]);
2080  yypop_ ();
2081  }
2082  throw;
2083  }
2084 #endif // YY_EXCEPTIONS
2085  }
2086 
2087  void
2089  {
2090  error (yyexc.location, yyexc.what ());
2091  }
2092 
2093  /* Return YYSTR after stripping away unnecessary quotes and
2094  backslashes, so that it's suitable for yyerror. The heuristic is
2095  that double-quoting is unnecessary unless the string contains an
2096  apostrophe, a comma, or backslash (other than backslash-backslash).
2097  YYSTR is taken from yytname. */
2098  std::string
2099  D2Parser::yytnamerr_ (const char *yystr)
2100  {
2101  if (*yystr == '"')
2102  {
2103  std::string yyr;
2104  char const *yyp = yystr;
2105 
2106  for (;;)
2107  switch (*++yyp)
2108  {
2109  case '\'':
2110  case ',':
2111  goto do_not_strip_quotes;
2112 
2113  case '\\':
2114  if (*++yyp != '\\')
2115  goto do_not_strip_quotes;
2116  else
2117  goto append;
2118 
2119  append:
2120  default:
2121  yyr += *yyp;
2122  break;
2123 
2124  case '"':
2125  return yyr;
2126  }
2127  do_not_strip_quotes: ;
2128  }
2129 
2130  return yystr;
2131  }
2132 
2133  std::string
2135  {
2136  return yytnamerr_ (yytname_[yysymbol]);
2137  }
2138 
2139 
2140 
2141  // D2Parser::context.
2142  D2Parser::context::context (const D2Parser& yyparser, const symbol_type& yyla)
2143  : yyparser_ (yyparser)
2144  , yyla_ (yyla)
2145  {}
2146 
2147  int
2149  {
2150  // Actual number of expected tokens
2151  int yycount = 0;
2152 
2153  int yyn = yypact_[+yyparser_.yystack_[0].state];
2154  if (!yy_pact_value_is_default_ (yyn))
2155  {
2156  /* Start YYX at -YYN if negative to avoid negative indexes in
2157  YYCHECK. In other words, skip the first -YYN actions for
2158  this state because they are default actions. */
2159  int yyxbegin = yyn < 0 ? -yyn : 0;
2160  // Stay within bounds of both yycheck and yytname.
2161  int yychecklim = yylast_ - yyn + 1;
2162  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2163  for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
2164  if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::S_YYerror
2165  && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
2166  {
2167  if (!yyarg)
2168  ++yycount;
2169  else if (yycount == yyargn)
2170  return 0;
2171  else
2172  yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
2173  }
2174  }
2175 
2176  if (yyarg && yycount == 0 && 0 < yyargn)
2177  yyarg[0] = symbol_kind::S_YYEMPTY;
2178  return yycount;
2179  }
2180 
2181 
2182 
2183  int
2184  D2Parser::yy_syntax_error_arguments_ (const context& yyctx,
2185  symbol_kind_type yyarg[], int yyargn) const
2186  {
2187  /* There are many possibilities here to consider:
2188  - If this state is a consistent state with a default action, then
2189  the only way this function was invoked is if the default action
2190  is an error action. In that case, don't check for expected
2191  tokens because there are none.
2192  - The only way there can be no lookahead present (in yyla) is
2193  if this state is a consistent state with a default action.
2194  Thus, detecting the absence of a lookahead is sufficient to
2195  determine that there is no unexpected or expected token to
2196  report. In that case, just report a simple "syntax error".
2197  - Don't assume there isn't a lookahead just because this state is
2198  a consistent state with a default action. There might have
2199  been a previous inconsistent state, consistent state with a
2200  non-default action, or user semantic action that manipulated
2201  yyla. (However, yyla is currently not documented for users.)
2202  - Of course, the expected token list depends on states to have
2203  correct lookahead information, and it depends on the parser not
2204  to perform extra reductions after fetching a lookahead from the
2205  scanner and before detecting a syntax error. Thus, state merging
2206  (from LALR or IELR) and default reductions corrupt the expected
2207  token list. However, the list is correct for canonical LR with
2208  one exception: it will still contain any token that will not be
2209  accepted due to an error action in a later state.
2210  */
2211 
2212  if (!yyctx.lookahead ().empty ())
2213  {
2214  if (yyarg)
2215  yyarg[0] = yyctx.token ();
2216  int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
2217  return yyn + 1;
2218  }
2219  return 0;
2220  }
2221 
2222  // Generate an error message.
2223  std::string
2224  D2Parser::yysyntax_error_ (const context& yyctx) const
2225  {
2226  // Its maximum.
2227  enum { YYARGS_MAX = 5 };
2228  // Arguments of yyformat.
2229  symbol_kind_type yyarg[YYARGS_MAX];
2230  int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
2231 
2232  char const* yyformat = YY_NULLPTR;
2233  switch (yycount)
2234  {
2235 #define YYCASE_(N, S) \
2236  case N: \
2237  yyformat = S; \
2238  break
2239  default: // Avoid compiler warnings.
2240  YYCASE_ (0, YY_("syntax error"));
2241  YYCASE_ (1, YY_("syntax error, unexpected %s"));
2242  YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
2243  YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2244  YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2245  YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2246 #undef YYCASE_
2247  }
2248 
2249  std::string yyres;
2250  // Argument number.
2251  std::ptrdiff_t yyi = 0;
2252  for (char const* yyp = yyformat; *yyp; ++yyp)
2253  if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
2254  {
2255  yyres += symbol_name (yyarg[yyi++]);
2256  ++yyp;
2257  }
2258  else
2259  yyres += *yyp;
2260  return yyres;
2261  }
2262 
2263 
2264  const short D2Parser::yypact_ninf_ = -208;
2265 
2266  const signed char D2Parser::yytable_ninf_ = -1;
2267 
2268  const short
2269  D2Parser::yypact_[] =
2270  {
2271  42, -208, -208, -208, -208, -208, -208, -208, -208, -208,
2272  -208, 45, 8, 0, 41, 49, 67, 55, 80, 95,
2273  124, 114, -208, -208, -208, -208, -208, -208, -208, -208,
2274  -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,
2275  -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,
2276  -208, -208, 8, 65, 120, 7, 23, 125, 50, 131,
2277  20, 133, 14, -208, 142, 128, 158, 159, 147, -208,
2278  160, -208, 162, 165, -208, -208, -208, -208, -208, -208,
2279  -208, -208, -208, -208, 166, -208, 96, -208, -208, -208,
2280  -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,
2281  -208, -208, 167, -208, -208, -208, -208, -208, 97, -208,
2282  -208, -208, -208, -208, -208, 168, 169, -208, -208, -208,
2283  -208, -208, -208, -208, 98, -208, -208, -208, -208, -208,
2284  170, 172, -208, -208, 173, -208, -208, -208, -208, 100,
2285  -208, -208, -208, -208, -208, 27, -208, -208, -208, -208,
2286  108, -208, -208, -208, -208, 8, 8, -208, 121, 175,
2287  -208, 176, 115, 123, 178, 179, 180, 181, 182, 183,
2288  184, 185, 186, 187, -208, 7, -208, 188, 135, 190,
2289  191, 23, -208, 23, -208, 125, 192, 193, 194, 50,
2290  -208, 50, -208, 131, 195, 144, 202, 20, -208, 20,
2291  133, -208, 203, 204, 51, -208, -208, -208, 205, 206,
2292  154, -208, -208, 94, 196, 209, 161, 210, 212, 207,
2293  213, 216, 217, -208, 171, -208, 174, 177, -208, 109,
2294  -208, 189, 218, 200, -208, 110, -208, 201, -208, 208,
2295  -208, 116, -208, 211, 209, -208, 8, 7, -208, -208,
2296  -208, -208, -208, -208, -208, -208, 2, 2, 125, -10,
2297  219, 220, -208, -208, -208, -208, -208, 133, -208, -208,
2298  -208, -208, -208, -208, -208, -208, 143, -208, -208, 146,
2299  -208, -208, -208, 149, 223, -208, -208, -208, -208, -208,
2300  153, -208, -208, -208, -208, 224, 221, -208, -208, 57,
2301  -208, 73, -208, 228, 2, -208, -208, -208, 229, 231,
2302  -10, -208, 14, -208, 219, 16, 220, -208, -208, 232,
2303  -208, 215, 222, -208, 155, -208, -208, -208, 234, -208,
2304  -208, -208, -208, 156, -208, -208, -208, -208, -208, -208,
2305  131, -208, -208, -208, 235, 236, 152, 237, 16, -208,
2306  230, 225, 238, -208, 226, -208, -208, -208, 240, -208,
2307  -208, 117, -208, 38, 240, -208, -208, 241, 245, 246,
2308  -208, 157, -208, -208, -208, -208, -208, -208, -208, 247,
2309  214, 227, 233, 248, 38, -208, 239, -208, -208, -208,
2310  242, -208, -208, -208
2311  };
2312 
2313  const unsigned char
2314  D2Parser::yydefact_[] =
2315  {
2316  0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
2317  20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2318  0, 0, 1, 37, 30, 26, 25, 22, 23, 24,
2319  29, 3, 27, 28, 44, 5, 48, 7, 147, 9,
2320  139, 11, 100, 13, 92, 15, 122, 17, 116, 19,
2321  186, 21, 39, 33, 0, 0, 0, 141, 0, 94,
2322  0, 0, 0, 41, 0, 40, 0, 0, 34, 46,
2323  0, 66, 0, 0, 70, 74, 76, 78, 80, 82,
2324  137, 165, 178, 197, 0, 65, 0, 50, 52, 53,
2325  54, 55, 56, 63, 64, 57, 58, 59, 60, 61,
2326  62, 160, 0, 163, 158, 157, 155, 156, 0, 149,
2327  151, 152, 153, 154, 145, 0, 142, 143, 112, 114,
2328  110, 109, 107, 108, 0, 102, 104, 105, 106, 98,
2329  0, 95, 96, 134, 0, 132, 131, 129, 130, 0,
2330  124, 126, 127, 128, 120, 0, 118, 193, 195, 190,
2331  0, 188, 191, 192, 38, 0, 0, 31, 0, 0,
2332  45, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2333  0, 0, 0, 0, 43, 0, 49, 0, 0, 0,
2334  0, 0, 148, 0, 140, 0, 0, 0, 0, 0,
2335  101, 0, 93, 0, 0, 0, 0, 0, 123, 0,
2336  0, 117, 0, 0, 0, 187, 42, 35, 0, 0,
2337  0, 68, 69, 0, 0, 0, 0, 0, 0, 0,
2338  0, 0, 0, 51, 0, 162, 0, 0, 150, 0,
2339  144, 0, 0, 0, 103, 0, 97, 0, 136, 0,
2340  125, 0, 119, 0, 0, 189, 0, 0, 67, 72,
2341  73, 71, 75, 32, 77, 79, 84, 84, 141, 0,
2342  180, 0, 161, 164, 159, 146, 113, 0, 111, 99,
2343  135, 133, 121, 194, 196, 36, 0, 90, 89, 0,
2344  85, 86, 88, 0, 0, 174, 176, 173, 171, 172,
2345  0, 167, 169, 170, 184, 0, 181, 182, 201, 0,
2346  199, 0, 47, 0, 0, 81, 83, 138, 0, 0,
2347  0, 166, 0, 179, 0, 0, 0, 198, 115, 0,
2348  87, 0, 0, 168, 0, 183, 212, 217, 0, 215,
2349  211, 209, 210, 0, 203, 205, 207, 208, 206, 200,
2350  94, 175, 177, 185, 0, 0, 0, 0, 0, 202,
2351  0, 0, 0, 214, 0, 204, 91, 213, 0, 216,
2352  221, 0, 219, 0, 0, 218, 230, 0, 0, 0,
2353  235, 0, 223, 225, 226, 227, 228, 229, 220, 0,
2354  0, 0, 0, 0, 0, 222, 0, 232, 233, 234,
2355  0, 224, 231, 236
2356  };
2357 
2358  const short
2359  D2Parser::yypgoto_[] =
2360  {
2361  -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,
2362  -208, -208, -41, -208, -207, -208, -19, -208, -208, -208,
2363  -208, -208, -208, -56, -208, -208, -208, -208, -208, -208,
2364  -5, 69, -208, -208, -208, -208, -208, -208, -208, -208,
2365  -208, -55, -208, -44, -208, -208, -208, -208, -208, -4,
2366  -208, -43, -208, -208, -208, -208, -78, -208, 70, -208,
2367  -208, -208, 76, 75, -208, -208, -208, -208, -208, -208,
2368  -208, -208, 3, 77, -208, -208, -208, 74, 72, -208,
2369  -208, -208, -208, -208, -208, -208, -208, -208, 17, -208,
2370  91, -208, -208, -208, 101, 99, -208, -208, -208, -208,
2371  -208, -208, -208, -208, -208, -208, -32, -208, -208, -208,
2372  -208, -208, -208, -208, -208, -33, -208, -208, -208, -26,
2373  83, -208, -208, -208, -208, -208, -208, -208, -28, -208,
2374  -208, -59, -208, -208, -208, -208, -208, -208, -208, -208,
2375  -74, -208, -208, -90, -208, -208, -208, -208, -208, -208,
2376  -208
2377  };
2378 
2379  const short
2380  D2Parser::yydefgoto_[] =
2381  {
2382  0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2383  20, 21, 30, 31, 32, 53, 254, 67, 68, 33,
2384  52, 64, 65, 85, 35, 54, 70, 159, 37, 55,
2385  86, 87, 88, 161, 89, 90, 91, 164, 251, 92,
2386  165, 93, 166, 94, 167, 95, 168, 96, 169, 279,
2387  280, 281, 282, 303, 45, 59, 130, 131, 132, 191,
2388  43, 58, 124, 125, 126, 188, 127, 186, 128, 187,
2389  49, 61, 145, 146, 199, 47, 60, 139, 140, 141,
2390  196, 142, 194, 143, 97, 170, 41, 57, 115, 116,
2391  117, 183, 39, 56, 108, 109, 110, 180, 111, 177,
2392  112, 113, 179, 98, 171, 290, 291, 292, 308, 293,
2393  309, 99, 172, 295, 296, 297, 312, 51, 62, 150,
2394  151, 152, 202, 153, 203, 100, 173, 299, 300, 315,
2395  333, 334, 335, 344, 336, 337, 347, 338, 345, 361,
2396  362, 363, 371, 372, 373, 379, 374, 375, 376, 377,
2397  383
2398  };
2399 
2400  const short
2401  D2Parser::yytable_[] =
2402  {
2403  105, 106, 121, 122, 136, 137, 149, 34, 253, 76,
2404  77, 63, 107, 23, 123, 24, 138, 25, 71, 72,
2405  73, 74, 285, 286, 75, 277, 76, 77, 78, 79,
2406  200, 133, 134, 201, 80, 76, 77, 253, 81, 76,
2407  77, 82, 76, 77, 83, 22, 135, 84, 36, 147,
2408  148, 101, 102, 103, 326, 327, 38, 328, 329, 84,
2409  316, 104, 42, 317, 84, 26, 27, 28, 29, 76,
2410  77, 84, 40, 84, 118, 119, 200, 84, 366, 318,
2411  84, 367, 368, 369, 370, 44, 147, 148, 120, 1,
2412  2, 3, 4, 5, 6, 7, 8, 9, 10, 175,
2413  181, 189, 46, 197, 176, 182, 190, 84, 198, 249,
2414  250, 204, 181, 189, 206, 207, 205, 265, 269, 197,
2415  364, 50, 66, 365, 272, 105, 106, 105, 106, 48,
2416  69, 155, 114, 121, 122, 121, 122, 107, 129, 107,
2417  144, 136, 137, 136, 137, 123, 175, 123, 154, 304,
2418  158, 302, 304, 138, 305, 138, 310, 306, 204, 348,
2419  384, 311, 156, 343, 349, 385, 162, 157, 160, 163,
2420  174, 178, 185, 211, 184, 193, 192, 195, 208, 209,
2421  210, 212, 213, 214, 215, 216, 217, 218, 219, 220,
2422  221, 222, 224, 225, 226, 227, 231, 232, 233, 237,
2423  278, 278, 238, 287, 288, 275, 239, 243, 244, 246,
2424  353, 248, 258, 247, 252, 289, 24, 256, 255, 257,
2425  259, 260, 261, 267, 314, 274, 294, 298, 262, 307,
2426  313, 263, 319, 321, 264, 322, 356, 340, 346, 351,
2427  352, 354, 276, 358, 223, 380, 266, 360, 278, 381,
2428  382, 386, 390, 283, 287, 288, 149, 268, 270, 330,
2429  331, 320, 350, 236, 234, 271, 289, 235, 273, 240,
2430  301, 332, 341, 241, 387, 284, 230, 242, 323, 342,
2431  228, 325, 357, 359, 229, 388, 324, 245, 339, 355,
2432  378, 389, 330, 331, 391, 0, 392, 0, 0, 393,
2433  0, 0, 0, 0, 332
2434  };
2435 
2436  const short
2437  D2Parser::yycheck_[] =
2438  {
2439  56, 56, 58, 58, 60, 60, 62, 7, 215, 19,
2440  20, 52, 56, 5, 58, 7, 60, 9, 11, 12,
2441  13, 14, 32, 33, 17, 23, 19, 20, 21, 22,
2442  3, 11, 12, 6, 27, 19, 20, 244, 31, 19,
2443  20, 34, 19, 20, 37, 0, 26, 57, 7, 35,
2444  36, 28, 29, 30, 38, 39, 7, 41, 42, 57,
2445  3, 38, 7, 6, 57, 57, 58, 59, 60, 19,
2446  20, 57, 5, 57, 24, 25, 3, 57, 40, 6,
2447  57, 43, 44, 45, 46, 5, 35, 36, 38, 47,
2448  48, 49, 50, 51, 52, 53, 54, 55, 56, 3,
2449  3, 3, 7, 3, 8, 8, 8, 57, 8, 15,
2450  16, 3, 3, 3, 155, 156, 8, 8, 8, 3,
2451  3, 7, 57, 6, 8, 181, 181, 183, 183, 5,
2452  10, 3, 7, 189, 189, 191, 191, 181, 7, 183,
2453  7, 197, 197, 199, 199, 189, 3, 191, 6, 3,
2454  3, 8, 3, 197, 8, 199, 3, 8, 3, 3,
2455  3, 8, 4, 8, 8, 8, 4, 8, 8, 4,
2456  4, 4, 3, 58, 6, 3, 6, 4, 57, 4,
2457  4, 58, 4, 4, 4, 4, 4, 4, 4, 4,
2458  4, 4, 4, 58, 4, 4, 4, 4, 4, 4,
2459  256, 257, 58, 259, 259, 246, 4, 4, 4, 4,
2460  58, 57, 5, 7, 18, 259, 7, 7, 57, 7,
2461  7, 5, 5, 5, 3, 244, 7, 7, 57, 6,
2462  6, 57, 4, 4, 57, 4, 6, 5, 4, 4,
2463  4, 4, 247, 5, 175, 4, 57, 7, 304, 4,
2464  4, 4, 4, 257, 310, 310, 312, 57, 57, 315,
2465  315, 304, 340, 193, 189, 57, 310, 191, 57, 197,
2466  267, 315, 57, 199, 60, 258, 185, 200, 310, 57,
2467  181, 314, 57, 57, 183, 58, 312, 204, 316, 348,
2468  364, 58, 348, 348, 384, -1, 57, -1, -1, 57,
2469  -1, -1, -1, -1, 348
2470  };
2471 
2472  const unsigned char
2473  D2Parser::yystos_[] =
2474  {
2475  0, 47, 48, 49, 50, 51, 52, 53, 54, 55,
2476  56, 62, 63, 64, 65, 66, 67, 68, 69, 70,
2477  71, 72, 0, 5, 7, 9, 57, 58, 59, 60,
2478  73, 74, 75, 80, 7, 85, 7, 89, 7, 153,
2479  5, 147, 7, 121, 5, 115, 7, 136, 5, 131,
2480  7, 178, 81, 76, 86, 90, 154, 148, 122, 116,
2481  137, 132, 179, 73, 82, 83, 57, 78, 79, 10,
2482  87, 11, 12, 13, 14, 17, 19, 20, 21, 22,
2483  27, 31, 34, 37, 57, 84, 91, 92, 93, 95,
2484  96, 97, 100, 102, 104, 106, 108, 145, 164, 172,
2485  186, 28, 29, 30, 38, 84, 102, 104, 155, 156,
2486  157, 159, 161, 162, 7, 149, 150, 151, 24, 25,
2487  38, 84, 102, 104, 123, 124, 125, 127, 129, 7,
2488  117, 118, 119, 11, 12, 26, 84, 102, 104, 138,
2489  139, 140, 142, 144, 7, 133, 134, 35, 36, 84,
2490  180, 181, 182, 184, 6, 3, 4, 8, 3, 88,
2491  8, 94, 4, 4, 98, 101, 103, 105, 107, 109,
2492  146, 165, 173, 187, 4, 3, 8, 160, 4, 163,
2493  158, 3, 8, 152, 6, 3, 128, 130, 126, 3,
2494  8, 120, 6, 3, 143, 4, 141, 3, 8, 135,
2495  3, 6, 183, 185, 3, 8, 73, 73, 57, 4,
2496  4, 58, 58, 4, 4, 4, 4, 4, 4, 4,
2497  4, 4, 4, 92, 4, 58, 4, 4, 156, 155,
2498  151, 4, 4, 4, 124, 123, 119, 4, 58, 4,
2499  139, 138, 134, 4, 4, 181, 4, 7, 57, 15,
2500  16, 99, 18, 75, 77, 57, 7, 7, 5, 7,
2501  5, 5, 57, 57, 57, 8, 57, 5, 57, 8,
2502  57, 57, 8, 57, 77, 73, 91, 23, 84, 110,
2503  111, 112, 113, 110, 149, 32, 33, 84, 102, 104,
2504  166, 167, 168, 170, 7, 174, 175, 176, 7, 188,
2505  189, 133, 8, 114, 3, 8, 8, 6, 169, 171,
2506  3, 8, 177, 6, 3, 190, 3, 6, 6, 4,
2507  112, 4, 4, 167, 180, 176, 38, 39, 41, 42,
2508  84, 102, 104, 191, 192, 193, 195, 196, 198, 189,
2509  5, 57, 57, 8, 194, 199, 4, 197, 3, 8,
2510  117, 4, 4, 58, 4, 192, 6, 57, 5, 57,
2511  7, 200, 201, 202, 3, 6, 40, 43, 44, 45,
2512  46, 203, 204, 205, 207, 208, 209, 210, 201, 206,
2513  4, 4, 4, 211, 3, 8, 4, 60, 58, 58,
2514  4, 204, 57, 57
2515  };
2516 
2517  const unsigned char
2518  D2Parser::yyr1_[] =
2519  {
2520  0, 61, 63, 62, 64, 62, 65, 62, 66, 62,
2521  67, 62, 68, 62, 69, 62, 70, 62, 71, 62,
2522  72, 62, 73, 73, 73, 73, 73, 73, 73, 74,
2523  76, 75, 77, 78, 78, 79, 79, 81, 80, 82,
2524  82, 83, 83, 84, 86, 85, 88, 87, 90, 89,
2525  91, 91, 92, 92, 92, 92, 92, 92, 92, 92,
2526  92, 92, 92, 92, 92, 92, 94, 93, 95, 96,
2527  98, 97, 99, 99, 101, 100, 103, 102, 105, 104,
2528  107, 106, 109, 108, 110, 110, 111, 111, 112, 112,
2529  114, 113, 116, 115, 117, 117, 118, 118, 120, 119,
2530  122, 121, 123, 123, 124, 124, 124, 124, 124, 124,
2531  126, 125, 128, 127, 130, 129, 132, 131, 133, 133,
2532  135, 134, 137, 136, 138, 138, 139, 139, 139, 139,
2533  139, 139, 141, 140, 143, 142, 144, 146, 145, 148,
2534  147, 149, 149, 150, 150, 152, 151, 154, 153, 155,
2535  155, 156, 156, 156, 156, 156, 156, 156, 158, 157,
2536  160, 159, 161, 163, 162, 165, 164, 166, 166, 167,
2537  167, 167, 167, 167, 169, 168, 171, 170, 173, 172,
2538  174, 174, 175, 175, 177, 176, 179, 178, 180, 180,
2539  180, 181, 181, 183, 182, 185, 184, 187, 186, 188,
2540  188, 190, 189, 191, 191, 192, 192, 192, 192, 192,
2541  192, 192, 194, 193, 195, 197, 196, 199, 198, 200,
2542  200, 202, 201, 203, 203, 204, 204, 204, 204, 204,
2543  206, 205, 207, 208, 209, 211, 210
2544  };
2545 
2546  const signed char
2547  D2Parser::yyr2_[] =
2548  {
2549  0, 2, 0, 3, 0, 3, 0, 3, 0, 3,
2550  0, 3, 0, 3, 0, 3, 0, 3, 0, 3,
2551  0, 3, 1, 1, 1, 1, 1, 1, 1, 1,
2552  0, 4, 1, 0, 1, 3, 5, 0, 4, 0,
2553  1, 1, 3, 2, 0, 4, 0, 6, 0, 4,
2554  1, 3, 1, 1, 1, 1, 1, 1, 1, 1,
2555  1, 1, 1, 1, 1, 1, 0, 4, 3, 3,
2556  0, 4, 1, 1, 0, 4, 0, 4, 0, 4,
2557  0, 6, 0, 6, 0, 1, 1, 3, 1, 1,
2558  0, 6, 0, 4, 0, 1, 1, 3, 0, 4,
2559  0, 4, 1, 3, 1, 1, 1, 1, 1, 1,
2560  0, 4, 0, 4, 0, 6, 0, 4, 1, 3,
2561  0, 4, 0, 4, 1, 3, 1, 1, 1, 1,
2562  1, 1, 0, 4, 0, 4, 3, 0, 6, 0,
2563  4, 0, 1, 1, 3, 0, 4, 0, 4, 1,
2564  3, 1, 1, 1, 1, 1, 1, 1, 0, 4,
2565  0, 4, 3, 0, 4, 0, 6, 1, 3, 1,
2566  1, 1, 1, 1, 0, 4, 0, 4, 0, 6,
2567  0, 1, 1, 3, 0, 4, 0, 4, 1, 3,
2568  1, 1, 1, 0, 4, 0, 4, 0, 6, 1,
2569  3, 0, 4, 1, 3, 1, 1, 1, 1, 1,
2570  1, 1, 0, 4, 3, 0, 4, 0, 6, 1,
2571  3, 0, 4, 1, 3, 1, 1, 1, 1, 1,
2572  0, 4, 3, 3, 3, 0, 4
2573  };
2574 
2575 
2576 #if D2_PARSER_DEBUG || 1
2577  // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
2578  // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
2579  const char*
2580  const D2Parser::yytname_[] =
2581  {
2582  "\"end of file\"", "error", "\"invalid token\"", "\",\"", "\":\"",
2583  "\"[\"", "\"]\"", "\"{\"", "\"}\"", "\"null\"", "\"DhcpDdns\"",
2584  "\"ip-address\"", "\"port\"", "\"dns-server-timeout\"",
2585  "\"ncr-protocol\"", "\"UDP\"", "\"TCP\"", "\"ncr-format\"", "\"JSON\"",
2586  "\"user-context\"", "\"comment\"", "\"forward-ddns\"",
2587  "\"reverse-ddns\"", "\"ddns-domains\"", "\"key-name\"",
2588  "\"dns-servers\"", "\"hostname\"", "\"tsig-keys\"", "\"algorithm\"",
2589  "\"digest-bits\"", "\"secret\"", "\"control-socket\"", "\"socket-type\"",
2590  "\"socket-name\"", "\"hooks-libraries\"", "\"library\"",
2591  "\"parameters\"", "\"loggers\"", "\"name\"", "\"output_options\"",
2592  "\"output\"", "\"debuglevel\"", "\"severity\"", "\"flush\"",
2593  "\"maxsize\"", "\"maxver\"", "\"pattern\"", "TOPLEVEL_JSON",
2594  "TOPLEVEL_DHCPDDNS", "SUB_DHCPDDNS", "SUB_TSIG_KEY", "SUB_TSIG_KEYS",
2595  "SUB_DDNS_DOMAIN", "SUB_DDNS_DOMAINS", "SUB_DNS_SERVER",
2596  "SUB_DNS_SERVERS", "SUB_HOOKS_LIBRARY", "\"constant string\"",
2597  "\"integer\"", "\"floating point\"", "\"boolean\"", "$accept", "start",
2598  "$@1", "$@2", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8", "$@9", "$@10",
2599  "value", "sub_json", "map2", "$@11", "map_value", "map_content",
2600  "not_empty_map", "list_generic", "$@12", "list_content",
2601  "not_empty_list", "unknown_map_entry", "syntax_map", "$@13",
2602  "global_object", "$@14", "sub_dhcpddns", "$@15", "dhcpddns_params",
2603  "dhcpddns_param", "ip_address", "$@16", "port", "dns_server_timeout",
2604  "ncr_protocol", "$@17", "ncr_protocol_value", "ncr_format", "$@18",
2605  "user_context", "$@19", "comment", "$@20", "forward_ddns", "$@21",
2606  "reverse_ddns", "$@22", "ddns_mgr_params", "not_empty_ddns_mgr_params",
2607  "ddns_mgr_param", "ddns_domains", "$@23", "sub_ddns_domains", "$@24",
2608  "ddns_domain_list", "not_empty_ddns_domain_list", "ddns_domain", "$@25",
2609  "sub_ddns_domain", "$@26", "ddns_domain_params", "ddns_domain_param",
2610  "ddns_domain_name", "$@27", "ddns_domain_key_name", "$@28",
2611  "dns_servers", "$@29", "sub_dns_servers", "$@30", "dns_server_list",
2612  "dns_server", "$@31", "sub_dns_server", "$@32", "dns_server_params",
2613  "dns_server_param", "dns_server_hostname", "$@33",
2614  "dns_server_ip_address", "$@34", "dns_server_port", "tsig_keys", "$@35",
2615  "sub_tsig_keys", "$@36", "tsig_keys_list", "not_empty_tsig_keys_list",
2616  "tsig_key", "$@37", "sub_tsig_key", "$@38", "tsig_key_params",
2617  "tsig_key_param", "tsig_key_name", "$@39", "tsig_key_algorithm", "$@40",
2618  "tsig_key_digest_bits", "tsig_key_secret", "$@41", "control_socket",
2619  "$@42", "control_socket_params", "control_socket_param",
2620  "control_socket_type", "$@43", "control_socket_name", "$@44",
2621  "hooks_libraries", "$@45", "hooks_libraries_list",
2622  "not_empty_hooks_libraries_list", "hooks_library", "$@46",
2623  "sub_hooks_library", "$@47", "hooks_params", "hooks_param", "library",
2624  "$@48", "parameters", "$@49", "loggers", "$@50", "loggers_entries",
2625  "logger_entry", "$@51", "logger_params", "logger_param", "name", "$@52",
2626  "debuglevel", "severity", "$@53", "output_options_list", "$@54",
2627  "output_options_list_content", "output_entry", "$@55",
2628  "output_params_list", "output_params", "output", "$@56", "flush",
2629  "maxsize", "maxver", "pattern", "$@57", YY_NULLPTR
2630  };
2631 #endif
2632 
2633 
2634 #if D2_PARSER_DEBUG
2635  const short
2636  D2Parser::yyrline_[] =
2637  {
2638  0, 125, 125, 125, 126, 126, 127, 127, 128, 128,
2639  129, 129, 130, 130, 131, 131, 132, 132, 133, 133,
2640  134, 134, 142, 143, 144, 145, 146, 147, 148, 151,
2641  156, 156, 167, 170, 171, 174, 179, 187, 187, 194,
2642  195, 198, 202, 213, 222, 222, 235, 235, 246, 246,
2643  254, 255, 259, 260, 261, 262, 263, 264, 265, 266,
2644  267, 268, 269, 270, 271, 272, 275, 275, 284, 293,
2645  303, 303, 312, 313, 316, 316, 325, 325, 350, 350,
2646  377, 377, 388, 388, 399, 400, 403, 404, 407, 408,
2647  413, 413, 424, 424, 431, 432, 435, 436, 439, 439,
2648  447, 447, 454, 455, 458, 459, 460, 461, 462, 463,
2649  467, 467, 480, 480, 493, 493, 504, 504, 511, 512,
2650  515, 515, 523, 523, 530, 531, 534, 535, 536, 537,
2651  538, 539, 542, 542, 555, 555, 564, 579, 579, 590,
2652  590, 597, 598, 601, 602, 605, 605, 613, 613, 622,
2653  623, 626, 627, 628, 629, 630, 631, 632, 635, 635,
2654  648, 648, 660, 669, 669, 686, 686, 697, 698, 701,
2655  702, 703, 704, 705, 708, 708, 717, 717, 728, 728,
2656  739, 740, 743, 744, 747, 747, 757, 757, 767, 768,
2657  769, 772, 773, 776, 776, 785, 785, 795, 795, 808,
2658  809, 813, 813, 821, 822, 825, 826, 827, 828, 829,
2659  830, 831, 834, 834, 843, 849, 849, 858, 858, 869,
2660  870, 873, 873, 881, 882, 885, 886, 887, 888, 889,
2661  892, 892, 901, 907, 913, 919, 919
2662  };
2663 
2664  void
2665  D2Parser::yy_stack_print_ () const
2666  {
2667  *yycdebug_ << "Stack now";
2668  for (stack_type::const_iterator
2669  i = yystack_.begin (),
2670  i_end = yystack_.end ();
2671  i != i_end; ++i)
2672  *yycdebug_ << ' ' << int (i->state);
2673  *yycdebug_ << '\n';
2674  }
2675 
2676  void
2677  D2Parser::yy_reduce_print_ (int yyrule) const
2678  {
2679  int yylno = yyrline_[yyrule];
2680  int yynrhs = yyr2_[yyrule];
2681  // Print the symbols being reduced, and their result.
2682  *yycdebug_ << "Reducing stack by rule " << yyrule - 1
2683  << " (line " << yylno << "):\n";
2684  // The symbols being reduced.
2685  for (int yyi = 0; yyi < yynrhs; yyi++)
2686  YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
2687  yystack_[(yynrhs) - (yyi + 1)]);
2688  }
2689 #endif // D2_PARSER_DEBUG
2690 
2691 
2692 #line 14 "d2_parser.yy"
2693 } } // isc::d2
2694 #line 2695 "d2_parser.cc"
2695 
2696 #line 928 "d2_parser.yy"
2697 
2698 
2699 void
2701  const std::string& what)
2702 {
2703  ctx.error(loc, what);
2704 }
Used while parsing a list of tsig-keys.
A Bison parser.
Definition: d2_parser.h:209
Define the isc::d2::parser class.
#define yylex
Definition: d2_parser.cc:39
symbol_kind::symbol_kind_type symbol_kind_type
(Internal) symbol kind.
Definition: d2_parser.h:776
int expected_tokens(symbol_kind_type yyarg[], int yyargn) const
Put in YYARG at most YYARGN of the expected tokens, and return the number of tokens stored in YYARG...
Definition: d2_parser.cc:2148
Used while parsing DhcpDdns/loggers/output_options structures.
Syntax errors thrown from user actions.
Definition: d2_parser.h:458
Used while parsing content of a dns-server.
virtual int parse()
Parse.
Definition: d2_parser.cc:511
Used while parsing content of DhcpDdns/tsig-keys/algorithm.
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: d2_parser.cc:476
Evaluation context, an interface to the expression evaluation.
#define YY_CAST(Type, Val)
Definition: agent_parser.h:171
symbol_kind_type kind() const YY_NOEXCEPT
The (internal) type number (corresponding to type).
Definition: d2_parser.h:2593
This one is used in pure JSON mode.
D2Parser(isc::d2::D2ParserContext &ctx_yyarg)
Build a parser object.
Definition: d2_parser.cc:147
void require(const std::string &name, isc::data::Element::Position open_loc, isc::data::Element::Position close_loc)
Check if a required parameter is present.
int debug_level_type
Type for debugging levels.
Definition: d2_parser.h:1132
#define YY_MOVE_REF(Type)
Definition: agent_parser.h:84
#define YY_STACK_PRINT()
Definition: d2_parser.cc:119
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
Used while parsing content of a tsig-key.
~syntax_error() YY_NOEXCEPT YY_NOTHROW
Definition: d2_parser.cc:160
"External" symbols: returned by the scanner.
Definition: d2_parser.h:1044
#define YY_RVREF(Type)
Definition: agent_parser.h:85
#define YY_MOVE
Definition: agent_parser.h:82
Used while parsing DhcpDdns/loggers structures.
void unique(const std::string &name, isc::data::Element::Position loc)
Check if a parameter is already present.
#define YY_REDUCE_PRINT(Rule)
Definition: d2_parser.cc:113
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: d2_parser.cc:463
debug_level_type debug_level() const YY_ATTRIBUTE_PURE
The current debugging level.
Definition: d2_parser.cc:470
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: d2_parser.h:2517
std::ostream & debug_stream() const YY_ATTRIBUTE_PURE
The current debugging stream.
Definition: d2_parser.cc:457
Used while parsing content of a ddns-domain.
Used while parsing DhcpDdns/hooks-libraries.
#define YYERROR
Definition: d2_parser.cc:139
Used while parsing content of DhcpDdns/reverse-ddns.
void leave()
Leave a syntactic context.
Used while parsing content of a control-socket.
Used while parsing DhcpDdns/ncr-protocol.
#define YY_SYMBOL_PRINT(Title, Symbol)
Definition: d2_parser.cc:103
Notes: IntElement type is changed to int64_t.
Definition: data.h:544
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: d2_parser.cc:82
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
bool empty() const YY_NOEXCEPT
Whether empty.
Definition: d2_parser.h:2510
Used while parsing DhcpDdns/ncr-format.
#define YYCDEBUG
Definition: d2_parser.cc:101
#define YYCASE_(N, S)
#define YY_NOTHROW
Definition: agent_parser.h:95
Defines the logger used by the top-level component of kea-dhcp-ddns.
#define YY_(msgid)
Definition: d2_parser.cc:62
void enter(const ParserContext &ctx)
Enter a new syntactic context.
const symbol_type & lookahead() const YY_NOEXCEPT
Definition: d2_parser.h:2073
Used while parsing content of DhcpDdns.
void merge(ElementPtr element, ConstElementPtr other)
Merges the data from other into element.
Definition: data.cc:1079
#define YY_USE(E)
Definition: agent_parser.h:130
symbol_kind_type kind_
The symbol kind.
Definition: d2_parser.h:1037
static const symbol_kind_type YYNTOKENS
The number of tokens.
Definition: d2_parser.h:779
Used while parsing a list of ddns-domains.
std::vector< isc::data::ElementPtr > stack_
JSON elements being parsed.
symbol_kind_type token() const YY_NOEXCEPT
Definition: d2_parser.h:2074
void clear() YY_NOEXCEPT
Destroy contents, and record that is empty.
Definition: d2_parser.h:930
#define YYACCEPT
Definition: d2_parser.cc:137
int operator()()
Parse.
Definition: d2_parser.cc:505
#define YY_NOEXCEPT
Definition: agent_parser.h:94
#define YYABORT
Definition: d2_parser.cc:138
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: d2_parser.cc:2700
context(const D2Parser &yyparser, const symbol_type &yyla)
Definition: d2_parser.cc:2142
ParserContext ctx_
Current syntactic context.
static std::string symbol_name(symbol_kind_type yysymbol)
The user-facing name of the symbol whose (internal) number is YYSYMBOL.
Definition: d2_parser.cc:2134
location_type location
The location.
Definition: d2_parser.h:993
isc::data::Element::Position loc2pos(isc::d2::location &loc)
Converts bison's position to one understood by isc::data::Element.
virtual ~D2Parser()
Definition: d2_parser.cc:157
location location_type
Symbol locations.
Definition: d2_parser.h:455
const std::string contextName()
Get the syntax context name.