From c233f066542a6eed2b39b79540a4a0856877e0b4 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 8 Apr 2003 11:33:13 +0000 Subject: [PATCH] Fixed buglet in independent subs Added more independent sub test cases [SVN r18207] --- include/boost/regex/v4/regex_compile.hpp | 7 ++++++- test/regress/tests.txt | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/boost/regex/v4/regex_compile.hpp b/include/boost/regex/v4/regex_compile.hpp index 8dc3f209..2fe1f14f 100644 --- a/include/boost/regex/v4/regex_compile.hpp +++ b/include/boost/regex/v4/regex_compile.hpp @@ -593,8 +593,13 @@ bool BOOST_REGEX_CALL reg_expression::probe_start_null { switch(node->type) { - case re_detail::syntax_element_startmark: case re_detail::syntax_element_endmark: + if(static_cast(node)->index == -3) + { + return true; + } + // fall through: + case re_detail::syntax_element_startmark: case re_detail::syntax_element_start_line: case re_detail::syntax_element_word_boundary: case re_detail::syntax_element_buffer_start: diff --git a/test/regress/tests.txt b/test/regress/tests.txt index 8cc6e2c1..0ae474d6 100644 --- a/test/regress/tests.txt +++ b/test/regress/tests.txt @@ -1146,6 +1146,7 @@ a()b\1 ab 0 2 1 1 ^((?>\w+)|(?>\s+))*$ "this is not a line with only words and spaces!" -1 -1 ((?>\d+))(\w) 12345a 0 6 0 5 5 6 ((?>\d+))(\w) 12345+ -1 -1 +((?>\d+))(\d) 12345 -1 -1 (?>a+)b aaab 0 4 ((?>a+)b) aaab 0 4 0 4 (?>(a+))b aaab 0 4 0 3 @@ -1164,5 +1165,11 @@ a()b\1 ab 0 2 1 1 ((?>a*))* aabbaa 0 2 2 2 ((?>a*?))* aaaaa 0 0 0 0 ((?>a*?))* aabbaa 0 0 0 0 +"word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword" "word cat dog elephant mussel cow horse canary baboon snake shark otherword" 0 74 +"word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword" "word cat dog elephant mussel cow horse canary baboon snake shark" -1 -1 +"word (?>[a-zA-Z0-9]+ ){0,30}otherword" "word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope" -1 -1 +"word (?>[a-zA-Z0-9]+ ){0,30}otherword" "word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I really really hope otherword" -1 -1 +((?>Z)+|A)* ZABCDEFG 0 2 1 2 +((?>)+|A)* !