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