Skip to content

Commit 9a8d2b1

Browse files
authored
Tentative fix for #227. (#230)
Fixes #227.
1 parent bd0e76f commit 9a8d2b1

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

include/boost/regex/v5/perl_matcher_non_recursive.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,10 @@ bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index,
12041204
else if(pstate->type == syntax_element_startmark)
12051205
{
12061206
int idx = static_cast<const re_brace*>(pstate)->index;
1207-
pstate = pstate->next.p;
1207+
if(idx > 0)
1208+
match_startmark();
1209+
else
1210+
pstate = pstate->next.p;
12081211
skip_until_paren(idx, false);
12091212
continue;
12101213
}

test/Jamfile.v2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,4 @@ compile test_windows_defs_3.cpp ;
135135
compile test_windows_defs_4.cpp ;
136136

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

test/issue227.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2024
3+
* Christian Mazakas
4+
*
5+
* Use, modification and distribution are subject to the
6+
* Boost Software License, Version 1.0. (See accompanying file
7+
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8+
*
9+
*/
10+
11+
#include <boost/regex.hpp>
12+
#include <string>
13+
14+
int main() {
15+
boost::regex rx("(*ACCEPT)*+\\1((*ACCEPT)*+\\K)");
16+
std::string str = "Z";
17+
boost::smatch what;
18+
boost::regex_search(str, what, rx, boost::match_default | boost::match_partial);
19+
}

0 commit comments

Comments
 (0)