-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Elixir and Erlang/OTP versions
$ elixir --version
Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
Elixir 1.15.0-dev (35114d3) (compiled with Erlang/OTP 24)
Operating system
Ubuntu-20.04
Current behavior
examples.ex:
"\"foo\""
# ^ ^
# 5 9
"\"foo\#{hmm}\""
# ^ ^ ^
# 5 10 16
{:ok, "\"foo\#{hmm}\""}
# ^ ^ ^ ^ ^
# 5 10 15 20 23
{:ok, "\"foo\#{hmm}\"", 123}
# ^ ^ ^ ^ ^ ^
# 5 10 15 20 25 28
scratch.exs:
run =
fn file ->
file
|> File.read!()
|> Code.string_to_quoted!(
columns: true,
token_metadata: true,
literal_encoder: fn literal, meta -> {:ok, {:__block__, meta, [literal]}} end
)
|> IO.inspect()
end
run.("examples.ex")
Run scratch.exs:
# elixir scratch.exs
{:__block__, [],
[
{:__block__,
[
end_of_expression: [newlines: 2, line: 1, column: 10],
delimiter: "\"",
line: 1,
column: 1
], ["\"foo\""]},
{:__block__,
[
end_of_expression: [newlines: 2, line: 5, column: 15],
delimiter: "\"",
line: 5,
column: 1
], ["\"foo\#{hmm}\""]},
{:__block__,
[
end_of_expression: [newlines: 2, line: 9, column: 22],
closing: [line: 9, column: 21],
line: 9,
column: 1
],
[
{{:__block__, [line: 9, column: 2], [:ok]},
{:__block__, [delimiter: "\"", line: 9, column: 7], ["\"foo\#{hmm}\""]}}
]},
{:{}, [closing: [line: 13, column: 26], line: 13, column: 1],
[
{:__block__, [line: 13, column: 2], [:ok]},
{:__block__, [delimiter: "\"", line: 13, column: 7], ["\"foo\#{hmm}\""]},
{:__block__, [token: "123", line: 13, column: 23], ~c"{"}
]}
]}
The end_of_expression
column for the second example is reported as 15. The closing
column for the third and fourth examples are reported as 21 and 26 , respectively.
Expected behavior
The end_of_expression
column for the second example should (I believe) be 17, and the closing
columns for examples three and four should be 23 and 28.
Metadata
Metadata
Assignees
Labels
No labels