dhcp4_parser.cc 144 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   parser4_lex

// First part of user declarations.

#line 39 "dhcp4_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 "dhcp4_parser.h"

// User implementation prologue.

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

#include <dhcp4/parser_context.h>

#line 59 "dhcp4_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 PARSER4_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 // !PARSER4_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 // !PARSER4_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 "dhcp4_parser.yy" // lalr1.cc:479
namespace isc { namespace dhcp {
#line 145 "dhcp4_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
  Dhcp4Parser::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.
  Dhcp4Parser::Dhcp4Parser (isc::dhcp::Parser4Context& ctx_yyarg)
    :
#if PARSER4_DEBUG
      yydebug_ (false),
      yycdebug_ (&std::cerr),
#endif
      ctx (ctx_yyarg)
  {}

  Dhcp4Parser::~Dhcp4Parser ()
  {}


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



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

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

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

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

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

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

  inline
  Dhcp4Parser::stack_symbol_type::stack_symbol_type ()
  {}


  inline
  Dhcp4Parser::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 159: // value
      case 163: // map_value
      case 201: // socket_type
      case 211: // db_type
      case 288: // hr_mode
      case 429: // ncr_protocol_value
      case 437: // replace_client_name_value
263
264
265
        value.move< ElementPtr > (that.value);
        break;

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

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

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

278
      case 142: // "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
  Dhcp4Parser::stack_symbol_type&
  Dhcp4Parser::stack_symbol_type::operator= (const stack_symbol_type& that)
  {
    state = that.state;
      switch (that.type_get ())
    {
297
298
299
300
301
302
303
      case 159: // value
      case 163: // map_value
      case 201: // socket_type
      case 211: // db_type
      case 288: // hr_mode
      case 429: // ncr_protocol_value
      case 437: // replace_client_name_value
304
305
306
        value.copy< ElementPtr > (that.value);
        break;

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

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

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

319
      case 142: // "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
  Dhcp4Parser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
  {
    if (yymsg)
      YY_SYMBOL_PRINT (yymsg, yysym);
  }

#if PARSER4_DEBUG
  template <typename Base>
  void
  Dhcp4Parser::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 142: // "constant string"
360

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

366
      case 143: // "integer"
367

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

373
      case 144: // "floating point"
374

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

380
      case 145: // "boolean"
381

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

387
      case 159: // value
388

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

394
      case 163: // map_value
395

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

401
      case 201: // socket_type
402

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

408
      case 211: // db_type
409

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

415
      case 288: // hr_mode
416

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

422
      case 429: // ncr_protocol_value
423

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

429
      case 437: // replace_client_name_value
430

431
#line 219 "dhcp4_parser.yy" // lalr1.cc:636
432
433
        { yyoutput << yysym.value.template as< ElementPtr > (); }
#line 434 "dhcp4_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
  Dhcp4Parser::yypush_ (const char* m, state_type s, symbol_type& sym)
  {
    stack_symbol_type t (s, sym);
    yypush_ (m, t);
  }

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

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

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

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


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

  void
  Dhcp4Parser::set_debug_level (debug_level_type l)
  {
    yydebug_ = l;
  }
#endif // PARSER4_DEBUG

  inline Dhcp4Parser::state_type
  Dhcp4Parser::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
  Dhcp4Parser::yy_pact_value_is_default_ (int yyvalue)
  {
    return yyvalue == yypact_ninf_;
  }

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

  int
  Dhcp4Parser::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 159: // value
      case 163: // map_value
      case 201: // socket_type
      case 211: // db_type
      case 288: // hr_mode
      case 429: // ncr_protocol_value
      case 437: // replace_client_name_value
640
641
642
        yylhs.value.build< ElementPtr > ();
        break;

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

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

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

655
      case 142: // "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 228 "dhcp4_parser.yy" // lalr1.cc:859
678
    { ctx.ctx_ = ctx.NO_KEYWORD; }
679
#line 680 "dhcp4_parser.cc" // lalr1.cc:859
680
681
682
    break;

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

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

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

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

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

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

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

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

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

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

  case 24:
743
#line 246 "dhcp4_parser.yy" // lalr1.cc:859
744
    { yylhs.value.as< ElementPtr > () = ElementPtr(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location))); }
745
#line 746 "dhcp4_parser.cc" // lalr1.cc:859
746
747
    break;

748
  case 25:
749
#line 247 "dhcp4_parser.yy" // lalr1.cc:859
750
    { yylhs.value.as< ElementPtr > () = ElementPtr(new DoubleElement(yystack_[0].value.as< double > (), ctx.loc2pos(yystack_[0].location))); }
751
#line 752 "dhcp4_parser.cc" // lalr1.cc:859
752
753
    break;

754
  case 26:
755
#line 248 "dhcp4_parser.yy" // lalr1.cc:859
756
    { yylhs.value.as< ElementPtr > () = ElementPtr(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location))); }
