parse transform options

Serge saleyn@REDACTED
Wed Jul 21 07:03:09 CEST 2021


Excellent! Thank you very much!

On Tue, Jul 20, 2021 at 10:35 PM Mikael Karlsson <karlsson.rm@REDACTED>
wrote:

> > How do you pass options (2nd argument) to a parse transform?
>
> The options are the compile options.
> If you need to pass custom options to the parse transform you can use -D :
> -- test_parse.erl
> -module(test_parse).
> -export([parse_transform/2]).
>
> parse_transform(Forms, Options) ->
>   io:format("Options: ~p~n", [Options]),
>   Forms.
>
> -- testt.erl
> -module(testt).
> -export([test/0]).
> -compile({parse_transform, test_parse}).
>
> test() -> hoho.
> --
> ~/work/erlang$ erlc -Dhejhopp -pa . testt.erl
> Options: [report_warnings,
>          {d,hejhopp},
>          report_errors,
>          {cwd,"/home/mikael/work/erlang"},
>          {outdir,"/home/mikael/work/erlang"}]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210721/0d0cb8c2/attachment.htm>


More information about the erlang-questions mailing list