Bengt Kleberg Bengt.Kleberg@REDACTED
Mon Sep 8 10:08:53 CEST 2003

Richard Carlsson wrote:

> If you take a look at the module 'epp_dodger.erl' in the syntax_tools
> contribution, it does a similar trick to get code containing macros past
> the parser. (It handles most "sane" uses of macros.) You might be able
> to use it directly, or just steal some parts of the code.

thank you for the help.

epp_dodger has some well thought out functions (unexported, but that is 
easily handled). unfortunatly the most lowlevel ones (scan_macro/1 and 
scan_form/1) gives the unwanted result of turning the macro into a free 

input lines:
	case catch free_vars(Lines) of
	{error, Reason} ->
		io:format( "CRASH ~w: ~s~n", [?MODULE, Reason] );
	Free ->
		Function_head = function_head( Free ),
		io:put_chars(lists:append( Function_head, Lines ))
(MODULE,Lines) ->

the more high level ones (parse_tokens/1 and rewrite_form/1) crash:

{"init terminating in do_boot",{put_chars,[{io,format,[<0.19.0>,"CRASH 
~w: ~s~n",[erlrefactor,{1,erl_parse,["syntax error before: 

i will (try to) keep epp_dodger in mind when my macros_to_atoms/1 starts 
to fail me.


More information about the erlang-questions mailing list