tlaplus-community / tree-sitter-tlaplus

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

Jlist misbehavior when using unicode land/lor symbols ∧ and ∨ #41

Closed ahelwer closed 3 years ago

ahelwer commented 3 years ago

The last land symbol should be part of the nested conjunction list, but it is not:

op ≜
  ∧ A
  ∧ ∧ B
    ∧ C

instead, it will only be part of the jlist if it is like this:

op ≜
  ∧ A
  ∧ ∧ B
      ∧ C

This only occurs when the nested jlist starts on the same line as the outer jlist, so this works fine:

op ≜
  ∧ A
  ∧
    ∧ B
    ∧ C

The behavior is identical with disjunction lists.

The behavior also occurs if there are prior unicode symbols on the line, like:

op ≜ ∧ A
     ∧ B
ahelwer commented 3 years ago

Probable cause: https://github.com/tree-sitter/tree-sitter/issues/1405 Also noticed some weird misbehavior when directly comparing L'∧' with lexer->lookahead; might need to use L'\u2227' instead.