Created
July 13, 2017 15:21
-
-
Save asonge/3fe2b0ad3ab3641a1fa1d360f60e65d6 to your computer and use it in GitHub Desktop.
Make you hrl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:ok, trees} = :code.lib_dir(:public_key) | |
|> Path.join("include/OTP-PUB-KEY.hrl") | |
|> :epp_dodger.parse_file() | |
constants = trees | |
|> Enum.map(&:erl_syntax_lib.strip_comments/1) | |
|> Enum.reject(&match?({:record, _},:erl_syntax_lib.analyze_attribute(&1))) | |
|> Enum.map(fn {:tree, :attribute, {:attr, _, _, :none}, {:attribute, {:atom, _, :define}, [{:atom,_,_}=a,b]}} -> | |
{:erl_syntax.concrete(a), :erl_syntax.concrete(b)}; | |
_ -> nil | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment