You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open a new file a.f90 (syntax highlighting enabled, Fortran free source)
Enter some variable declaration (with explicit kind):
real(kind=wp) :: foo
integer(kind=iwp) :: bar
Expected behaviour
Both type keywords (real and integer) should be highlighted with the same color, but they appear different (blue and green, respectively, in my system).
It seems real is recognized as the function instead of the type. Writing implicit real(kind=wp) fixes it.
Version of Vim
8.2 (2019 Dec 12, compiled Sep 13 2022 09:35:02)
Environment
Ubuntu 22.04, on Konsole
Logs and stack traces
No response
The text was updated successfully, but these errors were encountered:
I don't know Fortran, but it seems that the language supports a real data type, and a real() function. And when the real data type is written in a variable declaration, it might be followed by a parenthesis, making real ambiguous. If so, the syntax plugin might need a more accurate rule to avoid matching real as a function name, when it's actually a data type. It seems that declarations usually contain the token ::. Maybe we need to disallow its presence:
diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim
index b5c9b1ef8..31a0c5ca8 100644
--- a/runtime/syntax/fortran.vim+++ b/runtime/syntax/fortran.vim@@ -149,7 +149,7 @@ syn keyword fortranExtraIntrinsic algama cdabs cdcos cdexp cdlog cdsin cdsqrt cq
syn keyword fortranIntrinsic abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh
syn match fortranIntrinsic "\<len\s*[(,]"me=s+3
-syn match fortranIntrinsic "\<real\s*("me=s+4+syn match fortranIntrinsic "\<real\s*(\%(.*::\)\@!"me=s+4
syn match fortranIntrinsic "\<logical\s*("me=s+7
syn match fortranType "\<implicit\s\+real\>"
syn match fortranType "\<implicit\s\+logical\>"
In any case, I suggest you discuss this issue with the maintainer of the Fortran syntax plugin whose contact information is given at the top of the script:
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
They will decide how the issue should be fixed (if at all), then send their changes to the Vim devs to be merged in the next update of the runtime files (the last one occurred a few days ago).
Steps to reproduce
a.f90
(syntax highlighting enabled, Fortran free source)Expected behaviour
Both type keywords (
real
andinteger
) should be highlighted with the same color, but they appear different (blue and green, respectively, in my system).It seems
real
is recognized as the function instead of the type. Writingimplicit real(kind=wp)
fixes it.Version of Vim
8.2 (2019 Dec 12, compiled Sep 13 2022 09:35:02)
Environment
Ubuntu 22.04, on Konsole
Logs and stack traces
No response
The text was updated successfully, but these errors were encountered: