anchor.diff:  parse_gen_server(_TokenList) ->
     {error, not_supported}.
   
  +parse_gen_statem(TokenList) ->
  +  Type = gen_statem,
  +  Fun =
  +    fun({function, _, init, 1, Clauses}, Acc) ->
  +          parse_function_add_edges(Clauses, init, [async], Type, Acc);
  +       ({function, _, handle_event = FnName, 4, Clauses}, Acc) ->
  +          parse_function_add_node_and_edges(Clauses, FnName, [], Type, Acc);
  +       ({function, _, FnName, 3, Clauses}, Acc) ->
  +          parse_function_add_node_and_edges(Clauses, FnName, [], Type, Acc);
  +       (_Other, {OldNodes, OldEdges, OldAllStates}) ->
  +          {OldNodes, OldEdges, OldAllStates}
  +    end,
  +    Graph = generic_parse(TokenList, Fun),
  +    {parsed, Type, Graph}.
  +
   parse_gen_fsm(TokenList) ->
  +  Type = gen_fsm,
  +  Fun =
  +    fun({function, _, init, 1, Clauses}, Acc) ->
  +          parse_function_add_edges(Clauses, init, [async], Type, Acc);
  +       ({function, _, handle_event, 3, Clauses}, Acc) ->
  +          parse_function_add_states(Clauses, handle_event, [async, allstate], Type, Acc);
  +       ({function, _, handle_sync_event, 4, Clauses}, Acc) ->
  +          parse_function_add_states(Clauses, handle_sync_event, [sync, allstate], Type, Acc);
  +       ({function, _, handle_info, 3, Clauses}, Acc) ->
  +          parse_function_add_states(Clauses, handle_info, [async, allstate, info], Type, Acc);
  +       ({function, _, FnName, 2, Clauses}, Acc) ->
  +          %io:format("CLAUSES ~w for ASYNC FUNCTION ~w~n", [Clauses, FnName]),
  +          parse_function_add_node_and_edges(Clauses, FnName, [async], Type, Acc);
  +       ({function, _, FnName, 3, Clauses}, Acc) ->
  +          %io:format("CLAUSES ~w for SYNC FUNCTION ~w~n", [Clauses, FnName]),
  +          parse_function_add_node_and_edges(Clauses, FnName, [sync], Type, Acc);
  +       (_Other, {OldNodes, OldEdges, OldAllStates}) ->
  +            {OldNodes, OldEdges, OldAllStates}
  +    end,
  +    Graph = generic_parse(TokenList, Fun),
  +    {parsed, Type, Graph}.
  +
  +generic_parse(TokenList, Fun) ->
     Graph = digraph:new(),
  -  {States, Edges, AllStateEdges} = lists:foldl(
  -    fun(Token, {OldNodes, OldEdges, OldAllStates}) ->
  -      case Token of
  -        {function, _, init, 1, Clauses} ->
  -          case parse_function(Clauses, init, [async], gen_fsm) of
  -            {error, _Reason} ->
  -              {OldNodes, OldEdges, OldAllStates};
  -            NewEdges ->
  -              {OldNodes, OldEdges ++ NewEdges, OldAllStates}
  -          end;
  -        {function, _, handle_event, 3, Clauses} ->
  -          case parse_function(Clauses, handle_event, [async, allstate], gen_fsm) of
  -            {error, _Reason} ->
  -              {OldNodes, OldEdges, OldAllStates};
  -            NewEdges ->
  -              {OldNodes, OldEdges, OldAllStates ++ NewEdges}
  -          end;
  -        {function, _, handle_sync_event, 4, Clauses} ->
  -          case parse_function(Clauses, handle_sync_event, [sync, allstate], gen_fsm) of
  -            {error, _Reason} ->
  -              {OldNodes, OldEdges, OldAllStates};
  -            NewEdges ->
  -              {OldNodes, OldEdges, OldAllStates ++ NewEdges}
  -          end;
  -        {function, _, handle_info, 3, Clauses} ->
  -          case parse_function(Clauses, handle_info, [async, allstate, info], gen_fsm) of
  -             {error, _Reason} ->
  -               {OldNodes, OldEdges, OldAllStates};
  -             NewEdges ->
  -               {OldNodes, OldEdges, OldAllStates ++ NewEdges}
  -           end;
  -        {function, _, FnName, 2, Clauses} ->
  -          %io:format("CLAUSES ~w for ASYNC FUNCTION ~w~n", [Clauses, FnName]),
  -           case parse_function(Clauses, FnName, [async], gen_fsm) of
  -             {error, Reason} ->
  -               {OldNodes, OldEdges, OldAllStates};
  -             NewEdges ->
  -              {[FnName|OldNodes], OldEdges ++ NewEdges, OldAllStates}
  -             end;
  -        {function, _, FnName, 3, Clauses} ->
  -          %io:format("CLAUSES ~w for SYNC FUNCTION ~w~n", [Clauses, FnName]),
  -          case parse_function(Clauses, FnName, [sync], gen_fsm) of
  -            {error, _Reason} ->
  -              {OldNodes, OldEdges, OldAllStates};
  -            NewEdges ->
  -              {[FnName|OldNodes], OldEdges ++ NewEdges, OldAllStates}
  -          end;
  -        _Other ->
  -          {OldNodes, OldEdges, OldAllStates}
  -      end
  -    end, {[init, terminate],[],[]}, TokenList),
  +  {States, Edges, AllStateEdges} = lists:foldl(Fun, {[init, terminate],[],[]}, TokenList),
     {ExpAllStates, Expansion} = case ?EXPAND_FLAG of
   				true ->
   					{States, States};
  
positive.code:       eval_return(Rest, gen_fsm, [{ok, terminate, async}|Acc]);
      _Other ->
        eval_return(Rest, gen_fsm, Acc)
    end;
  eval_return([], _, []) ->
    {error, badreturn};
  
negative.code: %%--------------------------------------------------------------------
  handle_call({parse_file, File, Includes}, _From, State) ->
    {ok, ParsedFile} = epp:parse_file(File, Includes, []),
    Behaviour = lists:keyfind(behaviour, 3, ParsedFile),
    Behavior = lists:keyfind(behavior, 3, ParsedFile),
    Reply = case Behaviour of
              {attribute, _, _, gen_server} ->
                parse_gen_server(ParsedFile);
              {attribute, _, _, gen_fsm} ->
                parse_gen_fsm(ParsedFile);
              {attribute, _, _, gen_statem} ->
                parse_gen_statem(ParsedFile);
              {attribute, _, _, gen_event} ->
                parse_gen_event(ParsedFile);
              false ->
                case Behavior of
                  {attribute, _, _, gen_server} ->
                    parse_gen_server(ParsedFile);
                  {attribute, _, _, gen_fsm} ->
                    parse_gen_fsm(ParsedFile);
                  {attribute, _, _, gen_statem} ->
                    parse_gen_statem(ParsedFile);
                  {attribute, _, _, gen_event} ->
                    parse_gen_event(ParsedFile);
                  false ->
                    {error, not_otp}
  