Kea 3.3.1
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 35 "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_ YY_ATTRIBUTE_UNUSED = 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. */
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 71: // $@16: %empty
1016#line 318 "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 72: // ip_address: "ip-address" $@16 ":" "constant string"
1025#line 321 "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 73: // port: "port" ":" "integer"
1035#line 327 "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 74: // dns_server_timeout: "dns-server-timeout" ":" "integer"
1048#line 336 "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 75: // $@17: %empty
1062#line 346 "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 76: // ncr_protocol: "ncr-protocol" $@17 ":" ncr_protocol_value
1071#line 349 "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 77: // ncr_protocol_value: "UDP"
1080#line 355 "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 78: // ncr_protocol_value: "TCP"
1086#line 356 "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 79: // $@18: %empty
1092#line 359 "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 80: // ncr_format: "ncr-format" $@18 ":" "JSON"
1101#line 362 "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 81: // $@19: %empty
1111#line 368 "d2_parser.yy"
1112 {
1113 ctx.enter(ctx.NO_KEYWORD);
1114}
1115#line 1116 "d2_parser.cc"
1116 break;
1117
1118 case 82: // user_context: "user-context" $@19 ":" map_value
1119#line 370 "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 83: // $@20: %empty
1146#line 393 "d2_parser.yy"
1147 {
1148 ctx.enter(ctx.NO_KEYWORD);
1149}
1150#line 1151 "d2_parser.cc"
1151 break;
1152
1153 case 84: // comment: "comment" $@20 ":" "constant string"
1154#line 395 "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 85: // $@21: %empty
1183#line 420 "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 86: // forward_ddns: "forward-ddns" $@21 ":" "{" ddns_mgr_params "}"
1195#line 426 "d2_parser.yy"
1196 {
1197 ctx.stack_.pop_back();
1198 ctx.leave();
1199}
1200#line 1201 "d2_parser.cc"
1201 break;
1202
1203 case 87: // $@22: %empty
1204#line 431 "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 88: // reverse_ddns: "reverse-ddns" $@22 ":" "{" ddns_mgr_params "}"
1216#line 437 "d2_parser.yy"
1217 {
1218 ctx.stack_.pop_back();
1219 ctx.leave();
1220}
1221#line 1222 "d2_parser.cc"
1222 break;
1223
1224 case 93: // not_empty_ddns_mgr_params: ddns_mgr_params ","
1225#line 448 "d2_parser.yy"
1226 {
1227 ctx.warnAboutExtraCommas(yystack_[0].location);
1228 }
1229#line 1230 "d2_parser.cc"
1230 break;
1231
1232 case 96: // $@23: %empty
1233#line 459 "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 97: // ddns_domains: "ddns-domains" $@23 ":" "[" ddns_domain_list "]"
1245#line 465 "d2_parser.yy"
1246 {
1247 ctx.stack_.pop_back();
1248 ctx.leave();
1249}
1250#line 1251 "d2_parser.cc"
1251 break;
1252
1253 case 98: // $@24: %empty
1254#line 470 "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 99: // sub_ddns_domains: "[" $@24 ddns_domain_list "]"
1263#line 473 "d2_parser.yy"
1264 {
1265 // parsing completed
1266}
1267#line 1268 "d2_parser.cc"
1268 break;
1269
1270 case 104: // not_empty_ddns_domain_list: not_empty_ddns_domain_list ","
1271#line 483 "d2_parser.yy"
1272 {
1273 ctx.warnAboutExtraCommas(yystack_[0].location);
1274 }
1275#line 1276 "d2_parser.cc"
1276 break;
1277
1278 case 105: // $@25: %empty
1279#line 488 "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 106: // ddns_domain: "{" $@25 ddns_domain_params "}"
1289#line 492 "d2_parser.yy"
1290 {
1291 ctx.stack_.pop_back();
1292}
1293#line 1294 "d2_parser.cc"
1294 break;
1295
1296 case 107: // $@26: %empty
1297#line 496 "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 108: // sub_ddns_domain: "{" $@26 ddns_domain_params "}"
1306#line 499 "d2_parser.yy"
1307 {
1308 // parsing completed
1309}
1310#line 1311 "d2_parser.cc"
1311 break;
1312
1313 case 111: // ddns_domain_params: ddns_domain_params ","
1314#line 505 "d2_parser.yy"
1315 {
1316 ctx.warnAboutExtraCommas(yystack_[0].location);
1317 }
1318#line 1319 "d2_parser.cc"
1319 break;
1320
1321 case 118: // $@27: %empty
1322#line 519 "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 119: // ddns_domain_name: "name" $@27 ":" "constant string"
1331#line 522 "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 120: // $@28: %empty
1345#line 532 "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 121: // ddns_key_name: "key-name" $@28 ":" "constant string"
1354#line 535 "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 122: // $@29: %empty
1365#line 545 "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 123: // dns_servers: "dns-servers" $@29 ":" "[" dns_server_list "]"
1377#line 551 "d2_parser.yy"
1378 {
1379 ctx.stack_.pop_back();
1380 ctx.leave();
1381}
1382#line 1383 "d2_parser.cc"
1383 break;
1384
1385 case 124: // $@30: %empty
1386#line 556 "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 125: // sub_dns_servers: "[" $@30 dns_server_list "]"
1395#line 559 "d2_parser.yy"
1396 {
1397 // parsing completed
1398}
1399#line 1400 "d2_parser.cc"
1400 break;
1401
1402 case 128: // dns_server_list: dns_server_list ","
1403#line 565 "d2_parser.yy"
1404 {
1405 ctx.warnAboutExtraCommas(yystack_[0].location);
1406 }
1407#line 1408 "d2_parser.cc"
1408 break;
1409
1410 case 129: // $@31: %empty
1411#line 570 "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 130: // dns_server: "{" $@31 dns_server_params "}"
1421#line 574 "d2_parser.yy"
1422 {
1423 ctx.stack_.pop_back();
1424}
1425#line 1426 "d2_parser.cc"
1426 break;
1427
1428 case 131: // $@32: %empty
1429#line 578 "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 132: // sub_dns_server: "{" $@32 dns_server_params "}"
1438#line 581 "d2_parser.yy"
1439 {
1440 // parsing completed
1441}
1442#line 1443 "d2_parser.cc"
1443 break;
1444
1445 case 135: // dns_server_params: dns_server_params ","
1446#line 587 "d2_parser.yy"
1447 {
1448 ctx.warnAboutExtraCommas(yystack_[0].location);
1449 }
1450#line 1451 "d2_parser.cc"
1451 break;
1452
1453 case 143: // $@33: %empty
1454#line 601 "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 144: // dns_server_hostname: "hostname" $@33 ":" "constant string"
1463#line 604 "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 145: // $@34: %empty
1477#line 614 "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 146: // dns_server_ip_address: "ip-address" $@34 ":" "constant string"
1486#line 617 "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 147: // dns_server_port: "port" ":" "integer"
1496#line 623 "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 148: // $@35: %empty
1509#line 638 "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 149: // tsig_keys: "tsig-keys" $@35 ":" "[" tsig_keys_list "]"
1521#line 644 "d2_parser.yy"
1522 {
1523 ctx.stack_.pop_back();
1524 ctx.leave();
1525}
1526#line 1527 "d2_parser.cc"
1527 break;
1528
1529 case 150: // $@36: %empty
1530#line 649 "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 151: // sub_tsig_keys: "[" $@36 tsig_keys_list "]"
1539#line 652 "d2_parser.yy"
1540 {
1541 // parsing completed
1542}
1543#line 1544 "d2_parser.cc"
1544 break;
1545
1546 case 156: // not_empty_tsig_keys_list: not_empty_tsig_keys_list ","
1547#line 662 "d2_parser.yy"
1548 {
1549 ctx.warnAboutExtraCommas(yystack_[0].location);
1550 }
1551#line 1552 "d2_parser.cc"
1552 break;
1553
1554 case 157: // $@37: %empty
1555#line 667 "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 158: // tsig_key: "{" $@37 tsig_key_params "}"
1565#line 671 "d2_parser.yy"
1566 {
1567 ctx.stack_.pop_back();
1568}
1569#line 1570 "d2_parser.cc"
1570 break;
1571
1572 case 159: // $@38: %empty
1573#line 675 "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 160: // sub_tsig_key: "{" $@38 tsig_key_params "}"
1583#line 679 "d2_parser.yy"
1584 {
1585 // parsing completed
1586}
1587#line 1588 "d2_parser.cc"
1588 break;
1589
1590 case 163: // tsig_key_params: tsig_key_params ","
1591#line 686 "d2_parser.yy"
1592 {
1593 ctx.warnAboutExtraCommas(yystack_[0].location);
1594 }
1595#line 1596 "d2_parser.cc"
1596 break;
1597
1598 case 172: // $@39: %empty
1599#line 701 "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 173: // tsig_key_name: "name" $@39 ":" "constant string"
1608#line 704 "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 174: // $@40: %empty
1622#line 714 "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 175: // tsig_key_algorithm: "algorithm" $@40 ":" "constant string"
1631#line 717 "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 176: // tsig_key_digest_bits: "digest-bits" ":" "integer"
1644#line 726 "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 177: // $@41: %empty
1657#line 735 "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 178: // tsig_key_secret: "secret" $@41 ":" "constant string"
1667#line 739 "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 179: // $@42: %empty
1680#line 748 "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 180: // tsig_key_secret_file: "secret-file" $@42 ":" "constant string"
1690#line 752 "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 181: // $@43: %empty
1703#line 766 "d2_parser.yy"
1704 {
1705 ctx.unique("control-sockets", ctx.loc2pos(yystack_[0].location));
1706 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
1707 ctx.stack_.back()->set("control-sockets", l);
1708 ctx.stack_.push_back(l);
1709 ctx.enter(ctx.CONTROL_SOCKETS);
1710}
1711#line 1712 "d2_parser.cc"
1712 break;
1713
1714 case 182: // control_sockets: "control-sockets" $@43 ":" "[" control_socket_list "]"
1715#line 772 "d2_parser.yy"
1716 {
1717 ctx.stack_.pop_back();
1718 ctx.leave();
1719}
1720#line 1721 "d2_parser.cc"
1721 break;
1722
1723 case 187: // not_empty_control_socket_list: not_empty_control_socket_list ","
1724#line 783 "d2_parser.yy"
1725 {
1726 ctx.warnAboutExtraCommas(yystack_[0].location);
1727 }
1728#line 1729 "d2_parser.cc"
1729 break;
1730
1731 case 188: // $@44: %empty
1732#line 788 "d2_parser.yy"
1733 {
1734 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1735 ctx.stack_.back()->add(m);
1736 ctx.stack_.push_back(m);
1737}
1738#line 1739 "d2_parser.cc"
1739 break;
1740
1741 case 189: // control_socket_entry: "{" $@44 control_socket_params "}"
1742#line 792 "d2_parser.yy"
1743 {
1744 ctx.stack_.pop_back();
1745}
1746#line 1747 "d2_parser.cc"
1747 break;
1748
1749 case 192: // control_socket_params: control_socket_params ","
1750#line 798 "d2_parser.yy"
1751 {
1752 ctx.warnAboutExtraCommas(yystack_[0].location);
1753 }
1754#line 1755 "d2_parser.cc"
1755 break;
1756
1757 case 205: // $@45: %empty
1758#line 817 "d2_parser.yy"
1759 {
1760 ctx.unique("socket-type", ctx.loc2pos(yystack_[0].location));
1761 ctx.enter(ctx.CONTROL_SOCKET_TYPE);
1762}
1763#line 1764 "d2_parser.cc"
1764 break;
1765
1766 case 206: // control_socket_type: "socket-type" $@45 ":" control_socket_type_value
1767#line 820 "d2_parser.yy"
1768 {
1769 ctx.stack_.back()->set("socket-type", yystack_[0].value.as < ElementPtr > ());
1770 ctx.leave();
1771}
1772#line 1773 "d2_parser.cc"
1773 break;
1774
1775 case 207: // control_socket_type_value: "unix"
1776#line 826 "d2_parser.yy"
1777 { yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement("unix", ctx.loc2pos(yystack_[0].location))); }
1778#line 1779 "d2_parser.cc"
1779 break;
1780
1781 case 208: // control_socket_type_value: "http"
1782#line 827 "d2_parser.yy"
1783 { yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement("http", ctx.loc2pos(yystack_[0].location))); }
1784#line 1785 "d2_parser.cc"
1785 break;
1786
1787 case 209: // control_socket_type_value: "https"
1788#line 828 "d2_parser.yy"
1789 { yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement("https", ctx.loc2pos(yystack_[0].location))); }
1790#line 1791 "d2_parser.cc"
1791 break;
1792
1793 case 210: // $@46: %empty
1794#line 831 "d2_parser.yy"
1795 {
1796 ctx.unique("socket-name", ctx.loc2pos(yystack_[0].location));
1797 ctx.unique("socket-address", ctx.loc2pos(yystack_[0].location));
1798 ctx.enter(ctx.NO_KEYWORD);
1799}
1800#line 1801 "d2_parser.cc"
1801 break;
1802
1803 case 211: // control_socket_name: "socket-name" $@46 ":" "constant string"
1804#line 835 "d2_parser.yy"
1805 {
1806 ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1807 ctx.stack_.back()->set("socket-name", name);
1808 ctx.leave();
1809}
1810#line 1811 "d2_parser.cc"
1811 break;
1812
1813 case 212: // $@47: %empty
1814#line 841 "d2_parser.yy"
1815 {
1816 ctx.unique("socket-address", ctx.loc2pos(yystack_[0].location));
1817 ctx.unique("socket-name", ctx.loc2pos(yystack_[0].location));
1818 ctx.enter(ctx.NO_KEYWORD);
1819}
1820#line 1821 "d2_parser.cc"
1821 break;
1822
1823 case 213: // control_socket_address: "socket-address" $@47 ":" "constant string"
1824#line 845 "d2_parser.yy"
1825 {
1826 ElementPtr address(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1827 ctx.stack_.back()->set("socket-address", address);
1828 ctx.leave();
1829}
1830#line 1831 "d2_parser.cc"
1831 break;
1832
1833 case 214: // control_socket_port: "socket-port" ":" "integer"
1834#line 851 "d2_parser.yy"
1835 {
1836 ctx.unique("socket-port", ctx.loc2pos(yystack_[2].location));
1837 ElementPtr port(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
1838 ctx.stack_.back()->set("socket-port", port);
1839}
1840#line 1841 "d2_parser.cc"
1841 break;
1842
1843 case 215: // $@48: %empty
1844#line 857 "d2_parser.yy"
1845 {
1846 ctx.unique("trust-anchor", ctx.loc2pos(yystack_[0].location));
1847 ctx.enter(ctx.NO_KEYWORD);
1848}
1849#line 1850 "d2_parser.cc"
1850 break;
1851
1852 case 216: // trust_anchor: "trust-anchor" $@48 ":" "constant string"
1853#line 860 "d2_parser.yy"
1854 {
1855 ElementPtr ca(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1856 ctx.stack_.back()->set("trust-anchor", ca);
1857 ctx.leave();
1858}
1859#line 1860 "d2_parser.cc"
1860 break;
1861
1862 case 217: // $@49: %empty
1863#line 866 "d2_parser.yy"
1864 {
1865 ctx.unique("cert-file", ctx.loc2pos(yystack_[0].location));
1866 ctx.enter(ctx.NO_KEYWORD);
1867}
1868#line 1869 "d2_parser.cc"
1869 break;
1870
1871 case 218: // cert_file: "cert-file" $@49 ":" "constant string"
1872#line 869 "d2_parser.yy"
1873 {
1874 ElementPtr cert(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1875 ctx.stack_.back()->set("cert-file", cert);
1876 ctx.leave();
1877}
1878#line 1879 "d2_parser.cc"
1879 break;
1880
1881 case 219: // $@50: %empty
1882#line 875 "d2_parser.yy"
1883 {
1884 ctx.unique("key-file", ctx.loc2pos(yystack_[0].location));
1885 ctx.enter(ctx.NO_KEYWORD);
1886}
1887#line 1888 "d2_parser.cc"
1888 break;
1889
1890 case 220: // key_file: "key-file" $@50 ":" "constant string"
1891#line 878 "d2_parser.yy"
1892 {
1893 ElementPtr key(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1894 ctx.stack_.back()->set("key-file", key);
1895 ctx.leave();
1896}
1897#line 1898 "d2_parser.cc"
1898 break;
1899
1900 case 221: // cert_required: "cert-required" ":" "boolean"
1901#line 884 "d2_parser.yy"
1902 {
1903 ctx.unique("cert-required", ctx.loc2pos(yystack_[2].location));
1904 ElementPtr req(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
1905 ctx.stack_.back()->set("cert-required", req);
1906}
1907#line 1908 "d2_parser.cc"
1908 break;
1909
1910 case 222: // $@51: %empty
1911#line 892 "d2_parser.yy"
1912 {
1913 ctx.unique("authentication", ctx.loc2pos(yystack_[0].location));
1914 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
1915 ctx.stack_.back()->set("authentication", m);
1916 ctx.stack_.push_back(m);
1917 ctx.enter(ctx.AUTHENTICATION);
1918}
1919#line 1920 "d2_parser.cc"
1920 break;
1921
1922 case 223: // authentication: "authentication" $@51 ":" "{" auth_params "}"
1923#line 898 "d2_parser.yy"
1924 {
1925 // The type parameter is required
1926 ctx.require("type", ctx.loc2pos(yystack_[2].location), ctx.loc2pos(yystack_[0].location));
1927 ctx.stack_.pop_back();
1928 ctx.leave();
1929}
1930#line 1931 "d2_parser.cc"
1931 break;
1932
1933 case 226: // auth_params: auth_params ","
1934#line 907 "d2_parser.yy"
1935 {
1936 ctx.warnAboutExtraCommas(yystack_[0].location);
1937 }
1938#line 1939 "d2_parser.cc"
1939 break;
1940
1941 case 234: // $@52: %empty
1942#line 921 "d2_parser.yy"
1943 {
1944 ctx.unique("type", ctx.loc2pos(yystack_[0].location));
1945 ctx.enter(ctx.AUTH_TYPE);
1946}
1947#line 1948 "d2_parser.cc"
1948 break;
1949
1950 case 235: // auth_type: "type" $@52 ":" auth_type_value
1951#line 924 "d2_parser.yy"
1952 {
1953 ctx.stack_.back()->set("type", yystack_[0].value.as < ElementPtr > ());
1954 ctx.leave();
1955}
1956#line 1957 "d2_parser.cc"
1957 break;
1958
1959 case 236: // auth_type_value: "basic"
1960#line 929 "d2_parser.yy"
1961 { yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement("basic", ctx.loc2pos(yystack_[0].location))); }
1962#line 1963 "d2_parser.cc"
1963 break;
1964
1965 case 237: // $@53: %empty
1966#line 932 "d2_parser.yy"
1967 {
1968 ctx.unique("realm", ctx.loc2pos(yystack_[0].location));
1969 ctx.enter(ctx.NO_KEYWORD);
1970}
1971#line 1972 "d2_parser.cc"
1972 break;
1973
1974 case 238: // realm: "realm" $@53 ":" "constant string"
1975#line 935 "d2_parser.yy"
1976 {
1977 ElementPtr realm(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1978 ctx.stack_.back()->set("realm", realm);
1979 ctx.leave();
1980}
1981#line 1982 "d2_parser.cc"
1982 break;
1983
1984 case 239: // $@54: %empty
1985#line 941 "d2_parser.yy"
1986 {
1987 ctx.unique("directory", ctx.loc2pos(yystack_[0].location));
1988 ctx.enter(ctx.NO_KEYWORD);
1989}
1990#line 1991 "d2_parser.cc"
1991 break;
1992
1993 case 240: // directory: "directory" $@54 ":" "constant string"
1994#line 944 "d2_parser.yy"
1995 {
1996 ElementPtr directory(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
1997 ctx.stack_.back()->set("directory", directory);
1998 ctx.leave();
1999}
2000#line 2001 "d2_parser.cc"
2001 break;
2002
2003 case 241: // $@55: %empty
2004#line 950 "d2_parser.yy"
2005 {
2006 ctx.unique("clients", ctx.loc2pos(yystack_[0].location));
2007 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
2008 ctx.stack_.back()->set("clients", l);
2009 ctx.stack_.push_back(l);
2010 ctx.enter(ctx.CLIENTS);
2011}
2012#line 2013 "d2_parser.cc"
2013 break;
2014
2015 case 242: // clients: "clients" $@55 ":" "[" clients_list "]"
2016#line 956 "d2_parser.yy"
2017 {
2018 ctx.stack_.pop_back();
2019 ctx.leave();
2020}
2021#line 2022 "d2_parser.cc"
2022 break;
2023
2024 case 247: // not_empty_clients_list: not_empty_clients_list ","
2025#line 967 "d2_parser.yy"
2026 {
2027 ctx.warnAboutExtraCommas(yystack_[0].location);
2028 }
2029#line 2030 "d2_parser.cc"
2030 break;
2031
2032 case 248: // $@56: %empty
2033#line 972 "d2_parser.yy"
2034 {
2035 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
2036 ctx.stack_.back()->add(m);
2037 ctx.stack_.push_back(m);
2038}
2039#line 2040 "d2_parser.cc"
2040 break;
2041
2042 case 249: // basic_auth: "{" $@56 clients_params "}"
2043#line 976 "d2_parser.yy"
2044 {
2045 ctx.stack_.pop_back();
2046}
2047#line 2048 "d2_parser.cc"
2048 break;
2049
2050 case 252: // clients_params: clients_params ","
2051#line 982 "d2_parser.yy"
2052 {
2053 ctx.warnAboutExtraCommas(yystack_[0].location);
2054 }
2055#line 2056 "d2_parser.cc"
2056 break;
2057
2058 case 260: // $@57: %empty
2059#line 996 "d2_parser.yy"
2060 {
2061 ctx.unique("user", ctx.loc2pos(yystack_[0].location));
2062 ctx.enter(ctx.NO_KEYWORD);
2063}
2064#line 2065 "d2_parser.cc"
2065 break;
2066
2067 case 261: // user: "user" $@57 ":" "constant string"
2068#line 999 "d2_parser.yy"
2069 {
2070 ElementPtr user(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2071 ctx.stack_.back()->set("user", user);
2072 ctx.leave();
2073}
2074#line 2075 "d2_parser.cc"
2075 break;
2076
2077 case 262: // $@58: %empty
2078#line 1005 "d2_parser.yy"
2079 {
2080 ctx.unique("user-file", ctx.loc2pos(yystack_[0].location));
2081 ctx.enter(ctx.NO_KEYWORD);
2082}
2083#line 2084 "d2_parser.cc"
2084 break;
2085
2086 case 263: // user_file: "user-file" $@58 ":" "constant string"
2087#line 1008 "d2_parser.yy"
2088 {
2089 ElementPtr user(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2090 ctx.stack_.back()->set("user-file", user);
2091 ctx.leave();
2092}
2093#line 2094 "d2_parser.cc"
2094 break;
2095
2096 case 264: // $@59: %empty
2097#line 1014 "d2_parser.yy"
2098 {
2099 ctx.unique("password", ctx.loc2pos(yystack_[0].location));
2100 ctx.enter(ctx.NO_KEYWORD);
2101}
2102#line 2103 "d2_parser.cc"
2103 break;
2104
2105 case 265: // password: "password" $@59 ":" "constant string"
2106#line 1017 "d2_parser.yy"
2107 {
2108 ElementPtr pwd(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2109 ctx.stack_.back()->set("password", pwd);
2110 ctx.leave();
2111}
2112#line 2113 "d2_parser.cc"
2113 break;
2114
2115 case 266: // $@60: %empty
2116#line 1023 "d2_parser.yy"
2117 {
2118 ctx.unique("password-file", ctx.loc2pos(yystack_[0].location));
2119 ctx.enter(ctx.NO_KEYWORD);
2120}
2121#line 2122 "d2_parser.cc"
2122 break;
2123
2124 case 267: // password_file: "password-file" $@60 ":" "constant string"
2125#line 1026 "d2_parser.yy"
2126 {
2127 ElementPtr password(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2128 ctx.stack_.back()->set("password-file", password);
2129 ctx.leave();
2130}
2131#line 2132 "d2_parser.cc"
2132 break;
2133
2134 case 268: // $@61: %empty
2135#line 1034 "d2_parser.yy"
2136 {
2137 ctx.unique("hooks-libraries", ctx.loc2pos(yystack_[0].location));
2138 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
2139 ctx.stack_.back()->set("hooks-libraries", l);
2140 ctx.stack_.push_back(l);
2141 ctx.enter(ctx.HOOKS_LIBRARIES);
2142}
2143#line 2144 "d2_parser.cc"
2144 break;
2145
2146 case 269: // hooks_libraries: "hooks-libraries" $@61 ":" "[" hooks_libraries_list "]"
2147#line 1040 "d2_parser.yy"
2148 {
2149 ctx.stack_.pop_back();
2150 ctx.leave();
2151}
2152#line 2153 "d2_parser.cc"
2153 break;
2154
2155 case 274: // not_empty_hooks_libraries_list: not_empty_hooks_libraries_list ","
2156#line 1051 "d2_parser.yy"
2157 {
2158 ctx.warnAboutExtraCommas(yystack_[0].location);
2159 }
2160#line 2161 "d2_parser.cc"
2161 break;
2162
2163 case 275: // $@62: %empty
2164#line 1056 "d2_parser.yy"
2165 {
2166 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
2167 ctx.stack_.back()->add(m);
2168 ctx.stack_.push_back(m);
2169}
2170#line 2171 "d2_parser.cc"
2171 break;
2172
2173 case 276: // hooks_library: "{" $@62 hooks_params "}"
2174#line 1060 "d2_parser.yy"
2175 {
2176 // The library hooks parameter is required
2177 ctx.require("library", ctx.loc2pos(yystack_[3].location), ctx.loc2pos(yystack_[0].location));
2178 ctx.stack_.pop_back();
2179}
2180#line 2181 "d2_parser.cc"
2181 break;
2182
2183 case 277: // $@63: %empty
2184#line 1066 "d2_parser.yy"
2185 {
2186 // Parse the hooks-libraries list entry map
2187 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
2188 ctx.stack_.push_back(m);
2189}
2190#line 2191 "d2_parser.cc"
2191 break;
2192
2193 case 278: // sub_hooks_library: "{" $@63 hooks_params "}"
2194#line 1070 "d2_parser.yy"
2195 {
2196 // The library hooks parameter is required
2197 ctx.require("library", ctx.loc2pos(yystack_[3].location), ctx.loc2pos(yystack_[0].location));
2198 // parsing completed
2199}
2200#line 2201 "d2_parser.cc"
2201 break;
2202
2203 case 281: // hooks_params: hooks_params ","
2204#line 1078 "d2_parser.yy"
2205 {
2206 ctx.warnAboutExtraCommas(yystack_[0].location);
2207 }
2208#line 2209 "d2_parser.cc"
2209 break;
2210
2211 case 285: // $@64: %empty
2212#line 1088 "d2_parser.yy"
2213 {
2214 ctx.unique("library", ctx.loc2pos(yystack_[0].location));
2215 ctx.enter(ctx.NO_KEYWORD);
2216}
2217#line 2218 "d2_parser.cc"
2218 break;
2219
2220 case 286: // library: "library" $@64 ":" "constant string"
2221#line 1091 "d2_parser.yy"
2222 {
2223 ElementPtr lib(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2224 ctx.stack_.back()->set("library", lib);
2225 ctx.leave();
2226}
2227#line 2228 "d2_parser.cc"
2228 break;
2229
2230 case 287: // $@65: %empty
2231#line 1097 "d2_parser.yy"
2232 {
2233 ctx.unique("parameters", ctx.loc2pos(yystack_[0].location));
2234 ctx.enter(ctx.NO_KEYWORD);
2235}
2236#line 2237 "d2_parser.cc"
2237 break;
2238
2239 case 288: // parameters: "parameters" $@65 ":" map_value
2240#line 1100 "d2_parser.yy"
2241 {
2242 ctx.stack_.back()->set("parameters", yystack_[0].value.as < ElementPtr > ());
2243 ctx.leave();
2244}
2245#line 2246 "d2_parser.cc"
2246 break;
2247
2248 case 289: // $@66: %empty
2249#line 1107 "d2_parser.yy"
2250 {
2251 ctx.unique("loggers", ctx.loc2pos(yystack_[0].location));
2252 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
2253 ctx.stack_.back()->set("loggers", l);
2254 ctx.stack_.push_back(l);
2255 ctx.enter(ctx.LOGGERS);
2256}
2257#line 2258 "d2_parser.cc"
2258 break;
2259
2260 case 290: // loggers: "loggers" $@66 ":" "[" loggers_entries "]"
2261#line 1113 "d2_parser.yy"
2262 {
2263 ctx.stack_.pop_back();
2264 ctx.leave();
2265}
2266#line 2267 "d2_parser.cc"
2267 break;
2268
2269 case 293: // loggers_entries: loggers_entries ","
2270#line 1122 "d2_parser.yy"
2271 {
2272 ctx.warnAboutExtraCommas(yystack_[0].location);
2273 }
2274#line 2275 "d2_parser.cc"
2275 break;
2276
2277 case 294: // $@67: %empty
2278#line 1128 "d2_parser.yy"
2279 {
2280 ElementPtr l(new MapElement(ctx.loc2pos(yystack_[0].location)));
2281 ctx.stack_.back()->add(l);
2282 ctx.stack_.push_back(l);
2283}
2284#line 2285 "d2_parser.cc"
2285 break;
2286
2287 case 295: // logger_entry: "{" $@67 logger_params "}"
2288#line 1132 "d2_parser.yy"
2289 {
2290 ctx.stack_.pop_back();
2291}
2292#line 2293 "d2_parser.cc"
2293 break;
2294
2295 case 298: // logger_params: logger_params ","
2296#line 1138 "d2_parser.yy"
2297 {
2298 ctx.warnAboutExtraCommas(yystack_[0].location);
2299 }
2300#line 2301 "d2_parser.cc"
2301 break;
2302
2303 case 306: // $@68: %empty
2304#line 1152 "d2_parser.yy"
2305 {
2306 ctx.unique("name", ctx.loc2pos(yystack_[0].location));
2307 ctx.enter(ctx.NO_KEYWORD);
2308}
2309#line 2310 "d2_parser.cc"
2310 break;
2311
2312 case 307: // name: "name" $@68 ":" "constant string"
2313#line 1155 "d2_parser.yy"
2314 {
2315 ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2316 ctx.stack_.back()->set("name", name);
2317 ctx.leave();
2318}
2319#line 2320 "d2_parser.cc"
2320 break;
2321
2322 case 308: // debuglevel: "debuglevel" ":" "integer"
2323#line 1161 "d2_parser.yy"
2324 {
2325 ctx.unique("debuglevel", ctx.loc2pos(yystack_[2].location));
2326 ElementPtr dl(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
2327 ctx.stack_.back()->set("debuglevel", dl);
2328}
2329#line 2330 "d2_parser.cc"
2330 break;
2331
2332 case 309: // $@69: %empty
2333#line 1167 "d2_parser.yy"
2334 {
2335 ctx.unique("severity", ctx.loc2pos(yystack_[0].location));
2336 ctx.enter(ctx.NO_KEYWORD);
2337}
2338#line 2339 "d2_parser.cc"
2339 break;
2340
2341 case 310: // severity: "severity" $@69 ":" "constant string"
2342#line 1170 "d2_parser.yy"
2343 {
2344 ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2345 ctx.stack_.back()->set("severity", sev);
2346 ctx.leave();
2347}
2348#line 2349 "d2_parser.cc"
2349 break;
2350
2351 case 311: // $@70: %empty
2352#line 1176 "d2_parser.yy"
2353 {
2354 ctx.unique("output-options", ctx.loc2pos(yystack_[0].location));
2355 ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
2356 ctx.stack_.back()->set("output-options", l);
2357 ctx.stack_.push_back(l);
2358 ctx.enter(ctx.OUTPUT_OPTIONS);
2359}
2360#line 2361 "d2_parser.cc"
2361 break;
2362
2363 case 312: // output_options_list: "output-options" $@70 ":" "[" output_options_list_content "]"
2364#line 1182 "d2_parser.yy"
2365 {
2366 ctx.stack_.pop_back();
2367 ctx.leave();
2368}
2369#line 2370 "d2_parser.cc"
2370 break;
2371
2372 case 315: // output_options_list_content: output_options_list_content ","
2373#line 1189 "d2_parser.yy"
2374 {
2375 ctx.warnAboutExtraCommas(yystack_[0].location);
2376 }
2377#line 2378 "d2_parser.cc"
2378 break;
2379
2380 case 316: // $@71: %empty
2381#line 1194 "d2_parser.yy"
2382 {
2383 ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
2384 ctx.stack_.back()->add(m);
2385 ctx.stack_.push_back(m);
2386}
2387#line 2388 "d2_parser.cc"
2388 break;
2389
2390 case 317: // output_entry: "{" $@71 output_params_list "}"
2391#line 1198 "d2_parser.yy"
2392 {
2393 ctx.stack_.pop_back();
2394}
2395#line 2396 "d2_parser.cc"
2396 break;
2397
2398 case 320: // output_params_list: output_params_list ","
2399#line 1204 "d2_parser.yy"
2400 {
2401 ctx.warnAboutExtraCommas(yystack_[0].location);
2402 }
2403#line 2404 "d2_parser.cc"
2404 break;
2405
2406 case 326: // $@72: %empty
2407#line 1216 "d2_parser.yy"
2408 {
2409 ctx.unique("output", ctx.loc2pos(yystack_[0].location));
2410 ctx.enter(ctx.NO_KEYWORD);
2411}
2412#line 2413 "d2_parser.cc"
2413 break;
2414
2415 case 327: // output: "output" $@72 ":" "constant string"
2416#line 1219 "d2_parser.yy"
2417 {
2418 ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2419 ctx.stack_.back()->set("output", sev);
2420 ctx.leave();
2421}
2422#line 2423 "d2_parser.cc"
2423 break;
2424
2425 case 328: // flush: "flush" ":" "boolean"
2426#line 1225 "d2_parser.yy"
2427 {
2428 ctx.unique("flush", ctx.loc2pos(yystack_[2].location));
2429 ElementPtr flush(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
2430 ctx.stack_.back()->set("flush", flush);
2431}
2432#line 2433 "d2_parser.cc"
2433 break;
2434
2435 case 329: // maxsize: "maxsize" ":" "integer"
2436#line 1231 "d2_parser.yy"
2437 {
2438 ctx.unique("maxsize", ctx.loc2pos(yystack_[2].location));
2439 ElementPtr maxsize(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
2440 ctx.stack_.back()->set("maxsize", maxsize);
2441}
2442#line 2443 "d2_parser.cc"
2443 break;
2444
2445 case 330: // maxver: "maxver" ":" "integer"
2446#line 1237 "d2_parser.yy"
2447 {
2448 ctx.unique("maxver", ctx.loc2pos(yystack_[2].location));
2449 ElementPtr maxver(new IntElement(yystack_[0].value.as < int64_t > (), ctx.loc2pos(yystack_[0].location)));
2450 ctx.stack_.back()->set("maxver", maxver);
2451}
2452#line 2453 "d2_parser.cc"
2453 break;
2454
2455 case 331: // $@73: %empty
2456#line 1243 "d2_parser.yy"
2457 {
2458 ctx.unique("pattern", ctx.loc2pos(yystack_[0].location));
2459 ctx.enter(ctx.NO_KEYWORD);
2460}
2461#line 2462 "d2_parser.cc"
2462 break;
2463
2464 case 332: // pattern: "pattern" $@73 ":" "constant string"
2465#line 1246 "d2_parser.yy"
2466 {
2467 ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
2468 ctx.stack_.back()->set("pattern", sev);
2469 ctx.leave();
2470}
2471#line 2472 "d2_parser.cc"
2472 break;
2473
2474
2475#line 2476 "d2_parser.cc"
2476
2477 default:
2478 break;
2479 }
2480 }
2481#if YY_EXCEPTIONS
2482 catch (const syntax_error& yyexc)
2483 {
2484 YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
2485 error (yyexc);
2486 YYERROR;
2487 }
2488#endif // YY_EXCEPTIONS
2489 YY_SYMBOL_PRINT ("-> $$ =", yylhs);
2490 yypop_ (yylen);
2491 yylen = 0;
2492
2493 // Shift the result of the reduction.
2494 yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
2495 }
2496 goto yynewstate;
2497
2498
2499 /*--------------------------------------.
2500 | yyerrlab -- here on detecting error. |
2501 `--------------------------------------*/
2502 yyerrlab:
2503 // If not already recovering from an error, report this error.
2504 if (!yyerrstatus_)
2505 {
2506 ++yynerrs_;
2507 context yyctx (*this, yyla);
2508 std::string msg = yysyntax_error_ (yyctx);
2509 error (yyla.location, YY_MOVE (msg));
2510 }
2511
2512
2513 yyerror_range[1].location = yyla.location;
2514 if (yyerrstatus_ == 3)
2515 {
2516 /* If just tried and failed to reuse lookahead token after an
2517 error, discard it. */
2518
2519 // Return failure if at end of input.
2520 if (yyla.kind () == symbol_kind::S_YYEOF)
2521 YYABORT;
2522 else if (!yyla.empty ())
2523 {
2524 yy_destroy_ ("Error: discarding", yyla);
2525 yyla.clear ();
2526 }
2527 }
2528
2529 // Else will try to reuse lookahead token after shifting the error token.
2530 goto yyerrlab1;
2531
2532
2533 /*---------------------------------------------------.
2534 | yyerrorlab -- error raised explicitly by YYERROR. |
2535 `---------------------------------------------------*/
2536 yyerrorlab:
2537 /* Pacify compilers when the user code never invokes YYERROR and
2538 the label yyerrorlab therefore never appears in user code. */
2539 if (false)
2540 YYERROR;
2541
2542 /* Do not reclaim the symbols of the rule whose action triggered
2543 this YYERROR. */
2544 yypop_ (yylen);
2545 yylen = 0;
2546 YY_STACK_PRINT ();
2547 goto yyerrlab1;
2548
2549
2550 /*-------------------------------------------------------------.
2551 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2552 `-------------------------------------------------------------*/
2553 yyerrlab1:
2554 yyerrstatus_ = 3; // Each real token shifted decrements this.
2555 // Pop stack until we find a state that shifts the error token.
2556 for (;;)
2557 {
2558 yyn = yypact_[+yystack_[0].state];
2559 if (!yy_pact_value_is_default_ (yyn))
2560 {
2562 if (0 <= yyn && yyn <= yylast_
2563 && yycheck_[yyn] == symbol_kind::S_YYerror)
2564 {
2565 yyn = yytable_[yyn];
2566 if (0 < yyn)
2567 break;
2568 }
2569 }
2570
2571 // Pop the current state because it cannot handle the error token.
2572 if (yystack_.size () == 1)
2573 YYABORT;
2574
2575 yyerror_range[1].location = yystack_[0].location;
2576 yy_destroy_ ("Error: popping", yystack_[0]);
2577 yypop_ ();
2578 YY_STACK_PRINT ();
2579 }
2580 {
2581 stack_symbol_type error_token;
2582
2583 yyerror_range[2].location = yyla.location;
2584 YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);
2585
2586 // Shift the error token.
2587 error_token.state = state_type (yyn);
2588 yypush_ ("Shifting", YY_MOVE (error_token));
2589 }
2590 goto yynewstate;
2591
2592
2593 /*-------------------------------------.
2594 | yyacceptlab -- YYACCEPT comes here. |
2595 `-------------------------------------*/
2596 yyacceptlab:
2597 yyresult = 0;
2598 goto yyreturn;
2599
2600
2601 /*-----------------------------------.
2602 | yyabortlab -- YYABORT comes here. |
2603 `-----------------------------------*/
2604 yyabortlab:
2605 yyresult = 1;
2606 goto yyreturn;
2607
2608
2609 /*-----------------------------------------------------.
2610 | yyreturn -- parsing is finished, return the result. |
2611 `-----------------------------------------------------*/
2612 yyreturn:
2613 if (!yyla.empty ())
2614 yy_destroy_ ("Cleanup: discarding lookahead", yyla);
2615
2616 /* Do not reclaim the symbols of the rule whose action triggered
2617 this YYABORT or YYACCEPT. */
2618 yypop_ (yylen);
2619 YY_STACK_PRINT ();
2620 while (1 < yystack_.size ())
2621 {
2622 yy_destroy_ ("Cleanup: popping", yystack_[0]);
2623 yypop_ ();
2624 }
2625
2626 return yyresult;
2627 }
2628#if YY_EXCEPTIONS
2629 catch (...)
2630 {
2631 YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
2632 // Do not try to display the values of the reclaimed symbols,
2633 // as their printers might throw an exception.
2634 if (!yyla.empty ())
2635 yy_destroy_ (YY_NULLPTR, yyla);
2636
2637 while (1 < yystack_.size ())
2638 {
2639 yy_destroy_ (YY_NULLPTR, yystack_[0]);
2640 yypop_ ();
2641 }
2642 throw;
2643 }
2644#endif // YY_EXCEPTIONS
2645 }
2646
2647 void
2649 {
2650 error (yyexc.location, yyexc.what ());
2651 }
2652
2653 /* Return YYSTR after stripping away unnecessary quotes and
2654 backslashes, so that it's suitable for yyerror. The heuristic is
2655 that double-quoting is unnecessary unless the string contains an
2656 apostrophe, a comma, or backslash (other than backslash-backslash).
2657 YYSTR is taken from yytname. */
2658 std::string
2659 D2Parser::yytnamerr_ (const char *yystr)
2660 {
2661 if (*yystr == '"')
2662 {
2663 std::string yyr;
2664 char const *yyp = yystr;
2665
2666 for (;;)
2667 switch (*++yyp)
2668 {
2669 case '\'':
2670 case ',':
2671 goto do_not_strip_quotes;
2672
2673 case '\\':
2674 if (*++yyp != '\\')
2675 goto do_not_strip_quotes;
2676 else
2677 goto append;
2678
2679 append:
2680 default:
2681 yyr += *yyp;
2682 break;
2683
2684 case '"':
2685 return yyr;
2686 }
2687 do_not_strip_quotes: ;
2688 }
2689
2690 return yystr;
2691 }
2692
2693 std::string
2695 {
2696 return yytnamerr_ (yytname_[yysymbol]);
2697 }
2698
2699
2700
2701 // D2Parser::context.
2702 D2Parser::context::context (const D2Parser& yyparser, const symbol_type& yyla)
2703 : yyparser_ (yyparser)
2704 , yyla_ (yyla)
2705 {}
2706
2707 int
2709 {
2710 // Actual number of expected tokens
2711 int yycount = 0;
2712
2713 const int yyn = yypact_[+yyparser_.yystack_[0].state];
2714 if (!yy_pact_value_is_default_ (yyn))
2715 {
2716 /* Start YYX at -YYN if negative to avoid negative indexes in
2717 YYCHECK. In other words, skip the first -YYN actions for
2718 this state because they are default actions. */
2719 const int yyxbegin = yyn < 0 ? -yyn : 0;
2720 // Stay within bounds of both yycheck and yytname.
2721 const int yychecklim = yylast_ - yyn + 1;
2722 const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2723 for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
2724 if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::S_YYerror
2725 && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
2726 {
2727 if (!yyarg)
2728 ++yycount;
2729 else if (yycount == yyargn)
2730 return 0;
2731 else
2732 yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
2733 }
2734 }
2735
2736 if (yyarg && yycount == 0 && 0 < yyargn)
2737 yyarg[0] = symbol_kind::S_YYEMPTY;
2738 return yycount;
2739 }
2740
2741
2742
2743
2744
2745
2746 int
2747 D2Parser::yy_syntax_error_arguments_ (const context& yyctx,
2748 symbol_kind_type yyarg[], int yyargn) const
2749 {
2750 /* There are many possibilities here to consider:
2751 - If this state is a consistent state with a default action, then
2752 the only way this function was invoked is if the default action
2753 is an error action. In that case, don't check for expected
2754 tokens because there are none.
2755 - The only way there can be no lookahead present (in yyla) is
2756 if this state is a consistent state with a default action.
2757 Thus, detecting the absence of a lookahead is sufficient to
2758 determine that there is no unexpected or expected token to
2759 report. In that case, just report a simple "syntax error".
2760 - Don't assume there isn't a lookahead just because this state is
2761 a consistent state with a default action. There might have
2762 been a previous inconsistent state, consistent state with a
2763 non-default action, or user semantic action that manipulated
2764 yyla. (However, yyla is currently not documented for users.)
2765 - Of course, the expected token list depends on states to have
2766 correct lookahead information, and it depends on the parser not
2767 to perform extra reductions after fetching a lookahead from the
2768 scanner and before detecting a syntax error. Thus, state merging
2769 (from LALR or IELR) and default reductions corrupt the expected
2770 token list. However, the list is correct for canonical LR with
2771 one exception: it will still contain any token that will not be
2772 accepted due to an error action in a later state.
2773 */
2774
2775 if (!yyctx.lookahead ().empty ())
2776 {
2777 if (yyarg)
2778 yyarg[0] = yyctx.token ();
2779 int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
2780 return yyn + 1;
2781 }
2782 return 0;
2783 }
2784
2785 // Generate an error message.
2786 std::string
2787 D2Parser::yysyntax_error_ (const context& yyctx) const
2788 {
2789 // Its maximum.
2790 enum { YYARGS_MAX = 5 };
2791 // Arguments of yyformat.
2792 symbol_kind_type yyarg[YYARGS_MAX];
2793 int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
2794
2795 char const* yyformat = YY_NULLPTR;
2796 switch (yycount)
2797 {
2798#define YYCASE_(N, S) \
2799 case N: \
2800 yyformat = S; \
2801 break
2802 default: // Avoid compiler warnings.
2803 YYCASE_ (0, YY_("syntax error"));
2804 YYCASE_ (1, YY_("syntax error, unexpected %s"));
2805 YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
2806 YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2807 YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2808 YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2809#undef YYCASE_
2810 }
2811
2812 std::string yyres;
2813 // Argument number.
2814 std::ptrdiff_t yyi = 0;
2815 for (char const* yyp = yyformat; *yyp; ++yyp)
2816 if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
2817 {
2818 yyres += symbol_name (yyarg[yyi++]);
2819 ++yyp;
2820 }
2821 else
2822 yyres += *yyp;
2823 return yyres;
2824 }
2825
2826
2827 const short D2Parser::yypact_ninf_ = -200;
2828
2829 const signed char D2Parser::yytable_ninf_ = -1;
2830
2831 const short
2832 D2Parser::yypact_[] =
2833 {
2834 100, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2835 -200, 23, 8, 1, 24, 39, 84, 83, 87, 96,
2836 99, 108, -200, -200, -200, -200, -200, -200, -200, -200,
2837 -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2838 -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2839 -200, -200, 8, -27, 116, 7, 43, 121, 86, 122,
2840 21, 123, -12, -200, 140, 149, 154, 156, 159, -200,
2841 22, -200, -200, 161, 174, -200, -200, -200, -200, -200,
2842 -200, -200, -200, -200, -200, 195, -200, 67, -200, -200,
2843 -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2844 -200, -200, -200, 202, -200, -200, -200, -200, -200, -200,
2845 75, -200, -200, -200, -200, -200, -200, -200, 203, 208,
2846 -200, -200, -200, -200, -200, -200, -200, 94, -200, -200,
2847 -200, -200, -200, 206, 210, -200, -200, 211, -200, -200,
2848 -200, -200, -200, 104, -200, -200, -200, -200, -200, 4,
2849 -200, -200, -200, -200, 110, -200, -200, -200, -200, 8,
2850 8, -200, 137, 212, -200, -200, 213, 120, 141, 214,
2851 216, 217, 218, 219, 220, 221, 222, 223, 224, -200,
2852 7, -200, 225, 153, 226, 228, 229, 43, -200, 43,
2853 -200, 121, 230, 231, 232, 86, -200, 86, -200, 122,
2854 233, 160, 235, 21, -200, 21, 123, -200, 236, 237,
2855 3, -200, -200, -200, 238, 239, 166, -200, -200, 66,
2856 227, 240, 167, 241, 242, 245, 247, 248, 249, -200,
2857 180, -200, 187, 188, 189, -200, 111, -200, 191, 254,
2858 197, -200, 119, -200, 198, -200, 199, -200, 152, -200,
2859 200, 240, -200, 8, 7, -200, -200, -200, -200, -200,
2860 -200, -200, -200, 19, 19, 121, 253, 256, 262, -200,
2861 -200, -200, -200, -200, -200, 123, -200, -200, -200, -200,
2862 -200, -200, -200, -200, 176, -200, -200, 182, -200, -200,
2863 -200, 183, 264, -200, 265, 269, -200, -200, 272, 276,
2864 -200, -200, 45, -200, 54, -200, 277, 19, -200, -200,
2865 -200, 16, -200, 253, -12, -200, 256, 18, 262, -200,
2866 -200, 275, -200, -200, -200, -200, 278, -200, -200, -200,
2867 -200, 279, -200, -200, -200, 184, -200, -200, -200, -200,
2868 -200, -200, -200, -200, -200, -200, -200, 185, -200, -200,
2869 -200, 280, -200, -200, -200, -200, 186, -200, -200, -200,
2870 -200, -200, -200, 122, 281, 282, 283, 215, 284, 285,
2871 286, 287, 234, 16, -200, -200, 288, 290, 243, 291,
2872 18, -200, 292, 169, 246, 250, -200, 289, 251, 255,
2873 257, -200, -200, 258, 294, -200, 260, -200, -200, -200,
2874 -200, -200, -200, -200, -200, 80, -200, -200, -200, -200,
2875 293, -200, -200, -200, -200, -200, -200, -200, -200, 192,
2876 -200, -200, -200, -200, -200, -200, 88, -200, 297, 298,
2877 299, 300, 80, -200, 117, 293, -200, 263, 261, 266,
2878 301, -200, -200, 303, 304, 305, -200, 193, -200, -200,
2879 -200, -200, -200, -200, -200, -200, -200, -200, -200, 306,
2880 307, 259, 244, 252, 308, 117, -200, -200, 309, 313,
2881 -200, 267, -200, -200, -200, 268, -200, 89, -200, 306,
2882 -200, -200, -200, -200, -200, -200, -200, -200, -200, 194,
2883 -200, -200, -200, -200, -200, -200, 315, 316, 322, 327,
2884 89, -200, 270, 271, 274, 295, -200, -200, -200, -200,
2885 -200
2886 };
2887
2888 const short
2889 D2Parser::yydefact_[] =
2890 {
2891 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
2892 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2893 0, 0, 1, 38, 30, 26, 25, 22, 23, 24,
2894 29, 3, 27, 28, 46, 5, 52, 7, 159, 9,
2895 150, 11, 107, 13, 98, 15, 131, 17, 124, 19,
2896 277, 21, 40, 33, 0, 0, 0, 152, 0, 100,
2897 0, 0, 0, 42, 0, 41, 0, 0, 34, 48,
2898 0, 50, 71, 0, 0, 75, 79, 81, 83, 85,
2899 87, 148, 181, 268, 289, 0, 70, 0, 54, 57,
2900 58, 59, 60, 61, 68, 69, 62, 63, 64, 65,
2901 66, 67, 174, 0, 177, 179, 172, 171, 169, 170,
2902 0, 161, 164, 165, 166, 167, 168, 157, 0, 153,
2903 154, 120, 122, 118, 117, 115, 116, 0, 109, 112,
2904 113, 114, 105, 0, 101, 102, 145, 0, 143, 142,
2905 140, 141, 139, 0, 133, 136, 137, 138, 129, 0,
2906 126, 285, 287, 282, 0, 279, 283, 284, 39, 44,
2907 0, 31, 37, 0, 51, 47, 0, 0, 0, 0,
2908 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
2909 56, 53, 0, 0, 0, 0, 0, 163, 160, 0,
2910 151, 156, 0, 0, 0, 111, 108, 0, 99, 104,
2911 0, 0, 0, 135, 132, 0, 128, 125, 0, 0,
2912 281, 278, 43, 35, 0, 0, 0, 73, 74, 0,
2913 0, 0, 0, 0, 0, 0, 0, 0, 0, 55,
2914 0, 176, 0, 0, 0, 162, 0, 155, 0, 0,
2915 0, 110, 0, 103, 0, 147, 0, 134, 0, 127,
2916 0, 0, 280, 0, 0, 72, 77, 78, 76, 80,
2917 32, 82, 84, 89, 89, 152, 183, 270, 0, 175,
2918 178, 180, 173, 158, 121, 0, 119, 106, 146, 144,
2919 130, 286, 288, 36, 0, 96, 95, 0, 90, 91,
2920 94, 0, 0, 188, 0, 184, 185, 275, 0, 271,
2921 272, 294, 0, 291, 0, 49, 0, 93, 86, 88,
2922 149, 0, 182, 187, 0, 269, 274, 0, 293, 290,
2923 123, 0, 92, 205, 210, 212, 0, 222, 215, 217,
2924 219, 0, 204, 202, 203, 0, 190, 193, 194, 195,
2925 196, 198, 199, 200, 201, 197, 186, 0, 273, 306,
2926 311, 0, 309, 305, 303, 304, 0, 296, 299, 301,
2927 302, 300, 292, 100, 0, 0, 0, 0, 0, 0,
2928 0, 0, 0, 192, 189, 276, 0, 0, 0, 0,
2929 298, 295, 0, 0, 0, 0, 214, 0, 0, 0,
2930 0, 221, 191, 0, 0, 308, 0, 297, 97, 207,
2931 208, 209, 206, 211, 213, 0, 216, 218, 220, 307,
2932 0, 310, 234, 237, 239, 241, 233, 232, 231, 0,
2933 224, 227, 228, 229, 230, 316, 0, 313, 0, 0,
2934 0, 0, 226, 223, 0, 315, 312, 0, 0, 0,
2935 0, 225, 326, 0, 0, 0, 331, 0, 318, 321,
2936 322, 323, 324, 325, 314, 236, 235, 238, 240, 243,
2937 0, 0, 0, 0, 0, 320, 317, 248, 0, 244,
2938 245, 0, 328, 329, 330, 0, 319, 0, 242, 247,
2939 327, 332, 260, 262, 264, 266, 259, 257, 258, 0,
2940 250, 253, 254, 255, 256, 246, 0, 0, 0, 0,
2941 252, 249, 0, 0, 0, 0, 251, 261, 263, 265,
2942 267
2943 };
2944
2945 const short
2946 D2Parser::yypgoto_[] =
2947 {
2948 -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2949 -200, -200, -43, -200, -199, -200, 46, -200, -200, -200,
2950 -200, -200, -200, -56, -200, -200, -200, -200, -200, -200,
2951 -200, 56, 162, -200, -200, -200, -200, -200, -200, -200,
2952 -200, -200, -55, -200, -44, -200, -200, -200, -200, -200,
2953 69, -200, 33, -200, -200, -200, -200, -22, -200, 147,
2954 -200, -200, -200, 155, 158, -200, -200, -49, -200, -200,
2955 -200, -200, -200, 79, 150, -200, -200, -200, 157, 163,
2956 -200, -200, -200, -200, -200, -200, -200, -200, -200, 90,
2957 -200, 168, -200, -200, -200, 171, 170, -200, -200, -200,
2958 -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2959 50, -200, -200, -15, -200, -200, -200, -200, -200, -200,
2960 -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2961 -200, -200, -68, -200, -200, -200, -200, -200, -200, -200,
2962 -200, -200, -200, -200, -114, -200, -200, -133, -200, -200,
2963 -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
2964 52, -200, -200, -200, 55, 164, -200, -200, -200, -200,
2965 -200, -200, -200, 53, -200, -200, -10, -200, -200, -200,
2966 -200, -200, -200, -200, -200, -62, -200, -200, -90, -200,
2967 -200, -200, -200, -200, -200, -200
2968 };
2969
2970 const short
2971 D2Parser::yydefgoto_[] =
2972 {
2973 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2974 20, 21, 30, 31, 32, 53, 261, 67, 68, 33,
2975 52, 64, 65, 86, 35, 54, 70, 163, 71, 37,
2976 55, 87, 88, 89, 166, 90, 91, 92, 169, 258,
2977 93, 170, 94, 171, 95, 172, 96, 173, 97, 174,
2978 287, 288, 289, 290, 306, 45, 59, 133, 134, 135,
2979 197, 43, 58, 127, 128, 129, 194, 130, 192, 131,
2980 193, 49, 61, 149, 150, 205, 47, 60, 143, 144,
2981 145, 202, 146, 200, 147, 98, 175, 41, 57, 118,
2982 119, 120, 189, 39, 56, 110, 111, 112, 186, 113,
2983 182, 114, 115, 184, 116, 185, 99, 176, 294, 295,
2984 296, 311, 335, 336, 337, 364, 402, 338, 365, 339,
2985 366, 340, 341, 369, 342, 370, 343, 371, 344, 345,
2986 368, 419, 420, 421, 428, 456, 422, 429, 423, 430,
2987 424, 431, 468, 469, 470, 477, 489, 490, 491, 496,
2988 492, 497, 493, 498, 494, 499, 100, 177, 298, 299,
2989 300, 314, 51, 62, 154, 155, 156, 208, 157, 209,
2990 101, 178, 302, 303, 317, 356, 357, 358, 376, 359,
2991 360, 379, 361, 377, 426, 427, 434, 447, 448, 449,
2992 460, 450, 451, 452, 453, 464
2993 };
2994
2995 const short
2996 D2Parser::yytable_[] =
2997 {
2998 107, 108, 124, 125, 139, 140, 153, 206, 34, 63,
2999 207, 142, 109, 23, 126, 24, 141, 25, 72, 73,
3000 74, 75, 260, 22, 76, 164, 77, 78, 79, 80,
3001 165, 36, 136, 137, 81, 77, 78, 77, 78, 82,
3002 77, 78, 285, 151, 152, 121, 38, 138, 318, 323,
3003 66, 319, 260, 324, 325, 326, 327, 206, 151, 152,
3004 320, 83, 77, 78, 84, 85, 328, 329, 330, 331,
3005 180, 102, 103, 104, 105, 181, 349, 350, 187, 351,
3006 352, 256, 257, 188, 85, 26, 27, 28, 29, 40,
3007 42, 435, 44, 85, 436, 85, 85, 195, 85, 77,
3008 78, 106, 196, 46, 48, 77, 78, 203, 77, 78,
3009 121, 122, 204, 210, 187, 50, 212, 213, 211, 273,
3010 85, 412, 195, 413, 414, 415, 69, 277, 117, 132,
3011 148, 107, 108, 107, 108, 482, 483, 484, 485, 124,
3012 125, 124, 125, 109, 123, 109, 158, 139, 140, 139,
3013 140, 126, 159, 126, 142, 203, 142, 85, 160, 141,
3014 280, 141, 162, 85, 161, 167, 85, 1, 2, 3,
3015 4, 5, 6, 7, 8, 9, 10, 442, 168, 180,
3016 443, 444, 445, 446, 305, 307, 307, 373, 210, 380,
3017 308, 309, 374, 375, 381, 432, 465, 500, 217, 179,
3018 433, 466, 501, 399, 400, 401, 183, 286, 286, 190,
3019 283, 191, 198, 199, 214, 201, 215, 216, 219, 218,
3020 220, 221, 222, 223, 224, 225, 226, 227, 228, 230,
3021 232, 231, 233, 234, 238, 239, 240, 244, 245, 246,
3022 250, 251, 253, 255, 262, 259, 254, 24, 263, 264,
3023 265, 286, 266, 267, 268, 332, 333, 269, 153, 275,
3024 293, 353, 354, 297, 270, 271, 272, 334, 274, 301,
3025 310, 312, 313, 355, 276, 278, 279, 281, 315, 316,
3026 363, 321, 367, 372, 378, 383, 384, 385, 387, 388,
3027 389, 390, 393, 386, 394, 396, 405, 282, 398, 410,
3028 425, 437, 438, 439, 440, 455, 459, 461, 462, 463,
3029 284, 471, 475, 467, 391, 478, 479, 332, 333, 502,
3030 503, 395, 473, 403, 353, 354, 504, 404, 406, 334,
3031 474, 505, 407, 291, 408, 409, 355, 411, 457, 472,
3032 322, 382, 229, 458, 480, 481, 243, 507, 508, 416,
3033 417, 509, 242, 241, 304, 292, 249, 235, 392, 237,
3034 236, 418, 248, 346, 441, 495, 247, 506, 348, 347,
3035 397, 362, 510, 454, 252, 476, 416, 417, 0, 0,
3036 0, 0, 0, 0, 0, 0, 0, 0, 418, 0,
3037 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3039 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3040 0, 486, 487, 0, 0, 0, 0, 0, 0, 0,
3041 0, 0, 0, 488, 0, 0, 0, 0, 0, 0,
3042 0, 0, 0, 0, 486, 487, 0, 0, 0, 0,
3043 0, 0, 0, 0, 0, 0, 488
3044 };
3045
3046 const short
3047 D2Parser::yycheck_[] =
3048 {
3049 56, 56, 58, 58, 60, 60, 62, 3, 7, 52,
3050 6, 60, 56, 5, 58, 7, 60, 9, 11, 12,
3051 13, 14, 221, 0, 17, 3, 19, 20, 21, 22,
3052 8, 7, 11, 12, 27, 19, 20, 19, 20, 32,
3053 19, 20, 23, 55, 56, 24, 7, 26, 3, 33,
3054 77, 6, 251, 37, 38, 39, 40, 3, 55, 56,
3055 6, 54, 19, 20, 57, 77, 50, 51, 52, 53,
3056 3, 28, 29, 30, 31, 8, 58, 59, 3, 61,
3057 62, 15, 16, 8, 77, 77, 78, 79, 80, 5,
3058 7, 3, 5, 77, 6, 77, 77, 3, 77, 19,
3059 20, 58, 8, 7, 5, 19, 20, 3, 19, 20,
3060 24, 25, 8, 3, 3, 7, 159, 160, 8, 8,
3061 77, 41, 3, 43, 44, 45, 10, 8, 7, 7,
3062 7, 187, 187, 189, 189, 46, 47, 48, 49, 195,
3063 195, 197, 197, 187, 58, 189, 6, 203, 203, 205,
3064 205, 195, 3, 197, 203, 3, 205, 77, 4, 203,
3065 8, 205, 3, 77, 8, 4, 77, 67, 68, 69,
3066 70, 71, 72, 73, 74, 75, 76, 60, 4, 3,
3067 63, 64, 65, 66, 8, 3, 3, 3, 3, 3,
3068 8, 8, 8, 8, 8, 3, 3, 3, 78, 4,
3069 8, 8, 8, 34, 35, 36, 4, 263, 264, 6,
3070 253, 3, 6, 3, 77, 4, 4, 4, 4, 78,
3071 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
3072 4, 78, 4, 4, 4, 4, 4, 4, 78, 4,
3073 4, 4, 4, 77, 77, 18, 7, 7, 7, 7,
3074 5, 307, 5, 5, 5, 311, 311, 77, 314, 5,
3075 7, 317, 317, 7, 77, 77, 77, 311, 77, 7,
3076 6, 6, 3, 317, 77, 77, 77, 77, 6, 3,
3077 5, 4, 4, 4, 4, 4, 4, 4, 4, 4,
3078 4, 4, 4, 78, 4, 4, 7, 251, 6, 5,
3079 7, 4, 4, 4, 4, 42, 5, 4, 4, 4,
3080 254, 4, 4, 7, 80, 6, 3, 373, 373, 4,
3081 4, 78, 78, 77, 380, 380, 4, 77, 77, 373,
3082 78, 4, 77, 264, 77, 77, 380, 77, 77, 80,
3083 307, 363, 180, 77, 77, 77, 199, 77, 77, 405,
3084 405, 77, 197, 195, 275, 265, 206, 187, 373, 191,
3085 189, 405, 205, 313, 432, 479, 203, 500, 316, 314,
3086 380, 318, 77, 435, 210, 465, 432, 432, -1, -1,
3087 -1, -1, -1, -1, -1, -1, -1, -1, 432, -1,
3088 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3089 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3090 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3091 -1, 477, 477, -1, -1, -1, -1, -1, -1, -1,
3092 -1, -1, -1, 477, -1, -1, -1, -1, -1, -1,
3093 -1, -1, -1, -1, 500, 500, -1, -1, -1, -1,
3094 -1, -1, -1, -1, -1, -1, 500
3095 };
3096
3097 const short
3098 D2Parser::yystos_[] =
3099 {
3100 0, 67, 68, 69, 70, 71, 72, 73, 74, 75,
3101 76, 82, 83, 84, 85, 86, 87, 88, 89, 90,
3102 91, 92, 0, 5, 7, 9, 77, 78, 79, 80,
3103 93, 94, 95, 100, 7, 105, 7, 110, 7, 174,
3104 5, 168, 7, 142, 5, 136, 7, 157, 5, 152,
3105 7, 243, 101, 96, 106, 111, 175, 169, 143, 137,
3106 158, 153, 244, 93, 102, 103, 77, 98, 99, 10,
3107 107, 109, 11, 12, 13, 14, 17, 19, 20, 21,
3108 22, 27, 32, 54, 57, 77, 104, 112, 113, 114,
3109 116, 117, 118, 121, 123, 125, 127, 129, 166, 187,
3110 237, 251, 28, 29, 30, 31, 58, 104, 123, 125,
3111 176, 177, 178, 180, 182, 183, 185, 7, 170, 171,
3112 172, 24, 25, 58, 104, 123, 125, 144, 145, 146,
3113 148, 150, 7, 138, 139, 140, 11, 12, 26, 104,
3114 123, 125, 148, 159, 160, 161, 163, 165, 7, 154,
3115 155, 55, 56, 104, 245, 246, 247, 249, 6, 3,
3116 4, 8, 3, 108, 3, 8, 115, 4, 4, 119,
3117 122, 124, 126, 128, 130, 167, 188, 238, 252, 4,
3118 3, 8, 181, 4, 184, 186, 179, 3, 8, 173,
3119 6, 3, 149, 151, 147, 3, 8, 141, 6, 3,
3120 164, 4, 162, 3, 8, 156, 3, 6, 248, 250,
3121 3, 8, 93, 93, 77, 4, 4, 78, 78, 4,
3122 4, 4, 4, 4, 4, 4, 4, 4, 4, 113,
3123 4, 78, 4, 4, 4, 177, 176, 172, 4, 4,
3124 4, 145, 144, 140, 4, 78, 4, 160, 159, 155,
3125 4, 4, 246, 4, 7, 77, 15, 16, 120, 18,
3126 95, 97, 77, 7, 7, 5, 5, 5, 5, 77,
3127 77, 77, 77, 8, 77, 5, 77, 8, 77, 77,
3128 8, 77, 97, 93, 112, 23, 104, 131, 132, 133,
3129 134, 131, 170, 7, 189, 190, 191, 7, 239, 240,
3130 241, 7, 253, 254, 154, 8, 135, 3, 8, 8,
3131 6, 192, 6, 3, 242, 6, 3, 255, 3, 6,
3132 6, 4, 133, 33, 37, 38, 39, 40, 50, 51,
3133 52, 53, 104, 123, 125, 193, 194, 195, 198, 200,
3134 202, 203, 205, 207, 209, 210, 191, 245, 241, 58,
3135 59, 61, 62, 104, 123, 125, 256, 257, 258, 260,
3136 261, 263, 254, 5, 196, 199, 201, 4, 211, 204,
3137 206, 208, 4, 3, 8, 8, 259, 264, 4, 262,
3138 3, 8, 138, 4, 4, 4, 78, 4, 4, 4,
3139 4, 80, 194, 4, 4, 78, 4, 257, 6, 34,
3140 35, 36, 197, 77, 77, 7, 77, 77, 77, 77,
3141 5, 77, 41, 43, 44, 45, 104, 123, 125, 212,
3142 213, 214, 217, 219, 221, 7, 265, 266, 215, 218,
3143 220, 222, 3, 8, 267, 3, 6, 4, 4, 4,
3144 4, 213, 60, 63, 64, 65, 66, 268, 269, 270,
3145 272, 273, 274, 275, 266, 42, 216, 77, 77, 5,
3146 271, 4, 4, 4, 276, 3, 8, 7, 223, 224,
3147 225, 4, 80, 78, 78, 4, 269, 226, 6, 3,
3148 77, 77, 46, 47, 48, 49, 104, 123, 125, 227,
3149 228, 229, 231, 233, 235, 225, 230, 232, 234, 236,
3150 3, 8, 4, 4, 4, 4, 228, 77, 77, 77,
3151 77
3152 };
3153
3154 const short
3155 D2Parser::yyr1_[] =
3156 {
3157 0, 81, 83, 82, 84, 82, 85, 82, 86, 82,
3158 87, 82, 88, 82, 89, 82, 90, 82, 91, 82,
3159 92, 82, 93, 93, 93, 93, 93, 93, 93, 94,
3160 96, 95, 97, 98, 98, 99, 99, 99, 101, 100,
3161 102, 102, 103, 103, 103, 104, 106, 105, 108, 107,
3162 107, 109, 111, 110, 112, 112, 112, 113, 113, 113,
3163 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
3164 113, 115, 114, 116, 117, 119, 118, 120, 120, 122,
3165 121, 124, 123, 126, 125, 128, 127, 130, 129, 131,
3166 131, 132, 132, 132, 133, 133, 135, 134, 137, 136,
3167 138, 138, 139, 139, 139, 141, 140, 143, 142, 144,
3168 144, 144, 145, 145, 145, 145, 145, 145, 147, 146,
3169 149, 148, 151, 150, 153, 152, 154, 154, 154, 156,
3170 155, 158, 157, 159, 159, 159, 160, 160, 160, 160,
3171 160, 160, 160, 162, 161, 164, 163, 165, 167, 166,
3172 169, 168, 170, 170, 171, 171, 171, 173, 172, 175,
3173 174, 176, 176, 176, 177, 177, 177, 177, 177, 177,
3174 177, 177, 179, 178, 181, 180, 182, 184, 183, 186,
3175 185, 188, 187, 189, 189, 190, 190, 190, 192, 191,
3176 193, 193, 193, 194, 194, 194, 194, 194, 194, 194,
3177 194, 194, 194, 194, 194, 196, 195, 197, 197, 197,
3178 199, 198, 201, 200, 202, 204, 203, 206, 205, 208,
3179 207, 209, 211, 210, 212, 212, 212, 213, 213, 213,
3180 213, 213, 213, 213, 215, 214, 216, 218, 217, 220,
3181 219, 222, 221, 223, 223, 224, 224, 224, 226, 225,
3182 227, 227, 227, 228, 228, 228, 228, 228, 228, 228,
3183 230, 229, 232, 231, 234, 233, 236, 235, 238, 237,
3184 239, 239, 240, 240, 240, 242, 241, 244, 243, 245,
3185 245, 245, 245, 246, 246, 248, 247, 250, 249, 252,
3186 251, 253, 253, 253, 255, 254, 256, 256, 256, 257,
3187 257, 257, 257, 257, 257, 257, 259, 258, 260, 262,
3188 261, 264, 263, 265, 265, 265, 267, 266, 268, 268,
3189 268, 269, 269, 269, 269, 269, 271, 270, 272, 273,
3190 274, 276, 275
3191 };
3192
3193 const signed char
3194 D2Parser::yyr2_[] =
3195 {
3196 0, 2, 0, 3, 0, 3, 0, 3, 0, 3,
3197 0, 3, 0, 3, 0, 3, 0, 3, 0, 3,
3198 0, 3, 1, 1, 1, 1, 1, 1, 1, 1,
3199 0, 4, 1, 0, 1, 3, 5, 2, 0, 4,
3200 0, 1, 1, 3, 2, 2, 0, 4, 0, 6,
3201 1, 2, 0, 4, 1, 3, 2, 1, 1, 1,
3202 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3203 1, 0, 4, 3, 3, 0, 4, 1, 1, 0,
3204 4, 0, 4, 0, 4, 0, 6, 0, 6, 0,
3205 1, 1, 3, 2, 1, 1, 0, 6, 0, 4,
3206 0, 1, 1, 3, 2, 0, 4, 0, 4, 1,
3207 3, 2, 1, 1, 1, 1, 1, 1, 0, 4,
3208 0, 4, 0, 6, 0, 4, 1, 3, 2, 0,
3209 4, 0, 4, 1, 3, 2, 1, 1, 1, 1,
3210 1, 1, 1, 0, 4, 0, 4, 3, 0, 6,
3211 0, 4, 0, 1, 1, 3, 2, 0, 4, 0,
3212 4, 1, 3, 2, 1, 1, 1, 1, 1, 1,
3213 1, 1, 0, 4, 0, 4, 3, 0, 4, 0,
3214 4, 0, 6, 0, 1, 1, 3, 2, 0, 4,
3215 1, 3, 2, 1, 1, 1, 1, 1, 1, 1,
3216 1, 1, 1, 1, 1, 0, 4, 1, 1, 1,
3217 0, 4, 0, 4, 3, 0, 4, 0, 4, 0,
3218 4, 3, 0, 6, 1, 3, 2, 1, 1, 1,
3219 1, 1, 1, 1, 0, 4, 1, 0, 4, 0,
3220 4, 0, 6, 0, 1, 1, 3, 2, 0, 4,
3221 1, 3, 2, 1, 1, 1, 1, 1, 1, 1,
3222 0, 4, 0, 4, 0, 4, 0, 4, 0, 6,
3223 0, 1, 1, 3, 2, 0, 4, 0, 4, 1,
3224 3, 2, 1, 1, 1, 0, 4, 0, 4, 0,
3225 6, 1, 3, 2, 0, 4, 1, 3, 2, 1,
3226 1, 1, 1, 1, 1, 1, 0, 4, 3, 0,
3227 4, 0, 6, 1, 3, 2, 0, 4, 1, 3,
3228 2, 1, 1, 1, 1, 1, 0, 4, 3, 3,
3229 3, 0, 4
3230 };
3231
3232
3233#if D2_PARSER_DEBUG || 1
3234 // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
3235 // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
3236 const char*
3237 const D2Parser::yytname_[] =
3238 {
3239 "\"end of file\"", "error", "\"invalid token\"", "\",\"", "\":\"",
3240 "\"[\"", "\"]\"", "\"{\"", "\"}\"", "\"null\"", "\"DhcpDdns\"",
3241 "\"ip-address\"", "\"port\"", "\"dns-server-timeout\"",
3242 "\"ncr-protocol\"", "\"UDP\"", "\"TCP\"", "\"ncr-format\"", "\"JSON\"",
3243 "\"user-context\"", "\"comment\"", "\"forward-ddns\"",
3244 "\"reverse-ddns\"", "\"ddns-domains\"", "\"key-name\"",
3245 "\"dns-servers\"", "\"hostname\"", "\"tsig-keys\"", "\"algorithm\"",
3246 "\"digest-bits\"", "\"secret\"", "\"secret-file\"",
3247 "\"control-sockets\"", "\"socket-type\"", "\"unix\"", "\"http\"",
3248 "\"https\"", "\"socket-name\"", "\"socket-address\"", "\"socket-port\"",
3249 "\"authentication\"", "\"type\"", "\"basic\"", "\"realm\"",
3250 "\"directory\"", "\"clients\"", "\"user\"", "\"user-file\"",
3251 "\"password\"", "\"password-file\"", "\"trust-anchor\"", "\"cert-file\"",
3252 "\"key-file\"", "\"cert-required\"", "\"hooks-libraries\"",
3253 "\"library\"", "\"parameters\"", "\"loggers\"", "\"name\"",
3254 "\"output-options\"", "\"output\"", "\"debuglevel\"", "\"severity\"",
3255 "\"flush\"", "\"maxsize\"", "\"maxver\"", "\"pattern\"", "TOPLEVEL_JSON",
3256 "TOPLEVEL_DHCPDDNS", "SUB_DHCPDDNS", "SUB_TSIG_KEY", "SUB_TSIG_KEYS",
3257 "SUB_DDNS_DOMAIN", "SUB_DDNS_DOMAINS", "SUB_DNS_SERVER",
3258 "SUB_DNS_SERVERS", "SUB_HOOKS_LIBRARY", "\"constant string\"",
3259 "\"integer\"", "\"floating point\"", "\"boolean\"", "$accept", "start",
3260 "$@1", "$@2", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8", "$@9", "$@10",
3261 "value", "sub_json", "map2", "$@11", "map_value", "map_content",
3262 "not_empty_map", "list_generic", "$@12", "list_content",
3263 "not_empty_list", "unknown_map_entry", "syntax_map", "$@13",
3264 "global_object", "$@14", "global_object_comma", "sub_dhcpddns", "$@15",
3265 "dhcpddns_params", "dhcpddns_param", "ip_address", "$@16", "port",
3266 "dns_server_timeout", "ncr_protocol", "$@17", "ncr_protocol_value",
3267 "ncr_format", "$@18", "user_context", "$@19", "comment", "$@20",
3268 "forward_ddns", "$@21", "reverse_ddns", "$@22", "ddns_mgr_params",
3269 "not_empty_ddns_mgr_params", "ddns_mgr_param", "ddns_domains", "$@23",
3270 "sub_ddns_domains", "$@24", "ddns_domain_list",
3271 "not_empty_ddns_domain_list", "ddns_domain", "$@25", "sub_ddns_domain",
3272 "$@26", "ddns_domain_params", "ddns_domain_param", "ddns_domain_name",
3273 "$@27", "ddns_key_name", "$@28", "dns_servers", "$@29",
3274 "sub_dns_servers", "$@30", "dns_server_list", "dns_server", "$@31",
3275 "sub_dns_server", "$@32", "dns_server_params", "dns_server_param",
3276 "dns_server_hostname", "$@33", "dns_server_ip_address", "$@34",
3277 "dns_server_port", "tsig_keys", "$@35", "sub_tsig_keys", "$@36",
3278 "tsig_keys_list", "not_empty_tsig_keys_list", "tsig_key", "$@37",
3279 "sub_tsig_key", "$@38", "tsig_key_params", "tsig_key_param",
3280 "tsig_key_name", "$@39", "tsig_key_algorithm", "$@40",
3281 "tsig_key_digest_bits", "tsig_key_secret", "$@41",
3282 "tsig_key_secret_file", "$@42", "control_sockets", "$@43",
3283 "control_socket_list", "not_empty_control_socket_list",
3284 "control_socket_entry", "$@44", "control_socket_params",
3285 "control_socket_param", "control_socket_type", "$@45",
3286 "control_socket_type_value", "control_socket_name", "$@46",
3287 "control_socket_address", "$@47", "control_socket_port", "trust_anchor",
3288 "$@48", "cert_file", "$@49", "key_file", "$@50", "cert_required",
3289 "authentication", "$@51", "auth_params", "auth_param", "auth_type",
3290 "$@52", "auth_type_value", "realm", "$@53", "directory", "$@54",
3291 "clients", "$@55", "clients_list", "not_empty_clients_list",
3292 "basic_auth", "$@56", "clients_params", "clients_param", "user", "$@57",
3293 "user_file", "$@58", "password", "$@59", "password_file", "$@60",
3294 "hooks_libraries", "$@61", "hooks_libraries_list",
3295 "not_empty_hooks_libraries_list", "hooks_library", "$@62",
3296 "sub_hooks_library", "$@63", "hooks_params", "hooks_param", "library",
3297 "$@64", "parameters", "$@65", "loggers", "$@66", "loggers_entries",
3298 "logger_entry", "$@67", "logger_params", "logger_param", "name", "$@68",
3299 "debuglevel", "severity", "$@69", "output_options_list", "$@70",
3300 "output_options_list_content", "output_entry", "$@71",
3301 "output_params_list", "output_params", "output", "$@72", "flush",
3302 "maxsize", "maxver", "pattern", "$@73", YY_NULLPTR
3303 };
3304#endif
3305
3306
3307#if D2_PARSER_DEBUG
3308 const short
3309 D2Parser::yyrline_[] =
3310 {
3311 0, 153, 153, 153, 154, 154, 155, 155, 156, 156,
3312 157, 157, 158, 158, 159, 159, 160, 160, 161, 161,
3313 162, 162, 170, 171, 172, 173, 174, 175, 176, 179,
3314 184, 184, 195, 198, 199, 202, 207, 213, 218, 218,
3315 225, 226, 229, 233, 237, 247, 256, 256, 269, 269,
3316 279, 282, 286, 286, 294, 295, 296, 302, 303, 304,
3317 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
3318 315, 318, 318, 327, 336, 346, 346, 355, 356, 359,
3319 359, 368, 368, 393, 393, 420, 420, 431, 431, 442,
3320 443, 446, 447, 448, 453, 454, 459, 459, 470, 470,
3321 477, 478, 481, 482, 483, 488, 488, 496, 496, 503,
3322 504, 505, 510, 511, 512, 513, 514, 515, 519, 519,
3323 532, 532, 545, 545, 556, 556, 563, 564, 565, 570,
3324 570, 578, 578, 585, 586, 587, 592, 593, 594, 595,
3325 596, 597, 598, 601, 601, 614, 614, 623, 638, 638,
3326 649, 649, 656, 657, 660, 661, 662, 667, 667, 675,
3327 675, 684, 685, 686, 691, 692, 693, 694, 695, 696,
3328 697, 698, 701, 701, 714, 714, 726, 735, 735, 748,
3329 748, 766, 766, 777, 778, 781, 782, 783, 788, 788,
3330 796, 797, 798, 803, 804, 805, 806, 807, 808, 809,
3331 810, 811, 812, 813, 814, 817, 817, 826, 827, 828,
3332 831, 831, 841, 841, 851, 857, 857, 866, 866, 875,
3333 875, 884, 892, 892, 905, 906, 907, 912, 913, 914,
3334 915, 916, 917, 918, 921, 921, 929, 932, 932, 941,
3335 941, 950, 950, 961, 962, 965, 966, 967, 972, 972,
3336 980, 981, 982, 987, 988, 989, 990, 991, 992, 993,
3337 996, 996, 1005, 1005, 1014, 1014, 1023, 1023, 1034, 1034,
3338 1045, 1046, 1049, 1050, 1051, 1056, 1056, 1066, 1066, 1076,
3339 1077, 1078, 1081, 1084, 1085, 1088, 1088, 1097, 1097, 1107,
3340 1107, 1120, 1121, 1122, 1128, 1128, 1136, 1137, 1138, 1143,
3341 1144, 1145, 1146, 1147, 1148, 1149, 1152, 1152, 1161, 1167,
3342 1167, 1176, 1176, 1187, 1188, 1189, 1194, 1194, 1202, 1203,
3343 1204, 1209, 1210, 1211, 1212, 1213, 1216, 1216, 1225, 1231,
3344 1237, 1243, 1243
3345 };
3346
3347 void
3348 D2Parser::yy_stack_print_ () const
3349 {
3350 *yycdebug_ << "Stack now";
3351 for (stack_type::const_iterator
3352 i = yystack_.begin (),
3353 i_end = yystack_.end ();
3354 i != i_end; ++i)
3355 *yycdebug_ << ' ' << int (i->state);
3356 *yycdebug_ << '\n';
3357 }
3358
3359 void
3360 D2Parser::yy_reduce_print_ (int yyrule) const
3361 {
3362 int yylno = yyrline_[yyrule];
3363 int yynrhs = yyr2_[yyrule];
3364 // Print the symbols being reduced, and their result.
3365 *yycdebug_ << "Reducing stack by rule " << yyrule - 1
3366 << " (line " << yylno << "):\n";
3367 // The symbols being reduced.
3368 for (int yyi = 0; yyi < yynrhs; yyi++)
3369 YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
3370 yystack_[(yynrhs) - (yyi + 1)]);
3371 }
3372#endif // D2_PARSER_DEBUG
3373
3374
3375#line 14 "d2_parser.yy"
3376} } // isc::d2
3377#line 3378 "d2_parser.cc"
3378
3379#line 1252 "d2_parser.yy"
3380
3381
3382void
3384 const std::string& what)
3385{
3386 ctx.error(loc, what);
3387}
Evaluation context, an interface to the expression evaluation.
context(const D2Parser &yyparser, const symbol_type &yyla)
const symbol_type & lookahead() const YY_NOEXCEPT
Definition d2_parser.h:2491
symbol_kind_type token() const YY_NOEXCEPT
Definition d2_parser.h:2492
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.
T & emplace()
Instantiate an empty T in here.
Definition d2_parser.h:279
T & as() YY_NOEXCEPT
Accessor to a built T.
Definition d2_parser.h:320
symbol_kind::symbol_kind_type symbol_kind_type
(Internal) symbol kind.
Definition d2_parser.h:876
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:470
static const symbol_kind_type YYNTOKENS
The number of tokens.
Definition d2_parser.h:879
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:776
#define yylex
Definition d2_lexer.cc:27
#define YYCDEBUG
Definition d2_parser.cc:132
#define YYABORT
Definition d2_parser.cc:143
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition d2_parser.cc:87
#define YY_REDUCE_PRINT(Rule)
Definition d2_parser.cc:134
#define YY_SYMBOL_PRINT(Title, Symbol)
Definition d2_parser.cc:133
#define YYCASE_(N, S)
#define YY_STACK_PRINT()
Definition d2_parser.cc:135
#define YY_(msgid)
Definition d2_parser.cc:67
#define YYACCEPT
Definition d2_parser.cc:142
#define YYERROR
Definition d2_parser.cc:144
Define the isc::d2::parser class.
#define YY_RVREF(Type)
Definition d2_parser.h:87
#define YY_CPLUSPLUS
Definition d2_parser.h:73
#define YY_CAST(Type, Val)
Definition d2_parser.h:179
#define YY_MOVE_REF(Type)
Definition d2_parser.h:86
#define YY_NOEXCEPT
Definition d2_parser.h:96
#define YY_ATTRIBUTE_UNUSED
Definition d2_parser.h:126
#define YY_MOVE
Definition d2_parser.h:84
#define YY_NOTHROW
Definition d2_parser.h:97
#define YY_USE(E)
Definition d2_parser.h:132
void merge(ElementPtr element, ConstElementPtr other)
Merges the data from other into element. (on the first level).
Definition data.cc:1282
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
Defines the logger used by the top-level component of kea-lfc.
value_type value
The semantic value.
Definition d2_parser.h:1096
bool empty() const YY_NOEXCEPT
Whether empty.
Definition d2_parser.h:2934
location_type location
The location.
Definition d2_parser.h:1099
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition d2_parser.h:2941
void clear() YY_NOEXCEPT
Destroy contents, and record that is empty.
Definition d2_parser.h:1034
symbol_kind_type kind() const YY_NOEXCEPT
The (internal) type number (corresponding to type).
Definition d2_parser.h:3021
symbol_kind_type kind_
The symbol kind.
Definition d2_parser.h:1145
"External" symbols: returned by the scanner.
Definition d2_parser.h:1153
Syntax errors thrown from user actions.
Definition d2_parser.h:474
~syntax_error() YY_NOEXCEPT YY_NOTHROW
Definition d2_parser.cc:165