예제 #1
0
        public GeneratedFile[] Generate(SyntaxNode input)
        {
            YRoot root = new YRoot();

            // Namespaces:

            foreach (var inputNamespace in input.ChildNodes().OfType <NamespaceDeclarationSyntax>())
            {
                var @namespace = new YNamespace(inputNamespace.GetName());
                root.AddChild(@namespace);

                ProcessInterfaces(@namespace, inputNamespace);
                ProcessClasses(@namespace, inputNamespace);
            }

            List <GeneratedFile> files = new List <GeneratedFile>();

            foreach (var unit in _generationUnits)
            {
                unit.Compile(root);
                files.Add(unit.GeneratedSourceFile());
                files.Add(unit.GeneratedHeaderFile());
            }

            return(files.ToArray());
        }
예제 #2
0
        public string Compile(YRoot root, GenerationUnit unit)
        {
            var walker        = CreateUnitWalker(unit.Class, new UnitInlucdeFinder(root));
            var walkerAdapter = new YSyntaxWalkerAdapter(walker);

            walkerAdapter.Walk(root);

            return(walker.GeneratedText());
        }
예제 #3
0
 public void Compile(YRoot root)
 {
     _header.Content = new HeaderUnitCompiler().Compile(root, this);
     _source.Content = new SourceUnitCompiler().Compile(root, this);
 }
예제 #4
0
 public UnitInlucdeFinder(YRoot root)
 {
     _root = root;
 }