usagi-coffee / tree-sitter-abl

OpenEdge ABL grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unary minus can't be used with many expressions

jchros opened this issue · comments

Trying to use the unary minus operator with parenthesized expressions, function calls, object accesses, or field accesses result in the error trees being generated. Example:

w = -(0).
x = -f().
y = -table.field.
z = -obj:method().

For the example above, the grammar generates the following tree:

(source_code
  (variable_assignment
    (assignment
      (identifier)
      (ERROR)
      (parenthesized_expression
        (number_literal))))
  (variable_assignment
    (assignment
      (identifier)
      (ERROR
        (unary_expression
          (identifier)))
      (comparison_expression
        (identifier)
        (unary_expression
          (identifier)))))
  (abl_statement
    statement: (identifier))
  (variable_assignment
    (assignment
      (identifier)
      (ERROR
        (unary_expression
          (identifier)))
      (function_call
        function: (identifier)))))