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


C# ParseNode.Complete方法代码示例

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


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

示例1: ParserState

 /// <summary>
 /// Constructs a parser state, that manages a pointer to the text.
 /// </summary>
 /// <param name="text"></param>
 public ParserState(string text)
 {
     this.text = text;
     ParseNode root = new ParseNode(null, null, text, 0);
     root.Complete(text.Length);
     nodes.Push(root);
 }
开发者ID:gtpk,项目名称:cpp-ripper,代码行数:11,代码来源:ParseState.cs

示例2: ParserState

 /// <summary>
 /// Constructs a parser state, that manages a pointer to the text.
 /// </summary>
 /// <param name="text"></param>
 public ParserState(string text)
 {
     CreateNodes = true;
     _text = text;
     var root = new ParseNode(null, null, text, 0);
     root.Complete(text.Length);
     _nodes.Push(root);
 }
开发者ID:andy-uq,项目名称:TinyOS,代码行数:12,代码来源:ParseState.cs

示例3: Match

        /// <summary>
        /// This is the work-horse function. It attempts to match a rule
        /// by calling the rule's specialized "InternalMatch()" function. 
        /// If the match is successful, a node is created and added to the 
        /// the parser tree managed by ParserState. 
        /// If the match fails, then no node is created (technically 
        /// the node was already created, and just gets deleted) and the 
        /// ParserState index is returned to its original location.
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public virtual bool Match(ParserState p)
        {
            int old_index = p.index;

            if (p.CreateNodes && !(this is SkipRule))
            {

                ParseNode node = new ParseNode(this, p.Peek(), p.text, old_index);
                p.Push(node);
                if (InternalMatch(p))
                {
                    node.Complete(p.index);
                    p.Pop();
                    return true;
                }
                else
                {
                    p.index = old_index;
                    node = null;
                    p.Pop();
                    return false;
                }
            }
            else
            {
                if (InternalMatch(p))
                {
                    return true;
                }
                else
                {
                    p.index = old_index;
                    return false;
                }
            }
        }
开发者ID:feixhan,项目名称:AutoGenrate,代码行数:47,代码来源:Rule.cs

示例4: InternalMatch

 protected override bool InternalMatch(ParserState p)
 {
     ParseNode node = new ParseNode(this, p.Peek(), p.text, p.index);
     p.Push(node);
     if (rules[0].Match(p))
     {
         node.Complete(p.index);
         p.Pop();
         return true;
     }
     else
     {
         node = null;
         p.Pop();
         return false;
     }
 }
开发者ID:gtpk,项目名称:cpp-ripper,代码行数:17,代码来源:Rule.cs


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