summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp')
-rw-r--r--3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp86
1 files changed, 61 insertions, 25 deletions
diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp
index 72dc4ee..2757898 100644
--- a/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp
+++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp
@@ -369,7 +369,7 @@ bool basic_regex_parser<charT, traits>::parse_extended()
while((m_position != m_end) && !is_separator(*m_position++)){}
return true;
}
- // Otherwise fall through:
+ BOOST_FALLTHROUGH;
default:
result = parse_literal();
break;
@@ -623,7 +623,7 @@ bool basic_regex_parser<charT, traits>::parse_basic_escape()
{
case 'w':
negate = false;
- // fall through:
+ BOOST_FALLTHROUGH;
case 'W':
{
basic_char_set<charT, traits> char_set;
@@ -640,7 +640,7 @@ bool basic_regex_parser<charT, traits>::parse_basic_escape()
}
case 's':
negate = false;
- // fall through:
+ BOOST_FALLTHROUGH;
case 'S':
return add_emacs_code(negate);
case 'c':
@@ -672,7 +672,7 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape()
{
case regex_constants::escape_type_not_class:
negate = true;
- // fall through:
+ BOOST_FALLTHROUGH;
case regex_constants::escape_type_class:
{
escape_type_class_jump:
@@ -742,7 +742,7 @@ escape_type_class_jump:
break;
case regex_constants::escape_type_not_property:
negate = true;
- // fall through:
+ BOOST_FALLTHROUGH;
case regex_constants::escape_type_property:
{
++m_position;
@@ -901,7 +901,7 @@ escape_type_class_jump:
case regex_constants::escape_type_control_v:
if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
goto escape_type_class_jump;
- // fallthrough:
+ BOOST_FALLTHROUGH;
default:
this->append_literal(unescape_character());
break;
@@ -971,7 +971,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
// the last state was a literal with more than one character, split it in two:
re_literal* lit = static_cast<re_literal*>(this->m_last_state);
charT c = (static_cast<charT*>(static_cast<void*>(lit+1)))[lit->length - 1];
- --(lit->length);
+ lit->length -= 1;
// now append new state:
lit = static_cast<re_literal*>(this->append_state(syntax_element_literal, sizeof(re_literal) + sizeof(charT)));
lit->length = 1;
@@ -1070,26 +1070,46 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
// skip whitespace:
while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
++m_position;
- // fail if at end:
if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
- return false;
+ if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex))
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
+ return false;
+ }
+ // Treat the opening '{' as a literal character, rewind to start of error:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position;
+ return parse_literal();
}
// get min:
v = this->m_traits.toi(m_position, m_end, 10);
// skip whitespace:
- while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
- ++m_position;
if(v < 0)
{
- fail(regex_constants::error_badbrace, this->m_position - this->m_base);
- return false;
+ if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex))
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
+ return false;
+ }
+ // Treat the opening '{' as a literal character, rewind to start of error:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position;
+ return parse_literal();
}
- else if(this->m_position == this->m_end)
+ while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
+ ++m_position;
+ if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
- return false;
+ if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex))
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
+ return false;
+ }
+ // Treat the opening '{' as a literal character, rewind to start of error:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position;
+ return parse_literal();
}
min = v;
// see if we have a comma:
@@ -1102,12 +1122,19 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
++m_position;
if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
- return false;
+ if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex))
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
+ return false;
+ }
+ // Treat the opening '{' as a literal character, rewind to start of error:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position;
+ return parse_literal();
}
// get the value if any:
v = this->m_traits.toi(m_position, m_end, 10);
- max = (v >= 0) ? v : (std::numeric_limits<std::size_t>::max)();
+ max = (v >= 0) ? (std::size_t)v : (std::numeric_limits<std::size_t>::max)();
}
else
{
@@ -1120,8 +1147,15 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
// OK now check trailing }:
if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
- return false;
+ if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex))
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
+ return false;
+ }
+ // Treat the opening '{' as a literal character, rewind to start of error:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position;
+ return parse_literal();
}
if(isbasic)
{
@@ -1144,8 +1178,10 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
++m_position;
else
{
- fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
- return false;
+ // Treat the opening '{' as a literal character, rewind to start of error:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position;
+ return parse_literal();
}
//
// finally go and add the repeat, unless error:
@@ -1959,7 +1995,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
{
case regex_constants::syntax_or:
m_mark_reset = m_mark_count;
- // fall through:
+ BOOST_FALLTHROUGH;
case regex_constants::syntax_colon:
//
// a non-capturing mark: