diff --git a/src/aleppo.erl b/src/aleppo.erl index d06f427..a2be70c 100644 --- a/src/aleppo.erl +++ b/src/aleppo.erl @@ -142,12 +142,19 @@ process_tree([Node|Rest], TokenAcc, Context) -> {'macro', {var, Attrs, 'LINE'}} -> {Line, _} = location(Attrs), process_tree(Rest, [{integer, Attrs, Line}|TokenAcc], Context); - {'macro', {_Type, _Loc, MacroName}} -> + {'macro', {_Type, Attrs, MacroName}} -> InsertTokens = dict:fetch(MacroName, Context#ale_context.macro_dict), {_, RevProcessedTokens} = process_tree(InsertTokens, [], Context), - process_tree(Rest, RevProcessedTokens ++ TokenAcc, Context); + + LocFun = fun + ({T, _, V}) -> {T, Attrs, V}; + (Token) -> Token + end, + RevProcessedTokens1 = lists:map(LocFun, RevProcessedTokens), + + process_tree(Rest, RevProcessedTokens1 ++ TokenAcc, Context); {'macro', {_Type, Loc, MacroName}, MacroArgs} -> InsertTokens = case dict:find({MacroName, length(MacroArgs)},