From 36288578eeab077132f0d84cb6830a97f279f4f3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 16 Aug 2023 00:28:29 +0200 Subject: [PATCH] vim-patch:4868f637b84a Update syntax/fortran.vim (vim/vim#12798) Several small improvements including better discrimination of "real" used as a type and as an intrinsic https://github.com/vim/vim/commit/4868f637b84a18fd162db6eff6d716bf22595fd0 Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com> --- runtime/syntax/fortran.vim | 53 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index b5c9b1ef8d..fc6c82b480 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) -" Version: (v104) 2021 April 06 +" Version: (v105) 2023 August 14 " Maintainer: Ajit J. Thakkar ; " Usage: For instructions, do :help fortran-syntax from Vim " Credits: @@ -11,7 +11,7 @@ " Walter Dieudonne, Alexander Wagner, Roman Bertle, Charles Rendleman, " Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, Jan Hermann, " Stefano Zaghi, Vishnu V. Krishnan, Judicael Grasset, Takuma Yoshida, -" Eisuke Kawashima, Andre Chalella, and Fritz Reese. +" Eisuke Kawashima, Andre Chalella, Fritz Reese, and Karl D. Hammond. if exists("b:current_syntax") finish @@ -95,16 +95,14 @@ if exists("fortran_more_precise") syn match fortranConstructName "\(\" -syn match fortranType "\" -syn match fortranType "\" -syn match fortranType "\" -syn match fortranType "\" -syn match fortranType "\" +syn match fortranType "\" +syn match fortranType "\" syn keyword fortranType intrinsic -syn match fortranType "\" +syn match fortranType "\\s\+\(none\)\?" syn keyword fortranStructure dimension syn keyword fortranStorageClass parameter save syn match fortranUnitHeader "\" @@ -131,7 +129,8 @@ syn match fortranTypeOb "\" -syn match fortranType "\" +syn match fortranType "\\(\s\+is\>\)\?" +syn match fortranType "^\s*\(type\s\+\(is\)\? \)\?\s*\(real\|integer\|logical\|complex\|character\)\>" +syn match fortranType "^\s*\(implicit \)\?\s*\(real\|integer\|logical\|complex\|character\)\>" "Numbers of various sorts " Integers @@ -206,9 +206,6 @@ syn region fortranStringR start=+'+ end=+'+ contains=fortranContinueMark,fortran syn keyword fortranIntrinsicR dim lge lgt lle llt mod syn keyword fortranKeywordDel assign pause -syn match fortranType "\" -syn keyword fortranType none - syn keyword fortranStructure private public intent optional syn keyword fortranStructure pointer target allocatable syn keyword fortranStorageClass in out @@ -222,7 +219,8 @@ syn keyword fortranUnitHeader result operator assignment syn match fortranUnitHeader "\" syn keyword fortranKeyword allocate deallocate nullify cycle exit syn match fortranConditional "\" -syn keyword fortranConditional case default where elsewhere +syn match fortranConditional "\" +syn keyword fortranConditional where elsewhere syn match fortranOperator "\(\(>\|<\)=\=\|==\|/=\|=\)" syn match fortranOperator "=>" @@ -231,8 +229,7 @@ syn region fortranString start=+"+ end=+"+ contains=fortranLeftMargin,fortranCon syn keyword fortranIO pad position action delim readwrite syn keyword fortranIO eor advance nml -syn keyword fortranIntrinsic adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack precision present product radix random_number random_seed range repeat reshape rrspacing -syn keyword fortranIntrinsic scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify +syn match fortranIntrinsic '\<\(adjustl\|adjustr\|all\|allocated\|any\|associated\|bit_size\|btest\|ceiling\|count\|cshift\|date_and_time\|digits\|dot_product\|eoshift\|epsilon\|exponent\|floor\|fraction\|huge\|iand\|ibclr\|ibits\|ibset\|ieor\|ior\|ishft\|ishftc\|lbound\|len_trim\|matmul\|maxexponent\|maxloc\|maxval\|merge\|minexponent\|minloc\|minval\|modulo\|mvbits\|nearest\|pack\|precision\|present\|product\|radix\|random_number\|random_seed\|range\|repeat\|reshape\|rrspacing\|scale\|scan\|selected_int_kind\|selected_real_kind\|set_exponent\|shape\|size\|spacing\|spread\|sum\|system_clock\|tiny\|transpose\|trim\|ubound\|unpack\|verify\)\>\ze\s*(' syn match fortranIntrinsic "\\(\s*\.\)\@!"me=s+3 syn match fortranIntrinsic "\\s*[(,]"me=s+4 @@ -306,9 +303,9 @@ if b:fortran_dialect == "f08" syn match fortranType "\" + syn match fortranConditional "\" + syn match fortranConditional "\" syn match fortranUnitHeader "\" syn match fortranOperator "\([\|]\)" @@ -525,11 +522,6 @@ else hi! def link fortranConditionalR fortranConditional endif -" CUDA -hi def link fortranIntrinsicCUDA fortranIntrinsic -hi def link fortranTypeCUDA fortranType -hi def link fortranStringCUDA fortranString - hi def link fortranFormatSpec Identifier hi def link fortranFloat Float hi def link fortranPreCondit PreCondit @@ -543,8 +535,15 @@ hi def link fortranComment Comment hi def link fortranSerialNumber Todo hi def link fortranTab Error -" Uncomment the next line if you use extra intrinsics provided by vendors -"hi def link fortranExtraIntrinsic Function +if exists("fortran_CUDA") + hi def link fortranIntrinsicCUDA fortranIntrinsic + hi def link fortranTypeCUDA fortranType + hi def link fortranStringCUDA fortranString +endif + +if exists("fortran_vendor_intrinsics") + hi def link fortranExtraIntrinsic Function +endif let b:current_syntax = "fortran"