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


C# ITreeAdaptor类代码示例

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


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

示例1: TreePatternParser

 public TreePatternParser( TreePatternLexer tokenizer, TreeWizard wizard, ITreeAdaptor adaptor )
 {
     this.tokenizer = tokenizer;
     this.wizard = wizard;
     this.adaptor = adaptor;
     ttype = tokenizer.NextToken(); // kickstart
 }
开发者ID:sebasjm,项目名称:antlr,代码行数:7,代码来源:TreePatternParser.cs

示例2: EqualsCore

 protected static bool EqualsCore(object t1, object t2, ITreeAdaptor adaptor)
 {
     if ((t1 == null) || (t2 == null))
     {
         return false;
     }
     if (adaptor.GetType(t1) != adaptor.GetType(t2))
     {
         return false;
     }
     if (!adaptor.GetText(t1).Equals(adaptor.GetText(t2)))
     {
         return false;
     }
     int childCount = adaptor.GetChildCount(t1);
     int num2 = adaptor.GetChildCount(t2);
     if (childCount != num2)
     {
         return false;
     }
     for (int i = 0; i < childCount; i++)
     {
         object child = adaptor.GetChild(t1, i);
         object obj3 = adaptor.GetChild(t2, i);
         if (!EqualsCore(child, obj3, adaptor))
         {
             return false;
         }
     }
     return true;
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:31,代码来源:TreeWizard.cs

示例3: InContext

        /// <summary>
        /// The worker for <see cref="InContext(TreeParser, string)"/>. It's <see langword="static"/> and full of
        /// parameters for testing purposes.
        /// </summary>
        private static bool InContext(
            ITreeAdaptor adaptor,
            string[] tokenNames,
            object t,
            string context)
        {
            if (Regex.IsMatch(context, DotDot))
            {
                // don't allow "..", must be "..."
                throw new ArgumentException("invalid syntax: ..");
            }

            if (Regex.IsMatch(context, DoubleEtc))
            {
                // don't allow double "..."
                throw new ArgumentException("invalid syntax: ... ...");
            }

            context = context.Replace("...", " ... "); // ensure spaces around ...
            context = context.Trim();
            string[] nodes = context.Split(new[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            int ni = nodes.Length - 1;
            t = adaptor.GetParent(t);
            while (ni >= 0 && t != null)
            {
                if (nodes[ni].Equals("..."))
                {
                    // walk upwards until we see nodes[ni-1] then continue walking
                    if (ni == 0)
                    {
                        // ... at start is no-op
                        return true;
                    }

                    string goal = nodes[ni - 1];
                    object ancestor = GetAncestor(adaptor, tokenNames, t, goal);
                    if (ancestor == null)
                        return false;

                    t = ancestor;
                    ni--;
                }

                string name = tokenNames[adaptor.GetType(t)];
                if (!name.Equals(nodes[ni]))
                {
                    //System.Console.Error.WriteLine("not matched: " + nodes[ni] + " at " + t);
                    return false;
                }

                // advance to parent and to previous element in context node list
                ni--;
                t = adaptor.GetParent(t);
            }

            if (t == null && ni >= 0)
                return false; // at root but more nodes to match
            return true;
        }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:63,代码来源:TreeParserExtensions.cs

示例4: TreeViewModel

        public TreeViewModel(ITreeAdaptor adaptor, object tree)
        {
            if (adaptor == null)
                throw new ArgumentNullException("adaptor");
            if (tree == null)
                throw new ArgumentNullException("tree");

            _adaptor = adaptor;
            _tree = tree;
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:10,代码来源:TreeViewModel.cs

示例5: Concatenate_Depth2_Subtree_Name

        // Private interface
        private static string Concatenate_Depth2_Subtree_Name( ITreeAdaptor tree_adapter, object node )
        {
            StringBuilder builder = new StringBuilder();

            builder.Append( tree_adapter.GetText( node ) );

            for ( int i = 0; i < tree_adapter.GetChildCount( node ); i++ )
            {
                object child_node = tree_adapter.GetChild( node, i );
                builder.Append( tree_adapter.GetText( child_node ) );
            }

            return builder.ToString();
        }
开发者ID:bretambrose,项目名称:CCGOnlinePublic,代码行数:15,代码来源:EnumASTUtils.cs

示例6: TreeVisualizerViewModel

        public TreeVisualizerViewModel(ITreeAdaptor adaptor, object tree, ITokenStream tokenStream, string sourceText)
        {
            if (adaptor == null)
                throw new ArgumentNullException("adaptor");
            if (tree == null)
                throw new ArgumentNullException("tree");

            _adaptor = adaptor;
            _tree = tree;
            _tokenStream = tokenStream;
            _sourceText = sourceText;

            object root = adaptor.Nil();
            adaptor.AddChild(root, tree);
            _treeViewModel = new TreeViewModel(_adaptor, root);
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:16,代码来源:TreeVisualizerViewModel.cs

示例7: DefineNodes

 protected virtual IEnumerable<string> DefineNodes(object tree, ITreeAdaptor adaptor)
 {
     if (tree != null)
     {
         int childCount = adaptor.GetChildCount(tree);
         if (childCount != 0)
         {
             yield return this.GetNodeText(adaptor, tree);
             for (int i = 0; i < childCount; i++)
             {
                 object child = adaptor.GetChild(tree, i);
                 yield return this.GetNodeText(adaptor, child);
                 foreach (string iteratorVariable3 in this.DefineNodes(child, adaptor))
                 {
                     yield return iteratorVariable3;
                 }
             }
         }
     }
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:20,代码来源:DotTreeGenerator.cs

示例8: DefineEdges

 protected virtual IEnumerable<string> DefineEdges(object tree, ITreeAdaptor adaptor)
 {
     if (tree != null)
     {
         int childCount = adaptor.GetChildCount(tree);
         if (childCount != 0)
         {
             string iteratorVariable1 = "n" + this.GetNodeNumber(tree);
             string text = adaptor.GetText(tree);
             for (int i = 0; i < childCount; i++)
             {
                 object child = adaptor.GetChild(tree, i);
                 string iteratorVariable5 = adaptor.GetText(child);
                 string iteratorVariable6 = "n" + this.GetNodeNumber(child);
                 yield return string.Format("  {0} -> {1} // \"{2}\" -> \"{3}\"", new object[] { iteratorVariable1, iteratorVariable6, this.FixString(text), this.FixString(iteratorVariable5) });
                 foreach (string iteratorVariable7 in this.DefineEdges(child, adaptor))
                 {
                     yield return iteratorVariable7;
                 }
             }
         }
     }
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:23,代码来源:DotTreeGenerator.cs

示例9: TreeWizard

 public TreeWizard( ITreeAdaptor adaptor, IDictionary<string, int> tokenNameToTypeMap )
 {
     this.adaptor = adaptor;
     this.tokenNameToTypeMap = tokenNameToTypeMap;
 }
开发者ID:ksmyth,项目名称:antlr,代码行数:5,代码来源:TreeWizard.cs

示例10: RewriteRuleNodeStream

		/// <summary>Create a stream, but feed off an existing list</summary>
		public RewriteRuleNodeStream(
			ITreeAdaptor adaptor,
			string elementDescription,
            IList<object> elements
		) : base(adaptor, elementDescription, elements) {
		}
开发者ID:EightPillars,项目名称:PathwayEditor,代码行数:7,代码来源:RewriteRuleNodeStream.cs

示例11: _Equals

 protected static bool _Equals( object t1, object t2, ITreeAdaptor adaptor )
 {
     // make sure both are non-null
     if ( t1 == null || t2 == null )
     {
         return false;
     }
     // check roots
     if ( adaptor.GetType( t1 ) != adaptor.GetType( t2 ) )
     {
         return false;
     }
     if ( !adaptor.GetText( t1 ).Equals( adaptor.GetText( t2 ) ) )
     {
         return false;
     }
     // check children
     int n1 = adaptor.GetChildCount( t1 );
     int n2 = adaptor.GetChildCount( t2 );
     if ( n1 != n2 )
     {
         return false;
     }
     for ( int i = 0; i < n1; i++ )
     {
         object child1 = adaptor.GetChild( t1, i );
         object child2 = adaptor.GetChild( t2, i );
         if ( !_Equals( child1, child2, adaptor ) )
         {
             return false;
         }
     }
     return true;
 }
开发者ID:ksmyth,项目名称:antlr,代码行数:34,代码来源:TreeWizard.cs

示例12: RewriteRuleElementStream

 public RewriteRuleElementStream( ITreeAdaptor adaptor, string elementDescription )
 {
     this.elementDescription = elementDescription;
     this.adaptor = adaptor;
 }
开发者ID:EightPillars,项目名称:PathwayEditor,代码行数:5,代码来源:RewriteRuleElementStream.cs

示例13: RewriteRuleSubtreeStream

 public RewriteRuleSubtreeStream(ITreeAdaptor adaptor, string elementDescription, IList elements)            : base(adaptor, elementDescription, elements) { }
开发者ID:rgatkinson,项目名称:nadir,代码行数:1,代码来源:AntrRuntimeFixes.cs

示例14: ReadOnlyTreeVisitor

 public ReadOnlyTreeVisitor(ITreeAdaptor adaptor)
     {
     this.adaptor = adaptor;
     }
开发者ID:rgatkinson,项目名称:nadir,代码行数:4,代码来源:AntrRuntimeFixes.cs

示例15: UnBufferedTreeNodeStream

 public UnBufferedTreeNodeStream(ITreeAdaptor adaptor, object tree)
 {
     this.root = tree;
     this.adaptor = adaptor;
     Reset();
     down = adaptor.Create(Token.DOWN, "DOWN");
     up = adaptor.Create(Token.UP, "UP");
     eof = adaptor.Create(Token.EOF, "EOF");
 }
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:9,代码来源:UnBufferedTreeNodeStream.cs


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