Permalink
Browse files

Macro functions can be atoms

  • Loading branch information...
1 parent 1caff84 commit c93c3daaaedc27458302fdc6a79c0206c752de38 Evan Miller committed Jul 26, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/aleppo.erl
View
@@ -103,8 +103,12 @@ process_tree([Node|Rest], TokenAcc, Context) ->
{_, RevProcessedTokens} = process_tree(InsertTokens, [], Context),
process_tree(Rest, RevProcessedTokens ++ TokenAcc, Context);
{'macro', {_Type, Loc, MacroName}, MacroArgs} ->
- {DefinedArgs, DefinedTokens} = dict:fetch({MacroName, length(MacroArgs)}, Context#ale_context.macro_dict),
- InsertTokens = expand_macro_fun(Loc, DefinedArgs, DefinedTokens, MacroArgs),
+ InsertTokens = case dict:find({MacroName, length(MacroArgs)}, Context#ale_context.macro_dict) of
+ {ok, {DefinedArgs, DefinedTokens}} ->
+ expand_macro_fun(Loc, DefinedArgs, DefinedTokens, MacroArgs);
+ _ ->
+ dict:fetch(MacroName, Context#ale_context.macro_dict)
+ end,
{_, RevProcessedTokens} = process_tree(InsertTokens, [], Context),
process_tree(Rest, RevProcessedTokens ++ TokenAcc, Context);
OtherToken ->

0 comments on commit c93c3da

Please sign in to comment.