757
#line 758 "dhcp4_parser.cc" // lalr1.cc:859
758
759
    break;

760
  case 27:
761
#line 249 "dhcp4_parser.yy" // lalr1.cc:859
762
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location))); }
763
#line 764 "dhcp4_parser.cc" // lalr1.cc:859
764
765
    break;

766
  case 28:
767
#line 250 "dhcp4_parser.yy" // lalr1.cc:859
768
    { yylhs.value.as< ElementPtr > () = ElementPtr(new NullElement(ctx.loc2pos(yystack_[0].location))); }
769
#line 770 "dhcp4_parser.cc" // lalr1.cc:859
770
771
    break;

772
  case 29:
773
#line 251 "dhcp4_parser.yy" // lalr1.cc:859
774
    { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
775
#line 776 "dhcp4_parser.cc" // lalr1.cc:859
776
777
    break;

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

784
  case 31:
785
#line 255 "dhcp4_parser.yy" // lalr1.cc:859
786
787
788
789
    {
    // Push back the JSON value on the stack
    ctx.stack_.push_back(yystack_[0].value.as< ElementPtr > ());
}
790
#line 791 "dhcp4_parser.cc" // lalr1.cc:859
791
792
    break;

793
  case 32:
794
#line 260 "dhcp4_parser.yy" // lalr1.cc:859
795
796
797
798
799
800
    {
    // 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);
}
801
#line 802 "dhcp4_parser.cc" // lalr1.cc:859
802
803
    break;

804
  case 33:
805
#line 265 "dhcp4_parser.yy" // lalr1.cc:859
806
807
808
809
810
    {
    // map parsing completed. If we ever want to do any wrap up
    // (maybe some sanity checking), this would be the best place
    // for it.
}
811
#line 812 "dhcp4_parser.cc" // lalr1.cc:859
812
813
    break;

814
  case 34:
815
#line 271 "dhcp4_parser.yy" // lalr1.cc:859
816
    { yylhs.value.as< ElementPtr > () = ctx.stack_.back(); ctx.stack_.pop_back(); }
817
#line 818 "dhcp4_parser.cc" // lalr1.cc:859
818
819
820
    break;

  case 37:
821
#line 278 "dhcp4_parser.yy" // lalr1.cc:859
822
823
824
825
    {
                  // map containing a single entry
                  ctx.stack_.back()->set(yystack_[2].value.as< std::string > (), yystack_[0].value.as< ElementPtr > ());
                  }
826
#line 827 "dhcp4_parser.cc" // lalr1.cc:859
827
828
    break;

829
  case 38:
830
#line 282 "dhcp4_parser.yy" // lalr1.cc:859
831
832
833
834
835
    {
                  // 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 > ());
                  }
836
#line 837 "dhcp4_parser.cc" // lalr1.cc:859
837
838
    break;

839
  case 39:
840
#line 289 "dhcp4_parser.yy" // lalr1.cc:859
841
842
843
844
    {
    ElementPtr l(new ListElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(l);
}
845
#line 846 "dhcp4_parser.cc" // lalr1.cc:859
846
847
    break;

848
  case 40:
849
#line 292 "dhcp4_parser.yy" // lalr1.cc:859
850
851
852
    {
    // list parsing complete. Put any sanity checking here
}
853
#line 854 "dhcp4_parser.cc" // lalr1.cc:859
854
855
    break;

856
  case 43:
857
#line 300 "dhcp4_parser.yy" // lalr1.cc:859
858
859
860
861
    {
                  // List consisting of a single element.
                  ctx.stack_.back()->add(yystack_[0].value.as< ElementPtr > ());
                  }
862
#line 863 "dhcp4_parser.cc" // lalr1.cc:859
863
864
    break;

865
  case 44:
866
#line 304 "dhcp4_parser.yy" // lalr1.cc:859
867
868
869
870
    {
                  // List ending with , and a value.
                  ctx.stack_.back()->add(yystack_[0].value.as< ElementPtr > ());
                  }
871
#line 872 "dhcp4_parser.cc" // lalr1.cc:859
872
873
    break;

874
  case 45:
875
#line 311 "dhcp4_parser.yy" // lalr1.cc:859
876
877
878
    {
    // List parsing about to start
}
879
#line 880 "dhcp4_parser.cc" // lalr1.cc:859
880
881
    break;

882
  case 46:
883
#line 313 "dhcp4_parser.yy" // lalr1.cc:859
884
885
886
887
    {
    // list parsing complete. Put any sanity checking here
    //ctx.stack_.pop_back();
}
888
#line 889 "dhcp4_parser.cc" // lalr1.cc:859
889
890
    break;

891
  case 49:
892
#line 322 "dhcp4_parser.yy" // lalr1.cc:859
893
    {
894
895
896
                          ElementPtr s(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
                          ctx.stack_.back()->add(s);
                          }
897
#line 898 "dhcp4_parser.cc" // lalr1.cc:859
898
899
    break;

900
  case 50:
901
#line 326 "dhcp4_parser.yy" // lalr1.cc:859
902
    {
903
904
905
                          ElementPtr s(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
                          ctx.stack_.back()->add(s);
                          }
906
#line 907 "dhcp4_parser.cc" // lalr1.cc:859
907
908
    break;

909
  case 51:
910
#line 337 "dhcp4_parser.yy" // lalr1.cc:859
911
912
913
914
915
916
    {
    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.");
}
917
#line 918 "dhcp4_parser.cc" // lalr1.cc:859
918
919
    break;

920
  case 52:
921
#line 347 "dhcp4_parser.yy" // lalr1.cc:859
922
923
924
925
926
927
    {
    // 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);
}
928
#line 929 "dhcp4_parser.cc" // lalr1.cc:859
929
930
    break;

931
  case 53:
932
#line 352 "dhcp4_parser.yy" // lalr1.cc:859
933
934
935
936
937
    {
    // map parsing completed. If we ever want to do any wrap up
    // (maybe some sanity checking), this would be the best place
    // for it.
}
938
#line 939 "dhcp4_parser.cc" // lalr1.cc:859
939
940
    break;

Francis Dupont's avatar
Francis Dupont committed
941
  case 62:
942
#line 373 "dhcp4_parser.yy" // lalr1.cc:859
943
944
945
946
947
948
949
950
    {
    // 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("Dhcp4", m);
    ctx.stack_.push_back(m);
    ctx.enter(ctx.DHCP4);
}
951
#line 952 "dhcp4_parser.cc" // lalr1.cc:859
952
953
    break;

Francis Dupont's avatar
Francis Dupont committed
954
  case 63:
955
#line 380 "dhcp4_parser.yy" // lalr1.cc:859
956
957
958
959
960
961
962
    {
    // 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();
}
963
#line 964 "dhcp4_parser.cc" // lalr1.cc:859
964
965
    break;

Francis Dupont's avatar
Francis Dupont committed
966
  case 64:
967
#line 390 "dhcp4_parser.yy" // lalr1.cc:859
968
    {
Francis Dupont's avatar
Francis Dupont committed
969
    // Parse the Dhcp4 map
970
971
972
    ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(m);
}
973
#line 974 "dhcp4_parser.cc" // lalr1.cc:859
974
975
    break;

Francis Dupont's avatar
Francis Dupont committed
976
  case 65:
977
#line 394 "dhcp4_parser.yy" // lalr1.cc:859
978
979
980
    {
    // parsing completed
}
981
#line 982 "dhcp4_parser.cc" // lalr1.cc:859
982
983
    break;

984
985
  case 90:
#line 428 "dhcp4_parser.yy" // lalr1.cc:859
986
987
988
989
    {
    ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("valid-lifetime", prf);
}
990
#line 991 "dhcp4_parser.cc" // lalr1.cc:859
991
992
    break;

993
994
  case 91:
#line 433 "dhcp4_parser.yy" // lalr1.cc:859
995
996
997
998
    {
    ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("renew-timer", prf);
}
999
#line 1000 "dhcp4_parser.cc" // lalr1.cc:859
1000
1001
    break;

1002
1003
  case 92:
#line 438 "dhcp4_parser.yy" // lalr1.cc:859
1004
1005
1006
1007
    {
    ElementPtr prf(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("rebind-timer", prf);
}
1008
#line 1009 "dhcp4_parser.cc" // lalr1.cc:859
1009
1010
    break;

1011
1012
  case 93:
#line 443 "dhcp4_parser.yy" // lalr1.cc:859
1013
1014
1015
1016
    {
    ElementPtr dpp(new IntElement(yystack_[0].value.as< int64_t > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("decline-probation-period", dpp);
}
1017
#line 1018 "dhcp4_parser.cc" // lalr1.cc:859
1018
1019
    break;

1020
1021
  case 94:
#line 448 "dhcp4_parser.yy" // lalr1.cc:859
1022
    {
Francis Dupont's avatar
Francis Dupont committed
1023
    ElementPtr echo(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location)));
1024
1025
    ctx.stack_.back()->set("echo-client-id", echo);
}
1026
#line 1027 "dhcp4_parser.cc" // lalr1.cc:859
1027
1028
    break;

1029
1030
  case 95:
#line 453 "dhcp4_parser.yy" // lalr1.cc:859
1031
    {
Francis Dupont's avatar
Francis Dupont committed
1032
    ElementPtr match(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location)));
1033
1034
    ctx.stack_.back()->set("match-client-id", match);
}
1035
#line 1036 "dhcp4_parser.cc" // lalr1.cc:859
1036
1037
    break;

1038
1039
  case 96:
#line 459 "dhcp4_parser.yy" // lalr1.cc:859
1040
1041
1042
1043
1044
1045
    {
    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);
}
1046
#line 1047 "dhcp4_parser.cc" // lalr1.cc:859
1047
1048
    break;

1049
1050
  case 97:
#line 464 "dhcp4_parser.yy" // lalr1.cc:859
1051
1052
1053
1054
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1055
#line 1056 "dhcp4_parser.cc" // lalr1.cc:859
1056
1057
    break;

1058
1059
  case 103:
#line 478 "dhcp4_parser.yy" // lalr1.cc:859
1060
1061
1062
1063
1064
    {
    // Parse the interfaces-config map
    ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.push_back(m);
}
1065
#line 1066 "dhcp4_parser.cc" // lalr1.cc:859
1066
1067
    break;

1068
1069
  case 104:
#line 482 "dhcp4_parser.yy" // lalr1.cc:859
1070
1071
1072
    {
    // parsing completed
}
1073
#line 1074 "dhcp4_parser.cc" // lalr1.cc:859
1074
1075
    break;

1076
1077
  case 105:
#line 486 "dhcp4_parser.yy" // lalr1.cc:859
1078
1079
1080
1081
1082
1083
    {
    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);
}
1084
#line 1085 "dhcp4_parser.cc" // lalr1.cc:859
1085
1086
    break;

1087
1088
  case 106:
#line 491 "dhcp4_parser.yy" // lalr1.cc:859
1089
1090
1091
1092
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1093
#line 1094 "dhcp4_parser.cc" // lalr1.cc:859
1094
1095
    break;

1096
1097
  case 107:
#line 496 "dhcp4_parser.yy" // lalr1.cc:859
1098
    {
1099
    ctx.enter(ctx.DHCP_SOCKET_TYPE);
1100
}
1101
#line 1102 "dhcp4_parser.cc" // lalr1.cc:859
1102
1103
    break;

1104
1105
  case 108:
#line 498 "dhcp4_parser.yy" // lalr1.cc:859
1106
    {
1107
    ctx.stack_.back()->set("dhcp-socket-type", yystack_[0].value.as< ElementPtr > ());
1108
1109
    ctx.leave();
}
1110
#line 1111 "dhcp4_parser.cc" // lalr1.cc:859
1111
1112
    break;

1113
1114
  case 109:
#line 503 "dhcp4_parser.yy" // lalr1.cc:859
1115
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("raw", ctx.loc2pos(yystack_[0].location))); }
1116
#line 1117 "dhcp4_parser.cc" // lalr1.cc:859
1117
1118
    break;

