Skip to content

Fix Io_Implied_Do rejecting a minimal-length io-implied-do (closes #524) - #525

Open
DisciplinedSoftware wants to merge 1 commit into
stfc:masterfrom
DisciplinedSoftware:524_io_implied_do
Open

Fix Io_Implied_Do rejecting a minimal-length io-implied-do (closes #524)#525
DisciplinedSoftware wants to merge 1 commit into
stfc:masterfrom
DisciplinedSoftware:524_io_implied_do

Conversation

@DisciplinedSoftware

Copy link
Copy Markdown

Closes #524.

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:4074). The guard is changed to < 9 and a minimal-length case is added to test_io_implied_do.

  • pytest src/fparser passes (2950 passed, 24 xfailed, 1 pre-existing xpassed)
  • black clean
  • CHANGELOG.md updated (the PR-number placeholder will be filled in once this PR's number is known)

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 18, 2026 05:25
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.match guard from len(string) <= 9 to len(string) < 9 to 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.

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.

Io_Implied_Do rejects a minimal-length io-implied-do such as (i,i=1,n)

2 participants