Skip to content

tree-sitter-fortran errors parsing an assignment to an array called if #136

@inaki-amatria

Description

@inaki-amatria
  • tree-sitter-fortran version is: 64e11001d7ef3e8ac18e55a3a2d811fe36430923
  • Reduced test case is:
! foo.f90
program main
  integer, dimension(10, 10) :: if
  do i = 1, 10
    if(i, i) = 0
  end do
end
  • Current behavior:
(translation_unit [0, 0] - [7, 0]
  (comment [0, 0] - [0, 9])
  (program [1, 0] - [7, 0]
    (program_statement [1, 0] - [2, 0]
      (name [1, 8] - [1, 12]))
    (variable_declaration [2, 2] - [2, 34]
      type: (intrinsic_type [2, 2] - [2, 9])
      attribute: (type_qualifier [2, 11] - [2, 28]
        (argument_list [2, 20] - [2, 28]
          (number_literal [2, 21] - [2, 23])
          (number_literal [2, 25] - [2, 27])))
      declarator: (identifier [2, 32] - [2, 34]))
    (do_loop_statement [3, 2] - [5, 8]
      (loop_control_expression [3, 5] - [3, 14]
        (identifier [3, 5] - [3, 6])
        (number_literal [3, 9] - [3, 10])
        (number_literal [3, 12] - [3, 14]))
      (assignment_statement [4, 4] - [4, 16]
        left: (identifier [4, 4] - [4, 6])
        (ERROR [4, 6] - [4, 12]
          (parenthesized_expression [4, 6] - [4, 12]
            (identifier [4, 7] - [4, 8])
            (ERROR [4, 8] - [4, 11])))
        right: (number_literal [4, 15] - [4, 16]))
      (end_do_loop_statement [5, 2] - [5, 8]))
    (end_program_statement [6, 0] - [7, 0])))
foo.f90	   0.53 ms	   196 bytes/ms	(ERROR [4, 6] - [4, 12])
  • Expected behavior: tree-sitter-fortran parses line 5 as an assignment statement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions