本文整理汇总了C++中Next::match方法的典型用法代码示例。如果您正苦于以下问题:C++ Next::match方法的具体用法?C++ Next::match怎么用?C++ Next::match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Next
的用法示例。
在下文中一共展示了Next::match方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
if(state.eos() || Not::value ==
(detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type()) == this->ch_))
{
return false;
}
++state.cur_;
if(next.match(state))
{
return true;
}
--state.cur_;
return false;
}
示例2: match
bool match(state_type<BidiIter> &state, Next const &next) const
{
if(state.eos() || this->not_ == traits_cast<Traits>(state).isctype(
*state.cur_, this->mask_))
{
return false;
}
++state.cur_;
if(next.match(state))
{
return true;
}
--state.cur_;
return false;
}
示例3: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
if(state.eos() || this->not_ ==
this->in_range(traits_cast<Traits>(state), *state.cur_, icase_type()))
{
return false;
}
++state.cur_;
if(next.match(state))
{
return true;
}
--state.cur_;
return false;
}
示例4: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
BidiIter tmp = state.cur_;
char_translate<Traits, ICase::value> trans(traits_cast<Traits>(state));
result_type const &result = this->sym_(state.cur_, state.end_, trans);
if(result)
{
void const *old_slot = state.attr_context_.attr_slots_[this->slot_];
state.attr_context_.attr_slots_[this->slot_] = &*result;
if(next.match(state))
{
return true;
}
state.attr_context_.attr_slots_[this->slot_] = old_slot;
}
state.cur_ = tmp;
return false;
}
示例5: match_
bool match_(match_state<BidiIter> &state, Next const &next, greedy_slow_tag) const
{
int const diff = -static_cast<int>(Xpr::width == unknown_width::value ? this->width_ : Xpr::width);
unsigned int matches = 0;
BidiIter const tmp = state.cur_;
// greedily match as much as we can
while(matches < this->max_ && this->xpr_.match(state))
{
++matches;
}
// If this repeater is at the front of the pattern, note
// how much of the input we consumed so that a repeated search
// doesn't have to cover the same ground again.
if(this->leading_)
{
state.next_search_ = (matches && matches < this->max_)
? state.cur_
: (tmp == state.end_) ? tmp : boost::next(tmp);
}
if(this->min_ > matches)
{
state.cur_ = tmp;
return false;
}
// try matching the rest of the pattern, and back off if necessary
for(; ; --matches, std::advance(state.cur_, diff))
{
if(next.match(state))
{
return true;
}
else if(this->min_ == matches)
{
state.cur_ = tmp;
return false;
}
}
}
示例6: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
BidiIter const tmp = state.cur_;
char_type const *begin = detail::data_begin(this->str_);
for(; begin != this->end_; ++begin, ++state.cur_)
{
if(state.eos() ||
(detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type()) != *begin))
{
state.cur_ = tmp;
return false;
}
}
if(next.match(state))
{
return true;
}
state.cur_ = tmp;
return false;
}
示例7: match
bool match(state_type<BidiIter> &state, Next const &next) const
{
sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
BidiIter old_first = br.first;
BidiIter old_second = br.second;
bool old_matched = br.matched;
br.first = br.begin_;
br.second = state.cur_;
br.matched = true;
if(next.match(state))
{
return true;
}
br.first = old_first;
br.second = old_second;
br.matched = old_matched;
return false;
}
示例8: match_
bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const // Non-greedy
{
return next.match(state)
|| this->xpr_.BOOST_NESTED_TEMPLATE push_match<Next>(state);
}
示例9: match
static bool match(state_type<BidiIter> &state, Next const &next)
{
return state.eos() && next.match(state);
}