anchor.diff:              PosGen()
       end.
   
  -
  +new_name_gen(File, NewName) ->
  +    ModName=list_to_atom(filename:basename(File, ".erl")),
  +    case NewName of
  +        {generator, GenFun} ->
  +            GenFun(ModName);
  +        {user_input, GenPrompt} ->
  +            {prompt, GenPrompt(ModName)};
  +        _ when is_atom(NewName) ->
  +            NewName;
  +        _ ->
  +            throw({error, "Invalid new funname."})
  +    end.
  +        
   new_name_gen(File, FA, NewName) ->
       ModName=list_to_atom(filename:basename(File, ".erl")),
       case NewName of
  
positive.code:                          end)], FunDef)
      end.
   
  gen_question(rename_fun_by_name,[File,{F,A}, _NewName, _SearchPaths]) ->
      M=list_to_atom(filename:basename(File, ".erl")),
      lists:flatten(io_lib:format("Do you want to rename function ~p:~p/~p?", [M,F,A]));
  gen_question(rename_var,[File,{F,A},{range, {_File, _Loc}, V}, _, _]) ->
      M=list_to_atom(filename:basename(File, ".erl")),
      lists:flatten(io_lib:format("Do you want to rename variable ~s in function ~p:~p/~p?", [V,M,F,A]));
  
negative.code: 
   
  get_fun_arity(File, FA) ->
      get_fun_arity(File, FA, false).
  get_fun_arity(File, FA, Lazy) ->
      get_fun_arity(File, FA, Lazy, default).
  
  get_fun_arity(File, FA, false, Order) ->
      Funs = get_funs(File, Order),
      if is_function(FA) ->
              [{F,A}||{F,A}<-Funs, FA({F,A})];
         is_tuple(FA) ->
              normalise_fa(FA);
         true ->
              throw({error, "Invalid function-arity."})
      end;
  
  get_fun_arity({File, NextFileGen}, FA, true, Order) ->
      FAs = get_fun_arity(File, FA, true, Order),
      case FAs of
          [] ->
              case NextFileGen of 
                  {lazy_file_gen, FileGen} ->
                      case FileGen() of
                          [] -> [];
                          {File1, NextFileGen1}->
                              case File1 of 
                                  [] -> [];
                                  _ ->
                                      case FA of 
                                          {lazy_fa_gen, OriginFA, _} ->
                                              get_fun_arity({File1, NextFileGen1},OriginFA, true, Order);
                                          _ ->
                                              get_fun_arity({File1, NextFileGen1},FA, true, Order)
                                      end
                              end
                      end;
                  none -> []
              end;
          [{F, A}] ->
              case NextFileGen of 
                  {lazy_file_gen, FileGen} ->
                      case FileGen() of
                          [] ->  [];
                          {File1, NextFileGen1} ->
                              case File1 of 
                                  [] -> [{F,A}];
                                  _ ->
                                      {{File, F, A}, {File1, NextFileGen1}, FA}
                              end
                      end;
                  none -> [{F,A}]
              end;
          {{F,A}, {lazy_fa_gen, OriginFA, NextFAGen}} ->
              {{File, F,A}, {File, NextFileGen}, {lazy_fa_gen, OriginFA, NextFAGen}}
      end;
  get_fun_arity(_File, {lazy_fa_gen, _OriginFA, Gen}, true, _Order) ->
        Gen();
  get_fun_arity(File, FA, true, Order) ->
      Funs = get_funs(File, Order),
      if is_function(FA) ->
              get_next_fun_arity(Funs, FA);
         is_tuple(FA) ->
              normalise_fa(FA);
         true ->
              throw({error, "Invalid function-arity."})
      end.
  
  normalise_fa(F,A) -> normalise_fa({F,A}).
  
  normalise_fa({F, A}) ->
      F1 = case is_list(F) of
             true -> list_to_atom(F);
             _ -> F
           end,
      A1 = case is_list(A) of
             true -> list_to_integer(A);
             _ -> A
           end,
      [{F1, A1}].
  
  get_next_fun_arity([], _FA) -> [];
  get_next_fun_arity([{F,A}|Fs], FA)->
      case FA({F,A}) of
          true ->
              {{F,A}, {lazy_fa_gen, FA, fun() -> get_next_fun_arity(Fs, FA) end}};
          false ->
              get_next_fun_arity(Fs, FA)
      end.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                         
    
  get_vars(File, FunName, Arity, VarFilter) ->
      ModName=list_to_atom(filename:basename(File, ".erl")),
      FunDef=api_refac:mfa_to_fun_def({ModName, FunName, Arity}, File),
  