Skip to content

Commit 4ceb41e

Browse files
eksperimentallexmag
authored andcommitted
Formmating: Add white space around vertical bar (#4507)
1 parent 8fcf699 commit 4ceb41e

File tree

132 files changed

+1250
-1250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1250
-1250
lines changed

lib/eex/lib/eex/compiler.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,38 @@ defmodule EEx.Compiler do
2525

2626
# Generates the buffers by handling each expression from the tokenizer
2727

28-
defp generate_buffer([{:text, chars}|t], buffer, scope, state) do
28+
defp generate_buffer([{:text, chars} | t], buffer, scope, state) do
2929
buffer = state.engine.handle_text(buffer, IO.chardata_to_string(chars))
3030
generate_buffer(t, buffer, scope, state)
3131
end
3232

33-
defp generate_buffer([{:expr, line, mark, chars}|t], buffer, scope, state) do
33+
defp generate_buffer([{:expr, line, mark, chars} | t], buffer, scope, state) do
3434
expr = Code.string_to_quoted!(chars, [line: line, file: state.file])
3535
buffer = state.engine.handle_expr(buffer, IO.chardata_to_string(mark), expr)
3636
generate_buffer(t, buffer, scope, state)
3737
end
3838

39-
defp generate_buffer([{:start_expr, start_line, mark, chars}|t], buffer, scope, state) do
39+
defp generate_buffer([{:start_expr, start_line, mark, chars} | t], buffer, scope, state) do
4040
{contents, line, t} = look_ahead_text(t, start_line, chars)
41-
{contents, t} = generate_buffer(t, "", [contents|scope],
41+
{contents, t} = generate_buffer(t, "", [contents | scope],
4242
%{state | quoted: [], line: line, start_line: start_line})
4343
buffer = state.engine.handle_expr(buffer, IO.chardata_to_string(mark), contents)
4444
generate_buffer(t, buffer, scope, state)
4545
end
4646

47-
defp generate_buffer([{:middle_expr, line, _, chars}|t], buffer, [current|scope], state) do
47+
defp generate_buffer([{:middle_expr, line, _, chars} | t], buffer, [current | scope], state) do
4848
{wrapped, state} = wrap_expr(current, line, buffer, chars, state)
49-
generate_buffer(t, "", [wrapped|scope], %{state | line: line})
49+
generate_buffer(t, "", [wrapped | scope], %{state | line: line})
5050
end
5151

52-
defp generate_buffer([{:end_expr, line, _, chars}|t], buffer, [current|_], state) do
52+
defp generate_buffer([{:end_expr, line, _, chars} | t], buffer, [current | _], state) do
5353
{wrapped, state} = wrap_expr(current, line, buffer, chars, state)
5454
tuples = Code.string_to_quoted!(wrapped, [line: state.start_line, file: state.file])
5555
buffer = insert_quoted(tuples, state.quoted)
5656
{buffer, t}
5757
end
5858

59-
defp generate_buffer([{:end_expr, line, _, chars}|_], _buffer, [], state) do
59+
defp generate_buffer([{:end_expr, line, _, chars} | _], _buffer, [], state) do
6060
raise EEx.SyntaxError, message: "unexpected token #{inspect chars}", file: state.file, line: line
6161
end
6262

@@ -76,12 +76,12 @@ defmodule EEx.Compiler do
7676
key = length(state.quoted)
7777
placeholder = '__EEX__(' ++ Integer.to_char_list(key) ++ ');'
7878
{current ++ placeholder ++ new_lines ++ chars,
79-
%{state | quoted: [{key, buffer}|state.quoted]}}
79+
%{state | quoted: [{key, buffer} | state.quoted]}}
8080
end
8181

8282
# Look text ahead on expressions
8383

84-
defp look_ahead_text([{:text, text}, {:middle_expr, line, _, chars}|t]=list, start, contents) do
84+
defp look_ahead_text([{:text, text}, {:middle_expr, line, _, chars} | t]=list, start, contents) do
8585
if only_spaces?(text) do
8686
{contents ++ text ++ chars, line, t}
8787
else

lib/eex/lib/eex/tokenizer.ex

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ defmodule EEx.Tokenizer do
2525
end
2626

2727
defp tokenize('<%%' ++ t, line, opts, buffer, acc) do
28-
tokenize t, line, opts, [?%, ?<|buffer], acc
28+
tokenize t, line, opts, [?%, ?< | buffer], acc
2929
end
3030

3131
defp tokenize('<%#' ++ t, line, opts, buffer, acc) do
@@ -52,11 +52,11 @@ defmodule EEx.Tokenizer do
5252
end
5353

5454
defp tokenize('\n' ++ t, line, opts, buffer, acc) do
55-
tokenize t, line + 1, opts, [?\n|buffer], acc
55+
tokenize t, line + 1, opts, [?\n | buffer], acc
5656
end
5757

58-
defp tokenize([h|t], line, opts, buffer, acc) do
59-
tokenize t, line, opts, [h|buffer], acc
58+
defp tokenize([h | t], line, opts, buffer, acc) do
59+
tokenize t, line, opts, [h | buffer], acc
6060
end
6161

6262
defp tokenize([], _line, _opts, buffer, acc) do
@@ -75,16 +75,16 @@ defmodule EEx.Tokenizer do
7575

7676
# Tokenize an expression until we find %>
7777

78-
defp expr([?%, ?>|t], line, buffer) do
78+
defp expr([?%, ?> | t], line, buffer) do
7979
{:ok, buffer, line, t}
8080
end
8181

8282
defp expr('\n' ++ t, line, buffer) do
83-
expr t, line + 1, [?\n|buffer]
83+
expr t, line + 1, [?\n | buffer]
8484
end
8585

86-
defp expr([h|t], line, buffer) do
87-
expr t, line, [h|buffer]
86+
defp expr([h | t], line, buffer) do
87+
expr t, line, [h | buffer]
8888
end
8989

9090
defp expr([], line, _buffer) do
@@ -98,11 +98,11 @@ defmodule EEx.Tokenizer do
9898
# Middle tokens are marked with "->" or keywords
9999
# End tokens contain only the end word and optionally ")"
100100

101-
defp token_name([h|t]) when h in [?\s, ?\t, ?)] do
101+
defp token_name([h | t]) when h in [?\s, ?\t, ?)] do
102102
token_name(t)
103103
end
104104

