Skip to content

Commit 1f5303c

Browse files
committed
When creating the context object in detail::skip(), don't create empty structs
for symbol table tries, since they are never used. Fixes #245
1 parent 41e891d commit 1f5303c

File tree

1 file changed

+45
-10
lines changed

1 file changed

+45
-10
lines changed

include/boost/parser/parser.hpp

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,23 @@ namespace boost { namespace parser {
513513
globals_(nope_or_address(globals))
514514
{}
515515

516+
parse_context(
517+
std::bool_constant<DoTrace>,
518+
std::bool_constant<UseCallbacks>,
519+
I & first,
520+
S last,
521+
bool & success,
522+
int & indent,
523+
ErrorHandler const & error_handler,
524+
GlobalState & globals) :
525+
first_(first),
526+
last_(last),
527+
pass_(std::addressof(success)),
528+
trace_indent_(std::addressof(indent)),
529+
error_handler_(std::addressof(error_handler)),
530+
globals_(nope_or_address(globals))
531+
{}
532+
516533
// With callbacks.
517534
parse_context(
518535
std::bool_constant<DoTrace>,
@@ -768,6 +785,33 @@ namespace boost { namespace parser {
768785
pending_symbol_table_operations);
769786
}
770787

788+
template<
789+
bool DoTrace,
790+
bool UseCallbacks,
791+
typename Iter,
792+
typename Sentinel,
793+
typename ErrorHandler>
794+
auto make_context(
795+
Iter first,
796+
Sentinel last,
797+
bool & success,
798+
int & indent,
799+
ErrorHandler const & error_handler,
800+
nope const & n,
801+
nope const &,
802+
nope const &) noexcept
803+
{
804+
return parse_context(
805+
std::bool_constant<DoTrace>{},
806+
std::bool_constant<UseCallbacks>{},
807+
first,
808+
last,
809+
success,
810+
indent,
811+
error_handler,
812+
n);
813+
}
814+
771815
template<
772816
bool DoTrace,
773817
bool UseCallbacks,
@@ -1519,17 +1563,8 @@ namespace boost { namespace parser {
15191563
int indent = 0;
15201564
rethrow_error_handler eh;
15211565
nope const n;
1522-
symbol_table_tries_t symbol_table_tries;
1523-
pending_symbol_table_operations_t pending_symbol_table_operations;
15241566
auto const context = detail::make_context<false, false>(
1525-
first,
1526-
last,
1527-
success,
1528-
indent,
1529-
eh,
1530-
n,
1531-
symbol_table_tries,
1532-
pending_symbol_table_operations);
1567+
first, last, success, indent, eh, n, n, n);
15331568
while (success) {
15341569
skip_(
15351570
first,

0 commit comments

Comments
 (0)