PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

Fortran array syntax not recognized

Open hbrunie opened this issue 1 year ago • 1 comments

@pytest.mark.xfail
def test_psyclone_special_array_notation():
    code = """subroutine foo(a, n)
  integer :: n
  real*8, dimension(5) :: a

  a = (/2, 3, 4, 1/)

end subroutine foo\n"""
    reader = FortranReader()
    psyir_tree: Node = reader.psyir_from_source(code)
    assert len(psyir_tree.walk(CodeBlock)) == 0, psyir_tree.walk(CodeBlock)[
        0
    ].debug_string()
    writer = FortranWriter()
    output = writer(psyir_tree)
    assert code == output

hbrunie avatar Sep 25 '24 09:09 hbrunie

This would need us to handle Array_Constructor (from fparser), and turn it into a literal (or literal subclass, maybe ArrayLiteral). Unless we have a use-case where we need to analyse these structures (e.g. during declarations for declaration ordering is a possibility) then I think there's no rush.

LonelyCat124 avatar Oct 21 '25 13:10 LonelyCat124