stfc / fparser

This project maintains and develops a Fortran parser called fparser2 written purely in Python which supports Fortran 2003 and some Fortran 2008. A legacy parser fparser1 is also available but is not supported. The parsers were originally part of the f2py project by Pearu Peterson.
https://fparser.readthedocs.io
Other
61 stars 29 forks source link

Bug parsing write statement #64

Closed bonfus closed 6 years ago

bonfus commented 6 years ago

The following code compiles fine but is not parsed by the Fortran2003 module.

program ma
      WRITE(*,'(5X,"q_mesh =",4F12.8)') 1.d0, 2.d0, 3.d0, 4.d0
end program ma

code used:

# coding: utf-8
from fparser.api import Fortran2003
from fparser.readfortran import FortranFileReader
reader = FortranFileReader("test.f90")
Fortran2003.Program(reader)
arporter commented 6 years ago

Thanks for this report. I can reproduce the failure and will investigate further.

arporter commented 6 years ago

Bug was due to an over-zealous search for the '=' character in keyword-value pairs. It failed to allow for the case where an '=' character is in fact inside a string.

rupertford commented 6 years ago

pr #66 is now on master so closing this issue.