• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ match_state类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中match_state的典型用法代码示例。如果您正苦于以下问题:C++ match_state类的具体用法?C++ match_state怎么用?C++ match_state使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了match_state类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: match

        bool match(match_state<BidiIter> &state, Next const &next) const
        {
            if(state.eos())
            {
                return false;
            }

            char_type ch = *state.cur_;
            if(traits_cast<Traits>(state).isctype(ch, this->newline_))
            {
                ++state.cur_;
                if(this->cr_ == ch && !state.eos() && this->nl_ == *state.cur_)
                {
                    ++state.cur_;
                    if(next.match(state))
                    {
                        return true;
                    }
                    --state.cur_;
                }
                else if(next.match(state))
                {
                    return true;
                }

                --state.cur_;
            }
            return false;
        }
开发者ID:rogerclark,项目名称:grumble,代码行数:29,代码来源:logical_newline_matcher.hpp


示例2: match

        bool match(match_state<BidiIter> &state, Next const &next) const
        {
            if(state.bos())
            {
                if(!state.flags_.match_bol_)
                {
                    return false;
                }
            }
            else
            {
                char_type ch = *boost::prior(state.cur_);

                // If the previous character is not a newline, we're not at the start of a line
                if(!traits_cast<Traits>(state).isctype(ch, this->newline_))
                {
                    return false;
                }
                // There is no line-break between \r and \n
                else if(ch == this->cr_ && !state.eos() && *state.cur_ == this->nl_)
                {
                    return false;
                }
            }

            return next.match(state);
        }
开发者ID:BioinformaticsArchive,项目名称:MulRFRepo,代码行数:27,代码来源:assert_bol_matcher.hpp


示例3: match

        bool match(match_state<BidiIter> &state, Next const &next) const
        {
            BOOST_ASSERT(this->mark_number_ < static_cast<int>(state.mark_count_));
            sub_match_impl<BidiIter> const &br = state.sub_match(this->mark_number_);

            if(!br.matched)
            {
                return false;
            }

            BidiIter const tmp = state.cur_;
            for(BidiIter begin = br.first, end = br.second; begin != end; ++begin, ++state.cur_)
            {
                if(state.eos()
                    || detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type())
                    != detail::translate(*begin, traits_cast<Traits>(state), icase_type()))
                {
                    state.cur_ = tmp;
                    return false;
                }
            }

            if(next.match(state))
            {
                return true;
            }

            state.cur_ = tmp;
            return false;
        }
开发者ID:GDXN,项目名称:fitsliberator,代码行数:30,代码来源:mark_matcher.hpp


示例4: matched_wild_p

static bool
matched_wild_p( const wildcard_ &pattern, match_state &mm )
{
  unsigned pid = pattern.id();
  auto it = mm.find( pid );

  return it != mm.end() && it->first == pid;
}
开发者ID:cjgillot,项目名称:mycas,代码行数:8,代码来源:match.cpp


示例5: match

        bool match(match_state<BidiIter> &state, Next const &next) const
        {
            BidiIter cur = state.cur_;
            bool const thisword = !state.eos() && this->is_word(traits_cast<Traits>(state), *cur);
            bool const prevword = (!state.bos() || state.flags_.match_prev_avail_)
                && this->is_word(traits_cast<Traits>(state), *--cur);

            return Cond::eval(prevword, thisword, state) && next.match(state);
        }
开发者ID:03050903,项目名称:turbulenz_engine,代码行数:9,代码来源:assert_word_matcher.hpp


示例6: match_wild

static bool
match_wild( const basic &self, const wildcard_ &pattern, match_state &mm )
{
  unsigned pid = pattern.id();
  {
    auto it = mm.find( pid );

    if( it != mm.end() && it->first == pid )
      // already matched somewhere
      return expr::compare( &self, it->second ) == 0;
  }

  mm.push_state( pid, &self );
  return true;
}
开发者ID:cjgillot,项目名称:mycas,代码行数:15,代码来源:match.cpp


