dhcp6_parser.cc 149 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// A Bison parser, made by GNU Bison 3.0.4.

// Skeleton implementation for Bison LALR(1) parsers in C++

// Copyright (C) 2002-2015 Free Software Foundation, Inc.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// As a special exception, you may create a larger work that contains
// part or all of the Bison parser skeleton and distribute that work
// under terms of your choice, so long as that work isn't itself a
// parser generator using the skeleton or a modified version thereof
// as a parser skeleton.  Alternatively, if you modify or redistribute
// the parser skeleton itself, you may (at your option) remove this
// special exception, which will cause the skeleton and the resulting
// Bison output files to be licensed under the GNU General Public
// License without this special exception.

// This special exception was added by the Free Software Foundation in
// version 2.2 of Bison.

// Take the name prefix into account.
#define yylex   parser6_lex

// First part of user declarations.

#line 39 "dhcp6_parser.cc" // lalr1.cc:404

# ifndef YY_NULLPTR
#  if defined __cplusplus && 201103L <= __cplusplus
#   define YY_NULLPTR nullptr
#  else
#   define YY_NULLPTR 0
#  endif
# endif

#include "dhcp6_parser.h"

// User implementation prologue.

#line 53 "dhcp6_parser.cc" // lalr1.cc:412
// Unqualified %code blocks.
#line 34 "dhcp6_parser.yy" // lalr1.cc:413

#include <dhcp6/parser_context.h>

#line 59 "dhcp6_parser.cc" // lalr1.cc:413


#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(msgid) msgid
# endif
#endif

#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   If N is 0, then set CURRENT to the empty location which ends
   the previous symbol: RHS[0] (always defined).  */

