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

Allow space between "in" and "out" inside intent-spec "inout" #70 #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sgshulman
Copy link
Contributor

The standard allows this space. For example, see Fortran 2008 standard, section 3.3.2.2 Blank characters in free form.

@sgshulman sgshulman changed the title Allow space between "in" and "out" inside intent-spec "inout" satamas#70 Allow space between "in" and "out" inside intent-spec "inout" #70 Nov 28, 2020
@sizmailov
Copy link
Contributor

The standard allows this space. For example, see Fortran 2008 standard, section 3.3.2.2 Blank characters in free form.

I don't think this is technically correct since 3.3.2.2 prohibits spaces within token and section 5.3.10 lists three allowed tokens for intent-spec: INOUT, IN and OUT. Despite of that I think this is handy PR since there is a ton of legacy code with IN OUT intents which is now covered in distracting red.

@sgshulman
Copy link
Contributor Author

sgshulman commented Nov 28, 2020

@sizmailov Thank you for your response. The situation is a bit more complicated. Section 3.3.2.2 starts from:

  1. In free source form blank characters shall not appear within lexical tokens other than in a character context or in a format specification...

But several lines below we have:

One or more blanks shall be used to separate adjacent keywords except in the following cases, where blanks are
optional:
BLOCK DATA
DOUBLE PRECISION
ELSE IF
ELSE WHERE
END ASSOCIATE
END BLOCK
END BLOCK DATA
END CRITICAL
END DO
END ENUM
END FILE
END FORALL
END FUNCTION
END IF
END INTERFACE
END MODULE
END PROCEDURE
END PROGRAM
END SELECT
END SUBMODULE
END SUBROUTINE
END TYPE
END WHERE
GO TO
IN OUT
SELECT CASE
SELECT TYPE

I do not see any other places (except INTENT), where IN OUT keywords are neighbours.
As a result, I think it is correct from the standard point of view.

@sizmailov
Copy link
Contributor

Yeah, looks like you are right and I'm wrong.

I was under impression that people keep adding unnecessary spaces to f90+ sources just because they can (or to honor f77 compiler space-ignoring feature). I've seen dreadful abuses of this: spaces in programm and even in the middle of variable names...



The standard allows this space. For example, see Fortran 8 standard, section 3.3.2.2 Blank characters in free form
@LecrisUT
Copy link
Contributor

LecrisUT commented May 2, 2023

What is keeping this PR from being merged? Also does it account for arbitrary whitespace?

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.

3 participants