From e8d5c70baa2cf80eab4d94dd325bd92192017d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 28 Sep 2017 18:32:52 +0200 Subject: [PATCH] Move & up in the operator table to avoid conflicts with | in cons, closes #6613 --- lib/elixir/lib/code/identifier.ex | 2 +- lib/elixir/pages/Operators.md | 2 +- lib/elixir/src/elixir_parser.yrl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/elixir/lib/code/identifier.ex b/lib/elixir/lib/code/identifier.ex index 58ba5660649..4fce4cd8c8f 100644 --- a/lib/elixir/lib/code/identifier.ex +++ b/lib/elixir/lib/code/identifier.ex @@ -14,7 +14,7 @@ defmodule Code.Identifier do def unary_op(op) do cond do op in [:&] -> - {:non_associative, 30} + {:non_associative, 100} op in [:!, :^, :not, :+, :-, :~~~] -> {:non_associative, 300} op in [:@] -> diff --git a/lib/elixir/pages/Operators.md b/lib/elixir/pages/Operators.md index 566c13e7b07..84217bedf80 100644 --- a/lib/elixir/pages/Operators.md +++ b/lib/elixir/pages/Operators.md @@ -20,13 +20,13 @@ Operator `==` `!=` `=~` `===` `!==` | Left to right `&&` `&&&` `and` | Left to right `\|\|` `\|\|\|` `or` | Left to right +`&` | Unary `=` | Right to left `=>` | Right to left `\|` | Right to left `::` | Right to left `when` | Right to left `<-`, `\\` | Left to right -`&` | Unary ## Comparison operators diff --git a/lib/elixir/src/elixir_parser.yrl b/lib/elixir/src/elixir_parser.yrl index 2e790f51023..93b0178c5eb 100644 --- a/lib/elixir/src/elixir_parser.yrl +++ b/lib/elixir/src/elixir_parser.yrl @@ -55,13 +55,13 @@ Expect 3. Left 5 do. Right 10 stab_op_eol. %% -> Left 20 ','. -Nonassoc 30 capture_op_eol. %% & Left 40 in_match_op_eol. %% <-, \\ (allowed in matches along =) Right 50 when_op_eol. %% when Right 60 type_op_eol. %% :: Right 70 pipe_op_eol. %% | Right 80 assoc_op_eol. %% => Right 90 match_op_eol. %% = +Nonassoc 100 capture_op_eol. %% & Left 130 or_op_eol. %% ||, |||, or Left 140 and_op_eol. %% &&, &&&, and Left 150 comp_op_eol. %% ==, !=, =~, ===, !==