| File: | home/fedora/workspace/kea-dev/clang-static-analyzer/build/meson-private/tmp_xzd2v8m/../../../src/lib/eval/parser.cc |
| Warning: | line 712, column 43 The left operand of '+' is a garbage value due to array index out of bounds |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | // A Bison parser, made by GNU Bison 3.8.2. | |||
| 2 | ||||
| 3 | // Skeleton implementation for Bison LALR(1) parsers in C++ | |||
| 4 | ||||
| 5 | // Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. | |||
| 6 | ||||
| 7 | // This program is free software: you can redistribute it and/or modify | |||
| 8 | // it under the terms of the GNU General Public License as published by | |||
| 9 | // the Free Software Foundation, either version 3 of the License, or | |||
| 10 | // (at your option) any later version. | |||
| 11 | ||||
| 12 | // This program is distributed in the hope that it will be useful, | |||
| 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| 15 | // GNU General Public License for more details. | |||
| 16 | ||||
| 17 | // You should have received a copy of the GNU General Public License | |||
| 18 | // along with this program. If not, see <https://www.gnu.org/licenses/>. | |||
| 19 | ||||
| 20 | // As a special exception, you may create a larger work that contains | |||
| 21 | // part or all of the Bison parser skeleton and distribute that work | |||
| 22 | // under terms of your choice, so long as that work isn't itself a | |||
| 23 | // parser generator using the skeleton or a modified version thereof | |||
| 24 | // as a parser skeleton. Alternatively, if you modify or redistribute | |||
| 25 | // the parser skeleton itself, you may (at your option) remove this | |||
| 26 | // special exception, which will cause the skeleton and the resulting | |||
| 27 | // Bison output files to be licensed under the GNU General Public | |||
| 28 | // License without this special exception. | |||
| 29 | ||||
| 30 | // This special exception was added by the Free Software Foundation in | |||
| 31 | // version 2.2 of Bison. | |||
| 32 | ||||
| 33 | // DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, | |||
| 34 | // especially those whose name start with YY_ or yy_. They are | |||
| 35 | // private implementation details that can be changed or removed. | |||
| 36 | ||||
| 37 | ||||
| 38 | // Take the name prefix into account. | |||
| 39 | #define yylexevallex evallex | |||
| 40 | ||||
| 41 | ||||
| 42 | ||||
| 43 | #include "parser.h" | |||
| 44 | ||||
| 45 | ||||
| 46 | // Unqualified %code blocks. | |||
| 47 | #line 33 "parser.yy" | |||
| 48 | ||||
| 49 | # include "eval_context.h" | |||
| 50 | ||||
| 51 | // Avoid warnings with the error counter. | |||
| 52 | #if defined(__GNUC__4) || defined(__clang__1) | |||
| 53 | #pragma GCC diagnostic ignored "-Wunused-but-set-variable" | |||
| 54 | #endif | |||
| 55 | ||||
| 56 | #line 57 "parser.cc" | |||
| 57 | ||||
| 58 | ||||
| 59 | #ifndef YY_ | |||
| 60 | # if defined YYENABLE_NLS && YYENABLE_NLS | |||
| 61 | # if ENABLE_NLS | |||
| 62 | # include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE. | |||
| 63 | # define YY_(msgid)msgid dgettext ("bison-runtime", msgid) | |||
| 64 | # endif | |||
| 65 | # endif | |||
| 66 | # ifndef YY_ | |||
| 67 | # define YY_(msgid)msgid msgid | |||
| 68 | # endif | |||
| 69 | #endif | |||
| 70 | ||||
| 71 | ||||
| 72 | // Whether we are compiled with exception support. | |||
| 73 | #ifndef YY_EXCEPTIONS1 | |||
| 74 | # if defined __GNUC__4 && !defined __EXCEPTIONS1 | |||
| 75 | # define YY_EXCEPTIONS1 0 | |||
| 76 | # else | |||
| 77 | # define YY_EXCEPTIONS1 1 | |||
| 78 | # endif | |||
| 79 | #endif | |||
| 80 | ||||
| 81 | #define YYRHSLOC(Rhs, K)((Rhs)[K].location) ((Rhs)[K].location) | |||
| 82 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | |||
| 83 | If N is 0, then set CURRENT to the empty location which ends | |||
| 84 | the previous symbol: RHS[0] (always defined). */ | |||
| 85 | ||||
| 86 | # ifndef YYLLOC_DEFAULT | |||
| 87 | # define YYLLOC_DEFAULT(Current, Rhs, N)do if (N) { (Current).begin = ((Rhs)[1].location).begin; (Current ).end = ((Rhs)[N].location).end; } else { (Current).begin = ( Current).end = ((Rhs)[0].location).end; } while (false) \ | |||
| 88 | do \ | |||
| 89 | if (N) \ | |||
| 90 | { \ | |||
| 91 | (Current).begin = YYRHSLOC (Rhs, 1)((Rhs)[1].location).begin; \ | |||
| 92 | (Current).end = YYRHSLOC (Rhs, N)((Rhs)[N].location).end; \ | |||
| 93 | } \ | |||
| 94 | else \ | |||
| 95 | { \ | |||
| 96 | (Current).begin = (Current).end = YYRHSLOC (Rhs, 0)((Rhs)[0].location).end; \ | |||
| 97 | } \ | |||
| 98 | while (false) | |||
| 99 | # endif | |||
| 100 | ||||
| 101 | ||||
| 102 | // Enable debugging if requested. | |||
| 103 | #if EVALDEBUG1 | |||
| 104 | ||||
| 105 | // A pseudo ostream that takes yydebug_ into account. | |||
| 106 | # define YYCDEBUGif (yydebug_) (*yycdebug_) if (yydebug_) (*yycdebug_) | |||
| 107 | ||||
| 108 | # define YY_SYMBOL_PRINT(Title, Symbol)do { if (yydebug_) { *yycdebug_ << Title << ' '; yy_print_ (*yycdebug_, Symbol); *yycdebug_ << '\n'; } } while (false ) \ | |||
| 109 | do { \ | |||
| 110 | if (yydebug_) \ | |||
| 111 | { \ | |||
| 112 | *yycdebug_ << Title << ' '; \ | |||
| 113 | yy_print_ (*yycdebug_, Symbol); \ | |||
| 114 | *yycdebug_ << '\n'; \ | |||
| 115 | } \ | |||
| 116 | } while (false) | |||
| 117 | ||||
| 118 | # define YY_REDUCE_PRINT(Rule)do { if (yydebug_) yy_reduce_print_ (Rule); } while (false) \ | |||
| 119 | do { \ | |||
| 120 | if (yydebug_) \ | |||
| 121 | yy_reduce_print_ (Rule); \ | |||
| 122 | } while (false) | |||
| 123 | ||||
| 124 | # define YY_STACK_PRINT()do { if (yydebug_) yy_stack_print_ (); } while (false) \ | |||
| 125 | do { \ | |||
| 126 | if (yydebug_) \ | |||
| 127 | yy_stack_print_ (); \ | |||
| 128 | } while (false) | |||
| 129 | ||||
| 130 | #else // !EVALDEBUG | |||
| 131 | ||||
| 132 | # define YYCDEBUGif (yydebug_) (*yycdebug_) if (false) std::cerr | |||
| 133 | # define YY_SYMBOL_PRINT(Title, Symbol)do { if (yydebug_) { *yycdebug_ << Title << ' '; yy_print_ (*yycdebug_, Symbol); *yycdebug_ << '\n'; } } while (false ) YY_USE (Symbol)((void) (Symbol)) | |||
| 134 | # define YY_REDUCE_PRINT(Rule)do { if (yydebug_) yy_reduce_print_ (Rule); } while (false) static_cast<void> (0) | |||
| 135 | # define YY_STACK_PRINT()do { if (yydebug_) yy_stack_print_ (); } while (false) static_cast<void> (0) | |||
| 136 | ||||
| 137 | #endif // !EVALDEBUG | |||
| 138 | ||||
| 139 | #define yyerrok(yyerrstatus_ = 0) (yyerrstatus_ = 0) | |||
| 140 | #define yyclearin(yyla.clear ()) (yyla.clear ()) | |||
| 141 | ||||
| 142 | #define YYACCEPTgoto yyacceptlab goto yyacceptlab | |||
| 143 | #define YYABORTgoto yyabortlab goto yyabortlab | |||
| 144 | #define YYERRORgoto yyerrorlab goto yyerrorlab | |||
| 145 | #define YYRECOVERING()(!!yyerrstatus_) (!!yyerrstatus_) | |||
| 146 | ||||
| 147 | #line 14 "parser.yy" | |||
| 148 | namespace isc { namespace eval { | |||
| 149 | #line 150 "parser.cc" | |||
| 150 | ||||
| 151 | /// Build a parser object. | |||
| 152 | EvalParser::EvalParser (EvalContext& ctx_yyarg) | |||
| 153 | #if EVALDEBUG1 | |||
| 154 | : yydebug_ (false), | |||
| 155 | yycdebug_ (&std::cerr), | |||
| 156 | #else | |||
| 157 | : | |||
| 158 | #endif | |||
| 159 | ctx (ctx_yyarg) | |||
| 160 | {} | |||
| 161 | ||||
| 162 | EvalParser::~EvalParser () | |||
| 163 | {} | |||
| 164 | ||||
| 165 | EvalParser::syntax_error::~syntax_error () YY_NOEXCEPTnoexcept YY_NOTHROW | |||
| 166 | {} | |||
| 167 | ||||
| 168 | /*---------. | |||
| 169 | | symbol. | | |||
| 170 | `---------*/ | |||
| 171 | ||||
| 172 | ||||
| 173 | ||||
| 174 | // by_state. | |||
| 175 | EvalParser::by_state::by_state () YY_NOEXCEPTnoexcept | |||
| 176 | : state (empty_state) | |||
| 177 | {} | |||
| 178 | ||||
| 179 | EvalParser::by_state::by_state (const by_state& that) YY_NOEXCEPTnoexcept | |||
| 180 | : state (that.state) | |||
| 181 | {} | |||
| 182 | ||||
| 183 | void | |||
| 184 | EvalParser::by_state::clear () YY_NOEXCEPTnoexcept | |||
| 185 | { | |||
| 186 | state = empty_state; | |||
| 187 | } | |||
| 188 | ||||
| 189 | void | |||
| 190 | EvalParser::by_state::move (by_state& that) | |||
| 191 | { | |||
| 192 | state = that.state; | |||
| 193 | that.clear (); | |||
| 194 | } | |||
| 195 | ||||
| 196 | EvalParser::by_state::by_state (state_type s) YY_NOEXCEPTnoexcept | |||
| 197 | : state (s) | |||
| 198 | {} | |||
| 199 | ||||
| 200 | EvalParser::symbol_kind_type | |||
| 201 | EvalParser::by_state::kind () const YY_NOEXCEPTnoexcept | |||
| 202 | { | |||
| 203 | if (state == empty_state) | |||
| 204 | return symbol_kind::S_YYEMPTY; | |||
| 205 | else | |||
| 206 | return YY_CAST (symbol_kind_type, yystos_[+state])static_cast<symbol_kind_type> (yystos_[+state]); | |||
| 207 | } | |||
| 208 | ||||
| 209 | EvalParser::stack_symbol_type::stack_symbol_type () | |||
| 210 | {} | |||
| 211 | ||||
| 212 | EvalParser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type)stack_symbol_type&& that) | |||
| 213 | : super_type (YY_MOVEstd::move (that.state), YY_MOVEstd::move (that.location)) | |||
| 214 | { | |||
| 215 | switch (that.kind ()) | |||
| 216 | { | |||
| 217 | case symbol_kind::S_option_repr_type: // option_repr_type | |||
| 218 | value.YY_MOVE_OR_COPYmove< TokenOption::RepresentationType > (YY_MOVEstd::move (that.value)); | |||
| 219 | break; | |||
| 220 | ||||
| 221 | case symbol_kind::S_pkt4_field: // pkt4_field | |||
| 222 | value.YY_MOVE_OR_COPYmove< TokenPkt4::FieldType > (YY_MOVEstd::move (that.value)); | |||
| 223 | break; | |||
| 224 | ||||
| 225 | case symbol_kind::S_pkt6_field: // pkt6_field | |||
| 226 | value.YY_MOVE_OR_COPYmove< TokenPkt6::FieldType > (YY_MOVEstd::move (that.value)); | |||
| 227 | break; | |||
| 228 | ||||
| 229 | case symbol_kind::S_pkt_metadata: // pkt_metadata | |||
| 230 | value.YY_MOVE_OR_COPYmove< TokenPkt::MetadataType > (YY_MOVEstd::move (that.value)); | |||
| 231 | break; | |||
| 232 | ||||
| 233 | case symbol_kind::S_relay6_field: // relay6_field | |||
| 234 | value.YY_MOVE_OR_COPYmove< TokenRelay6Field::FieldType > (YY_MOVEstd::move (that.value)); | |||
| 235 | break; | |||
| 236 | ||||
| 237 | case symbol_kind::S_nest_level: // nest_level | |||
| 238 | value.YY_MOVE_OR_COPYmove< int8_t > (YY_MOVEstd::move (that.value)); | |||
| 239 | break; | |||
| 240 | ||||
| 241 | case symbol_kind::S_relay6_option_chain: // relay6_option_chain | |||
| 242 | value.YY_MOVE_OR_COPYmove< std::pair<int8_t, std::vector<uint16_t>> > (YY_MOVEstd::move (that.value)); | |||
| 243 | break; | |||
| 244 | ||||
| 245 | case symbol_kind::S_vendor_option_chain: // vendor_option_chain | |||
| 246 | value.YY_MOVE_OR_COPYmove< std::pair<uint32_t, std::vector<uint16_t>> > (YY_MOVEstd::move (that.value)); | |||
| 247 | break; | |||
| 248 | ||||
| 249 | case symbol_kind::S_STRING: // "constant string" | |||
| 250 | case symbol_kind::S_INTEGER: // "integer" | |||
| 251 | case symbol_kind::S_HEXSTRING: // "constant hexstring" | |||
| 252 | case symbol_kind::S_OPTION_NAME: // "option name" | |||
| 253 | case symbol_kind::S_IP_ADDRESS: // "ip address" | |||
| 254 | value.YY_MOVE_OR_COPYmove< std::string > (YY_MOVEstd::move (that.value)); | |||
| 255 | break; | |||
| 256 | ||||
| 257 | case symbol_kind::S_option_chain: // option_chain | |||
| 258 | case symbol_kind::S_relay4_option_chain: // relay4_option_chain | |||
| 259 | value.YY_MOVE_OR_COPYmove< std::vector<uint16_t> > (YY_MOVEstd::move (that.value)); | |||
| 260 | break; | |||
| 261 | ||||
| 262 | case symbol_kind::S_option_code: // option_code | |||
| 263 | case symbol_kind::S_sub_option_code: // sub_option_code | |||
| 264 | value.YY_MOVE_OR_COPYmove< uint16_t > (YY_MOVEstd::move (that.value)); | |||
| 265 | break; | |||
| 266 | ||||
| 267 | case symbol_kind::S_integer_expr: // integer_expr | |||
| 268 | case symbol_kind::S_enterprise_id: // enterprise_id | |||
| 269 | value.YY_MOVE_OR_COPYmove< uint32_t > (YY_MOVEstd::move (that.value)); | |||
| 270 | break; | |||
| 271 | ||||
| 272 | default: | |||
| 273 | break; | |||
| 274 | } | |||
| 275 | ||||
| 276 | #if 201103L <= YY_CPLUSPLUS201703L | |||
| 277 | // that is emptied. | |||
| 278 | that.state = empty_state; | |||
| 279 | #endif | |||
| 280 | } | |||
| 281 | ||||
| 282 | EvalParser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type)symbol_type&& that) | |||
| 283 | : super_type (s, YY_MOVEstd::move (that.location)) | |||
| 284 | { | |||
| 285 | switch (that.kind ()) | |||
| 286 | { | |||
| 287 | case symbol_kind::S_option_repr_type: // option_repr_type | |||
| 288 | value.move< TokenOption::RepresentationType > (YY_MOVEstd::move (that.value)); | |||
| 289 | break; | |||
| 290 | ||||
| 291 | case symbol_kind::S_pkt4_field: // pkt4_field | |||
| 292 | value.move< TokenPkt4::FieldType > (YY_MOVEstd::move (that.value)); | |||
| 293 | break; | |||
| 294 | ||||
| 295 | case symbol_kind::S_pkt6_field: // pkt6_field | |||
| 296 | value.move< TokenPkt6::FieldType > (YY_MOVEstd::move (that.value)); | |||
| 297 | break; | |||
| 298 | ||||
| 299 | case symbol_kind::S_pkt_metadata: // pkt_metadata | |||
| 300 | value.move< TokenPkt::MetadataType > (YY_MOVEstd::move (that.value)); | |||
| 301 | break; | |||
| 302 | ||||
| 303 | case symbol_kind::S_relay6_field: // relay6_field | |||
| 304 | value.move< TokenRelay6Field::FieldType > (YY_MOVEstd::move (that.value)); | |||
| 305 | break; | |||
| 306 | ||||
| 307 | case symbol_kind::S_nest_level: // nest_level | |||
| 308 | value.move< int8_t > (YY_MOVEstd::move (that.value)); | |||
| 309 | break; | |||
| 310 | ||||
| 311 | case symbol_kind::S_relay6_option_chain: // relay6_option_chain | |||
| 312 | value.move< std::pair<int8_t, std::vector<uint16_t>> > (YY_MOVEstd::move (that.value)); | |||
| 313 | break; | |||
| 314 | ||||
| 315 | case symbol_kind::S_vendor_option_chain: // vendor_option_chain | |||
| 316 | value.move< std::pair<uint32_t, std::vector<uint16_t>> > (YY_MOVEstd::move (that.value)); | |||
| 317 | break; | |||
| 318 | ||||
| 319 | case symbol_kind::S_STRING: // "constant string" | |||
| 320 | case symbol_kind::S_INTEGER: // "integer" | |||
| 321 | case symbol_kind::S_HEXSTRING: // "constant hexstring" | |||
| 322 | case symbol_kind::S_OPTION_NAME: // "option name" | |||
| 323 | case symbol_kind::S_IP_ADDRESS: // "ip address" | |||
| 324 | value.move< std::string > (YY_MOVEstd::move (that.value)); | |||
| 325 | break; | |||
| 326 | ||||
| 327 | case symbol_kind::S_option_chain: // option_chain | |||
| 328 | case symbol_kind::S_relay4_option_chain: // relay4_option_chain | |||
| 329 | value.move< std::vector<uint16_t> > (YY_MOVEstd::move (that.value)); | |||
| 330 | break; | |||
| 331 | ||||
| 332 | case symbol_kind::S_option_code: // option_code | |||
| 333 | case symbol_kind::S_sub_option_code: // sub_option_code | |||
| 334 | value.move< uint16_t > (YY_MOVEstd::move (that.value)); | |||
| 335 | break; | |||
| 336 | ||||
| 337 | case symbol_kind::S_integer_expr: // integer_expr | |||
| 338 | case symbol_kind::S_enterprise_id: // enterprise_id | |||
| 339 | value.move< uint32_t > (YY_MOVEstd::move (that.value)); | |||
| 340 | break; | |||
| 341 | ||||
| 342 | default: | |||
| 343 | break; | |||
| 344 | } | |||
| 345 | ||||
| 346 | // that is emptied. | |||
| 347 | that.kind_ = symbol_kind::S_YYEMPTY; | |||
| 348 | } | |||
| 349 | ||||
| 350 | #if YY_CPLUSPLUS201703L < 201103L | |||
| 351 | EvalParser::stack_symbol_type& | |||
| 352 | EvalParser::stack_symbol_type::operator= (const stack_symbol_type& that) | |||
| 353 | { | |||
| 354 | state = that.state; | |||
| 355 | switch (that.kind ()) | |||
| 356 | { | |||
| 357 | case symbol_kind::S_option_repr_type: // option_repr_type | |||
| 358 | value.copy< TokenOption::RepresentationType > (that.value); | |||
| 359 | break; | |||
| 360 | ||||
| 361 | case symbol_kind::S_pkt4_field: // pkt4_field | |||
| 362 | value.copy< TokenPkt4::FieldType > (that.value); | |||
| 363 | break; | |||
| 364 | ||||
| 365 | case symbol_kind::S_pkt6_field: // pkt6_field | |||
| 366 | value.copy< TokenPkt6::FieldType > (that.value); | |||
| 367 | break; | |||
| 368 | ||||
| 369 | case symbol_kind::S_pkt_metadata: // pkt_metadata | |||
| 370 | value.copy< TokenPkt::MetadataType > (that.value); | |||
| 371 | break; | |||
| 372 | ||||
| 373 | case symbol_kind::S_relay6_field: // relay6_field | |||
| 374 | value.copy< TokenRelay6Field::FieldType > (that.value); | |||
| 375 | break; | |||
| 376 | ||||
| 377 | case symbol_kind::S_nest_level: // nest_level | |||
| 378 | value.copy< int8_t > (that.value); | |||
| 379 | break; | |||
| 380 | ||||
| 381 | case symbol_kind::S_relay6_option_chain: // relay6_option_chain | |||
| 382 | value.copy< std::pair<int8_t, std::vector<uint16_t>> > (that.value); | |||
| 383 | break; | |||
| 384 | ||||
| 385 | case symbol_kind::S_vendor_option_chain: // vendor_option_chain | |||
| 386 | value.copy< std::pair<uint32_t, std::vector<uint16_t>> > (that.value); | |||
| 387 | break; | |||
| 388 | ||||
| 389 | case symbol_kind::S_STRING: // "constant string" | |||
| 390 | case symbol_kind::S_INTEGER: // "integer" | |||
| 391 | case symbol_kind::S_HEXSTRING: // "constant hexstring" | |||
| 392 | case symbol_kind::S_OPTION_NAME: // "option name" | |||
| 393 | case symbol_kind::S_IP_ADDRESS: // "ip address" | |||
| 394 | value.copy< std::string > (that.value); | |||
| 395 | break; | |||
| 396 | ||||
| 397 | case symbol_kind::S_option_chain: // option_chain | |||
| 398 | case symbol_kind::S_relay4_option_chain: // relay4_option_chain | |||
| 399 | value.copy< std::vector<uint16_t> > (that.value); | |||
| 400 | break; | |||
| 401 | ||||
| 402 | case symbol_kind::S_option_code: // option_code | |||
| 403 | case symbol_kind::S_sub_option_code: // sub_option_code | |||
| 404 | value.copy< uint16_t > (that.value); | |||
| 405 | break; | |||
| 406 | ||||
| 407 | case symbol_kind::S_integer_expr: // integer_expr | |||
| 408 | case symbol_kind::S_enterprise_id: // enterprise_id | |||
| 409 | value.copy< uint32_t > (that.value); | |||
| 410 | break; | |||
| 411 | ||||
| 412 | default: | |||
| 413 | break; | |||
| 414 | } | |||
| 415 | ||||
| 416 | location = that.location; | |||
| 417 | return *this; | |||
| 418 | } | |||
| 419 | ||||
| 420 | EvalParser::stack_symbol_type& | |||
| 421 | EvalParser::stack_symbol_type::operator= (stack_symbol_type& that) | |||
| 422 | { | |||
| 423 | state = that.state; | |||
| 424 | switch (that.kind ()) | |||
| 425 | { | |||
| 426 | case symbol_kind::S_option_repr_type: // option_repr_type | |||
| 427 | value.move< TokenOption::RepresentationType > (that.value); | |||
| 428 | break; | |||
| 429 | ||||
| 430 | case symbol_kind::S_pkt4_field: // pkt4_field | |||
| 431 | value.move< TokenPkt4::FieldType > (that.value); | |||
| 432 | break; | |||
| 433 | ||||
| 434 | case symbol_kind::S_pkt6_field: // pkt6_field | |||
| 435 | value.move< TokenPkt6::FieldType > (that.value); | |||
| 436 | break; | |||
| 437 | ||||
| 438 | case symbol_kind::S_pkt_metadata: // pkt_metadata | |||
| 439 | value.move< TokenPkt::MetadataType > (that.value); | |||
| 440 | break; | |||
| 441 | ||||
| 442 | case symbol_kind::S_relay6_field: // relay6_field | |||
| 443 | value.move< TokenRelay6Field::FieldType > (that.value); | |||
| 444 | break; | |||
| 445 | ||||
| 446 | case symbol_kind::S_nest_level: // nest_level | |||
| 447 | value.move< int8_t > (that.value); | |||
| 448 | break; | |||
| 449 | ||||
| 450 | case symbol_kind::S_relay6_option_chain: // relay6_option_chain | |||
| 451 | value.move< std::pair<int8_t, std::vector<uint16_t>> > (that.value); | |||
| 452 | break; | |||
| 453 | ||||
| 454 | case symbol_kind::S_vendor_option_chain: // vendor_option_chain | |||
| 455 | value.move< std::pair<uint32_t, std::vector<uint16_t>> > (that.value); | |||
| 456 | break; | |||
| 457 | ||||
| 458 | case symbol_kind::S_STRING: // "constant string" | |||
| 459 | case symbol_kind::S_INTEGER: // "integer" | |||
| 460 | case symbol_kind::S_HEXSTRING: // "constant hexstring" | |||
| 461 | case symbol_kind::S_OPTION_NAME: // "option name" | |||
| 462 | case symbol_kind::S_IP_ADDRESS: // "ip address" | |||
| 463 | value.move< std::string > (that.value); | |||
| 464 | break; | |||
| 465 | ||||
| 466 | case symbol_kind::S_option_chain: // option_chain | |||
| 467 | case symbol_kind::S_relay4_option_chain: // relay4_option_chain | |||
| 468 | value.move< std::vector<uint16_t> > (that.value); | |||
| 469 | break; | |||
| 470 | ||||
| 471 | case symbol_kind::S_option_code: // option_code | |||
| 472 | case symbol_kind::S_sub_option_code: // sub_option_code | |||
| 473 | value.move< uint16_t > (that.value); | |||
| 474 | break; | |||
| 475 | ||||
| 476 | case symbol_kind::S_integer_expr: // integer_expr | |||
| 477 | case symbol_kind::S_enterprise_id: // enterprise_id | |||
| 478 | value.move< uint32_t > (that.value); | |||
| 479 | break; | |||
| 480 | ||||
| 481 | default: | |||
| 482 | break; | |||
| 483 | } | |||
| 484 | ||||
| 485 | location = that.location; | |||
| 486 | // that is emptied. | |||
| 487 | that.state = empty_state; | |||
| 488 | return *this; | |||
| 489 | } | |||
| 490 | #endif | |||
| 491 | ||||
| 492 | template <typename Base> | |||
| 493 | void | |||
| 494 | EvalParser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const | |||
| 495 | { | |||
| 496 | if (yymsg) | |||
| 497 | YY_SYMBOL_PRINT (yymsg, yysym)do { if (yydebug_) { *yycdebug_ << yymsg << ' '; yy_print_ (*yycdebug_, yysym); *yycdebug_ << '\n'; } } while (false ); | |||
| 498 | } | |||
| 499 | ||||
| 500 | #if EVALDEBUG1 | |||
| 501 | template <typename Base> | |||
| 502 | void | |||
| 503 | EvalParser::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const | |||
| 504 | { | |||
| 505 | std::ostream& yyoutput = yyo; | |||
| 506 | YY_USE (yyoutput)((void) (yyoutput)); | |||
| 507 | if (yysym.empty ()) | |||
| 508 | yyo << "empty symbol"; | |||
| 509 | else | |||
| 510 | { | |||
| 511 | symbol_kind_type yykind = yysym.kind (); | |||
| 512 | yyo << (yykind < YYNTOKENS ? "token" : "nterm") | |||
| 513 | << ' ' << yysym.name () << " (" | |||
| 514 | << yysym.location << ": "; | |||
| 515 | switch (yykind) | |||
| 516 | { | |||
| 517 | case symbol_kind::S_STRING: // "constant string" | |||
| 518 | #line 139 "parser.yy" | |||
| 519 | { yyoutput << yysym.value.template as < std::string > (); } | |||
| 520 | #line 521 "parser.cc" | |||
| 521 | break; | |||
| 522 | ||||
| 523 | case symbol_kind::S_INTEGER: // "integer" | |||
| 524 | #line 139 "parser.yy" | |||
| 525 | { yyoutput << yysym.value.template as < std::string > (); } | |||
| 526 | #line 527 "parser.cc" | |||
| 527 | break; | |||
| 528 | ||||
| 529 | case symbol_kind::S_HEXSTRING: // "constant hexstring" | |||
| 530 | #line 139 "parser.yy" | |||
| 531 | { yyoutput << yysym.value.template as < std::string > (); } | |||
| 532 | #line 533 "parser.cc" | |||
| 533 | break; | |||
| 534 | ||||
| 535 | case symbol_kind::S_OPTION_NAME: // "option name" | |||
| 536 | #line 139 "parser.yy" | |||
| 537 | { yyoutput << yysym.value.template as < std::string > (); } | |||
| 538 | #line 539 "parser.cc" | |||
| 539 | break; | |||
| 540 | ||||
| 541 | case symbol_kind::S_IP_ADDRESS: // "ip address" | |||
| 542 | #line 139 "parser.yy" | |||
| 543 | { yyoutput << yysym.value.template as < std::string > (); } | |||
| 544 | #line 545 "parser.cc" | |||
| 545 | break; | |||
| 546 | ||||
| 547 | case symbol_kind::S_option_chain: // option_chain | |||
| 548 | #line 141 "parser.yy" | |||
| 549 | { | |||
| 550 | for (size_t i = 0; i < yysym.value.template as < std::vector<uint16_t> > ().size(); ++i) { | |||
| 551 | yyoutput << (i > 0 ? ", " : "") << yysym.value.template as < std::vector<uint16_t> > ()[i]; | |||
| 552 | } | |||
| 553 | } | |||
| 554 | #line 555 "parser.cc" | |||
| 555 | break; | |||
| 556 | ||||
| 557 | case symbol_kind::S_relay4_option_chain: // relay4_option_chain | |||
| 558 | #line 141 "parser.yy" | |||
| 559 | { | |||
| 560 | for (size_t i = 0; i < yysym.value.template as < std::vector<uint16_t> > ().size(); ++i) { | |||
| 561 | yyoutput << (i > 0 ? ", " : "") << yysym.value.template as < std::vector<uint16_t> > ()[i]; | |||
| 562 | } | |||
| 563 | } | |||
| 564 | #line 565 "parser.cc" | |||
| 565 | break; | |||
| 566 | ||||
| 567 | case symbol_kind::S_relay6_option_chain: // relay6_option_chain | |||
| 568 | #line 147 "parser.yy" | |||
| 569 | { | |||
| 570 | yyoutput << yysym.value.template as < std::pair<int8_t, std::vector<uint16_t>> > ().first << std::endl; | |||
| 571 | for (size_t i = 0; i < yysym.value.template as < std::pair<int8_t, std::vector<uint16_t>> > ().second.size(); ++i) { | |||
| 572 | yyoutput << (i > 0 ? ", " : "") << yysym.value.template as < std::pair<int8_t, std::vector<uint16_t>> > ().second[i]; | |||
| 573 | } | |||
| 574 | } | |||
| 575 | #line 576 "parser.cc" | |||
| 576 | break; | |||
| 577 | ||||
| 578 | case symbol_kind::S_vendor_option_chain: // vendor_option_chain | |||
| 579 | #line 154 "parser.yy" | |||
| 580 | { | |||
| 581 | yyoutput << yysym.value.template as < std::pair<uint32_t, std::vector<uint16_t>> > ().first << std::endl; | |||
| 582 | for (size_t i = 0; i < yysym.value.template as < std::pair<uint32_t, std::vector<uint16_t>> > ().second.size(); ++i) { | |||
| 583 | yyoutput << (i > 0 ? ", " : "") << yysym.value.template as < std::pair<uint32_t, std::vector<uint16_t>> > ().second[i]; | |||
| 584 | } | |||
| 585 | } | |||
| 586 | #line 587 "parser.cc" | |||
| 587 | break; | |||
| 588 | ||||
| 589 | case symbol_kind::S_integer_expr: // integer_expr | |||
| 590 | #line 139 "parser.yy" | |||
| 591 | { yyoutput << yysym.value.template as < uint32_t > (); } | |||
| 592 | #line 593 "parser.cc" | |||
| 593 | break; | |||
| 594 | ||||
| 595 | case symbol_kind::S_option_code: // option_code | |||
| 596 | #line 139 "parser.yy" | |||
| 597 | { yyoutput << yysym.value.template as < uint16_t > (); } | |||
| 598 | #line 599 "parser.cc" | |||
| 599 | break; | |||
| 600 | ||||
| 601 | case symbol_kind::S_sub_option_code: // sub_option_code | |||
| 602 | #line 139 "parser.yy" | |||
| 603 | { yyoutput << yysym.value.template as < uint16_t > (); } | |||
| 604 | #line 605 "parser.cc" | |||
| 605 | break; | |||
| 606 | ||||
| 607 | case symbol_kind::S_option_repr_type: // option_repr_type | |||
| 608 | #line 139 "parser.yy" | |||
| 609 | { yyoutput << yysym.value.template as < TokenOption::RepresentationType > (); } | |||
| 610 | #line 611 "parser.cc" | |||
| 611 | break; | |||
| 612 | ||||
| 613 | case symbol_kind::S_nest_level: // nest_level | |||
| 614 | #line 139 "parser.yy" | |||
| 615 | { yyoutput << yysym.value.template as < int8_t > (); } | |||
| 616 | #line 617 "parser.cc" | |||
| 617 | break; | |||
| 618 | ||||
| 619 | case symbol_kind::S_pkt_metadata: // pkt_metadata | |||
| 620 | #line 139 "parser.yy" | |||
| 621 | { yyoutput << yysym.value.template as < TokenPkt::MetadataType > (); } | |||
| 622 | #line 623 "parser.cc" | |||
| 623 | break; | |||
| 624 | ||||
| 625 | case symbol_kind::S_enterprise_id: // enterprise_id | |||
| 626 | #line 139 "parser.yy" | |||
| 627 | { yyoutput << yysym.value.template as < uint32_t > (); } | |||
| 628 | #line 629 "parser.cc" | |||
| 629 | break; | |||
| 630 | ||||
| 631 | case symbol_kind::S_pkt4_field: // pkt4_field | |||
| 632 | #line 139 "parser.yy" | |||
| 633 | { yyoutput << yysym.value.template as < TokenPkt4::FieldType > (); } | |||
| 634 | #line 635 "parser.cc" | |||
| 635 | break; | |||
| 636 | ||||
| 637 | case symbol_kind::S_pkt6_field: // pkt6_field | |||
| 638 | #line 139 "parser.yy" | |||
| 639 | { yyoutput << yysym.value.template as < TokenPkt6::FieldType > (); } | |||
| 640 | #line 641 "parser.cc" | |||
| 641 | break; | |||
| 642 | ||||
| 643 | case symbol_kind::S_relay6_field: // relay6_field | |||
| 644 | #line 139 "parser.yy" | |||
| 645 | { yyoutput << yysym.value.template as < TokenRelay6Field::FieldType > (); } | |||
| 646 | #line 647 "parser.cc" | |||
| 647 | break; | |||
| 648 | ||||
| 649 | default: | |||
| 650 | break; | |||
| 651 | } | |||
| 652 | yyo << ')'; | |||
| 653 | } | |||
| 654 | } | |||
| 655 | #endif | |||
| 656 | ||||
| 657 | void | |||
| 658 | EvalParser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type)stack_symbol_type&& sym) | |||
| 659 | { | |||
| 660 | if (m) | |||
| 661 | YY_SYMBOL_PRINT (m, sym)do { if (yydebug_) { *yycdebug_ << m << ' '; yy_print_ (*yycdebug_, sym); *yycdebug_ << '\n'; } } while (false ); | |||
| 662 | yystack_.push (YY_MOVEstd::move (sym)); | |||
| 663 | } | |||
| 664 | ||||
| 665 | void | |||
| 666 | EvalParser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type)symbol_type&& sym) | |||
| 667 | { | |||
| 668 | #if 201103L <= YY_CPLUSPLUS201703L | |||
| 669 | yypush_ (m, stack_symbol_type (s, std::move (sym))); | |||
| 670 | #else | |||
| 671 | stack_symbol_type ss (s, sym); | |||
| 672 | yypush_ (m, ss); | |||
| 673 | #endif | |||
| 674 | } | |||
| 675 | ||||
| 676 | void | |||
| 677 | EvalParser::yypop_ (int n) YY_NOEXCEPTnoexcept | |||
| 678 | { | |||
| 679 | yystack_.pop (n); | |||
| 680 | } | |||
| 681 | ||||
| 682 | #if EVALDEBUG1 | |||
| 683 | std::ostream& | |||
| 684 | EvalParser::debug_stream () const | |||
| 685 | { | |||
| 686 | return *yycdebug_; | |||
| 687 | } | |||
| 688 | ||||
| 689 | void | |||
| 690 | EvalParser::set_debug_stream (std::ostream& o) | |||
| 691 | { | |||
| 692 | yycdebug_ = &o; | |||
| 693 | } | |||
| 694 | ||||
| 695 | ||||
| 696 | EvalParser::debug_level_type | |||
| 697 | EvalParser::debug_level () const | |||
| 698 | { | |||
| 699 | return yydebug_; | |||
| 700 | } | |||
| 701 | ||||
| 702 | void | |||
| 703 | EvalParser::set_debug_level (debug_level_type l) | |||
| 704 | { | |||
| 705 | yydebug_ = l; | |||
| 706 | } | |||
| 707 | #endif // EVALDEBUG | |||
| 708 | ||||
| 709 | EvalParser::state_type | |||
| 710 | EvalParser::yy_lr_goto_state_ (state_type yystate, int yysym) | |||
| 711 | { | |||
| 712 | int yyr = yypgoto_[yysym - YYNTOKENS] + yystate; | |||
| ||||
| 713 | if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) | |||
| 714 | return yytable_[yyr]; | |||
| 715 | else | |||
| 716 | return yydefgoto_[yysym - YYNTOKENS]; | |||
| 717 | } | |||
| 718 | ||||
| 719 | bool | |||
| 720 | EvalParser::yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPTnoexcept | |||
| 721 | { | |||
| 722 | return yyvalue == yypact_ninf_; | |||
| 723 | } | |||
| 724 | ||||
| 725 | bool | |||
| 726 | EvalParser::yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPTnoexcept | |||
| 727 | { | |||
| 728 | return yyvalue == yytable_ninf_; | |||
| 729 | } | |||
| 730 | ||||
| 731 | int | |||
| 732 | EvalParser::operator() () | |||
| 733 | { | |||
| 734 | return parse (); | |||
| 735 | } | |||
| 736 | ||||
| 737 | int | |||
| 738 | EvalParser::parse () | |||
| 739 | { | |||
| 740 | int yyn; | |||
| 741 | /// Length of the RHS of the rule being reduced. | |||
| 742 | int yylen = 0; | |||
| 743 | ||||
| 744 | // Error handling. | |||
| 745 | int yynerrs_ = 0; | |||
| 746 | int yyerrstatus_ = 0; | |||
| 747 | ||||
| 748 | /// The lookahead symbol. | |||
| 749 | symbol_type yyla; | |||
| 750 | ||||
| 751 | /// The locations where the error started and ended. | |||
| 752 | stack_symbol_type yyerror_range[3]; | |||
| 753 | ||||
| 754 | /// The return value of parse (). | |||
| 755 | int yyresult; | |||
| 756 | ||||
| 757 | #if YY_EXCEPTIONS1 | |||
| 758 | try | |||
| 759 | #endif // YY_EXCEPTIONS | |||
| 760 | { | |||
| 761 | YYCDEBUGif (yydebug_) (*yycdebug_) << "Starting parse\n"; | |||
| ||||
| 762 | ||||
| 763 | ||||
| 764 | /* Initialize the stack. The initial state will be set in | |||
| 765 | yynewstate, since the latter expects the semantical and the | |||
| 766 | location values to have been already stored, initialize these | |||
| 767 | stacks with a primary value. */ | |||
| 768 | yystack_.clear (); | |||
| 769 | yypush_ (YY_NULLPTRnullptr, 0, YY_MOVEstd::move (yyla)); | |||
| 770 | ||||
| 771 | /*-----------------------------------------------. | |||
| 772 | | yynewstate -- push a new symbol on the stack. | | |||
| 773 | `-----------------------------------------------*/ | |||
| 774 | yynewstate: | |||
| 775 | YYCDEBUGif (yydebug_) (*yycdebug_) << "Entering state " << int (yystack_[0].state) << '\n'; | |||
| 776 | YY_STACK_PRINT ()do { if (yydebug_) yy_stack_print_ (); } while (false); | |||
| 777 | ||||
| 778 | // Accept? | |||
| 779 | if (yystack_[0].state == yyfinal_) | |||
| 780 | YYACCEPTgoto yyacceptlab; | |||
| 781 | ||||
| 782 | goto yybackup; | |||
| 783 | ||||
| 784 | ||||
| 785 | /*-----------. | |||
| 786 | | yybackup. | | |||
| 787 | `-----------*/ | |||
| 788 | yybackup: | |||
| 789 | // Try to take a decision without lookahead. | |||
| 790 | yyn = yypact_[+yystack_[0].state]; | |||
| 791 | if (yy_pact_value_is_default_ (yyn)) | |||
| 792 | goto yydefault; | |||
| 793 | ||||
| 794 | // Read a lookahead token. | |||
| 795 | if (yyla.empty ()) | |||
| 796 | { | |||
| 797 | YYCDEBUGif (yydebug_) (*yycdebug_) << "Reading a token\n"; | |||
| 798 | #if YY_EXCEPTIONS1 | |||
| 799 | try | |||
| 800 | #endif // YY_EXCEPTIONS | |||
| 801 | { | |||
| 802 | symbol_type yylookahead (yylexevallex (ctx)); | |||
| 803 | yyla.move (yylookahead); | |||
| 804 | } | |||
| 805 | #if YY_EXCEPTIONS1 | |||
| 806 | catch (const syntax_error& yyexc) | |||
| 807 | { | |||
| 808 | YYCDEBUGif (yydebug_) (*yycdebug_) << "Caught exception: " << yyexc.what() << '\n'; | |||
| 809 | error (yyexc); | |||
| 810 | goto yyerrlab1; | |||
| 811 | } | |||
| 812 | #endif // YY_EXCEPTIONS | |||
| 813 | } | |||
| 814 | YY_SYMBOL_PRINT ("Next token is", yyla)do { if (yydebug_) { *yycdebug_ << "Next token is" << ' '; yy_print_ (*yycdebug_, yyla); *yycdebug_ << '\n'; } } while (false); | |||
| 815 | ||||
| 816 | if (yyla.kind () == symbol_kind::S_YYerror) | |||
| 817 | { | |||
| 818 | // The scanner already issued an error message, process directly | |||
| 819 | // to error recovery. But do not keep the error token as | |||
| 820 | // lookahead, it is too special and may lead us to an endless | |||
| 821 | // loop in error recovery. */ | |||
| 822 | yyla.kind_ = symbol_kind::S_YYUNDEF; | |||
| 823 | goto yyerrlab1; | |||
| 824 | } | |||
| 825 | ||||
| 826 | /* If the proper action on seeing token YYLA.TYPE is to reduce or | |||
| 827 | to detect an error, take that action. */ | |||
| 828 | yyn += yyla.kind (); | |||
| 829 | if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ()) | |||
| 830 | { | |||
| 831 | goto yydefault; | |||
| 832 | } | |||
| 833 | ||||
| 834 | // Reduce or error. | |||
| 835 | yyn = yytable_[yyn]; | |||
| 836 | if (yyn <= 0) | |||
| 837 | { | |||
| 838 | if (yy_table_value_is_error_ (yyn)) | |||
| 839 | goto yyerrlab; | |||
| 840 | yyn = -yyn; | |||
| 841 | goto yyreduce; | |||
| 842 | } | |||
| 843 | ||||
| 844 | // Count tokens shifted since error; after three, turn off error status. | |||
| 845 | if (yyerrstatus_) | |||
| 846 | --yyerrstatus_; | |||
| 847 | ||||
| 848 | // Shift the lookahead token. | |||
| 849 | yypush_ ("Shifting", state_type (yyn), YY_MOVEstd::move (yyla)); | |||
| 850 | goto yynewstate; | |||
| 851 | ||||
| 852 | ||||
| 853 | /*-----------------------------------------------------------. | |||
| 854 | | yydefault -- do the default action for the current state. | | |||
| 855 | `-----------------------------------------------------------*/ | |||
| 856 | yydefault: | |||
| 857 | yyn = yydefact_[+yystack_[0].state]; | |||
| 858 | if (yyn == 0) | |||
| 859 | goto yyerrlab; | |||
| 860 | goto yyreduce; | |||
| 861 | ||||
| 862 | ||||
| 863 | /*-----------------------------. | |||
| 864 | | yyreduce -- do a reduction. | | |||
| 865 | `-----------------------------*/ | |||
| 866 | yyreduce: | |||
| 867 | yylen = yyr2_[yyn]; | |||
| 868 | { | |||
| 869 | stack_symbol_type yylhs; | |||
| 870 | yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]); | |||
| 871 | /* Variants are always initialized to an empty instance of the | |||
| 872 | correct type. The default '$$ = $1' action is NOT applied | |||
| 873 | when using variants. */ | |||
| 874 | switch (yyr1_[yyn]) | |||
| 875 | { | |||
| 876 | case symbol_kind::S_option_repr_type: // option_repr_type | |||
| 877 | yylhs.value.emplace< TokenOption::RepresentationType > (); | |||
| 878 | break; | |||
| 879 | ||||
| 880 | case symbol_kind::S_pkt4_field: // pkt4_field | |||
| 881 | yylhs.value.emplace< TokenPkt4::FieldType > (); | |||
| 882 | break; | |||
| 883 | ||||
| 884 | case symbol_kind::S_pkt6_field: // pkt6_field | |||
| 885 | yylhs.value.emplace< TokenPkt6::FieldType > (); | |||
| 886 | break; | |||
| 887 | ||||
| 888 | case symbol_kind::S_pkt_metadata: // pkt_metadata | |||
| 889 | yylhs.value.emplace< TokenPkt::MetadataType > (); | |||
| 890 | break; | |||
| 891 | ||||
| 892 | case symbol_kind::S_relay6_field: // relay6_field | |||
| 893 | yylhs.value.emplace< TokenRelay6Field::FieldType > (); | |||
| 894 | break; | |||
| 895 | ||||
| 896 | case symbol_kind::S_nest_level: // nest_level | |||
| 897 | yylhs.value.emplace< int8_t > (); | |||
| 898 | break; | |||
| 899 | ||||
| 900 | case symbol_kind::S_relay6_option_chain: // relay6_option_chain | |||
| 901 | yylhs.value.emplace< std::pair<int8_t, std::vector<uint16_t>> > (); | |||
| 902 | break; | |||
| 903 | ||||
| 904 | case symbol_kind::S_vendor_option_chain: // vendor_option_chain | |||
| 905 | yylhs.value.emplace< std::pair<uint32_t, std::vector<uint16_t>> > (); | |||
| 906 | break; | |||
| 907 | ||||
| 908 | case symbol_kind::S_STRING: // "constant string" | |||
| 909 | case symbol_kind::S_INTEGER: // "integer" | |||
| 910 | case symbol_kind::S_HEXSTRING: // "constant hexstring" | |||
| 911 | case symbol_kind::S_OPTION_NAME: // "option name" | |||
| 912 | case symbol_kind::S_IP_ADDRESS: // "ip address" | |||
| 913 | yylhs.value.emplace< std::string > (); | |||
| 914 | break; | |||
| 915 | ||||
| 916 | case symbol_kind::S_option_chain: // option_chain | |||
| 917 | case symbol_kind::S_relay4_option_chain: // relay4_option_chain | |||
| 918 | yylhs.value.emplace< std::vector<uint16_t> > (); | |||
| 919 | break; | |||
| 920 | ||||
| 921 | case symbol_kind::S_option_code: // option_code | |||
| 922 | case symbol_kind::S_sub_option_code: // sub_option_code | |||
| 923 | yylhs.value.emplace< uint16_t > (); | |||
| 924 | break; | |||
| 925 | ||||
| 926 | case symbol_kind::S_integer_expr: // integer_expr | |||
| 927 | case symbol_kind::S_enterprise_id: // enterprise_id | |||
| 928 | yylhs.value.emplace< uint32_t > (); | |||
| 929 | break; | |||
| 930 | ||||
| 931 | default: | |||
| 932 | break; | |||
| 933 | } | |||
| 934 | ||||
| 935 | ||||
| 936 | // Default location. | |||
| 937 | { | |||
| 938 | stack_type::slice range (yystack_, yylen); | |||
| 939 | YYLLOC_DEFAULT (yylhs.location, range, yylen)do if (yylen) { (yylhs.location).begin = ((range)[1].location ).begin; (yylhs.location).end = ((range)[yylen].location).end ; } else { (yylhs.location).begin = (yylhs.location).end = (( range)[0].location).end; } while (false); | |||
| 940 | yyerror_range[1].location = yylhs.location; | |||
| 941 | } | |||
| 942 | ||||
| 943 | // Perform the reduction. | |||
| 944 | YY_REDUCE_PRINT (yyn)do { if (yydebug_) yy_reduce_print_ (yyn); } while (false); | |||
| 945 | #if YY_EXCEPTIONS1 | |||
| 946 | try | |||
| 947 | #endif // YY_EXCEPTIONS | |||
| 948 | { | |||
| 949 | switch (yyn) | |||
| 950 | { | |||
| 951 | case 5: // option_chain: "option" "[" option_code "]" | |||
| 952 | #line 178 "parser.yy" | |||
| 953 | { | |||
| 954 | yylhs.value.as < std::vector<uint16_t> > ().push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 955 | } | |||
| 956 | #line 957 "parser.cc" | |||
| 957 | break; | |||
| 958 | ||||
| 959 | case 6: // option_chain: option_chain "." "option" "[" sub_option_code "]" | |||
| 960 | #line 182 "parser.yy" | |||
| 961 | { | |||
| 962 | yylhs.value.as < std::vector<uint16_t> > () = std::move(yystack_[5].value.as < std::vector<uint16_t> > ()); | |||
| 963 | yylhs.value.as < std::vector<uint16_t> > ().push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 964 | } | |||
| 965 | #line 966 "parser.cc" | |||
| 966 | break; | |||
| 967 | ||||
| 968 | case 7: // relay4_option_chain: "relay4" "[" sub_option_code "]" | |||
| 969 | #line 189 "parser.yy" | |||
| 970 | { | |||
| 971 | // Ensure we are parsing a DHCPv4 context | |||
| 972 | if (ctx.getUniverse() != Option::V4) { | |||
| 973 | error(yystack_[3].location, "relay4 can only be used in DHCPv4."); | |||
| 974 | } | |||
| 975 | yylhs.value.as < std::vector<uint16_t> > ().push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 976 | } | |||
| 977 | #line 978 "parser.cc" | |||
| 978 | break; | |||
| 979 | ||||
| 980 | case 8: // relay4_option_chain: relay4_option_chain "." "option" "[" option_code "]" | |||
| 981 | #line 197 "parser.yy" | |||
| 982 | { | |||
| 983 | yylhs.value.as < std::vector<uint16_t> > () = std::move(yystack_[5].value.as < std::vector<uint16_t> > ()); | |||
| 984 | yylhs.value.as < std::vector<uint16_t> > ().push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 985 | } | |||
| 986 | #line 987 "parser.cc" | |||
| 987 | break; | |||
| 988 | ||||
| 989 | case 9: // relay6_option_chain: "relay6" "[" nest_level "]" "." "option" "[" sub_option_code "]" | |||
| 990 | #line 204 "parser.yy" | |||
| 991 | { | |||
| 992 | // Ensure we are parsing a DHCPv6 context | |||
| 993 | if (ctx.getUniverse() != Option::V6) { | |||
| 994 | error(yystack_[8].location, "relay6 can only be used in DHCPv6."); | |||
| 995 | } | |||
| 996 | yylhs.value.as < std::pair<int8_t, std::vector<uint16_t>> > ().first = yystack_[6].value.as < int8_t > (); | |||
| 997 | yylhs.value.as < std::pair<int8_t, std::vector<uint16_t>> > ().second.push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 998 | } | |||
| 999 | #line 1000 "parser.cc" | |||
| 1000 | break; | |||
| 1001 | ||||
| 1002 | case 10: // relay6_option_chain: relay6_option_chain "." "option" "[" option_code "]" | |||
| 1003 | #line 213 "parser.yy" | |||
| 1004 | { | |||
| 1005 | yylhs.value.as < std::pair<int8_t, std::vector<uint16_t>> > () = std::move(yystack_[5].value.as < std::pair<int8_t, std::vector<uint16_t>> > ()); | |||
| 1006 | yylhs.value.as < std::pair<int8_t, std::vector<uint16_t>> > ().second.push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 1007 | } | |||
| 1008 | #line 1009 "parser.cc" | |||
| 1009 | break; | |||
| 1010 | ||||
| 1011 | case 11: // vendor_option_chain: "vendor" "[" enterprise_id "]" "." "option" "[" sub_option_code "]" | |||
| 1012 | #line 220 "parser.yy" | |||
| 1013 | { | |||
| 1014 | yylhs.value.as < std::pair<uint32_t, std::vector<uint16_t>> > ().first = yystack_[6].value.as < uint32_t > (); | |||
| 1015 | yylhs.value.as < std::pair<uint32_t, std::vector<uint16_t>> > ().second.push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 1016 | } | |||
| 1017 | #line 1018 "parser.cc" | |||
| 1018 | break; | |||
| 1019 | ||||
| 1020 | case 12: // vendor_option_chain: vendor_option_chain "." "option" "[" option_code "]" | |||
| 1021 | #line 225 "parser.yy" | |||
| 1022 | { | |||
| 1023 | yylhs.value.as < std::pair<uint32_t, std::vector<uint16_t>> > () = std::move(yystack_[5].value.as < std::pair<uint32_t, std::vector<uint16_t>> > ()); | |||
| 1024 | yylhs.value.as < std::pair<uint32_t, std::vector<uint16_t>> > ().second.push_back(yystack_[1].value.as < uint16_t > ()); | |||
| 1025 | } | |||
| 1026 | #line 1027 "parser.cc" | |||
| 1027 | break; | |||
| 1028 | ||||
| 1029 | case 14: // bool_expr: "not" bool_expr | |||
| 1030 | #line 233 "parser.yy" | |||
| 1031 | { | |||
| 1032 | TokenPtr neg(new TokenNot()); | |||
| 1033 | ctx.expression_.push_back(neg); | |||
| 1034 | } | |||
| 1035 | #line 1036 "parser.cc" | |||
| 1036 | break; | |||
| 1037 | ||||
| 1038 | case 15: // $@1: %empty | |||
| 1039 | #line 238 "parser.yy" | |||
| 1040 | { | |||
| 1041 | unsigned target = ++ctx.label_; | |||
| 1042 | ctx.labels_.push_back(target); | |||
| 1043 | TokenPtr pobf(new TokenPopOrBranchFalse(target)); | |||
| 1044 | ctx.expression_.push_back(pobf); | |||
| 1045 | } | |||
| 1046 | #line 1047 "parser.cc" | |||
| 1047 | break; | |||
| 1048 | ||||
| 1049 | case 16: // bool_expr: bool_expr "and" $@1 bool_expr | |||
| 1050 | #line 243 "parser.yy" | |||
| 1051 | { | |||
| 1052 | unsigned target = ctx.labels_.back(); | |||
| 1053 | ctx.labels_.pop_back(); | |||
| 1054 | TokenPtr lab(new TokenLabel(target)); | |||
| 1055 | ctx.expression_.push_back(lab); | |||
| 1056 | } | |||
| 1057 | #line 1058 "parser.cc" | |||
| 1058 | break; | |||
| 1059 | ||||
| 1060 | case 17: // bool_expr: bool_expr "sand" bool_expr | |||
| 1061 | #line 250 "parser.yy" | |||
| 1062 | { | |||
| 1063 | TokenPtr neg(new TokenAnd()); | |||
| 1064 | ctx.expression_.push_back(neg); | |||
| 1065 | } | |||
| 1066 | #line 1067 "parser.cc" | |||
| 1067 | break; | |||
| 1068 | ||||
| 1069 | case 18: // $@2: %empty | |||
| 1070 | #line 255 "parser.yy" | |||
| 1071 | { | |||
| 1072 | unsigned target = ++ctx.label_; | |||
| 1073 | ctx.labels_.push_back(target); | |||
| 1074 | TokenPtr pobt(new TokenPopOrBranchTrue(target)); | |||
| 1075 | ctx.expression_.push_back(pobt); | |||
| 1076 | } | |||
| 1077 | #line 1078 "parser.cc" | |||
| 1078 | break; | |||
| 1079 | ||||
| 1080 | case 19: // bool_expr: bool_expr "or" $@2 bool_expr | |||
| 1081 | #line 260 "parser.yy" | |||
| 1082 | { | |||
| 1083 | unsigned target = ctx.labels_.back(); | |||
| 1084 | ctx.labels_.pop_back(); | |||
| 1085 | TokenPtr lab(new TokenLabel(target)); | |||
| 1086 | ctx.expression_.push_back(lab); | |||
| 1087 | } | |||
| 1088 | #line 1089 "parser.cc" | |||
| 1089 | break; | |||
| 1090 | ||||
| 1091 | case 20: // bool_expr: bool_expr "sor" bool_expr | |||
| 1092 | #line 267 "parser.yy" | |||
| 1093 | { | |||
| 1094 | TokenPtr neg(new TokenOr()); | |||
| 1095 | ctx.expression_.push_back(neg); | |||
| 1096 | } | |||
| 1097 | #line 1098 "parser.cc" | |||
| 1098 | break; | |||
| 1099 | ||||
| 1100 | case 21: // bool_expr: string_expr "==" string_expr | |||
| 1101 | #line 272 "parser.yy" | |||
| 1102 | { | |||
| 1103 | TokenPtr eq(new TokenEqual()); | |||
| 1104 | ctx.expression_.push_back(eq); | |||
| 1105 | } | |||
| 1106 | #line 1107 "parser.cc" | |||
| 1107 | break; | |||
| 1108 | ||||
| 1109 | case 22: // bool_expr: option_chain "." "exists" | |||
| 1110 | #line 277 "parser.yy" | |||
| 1111 | { | |||
| 1112 | TokenPtr opt(new TokenOption(yystack_[2].value.as < std::vector<uint16_t> > (), TokenOption::EXISTS)); | |||
| 1113 | ctx.expression_.push_back(opt); | |||
| 1114 | } | |||
| 1115 | #line 1116 "parser.cc" | |||
| 1116 | break; | |||
| 1117 | ||||
| 1118 | case 23: // bool_expr: relay4_option_chain "." "exists" | |||
| 1119 | #line 282 "parser.yy" | |||
| 1120 | { | |||
| 1121 | switch (ctx.getUniverse()) { | |||
| 1122 | case Option::V4: | |||
| 1123 | { | |||
| 1124 | TokenPtr opt(new TokenRelay4Option(yystack_[2].value.as < std::vector<uint16_t> > (), TokenOption::EXISTS)); | |||
| 1125 | ctx.expression_.push_back(opt); | |||
| 1126 | break; | |||
| 1127 | } | |||
| 1128 | case Option::V6: | |||
| 1129 | // We will have relay6[123] for the DHCPv6. | |||
| 1130 | // In a very distant future we'll possibly be able | |||
| 1131 | // to mix both if we have DHCPv4-over-DHCPv6, so it | |||
| 1132 | // has some sense to make it explicit whether we | |||
| 1133 | // talk about DHCPv4 relay or DHCPv6 relay. However, | |||
| 1134 | // for the time being relay4 can be used in DHCPv4 | |||
| 1135 | // only. | |||
| 1136 | error(yystack_[2].location, "relay4 can only be used in DHCPv4."); | |||
| 1137 | } | |||
| 1138 | } | |||
| 1139 | #line 1140 "parser.cc" | |||
| 1140 | break; | |||
| 1141 | ||||
| 1142 | case 24: // bool_expr: relay6_option_chain "." "exists" | |||
| 1143 | #line 302 "parser.yy" | |||
| 1144 | { | |||
| 1145 | switch (ctx.getUniverse()) { | |||
| 1146 | case Option::V6: | |||
| 1147 | { | |||
| 1148 | TokenPtr opt(new TokenRelay6Option(yystack_[2].value.as < std::pair<int8_t, std::vector<uint16_t>> > ().first, yystack_[2].value.as < std::pair<int8_t, std::vector<uint16_t>> > ().second, TokenOption::EXISTS)); | |||
| 1149 | ctx.expression_.push_back(opt); | |||
| 1150 | break; | |||
| 1151 | } | |||
| 1152 | case Option::V4: | |||
| 1153 | // For now we only use relay6 in DHCPv6. | |||
| 1154 | error(yystack_[2].location, "relay6 can only be used in DHCPv6."); | |||
| 1155 | } | |||
| 1156 | } | |||
| 1157 | #line 1158 "parser.cc" | |||
| 1158 | break; | |||
| 1159 | ||||
| 1160 | case 25: // bool_expr: "vendor-class" "[" enterprise_id "]" "." "exists" | |||
| 1161 | #line 316 "parser.yy" | |||
| 1162 | { | |||
| 1163 | // Expression: vendor-class[1234].exists | |||
| 1164 | // | |||
| 1165 | // This token will find option 124 (DHCPv4) or 16 (DHCPv6), | |||
| 1166 | // and will check if enterprise-id equals specified value. | |||
| 1167 | TokenPtr exist(new TokenVendorClass(ctx.getUniverse(), yystack_[3].value.as < uint32_t > (), TokenOption::EXISTS)); | |||
| 1168 | ctx.expression_.push_back(exist); | |||
| 1169 | } | |||
| 1170 | #line 1171 "parser.cc" | |||
| 1171 | break; | |||
| 1172 | ||||
| 1173 | case 26: // bool_expr: "vendor" "[" enterprise_id "]" "." "exists" | |||
| 1174 | #line 325 "parser.yy" | |||
| 1175 | { | |||
| 1176 | // Expression: vendor[1234].exists | |||
| 1177 | // | |||
| 1178 | // This token will find option 125 (DHCPv4) or 17 (DHCPv6), | |||
| 1179 | // and will check if enterprise-id equals specified value. | |||
| 1180 | TokenPtr exist(new TokenVendor(ctx.getUniverse(), yystack_[3].value.as < uint32_t > (), TokenOption::EXISTS)); | |||
| 1181 | ctx.expression_.push_back(exist); | |||
| 1182 | } | |||
| 1183 | #line 1184 "parser.cc" | |||
| 1184 | break; | |||
| 1185 | ||||
| 1186 | case 27: // bool_expr: vendor_option_chain "." "exists" | |||
| 1187 | #line 334 "parser.yy" | |||
| 1188 | { | |||
| 1189 | // Expression vendor[1234].option[123].exists | |||
| 1190 | // | |||
| 1191 | // This token will check if specified vendor option | |||
| 1192 | // exists, has specified enterprise-id and if has | |||
| 1193 | // specified suboption. | |||
| 1194 | TokenPtr exist(new TokenVendor(ctx.getUniverse(), yystack_[2].value.as < std::pair<uint32_t, std::vector<uint16_t>> > ().first, TokenOption::EXISTS, yystack_[2].value.as < std::pair<uint32_t, std::vector<uint16_t>> > ().second)); | |||
| 1195 | ctx.expression_.push_back(exist); | |||
| 1196 | } | |||
| 1197 | #line 1198 "parser.cc" | |||
| 1198 | break; | |||
| 1199 | ||||
| 1200 | case 28: // bool_expr: "member" "(" "constant string" ")" | |||
| 1201 | #line 344 "parser.yy" | |||
| 1202 | { | |||
| 1203 | // Expression member('foo') | |||
| 1204 | // | |||
| 1205 | // This token will check if the packet is a member of | |||
| 1206 | // the specified client class. | |||
| 1207 | // To avoid loops at evaluation only already defined and | |||
| 1208 | // built-in classes are allowed. | |||
| 1209 | std::string cc = yystack_[1].value.as < std::string > (); | |||
| 1210 | if (!ctx.isClientClassDefined(cc)) { | |||
| 1211 | error(yystack_[1].location, "Not defined client class '" + cc + "'"); | |||
| 1212 | } | |||
| 1213 | TokenPtr member(new TokenMember(cc)); | |||
| 1214 | ctx.expression_.push_back(member); | |||
| 1215 | } | |||
| 1216 | #line 1217 "parser.cc" | |||
| 1217 | break; | |||
| 1218 | ||||
| 1219 | case 29: // bool_expr: "match" "(" "constant string" "," string_expr ")" | |||
| 1220 | #line 359 "parser.yy" | |||
| 1221 | { | |||
| 1222 | // Expression match('<regex>', <string_expr>) | |||
| 1223 | // | |||
| 1224 | // This token will check if the regular expression matches | |||
| 1225 | // the string expression. | |||
| 1226 | TokenPtr match(new TokenMatch(yystack_[3].value.as < std::string > ())); | |||
| 1227 | ctx.expression_.push_back(match); | |||
| 1228 | } | |||
| 1229 | #line 1230 "parser.cc" | |||
| 1230 | break; | |||
| 1231 | ||||
| 1232 | case 30: // string_expr: "constant string" | |||
| 1233 | #line 370 "parser.yy" | |||
| 1234 | { | |||
| 1235 | TokenPtr str(new TokenString(yystack_[0].value.as < std::string > ())); | |||
| 1236 | ctx.expression_.push_back(str); | |||
| 1237 | } | |||
| 1238 | #line 1239 "parser.cc" | |||
| 1239 | break; | |||
| 1240 | ||||
| 1241 | case 31: // string_expr: "constant hexstring" | |||
| 1242 | #line 375 "parser.yy" | |||
| 1243 | { | |||
| 1244 | TokenPtr hex(new TokenHexString(yystack_[0].value.as < std::string > ())); | |||
| 1245 | ctx.expression_.push_back(hex); | |||
| 1246 | } | |||
| 1247 | #line 1248 "parser.cc" | |||
| 1248 | break; | |||
| 1249 | ||||
| 1250 | case 32: // string_expr: "ip address" | |||
| 1251 | #line 380 "parser.yy" | |||
| 1252 | { | |||
| 1253 | TokenPtr ip(new TokenIpAddress(yystack_[0].value.as < std::string > ())); | |||
| 1254 | ctx.expression_.push_back(ip); | |||
| 1255 | } | |||
| 1256 | #line 1257 "parser.cc" | |||
| 1257 | break; | |||
| 1258 | ||||
| 1259 | case 33: // string_expr: option_chain "." option_repr_type | |||
| 1260 | #line 385 "parser.yy" | |||
| 1261 | { | |||
| 1262 | TokenPtr opt(new TokenOption(yystack_[2].value.as < std::vector<uint16_t> > (), yystack_[0].value.as < TokenOption::RepresentationType > ())); | |||
| 1263 | ctx.expression_.push_back(opt); | |||
| 1264 | } | |||
| 1265 | #line 1266 "parser.cc" | |||
| 1266 | break; | |||
| 1267 | ||||
| 1268 | case 34: // string_expr: relay4_option_chain "." option_repr_type | |||
| 1269 | #line 390 "parser.yy" | |||
| 1270 | { | |||
| 1271 | switch (ctx.getUniverse()) { | |||
| 1272 | case Option::V4: | |||
| 1273 | { | |||
| 1274 | TokenPtr opt(new TokenRelay4Option(yystack_[2].value.as < std::vector<uint16_t> > (), yystack_[0].value.as < TokenOption::RepresentationType > ())); | |||
| 1275 | ctx.expression_.push_back(opt); | |||
| 1276 | break; | |||
| 1277 | } | |||
| 1278 | case Option::V6: | |||
| 1279 | // We will have relay6[123] for the DHCPv6. | |||
| 1280 | // In a very distant future we'll possibly be able | |||
| 1281 | // to mix both if we have DHCPv4-over-DHCPv6, so it | |||
| 1282 | // has some sense to make it explicit whether we | |||
| 1283 | // talk about DHCPv4 relay or DHCPv6 relay. However, | |||
| 1284 | // for the time being relay4 can be used in DHCPv4 | |||
| 1285 | // only. | |||
| 1286 | error(yystack_[2].location, "relay4 can only be used in DHCPv4."); | |||
| 1287 | } | |||
| 1288 | } | |||
| 1289 | #line 1290 "parser.cc" | |||
| 1290 | break; | |||
| 1291 | ||||
| 1292 | case 35: // string_expr: relay6_option_chain "." option_repr_type | |||
| 1293 | #line 411 "parser.yy" | |||
| 1294 | { | |||
| 1295 | switch (ctx.getUniverse()) { | |||
| 1296 | case Option::V6: | |||
| 1297 | { | |||
| 1298 | TokenPtr opt(new TokenRelay6Option(yystack_[2].value.as < std::pair<int8_t, std::vector<uint16_t>> > ().first, yystack_[2].value.as < std::pair<int8_t, std::vector<uint16_t>> > ().second, yystack_[0].value.as < TokenOption::RepresentationType > ())); | |||
| 1299 | ctx.expression_.push_back(opt); | |||
| 1300 | break; | |||
| 1301 | } | |||
| 1302 | case Option::V4: | |||
| 1303 | // For now we only use relay6 in DHCPv6. | |||
| 1304 | error(yystack_[2].location, "relay6 can only be used in DHCPv6."); | |||
| 1305 | } | |||
| 1306 | } | |||
| 1307 | #line 1308 "parser.cc" | |||
| 1308 | break; | |||
| 1309 | ||||
| 1310 | case 36: // string_expr: "pkt" "." pkt_metadata | |||
| 1311 | #line 426 "parser.yy" | |||
| 1312 | { | |||
| 1313 | TokenPtr pkt_metadata(new TokenPkt(yystack_[0].value.as < TokenPkt::MetadataType > ())); | |||
| 1314 | ctx.expression_.push_back(pkt_metadata); | |||
| 1315 | } | |||
| 1316 | #line 1317 "parser.cc" | |||
| 1317 | break; | |||
| 1318 | ||||
| 1319 | case 37: // string_expr: "pkt4" "." pkt4_field | |||
| 1320 | #line 431 "parser.yy" | |||
| 1321 | { | |||
| 1322 | switch (ctx.getUniverse()) { | |||
| 1323 | case Option::V4: | |||
| 1324 | { | |||
| 1325 | TokenPtr pkt4_field(new TokenPkt4(yystack_[0].value.as < TokenPkt4::FieldType > ())); | |||
| 1326 | ctx.expression_.push_back(pkt4_field); | |||
| 1327 | break; | |||
| 1328 | } | |||
| 1329 | case Option::V6: | |||
| 1330 | // For now we only use pkt4 in DHCPv4. | |||
| 1331 | error(yystack_[2].location, "pkt4 can only be used in DHCPv4."); | |||
| 1332 | } | |||
| 1333 | } | |||
| 1334 | #line 1335 "parser.cc" | |||
| 1335 | break; | |||
| 1336 | ||||
| 1337 | case 38: // string_expr: "pkt6" "." pkt6_field | |||
| 1338 | #line 445 "parser.yy" | |||
| 1339 | { | |||
| 1340 | switch (ctx.getUniverse()) { | |||
| 1341 | case Option::V6: | |||
| 1342 | { | |||
| 1343 | TokenPtr pkt6_field(new TokenPkt6(yystack_[0].value.as < TokenPkt6::FieldType > ())); | |||
| 1344 | ctx.expression_.push_back(pkt6_field); | |||
| 1345 | break; | |||
| 1346 | } | |||
| 1347 | case Option::V4: | |||
| 1348 | // For now we only use pkt6 in DHCPv6. | |||
| 1349 | error(yystack_[2].location, "pkt6 can only be used in DHCPv6."); | |||
| 1350 | } | |||
| 1351 | } | |||
| 1352 | #line 1353 "parser.cc" | |||
| 1353 | break; | |||
| 1354 | ||||
| 1355 | case 39: // string_expr: "relay6" "[" nest_level "]" "." relay6_field | |||
| 1356 | #line 459 "parser.yy" | |||
| 1357 | { | |||
| 1358 | switch (ctx.getUniverse()) { | |||
| 1359 | case Option::V6: | |||
| 1360 | { | |||
| 1361 | TokenPtr relay6field(new TokenRelay6Field(yystack_[3].value.as < int8_t > (), yystack_[0].value.as < TokenRelay6Field::FieldType > ())); | |||
| 1362 | ctx.expression_.push_back(relay6field); | |||
| 1363 | break; | |||
| 1364 | } | |||
| 1365 | case Option::V4: | |||
| 1366 | // For now we only use relay6 in DHCPv6. | |||
| 1367 | error(yystack_[5].location, "relay6 can only be used in DHCPv6."); | |||
| 1368 | } | |||
| 1369 | } | |||
| 1370 | #line 1371 "parser.cc" | |||
| 1371 | break; | |||
| 1372 | ||||
| 1373 | case 40: // string_expr: "substring" "(" string_expr "," start_expr "," length_expr ")" | |||
| 1374 | #line 474 "parser.yy" | |||
| 1375 | { | |||
| 1376 | TokenPtr sub(new TokenSubstring()); | |||
| 1377 | ctx.expression_.push_back(sub); | |||
| 1378 | } | |||
| 1379 | #line 1380 "parser.cc" | |||
| 1380 | break; | |||
| 1381 | ||||
| 1382 | case 41: // string_expr: "split" "(" string_expr "," string_expr "," int_expr ")" | |||
| 1383 | #line 479 "parser.yy" | |||
| 1384 | { | |||
| 1385 | TokenPtr split(new TokenSplit()); | |||
| 1386 | ctx.expression_.push_back(split); | |||
| 1387 | } | |||
| 1388 | #line 1389 "parser.cc" | |||
| 1389 | break; | |||
| 1390 | ||||
| 1391 | case 42: // string_expr: "concat" "(" string_expr "," string_expr ")" | |||
| 1392 | #line 484 "parser.yy" | |||
| 1393 | { | |||
| 1394 | TokenPtr conc(new TokenConcat()); | |||
| 1395 | ctx.expression_.push_back(conc); | |||
| 1396 | } | |||
| 1397 | #line 1398 "parser.cc" | |||
| 1398 | break; | |||
| 1399 | ||||
| 1400 | case 43: // string_expr: string_expr "+" string_expr | |||
| 1401 | #line 489 "parser.yy" | |||
| 1402 | { | |||
| 1403 | TokenPtr conc(new TokenConcat()); | |||
| 1404 | ctx.expression_.push_back(conc); | |||
| 1405 | } | |||
| 1406 | #line 1407 "parser.cc" | |||
| 1407 | break; | |||
| 1408 | ||||
| 1409 | case 44: // string_expr: "lcase" "(" string_expr ")" | |||
| 1410 | #line 494 "parser.yy" | |||
| 1411 | { | |||
| 1412 | TokenPtr lcase(new TokenLowerCase()); | |||
| 1413 | ctx.expression_.push_back(lcase); | |||
| 1414 | } | |||
| 1415 | #line 1416 "parser.cc" | |||
| 1416 | break; | |||
| 1417 | ||||
| 1418 | case 45: // string_expr: "ucase" "(" string_expr ")" | |||
| 1419 | #line 499 "parser.yy" | |||
| 1420 | { | |||
| 1421 | TokenPtr ucase(new TokenUpperCase()); | |||
| 1422 | ctx.expression_.push_back(ucase); | |||
| 1423 | } | |||
| 1424 | #line 1425 "parser.cc" | |||
| 1425 | break; | |||
| 1426 | ||||
| 1427 | case 46: // $@3: %empty | |||
| 1428 | #line 504 "parser.yy" | |||
| 1429 | { | |||
| 1430 | unsigned target = ++ctx.label_; | |||
| 1431 | ctx.labels_.push_back(target); | |||
| 1432 | TokenPtr pabf(new TokenPopAndBranchFalse(target)); | |||
| 1433 | ctx.expression_.push_back(pabf); | |||
| 1434 | } | |||
| 1435 | #line 1436 "parser.cc" | |||
| 1436 | break; | |||
| 1437 | ||||
| 1438 | case 47: // $@4: %empty | |||
| 1439 | #line 509 "parser.yy" | |||
| 1440 | { | |||
| 1441 | unsigned target = ctx.labels_.back(); | |||
| 1442 | ctx.labels_.pop_back(); | |||
| 1443 | unsigned target2 = ++ctx.label_; | |||
| 1444 | ctx.labels_.push_back(target2); | |||
| 1445 | TokenPtr branch(new TokenBranch(target2)); | |||
| 1446 | ctx.expression_.push_back(branch); | |||
| 1447 | TokenPtr lab(new TokenLabel(target)); | |||
| 1448 | ctx.expression_.push_back(lab); | |||
| 1449 | } | |||
| 1450 | #line 1451 "parser.cc" | |||
| 1451 | break; | |||
| 1452 | ||||
| 1453 | case 48: // string_expr: "ifelse" "(" bool_expr "," $@3 string_expr "," $@4 string_expr ")" | |||
| 1454 | #line 518 "parser.yy" | |||
| 1455 | { | |||
| 1456 | unsigned target = ctx.labels_.back(); | |||
| 1457 | ctx.labels_.pop_back(); | |||
| 1458 | TokenPtr lab(new TokenLabel(target)); | |||
| 1459 | ctx.expression_.push_back(lab); | |||
| 1460 | } | |||
| 1461 | #line 1462 "parser.cc" | |||
| 1462 | break; | |||
| 1463 | ||||
| 1464 | case 49: // string_expr: "sifelse" "(" bool_expr "," string_expr "," string_expr ")" | |||
| 1465 | #line 525 "parser.yy" | |||
| 1466 | { | |||
| 1467 | TokenPtr cond(new TokenIfElse()); | |||
| 1468 | ctx.expression_.push_back(cond); | |||
| 1469 | } | |||
| 1470 | #line 1471 "parser.cc" | |||
| 1471 | break; | |||
| 1472 | ||||
| 1473 | case 50: // string_expr: "hexstring" "(" string_expr "," string_expr ")" | |||
| 1474 | #line 530 "parser.yy" | |||
| 1475 | { | |||
| 1476 | TokenPtr tohex(new TokenToHexString()); | |||
| 1477 | ctx.expression_.push_back(tohex); | |||
| 1478 | } | |||
| 1479 | #line 1480 "parser.cc" | |||
| 1480 | break; | |||
| 1481 | ||||
| 1482 | case 51: // string_expr: "addrtotext" "(" string_expr ")" | |||
| 1483 | #line 535 "parser.yy" | |||
| 1484 | { | |||
| 1485 | TokenPtr addrtotext(new TokenIpAddressToText()); | |||
| 1486 | ctx.expression_.push_back(addrtotext); | |||
| 1487 | } | |||
| 1488 | #line 1489 "parser.cc" | |||
| 1489 | break; | |||
| 1490 | ||||
| 1491 | case 52: // string_expr: "int8totext" "(" string_expr ")" | |||
| 1492 | #line 540 "parser.yy" | |||
| 1493 | { | |||
| 1494 | TokenPtr int8totext(new TokenInt8ToText()); | |||
| 1495 | ctx.expression_.push_back(int8totext); | |||
| 1496 | } | |||
| 1497 | #line 1498 "parser.cc" | |||
| 1498 | break; | |||
| 1499 | ||||
| 1500 | case 53: // string_expr: "int16totext" "(" string_expr ")" | |||
| 1501 | #line 545 "parser.yy" | |||
| 1502 | { | |||
| 1503 | TokenPtr int16totext(new TokenInt16ToText()); | |||
| 1504 | ctx.expression_.push_back(int16totext); | |||
| 1505 | } | |||
| 1506 | #line 1507 "parser.cc" | |||
| 1507 | break; | |||
| 1508 | ||||
| 1509 | case 54: // string_expr: "int32totext" "(" string_expr ")" | |||
| 1510 | #line 550 "parser.yy" | |||
| 1511 | { | |||
| 1512 | TokenPtr int32totext(new TokenInt32ToText()); | |||
| 1513 | ctx.expression_.push_back(int32totext); | |||
| 1514 | } | |||
| 1515 | #line 1516 "parser.cc" | |||
| 1516 | break; | |||
| 1517 | ||||
| 1518 | case 55: // string_expr: "uint8totext" "(" string_expr ")" | |||
| 1519 | #line 555 "parser.yy" | |||
| 1520 | { | |||
| 1521 | TokenPtr uint8totext(new TokenUInt8ToText()); | |||
| 1522 | ctx.expression_.push_back(uint8totext); | |||
| 1523 | } | |||
| 1524 | #line 1525 "parser.cc" | |||
| 1525 | break; | |||
| 1526 | ||||
| 1527 | case 56: // string_expr: "uint16totext" "(" string_expr ")" | |||
| 1528 | #line 560 "parser.yy" | |||
| 1529 | { | |||
| 1530 | TokenPtr uint16totext(new TokenUInt16ToText()); | |||
| 1531 | ctx.expression_.push_back(uint16totext); | |||
| 1532 | } | |||
| 1533 | #line 1534 "parser.cc" | |||
| 1534 | break; | |||
| 1535 | ||||
| 1536 | case 57: // string_expr: "uint32totext" "(" string_expr ")" | |||
| 1537 | #line 565 "parser.yy" | |||
| 1538 | { | |||
| 1539 | TokenPtr uint32totext(new TokenUInt32ToText()); | |||
| 1540 | ctx.expression_.push_back(uint32totext); | |||
| 1541 | } | |||
| 1542 | #line 1543 "parser.cc" | |||
| 1543 | break; | |||
| 1544 | ||||
| 1545 | case 58: // string_expr: "vendor" "." "enterprise" | |||
| 1546 | #line 570 "parser.yy" | |||
| 1547 | { | |||
| 1548 | // expression: vendor.enterprise | |||
| 1549 | // | |||
| 1550 | // This token will return enterprise-id number of | |||
| 1551 | // received vendor option. | |||
| 1552 | TokenPtr vendor(new TokenVendor(ctx.getUniverse(), 0, TokenVendor::ENTERPRISE_ID)); | |||
| 1553 | ctx.expression_.push_back(vendor); | |||
| 1554 | } | |||
| 1555 | #line 1556 "parser.cc" | |||
| 1556 | break; | |||
| 1557 | ||||
| 1558 | case 59: // string_expr: "vendor-class" "." "enterprise" | |||
| 1559 | #line 579 "parser.yy" | |||
| 1560 | { | |||
| 1561 | // expression: vendor-class.enterprise | |||
| 1562 | // | |||
| 1563 | // This token will return enterprise-id number of | |||
| 1564 | // received vendor class option. | |||
| 1565 | TokenPtr vendor(new TokenVendorClass(ctx.getUniverse(), 0, | |||
| 1566 | TokenVendor::ENTERPRISE_ID)); | |||
| 1567 | ctx.expression_.push_back(vendor); | |||
| 1568 | } | |||
| 1569 | #line 1570 "parser.cc" | |||
| 1570 | break; | |||
| 1571 | ||||
| 1572 | case 60: // string_expr: vendor_option_chain "." option_repr_type | |||
| 1573 | #line 589 "parser.yy" | |||
| 1574 | { | |||
| 1575 | // This token will search for vendor option with | |||
| 1576 | // specified enterprise-id. If found, will search | |||
| 1577 | // for specified suboption and finally will return | |||
| 1578 | // its content. | |||
| 1579 | TokenPtr opt(new TokenVendor(ctx.getUniverse(), yystack_[2].value.as < std::pair<uint32_t, std::vector<uint16_t>> > ().first, yystack_[0].value.as < TokenOption::RepresentationType > (), yystack_[2].value.as < std::pair<uint32_t, std::vector<uint16_t>> > ().second)); | |||
| 1580 | ctx.expression_.push_back(opt); | |||
| 1581 | } | |||
| 1582 | #line 1583 "parser.cc" | |||
| 1583 | break; | |||
| 1584 | ||||
| 1585 | case 61: // string_expr: "vendor-class" "[" enterprise_id "]" "." "data" | |||
| 1586 | #line 598 "parser.yy" | |||
| 1587 | { | |||
| 1588 | // expression: vendor-class[1234].data | |||
| 1589 | // | |||
| 1590 | // Vendor class option does not have suboptions, | |||
| 1591 | // but chunks of data (typically 1, but the option | |||
| 1592 | // structure allows multiple of them). If chunk | |||
| 1593 | // offset is not specified, we assume the first (0th) | |||
| 1594 | // is requested. | |||
| 1595 | TokenPtr vendor_class(new TokenVendorClass(ctx.getUniverse(), yystack_[3].value.as < uint32_t > (), | |||
| 1596 | TokenVendor::DATA, 0)); | |||
| 1597 | ctx.expression_.push_back(vendor_class); | |||
| 1598 | } | |||
| 1599 | #line 1600 "parser.cc" | |||
| 1600 | break; | |||
| 1601 | ||||
| 1602 | case 62: // string_expr: "vendor-class" "[" enterprise_id "]" "." "data" "[" "integer" "]" | |||
| 1603 | #line 611 "parser.yy" | |||
| 1604 | { | |||
| 1605 | // expression: vendor-class[1234].data[5] | |||
| 1606 | // | |||
| 1607 | // Vendor class option does not have suboptions, | |||
| 1608 | // but chunks of data (typically 1, but the option | |||
| 1609 | // structure allows multiple of them). This syntax | |||
| 1610 | // specifies which data chunk (tuple) we want. | |||
| 1611 | uint8_t index = ctx.convertUint8(yystack_[1].value.as < std::string > (), yystack_[1].location); | |||
| 1612 | TokenPtr vendor_class(new TokenVendorClass(ctx.getUniverse(), yystack_[6].value.as < uint32_t > (), | |||
| 1613 | TokenVendor::DATA, index)); | |||
| 1614 | ctx.expression_.push_back(vendor_class); | |||
| 1615 | } | |||
| 1616 | #line 1617 "parser.cc" | |||
| 1617 | break; | |||
| 1618 | ||||
| 1619 | case 63: // string_expr: integer_expr | |||
| 1620 | #line 624 "parser.yy" | |||
| 1621 | { | |||
| 1622 | TokenPtr integer(new TokenInteger(yystack_[0].value.as < uint32_t > ())); | |||
| 1623 | ctx.expression_.push_back(integer); | |||
| 1624 | } | |||
| 1625 | #line 1626 "parser.cc" | |||
| 1626 | break; | |||
| 1627 | ||||
| 1628 | case 65: // integer_expr: "integer" | |||
| 1629 | #line 632 "parser.yy" | |||
| 1630 | { | |||
| 1631 | yylhs.value.as < uint32_t > () = ctx.convertUint32(yystack_[0].value.as < std::string > (), yystack_[0].location); | |||
| 1632 | } | |||
| 1633 | #line 1634 "parser.cc" | |||
| 1634 | break; | |||
| 1635 | ||||
| 1636 | case 66: // option_code: "integer" | |||
| 1637 | #line 638 "parser.yy" | |||
| 1638 | { | |||
| 1639 | yylhs.value.as < uint16_t > () = ctx.convertOptionCode(yystack_[0].value.as < std::string > (), yystack_[0].location); | |||
| 1640 | } | |||
| 1641 | #line 1642 "parser.cc" | |||
| 1642 | break; | |||
| 1643 | ||||
| 1644 | case 67: // option_code: "option name" | |||
| 1645 | #line 642 "parser.yy" | |||
| 1646 | { | |||
| 1647 | yylhs.value.as < uint16_t > () = ctx.convertOptionName(yystack_[0].value.as < std::string > (), yystack_[0].location); | |||
| 1648 | } | |||
| 1649 | #line 1650 "parser.cc" | |||
| 1650 | break; | |||
| 1651 | ||||
| 1652 | case 68: // sub_option_code: "integer" | |||
| 1653 | #line 648 "parser.yy" | |||
| 1654 | { | |||
| 1655 | yylhs.value.as < uint16_t > () = ctx.convertOptionCode(yystack_[0].value.as < std::string > (), yystack_[0].location); | |||
| 1656 | } | |||
| 1657 | #line 1658 "parser.cc" | |||
| 1658 | break; | |||
| 1659 | ||||
| 1660 | case 69: // option_repr_type: "text" | |||
| 1661 | #line 654 "parser.yy" | |||
| 1662 | { | |||
| 1663 | yylhs.value.as < TokenOption::RepresentationType > () = TokenOption::TEXTUAL; | |||
| 1664 | } | |||
| 1665 | #line 1666 "parser.cc" | |||
| 1666 | break; | |||
| 1667 | ||||
| 1668 | case 70: // option_repr_type: "hex" | |||
| 1669 | #line 658 "parser.yy" | |||
| 1670 | { | |||
| 1671 | yylhs.value.as < TokenOption::RepresentationType > () = TokenOption::HEXADECIMAL; | |||
| 1672 | } | |||
| 1673 | #line 1674 "parser.cc" | |||
| 1674 | break; | |||
| 1675 | ||||
| 1676 | case 71: // nest_level: "integer" | |||
| 1677 | #line 664 "parser.yy" | |||
| 1678 | { | |||
| 1679 | yylhs.value.as < int8_t > () = ctx.convertNestLevelNumber(yystack_[0].value.as < std::string > (), yystack_[0].location); | |||
| 1680 | } | |||
| 1681 | #line 1682 "parser.cc" | |||
| 1682 | break; | |||
| 1683 | ||||
| 1684 | case 72: // pkt_metadata: "iface" | |||
| 1685 | #line 673 "parser.yy" | |||
| 1686 | { | |||
| 1687 | yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::IFACE; | |||
| 1688 | } | |||
| 1689 | #line 1690 "parser.cc" | |||
| 1690 | break; | |||
| 1691 | ||||
| 1692 | case 73: // pkt_metadata: "src" | |||
| 1693 | #line 677 "parser.yy" | |||
| 1694 | { | |||
| 1695 | yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::SRC; | |||
| 1696 | } | |||
| 1697 | #line 1698 "parser.cc" | |||
| 1698 | break; | |||
| 1699 | ||||
| 1700 | case 74: // pkt_metadata: "dst" | |||
| 1701 | #line 681 "parser.yy" | |||
| 1702 | { | |||
| 1703 | yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::DST; | |||
| 1704 | } | |||
| 1705 | #line 1706 "parser.cc" | |||
| 1706 | break; | |||
| 1707 | ||||
| 1708 | case 75: // pkt_metadata: "len" | |||
| 1709 | #line 685 "parser.yy" | |||
| 1710 | { | |||
| 1711 | yylhs.value.as < TokenPkt::MetadataType > () = TokenPkt::LEN; | |||
| 1712 | } | |||
| 1713 | #line 1714 "parser.cc" | |||
| 1714 | break; | |||
| 1715 | ||||
| 1716 | case 76: // enterprise_id: "integer" | |||
| 1717 | #line 691 "parser.yy" | |||
| 1718 | { | |||
| 1719 | yylhs.value.as < uint32_t > () = ctx.convertUint32(yystack_[0].value.as < std::string > (), yystack_[0].location); | |||
| 1720 | } | |||
| 1721 | #line 1722 "parser.cc" | |||
| 1722 | break; | |||
| 1723 | ||||
| 1724 | case 77: // enterprise_id: "*" | |||
| 1725 | #line 695 "parser.yy" | |||
| 1726 | { | |||
| 1727 | yylhs.value.as < uint32_t > () = 0; | |||
| 1728 | } | |||
| 1729 | #line 1730 "parser.cc" | |||
| 1730 | break; | |||
| 1731 | ||||
| 1732 | case 78: // pkt4_field: "mac" | |||
| 1733 | #line 701 "parser.yy" | |||
| 1734 | { | |||
| 1735 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::CHADDR; | |||
| 1736 | } | |||
| 1737 | #line 1738 "parser.cc" | |||
| 1738 | break; | |||
| 1739 | ||||
| 1740 | case 79: // pkt4_field: "hlen" | |||
| 1741 | #line 705 "parser.yy" | |||
| 1742 | { | |||
| 1743 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::HLEN; | |||
| 1744 | } | |||
| 1745 | #line 1746 "parser.cc" | |||
| 1746 | break; | |||
| 1747 | ||||
| 1748 | case 80: // pkt4_field: "htype" | |||
| 1749 | #line 709 "parser.yy" | |||
| 1750 | { | |||
| 1751 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::HTYPE; | |||
| 1752 | } | |||
| 1753 | #line 1754 "parser.cc" | |||
| 1754 | break; | |||
| 1755 | ||||
| 1756 | case 81: // pkt4_field: "ciaddr" | |||
| 1757 | #line 713 "parser.yy" | |||
| 1758 | { | |||
| 1759 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::CIADDR; | |||
| 1760 | } | |||
| 1761 | #line 1762 "parser.cc" | |||
| 1762 | break; | |||
| 1763 | ||||
| 1764 | case 82: // pkt4_field: "giaddr" | |||
| 1765 | #line 717 "parser.yy" | |||
| 1766 | { | |||
| 1767 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::GIADDR; | |||
| 1768 | } | |||
| 1769 | #line 1770 "parser.cc" | |||
| 1770 | break; | |||
| 1771 | ||||
| 1772 | case 83: // pkt4_field: "yiaddr" | |||
| 1773 | #line 721 "parser.yy" | |||
| 1774 | { | |||
| 1775 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::YIADDR; | |||
| 1776 | } | |||
| 1777 | #line 1778 "parser.cc" | |||
| 1778 | break; | |||
| 1779 | ||||
| 1780 | case 84: // pkt4_field: "siaddr" | |||
| 1781 | #line 725 "parser.yy" | |||
| 1782 | { | |||
| 1783 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::SIADDR; | |||
| 1784 | } | |||
| 1785 | #line 1786 "parser.cc" | |||
| 1786 | break; | |||
| 1787 | ||||
| 1788 | case 85: // pkt4_field: "msgtype" | |||
| 1789 | #line 729 "parser.yy" | |||
| 1790 | { | |||
| 1791 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::MSGTYPE; | |||
| 1792 | } | |||
| 1793 | #line 1794 "parser.cc" | |||
| 1794 | break; | |||
| 1795 | ||||
| 1796 | case 86: // pkt4_field: "transid" | |||
| 1797 | #line 733 "parser.yy" | |||
| 1798 | { | |||
| 1799 | yylhs.value.as < TokenPkt4::FieldType > () = TokenPkt4::TRANSID; | |||
| 1800 | } | |||
| 1801 | #line 1802 "parser.cc" | |||
| 1802 | break; | |||
| 1803 | ||||
| 1804 | case 87: // pkt6_field: "msgtype" | |||
| 1805 | #line 739 "parser.yy" | |||
| 1806 | { | |||
| 1807 | yylhs.value.as < TokenPkt6::FieldType > () = TokenPkt6::MSGTYPE; | |||
| 1808 | } | |||
| 1809 | #line 1810 "parser.cc" | |||
| 1810 | break; | |||
| 1811 | ||||
| 1812 | case 88: // pkt6_field: "transid" | |||
| 1813 | #line 743 "parser.yy" | |||
| 1814 | { | |||
| 1815 | yylhs.value.as < TokenPkt6::FieldType > () = TokenPkt6::TRANSID; | |||
| 1816 | } | |||
| 1817 | #line 1818 "parser.cc" | |||
| 1818 | break; | |||
| 1819 | ||||
| 1820 | case 89: // relay6_field: "peeraddr" | |||
| 1821 | #line 749 "parser.yy" | |||
| 1822 | { | |||
| 1823 | yylhs.value.as < TokenRelay6Field::FieldType > () = TokenRelay6Field::PEERADDR; | |||
| 1824 | } | |||
| 1825 | #line 1826 "parser.cc" | |||
| 1826 | break; | |||
| 1827 | ||||
| 1828 | case 90: // relay6_field: "linkaddr" | |||
| 1829 | #line 753 "parser.yy" | |||
| 1830 | { | |||
| 1831 | yylhs.value.as < TokenRelay6Field::FieldType > () = TokenRelay6Field::LINKADDR; | |||
| 1832 | } | |||
| 1833 | #line 1834 "parser.cc" | |||
| 1834 | break; | |||
| 1835 | ||||
| 1836 | case 91: // start_expr: "integer" | |||
| 1837 | #line 759 "parser.yy" | |||
| 1838 | { | |||
| 1839 | TokenPtr str(new TokenString(yystack_[0].value.as < std::string > ())); | |||
| 1840 | ctx.expression_.push_back(str); | |||
| 1841 | } | |||
| 1842 | #line 1843 "parser.cc" | |||
| 1843 | break; | |||
| 1844 | ||||
| 1845 | case 92: // length_expr: "integer" | |||
| 1846 | #line 766 "parser.yy" | |||
| 1847 | { | |||
| 1848 | TokenPtr str(new TokenString(yystack_[0].value.as < std::string > ())); | |||
| 1849 | ctx.expression_.push_back(str); | |||
| 1850 | } | |||
| 1851 | #line 1852 "parser.cc" | |||
| 1852 | break; | |||
| 1853 | ||||
| 1854 | case 93: // length_expr: "all" | |||
| 1855 | #line 771 "parser.yy" | |||
| 1856 | { | |||
| 1857 | TokenPtr str(new TokenString("all")); | |||
| 1858 | ctx.expression_.push_back(str); | |||
| 1859 | } | |||
| 1860 | #line 1861 "parser.cc" | |||
| 1861 | break; | |||
| 1862 | ||||
| 1863 | case 94: // int_expr: "integer" | |||
| 1864 | #line 778 "parser.yy" | |||
| 1865 | { | |||
| 1866 | TokenPtr str(new TokenString(yystack_[0].value.as < std::string > ())); | |||
| 1867 | ctx.expression_.push_back(str); | |||
| 1868 | } | |||
| 1869 | #line 1870 "parser.cc" | |||
| 1870 | break; | |||
| 1871 | ||||
| 1872 | ||||
| 1873 | #line 1874 "parser.cc" | |||
| 1874 | ||||
| 1875 | default: | |||
| 1876 | break; | |||
| 1877 | } | |||
| 1878 | } | |||
| 1879 | #if YY_EXCEPTIONS1 | |||
| 1880 | catch (const syntax_error& yyexc) | |||
| 1881 | { | |||
| 1882 | YYCDEBUGif (yydebug_) (*yycdebug_) << "Caught exception: " << yyexc.what() << '\n'; | |||
| 1883 | error (yyexc); | |||
| 1884 | YYERRORgoto yyerrorlab; | |||
| 1885 | } | |||
| 1886 | #endif // YY_EXCEPTIONS | |||
| 1887 | YY_SYMBOL_PRINT ("-> $$ =", yylhs)do { if (yydebug_) { *yycdebug_ << "-> $$ =" << ' '; yy_print_ (*yycdebug_, yylhs); *yycdebug_ << '\n' ; } } while (false); | |||
| 1888 | yypop_ (yylen); | |||
| 1889 | yylen = 0; | |||
| 1890 | ||||
| 1891 | // Shift the result of the reduction. | |||
| 1892 | yypush_ (YY_NULLPTRnullptr, YY_MOVEstd::move (yylhs)); | |||
| 1893 | } | |||
| 1894 | goto yynewstate; | |||
| 1895 | ||||
| 1896 | ||||
| 1897 | /*--------------------------------------. | |||
| 1898 | | yyerrlab -- here on detecting error. | | |||
| 1899 | `--------------------------------------*/ | |||
| 1900 | yyerrlab: | |||
| 1901 | // If not already recovering from an error, report this error. | |||
| 1902 | if (!yyerrstatus_) | |||
| 1903 | { | |||
| 1904 | ++yynerrs_; | |||
| 1905 | context yyctx (*this, yyla); | |||
| 1906 | std::string msg = yysyntax_error_ (yyctx); | |||
| 1907 | error (yyla.location, YY_MOVEstd::move (msg)); | |||
| 1908 | } | |||
| 1909 | ||||
| 1910 | ||||
| 1911 | yyerror_range[1].location = yyla.location; | |||
| 1912 | if (yyerrstatus_ == 3) | |||
| 1913 | { | |||
| 1914 | /* If just tried and failed to reuse lookahead token after an | |||
| 1915 | error, discard it. */ | |||
| 1916 | ||||
| 1917 | // Return failure if at end of input. | |||
| 1918 | if (yyla.kind () == symbol_kind::S_YYEOF) | |||
| 1919 | YYABORTgoto yyabortlab; | |||
| 1920 | else if (!yyla.empty ()) | |||
| 1921 | { | |||
| 1922 | yy_destroy_ ("Error: discarding", yyla); | |||
| 1923 | yyla.clear (); | |||
| 1924 | } | |||
| 1925 | } | |||
| 1926 | ||||
| 1927 | // Else will try to reuse lookahead token after shifting the error token. | |||
| 1928 | goto yyerrlab1; | |||
| 1929 | ||||
| 1930 | ||||
| 1931 | /*---------------------------------------------------. | |||
| 1932 | | yyerrorlab -- error raised explicitly by YYERROR. | | |||
| 1933 | `---------------------------------------------------*/ | |||
| 1934 | yyerrorlab: | |||
| 1935 | /* Pacify compilers when the user code never invokes YYERROR and | |||
| 1936 | the label yyerrorlab therefore never appears in user code. */ | |||
| 1937 | if (false) | |||
| 1938 | YYERRORgoto yyerrorlab; | |||
| 1939 | ||||
| 1940 | /* Do not reclaim the symbols of the rule whose action triggered | |||
| 1941 | this YYERROR. */ | |||
| 1942 | yypop_ (yylen); | |||
| 1943 | yylen = 0; | |||
| 1944 | YY_STACK_PRINT ()do { if (yydebug_) yy_stack_print_ (); } while (false); | |||
| 1945 | goto yyerrlab1; | |||
| 1946 | ||||
| 1947 | ||||
| 1948 | /*-------------------------------------------------------------. | |||
| 1949 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | |||
| 1950 | `-------------------------------------------------------------*/ | |||
| 1951 | yyerrlab1: | |||
| 1952 | yyerrstatus_ = 3; // Each real token shifted decrements this. | |||
| 1953 | // Pop stack until we find a state that shifts the error token. | |||
| 1954 | for (;;) | |||
| 1955 | { | |||
| 1956 | yyn = yypact_[+yystack_[0].state]; | |||
| 1957 | if (!yy_pact_value_is_default_ (yyn)) | |||
| 1958 | { | |||
| 1959 | yyn += symbol_kind::S_YYerror; | |||
| 1960 | if (0 <= yyn && yyn <= yylast_ | |||
| 1961 | && yycheck_[yyn] == symbol_kind::S_YYerror) | |||
| 1962 | { | |||
| 1963 | yyn = yytable_[yyn]; | |||
| 1964 | if (0 < yyn) | |||
| 1965 | break; | |||
| 1966 | } | |||
| 1967 | } | |||
| 1968 | ||||
| 1969 | // Pop the current state because it cannot handle the error token. | |||
| 1970 | if (yystack_.size () == 1) | |||
| 1971 | YYABORTgoto yyabortlab; | |||
| 1972 | ||||
| 1973 | yyerror_range[1].location = yystack_[0].location; | |||
| 1974 | yy_destroy_ ("Error: popping", yystack_[0]); | |||
| 1975 | yypop_ (); | |||
| 1976 | YY_STACK_PRINT ()do { if (yydebug_) yy_stack_print_ (); } while (false); | |||
| 1977 | } | |||
| 1978 | { | |||
| 1979 | stack_symbol_type error_token; | |||
| 1980 | ||||
| 1981 | yyerror_range[2].location = yyla.location; | |||
| 1982 | YYLLOC_DEFAULT (error_token.location, yyerror_range, 2)do if (2) { (error_token.location).begin = ((yyerror_range)[1 ].location).begin; (error_token.location).end = ((yyerror_range )[2].location).end; } else { (error_token.location).begin = ( error_token.location).end = ((yyerror_range)[0].location).end ; } while (false); | |||
| 1983 | ||||
| 1984 | // Shift the error token. | |||
| 1985 | error_token.state = state_type (yyn); | |||
| 1986 | yypush_ ("Shifting", YY_MOVEstd::move (error_token)); | |||
| 1987 | } | |||
| 1988 | goto yynewstate; | |||
| 1989 | ||||
| 1990 | ||||
| 1991 | /*-------------------------------------. | |||
| 1992 | | yyacceptlab -- YYACCEPT comes here. | | |||
| 1993 | `-------------------------------------*/ | |||
| 1994 | yyacceptlab: | |||
| 1995 | yyresult = 0; | |||
| 1996 | goto yyreturn; | |||
| 1997 | ||||
| 1998 | ||||
| 1999 | /*-----------------------------------. | |||
| 2000 | | yyabortlab -- YYABORT comes here. | | |||
| 2001 | `-----------------------------------*/ | |||
| 2002 | yyabortlab: | |||
| 2003 | yyresult = 1; | |||
| 2004 | goto yyreturn; | |||
| 2005 | ||||
| 2006 | ||||
| 2007 | /*-----------------------------------------------------. | |||
| 2008 | | yyreturn -- parsing is finished, return the result. | | |||
| 2009 | `-----------------------------------------------------*/ | |||
| 2010 | yyreturn: | |||
| 2011 | if (!yyla.empty ()) | |||
| 2012 | yy_destroy_ ("Cleanup: discarding lookahead", yyla); | |||
| 2013 | ||||
| 2014 | /* Do not reclaim the symbols of the rule whose action triggered | |||
| 2015 | this YYABORT or YYACCEPT. */ | |||
| 2016 | yypop_ (yylen); | |||
| 2017 | YY_STACK_PRINT ()do { if (yydebug_) yy_stack_print_ (); } while (false); | |||
| 2018 | while (1 < yystack_.size ()) | |||
| 2019 | { | |||
| 2020 | yy_destroy_ ("Cleanup: popping", yystack_[0]); | |||
| 2021 | yypop_ (); | |||
| 2022 | } | |||
| 2023 | ||||
| 2024 | return yyresult; | |||
| 2025 | } | |||
| 2026 | #if YY_EXCEPTIONS1 | |||
| 2027 | catch (...) | |||
| 2028 | { | |||
| 2029 | YYCDEBUGif (yydebug_) (*yycdebug_) << "Exception caught: cleaning lookahead and stack\n"; | |||
| 2030 | // Do not try to display the values of the reclaimed symbols, | |||
| 2031 | // as their printers might throw an exception. | |||
| 2032 | if (!yyla.empty ()) | |||
| 2033 | yy_destroy_ (YY_NULLPTRnullptr, yyla); | |||
| 2034 | ||||
| 2035 | while (1 < yystack_.size ()) | |||
| 2036 | { | |||
| 2037 | yy_destroy_ (YY_NULLPTRnullptr, yystack_[0]); | |||
| 2038 | yypop_ (); | |||
| 2039 | } | |||
| 2040 | throw; | |||
| 2041 | } | |||
| 2042 | #endif // YY_EXCEPTIONS | |||
| 2043 | } | |||
| 2044 | ||||
| 2045 | void | |||
| 2046 | EvalParser::error (const syntax_error& yyexc) | |||
| 2047 | { | |||
| 2048 | error (yyexc.location, yyexc.what ()); | |||
| 2049 | } | |||
| 2050 | ||||
| 2051 | /* Return YYSTR after stripping away unnecessary quotes and | |||
| 2052 | backslashes, so that it's suitable for yyerror. The heuristic is | |||
| 2053 | that double-quoting is unnecessary unless the string contains an | |||
| 2054 | apostrophe, a comma, or backslash (other than backslash-backslash). | |||
| 2055 | YYSTR is taken from yytname. */ | |||
| 2056 | std::string | |||
| 2057 | EvalParser::yytnamerr_ (const char *yystr) | |||
| 2058 | { | |||
| 2059 | if (*yystr == '"') | |||
| 2060 | { | |||
| 2061 | std::string yyr; | |||
| 2062 | char const *yyp = yystr; | |||
| 2063 | ||||
| 2064 | for (;;) | |||
| 2065 | switch (*++yyp) | |||
| 2066 | { | |||
| 2067 | case '\'': | |||
| 2068 | case ',': | |||
| 2069 | goto do_not_strip_quotes; | |||
| 2070 | ||||
| 2071 | case '\\': | |||
| 2072 | if (*++yyp != '\\') | |||
| 2073 | goto do_not_strip_quotes; | |||
| 2074 | else | |||
| 2075 | goto append; | |||
| 2076 | ||||
| 2077 | append: | |||
| 2078 | default: | |||
| 2079 | yyr += *yyp; | |||
| 2080 | break; | |||
| 2081 | ||||
| 2082 | case '"': | |||
| 2083 | return yyr; | |||
| 2084 | } | |||
| 2085 | do_not_strip_quotes: ; | |||
| 2086 | } | |||
| 2087 | ||||
| 2088 | return yystr; | |||
| 2089 | } | |||
| 2090 | ||||
| 2091 | std::string | |||
| 2092 | EvalParser::symbol_name (symbol_kind_type yysymbol) | |||
| 2093 | { | |||
| 2094 | return yytnamerr_ (yytname_[yysymbol]); | |||
| 2095 | } | |||
| 2096 | ||||
| 2097 | ||||
| 2098 | ||||
| 2099 | // EvalParser::context. | |||
| 2100 | EvalParser::context::context (const EvalParser& yyparser, const symbol_type& yyla) | |||
| 2101 | : yyparser_ (yyparser) | |||
| 2102 | , yyla_ (yyla) | |||
| 2103 | {} | |||
| 2104 | ||||
| 2105 | int | |||
| 2106 | EvalParser::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const | |||
| 2107 | { | |||
| 2108 | // Actual number of expected tokens | |||
| 2109 | int yycount = 0; | |||
| 2110 | ||||
| 2111 | const int yyn = yypact_[+yyparser_.yystack_[0].state]; | |||
| 2112 | if (!yy_pact_value_is_default_ (yyn)) | |||
| 2113 | { | |||
| 2114 | /* Start YYX at -YYN if negative to avoid negative indexes in | |||
| 2115 | YYCHECK. In other words, skip the first -YYN actions for | |||
| 2116 | this state because they are default actions. */ | |||
| 2117 | const int yyxbegin = yyn < 0 ? -yyn : 0; | |||
| 2118 | // Stay within bounds of both yycheck and yytname. | |||
| 2119 | const int yychecklim = yylast_ - yyn + 1; | |||
| 2120 | const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | |||
| 2121 | for (int yyx = yyxbegin; yyx < yyxend; ++yyx) | |||
| 2122 | if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::S_YYerror | |||
| 2123 | && !yy_table_value_is_error_ (yytable_[yyx + yyn])) | |||
| 2124 | { | |||
| 2125 | if (!yyarg) | |||
| 2126 | ++yycount; | |||
| 2127 | else if (yycount == yyargn) | |||
| 2128 | return 0; | |||
| 2129 | else | |||
| 2130 | yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx)static_cast<symbol_kind_type> (yyx); | |||
| 2131 | } | |||
| 2132 | } | |||
| 2133 | ||||
| 2134 | if (yyarg && yycount == 0 && 0 < yyargn) | |||
| 2135 | yyarg[0] = symbol_kind::S_YYEMPTY; | |||
| 2136 | return yycount; | |||
| 2137 | } | |||
| 2138 | ||||
| 2139 | ||||
| 2140 | ||||
| 2141 | ||||
| 2142 | ||||
| 2143 | ||||
| 2144 | int | |||
| 2145 | EvalParser::yy_syntax_error_arguments_ (const context& yyctx, | |||
| 2146 | symbol_kind_type yyarg[], int yyargn) const | |||
| 2147 | { | |||
| 2148 | /* There are many possibilities here to consider: | |||
| 2149 | - If this state is a consistent state with a default action, then | |||
| 2150 | the only way this function was invoked is if the default action | |||
| 2151 | is an error action. In that case, don't check for expected | |||
| 2152 | tokens because there are none. | |||
| 2153 | - The only way there can be no lookahead present (in yyla) is | |||
| 2154 | if this state is a consistent state with a default action. | |||
| 2155 | Thus, detecting the absence of a lookahead is sufficient to | |||
| 2156 | determine that there is no unexpected or expected token to | |||
| 2157 | report. In that case, just report a simple "syntax error". | |||
| 2158 | - Don't assume there isn't a lookahead just because this state is | |||
| 2159 | a consistent state with a default action. There might have | |||
| 2160 | been a previous inconsistent state, consistent state with a | |||
| 2161 | non-default action, or user semantic action that manipulated | |||
| 2162 | yyla. (However, yyla is currently not documented for users.) | |||
| 2163 | - Of course, the expected token list depends on states to have | |||
| 2164 | correct lookahead information, and it depends on the parser not | |||
| 2165 | to perform extra reductions after fetching a lookahead from the | |||
| 2166 | scanner and before detecting a syntax error. Thus, state merging | |||
| 2167 | (from LALR or IELR) and default reductions corrupt the expected | |||
| 2168 | token list. However, the list is correct for canonical LR with | |||
| 2169 | one exception: it will still contain any token that will not be | |||
| 2170 | accepted due to an error action in a later state. | |||
| 2171 | */ | |||
| 2172 | ||||
| 2173 | if (!yyctx.lookahead ().empty ()) | |||
| 2174 | { | |||
| 2175 | if (yyarg) | |||
| 2176 | yyarg[0] = yyctx.token (); | |||
| 2177 | int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1); | |||
| 2178 | return yyn + 1; | |||
| 2179 | } | |||
| 2180 | return 0; | |||
| 2181 | } | |||
| 2182 | ||||
| 2183 | // Generate an error message. | |||
| 2184 | std::string | |||
| 2185 | EvalParser::yysyntax_error_ (const context& yyctx) const | |||
| 2186 | { | |||
| 2187 | // Its maximum. | |||
| 2188 | enum { YYARGS_MAX = 5 }; | |||
| 2189 | // Arguments of yyformat. | |||
| 2190 | symbol_kind_type yyarg[YYARGS_MAX]; | |||
| 2191 | int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX); | |||
| 2192 | ||||
| 2193 | char const* yyformat = YY_NULLPTRnullptr; | |||
| 2194 | switch (yycount) | |||
| 2195 | { | |||
| 2196 | #define YYCASE_(N, S) \ | |||
| 2197 | case N: \ | |||
| 2198 | yyformat = S; \ | |||
| 2199 | break | |||
| 2200 | default: // Avoid compiler warnings. | |||
| 2201 | YYCASE_ (0, YY_("syntax error")"syntax error"); | |||
| 2202 | YYCASE_ (1, YY_("syntax error, unexpected %s")"syntax error, unexpected %s"); | |||
| 2203 | YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s")"syntax error, unexpected %s, expecting %s"); | |||
| 2204 | YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s")"syntax error, unexpected %s, expecting %s or %s"); | |||
| 2205 | YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")"syntax error, unexpected %s, expecting %s or %s or %s"); | |||
| 2206 | YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")"syntax error, unexpected %s, expecting %s or %s or %s or %s"); | |||
| 2207 | #undef YYCASE_ | |||
| 2208 | } | |||
| 2209 | ||||
| 2210 | std::string yyres; | |||
| 2211 | // Argument number. | |||
| 2212 | std::ptrdiff_t yyi = 0; | |||
| 2213 | for (char const* yyp = yyformat; *yyp; ++yyp) | |||
| 2214 | if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) | |||
| 2215 | { | |||
| 2216 | yyres += symbol_name (yyarg[yyi++]); | |||
| 2217 | ++yyp; | |||
| 2218 | } | |||
| 2219 | else | |||
| 2220 | yyres += *yyp; | |||
| 2221 | return yyres; | |||
| 2222 | } | |||
| 2223 | ||||
| 2224 | ||||
| 2225 | const short EvalParser::yypact_ninf_ = -193; | |||
| 2226 | ||||
| 2227 | const signed char EvalParser::yytable_ninf_ = -1; | |||
| 2228 | ||||
| 2229 | const short | |||
| 2230 | EvalParser::yypact_[] = | |||
| 2231 | { | |||
| 2232 | 64, 207, 89, 58, 207, 207, -9, 17, 46, 20, | |||
| 2233 | 56, 90, 113, 116, 145, 150, 173, 177, 184, 185, | |||
| 2234 | 203, 208, 214, 220, 226, 231, 272, 243, 105, 166, | |||
| 2235 | 282, -193, -193, -193, -193, -193, 244, 251, 252, 283, | |||
| 2236 | 233, 52, -193, 89, 176, 186, 286, 292, 294, 295, | |||
| 2237 | 274, -193, 280, -1, -193, 228, 250, 253, 255, 266, | |||
| 2238 | 248, 89, 89, 89, 207, 207, 89, 89, 89, 89, | |||
| 2239 | 89, 89, 89, 89, 89, 89, 23, 45, 257, 45, | |||
| 2240 | 261, 258, 146, 187, 205, 211, -193, 207, -193, 207, | |||
| 2241 | 89, 89, 2, 45, 45, 86, 152, 217, 225, -193, | |||
| 2242 | -193, -193, -193, 299, -193, 303, -193, 306, 321, -193, | |||
| 2243 | -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, | |||
| 2244 | -193, -193, -193, -193, 43, 256, 259, 143, 153, 260, | |||
| 2245 | 3, 6, 7, 8, 9, 10, 11, 12, 14, -193, | |||
| 2246 | -193, -193, -193, -193, 308, -193, 309, -193, 289, 312, | |||
| 2247 | -193, -193, -193, -193, 313, -193, -193, 314, -193, -193, | |||
| 2248 | 315, -193, -193, 207, 327, 207, 163, 274, -193, 316, | |||
| 2249 | 317, -193, -193, 318, -193, 270, 89, 89, -193, 89, | |||
| 2250 | 89, -193, -193, -193, -193, -193, -193, -193, -193, -193, | |||
| 2251 | 319, 320, 89, 250, 228, 228, 228, -193, 158, 322, | |||
| 2252 | 323, 13, -193, 301, 267, 15, 89, 268, 33, -18, | |||
| 2253 | 65, 42, 325, 326, 328, 329, 285, 337, 332, -193, | |||
| 2254 | -193, -193, -33, 284, -193, 271, 89, -193, -193, 334, | |||
| 2255 | 335, -193, -193, -193, -193, -193, -193, 250, -193, -193, | |||
| 2256 | 349, -193, 350, -193, 53, 290, 250, 339, -193, -193, | |||
| 2257 | 89, -193, 340, 341, -193, 73, -193, -193, -193 | |||
| 2258 | }; | |||
| 2259 | ||||
| 2260 | const signed char | |||
| 2261 | EvalParser::yydefact_[] = | |||
| 2262 | { | |||
| 2263 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 2264 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 2265 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 2266 | 0, 30, 65, 31, 32, 2, 0, 0, 0, 0, | |||
| 2267 | 4, 0, 63, 0, 0, 0, 0, 0, 0, 0, | |||
| 2268 | 3, 1, 0, 0, 14, 0, 0, 0, 0, 0, | |||
| 2269 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 2270 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 2271 | 0, 0, 0, 0, 0, 0, 15, 0, 18, 0, | |||
| 2272 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, | |||
| 2273 | 64, 66, 67, 0, 68, 0, 71, 0, 0, 72, | |||
| 2274 | 73, 74, 75, 36, 78, 79, 80, 81, 82, 83, | |||
| 2275 | 84, 85, 86, 37, 0, 0, 0, 0, 0, 0, | |||
| 2276 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, | |||
| 2277 | 88, 38, 77, 76, 0, 59, 0, 58, 0, 0, | |||
| 2278 | 69, 70, 22, 33, 0, 23, 34, 0, 24, 35, | |||
| 2279 | 0, 27, 60, 0, 17, 0, 20, 21, 43, 0, | |||
| 2280 | 0, 5, 7, 0, 28, 0, 0, 0, 46, 0, | |||
| 2281 | 0, 51, 52, 53, 54, 55, 56, 57, 44, 45, | |||
| 2282 | 0, 0, 0, 0, 0, 0, 0, 16, 19, 0, | |||
| 2283 | 0, 0, 91, 0, 0, 0, 0, 0, 0, 0, | |||
| 2284 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, | |||
| 2285 | 90, 39, 0, 0, 42, 0, 0, 50, 25, 61, | |||
| 2286 | 0, 26, 29, 6, 8, 10, 12, 0, 93, 92, | |||
| 2287 | 0, 94, 0, 47, 0, 0, 0, 0, 40, 41, | |||
| 2288 | 0, 49, 0, 0, 9, 0, 62, 11, 48 | |||
| 2289 | }; | |||
| 2290 | ||||
| 2291 | const short | |||
| 2292 | EvalParser::yypgoto_[] = | |||
| 2293 | { | |||
| 2294 | -193, -193, -193, 16, 21, 26, 31, 34, -193, -193, | |||
| 2295 | -2, -193, -193, -193, 72, -192, 117, -193, -193, 51, | |||
| 2296 | -193, -193, -193, -193, -193, -193 | |||
| 2297 | }; | |||
| 2298 | ||||
| 2299 | const unsigned char | |||
| 2300 | EvalParser::yydefgoto_[] = | |||
| 2301 | { | |||
| 2302 | 0, 3, 35, 46, 47, 48, 49, 40, 163, 165, | |||
| 2303 | 41, 206, 250, 42, 103, 105, 153, 107, 113, 144, | |||
| 2304 | 123, 141, 221, 203, 240, 242 | |||
| 2305 | }; | |||
| 2306 | ||||
| 2307 | const short | |||
| 2308 | EvalParser::yytable_[] = | |||
| 2309 | { | |||
| 2310 | 50, 212, 53, 100, 228, 238, 100, 181, 55, 90, | |||
| 2311 | 182, 183, 184, 185, 186, 187, 188, 36, 189, 224, | |||
| 2312 | 36, 36, 37, 58, 218, 37, 37, 38, 219, 220, | |||
| 2313 | 38, 38, 39, 239, 56, 39, 39, 227, 52, 54, | |||
| 2314 | 91, 92, 229, 91, 91, 247, 232, 91, 91, 91, | |||
| 2315 | 91, 91, 91, 91, 253, 91, 91, 251, 51, 124, | |||
| 2316 | 125, 126, 90, 57, 129, 130, 131, 132, 133, 134, | |||
| 2317 | 135, 136, 137, 138, 91, 59, 230, 258, 139, 140, | |||
| 2318 | 36, 36, 175, 91, 91, 37, 37, 231, 167, 168, | |||
| 2319 | 38, 38, 43, 91, 91, 39, 39, 149, 127, 128, | |||
| 2320 | 6, 7, 8, 36, 142, 36, 150, 151, 37, 60, | |||
| 2321 | 37, 143, 10, 38, 91, 38, 61, 11, 39, 62, | |||
| 2322 | 39, 164, 77, 166, 78, 12, 13, 1, 2, 14, | |||
| 2323 | 146, 15, 16, 17, 18, 19, 20, 21, 22, 23, | |||
| 2324 | 24, 25, 26, 27, 169, 170, 44, 45, 63, 86, | |||
| 2325 | 87, 88, 89, 64, 31, 32, 33, 149, 34, 86, | |||
| 2326 | 87, 88, 89, 154, 86, 87, 150, 151, 152, 86, | |||
| 2327 | 87, 88, 150, 151, 204, 205, 65, 207, 208, 36, | |||
| 2328 | 66, 36, 178, 79, 37, 80, 37, 67, 68, 38, | |||
| 2329 | 211, 38, 179, 93, 39, 78, 39, 197, 154, 198, | |||
| 2330 | 156, 159, 162, 94, 225, 80, 69, 150, 151, 155, | |||
| 2331 | 4, 70, 5, 156, 159, 162, 157, 71, 6, 7, | |||
| 2332 | 8, 9, 160, 72, 244, 150, 151, 158, 157, 73, | |||
| 2333 | 10, 150, 151, 161, 74, 11, 160, 150, 151, 86, | |||
| 2334 | 87, 88, 89, 12, 13, 150, 151, 14, 255, 15, | |||
| 2335 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, | |||
| 2336 | 26, 27, 76, 82, 28, 29, 213, 214, 215, 30, | |||
| 2337 | 83, 84, 31, 32, 33, 75, 34, 114, 115, 116, | |||
| 2338 | 117, 118, 119, 120, 99, 81, 86, 87, 88, 89, | |||
| 2339 | 109, 110, 111, 112, 101, 176, 102, 91, 177, 180, | |||
| 2340 | 91, 91, 85, 121, 122, 95, 223, 226, 91, 91, | |||
| 2341 | 243, 96, 91, 97, 98, 91, 104, 171, 145, 106, | |||
| 2342 | 108, 172, 147, 148, 173, 174, 190, 191, 192, 193, | |||
| 2343 | 194, 195, 196, 86, 199, 200, 202, 201, 209, 210, | |||
| 2344 | 222, 216, 217, 233, 234, 229, 235, 236, 230, 237, | |||
| 2345 | 241, 245, 246, 248, 249, 0, 252, 254, 256, 257 | |||
| 2346 | }; | |||
| 2347 | ||||
| 2348 | const short | |||
| 2349 | EvalParser::yycheck_[] = | |||
| 2350 | { | |||
| 2351 | 2, 193, 4, 4, 22, 38, 4, 4, 17, 10, | |||
| 2352 | 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, | |||
| 2353 | 4, 5, 1, 3, 11, 4, 5, 1, 15, 16, | |||
| 2354 | 4, 5, 1, 66, 17, 4, 5, 4, 4, 5, | |||
| 2355 | 41, 43, 60, 41, 41, 237, 4, 41, 41, 41, | |||
| 2356 | 41, 41, 41, 41, 246, 41, 41, 4, 0, 61, | |||
| 2357 | 62, 63, 10, 17, 66, 67, 68, 69, 70, 71, | |||
| 2358 | 72, 73, 74, 75, 41, 19, 11, 4, 55, 56, | |||
| 2359 | 64, 65, 39, 41, 41, 64, 65, 22, 90, 91, | |||
| 2360 | 64, 65, 3, 41, 41, 64, 65, 11, 64, 65, | |||
| 2361 | 11, 12, 13, 87, 59, 89, 20, 21, 87, 19, | |||
| 2362 | 89, 66, 23, 87, 41, 89, 3, 28, 87, 3, | |||
| 2363 | 89, 87, 17, 89, 19, 36, 37, 63, 64, 40, | |||
| 2364 | 79, 42, 43, 44, 45, 46, 47, 48, 49, 50, | |||
| 2365 | 51, 52, 53, 54, 93, 94, 57, 58, 3, 6, | |||
| 2366 | 7, 8, 9, 3, 65, 66, 67, 11, 69, 6, | |||
| 2367 | 7, 8, 9, 11, 6, 7, 20, 21, 22, 6, | |||
| 2368 | 7, 8, 20, 21, 176, 177, 3, 179, 180, 163, | |||
| 2369 | 3, 165, 39, 17, 163, 19, 165, 3, 3, 163, | |||
| 2370 | 192, 165, 39, 17, 163, 19, 165, 163, 11, 165, | |||
| 2371 | 83, 84, 85, 17, 206, 19, 3, 20, 21, 22, | |||
| 2372 | 3, 3, 5, 96, 97, 98, 11, 3, 11, 12, | |||
| 2373 | 13, 14, 11, 3, 226, 20, 21, 22, 11, 3, | |||
| 2374 | 23, 20, 21, 22, 3, 28, 11, 20, 21, 6, | |||
| 2375 | 7, 8, 9, 36, 37, 20, 21, 40, 250, 42, | |||
| 2376 | 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, | |||
| 2377 | 53, 54, 19, 19, 57, 58, 194, 195, 196, 62, | |||
| 2378 | 19, 19, 65, 66, 67, 3, 69, 29, 30, 31, | |||
| 2379 | 32, 33, 34, 35, 4, 3, 6, 7, 8, 9, | |||
| 2380 | 24, 25, 26, 27, 66, 39, 68, 41, 39, 39, | |||
| 2381 | 41, 41, 19, 55, 56, 19, 39, 39, 41, 41, | |||
| 2382 | 39, 19, 41, 19, 19, 41, 66, 18, 61, 66, | |||
| 2383 | 65, 18, 61, 65, 18, 4, 18, 18, 39, 17, | |||
| 2384 | 17, 17, 17, 6, 18, 18, 66, 19, 19, 19, | |||
| 2385 | 39, 19, 19, 18, 18, 60, 18, 18, 11, 17, | |||
| 2386 | 66, 17, 17, 4, 4, -1, 66, 18, 18, 18 | |||
| 2387 | }; | |||
| 2388 | ||||
| 2389 | const signed char | |||
| 2390 | EvalParser::yystos_[] = | |||
| 2391 | { | |||
| 2392 | 0, 63, 64, 71, 3, 5, 11, 12, 13, 14, | |||
| 2393 | 23, 28, 36, 37, 40, 42, 43, 44, 45, 46, | |||
| 2394 | 47, 48, 49, 50, 51, 52, 53, 54, 57, 58, | |||
| 2395 | 62, 65, 66, 67, 69, 72, 73, 74, 75, 76, | |||
| 2396 | 77, 80, 83, 3, 57, 58, 73, 74, 75, 76, | |||
| 2397 | 80, 0, 77, 80, 77, 17, 17, 17, 3, 19, | |||
| 2398 | 19, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |||
| 2399 | 3, 3, 3, 3, 3, 3, 19, 17, 19, 17, | |||
| 2400 | 19, 3, 19, 19, 19, 19, 6, 7, 8, 9, | |||
| 2401 | 10, 41, 80, 17, 17, 19, 19, 19, 19, 4, | |||
| 2402 | 4, 66, 68, 84, 66, 85, 66, 87, 65, 24, | |||
| 2403 | 25, 26, 27, 88, 29, 30, 31, 32, 33, 34, | |||
| 2404 | 35, 55, 56, 90, 80, 80, 80, 77, 77, 80, | |||
| 2405 | 80, 80, 80, 80, 80, 80, 80, 80, 80, 55, | |||
| 2406 | 56, 91, 59, 66, 89, 61, 89, 61, 65, 11, | |||
| 2407 | 20, 21, 22, 86, 11, 22, 86, 11, 22, 86, | |||
| 2408 | 11, 22, 86, 78, 77, 79, 77, 80, 80, 89, | |||
| 2409 | 89, 18, 18, 18, 4, 39, 39, 39, 39, 39, | |||
| 2410 | 39, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |||
| 2411 | 18, 18, 39, 17, 17, 17, 17, 77, 77, 18, | |||
| 2412 | 18, 19, 66, 93, 80, 80, 81, 80, 80, 19, | |||
| 2413 | 19, 80, 85, 84, 84, 84, 19, 19, 11, 15, | |||
| 2414 | 16, 92, 39, 39, 4, 80, 39, 4, 22, 60, | |||
| 2415 | 11, 22, 4, 18, 18, 18, 18, 17, 38, 66, | |||
| 2416 | 94, 66, 95, 39, 80, 17, 17, 85, 4, 4, | |||
| 2417 | 82, 4, 66, 85, 18, 80, 18, 18, 4 | |||
| 2418 | }; | |||
| 2419 | ||||
| 2420 | const signed char | |||
| 2421 | EvalParser::yyr1_[] = | |||
| 2422 | { | |||
| 2423 | 0, 70, 71, 71, 72, 73, 73, 74, 74, 75, | |||
| 2424 | 75, 76, 76, 77, 77, 78, 77, 77, 79, 77, | |||
| 2425 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | |||
| 2426 | 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, | |||
| 2427 | 80, 80, 80, 80, 80, 80, 81, 82, 80, 80, | |||
| 2428 | 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, | |||
| 2429 | 80, 80, 80, 80, 80, 83, 84, 84, 85, 86, | |||
| 2430 | 86, 87, 88, 88, 88, 88, 89, 89, 90, 90, | |||
| 2431 | 90, 90, 90, 90, 90, 90, 90, 91, 91, 92, | |||
| 2432 | 92, 93, 94, 94, 95 | |||
| 2433 | }; | |||
| 2434 | ||||
| 2435 | const signed char | |||
| 2436 | EvalParser::yyr2_[] = | |||
| 2437 | { | |||
| 2438 | 0, 2, 2, 2, 1, 4, 6, 4, 6, 9, | |||
| 2439 | 6, 9, 6, 3, 2, 0, 4, 3, 0, 4, | |||
| 2440 | 3, 3, 3, 3, 3, 6, 6, 3, 4, 6, | |||
| 2441 | 1, 1, 1, 3, 3, 3, 3, 3, 3, 6, | |||
| 2442 | 8, 8, 6, 3, 4, 4, 0, 0, 10, 8, | |||
| 2443 | 6, 4, 4, 4, 4, 4, 4, 4, 3, 3, | |||
| 2444 | 3, 6, 9, 1, 3, 1, 1, 1, 1, 1, | |||
| 2445 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
| 2446 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
| 2447 | 1, 1, 1, 1, 1 | |||
| 2448 | }; | |||
| 2449 | ||||
| 2450 | ||||
| 2451 | #if EVALDEBUG1 || 1 | |||
| 2452 | // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | |||
| 2453 | // First, the terminals, then, starting at \a YYNTOKENS, nonterminals. | |||
| 2454 | const char* | |||
| 2455 | const EvalParser::yytname_[] = | |||
| 2456 | { | |||
| 2457 | "\"end of file\"", "error", "\"invalid token\"", "\"(\"", "\")\"", | |||
| 2458 | "\"not\"", "\"and\"", "\"sand\"", "\"or\"", "\"sor\"", "\"==\"", | |||
| 2459 | "\"option\"", "\"relay4\"", "\"relay6\"", "\"member\"", "\"peeraddr\"", | |||
| 2460 | "\"linkaddr\"", "\"[\"", "\"]\"", "\".\"", "\"text\"", "\"hex\"", | |||
| 2461 | "\"exists\"", "\"pkt\"", "\"iface\"", "\"src\"", "\"dst\"", "\"len\"", | |||
| 2462 | "\"pkt4\"", "\"mac\"", "\"hlen\"", "\"htype\"", "\"ciaddr\"", | |||
| 2463 | "\"giaddr\"", "\"yiaddr\"", "\"siaddr\"", "\"substring\"", "\"split\"", | |||
| 2464 | "\"all\"", "\",\"", "\"concat\"", "\"+\"", "\"ifelse\"", "\"sifelse\"", | |||
| 2465 | "\"hexstring\"", "\"addrtotext\"", "\"int8totext\"", "\"int16totext\"", | |||
| 2466 | "\"int32totext\"", "\"uint8totext\"", "\"uint16totext\"", | |||
| 2467 | "\"uint32totext\"", "\"lcase\"", "\"ucase\"", "\"pkt6\"", "\"msgtype\"", | |||
| 2468 | "\"transid\"", "\"vendor-class\"", "\"vendor\"", "\"*\"", "\"data\"", | |||
| 2469 | "\"enterprise\"", "\"match\"", "\"top-level bool\"", | |||
| 2470 | "\"top-level string\"", "\"constant string\"", "\"integer\"", | |||
| 2471 | "\"constant hexstring\"", "\"option name\"", "\"ip address\"", "$accept", | |||
| 2472 | "start", "expression", "option_chain", "relay4_option_chain", | |||
| 2473 | "relay6_option_chain", "vendor_option_chain", "bool_expr", "$@1", "$@2", | |||
| 2474 | "string_expr", "$@3", "$@4", "integer_expr", "option_code", | |||
| 2475 | "sub_option_code", "option_repr_type", "nest_level", "pkt_metadata", | |||
| 2476 | "enterprise_id", "pkt4_field", "pkt6_field", "relay6_field", | |||
| 2477 | "start_expr", "length_expr", "int_expr", YY_NULLPTRnullptr | |||
| 2478 | }; | |||
| 2479 | #endif | |||
| 2480 | ||||
| 2481 | ||||
| 2482 | #if EVALDEBUG1 | |||
| 2483 | const short | |||
| 2484 | EvalParser::yyrline_[] = | |||
| 2485 | { | |||
| 2486 | 0, 168, 168, 169, 174, 177, 181, 188, 196, 203, | |||
| 2487 | 212, 219, 224, 231, 232, 238, 237, 249, 255, 254, | |||
| 2488 | 266, 271, 276, 281, 301, 315, 324, 333, 343, 358, | |||
| 2489 | 369, 374, 379, 384, 389, 410, 425, 430, 444, 458, | |||
| 2490 | 473, 478, 483, 488, 493, 498, 504, 509, 503, 524, | |||
| 2491 | 529, 534, 539, 544, 549, 554, 559, 564, 569, 578, | |||
| 2492 | 588, 597, 610, 623, 628, 631, 637, 641, 647, 653, | |||
| 2493 | 657, 663, 672, 676, 680, 684, 690, 694, 700, 704, | |||
| 2494 | 708, 712, 716, 720, 724, 728, 732, 738, 742, 748, | |||
| 2495 | 752, 758, 765, 770, 777 | |||
| 2496 | }; | |||
| 2497 | ||||
| 2498 | void | |||
| 2499 | EvalParser::yy_stack_print_ () const | |||
| 2500 | { | |||
| 2501 | *yycdebug_ << "Stack now"; | |||
| 2502 | for (stack_type::const_iterator | |||
| 2503 | i = yystack_.begin (), | |||
| 2504 | i_end = yystack_.end (); | |||
| 2505 | i != i_end; ++i) | |||
| 2506 | *yycdebug_ << ' ' << int (i->state); | |||
| 2507 | *yycdebug_ << '\n'; | |||
| 2508 | } | |||
| 2509 | ||||
| 2510 | void | |||
| 2511 | EvalParser::yy_reduce_print_ (int yyrule) const | |||
| 2512 | { | |||
| 2513 | int yylno = yyrline_[yyrule]; | |||
| 2514 | int yynrhs = yyr2_[yyrule]; | |||
| 2515 | // Print the symbols being reduced, and their result. | |||
| 2516 | *yycdebug_ << "Reducing stack by rule " << yyrule - 1 | |||
| 2517 | << " (line " << yylno << "):\n"; | |||
| 2518 | // The symbols being reduced. | |||
| 2519 | for (int yyi = 0; yyi < yynrhs; yyi++) | |||
| 2520 | YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",do { if (yydebug_) { *yycdebug_ << " $" << yyi + 1 << " =" << ' '; yy_print_ (*yycdebug_, yystack_ [(yynrhs) - (yyi + 1)]); *yycdebug_ << '\n'; } } while ( false) | |||
| 2521 | yystack_[(yynrhs) - (yyi + 1)])do { if (yydebug_) { *yycdebug_ << " $" << yyi + 1 << " =" << ' '; yy_print_ (*yycdebug_, yystack_ [(yynrhs) - (yyi + 1)]); *yycdebug_ << '\n'; } } while ( false); | |||
| 2522 | } | |||
| 2523 | #endif // EVALDEBUG | |||
| 2524 | ||||
| 2525 | ||||
| 2526 | #line 14 "parser.yy" | |||
| 2527 | } } // isc::eval | |||
| 2528 | #line 2529 "parser.cc" | |||
| 2529 | ||||
| 2530 | #line 784 "parser.yy" | |||
| 2531 | ||||
| 2532 | void | |||
| 2533 | isc::eval::EvalParser::error(const location_type& loc, | |||
| 2534 | const std::string& what) | |||
| 2535 | { | |||
| 2536 | ctx.error(loc, what); | |||
| 2537 | } |