Re: parse transform options

Serge <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CANt451kKqPQQTaBuhSJde=aVcKROVnYgrO0HttJryxtVSc29-w@mail.gmail.com>
Excellent! Thank you very much!

On Tue, Jul 20, 2021 at 10:35 PM Mikael Karlsson <[email protected]>
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"}]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.