@@ -45,10 +45,11 @@ defmodule Record.Extractor do
45
45
end
46
46
47
47
# Read a file and return its abstract syntax form that also
48
- # includes record and other preprocessor modules. This is done
49
- # by using Erlang's epp_dodger.
48
+ # includes record but with macros and other attributes expanded,
49
+ # such as `-include(...)` and `-include_lib(...)`. This is done
50
+ # by using Erlang's epp.
50
51
defp read_file ( file ) do
51
- case :epp_dodger . quick_parse_file ( file ) do
52
+ case :epp . parse_file ( file , [ ] ) do
52
53
{ :ok , form } ->
53
54
form
54
55
other ->
@@ -80,11 +81,11 @@ defmodule Record.Extractor do
80
81
81
82
defp eval_record ( cons , form ) do
82
83
form = form ++
83
- [ { :function , 0 , :hello , 0 , [
84
- { :clause , 0 , [ ] , [ ] , [ cons ] } ] } ]
84
+ [ { :function , 0 , :hello , 0 , [
85
+ { :clause , 0 , [ ] , [ ] , [ cons ] } ] } ]
85
86
86
87
{ :function , 0 , :hello , 0 , [
87
- { :clause , 0 , [ ] , [ ] , [ record_ast ] } ] } = :erl_expand_records . module ( form , [ ] ) |> List . last
88
+ { :clause , 0 , [ ] , [ ] , [ record_ast ] } ] } = :erl_expand_records . module ( form , [ ] ) |> List . last
88
89
89
90
{ :value , record , _ } = :erl_eval . expr ( record_ast , [ ] )
90
91
record
0 commit comments