This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
typedef enum {NONE, WHITESPACE, BINARY, FUNCTIONS, CLAUSES} MODE; | |
int showHelp(); | |
MODE getMode(const char *modeString, MODE *mode); | |
void writeFile(FILE *fd, MODE mode, int size); | |
const char *nameForMode(MODE mode); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(pt). | |
-export([parse_transform/2]). | |
parse_transform(ASTIn, _Options) -> | |
format(ASTIn). | |
format({call, Line, {atom, _, FName}, FixedArgs} = Call) -> | |
case handle_partial_application(FName, Line) of | |
undefined -> | |
format_tuple(Call); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
partial_application(F, Args) -> | |
{arity, InitialArity} = erlang:fun_info(F, arity), | |
case length(Args) of | |
L when L < InitialArity -> | |
MissingArgs = [{var, 1, N} || N <- lists:seq(1, InitialArity - L)], | |
ArgList = [case is_function(A) of | |
false -> erl_parse:abstract(A); | |
true -> {var, 1, erlang:fun_to_list(A)} | |
end || A <- Args] ++ MissingArgs, | |
Parsed = [{'fun', 1, |