fortran-plugin icon indicating copy to clipboard operation
fortran-plugin copied to clipboard

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

Open sgshulman opened this issue 4 years ago • 4 comments

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

sgshulman avatar Nov 28 '20 18:11 sgshulman

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.

sizmailov avatar Nov 28 '20 20:11 sizmailov

@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.

sgshulman avatar Nov 28 '20 21:11 sgshulman

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...

sizmailov avatar Nov 28 '20 22:11 sizmailov

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

LecrisUT avatar May 02 '23 15:05 LecrisUT