presentations/highlight-js/test/detect/erlang/default.txt

61 lines
1.2 KiB
Text
Raw Normal View History

2018-12-07 08:48:05 -06:00
-module(ssh_cli).
-behaviour(ssh_channel).
-include("ssh.hrl").
%% backwards compatibility
-export([listen/1, listen/2, listen/3, listen/4, stop/1]).
if L =/= [] -> % If L is not empty
sum(L) / count(L);
true ->
error
end.
%% state
-record(state, {
cm,
channel
}).
-spec foo(integer()) -> integer().
foo(X) -> 1 + X.
test(Foo)->Foo.
init([Shell, Exec]) ->
{ok, #state{shell = Shell, exec = Exec}};
init([Shell]) ->
false = not true,
io:format("Hello, \"~p!~n", [atom_to_list('World')]),
{ok, #state{shell = Shell}}.
concat([Single]) -> Single;
concat(RList) ->
EpsilonFree = lists:filter(
fun (Element) ->
case Element of
epsilon -> false;
_ -> true
end
end,
RList),
case EpsilonFree of
[Single] -> Single;
Other -> {concat, Other}
end.
union_dot_union({union, _}=U1, {union, _}=U2) ->
union(lists:flatten(
lists:map(
fun (X1) ->
lists:map(
fun (X2) ->
concat([X1, X2])
end,
union_to_list(U2)
)
end,
union_to_list(U1)
))).