tlaplus-community / tree-sitter-tlaplus

A tree-sitter grammar for TLA⁺ and PlusCal
MIT License
57 stars 10 forks source link

Parsing collision between higher-order function arguments and infix operators #5

Closed ahelwer closed 1 year ago

ahelwer commented 3 years ago

Similar to https://github.com/tlaplus/tlaplus/issues/625. The grammar's current behavior matches SANY's current behavior.

This grammar currently interprets f(+) as (infix_op (identifier) (oplus) ... instead of (bound_op (identifier) (plus)).

It's uncertain which interpretation should actually be correct; the resolution of this issue is blocked until such time as a decision is made elsewhere. Tree-sitter currently chooses the infix interpretation because it will tokenize f as an identifier, then choose to tokenize (+) as oplus instead of function application, due to rules either 2, 3, or 4 in tree-sitters conflicting tokens rules.

This behavior is exhibited for the infix operators (+), (-), (/), (\X), and (.) (uncertain about last two).