diff options
author | Christian Clason <c.clason@uni-graz.at> | 2023-05-15 09:38:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-15 09:38:32 +0200 |
commit | c11986ed1a816d7ebcb5a5f707e3ef884f278293 (patch) | |
tree | b6cdae22f19baf94e31ef7dd14cc8b1ba94514a8 /runtime/syntax | |
parent | 189e21ae50efe14d8446db11aee6b50f8022d99f (diff) | |
download | rneovim-c11986ed1a816d7ebcb5a5f707e3ef884f278293.tar.gz rneovim-c11986ed1a816d7ebcb5a5f707e3ef884f278293.tar.bz2 rneovim-c11986ed1a816d7ebcb5a5f707e3ef884f278293.zip |
vim-patch:b7398fe41c9e (#23627)
Update runtime files
https://github.com/vim/vim/commit/b7398fe41c9e1e731d058105a34158871ee83e3f
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime/syntax')
-rw-r--r-- | runtime/syntax/dts.vim | 5 | ||||
-rw-r--r-- | runtime/syntax/luau.vim | 15 | ||||
-rw-r--r-- | runtime/syntax/nasm.vim | 72 | ||||
-rw-r--r-- | runtime/syntax/xpm.vim | 181 |
4 files changed, 182 insertions, 91 deletions
diff --git a/runtime/syntax/dts.vim b/runtime/syntax/dts.vim index be51ab5b10..bb7eff7be1 100644 --- a/runtime/syntax/dts.vim +++ b/runtime/syntax/dts.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: dts/dtsi (device tree files) " Maintainer: Daniel Mack <vim@zonque.org> -" Last Change: 2022 Jun 14 +" Last Change: 2023 Apr 28 if exists("b:current_syntax") finish @@ -10,9 +10,10 @@ let b:current_syntax = 'dts' syntax region dtsComment start="/\*" end="\*/" syntax match dtsReference "&[[:alpha:][:digit:]_]\+" +syntax match dtsReference "&{[[:alpha:][:digit:]@_/-]\+}" syntax region dtsBinaryProperty start="\[" end="\]" syntax match dtsStringProperty "\".*\"" -syntax match dtsKeyword "/.\{-1,\}/" +syntax match dtsKeyword "/[[:alpha:][:digit:]-]\+/\([[:space:]]\|;\)"he=e-1 syntax match dtsLabel "^[[:space:]]*[[:alpha:][:digit:]_]\+:" syntax match dtsNode /[[:alpha:][:digit:]-_]\+\(@[0-9a-fA-F]\+\|\)[[:space:]]*{/he=e-1 syntax region dtsCellProperty start="<" end=">" contains=dtsReference,dtsBinaryProperty,dtsStringProperty,dtsComment diff --git a/runtime/syntax/luau.vim b/runtime/syntax/luau.vim new file mode 100644 index 0000000000..59eccac100 --- /dev/null +++ b/runtime/syntax/luau.vim @@ -0,0 +1,15 @@ +" Vim syntax file +" Language: Luau +" Maintainer: None yet +" Last Change: 2023 Apr 30 + +if exists("b:current_syntax") + finish +endif + +" Luau is a superset of lua +runtime! syntax/lua.vim + +let b:current_syntax = "luau" + +" vim: nowrap sw=2 sts=2 ts=8 noet: diff --git a/runtime/syntax/nasm.vim b/runtime/syntax/nasm.vim index d763033225..0eb82fad10 100644 --- a/runtime/syntax/nasm.vim +++ b/runtime/syntax/nasm.vim @@ -3,8 +3,12 @@ " Maintainer: Andrii Sokolov <andriy145@gmail.com> " Original Author: Manuel M.H. Stol <Manuel.Stol@allieddata.nl> " Former Maintainer: Manuel M.H. Stol <Manuel.Stol@allieddata.nl> -" Contributors: Leonard König <leonard.r.koenig@gmail.com> (C string highlighting), Peter Stanhope <dev.rptr@gmail.com> (Add missing 64-bit mode registers) -" Last Change: 2017 Jan 23 +" Contributors: +" Leonard König <leonard.r.koenig@gmail.com> (C string highlighting), +" Peter Stanhope <dev.rptr@gmail.com> (Add missing 64-bit mode registers) +" Frédéric Hamel <rederic.hamel123@gmail.com> (F16c support, partial AVX +" support, other) +" Last Change: 2022 May 3 " NASM Home: http://www.nasm.us/ @@ -277,7 +281,7 @@ syn match nasmInstrModifier "\<F\(ADD\|MUL\|\(DIV\|SUB\)R\=\)\s\+TO\>"lc=5,ms= " NAsm directives syn keyword nasmRepeat TIMES syn keyword nasmDirective ALIGN[B] INCBIN EQU NOSPLIT SPLIT -syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT +syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT DEFAULT syn keyword nasmDirective ENDSECTION ENDSEGMENT syn keyword nasmDirective __SECT__ " Macro created standard directives: (requires %include) @@ -309,7 +313,7 @@ syn match nasmStdInstruction "\<\(CMOV\|J\|SET\)\(N\=\([ABGL]E\=\|[CEOSZ]\)\|P syn match nasmStdInstruction "\<POP\>" syn keyword nasmStdInstruction AAA AAD AAM AAS ADC ADD AND syn keyword nasmStdInstruction BOUND BSF BSR BSWAP BT[C] BTR BTS -syn keyword nasmStdInstruction CALL CBW CDQ CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ +syn keyword nasmStdInstruction CALL CBW CDQ CDQE CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ syn keyword nasmStdInstruction CMPXCHG CMPXCHG8B CPUID CWD[E] CQO syn keyword nasmStdInstruction DAA DAS DEC DIV ENTER syn keyword nasmStdInstruction IDIV IMUL INC INT[O] IRET[D] IRETW IRETQ @@ -319,6 +323,7 @@ syn keyword nasmStdInstruction LODSW LOOP[E] LOOPNE LOOPNZ LOOPZ LSS syn keyword nasmStdInstruction MOVSB MOVSD MOVSW MOVSX MOVSQ MOVZX MUL NEG NOP NOT syn keyword nasmStdInstruction OR POPA[D] POPAW POPF[D] POPFW POPFQ syn keyword nasmStdInstruction PUSH[AD] PUSHAW PUSHF[D] PUSHFW PUSHFQ +syn keyword nasmStdInstruction PAUSE syn keyword nasmStdInstruction RCL RCR RETF RET[N] ROL ROR syn keyword nasmStdInstruction SAHF SAL SAR SBB SCASB SCASD SCASW syn keyword nasmStdInstruction SHL[D] SHR[D] STC STD STOSB STOSD STOSW STOSQ SUB @@ -405,6 +410,62 @@ syn keyword nasmSseInstruction ORPS RCPPS RCPSS RSQRTPS RSQRTSS syn keyword nasmSseInstruction SHUFPS SQRTPS SQRTSS STMXCSR SUBPS SUBSS syn keyword nasmSseInstruction UCOMISS UNPCKHPS UNPCKLPS XORPS +" F16c Instructions +syn keyword nasmF16CInstruction VCVTPH2PS VCVTPS2PH + +" AVX Instructions +syn keyword nasmAVXInstruction VCVTDQ2PD VCVTDQ2PS VCVTPD2DQ VCVTPD2P VCVTPD2PS +syn keyword nasmAVXInstruction VCVTPS2DQ VCVTPS2PD +syn keyword nasmAVXInstruction VCVTSD2SI VCVTSD2SS VCVTSI2SD VCVTSI2SS VCVTSS2SD VCVTSS2SI +syn keyword nasmAVXInstruction VMAXPS VMAXSS VMINPS VMINSS VMOVAPS VMOVHLPS VMOVHPS +syn keyword nasmAVXInstruction VMAXPD VMAXSD VMINPD VMINSD VMOVAPD VMOVHLPD VMOVHPD +syn keyword nasmAVXInstruction VMOVLHPS VMOVLPS VMOVMSKPS VMOVNTPS VMOVSS VMOVUPS +syn keyword nasmAVXInstruction VMULPS VMULSS VPXOR + +syn match nasmInstructnError "\<VP\a\{3}R\a\>" +syn match nasmAVXInstruction "\<VP\(INS\|EXT\)R[BDQW]\>" + +syn keyword nasmAVXInstruction VORPS VPABSB VPABSD VPABSW +syn keyword nasmAVXInstruction PACKSSDW VPACKSSWB VPACKUSDW VPACKUSWB VPADDD +syn keyword nasmAVXInstruction PADDQ VPADDSB VPADDSW VPADDUSB VPADDUSW +syn keyword nasmAVXInstruction PADDW VPALIGNR VPAND VPANDN VPAVGB +syn keyword nasmAVXInstruction PAVGW VPBLENDD VPBLENDVB VPBLENDW VPBROADCASTB +syn keyword nasmAVXInstruction PBROADCASTD VPBROADCASTQ VPBROADCASTW VPCLMULQDQ VPCMOV +syn keyword nasmAVXInstruction PCMPEQB VPCMPEQD VPCMPEQQ VPCMPEQW VPCMPESTRI +syn keyword nasmAVXInstruction PCMPESTRM VPCMPGTB VPCMPGTD VPCMPGTQ VPCMPGTW +syn keyword nasmAVXInstruction PCMPISTRI VPCMPISTRM VPCOMB VPCOMD VPCOMQ +syn keyword nasmAVXInstruction PCOMUB VPCOMUD VPCOMUQ VPCOMUW VPCOMW +syn keyword nasmAVXInstruction PERM2FVPERM2IVPERMD VPERMIL2PD VPERMIL2PS VPERMILPD VPERMILPS +syn keyword nasmAVXInstruction PERMPD VPERMPS VPERMQ VPEXTRB VPEXTRD +syn keyword nasmAVXInstruction PEXTRQ VPEXTRW VPGATHERDD VPGATHERDQ VPGATHERQD +syn keyword nasmAVXInstruction PGATHERQQ VPHADDBD VPHADDBQ VPHADDBW VPHADDD +syn keyword nasmAVXInstruction PHADDDQ VPHADDSW VPHADDUBQ VPHADDUBW VPHADDUDQ +syn keyword nasmAVXInstruction PHADDUWD VPHADDUWQ VPHADDW VPHADDWD VPHADDWQ +syn keyword nasmAVXInstruction PHMINPOSUW VPHSUBBW VPHSUBD VPHSUBDQ VPHSUBSW +syn keyword nasmAVXInstruction PHSUBW VPHSUBWD VPINSRB VPINSRD VPINSRQ +syn keyword nasmAVXInstruction PINSRW VPMACSDD VPMACSDQH +syn keyword nasmAVXInstruction VPMACSDQL VPMACSSDD VPMACSSDQL VPMACSSQH VPMACSSWD +syn keyword nasmAVXInstruction VPMACSSWW VPMACSWD VPMACSWW VPMADCSSWD VPMADCSWD +syn keyword nasmAVXInstruction VPMADDUBSW VPMADDWD VPMASKMOVD VPMASKMOVQ VPMAXSB +syn keyword nasmAVXInstruction VPMAXSD VPMAXSW VPMAXUB VPMAXUD VPMAXUW +syn keyword nasmAVXInstruction VPMINSB VPMINSD VPMINSW VPMINUB VPMINUD +syn keyword nasmAVXInstruction VPMINUW VPMOVMSKB VPMOVSXBD VPMOVSXBQ VPMOVSXBW +syn keyword nasmAVXInstruction VPMOVSXDQ VPMOVSXWD VPMOVSXWQ VPMOVZXBD VPMOVZXBQ +syn keyword nasmAVXInstruction VPMOVZXBW VPMOVZXDQ VPMOVZXWD VPMOVZXWQ VPMULDQ +syn keyword nasmAVXInstruction VPMULHRSW VPMULHUW VPMULHW VPMULLD VPMULLW +syn keyword nasmAVXInstruction VPMULUDQ VPOR VPPERM VPROTB VPROTD +syn keyword nasmAVXInstruction VPROTQ VPROTW VPSADBW VPSHAB VPSHAD +syn keyword nasmAVXInstruction VPSHAQ VPSHAW VPSHLB VPSHLD VPSHLQ +syn keyword nasmAVXInstruction VPSHLW VPSHUFB VPSHUFD VPSHUFHW VPSHUFLW +syn keyword nasmAVXInstruction VPSIGNB VPSIGND VPSIGNW VPSLLD VPSLLDQ +syn keyword nasmAVXInstruction VPSLLQ VPSLLVD VPSLLVQ VPSLLW VPSRAD +syn keyword nasmAVXInstruction VPSRAVD VPSRAW VPSRLD VPSRLDQ VPSRLQ +syn keyword nasmAVXInstruction VPSRLVD VPSRLVQ VPSRLW VPSUBB VPSUBD +syn keyword nasmAVXInstruction VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW +syn keyword nasmAVXInstruction VPSUBW VPTEST VPUNPCKHBW VPUNPCKHDQ VPUNPCKHQDQ +syn keyword nasmAVXInstruction VPUNPCKHWD VPUNPCKLBW VPUNPCKLDQ VPUNPCKLQDQ VPUNPCKLWD +syn keyword nasmAVXInstruction VPXOR VRCPPS + " Three Dimensional Now Packed Instructions: (requires 3DNow! unit) syn keyword nasmNowInstruction FEMMS PAVGUSB PF2ID PFACC PFADD PFCMPEQ PFCMPGE @@ -515,13 +576,14 @@ hi def link nasmDbgInstruction Debug hi def link nasmFpuInstruction Statement hi def link nasmMmxInstruction Statement hi def link nasmSseInstruction Statement +hi def link nasmF16cInstruction Statement +hi def link nasmAVXInstruction Statement hi def link nasmNowInstruction Statement hi def link nasmAmdInstruction Special hi def link nasmCrxInstruction Special hi def link nasmUndInstruction Todo hi def link nasmInstructnError Error - let b:current_syntax = "nasm" " vim:ts=8 sw=4 diff --git a/runtime/syntax/xpm.vim b/runtime/syntax/xpm.vim index be9f38723e..77d82403e9 100644 --- a/runtime/syntax/xpm.vim +++ b/runtime/syntax/xpm.vim @@ -1,10 +1,12 @@ " Vim syntax file " Language: X Pixmap " Maintainer: Ronald Schild <rs@scutum.de> -" Last Change: 2021 Oct 04 -" Version: 5.4n.1 +" Last Change: 2023 May 11 +" Version: 5.4n.2 " Jemma Nelson added termguicolors support " Dominique Pellé fixed spelling support +" Christian J. Robinson fixed use of global variables, moved +" loop into a function " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -21,108 +23,119 @@ syn region xpmPixelString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@xpmCo if has("gui_running") || has("termguicolors") && &termguicolors -let color = "" -let chars = "" -let colors = 0 -let cpp = 0 -let n = 0 -let i = 1 +function s:CreateSyntax() abort + let color = "" + let chars = "" + let colors = 0 + let cpp = 0 + let n = 0 + let lines = getline(1, '$') -while i <= line("$") " scanning all lines + for line in lines " scanning all lines - let s = matchstr(getline(i), '".\{-1,}"') - if s != "" " does line contain a string? + let s = matchstr(line, '".\{-1,}"') - if n == 0 " first string is the Values string + if s != "" " does line contain a string? - " get the 3rd value: colors = number of colors - let colors = substitute(s, '"\s*\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '') - " get the 4th value: cpp = number of character per pixel - let cpp = substitute(s, '"\s*\d\+\s\+\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '') - if cpp =~ '[^0-9]' - break " if cpp is not made of digits there must be something wrong - endif + if n == 0 " first string is the Values string - " Highlight the Values string as normal string (no pixel string). - " Only when there is no slash, it would terminate the pattern. - if s !~ '/' - exe 'syn match xpmValues /' . s . '/' - endif - hi link xpmValues String + let values = split(s[1 : -2]) + + " Values string invalid, bail out + if len(values) != 4 + return + endif - let n = 1 " n = color index + " get the 3rd value: colors = number of colors + let colors = str2nr(values[2]) + " get the 4th value: cpp = number of character per pixel + let cpp = str2nr(values[3]) - elseif n <= colors " string is a color specification + " these values must be positive, nonzero + if colors < 1 || cpp < 1 + return + endif + + " Highlight the Values string as normal string (no pixel string). + " Only when there is no slash, it would terminate the pattern. + if s !~ '/' + exe 'syn match xpmValues /' .. s .. '/' + endif + hi link xpmValues String - " get chars = <cpp> length string representing the pixels - " (first incl. the following whitespace) - let chars = substitute(s, '"\(.\{'.cpp.'}\s\).*"', '\1', '') + let n = 1 " n = color index - " now get color, first try 'c' key if any (color visual) - let color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '') - if color == s - " no 'c' key, try 'g' key (grayscale with more than 4 levels) - let color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '') + elseif n <= colors " string is a color specification + + " get chars = <cpp> length string representing the pixels + " (first incl. the following whitespace) + let chars = substitute(s, '"\(.\{' .. cpp .. '}\s\).*"', '\1', '') + + " now get color, first try 'c' key if any (color visual) + let color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '') if color == s - " next try: 'g4' key (4-level grayscale) - let color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '') + " no 'c' key, try 'g' key (grayscale with more than 4 levels) + let color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '') if color == s - " finally try 'm' key (mono visual) - let color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '') + " next try: 'g4' key (4-level grayscale) + let color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '') if color == s - let color = "" + " finally try 'm' key (mono visual) + let color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '') + if color == s + let color = "" + endif endif endif endif - endif - " Vim cannot handle RGB codes with more than 6 hex digits - if color =~ '#\x\{10,}$' - let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g') - elseif color =~ '#\x\{7,}$' - let color = substitute(color, '\(\x\x\)\x', '\1', 'g') - " nor with 3 digits - elseif color =~ '#\x\{3}$' - let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '') - endif + " Vim cannot handle RGB codes with more than 6 hex digits + if color =~ '#\x\{10,}$' + let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g') + elseif color =~ '#\x\{7,}$' + let color = substitute(color, '\(\x\x\)\x', '\1', 'g') + " nor with 3 digits + elseif color =~ '#\x\{3}$' + let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '') + endif - " escape meta characters in patterns - let s = escape(s, '/\*^$.~[]') - let chars = escape(chars, '/\*^$.~[]') - - " now create syntax items - " highlight the color string as normal string (no pixel string) - exe 'syn match xpmCol'.n.'Def /'.s.'/ contains=xpmCol'.n.'inDef' - exe 'hi link xpmCol'.n.'Def String' - - " but highlight the first whitespace after chars in its color - exe 'syn match xpmCol'.n.'inDef /"'.chars.'/hs=s+'.(cpp+1).' contained' - exe 'hi link xpmCol'.n.'inDef xpmColor'.n - - " remove the following whitespace from chars - let chars = substitute(chars, '.$', '', '') - - " and create the syntax item contained in the pixel strings - exe 'syn match xpmColor'.n.' /'.chars.'/ contained' - exe 'syn cluster xpmColors add=xpmColor'.n - - " if no color or color = "None" show background - if color == "" || substitute(color, '.*', '\L&', '') == 'none' - exe 'hi xpmColor'.n.' guifg=bg' - exe 'hi xpmColor'.n.' guibg=NONE' - elseif color !~ "'" - exe 'hi xpmColor'.n." guifg='".color."'" - exe 'hi xpmColor'.n." guibg='".color."'" + " escape meta characters in patterns + let s = escape(s, '/\*^$.~[] ') + let chars = escape(chars, '/\*^$.~[] ') + + " now create syntax items + " highlight the color string as normal string (no pixel string) + exe 'syn match xpmCol' .. n .. 'Def /' .. s .. '/ contains=xpmCol' .. n .. 'inDef' + exe 'hi link xpmCol' .. n .. 'Def String' + + " but highlight the first whitespace after chars in its color + exe 'syn match xpmCol' .. n .. 'inDef /"' .. chars .. '/hs=s+' .. (cpp + 1) .. ' contained' + exe 'hi link xpmCol' .. n .. 'inDef xpmColor' .. n + + " remove the following whitespace from chars + let chars = substitute(chars, '.$', '', '') + + " and create the syntax item contained in the pixel strings + exe 'syn match xpmColor' .. n .. ' /' .. chars .. '/ contained' + exe 'syn cluster xpmColors add=xpmColor' .. n + + " if no color or color = "None" show background + if color == "" || substitute(color, '.*', '\L&', '') == 'none' + exe 'hi xpmColor' .. n .. ' guifg=bg' + exe 'hi xpmColor' .. n .. ' guibg=NONE' + elseif color !~ "'" + exe 'hi xpmColor' .. n .. " guifg='" .. color .. "'" + exe 'hi xpmColor' .. n .. " guibg='" .. color .. "'" + endif + let n += 1 + else + break " no more color string endif - let n = n + 1 - else - break " no more color string endif - endif - let i = i + 1 -endwhile + endfor +endfunction -unlet color chars colors cpp n i s +call s:CreateSyntax() endif " has("gui_running") || has("termguicolors") && &termguicolors |