There is a very convenient tool file:path_consult for config files.
But what if config is loaded into memory? You have to dig into sources.
https://gist.github.com/2537756
parse(Text) when is_list(Text) ->
parse(Text, [], 0, []).
parse(Text, Env, Line, Acc) ->
case erl_scan:tokens([], Text, Line) of
{done, {ok, Scanned, NewLine}, Rest} ->
{ok, Parsed} = erl_parse:parse_exprs(Scanned),
{value, Out, NewEnv} = erl_eval:exprs(Parsed, Env),
parse(Rest, NewEnv, NewLine, [Out|Acc]);
{more, _} ->
lists:reverse(Acc)
end.
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions