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

Fortran: Fix parsing of statement functions #14

Open
stevewpalmer opened this issue Nov 28, 2024 · 1 comment
Open

Fortran: Fix parsing of statement functions #14

stevewpalmer opened this issue Nov 28, 2024 · 1 comment
Assignees

Comments

@stevewpalmer
Copy link
Owner

We need to add support for the ability to assign input and calculations to character substrings.

@stevewpalmer stevewpalmer self-assigned this Jan 1, 2025
@stevewpalmer
Copy link
Owner Author

stevewpalmer commented Jan 5, 2025

The issue here is that parsing statement functions is being confused by substring assignments. We need to fix the code that detects whether a line is a statement function via the following rules:

<f-ident><param-l><ident*><param-r><eqop><expression>

where <f-ident> may not be predefined as an array and the left hand expression may not contain substrings. Statement expressions must follow initialisation but precede the first executable statement.

There are other issues with statement expression parsing that need to be resolved here so I'm changing the issue title since once these are fixed, substring assignment will start working without any other changes (com already supports them in the assignment parse node implementation).

  1. Ensure statement functions precede any executable code.
  2. Ensure statement functions are not recursive.
  3. Arguments may not be functions or arrays.
  4. Statement functions cannot be EXTERNAL.

See here for more details. We also need better unit tests to validate all the above.

@stevewpalmer stevewpalmer changed the title Support Fortran substring assignment Fix parsing of statement functions Jan 5, 2025
@stevewpalmer stevewpalmer changed the title Fix parsing of statement functions Fortran: Fix parsing of statement functions Jan 5, 2025
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

No branches or pull requests

1 participant