# ifndef YYLLOC_DEFAULT
#  define YYLLOC_DEFAULT(Current, Rhs, N)                               \
    do                                                                  \
      if (N)                                                            \
        {                                                               \
          (Current).begin  = YYRHSLOC (Rhs, 1).begin;                   \
          (Current).end    = YYRHSLOC (Rhs, N).end;                     \
        }                                                               \
      else                                                              \
        {                                                               \
          (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end;      \
        }                                                               \
    while (/*CONSTCOND*/ false)
# endif


// Suppress unused-variable warnings by "using" E.
#define YYUSE(E) ((void) (E))

// Enable debugging if requested.
#if PARSER6_DEBUG

// A pseudo ostream that takes yydebug_ into account.
# define YYCDEBUG if (yydebug_) (*yycdebug_)

# define YY_SYMBOL_PRINT(Title, Symbol)         \
  do {                                          \
    if (yydebug_)                               \
    {                                           \
      *yycdebug_ << Title << ' ';               \
      yy_print_ (*yycdebug_, Symbol);           \
      *yycdebug_ << std::endl;                  \
    }                                           \
  } while (false)

# define YY_REDUCE_PRINT(Rule)          \
  do {                                  \
    if (yydebug_)                       \
      yy_reduce_print_ (Rule);          \
  } while (false)

# define YY_STACK_PRINT()               \
  do {                                  \
    if (yydebug_)                       \
      yystack_print_ ();                \
  } while (false)

#else // !PARSER6_DEBUG

# define YYCDEBUG if (false) std::cerr
# define YY_SYMBOL_PRINT(Title, Symbol)  YYUSE(Symbol)
# define YY_REDUCE_PRINT(Rule)           static_cast<void>(0)
# define YY_STACK_PRINT()                static_cast<void>(0)

#endif // !PARSER6_DEBUG

#define yyerrok         (yyerrstatus_ = 0)
#define yyclearin       (yyla.clear ())

#define YYACCEPT        goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrorlab
#define YYRECOVERING()  (!!yyerrstatus_)

#line 14 "dhcp6_parser.yy" // lalr1.cc:479
namespace isc { namespace dhcp {
#line 145 "dhcp6_parser.cc" // lalr1.cc:479

  /* Return YYSTR after stripping away unnecessary quotes and
     backslashes, so that it's suitable for yyerror.  The heuristic is
     that double-quoting is unnecessary unless the string contains an
     apostrophe, a comma, or backslash (other than backslash-backslash).
     YYSTR is taken from yytname.  */
  std::string
  Dhcp6Parser::yytnamerr_ (const char *yystr)
  {
    if (*yystr == '"')
      {
        std::string yyr = "";
        char const *yyp = yystr;

        for (;;)
          switch (*++yyp)
            {
            case '\'':
            case ',':
              goto do_not_strip_quotes;

            case '\\':
              if (*++yyp != '\\')
                goto do_not_strip_quotes;
              // Fall through.
            default:
              yyr += *yyp;
              break;

            case '"':
              return yyr;
            }
      do_not_strip_quotes: ;
      }

    return yystr;
  }


  /// Build a parser object.
  Dhcp6Parser::Dhcp6Parser (isc::dhcp::Parser6Context& ctx_yyarg)
    :
#if PARSER6_DEBUG
      yydebug_ (false),
      yycdebug_ (&std::cerr),
#endif
      ctx (ctx_yyarg)
  {}

  Dhcp6Parser::~Dhcp6Parser ()
  {}


  /*---------------.
  | Symbol types.  |
  `---------------*/



  // by_state.
  inline
  Dhcp6Parser::by_state::by_state ()
    : state (empty_state)
  {}

  inline
  Dhcp6Parser::by_state::by_state (const by_state& other)
    : state (other.state)
  {}

  inline
  void
  Dhcp6Parser::by_state::clear ()
  {
    state = empty_state;
  }

  inline
  void
  Dhcp6Parser::by_state::move (by_state& that)
  {
    state = that.state;
    that.clear ();
  }

  inline
  Dhcp6Parser::by_state::by_state (state_type s)
    : state (s)
  {}

  inline
  Dhcp6Parser::symbol_number_type
  Dhcp6Parser::by_state::type_get () const
  {
    if (state == empty_state)
      return empty_symbol;
    else
      return yystos_[state];
  }

  inline
  Dhcp6Parser::stack_symbol_type::stack_symbol_type ()
  {}


  inline
  Dhcp6Parser::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
    : super_type (s, that.location)
  {
      switch (that.type_get ())
    {
256
257
258
259
260
261
262
      case 168: // value
      case 172: // map_value
      case 216: // db_type
      case 292: // hr_mode
      case 421: // duid_type
      case 454: // ncr_protocol_value
      case 462: // replace_client_name_value
263
264
265
        value.move< ElementPtr > (that.value);
        break;

266
      case 153: // "boolean"
267
268
269
        value.move< bool > (that.value);
        break;

270
      case 152: // "floating point"
271
272
273
        value.move< double > (that.value);
        break;

274
      case 151: // "integer"
275
276
277
        value.move< int64_t > (that.value);
        break;

278
      case 150: // "constant string"
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
        value.move< std::string > (that.value);
        break;

      default:
        break;
    }

    // that is emptied.
    that.type = empty_symbol;
  }

  inline
  Dhcp6Parser::stack_symbol_type&
  Dhcp6Parser::stack_symbol_type::operator= (const stack_symbol_type& that)
  {
    state = that.state;
      switch (that.type_get ())
    {
297
298
299
300
301
302
303
      case 168: // value
      case 172: // map_value
      case 216: // db_type
      case 292: // hr_mode
      case 421: // duid_type
      case 454: // ncr_protocol_value
      case 462: // replace_client_name_value
304
305
306
        value.copy< ElementPtr > (that.value);
        break;

307
      case 153: // "boolean"
308
309
310
        value.copy< bool > (that.value);
        break;

311
      case 152: // "floating point"
312
313
314
        value.copy< double > (that.value);
        break;

315
      case 151: // "integer"
316
317
318
        value.copy< int64_t > (that.value);
        break;

319
      case 150: // "constant string"
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
        value.copy< std::string > (that.value);
        break;

      default:
        break;
    }

    location = that.location;
    return *this;
  }


  template <typename Base>
  inline
  void
  Dhcp6Parser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
  {
    if (yymsg)
      YY_SYMBOL_PRINT (yymsg, yysym);
  }

#if PARSER6_DEBUG
  template <typename Base>
  void
  Dhcp6Parser::yy_print_ (std::ostream& yyo,
                                     const basic_symbol<Base>& yysym) const
  {
    std::ostream& yyoutput = yyo;
    YYUSE (yyoutput);
    symbol_number_type yytype = yysym.type_get ();
    // Avoid a (spurious) G++ 4.8 warning about "array subscript is
    // below array bounds".
    if (yysym.empty ())
      std::abort ();
    yyo << (yytype < yyntokens_ ? "token" : "nterm")
        << ' ' << yytname_[yytype] << " ("
        << yysym.location << ": ";
    switch (yytype)
    {
359
            case 150: // "constant string"
360

361
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
362
        { yyoutput << yysym.value.template as< std::string > (); }
363
#line 364 "dhcp6_parser.cc" // lalr1.cc:636
364
365
        break;

366
      case 151: // "integer"
367

368
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
369
        { yyoutput << yysym.value.template as< int64_t > (); }
370
#line 371 "dhcp6_parser.cc" // lalr1.cc:636
371
372
        break;

373
      case 152: // "floating point"
374

375
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
376
        { yyoutput << yysym.value.template as< double > (); }
377
#line 378 "dhcp6_parser.cc" // lalr1.cc:636
378
379
        break;

380
      case 153: // "boolean"
381

382
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
383
        { yyoutput << yysym.value.template as< bool > (); }
384
#line 385 "dhcp6_parser.cc" // lalr1.cc:636
385
386
        break;

387
      case 168: // value
388

389
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
390
        { yyoutput << yysym.value.template as< ElementPtr > (); }
391
#line 392 "dhcp6_parser.cc" // lalr1.cc:636
392
393
        break;

394
      case 172: // map_value
395

396
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
397
        { yyoutput << yysym.value.template as< ElementPtr > (); }
398
#line 399 "dhcp6_parser.cc" // lalr1.cc:636
399
400
        break;

401
      case 216: // db_type
402

403
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
404
        { yyoutput << yysym.value.template as< ElementPtr > (); }
405
#line 406 "dhcp6_parser.cc" // lalr1.cc:636
406
407
        break;

408
      case 292: // hr_mode
409

410
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
411
        { yyoutput << yysym.value.template as< ElementPtr > (); }
412
#line 413 "dhcp6_parser.cc" // lalr1.cc:636
413
414
        break;

415
      case 421: // duid_type
416

417
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
418
        { yyoutput << yysym.value.template as< ElementPtr > (); }
419
#line 420 "dhcp6_parser.cc" // lalr1.cc:636
420
421
        break;

422
      case 454: // ncr_protocol_value
423

424
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
425
        { yyoutput << yysym.value.template as< ElementPtr > (); }
426
427
428
#line 427 "dhcp6_parser.cc" // lalr1.cc:636
        break;

429
      case 462: // replace_client_name_value
430

431
#line 226 "dhcp6_parser.yy" // lalr1.cc:636
432
433
        { yyoutput << yysym.value.template as< ElementPtr > (); }
#line 434 "dhcp6_parser.cc" // lalr1.cc:636
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
        break;


      default:
        break;
    }
    yyo << ')';
  }
#endif

  inline
  void
  Dhcp6Parser::yypush_ (const char* m, state_type s, symbol_type& sym)
  {
    stack_symbol_type t (s, sym);
    yypush_ (m, t);
  }

  inline
  void
  Dhcp6Parser::yypush_ (const char* m, stack_symbol_type& s)
  {
    if (m)
      YY_SYMBOL_PRINT (m, s);
    yystack_.push (s);
  }

  inline
  void
  Dhcp6Parser::yypop_ (unsigned int n)
  {
    yystack_.pop (n);
  }

#if PARSER6_DEBUG
  std::ostream&
  Dhcp6Parser::debug_stream () const
  {
    return *yycdebug_;
  }

  void
  Dhcp6Parser::set_debug_stream (std::ostream& o)
  {
    yycdebug_ = &o;
  }


  Dhcp6Parser::debug_level_type
  Dhcp6Parser::debug_level () const
  {
    return yydebug_;
  }

  void
  Dhcp6Parser::set_debug_level (debug_level_type l)
  {
    yydebug_ = l;
  }
#endif // PARSER6_DEBUG

  inline Dhcp6Parser::state_type
  Dhcp6Parser::yy_lr_goto_state_ (state_type yystate, int yysym)
  {
    int yyr = yypgoto_[yysym - yyntokens_] + yystate;
    if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
      return yytable_[yyr];
    else
      return yydefgoto_[yysym - yyntokens_];
  }

  inline bool
  Dhcp6Parser::yy_pact_value_is_default_ (int yyvalue)
  {
    return yyvalue == yypact_ninf_;
  }

  inline bool
  Dhcp6Parser::yy_table_value_is_error_ (int yyvalue)
  {
    return yyvalue == yytable_ninf_;
  }

  int
  Dhcp6Parser::parse ()
  {
    // State.
    int yyn;
    /// Length of the RHS of the rule being reduced.
    int yylen = 0;

    // Error handling.
    int yynerrs_ = 0;
    int yyerrstatus_ = 0;

    /// The lookahead symbol.
    symbol_type yyla;

    /// The locations where the error started and ended.
    stack_symbol_type yyerror_range[3];

    /// The return value of parse ().
    int yyresult;

    // FIXME: This shoud be completely indented.  It is not yet to
    // avoid gratuitous conflicts when merging into the master branch.
    try
      {
    YYCDEBUG << "Starting parse" << std::endl;


    /* Initialize the stack.  The initial state will be set in
       yynewstate, since the latter expects the semantical and the
       location values to have been already stored, initialize these
       stacks with a primary value.  */
    yystack_.clear ();
    yypush_ (YY_NULLPTR, 0, yyla);

    // A new symbol was pushed on the stack.
  yynewstate:
    YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;

    // Accept?
    if (yystack_[0].state == yyfinal_)
      goto yyacceptlab;

    goto yybackup;

    // Backup.
  yybackup:

    // Try to take a decision without lookahead.
    yyn = yypact_[yystack_[0].state];
    if (yy_pact_value_is_default_ (yyn))
      goto yydefault;

    // Read a lookahead token.
    if (yyla.empty ())
      {
        YYCDEBUG << "Reading a token: ";
        try
          {
            symbol_type yylookahead (yylex (ctx));
            yyla.move (yylookahead);
          }
        catch (const syntax_error& yyexc)
          {
            error (yyexc);
            goto yyerrlab1;
          }
      }
    YY_SYMBOL_PRINT ("Next token is", yyla);

    /* If the proper action on seeing token YYLA.TYPE is to reduce or
       to detect an error, take that action.  */
    yyn += yyla.type_get ();
    if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ())
      goto yydefault;

    // Reduce or error.
    yyn = yytable_[yyn];
    if (yyn <= 0)
      {
        if (yy_table_value_is_error_ (yyn))
          goto yyerrlab;
        yyn = -yyn;
        goto yyreduce;
      }

    // Count tokens shifted since error; after three, turn off error status.
    if (yyerrstatus_)
      --yyerrstatus_;

    // Shift the lookahead token.
    yypush_ ("Shifting", yyn, yyla);
    goto yynewstate;

  /*-----------------------------------------------------------.
  | yydefault -- do the default action for the current state.  |
  `-----------------------------------------------------------*/
  yydefault:
    yyn = yydefact_[yystack_[0].state];
    if (yyn == 0)
      goto yyerrlab;
    goto yyreduce;

  /*-----------------------------.
  | yyreduce -- Do a reduction.  |
  `-----------------------------*/
  yyreduce:
    yylen = yyr2_[yyn];
    {
      stack_symbol_type yylhs;
      yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);
      /* Variants are always initialized to an empty instance of the
         correct type. The default '$$ = $1' action is NOT applied
         when using variants.  */
        switch (yyr1_[yyn])
    {
633
634
635
636
637
638
639
      case 168: // value
      case 172: // map_value
      case 216: // db_type
      case 292: // hr_mode
      case 421: // duid_type
      case 454: // ncr_protocol_value
      case 462: // replace_client_name_value
640
641
642
        yylhs.value.build< ElementPtr > ();
        break;

643
      case 153: // "boolean"
644
645
646
        yylhs.value.build< bool > ();
        break;

647
      case 152: // "floating point"
648
649
650
        yylhs.value.build< double > ();
        break;

651
      case 151: // "integer"
652
653
654
        yylhs.value.build< int64_t > ();
        break;

655
      case 150: // "constant string"
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
        yylhs.value.build< std::string > ();
        break;

      default:
        break;
    }


      // Compute the default @$.
      {
        slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
        YYLLOC_DEFAULT (yylhs.location, slice, yylen);
      }

      // Perform the reduction.
      YY_REDUCE_PRINT (yyn);
      try
        {
          switch (yyn)
            {
  case 2:
677
#line 235 "dhcp6_parser.yy" // lalr1.cc:859
678
    { ctx.ctx_ = ctx.NO_KEYWORD; }
679
#line 680 "dhcp6_parser.cc" // lalr1.cc:859
680
681
682
    break;

  case 4:
683
#line 236 "dhcp6_parser.yy" // lalr1.cc:859
684
    { ctx.ctx_ = ctx.CONFIG; }
685
#line 686 "dhcp6_parser.cc" // lalr1.cc:859
686
687
688
    break;

  case 6:
689
#line 237 "dhcp6_parser.yy" // lalr1.cc:859
690
    { ctx.ctx_ = ctx.DHCP6; }
691
#line 692 "dhcp6_parser.cc" // lalr1.cc:859
692
693
694
    break;

  case 8:
695
#line 238 "dhcp6_parser.yy" // lalr1.cc:859
696
    { ctx.ctx_ = ctx.INTERFACES_CONFIG; }
697
#line 698 "dhcp6_parser.cc" // lalr1.cc:859
698
699
700
    break;

  case 10:
701
#line 239 "dhcp6_parser.yy" // lalr1.cc:859
702
    { ctx.ctx_ = ctx.SUBNET6; }
703
#line 704 "dhcp6_parser.cc" // lalr1.cc:859
704
705
706
    break;

  case 12:
707
#line 240 "dhcp6_parser.yy" // lalr1.cc:859
708
    { ctx.ctx_ = ctx.POOLS; }
709
#line 710 "dhcp6_parser.cc" // lalr1.cc:859
710
711
712
    break;

  case 14:
713
#line 241 "dhcp6_parser.yy" // lalr1.cc:859
714
    { ctx.ctx_ = ctx.PD_POOLS; }
715
#line 716 "dhcp6_parser.cc" // lalr1.cc:859
716
717
718
    break;

  case 16:
719
#line 242 "dhcp6_parser.yy" // lalr1.cc:859
720
    { ctx.ctx_ = ctx.RESERVATIONS; }
721
#line 722 "dhcp6_parser.cc" // lalr1.cc:859
722
723
724
    break;

  case 18:
725
#line 243 "dhcp6_parser.yy" // lalr1.cc:859
726
    { ctx.ctx_ = ctx.OPTION_DEF; }
727
#line 728 "dhcp6_parser.cc" // lalr1.cc:859
728
729
730
    break;

  case 20:
731
#line 244 "dhcp6_parser.yy" // lalr1.cc:859
732
    { ctx.ctx_ = ctx.OPTION_DATA; }
733
#line 734 "dhcp6_parser.cc" // lalr1.cc:859
734
735
736
    break;

  case 22:
737
#line 245 "dhcp6_parser.yy" // lalr1.cc:859
738
    { ctx.ctx_ = ctx.HOOKS_LIBRARIES; }
739
#line 740 "dhcp6_parser.cc" // lalr1.cc:859
740
741
742
    break;

  case 24:
743
#line 246 "dhcp6_parser.yy" // lalr1.cc:859
744
    { ctx.ctx_ = ctx.DHCP_DDNS; }
745
#line 746 "dhcp6_parser.cc" // lalr1.cc:859
746
747
748
    break;

  case 26:
749
#line 254 "dhcp6_parser.yy" // lalr1.cc:859
750
    { yylhs.value.as< ElementPtr > () = ElementPtr(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location))); }
751
#line 752 "dhcp6_parser.cc" // lalr1.cc:859
752
753
    break;

754
  case 27:
755
#line 255 "dhcp6_parser.yy" // lalr1.cc:859
756
    { yylhs.value.as< ElementPtr > () = ElementPtr(new DoubleElement(yystack_[0].value.as< double > (), ctx.loc2pos(yystack_[0].location))); }
757
#line 758 "dhcp6_parser.cc" // lalr1.cc:859
758
759
    break;

760
  case 28:
761
#line 256 "dhcp6_parser.yy" // lalr1.cc:859
762
    { yylhs.value.as< ElementPtr > () = ElementPtr(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location))); }
763
#line 764 "dhcp6_parser.cc" // lalr1.cc:859
764
765
    break;

766
  case 29:
767
#line 257 "dhcp6_parser.yy" // lalr1.cc:859
768
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); }
769
#line 770 "dhcp6_parser.cc" // lalr1.cc:859
770
771
    break;

