PSyclone
PSyclone copied to clipboard
Fortran array syntax not recognized
@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
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.