From be8a06aff180c10900dc0faf3df119f2e40d0b7e Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Mon, 8 Nov 2021 23:03:33 +0100 Subject: [PATCH 1/3] +add: A Fortran Lexer test file --- .../styleLexFortan/Fortran_Control.f90 | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/test_files/StyleLexers/styleLexFortan/Fortran_Control.f90 diff --git a/test/test_files/StyleLexers/styleLexFortan/Fortran_Control.f90 b/test/test_files/StyleLexers/styleLexFortan/Fortran_Control.f90 new file mode 100644 index 000000000..a91615985 --- /dev/null +++ b/test/test_files/StyleLexers/styleLexFortan/Fortran_Control.f90 @@ -0,0 +1,49 @@ +! An example of reading a simple control with labels. +! +! Jason Blevins +! Durham, May 6, 2008 + +program control_file + implicit none + + ! Input related variables + character(len=100) :: buffer, label + integer :: pos + integer, parameter :: fh = 15 + integer :: ios = 0 + integer :: line = 0 + + ! Control file variables + real :: pi + integer, dimension(5) :: vector + + open(fh, file='control_file.txt') + + ! ios is negative if an end of record condition is encountered or if + ! an endfile condition was detected. It is positive if an error was + ! detected. ios is zero otherwise. + + do while (ios == 0) + read(fh, '(A)', iostat=ios) buffer + if (ios == 0) then + line = line + 1 + + ! Find the first instance of whitespace. Split label and data. + pos = scan(buffer, ' ') + label = buffer(1:pos) + buffer = buffer(pos+1:) + + select case (label) + case ('pi') + read(buffer, *, iostat=ios) pi + print *, 'Read pi: ', pi + case ('vector') + read(buffer, *, iostat=ios) vector + print *, 'Read vector: ', vector + case default + print *, 'Skipping invalid label at line', line + end select + end if + end do + +end program control_file From 65a298422e71ae3fe061ccfdd10e006e87ad31cd Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Mon, 8 Nov 2021 23:24:50 +0100 Subject: [PATCH 2/3] - fix correction of typo --- .../{styleLexFortan => styleLexFortran}/Fortran_Control.f90 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/test_files/StyleLexers/{styleLexFortan => styleLexFortran}/Fortran_Control.f90 (100%) diff --git a/test/test_files/StyleLexers/styleLexFortan/Fortran_Control.f90 b/test/test_files/StyleLexers/styleLexFortran/Fortran_Control.f90 similarity index 100% rename from test/test_files/StyleLexers/styleLexFortan/Fortran_Control.f90 rename to test/test_files/StyleLexers/styleLexFortran/Fortran_Control.f90 From 91cab8f1e85b45175f4b587e40a7ec2124681677 Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Tue, 9 Nov 2021 10:32:50 +0100 Subject: [PATCH 3/3] +enh: Lexer Fortran: extended intrinsic functions --- src/StyleLexers/styleLexFortran.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/StyleLexers/styleLexFortran.c b/src/StyleLexers/styleLexFortran.c index ad18fccdc..1b9bd8d19 100644 --- a/src/StyleLexers/styleLexFortran.c +++ b/src/StyleLexers/styleLexFortran.c @@ -3,6 +3,7 @@ // ---------------------------------------------------------------------------- // https://en.wikibooks.org/wiki/Fortran +// https://releases.llvm.org/11.0.0/tools/flang/docs/Intrinsics.html // ---------------------------------------------------------------------------- @@ -22,12 +23,20 @@ KEYWORDLIST KeyWords_Fortran = "sign size stat status stop stream subroutine target then to type unformatted unit use value volatile wait where while write", // Intrinsic functions - "achar adjustl adjustr aimag aint all alog alog10 amax0 amax1 amin0 amin1 amod anint any atan2 bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 " - "bessel_yn bge bgt ble blt btest cabs ccos ceiling cexp char clog conjg count csin csqrt ctan dabs dacos dasin datan datan2 dble dcos dcosh ddim dexp " - "dint dlog dlog10 dmax1 dmin1 dmod dnint dprod dsign dsin dsinh dsqrt dtan dtanh erf erfc erfc_scaled exponent findloc float floor fraction gamma " - "hypot iabs iachar iall iany ibclr ibits ibset ichar idim idint idnint ifix image_status index int iparity is_iostat_end is_iostat_eor ishft ishftc " - "isign leadz len len_trim lge lgt lle llt log_gamma log10 logical maskl maskr max0 max1 maxloc maxval merge min0 min1 minloc minval nearest nint " - "norm2 not parity popcnt poppar product real rrspacing scale scan set_exponent shifta shiftl shiftr sngl spacing sum trailz verify", + "achar adjustl adjustr aimag aint alog alog10 amax0 amax1 amin0 amin1 amod anint associated atan2 baddress " + "bessel_j0 bessel_j1 bessel_y0 bessel_y1 bge bgt bit_size ble blt btest cabs cachesize ccos ceiling cexp char " + "clog command_argument_count compl conjg coshape cotan cotand cshift csin csqrt ctan dabs dacos dasin datan " + "datan2 dble dcos dcosh ddim dexp dfloat digits dint dlog dlog10 dmax1 dmin1 dmod dnint dnum dprod dsign dsin " + "dsinh dsqrt dtan dtanh eof eoshift epsilon eqv erf erfc erfc_scaled exponent extends_type_of failed_images " + "float floor fp_class fraction gamma get_team hypot iabs iachar iaddr iarg iargc ibchng ibclr ibits ibset ichar " + "idim idint idnint ifix ilen image_status index int int_ptr_kind int8 inum is_contiguous is_iostat_end " + "is_iostat_eor isha ishc ishft ishftc ishl isign isnan ixor izext jint jnint jnum kind knint knum lbound " + "lcobound leadz len len_trim lge lgt lle llt log_gamma log10 logical malloc maskl maskr max0 max1 maxexponent " + "mclock merge min0 min1 minexponent nargs nearest neqv new_line nint not null numarg pack popcnt poppar " + "precision present qcmplx qext qfloat qnum qreal radix ran ranf range rank real reduce repeat reshape rnum " + "rrspacing same_type_as scale scan secnds selected_char_kind selected_int_kind selected_real_kind set_exponent " + "shape shift shifta shiftl shiftr size sizeof sngl spacing spread stopped_images storage_size team_number " + "this_image tiny trailz transpose trim ubound ucobound unpack verify", // Extended and user defined functions "",