예제 #1
0
        private KeyValuePair <string, UstList <UstNode> > SourceFileToCodeTokens(RootUstNode sourceFile)
        {
            var allNodes = new UstList <UstNode>();

            allNodes.AddRange(sourceFile.AllInvocationExpressions());
            allNodes.AddRange(sourceFile.AllAnnotations());
            allNodes.AddRange(sourceFile.AllDeclarationNodes());
            allNodes.AddRange(sourceFile.AllStructDeclarations());
            allNodes.AddRange(sourceFile.AllEnumDeclarations());

            return(KeyValuePair.Create(sourceFile.FileFullPath, allNodes));
        }
예제 #2
0
        private static UstList <T> GetNodes <T>(UstNode node) where T : UstNode
        {
            UstList <T> nodes = new UstList <T>();

            foreach (UstNode child in node.Children)
            {
                if (child != null)
                {
                    if (child is T)
                    {
                        nodes.Add((T)child);
                    }
                    nodes.AddRange(GetNodes <T>(child));
                }
            }

            return(nodes);
        }