Skip to content

Commit ba579f1

Browse files
committed
Use simpler solution for adjusting map line
1 parent f0e97d0 commit ba579f1

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

lib/elixir/src/elixir_parser.yrl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ map_args -> open_curly assoc_update ',' close_curly : build_map_update('$1', '$2
642642
map_args -> open_curly assoc_update ',' map_close : build_map_update('$1', '$2', element(2, '$4'), element(1, '$4')).
643643
map_args -> open_curly assoc_update_kw close_curly : build_map_update('$1', '$2', '$3', []).
644644

645-
map -> map_op map_args : adjust_map_column('$2').
645+
map -> map_op map_args : '$2'.
646646
map -> '%' map_base_expr map_args : {'%', meta_from_token('$1'), ['$2', '$3']}.
647647
map -> '%' map_base_expr eol map_args : {'%', meta_from_token('$1'), ['$2', '$4']}.
648648

@@ -776,17 +776,6 @@ build_map_update(Left, {Pipe, Struct, Map}, Right, Extra) ->
776776
Op = build_op(Struct, Pipe, append_non_empty(Map, Extra)),
777777
{'%{}', newlines_pair(Left, Right) ++ meta_from_token(Left), [Op]}.
778778

779-
adjust_map_column(Map) ->
780-
case ?columns() of
781-
true ->
782-
{'%{}', Meta, Pairs} = Map,
783-
UpdatedMeta = [{Key, if Key =:= column -> Value - 1; true -> Value end} ||
784-
{Key, Value} <- Meta],
785-
{'%{}', UpdatedMeta, Pairs};
786-
false ->
787-
Map
788-
end.
789-
790779
%% Blocks
791780

792781
build_block(Exprs) -> build_block(Exprs, []).

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ tokenize([$%, $[ | Rest], Line, Column, Scope, Tokens) ->
629629
error(Reason, Rest, Scope, Tokens);
630630

631631
tokenize([$%, ${ | T], Line, Column, Scope, Tokens) ->
632-
tokenize([${ | T], Line, Column + 1, Scope, [{'%{}', {Line, Column, nil}} | Tokens]);
632+
Token = {'{', {Line, Column, nil}},
633+
handle_terminator(T, Line, Column + 2, Scope, Token, [{'%{}', {Line, Column, nil}} | Tokens]);
633634

634635
tokenize([$% | T], Line, Column, Scope, Tokens) ->
635636
tokenize(T, Line, Column + 1, Scope, [{'%', {Line, Column, nil}} | Tokens]);

0 commit comments

Comments
 (0)