public static CompilationUnitSyntax Parse(string content) { if (content == null) { throw new ArgumentNullException(nameof(content)); } var compilationUnitSyntax = new CompilationUnitSyntax(); //parse all interface names GetGroupsByPattern("interface\\s+([A-aZ-z0-9_]+)", content) .ForEach(name => compilationUnitSyntax.AddMember(new InterfaceDeclarationSyntax(name))); //parse all class names GetGroupsByPattern("class\\s+([A-aZ-z0-9_]+)", content) .ForEach(name => compilationUnitSyntax.AddMember(new ClassDeclarationSyntax(name))); return(compilationUnitSyntax); }