Kea 1.5.0
parser.cc
Go to the documentation of this file.
1// A Bison parser, made by GNU Bison 3.2.1.
2
3// Skeleton implementation for Bison LALR(1) parsers in C++
4
5// Copyright (C) 2002-2015, 2018 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 <http://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// Undocumented macros, especially those whose name start with YY_,
34// are private implementation details. Do not rely on them.
35
36
37// Take the name prefix into account.
38#define yylex evallex
39
40
41
42#include "parser.h"
43
44
45// Unqualified %code blocks.
46#line 33 "parser.yy" // lalr1.cc:438
47
48# include "eval_context.h"
49
50#line 51 "parser.cc" // lalr1.cc:438
51
52
53#ifndef YY_
54# if defined YYENABLE_NLS && YYENABLE_NLS
55# if ENABLE_NLS
56# include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
57# define YY_(msgid) dgettext ("bison-runtime", msgid)
58# endif
59# endif
60# ifndef YY_
61# define YY_(msgid) msgid
62# endif
63#endif
64
65// Whether we are compiled with exception support.
66#ifndef YY_EXCEPTIONS
67# if defined __GNUC__ && !defined __EXCEPTIONS
68# define YY_EXCEPTIONS 0
69# else
70# define YY_EXCEPTIONS 1
71# endif
72#endif
73
74#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
75/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
76 If N is 0, then set CURRENT to the empty location which ends
77 the previous symbol: RHS[0] (always defined). */
78
79# ifndef YYLLOC_DEFAULT
80# define YYLLOC_DEFAULT(Current, Rhs, N) \
81 do \
82 if (N) \
83 { \
84 (Current).begin = YYRHSLOC (Rhs, 1).begin; \
85 (Current).end = YYRHSLOC (Rhs, N).end; \
86 } \
87 else \
88 { \
89 (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
90 } \
91 while (/*CONSTCOND*/ false)
92# endif
93
94
95// Suppress unused-variable warnings by "using" E.
96#define YYUSE(E) ((void) (E))
97
98// Enable debugging if requested.
99#if EVALDEBUG
100
101// A pseudo ostream that takes yydebug_ into account.
102# define YYCDEBUG if (yydebug_) (*yycdebug_)
103
104# define YY_SYMBOL_PRINT(Title, Symbol) \
105 do { \
106 if (yydebug_) \
107 { \
108 *yycdebug_ << Title << ' '; \
109 yy_print_ (*yycdebug_, Symbol); \
110 *yycdebug_ << '\n'; \
111 } \
112 } while (false)
113
114# define YY_REDUCE_PRINT(Rule) \
115 do { \
116 if (yydebug_) \
117 yy_reduce_print_ (Rule); \
118 } while (false)
119
120# define YY_STACK_PRINT() \
121 do { \
122 if (yydebug_) \
123 yystack_print_ (); \
124 } while (false)
125
126#else // !EVALDEBUG
127
128# define YYCDEBUG if (false) std::cerr
129# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
130# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
131# define YY_STACK_PRINT() static_cast<void> (0)
132
133#endif // !EVALDEBUG
134
135#define yyerrok (yyerrstatus_ = 0)
136#define yyclearin (yyla.clear ())
137
138#define YYACCEPT goto yyacceptlab
139#define YYABORT goto yyabortlab
140#define YYERROR goto yyerrorlab
141#define YYRECOVERING() (!!yyerrstatus_)
142
143#line 14 "parser.yy" // lalr1.cc:513
144namespace isc { namespace eval {
145#line 146 "parser.cc" // lalr1.cc:513
146
147 /* Return YYSTR after stripping away unnecessary quotes and
148 backslashes, so that it's suitable for yyerror. The heuristic is
149 that double-quoting is unnecessary unless the string contains an
150 apostrophe, a comma, or backslash (other than backslash-backslash).
151 YYSTR is taken from yytname. */
152 std::string
153 EvalParser::yytnamerr_ (const char *yystr)
154 {
155 if (*yystr == '"')
156 {
157 std::string yyr = "";
158 char const *yyp = yystr;
159
160 for (;;)
161 switch (*++yyp)
162 {
163 case '\'':
164 case ',':
165 goto do_not_strip_quotes;
166
167 case '\\':
168 if (*++yyp != '\\')
169 goto do_not_strip_quotes;
170 // Fall through.
171 default:
172 yyr += *yyp;
173 break;
174
175 case '"':
176 return yyr;
177 }
178 do_not_strip_quotes: ;
179 }
180
181 return yystr;
182 }
183
184
187 :
189 yydebug_ (false),
190 yycdebug_ (&std::cerr),
191#endif
192 ctx (ctx_yyarg)
193 {}
194
196 {}
197
198
199 /*---------------.
200 | Symbol types. |
201 `---------------*/
202
203
204
205 // by_state.
206 EvalParser::by_state::by_state ()
207 : state (empty_state)
208 {}
209
210 EvalParser::by_state::by_state (const by_state& other)
211 : state (other.state)
212 {}
213
214 void
215 EvalParser::by_state::clear ()
216 {
217 state = empty_state;
218 }
219
220 void
221 EvalParser::by_state::move (by_state& that)
222 {
223 state = that.state;
224 that.clear ();
225 }
226
227 EvalParser::by_state::by_state (state_type s)
228 : state (s)
229 {}
230
232 EvalParser::by_state::type_get () const
233 {
234 if (state == empty_state)
235 return empty_symbol;
236 else
237 return yystos_[state];
238 }
239
240 EvalParser::stack_symbol_type::stack_symbol_type ()
241 {}
242
243 EvalParser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
244 : super_type (YY_MOVE (that.state), YY_MOVE (that.location))
245 {
246 switch (that.type_get ())
247 {
248 case 62: // option_repr_type
249 value.YY_MOVE_OR_COPY< TokenOption::RepresentationType > (YY_MOVE (that.value));
250 break;
251
252 case 66: // pkt4_field
253 value.YY_MOVE_OR_COPY< TokenPkt4::FieldType > (YY_MOVE (that.value));
254 break;
255
256 case 67: // pkt6_field
257 value.YY_MOVE_OR_COPY< TokenPkt6::FieldType > (YY_MOVE (that.value));
258 break;
259
260 case 64: // pkt_metadata
261 value.YY_MOVE_OR_COPY< TokenPkt::MetadataType > (YY_MOVE (that.value));
262 break;
263
264 case 68: // relay6_field
265 value.YY_MOVE_OR_COPY< TokenRelay6Field::FieldType > (YY_MOVE (that.value));
266 break;
267
268 case 63: // nest_level
269 value.YY_MOVE_OR_COPY< int8_t > (YY_MOVE (that.value));
270 break;
271
272 case 50: // "constant string"
273 case 51: // "integer"
274 case 52: // "constant hexstring"
275 case 53: // "option name"
276 case 54: // "ip address"
277 value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value));
278 break;
279
280 case 61: // option_code
281 value.YY_MOVE_OR_COPY< uint16_t > (YY_MOVE (that.value));
282 break;
283
284 case 60: // integer_expr
285 case 65: // enterprise_id
286 value.YY_MOVE_OR_COPY< uint32_t > (YY_MOVE (that.value));
287 break;
288
289 default:
290 break;
291 }
292
293#if 201103L <= YY_CPLUSPLUS
294 // that is emptied.
295 that.state = empty_state;
296#endif
297 }
298
299 EvalParser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
300 : super_type (s, YY_MOVE (that.location))
301 {
302 switch (that.type_get ())
303 {
304 case 62: // option_repr_type
305 value.move< TokenOption::RepresentationType > (YY_MOVE (that.value));
306 break;
307
308 case 66: // pkt4_field
309 value.move< TokenPkt4::FieldType > (YY_MOVE (that.value));
310 break;
311
312 case 67: // pkt6_field
313 value.move< TokenPkt6::FieldType > (YY_MOVE (that.value));
314 break;
315
316 case 64: // pkt_metadata
317 value.move< TokenPkt::MetadataType > (YY_MOVE (that.value));
318 break;
319
320 case 68: // relay6_field
321 value.move< TokenRelay6Field::FieldType > (YY_MOVE (that.value));
322 break;
323
324 case 63: // nest_level
325 value.move< int8_t > (YY_MOVE (that.value));
326 break;
327
328 case 50: // "constant string"
329 case 51: // "integer"
330 case 52: // "constant hexstring"
331 case 53: // "option name"
332 case 54: // "ip address"
333 value.move< std::string > (YY_MOVE (that.value));
334 break;
335
336 case 61: // option_code
337 value.move< uint16_t > (YY_MOVE (that.value));
338 break;
339
340 case 60: // integer_expr
341 case 65: // enterprise_id
342 value.move< uint32_t > (YY_MOVE (that.value));
343 break;
344
345 default:
346 break;
347 }
348
349 // that is emptied.
350 that.type = empty_symbol;
351 }
352
353#if YY_CPLUSPLUS < 201103L
354 EvalParser::stack_symbol_type&
355 EvalParser::stack_symbol_type::operator= (stack_symbol_type& that)
356 {
357 state = that.state;
358 switch (that.type_get ())
359 {
360 case 62: // option_repr_type
361 value.move< TokenOption::RepresentationType > (that.value);
362 break;
363
364 case 66: // pkt4_field
365 value.move< TokenPkt4::FieldType > (that.value);
366 break;
367
368 case 67: // pkt6_field
369 value.move< TokenPkt6::FieldType > (that.value);
370 break;
371
372 case 64: // pkt_metadata
373 value.move< TokenPkt::MetadataType > (that.value);
374 break;
375
376 case 68: // relay6_field
377 value.move< TokenRelay6Field::FieldType > (that.value);
378 break;
379
380 case 63: // nest_level
381 value.move< int8_t > (that.value);
382 break;
383
384 case 50: // "constant string"
385 case 51: // "integer"
386 case 52: // "constant hexstring"
387 case 53: // "option name"
388 case 54: // "ip address"
389 value.move< std::string > (that.value);
390 break;
391
392 case 61: // option_code
393 value.move< uint16_t > (that.value);
394 break;
395
396 case 60: // integer_expr
397 case 65: // enterprise_id
398 value.move< uint32_t > (that.value);
399 break;
400
401 default:
402 break;
403 }
404
405 location = that.location;
406 // that is emptied.
407 that.state = empty_state;
408 return *this;
409 }
410#endif
411
412 template <typename Base>
413 void
414 EvalParser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
415 {
416 if (yymsg)
417 YY_SYMBOL_PRINT (yymsg, yysym);
418 }
419
420#if EVALDEBUG
421 template <typename Base>
422 void
423 EvalParser::yy_print_ (std::ostream& yyo,
424 const basic_symbol<Base>& yysym) const
425 {
426 std::ostream& yyoutput = yyo;
427 YYUSE (yyoutput);
428 symbol_number_type yytype = yysym.type_get ();
429 // Avoid a (spurious) G++ 4.8 warning about "array subscript is
430 // below array bounds".
431 if (yysym.empty ())
432 std::abort ();
433 yyo << (yytype < yyntokens_ ? "token" : "nterm")
434 << ' ' << yytname_[yytype] << " ("
435 << yysym.location << ": ";
436 switch (yytype)
437 {
438 case 50: // "constant string"
439
440#line 111 "parser.yy" // lalr1.cc:672
441 { yyoutput << yysym.value.template as< std::string > (); }
442#line 443 "parser.cc" // lalr1.cc:672
443 break;
444
445 case 51: // "integer"
446
447#line 111 "parser.yy" // lalr1.cc:672
448 { yyoutput << yysym.value.template as< std::string > (); }
449#line 450 "parser.cc" // lalr1.cc:672
450 break;
451
452 case 52: // "constant hexstring"
453
454#line 111 "parser.yy" // lalr1.cc:672
455 { yyoutput << yysym.value.template as< std::string > (); }
456#line 457 "parser.cc" // lalr1.cc:672
457 break;
458
459 case 53: // "option name"
460
461#line 111 "parser.yy" // lalr1.cc:672
462 { yyoutput << yysym.value.template as< std::string > (); }
463#line 464 "parser.cc" // lalr1.cc:672
464 break;
465
466 case 54: // "ip address"
467
468#line 111 "parser.yy" // lalr1.cc:672
469 { yyoutput << yysym.value.template as< std::string > (); }
470#line 471 "parser.cc" // lalr1.cc:672
471 break;
472
473 case 60: // integer_expr
474
475#line 111 "parser.yy" // lalr1.cc:672
476 { yyoutput << yysym.value.template as< uint32_t > (); }
477#line 478 "parser.cc" // lalr1.cc:672
478 break;
479
480 case 61: // option_code
481
482#line 111 "parser.yy" // lalr1.cc:672
483 { yyoutput << yysym.value.template as< uint16_t > (); }
484#line 485 "parser.cc" // lalr1.cc:672
485 break;
486
487 case 62: // option_repr_type
488
489#line 111 "parser.yy" // lalr1.cc:672
490 { yyoutput << yysym.value.template as< TokenOption::RepresentationType > (); }
491#line 492 "parser.cc" // lalr1.cc:672
492 break;
493
494 case 63: // nest_level
495
496#line 111 "parser.yy" // lalr1.cc:672
497 { yyoutput << yysym.value.template as< int8_t > (); }
498#line 499 "parser.cc" // lalr1.cc:672
499 break;
500
501 case 64: // pkt_metadata
502
503#line 111 "parser.yy" // lalr1.cc:672
504 { yyoutput << yysym.value.template as< TokenPkt::MetadataType > (); }
505#line 506 "parser.cc" // lalr1.cc:672
506 break;
507
508 case 65: // enterprise_id
509
510#line 111 "parser.yy" // lalr1.cc:672
511 { yyoutput << yysym.value.template as< uint32_t > (); }
512#line 513 "parser.cc" // lalr1.cc:672
513 break;
514
515 case 66: // pkt4_field
516
517#line 111 "parser.yy" // lalr1.cc:672
518 { yyoutput << yysym.value.template as< TokenPkt4::FieldType > (); }
519#line 520 "parser.cc" // lalr1.cc:672
520 break;
521
522 case 67: // pkt6_field
523
524#line 111 "parser.yy" // lalr1.cc:672
525 { yyoutput << yysym.value.template as< TokenPkt6::FieldType > (); }
526#line 527 "parser.cc" // lalr1.cc:672
527 break;
528
529 case 68: // relay6_field
530
531#line 111 "parser.yy" // lalr1.cc:672
532 { yyoutput << yysym.value.template as< TokenRelay6Field::FieldType > (); }
533#line 534 "parser.cc" // lalr1.cc:672
534 break;
535
536
537 default:
538 break;
539 }
540 yyo << ')';
541 }
542#endif
543
544 void
545 EvalParser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
546 {
547 if (m)
548 YY_SYMBOL_PRINT (m, sym);
549 yystack_.push (YY_MOVE (sym));
550 }
551
552 void
553 EvalParser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
554 {
555#if 201103L <= YY_CPLUSPLUS
556 yypush_ (m, stack_symbol_type (s, std::move (sym)));
557#else
558 stack_symbol_type ss (s, sym);
559 yypush_ (m, ss);
560#endif
561 }
562
563 void
564 EvalParser::yypop_ (int n)
565 {
566 yystack_.pop (n);
567 }
568
569#if EVALDEBUG
570 std::ostream&
571 EvalParser::debug_stream () const
572 {
573 return *yycdebug_;
574 }
575
576 void
577 EvalParser::set_debug_stream (std::ostream& o)
578 {
579 yycdebug_ = &o;
580 }
581
582
583 EvalParser::debug_level_type
584 EvalParser::debug_level () const
585 {
586 return yydebug_;
587 }
588
589 void
590 EvalParser::set_debug_level (debug_level_type l)
591 {
592 yydebug_ = l;
593 }
594#endif // EVALDEBUG
595
596 EvalParser::state_type
597 EvalParser::yy_lr_goto_state_ (state_type yystate, int yysym)
598 {
599 int yyr = yypgoto_[yysym - yyntokens_] + yystate;
600 if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
601 return yytable_[yyr];
602 else
603 return yydefgoto_[yysym - yyntokens_];
604 }
605
606 bool
607 EvalParser::yy_pact_value_is_default_ (int yyvalue)
608 {
609 return yyvalue == yypact_ninf_;
610 }
611
612 bool
613 EvalParser::yy_table_value_is_error_ (int yyvalue)
614 {
615 return yyvalue == yytable_ninf_;
616 }
617
618 int
620 {
621 return parse ();
622 }
623
624 int
626 {
627 // State.
628 int yyn;
630 int yylen = 0;
631
632 // Error handling.
633 int yynerrs_ = 0;
634 int yyerrstatus_ = 0;
635
637 symbol_type yyla;
638
640 stack_symbol_type yyerror_range[3];
641
643 int yyresult;
644
645#if YY_EXCEPTIONS
646 try
647#endif // YY_EXCEPTIONS
648 {
649 YYCDEBUG << "Starting parse\n";
650
651
652 /* Initialize the stack. The initial state will be set in
653 yynewstate, since the latter expects the semantical and the
654 location values to have been already stored, initialize these
655 stacks with a primary value. */
656 yystack_.clear ();
657 yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
658
659 // A new symbol was pushed on the stack.
660 yynewstate:
661 YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
662
663 // Accept?
664 if (yystack_[0].state == yyfinal_)
665 goto yyacceptlab;
666
667 goto yybackup;
668
669 // Backup.
670 yybackup:
671 // Try to take a decision without lookahead.
672 yyn = yypact_[yystack_[0].state];
673 if (yy_pact_value_is_default_ (yyn))
674 goto yydefault;
675
676 // Read a lookahead token.
677 if (yyla.empty ())
678 {
679 YYCDEBUG << "Reading a token: ";
680#if YY_EXCEPTIONS
681 try
682#endif // YY_EXCEPTIONS
683 {
684 symbol_type yylookahead (yylex (ctx));
685 yyla.move (yylookahead);
686 }
687#if YY_EXCEPTIONS
688 catch (const syntax_error& yyexc)
689 {
690 error (yyexc);
691 goto yyerrlab1;
692 }
693#endif // YY_EXCEPTIONS
694 }
695 YY_SYMBOL_PRINT ("Next token is", yyla);
696
697 /* If the proper action on seeing token YYLA.TYPE is to reduce or
698 to detect an error, take that action. */
699 yyn += yyla.type_get ();
700 if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ())
701 goto yydefault;
702
703 // Reduce or error.
704 yyn = yytable_[yyn];
705 if (yyn <= 0)
706 {
707 if (yy_table_value_is_error_ (yyn))
708 goto yyerrlab;
709 yyn = -yyn;
710 goto yyreduce;
711 }
712
713 // Count tokens shifted since error; after three, turn off error status.
714 if (yyerrstatus_)
715 --yyerrstatus_;
716
717 // Shift the lookahead token.
718 yypush_ ("Shifting", yyn, YY_MOVE (yyla));
719 goto yynewstate;
720
721 /*-----------------------------------------------------------.
722 | yydefault -- do the default action for the current state. |
723 `-----------------------------------------------------------*/
724 yydefault:
725 yyn = yydefact_[yystack_[0].state];
726 if (yyn == 0)
727 goto yyerrlab;
728 goto yyreduce;
729
730 /*-----------------------------.
731 | yyreduce -- Do a reduction. |
732 `-----------------------------*/
733 yyreduce:
734 yylen = yyr2_[yyn];
735 {
736 stack_symbol_type yylhs;
737 yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);
738 /* Variants are always initialized to an empty instance of the
739 correct type. The default '$$ = $1' action is NOT applied
740 when using variants. */
741 switch (yyr1_[yyn])
742 {
743 case 62: // option_repr_type
744 yylhs.value.emplace< TokenOption::RepresentationType > ();
745 break;
746
747 case 66: // pkt4_field
748 yylhs.value.emplace< TokenPkt4::FieldType > ();
749 break;
750
751 case 67: // pkt6_field
752 yylhs.value.emplace< TokenPkt6::FieldType > ();
753 break;
754
755 case 64: // pkt_metadata
756 yylhs.value.emplace< TokenPkt::MetadataType > ();
757 break;
758
759 case 68: // relay6_field
760 yylhs.value.emplace< TokenRelay6Field::FieldType > ();
761 break;
762
763 case 63: // nest_level
764 yylhs.value.emplace< int8_t > ();
765 break;
766
767 case 50: // "constant string"
768 case 51: // "integer"
769 case 52: // "constant hexstring"
770 case 53: // "option name"
771 case 54: // "ip address"
772 yylhs.value.emplace< std::string > ();
773 break;
774
775 case 61: // option_code
776 yylhs.value.emplace< uint16_t > ();
777 break;
778
779 case 60: // integer_expr
780 case 65: // enterprise_id
781 yylhs.value.emplace< uint32_t > ();
782 break;
783
784 default:
785 break;
786 }
787
788
789 // Default location.
790 {
792 YYLLOC_DEFAULT (yylhs.location, slice, yylen);
793 yyerror_range[1].location = yylhs.location;
794 }
795
796 // Perform the reduction.
797 YY_REDUCE_PRINT (yyn);
798#if YY_EXCEPTIONS
799 try
800#endif // YY_EXCEPTIONS
801 {
802 switch (yyn)
803 {
804 case 6:
805#line 131 "parser.yy" // lalr1.cc:907
806 {
807 TokenPtr neg(new TokenNot());
808 ctx.expression.push_back(neg);
809 }
810#line 811 "parser.cc" // lalr1.cc:907
811 break;
812
813 case 7:
814#line 136 "parser.yy" // lalr1.cc:907
815 {
816 TokenPtr neg(new TokenAnd());
817 ctx.expression.push_back(neg);
818 }
819#line 820 "parser.cc" // lalr1.cc:907
820 break;
821
822 case 8:
823#line 141 "parser.yy" // lalr1.cc:907
824 {
825 TokenPtr neg(new TokenOr());
826 ctx.expression.push_back(neg);
827 }
828#line 829 "parser.cc" // lalr1.cc:907
829 break;
830
831 case 9:
832#line 146 "parser.yy" // lalr1.cc:907
833 {
834 TokenPtr eq(new TokenEqual());
835 ctx.expression.push_back(eq);
836 }
837#line 838 "parser.cc" // lalr1.cc:907
838 break;
839
840 case 10:
841#line 151 "parser.yy" // lalr1.cc:907
842 {
843 TokenPtr opt(new TokenOption(yystack_[3].value.as< uint16_t > (), TokenOption::EXISTS));
844 ctx.expression.push_back(opt);
845 }
846#line 847 "parser.cc" // lalr1.cc:907
847 break;
848
849 case 11:
850#line 156 "parser.yy" // lalr1.cc:907
851 {
852 switch (ctx.getUniverse()) {
853 case Option::V4:
854 {
855 TokenPtr opt(new TokenRelay4Option(yystack_[3].value.as< uint16_t > (), TokenOption::EXISTS));
856 ctx.expression.push_back(opt);
857 break;
858 }
859 case Option::V6:
860 // We will have relay6[123] for the DHCPv6.
861 // In a very distant future we'll possibly be able
862 // to mix both if we have DHCPv4-over-DHCPv6, so it
863 // has some sense to make it explicit whether we
864 // talk about DHCPv4 relay or DHCPv6 relay. However,
865 // for the time being relay4 can be used in DHCPv4
866 // only.
867 error(yystack_[5].location, "relay4 can only be used in DHCPv4.");
868 }
869 }
870#line 871 "parser.cc" // lalr1.cc:907
871 break;
872
873 case 12:
874#line 176 "parser.yy" // lalr1.cc:907
875 {
876 switch (ctx.getUniverse()) {
877 case Option::V6:
878 {
879 TokenPtr opt(new TokenRelay6Option(yystack_[8].value.as< int8_t > (), yystack_[3].value.as< uint16_t > (), TokenOption::EXISTS));
880 ctx.expression.push_back(opt);
881 break;
882 }
883 case Option::V4:
884 // For now we only use relay6 in DHCPv6.
885 error(yystack_[10].location, "relay6 can only be used in DHCPv6.");
886 }
887 }
888#line 889 "parser.cc" // lalr1.cc:907
889 break;
890
891 case 13:
892#line 190 "parser.yy" // lalr1.cc:907
893 {
894 // Expression: vendor-class[1234].exists
895 //
896 // This token will find option 124 (DHCPv4) or 16 (DHCPv6),
897 // and will check if enterprise-id equals specified value.
898 TokenPtr exist(new TokenVendorClass(ctx.getUniverse(), yystack_[3].value.as< uint32_t > (), TokenOption::EXISTS));
899 ctx.expression.push_back(exist);
900 }
901#line 902 "parser.cc" // lalr1.cc:907
902 break;
903
904 case 14:
905#line 199 "parser.yy" // lalr1.cc:907
906 {
907 // Expression: vendor[1234].exists
908 //
909 // This token will find option 125 (DHCPv4) or 17 (DHCPv6),
910 // and will check if enterprise-id equals specified value.
911 TokenPtr exist(new TokenVendor(ctx.getUniverse(), yystack_[3].value.as< uint32_t > (), TokenOption::EXISTS));
912 ctx.expression.push_back(exist);
913 }
914#line 915 "parser.cc" // lalr1.cc:907
915 break;
916
917 case 15:
918#line 208 "parser.yy" // lalr1.cc:907
919 {
920 // Expression vendor[1234].option[123].exists
921 //
922 // This token will check if specified vendor option
923 // exists, has specified enterprise-id and if has
924 // specified suboption.
925 TokenPtr exist(new TokenVendor(ctx.getUniverse(), yystack_[8].value.as< uint32_t > (), TokenOption::EXISTS, yystack_[3].value.as< uint16_t > ()));
926 ctx.expression.push_back(exist);
927 }
928#line 929 "parser.cc" // lalr1.cc:907
929 break;
930
931 case 16:
932#line 218 "parser.yy" // lalr1.cc:907
933 {
934 // Expression member('foo')
935 //
936 // This token will check if the packet is a member of
937 // the specified client class.
938 // To avoid loops at evaluation only already defined and
939 // built-in classes are allowed.
940 std::string cc = yystack_[1].value.as< std::string > ();
941 if (!ctx.isClientClassDefined(cc)) {
942 error(yystack_[1].location, "Not defined client class '" + cc + "'");
943 }
944 TokenPtr member(new TokenMember(cc));
945 ctx.expression.push_back(member);
946 }
947#line 948 "parser.cc" // lalr1.cc:907
948 break;
949
950 case 17:
951#line 235 "parser.yy" // lalr1.cc:907
952 {
953 TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
954 ctx.expression.push_back(str);
955 }
956#line 957 "parser.cc" // lalr1.cc:907
957 break;
958
959 case 18:
960#line 240 "parser.yy" // lalr1.cc:907
961 {
962 TokenPtr hex(new TokenHexString(yystack_[0].value.as< std::string > ()));
963 ctx.expression.push_back(hex);
964 }
965#line 966 "parser.cc" // lalr1.cc:907
966 break;
967
968 case 19:
969#line 245 "parser.yy" // lalr1.cc:907
970 {
971 TokenPtr ip(new TokenIpAddress(yystack_[0].value.as< std::string > ()));
972 ctx.expression.push_back(ip);
973 }
974#line 975 "parser.cc" // lalr1.cc:907
975 break;
976
977 case 20:
978#line 250 "parser.yy" // lalr1.cc:907
979 {
980 TokenPtr opt(new TokenOption(yystack_[3].value.as< uint16_t > (), yystack_[0].value.as< TokenOption::RepresentationType > ()));
981 ctx.expression.push_back(opt);
982 }
983#line 984 "parser.cc" // lalr1.cc:907
984 break;
985
986 case 21:
987#line 255 "parser.yy" // lalr1.cc:907
988 {
989 switch (ctx.getUniverse()) {
990 case Option::V4:
991 {
992 TokenPtr opt(new TokenRelay4Option(yystack_[3].value.as< uint16_t > (), yystack_[0].value.as< TokenOption::RepresentationType > ()));
993 ctx.expression.push_back(opt);
994 break;
995 }
996 case Option::V6:
997 // We will have relay6[123] for the DHCPv6.
998 // In a very distant future we'll possibly be able
999 // to mix both if we have DHCPv4-over-DHCPv6, so it
1000 // has some sense to make it explicit whether we
1001 // talk about DHCPv4 relay or DHCPv6 relay. However,
1002 // for the time being relay4 can be used in DHCPv4
1003 // only.
1004 error(yystack_[5].location, "relay4 can only be used in DHCPv4.");
1005 }
1006 }
1007#line 1008 "parser.cc" // lalr1.cc:907
1008 break;
1009
1010 case 22:
1011#line 276 "parser.yy" // lalr1.cc:907
1012 {
1013 switch (ctx.getUniverse()) {
1014 case Option::V6:
1015 {
1016 TokenPtr opt(new TokenRelay6Option(yystack_[8].value.as< int8_t > (), yystack_[3].value.as< uint16_t > (), yystack_[0].value.as< TokenOption::RepresentationType > ()));
1017 ctx.expression.push_back(opt);
1018 break;
1019 }
1020 case Option::V4:
1021 // For now we only use relay6 in DHCPv6.
1022 error(yystack_[10].location, "relay6 can only be used in DHCPv6.");
1023 }
1024 }
1025#line 1026 "parser.cc" // lalr1.cc:907
1026 break;
1027
1028 case 23:
1029#line 291 "parser.yy" // lalr1.cc:907
1030 {
1031 TokenPtr pkt_metadata(new TokenPkt(yystack_[0].value.as< TokenPkt::MetadataType > ()));
1032 ctx.expression.push_back(pkt_metadata);
1033 }
1034#line 1035 "parser.cc" // lalr1.cc:907
1035 break;
1036
1037 case 24:
1038#line 296 "parser.yy" // lalr1.cc:907
1039 {
1040 switch (ctx.getUniverse()) {
1041 case Option::V4:
1042 {
1043 TokenPtr pkt4_field(new TokenPkt4(yystack_[0].value.as< TokenPkt4::FieldType > ()));
1044 ctx.expression.push_back(pkt4_field);
1045 break;
1046 }
1047 case Option::V6:
1048 // For now we only use pkt4 in DHCPv4.
1049 error(yystack_[2].location, "pkt4 can only be used in DHCPv4.");
1050 }
1051 }
1052#line 1053 "parser.cc" // lalr1.cc:907
1053 break;
1054
1055 case 25:
1056#line 310 "parser.yy" // lalr1.cc:907
1057 {
1058 switch (ctx.getUniverse()) {
1059 case Option::V6:
1060 {
1061 TokenPtr pkt6_field(new TokenPkt6(yystack_[0].value.as< TokenPkt6::FieldType > ()));
1062 ctx.expression.push_back(pkt6_field);
1063 break;
1064 }
1065 case Option::V4:
1066 // For now we only use pkt6 in DHCPv6.
1067 error(yystack_[2].location, "pkt6 can only be used in DHCPv6.");
1068 }
1069 }
1070#line 1071 "parser.cc" // lalr1.cc:907
1071 break;
1072
1073 case 26:
1074#line 324 "parser.yy" // lalr1.cc:907
1075 {
1076 switch (ctx.getUniverse()) {
1077 case Option::V6:
1078 {
1079 TokenPtr relay6field(new TokenRelay6Field(yystack_[3].value.as< int8_t > (), yystack_[0].value.as< TokenRelay6Field::FieldType > ()));
1080 ctx.expression.push_back(relay6field);
1081 break;
1082 }
1083 case Option::V4:
1084 // For now we only use relay6 in DHCPv6.
1085 error(yystack_[5].location, "relay6 can only be used in DHCPv6.");
1086 }
1087 }
1088#line 1089 "parser.cc" // lalr1.cc:907
1089 break;
1090
1091 case 27:
1092#line 339 "parser.yy" // lalr1.cc:907
1093 {
1094 TokenPtr sub(new TokenSubstring());
1095 ctx.expression.push_back(sub);
1096 }
1097#line 1098 "parser.cc" // lalr1.cc:907
1098 break;
1099
1100 case 28:
1101#line 344 "parser.yy" // lalr1.cc:907
1102 {
1103 TokenPtr conc(new TokenConcat());
1104 ctx.expression.push_back(conc);
1105 }
1106#line 1107 "parser.cc" // lalr1.cc:907
1107 break;
1108
1109 case 29:
1110#line 349 "parser.yy" // lalr1.cc:907
1111 {
1112 TokenPtr cond(new TokenIfElse());
1113 ctx.expression.push_back(cond);
1114 }
1115#line 1116 "parser.cc" // lalr1.cc:907
1116 break;
1117
1118 case 30:
1119#line 354 "parser.yy" // lalr1.cc:907
1120 {
1121 TokenPtr tohex(new TokenToHexString());
1122 ctx.expression.push_back(tohex);
1123 }
1124#line 1125 "parser.cc" // lalr1.cc:907
1125 break;
1126
1127 case 31:
1128#line 359 "parser.yy" // lalr1.cc:907
1129 {
1130 // expression: vendor.enterprise
1131 //
1132 // This token will return enterprise-id number of
1133 // received vendor option.
1135 ctx.expression.push_back(vendor);
1136 }
1137#line 1138 "parser.cc" // lalr1.cc:907
1138 break;
1139
1140 case 32:
1141#line 368 "parser.yy" // lalr1.cc:907
1142 {
1143 // expression: vendor-class.enterprise
1144 //
1145 // This token will return enterprise-id number of
1146 // received vendor class option.
1147 TokenPtr vendor(new TokenVendorClass(ctx.getUniverse(), 0,
1149 ctx.expression.push_back(vendor);
1150 }
1151#line 1152 "parser.cc" // lalr1.cc:907
1152 break;
1153
1154 case 33:
1155#line 378 "parser.yy" // lalr1.cc:907
1156 {
1157 // This token will search for vendor option with
1158 // specified enterprise-id. If found, will search
1159 // for specified suboption and finally will return
1160 // its content.
1161 TokenPtr opt(new TokenVendor(ctx.getUniverse(), yystack_[8].value.as< uint32_t > (), yystack_[0].value.as< TokenOption::RepresentationType > (), yystack_[3].value.as< uint16_t > ()));
1162 ctx.expression.push_back(opt);
1163 }
1164#line 1165 "parser.cc" // lalr1.cc:907
1165 break;
1166
1167 case 34:
1168#line 387 "parser.yy" // lalr1.cc:907
1169 {
1170 // expression: vendor-class[1234].data
1171 //
1172 // Vendor class option does not have suboptions,
1173 // but chunks of data (typically 1, but the option
1174 // structure allows multiple of them). If chunk
1175 // offset is not specified, we assume the first (0th)
1176 // is requested.
1177 TokenPtr vendor_class(new TokenVendorClass(ctx.getUniverse(), yystack_[3].value.as< uint32_t > (),
1178 TokenVendor::DATA, 0));
1179 ctx.expression.push_back(vendor_class);
1180 }
1181#line 1182 "parser.cc" // lalr1.cc:907
1182 break;
1183
1184 case 35:
1185#line 400 "parser.yy" // lalr1.cc:907
1186 {
1187 // expression: vendor-class[1234].data[5]
1188 //
1189 // Vendor class option does not have suboptions,
1190 // but chunks of data (typically 1, but the option
1191 // structure allows multiple of them). This syntax
1192 // specifies which data chunk (tuple) we want.
1193 uint8_t index = ctx.convertUint8(yystack_[1].value.as< std::string > (), yystack_[1].location);
1194 TokenPtr vendor_class(new TokenVendorClass(ctx.getUniverse(), yystack_[6].value.as< uint32_t > (),
1195 TokenVendor::DATA, index));
1196 ctx.expression.push_back(vendor_class);
1197 }
1198#line 1199 "parser.cc" // lalr1.cc:907
1199 break;
1200
1201 case 36:
1202#line 413 "parser.yy" // lalr1.cc:907
1203 {
1204 TokenPtr integer(new TokenInteger(yystack_[0].value.as< uint32_t > ()));
1205 ctx.expression.push_back(integer);
1206 }
1207#line 1208 "parser.cc" // lalr1.cc:907
1208 break;
1209
1210 case 37:
1211#line 420 "parser.yy" // lalr1.cc:907
1212 {
1213 yylhs.value.as< uint32_t > () = ctx.convertUint32(yystack_[0].value.as< std::string > (), yystack_[0].location);
1214 }
1215#line 1216 "parser.cc" // lalr1.cc:907
1216 break;
1217
1218 case 38:
1219#line 426 "parser.yy" // lalr1.cc:907
1220 {
1221 yylhs.value.as< uint16_t > () = ctx.convertOptionCode(yystack_[0].value.as< std::string > (), yystack_[0].location);
1222 }
1223#line 1224 "parser.cc" // lalr1.cc:907
1224 break;
1225
1226 case 39:
1227#line 430 "parser.yy" // lalr1.cc:907
1228 {
1229 yylhs.value.as< uint16_t > () = ctx.convertOptionName(yystack_[0].value.as< std::string > (), yystack_[0].location);
1230 }
1231#line 1232 "parser.cc" // lalr1.cc:907
1232 break;
1233
1234 case 40:
1235#line 436 "parser.yy" // lalr1.cc:907
1236 {
1238 }
1239#line 1240 "parser.cc" // lalr1.cc:907
1240 break;
1241
1242 case 41:
1243#line 440 "parser.yy" // lalr1.cc:907
1244 {
1246 }
1247#line 1248 "parser.cc" // lalr1.cc:907
1248 break;
1249
1250 case 42:
1251#line 446 "parser.yy" // lalr1.cc:907
1252 {
1253 yylhs.value.as< int8_t > () = ctx.convertNestLevelNumber(yystack_[0].value.as< std::string > (), yystack_[0].location);
1254 }
1255#line 1256 "parser.cc" // lalr1.cc:907
1256 break;
1257
1258 case 43:
1259#line 455 "parser.yy" // lalr1.cc:907
1260 {
1261 yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::IFACE;
1262 }
1263#line 1264 "parser.cc" // lalr1.cc:907
1264 break;
1265
1266 case 44:
1267#line 459 "parser.yy" // lalr1.cc:907
1268 {
1269 yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::SRC;
1270 }
1271#line 1272 "parser.cc" // lalr1.cc:907
1272 break;
1273
1274 case 45:
1275#line 463 "parser.yy" // lalr1.cc:907
1276 {
1277 yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::DST;
1278 }
1279#line 1280 "parser.cc" // lalr1.cc:907
1280 break;
1281
1282 case 46:
1283#line 467 "parser.yy" // lalr1.cc:907
1284 {
1285 yylhs.value.as< TokenPkt::MetadataType > () = TokenPkt::LEN;
1286 }
1287#line 1288 "parser.cc" // lalr1.cc:907
1288 break;
1289
1290 case 47:
1291#line 473 "parser.yy" // lalr1.cc:907
1292 {
1293 yylhs.value.as< uint32_t > () = ctx.convertUint32(yystack_[0].value.as< std::string > (), yystack_[0].location);
1294 }
1295#line 1296 "parser.cc" // lalr1.cc:907
1296 break;
1297
1298 case 48:
1299#line 477 "parser.yy" // lalr1.cc:907
1300 {
1301 yylhs.value.as< uint32_t > () = 0;
1302 }
1303#line 1304 "parser.cc" // lalr1.cc:907
1304 break;
1305
1306 case 49:
1307#line 483 "parser.yy" // lalr1.cc:907
1308 {
1309 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::CHADDR;
1310 }
1311#line 1312 "parser.cc" // lalr1.cc:907
1312 break;
1313
1314 case 50:
1315#line 487 "parser.yy" // lalr1.cc:907
1316 {
1317 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::HLEN;
1318 }
1319#line 1320 "parser.cc" // lalr1.cc:907
1320 break;
1321
1322 case 51:
1323#line 491 "parser.yy" // lalr1.cc:907
1324 {
1325 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::HTYPE;
1326 }
1327#line 1328 "parser.cc" // lalr1.cc:907
1328 break;
1329
1330 case 52:
1331#line 495 "parser.yy" // lalr1.cc:907
1332 {
1333 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::CIADDR;
1334 }
1335#line 1336 "parser.cc" // lalr1.cc:907
1336 break;
1337
1338 case 53:
1339#line 499 "parser.yy" // lalr1.cc:907
1340 {
1341 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::GIADDR;
1342 }
1343#line 1344 "parser.cc" // lalr1.cc:907
1344 break;
1345
1346 case 54:
1347#line 503 "parser.yy" // lalr1.cc:907
1348 {
1349 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::YIADDR;
1350 }
1351#line 1352 "parser.cc" // lalr1.cc:907
1352 break;
1353
1354 case 55:
1355#line 507 "parser.yy" // lalr1.cc:907
1356 {
1357 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::SIADDR;
1358 }
1359#line 1360 "parser.cc" // lalr1.cc:907
1360 break;
1361
1362 case 56:
1363#line 511 "parser.yy" // lalr1.cc:907
1364 {
1365 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::MSGTYPE;
1366 }
1367#line 1368 "parser.cc" // lalr1.cc:907
1368 break;
1369
1370 case 57:
1371#line 515 "parser.yy" // lalr1.cc:907
1372 {
1373 yylhs.value.as< TokenPkt4::FieldType > () = TokenPkt4::TRANSID;
1374 }
1375#line 1376 "parser.cc" // lalr1.cc:907
1376 break;
1377
1378 case 58:
1379#line 521 "parser.yy" // lalr1.cc:907
1380 {
1381 yylhs.value.as< TokenPkt6::FieldType > () = TokenPkt6::MSGTYPE;
1382 }
1383#line 1384 "parser.cc" // lalr1.cc:907
1384 break;
1385
1386 case 59:
1387#line 525 "parser.yy" // lalr1.cc:907
1388 {
1389 yylhs.value.as< TokenPkt6::FieldType > () = TokenPkt6::TRANSID;
1390 }
1391#line 1392 "parser.cc" // lalr1.cc:907
1392 break;
1393
1394 case 60:
1395#line 531 "parser.yy" // lalr1.cc:907
1396 {
1398 }
1399#line 1400 "parser.cc" // lalr1.cc:907
1400 break;
1401
1402 case 61:
1403#line 535 "parser.yy" // lalr1.cc:907
1404 {
1406 }
1407#line 1408 "parser.cc" // lalr1.cc:907
1408 break;
1409
1410 case 62:
1411#line 541 "parser.yy" // lalr1.cc:907
1412 {
1413 TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
1414 ctx.expression.push_back(str);
1415 }
1416#line 1417 "parser.cc" // lalr1.cc:907
1417 break;
1418
1419 case 63:
1420#line 548 "parser.yy" // lalr1.cc:907
1421 {
1422 TokenPtr str(new TokenString(yystack_[0].value.as< std::string > ()));
1423 ctx.expression.push_back(str);
1424 }
1425#line 1426 "parser.cc" // lalr1.cc:907
1426 break;
1427
1428 case 64:
1429#line 553 "parser.yy" // lalr1.cc:907
1430 {
1431 TokenPtr str(new TokenString("all"));
1432 ctx.expression.push_back(str);
1433 }
1434#line 1435 "parser.cc" // lalr1.cc:907
1435 break;
1436
1437
1438#line 1439 "parser.cc" // lalr1.cc:907
1439 default:
1440 break;
1441 }
1442 }
1443#if YY_EXCEPTIONS
1444 catch (const syntax_error& yyexc)
1445 {
1446 error (yyexc);
1447 YYERROR;
1448 }
1449#endif // YY_EXCEPTIONS
1450 YY_SYMBOL_PRINT ("-> $$ =", yylhs);
1451 yypop_ (yylen);
1452 yylen = 0;
1453 YY_STACK_PRINT ();
1454
1455 // Shift the result of the reduction.
1456 yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
1457 }
1458 goto yynewstate;
1459
1460 /*--------------------------------------.
1461 | yyerrlab -- here on detecting error. |
1462 `--------------------------------------*/
1463 yyerrlab:
1464 // If not already recovering from an error, report this error.
1465 if (!yyerrstatus_)
1466 {
1467 ++yynerrs_;
1468 error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla));
1469 }
1470
1471
1472 yyerror_range[1].location = yyla.location;
1473 if (yyerrstatus_ == 3)
1474 {
1475 /* If just tried and failed to reuse lookahead token after an
1476 error, discard it. */
1477
1478 // Return failure if at end of input.
1479 if (yyla.type_get () == yyeof_)
1480 YYABORT;
1481 else if (!yyla.empty ())
1482 {
1483 yy_destroy_ ("Error: discarding", yyla);
1484 yyla.clear ();
1485 }
1486 }
1487
1488 // Else will try to reuse lookahead token after shifting the error token.
1489 goto yyerrlab1;
1490
1491
1492 /*---------------------------------------------------.
1493 | yyerrorlab -- error raised explicitly by YYERROR. |
1494 `---------------------------------------------------*/
1495 yyerrorlab:
1496
1497 /* Pacify compilers like GCC when the user code never invokes
1498 YYERROR and the label yyerrorlab therefore never appears in user
1499 code. */
1500 if (false)
1501 goto yyerrorlab;
1502 /* Do not reclaim the symbols of the rule whose action triggered
1503 this YYERROR. */
1504 yypop_ (yylen);
1505 yylen = 0;
1506 goto yyerrlab1;
1507
1508 /*-------------------------------------------------------------.
1509 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1510 `-------------------------------------------------------------*/
1511 yyerrlab1:
1512 yyerrstatus_ = 3; // Each real token shifted decrements this.
1513 {
1514 stack_symbol_type error_token;
1515 for (;;)
1516 {
1517 yyn = yypact_[yystack_[0].state];
1518 if (!yy_pact_value_is_default_ (yyn))
1519 {
1520 yyn += yyterror_;
1521 if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
1522 {
1523 yyn = yytable_[yyn];
1524 if (0 < yyn)
1525 break;
1526 }
1527 }
1528
1529 // Pop the current state because it cannot handle the error token.
1530 if (yystack_.size () == 1)
1531 YYABORT;
1532
1533 yyerror_range[1].location = yystack_[0].location;
1534 yy_destroy_ ("Error: popping", yystack_[0]);
1535 yypop_ ();
1536 YY_STACK_PRINT ();
1537 }
1538
1539 yyerror_range[2].location = yyla.location;
1540 YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);
1541
1542 // Shift the error token.
1543 error_token.state = yyn;
1544 yypush_ ("Shifting", YY_MOVE (error_token));
1545 }
1546 goto yynewstate;
1547
1548 // Accept.
1549 yyacceptlab:
1550 yyresult = 0;
1551 goto yyreturn;
1552
1553 // Abort.
1554 yyabortlab:
1555 yyresult = 1;
1556 goto yyreturn;
1557
1558 yyreturn:
1559 if (!yyla.empty ())
1560 yy_destroy_ ("Cleanup: discarding lookahead", yyla);
1561
1562 /* Do not reclaim the symbols of the rule whose action triggered
1563 this YYABORT or YYACCEPT. */
1564 yypop_ (yylen);
1565 while (1 < yystack_.size ())
1566 {
1567 yy_destroy_ ("Cleanup: popping", yystack_[0]);
1568 yypop_ ();
1569 }
1570
1571 return yyresult;
1572 }
1573#if YY_EXCEPTIONS
1574 catch (...)
1575 {
1576 YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
1577 // Do not try to display the values of the reclaimed symbols,
1578 // as their printers might throw an exception.
1579 if (!yyla.empty ())
1580 yy_destroy_ (YY_NULLPTR, yyla);
1581
1582 while (1 < yystack_.size ())
1583 {
1584 yy_destroy_ (YY_NULLPTR, yystack_[0]);
1585 yypop_ ();
1586 }
1587 throw;
1588 }
1589#endif // YY_EXCEPTIONS
1590 }
1591
1592 void
1594 {
1595 error (yyexc.location, yyexc.what ());
1596 }
1597
1598 // Generate an error message.
1599 std::string
1600 EvalParser::yysyntax_error_ (state_type yystate, const symbol_type& yyla) const
1601 {
1602 // Number of reported tokens (one for the "unexpected", one per
1603 // "expected").
1604 size_t yycount = 0;
1605 // Its maximum.
1606 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1607 // Arguments of yyformat.
1608 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1609
1610 /* There are many possibilities here to consider:
1611 - If this state is a consistent state with a default action, then
1612 the only way this function was invoked is if the default action
1613 is an error action. In that case, don't check for expected
1614 tokens because there are none.
1615 - The only way there can be no lookahead present (in yyla) is
1616 if this state is a consistent state with a default action.
1617 Thus, detecting the absence of a lookahead is sufficient to
1618 determine that there is no unexpected or expected token to
1619 report. In that case, just report a simple "syntax error".
1620 - Don't assume there isn't a lookahead just because this state is
1621 a consistent state with a default action. There might have
1622 been a previous inconsistent state, consistent state with a
1623 non-default action, or user semantic action that manipulated
1624 yyla. (However, yyla is currently not documented for users.)
1625 - Of course, the expected token list depends on states to have
1626 correct lookahead information, and it depends on the parser not
1627 to perform extra reductions after fetching a lookahead from the
1628 scanner and before detecting a syntax error. Thus, state
1629 merging (from LALR or IELR) and default reductions corrupt the
1630 expected token list. However, the list is correct for
1631 canonical LR with one exception: it will still contain any
1632 token that will not be accepted due to an error action in a
1633 later state.
1634 */
1635 if (!yyla.empty ())
1636 {
1637 int yytoken = yyla.type_get ();
1638 yyarg[yycount++] = yytname_[yytoken];
1639 int yyn = yypact_[yystate];
1640 if (!yy_pact_value_is_default_ (yyn))
1641 {
1642 /* Start YYX at -YYN if negative to avoid negative indexes in
1643 YYCHECK. In other words, skip the first -YYN actions for
1644 this state because they are default actions. */
1645 int yyxbegin = yyn < 0 ? -yyn : 0;
1646 // Stay within bounds of both yycheck and yytname.
1647 int yychecklim = yylast_ - yyn + 1;
1648 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
1649 for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
1650 if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
1651 && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
1652 {
1653 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1654 {
1655 yycount = 1;
1656 break;
1657 }
1658 else
1659 yyarg[yycount++] = yytname_[yyx];
1660 }
1661 }
1662 }
1663
1664 char const* yyformat = YY_NULLPTR;
1665 switch (yycount)
1666 {
1667#define YYCASE_(N, S) \
1668 case N: \
1669 yyformat = S; \
1670 break
1671 default: // Avoid compiler warnings.
1672 YYCASE_ (0, YY_("syntax error"));
1673 YYCASE_ (1, YY_("syntax error, unexpected %s"));
1674 YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
1675 YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1676 YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1677 YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1678#undef YYCASE_
1679 }
1680
1681 std::string yyres;
1682 // Argument number.
1683 size_t yyi = 0;
1684 for (char const* yyp = yyformat; *yyp; ++yyp)
1685 if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
1686 {
1687 yyres += yytnamerr_ (yyarg[yyi++]);
1688 ++yyp;
1689 }
1690 else
1691 yyres += *yyp;
1692 return yyres;
1693 }
1694
1695
1696 const signed char EvalParser::yypact_ninf_ = -118;
1697
1698 const signed char EvalParser::yytable_ninf_ = -1;
1699
1700 const short
1701 EvalParser::yypact_[] =
1702 {
1703 -14, 27, 76, 17, 27, 27, 37, 41, 53, 39,
1704 52, 59, 77, 85, 93, 98, 88, 29, 94, -118,
1705 -118, -118, -118, -118, 56, 104, -118, 114, 124, 129,
1706 119, 120, -118, -118, 7, -118, 87, 87, 67, 95,
1707 50, 62, 76, 76, 27, 76, 100, -35, 99, -35,
1708 101, 27, 27, 76, 87, 87, 67, -35, -35, -118,
1709 -118, -118, 131, 133, -118, 134, 147, -118, -118, -118,
1710 -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
1711 -118, -118, 116, 117, -3, 118, -118, -118, -118, -118,
1712 -118, 139, -118, 140, -118, -118, 151, -118, 142, 143,
1713 144, 145, 146, 148, 149, 150, -118, 112, 76, 76,
1714 76, 152, 153, 154, 155, 156, 157, 158, 9, 64,
1715 12, -118, 128, 164, 141, 172, -15, 0, 103, 103,
1716 36, 132, 170, -118, -118, -118, -118, -118, -118, 165,
1717 -118, -118, -118, -29, -118, 76, -118, -118, 166, 167,
1718 -118, 168, 169, 87, -118, -118, 181, 182, 136, 87,
1719 87, 87, 173, -118, -118, 174, 175, 176, 177, 171,
1720 -118, 178, 179, 180, 80, 113, 103, 103, -118, -118,
1721 -118, -118
1722 };
1723
1724 const unsigned char
1725 EvalParser::yydefact_[] =
1726 {
1727 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1728 0, 0, 0, 0, 0, 0, 0, 0, 0, 17,
1729 37, 18, 19, 2, 4, 0, 36, 0, 0, 0,
1730 0, 0, 3, 1, 0, 6, 0, 0, 0, 0,
1731 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1732 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
1733 38, 39, 0, 0, 42, 0, 0, 43, 44, 45,
1734 46, 23, 49, 50, 51, 52, 53, 54, 55, 56,
1735 57, 24, 0, 0, 0, 0, 58, 59, 25, 48,
1736 47, 0, 32, 0, 31, 7, 8, 9, 0, 0,
1737 0, 0, 0, 0, 0, 0, 16, 0, 0, 0,
1738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1739 0, 62, 0, 0, 0, 0, 0, 0, 0, 0,
1740 0, 0, 0, 40, 41, 10, 20, 11, 21, 0,
1741 60, 61, 26, 0, 28, 0, 30, 13, 34, 0,
1742 14, 0, 0, 0, 64, 63, 0, 0, 0, 0,
1743 0, 0, 0, 27, 29, 0, 0, 0, 0, 0,
1744 35, 0, 0, 0, 0, 0, 0, 0, 12, 22,
1745 15, 33
1746 };
1747
1748 const short
1749 EvalParser::yypgoto_[] =
1750 {
1751 -118, -118, -118, 3, -2, -118, -36, -117, 138, -118,
1752 -34, -118, -118, -118, -118, -118
1753 };
1754
1755 const short
1756 EvalParser::yydefgoto_[] =
1757 {
1758 -1, 3, 23, 24, 25, 26, 62, 136, 65, 71,
1759 91, 81, 88, 142, 122, 156
1760 };
1761
1762 const unsigned char
1763 EvalParser::yytable_[] =
1764 {
1765 32, 63, 138, 51, 52, 147, 154, 34, 35, 149,
1766 89, 59, 138, 51, 52, 93, 90, 33, 98, 99,
1767 150, 139, 155, 101, 102, 140, 141, 133, 134, 135,
1768 4, 148, 5, 109, 1, 2, 6, 7, 8, 9,
1769 82, 83, 39, 85, 47, 151, 48, 84, 10, 140,
1770 141, 97, 36, 11, 95, 96, 37, 179, 181, 179,
1771 181, 12, 51, 52, 13, 14, 15, 16, 38, 40,
1772 17, 18, 67, 68, 69, 70, 41, 19, 20, 21,
1773 42, 22, 133, 134, 137, 27, 28, 29, 43, 72,
1774 73, 74, 75, 76, 77, 78, 44, 10, 133, 134,
1775 178, 45, 11, 79, 80, 46, 123, 124, 125, 49,
1776 12, 50, 53, 13, 14, 15, 16, 162, 64, 30,
1777 31, 133, 134, 166, 167, 168, 19, 20, 21, 54,
1778 22, 133, 134, 180, 57, 58, 48, 50, 60, 55,
1779 61, 86, 87, 157, 56, 66, 92, 103, 94, 104,
1780 105, 106, 107, 108, 110, 111, 112, 51, 113, 114,
1781 115, 116, 117, 121, 143, 118, 119, 120, 144, 126,
1782 127, 128, 129, 130, 131, 132, 146, 145, 148, 152,
1783 153, 158, 159, 160, 161, 163, 164, 165, 174, 169,
1784 170, 171, 172, 173, 100, 175, 176, 177
1785 };
1786
1787 const unsigned char
1788 EvalParser::yycheck_[] =
1789 {
1790 2, 37, 119, 6, 7, 20, 35, 4, 5, 9,
1791 45, 4, 129, 6, 7, 49, 51, 0, 54, 55,
1792 20, 9, 51, 57, 58, 13, 14, 18, 19, 20,
1793 3, 46, 5, 36, 48, 49, 9, 10, 11, 12,
1794 42, 43, 3, 45, 15, 9, 17, 44, 21, 13,
1795 14, 53, 15, 26, 51, 52, 15, 174, 175, 176,
1796 177, 34, 6, 7, 37, 38, 39, 40, 15, 17,
1797 43, 44, 22, 23, 24, 25, 17, 50, 51, 52,
1798 3, 54, 18, 19, 20, 9, 10, 11, 3, 27,
1799 28, 29, 30, 31, 32, 33, 3, 21, 18, 19,
1800 20, 3, 26, 41, 42, 17, 108, 109, 110, 15,
1801 34, 17, 8, 37, 38, 39, 40, 153, 51, 43,
1802 44, 18, 19, 159, 160, 161, 50, 51, 52, 15,
1803 54, 18, 19, 20, 15, 15, 17, 17, 51, 15,
1804 53, 41, 42, 145, 15, 50, 47, 16, 47, 16,
1805 16, 4, 36, 36, 36, 16, 16, 6, 16, 16,
1806 16, 16, 16, 51, 36, 17, 17, 17, 4, 17,
1807 17, 17, 17, 17, 17, 17, 4, 36, 46, 9,
1808 15, 15, 15, 15, 15, 4, 4, 51, 17, 16,
1809 16, 16, 16, 16, 56, 17, 17, 17
1810 };
1811
1812 const unsigned char
1813 EvalParser::yystos_[] =
1814 {
1815 0, 48, 49, 56, 3, 5, 9, 10, 11, 12,
1816 21, 26, 34, 37, 38, 39, 40, 43, 44, 50,
1817 51, 52, 54, 57, 58, 59, 60, 9, 10, 11,
1818 43, 44, 59, 0, 58, 58, 15, 15, 15, 3,
1819 17, 17, 3, 3, 3, 3, 17, 15, 17, 15,
1820 17, 6, 7, 8, 15, 15, 15, 15, 15, 4,
1821 51, 53, 61, 61, 51, 63, 50, 22, 23, 24,
1822 25, 64, 27, 28, 29, 30, 31, 32, 33, 41,
1823 42, 66, 59, 59, 58, 59, 41, 42, 67, 45,
1824 51, 65, 47, 65, 47, 58, 58, 59, 61, 61,
1825 63, 65, 65, 16, 16, 16, 4, 36, 36, 36,
1826 36, 16, 16, 16, 16, 16, 16, 16, 17, 17,
1827 17, 51, 69, 59, 59, 59, 17, 17, 17, 17,
1828 17, 17, 17, 18, 19, 20, 62, 20, 62, 9,
1829 13, 14, 68, 36, 4, 36, 4, 20, 46, 9,
1830 20, 9, 9, 15, 35, 51, 70, 59, 15, 15,
1831 15, 15, 61, 4, 4, 51, 61, 61, 61, 16,
1832 16, 16, 16, 16, 17, 17, 17, 17, 20, 62,
1833 20, 62
1834 };
1835
1836 const unsigned char
1837 EvalParser::yyr1_[] =
1838 {
1839 0, 55, 56, 56, 57, 58, 58, 58, 58, 58,
1840 58, 58, 58, 58, 58, 58, 58, 59, 59, 59,
1841 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
1842 59, 59, 59, 59, 59, 59, 59, 60, 61, 61,
1843 62, 62, 63, 64, 64, 64, 64, 65, 65, 66,
1844 66, 66, 66, 66, 66, 66, 66, 66, 67, 67,
1845 68, 68, 69, 70, 70
1846 };
1847
1848 const unsigned char
1849 EvalParser::yyr2_[] =
1850 {
1851 0, 2, 2, 2, 1, 3, 2, 3, 3, 3,
1852 6, 6, 11, 6, 6, 11, 4, 1, 1, 1,
1853 6, 6, 11, 3, 3, 3, 6, 8, 6, 8,
1854 6, 3, 3, 11, 6, 9, 1, 1, 1, 1,
1855 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1856 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1857 1, 1, 1, 1, 1
1858 };
1859
1860
1861
1862 // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1863 // First, the terminals, then, starting at \a yyntokens_, nonterminals.
1864 const char*
1865 const EvalParser::yytname_[] =
1866 {
1867 "\"end of file\"", "error", "$undefined", "\"(\"", "\")\"", "\"not\"",
1868 "\"and\"", "\"or\"", "\"==\"", "\"option\"", "\"relay4\"", "\"relay6\"",
1869 "\"member\"", "\"peeraddr\"", "\"linkaddr\"", "\"[\"", "\"]\"", "\".\"",
1870 "\"text\"", "\"hex\"", "\"exists\"", "\"pkt\"", "\"iface\"", "\"src\"",
1871 "\"dst\"", "\"len\"", "\"pkt4\"", "\"mac\"", "\"hlen\"", "\"htype\"",
1872 "\"ciaddr\"", "\"giaddr\"", "\"yiaddr\"", "\"siaddr\"", "\"substring\"",
1873 "\"all\"", "\",\"", "\"concat\"", "\"ifelse\"", "\"hexstring\"",
1874 "\"pkt6\"", "\"msgtype\"", "\"transid\"", "\"vendor-class\"",
1875 "\"vendor\"", "\"*\"", "\"data\"", "\"enterprise\"",
1876 "\"top-level bool\"", "\"top-level string\"", "\"constant string\"",
1877 "\"integer\"", "\"constant hexstring\"", "\"option name\"",
1878 "\"ip address\"", "$accept", "start", "expression", "bool_expr",
1879 "string_expr", "integer_expr", "option_code", "option_repr_type",
1880 "nest_level", "pkt_metadata", "enterprise_id", "pkt4_field",
1881 "pkt6_field", "relay6_field", "start_expr", "length_expr", YY_NULLPTR
1882 };
1883
1884#if EVALDEBUG
1885 const unsigned short
1886 EvalParser::yyrline_[] =
1887 {
1888 0, 120, 120, 121, 126, 129, 130, 135, 140, 145,
1889 150, 155, 175, 189, 198, 207, 217, 234, 239, 244,
1890 249, 254, 275, 290, 295, 309, 323, 338, 343, 348,
1891 353, 358, 367, 377, 386, 399, 412, 419, 425, 429,
1892 435, 439, 445, 454, 458, 462, 466, 472, 476, 482,
1893 486, 490, 494, 498, 502, 506, 510, 514, 520, 524,
1894 530, 534, 540, 547, 552
1895 };
1896
1897 // Print the state stack on the debug stream.
1898 void
1899 EvalParser::yystack_print_ ()
1900 {
1901 *yycdebug_ << "Stack now";
1903 i = yystack_.begin (),
1904 i_end = yystack_.end ();
1905 i != i_end; ++i)
1906 *yycdebug_ << ' ' << i->state;
1907 *yycdebug_ << '\n';
1908 }
1909
1910 // Report on the debug stream that the rule \a yyrule is going to be reduced.
1911 void
1912 EvalParser::yy_reduce_print_ (int yyrule)
1913 {
1914 unsigned yylno = yyrline_[yyrule];
1915 int yynrhs = yyr2_[yyrule];
1916 // Print the symbols being reduced, and their result.
1917 *yycdebug_ << "Reducing stack by rule " << yyrule - 1
1918 << " (line " << yylno << "):\n";
1919 // The symbols being reduced.
1920 for (int yyi = 0; yyi < yynrhs; yyi++)
1921 YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
1922 yystack_[(yynrhs) - (yyi + 1)]);
1923 }
1924#endif // EVALDEBUG
1925
1926
1927#line 14 "parser.yy" // lalr1.cc:1218
1928} } // isc::eval
1929#line 1930 "parser.cc" // lalr1.cc:1218
1930#line 559 "parser.yy" // lalr1.cc:1219
1931
1932void
1934 const std::string& what)
1935{
1936 ctx.error(loc, what);
1937}
#define yylex
Definition: agent_lexer.cc:27
if(!(yy_init))
#define YYUSE(E)
Definition: agent_parser.cc:96
#define YYCDEBUG
#define YYABORT
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: agent_parser.cc:80
#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:61
#define YYERROR
#define YY_RVREF(Type)
Definition: agent_parser.h:84
#define YY_MOVE_REF(Type)
Definition: agent_parser.h:83
#define YY_MOVE
Definition: agent_parser.h:81
Token that represents logical and operator.
Definition: token.h:795
Token that represents concat operator (concatenates two other tokens)
Definition: token.h:678
Token that represents equality operator (compares two other tokens)
Definition: token.h:597
Token representing a constant string in hexadecimal format.
Definition: token.h:137
Token that represents an alternative.
Definition: token.h:706
Token representing an unsigned 32 bit integer.
Definition: token.h:164
Token representing an IP address as a constant string.
Definition: token.h:191
Token that represents client class membership.
Definition: token.h:845
Token that represents logical negation operator.
Definition: token.h:771
Token that represents a value of an option.
Definition: token.h:219
RepresentationType
Token representation type.
Definition: token.h:229
Token that represents logical or operator.
Definition: token.h:820
Token that represents fields of a DHCPv4 packet.
Definition: token.h:435
FieldType
enum value that determines the field.
Definition: token.h:439
@ CIADDR
ciaddr (IPv4 address)
Definition: token.h:442
@ HLEN
hlen (hardware address length)
Definition: token.h:445
@ HTYPE
htype (hardware address type)
Definition: token.h:446
@ GIADDR
giaddr (IPv4 address)
Definition: token.h:441
@ CHADDR
chaddr field (up to 16 bytes link-layer address)
Definition: token.h:440
@ YIADDR
yiaddr (IPv4 address)
Definition: token.h:443
@ SIADDR
siaddr (IPv4 address)
Definition: token.h:444
@ TRANSID
transaction-id (xid)
Definition: token.h:448
@ MSGTYPE
message type (not really a field, content of option 53)
Definition: token.h:447
Token that represents fields of DHCPv6 packet.
Definition: token.h:489
FieldType
enum value that determines the field.
Definition: token.h:492
@ TRANSID
transaction id (integer but manipulated as a string)
Definition: token.h:494
@ MSGTYPE
msg type
Definition: token.h:493
Token that represents meta data of a DHCP packet.
Definition: token.h:385
MetadataType
enum value that determines the field.
Definition: token.h:389
@ LEN
length (4 octets)
Definition: token.h:393
@ DST
destination (IP address)
Definition: token.h:392
@ IFACE
interface name (string)
Definition: token.h:390
@ SRC
source (IP address)
Definition: token.h:391
Represents a sub-option inserted by the DHCPv4 relay.
Definition: token.h:311
Token that represents a value of a field within a DHCPv6 relay encapsulation.
Definition: token.h:540
FieldType
enum value that determines the field.
Definition: token.h:544
@ LINKADDR
Link address field (IPv6 address)
Definition: token.h:546
@ PEERADDR
Peer address field (IPv6 address)
Definition: token.h:545
Token that represents a value of an option within a DHCPv6 relay encapsulation.
Definition: token.h:343
The order where Token subtypes are declared should be:
Definition: token.h:114
Token that represents the substring operator (returns a portion of the supplied string)
Definition: token.h:622
Token that converts to hexadecimal string.
Definition: token.h:736
Token that represents vendor class options in DHCPv4 and DHCPv6.
Definition: token.h:1005
Token that represents vendor options in DHCPv4 and DHCPv6.
Definition: token.h:890
@ DATA
data chunk, used in derived vendor-class only
Definition: token.h:898
@ ENTERPRISE_ID
enterprise-id field (vendor-info, vendor-class)
Definition: token.h:896
Evaluation context, an interface to the expression evaluation.
Definition: eval_context.h:35
int8_t convertNestLevelNumber(const std::string &nest_level, const isc::eval::location &loc)
Nest level conversion.
uint16_t convertOptionCode(const std::string &option_code, const isc::eval::location &loc)
Option code conversion.
Definition: eval_context.cc:69
uint16_t convertOptionName(const std::string &option_name, const isc::eval::location &loc)
Option name conversion.
Definition: eval_context.cc:94
isc::dhcp::Expression expression
Parsed expression (output tokens are stored here)
Definition: eval_context.h:68
Option::Universe getUniverse()
Returns the universe (v4 or v6)
Definition: eval_context.h:180
static uint32_t convertUint32(const std::string &number, const isc::eval::location &loc)
Attempts to convert string to unsigned 32bit integer.
bool isClientClassDefined(const ClientClass &client_class)
Check if a client class is already defined.
static uint8_t convertUint8(const std::string &number, const isc::eval::location &loc)
Attempts to convert string to unsigned 8bit integer.
static void error(const isc::eval::location &loc, const std::string &what)
Error handler.
Definition: eval_context.cc:57
int operator()()
Parse.
Definition: parser.cc:619
virtual int parse()
Parse.
Definition: parser.cc:625
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parser.h:614
location location_type
Symbol locations.
Definition: parser.h:540
virtual ~EvalParser()
Definition: parser.cc:195
EvalParser(EvalContext &ctx_yyarg)
Build a parser object.
Definition: parser.cc:186
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parser.cc:1933
Present a slice of the top of a stack.
Definition: parser.h:269
size_type size() const
Definition: parser.h:242
void push(YY_MOVE_REF(T) t)
Steal the contents of t.
Definition: parser.h:222
const_iterator end() const
Definition: parser.h:254
void clear()
Definition: parser.h:236
const_iterator begin() const
Definition: parser.h:248
void pop(int n=1)
Definition: parser.h:229
S::const_reverse_iterator const_iterator
Definition: parser.h:175
boost::shared_ptr< Token > TokenPtr
Pointer to a single Token.
Definition: token.h:20
Defines the logger used by the top-level component of kea-dhcp-ddns.
Define the isc::eval::parser class.
#define EVALDEBUG
Definition: parser.h:160
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parser.h:1550
location_type location
The location.
Definition: parser.h:710
bool empty() const
Whether empty.
Definition: parser.h:1543
void clear()
Destroy contents, and record that is empty.
Definition: parser.h:1478
Syntax errors thrown from user actions.
Definition: parser.h:544