How to get 'import' clauses from d file?

Alex Khmara alex.khmara at gmail.com
Sat Jan 15 00:58:18 PST 2011


Hello!

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?


More information about the Digitalmars-d-learn mailing list