-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Just saw your talk, and I had flashbacks from when I needed constants from :public_key's hrl file. It took me forever to find this on the Erlang ML: http://erlang.org/doc/man/epp_dodger.html
Example usage:
{:ok, forms} = :code.lib_dir(:wx) |> Path.join("include/wx.hrl") |> :epp_dodger.parse_file()
It basically skips the precompile phase of the parser so that you end up with just straight terms. You still have to resolve macros that are expressions, but it looks pretty basic. And you can always pattern-match the few hard-to-generalize exceptions as you iterate through everything.
If in a module adding @resource_file on the hrl file will make it so that the compiler depends on it, though this might not be important since it only changes if you switch versions of Erlang.