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


C# Context.Pop方法代码示例

本文整理汇总了C#中Context.Pop方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Pop方法的具体用法?C# Context.Pop怎么用?C# Context.Pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Context的用法示例。


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

示例1: MatchNext

        public override bool MatchNext(Context context)
        {
            // Pull the starting state back off the stack and restore
            // the state of the matching context
            int key = context.Pop();
            int offset = context.Pop();

            context.RestoreCaptures(key);
            context.offset = offset;

            return false;
        }
开发者ID:TheFellow,项目名称:RegexLib,代码行数:12,代码来源:Atomic.cs

示例2: MatchNext

        public bool MatchNext(Context context)
        {
            // Restore the previous offset
            int offset = context.Pop();
            context.offset = offset;

            return false;
        }
开发者ID:TheFellow,项目名称:RegexLib,代码行数:8,代码来源:Backreference.cs

示例3: MatchNext

        public override bool MatchNext(Context context)
        {
            // Restore the captures (removing anything we captured
            // during the assertion) and fail
            int maxKey = context.Pop();
            context.RestoreCaptures(maxKey);

            return false;
        }
开发者ID:TheFellow,项目名称:RegexLib,代码行数:9,代码来源:Lookaround.cs

示例4: MatchNext

        public override bool MatchNext(Context context)
        {
            var ci = context.Pop(groupId);

            bool result = matchItem.MatchNext(context);

            if (result)
                context.Push(ci.beg, context.offset, groupId);

            return result;
        }
开发者ID:TheFellow,项目名称:RegexLib,代码行数:11,代码来源:CaptureGroup.cs

示例5: MatchNext

        public override bool MatchNext(Context context)
        {
            // Pop off how many matches we've actually made.
            int count = context.Pop();

            // If we have not reached the maximum iterations and
            // can match again, that's what we'll do.
            if (count < max && matchItem.Match(context))
            {
                // Save state and succeed
                context.Push(++count);
                return true;
            }

            // Current iteration of the token failed, try alternatives
            // backwards through the previously matched iterations
            while (count > 0)
            {
                // If we find an alternative match then save state and exit
                if (matchItem.MatchNext(context))
                {
                    context.Push(count);
                    return true;
                }

                // Alternative failed, go back to a previous iteration
                count--;
            }

            // At this point count == 0 so we have no other options
            // We have to try backtracking into the base behavior.
            // If that fails we're out of options.
            if (!base.MatchNext(context))
                return false;

            // We've successfully matched at the base level.
            // Behave lazily by saving this state and succeeding
            context.Push(0);
            return true;
        }
开发者ID:TheFellow,项目名称:RegexLib,代码行数:40,代码来源:Lazy.cs


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