Skip to content

Commit 5187dad

Browse files
committed
Disambuigate base identifiers.
1 parent d55f8e6 commit 5187dad

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/elixir_parser.yrl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ expr -> np_call_exprs : '$1'.
166166
% No Parens Calls
167167
np_call_exprs -> np_method_call_expr : '$1'.
168168
np_call_exprs -> np_erlang_call_expr : '$1'.
169+
np_call_exprs -> base_identifier : '$1'.
169170
np_call_exprs -> brackets_expr : '$1'.
170171

171172
% Method call
@@ -186,6 +187,7 @@ call_exprs -> min_expr : '$1'.
186187

187188
% Function call
188189
fun_call_expr -> min_expr call_args_parens : build_fun_call('$1', '$2').
190+
fun_call_expr -> base_identifier call_args_parens : build_fun_call('$1', '$2').
189191

190192
% Method call
191193
method_call_expr -> np_call_exprs dot_eol method_name call_args_parens : build_method_call('$1', '$3', '$4').
@@ -217,6 +219,7 @@ _expr -> _np_call_exprs : '$1'.
217219
% No Parens Calls
218220
_np_call_exprs -> _np_method_call_expr : '$1'.
219221
_np_call_exprs -> np_erlang_call_expr : '$1'.
222+
_np_call_exprs -> base_identifier : '$1'.
220223
_np_call_exprs -> _brackets_expr : '$1'.
221224

222225
% Method call
@@ -237,6 +240,7 @@ _call_exprs -> base_expr : '$1'.
237240

238241
% Function call
239242
_fun_call_expr -> base_expr call_args_parens : build_fun_call('$1', '$2').
243+
_fun_call_expr -> base_identifier call_args_parens : build_fun_call('$1', '$2').
240244

241245
% Method call
242246
_method_call_expr -> _np_call_exprs dot_eol method_name call_args_parens : build_method_call('$1', '$3', '$4').
@@ -360,7 +364,6 @@ close_gt -> '>>' : '$1'.
360364
close_gt -> eol '>>' : '$2'.
361365

362366
% Base expressions
363-
base_expr -> base_identifier : '$1'.
364367
base_expr -> string_list : build_string_list('$1').
365368
base_expr -> ivar : '$1'.
366369
base_expr -> atom : '$1'.

test/elixir/list_test.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,16 @@ object ListTest
7171
2 = a_list()[1]
7272
2 = self.a_list()[1]
7373
2 = ([1] + [2,3])[1]
74+
[1] = a_list [1]
7475
end
7576
7677
protected
7778
7879
def a_list
7980
[1,2,3]
8081
end
82+
83+
def a_list(list)
84+
list
85+
end
8186
end

0 commit comments

Comments
 (0)