From eda351ca897ca0270ed8b01798af3679914683a1 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 10 Mar 2021 17:22:05 +0100 Subject: Update --- syntax/gomod.vim | 18 +++++++- syntax/javascript.vim | 2 +- syntax/julia.vim | 79 +++++++++++++++++++++----------- syntax/kotlin.vim | 4 +- syntax/llvm.vim | 3 +- syntax/mlir.vim | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++ syntax/svelte.vim | 4 +- 7 files changed, 200 insertions(+), 32 deletions(-) create mode 100644 syntax/mlir.vim (limited to 'syntax') diff --git a/syntax/gomod.vim b/syntax/gomod.vim index 0de3d9d9..4f120ffd 100644 --- a/syntax/gomod.vim +++ b/syntax/gomod.vim @@ -11,17 +11,22 @@ endif syntax case match +" Reference documentation: +" https://golang.org/ref/mod#go-mod-file-grammar + " match keywords syntax keyword gomodModule module syntax keyword gomodGo go contained syntax keyword gomodRequire require syntax keyword gomodExclude exclude syntax keyword gomodReplace replace +syntax keyword gomodRetract retract " require, exclude, replace, and go can be also grouped into block syntax region gomodRequire start='require (' end=')' transparent contains=gomodRequire,gomodVersion syntax region gomodExclude start='exclude (' end=')' transparent contains=gomodExclude,gomodVersion syntax region gomodReplace start='replace (' end=')' transparent contains=gomodReplace,gomodVersion +syntax region gomodRetract start='retract (' end=')' transparent contains=gomodVersionRange,gomodVersion syntax match gomodGo '^go .*$' transparent contains=gomodGo,gomodGoVersion " set highlights @@ -30,6 +35,7 @@ highlight default link gomodGo Keyword highlight default link gomodRequire Keyword highlight default link gomodExclude Keyword highlight default link gomodReplace Keyword +highlight default link gomodRetract Keyword " comments are always in form of // ... syntax region gomodComment start="//" end="$" contains=@Spell @@ -47,7 +53,6 @@ highlight default link gomodReplaceOperator Operator syntax match gomodGoVersion "1\.\d\+" contained highlight default link gomodGoVersion Identifier - " highlight versions: " * vX.Y.Z-pre " * vX.Y.Z @@ -93,4 +98,15 @@ syntax match gomodVersion "v[2-9]\{1}\d*\.\d\+\.\d\+\%(+\%([0-9A-Za-z-]\+\)\%(\. " ^------- version -------^^---------------- metadata ---------------------^ highlight default link gomodVersion Identifier +" match go version ranges in retract directive +" https://golang.org/ref/mod#go-mod-file-retract +syntax region gomodVersionRange start="\[" end="\]" transparent matchgroup=gomodVersionRangeBracket contains=gomodVersion,gomodVersionRangeSeparator +highlight default link gomodVersionRange Operator +syntax match gomodVersionRangeBracket "\[" contained +syntax match gomodVersionRangeBracket "\]" contained +highlight default link gomodVersionRangeBracket Operator +syntax match gomodVersionRangeSeparator "," contained +highlight default link gomodVersionRangeSeparator Operator + + let b:current_syntax = "gomod" diff --git a/syntax/javascript.vim b/syntax/javascript.vim index dbd1c4ed..615862dc 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -108,7 +108,7 @@ syntax keyword jsDo do skipwhite skipempty next 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 syntax keyword jsFinally contained finally skipwhite skipempty nextgroup=jsFinallyBlock -syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch +syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch,jsTryCatchBlock syntax keyword jsException throw syntax keyword jsAsyncKeyword async await syntax match jsSwitchColon contained /::\@!/ skipwhite skipempty nextgroup=jsSwitchBlock diff --git a/syntax/julia.vim b/syntax/julia.vim index 5d9a7ae1..1a08f62d 100644 --- a/syntax/julia.vim +++ b/syntax/julia.vim @@ -36,11 +36,11 @@ let s:julia_highlight_operators = get(g:, "julia_highlight_operators", 1) " characters which cannot be used in identifiers. This list is very incomplete: " 1) it only cares about charactes below 256 " 2) it doesn't distinguish between what's allowed as the 1st char vs in the -" rest of an identifier (e.g. digits, `!` and `?`) +" rest of an identifier (e.g. digits and `!`) " Despite these shortcomings, it seems to do a decent job. " note: \U5B and \U5D are '[' and ']' let s:nonid_chars = "\U01-\U07" . "\U0E-\U1F" . - \ "\"#$'(,.:;=@`\\U5B{" . + \ "?\"#$'(,.:;=@`\\U5B{" . \ "\U80-\UA1" . "\UA7\UA8\UAB\UAD\UAF\UB4" . "\UB6-\UB8" . "\UBB\UBF" let s:nonidS_chars = "[:space:])\\U5D}" . s:nonid_chars @@ -64,7 +64,7 @@ let s:binop_chars = "=+\\U2D*/\\%÷^&|⊻<>≤≥≡≠≢∈∉⋅×∪∩⊆ let s:binop_chars_extra = "\\U214B\\U2190-\\U2194\\U219A\\U219B\\U21A0\\U21A3\\U21A6\\U21AE\\U21CE\\U21CF\\U21D2\\U21D4\\U21F4-\\U21FF\\U2208-\\U220D\\U2213\\U2214\\U2217-\\U2219\\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-\\U22ED\\U22F2-\\U22FF\\U25B7\\U27C8\\U27C9\\U27D1\\U27D2\\U27D5-\\U27D7\\U27F0\\U27F1\\U27F5-\\U27F7\\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\\U2A22-\\U2A2E\\U2A30-\\U2A3D\\U2A40-\\U2A45\\U2A4A-\\U2A58\\U2A5A-\\U2A63\\U2A66\\U2A67\\U2A6A-\\U2AD9\\U2ADB\\U2AF7-\\U2AFA\\U2B30-\\U2B44\\U2B47-\\U2B4C\\UFFE9-\\UFFEC" " a Julia identifier, sort of -let s:idregex = '\%([^' . s:nonidS_chars . '0-9!?' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*\)' +let s:idregex = '\%([^' . s:nonidS_chars . '0-9!' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*\)' let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' . \ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|>:\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' . @@ -74,11 +74,11 @@ let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' . syn case match -syntax cluster juliaExpressions contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems +syntax cluster juliaExpressions contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems,@juliaSyntaxRegions syntax cluster juliaExprsPrintf contains=@juliaExpressions,@juliaPrintfItems syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraIdxBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar -syntax cluster juliaKeywordItems contains=juliaKeyword,juliaImportLine,juliaInfixKeyword,juliaRepKeyword +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 @@ -93,6 +93,8 @@ syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juli syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM syntax cluster juliaErrorItems contains=juliaErrorPar,juliaErrorEnd,juliaErrorElse,juliaErrorCatch,juliaErrorFinally +syntax cluster juliaSyntaxRegions contains=juliaParamTypeR,juliaFunctionCallR,juliaTypeOperatorR,juliaWhereR + syntax cluster juliaSpellcheckStrings contains=@spell syntax cluster juliaSpellcheckDocStrings contains=@spell syntax cluster juliaSpellcheckComments contains=@spell @@ -126,9 +128,21 @@ syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contain syntax region juliaParBlockInRange matchgroup=juliaParDelim contained start="(" end=")" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeKeyword,juliaComprehensionFor syntax region juliaSqBraIdxBlock matchgroup=juliaParDelim start="\[" end="\]" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeKeyword,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS exec 'syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\%(^\|\s\|' . s:operators . '\)\@'.s:d(3).'<=\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS' -syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions +syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=juliaType,@juliaExpressions + +exec 'syntax match juliaType contained "' . s:idregex . '\%(\.' . s:idregex . '\)*"' + +exec 'syntax region juliaFunctionCallR transparent start="' . s:idregex . '\%(\.' . s:idregex . '\)*\s*(" end=")\@'.s:d(1).'<=" contains=juliaFunctionCall,juliaParBlock' +exec 'syntax match juliaFunctionCall contained "\%(' . s:idregex . '\.\)*\zs' . s:idregex . '"' + +" note: we would in principle add a "s:nodot" before function/macro/struct/... but it shouldn't come up in valid code +exec 'syntax match juliaFunctionDef contained transparent "\%(\<\%(function\|macro\)\s\+\)\@'.s:d(20).'<=' . s:idregex . '\%(\.' . s:idregex . '\)*\ze\s\+\%(end\>\|$\)" contains=juliaFunctionName' +exec 'syntax region juliaFunctionDefP contained transparent start="\%(\<\%(function\|macro\)\s\+\)\@'.s:d(20).'<=' . s:idregex . '\%(\.' . s:idregex . '\)*\s*(" end=")\@'.s:d(1).'<=" contains=juliaFunctionName,juliaParBlock' +exec 'syntax match juliaFunctionName contained "\%(\<\%(function\|macro\)\s\+\)\@'.s:d(20).'<=\%(' . s:idregex . '\.\)*\zs' . s:idregex . '"' + +exec 'syntax match juliaStructR contained transparent "\%(\<\%(\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\)\s\+\)\@'.s:d(20).'<=\%(' . s:idregex . '\.\)*' . s:idregex . '\>\(\s*(\)\@!" contains=juliaType' -exec 'syntax match juliaKeyword display "'.s:nodot.'\<\%(return\|local\|global\|const\|where\)\>"' +exec 'syntax match juliaKeyword display "'.s:nodot.'\<\%(return\|local\|global\|const\)\>"' syntax match juliaInfixKeyword display "\%(=\s*\)\@\S\@!\%(\s*=\)\@!" " The import/export/using keywords introduce a sort of special parsing @@ -144,26 +158,25 @@ exec 'syntax region juliaWhileBlock matchgroup=juliaRepeat start="'.s:nodot.'\ exec 'syntax region juliaForBlock matchgroup=juliaRepeat start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions,juliaOuter fold' exec 'syntax region juliaBeginBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions fold' exec 'syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions,juliaFunctionDef,juliaFunctionDefP fold' -exec 'syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions fold' +exec 'syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions,juliaFunctionDef,juliaFunctionDefP fold' exec 'syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions fold' -exec 'syntax region juliaStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions fold' -exec 'syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions fold' +exec 'syntax region juliaStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions,juliaStructR fold' +exec 'syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions,juliaStructR fold' exec 'syntax region juliaLetBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions fold' exec 'syntax region juliaDoBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions fold' exec 'syntax region juliaModuleBlock matchgroup=juliaBlKeyword start="\%(\%(\.\s*\)\@'.s:d(6).'" end="\" contains=@juliaExpressions fold' exec 'syntax region juliaExceptionBlock matchgroup=juliaException start="'.s:nodot.'\" end="'.s:nodot.'\" contains=@juliaExpressions,juliaCatchBlock,juliaFinallyBlock fold' exec 'syntax region juliaCatchBlock matchgroup=juliaException transparent contained start="'.s:nodot.'\" end="'.s:nodot.'\"me=s-1 contains=@juliaExpressions,juliaFinallyBlock' -exec 'syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="'.s:nodot.'\" end="'.s:nodot.'\"me=s-1 contains=@juliaExpressions' -" AbstractBlock needs to come after to take precedence -exec 'syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" fold contains=@juliaExpressions' -exec 'syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" fold contains=@juliaExpressions' +exec 'syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="'.s:nodot.'\" end="'.s:nodot.'\"me=s-1 contains=@juliaExpressions' +exec 'syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" fold contains=@juliaExpressions,juliaStructR' +exec 'syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\" end="'.s:nodot.'\" fold contains=@juliaExpressions,juliaStructR' exec 'syntax region juliaComprehensionFor matchgroup=juliaComprehensionFor transparent contained start="\%([^[:space:],;:({[]\_s*\)\@'.s:d(80).'<=\" end="\ze[]);]" contains=@juliaExpressions,juliaComprehensionIf,juliaComprehensionFor' exec 'syntax match juliaComprehensionIf contained "'.s:nodot.'\"' exec 'syntax match juliaOuter contained "\"' -syntax match juliaRangeKeyword display contained "\<\%(begin\|end\)\>" +syntax match juliaRangeKeyword contained "\<\%(begin\|end\)\>" syntax match juliaBaseTypeBasic display "\<\%(\%(N\|Named\)\?Tuple\|Symbol\|Function\|Union\%(All\)\?\|Type\%(Name\|Var\)\?\|Any\|ANY\|Vararg\|Ptr\|Exception\|Module\|Expr\|DataType\|\%(LineNumber\|Quote\)Node\|\%(Weak\|Global\)\?Ref\|Method\|Pair\|Val\|Nothing\|Some\|Missing\)\>" syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|\%(Abstract\)\?Irrational\|Enum\|BigInt\|BigFloat\|MathConst\|ComplexF\%(16\|32\|64\)\)\>" @@ -201,11 +214,9 @@ syntax match juliaConstIO display "\<\%(std\%(out\|in\|err\)\|devnull\)\>" syntax match juliaConstC display "\<\%(C_NULL\)\>" syntax match juliaConstGeneric display "\<\%(nothing\|Main\|undef\|missing\)\>" -exec 'syntax match juliaFunctionDef contained transparent "\%(\\|$\)" contains=juliaFunctionName' -exec 'syntax region juliaFunctionDefP contained transparent start="\%(\+-]\ze[^0-9]" @@ -253,11 +264,11 @@ exec 'syntax match juliaNumber contained "' . s:int_regex . '" contains=juliaC exec 'syntax match juliaFloat contained "' . s:float_regex . '" contains=juliaComplexUnit' syntax match juliaComplexUnit display contained "\" -exec 'syntax match juliaOperator "' . s:operators . '"' syntax match juliaRangeOperator display ":" +exec 'syntax match juliaOperator "' . s:operators . '"' exec 'syntax region juliaTernaryRegion matchgroup=juliaTernaryOperator start="\s\zs?\ze\s" skip="\%(:\(:\|[^:[:space:]'."'".'"({[]\+\s*\ze:\)\|\%(?\s*\)\@'.s:d(6).'<=:(\)" end=":" contains=@juliaExpressions,juliaErrorSemicol' -let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!?]\|^\)\@'.s:d(1).'<=\$' +let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!]\|^\)\@'.s:d(1).'<=\$' exec 'syntax match juliaDollarVar display contained "' . s:interp_dollar . s:idregex . '"' exec 'syntax region juliaDollarPar matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '(" end=")" contains=@juliaExpressions' @@ -269,7 +280,7 @@ syntax match juliaChar display "'\\x\x\{2\}'" contains=juliaHexEscapeChar syntax match juliaChar display "'\\u\x\{1,4\}'" contains=juliaUniCharSmall syntax match juliaChar display "'\\U\x\{1,8\}'" contains=juliaUniCharLarge -exec 'syntax match juliaCTransOperator "[[:space:]}' . s:nonid_chars . s:uniop_chars . s:binop_chars . '!?]\@'.s:d(1).':]:\s*\%(' . s:idregex . '\.\)*' . s:idregex . '" contains=juliaTypeOperator,juliaType,@juliaExpressions' +exec 'syntax match juliaTypeOperatorR transparent "' . s:idregex . '\%(\.' . s:idregex . '\)*\s*[<>]:\s*\%(\%(' . s:idregex . '\.\)*' . s:idregex . '\)\?" contains=juliaTypeOperator,juliaType,@juliaExpressions' +exec 'syntax match juliaTypeOperatorR transparent "\]:" +syntax match juliaIsaKeyword contained "\" + +syntax match juliaWhereKeyword "\" +exec 'syntax match juliaWhereR transparent "\/ @@ -207,6 +207,7 @@ syn match llvmConstant /\/ syn match llvmSpecialComment /;\s*PR\d*\s*$/ 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*XFAIL:.*$/ diff --git a/syntax/mlir.vim b/syntax/mlir.vim new file mode 100644 index 00000000..9bfd7f35 --- /dev/null +++ b/syntax/mlir.vim @@ -0,0 +1,122 @@ +if polyglot#init#is_disabled(expand(':p'), 'llvm', 'syntax/mlir.vim') + finish +endif + +" Vim syntax file +" Language: mlir +" Maintainer: The MLIR team, http://github.com/tensorflow/mlir/ +" Version: $Revision$ +" Some parts adapted from the LLVM vim syntax file. + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case match + +" Types. +syn keyword mlirType index f16 f32 f64 +" Integer type. +syn match mlirType /\/ + +" Elemental types inside memref, tensor, or vector types. +syn match mlirType /x\s*\zs\(f16\|f32\|f64\|i\d\+\)/ + +" Shaped types. +syn match mlirType /\/ +syn match mlirType /\/ +syn match mlirType /\/ + +" vector types inside memref or tensor. +syn match mlirType /x\s*\zsvector/ + +" Operations. +" Core ops (not exhaustive yet). +" TODO: the list is not exhaustive. +syn keyword mlirOps alloc alloca addf addi call call_indirect cmpf cmpi constant +syn keyword mlirOps dealloc divf dma_start dma_wait dim extract_element +syn keyword mlirOps getTensor index_cast load memref_cast memref_shape_cast +syn keyword mlirOps mulf muli negf prefetch sitofp splat store select subf subi +syn keyword mlirOps subview tensor_cast view + +" Affine ops. +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ +syn match mlirOps /\/ + +" TODO: dialect name prefixed ops (llvm or std). + +" Keywords. +syn keyword mlirKeyword + \ affine_map + \ affine_set + \ dense + \ else + \ func + \ module + \ return + \ step + \ to + +" Misc syntax. + +syn match mlirNumber /-\?\<\d\+\>/ +" Match numbers even in shaped types. +syn match mlirNumber /-\?\<\d\+\ze\s*x/ +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 /\/\/.*$/ +syn region mlirString start=/"/ skip=/\\"/ end=/"/ +syn match mlirLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/ +syn match mlirIdentifier /[%@][a-zA-Z$._-][a-zA-Z0-9$._-]*/ +syn match mlirIdentifier /[%@!]\d\+\>/ +syn match mlirMapSetOutline "#.*$" + +" Syntax-highlight lit test commands and bug numbers. +syn match mlirSpecialComment /\/\/\s*RUN:.*$/ +syn match mlirSpecialComment /\/\/\s*CHECK:.*$/ +syn match mlirSpecialComment "\v\/\/\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL):.*$" +syn match mlirSpecialComment /\/\/\s*expected-error.*$/ +syn match mlirSpecialComment /\/\/\s*expected-remark.*$/ +syn match mlirSpecialComment /;\s*XFAIL:.*$/ +syn match mlirSpecialComment /\/\/\s*PR\d*\s*$/ +syn match mlirSpecialComment /\/\/\s*REQUIRES:.*$/ + +if version >= 508 || !exists("did_c_syn_inits") + if version < 508 + let did_c_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink mlirType Type + HiLink mlirOps Statement + HiLink mlirMapSetOutline PreProc + HiLink mlirNumber Number + HiLink mlirComment Comment + HiLink mlirString String + HiLink mlirLabel Label + HiLink mlirKeyword Keyword + HiLink mlirBoolean Boolean + HiLink mlirFloat Float + HiLink mlirConstant Constant + HiLink mlirSpecialComment SpecialComment + HiLink mlirIdentifier Identifier + + delcommand HiLink +endif + +let b:current_syntax = "mlir" diff --git a/syntax/svelte.vim b/syntax/svelte.vim index ce454db0..d872826c 100644 --- a/syntax/svelte.vim +++ b/syntax/svelte.vim @@ -35,8 +35,6 @@ syntax keyword svelteKeyword slot contained containedin=htmlTag " https://github.com/mxw/vim-jsx/blob/master/after/syntax/jsx.vim syntax region svelteExpression start="{" end="" contains=jsBlock,javascriptBlock containedin=htmlString,htmlTag,htmlArg,htmlValue,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,htmlHead,htmlTitle,htmlBoldItalicUnderline,htmlUnderlineBold,htmlUnderlineItalicBold,htmlUnderlineBoldItalic,htmlItalicUnderline,htmlItalicBold,htmlItalicBoldUnderline,htmlItalicUnderlineBold,htmlLink,htmlLeadingSpace,htmlBold,htmlBoldUnderline,htmlBoldItalic,htmlBoldUnderlineItalic,htmlUnderline,htmlUnderlineItalic,htmlItalic,htmlStrike,javaScript -syntax region svelteSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent - " Block conditionals. syntax match svelteConditional "#if" contained containedin=jsBlock,javascriptBlock syntax match svelteConditional "/if" contained containedin=jsBlock,javascriptBlock @@ -117,6 +115,8 @@ for s:language in s:languages endif endfor +syntax region svelteSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent + " Cybernetically enhanced web apps. let b:current_syntax = "svelte" -- cgit v1.2.3