tree-sitter / tree-sitter-rust

Rust grammar for tree-sitter
MIT License
337 stars 96 forks source link

`&a?` wrong precedence #188

Closed Kyuuhachi closed 11 months ago

Kyuuhachi commented 11 months ago

The following code is parsed wrong:

fn f() {
    &a?
}

Neovim's TSPlayground shows the syntax tree as

function_item [0, 0] - [2, 1]
  name: identifier [0, 3] - [0, 4]
  parameters: parameters [0, 4] - [0, 6]
  body: block [0, 7] - [2, 1]
    try_expression [1, 1] - [1, 4]
      reference_expression [1, 1] - [1, 3]
        value: identifier [1, 2] - [1, 3]

The reference_expression is inside the try_expression, which is wrong.