Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Macro functions can be atoms

  • Loading branch information...
commit c93c3daaaedc27458302fdc6a79c0206c752de38 1 parent 1caff84
Evan Miller authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/aleppo.erl
View
8 src/aleppo.erl
@@ -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 ->
Please sign in to comment.
Something went wrong with that request. Please try again.