Skip to content

Commit

Permalink
add colon back to match for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
marianoguerra committed Mar 25, 2015
1 parent 0a73d47 commit 910b70f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/all.fn
Expand Up @@ -216,7 +216,7 @@ fn types @public
end
case match_expr:
Error = (throw, badarg)
match Error
match Error:
case throw, T1: T1
case error, E1: E1
case exit, X1: X1
Expand Down
3 changes: 1 addition & 2 deletions src/efene.erl
Expand Up @@ -190,14 +190,13 @@ clean_tokens([{arrow, _, _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accu
clean_tokens([{arrowend, _, _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{larrow, _, _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{larrowend, _, _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
% remove newline after try, catch, after, receive, begin, match
% remove newline after try, catch, after, receive, begin
clean_tokens([{'try', _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{'catch', _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{'after', _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{'receive', _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{'begin', _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{'fn', _}=H, {nl, _, _}|T], Accum) -> clean_tokens([H|T], Accum);
clean_tokens([{'match', _}=H1, H2, {nl, _, _}|T], Accum) -> clean_tokens([H1, H2|T], Accum);
clean_tokens([{'fn', _}=H1, {var, _, _}=H2, {nl, _, _}|T], Accum) -> clean_tokens([H1, H2|T], Accum);
clean_tokens([{'fn', _}=H1, {atom, _, _}=H2, {nl, _, _}|T], Accum) -> clean_tokens([H1, H2|T], Accum);

Expand Down
4 changes: 2 additions & 2 deletions src/fn_parser.yrl
Expand Up @@ -76,8 +76,8 @@ e_cases -> e_case_cond : ['$1'].
e_cases -> e_case_cond e_case_else : ['$1', '$2'].
e_cases -> e_case_cond e_cases : ['$1'|'$2'].

e_switch -> match literal e_case end:
{expr, line('$1'), switch, {'$2', '$3'}}.
e_switch -> match literal colon e_case end:
{expr, line('$1'), switch, {'$2', '$4'}}.

e_receive -> receive e_case end:
{expr, line('$1'), 'receive', {'$2', noafter}}.
Expand Down
2 changes: 1 addition & 1 deletion src/fn_pp.erl
Expand Up @@ -127,7 +127,7 @@ print(?E(_L, 'receive', {?E(_CLine, 'case', Clauses), After}), Str, Nl, Indent)
ind(Indent)]);

print(?E(_L, switch, {Value, ?E(_CaseLine, 'case', Clauses)}), Str, Nl, Indent) ->
fmt(Str, "match ~s~n~s~send", true, Indent, [print_single(Value),
fmt(Str, "match ~s:~n~s~send", true, Indent, [print_single(Value),
print_clauses(Clauses, Nl, Indent + 1),
ind(Indent)]);

Expand Down

0 comments on commit 910b70f

Please sign in to comment.