Skip to content
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

Fix block parsing #228

Merged
merged 1 commit into from
Jun 22, 2022
Merged

Fix block parsing #228

merged 1 commit into from
Jun 22, 2022

Conversation

RaoulHC
Copy link
Collaborator

@RaoulHC RaoulHC commented Jun 21, 2022

The way it currently worked meant it would fail to parse includes that
didn't end with a newline, which is valid. To allow this the block
parsing had to be reorganized, with the block parser not expecting
trailing newlines, but otherwise behaves the same.

We might want to do this for other parsers, but because they currently
don't expand includes, it's not actually a problem for them.

Copy link
Collaborator

@raehik raehik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language.Fortran.Parser.f77lIncludesInline snocs a newline onto include files before parsing them with a note about this behaviour you've fixed. We should update the comment there (and remove the snoc as long as it has no unexpected consequences).

test-data/f77-include/foo.f Outdated Show resolved Hide resolved
src/Language/Fortran/Parser/Fixed/Fortran77.y Show resolved Hide resolved
@raehik
Copy link
Collaborator

raehik commented Jun 22, 2022

Cheers for this. I had felt the previous design was a bit of a code smell, swapping unlines for intercalate "\n" feels like an improvement.
Have made a note for pulling this into the other parsers #229 .

@RaoulHC
Copy link
Collaborator Author

RaoulHC commented Jun 22, 2022

Removed that snoc and comment, looks like I was the person to add it in the first place.

The way it currently worked meant it would fail to parse includes that
didn't end with a newline, which is valid. To allow this the block
parsing had to be reorganized, with the block parser not expecting
trailing newlines, but otherwise behaves the same.
@raehik raehik merged commit e6f750f into master Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants