Permalink
Browse files

Fix handling of arg-list.

  • Loading branch information...
1 parent ee70b62 commit 7c0010504318e97e1370b88ada844bbcf9362ee7 @evanmiller evanmiller committed Jun 25, 2010
Showing with 8 additions and 6 deletions.
  1. +6 −4 src/aleppo.erl
  2. +2 −2 src/aleppo_parser.yrl
View
10 src/aleppo.erl
@@ -240,13 +240,15 @@ expand_macro_fun(Loc, DefinedArgs, DefinedTokens, ApplyArgs) ->
[{')', Loc}].
replace_macro_strings(DefinedTokens, DefinedArgs, ApplyArgs) ->
- MacroStringDict = dict:from_list(lists:zipwith(fun({var, _, VarName}, ApplyTokens) ->
+ MacroStringDict = dict:from_list(lists:zipwith(fun([{var, _, VarName}], ApplyTokens) ->
ArgAsString = lists:concat(lists:foldr(
fun
(Token, []) ->
- [erl_scan:token_info(Token, symbol)];
+ {symbol, Symbol} = erl_scan:token_info(Token, symbol),
+ [Symbol];
(Token, Acc) ->
- [erl_scan:token_info(Token, symbol), " "|Acc]
+ {symbol, Symbol} = erl_scan:token_info(Token, symbol),
+ [Symbol, " "|Acc]
end, [], ApplyTokens)),
{VarName, ArgAsString}
end, DefinedArgs, ApplyArgs)),
@@ -263,7 +265,7 @@ insert_comma_tokens(Args, Loc) ->
lists:foldr(fun
(Arg, []) -> Arg;
(Arg, Acc) -> Arg ++ [{',', Loc}|Acc]
- end, Args).
+ end, [], Args).
mark_keywords(Tokens) ->
mark_keywords(Tokens, undefined, []).
View
4 src/aleppo_parser.yrl
@@ -104,8 +104,8 @@ MacroName -> var : '$1'.
MacroArgs -> '$empty' : [].
MacroArgs -> NonEmptyMacroArgs : '$1'.
-NonEmptyMacroArgs -> NonEmptyMacroArgs ',' var : '$1' ++ ['$3'].
-NonEmptyMacroArgs -> var : ['$1'].
+NonEmptyMacroArgs -> NonEmptyMacroArgs ',' var : '$1' ++ [['$3']].
+NonEmptyMacroArgs -> var : [['$1']].
ApplyMacroArgs -> '$empty' : [].
ApplyMacroArgs -> NonEmptyApplyMacroArgs : '$1'.

0 comments on commit 7c00105

Please sign in to comment.