Kea 2.5.6
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 121 "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 121 "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 121 "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 121 "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 121 "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 121 "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 121 "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 130 "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 131 "d2_parser.yy"
704 { ctx.ctx_ = ctx.CONFIG; }
705#line 706 "d2_parser.cc"
706 break;
707
708 case 6: // $@3: %empty
709#line 132 "d2_parser.yy"
710 { ctx.ctx_ = ctx.DHCPDDNS; }
711#line 712 "d2_parser.cc"
712 break;
713
714 case 8: // $@4: %empty
715#line 133 "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 134 "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 135 "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 136 "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 137 "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 138 "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 139 "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 147 "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 148 "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 149 "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 150 "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 151 "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 152 "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 153 "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 156 "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 161 "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 166 "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 172 "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 179 "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 184 "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 190 "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 195 "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 198 "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 206 "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 210 "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 214 "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 224 "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 233 "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 238 "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 246 "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 252 "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 259 "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 263 "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 267 "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 273 "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 295 "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 298 "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 304 "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 313 "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 323 "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 326 "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 332 "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 333 "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 336 "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 339 "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 345 "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 347 "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 370 "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 372 "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 397 "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 403 "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 408 "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 414 "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 425 "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 436 "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 442 "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 447 "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 450 "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 460 "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 465 "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 469 "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 473 "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 476 "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 482 "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 496 "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 499 "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 509 "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 512 "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 522 "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 528 "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 533 "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 536 "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 542 "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 547 "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 551 "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 555 "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 558 "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 564 "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 578 "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 581 "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 591 "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 594 "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 600 "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 615 "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 621 "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 626 "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 629 "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 639 "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 644 "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 648 "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 652 "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 656 "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 663 "d2_parser.yy"
1570 {
1571 ctx.warnAboutExtraCommas(yystack_[0].location);
1572 }
1573#line 1574 "d2_parser.cc"
1574 break;
1575
1576 case 171: // $@39: %empty
1577#line 677 "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 172: // tsig_key_name: "name" $@39 ":" "constant string"
1586#line 680 "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 173: // $@40: %empty
1600#line 690 "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 174: // tsig_key_algorithm: "algorithm" $@40 ":" "constant string"
1609#line 693 "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 175: // tsig_key_digest_bits: "digest-bits" ":" "integer"
1622#line 702 "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 176: // $@41: %empty
1635#line 711 "d2_parser.yy"
1636 {
1637 ctx.unique("secret", ctx.loc2pos(yystack_[0].location));
1638 ctx.enter(ctx.NO_KEYWORD);
1639}
1640#line 1641 "d2_parser.cc"
1641 break;
1642
1643 case 177: // tsig_key_secret: "secret" $@41 ":" "constant string"
1644#line 714 "d2_parser.yy"
1645 {
1646 if (yystack_[0].value.as < std::string > () == "") {
1647 error(yystack_[1].location, "TSIG key secret cannot be blank");
1648 }
1649 ElementPtr elem(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1650 ctx.stack_.back()->set("secret", elem);
1651 ctx.leave();
1652}
1653#line 1654 "d2_parser.cc"
1654 break;
1655
1656 case 178: // $@42: %empty
1657#line 728 "d2_parser.yy"
1658 {
1659 ctx.unique("control-socket", ctx.loc2pos(yystack_[0].location));
1660 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1661 ctx.stack_.back()->set("control-socket", m);
1662 ctx.stack_.push_back(m);
1663 ctx.enter(ctx.CONTROL_SOCKET);
1664}
1665#line 1666 "d2_parser.cc"
1666 break;
1667
1668 case 179: // control_socket: "control-socket" $@42 ":" "{" control_socket_params "}"
1669#line 734 "d2_parser.yy"
1670 {
1671 ctx.stack_.pop_back();
1672 ctx.leave();
1673}
1674#line 1675 "d2_parser.cc"
1675 break;
1676
1677 case 182: // control_socket_params: control_socket_params ","
1678#line 741 "d2_parser.yy"
1679 {
1680 ctx.warnAboutExtraCommas(yystack_[0].location);
1681 }
1682#line 1683 "d2_parser.cc"
1683 break;
1684
1685 case 188: // $@43: %empty
1686#line 753 "d2_parser.yy"
1687 {
1688 ctx.unique("socket-type", ctx.loc2pos(yystack_[0].location));
1689 ctx.enter(ctx.NO_KEYWORD);
1690}
1691#line 1692 "d2_parser.cc"
1692 break;
1693
1694 case 189: // control_socket_type: "socket-type" $@43 ":" "constant string"
1695#line 756 "d2_parser.yy"
1696 {
1697 ElementPtr stype(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1698 ctx.stack_.back()->set("socket-type", stype);
1699 ctx.leave();
1700}
1701#line 1702 "d2_parser.cc"
1702 break;
1703
1704 case 190: // $@44: %empty
1705#line 762 "d2_parser.yy"
1706 {
1707 ctx.unique("socket-name", ctx.loc2pos(yystack_[0].location));
1708 ctx.enter(ctx.NO_KEYWORD);
1709}
1710#line 1711 "d2_parser.cc"
1711 break;
1712
1713 case 191: // control_socket_name: "socket-name" $@44 ":" "constant string"
1714#line 765 "d2_parser.yy"
1715 {
1716 ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1717 ctx.stack_.back()->set("socket-name", name);
1718 ctx.leave();
1719}
1720#line 1721 "d2_parser.cc"
1721 break;
1722
1723 case 192: // $@45: %empty
1724#line 773 "d2_parser.yy"
1725 {
1726 ctx.unique("hooks-libraries", ctx.loc2pos(yystack_[0].location));
1727 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1728 ctx.stack_.back()->set("hooks-libraries", l);
1729 ctx.stack_.push_back(l);
1730 ctx.enter(ctx.HOOKS_LIBRARIES);
1731}
1732#line 1733 "d2_parser.cc"
1733 break;
1734
1735 case 193: // hooks_libraries: "hooks-libraries" $@45 ":" "[" hooks_libraries_list "]"
1736#line 779 "d2_parser.yy"
1737 {
1738 ctx.stack_.pop_back();
1739 ctx.leave();
1740}
1741#line 1742 "d2_parser.cc"
1742 break;
1743
1744 case 198: // not_empty_hooks_libraries_list: not_empty_hooks_libraries_list ","
1745#line 790 "d2_parser.yy"
1746 {
1747 ctx.warnAboutExtraCommas(yystack_[0].location);
1748 }
1749#line 1750 "d2_parser.cc"
1750 break;
1751
1752 case 199: // $@46: %empty
1753#line 795 "d2_parser.yy"
1754 {
1755 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1756 ctx.stack_.back()->add(m);
1757 ctx.stack_.push_back(m);
1758}
1759#line 1760 "d2_parser.cc"
1760 break;
1761
1762 case 200: // hooks_library: "{" $@46 hooks_params "}"
1763#line 799 "d2_parser.yy"
1764 {
1765 // The library hooks parameter is required
1766 ctx.require("library", ctx.loc2pos(yystack_[3].location), ctx.loc2pos(yystack_[0].location));
1767 ctx.stack_.pop_back();
1768}
1769#line 1770 "d2_parser.cc"
1770 break;
1771
1772 case 201: // $@47: %empty
1773#line 805 "d2_parser.yy"
1774 {
1775 // Parse the hooks-libraries list entry map
1776 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1777 ctx.stack_.push_back(m);
1778}
1779#line 1780 "d2_parser.cc"
1780 break;
1781
1782 case 202: // sub_hooks_library: "{" $@47 hooks_params "}"
1783#line 809 "d2_parser.yy"
1784 {
1785 // The library hooks parameter is required
1786 ctx.require("library", ctx.loc2pos(yystack_[3].location), ctx.loc2pos(yystack_[0].location));
1787 // parsing completed
1788}
1789#line 1790 "d2_parser.cc"
1790 break;
1791
1792 case 205: // hooks_params: hooks_params ","
1793#line 817 "d2_parser.yy"
1794 {
1795 ctx.warnAboutExtraCommas(yystack_[0].location);
1796 }
1797#line 1798 "d2_parser.cc"
1798 break;
1799
1800 case 209: // $@48: %empty
1801#line 827 "d2_parser.yy"
1802 {
1803 ctx.unique("library", ctx.loc2pos(yystack_[0].location));
1804 ctx.enter(ctx.NO_KEYWORD);
1805}
1806#line 1807 "d2_parser.cc"
1807 break;
1808
1809 case 210: // library: "library" $@48 ":" "constant string"
1810#line 830 "d2_parser.yy"
1811 {
1812 ElementPtr lib(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1813 ctx.stack_.back()->set("library", lib);
1814 ctx.leave();
1815}
1816#line 1817 "d2_parser.cc"
1817 break;
1818
1819 case 211: // $@49: %empty
1820#line 836 "d2_parser.yy"
1821 {
1822 ctx.unique("parameters", ctx.loc2pos(yystack_[0].location));
1823 ctx.enter(ctx.NO_KEYWORD);
1824}
1825#line 1826 "d2_parser.cc"
1826 break;
1827
1828 case 212: // parameters: "parameters" $@49 ":" map_value
1829#line 839 "d2_parser.yy"
1830 {
1831 ctx.stack_.back()->set("parameters", yystack_[0].value.as < ElementPtr > ());
1832 ctx.leave();
1833}
1834#line 1835 "d2_parser.cc"
1835 break;
1836
1837 case 213: // $@50: %empty
1838#line 846 "d2_parser.yy"
1839 {
1840 ctx.unique("loggers", ctx.loc2pos(yystack_[0].location));
1841 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1842 ctx.stack_.back()->set("loggers", l);
1843 ctx.stack_.push_back(l);
1844 ctx.enter(ctx.LOGGERS);
1845}
1846#line 1847 "d2_parser.cc"
1847 break;
1848
1849 case 214: // loggers: "loggers" $@50 ":" "[" loggers_entries "]"
1850#line 852 "d2_parser.yy"
1851 {
1852 ctx.stack_.pop_back();
1853 ctx.leave();
1854}
1855#line 1856 "d2_parser.cc"
1856 break;
1857
1858 case 217: // loggers_entries: loggers_entries ","
1859#line 861 "d2_parser.yy"
1860 {
1861 ctx.warnAboutExtraCommas(yystack_[0].location);
1862 }
1863#line 1864 "d2_parser.cc"
1864 break;
1865
1866 case 218: // $@51: %empty
1867#line 867 "d2_parser.yy"
1868 {
1869 ElementPtr l(new MapElement(ctx.loc2pos(yystack_[0].location)));
1870 ctx.stack_.back()->add(l);
1871 ctx.stack_.push_back(l);
1872}
1873#line 1874 "d2_parser.cc"
1874 break;
1875
1876 case 219: // logger_entry: "{" $@51 logger_params "}"
1877#line 871 "d2_parser.yy"
1878 {
1879 ctx.stack_.pop_back();
1880}
1881#line 1882 "d2_parser.cc"
1882 break;
1883
1884 case 222: // logger_params: logger_params ","
1885#line 877 "d2_parser.yy"
1886 {
1887 ctx.warnAboutExtraCommas(yystack_[0].location);
1888 }
1889#line 1890 "d2_parser.cc"
1890 break;
1891
1892 case 230: // $@52: %empty
1893#line 891 "d2_parser.yy"
1894 {
1895 ctx.unique("name", ctx.loc2pos(yystack_[0].location));
1896 ctx.enter(ctx.NO_KEYWORD);
1897}
1898#line 1899 "d2_parser.cc"
1899 break;
1900
1901 case 231: // name: "name" $@52 ":" "constant string"
1902#line 894 "d2_parser.yy"
1903 {
1904 ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1905 ctx.stack_.back()->set("name", name);
1906 ctx.leave();
1907}
1908#line 1909 "d2_parser.cc"
1909 break;
1910
1911 case 232: // debuglevel: "debuglevel" ":" "integer"
1912#line 900 "d2_parser.yy"
1913 {
1914 ctx.unique("debuglevel", ctx.loc2pos(yystack_[2].location));
1915 ElementPtr dl(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
1916 ctx.stack_.back()->set("debuglevel", dl);
1917}
1918#line 1919 "d2_parser.cc"
1919 break;
1920
1921 case 233: // $@53: %empty
1922#line 906 "d2_parser.yy"
1923 {
1924 ctx.unique("severity", ctx.loc2pos(yystack_[0].location));
1925 ctx.enter(ctx.NO_KEYWORD);
1926}
1927#line 1928 "d2_parser.cc"
1928 break;
1929
1930 case 234: // severity: "severity" $@53 ":" "constant string"
1931#line 909 "d2_parser.yy"
1932 {
1933 ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1934 ctx.stack_.back()->set("severity", sev);
1935 ctx.leave();
1936}
1937#line 1938 "d2_parser.cc"
1938 break;
1939
1940 case 235: // $@54: %empty
1941#line 915 "d2_parser.yy"
1942 {
1943 ctx.unique("output-options", ctx.loc2pos(yystack_[0].location));
1944 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1945 ctx.stack_.back()->set("output-options", l);
1946 ctx.stack_.push_back(l);
1947 ctx.enter(ctx.OUTPUT_OPTIONS);
1948}
1949#line 1950 "d2_parser.cc"
1950 break;
1951
1952 case 236: // output_options_list: "output-options" $@54 ":" "[" output_options_list_content "]"
1953#line 921 "d2_parser.yy"
1954 {
1955 ctx.stack_.pop_back();
1956 ctx.leave();
1957}
1958#line 1959 "d2_parser.cc"
1959 break;
1960
1961 case 239: // output_options_list_content: output_options_list_content ","
1962#line 928 "d2_parser.yy"
1963 {
1964 ctx.warnAboutExtraCommas(yystack_[0].location);
1965 }
1966#line 1967 "d2_parser.cc"
1967 break;
1968
1969 case 240: // $@55: %empty
1970#line 933 "d2_parser.yy"
1971 {
1972 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1973 ctx.stack_.back()->add(m);
1974 ctx.stack_.push_back(m);
1975}
1976#line 1977 "d2_parser.cc"
1977 break;
1978
1979 case 241: // output_entry: "{" $@55 output_params_list "}"
1980#line 937 "d2_parser.yy"
1981 {
1982 ctx.stack_.pop_back();
1983}
1984#line 1985 "d2_parser.cc"
1985 break;
1986
1987 case 244: // output_params_list: output_params_list ","
1988#line 943 "d2_parser.yy"
1989 {
1990 ctx.warnAboutExtraCommas(yystack_[0].location);
1991 }
1992#line 1993 "d2_parser.cc"
1993 break;
1994
1995 case 250: // $@56: %empty
1996#line 955 "d2_parser.yy"
1997 {
1998 ctx.unique("output", ctx.loc2pos(yystack_[0].location));
1999 ctx.enter(ctx.NO_KEYWORD);
2000}
2001#line 2002 "d2_parser.cc"
2002 break;
2003
2004 case 251: // output: "output" $@56 ":" "constant string"
2005#line 958 "d2_parser.yy"
2006 {
2007 ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2008 ctx.stack_.back()->set("output", sev);
2009 ctx.leave();
2010}
2011#line 2012 "d2_parser.cc"
2012 break;
2013
2014 case 252: // flush: "flush" ":" "boolean"
2015#line 964 "d2_parser.yy"
2016 {
2017 ctx.unique("flush", ctx.loc2pos(yystack_[2].location));
2018 ElementPtr flush(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
2019 ctx.stack_.back()->set("flush", flush);
2020}
2021#line 2022 "d2_parser.cc"
2022 break;
2023
2024 case 253: // maxsize: "maxsize" ":" "integer"
2025#line 970 "d2_parser.yy"
2026 {
2027 ctx.unique("maxsize", ctx.loc2pos(yystack_[2].location));
2028 ElementPtr maxsize(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
2029 ctx.stack_.back()->set("maxsize", maxsize);
2030}
2031#line 2032 "d2_parser.cc"
2032 break;
2033
2034 case 254: // maxver: "maxver" ":" "integer"
2035#line 976 "d2_parser.yy"
2036 {
2037 ctx.unique("maxver", ctx.loc2pos(yystack_[2].location));
2038 ElementPtr maxver(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
2039 ctx.stack_.back()->set("maxver", maxver);
2040}
2041#line 2042 "d2_parser.cc"
2042 break;
2043
2044 case 255: // $@57: %empty
2045#line 982 "d2_parser.yy"
2046 {
2047 ctx.unique("pattern", ctx.loc2pos(yystack_[0].location));
2048 ctx.enter(ctx.NO_KEYWORD);
2049}
2050#line 2051 "d2_parser.cc"
2051 break;
2052
2053 case 256: // pattern: "pattern" $@57 ":" "constant string"
2054#line 985 "d2_parser.yy"
2055 {
2056 ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2057 ctx.stack_.back()->set("pattern", sev);
2058 ctx.leave();
2059}
2060#line 2061 "d2_parser.cc"
2061 break;
2062
2063
2064#line 2065 "d2_parser.cc"
2065
2066 default:
2067 break;
2068 }
2069 }
2070#if YY_EXCEPTIONS
2071 catch (const syntax_error& yyexc)
2072 {
2073 YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
2074 error (yyexc);
2075 YYERROR;
2076 }
2077#endif // YY_EXCEPTIONS
2078 YY_SYMBOL_PRINT ("-> $$ =", yylhs);
2079 yypop_ (yylen);
2080 yylen = 0;
2081
2082 // Shift the result of the reduction.
2083 yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
2084 }
2085 goto yynewstate;
2086
2087
2088 /*--------------------------------------.
2089 | yyerrlab -- here on detecting error. |
2090 `--------------------------------------*/
2091 yyerrlab:
2092 // If not already recovering from an error, report this error.
2093 if (!yyerrstatus_)
2094 {
2095 ++yynerrs_;
2096 context yyctx (*this, yyla);
2097 std::string msg = yysyntax_error_ (yyctx);
2098 error (yyla.location, YY_MOVE (msg));
2099 }
2100
2101
2102 yyerror_range[1].location = yyla.location;
2103 if (yyerrstatus_ == 3)
2104 {
2105 /* If just tried and failed to reuse lookahead token after an
2106 error, discard it. */
2107
2108 // Return failure if at end of input.
2109 if (yyla.kind () == symbol_kind::S_YYEOF)
2110 YYABORT;
2111 else if (!yyla.empty ())
2112 {
2113 yy_destroy_ ("Error: discarding", yyla);
2114 yyla.clear ();
2115 }
2116 }
2117
2118 // Else will try to reuse lookahead token after shifting the error token.
2119 goto yyerrlab1;
2120
2121
2122 /*---------------------------------------------------.
2123 | yyerrorlab -- error raised explicitly by YYERROR. |
2124 `---------------------------------------------------*/
2125 yyerrorlab:
2126 /* Pacify compilers when the user code never invokes YYERROR and
2127 the label yyerrorlab therefore never appears in user code. */
2128 if (false)
2129 YYERROR;
2130
2131 /* Do not reclaim the symbols of the rule whose action triggered
2132 this YYERROR. */
2133 yypop_ (yylen);
2134 yylen = 0;
2135 YY_STACK_PRINT ();
2136 goto yyerrlab1;
2137
2138
2139 /*-------------------------------------------------------------.
2140 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2141 `-------------------------------------------------------------*/
2142 yyerrlab1:
2143 yyerrstatus_ = 3; // Each real token shifted decrements this.
2144 // Pop stack until we find a state that shifts the error token.
2145 for (;;)
2146 {
2147 yyn = yypact_[+yystack_[0].state];
2148 if (!yy_pact_value_is_default_ (yyn))
2149 {
2151 if (0 <= yyn && yyn <= yylast_
2152 && yycheck_[yyn] == symbol_kind::S_YYerror)
2153 {
2154 yyn = yytable_[yyn];
2155 if (0 < yyn)
2156 break;
2157 }
2158 }
2159
2160 // Pop the current state because it cannot handle the error token.
2161 if (yystack_.size () == 1)
2162 YYABORT;
2163
2164 yyerror_range[1].location = yystack_[0].location;
2165 yy_destroy_ ("Error: popping", yystack_[0]);
2166 yypop_ ();
2167 YY_STACK_PRINT ();
2168 }
2169 {
2170 stack_symbol_type error_token;
2171
2172 yyerror_range[2].location = yyla.location;
2173 YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);
2174
2175 // Shift the error token.
2176 error_token.state = state_type (yyn);
2177 yypush_ ("Shifting", YY_MOVE (error_token));
2178 }
2179 goto yynewstate;
2180
2181
2182 /*-------------------------------------.
2183 | yyacceptlab -- YYACCEPT comes here. |
2184 `-------------------------------------*/
2185 yyacceptlab:
2186 yyresult = 0;
2187 goto yyreturn;
2188
2189
2190 /*-----------------------------------.
2191 | yyabortlab -- YYABORT comes here. |
2192 `-----------------------------------*/
2193 yyabortlab:
2194 yyresult = 1;
2195 goto yyreturn;
2196
2197
2198 /*-----------------------------------------------------.
2199 | yyreturn -- parsing is finished, return the result. |
2200 `-----------------------------------------------------*/
2201 yyreturn:
2202 if (!yyla.empty ())
2203 yy_destroy_ ("Cleanup: discarding lookahead", yyla);
2204
2205 /* Do not reclaim the symbols of the rule whose action triggered
2206 this YYABORT or YYACCEPT. */
2207 yypop_ (yylen);
2208 YY_STACK_PRINT ();
2209 while (1 < yystack_.size ())
2210 {
2211 yy_destroy_ ("Cleanup: popping", yystack_[0]);
2212 yypop_ ();
2213 }
2214
2215 return yyresult;
2216 }
2217#if YY_EXCEPTIONS
2218 catch (...)
2219 {
2220 YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
2221 // Do not try to display the values of the reclaimed symbols,
2222 // as their printers might throw an exception.
2223 if (!yyla.empty ())
2224 yy_destroy_ (YY_NULLPTR, yyla);
2225
2226 while (1 < yystack_.size ())
2227 {
2228 yy_destroy_ (YY_NULLPTR, yystack_[0]);
2229 yypop_ ();
2230 }
2231 throw;
2232 }
2233#endif // YY_EXCEPTIONS
2234 }
2235
2236 void
2238 {
2239 error (yyexc.location, yyexc.what ());
2240 }
2241
2242 /* Return YYSTR after stripping away unnecessary quotes and
2243 backslashes, so that it's suitable for yyerror. The heuristic is
2244 that double-quoting is unnecessary unless the string contains an
2245 apostrophe, a comma, or backslash (other than backslash-backslash).
2246 YYSTR is taken from yytname. */
2247 std::string
2248 D2Parser::yytnamerr_ (const char *yystr)
2249 {
2250 if (*yystr == '"')
2251 {
2252 std::string yyr;
2253 char const *yyp = yystr;
2254
2255 for (;;)
2256 switch (*++yyp)
2257 {
2258 case '\'':
2259 case ',':
2260 goto do_not_strip_quotes;
2261
2262 case '\\':
2263 if (*++yyp != '\\')
2264 goto do_not_strip_quotes;
2265 else
2266 goto append;
2267
2268 append:
2269 default:
2270 yyr += *yyp;
2271 break;
2272
2273 case '"':
2274 return yyr;
2275 }
2276 do_not_strip_quotes: ;
2277 }
2278
2279 return yystr;
2280 }
2281
2282 std::string
2284 {
2285 return yytnamerr_ (yytname_[yysymbol]);
2286 }
2287
2288
2289
2290 // D2Parser::context.
2291 D2Parser::context::context (const D2Parser& yyparser, const symbol_type& yyla)
2292 : yyparser_ (yyparser)
2293 , yyla_ (yyla)
2294 {}
2295
2296 int
2298 {
2299 // Actual number of expected tokens
2300 int yycount = 0;
2301
2302 const int yyn = yypact_[+yyparser_.yystack_[0].state];
2303 if (!yy_pact_value_is_default_ (yyn))
2304 {
2305 /* Start YYX at -YYN if negative to avoid negative indexes in
2306 YYCHECK. In other words, skip the first -YYN actions for
2307 this state because they are default actions. */
2308 const int yyxbegin = yyn < 0 ? -yyn : 0;
2309 // Stay within bounds of both yycheck and yytname.
2310 const int yychecklim = yylast_ - yyn + 1;
2311 const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2312 for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
2313 if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::S_YYerror
2314 && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
2315 {
2316 if (!yyarg)
2317 ++yycount;
2318 else if (yycount == yyargn)
2319 return 0;
2320 else
2321 yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
2322 }
2323 }
2324
2325 if (yyarg && yycount == 0 && 0 < yyargn)
2326 yyarg[0] = symbol_kind::S_YYEMPTY;
2327 return yycount;
2328 }
2329
2330
2331
2332
2333
2334
2335 int
2336 D2Parser::yy_syntax_error_arguments_ (const context& yyctx,
2337 symbol_kind_type yyarg[], int yyargn) const
2338 {
2339 /* There are many possibilities here to consider:
2340 - If this state is a consistent state with a default action, then
2341 the only way this function was invoked is if the default action
2342 is an error action. In that case, don't check for expected
2343 tokens because there are none.
2344 - The only way there can be no lookahead present (in yyla) is
2345 if this state is a consistent state with a default action.
2346 Thus, detecting the absence of a lookahead is sufficient to
2347 determine that there is no unexpected or expected token to
2348 report. In that case, just report a simple "syntax error".
2349 - Don't assume there isn't a lookahead just because this state is
2350 a consistent state with a default action. There might have
2351 been a previous inconsistent state, consistent state with a
2352 non-default action, or user semantic action that manipulated
2353 yyla. (However, yyla is currently not documented for users.)
2354 - Of course, the expected token list depends on states to have
2355 correct lookahead information, and it depends on the parser not
2356 to perform extra reductions after fetching a lookahead from the
2357 scanner and before detecting a syntax error. Thus, state merging
2358 (from LALR or IELR) and default reductions corrupt the expected
2359 token list. However, the list is correct for canonical LR with
2360 one exception: it will still contain any token that will not be
2361 accepted due to an error action in a later state.
2362 */
2363
2364 if (!yyctx.lookahead ().empty ())
2365 {
2366 if (yyarg)
2367 yyarg[0] = yyctx.token ();
2368 int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
2369 return yyn + 1;
2370 }
2371 return 0;
2372 }
2373
2374 // Generate an error message.
2375 std::string
2376 D2Parser::yysyntax_error_ (const context& yyctx) const
2377 {
2378 // Its maximum.
2379 enum { YYARGS_MAX = 5 };
2380 // Arguments of yyformat.
2381 symbol_kind_type yyarg[YYARGS_MAX];
2382 int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
2383
2384 char const* yyformat = YY_NULLPTR;
2385 switch (yycount)
2386 {
2387#define YYCASE_(N, S) \
2388 case N: \
2389 yyformat = S; \
2390 break
2391 default: // Avoid compiler warnings.
2392 YYCASE_ (0, YY_("syntax error"));
2393 YYCASE_ (1, YY_("syntax error, unexpected %s"));
2394 YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
2395 YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2396 YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2397 YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2398#undef YYCASE_
2399 }
2400
2401 std::string yyres;
2402 // Argument number.
2403 std::ptrdiff_t yyi = 0;
2404 for (char const* yyp = yyformat; *yyp; ++yyp)
2405 if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
2406 {
2407 yyres += symbol_name (yyarg[yyi++]);
2408 ++yyp;
2409 }
2410 else
2411 yyres += *yyp;
2412 return yyres;
2413 }
2414
2415
2416 const short D2Parser::yypact_ninf_ = -212;
2417
2418 const signed char D2Parser::yytable_ninf_ = -1;
2419
2420 const short
2421 D2Parser::yypact_[] =
2422 {
2423 49, -212, -212, -212, -212, -212, -212, -212, -212, -212,
2424 -212, 10, 8, 24, 30, 42, 48, 64, 128, 74,
2425 136, 127, -212, -212, -212, -212, -212, -212, -212, -212,
2426 -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,
2427 -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,
2428 -212, -212, 8, -22, 33, 7, 31, 146, 38, 156,
2429 28, 160, 37, -212, 137, 163, 166, 164, 168, -212,
2430 22, -212, -212, 169, 170, -212, -212, -212, -212, -212,
2431 -212, -212, -212, -212, -212, 171, -212, 76, -212, -212,
2432 -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,
2433 -212, -212, -212, 172, -212, -212, -212, -212, -212, 79,
2434 -212, -212, -212, -212, -212, -212, 173, 174, -212, -212,
2435 -212, -212, -212, -212, -212, 103, -212, -212, -212, -212,
2436 -212, 175, 177, -212, -212, 178, -212, -212, -212, -212,
2437 -212, 104, -212, -212, -212, -212, -212, 77, -212, -212,
2438 -212, -212, 105, -212, -212, -212, -212, 8, 8, -212,
2439 121, 179, -212, -212, 180, 130, 131, 181, 182, 183,
2440 186, 187, 188, 189, 190, 191, 192, -212, 7, -212,
2441 193, 140, 195, 196, 31, -212, 31, -212, 146, 197,
2442 198, 201, 38, -212, 38, -212, 156, 205, 154, 206,
2443 28, -212, 28, 160, -212, 207, 209, -13, -212, -212,
2444 -212, 210, 208, 162, -212, -212, 153, 199, 213, 165,
2445 214, 216, 211, 217, 220, 221, -212, 176, -212, 184,
2446 185, -212, 106, -212, 203, 222, 204, -212, 107, -212,
2447 215, -212, 218, -212, 115, -212, 219, 213, -212, 8,
2448 7, -212, -212, -212, -212, -212, -212, -212, -212, -15,
2449 -15, 146, 13, 223, 224, -212, -212, -212, -212, -212,
2450 160, -212, -212, -212, -212, -212, -212, -212, -212, 116,
2451 -212, -212, 117, -212, -212, -212, 118, 226, -212, -212,
2452 -212, -212, -212, 119, -212, -212, -212, -212, 228, 225,
2453 -212, -212, 129, -212, 158, -212, 231, -15, -212, -212,
2454 -212, 232, 233, 13, -212, 37, -212, 223, 36, 224,
2455 -212, -212, 234, -212, 227, 229, -212, 149, -212, -212,
2456 -212, 236, -212, -212, -212, -212, 151, -212, -212, -212,
2457 -212, -212, -212, 156, -212, -212, -212, 239, 240, 194,
2458 241, 36, -212, 242, 230, 244, -212, 235, -212, -212,
2459 -212, 243, -212, -212, 159, -212, 46, 243, -212, -212,
2460 249, 250, 251, -212, 152, -212, -212, -212, -212, -212,
2461 -212, -212, 252, 237, 212, 245, 260, 46, -212, 247,
2462 -212, -212, -212, 248, -212, -212, -212
2463 };
2464
2465 const short
2466 D2Parser::yydefact_[] =
2467 {
2468 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
2469 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2470 0, 0, 1, 38, 30, 26, 25, 22, 23, 24,
2471 29, 3, 27, 28, 46, 5, 52, 7, 159, 9,
2472 150, 11, 107, 13, 98, 15, 131, 17, 124, 19,
2473 201, 21, 40, 33, 0, 0, 0, 152, 0, 100,
2474 0, 0, 0, 42, 0, 41, 0, 0, 34, 48,
2475 0, 50, 71, 0, 0, 75, 79, 81, 83, 85,
2476 87, 148, 178, 192, 213, 0, 70, 0, 54, 57,
2477 58, 59, 60, 61, 68, 69, 62, 63, 64, 65,
2478 66, 67, 173, 0, 176, 171, 170, 168, 169, 0,
2479 161, 164, 165, 166, 167, 157, 0, 153, 154, 120,
2480 122, 118, 117, 115, 116, 0, 109, 112, 113, 114,
2481 105, 0, 101, 102, 145, 0, 143, 142, 140, 141,
2482 139, 0, 133, 136, 137, 138, 129, 0, 126, 209,
2483 211, 206, 0, 203, 207, 208, 39, 44, 0, 31,
2484 37, 0, 51, 47, 0, 0, 0, 0, 0, 0,
2485 0, 0, 0, 0, 0, 0, 0, 45, 56, 53,
2486 0, 0, 0, 0, 163, 160, 0, 151, 156, 0,
2487 0, 0, 111, 108, 0, 99, 104, 0, 0, 0,
2488 135, 132, 0, 128, 125, 0, 0, 205, 202, 43,
2489 35, 0, 0, 0, 73, 74, 0, 0, 0, 0,
2490 0, 0, 0, 0, 0, 0, 55, 0, 175, 0,
2491 0, 162, 0, 155, 0, 0, 0, 110, 0, 103,
2492 0, 147, 0, 134, 0, 127, 0, 0, 204, 0,
2493 0, 72, 77, 78, 76, 80, 32, 82, 84, 89,
2494 89, 152, 0, 194, 0, 174, 177, 172, 158, 121,
2495 0, 119, 106, 146, 144, 130, 210, 212, 36, 0,
2496 96, 95, 0, 90, 91, 94, 0, 0, 188, 190,
2497 187, 185, 186, 0, 180, 183, 184, 199, 0, 195,
2498 196, 218, 0, 215, 0, 49, 0, 93, 86, 88,
2499 149, 0, 0, 182, 179, 0, 193, 198, 0, 217,
2500 214, 123, 0, 92, 0, 0, 181, 0, 197, 230,
2501 235, 0, 233, 229, 227, 228, 0, 220, 223, 225,
2502 226, 224, 216, 100, 189, 191, 200, 0, 0, 0,
2503 0, 222, 219, 0, 0, 0, 232, 0, 221, 97,
2504 231, 0, 234, 240, 0, 237, 0, 239, 236, 250,
2505 0, 0, 0, 255, 0, 242, 245, 246, 247, 248,
2506 249, 238, 0, 0, 0, 0, 0, 244, 241, 0,
2507 252, 253, 254, 0, 243, 251, 256
2508 };
2509
2510 const short
2511 D2Parser::yypgoto_[] =
2512 {
2513 -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,
2514 -212, -212, -41, -212, -211, -212, -18, -212, -212, -212,
2515 -212, -212, -212, -56, -212, -212, -212, -212, -212, -212,
2516 -212, -12, 68, -212, -212, -212, -212, -212, -212, -212,
2517 -212, -212, -55, -212, -44, -212, -212, -212, -212, -212,
2518 5, -212, -60, -212, -212, -212, -212, -77, -212, 71,
2519 -212, -212, -212, 83, 81, -212, -212, -51, -212, -212,
2520 -212, -212, -212, -2, 75, -212, -212, -212, 69, 80,
2521 -212, -212, -212, -212, -212, -212, -212, -212, -212, 18,
2522 -212, 93, -212, -212, -212, 96, 99, -212, -212, -212,
2523 -212, -212, -212, -212, -212, -212, -212, -28, -212, -212,
2524 -212, -212, -212, -212, -212, -212, -29, -212, -212, -212,
2525 -26, 84, -212, -212, -212, -212, -212, -212, -212, -25,
2526 -212, -212, -61, -212, -212, -212, -212, -212, -212, -212,
2527 -212, -74, -212, -212, -89, -212, -212, -212, -212, -212,
2528 -212, -212
2529 };
2530
2531 const short
2532 D2Parser::yydefgoto_[] =
2533 {
2534 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2535 20, 21, 30, 31, 32, 53, 257, 67, 68, 33,
2536 52, 64, 65, 86, 35, 54, 70, 161, 71, 37,
2537 55, 87, 88, 89, 164, 90, 91, 92, 167, 254,
2538 93, 168, 94, 169, 95, 170, 96, 171, 97, 172,
2539 282, 283, 284, 285, 306, 45, 59, 131, 132, 133,
2540 194, 43, 58, 125, 126, 127, 191, 128, 189, 129,
2541 190, 49, 61, 147, 148, 202, 47, 60, 141, 142,
2542 143, 199, 144, 197, 145, 98, 173, 41, 57, 116,
2543 117, 118, 186, 39, 56, 109, 110, 111, 183, 112,
2544 180, 113, 114, 182, 99, 174, 293, 294, 295, 311,
2545 296, 312, 100, 175, 298, 299, 300, 315, 51, 62,
2546 152, 153, 154, 205, 155, 206, 101, 176, 302, 303,
2547 318, 336, 337, 338, 347, 339, 340, 350, 341, 348,
2548 364, 365, 366, 374, 375, 376, 382, 377, 378, 379,
2549 380, 386
2550 };
2551
2552 const short
2553 D2Parser::yytable_[] =
2554 {
2555 106, 107, 122, 123, 137, 138, 151, 256, 280, 140,
2556 22, 63, 108, 23, 124, 24, 139, 25, 72, 73,
2557 74, 75, 149, 150, 76, 162, 77, 78, 79, 80,
2558 163, 34, 77, 78, 81, 66, 256, 36, 82, 134,
2559 135, 83, 85, 69, 84, 288, 289, 77, 78, 38,
2560 77, 78, 119, 40, 136, 77, 78, 77, 78, 102,
2561 103, 104, 119, 120, 85, 26, 27, 28, 29, 105,
2562 85, 42, 149, 150, 329, 330, 121, 331, 332, 178,
2563 203, 46, 184, 204, 179, 85, 369, 185, 85, 370,
2564 371, 372, 373, 85, 85, 85, 1, 2, 3, 4,
2565 5, 6, 7, 8, 9, 10, 192, 200, 207, 184,
2566 192, 193, 201, 208, 268, 272, 209, 210, 200, 178,
2567 307, 307, 313, 275, 305, 308, 309, 314, 106, 107,
2568 106, 107, 319, 44, 50, 320, 122, 123, 122, 123,
2569 108, 48, 108, 156, 137, 138, 137, 138, 124, 140,
2570 124, 140, 207, 115, 351, 387, 139, 346, 139, 352,
2571 388, 203, 367, 130, 321, 368, 157, 146, 252, 253,
2572 158, 160, 159, 165, 166, 177, 181, 188, 211, 187,
2573 196, 195, 198, 212, 213, 216, 217, 218, 214, 215,
2574 219, 220, 221, 222, 223, 224, 225, 227, 228, 229,
2575 230, 234, 235, 281, 281, 236, 290, 291, 278, 240,
2576 242, 246, 241, 247, 249, 250, 261, 255, 292, 251,
2577 24, 259, 258, 260, 262, 263, 264, 270, 317, 277,
2578 297, 301, 310, 265, 316, 322, 324, 325, 279, 343,
2579 349, 266, 267, 354, 355, 357, 226, 323, 359, 361,
2580 363, 281, 356, 383, 384, 385, 389, 290, 291, 151,
2581 269, 271, 333, 334, 393, 286, 353, 239, 304, 292,
2582 391, 244, 273, 237, 335, 274, 276, 238, 245, 287,
2583 243, 233, 232, 231, 344, 326, 345, 360, 328, 327,
2584 358, 248, 362, 381, 342, 333, 334, 390, 394, 0,
2585 0, 0, 0, 392, 395, 396, 0, 335
2586 };
2587
2588 const short
2589 D2Parser::yycheck_[] =
2590 {
2591 56, 56, 58, 58, 60, 60, 62, 218, 23, 60,
2592 0, 52, 56, 5, 58, 7, 60, 9, 11, 12,
2593 13, 14, 35, 36, 17, 3, 19, 20, 21, 22,
2594 8, 7, 19, 20, 27, 57, 247, 7, 31, 11,
2595 12, 34, 57, 10, 37, 32, 33, 19, 20, 7,
2596 19, 20, 24, 5, 26, 19, 20, 19, 20, 28,
2597 29, 30, 24, 25, 57, 57, 58, 59, 60, 38,
2598 57, 7, 35, 36, 38, 39, 38, 41, 42, 3,
2599 3, 7, 3, 6, 8, 57, 40, 8, 57, 43,
2600 44, 45, 46, 57, 57, 57, 47, 48, 49, 50,
2601 51, 52, 53, 54, 55, 56, 3, 3, 3, 3,
2602 3, 8, 8, 8, 8, 8, 157, 158, 3, 3,
2603 3, 3, 3, 8, 8, 8, 8, 8, 184, 184,
2604 186, 186, 3, 5, 7, 6, 192, 192, 194, 194,
2605 184, 5, 186, 6, 200, 200, 202, 202, 192, 200,
2606 194, 202, 3, 7, 3, 3, 200, 8, 202, 8,
2607 8, 3, 3, 7, 6, 6, 3, 7, 15, 16,
2608 4, 3, 8, 4, 4, 4, 4, 3, 57, 6,
2609 3, 6, 4, 4, 4, 4, 4, 4, 58, 58,
2610 4, 4, 4, 4, 4, 4, 4, 4, 58, 4,
2611 4, 4, 4, 259, 260, 4, 262, 262, 249, 4,
2612 4, 4, 58, 4, 4, 7, 5, 18, 262, 57,
2613 7, 7, 57, 7, 7, 5, 5, 5, 3, 247,
2614 7, 7, 6, 57, 6, 4, 4, 4, 250, 5,
2615 4, 57, 57, 4, 4, 4, 178, 307, 6, 5,
2616 7, 307, 58, 4, 4, 4, 4, 313, 313, 315,
2617 57, 57, 318, 318, 4, 260, 343, 196, 270, 313,
2618 58, 202, 57, 192, 318, 57, 57, 194, 203, 261,
2619 200, 188, 186, 184, 57, 313, 57, 57, 317, 315,
2620 351, 207, 57, 367, 319, 351, 351, 60, 387, -1,
2621 -1, -1, -1, 58, 57, 57, -1, 351
2622 };
2623
2624 const unsigned char
2625 D2Parser::yystos_[] =
2626 {
2627 0, 47, 48, 49, 50, 51, 52, 53, 54, 55,
2628 56, 62, 63, 64, 65, 66, 67, 68, 69, 70,
2629 71, 72, 0, 5, 7, 9, 57, 58, 59, 60,
2630 73, 74, 75, 80, 7, 85, 7, 90, 7, 154,
2631 5, 148, 7, 122, 5, 116, 7, 137, 5, 132,
2632 7, 179, 81, 76, 86, 91, 155, 149, 123, 117,
2633 138, 133, 180, 73, 82, 83, 57, 78, 79, 10,
2634 87, 89, 11, 12, 13, 14, 17, 19, 20, 21,
2635 22, 27, 31, 34, 37, 57, 84, 92, 93, 94,
2636 96, 97, 98, 101, 103, 105, 107, 109, 146, 165,
2637 173, 187, 28, 29, 30, 38, 84, 103, 105, 156,
2638 157, 158, 160, 162, 163, 7, 150, 151, 152, 24,
2639 25, 38, 84, 103, 105, 124, 125, 126, 128, 130,
2640 7, 118, 119, 120, 11, 12, 26, 84, 103, 105,
2641 128, 139, 140, 141, 143, 145, 7, 134, 135, 35,
2642 36, 84, 181, 182, 183, 185, 6, 3, 4, 8,
2643 3, 88, 3, 8, 95, 4, 4, 99, 102, 104,
2644 106, 108, 110, 147, 166, 174, 188, 4, 3, 8,
2645 161, 4, 164, 159, 3, 8, 153, 6, 3, 129,
2646 131, 127, 3, 8, 121, 6, 3, 144, 4, 142,
2647 3, 8, 136, 3, 6, 184, 186, 3, 8, 73,
2648 73, 57, 4, 4, 58, 58, 4, 4, 4, 4,
2649 4, 4, 4, 4, 4, 4, 93, 4, 58, 4,
2650 4, 157, 156, 152, 4, 4, 4, 125, 124, 120,
2651 4, 58, 4, 140, 139, 135, 4, 4, 182, 4,
2652 7, 57, 15, 16, 100, 18, 75, 77, 57, 7,
2653 7, 5, 7, 5, 5, 57, 57, 57, 8, 57,
2654 5, 57, 8, 57, 57, 8, 57, 77, 73, 92,
2655 23, 84, 111, 112, 113, 114, 111, 150, 32, 33,
2656 84, 103, 105, 167, 168, 169, 171, 7, 175, 176,
2657 177, 7, 189, 190, 134, 8, 115, 3, 8, 8,
2658 6, 170, 172, 3, 8, 178, 6, 3, 191, 3,
2659 6, 6, 4, 113, 4, 4, 168, 181, 177, 38,
2660 39, 41, 42, 84, 103, 105, 192, 193, 194, 196,
2661 197, 199, 190, 5, 57, 57, 8, 195, 200, 4,
2662 198, 3, 8, 118, 4, 4, 58, 4, 193, 6,
2663 57, 5, 57, 7, 201, 202, 203, 3, 6, 40,
2664 43, 44, 45, 46, 204, 205, 206, 208, 209, 210,
2665 211, 202, 207, 4, 4, 4, 212, 3, 8, 4,
2666 60, 58, 58, 4, 205, 57, 57
2667 };
2668
2669 const unsigned char
2670 D2Parser::yyr1_[] =
2671 {
2672 0, 61, 63, 62, 64, 62, 65, 62, 66, 62,
2673 67, 62, 68, 62, 69, 62, 70, 62, 71, 62,
2674 72, 62, 73, 73, 73, 73, 73, 73, 73, 74,
2675 76, 75, 77, 78, 78, 79, 79, 79, 81, 80,
2676 82, 82, 83, 83, 83, 84, 86, 85, 88, 87,
2677 87, 89, 91, 90, 92, 92, 92, 93, 93, 93,
2678 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
2679 93, 95, 94, 96, 97, 99, 98, 100, 100, 102,
2680 101, 104, 103, 106, 105, 108, 107, 110, 109, 111,
2681 111, 112, 112, 112, 113, 113, 115, 114, 117, 116,
2682 118, 118, 119, 119, 119, 121, 120, 123, 122, 124,
2683 124, 124, 125, 125, 125, 125, 125, 125, 127, 126,
2684 129, 128, 131, 130, 133, 132, 134, 134, 134, 136,
2685 135, 138, 137, 139, 139, 139, 140, 140, 140, 140,
2686 140, 140, 140, 142, 141, 144, 143, 145, 147, 146,
2687 149, 148, 150, 150, 151, 151, 151, 153, 152, 155,
2688 154, 156, 156, 156, 157, 157, 157, 157, 157, 157,
2689 157, 159, 158, 161, 160, 162, 164, 163, 166, 165,
2690 167, 167, 167, 168, 168, 168, 168, 168, 170, 169,
2691 172, 171, 174, 173, 175, 175, 176, 176, 176, 178,
2692 177, 180, 179, 181, 181, 181, 181, 182, 182, 184,
2693 183, 186, 185, 188, 187, 189, 189, 189, 191, 190,
2694 192, 192, 192, 193, 193, 193, 193, 193, 193, 193,
2695 195, 194, 196, 198, 197, 200, 199, 201, 201, 201,
2696 203, 202, 204, 204, 204, 205, 205, 205, 205, 205,
2697 207, 206, 208, 209, 210, 212, 211
2698 };
2699
2700 const signed char
2701 D2Parser::yyr2_[] =
2702 {
2703 0, 2, 0, 3, 0, 3, 0, 3, 0, 3,
2704 0, 3, 0, 3, 0, 3, 0, 3, 0, 3,
2705 0, 3, 1, 1, 1, 1, 1, 1, 1, 1,
2706 0, 4, 1, 0, 1, 3, 5, 2, 0, 4,
2707 0, 1, 1, 3, 2, 2, 0, 4, 0, 6,
2708 1, 2, 0, 4, 1, 3, 2, 1, 1, 1,
2709 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2710 1, 0, 4, 3, 3, 0, 4, 1, 1, 0,
2711 4, 0, 4, 0, 4, 0, 6, 0, 6, 0,
2712 1, 1, 3, 2, 1, 1, 0, 6, 0, 4,
2713 0, 1, 1, 3, 2, 0, 4, 0, 4, 1,
2714 3, 2, 1, 1, 1, 1, 1, 1, 0, 4,
2715 0, 4, 0, 6, 0, 4, 1, 3, 2, 0,
2716 4, 0, 4, 1, 3, 2, 1, 1, 1, 1,
2717 1, 1, 1, 0, 4, 0, 4, 3, 0, 6,
2718 0, 4, 0, 1, 1, 3, 2, 0, 4, 0,
2719 4, 1, 3, 2, 1, 1, 1, 1, 1, 1,
2720 1, 0, 4, 0, 4, 3, 0, 4, 0, 6,
2721 1, 3, 2, 1, 1, 1, 1, 1, 0, 4,
2722 0, 4, 0, 6, 0, 1, 1, 3, 2, 0,
2723 4, 0, 4, 1, 3, 2, 1, 1, 1, 0,
2724 4, 0, 4, 0, 6, 1, 3, 2, 0, 4,
2725 1, 3, 2, 1, 1, 1, 1, 1, 1, 1,
2726 0, 4, 3, 0, 4, 0, 6, 1, 3, 2,
2727 0, 4, 1, 3, 2, 1, 1, 1, 1, 1,
2728 0, 4, 3, 3, 3, 0, 4
2729 };
2730
2731
2732#if D2_PARSER_DEBUG || 1
2733 // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
2734 // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
2735 const char*
2736 const D2Parser::yytname_[] =
2737 {
2738 "\"end of file\"", "error", "\"invalid token\"", "\",\"", "\":\"",
2739 "\"[\"", "\"]\"", "\"{\"", "\"}\"", "\"null\"", "\"DhcpDdns\"",
2740 "\"ip-address\"", "\"port\"", "\"dns-server-timeout\"",
2741 "\"ncr-protocol\"", "\"UDP\"", "\"TCP\"", "\"ncr-format\"", "\"JSON\"",
2742 "\"user-context\"", "\"comment\"", "\"forward-ddns\"",
2743 "\"reverse-ddns\"", "\"ddns-domains\"", "\"key-name\"",
2744 "\"dns-servers\"", "\"hostname\"", "\"tsig-keys\"", "\"algorithm\"",
2745 "\"digest-bits\"", "\"secret\"", "\"control-socket\"", "\"socket-type\"",
2746 "\"socket-name\"", "\"hooks-libraries\"", "\"library\"",
2747 "\"parameters\"", "\"loggers\"", "\"name\"", "\"output-options\"",
2748 "\"output\"", "\"debuglevel\"", "\"severity\"", "\"flush\"",
2749 "\"maxsize\"", "\"maxver\"", "\"pattern\"", "TOPLEVEL_JSON",
2750 "TOPLEVEL_DHCPDDNS", "SUB_DHCPDDNS", "SUB_TSIG_KEY", "SUB_TSIG_KEYS",
2751 "SUB_DDNS_DOMAIN", "SUB_DDNS_DOMAINS", "SUB_DNS_SERVER",
2752 "SUB_DNS_SERVERS", "SUB_HOOKS_LIBRARY", "\"constant string\"",
2753 "\"integer\"", "\"floating point\"", "\"boolean\"", "$accept", "start",
2754 "$@1", "$@2", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8", "$@9", "$@10",
2755 "value", "sub_json", "map2", "$@11", "map_value", "map_content",
2756 "not_empty_map", "list_generic", "$@12", "list_content",
2757 "not_empty_list", "unknown_map_entry", "syntax_map", "$@13",
2758 "global_object", "$@14", "global_object_comma", "sub_dhcpddns", "$@15",
2759 "dhcpddns_params", "dhcpddns_param", "ip_address", "$@16", "port",
2760 "dns_server_timeout", "ncr_protocol", "$@17", "ncr_protocol_value",
2761 "ncr_format", "$@18", "user_context", "$@19", "comment", "$@20",
2762 "forward_ddns", "$@21", "reverse_ddns", "$@22", "ddns_mgr_params",
2763 "not_empty_ddns_mgr_params", "ddns_mgr_param", "ddns_domains", "$@23",
2764 "sub_ddns_domains", "$@24", "ddns_domain_list",
2765 "not_empty_ddns_domain_list", "ddns_domain", "$@25", "sub_ddns_domain",
2766 "$@26", "ddns_domain_params", "ddns_domain_param", "ddns_domain_name",
2767 "$@27", "ddns_key_name", "$@28", "dns_servers", "$@29",
2768 "sub_dns_servers", "$@30", "dns_server_list", "dns_server", "$@31",
2769 "sub_dns_server", "$@32", "dns_server_params", "dns_server_param",
2770 "dns_server_hostname", "$@33", "dns_server_ip_address", "$@34",
2771 "dns_server_port", "tsig_keys", "$@35", "sub_tsig_keys", "$@36",
2772 "tsig_keys_list", "not_empty_tsig_keys_list", "tsig_key", "$@37",
2773 "sub_tsig_key", "$@38", "tsig_key_params", "tsig_key_param",
2774 "tsig_key_name", "$@39", "tsig_key_algorithm", "$@40",
2775 "tsig_key_digest_bits", "tsig_key_secret", "$@41", "control_socket",
2776 "$@42", "control_socket_params", "control_socket_param",
2777 "control_socket_type", "$@43", "control_socket_name", "$@44",
2778 "hooks_libraries", "$@45", "hooks_libraries_list",
2779 "not_empty_hooks_libraries_list", "hooks_library", "$@46",
2780 "sub_hooks_library", "$@47", "hooks_params", "hooks_param", "library",
2781 "$@48", "parameters", "$@49", "loggers", "$@50", "loggers_entries",
2782 "logger_entry", "$@51", "logger_params", "logger_param", "name", "$@52",
2783 "debuglevel", "severity", "$@53", "output_options_list", "$@54",
2784 "output_options_list_content", "output_entry", "$@55",
2785 "output_params_list", "output_params", "output", "$@56", "flush",
2786 "maxsize", "maxver", "pattern", "$@57", YY_NULLPTR
2787 };
2788#endif
2789
2790
2791#if D2_PARSER_DEBUG
2792 const short
2793 D2Parser::yyrline_[] =
2794 {
2795 0, 130, 130, 130, 131, 131, 132, 132, 133, 133,
2796 134, 134, 135, 135, 136, 136, 137, 137, 138, 138,
2797 139, 139, 147, 148, 149, 150, 151, 152, 153, 156,
2798 161, 161, 172, 175, 176, 179, 184, 190, 195, 195,
2799 202, 203, 206, 210, 214, 224, 233, 233, 246, 246,
2800 256, 259, 263, 263, 271, 272, 273, 279, 280, 281,
2801 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
2802 292, 295, 295, 304, 313, 323, 323, 332, 333, 336,
2803 336, 345, 345, 370, 370, 397, 397, 408, 408, 419,
2804 420, 423, 424, 425, 430, 431, 436, 436, 447, 447,
2805 454, 455, 458, 459, 460, 465, 465, 473, 473, 480,
2806 481, 482, 487, 488, 489, 490, 491, 492, 496, 496,
2807 509, 509, 522, 522, 533, 533, 540, 541, 542, 547,
2808 547, 555, 555, 562, 563, 564, 569, 570, 571, 572,
2809 573, 574, 575, 578, 578, 591, 591, 600, 615, 615,
2810 626, 626, 633, 634, 637, 638, 639, 644, 644, 652,
2811 652, 661, 662, 663, 668, 669, 670, 671, 672, 673,
2812 674, 677, 677, 690, 690, 702, 711, 711, 728, 728,
2813 739, 740, 741, 746, 747, 748, 749, 750, 753, 753,
2814 762, 762, 773, 773, 784, 785, 788, 789, 790, 795,
2815 795, 805, 805, 815, 816, 817, 820, 823, 824, 827,
2816 827, 836, 836, 846, 846, 859, 860, 861, 867, 867,
2817 875, 876, 877, 882, 883, 884, 885, 886, 887, 888,
2818 891, 891, 900, 906, 906, 915, 915, 926, 927, 928,
2819 933, 933, 941, 942, 943, 948, 949, 950, 951, 952,
2820 955, 955, 964, 970, 976, 982, 982
2821 };
2822
2823 void
2824 D2Parser::yy_stack_print_ () const
2825 {
2826 *yycdebug_ << "Stack now";
2827 for (stack_type::const_iterator
2828 i = yystack_.begin (),
2829 i_end = yystack_.end ();
2830 i != i_end; ++i)
2831 *yycdebug_ << ' ' << int (i->state);
2832 *yycdebug_ << '\n';
2833 }
2834
2835 void
2836 D2Parser::yy_reduce_print_ (int yyrule) const
2837 {
2838 int yylno = yyrline_[yyrule];
2839 int yynrhs = yyr2_[yyrule];
2840 // Print the symbols being reduced, and their result.
2841 *yycdebug_ << "Reducing stack by rule " << yyrule - 1
2842 << " (line " << yylno << "):\n";
2843 // The symbols being reduced.
2844 for (int yyi = 0; yyi < yynrhs; yyi++)
2845 YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
2846 yystack_[(yynrhs) - (yyi + 1)]);
2847 }
2848#endif // D2_PARSER_DEBUG
2849
2850
2851#line 14 "d2_parser.yy"
2852} } // isc::d2
2853#line 2854 "d2_parser.cc"
2854
2855#line 991 "d2_parser.yy"
2856
2857
2858void
2860 const std::string& what)
2861{
2862 ctx.error(loc, what);
2863}
#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:2291
const symbol_type & lookahead() const YY_NOEXCEPT
Definition: d2_parser.h:2100
symbol_kind_type token() const YY_NOEXCEPT
Definition: d2_parser.h:2101
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:2297
Present a slice of the top of a stack.
Definition: d2_parser.h:2367
A Bison parser.
Definition: d2_parser.h:216
symbol_kind::symbol_kind_type symbol_kind_type
(Internal) symbol kind.
Definition: d2_parser.h:789
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:792
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:2283
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:2859
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:2539
location_type location
The location.
Definition: d2_parser.h:1008
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: d2_parser.h:2546
void clear() YY_NOEXCEPT
Destroy contents, and record that is empty.
Definition: d2_parser.h:945
"External" symbols: returned by the scanner.
Definition: d2_parser.h:1062
Syntax errors thrown from user actions.
Definition: d2_parser.h:471
~syntax_error() YY_NOEXCEPT YY_NOTHROW
Definition: d2_parser.cc:165