diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tools/emacs/test.erl.indented | 810 | ||||
-rw-r--r-- | lib/tools/emacs/test.erl.orig | 210 |
2 files changed, 510 insertions, 510 deletions
diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented index 7a1ff6a954..14a4eca7c3 100644 --- a/lib/tools/emacs/test.erl.indented +++ b/lib/tools/emacs/test.erl.indented @@ -1,4 +1,4 @@ -%% -*- erlang -*- +%% -*- Mode: erlang; indent-tabs-mode: nil -*- %% %% %CopyrightBegin% %% @@ -27,7 +27,7 @@ %%% Created : 6 Oct 2009 by Dan Gudmundsson <[email protected]> %%%------------------------------------------------------------------- -%% Start off with syntax highlighting you have to verify this by looking here +%% Start off with syntax highlighting you have to verify this by looking here %% and see that the code looks alright -module(test). @@ -44,175 +44,175 @@ foo() -> %% Module attributes should be highlighted -export([t/1]). --record(record1, {a, - b, - c - }). +-record(record1, {a, + b, + c + }). -record(record2, { - a, - b - }). + a, + b + }). -record(record3, {a = 8#42423 bor - 8#4234, - b = 8#5432 - bor 2#1010101 - c = 123 + - 234, + 8#4234, + b = 8#5432 + bor 2#1010101 + c = 123 + + 234, d}). -record(record4, { - a = 8#42423 bor - 8#4234, - b = 8#5432 - bor 2#1010101 - c = 123 + - 234, - d}). + a = 8#42423 bor + 8#4234, + b = 8#5432 + bor 2#1010101 + c = 123 + + 234, + d}). -record(record5, { a = 1 :: integer() - , b = foobar :: atom() - }). + , b = foobar :: atom() + }). -define(MACRO_1, macro). -define(MACRO_2(_), macro). -spec t(integer()) -> any(). --type ann() :: Var :: integer(). --type ann2() :: Var :: - 'return' - | 'return_white_spaces' - | 'return_comments' - | 'text' | ann(). --type paren() :: - (ann2()). --type t1() :: atom(). --type t2() :: [t1()]. --type t3(Atom) :: integer(Atom). --type t4() :: t3(foobar). --type t5() :: {t1(), t3(foo)}. --type t6() :: 1 | 2 | 3 | - 'foo' | 'bar'. --type t7() :: []. --type t71() :: [_]. +-type ann() :: Var :: integer(). +-type ann2() :: Var :: + 'return' + | 'return_white_spaces' + | 'return_comments' + | 'text' | ann(). +-type paren() :: + (ann2()). +-type t1() :: atom(). +-type t2() :: [t1()]. +-type t3(Atom) :: integer(Atom). +-type t4() :: t3(foobar). +-type t5() :: {t1(), t3(foo)}. +-type t6() :: 1 | 2 | 3 | + 'foo' | 'bar'. +-type t7() :: []. +-type t71() :: [_]. -type t8() :: {any(),none(),pid(),port(), - reference(),float()}. --type t9() :: [1|2|3|foo|bar] | - list(a | b | c) | t71(). --type t10() :: {1|2|3|foo|t9()} | {}. --type t11() :: 1..2. --type t13() :: maybe_improper_list(integer(), t11()). --type t14() :: [erl_scan:foo() | - %% Should be highlighted - term() | - bool() | - byte() | - char() | - non_neg_integer() | nonempty_list() | - pos_integer() | - neg_integer() | - number() | - list() | - nonempty_improper_list() | nonempty_maybe_improper_list() | - maybe_improper_list() | string() | iolist() | byte() | - module() | - mfa() | - node() | - timeout() | - no_return() | - %% Should not be highlighted - nonempty_() | nonlist() | - erl_scan:bar(34, 92) | t13() | m:f(integer() | <<_:_*16>>)]. + reference(),float()}. +-type t9() :: [1|2|3|foo|bar] | + list(a | b | c) | t71(). +-type t10() :: {1|2|3|foo|t9()} | {}. +-type t11() :: 1..2. +-type t13() :: maybe_improper_list(integer(), t11()). +-type t14() :: [erl_scan:foo() | + %% Should be highlighted + term() | + bool() | + byte() | + char() | + non_neg_integer() | nonempty_list() | + pos_integer() | + neg_integer() | + number() | + list() | + nonempty_improper_list() | nonempty_maybe_improper_list() | + maybe_improper_list() | string() | iolist() | byte() | + module() | + mfa() | + node() | + timeout() | + no_return() | + %% Should not be highlighted + nonempty_() | nonlist() | + erl_scan:bar(34, 92) | t13() | m:f(integer() | <<_:_*16>>)]. -type t15() :: {binary(),<<>>,<<_:34>>,<<_:_*42>>, <<_:3,_:_*14>>,<<>>} | [<<>>|<<_:34>>|<<_:16>>| - <<_:3,_:_*1472>>|<<_:19,_:_*14>>| <<_:34>>| - <<_:34>>|<<_:34>>|<<_:34>>]. --type t16() :: fun(). --type t17() :: fun((...) -> paren()). --type t18() :: fun(() -> t17() | t16()). + <<_:3,_:_*1472>>|<<_:19,_:_*14>>| <<_:34>>| + <<_:34>>|<<_:34>>|<<_:34>>]. +-type t16() :: fun(). +-type t17() :: fun((...) -> paren()). +-type t18() :: fun(() -> t17() | t16()). -type t19() :: fun((t18()) -> t16()) | - fun((nonempty_maybe_improper_list('integer', any())| - 1|2|3|a|b|<<_:3,_:_*14>>|integer()) -> - nonempty_maybe_improper_list('integer', any())| - 1|2|3|a|b|<<_:3,_:_*14>>|integer()). --type t20() :: [t19(), ...]. --type t21() :: tuple(). --type t21(A) :: A. --type t22() :: t21(integer()). --type t23() :: #rec1{}. --type t24() :: #rec2{a :: t23(), b :: [atom()]}. --type t25() :: #rec3{f123 :: [t24() | - 1|2|3|4|a|b|c|d| - nonempty_maybe_improper_list(integer, any())]}. + fun((nonempty_maybe_improper_list('integer', any())| + 1|2|3|a|b|<<_:3,_:_*14>>|integer()) -> + nonempty_maybe_improper_list('integer', any())| + 1|2|3|a|b|<<_:3,_:_*14>>|integer()). +-type t20() :: [t19(), ...]. +-type t21() :: tuple(). +-type t21(A) :: A. +-type t22() :: t21(integer()). +-type t23() :: #rec1{}. +-type t24() :: #rec2{a :: t23(), b :: [atom()]}. +-type t25() :: #rec3{f123 :: [t24() | + 1|2|3|4|a|b|c|d| + nonempty_maybe_improper_list(integer, any())]}. -type t26() :: #rec4{ a :: integer() - , b :: any() - }. + , b :: any() + }. -type t27() :: { integer() - , atom() - }. + , atom() + }. -type t99() :: - {t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(), - t15(),t20(),t21(), t22(),t25()}. + {t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(), + t15(),t20(),t21(), t22(),t25()}. -spec t1(FooBar :: t99()) -> t99(); - (t2()) -> t2(); + (t2()) -> t2(); (t4()) -> t4() when is_subtype(t4(), t24); - (t23()) -> t23() when is_subtype(t23(), atom()), - is_subtype(t23(), t14()); - (t24()) -> t24() when is_subtype(t24(), atom()), - is_subtype(t24(), t14()), - is_subtype(t24(), t4()). + (t23()) -> t23() when is_subtype(t23(), atom()), + is_subtype(t23(), t14()); + (t24()) -> t24() when is_subtype(t24(), atom()), + is_subtype(t24(), t14()), + is_subtype(t24(), t4()). -spec over(I :: integer()) -> R1 :: foo:typen(); - (A :: atom()) -> R2 :: foo:atomen(); - (T :: tuple()) -> R3 :: bar:typen(). + (A :: atom()) -> R2 :: foo:atomen(); + (T :: tuple()) -> R3 :: bar:typen(). --spec mod:t2() -> any(). +-spec mod:t2() -> any(). --spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]} - | {'del_member', name(), pid()}, - #state{}) -> {'noreply', #state{}}. +-spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]} + | {'del_member', name(), pid()}, + #state{}) -> {'noreply', #state{}}. --spec handle_cast(Cast :: - {'exchange', node(), [[name(),...]]} - | {'del_member', name(), pid()}, - #state{}) -> {'noreply', #state{}}. +-spec handle_cast(Cast :: + {'exchange', node(), [[name(),...]]} + | {'del_member', name(), pid()}, + #state{}) -> {'noreply', #state{}}. -spec all(fun((T) -> boolean()), List :: [T]) -> - boolean() when is_subtype(T, term()). % (*) + boolean() when is_subtype(T, term()). % (*) --spec get_closest_pid(term()) -> - Return :: pid() - | {'error', {'no_process', term()} - | {'no_such_group', term()}}. +-spec get_closest_pid(term()) -> + Return :: pid() + | {'error', {'no_process', term()} + | {'no_such_group', term()}}. -spec add( X :: integer() - , Y :: integer() - ) -> integer(). + , Y :: integer() + ) -> integer(). --opaque attributes_data() :: - [{'column', column()} | {'line', info_line()} | - {'text', string()}] | {line(),column()}. +-opaque attributes_data() :: + [{'column', column()} | {'line', info_line()} | + {'text', string()}] | {line(),column()}. -record(r,{ f1 :: attributes_data(), - f222 = foo:bar(34, #rec3{}, 234234234423, - aassdsfsdfsdf, 2234242323) :: - [t24() | 1|2|3|4|a|b|c|d| - nonempty_maybe_improper_list(integer, any())], - f333 :: [t24() | 1|2|3|4|a|b|c|d| - nonempty_maybe_improper_list(integer, any())], - f3 = x:y(), - f4 = x:z() :: t99(), - f17 :: 'undefined', - f18 :: 1 | 2 | 'undefined', - f19 = 3 :: integer()|undefined, - f5 = 3 :: undefined|integer()}). + f222 = foo:bar(34, #rec3{}, 234234234423, + aassdsfsdfsdf, 2234242323) :: + [t24() | 1|2|3|4|a|b|c|d| + nonempty_maybe_improper_list(integer, any())], + f333 :: [t24() | 1|2|3|4|a|b|c|d| + nonempty_maybe_improper_list(integer, any())], + f3 = x:y(), + f4 = x:z() :: t99(), + f17 :: 'undefined', + f18 :: 1 | 2 | 'undefined', + f19 = 3 :: integer()|undefined, + f5 = 3 :: undefined|integer()}). -record(state, { - sequence_number = 1 :: integer() - }). + sequence_number = 1 :: integer() + }). highlighting(X) % Function definitions should be highlighted @@ -230,12 +230,12 @@ highlighting(X) % Function definitions should be highlighted '#1',atom, $", atom, % atom should be ok - $', atom, + $', atom, "string$", atom, "string$", atom, % currently buggy I know... "string\$", atom, % workaround for bug above - "char $in string", atom, + "char $in string", atom, 'atom$', atom, 'atom$', atom, 'atom\$', atom, @@ -270,15 +270,15 @@ highlighting(X) % Function definitions should be highlighted erlang:anything(lists), %% Guards is_atom(foo), is_float(2.3), is_integer(32), is_number(4323.3), - is_function(Fun), is_pid(self()), + is_function(Fun), is_pid(self()), not_a_guard:is_list([]), %% Other Types atom, % not (currently) hightlighted - 234234, + 234234, 234.43, - [list, are, not, higlighted], + [list, are, not, higlighted], {nor, is, tuple}, ok. @@ -290,35 +290,35 @@ highlighting(X) % Function definitions should be highlighted %% Indented - % Right + % Right -indent_basics(X, Y, Z) +indent_basics(X, Y, Z) when X > 42, Z < 13; Y =:= 4711 -> %% comments - % right comments - case lists:filter(fun(_, AlongName, - B, - C) -> - true - end, - [a,v,b]) + % right comments + case lists:filter(fun(_, AlongName, + B, + C) -> + true + end, + [a,v,b]) of - [] -> - Y = 5 * 43, - ok; - [_|_] -> - Y = 5 * 43, - ok + [] -> + Y = 5 * 43, + ok; + [_|_] -> + Y = 5 * 43, + ok end, Y, %% List, tuples and binaries - [a, + [a, b, c ], - [ a, + [ a, b, c ], @@ -326,10 +326,10 @@ indent_basics(X, Y, Z) a, b ], - {a, + {a, b,c }, - { a, + { a, b,c }, @@ -366,16 +366,16 @@ indent_basics(X, Y, Z) c ), - call(2#42423 bor - #4234, - 2#5432, - other_arg), + call(2#42423 bor + #4234, + 2#5432, + other_arg), ok; -indent_basics(Xlongname, - #struct{a=Foo, - b=Bar}, - [X| - Y]) -> +indent_basics(Xlongname, + #struct{a=Foo, + b=Bar}, + [X| + Y]) -> testing_next_clause, ok; indent_basics( % AD added clause @@ -408,295 +408,295 @@ indent_nested() -> indent_icr(Z) -> % icr = if case receive %% If if Z >= 0 -> - X = 43 div 4, - foo(X); + X = 43 div 4, + foo(X); Z =< 10 -> - X = 43 div 4, - foo(X); + X = 43 div 4, + foo(X); Z == 5 orelse Z == 7 -> - X = 43 div 4, - foo(X); + X = 43 div 4, + foo(X); true -> - if_works + if_works end, %% Case case {Z, foo, bar} of - {Z,_,_} -> - X = 43 div 4, - foo(X); - {Z,_,_} when - Z =:= 42 -> % AD line should be indented as a when - X = 43 div 4, - foo(X); - {Z,_,_} - when Z < 10 -> % AD when should be indented - X = 43 div 4, - foo(X); - {Z,_,_} - when % AD when should be indented - Z < 10 % and the guards should follow when - andalso % unsure about how though - true -> - X = 43 div 4, - foo(X) + {Z,_,_} -> + X = 43 div 4, + foo(X); + {Z,_,_} when + Z =:= 42 -> % AD line should be indented as a when + X = 43 div 4, + foo(X); + {Z,_,_} + when Z < 10 -> % AD when should be indented + X = 43 div 4, + foo(X); + {Z,_,_} + when % AD when should be indented + Z < 10 % and the guards should follow when + andalso % unsure about how though + true -> + X = 43 div 4, + foo(X) end, %% begin begin - sune, - X = 74234 + foo(8456) + - 345 div 43, - ok + sune, + X = 74234 + foo(8456) + + 345 div 43, + ok end, %% receive - receive - {Z,_,_} -> - X = 43 div 4, - foo(X); - Z -> - X = 43 div 4, - foo(X) + receive + {Z,_,_} -> + X = 43 div 4, + foo(X); + Z -> + X = 43 div 4, + foo(X) end, receive - {Z,_,_} -> - X = 43 div 4, - foo(X); - Z % AD added clause - when Z =:= 1 -> % This line should be indented by 2 - X = 43 div 4, - foo(X); - Z when % AD added clause - Z =:= 2 -> % This line should be indented by 2 - X = 43 div 4, - foo(X); - Z -> - X = 43 div 4, - foo(X) + {Z,_,_} -> + X = 43 div 4, + foo(X); + Z % AD added clause + when Z =:= 1 -> % This line should be indented by 2 + X = 43 div 4, + foo(X); + Z when % AD added clause + Z =:= 2 -> % This line should be indented by 2 + X = 43 div 4, + foo(X); + Z -> + X = 43 div 4, + foo(X) after infinity -> - foo(X), - asd(X), - 5*43 + foo(X), + asd(X), + 5*43 end, receive - after 10 -> - foo(X), - asd(X), - 5*43 + after 10 -> + foo(X), + asd(X), + 5*43 end, ok. indent_fun() -> %% Changed fun to one indention level - Var = spawn(fun(X) - when X == 2; - X > 10 -> - hello, - case Hello() of - true when is_atom(X) -> - foo; - false -> - bar - end; - (Foo) when is_atom(Foo), - is_integer(X) -> - X = 6* 45, - Y = true andalso - kalle - end), + Var = spawn(fun(X) + when X == 2; + X > 10 -> + hello, + case Hello() of + true when is_atom(X) -> + foo; + false -> + bar + end; + (Foo) when is_atom(Foo), + is_integer(X) -> + X = 6* 45, + Y = true andalso + kalle + end), %% check EEP37 named funs Fn1 = fun Fact(N) when N > 0 -> - F = Fact(N-1), - N * F; - Fact(0) -> - 1 - end, + F = Fact(N-1), + N * F; + Fact(0) -> + 1 + end, %% check anonymous funs too Fn2 = fun(0) -> - 1; - (N) -> - N - end, + 1; + (N) -> + N + end, ok. indent_try_catch() -> try - io:format(stdout, "Parsing file ~s, ", - [St0#leex.xfile]), - {ok,Line3,REAs,Actions,St3} = - parse_rules(Xfile, Line2, Macs, St2) + io:format(stdout, "Parsing file ~s, ", + [St0#leex.xfile]), + {ok,Line3,REAs,Actions,St3} = + parse_rules(Xfile, Line2, Macs, St2) catch - exit:{badarg,R} -> - foo(R), - io:format(stdout, - "ERROR reason ~p~n", - R); - error:R % AD added clause - when R =:= 42 -> % when should be indented - foo(R); - error:R % AD added clause - when % when should be indented - R =:= 42 -> % but unsure about this (maybe 2 more) - foo(R); - error:R when % AD added clause - R =:= foo -> % line should be 2 indented (works) - foo(R); - error:R -> - foo(R), - io:format(stdout, - "ERROR reason ~p~n", - R) + exit:{badarg,R} -> + foo(R), + io:format(stdout, + "ERROR reason ~p~n", + R); + error:R % AD added clause + when R =:= 42 -> % when should be indented + foo(R); + error:R % AD added clause + when % when should be indented + R =:= 42 -> % but unsure about this (maybe 2 more) + foo(R); + error:R when % AD added clause + R =:= foo -> % line should be 2 indented (works) + foo(R); + error:R -> + foo(R), + io:format(stdout, + "ERROR reason ~p~n", + R) after - foo('after'), - file:close(Xfile) + foo('after'), + file:close(Xfile) end; indent_try_catch() -> try - foo(bar) + foo(bar) of - X when true andalso - kalle -> - io:format(stdout, "Parsing file ~s, ", - [St0#leex.xfile]), - {ok,Line3,REAs,Actions,St3} = - parse_rules(Xfile, Line2, Macs, St2); - X % AD added clause - when false andalso % when should be 2 indented - bengt -> - gurka(); - X when % AD added clause - false andalso % line should be 2 indented - not bengt -> - gurka(); - X -> - io:format(stdout, "Parsing file ~s, ", - [St0#leex.xfile]), - {ok,Line3,REAs,Actions,St3} = - parse_rules(Xfile, Line2, Macs, St2) + X when true andalso + kalle -> + io:format(stdout, "Parsing file ~s, ", + [St0#leex.xfile]), + {ok,Line3,REAs,Actions,St3} = + parse_rules(Xfile, Line2, Macs, St2); + X % AD added clause + when false andalso % when should be 2 indented + bengt -> + gurka(); + X when % AD added clause + false andalso % line should be 2 indented + not bengt -> + gurka(); + X -> + io:format(stdout, "Parsing file ~s, ", + [St0#leex.xfile]), + {ok,Line3,REAs,Actions,St3} = + parse_rules(Xfile, Line2, Macs, St2) catch - exit:{badarg,R} -> - foo(R), - io:format(stdout, - "ERROR reason ~p~n", - R); - error:R -> - foo(R), - io:format(stdout, - "ERROR reason ~p~n", - R) + exit:{badarg,R} -> + foo(R), + io:format(stdout, + "ERROR reason ~p~n", + R); + error:R -> + foo(R), + io:format(stdout, + "ERROR reason ~p~n", + R) after - foo('after'), - file:close(Xfile), - bar(with_long_arg, - with_second_arg) + foo('after'), + file:close(Xfile), + bar(with_long_arg, + with_second_arg) end; indent_try_catch() -> try foo() - after - foo(), - bar(with_long_arg, - with_second_arg) + after + foo(), + bar(with_long_arg, + with_second_arg) end. indent_catch() -> D = B + - float(43.1), + float(43.1), B = catch oskar(X), - A = catch (baz + - bax), + A = catch (baz + + bax), catch foo(), - C = catch B + - float(43.1), + C = catch B + + float(43.1), case catch foo(X) of - A -> - B + A -> + B end, case - catch foo(X) + catch foo(X) of - A -> - B + A -> + B end, case - foo(X) + foo(X) of - A -> - catch B, - X + A -> + catch B, + X end, try sune of - _ -> foo + _ -> foo catch _:_ -> baf end, try - sune + sune of - _ -> - X = 5, - (catch foo(X)), - X + 10 + _ -> + X = 5, + (catch foo(X)), + X + 10 catch _:_ -> baf end, try - (catch sune) + (catch sune) of - _ -> - catch foo() %% BUGBUG can't handle catch inside try without parentheses + _ -> + catch foo() %% BUGBUG can't handle catch inside try without parentheses catch _:_ -> - baf + baf end, try - (catch exit()) + (catch exit()) catch - _ -> - catch baf() + _ -> + catch baf() end, ok. indent_binary() -> X = lists:foldr(fun(M) -> - <<Ma/binary, " ">> - end, [], A), + <<Ma/binary, " ">> + end, [], A), A = <<X/binary, 0:8>>, B. indent_comprehensions() -> - %% I don't have a good idea how we want to handle this + %% I don't have a good idea how we want to handle this %% but they are here to show how they are indented today. - Result1 = [X || - #record{a=X} <- lists:seq(1, 10), - true = (X rem 2) - ], + Result1 = [X || + #record{a=X} <- lists:seq(1, 10), + true = (X rem 2) + ], Result2 = [X || <<X:32,_:32>> <= <<0:512>>, - true = (X rem 2) - ], + true = (X rem 2) + ], - Binary1 = << <<X:8>> || - #record{a=X} <- lists:seq(1, 10), - true = (X rem 2) - >>, + Binary1 = << <<X:8>> || + #record{a=X} <- lists:seq(1, 10), + true = (X rem 2) + >>, Binary2 = << <<X:8>> || <<X:32,_:32>> <= <<0:512>>, - true = (X rem 2) - >>, + true = (X rem 2) + >>, ok. %% This causes an error in earlier erlang-mode versions. foo() -> [#foo{ - foo = foo}]. + foo = foo}]. %% Record indentation some_function_with_a_very_long_name() -> @@ -704,20 +704,20 @@ some_function_with_a_very_long_name() -> field1=a, field2=b}, case dummy_function_with_a_very_very_long_name(x) of - #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ - field1=a, - field2=b} -> - ok; - Var = #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ - field1=a, - field2=b} -> - Var#'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ - field1=a, - field2=b}; - #xyz{ - a=1, - b=2} -> - ok + #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ + field1=a, + field2=b} -> + ok; + Var = #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ + field1=a, + field2=b} -> + Var#'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ + field1=a, + field2=b}; + #xyz{ + a=1, + b=2} -> + ok end. another_function_with_a_very_very_long_name() -> @@ -726,45 +726,45 @@ another_function_with_a_very_very_long_name() -> field2=1}. some_function_name_xyz(xyzzy, #some_record{ - field1=Field1, - field2=Field2}) -> + field1=Field1, + field2=Field2}) -> SomeVariable = f(#'Some-long-record-name'{ - field_a = 1, - 'inter-xyz-parameters' = - #'Some-other-very-long-record-name'{ - field2 = Field1, - field2 = Field2}}), + field_a = 1, + 'inter-xyz-parameters' = + #'Some-other-very-long-record-name'{ + field2 = Field1, + field2 = Field2}}), {ok, SomeVariable}. commas_first() -> {abc, [ {some_var, 1} - , {some_other_var, 2} - , {erlang_ftw, 9} - , {erlang_cookie, 'cookie'} - , {cmds, - [ {one, "sudo ls"} - , {one, "sudo ls"} - , {two, "sudo ls"} - , {three, "sudo ls"} - , {four, "sudo ls"} - , {three, "sudo ls"} - ] } - , {ssh_username, "yow"} - , {cluster, - [ {aaaa, [ {"10.198.55.12" , "" } - , {"10.198.55.13" , "" } - ] } - , {bbbb, [ {"10.198.55.151", "" } - , {"10.198.55.123", "" } - , {"10.198.55.34" , "" } - , {"10.198.55.85" , "" } - , {"10.198.55.67" , "" } - ] } - , {cccc, [ {"10.198.55.68" , "" } - , {"10.198.55.69" , "" } - ] } - ] } - ] + , {some_other_var, 2} + , {erlang_ftw, 9} + , {erlang_cookie, 'cookie'} + , {cmds, + [ {one, "sudo ls"} + , {one, "sudo ls"} + , {two, "sudo ls"} + , {three, "sudo ls"} + , {four, "sudo ls"} + , {three, "sudo ls"} + ] } + , {ssh_username, "yow"} + , {cluster, + [ {aaaa, [ {"10.198.55.12" , "" } + , {"10.198.55.13" , "" } + ] } + , {bbbb, [ {"10.198.55.151", "" } + , {"10.198.55.123", "" } + , {"10.198.55.34" , "" } + , {"10.198.55.85" , "" } + , {"10.198.55.67" , "" } + ] } + , {cccc, [ {"10.198.55.68" , "" } + , {"10.198.55.69" , "" } + ] } + ] } + ] }. @@ -776,9 +776,9 @@ commas_first() -> %% body, due to the function name being mistaken for a keyword catcher(N) -> try generate_exception(N) of - Val -> {N, normal, Val} + Val -> {N, normal, Val} catch - throw:X -> {N, caught, thrown, X}; - exit:X -> {N, caught, exited, X}; - error:X -> {N, caught, error, X} + throw:X -> {N, caught, thrown, X}; + exit:X -> {N, caught, exited, X}; + error:X -> {N, caught, error, X} end. diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig index 2552c71baf..c0cf1749b6 100644 --- a/lib/tools/emacs/test.erl.orig +++ b/lib/tools/emacs/test.erl.orig @@ -1,4 +1,4 @@ -%% -*- erlang -*- +%% -*- Mode: erlang; indent-tabs-mode: nil -*- %% %% %CopyrightBegin% %% @@ -27,7 +27,7 @@ %%% Created : 6 Oct 2009 by Dan Gudmundsson <[email protected]> %%%------------------------------------------------------------------- -%% Start off with syntax highlighting you have to verify this by looking here +%% Start off with syntax highlighting you have to verify this by looking here %% and see that the code looks alright -module(test). @@ -44,18 +44,18 @@ foo() -> %% Module attributes should be highlighted -export([t/1]). --record(record1, {a, - b, +-record(record1, {a, + b, c }). -record(record2, { a, b }). - + -record(record3, {a = 8#42423 bor 8#4234, - b = 8#5432 + b = 8#5432 bor 2#1010101 c = 123 + 234, @@ -64,7 +64,7 @@ foo() -> -record(record4, { a = 8#42423 bor 8#4234, - b = 8#5432 + b = 8#5432 bor 2#1010101 c = 123 + 234, @@ -79,31 +79,31 @@ foo() -> -spec t(integer()) -> any(). --type ann() :: Var :: integer(). --type ann2() :: Var :: - 'return' - | 'return_white_spaces' +-type ann() :: Var :: integer(). +-type ann2() :: Var :: + 'return' + | 'return_white_spaces' | 'return_comments' - | 'text' | ann(). --type paren() :: - (ann2()). --type t1() :: atom(). --type t2() :: [t1()]. --type t3(Atom) :: integer(Atom). --type t4() :: t3(foobar). --type t5() :: {t1(), t3(foo)}. --type t6() :: 1 | 2 | 3 | - 'foo' | 'bar'. --type t7() :: []. --type t71() :: [_]. + | 'text' | ann(). +-type paren() :: + (ann2()). +-type t1() :: atom(). +-type t2() :: [t1()]. +-type t3(Atom) :: integer(Atom). +-type t4() :: t3(foobar). +-type t5() :: {t1(), t3(foo)}. +-type t6() :: 1 | 2 | 3 | + 'foo' | 'bar'. +-type t7() :: []. +-type t71() :: [_]. -type t8() :: {any(),none(),pid(),port(), - reference(),float()}. --type t9() :: [1|2|3|foo|bar] | - list(a | b | c) | t71(). --type t10() :: {1|2|3|foo|t9()} | {}. --type t11() :: 1..2. --type t13() :: maybe_improper_list(integer(), t11()). --type t14() :: [erl_scan:foo() | + reference(),float()}. +-type t9() :: [1|2|3|foo|bar] | + list(a | b | c) | t71(). +-type t10() :: {1|2|3|foo|t9()} | {}. +-type t11() :: 1..2. +-type t13() :: maybe_improper_list(integer(), t11()). +-type t14() :: [erl_scan:foo() | %% Should be highlighted term() | bool() | @@ -122,31 +122,31 @@ foo() -> timeout() | no_return() | %% Should not be highlighted - nonempty_() | nonlist() | + nonempty_() | nonlist() | erl_scan:bar(34, 92) | t13() | m:f(integer() | <<_:_*16>>)]. -type t15() :: {binary(),<<>>,<<_:34>>,<<_:_*42>>, <<_:3,_:_*14>>,<<>>} | [<<>>|<<_:34>>|<<_:16>>| <<_:3,_:_*1472>>|<<_:19,_:_*14>>| <<_:34>>| -<<_:34>>|<<_:34>>|<<_:34>>]. --type t16() :: fun(). --type t17() :: fun((...) -> paren()). --type t18() :: fun(() -> t17() | t16()). +<<_:34>>|<<_:34>>|<<_:34>>]. +-type t16() :: fun(). +-type t17() :: fun((...) -> paren()). +-type t18() :: fun(() -> t17() | t16()). -type t19() :: fun((t18()) -> t16()) | fun((nonempty_maybe_improper_list('integer', any())| 1|2|3|a|b|<<_:3,_:_*14>>|integer()) -> nonempty_maybe_improper_list('integer', any())| -1|2|3|a|b|<<_:3,_:_*14>>|integer()). --type t20() :: [t19(), ...]. --type t21() :: tuple(). --type t21(A) :: A. --type t22() :: t21(integer()). --type t23() :: #rec1{}. --type t24() :: #rec2{a :: t23(), b :: [atom()]}. --type t25() :: #rec3{f123 :: [t24() | -1|2|3|4|a|b|c|d| -nonempty_maybe_improper_list(integer, any())]}. +1|2|3|a|b|<<_:3,_:_*14>>|integer()). +-type t20() :: [t19(), ...]. +-type t21() :: tuple(). +-type t21(A) :: A. +-type t22() :: t21(integer()). +-type t23() :: #rec1{}. +-type t24() :: #rec2{a :: t23(), b :: [atom()]}. +-type t25() :: #rec3{f123 :: [t24() | +1|2|3|4|a|b|c|d| +nonempty_maybe_improper_list(integer, any())]}. -type t26() :: #rec4{ a :: integer() , b :: any() }. @@ -155,7 +155,7 @@ nonempty_maybe_improper_list(integer, any())]}. }. -type t99() :: {t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(), -t15(),t20(),t21(), t22(),t25()}. +t15(),t20(),t21(), t22(),t25()}. -spec t1(FooBar :: t99()) -> t99(); (t2()) -> t2(); (t4()) -> t4() when is_subtype(t4(), t24); @@ -169,21 +169,21 @@ t15(),t20(),t21(), t22(),t25()}. (A :: atom()) -> R2 :: foo:atomen(); (T :: tuple()) -> R3 :: bar:typen(). --spec mod:t2() -> any(). +-spec mod:t2() -> any(). --spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]} +-spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]} | {'del_member', name(), pid()}, #state{}) -> {'noreply', #state{}}. --spec handle_cast(Cast :: - {'exchange', node(), [[name(),...]]} +-spec handle_cast(Cast :: + {'exchange', node(), [[name(),...]]} | {'del_member', name(), pid()}, #state{}) -> {'noreply', #state{}}. -spec all(fun((T) -> boolean()), List :: [T]) -> boolean() when is_subtype(T, term()). % (*) --spec get_closest_pid(term()) -> +-spec get_closest_pid(term()) -> Return :: pid() | {'error', {'no_process', term()} | {'no_such_group', term()}}. @@ -192,23 +192,23 @@ t15(),t20(),t21(), t22(),t25()}. , Y :: integer() ) -> integer(). --opaque attributes_data() :: +-opaque attributes_data() :: [{'column', column()} | {'line', info_line()} | - {'text', string()}] | {line(),column()}. + {'text', string()}] | {line(),column()}. -record(r,{ f1 :: attributes_data(), -f222 = foo:bar(34, #rec3{}, 234234234423, - aassdsfsdfsdf, 2234242323) :: -[t24() | 1|2|3|4|a|b|c|d| +f222 = foo:bar(34, #rec3{}, 234234234423, + aassdsfsdfsdf, 2234242323) :: +[t24() | 1|2|3|4|a|b|c|d| nonempty_maybe_improper_list(integer, any())], -f333 :: [t24() | 1|2|3|4|a|b|c|d| +f333 :: [t24() | 1|2|3|4|a|b|c|d| nonempty_maybe_improper_list(integer, any())], f3 = x:y(), f4 = x:z() :: t99(), f17 :: 'undefined', f18 :: 1 | 2 | 'undefined', f19 = 3 :: integer()|undefined, -f5 = 3 :: undefined|integer()}). +f5 = 3 :: undefined|integer()}). -record(state, { sequence_number = 1 :: integer() @@ -230,12 +230,12 @@ highlighting(X) % Function definitions should be highlighted '#1',atom, $", atom, % atom should be ok - $', atom, - + $', atom, + "string$", atom, "string$", atom, % currently buggy I know... "string\$", atom, % workaround for bug above - - "char $in string", atom, + + "char $in string", atom, 'atom$', atom, 'atom$', atom, 'atom\$', atom, @@ -270,18 +270,18 @@ highlighting(X) % Function definitions should be highlighted erlang:anything(lists), %% Guards is_atom(foo), is_float(2.3), is_integer(32), is_number(4323.3), - is_function(Fun), is_pid(self()), + is_function(Fun), is_pid(self()), not_a_guard:is_list([]), %% Other Types atom, % not (currently) hightlighted - 234234, + 234234, 234.43, - [list, are, not, higlighted], + [list, are, not, higlighted], {nor, is, tuple}, ok. - + %%% %%% Indentation %%% @@ -293,32 +293,32 @@ highlighting(X) % Function definitions should be highlighted % Right -indent_basics(X, Y, Z) +indent_basics(X, Y, Z) when X > 42, Z < 13; Y =:= 4711 -> %% comments % right comments - case lists:filter(fun(_, AlongName, - B, + case lists:filter(fun(_, AlongName, + B, C) -> true - end, + end, [a,v,b]) of [] -> Y = 5 * 43, ok; - [_|_] -> + [_|_] -> Y = 5 * 43, ok end, Y, %% List, tuples and binaries - [a, + [a, b, c ], - [ a, + [ a, b, c ], @@ -326,10 +326,10 @@ Y =:= 4711 -> a, b ], - {a, + {a, b,c }, - { a, + { a, b,c }, @@ -337,7 +337,7 @@ Y =:= 4711 -> a, b }, - + <<1:8, 2:8 >>, @@ -359,21 +359,21 @@ Y =:= 4711 -> c ), - + ( a, b, c ), - call(2#42423 bor + call(2#42423 bor #4234, 2#5432, other_arg), ok; -indent_basics(Xlongname, +indent_basics(Xlongname, #struct{a=Foo, - b=Bar}, + b=Bar}, [X| Y]) -> testing_next_clause, @@ -451,13 +451,13 @@ indent_icr(Z) -> % icr = if case receive %% receive - receive + receive {Z,_,_} -> X = 43 div 4, foo(X); Z -> X = 43 div 4, - foo(X) + foo(X) end, receive {Z,_,_} -> @@ -473,33 +473,33 @@ indent_icr(Z) -> % icr = if case receive foo(X); Z -> X = 43 div 4, - foo(X) + foo(X) after infinity -> foo(X), asd(X), 5*43 end, receive - after 10 -> + after 10 -> foo(X), asd(X), 5*43 end, ok. - + indent_fun() -> %% Changed fun to one indention level -Var = spawn(fun(X) +Var = spawn(fun(X) when X == 2; - X > 10 -> + X > 10 -> hello, - case Hello() of - true when is_atom(X) -> + case Hello() of + true when is_atom(X) -> foo; false -> bar end; - (Foo) when is_atom(Foo), + (Foo) when is_atom(Foo), is_integer(X) -> X = 6* 45, Y = true andalso @@ -522,14 +522,14 @@ Fact(0) -> indent_try_catch() -> try - io:format(stdout, "Parsing file ~s, ", + io:format(stdout, "Parsing file ~s, ", [St0#leex.xfile]), - {ok,Line3,REAs,Actions,St3} = + {ok,Line3,REAs,Actions,St3} = parse_rules(Xfile, Line2, Macs, St2) catch exit:{badarg,R} -> foo(R), - io:format(stdout, + io:format(stdout, "ERROR reason ~p~n", R); error:R % AD added clause @@ -544,7 +544,7 @@ indent_try_catch() -> foo(R); error:R -> foo(R), - io:format(stdout, + io:format(stdout, "ERROR reason ~p~n", R) after @@ -577,12 +577,12 @@ indent_try_catch() -> catch exit:{badarg,R} -> foo(R), - io:format(stdout, + io:format(stdout, "ERROR reason ~p~n", R); error:R -> foo(R), - io:format(stdout, + io:format(stdout, "ERROR reason ~p~n", R) after @@ -593,7 +593,7 @@ indent_try_catch() -> end; indent_try_catch() -> try foo() - after + after foo(), bar(with_long_arg, with_second_arg) @@ -602,16 +602,16 @@ indent_try_catch() -> indent_catch() -> D = B + float(43.1), - + B = catch oskar(X), - - A = catch (baz + + + A = catch (baz + bax), catch foo(), - C = catch B + + C = catch B + float(43.1), - + case catch foo(X) of A -> B @@ -673,9 +673,9 @@ indent_binary() -> indent_comprehensions() -> -%% I don't have a good idea how we want to handle this +%% I don't have a good idea how we want to handle this %% but they are here to show how they are indented today. -Result1 = [X || +Result1 = [X || #record{a=X} <- lists:seq(1, 10), true = (X rem 2) ], @@ -683,7 +683,7 @@ Result2 = [X || <<X:32,_:32>> <= <<0:512>>, true = (X rem 2) ], -Binary1 = << <<X:8>> || +Binary1 = << <<X:8>> || #record{a=X} <- lists:seq(1, 10), true = (X rem 2) >>, |