示例7: is_line_break

            bool is_line_break(match_state<BidiIter> &state) const
        {
            BOOST_ASSERT(!state.bos() || state.flags_.match_prev_avail_);
            BidiIter tmp = state.cur_;
            char_type ch = *--tmp;

            if(traits_cast<Traits>(state).isctype(ch, this->newline_))
            {
                // there is no line-break between \r and \n
                if(this->cr_ != ch || state.eos() || this->nl_ != *state.cur_)
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:GDXN,项目名称:fitsliberator,代码行数:17,代码来源:assert_line_base.hpp


示例8: match

        bool match(match_state<BidiIter> &state, Next const &next) const
        {
            if(!state.eos() && !this->can_match_(*state.cur_, traits_cast<Traits>(state)))
            {
                return false;
            }

            return detail::alt_match(this->alternates_, state, next);
        }
开发者ID:AsherBond,项目名称:PDAL,代码行数:9,代码来源:alternate_matcher.hpp


示例9: eval

        static bool eval(bool prevword, bool thisword, match_state<BidiIter> &state)
        {
            if((state.flags_.match_not_bow_ && state.bos()) || (state.flags_.match_not_eow_ && state.eos()))
            {
                return !IsBoundary::value;
            }

            return IsBoundary::value == (prevword != thisword);
        }
开发者ID:03050903,项目名称:turbulenz_engine,代码行数:9,代码来源:assert_word_matcher.hpp


示例10: match

        static bool match(match_state<BidiIter> &state, Next const &)
        {
            BidiIter const tmp = state.cur_;
            sub_match_impl<BidiIter> &s0 = state.sub_match(0);
            BOOST_ASSERT(!s0.matched);

            // SPECIAL: if there is a match context on the context stack, then
            // this pattern has been nested within another. pop that context and
            // continue executing.
            if(0 != state.context_.prev_context_)
            {
                if(!pop_context_match(state))
                {
                    return false;
                }

                // record the end of sub-match zero
                s0.first = s0.begin_;
                s0.second = tmp;
                s0.matched = true;

                return true;
            }
            else if((state.flags_.match_all_ && !state.eos()) ||
                    (state.flags_.match_not_null_ && state.cur_ == s0.begin_))
            {
                return false;
            }

            // record the end of sub-match zero
            s0.first = s0.begin_;
            s0.second = tmp;
            s0.matched = true;

            // Now execute any actions that have been queued
            for(actionable const *actor = state.action_list_.next; 0 != actor; actor = actor->next)
            {
                actor->execute(state.action_args_);
            }

            return true;
        }
开发者ID:13W,项目名称:icq-desktop,代码行数:42,代码来源:end_matcher.hpp


示例11: operator

    bool operator ()(match_state<BidiIter> &state) const
    {
        if(state.bos() && state.flags_.match_bol_)
        {
            return true;
        }

        BidiIter cur = state.cur_;
        BidiIter const end = state.end_;
        std::advance(cur, static_cast<diff_type>(-!state.bos()));

        for(; cur != end; ++cur)
        {
            if(this->bits_[static_cast<unsigned char>(*cur)])
            {
                state.cur_ = ++cur;
                return true;
            }
        }

        return false;
    }
开发者ID:Axitonium,项目名称:sourcesdkpython,代码行数:22,代码来源:finder.hpp


示例12: match

    bool match(match_state<BidiIter> &state, Next const &next) const
    {
        if(state.eos() || this->not_ == this->in_set(traits_cast<Traits>(state), *state.cur_))
        {
            return false;
        }

        if(++state.cur_, next.match(state))
        {
            return true;
        }

        return --state.cur_, false;
    }
开发者ID:rogerclark,项目名称:grumble,代码行数:14,代码来源:set_matcher.hpp


示例13: match_next

    inline bool match_next(match_state<BidiIter> &state, Next const &next, int mark_number)
    {
        sub_match_impl<BidiIter> &br = state.sub_match(mark_number);

        bool old_matched = br.matched;
        br.matched = false;

        if(next.match(state))
        {
            return true;
        }

        br.matched = old_matched;
        return false;
    }
开发者ID:GDXN,项目名称:fitsliberator,代码行数:15,代码来源:optional_matcher.hpp


示例14: 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;
        }
开发者ID:AsherBond,项目名称:PDAL,代码行数:17,代码来源:literal_matcher.hpp


示例15: 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;
        }
开发者ID:rogerclark,项目名称:grumble,代码行数:17,代码来源:range_matcher.hpp


示例16: match

        bool match(match_state<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;
        }
开发者ID:GDXN,项目名称:fitsliberator,代码行数:17,代码来源:posix_charset_matcher.hpp


示例17: match

        bool match(match_state<BidiIter> &state, Next const &next) const
        {
            // prevent repeated zero-width sub-matches from causing infinite recursion
            sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);

            if(br.zero_width_ && br.begin_ == state.cur_)
            {
                return next.skip_match(state);
            }

            bool old_zero_width = br.zero_width_;
            br.zero_width_ = (br.begin_ == state.cur_);

            if(this->match_(state, next, greedy_type()))
            {
                return true;
            }

            br.zero_width_ = old_zero_width;
            return false;
        }
开发者ID:rogerclark,项目名称:grumble,代码行数:21,代码来源:repeat_end_matcher.hpp


示例18: match_

        bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
        {
            sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);

            if(this->max_ > br.repeat_count_)
            {
                ++br.repeat_count_;
                // loop back to the expression "pushed" in repeat_begin_matcher::match
                if(next.top_match(state, this->back_))
                {
                    return true;
                }
                else if(--br.repeat_count_ < this->min_)
                {
                    return false;
                }
            }

            // looping finished, continue matching the rest of the pattern
            return next.skip_match(state);
        }
开发者ID:rogerclark,项目名称:grumble,代码行数:21,代码来源:repeat_end_matcher.hpp


示例19: match

        bool match(match_state<BidiIter> &state, Next const &next) const
        {
            sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);

            unsigned int old_repeat_count = br.repeat_count_;
            bool old_zero_width = br.zero_width_;

            br.repeat_count_ = 1;
            br.zero_width_ = false;

            // "push" next onto the stack, so it can be "popped" in
            // repeat_end_matcher and used to loop back.
            if(next.BOOST_NESTED_TEMPLATE push_match<Next>(state))
            {
                return true;
            }

            br.repeat_count_ = old_repeat_count;
            br.zero_width_ = old_zero_width;

            return false;
        }
开发者ID:13W,项目名称:icq-desktop,代码行数:22,代码来源:repeat_begin_matcher.hpp


示例20: 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;
        }
开发者ID:AsherBond,项目名称:PDAL,代码行数:22,代码来源:string_matcher.hpp



注:本文中的match_state类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ math类代码示例发布时间:2022-05-31
下一篇:
C++ match_results类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap