Skip to content

Incorrect parsing of && as two unary & #413

@akimd

Description

@akimd

Hi,

In the following example (a) && (b > 0) is mistakenly parsed as a cast to type a of &(&(b > 0)).

Cheers.

$ echo 'res = (a) && (b > 0);' | tree-sitter parse --no-ranges
(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (cast_expression
          type: (identifier)
          value: (prefix_unary_expression
            (prefix_unary_expression
              (parenthesized_expression
                (binary_expression
                  left: (identifier)
                  right: (integer_literal))))))))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions