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