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