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