Re: parse transform options

Mikael Karlsson <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAHsLMoSFWXxyvUdAYx+0nK07omxM6iOA5TSMTYuKyoUGX3kgqA@mail.gmail.com>
> 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.