Fix Io_Implied_Do rejecting a minimal-length io-implied-do (closes #524) - #525
Open
DisciplinedSoftware wants to merge 1 commit into
Open
Fix Io_Implied_Do rejecting a minimal-length io-implied-do (closes #524)#525DisciplinedSoftware wants to merge 1 commit into
DisciplinedSoftware wants to merge 1 commit into
Conversation
The length guard in Io_Implied_Do.match used '<= 9' but the shortest legal io-implied-do, e.g. '(i,i=1,n)', is exactly 9 characters, so statements such as 'WRITE (IOUT,10) N,(I,I=1,J)' failed to parse. Found while parsing MODFLOW-2005 (gwf2swr7.f). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DisciplinedSoftware
force-pushed
the
524_io_implied_do
branch
from
August 18, 2026 05:25
3bf6c1e to
7989061
Compare
There was a problem hiding this comment.
Pull request overview
This pull request fixes an off-by-one length check in Io_Implied_Do.match that incorrectly rejected the shortest valid io-implied-do form (9 characters, e.g. (i,i=1,n)), causing valid WRITE statements to fail to parse (as reported in issue #524).
Changes:
- Adjust
Io_Implied_Do.matchguard fromlen(string) <= 9tolen(string) < 9to allow minimal-length io-implied-do constructs. - Add a regression test covering the 9-character minimal-length case in
test_io_implied_do. - Add a corresponding entry to
CHANGELOG.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/fparser/two/Fortran2003.py | Fixes the io-implied-do length guard off-by-one so minimal valid constructs are accepted. |
| src/fparser/two/tests/test_fortran2003.py | Adds a regression test for a minimal-length io-implied-do string. |
| CHANGELOG.md | Records the bugfix and references the associated issue/PR. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #524.
The length guard in
Io_Implied_Do.matchused<= 9, but the shortest legal io-implied-do, e.g.(i,i=1,n), is exactly 9 characters, so statements such asWRITE (IOUT,10) N,(I,I=1,J)failed to parse (found while parsing MODFLOW-2005,gwf2swr7.f:4074). The guard is changed to< 9and a minimal-length case is added totest_io_implied_do.pytest src/fparserpasses (2950 passed, 24 xfailed, 1 pre-existing xpassed)blackclean🤖 Generated with Claude Code