" Vim syntax file
" Language: IRPF90
" Version: 0.1
" URL:
" Last Change: 2010 Jun. 9
" Maintainer:
" Usage: Do :help irpf90-syntax from Vim
" Credits:
" Version 0.1 was based on the fortran 95 syntax file by Ajit J. Thakkar
if version < 600
let b:current_syntax = "fortran"
finish
elseif exists("b:current_syntax")
finish
endif
let b:current_syntax = "irpf90"
syn case ignore
syn match irpf90Identifier "\<\a\w*\>" contains=irpf90SerialNumber
syn match irpf90ConstructName "^\s*\zs\a\w*\ze\s*:"
syn match irpf90ConstructName "\(\"
syn keyword irpf90Type character complex integer
syn keyword irpf90Type intrinsic
syn match irpf90Type "\"
syn keyword irpf90Structure dimension
syn keyword irpf90StorageClass parameter save
syn match irpf90UnitHeader "\"
syn keyword irpf90Call call
syn match irpf90UnitHeader "\"
syn match irpf90UnitHeader "\"
syn keyword irpf90Statement return stop
syn keyword irpf90Conditional else then
syn match irpf90Conditional "\"
syn match irpf90Repeat "\"
syn keyword irpf90Todo contained todo fixme
"Catch errors caused by too many right parentheses
syn region irpf90Paren transparent start="(" end=")" contains=ALLBUT,irpf90ParenError,@irpf90CommentGroup,cIncluded
syn match irpf90ParenError ")"
syn match irpf90Operator "\.\s*n\=eqv\s*\."
syn match irpf90Operator "\.\s*\(and\|or\|not\)\s*\."
syn match irpf90Operator "\(+\|-\|/\|\*\)"
syn match irpf90Boolean "\.\s*\(true\|false\)\s*\."
syn keyword irpf90ReadWrite backspace close inquire open rewind endfile
syn keyword irpf90ReadWrite read write print
"If tabs are allowed then the left margin checks do not work
if exists("irpf90_have_tabs")
syn match irpf90Tab "\t" transparent
else
syn match irpf90Tab "\t"
endif
syn keyword irpf90IO unit file iostat access blank fmt form
syn keyword irpf90IO recl status exist opened number named name
syn keyword irpf90IO sequential direct rec
syn keyword irpf90IO formatted unformatted nextrec
syn keyword irpf9066Intrinsic cabs ccos cexp clog csin csqrt
syn keyword irpf9066Intrinsic dacos dasin datan datan2 dcos dcosh
syn keyword irpf9066Intrinsic ddim dexp dint dlog dlog10 dmod dabs
syn keyword irpf9066Intrinsic dnint dsign dsin dsinh dsqrt dtan
syn keyword irpf9066Intrinsic dtanh iabs idim idnint isign idint ifix
syn keyword irpf9066Intrinsic amax0 amax1 dmax1 max0 max1
syn keyword irpf9066Intrinsic amin0 amin1 dmin1 min0 min1
syn keyword irpf9066Intrinsic amod float sngl alog alog10
" Intrinsics provided by some vendors
syn keyword irpf90ExtraIntrinsic cdabs cdcos cdexp cdlog cdsin cdsqrt
syn keyword irpf90ExtraIntrinsic cqabs cqcos cqexp cqlog cqsin cqsqrt
syn keyword irpf90ExtraIntrinsic qacos qasin qatan qatan2 qcos qcosh
syn keyword irpf90ExtraIntrinsic qdim qexp iqint qlog qlog10 qmod qabs
syn keyword irpf90ExtraIntrinsic qnint qsign qsin qsinh qsqrt qtan
syn keyword irpf90ExtraIntrinsic qtanh qmax1 qmin1
syn keyword irpf90ExtraIntrinsic dimag qimag dcmplx qcmplx dconjg qconjg
syn keyword irpf90ExtraIntrinsic gamma dgamma qgamma algama dlgama qlgama
syn keyword irpf90ExtraIntrinsic erf derf qerf erfc derfc qerfc
syn keyword irpf90ExtraIntrinsic dfloat
syn keyword irpf90Intrinsic abs acos aimag aint anint asin atan atan2
syn keyword irpf90Intrinsic cos sin tan sinh cosh tanh exp log log10
syn keyword irpf90Intrinsic sign sqrt int cmplx nint min max conjg
syn keyword irpf90Intrinsic char ichar index
syn match irpf90Intrinsic "\"
syn match irpf90Intrinsic "\"
"Numbers of various sorts
" Integers
syn match irpf90Number display "\<\d\+\(_\a\w*\)\=\>"
" floating point number, without a decimal point
syn match irpf90FloatNoDec display "\<\d\+[deq][-+]\=\d\+\(_\a\w*\)\=\>"
" floating point number, starting with a decimal point
syn match irpf90FloatIniDec display "\.\d\+\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>"
" floating point number, no digits after decimal
syn match irpf90FloatEndDec display "\<\d\+\.\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>"
" floating point number, D or Q exponents
syn match irpf90FloatDExp display "\<\d\+\.\d\+\([dq][-+]\=\d\+\)\=\(_\a\w*\)\=\>"
" floating point number
syn match irpf90Float display "\<\d\+\.\d\+\(e[-+]\=\d\+\)\=\(_\a\w*\)\=\>"
" Numbers in formats
syn match irpf90FormatSpec display "\d*f\d\+\.\d\+"
syn match irpf90FormatSpec display "\d*e[sn]\=\d\+\.\d\+\(e\d+\>\)\="
syn match irpf90FormatSpec display "\d*\(d\|q\|g\)\d\+\.\d\+\(e\d+\)\="
syn match irpf90FormatSpec display "\d\+x\>"
" The next match cannot be used because it would pick up identifiers as well
" syn match irpf90FormatSpec display "\<\(a\|i\)\d\+"
" Numbers as labels
syn match irpf90LabelNumber display "^\d\{1,5}\s"me=e-1
syn match irpf90LabelNumber display "^ \d\{1,4}\s"ms=s+1,me=e-1
syn match irpf90LabelNumber display "^ \d\{1,3}\s"ms=s+2,me=e-1
syn match irpf90LabelNumber display "^ \d\d\=\s"ms=s+3,me=e-1
syn match irpf90LabelNumber display "^ \d\s"ms=s+4,me=e-1
if version >= 600 && exists("irpf90_more_precise")
" Numbers as targets
syn match irpf90Target display "\(\"
syn match irpf90Target display "\(\"
syn match irpf90Target display "\(\"
endif
syn keyword irpf90TypeEx external
syn keyword irpf90IOEx format
syn keyword irpf90StatementEx continue
syn match irpf90StatementEx "\"
syn region irpf90StringEx start=+'+ end=+'+ contains=irpf90ContinueMark,irpf90LeftMargin,irpf90SerialNumber
syn keyword irpf90IntrinsicEx dim lge lgt lle llt mod
syn keyword irpf90StatementOb assign pause to
syn keyword irpf90Type type none
syn keyword irpf90Structure private public intent optional
syn keyword irpf90Structure pointer target allocatable
syn keyword irpf90StorageClass in out
syn match irpf90StorageClass "\"
syn keyword irpf90UnitHeader use only contains
syn keyword irpf90UnitHeader result operator assignment
syn match irpf90UnitHeader "\"
syn match irpf90UnitHeader "\"
syn keyword irpf90Statement allocate deallocate nullify cycle exit
syn match irpf90Conditional "\