Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cmazakas committed Nov 1, 2024
1 parent 6567738 commit 0c93a55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
26 changes: 4 additions & 22 deletions include/boost/regex/v5/perl_matcher_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,32 +591,14 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_backref()
}while((r.first != r.second) && ((*m_presult)[index].matched != true));
}

if((m_match_flags & match_perl) && !(*m_presult)[index].matched){
if((m_match_flags & match_perl) && !(*m_presult)[index].matched)
return false;
}

auto const& submatch = (*m_presult)[index];
BidiIterator i = submatch.get_first();
BidiIterator j = submatch.get_second();

{
auto ic = i;
auto jc = j;
auto curr = 0;
while(ic != jc) {
++ic;
if(++curr >= 5000) {
boost::throw_exception(std::runtime_error("lmao no way bro, it's over"));
}
}
}

BidiIterator i = (*m_presult)[index].first;
BidiIterator j = (*m_presult)[index].second;
while(i != j)
{
if((position == last))
return false;

if((traits_inst.translate(*position, icase) != traits_inst.translate(*i, icase)))
if((position == last) || (traits_inst.translate(*position, icase) != traits_inst.translate(*i, icase)))
return false;
++i;
++position;
Expand Down
2 changes: 2 additions & 0 deletions include/boost/regex/v5/perl_matcher_non_recursive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,8 @@ bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index,
else if(pstate->type == syntax_element_startmark)
{
int idx = static_cast<const re_brace*>(pstate)->index;
if( idx == -5 )
match_startmark();
pstate = pstate->next.p;
skip_until_paren(idx, false);
continue;
Expand Down
2 changes: 1 addition & 1 deletion test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ compile test_windows_defs_3.cpp ;
compile test_windows_defs_4.cpp ;

run issue153.cpp : : : "<toolset>msvc:<linkflags>-STACK:2097152" ;
# run issue227.cpp ;
run issue227.cpp ;

0 comments on commit 0c93a55

Please sign in to comment.