Added support for \g \K and \R.

[SVN r52592]
This commit is contained in:
John Maddock
2009-04-25 17:32:49 +00:00
parent 7b10b5dac5
commit 30941e330d
42 changed files with 795 additions and 519 deletions

View File

@ -51,8 +51,8 @@ public:
template <class A>
void restore(match_results<BidiIterator, A>& w)
{
w.set_first(sub.first, index);
w.set_second(sub.second, index, sub.matched);
w.set_first(sub.first, index, index == 0);
w.set_second(sub.second, index, sub.matched, index == 0);
}
const sub_match<BidiIterator>& get() { return sub; }
};
@ -209,6 +209,17 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
break;
}
}
case -5:
{
// Reset start of $0, since we have a \K escape
backup_subex<BidiIterator> sub(*m_presult, 0);
m_presult->set_first(position, 0, true);
pstate = pstate->next.p;
r = match_all_states();
if(r == false)
sub.restore(*m_presult);
break;
}
default:
{
BOOST_ASSERT(index > 0);