772
  case 30:
773
#line 258 "dhcp6_parser.yy" // lalr1.cc:859
774
    { yylhs.value.as< ElementPtr > () = ElementPtr(new NullElement(ctx.loc2pos(yystack_[0].location))); }
775
#line 776 "dhcp6_parser.cc" // lalr1.cc:859
776
777
    break;

778
  case 31:
779
#line 259 "dhcp6_parser.yy" // lalr1.cc:859
780
    { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
781
#line 782 "dhcp6_parser.cc" // lalr1.cc:859
782
783
    break;

784
  case 32:
785
#line 260 "dhcp6_parser.yy" // lalr1.cc:859
786
    { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
787
#line 788 "dhcp6_parser.cc" // lalr1.cc:859
788
789
    break;

790
  case 33:
791
#line 263 "dhcp6_parser.yy" // lalr1.cc:859
792
793
794
795
    {
    // Push back the JSON value on the stack
    ctx.stack_.push_back(yystack_[0].value.as< ElementPtr > ());
}
796
#line 797 "dhcp6_parser.cc" // lalr1.cc:859
797
798
    break;

799
  case 34:
800
#line 268 "dhcp6_parser.yy" // lalr1.cc:859
801
802
803
804
805
806
    {
    // This code is executed when we're about to start parsing
    // the content of the map
    ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(m);
}
807
#line 808 "dhcp6_parser.cc" // lalr1.cc:859
808
809
    break;

810
  case 35:
811
#line 273 "dhcp6_parser.yy" // lalr1.cc:859
812
813
814
815
816
    {
    // map parsing completed. If we ever want to do any wrap up
    // (maybe some sanity checking), this would be the best place
    // for it.
}
817
#line 818 "dhcp6_parser.cc" // lalr1.cc:859
818
819
    break;

820
  case 36:
821
#line 279 "dhcp6_parser.yy" // lalr1.cc:859
822
    { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
823
#line 824 "dhcp6_parser.cc" // lalr1.cc:859
824
825
826
    break;

  case 39:
827
#line 286 "dhcp6_parser.yy" // lalr1.cc:859
828
829
830
831
    {
                  // map containing a single entry
                  ctx.stack_.back()->set(yystack_[2].value.as< std::string > (), yystack_[0].value.as< ElementPtr > ());
                  }
832
#line 833 "dhcp6_parser.cc" // lalr1.cc:859
833
834
    break;

835
  case 40:
836
#line 290 "dhcp6_parser.yy" // lalr1.cc:859
837
838
839
840
841
    {
                  // map consisting of a shorter map followed by
                  // comma and string:value
                  ctx.stack_.back()->set(yystack_[2].value.as< std::string > (), yystack_[0].value.as< ElementPtr > ());
                  }
842
#line 843 "dhcp6_parser.cc" // lalr1.cc:859
843
844
    break;

845
  case 41:
846
#line 297 "dhcp6_parser.yy" // lalr1.cc:859
847
848
849
850
    {
    ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(l);
}
851
#line 852 "dhcp6_parser.cc" // lalr1.cc:859
852
853
    break;

854
  case 42:
855
#line 300 "dhcp6_parser.yy" // lalr1.cc:859
856
857
858
    {
    // list parsing complete. Put any sanity checking here
}
859
#line 860 "dhcp6_parser.cc" // lalr1.cc:859
860
861
    break;

862
  case 45:
863
#line 308 "dhcp6_parser.yy" // lalr1.cc:859
864
865
866
867
    {
                  // List consisting of a single element.
                  ctx.stack_.back()->add(yystack_[0].value.as< ElementPtr > ());
                  }
868
#line 869 "dhcp6_parser.cc" // lalr1.cc:859
869
870
    break;

871
  case 46:
872
#line 312 "dhcp6_parser.yy" // lalr1.cc:859
873
874
875
876
    {
                  // List ending with , and a value.
                  ctx.stack_.back()->add(yystack_[0].value.as< ElementPtr > ());
                  }
877
#line 878 "dhcp6_parser.cc" // lalr1.cc:859
878
879
    break;

880
  case 47:
881
#line 319 "dhcp6_parser.yy" // lalr1.cc:859
882
883
884
    {
    // List parsing about to start
}
885
#line 886 "dhcp6_parser.cc" // lalr1.cc:859
886
887
    break;

888
  case 48:
889
#line 321 "dhcp6_parser.yy" // lalr1.cc:859
890
891
892
893
    {
    // list parsing complete. Put any sanity checking here
    //ctx.stack_.pop_back();
}
894
#line 895 "dhcp6_parser.cc" // lalr1.cc:859
895
896
    break;

897
  case 51:
898
#line 330 "dhcp6_parser.yy" // lalr1.cc:859
899
    {
900
901
902
                          ElementPtr s(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
                          ctx.stack_.back()->add(s);
                          }
903
#line 904 "dhcp6_parser.cc" // lalr1.cc:859
904
905
    break;

906
  case 52:
907
#line 334 "dhcp6_parser.yy" // lalr1.cc:859
908
    {
909
910
911
                          ElementPtr s(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
                          ctx.stack_.back()->add(s);
                          }
912
#line 913 "dhcp6_parser.cc" // lalr1.cc:859
913
914
    break;

915
  case 53:
916
#line 345 "dhcp6_parser.yy" // lalr1.cc:859
917
918
919
920
921
922
    {
    const std::string& where = ctx.contextName();
    const std::string& keyword = yystack_[1].value.as< std::string > ();
    error(yystack_[1].location,
          "got unexpected keyword \"" + keyword + "\" in " + where + " map.");
}
923
#line 924 "dhcp6_parser.cc" // lalr1.cc:859
924
925
    break;

926
  case 54:
927
#line 355 "dhcp6_parser.yy" // lalr1.cc:859
928
929
930
931
932
933
    {
    // This code is executed when we're about to start parsing
    // the content of the map
    ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(m);
}
934
#line 935 "dhcp6_parser.cc" // lalr1.cc:859
935
936
    break;

937
  case 55:
938
#line 360 "dhcp6_parser.yy" // lalr1.cc:859
939
940
941
942
943
    {
    // map parsing completed. If we ever want to do any wrap up
    // (maybe some sanity checking), this would be the best place
    // for it.
}
944
#line 945 "dhcp6_parser.cc" // lalr1.cc:859
945
946
    break;

Francis Dupont's avatar
Francis Dupont committed
947
  case 64:
948
#line 380 "dhcp6_parser.yy" // lalr1.cc:859
949
950
951
952
953
954
955
956
    {
    // This code is executed when we're about to start parsing
    // the content of the map
    ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("Dhcp6", m);
    ctx.stack_.push_back(m);
    ctx.enter(ctx.DHCP6);
}
957
#line 958 "dhcp6_parser.cc" // lalr1.cc:859
958
959
    break;

Francis Dupont's avatar
Francis Dupont committed
960
  case 65:
961
#line 387 "dhcp6_parser.yy" // lalr1.cc:859
962
963
964
965
966
967
968
    {
    // map parsing completed. If we ever want to do any wrap up
    // (maybe some sanity checking), this would be the best place
    // for it.
    ctx.stack_.pop_back();
    ctx.leave();
}
969
#line 970 "dhcp6_parser.cc" // lalr1.cc:859
970
971
    break;

Francis Dupont's avatar
Francis Dupont committed
972
  case 66:
973
#line 397 "dhcp6_parser.yy" // lalr1.cc:859
974
975
976
977
978
    {
    // Parse the Dhcp6 map
    ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(m);
}
979
#line 980 "dhcp6_parser.cc" // lalr1.cc:859
980
981
    break;

Francis Dupont's avatar
Francis Dupont committed
982
  case 67:
983
#line 401 "dhcp6_parser.yy" // lalr1.cc:859
984
985
986
    {
    // parsing completed
}
987
#line 988 "dhcp6_parser.cc" // lalr1.cc:859
988
989
    break;

990
991
  case 93:
#line 436 "dhcp6_parser.yy" // lalr1.cc:859
992
993
994
995
    {
    ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("preferred-lifetime", prf);
}
996
#line 997 "dhcp6_parser.cc" // lalr1.cc:859
997
998
    break;

999
1000
  case 94:
#line 441 "dhcp6_parser.yy" // lalr1.cc:859
1001
1002
1003
1004
    {
    ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("valid-lifetime", prf);
}
1005
#line 1006 "dhcp6_parser.cc" // lalr1.cc:859
1006
1007
    break;

1008
1009
  case 95:
#line 446 "dhcp6_parser.yy" // lalr1.cc:859
1010
1011
1012
1013
    {
    ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("renew-timer", prf);
}
1014
#line 1015 "dhcp6_parser.cc" // lalr1.cc:859
1015
1016
    break;

1017
1018
  case 96:
#line 451 "dhcp6_parser.yy" // lalr1.cc:859
1019
1020
1021
1022
    {
    ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("rebind-timer", prf);
}
1023
#line 1024 "dhcp6_parser.cc" // lalr1.cc:859
1024
1025
    break;

1026
1027
  case 97:
#line 456 "dhcp6_parser.yy" // lalr1.cc:859
1028
1029
1030
1031
    {
    ElementPtr dpp(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("decline-probation-period", dpp);
}
1032
#line 1033 "dhcp6_parser.cc" // lalr1.cc:859
1033
1034
    break;

1035
1036
  case 98:
#line 461 "dhcp6_parser.yy" // lalr1.cc:859
1037
1038
1039
1040
1041
1042
    {
    ElementPtr i(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("interfaces-config", i);
    ctx.stack_.push_back(i);
    ctx.enter(ctx.INTERFACES_CONFIG);
}
1043
#line 1044 "dhcp6_parser.cc" // lalr1.cc:859
1044
1045
    break;

1046
1047
  case 99:
#line 466 "dhcp6_parser.yy" // lalr1.cc:859
1048
1049
1050
1051
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1052
#line 1053 "dhcp6_parser.cc" // lalr1.cc:859
1053
1054
    break;

1055
1056
  case 100:
#line 471 "dhcp6_parser.yy" // lalr1.cc:859
1057
1058
1059
1060
1061
    {
    // Parse the interfaces-config map
    ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(m);
}
1062
#line 1063 "dhcp6_parser.cc" // lalr1.cc:859
1063
1064
    break;

1065
1066
  case 101:
#line 475 "dhcp6_parser.yy" // lalr1.cc:859
1067
1068
1069
    {
    // parsing completed
}
1070
#line 1071 "dhcp6_parser.cc" // lalr1.cc:859
1071
1072
    break;

1073
1074
  case 106:
#line 487 "dhcp6_parser.yy" // lalr1.cc:859
1075
1076
1077
1078
1079
1080
    {
    ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("interfaces", l);
    ctx.stack_.push_back(l);
    ctx.enter(ctx.NO_KEYWORD);
}
1081
#line 1082 "dhcp6_parser.cc" // lalr1.cc:859
1082
1083
    break;

1084
1085
  case 107:
#line 492 "dhcp6_parser.yy" // lalr1.cc:859
1086
1087
1088
1089
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1090
#line 1091 "dhcp6_parser.cc" // lalr1.cc:859
1091
1092
    break;

1093
1094
  case 108:
#line 497 "dhcp6_parser.yy" // lalr1.cc:859
Francis Dupont's avatar
Francis Dupont committed
1095
1096
1097
1098
    {
    ElementPtr b(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("re-detect", b);
}
1099
#line 1100 "dhcp6_parser.cc" // lalr1.cc:859
Francis Dupont's avatar
Francis Dupont committed
1100
1101
    break;

1102
1103
  case 109:
#line 503 "dhcp6_parser.yy" // lalr1.cc:859
1104
1105
1106
1107
1108
1109
    {
    ElementPtr i(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("lease-database", i);
    ctx.stack_.push_back(i);
    ctx.enter(ctx.LEASE_DATABASE);
}
1110
#line 1111 "dhcp6_parser.cc" // lalr1.cc:859
1111
1112
    break;

1113
1114
  case 110:
#line 508 "dhcp6_parser.yy" // lalr1.cc:859
1115
1116
1117
1118
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1119
#line 1120 "dhcp6_parser.cc" // lalr1.cc:859
1120
1121
    break;

1122
1123
  case 111:
#line 513 "dhcp6_parser.yy" // lalr1.cc:859
1124
1125
1126
1127
1128
1129
    {
    ElementPtr i(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("hosts-database", i);
    ctx.stack_.push_back(i);
    ctx.enter(ctx.HOSTS_DATABASE);
}
1130
#line 1131 "dhcp6_parser.cc" // lalr1.cc:859
1131
1132
    break;

1133
1134
  case 112:
#line 518 "dhcp6_parser.yy" // lalr1.cc:859
1135
1136
1137
1138
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1139
#line 1140 "dhcp6_parser.cc" // lalr1.cc:859
1140
1141
    break;

1142
1143
  case 128:
#line 542 "dhcp6_parser.yy" // lalr1.cc:859
1144
    {
1145
    ctx.enter(ctx.DATABASE_TYPE);
1146
}
1147
#line 1148 "dhcp6_parser.cc" // lalr1.cc:859
1148
1149
    break;

1150
1151
  case 129:
#line 544 "dhcp6_parser.yy" // lalr1.cc:859
1152
    {
1153
    ctx.stack_.back()->set("type", yystack_[0].value.as< ElementPtr > ());
1154
1155
    ctx.leave();
}
1156
#line 1157 "dhcp6_parser.cc" // lalr1.cc:859
1157
1158
    break;

1159
1160
  case 130:
#line 549 "dhcp6_parser.yy" // lalr1.cc:859
1161
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("memfile", ctx.loc2pos(yystack_[0].location))); }
1162
#line 1163 "dhcp6_parser.cc" // lalr1.cc:859
1163
1164
    break;

1165
1166
  case 131:
#line 550 "dhcp6_parser.yy" // lalr1.cc:859
1167
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("mysql", ctx.loc2pos(yystack_[0].location))); }
1168
#line 1169 "dhcp6_parser.cc" // lalr1.cc:859
1169
1170
    break;

1171
1172
  case 132:
#line 551 "dhcp6_parser.yy" // lalr1.cc:859
1173
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("postgresql", ctx.loc2pos(yystack_[0].location))); }
1174
#line 1175 "dhcp6_parser.cc" // lalr1.cc:859
1175
1176
    break;

1177
1178
  case 133:
#line 552 "dhcp6_parser.yy" // lalr1.cc:859
1179
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("cql", ctx.loc2pos(yystack_[0].location))); }
1180
#line 1181 "dhcp6_parser.cc" // lalr1.cc:859
1181
1182
    break;

1183
1184
  case 134:
#line 555 "dhcp6_parser.yy" // lalr1.cc:859
1185
1186
1187
    {
    ctx.enter(ctx.NO_KEYWORD);
}
1188
#line 1189 "dhcp6_parser.cc" // lalr1.cc:859
1189
1190
    break;

1191
1192
  case 135:
#line 557 "dhcp6_parser.yy" // lalr1.cc:859
1193
1194
1195
1196
1197
    {
    ElementPtr user(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("user", user);
    ctx.leave();
}
1198
#line 1199 "dhcp6_parser.cc" // lalr1.cc:859
1199
1200
    break;

1201
1202
  case 136:
#line 563 "dhcp6_parser.yy" // lalr1.cc:859
1203
1204
1205
    {
    ctx.enter(ctx.NO_KEYWORD);
}
1206
#line 1207 "dhcp6_parser.cc" // lalr1.cc:859
1207
1208
    break;

1209
1210
  case 137:
#line 565 "dhcp6_parser.yy" // lalr1.cc:859
1211
1212
1213
1214
1215
    {
    ElementPtr pwd(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("password", pwd);
    ctx.leave();
}
1216
#line 1217 "dhcp6_parser.cc" // lalr1.cc:859
1217
1218
    break;

1219
1220
  case 138:
#line 571 "dhcp6_parser.yy" // lalr1.cc:859
1221
1222
1223
    {
    ctx.enter(ctx.NO_KEYWORD);
}
1224
#line 1225 "dhcp6_parser.cc" // lalr1.cc:859
1225
1226
    break;

1227
1228
  case 139:
#line 573 "dhcp6_parser.yy" // lalr1.cc:859
1229
1230
1231
1232
1233
    {
    ElementPtr h(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("host", h);
    ctx.leave();
}
1234
#line 1235 "dhcp6_parser.cc" // lalr1.cc:859
1235
1236
    break;

1237
1238
  case 140:
#line 579 "dhcp6_parser.yy" // lalr1.cc:859
Francis Dupont's avatar
Francis Dupont committed
1239
1240
1241
1242
    {
    ElementPtr p(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("port", p);
}
1243
#line 1244 "dhcp6_parser.cc" // lalr1.cc:859
Francis Dupont's avatar
Francis Dupont committed
1244
1245
    break;

1246
1247
  case 141:
#line 584 "dhcp6_parser.yy" // lalr1.cc:859
1248
1249
1250
    {
    ctx.enter(ctx.NO_KEYWORD);
}
1251
#line 1252 "dhcp6_parser.cc" // lalr1.cc:859
1252