vim-tomo/syntax/sss.vim

179 lines
6.9 KiB
VimL
Raw Normal View History

2023-04-30 18:45:06 -07:00
" Language: SSS
" Maintainer: Bruce Hill <bruce@bruce-hill.com>
" License: WTFPL
" Bail if our syntax is already loaded.
if exists('b:current_syntax') && b:current_syntax == 'sss'
finish
endif
syn match SSSErrorWord /\i*/ contained
hi def link SSSErrorWord Error
2023-04-30 18:45:06 -07:00
syn match SSSVar /[a-zA-Z_][a-zA-Z_0-9]*/
syn match SSSNumber /0x[0-9a-fA-F_]\+%\?\|[0-9][0-9_]*\(\.\([0-9][0-9_]*\|\.\@!\)\)\?\(e[0-9_]\+\)\?%\?\|\.\@<!\.[0-9][0-9_]*\(e[0-9_]\+\)\?%\?/
hi def link SSSNumber Number
syn match SSSChar /`./
hi def link SSSChar String
2024-11-25 22:01:01 -08:00
syn region SSSString start=/".\@=/ end=/"\|$/ contains=SSSStringInterp
2023-04-30 18:45:06 -07:00
syn region SSSString start=/'.\@=/ end=/'\|$/
2024-11-25 22:01:01 -08:00
syn region SSSString start=/`.\@=/ end=/`\|$/ contains=SSSStringInterp
syn region SSSString start=/".\@!\%(^\z(\s*\).*\)\@<=/ end=/^\z1"\|^\%(\z1\s\)\@!\s*\S\@=/ contains=SSSStringInterp
2023-04-30 18:45:06 -07:00
syn region SSSString start=/'.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\z1'\|^\%(\z1\s\)\@!\s*\S\@=/he=s-1
2024-11-25 22:01:01 -08:00
syn region SSSString start=/`.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\z1`\|^\%(\z1\s\)\@!\s*\S\@=/he=s-1
2023-04-30 18:45:06 -07:00
hi def link SSSString String
2024-11-25 22:01:01 -08:00
syn region SSSPath start=;(\(\~/\|./\|../\|/\); skip=/\\.\|([^)]*)/ end=;$\|); contains=SSSStringInterp,SSSEscape
hi def link SSSPath String
syn region SSSDSLString start=/\z(["'`|/;([{<]\).\@=/hs=e end=/\z1/ contains=SSSStringInterp contained
syn region SSSDSLString start=/\z(["'`|/;([{<]\).\@!\%(^\z(\s*\).*\)\@<=/hs=e end=/^\z2\z1/he=e contains=SSSStringInterp contained
syn region SSSDSLString start=/\[/hs=e+1 end=/]/he=s-1 contains=SSSStringInterp contained
2023-04-30 18:45:06 -07:00
syn region SSSDSLString start=/{/hs=e+1 end=/}/he=s-1 contained
2024-11-25 22:01:01 -08:00
syn region SSSDSLString start=/</hs=e+1 end=/>/he=s-1 contains= contained
2023-04-30 18:45:06 -07:00
syn region SSSDSLString start=/(/hs=e+1 end=/)/he=s-1 contains=SSSStringInterp contained
hi def link SSSDSLString String
2024-11-25 22:01:01 -08:00
syn match SSSArray /\[/ nextgroup=SSSTypeAnnotation
syn match SSSTable /{/ nextgroup=SSSTypeAnnotation
2023-06-05 10:48:19 -07:00
syn match SSSDocTest /^\s*>>>/
syn region SSSDocTest start=/^\s*===/ end=/$/
hi SSSDocTest ctermfg=gray
2023-04-30 18:45:06 -07:00
syn match SSSDocError /!!!.*/
hi SSSDocError ctermfg=red cterm=italic
2024-11-25 22:01:01 -08:00
syn match SSSDSL /\$\w*/ nextgroup=SSSString,SSSCustomStringInterp
2023-04-30 18:45:06 -07:00
hi def link SSSDSL String
hi SSSDSL ctermfg=white cterm=bold
2024-11-25 22:01:01 -08:00
syn match SSSCustomStringInterp /[~!@#$%^&*+=\?]\?/ contained nextgroup=SSSDSLString
hi SSSCustomStringInterp ctermfg=gray
2023-04-30 18:45:06 -07:00
syn match SSSStringDollar /\$:\?/ contained
hi SSSStringDollar ctermfg=LightBlue
syn match SSSStringAt /@/ contained
hi SSSStringAt ctermfg=LightBlue
2024-11-25 22:01:01 -08:00
syn match SSSStringInterpWord /[a-zA-Z_][a-zA-Z_0-9]*/ contained
2023-04-30 18:45:06 -07:00
hi SSSStringInterpWord ctermfg=LightBlue
2023-06-11 11:36:59 -07:00
syn match SSSStringInterp /\$:\?/ contained nextgroup=SSSStringDollar,SSSStringInterpWord,SSSParenGroup,@SSSAll
2023-04-30 18:45:06 -07:00
hi SSSStringInterp ctermfg=LightBlue
syn match SSSEscape /\\\([abenrtvN]\|x\x\x\|\d\{3}\)\(-\([abnrtv]\|x\x\x\|\d\{3}\)\)\?\|\\./
hi SSSEscape ctermfg=LightBlue
2023-07-28 08:58:28 -07:00
syn keyword SSSExtern extern
hi def link SSSExtern Statement
syn keyword SSSConditional if unless elseif else when then defer convert
2023-04-30 18:45:06 -07:00
hi def link SSSConditional Conditional
2024-11-25 22:01:01 -08:00
syn keyword SSSLoop for between while do until with repeat
2023-04-30 18:45:06 -07:00
hi def link SSSLoop Repeat
syn keyword SSSFail fail
hi def link SSSFail Exception
2024-11-25 22:01:01 -08:00
syn keyword SSSStatement stop skip fail pass return del struct lang
2023-04-30 18:45:06 -07:00
hi def link SSSStatement Statement
2024-11-25 22:01:01 -08:00
syn keyword SSSNull NONE
hi SSSNull ctermfg=red
2023-06-05 10:59:26 -07:00
syn region SSSUse matchgroup=Keyword start=/\<use\>/ matchgroup=SSSDelim end=/$\|;/
hi def link SSSUse String
2023-04-30 18:45:06 -07:00
2023-06-04 12:37:34 -07:00
syn match SSSArgDefault /=/ nextgroup=@SSSAll skipwhite contained
hi def link SSSArgDefault Operator
syn match SSSReturnSignature /->/ nextgroup=SSSType skipwhite contained
hi def link SSSReturnSignature Operator
2024-11-25 22:01:01 -08:00
syn region SSSFnArgSignature start=/(/ end=/)/ contains=SSSVar,SSSDelim,SSSTypeAnnotation,SSSArgDefault nextgroup=SSSReturnSignature skipwhite contained
2023-06-04 12:37:34 -07:00
syn match SSSFnName /\<[a-zA-Z_][a-zA-Z_0-9]*\>/ nextgroup=SSSFnArgSignature skipwhite contained
2023-04-30 18:45:06 -07:00
hi def link SSSFnName Function
2023-07-28 08:58:28 -07:00
syn keyword SSSFuncDef func nextgroup=SSSFnName skipwhite
hi def link SSSFuncDef Keyword
syn match SSSTagEquals /=/ skipwhite nextgroup=SSSErrorWord,SSSNumber contained
hi def link SSSTagEquals Operator
syn match SSSTagType /(/ nextgroup=SSSType contained
syn match SSSTag /[a-zA-Z_]\i*/ nextgroup=SSSTagType contained
hi SSSTag cterm=bold
2023-07-28 08:58:28 -07:00
syn keyword SSSEnum enum skipwhite nextgroup=SSSTaggedUnion
hi def link SSSEnum Keyword
syn region SSSTaggedUnion start=/:=/ skip=/|/ end=/$/ contains=SSSTag,SSSTagEquals contained
2023-04-30 18:45:06 -07:00
" syn region SSSFnDecl start=/\<def\>/ end=/(\@=\|$/ contains=SSSFnName,SSSKeyword
syn keyword SSSBoolean yes no
hi def link SSSBoolean Boolean
syn keyword SSSNil nil
hi SSSNil cterm=bold ctermfg=cyan
syn match SSSStructName /\w\+\( *{\)\@=/
hi SSSStructName cterm=bold
2024-11-25 22:01:01 -08:00
syn keyword SSSOperator in and or xor is not mod mod1 _min_ _max_ _mix_
syn match SSSOperator ;\([a-zA-Z0-9_)] *\)\@<=/;
syn match SSSOperator ;[+*^<>=-]=\?;
syn match SSSOperator /[:!]\?=/
syn match SSSOperator /[#?:]/
2023-04-30 18:45:06 -07:00
hi def link SSSOperator Operator
syn match SSSDelim /,/
2023-06-04 12:37:34 -07:00
hi def link SSSDelim Delimiter
2023-04-30 18:45:06 -07:00
2024-11-25 22:01:01 -08:00
syn match SSSTableValueType /:/ nextgroup=SSSType contained
2023-06-04 12:37:34 -07:00
hi def link SSSTableValueType Type
2023-04-30 18:45:06 -07:00
syn match SSSTypeDelim /,/ contained
hi def link SSSTypeDelim Type
syn match SSSAssoc /=/ contained
hi def link SSSAssoc Type
2024-11-25 22:01:01 -08:00
syn region SSSType start=/\[/ end=/\]\|\():\)\@=\|$/ contains=SSSType contained nextgroup=SSSTableValueType
syn region SSSType start=/{/ end=/}\|\():\)\@=\|$/ contains=SSSType,SSSAssoc contained nextgroup=SSSTableValueType
syn region SSSType start=/func(/ end=/) *\(->\)\?/ contains=SSSType,SSSTypeDelim nextgroup=SSSType contained
syn match SSSType /[a-zA-Z_]\i*/ contained nextgroup=SSSTableValueType
syn match SSSType /\$[a-zA-Z_0-9]\+/ contained nextgroup=SSSTableValueType
2023-06-04 14:42:44 -07:00
syn match SSSType /[@?&]\+/ contained nextgroup=SSSType
2023-04-30 18:45:06 -07:00
hi def link SSSType Type
2024-11-25 22:01:01 -08:00
syn match SSSTypeAnnotation /:=\@!/ nextgroup=SSSType contained
2023-04-30 18:45:06 -07:00
hi def link SSSTypeAnnotation Operator
2024-11-25 22:01:01 -08:00
syn region SSSComment start=;#; end=/$/
2023-04-30 18:45:06 -07:00
hi def link SSSComment Comment
2024-11-25 22:01:01 -08:00
syn region SSSSay start=;!!; end=/$/ contains=SSSEscape,SSSStringInterp
hi SSSSay ctermfg=white cterm=bold
syn region SSSInlineCParens start=/(/ end=/)/ contains=SSSInlineCParens contained
hi def link SSSInlineCParens String
syn region SSSInlineCBraces start=/{/ end=/}/ contains=SSSInlineCBraces contained
hi def link SSSInlineCBraces String
syn match SSSInlineC ;inline C *; nextgroup=SSSInlineCBraces,SSSInlineCParens
hi def link SSSInlineC Keyword
2023-06-11 11:36:59 -07:00
syn region SSSParenGroup start=/(/ end=/)/ contains=@SSSAll,SSSParenGroup contained
2023-04-30 18:45:06 -07:00
syn match SSSLinkerDirective ;^\s*!link.*$;
hi SSSLinkerDirective ctermbg=blue ctermfg=black
2024-11-25 22:01:01 -08:00
syn cluster SSSAll contains=SSSVar,SSSComment,SSSChar,SSSString,SSSDSL,SSSPath,SSSKeyword,SSSOperator,
\SSSConditional,SSSLoop,SSSFail,SSSNull,SSSStatement,SSSStructure,SSSTypedef,SSSEmptyTable,SSSUse,
\SSSNumber,SSSFnDecl,SSSBoolean,SSSNil,SSSDocTest,SSSDocError,SSSArray,SSSTable,
\SSSLinkerDirective,SSSInlineC
2023-04-30 18:45:06 -07:00
if !exists('b:current_syntax')
let b:current_syntax = 'bpeg'
endif