105-
defp token_name('od' ++ [h|_]) when h in [?\s, ?\t, ?)] do
105+
defp token_name('od' ++ [h | _]) when h in [?\s, ?\t, ?)] do
106106
:start_expr
107107
end
108108

@@ -190,22 +190,22 @@ defmodule EEx.Tokenizer do
190190

191191
defp trim_left(buffer, acc) do
192192
case {trim_whitespace(buffer), acc} do
193-
{[?\n|_] = trimmed_buffer, _} -> {true, trimmed_buffer}
193+
{[?\n | _] = trimmed_buffer, _} -> {true, trimmed_buffer}
194194
{[], []} -> {true, []}
195195
_ -> {false, buffer}
196196
end
197197
end
198198

199199
defp trim_right(rest, line) do
200200
case trim_whitespace(rest) do
201-
[?\r, ?\n|trimmed_rest] -> {true, trimmed_rest, line + 1}
202-
[?\n|trimmed_rest] -> {true, trimmed_rest, line + 1}
201+
[?\r, ?\n | trimmed_rest] -> {true, trimmed_rest, line + 1}
202+
[?\n | trimmed_rest] -> {true, trimmed_rest, line + 1}
203203
[] -> {true, [], line}
204204
_ -> {false, rest, line}
205205
end
206206
end
207207

208-
defp trim_whitespace([h|t]) when h == ?\s or h == ?\t do
208+
defp trim_whitespace([h | t]) when h == ?\s or h == ?\t do
209209
trim_whitespace(t)
210210
end
211211

lib/elixir/lib/access.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ defmodule Access do
117117
stacktrace = System.stacktrace
118118
e =
119119
case stacktrace do
120-
[unquote(top)|_] ->
120+
[unquote(top) | _] ->
121121
%{unquote(e) | reason: "#{inspect unquote(struct)} does not implement the Access behaviour"}
122122
_ ->
123123
unquote(e)

lib/elixir/lib/application.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ defmodule Application do
381381
Path.join(app_dir(app), path)
382382
end
383383
def app_dir(app, path) when is_list(path) do
384-
Path.join([app_dir(app)|path])
384+
Path.join([app_dir(app) | path])
385385
end
386386

387387
@doc """

lib/elixir/lib/code.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ defmodule Code do
594594
## Examples
595595
596596
# Get the documentation for the first function listed
597-
iex> [fun|_] = Code.get_docs(Atom, :docs) |> Enum.sort()
597+
iex> [fun | _] = Code.get_docs(Atom, :docs) |> Enum.sort()
598598
iex> {{_function, _arity}, _line, _kind, _signature, text} = fun
599599
iex> String.split(text, "\n") |> Enum.at(0)
600600
"Converts an atom to a char list."

lib/elixir/lib/collectable.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ end
4949
defimpl Collectable, for: List do
5050
def into(original) do
5151
{[], fn
52-
list, {:cont, x} -> [x|list]
52+
list, {:cont, x} -> [x | list]
5353
list, :done -> original ++ :lists.reverse(list)
5454
_, :halt -> :ok
5555
end}
@@ -59,7 +59,7 @@ end
5959
defimpl Collectable, for: BitString do
6060
def into(original) do
6161
{original, fn
62-
acc, {:cont, x} when is_bitstring(x) -> [acc|x]
62+
acc, {:cont, x} when is_bitstring(x) -> [acc | x]
6363
acc, :done -> IO.iodata_to_binary(acc)
6464
_, :halt -> :ok
6565
end}

lib/elixir/lib/dict.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,19 @@ defmodule Dict do
8282

8383
def to_list(dict) do
8484
reduce(dict, {:cont, []}, fn
85-
kv, acc -> {:cont, [kv|acc]}
85+
kv, acc -> {:cont, [kv | acc]}
8686
end) |> elem(1) |> :lists.reverse
8787
end
8888

8989
def keys(dict) do
9090
reduce(dict, {:cont, []}, fn
91-
{k, _}, acc -> {:cont, [k|acc]}
91+
{k, _}, acc -> {:cont, [k | acc]}
9292
end) |> elem(1) |> :lists.reverse
9393
end
9494

9595
def values(dict) do
9696
reduce(dict, {:cont, []}, fn
97-
{_, v}, acc -> {:cont, [v|acc]}
97+
{_, v}, acc -> {:cont, [v | acc]}
9898
end) |> elem(1) |> :lists.reverse
9999
end
100100

0 commit comments

Comments
 (0)