1119
1120
  case 110:
#line 504 "dhcp4_parser.yy" // lalr1.cc:859
1121
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("udp", ctx.loc2pos(yystack_[0].location))); }
1122
#line 1123 "dhcp4_parser.cc" // lalr1.cc:859
1123
1124
    break;

1125
1126
  case 111:
#line 507 "dhcp4_parser.yy" // lalr1.cc:859
Francis Dupont's avatar
Francis Dupont committed
1127
1128
1129
1130
    {
    ElementPtr b(new BoolElement(yystack_[0].value.as< bool > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("re-detect", b);
}
1131
#line 1132 "dhcp4_parser.cc" // lalr1.cc:859
Francis Dupont's avatar
Francis Dupont committed
1132
1133
    break;

1134
1135
  case 112:
#line 513 "dhcp4_parser.yy" // lalr1.cc:859
1136
1137
1138
1139
1140
1141
    {
    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);
}
1142
#line 1143 "dhcp4_parser.cc" // lalr1.cc:859
1143
1144
    break;

1145
1146
  case 113:
#line 518 "dhcp4_parser.yy" // lalr1.cc:859
1147
1148
1149
1150
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1151
#line 1152 "dhcp4_parser.cc" // lalr1.cc:859
1152
1153
    break;

1154
1155
  case 114:
#line 523 "dhcp4_parser.yy" // lalr1.cc:859
1156
1157
1158
1159
1160
1161
    {
    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);
}
1162
#line 1163 "dhcp4_parser.cc" // lalr1.cc:859
1163
1164
    break;

