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()); }
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()); }
public void Compile(YRoot root) { _header.Content = new HeaderUnitCompiler().Compile(root, this); _source.Content = new SourceUnitCompiler().Compile(root, this); }
public UnitInlucdeFinder(YRoot root) { _root = root; }