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