1165
1166
  case 115:
#line 528 "dhcp4_parser.yy" // lalr1.cc:859
1167
1168
1169
1170
    {
    ctx.stack_.pop_back();
    ctx.leave();
}
1171
#line 1172 "dhcp4_parser.cc" // lalr1.cc:859
1172
1173
    break;

1174
1175
  case 131:
#line 552 "dhcp4_parser.yy" // lalr1.cc:859
1176
    {
1177
    ctx.enter(ctx.DATABASE_TYPE);
1178
}
1179
#line 1180 "dhcp4_parser.cc" // lalr1.cc:859
1180
1181
    break;

1182
1183
  case 132:
#line 554 "dhcp4_parser.yy" // lalr1.cc:859
1184
    {
1185
    ctx.stack_.back()->set("type", yystack_[0].value.as< ElementPtr > ());
1186
1187
    ctx.leave();
}
1188
#line 1189 "dhcp4_parser.cc" // lalr1.cc:859
1189
1190
    break;

1191
1192
  case 133:
#line 559 "dhcp4_parser.yy" // lalr1.cc:859
1193
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("memfile", ctx.loc2pos(yystack_[0].location))); }
1194
#line 1195 "dhcp4_parser.cc" // lalr1.cc:859
1195
1196
    break;

1197
1198
  case 134:
