当前位置: 首页>>代码示例>>C++>>正文


C++ match_state类代码示例

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


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


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