anchor.diff:  -module(elvis_code).
   
   -export([
  -         parse_tree/1
  +         parse_tree/1,
  +         nesting_level/1
           ]).
   
  +-type tree_node() ::
  +        #{type => atom(),
  +          attrs => map(),
  +          content => [tree_node()]}.
  +
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%% Public API
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
  --spec parse_tree(string()) -> [{ok | error, erl_parse:abstract_form()}].
  +-spec parse_tree(string() | binary()) -> [{ok | error, erl_parse:abstract_form()}].
   parse_tree(Source) ->
       SourceStr = elvis_utils:to_str(Source),
       {ok, Tokens, _} = erl_scan:string(SourceStr, {1, 1}, []),
       {ok, NewTokens} = aleppo:process_tokens(Tokens),
   
       Forms = split_when(fun is_dot/1, NewTokens),
  -    [to_map(Parsed)
  -     || {ok, Parsed} <- lists:map(fun erl_parse:parse_form/1, Forms)].
  +    ParsedForms = lists:map(fun erl_parse:parse_form/1, Forms),
  +    Children = [to_map(Parsed) || {ok, Parsed} <- ParsedForms],
  +
  +    #{type => root,
  +      content => Children}.
  +
  +-spec nesting_level(map()) -> integer().
  +nesting_level(#{type := Type, content := Content}) when
  +      Type == function;
  +      Type == 'case';
  +      Type == 'try';
  +      Type == 'if';
  +      Type == 'catch';
  +      Type == 'fun';
  +      Type == 'receive' ->
  +    1 + max_level(Content);
  +nesting_level(#{content := Content}) ->
  +    max_level(Content);
  +nesting_level(_Node) ->
  +    0.
  +
  +max_level(Content) ->
  +    Levels = lists:map(fun nesting_level/1, Content),
  +    lists:max(Levels).
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%% Private
  
positive.code: 
  %% Keywords
  
  to_map({'case', Location, Expression, Clauses}) ->
      #{type => 'case',
        attrs => #{location => Location,
                   expression => to_map(Expression)},
        content => to_map(Clauses)};
  
  to_map({'fun', Location, {function, Name, Arity}}) ->
  
negative.code:                  after_body => to_map(AfterBody)},
        content => to_map(Body)};
  
  to_map({'if', Location, IfClauses}) ->
      #{type => 'if',
        attrs => #{location => Location},
        content => to_map(IfClauses)};
  
  to_map({'catch', Location, Expr}) ->
      #{type => 'catch',
        attrs => #{location => Location},
        content => [to_map(Expr)]};
  
  to_map({'receive', Location, Clauses}) ->
      #{type => 'receive',
        attrs => #{location => Location},
        content => to_map(Clauses)};
  
  to_map({'receive', Location, Clauses, AfterExpr, AfterBody}) ->
      #{type => 'receive',
        attrs => #{location => Location,
                   after_expr => to_map(AfterExpr),
                   after_body => to_map(AfterBody)},
        content => to_map(Clauses)};
  
  %% List
  
  to_map({nil, Location}) ->
  