#line 560 "dhcp4_parser.yy" // lalr1.cc:859
1199
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("mysql", ctx.loc2pos(yystack_[0].location))); }
1200
#line 1201 "dhcp4_parser.cc" // lalr1.cc:859
1201
1202
    break;

1203
1204
  case 135:
#line 561 "dhcp4_parser.yy" // lalr1.cc:859
1205
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("postgresql", ctx.loc2pos(yystack_[0].location))); }
1206
#line 1207 "dhcp4_parser.cc" // lalr1.cc:859
1207
1208
    break;

1209
1210
  case 136:
#line 562 "dhcp4_parser.yy" // lalr1.cc:859
1211
    { yylhs.value.as< ElementPtr > () = ElementPtr(new StringElement("cql", ctx.loc2pos(yystack_[0].location))); }
1212
#line 1213 "dhcp4_parser.cc" // lalr1.cc:859
1213
1214
    break;

1215
1216
  case 137:
#line 565 "dhcp4_parser.yy" // lalr1.cc:859
1217
1218
1219
    {
    ctx.enter(ctx.NO_KEYWORD);
}
1220
#line 1221 "dhcp4_parser.cc" // lalr1.cc:859
1221
1222
    break;

1223
1224
  case 138:
#line 567 "dhcp4_parser.yy" // lalr1.cc:859
1225
1226
1227
1228
1229
    {
    ElementPtr user(new StringElement(yystack_[0].value.as< std::string > (), ctx.loc2pos(yystack_[0].location)));
    ctx.stack_.back()->set("user", user);
    ctx.leave();
}
1230
#line 1231 "dhcp4_parser.cc" // lalr1.cc:859
1231
1232
    break;

1233
1234
  case 139:
#line 573 "dhcp4_parser.yy" // lalr1.cc:859