I'm testing intellij-elixir against elixir-lang/elixir 1.0.4 prior to releasing intellij-elixir 1.0.0. I'm currently checking my implementation of
unmatched_expr and I hit a case in
Mix.Tasks.Deps.Clean where my associativity disagrees with native Elixir. It appears that the left associativity of the operator (in this case `|>`) isn't respected and right-associativity is used when going from an unmatched_expr to a matched_expr.
First, with all matched_expr:
```elixir
```
and Elixir and intellij-elixir agree the quoting is
```elixir
{
:|>,
[line: 3],
[
{
:|>,
[line: 2],
[
{:one, [line: 1], nil},
{:two, [line: 2], nil}
]
},
{:three, [line: 3], nil}
]
}
```
So, it's left associative (the left-most element are grouped together and they are the left operand to the next `|>` as stated in
elixir_parser.yrl#L61)
If the `one` is changed to `one do end`, then it is parsed as a `block_expr` and the `unmatched_expr -> unmatched_expr op_expr` rule goes into effect
```elixir
one do end
|> two
|> three
```
Using `Code.string_to_quoted` this quotes as
```elixir
{
:|>,
[line: 2],
[
{:one, [line: 1], [[do: nil]]},
{
:|>,
[line: 3],
[
{:two, [line: 2], nil},
{:three, [line: 3], nil}
]
}
]
}
```
So, now the associativity has changed and is no longer left, but right. (Or at least the piping from two to three happens first.) What am I missing in elixir_parser.yrl or some other part of Code.string_to_quoted that changes the associativity? This obviously isn't a bug because the `|>` macro rewrites this pipeline correctly, right? I just want to be mimicking the quoting correctly in intellij-elixir as quote comparison is how I test intellij-elixir's parser
Right now in intellij-elixir I'm preserving left-associativity (by having the same rule order, but unmatched* accepts blocks and matched* doesn't) and getting
```elixir
{
:|>,
[line: 3],
[
{
:|>,
[line: 2],
[
{:one, [line: 1], [[do: nil]]},
{:two, [line: 2], nil}
]
},
{three,[{line,3}],nil}
]
}
```
Which matched the `one |> two |> three` quoted form with the addition of the `[[do: nil]]`.