-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on concatenation of two strings with a backslash #457
Comments
Thanks for reporting this @mbraakhekke. Do you get the expected parse tree for the line in isolation? (I ask because you have to be careful as, unless you tell the reader you have free-format code, it will see the first |
You're right: the line gets interpreted as a comment. How do I tell the reader the file is free-format? |
It's slightly non-intuitive. You need to call set_format() on the reader object (https://fparser.readthedocs.io/en/latest/_static/html/classfparser_1_1common_1_1readfortran_1_1FortranReaderBase.html#ad9e18ea6d859fd5459381d4f1437311d) and pass it an appropriate sourceinfo.FortranFormat object: from fparser.common.sourceinfo import FortranFormat
reader = ...
reader.set_format(FortranFormat(is_free=True, is_strict=False))
... |
OK thanks. Now the parsing also fails with a |
The following minimal program results in a
NoMatchError
for line 2:I believe this is correct Fortran--at least it compiles fine on Intel.
I'm still investigating myself. It's doesn't seem to be a problem with the regex pattern for the
concat-op
. I think it has something to do with the fact that backslashes in strings get automatically escaped to\\
in Python.Interestingly, if I take out the line from the program block, i.e. just:
it works fine.
The text was updated successfully, but these errors were encountered: