mirror of
https://github.com/boostorg/regex.git
synced 2025-07-16 22:02:08 +02:00
Fixed Perl style formatting with \l and \u.
[SVN r37228]
This commit is contained in:
@ -75,7 +75,7 @@ class basic_regex_formatter
|
|||||||
public:
|
public:
|
||||||
typedef typename traits::char_type char_type;
|
typedef typename traits::char_type char_type;
|
||||||
basic_regex_formatter(OutputIterator o, const Results& r, const traits& t)
|
basic_regex_formatter(OutputIterator o, const Results& r, const traits& t)
|
||||||
: m_traits(t), m_results(r), m_out(o), m_state(output_copy), m_have_conditional(false) {}
|
: m_traits(t), m_results(r), m_out(o), m_state(output_copy), m_restore_state(output_copy), m_have_conditional(false) {}
|
||||||
OutputIterator format(const char_type* p1, const char_type* p2, match_flag_type f);
|
OutputIterator format(const char_type* p1, const char_type* p2, match_flag_type f);
|
||||||
OutputIterator format(const char_type* p1, match_flag_type f)
|
OutputIterator format(const char_type* p1, match_flag_type f)
|
||||||
{
|
{
|
||||||
@ -108,6 +108,7 @@ private:
|
|||||||
const char_type* m_end; // format string end
|
const char_type* m_end; // format string end
|
||||||
match_flag_type m_flags; // format flags to use
|
match_flag_type m_flags; // format flags to use
|
||||||
output_state m_state; // what to do with the next character
|
output_state m_state; // what to do with the next character
|
||||||
|
output_state m_restore_state; // what state to restore to.
|
||||||
bool m_have_conditional; // we are parsing a conditional
|
bool m_have_conditional; // we are parsing a conditional
|
||||||
private:
|
private:
|
||||||
basic_regex_formatter(const basic_regex_formatter&);
|
basic_regex_formatter(const basic_regex_formatter&);
|
||||||
@ -362,6 +363,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
|
|||||||
{
|
{
|
||||||
case 'l':
|
case 'l':
|
||||||
++m_position;
|
++m_position;
|
||||||
|
m_restore_state = m_state;
|
||||||
m_state = output_next_lower;
|
m_state = output_next_lower;
|
||||||
breakout = true;
|
breakout = true;
|
||||||
break;
|
break;
|
||||||
@ -372,6 +374,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
|
|||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
++m_position;
|
++m_position;
|
||||||
|
m_restore_state = m_state;
|
||||||
m_state = output_next_upper;
|
m_state = output_next_upper;
|
||||||
breakout = true;
|
breakout = true;
|
||||||
break;
|
break;
|
||||||
@ -495,11 +498,11 @@ void basic_regex_formatter<OutputIterator, Results, traits>::put(char_type c)
|
|||||||
return;
|
return;
|
||||||
case output_next_lower:
|
case output_next_lower:
|
||||||
c = m_traits.tolower(c);
|
c = m_traits.tolower(c);
|
||||||
this->m_state = output_copy;
|
this->m_state = m_restore_state;
|
||||||
break;
|
break;
|
||||||
case output_next_upper:
|
case output_next_upper:
|
||||||
c = m_traits.toupper(c);
|
c = m_traits.toupper(c);
|
||||||
this->m_state = output_copy;
|
this->m_state = m_restore_state;
|
||||||
break;
|
break;
|
||||||
case output_lower:
|
case output_lower:
|
||||||
c = m_traits.tolower(c);
|
c = m_traits.tolower(c);
|
||||||
|
Reference in New Issue
Block a user