fortran-src icon indicating copy to clipboard operation
fortran-src copied to clipboard

Failed to parse this statement: `write(6,'(10(e12.5,a))') ((array(i),' '), i=1,nb)`

Open uNouss opened this issue 1 year ago • 0 comments

I have provided this code as an example.

      program main
      implicit none
      
      integer i
      integer nb
      parameter(nb=3)
      real array(nb)

*     -- initialize 'array'
      do i=1, nb
        array(i) = sin(real(i))
      enddo

*     -- print 'array' with '--' as separator
      write(6,'(10(f7.5,a))') ((array(i),'--'), i=1,nb)

      end

It's a Fortran77 code that I have retrieved and am working on. I'd like to parse it with fortran-src and get the corresponding AST.

But I have an error on line $15$.

As far as I know, this statement is valid in fortran77 (see https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vnc5/index.html ).

If so, is it possible to take this type of expression into account in the parser as part of read, write and print?

asciicast

uNouss avatar Jan 23 '24 10:01 uNouss