Skip to content

Commit

Permalink
Merge fd8f999 into c5eed0d
Browse files Browse the repository at this point in the history
  • Loading branch information
skyrich62 authored Apr 11, 2023
2 parents c5eed0d + fd8f999 commit 2a3a3ea
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions include/tao/pegtl/contrib/parse_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,10 @@ namespace tao::pegtl::parse_tree
template< typename ParseInput, typename... States >
static void start( const ParseInput& in, state< Node >& state, States&&... st )
{
Control< Rule >::start( in, st... );
state.emplace_back();
state.back()->template start< Rule >( in, st... );
auto& n = state.back()->children.back();
Control< Rule >::start( in, n, st... );
}

template< typename ParseInput, typename... States >
Expand All @@ -304,16 +305,20 @@ namespace tao::pegtl::parse_tree
transform< Selector< Rule > >( in, n, st... );
if( n ) {
state.back()->emplace_back( std::move( n ), st... );
Control< Rule >::success( in, state.back()->children.back(), st... );
}
else {
auto null_child = std::make_unique<Node>();
Control< Rule >::success( in, null_child, st... );
}
Control< Rule >::success( in, st... );
}

template< typename ParseInput, typename... States >
static void failure( const ParseInput& in, state< Node >& state, States&&... st )
{
state.back()->template failure< Rule >( in, st... );
Control< Rule >::failure( in, state.back()->children.back(), st... );
state.pop_back();
Control< Rule >::failure( in, st... );
}

template< typename ParseInput, typename... States >
Expand Down

0 comments on commit 2a3a3ea

Please sign in to comment.