diff options
Diffstat (limited to 'syntax')
-rw-r--r-- | syntax/basic/keyword.vim | 16 | ||||
-rw-r--r-- | syntax/basic/literal.vim | 17 | ||||
-rw-r--r-- | syntax/caddyfile.vim | 39 | ||||
-rw-r--r-- | syntax/clojure.vim | 4 | ||||
-rw-r--r-- | syntax/erlang.vim | 17 | ||||
-rw-r--r-- | syntax/gdscript3.vim | 101 | ||||
-rw-r--r-- | syntax/git.vim | 4 | ||||
-rw-r--r-- | syntax/gitcommit.vim | 2 | ||||
-rw-r--r-- | syntax/gitrebase.vim | 2 | ||||
-rw-r--r-- | syntax/go.vim | 66 | ||||
-rw-r--r-- | syntax/gsl.vim | 63 | ||||
-rw-r--r-- | syntax/haml.vim | 2 | ||||
-rw-r--r-- | syntax/help.vim | 3 | ||||
-rw-r--r-- | syntax/javascript.vim | 40 | ||||
-rw-r--r-- | syntax/julia.vim | 18 | ||||
-rw-r--r-- | syntax/kotlin.vim | 7 | ||||
-rw-r--r-- | syntax/llvm.vim | 77 | ||||
-rw-r--r-- | syntax/machine-ir.vim | 42 | ||||
-rw-r--r-- | syntax/meson.vim | 1 | ||||
-rw-r--r-- | syntax/mir.vim | 52 | ||||
-rw-r--r-- | syntax/mlir.vim | 34 | ||||
-rw-r--r-- | syntax/ocaml.vim | 372 | ||||
-rw-r--r-- | syntax/odin.vim | 14 | ||||
-rw-r--r-- | syntax/openscad.vim | 2 | ||||
-rw-r--r-- | syntax/qml.vim | 6 | ||||
-rw-r--r-- | syntax/requirements.vim | 20 | ||||
-rw-r--r-- | syntax/ruby.vim | 10 | ||||
-rw-r--r-- | syntax/solidity.vim | 2 | ||||
-rw-r--r-- | syntax/swayconfig.vim | 64 | ||||
-rw-r--r-- | syntax/swift.vim | 1 | ||||
-rw-r--r-- | syntax/tmux.vim | 4 |
31 files changed, 736 insertions, 366 deletions
diff --git a/syntax/basic/keyword.vim b/syntax/basic/keyword.vim index 611a3f91..adcd950b 100644 --- a/syntax/basic/keyword.vim +++ b/syntax/basic/keyword.vim @@ -5,7 +5,7 @@ endif "Import syntax keyword typescriptImport from as syntax keyword typescriptImport import - \ nextgroup=typescriptImportType + \ nextgroup=typescriptImportType,typescriptTypeBlock,typescriptDefaultImportName \ skipwhite syntax keyword typescriptImportType type \ contained @@ -17,11 +17,10 @@ syntax match typescriptExportType /\<type\s*{\@=/ syntax keyword typescriptModule namespace module -syntax keyword typescriptCastKeyword as +syntax keyword typescriptCastKeyword as satisfies \ nextgroup=@typescriptType \ skipwhite - syntax keyword typescriptVariable let var \ nextgroup=@typescriptVariableDeclarations \ skipwhite skipempty @@ -90,6 +89,17 @@ syntax cluster typescriptAmbients contains= \ typescriptModule syntax keyword typescriptIdentifier arguments nextgroup=@afterIdentifier +syntax match typescriptDefaultImportName /\v\h\k*( |,)/ + \ contained + \ nextgroup=typescriptTypeBlock + \ skipwhite skipempty + +syntax region typescriptTypeBlock + \ matchgroup=typescriptBraces + \ start=/{/ end=/}/ + \ contained + \ contains=typescriptIdentifierName,typescriptImportType + \ fold "Program Keywords exec 'syntax keyword typescriptNull null '.(exists('g:typescript_conceal_null') ? 'conceal cchar='.g:typescript_conceal_null : '').' nextgroup=@typescriptSymbols skipwhite skipempty' diff --git a/syntax/basic/literal.vim b/syntax/basic/literal.vim index d6204014..1ecbcd9d 100644 --- a/syntax/basic/literal.vim +++ b/syntax/basic/literal.vim @@ -22,9 +22,20 @@ syntax region typescriptString syntax match typescriptSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{1,6}})|c\u|.)" -" From vim runtime -" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48> -syntax region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimsuy]\{0,5\}\s*$+ end=+/[gimsuy]\{0,5\}\s*[;.,)\]}:]+me=e-1 nextgroup=typescriptDotNotation oneline +" From pangloss/vim-javascript +" <https://github.com/pangloss/vim-javascript/blob/d6e137563c47fb59f26ed25d044c0c7532304f18/syntax/javascript.vim#L64-L72> +syntax region typescriptRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ contains=typescriptSpecial extend +syntax match typescriptRegexpBoundary contained "\v\c[$^]|\\b" +syntax match typescriptRegexpBackRef contained "\v\\[1-9]\d*" +syntax match typescriptRegexpQuantifier contained "\v[^\\]%([?*+]|\{\d+%(,\d*)?})\??"lc=1 +syntax match typescriptRegexpOr contained "|" +syntax match typescriptRegexpMod contained "\v\(\?[:=!>]"lc=1 +syntax region typescriptRegexpGroup contained start="[^\\]("lc=1 skip="\\.\|\[\(\\.\|[^]]\+\)\]" end=")" contains=typescriptRegexpCharClass,@typescriptRegexpSpecial keepend +syntax region typescriptRegexpString + \ start=+\%(\%(\<return\|\<typeof\|\_[^)\]'"[:blank:][:alnum:]_$]\)\s*\)\@<=/\ze[^*/]+ skip=+\\.\|\[[^]]\{1,}\]+ end=+/[gimyus]\{,6}+ + \ contains=typescriptRegexpCharClass,typescriptRegexpGroup,@typescriptRegexpSpecial + \ oneline keepend extend +syntax cluster typescriptRegexpSpecial contains=typescriptSpecial,typescriptRegexpBoundary,typescriptRegexpBackRef,typescriptRegexpQuantifier,typescriptRegexpOr,typescriptRegexpMod syntax region typescriptTemplate \ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/ diff --git a/syntax/caddyfile.vim b/syntax/caddyfile.vim index ab0c24d1..12300a7c 100644 --- a/syntax/caddyfile.vim +++ b/syntax/caddyfile.vim @@ -2,32 +2,51 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'caddyfile', 'syntax/caddyfile finish endif -" Language: Caddyfile -" Author: Josh Glendenning <josh@isobit.io> +" Language: Caddyfile +" Maintainer: 0az <0az@afzhou.com> +" Original Author: Josh Glendenning <josh@isobit.io> if exists("b:current_syntax") finish endif -syn match caddyDirective "^\s*\([a-zA-Z0-9_]\+\)" nextgroup=caddyDirectiveArgs skipwhite -syn region caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString nextgroup=caddyDirectiveBlock skipwhite -syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment +syn match caddyDirective "\v^\s*(\w\S*)" nextgroup=caddyDirectiveArgs skipwhite +syn region caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString,caddyNamedMatcher nextgroup=caddyDirectiveBlock skipwhite +syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment,caddyImport -syn match caddySubdirective "^\s*\([a-zA-Z0-9_]\+\)" contained nextgroup=caddySubdirectiveArgs skipwhite -syn region caddySubdirectiveArgs start="" end="\(#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString +syn match caddySubdirective "\v^\s*(\w\S*)" contained nextgroup=caddySubdirectiveArgs skipwhite +syn region caddySubdirectiveArgs start="" end="\(#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString,caddyNamedMatcher -syn match caddyHost "\(https\?:\/\/\)\?\(\(\w\{1,}\.\)\(\w\{2,}\.\?\)\+\|localhost\)\(:[0-9]\{1,5}\)\?" nextgroup=caddyHostBlock skipwhite -syn region caddyHostBlock start="{" skip="\\}" end="}" contained contains=caddyDirective,caddyComment +" Needs priority over Directive +syn match caddyImport "\v^\s*<import>" nextgroup=caddyImportPattern skipwhite +syn match caddyImportPattern "\v\c\S+" contained nextgroup=caddyImportArgs skipwhite +syn region caddyImportArgs start="" end="$"me=s-1 oneline contained contains=caddyPlaceholder,caddyString,caddyNamedMatcher + +syn match caddyHost "\v\c^\s*\zs(https?://)?(([0-9a-z-]+\.)([0-9a-z-]+\.?)+|[0-9a-z-]+)?(:\d{1,5})?" nextgroup=caddyHostBlock skipwhite +syn region caddyHostBlock start="{" skip="\\}" end="}" contained contains=caddyDirective,caddyComment,caddyNamedMatcherDef,caddyImport + +" Needs priority over Host +syn region caddySnippetDef start="("rs=e+1 end=")"re=s-1 oneline keepend contains=caddySnippet +syn match caddySnippet "\v\w+" contained nextgroup=caddySnippetBlock skipwhite + +syn match caddyNamedMatcher "\v^\s*\zs\@\S+" contained skipwhite +syn match caddyNamedMatcherDef "\v\s*\zs\@\S+" nextgroup=caddyNamedMatcherDefBlock +syn region caddyNamedMatcherDefBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment,caddyImport syn region caddyPlaceholder start="{" skip="\\}" end="}" oneline contained syn region caddyString start='"' skip='\\\\\|\\"' end='"' oneline -syn match caddyComment "#.*$" +syn region caddyComment start="#" end="$" oneline hi link caddyDirective Keyword hi link caddySubdirective Structure hi link caddyHost Identifier +hi link caddyImport PreProc +hi link caddySnippetDef PreProc +hi link caddySnippet Identifier hi link caddyPlaceholder Special hi link caddyString String hi link caddyComment Comment +hi link caddyNamedMatcherDef caddyNamedMatcher +hi link caddyNamedMatcher Identifier let b:current_syntax = "caddyfile" diff --git a/syntax/clojure.vim b/syntax/clojure.vim index c892c267..4397b89b 100644 --- a/syntax/clojure.vim +++ b/syntax/clojure.vim @@ -26,7 +26,7 @@ endif " -*- KEYWORDS -*- " Generated from https://github.com/clojure-vim/clojure.vim/blob/%%RELEASE_TAG%%/clj/src/vim_clojure_static/generate.clj -" Clojure version 1.11.0 +" Clojure version 1.11.1 let s:clojure_syntax_keywords = { \ 'clojureBoolean': ["false","true"], \ 'clojureCond': ["case","case*","clojure.core/case","clojure.core/cond","clojure.core/cond->","clojure.core/cond->>","clojure.core/condp","clojure.core/if-let","clojure.core/if-not","clojure.core/if-some","clojure.core/when","clojure.core/when-first","clojure.core/when-let","clojure.core/when-not","clojure.core/when-some","cond","cond->","cond->>","condp","if","if-let","if-not","if-some","when","when-first","when-let","when-not","when-some"], @@ -100,7 +100,7 @@ syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ " -*- CHARACTER PROPERTY CLASSES -*- " Generated from https://github.com/clojure-vim/clojure.vim/blob/%%RELEASE_TAG%%/clj/src/vim_clojure_static/generate.clj -" Java version 17.0.2 +" Java version 18.0.1 syntax match clojureRegexpPosixCharClass "\v\\[pP]\{%(Cntrl|A%(l%(pha|num)|SCII)|Space|Graph|Upper|P%(rint|unct)|Blank|XDigit|Digit|Lower)\}" contained display syntax match clojureRegexpJavaCharClass "\v\\[pP]\{java%(Whitespace|JavaIdentifier%(Part|Start)|SpaceChar|Mirrored|TitleCase|I%(SOControl|de%(ographic|ntifierIgnorable))|D%(efined|igit)|U%(pperCase|nicodeIdentifier%(Part|Start))|L%(etter%(OrDigit)?|owerCase)|Alphabetic)\}" contained display syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\cIs%(l%(owercase|etter)|hex%(digit|_digit)|w%(hite%(_space|space)|ord)|noncharacter%(_code_point|codepoint)|p%(rint|unctuation)|ideographic|graph|a%(l%(num|phabetic)|ssigned)|uppercase|join%(control|_control)|titlecase|blank|digit|control)\}" contained display diff --git a/syntax/erlang.vim b/syntax/erlang.vim index 473c0606..72bfb2d5 100644 --- a/syntax/erlang.vim +++ b/syntax/erlang.vim @@ -6,7 +6,7 @@ endif " Language: Erlang (http://www.erlang.org) " Maintainer: Csaba Hoch <csaba.hoch@gmail.com> " Contributor: Adam Rutkowski <hq@mtod.org> -" Last Update: 2020-May-26 +" Last Update: 2022-Sep-06 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime @@ -65,7 +65,8 @@ syn match erlangQuotedAtomModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' con syn match erlangModifier '\$\%([^\\]\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\)' " Operators, separators -syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|=>\|:=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' +syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|=>\|:=\|?=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' +syn match erlangEqualsBinary '=<<\%(<\)\@!' syn keyword erlangOperator div rem or xor bor bxor bsl bsr and band not bnot andalso orelse syn match erlangBracket '{\|}\|\[\|]\||\|||' syn match erlangPipe '|' @@ -80,7 +81,8 @@ syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\ syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment,erlangVariable " Variables, macros, records, maps -syn match erlangVariable '\<[A-Z_][[:alnum:]_@]*' +syn match erlangVariable '\<[A-Z][[:alnum:]_@]*' +syn match erlangAnonymousVariable '\<_[[:alnum:]_@]*' syn match erlangMacro '??\=[[:alnum:]_@]\+' syn match erlangMacro '\%(-define(\)\@<=[[:alnum:]_@]\+' syn region erlangQuotedMacro start=/??\=\s*'/ end=/'/ contains=erlangQuotedAtomModifier @@ -96,7 +98,7 @@ syn match erlangBitType '\%(\/\%(\s\|\n\|%.*\n\)*\)\@<=\%(integer\|float\|binary " Constants and Directives syn match erlangUnknownAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\l[[:alnum:]_@]*' contains=erlangComment -syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\|author\|copyright\|doc\|vsn\|on_load\|optional_callbacks\)\>' contains=erlangComment +syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\|author\|copyright\|doc\|vsn\|on_load\|optional_callbacks\|feature\)\>' contains=erlangComment syn match erlangInclude '^\s*-\%(\s\|\n\|%.*\n\)*\%(include\|include_lib\)\>' contains=erlangComment syn match erlangRecordDef '^\s*-\%(\s\|\n\|%.*\n\)*record\>' contains=erlangComment syn match erlangDefine '^\s*-\%(\s\|\n\|%.*\n\)*\%(define\|undef\)\>' contains=erlangComment @@ -104,8 +106,8 @@ syn match erlangPreCondit '^\s*-\%(\s\|\n\|%.*\n\)*\%(ifdef\|ifndef\|else\|endif syn match erlangType '^\s*-\%(\s\|\n\|%.*\n\)*\%(spec\|type\|opaque\|callback\)\>' contains=erlangComment " Keywords -syn keyword erlangKeyword after begin case catch cond end fun if let of -syn keyword erlangKeyword receive when try +syn keyword erlangKeyword after begin case catch cond end fun if let of else +syn keyword erlangKeyword receive when try maybe " Build-in-functions (BIFs) syn keyword erlangBIF abs alive apply atom_to_binary atom_to_list contained @@ -178,6 +180,7 @@ hi def link erlangModifier Special " Operators, separators hi def link erlangOperator Operator +hi def link erlangEqualsBinary ErrorMsg hi def link erlangRightArrow Operator if s:old_style hi def link erlangBracket Normal @@ -195,6 +198,7 @@ hi def link erlangLocalFuncRef Normal hi def link erlangGlobalFuncCall Function hi def link erlangGlobalFuncRef Function hi def link erlangVariable Normal +hi def link erlangAnonymousVariable erlangVariable hi def link erlangMacro Normal hi def link erlangQuotedMacro Normal hi def link erlangRecord Normal @@ -207,6 +211,7 @@ hi def link erlangLocalFuncRef Normal hi def link erlangGlobalFuncCall Normal hi def link erlangGlobalFuncRef Normal hi def link erlangVariable Identifier +hi def link erlangAnonymousVariable erlangVariable hi def link erlangMacro Macro hi def link erlangQuotedMacro Macro hi def link erlangRecord Structure diff --git a/syntax/gdscript3.vim b/syntax/gdscript3.vim deleted file mode 100644 index cabfdfbd..00000000 --- a/syntax/gdscript3.vim +++ /dev/null @@ -1,101 +0,0 @@ -if polyglot#init#is_disabled(expand('<sfile>:p'), 'gdscript', 'syntax/gdscript3.vim') - finish -endif - -" Syntax file for GDScript - -if exists("b:current_syntax") - finish -endif -let b:current_syntax = "gdscript3" - -let s:save_cpo = &cpo -set cpo&vim - -syn keyword gdConditional if elif else match -syn keyword gdRepeat for while -syn keyword gdOperator and or not is in -syn match gdOperator "\V&&\|||\|!\|&\|^\||\|~\|*\|/\|%\|+\|-\|=\|<\|>" -syn match gdDelimiter "\V(\|)\|[\|]\|{\|}" -syn keyword gdStatement break continue pass return -syn keyword gdKeyword extends tool signal self - \ const enum var onready export setget -syn match gdKeyword "\v^\s*((static\s*)=func|class)" - \ nextgroup=gdFunction skipwhite -syn keyword gdBoolean true false - -syn match gdMember "\v<(\.)@<=[a-z_]+\w*>" -syn match gdFunction "\v<\w*>(\()@=" -syn match gdSignal "\v(<signal>\s+)@<=<\w+>" -syn match gdSetGet "\v(<setget>\s+)@<=<\w+>" -syn match gdSetGet "\v(<setget>\s+\w*\s*,\s*)@<=<\w+>" - -syn keyword gdNull null -syn keyword gdClass int float bool -syn match gdClass "\v<\u\w+>" -syn match gdConstant "\v<[A-Z_]+[A-Z0-9_]*>" -syn keyword gdClass AABB IP JSON OS RID -syn match gdNode "\v\$\a+\w*" - -syn region gdString start='\v\"' end='\v\"' -syn region gdString start='\v\'' end='\v\'' -syn match gdEscapeError "\v\\." containedin=gdString -syn match gdEscapeError "\v\\u.{,3}" containedin=gdString -syn match gdEscape "\v\\[abfnrtv\\'"]" containedin=gdString -syn match gdEscape "\v\\u[0-9]{4}" containedin=gdString - -syn match gdFormat "\v\%\%" containedin=gdString -syn match gdFormat "\v\%[+-]=(\d*|\*)=\.=(\d*|\*)=[scdoxXf]" containedin=gdString - -syn match gdNumber "\v<\d+(\.)@!>" -syn match gdNumber "\v<0x\x+(\.)@!>" -syn match gdFloat "\v<\d*\.\d+(\.)@!>" -syn match gdFloat "\v<\d*\.=\d+(e-=\d+)@=" -syn match gdExponent "\v(\d*\.=\d+)@<=e-=\d+>" - -syn match gdComment "\v#.*$" -syn keyword gdTodo TODO FIXME XXX NOTE BUG HACK OPTIMIZE containedin=gdComment - -syn region gdFunctionFold - \ start="\v^\z(\s*)%(%(static\s+)=func|class)>" - \ end="\v\ze%(\s*\n)+%(\z1\s)@!." - \ fold transparent - -syn region gdFold - \ matchgroup=gdComment - \ start='#.*{{{.*$' - \ end='#.*}}}.*$' - \ fold transparent - -hi def link gdConditional Conditional -hi def link gdRepeat Repeat -hi def link gdOperator Operator -hi def link gdDelimiter Delimiter -hi def link gdStatement Statement -hi def link gdKeyword Keyword -hi def link gdBoolean Boolean - -hi def link gdMember Identifier -hi def link gdFunction Function -hi def link gdSignal Function -hi def link gdSetGet Function - -hi def link gdNull Constant -hi def link gdClass Type -hi def link gdConstant Constant -hi def link gdNode Identifier - -hi def link gdString String -hi def link gdEscape Special -hi def link gdFormat Special -hi def link gdNumber Number -hi def link gdFloat Float -hi def link gdExponent Special - -hi def link gdEscapeError Error - -hi def link gdComment Comment -hi def link gdTodo Todo - -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/syntax/git.vim b/syntax/git.vim index 66a77c20..16593070 100644 --- a/syntax/git.vim +++ b/syntax/git.vim @@ -5,7 +5,7 @@ endif " Vim syntax file " Language: generic git output " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2019 Dec 05 +" Last Change: 2022 Jan 05 if exists("b:current_syntax") finish @@ -42,7 +42,7 @@ syn match gitReflog /^\x\{40,\} \x\{40,\} .\{-\}\d\+\s-\d\{4\}\t.*/ skipwhite c syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff -syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff +syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge syn match gitDiffAdded "{+[^}]*+}" contained containedin=gitDiff diff --git a/syntax/gitcommit.vim b/syntax/gitcommit.vim index 3839fffb..abd94577 100644 --- a/syntax/gitcommit.vim +++ b/syntax/gitcommit.vim @@ -6,7 +6,7 @@ endif " Language: git commit file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.git/COMMIT_EDITMSG -" Last Change: 2019 Dec 05 +" Last Change: 2022 Jan 05 if exists("b:current_syntax") finish diff --git a/syntax/gitrebase.vim b/syntax/gitrebase.vim index c042f193..5c94796d 100644 --- a/syntax/gitrebase.vim +++ b/syntax/gitrebase.vim @@ -6,7 +6,7 @@ endif " Language: git rebase --interactive " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: git-rebase-todo -" Last Change: 2019 Dec 06 +" Last Change: 2022 Jan 05 if exists("b:current_syntax") finish diff --git a/syntax/go.vim b/syntax/go.vim index 23270e84..2d7dbde4 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -169,14 +169,10 @@ endif syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst " Integers -syn match goDecimalInt "\<-\=\(0\|[1-9]_\?\(\d\|\d\+_\?\d\+\)*\)\%([Ee][-+]\=\d\+\)\=\>" -"syn match goDecimalError "\<-\=\(_\(\d\+_*\)\+\|\([1-9]\d*_*\)\+__\(\d\+_*\)\+\|\([1-9]\d*_*\)\+_\+\)\%([Ee][-+]\=\d\+\)\=\>" -syn match goHexadecimalInt "\<-\=0[xX]_\?\(\x\+_\?\)\+\>" -"syn match goHexadecimalError "\<-\=0[xX]_\?\(\x\+_\?\)*\(\([^-+%&|^*/ \t0-9A-Fa-f_)]\|__\)\S*\|_\)\>" -syn match goOctalInt "\<-\=0[oO]\?_\?\(\o\+_\?\)\+\>" -"syn match goOctalError "\<-\=0[0-7oO_]*\(\([^-+%&|^*/ \t0-7oOxX_/)\]\}\:;]\|[oO]\{2,\}\|__\)\S*\|_\|[oOxX]\)\>" -syn match goBinaryInt "\<-\=0[bB]_\?\([01]\+_\?\)\+\>" -"syn match goBinaryError "\<-\=0[bB]_\?[01_]*\([^-+%&|^*/ \t01_)]\S*\|__\S*\|_\)\>" +syn match goDecimalInt "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)\>" +syn match goHexadecimalInt "\<-\=0[xX]_\?\%(\x\|\x_\x\)\+\>" +syn match goOctalInt "\<-\=0[oO]\?_\?\%(\o\|\o_\o\)\+\>" +syn match goBinaryInt "\<-\=0[bB]_\?\%([01]\|[01]_[01]\)\+\>" hi def link goDecimalInt Integer hi def link goDecimalError Error @@ -189,19 +185,55 @@ hi def link goBinaryError Error hi def link Integer Number " Floating point -syn match goFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=\>" -syn match goFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=\>" +"float_lit = decimal_float_lit | hex_float_lit . +" +"decimal_float_lit = decimal_digits "." [ decimal_digits ] [ decimal_exponent ] | +" decimal_digits decimal_exponent | +" "." decimal_digits [ decimal_exponent ] . +"decimal_exponent = ( "e" | "E" ) [ "+" | "-" ] decimal_digits . +" +"hex_float_lit = "0" ( "x" | "X" ) hex_mantissa hex_exponent . +"hex_mantissa = [ "_" ] hex_digits "." [ hex_digits ] | +" [ "_" ] hex_digits | +" "." hex_digits . +"hex_exponent = ( "p" | "P" ) [ "+" | "-" ] decimal_digits . +" decimal floats with a decimal point +syn match goFloat "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)\.\%(\%(\%(\d\|\d_\d\)\+\)\=\%([Ee][-+]\=\%(\d\|\d_\d\)\+\)\=\>\)\=" +syn match goFloat "\s\zs-\=\.\%(\d\|\d_\d\)\+\%(\%([Ee][-+]\=\%(\d\|\d_\d\)\+\)\>\)\=" +" decimal floats without a decimal point +syn match goFloat "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)[Ee][-+]\=\%(\d\|\d_\d\)\+\>" +" hexadecimal floats with a decimal point +syn match goHexadecimalFloat "\<-\=0[xX]\%(_\x\|\x\)\+\.\%(\%(\x\|\x_\x\)\+\)\=\%([Pp][-+]\=\%(\d\|\d_\d\)\+\)\=\>" +syn match goHexadecimalFloat "\<-\=0[xX]\.\%(\x\|\x_\x\)\+\%([Pp][-+]\=\%(\d\|\d_\d\)\+\)\=\>" +" hexadecimal floats without a decimal point +syn match goHexadecimalFloat "\<-\=0[xX]\%(_\x\|\x\)\+[Pp][-+]\=\%(\d\|\d_\d\)\+\>" hi def link goFloat Float +hi def link goHexadecimalFloat Float " Imaginary literals -syn match goImaginary "\<-\=\d\+i\>" -syn match goImaginary "\<-\=\d\+[Ee][-+]\=\d\+i\>" -syn match goImaginaryFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=i\>" -syn match goImaginaryFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=i\>" - -hi def link goImaginary Number -hi def link goImaginaryFloat Float +syn match goImaginaryDecimal "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)i\>" +syn match goImaginaryHexadecimal "\<-\=0[xX]_\?\%(\x\|\x_\x\)\+i\>" +syn match goImaginaryOctal "\<-\=0[oO]\?_\?\%(\o\|\o_\o\)\+i\>" +syn match goImaginaryBinary "\<-\=0[bB]_\?\%([01]\|[01]_[01]\)\+i\>" + +" imaginary decimal floats with a decimal point +syn match goImaginaryFloat "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)\.\%(\%(\%(\d\|\d_\d\)\+\)\=\%([Ee][-+]\=\%(\d\|\d_\d\)\+\)\=\)\=i\>" +syn match goImaginaryFloat "\s\zs-\=\.\%(\d\|\d_\d\)\+\%([Ee][-+]\=\%(\d\|\d_\d\)\+\)\=i\>" +" imaginary decimal floats without a decimal point +syn match goImaginaryFloat "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)[Ee][-+]\=\%(\d\|\d_\d\)\+i\>" +" imaginary hexadecimal floats with a decimal point +syn match goImaginaryHexadecimalFloat "\<-\=0[xX]\%(_\x\|\x\)\+\.\%(\%(\x\|\x_\x\)\+\)\=\%([Pp][-+]\=\%(\d\|\d_\d\)\+\)\=i\>" +syn match goImaginaryHexadecimalFloat "\<-\=0[xX]\.\%(\x\|\x_\x\)\+\%([Pp][-+]\=\%(\d\|\d_\d\)\+\)\=i\>" +" imaginary hexadecimal floats without a decimal point +syn match goImaginaryHexadecimalFloat "\<-\=0[xX]\%(_\x\|\x\)\+[Pp][-+]\=\%(\d\|\d_\d\)\+i\>" + +hi def link goImaginaryDecimal Number +hi def link goImaginaryHexadecimal Number +hi def link goImaginaryOctal Number +hi def link goImaginaryBinary Number +hi def link goImaginaryFloat Float +hi def link goImaginaryHexadecimalFloat Float " Spaces after "[]" if go#config#HighlightArrayWhitespaceError() diff --git a/syntax/gsl.vim b/syntax/gsl.vim deleted file mode 100644 index 1c8407be..00000000 --- a/syntax/gsl.vim +++ /dev/null @@ -1,63 +0,0 @@ -if polyglot#init#is_disabled(expand('<sfile>:p'), 'gdscript', 'syntax/gsl.vim') - finish -endif - -" Syntax file for Godot Shading Language - -if exists("b:current_syntax") - finish -endif -let b:current_syntax = "gsl" - -let s:save_cpo = &cpo -set cpo&vim - -syn keyword gslConditional if else -syn keyword gslRepeat for while -syn match gslOperator "\V&&\|||\|!\|&\|^\||\|~\|*\|/\|%\|+\|-\|=\|<\|>\|;" -syn match gslDelimiter "\V(\|)\|[\|]\|{\|}" -syn keyword gslStatement return discard -syn keyword gslBoolean true false - -syn keyword gslKeyword shader_type render_mode varying flat noperspective smooth - \ uniform lowp mediump highp in out inout - -syn keyword gslType void bool bvec2 bvec3 bvec4 int ivec2 ivec3 ivec4 - \ uint uvec2 uvec3 uvec4 float vec2 vec3 vec4 - \ mat2 mat3 mat4 sampler2D isampler2D usampler2D samplerCube - -syn match gslMember "\v<(\.)@<=[a-z_]+\w*>" -syn match gslConstant "\v<[A-Z_]+[A-Z0-9_]*>" -syn match gslFunction "\v<\w*>(\()@=" - -syn match gslNumber "\v<\d+(\.)@!>" -syn match gslFloat "\v<\d*\.\d+(\.)@!>" -syn match gslFloat "\v<\d*\.=\d+(e-=\d+)@=" -syn match gslExponent "\v(\d*\.=\d+)@<=e-=\d+>" - -syn match gslComment "\v//.*$" -syn region gslComment start="/\*" end="\*/" -syn keyword gslTodo TODO FIXME XXX NOTE BUG HACK OPTIMIZE containedin=gslComment - -hi def link gslConditional Conditional -hi def link gslRepeat Repeat -hi def link gslOperator Operator -hi def link gslDelimiter Delimiter -hi def link gslStatement Statement -hi def link gslBoolean Boolean - -hi def link gslKeyword Keyword -hi def link gslMember Identifier -hi def link gslConstant Constant -hi def link gslFunction Function -hi def link gslType Type - -hi def link gslNumber Number -hi def link gslFloat Float -hi def link gslExponent Special - -hi def link gslComment Comment -hi def link gslTodo Todo - -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/syntax/haml.vim b/syntax/haml.vim index 0861ed33..a6a8b568 100644 --- a/syntax/haml.vim +++ b/syntax/haml.vim @@ -6,7 +6,7 @@ endif " Language: Haml " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.haml -" Last Change: 2018 Aug 21 +" Last Change: 2019 Dec 05 if exists("b:current_syntax") finish diff --git a/syntax/help.vim b/syntax/help.vim index 5a39fd99..e11f345e 100644 --- a/syntax/help.vim +++ b/syntax/help.vim @@ -5,7 +5,7 @@ endif " Vim syntax file " Language: Vim help file " Maintainer: Bram Moolenaar (Bram@vim.org) -" Last Change: 2021 Jun 13 +" Last Change: 2022 Sep 26 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -43,6 +43,7 @@ syn match helpVim "VIM REFERENCE.*" syn match helpVim "NVIM REFERENCE.*" syn match helpOption "'[a-z]\{2,\}'" syn match helpOption "'t_..'" +syn match helpNormal "'ab'" syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore diff --git a/syntax/javascript.vim b/syntax/javascript.vim index a30956eb..c4253b66 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -28,16 +28,18 @@ syntax sync fromstart " syntax case ignore syntax case match -syntax match jsNoise /[:,;]/ +syntax match jsNoise /[:;]/ +syntax match jsNoise /,/ skipwhite skipempty nextgroup=@jsExpression syntax match jsDot /\./ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate syntax match jsObjectProp contained /\<\K\k*/ -syntax match jsFuncCall /\<\K\k*\ze\s*(/ +syntax match jsFuncCall /\<\K\k*\ze[\s\n]*(/ syntax match jsParensError /[)}\]]/ " Program Keywords syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef syntax match jsVariableDef contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFlowDefinition -syntax keyword jsOperatorKeyword delete instanceof typeof void new in of skipwhite skipempty nextgroup=@jsExpression +syntax keyword jsOperatorKeyword delete instanceof typeof void new in skipwhite skipempty nextgroup=@jsExpression +syntax keyword jsOf of skipwhite skipempty nextgroup=@jsExpression syntax match jsOperator "[-!|&+<>=%/*~^]" skipwhite skipempty nextgroup=@jsExpression syntax match jsOperator /::/ skipwhite skipempty nextgroup=@jsExpression syntax keyword jsBooleanTrue true @@ -103,7 +105,8 @@ syntax keyword jsStatement contained break continue skipwhite skipempty next syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse syntax keyword jsConditional else skipwhite skipempty nextgroup=jsCommentIfElse,jsIfElseBlock syntax keyword jsConditional switch skipwhite skipempty nextgroup=jsParenSwitch -syntax keyword jsRepeat while for skipwhite skipempty nextgroup=jsParenRepeat,jsForAwait +syntax keyword jsWhile while skipwhite skipempty nextgroup=jsParenWhile +syntax keyword jsFor for skipwhite skipempty nextgroup=jsParenFor,jsForAwait syntax keyword jsDo do skipwhite skipempty nextgroup=jsRepeatBlock syntax region jsSwitchCase contained matchgroup=jsLabel start=/\<\%(case\|default\)\>/ end=/:\@=/ contains=@jsExpression,jsLabel skipwhite skipempty nextgroup=jsSwitchColon keepend syntax keyword jsTry try skipwhite skipempty nextgroup=jsTryCatchBlock @@ -139,19 +142,20 @@ syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus " Code blocks syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression,jsSpreadExpression extend fold syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsExpression extend fold nextgroup=jsFlowDefinition -syntax region jsParenDecorator contained matchgroup=jsParensDecorator start=/(/ end=/)/ contains=@jsAll extend fold -syntax region jsParenIfElse contained matchgroup=jsParensIfElse start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentIfElse,jsIfElseBlock,jsReturn extend fold -syntax region jsParenRepeat contained matchgroup=jsParensRepeat start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentRepeat,jsRepeatBlock,jsReturn extend fold -syntax region jsParenSwitch contained matchgroup=jsParensSwitch start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold +syntax region jsParenDecorator contained matchgroup=jsParensDecorator start=/(/ end=/)/ contains=@jsExpression extend fold +syntax region jsParenIfElse contained matchgroup=jsParensIfElse start=/(/ end=/)/ contains=@jsExpression skipwhite skipempty nextgroup=jsCommentIfElse,jsIfElseBlock,jsReturn extend fold +syntax region jsParenWhile contained matchgroup=jsParensWhile start=/(/ end=/)/ contains=@jsExpression skipwhite skipempty nextgroup=jsCommentRepeat,jsRepeatBlock,jsReturn extend fold +syntax region jsParenFor contained matchgroup=jsParensFor start=/(/ end=/)/ contains=@jsExpression,jsStorageClass,jsOf skipwhite skipempty nextgroup=jsCommentRepeat,jsRepeatBlock,jsReturn extend fold +syntax region jsParenSwitch contained matchgroup=jsParensSwitch start=/(/ end=/)/ contains=@jsExpression skipwhite skipempty nextgroup=jsSwitchBlock extend fold syntax region jsParenCatch contained matchgroup=jsParensCatch start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsDestructuringArray,jsRestExpression,jsFlowArgumentDef skipwhite skipempty nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn extend fold syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsAsyncKeyword,jsNoise extend fold -syntax region jsFuncBlock contained matchgroup=jsFuncBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold -syntax region jsIfElseBlock contained matchgroup=jsIfElseBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold -syntax region jsTryCatchBlock contained matchgroup=jsTryCatchBraces start=/{/ end=/}/ contains=@jsAll,jsBlock skipwhite skipempty nextgroup=jsCatch,jsFinally extend fold -syntax region jsFinallyBlock contained matchgroup=jsFinallyBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold -syntax region jsSwitchBlock contained matchgroup=jsSwitchBraces start=/{/ end=/}/ contains=@jsAll,jsBlock,jsSwitchCase extend fold -syntax region jsRepeatBlock contained matchgroup=jsRepeatBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold +syntax region jsFuncBlock contained matchgroup=jsFuncBraces start=/{/ end=/}/ contains=@jsAll extend fold +syntax region jsIfElseBlock contained matchgroup=jsIfElseBraces start=/{/ end=/}/ contains=@jsAll extend fold +syntax region jsTryCatchBlock contained matchgroup=jsTryCatchBraces start=/{/ end=/}/ contains=@jsAll skipwhite skipempty nextgroup=jsCatch,jsFinally extend fold +syntax region jsFinallyBlock contained matchgroup=jsFinallyBraces start=/{/ end=/}/ contains=@jsAll extend fold +syntax region jsSwitchBlock contained matchgroup=jsSwitchBraces start=/{/ end=/}/ contains=@jsAll,jsSwitchCase extend fold +syntax region jsRepeatBlock contained matchgroup=jsRepeatBraces start=/{/ end=/}/ contains=@jsAll extend fold syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression,jsComment nextgroup=jsFlowDefinition extend fold syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsDestructuringNoise,jsDestructuringProperty,jsSpreadExpression,jsDestructuringBlock,jsDestructuringArray,jsComment nextgroup=jsFlowDefinition extend fold syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectShorthandProp,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator,jsAsyncKeyword,jsTemplateString extend fold @@ -169,7 +173,7 @@ syntax match jsFuncName contained /\<\K\k*/ skipwhite skipempty ne syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend syntax match jsFuncArgCommas contained ',' syntax keyword jsArguments contained arguments -syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenRepeat +syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenFor " Matches a single keyword argument with no parens syntax match jsArrowFuncArgs /\<\K\k*\ze\s*=>/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend @@ -237,7 +241,7 @@ if exists("javascript_plugin_flow") endif syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsOperatorKeyword,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo,jsForAwait,jsAsyncKeyword,jsStatement,jsDot -syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsException,jsTry,jsNoise,jsBlockLabel +syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsWhile,jsFor,jsReturn,jsException,jsTry,jsNoise,jsBlockLabel,jsBlock " Define the default highlighting. " For version 5.7 and earlier: only when not done already @@ -252,6 +256,8 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsComment Comment HiLink jsEnvComment PreProc HiLink jsParensIfElse jsParens + HiLink jsParensWhile jsParensRepeat + HiLink jsParensFor jsParensRepeat HiLink jsParensRepeat jsParens HiLink jsParensSwitch jsParens HiLink jsParensCatch jsParens @@ -277,6 +283,8 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsBranch Conditional HiLink jsLabel Label HiLink jsReturn Statement + HiLink jsWhile jsRepeat + HiLink jsFor jsRepeat HiLink jsRepeat Repeat HiLink jsDo Repeat HiLink jsStatement Statement diff --git a/syntax/julia.vim b/syntax/julia.vim index 0dcb1382..5f35f407 100644 --- a/syntax/julia.vim +++ b/syntax/julia.vim @@ -62,12 +62,6 @@ let s:op_chars = '\U25\U26\U2A\U2B\U2D\U2F\U3C-\U3E\U5C\U5E\U7C\U7E\UAC\UB1\UD7\ " The list contains the following characters: '…⁝⅋←↑→↓↔↚↛↜↝↞↠↢↣↤↦↩↪↫↬↮↶↷↺↻↼↽⇀⇁⇄⇆⇇⇉⇋⇌⇍⇎⇏⇐⇒⇔⇚⇛⇜⇝⇠⇢⇴⇵⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿∈∉∊∋∌∍∓∔∗∘∙√∛∜∝∤∥∦∧∨∩∪∷∸∺∻∽∾≀≁≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆⊇⊈⊉⊊⊋⊍⊎⊏⊐⊑⊒⊓⊔⊕⊖⊗⊘⊙⊚⊛⊜⊞⊟⊠⊡⊢⊣⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⊻⊼⊽⋄⋅⋆⋇⋉⋊⋋⋌⋍⋎⋏⋐⋑⋒⋓⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋮⋯⋰⋱⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⌿▷⟂⟈⟉⟑⟒⟕⟖⟗⟰⟱⟵⟶⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩⥪⥫⥬⥭⥮⥯⥰⦷⦸⦼⦾⦿⧀⧁⧡⧣⧤⧥⧴⧶⧷⧺⧻⨇⨈⨝⨟⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨰⨱⨲⨳⨴⨵⨶⨷⨸⨹⨺⨻⨼⨽⩀⩁⩂⩃⩄⩅⩊⩋⩌⩍⩎⩏⩐⩑⩒⩓⩔⩕⩖⩗⩘⩚⩛⩜⩝⩞⩟⩠⩡⩢⩣⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫛⫷⫸⫹⫺⬰⬱⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←↑→↓' let s:op_chars_wc = '\U2026\U205D\U214B\U2190-\U2194\U219A-\U219E\U21A0\U21A2-\U21A4\U21A6\U21A9-\U21AC\U21AE\U21B6\U21B7\U21BA-\U21BD\U21C0\U21C1\U21C4\U21C6\U21C7\U21C9\U21CB-\U21D0\U21D2\U21D4\U21DA-\U21DD\U21E0\U21E2\U21F4-\U21FF\U2208-\U220D\U2213\U2214\U2217-\U221D\U2224-\U222A\U2237\U2238\U223A\U223B\U223D\U223E\U2240-\U228B\U228D-\U229C\U229E-\U22A3\U22A9\U22AC\U22AE\U22B0-\U22B7\U22BB-\U22BD\U22C4-\U22C7\U22C9-\U22D3\U22D5-\U22FF\U233F\U25B7\U27C2\U27C8\U27C9\U27D1\U27D2\U27D5-\U27D7\U27F0\U27F1\U27F5-\U27F7\U27F9-\U27FF\U2900-\U2918\U291D-\U2920\U2944-\U2970\U29B7\U29B8\U29BC\U29BE-\U29C1\U29E1\U29E3-\U29E5\U29F4\U29F6\U29F7\U29FA\U29FB\U2A07\U2A08\U2A1D\U2A1F\U2A22-\U2A2E\U2A30-\U2A3D\U2A40-\U2A45\U2A4A-\U2A58\U2A5A-\U2A63\U2A66\U2A67\U2A6A-\U2AD9\U2ADB\U2AF7-\U2AFA\U2B30-\U2B44\U2B47-\U2B4C\UFFE9-\UFFEC' -" Full operators regex -let s:operators = '\%(' . '\.\%([-+*/^÷%|&⊻]\|//\|\\\|>>\|>>>\?\)\?=' - \ . '\|' . '[:<>]=\|||\|&&\||>\|<|\|[<>:]:\|<<\|>>>\?\|//\|[-=]>\|\.\.\.\?' - \ . '\|' . '\.\?[!' . s:op_chars . s:op_chars_wc . ']' - \ . '\)' - " Characters that can be used to start an identifier. Above \UBF we don't " bother checking. (If a UTF8 operator is used, it will take precedence anyway.) @@ -80,6 +74,12 @@ let s:id_charsW = '\%([0-9A-Za-z_!\UA2-\UA6\UA9\UAA\UAE-\UB0\UB2-\UB5\UB8-\UBA\U " A valid julia identifier, more or less let s:idregex = '\%(' . s:id_charsH . s:id_charsW . '*\)' +" Full operators regex +let s:operators = '\%(' . '\.\%([-+*/^÷%|&⊻]\|//\|\\\|>>\|>>>\?\)\?=' + \ . '\|' . '[!:<>]=\|||\|&&\||>\|<|\|[<>:]:\|<<\|>>>\?\|//\|[-=]>\|\.\.\.\?' + \ . '\|' . '\.!' . '\|'.s:id_charsW.'\@'.s:d(1).'<!!' + \ . '\|' . '\.\?[' . s:op_chars . s:op_chars_wc . ']' + \ . '\)' syn case match @@ -90,10 +90,10 @@ syntax cluster juliaExprsNodot contains=@juliaParItems,@juliaStringItems,@julia syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraIdxBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar syntax cluster juliaKeywordItems contains=juliaKeyword,juliaWhereKeyword,juliaImportLine,juliaInfixKeyword,juliaRepKeyword -syntax cluster juliaBlocksItems contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock,juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock -syntax cluster juliaTypesItems contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther +syntax cluster juliaBlocksItems contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock,juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock +syntax cluster juliaTypesItems contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther -syntax cluster juliaConstItems contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstMMap,juliaConstC,juliaConstGeneric,juliaConstIO,juliaPossibleEuler +syntax cluster juliaConstItems contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstC,juliaConstGeneric,juliaConstIO,juliaPossibleEuler syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra syntax cluster juliaSymbolItems contains=juliaPossibleSymbol diff --git a/syntax/kotlin.vim b/syntax/kotlin.vim index 7175f7e3..39ddd471 100644 --- a/syntax/kotlin.vim +++ b/syntax/kotlin.vim @@ -60,10 +60,11 @@ syn keyword ktConstant null syn keyword ktModifier reified external inline noinline crossinline -syn match ktModifier "\v<(data|value)>\ze\@=.*<class>" +syn match ktModifier "\v<data>\ze\@=.*<(class|object)>" +syn match ktModifier "\v<value>\ze\@=.*<class>" syn match ktModifier "\v<(tailrec|operator|infix)>\ze\@=.*<fun>" -syn match ktModifier "\v<(const)>\ze\@=.*<val>" -syn match ktModifier "\v<(lateinit)>\ze\@=.*<var>" +syn match ktModifier "\v<const>\ze\@=.*<val>" +syn match ktModifier "\v<lateinit>\ze\@=.*<var>" syn match ktModifier "\v<(internal|private|protected|public)>\ze\@=.*<(class|object|interface|typealias|fun|val|var|constructor|get|set)>" syn match ktOperator "\v\?:|::|\<\=? | \>\=?|[!=]\=\=?|<as>\??|[-*+/%]\=?|[!&|]" diff --git a/syntax/llvm.vim b/syntax/llvm.vim index ee58753f..50dc0c9f 100644 --- a/syntax/llvm.vim +++ b/syntax/llvm.vim @@ -19,8 +19,8 @@ syn case match " Types also include struct, array, vector, etc. but these don't " benefit as much from having dedicated highlighting rules. syn keyword llvmType void half bfloat float double x86_fp80 fp128 ppc_fp128 -syn keyword llvmType label metadata x86_mmx -syn keyword llvmType type label opaque token +syn keyword llvmType label metadata x86_mmx x86_amx +syn keyword llvmType type label opaque token ptr syn match llvmType /\<i\d\+\>/ " Instructions. @@ -29,16 +29,16 @@ syn match llvmType /\<i\d\+\>/ syn keyword llvmStatement add addrspacecast alloca and arcp ashr atomicrmw syn keyword llvmStatement bitcast br catchpad catchswitch catchret call callbr syn keyword llvmStatement cleanuppad cleanupret cmpxchg eq exact extractelement -syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext -syn keyword llvmStatement fptosi fptoui fptrunc free frem fsub fneg getelementptr -syn keyword llvmStatement icmp inbounds indirectbr insertelement insertvalue -syn keyword llvmStatement inttoptr invoke landingpad load lshr malloc max min -syn keyword llvmStatement mul nand ne ninf nnan nsw nsz nuw oeq oge ogt ole -syn keyword llvmStatement olt one or ord phi ptrtoint resume ret sdiv select -syn keyword llvmStatement sext sge sgt shl shufflevector sitofp sle slt srem -syn keyword llvmStatement store sub switch trunc udiv ueq uge ugt uitofp ule ult -syn keyword llvmStatement umax umin une uno unreachable unwind urem va_arg -syn keyword llvmStatement xchg xor zext +syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fneg fpext +syn keyword llvmStatement fptosi fptoui fptrunc free freeze frem fsub +syn keyword llvmStatement getelementptr icmp inbounds indirectbr insertelement +syn keyword llvmStatement insertvalue inttoptr invoke landingpad load lshr +syn keyword llvmStatement malloc max min mul nand ne ninf nnan nsw nsz nuw oeq +syn keyword llvmStatement oge ogt ole olt one or ord phi ptrtoint resume ret +syn keyword llvmStatement sdiv select sext sge sgt shl shufflevector sitofp +syn keyword llvmStatement sle slt srem store sub switch trunc udiv ueq uge ugt +syn keyword llvmStatement uitofp ule ult umax umin une uno unreachable unwind +syn keyword llvmStatement urem va_arg xchg xor zext " Keywords. syn keyword llvmKeyword @@ -48,11 +48,12 @@ syn keyword llvmKeyword \ alias \ align \ alignstack + \ allocsize \ alwaysinline \ appending \ argmemonly - \ arm_aapcscc \ arm_aapcs_vfpcc + \ arm_aapcscc \ arm_apcscc \ asm \ atomic @@ -62,51 +63,58 @@ syn keyword llvmKeyword \ byref \ byval \ c - \ catch \ caller + \ catch \ cc \ ccc \ cleanup + \ cold \ coldcc \ comdat \ common \ constant + \ convergent \ datalayout \ declare \ default \ define \ deplibs \ dereferenceable + \ dereferenceable_or_null \ distinct \ dllexport \ dllimport \ dso_local \ dso_preemptable \ except + \ extern_weak \ external \ externally_initialized - \ extern_weak \ fastcc - \ tailcc \ filter \ from \ gc \ global - \ hhvmcc \ hhvm_ccc + \ hhvmcc \ hidden + \ hot \ immarg + \ inaccessiblemem_or_argmemonly + \ inaccessiblememonly + \ inalloca \ initialexec \ inlinehint \ inreg - \ inteldialect \ intel_ocl_bicc + \ inteldialect \ internal + \ jumptable \ linkonce \ linkonce_odr + \ local_unnamed_addr \ localdynamic \ localexec - \ local_unnamed_addr \ minsize \ module \ monotonic @@ -117,19 +125,32 @@ syn keyword llvmKeyword \ nest \ noalias \ nobuiltin + \ nocallback \ nocapture + \ nocf_check + \ no_cfi + \ noduplicate + \ nofree \ noimplicitfloat \ noinline + \ nomerge \ nonlazybind \ nonnull + \ noprofile \ norecurse \ noredzone \ noreturn + \ nosync \ noundef \ nounwind + \ nosanitize_bounds + \ nosanitize_coverage + \ null_pointer_is_valid + \ optforfuzzing \ optnone \ optsize \ personality + \ preallocated \ private \ protected \ ptx_device @@ -139,16 +160,20 @@ syn keyword llvmKeyword \ release \ returned \ returns_twice + \ safestack \ sanitize_address + \ sanitize_hwaddress \ sanitize_memory + \ sanitize_memtag \ sanitize_thread \ section \ seq_cst + \ shadowcallstack \ sideeffect \ signext - \ syncscope \ source_filename \ speculatable + \ speculative_load_hardening \ spir_func \ spir_kernel \ sret @@ -157,8 +182,12 @@ syn keyword llvmKeyword \ sspstrong \ strictfp \ swiftcc + \ swifterror + \ swifttailcc \ swiftself + \ syncscope \ tail + \ tailcc \ target \ thread_local \ to @@ -171,10 +200,11 @@ syn keyword llvmKeyword \ volatile \ weak \ weak_odr + \ willreturn + \ win64cc \ within \ writeonly \ x86_64_sysvcc - \ win64cc \ x86_fastcallcc \ x86_stdcallcc \ x86_thiscallcc @@ -189,7 +219,7 @@ syn match llvmNumber /-\?\<\d\+\>/ syn match llvmFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/ syn match llvmFloat /\<0x\x\+\>/ syn keyword llvmBoolean true false -syn keyword llvmConstant zeroinitializer undef null none +syn keyword llvmConstant zeroinitializer undef null none poison vscale syn match llvmComment /;.*$/ syn region llvmString start=/"/ skip=/\\"/ end=/"/ syn match llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/ @@ -212,7 +242,8 @@ syn match llvmSpecialComment /;\s*REQUIRES:.*$/ syn match llvmSpecialComment /;\s*RUN:.*$/ syn match llvmSpecialComment /;\s*ALLOW_RETRIES:.*$/ syn match llvmSpecialComment /;\s*CHECK:.*$/ -syn match llvmSpecialComment "\v;\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL):.*$" +syn match llvmSpecialComment /;\s*CHECK-EMPTY:\s*$/ +syn match llvmSpecialComment /\v;\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL|COUNT-\d+):.*$/ syn match llvmSpecialComment /;\s*XFAIL:.*$/ if version >= 508 || !exists("did_c_syn_inits") diff --git a/syntax/machine-ir.vim b/syntax/machine-ir.vim new file mode 100644 index 00000000..ad43a9f5 --- /dev/null +++ b/syntax/machine-ir.vim @@ -0,0 +1,42 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'llvm', 'syntax/machine-ir.vim') + finish +endif + +" Vim syntax file +" Language: mir +" Maintainer: The LLVM team, http://llvm.org/ +" Version: $Revision$ + +syn case match + +" FIXME: MIR doesn't actually match LLVM IR. Stop including it all as a +" fallback once enough is implemented. +" See the MIR LangRef: https://llvm.org/docs/MIRLangRef.html +unlet b:current_syntax " Unlet so that the LLVM syntax will load +runtime! syntax/llvm.vim +unlet b:current_syntax + +syn match mirType /\<[sp]\d\+\>/ + +" Opcodes. Matching instead of listing them because individual targets can add +" these. FIXME: Maybe use some more context to make this more accurate? +syn match mirStatement /\<[A-Z][A-Za-z0-9_]*\>/ + +syn match mirPReg /$[-a-zA-Z$._][-a-zA-Z$._0-9]*/ + +if version >= 508 || !exists("did_c_syn_inits") + if version < 508 + let did_c_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink mirType Type + HiLink mirStatement Statement + HiLink mirPReg Identifier + + delcommand HiLink +endif + +let b:current_syntax = "mir" diff --git a/syntax/meson.vim b/syntax/meson.vim index c392cccd..d3af405d 100644 --- a/syntax/meson.vim +++ b/syntax/meson.vim @@ -72,6 +72,7 @@ syn keyword mesonBuiltin \ add_global_link_arguments \ add_languages \ add_project_arguments + \ add_project_dependencies \ add_project_link_arguments \ add_test_setup \ alias_target diff --git a/syntax/mir.vim b/syntax/mir.vim new file mode 100644 index 00000000..55273945 --- /dev/null +++ b/syntax/mir.vim @@ -0,0 +1,52 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'llvm', 'syntax/mir.vim') + finish +endif + +" Vim syntax file +" Language: mir +" Maintainer: The LLVM team, http://llvm.org/ +" Version: $Revision$ + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case match + +" MIR is embedded in a yaml container, so we load all of the yaml syntax. +runtime! syntax/yaml.vim +unlet b:current_syntax + +" The first document of a file is allowed to contain an LLVM IR module inside +" a top-level yaml block string. +syntax include @LLVM syntax/llvm.vim +" FIXME: This should only be allowed for the first document of the file +syntax region llvm start=/\(^---\s*|\)\@<=/ end=/\(^\.\.\.\)\@=/ contains=@LLVM + +" The `body:` field of a document contains the MIR dump of the function +syntax include @MIR syntax/machine-ir.vim +syntax region mir start=/\(^body:\s*|\)\@<=/ end=/\(^[^[:space:]]\)\@=/ contains=@MIR + +" Syntax-highlight lit test commands and bug numbers. +syn match mirSpecialComment /#\s*PR\d*\s*$/ +syn match mirSpecialComment /#\s*REQUIRES:.*$/ +syn match mirSpecialComment /#\s*RUN:.*$/ +syn match mirSpecialComment /#\s*ALLOW_RETRIES:.*$/ +syn match mirSpecialComment /#\s*CHECK:.*$/ +syn match mirSpecialComment "\v#\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL):.*$" +syn match mirSpecialComment /#\s*XFAIL:.*$/ + +if version >= 508 || !exists("did_c_syn_inits") + if version < 508 + let did_c_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink mirSpecialComment SpecialComment +endif + +let b:current_syntax = "mir" diff --git a/syntax/mlir.vim b/syntax/mlir.vim index 6539cbdc..13f468c9 100644 --- a/syntax/mlir.vim +++ b/syntax/mlir.vim @@ -18,7 +18,7 @@ syn case match " Types. " -syn keyword mlirType index f16 f32 f64 +syn keyword mlirType index f16 f32 f64 bf16 " Signless integer types. syn match mlirType /\<i\d\+\>/ " Unsigned integer types. @@ -27,7 +27,7 @@ syn match mlirType /\<ui\d\+\>/ syn match mlirType /\<si\d\+\>/ " Elemental types inside memref, tensor, or vector types. -syn match mlirType /x\s*\zs\(f16\|f32\|f64\|i\d\+\|ui\d\+\|si\d\+\)/ +syn match mlirType /x\s*\zs\(bf16|f16\|f32\|f64\|i\d\+\|ui\d\+\|si\d\+\)/ " Shaped types. syn match mlirType /\<memref\ze\s*<.*>/ @@ -38,7 +38,6 @@ syn match mlirType /\<vector\ze\s*<.*>/ syn match mlirType /x\s*\zsvector/ " Operations. -" Standard dialect ops. " TODO: this list is not exhaustive. syn keyword mlirOps alloc alloca addf addi and call call_indirect cmpf cmpi syn keyword mlirOps constant dealloc divf dma_start dma_wait dim exp @@ -47,6 +46,9 @@ syn keyword mlirOps memref_shape_cast mulf muli negf powf prefetch rsqrt sitofp syn keyword mlirOps splat store select sqrt subf subi subview tanh syn keyword mlirOps view +" Math ops. +syn match mlirOps /\<math\.erf\>/ + " Affine ops. syn match mlirOps /\<affine\.apply\>/ syn match mlirOps /\<affine\.dma_start\>/ @@ -57,8 +59,10 @@ syn match mlirOps /\<affine\.load\>/ syn match mlirOps /\<affine\.parallel\>/ syn match mlirOps /\<affine\.prefetch\>/ syn match mlirOps /\<affine\.store\>/ -syn match mlirOps /\<loop\.for\>/ -syn match mlirOps /\<loop\.if\>/ +syn match mlirOps /\<scf\.execute_region\>/ +syn match mlirOps /\<scf\.for\>/ +syn match mlirOps /\<scf\.if\>/ +syn match mlirOps /\<scf\.yield\>/ " TODO: dialect name prefixed ops (llvm or std). @@ -84,12 +88,22 @@ syn match mlirNumber /x\s*\zs-\?\d\+\ze\s*x/ syn match mlirFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/ syn match mlirFloat /\<0x\x\+\>/ syn keyword mlirBoolean true false -syn match mlirComment /\/\/.*$/ +" Spell checking is enabled only in comments by default. +syn match mlirComment /\/\/.*$/ contains=@Spell syn region mlirString start=/"/ skip=/\\"/ end=/"/ syn match mlirLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/ +" Prefixed identifiers usually used for ssa values and symbols. syn match mlirIdentifier /[%@][a-zA-Z$._-][a-zA-Z0-9$._-]*/ -syn match mlirIdentifier /[%@!]\d\+\>/ -syn match mlirMapSetOutline "#.*$" +syn match mlirIdentifier /[%@]\d\+\>/ +" Prefixed identifiers usually used for blocks. +syn match mlirBlockIdentifier /\^[a-zA-Z$._-][a-zA-Z0-9$._-]*/ +syn match mlirBlockIdentifier /\^\d\+\>/ +" Prefixed identifiers usually used for types. +syn match mlirTypeIdentifier /![a-zA-Z$._-][a-zA-Z0-9$._-]*/ +syn match mlirTypeIdentifier /!\d\+\>/ +" Prefixed identifiers usually used for attribute aliases and result numbers. +syn match mlirAttrIdentifier /#[a-zA-Z$._-][a-zA-Z0-9$._-]*/ +syn match mlirAttrIdentifier /#\d\+\>/ " Syntax-highlight lit test commands and bug numbers. syn match mlirSpecialComment /\/\/\s*RUN:.*$/ @@ -111,7 +125,6 @@ if version >= 508 || !exists("did_c_syn_inits") HiLink mlirType Type HiLink mlirOps Statement - HiLink mlirMapSetOutline PreProc HiLink mlirNumber Number HiLink mlirComment Comment HiLink mlirString String @@ -122,6 +135,9 @@ if version >= 508 || !exists("did_c_syn_inits") HiLink mlirConstant Constant HiLink mlirSpecialComment SpecialComment HiLink mlirIdentifier Identifier + HiLink mlirBlockIdentifier Label + HiLink mlirTypeIdentifier Type + HiLink mlirAttrIdentifier PreProc delcommand HiLink endif diff --git a/syntax/ocaml.vim b/syntax/ocaml.vim index e3e6cfa3..88b2fa31 100644 --- a/syntax/ocaml.vim +++ b/syntax/ocaml.vim @@ -10,6 +10,7 @@ endif " Issac Trotts <ijtrotts@ucdavis.edu> " URL: https://github.com/ocaml/vim-ocaml " Last Change: +" 2019 Nov 05 - Accurate type highlighting (Maëlan) " 2018 Nov 08 - Improved highlighting of operators (Maëlan) " 2018 Apr 22 - Improved support for PPX (Andrey Popp) " 2018 Mar 16 - Remove raise, lnot and not from keywords (Étienne Millon, "copy") @@ -42,25 +43,18 @@ syn case match " Access to the method of an object syn match ocamlMethod "#" -" Script headers highlighted like comments -syn match ocamlComment "^#!.*" contains=@Spell - " Scripting directives syn match ocamlScript "^#\<\(quit\|labels\|warnings\|warn_error\|directory\|remove_directory\|cd\|load\|load_rec\|use\|mod_use\|install_printer\|remove_printer\|require\|list\|ppx\|principal\|predicates\|rectypes\|thread\|trace\|untrace\|untrace_all\|print_depth\|print_length\|camlp4o\|camlp4r\|topfind_log\|topfind_verbose\)\>" " lowercase identifier - the standard way to match syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/ -syn match ocamlKeyChar "|" - " Errors syn match ocamlBraceErr "}" syn match ocamlBrackErr "\]" syn match ocamlParenErr ")" syn match ocamlArrErr "|]" -syn match ocamlCommentErr "\*)" - syn match ocamlCountErr "\<downto\>" syn match ocamlCountErr "\<to\>" @@ -79,19 +73,22 @@ else syn match ocamlEndErr "\<end\>" endif -" Some convenient clusters -syn cluster ocamlAllErrs contains=ocamlBraceErr,ocamlBrackErr,ocamlParenErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr +" These keywords are only expected nested in constructions that are handled by +" the type linter, so outside of type contexts we highlight them as errors: +syn match ocamlKwErr "\<\(mutable\|nonrec\|of\|private\)\>" -syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr +" Some convenient clusters +syn cluster ocamlAllErrs contains=@ocamlAENoParen,ocamlParenErr +syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr,ocamlKwErr syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod,ocamlVal " Enclosing delimiters -syn region ocamlEncl transparent matchgroup=ocamlKeywordDelimiter start="(" matchgroup=ocamlKeywordDelimiter end=")" contains=ALLBUT,@ocamlContained,ocamlParenErr -syn region ocamlEncl transparent matchgroup=ocamlKeywordDelimiter start="{" matchgroup=ocamlKeywordDelimiter end="}" contains=ALLBUT,@ocamlContained,ocamlBraceErr -syn region ocamlEncl transparent matchgroup=ocamlKeywordDelimiter start="\[" matchgroup=ocamlKeywordDelimiter end="\]" contains=ALLBUT,@ocamlContained,ocamlBrackErr -syn region ocamlEncl transparent matchgroup=ocamlKeywordDelimiter start="\[|" matchgroup=ocamlKeywordDelimiter end="|\]" contains=ALLBUT,@ocamlContained,ocamlArrErr +syn region ocamlNone transparent matchgroup=ocamlEncl start="(" matchgroup=ocamlEncl end=")" contains=ALLBUT,@ocamlContained,ocamlParenErr +syn region ocamlNone transparent matchgroup=ocamlEncl start="{" matchgroup=ocamlEncl end="}" contains=ALLBUT,@ocamlContained,ocamlBraceErr +syn region ocamlNone transparent matchgroup=ocamlEncl start="\[" matchgroup=ocamlEncl end="\]" contains=ALLBUT,@ocamlContained,ocamlBrackErr +syn region ocamlNone transparent matchgroup=ocamlEncl start="\[|" matchgroup=ocamlEncl end="|\]" contains=ALLBUT,@ocamlContained,ocamlArrErr " Comments @@ -141,7 +138,7 @@ syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModPa " "module" - somewhat complicated stuff ;-) syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS -syn region ocamlModParam start="([^*]" end=")" contained contains=ocamlGenMod,ocamlModParam1,ocamlSig,ocamlVal +syn region ocamlModParam start="(\*\@!" end=")" contained contains=ocamlGenMod,ocamlModParam,ocamlModParam1,ocamlSig,ocamlVal syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty syn match ocamlGenMod "()" contained skipwhite skipempty @@ -155,7 +152,7 @@ syn region ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLC syn region ocamlModRHS start="." end=". *\w\|([^*]"me=e-2 contained contains=ocamlComment skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod syn match ocamlFullMod "\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=ocamlFuncWith -syn region ocamlFuncWith start="([^*)]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith +syn region ocamlFuncWith start="([*)]\@!" end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith syn region ocamlFuncStruct matchgroup=ocamlStructEncl start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*\>" contained @@ -167,7 +164,7 @@ syn region ocamlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT, syn region ocamlStruct matchgroup=ocamlStructEncl start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr " "module type" -syn region ocamlKeyword start="\<module\>\s*\<type\>\(\s*\<of\>\)\=" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef +syn region ocamlKeyword start="\<module\s\+type\(\s\+of\)\=\>" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef syn match ocamlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s+1 skipwhite skipempty nextgroup=ocamlFullMod " Quoted strings @@ -175,16 +172,26 @@ syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{\z\([a-z_]*\)|" syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{%[a-z_]\+\(\.[a-z_]\+\)\?\( \z\([a-z_]\+\)\)\?|" end="|\z1}" contains=@Spell syn keyword ocamlKeyword and as assert class -syn keyword ocamlKeyword constraint else -syn keyword ocamlKeyword exception external fun - +syn keyword ocamlKeyword else +syn keyword ocamlKeyword external syn keyword ocamlKeyword in inherit initializer syn keyword ocamlKeyword lazy let match -syn keyword ocamlKeyword method mutable new nonrec of -syn keyword ocamlKeyword parser private rec -syn keyword ocamlKeyword try type +syn keyword ocamlKeyword method new +syn keyword ocamlKeyword parser rec +syn keyword ocamlKeyword try syn keyword ocamlKeyword virtual when while with +" Keywords which are handled by the type linter: +" as (within a type equation) +" constraint exception mutable nonrec of private type + +" The `fun` keyword has special treatment because of the syntax `fun … : t -> e` +" where `->` ends the type context rather than being part of it; to handle that, +" we blacklist the ocamlTypeAnnot matchgroup, and we plug ocamlFunTypeAnnot +" instead (later in this file, by using containedin=ocamlFun): +syn region ocamlFun matchgroup=ocamlKeyword start='\<fun\>' matchgroup=ocamlArrow end='->' +\ contains=ALLBUT,@ocamlContained,ocamlArrow,ocamlInfixOp,ocamlTypeAnnot + if exists("ocaml_revised") syn keyword ocamlKeyword do value syn keyword ocamlBoolean True False @@ -193,14 +200,10 @@ else syn keyword ocamlBoolean true false endif -syn keyword ocamlType array bool char exn float format format4 -syn keyword ocamlType int int32 int64 lazy_t list nativeint option -syn keyword ocamlType bytes string unit - -syn match ocamlConstructorDelimiter "(\s*)" -syn match ocamlConstructorDelimiter "\[\s*\]" -syn match ocamlConstructorDelimiter "\[|\s*>|]" -syn match ocamlConstructorDelimiter "\[<\s*>\]" +syn match ocamlEmptyConstructor "(\s*)" +syn match ocamlEmptyConstructor "\[\s*\]" +syn match ocamlEmptyConstructor "\[|\s*>|]" +syn match ocamlEmptyConstructor "\[<\s*>\]" syn match ocamlConstructor "\u\(\w\|'\)*\>" " Polymorphic variants @@ -215,26 +218,24 @@ syn match ocamlCharErr "'\\\d\d'\|'\\\d'" syn match ocamlCharErr "'\\[^\'ntbr]'" syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell -syn match ocamlTopStop ";;" - syn match ocamlAnyVar "\<_\>" -syn match ocamlKeyChar "|[^\]]"me=e-1 +syn match ocamlKeyChar "|]\@!" syn match ocamlKeyChar ";" syn match ocamlKeyChar "\~" syn match ocamlKeyChar "?" +" NOTE: for correct precedence, the rule for ";;" must come after that for ";" +syn match ocamlTopStop ";;" + "" Operators " The grammar of operators is found there: " https://caml.inria.fr/pub/docs/manual-ocaml/names.html#operator-name " https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:ext-ops " https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:index-operators -" =, *, < and > are both operator names and keywords, we let the user choose how -" to display them (has to be declared before regular infix operators): +" = is both an operator name and a keyword, we let the user choose how +" to display it (has to be declared before regular infix operators): syn match ocamlEqual "=" -syn match ocamlStar "*" -syn match ocamlAngle "<" -syn match ocamlAngle ">" " Custom indexing operators: syn region ocamlIndexing matchgroup=ocamlIndexingOp \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*(" @@ -253,8 +254,8 @@ syn match ocamlExtensionOp "#[#~?!.:|&$%<=>@^*/+-]\+" " Infix and prefix operators: syn match ocamlPrefixOp "![~?!.:|&$%<=>@^*/+-]*" syn match ocamlPrefixOp "[~?][~?!.:|&$%<=>@^*/+-]\+" -syn match ocamlInfixOp "[&$%@^/+-][~?!.:|&$%<=>@^*/+-]*" -syn match ocamlInfixOp "[|<=>*][~?!.:|&$%<=>@^*/+-]\+" +syn match ocamlInfixOp "[&$%<>@^*/+-][~?!.:|&$%<=>@^*/+-]*" +syn match ocamlInfixOp "[|=][~?!.:|&$%<=>@^*/+-]\+" syn match ocamlInfixOp "#[~?!.:|&$%<=>@^*/+-]\+#\@!" syn match ocamlInfixOp "!=[~?!.:|&$%<=>@^*/+-]\@!" syn keyword ocamlInfixOpKeyword asr land lor lsl lsr lxor mod or @@ -271,6 +272,9 @@ else syn match ocamlKeyChar "<-[~?!.:|&$%<=>@^*/+-]\@!" endif +" Script shebang (has to be declared after operators) +syn match ocamlShebang "\%1l^#!.*$" + syn match ocamlNumber "-\=\<\d\(_\|\d\)*[l|L|n]\?\>" syn match ocamlNumber "-\=\<0[x|X]\(\x\|_\)\+[l|L|n]\?\>" syn match ocamlNumber "-\=\<0[o|O]\(\o\|_\)\+[l|L|n]\?\>" @@ -278,10 +282,264 @@ syn match ocamlNumber "-\=\<0[b|B]\([01]\|_\)\+[l|L|n]\?\>" syn match ocamlFloat "-\=\<\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>" " Labels -syn match ocamlLabel "\~\(\l\|_\)\(\w\|'\)*"lc=1 -syn match ocamlLabel "?\(\l\|_\)\(\w\|'\)*"lc=1 +syn match ocamlLabel "[~?]\(\l\|_\)\(\w\|'\)*:\?" syn region ocamlLabel transparent matchgroup=ocamlLabel start="[~?](\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +"" Type contexts + +" How we recognize type contexts is explained in `type-linter-notes.md` +" and a test suite is found in `type-linter-test.ml`. +" +" ocamlTypeExpr is the cluster of things that can make up a type expression +" (in a loose sense, e.g. the “as” keyword and universal quantification are +" included). Regions containing a type expression use it like this: +" +" contains=@ocamlTypeExpr,... +" +" ocamlTypeContained is the cluster of things that can be found in a type +" expression or a type definition. It is not expected to be used in any region, +" it exists solely for throwing things in it that should not pollute the main +" linter. +" +" Both clusters are filled in incrementally. Every match group that is not to be +" found at the main level must be declared as “contained” and added to either +" ocamlTypeExpr or ocamlTypeContained. +" +" In these clusters we don’t put generic things that can also be found elswhere, +" i.e. ocamlComment and ocamlPpx, because everything that is in these clusters +" is also put in ocamlContained and thus ignored by the main linter. + +"syn cluster ocamlTypeExpr contains= +syn cluster ocamlTypeContained contains=@ocamlTypeExpr +syn cluster ocamlContained add=@ocamlTypeContained + +" We’ll use a “catch-all” highlighting group to show as error anything that is +" not matched more specifically; we don’t want spaces to be reported as errors +" (different background color), so we just catch them here: +syn cluster ocamlTypeExpr add=ocamlTypeBlank +syn match ocamlTypeBlank contained "\_s\+" +hi link ocamlTypeBlank NONE + +" NOTE: Carefully avoid catching "(*" here. +syn cluster ocamlTypeExpr add=ocamlTypeParen +syn region ocamlTypeParen contained transparent +\ matchgroup=ocamlEncl start="(\*\@!" +\ matchgroup=ocamlEncl end=")" +\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx + +syn cluster ocamlTypeExpr add=ocamlTypeKeyChar,ocamlTypeAs +syn match ocamlTypeKeyChar contained "->" +syn match ocamlTypeKeyChar contained "\*" +syn match ocamlTypeKeyChar contained "#" +syn match ocamlTypeKeyChar contained "," +syn match ocamlTypeKeyChar contained "\." +syn keyword ocamlTypeAs contained as +hi link ocamlTypeAs ocamlKeyword + +syn cluster ocamlTypeExpr add=ocamlTypeVariance +syn match ocamlTypeVariance contained "[-+!]\ze *\('\|\<_\>\)" +syn match ocamlTypeVariance contained "[-+] *!\+\ze *\('\|\<_\>\)" +syn match ocamlTypeVariance contained "! *[-+]\+\ze *\('\|\<_\>\)" + +syn cluster ocamlTypeContained add=ocamlTypeEq +syn match ocamlTypeEq contained "[+:]\?=" +hi link ocamlTypeEq ocamlKeyChar + +syn cluster ocamlTypeExpr add=ocamlTypeVar,ocamlTypeConstr,ocamlTypeAnyVar,ocamlTypeBuiltin +syn match ocamlTypeVar contained "'\(\l\|_\)\(\w\|'\)*\>" +syn match ocamlTypeConstr contained "\<\(\l\|_\)\(\w\|'\)*\>" +" NOTE: for correct precedence, the rule for the wildcard (ocamlTypeAnyVar) +" must come after the rule for type constructors (ocamlTypeConstr). +syn match ocamlTypeAnyVar contained "\<_\>" +" NOTE: For correct precedence, these builtin names must occur after the rule +" for type constructors (ocamlTypeConstr) but before the rule for non-optional +" labeled arguments (ocamlTypeLabel). For the latter to take precedence over +" these builtin names, we use “syn match” here instead of “syn keyword”. +syn match ocamlTypeBuiltin contained "\<array\>" +syn match ocamlTypeBuiltin contained "\<bool\>" +syn match ocamlTypeBuiltin contained "\<bytes\>" +syn match ocamlTypeBuiltin contained "\<char\>" +syn match ocamlTypeBuiltin contained "\<exn\>" +syn match ocamlTypeBuiltin contained "\<float\>" +syn match ocamlTypeBuiltin contained "\<format\>" +syn match ocamlTypeBuiltin contained "\<format4\>" +syn match ocamlTypeBuiltin contained "\<format6\>" +syn match ocamlTypeBuiltin contained "\<in_channel\>" +syn match ocamlTypeBuiltin contained "\<int\>" +syn match ocamlTypeBuiltin contained "\<int32\>" +syn match ocamlTypeBuiltin contained "\<int64\>" +syn match ocamlTypeBuiltin contained "\<lazy_t\>" +syn match ocamlTypeBuiltin contained "\<list\>" +syn match ocamlTypeBuiltin contained "\<nativeint\>" +syn match ocamlTypeBuiltin contained "\<option\>" +syn match ocamlTypeBuiltin contained "\<out_channel\>" +syn match ocamlTypeBuiltin contained "\<ref\>" +syn match ocamlTypeBuiltin contained "\<result\>" +syn match ocamlTypeBuiltin contained "\<scanner\>" +syn match ocamlTypeBuiltin contained "\<string\>" +syn match ocamlTypeBuiltin contained "\<unit\>" + +syn cluster ocamlTypeExpr add=ocamlTypeLabel +syn match ocamlTypeLabel contained "?\?\(\l\|_\)\(\w\|'\)*\_s*:[>=]\@!" +hi link ocamlTypeLabel ocamlLabel + +" Object type +syn cluster ocamlTypeExpr add=ocamlTypeObject +syn region ocamlTypeObject contained +\ matchgroup=ocamlEncl start="<" +\ matchgroup=ocamlEncl end=">" +\ contains=ocamlTypeObjectDots,ocamlLCIdentifier,ocamlTypeObjectAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx +hi link ocamlTypeObject ocamlTypeCatchAll +syn cluster ocamlTypeContained add=ocamlTypeObjectDots +syn match ocamlTypeObjectDots contained "\.\." +hi link ocamlTypeObjectDots ocamlKeyChar +syn cluster ocamlTypeContained add=ocamlTypeObjectAnnot +syn region ocamlTypeObjectAnnot contained +\ matchgroup=ocamlKeyChar start=":" +\ matchgroup=ocamlKeyChar end=";\|>\@=" +\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx +hi link ocamlTypeObjectAnnot ocamlTypeCatchAll + +" Record type definition +syn cluster ocamlTypeContained add=ocamlTypeRecordDecl +syn region ocamlTypeRecordDecl contained +\ matchgroup=ocamlEncl start="{" +\ matchgroup=ocamlEncl end="}" +\ contains=ocamlTypeMutable,ocamlLCIdentifier,ocamlTypeRecordAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx +hi link ocamlTypeRecordDecl ocamlTypeCatchAll +syn cluster ocamlTypeContained add=ocamlTypeMutable +syn keyword ocamlTypeMutable contained mutable +hi link ocamlTypeMutable ocamlKeyword +syn cluster ocamlTypeContained add=ocamlTypeRecordAnnot +syn region ocamlTypeRecordAnnot contained +\ matchgroup=ocamlKeyChar start=":" +\ matchgroup=ocamlKeyChar end=";\|}\@=" +\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx +hi link ocamlTypeRecordAnnot ocamlTypeCatchAll + +" Polymorphic variant types +" NOTE: Carefully avoid catching "[@" here. +syn cluster ocamlTypeExpr add=ocamlTypeVariant +syn region ocamlTypeVariant contained +\ matchgroup=ocamlEncl start="\[>" start="\[<" start="\[@\@!" +\ matchgroup=ocamlEncl end="\]" +\ contains=ocamlTypeVariantKeyChar,ocamlTypeVariantConstr,ocamlTypeVariantAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx +hi link ocamlTypeVariant ocamlTypeCatchAll +syn cluster ocamlTypeContained add=ocamlTypeVariantKeyChar +syn match ocamlTypeVariantKeyChar contained "|" +syn match ocamlTypeVariantKeyChar contained ">" +hi link ocamlTypeVariantKeyChar ocamlKeyChar +syn cluster ocamlTypeContained add=ocamlTypeVariantConstr +syn match ocamlTypeVariantConstr contained "`\w\(\w\|'\)*\>" +hi link ocamlTypeVariantConstr ocamlConstructor +syn cluster ocamlTypeContained add=ocamlTypeVariantAnnot +syn region ocamlTypeVariantAnnot contained +\ matchgroup=ocamlKeyword start="\<of\>" +\ matchgroup=ocamlKeyChar end="|\|>\|\]\@=" +\ contains=@ocamlTypeExpr,ocamlTypeAmp,ocamlComment,ocamlPpx +hi link ocamlTypeVariantAnnot ocamlTypeCatchAll +syn cluster ocamlTypeContained add=ocamlTypeAmp +syn match ocamlTypeAmp contained "&" +hi link ocamlTypeAmp ocamlTypeKeyChar + +" Sum type definition +syn cluster ocamlTypeContained add=ocamlTypeSumDecl +syn region ocamlTypeSumDecl contained +\ matchgroup=ocamlTypeSumBar start="|" +\ matchgroup=ocamlTypeSumConstr start="\<\u\(\w\|'\)*\>" +\ matchgroup=ocamlTypeSumConstr start="\<false\>" start="\<true\>" +\ matchgroup=ocamlTypeSumConstr start="(\_s*)" start="\[\_s*]" start="(\_s*::\_s*)" +\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\|=\)\@=" +\ matchgroup=NONE end="\(\<and\>\)\@=" +\ contains=ocamlTypeSumBar,ocamlTypeSumConstr,ocamlTypeSumAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx +hi link ocamlTypeSumDecl ocamlTypeCatchAll +syn cluster ocamlTypeContained add=ocamlTypeSumBar +syn match ocamlTypeSumBar contained "|" +hi link ocamlTypeSumBar ocamlKeyChar +syn cluster ocamlTypeContained add=ocamlTypeSumConstr +syn match ocamlTypeSumConstr contained "\<\u\(\w\|'\)*\>" +syn match ocamlTypeSumConstr contained "\<false\>" +syn match ocamlTypeSumConstr contained "\<true\>" +syn match ocamlTypeSumConstr contained "(\_s*)" +syn match ocamlTypeSumConstr contained "\[\_s*]" +syn match ocamlTypeSumConstr contained "(\_s*::\_s*)" +hi link ocamlTypeSumConstr ocamlConstructor +syn cluster ocamlTypeContained add=ocamlTypeSumAnnot +syn region ocamlTypeSumAnnot contained +\ matchgroup=ocamlKeyword start="\<of\>" +\ matchgroup=ocamlKeyChar start=":" +\ matchgroup=NONE end="|\@=" +\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@=" +\ matchgroup=NONE end="\(\<and\>\)\@=" +\ contains=@ocamlTypeExpr,ocamlTypeRecordDecl,ocamlComment,ocamlPpx +hi link ocamlTypeSumAnnot ocamlTypeCatchAll + +" Type context opened by “type” (type definition), “constraint” (type +" constraint) and “exception” (exception definition) +syn region ocamlTypeDef +\ matchgroup=ocamlKeyword start="\<type\>\(\_s\+\<nonrec\>\)\?\|\<constraint\>\|\<exception\>" +\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@=" +\ contains=@ocamlTypeExpr,ocamlTypeEq,ocamlTypePrivate,ocamlTypeDefDots,ocamlTypeRecordDecl,ocamlTypeSumDecl,ocamlTypeDefAnd,ocamlComment,ocamlPpx +hi link ocamlTypeDef ocamlTypeCatchAll +syn cluster ocamlTypeContained add=ocamlTypePrivate +syn keyword ocamlTypePrivate contained private +hi link ocamlTypePrivate ocamlKeyword +syn cluster ocamlTypeContained add=ocamlTypeDefAnd +syn keyword ocamlTypeDefAnd contained and +hi link ocamlTypeDefAnd ocamlKeyword +syn cluster ocamlTypeContained add=ocamlTypeDefDots +syn match ocamlTypeDefDots contained "\.\." +hi link ocamlTypeDefDots ocamlKeyChar + +" When "exception" is preceded by "with", "|" or "(", that’s not an exception +" definition but an exception pattern; we simply highlight the keyword without +" starting a type context. +" NOTE: These rules must occur after that for "exception". +syn match ocamlKeyword "\<with\_s\+exception\>"lc=4 +syn match ocamlKeyword "|\_s*exception\>"lc=1 +syn match ocamlKeyword "(\_s*exception\>"lc=1 + +" Type context opened by “:” (countless kinds of type annotations) and “:>” +" (type coercions) +syn region ocamlTypeAnnot matchgroup=ocamlKeyChar start=":\(>\|\_s*type\>\|[>:=]\@!\)" +\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@=" +\ matchgroup=NONE end="\(;\|}\)\@=" +\ matchgroup=NONE end="\(=\|:>\)\@=" +\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx +hi link ocamlTypeAnnot ocamlTypeCatchAll + +" Type annotation that gives the return type of a `fun` keyword +" (the type context is ended by `->`) +syn cluster ocamlTypeContained add=ocamlFunTypeAnnot +syn region ocamlFunTypeAnnot contained containedin=ocamlFun +\ matchgroup=ocamlKeyChar start=":" +\ matchgroup=NONE end="\(->\)\@=" +\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx +hi link ocamlFunTypeAnnot ocamlTypeCatchAll + +" Module paths (including functors) in types. +" NOTE: This rule must occur after the rule for ocamlTypeSumDecl as it must take +" precedence over it (otherwise the module name would be mistakenly highlighted +" as a constructor). +" NOTE: Carefully avoid catching "(*" here. +syn cluster ocamlTypeExpr add=ocamlTypeModPath +syn match ocamlTypeModPath contained "\<\u\(\w\|'\)*\_s*\." +syn region ocamlTypeModPath contained transparent +\ matchgroup=ocamlModPath start="\<\u\(\w\|'\)*\_s*(\*\@!" +\ matchgroup=ocamlModPath end=")\_s*\." +\ contains=ocamlTypeDotlessModPath,ocamlTypeBlank,ocamlComment,ocamlPpx +hi link ocamlTypeModPath ocamlModPath +syn cluster ocamlTypeContained add=ocamlTypeDotlessModPath +syn match ocamlTypeDotlessModPath contained "\<\u\(\w\|'\)*\_s*\.\?" +syn region ocamlTypeDotlessModPath contained transparent +\ matchgroup=ocamlModPath start="\<\u\(\w\|'\)*\_s*(\*\@!" +\ matchgroup=ocamlModPath end=")\_s*\.\?" +\ contains=ocamlTypeDotlessModPath,ocamlTypeBlank,ocamlComment,ocamlPpx +hi link ocamlTypeDotlessModPath ocamlTypeModPath + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Synchronization syn sync minlines=50 @@ -311,19 +569,19 @@ hi def link ocamlBrackErr Error hi def link ocamlParenErr Error hi def link ocamlArrErr Error -hi def link ocamlCommentErr Error - hi def link ocamlCountErr Error hi def link ocamlDoErr Error hi def link ocamlDoneErr Error hi def link ocamlEndErr Error hi def link ocamlThenErr Error +hi def link ocamlKwErr Error hi def link ocamlCharErr Error hi def link ocamlErr Error hi def link ocamlComment Comment +hi def link ocamlShebang ocamlComment hi def link ocamlModPath Include hi def link ocamlObject Include @@ -344,13 +602,12 @@ hi def link ocamlStructEncl ocamlModule hi def link ocamlScript Include hi def link ocamlConstructor Constant -hi def link ocamlConstructorDelimiter ocamlConstructor +hi def link ocamlEmptyConstructor ocamlConstructor hi def link ocamlVal Keyword hi def link ocamlModPreRHS Keyword hi def link ocamlMPRestr2 Keyword hi def link ocamlKeyword Keyword -hi def link ocamlKeywordDelimiter ocamlKeyword hi def link ocamlMethod Include hi def link ocamlArrow Keyword hi def link ocamlKeyChar Keyword @@ -359,8 +616,6 @@ hi def link ocamlTopStop Keyword hi def link ocamlRefAssign ocamlKeyChar hi def link ocamlEqual ocamlKeyChar -hi def link ocamlStar ocamlInfixOp -hi def link ocamlAngle ocamlInfixOp hi def link ocamlCons ocamlInfixOp hi def link ocamlPrefixOp ocamlOperator @@ -384,7 +639,24 @@ hi def link ocamlQuotedStringDelim Identifier hi def link ocamlLabel Identifier -hi def link ocamlType Type +" Type linting groups that the user can customize: +" - ocamlTypeCatchAll: anything in a type context that is not caught by more +" specific rules (in principle, this should only match syntax errors) +" - ocamlTypeConstr: type constructors +" - ocamlTypeBuiltin: builtin type constructors (like int or list) +" - ocamlTypeVar: type variables ('a) +" - ocamlTypeAnyVar: wildcard (_) +" - ocamlTypeVariance: variance and injectivity indications (+'a, !'a) +" - ocamlTypeKeyChar: symbols such as -> and * +" Default values below mimick the behavior before the type linter was +" implemented, but now we can do better. :-) +hi def link ocamlTypeCatchAll Error +hi def link ocamlTypeConstr NONE +hi def link ocamlTypeBuiltin Type +hi def link ocamlTypeVar NONE +hi def link ocamlTypeAnyVar NONE +hi def link ocamlTypeVariance ocamlKeyChar +hi def link ocamlTypeKeyChar ocamlKeyChar hi def link ocamlTodo Todo diff --git a/syntax/odin.vim b/syntax/odin.vim index 9f8521ae..418aa8db 100644 --- a/syntax/odin.vim +++ b/syntax/odin.vim @@ -11,6 +11,7 @@ syntax keyword odinTransmute transmute syntax keyword odinCast cast syntax keyword odinDistinct distinct syntax keyword odinOpaque opaque +syntax keyword odinWhere where syntax keyword odinStruct struct syntax keyword odinEnum enum @@ -47,10 +48,11 @@ syntax match odinFixMe "FIXME" syntax match odinNoCheckin "NOCHECKIN" syntax match odinHack "HACK" -syntax keyword odinDataType string cstring bool b8 b16 b32 b64 rune any rawptr f32 f64 f32le f32be f64le f64be u8 u16 u32 u64 u128 u16le u32le u64le u128le u16be u32be u64be u128be uint uintptr i8 i16 i32 i64 i128 i16le i32le i64le i128le i16be i32be i64be i128be int complex complex32 complex64 complex128 quaternion quaternion64 quaternion128 quaternion256 matrix +syntax keyword odinDataType string cstring bool b8 b16 b32 b64 rune any rawptr f16 f32 f64 f16le f16be f32le f32be f64le f64be u8 u16 u32 u64 u128 u16le u32le u64le u128le u16be u32be u64be u128be uint uintptr i8 i16 i32 i64 i128 i16le i32le i64le i128le i16be i32be i64be i128be int complex complex32 complex64 complex128 quaternion quaternion64 quaternion128 quaternion256 matrix typeid syntax keyword odinBool true false syntax keyword odinNull nil syntax keyword odinDynamic dynamic +syntax keyword odinMap map syntax keyword odinProc proc syntax keyword odinIn in syntax keyword odinNotIn notin @@ -65,9 +67,9 @@ syntax keyword odinPackage package syntax keyword odinReturn return syntax keyword odinDefer defer -syntax region odinChar start=/\v'/ skip=/\v\\./ end=/\v'/ -syntax region odinString start=/\v"/ skip=/\v\\./ end=/\v"/ -syntax region odinRawString start=/\v`/ skip=/\v\\./ end=/\v`/ +syntax region odinRawString start=+`+ end=+`+ +syntax region odinChar start=+'+ skip=+\\\\\|\\'+ end=+'+ +syntax region odinString start=+"+ skip=+\\\\\|\\'+ end=+"+ syntax match odinFunction "\v<\w*>(\s*::\s*proc)@=" @@ -96,7 +98,7 @@ syntax match odinMacro "#\<\w\+\>" display syntax match odinTemplate "$\<\w\+\>" syntax match odinCommentNote "@\<\w\+\>" contained display -syntax region odinLineComment start=/\/\// end=/$/ contains=odinLineComment, odinCommentNote, odinTodo, odinNote, odinXXX, odinFixMe, odinNoCheckin, odinHack +syntax region odinLineComment start=/\/\// end=/$/ contains=odinCommentNote, odinTodo, odinNote, odinXXX, odinFixMe, odinNoCheckin, odinHack syntax region odinBlockComment start=/\v\/\*/ end=/\v\*\// contains=odinBlockComment, odinCommentNote, odinTodo, odinNote, odinXXX, odinFixMe, odinNoCheckin, odinHack highlight link odinUsing Keyword @@ -121,6 +123,7 @@ highlight link odinAlignOf Keyword highlight link odinPackage Keyword highlight link odinOrReturn Keyword highlight link odinOrElse Keyword +highlight link odinWhere Keyword highlight link odinInline Keyword highlight link odinNoInline Keyword @@ -133,6 +136,7 @@ highlight link odinDo Keyword highlight link odinDefer Operator highlight link odinDynamic Operator +highlight link odinMap Operator highlight link odinRange Operator highlight link odinHalfRange Operator highlight link odinAssign Operator diff --git a/syntax/openscad.vim b/syntax/openscad.vim index 40156d58..14e6b223 100644 --- a/syntax/openscad.vim +++ b/syntax/openscad.vim @@ -32,7 +32,7 @@ syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface syn keyword openscadPrimitive2D square circle polygon import_dxf text syn keyword openscadPrimitiveImport import child children -syn match openscadSpecialVariable "\$[a-zA-Z]\+\>" display +syn match openscadSpecialVariable "\$[a-zA-Z0-9_]\+\>" display syn match openscadModifier "^\s*[\*\!\#\%]" display syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent diff --git a/syntax/qml.vim b/syntax/qml.vim index 73540c7c..aee23df4 100644 --- a/syntax/qml.vim +++ b/syntax/qml.vim @@ -31,7 +31,7 @@ endif syn case ignore -syn cluster qmlExpr contains=qmlStringD,qmlStringS,qmlStringT,SqmlCharacter,qmlNumber,qmlObjectLiteralType,qmlBoolean,qmlType,qmlJsType,qmlNull,qmlGlobal,qmlFunction,qmlArrowFunction +syn cluster qmlExpr contains=qmlStringD,qmlStringS,qmlStringT,SqmlCharacter,qmlNumber,qmlObjectLiteralType,qmlBoolean,qmlType,qmlJsType,qmlNull,qmlGlobal,qmlFunction,qmlArrowFunction,qmlNullishCoalescing syn keyword qmlCommentTodo TODO FIXME XXX TBD contained syn match qmlLineComment "\/\/.*" contains=@Spell,qmlCommentTodo syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)" @@ -49,6 +49,7 @@ syn region qmlRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi syn match qmlObjectLiteralType "[A-Za-z][_A-Za-z0-9]*\s*\({\)\@=" syn region qmlTernaryColon start="?" end=":" contains=@qmlExpr,qmlBraces,qmlParens syn match qmlBindingProperty "\<[A-Za-z][_A-Za-z.0-9]*\s*:" +syn match qmlNullishCoalescing "??" syn keyword qmlConditional if else switch syn keyword qmlRepeat while for do in @@ -1065,7 +1066,7 @@ syntax keyword qmlObjectLiteralType XYSeries syntax keyword qmlObjectLiteralType YAnimator -syntax keyword qmlObjectLiteralType ZoomBlur +syntax keyword qmlObjectLiteralType ZoomBlur " }}} @@ -1126,6 +1127,7 @@ if version >= 508 || !exists("did_qml_syn_inits") HiLink qmlNull Keyword HiLink qmlBoolean Boolean HiLink qmlRegexpString String + HiLink qmlNullishCoalescing Operator HiLink qmlIdentifier Identifier HiLink qmlLabel Label diff --git a/syntax/requirements.vim b/syntax/requirements.vim index 3835c07f..d665d456 100644 --- a/syntax/requirements.vim +++ b/syntax/requirements.vim @@ -3,7 +3,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'requirements', 'syntax/requir endif " the Requirements File Format syntax support for Vim -" Version: 1.6.0 +" Version: 1.7.1 " Author: raimon <raimon49@hotmail.com> " License: MIT LICENSE " The MIT License (MIT) @@ -34,6 +34,7 @@ endif syn case match +syn match requirementsVersion "\v\d+[a-zA-Z0-9\.\-\*]*" syn region requirementsComment start="[ \t]*#" end="$" syn match requirementsCommandOption "\v^\[?--?[a-zA-Z\-]*\]?" syn match requirementsVersionSpecifiers "\v(\=\=\=?|\<\=?|\>\=?|\~\=|\!\=)" @@ -43,14 +44,15 @@ syn match requirementsVersionControls "\v(git\+?|hg\+|svn\+|bzr\+).*://.\S+" syn match requirementsURLs "\v(\@\s)?(https?|ftp|gopher)://?[^\s/$.?#].\S*" syn match requirementsEnvironmentMarkers "\v;\s[^#]+" -hi link requirementsComment Comment -hi link requirementsCommandOption Special -hi link requirementsVersionSpecifiers Boolean -hi link requirementsPackageName Identifier -hi link requirementsExtras Type -hi link requirementsVersionControls Underlined -hi link requirementsURLs Underlined -hi link requirementsEnvironmentMarkers Macro +hi def link requirementsVersion Number +hi def link requirementsComment Comment +hi def link requirementsCommandOption Special +hi def link requirementsVersionSpecifiers Boolean +hi def link requirementsPackageName Identifier +hi def link requirementsExtras Type +hi def link requirementsVersionControls Underlined +hi def link requirementsURLs Underlined +hi def link requirementsEnvironmentMarkers Macro let b:current_syntax = "requirements" diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a2fae63a..a2e3c3aa 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -402,11 +402,6 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") SynFold 'for' syn region rubyRepeatExpression start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\@<![!?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine - if !exists("ruby_minlines") - let ruby_minlines = 500 - endif - exe "syn sync minlines=" . ruby_minlines - else syn match rubyControl "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl syn match rubyControl "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl @@ -415,6 +410,11 @@ else syn match rubyKeyword "\<\%(alias\|undef\)\>" endif +if !exists("ruby_minlines") + let ruby_minlines = 500 +endif +exe "syn sync minlines=" . ruby_minlines + " Special Methods {{{1 if !exists("ruby_no_special_methods") syn match rubyAccess "\<\%(public\|protected\|private\)\>" " use re=2 diff --git a/syntax/solidity.vim b/syntax/solidity.vim index e533ab54..d145a547 100644 --- a/syntax/solidity.vim +++ b/syntax/solidity.vim @@ -126,7 +126,7 @@ syn region solFuncBody contained contains=solDestructure,solComment,s \ start='{' \ end='}' syn match solFuncCall contained skipempty skipwhite nextgroup=solCallOptions,solFuncCallParens - \ '\v%(%(<if>|<uint>|<int>|<ufixed>|<bytes>|<address>|<string>|<bool>)\s*)@<!<[a-zA-Z_][0-9a-zA-Z_]*\s*%((\{(\n|.|\s)*\})?\s*(\((\n|.|\s)*\)))@=' + \ '\v%(%(<if>|<uint>|<int>|<ufixed>|<bytes>|<address>|<string>|<bool>)\s*)@<!<[a-zA-Z_][0-9a-zA-Z_]*\s*%((\{[^}]*\})?\s*\()@=' syn region solFuncCallParens contained transparent contains=solComment,solString,solFuncCall,solConstant,solNumber,solMethod,solTypeCast,solComma,solOperator \ start='(' \ end=')' diff --git a/syntax/swayconfig.vim b/syntax/swayconfig.vim index 93832bcf..9752846c 100644 --- a/syntax/swayconfig.vim +++ b/syntax/swayconfig.vim @@ -6,7 +6,7 @@ endif " Language: sway config file " Original Author: Mohamed Boughaba <mohamed dot bgb at gmail dot com> " Maintainer: James Eapen <jamespeapen at gmail dot com> -" Version: 1.0 +" Version: 0.11.6 " Last Change: 2020-10-07 " References: @@ -60,30 +60,41 @@ syn match swayConfigInitialize /^\s*set\s\+.*$/ contains=swayConfigVariable,sway " Gaps syn keyword swayConfigGapStyleKeyword inner outer horizontal vertical top right bottom left current all set plus minus toggle up down contained syn match swayConfigGapStyle /^\s*\(gaps\)\s\+\(inner\|outer\|horizontal\|vertical\|left\|top\|right\|bottom\)\(\s\+\(current\|all\)\)\?\(\s\+\(set\|plus\|minus\|toggle\)\)\?\(\s\+\(-\?\d\+\|\$.*\)\)$/ contains=swayConfigGapStyleKeyword,swayConfigNumber,swayConfigVariable -syn keyword swayConfigSmartGapKeyword on inverse_outer contained -syn match swayConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\)\s\?$/ contains=swayConfigSmartGapKeyword -syn keyword swayConfigSmartBorderKeyword on no_gaps contained -syn match swayConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\)\s\?$/ contains=swayConfigSmartBorderKeyword +syn keyword swayConfigSmartGapKeyword on inverse_outer off contained +syn match swayConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\|off\)\s\?$/ contains=swayConfigSmartGapKeyword +syn keyword swayConfigSmartBorderKeyword on no_gaps off contained +syn match swayConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\|off\)\s\?$/ contains=swayConfigSmartBorderKeyword " Keyboard bindings syn keyword swayConfigAction toggle fullscreen restart key import kill shrink grow contained syn keyword swayConfigAction focus move grow height width split layout resize restore reload mute unmute exit mode workspace container to output contained syn match swayConfigModifier /\w\++\w\+\(\(+\w\+\)\+\)\?/ contained contains=swayConfigVariableModifier -syn match swayConfigNumber /\s\d\+/ contained +syn match swayConfigNumber /\s[+-]\?\(\d\+\.\)\?\d\+/ contained syn match swayConfigUnit /\sp\(pt\|x\)/ contained syn match swayConfigUnitOr /\sor/ contained -syn keyword swayConfigBindKeyword bindsym bindcode exec gaps border contained +syn keyword swayConfigBindKeyword bindsym bindcode bindswitch bindgesture exec gaps border contained syn match swayConfigBindArgument /--\w\+\(\(-\w\+\)\+\)\?\s/ contained -syn match swayConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=swayConfigVariable,swayConfigBindKeyword,swayConfigVariableAndModifier,swayConfigNumber,swayConfigUnit,swayConfigUnitOr,swayConfigBindArgument,swayConfigModifier,swayConfigAction,swayConfigString,swayConfigGapStyleKeyword,swayConfigBorderStyleKeyword +syn match swayConfigBind /^\s*\(bindsym\|bindcode\|bindswitch\)\s\+.*$/ contains=swayConfigVariable,swayConfigBindKeyword,swayConfigVariableAndModifier,swayConfigNumber,swayConfigUnit,swayConfigUnitOr,swayConfigBindArgument,swayConfigModifier,swayConfigAction,swayConfigString,swayConfigGapStyleKeyword,swayConfigBorderStyleKeyword + +" bindgestures +syn keyword swayConfigBindGestureCommand swipe pinch hold contained +syn keyword swayConfigBindGestureDirection up down left right next prev contained +syn keyword swayConfigBindGesturePinchDirection inward outward clockwise counterclockwise contained +syn match swayConfigBindGestureHold /^\s*\(bindgesture\)\s\+hold\(:[1-5]\)\?\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,swayConfigWorkspaceKeyword,swayConfigAction +syn match swayConfigBindGestureSwipe /^\s*\(bindgesture\)\s\+swipe\(:[3-5]\)\?:\(up\|down\|left\|right\)\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,swayConfigWorkspaceKeyword,swayConfigAction +syn match swayConfigBindGesturePinch /^\s*\(bindgesture\)\s\+pinch\(:[2-5]\)\?:\(up\|down\|left\|right\|inward\|outward\|clockwise\|counterclockwise\)\(+\(up\|down\|left\|right\|inward\|outward\|clockwise\|counterclockwise\)\)\?.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,swayConfigBindGesturePinchDirection,swayConfigWorkspaceKeyword,swayConfigAction " Floating +syn keyword swayConfigFloatingKeyword floating contained +syn match swayConfigFloating /^\s*floating\s\+\(enable\|disable\|toggle\)\s*$/ contains=swayConfigFloatingKeyword + syn keyword swayConfigFloatingModifier floating_modifier contained -syn match swayConfigFloatingMouseAction /^\s\?.*floating_modifier\s.*\(normal\|inverted\)$/ contains=swayConfigFloatingModifier,swayConfigVariable +syn match swayConfigFloatingMouseAction /^\s\?.*floating_modifier\s\S\+\s\?\(normal\|inverted\|none\)\?$/ contains=swayConfigFloatingModifier,swayConfigVariable syn keyword swayConfigSizeSpecial x contained syn match swayConfigNegativeSize /-/ contained syn match swayConfigSize /-\?\d\+\s\?x\s\?-\?\d\+/ contained contains=swayConfigSizeSpecial,swayConfigNumber,swayConfigNegativeSize -syn match swayConfigFloating /^\s*floating_\(maximum\|minimum\)_size\s\+-\?\d\+\s\?x\s\?-\?\d\+/ contains=swayConfigSize +syn match swayConfigFloatingSize /^\s*floating_\(maximum\|minimum\)_size\s\+-\?\d\+\s\?x\s\?-\?\d\+/ contains=swayConfigSize " Orientation syn keyword swayConfigOrientationKeyword vertical horizontal auto contained @@ -125,6 +136,10 @@ syn keyword swayConfigExecKeyword exec exec_always contained syn match swayConfigNoStartupId /--no-startup-id/ contained " We are not using swayConfigBindArgument as only no-startup-id is supported here syn match swayConfigExec /^\s*exec\(_always\)\?\s\+.*$/ contains=swayConfigExecKeyword,swayConfigNoStartupId,swayConfigString +" Input config +syn keyword swayConfigInputKeyword input contained +syn match swayConfigInput /^\s*input\s\+.*$/ contains=swayConfigInputKeyword + " Automatically putting workspaces on specific screens syn keyword swayConfigWorkspaceKeyword workspace contained syn keyword swayConfigOutputKeyword output contained @@ -139,8 +154,9 @@ syn keyword swayConfigFocusType output contained syn match swayConfigFocus /^\s*focus\soutput\s.*$/ contains=swayConfigFocusKeyword,swayConfigFocusType " Changing colors -syn keyword swayConfigClientColorKeyword client focused focused_inactive unfocused urgent placeholder background contained -syn match swayConfigClientColor /^\s*client.\w\+\s\+.*$/ contains=swayConfigClientColorKeyword,swayConfigColor,swayConfigVariable +syn keyword swayConfigClientKeyword client contained +syn keyword swayConfigClientColorKeyword focused focused_inactive focused_tab_title unfocused urgent placeholder contained +syn match swayConfigClientColor /^\s*client.\w\+\s\+.*$/ contains=swayConfigClientKeyword,swayConfigClientColorKeyword,swayConfigColor,swayConfigVariable syn keyword swayConfigTitleAlignKeyword left center right contained syn match swayConfigTitleAlign /^\s*title_align\s\+.*$/ contains=swayConfigTitleAlignKeyword @@ -156,8 +172,8 @@ syn match swayConfigMouseWarping /^\s*mouse_warping\s\+\(output\|none\)\s\?$/ co " Focus follows mouse syn keyword swayConfigFocusFollowsMouseKeyword focus_follows_mouse contained -syn keyword swayConfigFocusFollowsMouseType yes no contained -syn match swayConfigFocusFollowsMouse /^\s*focus_follows_mouse\s\+\(yes\|no\)\s\?$/ contains=swayConfigFocusFollowsMouseKeyword,swayConfigFocusFollowsMouseType +syn keyword swayConfigFocusFollowsMouseType yes no always contained +syn match swayConfigFocusFollowsMouse /^\s*focus_follows_mouse\s\+\(yes\|no\|always\)\s\?$/ contains=swayConfigFocusFollowsMouseKeyword,swayConfigFocusFollowsMouseType " Popups during fullscreen mode syn keyword swayConfigPopupOnFullscreenKeyword popup_during_fullscreen contained @@ -192,15 +208,15 @@ syn keyword swayConfigDrawingMarksKeyword show_marks contained syn match swayConfigDrawingMarks /^\s*show_marks\s\+\(yes\|no\)\s\?$/ contains=swayConfigFocusWrappingType,swayConfigDrawingMarksKeyword " Group mode/bar -syn keyword swayConfigBlockKeyword set input mode bar colors i3bar_command status_command position exec mode hidden_state modifier id position output background statusline tray_output tray_padding separator separator_symbol workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained -syn region swayConfigBlock start=+.*s\?{$+ end=+^}$+ contains=swayConfigBlockKeyword,swayConfigString,swayConfigBind,swayConfigComment,swayConfigFont,swayConfigFocusWrappingType,swayConfigColor,swayConfigVariable transparent keepend extend +syn keyword swayConfigBlockKeyword set bar colors i3bar_command status_command position hidden_state modifier id position background statusline tray_output tray_padding separator separator_symbol workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained +syn region swayConfigBlock start=+.*s\?{$+ end=+^}$+ contains=swayConfigBlockKeyword,swayConfigString,swayConfigAction,swayConfigBind,swayConfigComment,swayConfigFont,swayConfigFocusWrappingType,swayConfigColor,swayConfigVariable,swayConfigInputKeyword,swayConfigOutputKeyword transparent keepend extend " Line continuation -syn region swayConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=swayConfigBlockKeyword,swayConfigString,swayConfigBind,swayConfigComment,swayConfigFont,swayConfigFocusWrappingType,swayConfigColor,swayConfigVariable transparent keepend extend +syn region swayConfigLineCont start=/^.*\\$/ end=/^[^\\]*$/ contains=swayConfigBlockKeyword,swayConfigString,swayConfigAction,swayConfigBind,swayConfigComment,swayConfigFont,swayConfigFocusWrappingType,swayConfigColor,swayConfigVariable,swayConfigExecKeyword transparent keepend extend " Includes with relative paths to config files syn keyword swayConfigInclude include contained -syn match swayConfigFile /^include\s\(\~\?\/.*$\|\.\{0,2}\/.*$\)/ contains=swayConfigInclude +syn match swayConfigFile /^\s\?include\s\+.*$/ contains=swayConfigInclude " xwayland syn keyword swayConfigXwaylandKeyword xwayland contained @@ -227,9 +243,14 @@ hi! def link swayConfigEdgeKeyword Type hi! def link swayConfigAction Type hi! def link swayConfigCommand Type hi! def link swayConfigOutputKeyword Type +hi! def link swayConfigInputKeyword Type hi! def link swayConfigWindowCommandSpecial Type hi! def link swayConfigFocusWrappingType Type hi! def link swayConfigUnitOr Type +hi! def link swayConfigClientColorKeyword Type +hi! def link swayConfigFloating Type +hi! def link swayConfigBindGestureDirection Constant +hi! def link swayConfigBindGesturePinchDirection Constant hi! def link swayConfigFontSize Constant hi! def link swayConfigColor Constant hi! def link swayConfigNumber Constant @@ -247,8 +268,10 @@ hi! def link swayConfigAssignSpecial Special hi! def link swayConfigFontNamespace PreProc hi! def link swayConfigBindArgument PreProc hi! def link swayConfigNoStartupId PreProc +hi! def link swayConfigBindGesture PreProc hi! def link swayConfigFontKeyword Identifier hi! def link swayConfigBindKeyword Identifier +hi! def link swayConfigBindGestureCommand Identifier hi! def link swayConfigOrientation Identifier hi! def link swayConfigGapStyle Identifier hi! def link swayConfigTitleAlign Identifier @@ -257,7 +280,7 @@ hi! def link swayConfigSmartBorder Identifier hi! def link swayConfigLayout Identifier hi! def link swayConfigBorderStyle Identifier hi! def link swayConfigEdge Identifier -hi! def link swayConfigFloating Identifier +hi! def link swayConfigFloatingSize Identifier hi! def link swayConfigCommandKeyword Identifier hi! def link swayConfigNoFocusKeyword Identifier hi! def link swayConfigInitializeKeyword Identifier @@ -265,7 +288,7 @@ hi! def link swayConfigAssignKeyword Identifier hi! def link swayConfigResourceKeyword Identifier hi! def link swayConfigExecKeyword Identifier hi! def link swayConfigWorkspaceKeyword Identifier -hi! def link swayConfigClientColorKeyword Identifier +hi! def link swayConfigClientKeyword Identifier hi! def link swayConfigInterprocessKeyword Identifier hi! def link swayConfigMouseWarpingKeyword Identifier hi! def link swayConfigFocusFollowsMouseKeyword Identifier @@ -281,6 +304,7 @@ hi! def link swayConfigVariable Statement hi! def link swayConfigArbitraryCommand Type hi! def link swayConfigInclude Identifier hi! def link swayConfigFile Constant +hi! def link swayConfigFloatingKeyword Identifier hi! def link swayConfigFloatingModifier Identifier hi! def link swayConfigFloatingMouseAction Type hi! def link swayConfigFocusKeyword Type diff --git a/syntax/swift.vim b/syntax/swift.vim index 2dcb0376..90035eac 100644 --- a/syntax/swift.vim +++ b/syntax/swift.vim @@ -192,6 +192,7 @@ syntax match swiftMultiwordKeywords "indirect enum" syntax region swiftEscapedReservedWord start="`" end="`" oneline syntax keyword swiftAttributes + \ @_disfavoredOverload \ @_exported \ @_implementationOnly \ @_silgen_name diff --git a/syntax/tmux.vim b/syntax/tmux.vim index f73e8e49..f3917e70 100644 --- a/syntax/tmux.vim +++ b/syntax/tmux.vim @@ -3,7 +3,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'tmux', 'syntax/tmux.vim') endif " Language: tmux(1) configuration file -" Version: 3.3-rc (git-8bcd392e) +" Version: 3.3a (git-7b8ececd) " URL: https://github.com/ericpruitt/tmux.vim/ " Maintainer: Eric Pruitt <eric.pruitt@gmail.com> " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) @@ -165,7 +165,7 @@ syn keyword tmuxCommands \ switch-client switchc unbind unbind-key unlink-window unlinkw wait wait-for syn keyword tmuxEnums -\ absolute-centre always any arrows bar blinking-bar blinking-block +\ absolute-centre all always any arrows bar blinking-bar blinking-block \ blinking-underline block both bottom centre color colour current default \ double emacs external failed heavy largest latest left manual no-detached \ none number off on other padded right rounded simple single smallest top |