How to get 'import' clauses from d file?

Trass3r un at
Sat Jan 15 03:48:42 PST 2011

> I'm trying to make some home-grown d build system, but and one of my  
> tasks
> is to get module dependencies. Yes, I know about -deps DMD switch, but  
> it works
> when all needed modules are given to compiler. But if some dependencies  
> absent compiler
> just aborts with error "module foo is in file "foo.d"  that can not be  
> read".
> Of course, I can extract "foo" from this string, deal with it and  
> repeat, but working
> one module at a time is not a much fun. Seems like I need to parse d  
> source and extract
> "import" clauses without compiler help - but may be I missed something?  
> And if not -
> what tools can I use for parsing?

You might look up how xfBuild uses the deps parameter to get all needed  

More information about the Digitalmars-d-learn mailing list