| 445 | typename RuleParams = nope, |
| 446 | typename Where = nope> |
| 447 | struct parse_context |
| 448 | { |
| 449 | parse_context() = default; |
| 450 | parse_context(parse_context const &) = default; |
| 451 | parse_context & operator=(parse_context const &) = default; |
| 452 | |
| 453 | using rule_tag = RuleTag; |
| 454 | |
| 455 | static constexpr bool do_trace = DoTrace; |
| 456 | static constexpr bool use_callbacks = UseCallbacks; |
| 457 | |
| 458 | I first_; |
| 459 | S last_; |
| 460 | bool * pass_ = nullptr; |
| 461 | int * trace_indent_ = nullptr; |
| 462 | symbol_table_tries_t * symbol_table_tries_ = nullptr; |
| 463 | pending_symbol_table_operations_t * |
| 464 | pending_symbol_table_operations_ = nullptr; |
| 465 | ErrorHandler const * error_handler_ = nullptr; |
| 466 | nope_or_pointer_t<GlobalState> globals_{}; |
| 467 | nope_or_pointer_t<Callbacks, true> callbacks_{}; |
| 468 | nope_or_pointer_t<Attr> attr_{}; |
| 469 | nope_or_pointer_t<Val> val_{}; |
| 470 | nope_or_pointer_t<RuleLocals> locals_{}; |
| 471 | nope_or_pointer_t<RuleParams, true> params_{}; |
| 472 | nope_or_pointer_t<Where, true> where_{}; |
| 473 | int no_case_depth_ = 0; |
| 474 | |
| 475 | // These exist in order to provide an address, if requested, for |
| 476 | // either kind of symbol table struct. The nonstatic member |
| 477 | // pointers for these will be null if this context was created |
| 478 | // inside of detail::skip(), but nothing prevents the user from |
| 479 | // trying to use a symbol_parser anyway. So, we have these. |
| 480 | static std::optional<symbol_table_tries_t> |
| 481 | empty_symbol_table_tries_; |
| 482 | static std::optional<pending_symbol_table_operations_t> |
| 483 | empty_pending_symbol_table_operations_; |
| 484 | |
| 485 | symbol_table_tries_t & get_symbol_table_tries() const |
| 486 | { |
| 487 | if (symbol_table_tries_) |
| 488 | return *symbol_table_tries_; |
| 489 | if (!empty_symbol_table_tries_) |
| 490 | empty_symbol_table_tries_ = symbol_table_tries_t(); |
| 491 | return *empty_symbol_table_tries_; |
| 492 | } |
| 493 | |
| 494 | pending_symbol_table_operations_t & |
| 495 | get_pending_symbol_table_operations() const |
| 496 | { |
| 497 | if (pending_symbol_table_operations_) |
| 498 | return *pending_symbol_table_operations_; |
| 499 | if (!empty_pending_symbol_table_operations_) { |
| 500 | empty_pending_symbol_table_operations_ = |
| 501 | pending_symbol_table_operations_t(); |
| 502 | } |
| 503 | return *empty_pending_symbol_table_operations_; |
| 504 | } |