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