-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Fix crackfortran parsing error when a division occurs within a common block #28396
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
Conversation
Hi @nchristensen - can you add a test for this? Thanks! |
This comment was marked as resolved.
This comment was marked as resolved.
I had to simplify the example code, but the test seems to work now. |
I don't think the test failure is related. Ping @HaoZeke - would you mind taking a look at this? |
@HaoZeke ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nchristensen. I have an enhancement suggestion but otherwise this looks like a pragmatic solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very elegant fix, thanks @nchristensen !
Please squash when merging. |
Thanks @nchristensen . |
…ommon block (numpy#28396) * BUG: Fix crackpython parsing error when a division occurs within a common block * Add test for more complicated array sizing expression * fix typos * Simplify tests to currently supported syntax * Use regular expression to find common block name * Revert from broken regular expression version to prior version, add comment * Add space before inline comment * Use regular expression to split line * Add missing white space to appease linter * More linting fixes * Pass maxsplit as a keyword argument
…ommon block (numpy#28396) * BUG: Fix crackpython parsing error when a division occurs within a common block * Add test for more complicated array sizing expression * fix typos * Simplify tests to currently supported syntax * Use regular expression to find common block name * Revert from broken regular expression version to prior version, add comment * Add space before inline comment * Use regular expression to split line * Add missing white space to appease linter * More linting fixes * Pass maxsplit as a keyword argument
The
analyzeline
function currently passes over all/
characters, presumably assuming they only indicate the name of the common block. However, this means division operations after the common block name are also passed over.For instance
common /mortmp/ ctmp((lub*(lub+1)*(lub+1))/lpmin+1)
fails to parse correctly.
This pull request attempts to rectify this by counting the number of slashes encountered in the line and only passing over the first two.