Updated with new name

This commit is contained in:
Bruce Hill 2023-04-30 21:45:06 -04:00
parent 0b38c00899
commit 5fca9efa68
7 changed files with 155 additions and 156 deletions

View File

@ -1 +1 @@
This is a vim plugin for the Blang programming language.
This is a vim plugin for the [SSS programming language](https://github.com/bruce-hil/sss).

View File

@ -1,6 +0,0 @@
" Language: Blang
" Maintainer: Bruce Hill <bruce@bruce-hill.com>
" License: WTFPL
autocmd BufNewFile,BufRead *.blang set filetype=blang
autocmd BufNewFile,BufRead *.bl set filetype=blang

5
ftdetect/sss.vim Normal file
View File

@ -0,0 +1,5 @@
" Language: SSS
" Maintainer: Bruce Hill <bruce@bruce-hill.com>
" License: WTFPL
autocmd BufNewFile,BufRead *.sss set filetype=sss

View File

@ -1,4 +1,4 @@
" Language: Blang
" Language: SSS
" Maintainer: Bruce Hill <bruce@bruce-hill.com>
" License: WTFPL

View File

@ -1,4 +1,4 @@
" Language: Blang
" Language: SSS
" Maintainer: Bruce Hill <bruce@bruce-hill.com>
" License: WTFPL
@ -9,15 +9,15 @@ endif
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetBlangIndent()
setlocal indentexpr=GetSSSIndent()
setlocal indentkeys+=-:
" Only define the function once.
if exists("*GetBlangIndent")
if exists("*GetSSSIndent")
finish
endif
function! GetBlangIndent()
function! GetSSSIndent()
let line = getline(v:lnum)
let current_ind = indent(v:lnum)
let previousNum = prevnonblank(v:lnum - 1)

View File

@ -1,144 +0,0 @@
" Language: Blang
" Maintainer: Bruce Hill <bruce@bruce-hill.com>
" License: WTFPL
" Bail if our syntax is already loaded.
if exists('b:current_syntax') && b:current_syntax == 'blang'
finish
endif
syn match BlangVar /[a-zA-Z_][a-zA-Z_0-9]*/
syn match BlangNumber /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 BlangNumber Number
syn match BlangChar /`./
hi def link BlangChar String
syn region BlangString start=/".\@=/ end=/"\|$/ contains=BlangEscape,BlangStringInterp
syn region BlangString start=/'.\@=/ end=/'\|$/
syn region BlangString start=/".\@!\%(^\z(\s*\).*\)\@<=/ end=/^\z1"\|^\%(\z1\s\)\@!\s*\S\@=/ contains=BlangEscape,BlangStringInterp
syn region BlangString start=/'.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\z1'\|^\%(\z1\s\)\@!\s*\S\@=/he=s-1
hi def link BlangString String
syn region BlangDSLString start=/\z(\W\).\@=/hs=e end=/\z1/ contains=BlangEscape,BlangStringInterp contained
syn region BlangDSLString start=/\z(\W\).\@!\%(^\z(\s*\).*\)\@<=/hs=e end=/^\z2\z1/he=e contains=BlangEscape,BlangStringInterp contained
syn region BlangDSLString start=/\[/hs=e+1 end=/]/he=s-1 contains=BlangEscape,BlangStringInterp contained
syn region BlangDSLString start=/{/hs=e+1 end=/}/he=s-1 contained
syn region BlangDSLString start=/</hs=e+1 end=/>/he=s-1 contains=BlangEscape contained
syn region BlangDSLString start=/(/hs=e+1 end=/)/he=s-1 contains=BlangStringInterp contained
syn region BlangDSLString start=/\//hs=e+1 end=/\//he=s-1 contains=BlangStringAtInterp contained
syn region BlangDSLString start=/>.\@=/hs=e+1 end=/$/ contains=BlangStringAtInterp contained
syn region BlangDSLString start=/>.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\%(\z1\s\)\@!.\@=/ contains=BlangStringAtInterp contained
syn region BlangDSLString start=/:.\@=/hs=e+1 end=/$/ contains=BlangStringInterp,BlangEscape contained
syn region BlangDSLString start=/:.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\%(\z1\s\)\@!.\@=/ contains=BlangStringInterp,BlangEscape contained
hi def link BlangDSLString String
syn match BlangDocTest /^\s*\(>>>\|===\|!!!\)/
hi BlangDocTest ctermfg=gray cterm=italic
syn match BlangDocError /!!!.*/
hi BlangDocError ctermfg=red cterm=italic
syn match BlangDSL /\$\w*/ nextgroup=BlangString,BlangDSLString
hi def link BlangDSL String
hi BlangDSL ctermfg=white cterm=bold
syn match BlangStringDollar /\$:\?/ contained
hi BlangStringDollar ctermfg=LightBlue
syn match BlangStringAt /@/ contained
hi BlangStringAt ctermfg=LightBlue
syn match BlangStringInterpWord /[a-zA-Z_][a-zA-Z_0-9]*\(\.[a-zA-Z_][a-zA-Z_0-9]*\)*/ contained
hi BlangStringInterpWord ctermfg=LightBlue
syn match BlangStringInterp /\$:\?/ contained nextgroup=BlangStringDollar,BlangStringInterpWord,@BlangAll
hi BlangStringInterp ctermfg=LightBlue
syn match BlangStringAtInterp /@/ contained nextgroup=BlangStringAt,BlangStringInterpWord,@BlangAll
hi BlangStringAtInterp ctermfg=LightBlue
syn match BlangEscape /\\\([abenrtvN]\|x\x\x\|\d\{3}\)\(-\([abnrtv]\|x\x\x\|\d\{3}\)\)\?\|\\./
hi BlangEscape ctermfg=LightBlue
syn keyword BlangConditional if unless elseif else when then defer
hi def link BlangConditional Conditional
syn keyword BlangLoop for between while repeat do until with
hi def link BlangLoop Repeat
syn keyword BlangFail fail
hi def link BlangFail Exception
syn keyword BlangStatement stop skip fail pass return
hi def link BlangStatement Statement
syn keyword BlangStructure struct unit enum union
hi def link BlangStructure Structure
syn keyword BlangTypedef deftype
hi def link BlangTypedef Typedef
syn keyword BlangKeyword macro deftype use export extern
hi def link BlangKeyword Keyword
syn match BlangFnName /\<[a-zA-Z_][a-zA-Z_0-9]*\>/ contained
hi def link BlangFnName Function
syn keyword BlangDef def nextgroup=BlangFnName skipwhite
hi def link BlangDef Keyword
" syn region BlangFnDecl start=/\<def\>/ end=/(\@=\|$/ contains=BlangFnName,BlangKeyword
syn keyword BlangBoolean yes no
hi def link BlangBoolean Boolean
syn keyword BlangNil nil
hi BlangNil cterm=bold ctermfg=cyan
syn match BlangStructName /\w\+\( *{\)\@=/
hi BlangStructName cterm=bold
syn keyword BlangOperator in and or xor is not mod sizeof typeof
syn match BlangOperator /\<\(and\|or\|xor\|mod\|in\)=/
syn match BlangOperator /\(>>>\|===\)\@![+*/^<>=-]=\?/
syn match BlangOperator /\(===\)\@![:!]\?=/
syn match BlangOperator /[#?]/
hi def link BlangOperator Operator
syn match BlangDelim /,/
hi def link BlangDelim Dlimiter
syn match BlangTypeDelim /,/ contained
hi def link BlangTypeDelim Type
syn match BlangAssoc /=/ contained
hi def link BlangAssoc Type
syn region BlangType start=/\[/ end=/\]\|$/ contains=BlangType contained
syn region BlangType start=/{/ end=/}\|$/ contains=BlangType,BlangAssoc contained
syn region BlangType start=/(/ end=/)=>\|$/ contains=BlangType,BlangTypeDelim nextgroup=BlangType contained
syn match BlangType /[a-zA-Z_0-9@?]\+/ contained
hi def link BlangType Type
syn match BlangTypeAnnotation /:\@<!:[=:]\@!/
"nextgroup=BlangType skipwhite
hi def link BlangTypeAnnotation Operator
syn match BlangAs /\<as\>/ nextgroup=BlangType skipwhite
hi def link BlangAs Operator
syn region BlangComment start=;//; end=/$/
hi def link BlangComment Comment
syn region BlangParenGroup start=/(/ end=/)/ contains=@BlangAll
syn match BlangLinkerDirective ;^\s*!link.*$;
hi BlangLinkerDirective ctermbg=blue ctermfg=black
syn cluster BlangAll contains=BlangVar,BlangComment,BlangChar,BlangString,BlangDSL,BlangKeyword,BlangOperator,
\BlangConditional,BlangLoop,BlangFail,BlangStatement,BlangStructure,BlangTypedef,
\BlangNumber,BlangFnDecl,BlangBoolean,BlangNil,BlangTypeAnnotation,BlangAs,BlangParenGroup,BlangDocTest,BlangDocError
\BlangLinkerDirective
if !exists('b:current_syntax')
let b:current_syntax = 'bpeg'
endif

144
syntax/sss.vim Normal file
View File

@ -0,0 +1,144 @@
" 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 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
syn region SSSString start=/".\@=/ end=/"\|$/ contains=SSSEscape,SSSStringInterp
syn region SSSString start=/'.\@=/ end=/'\|$/
syn region SSSString start=/".\@!\%(^\z(\s*\).*\)\@<=/ end=/^\z1"\|^\%(\z1\s\)\@!\s*\S\@=/ contains=SSSEscape,SSSStringInterp
syn region SSSString start=/'.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\z1'\|^\%(\z1\s\)\@!\s*\S\@=/he=s-1
hi def link SSSString String
syn region SSSDSLString start=/\z(\W\).\@=/hs=e end=/\z1/ contains=SSSEscape,SSSStringInterp contained
syn region SSSDSLString start=/\z(\W\).\@!\%(^\z(\s*\).*\)\@<=/hs=e end=/^\z2\z1/he=e contains=SSSEscape,SSSStringInterp contained
syn region SSSDSLString start=/\[/hs=e+1 end=/]/he=s-1 contains=SSSEscape,SSSStringInterp contained
syn region SSSDSLString start=/{/hs=e+1 end=/}/he=s-1 contained
syn region SSSDSLString start=/</hs=e+1 end=/>/he=s-1 contains=SSSEscape contained
syn region SSSDSLString start=/(/hs=e+1 end=/)/he=s-1 contains=SSSStringInterp contained
syn region SSSDSLString start=/\//hs=e+1 end=/\//he=s-1 contains=SSSStringAtInterp contained
syn region SSSDSLString start=/>.\@=/hs=e+1 end=/$/ contains=SSSStringAtInterp contained
syn region SSSDSLString start=/>.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\%(\z1\s\)\@!.\@=/ contains=SSSStringAtInterp contained
syn region SSSDSLString start=/:.\@=/hs=e+1 end=/$/ contains=SSSStringInterp,SSSEscape contained
syn region SSSDSLString start=/:.\@!\%(^\z(\s*\).*\)\@<=/hs=e+1 end=/^\%(\z1\s\)\@!.\@=/ contains=SSSStringInterp,SSSEscape contained
hi def link SSSDSLString String
syn match SSSDocTest /^\s*\(>>>\|===\|!!!\)/
hi SSSDocTest ctermfg=gray cterm=italic
syn match SSSDocError /!!!.*/
hi SSSDocError ctermfg=red cterm=italic
syn match SSSDSL /\$\w*/ nextgroup=SSSString,SSSDSLString
hi def link SSSDSL String
hi SSSDSL ctermfg=white cterm=bold
syn match SSSStringDollar /\$:\?/ contained
hi SSSStringDollar ctermfg=LightBlue
syn match SSSStringAt /@/ contained
hi SSSStringAt ctermfg=LightBlue
syn match SSSStringInterpWord /[a-zA-Z_][a-zA-Z_0-9]*\(\.[a-zA-Z_][a-zA-Z_0-9]*\)*/ contained
hi SSSStringInterpWord ctermfg=LightBlue
syn match SSSStringInterp /\$:\?/ contained nextgroup=SSSStringDollar,SSSStringInterpWord,@SSSAll
hi SSSStringInterp ctermfg=LightBlue
syn match SSSStringAtInterp /@/ contained nextgroup=SSSStringAt,SSSStringInterpWord,@SSSAll
hi SSSStringAtInterp ctermfg=LightBlue
syn match SSSEscape /\\\([abenrtvN]\|x\x\x\|\d\{3}\)\(-\([abnrtv]\|x\x\x\|\d\{3}\)\)\?\|\\./
hi SSSEscape ctermfg=LightBlue
syn keyword SSSConditional if unless elseif else when then defer
hi def link SSSConditional Conditional
syn keyword SSSLoop for between while repeat do until with
hi def link SSSLoop Repeat
syn keyword SSSFail fail
hi def link SSSFail Exception
syn keyword SSSStatement stop skip fail pass return
hi def link SSSStatement Statement
syn keyword SSSStructure struct unit enum union
hi def link SSSStructure Structure
syn keyword SSSTypedef deftype
hi def link SSSTypedef Typedef
syn keyword SSSKeyword macro deftype use export extern global
hi def link SSSKeyword Keyword
syn match SSSFnName /\<[a-zA-Z_][a-zA-Z_0-9]*\>/ contained
hi def link SSSFnName Function
syn keyword SSSDef def nextgroup=SSSFnName skipwhite
hi def link SSSDef Keyword
" 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
syn keyword SSSOperator in and or xor is not mod sizeof typeof
syn match SSSOperator /\<\(and\|or\|xor\|mod\|in\)=/
syn match SSSOperator /\(>>>\|===\)\@![+*/^<>=-]=\?/
syn match SSSOperator /\(===\)\@![:!]\?=/
syn match SSSOperator /[#?]/
hi def link SSSOperator Operator
syn match SSSDelim /,/
hi def link SSSDelim Dlimiter
syn match SSSTypeDelim /,/ contained
hi def link SSSTypeDelim Type
syn match SSSAssoc /=/ contained
hi def link SSSAssoc Type
syn region SSSType start=/\[/ end=/\]\|$/ contains=SSSType contained
syn region SSSType start=/{/ end=/}\|$/ contains=SSSType,SSSAssoc contained
syn region SSSType start=/(/ end=/)=>\|$/ contains=SSSType,SSSTypeDelim nextgroup=SSSType contained
syn match SSSType /[a-zA-Z_0-9@?]\+/ contained
hi def link SSSType Type
syn match SSSTypeAnnotation /:\@<!:[=:]\@!/
"nextgroup=SSSType skipwhite
hi def link SSSTypeAnnotation Operator
syn match SSSAs /\<as\>/ nextgroup=SSSType skipwhite
hi def link SSSAs Operator
syn region SSSComment start=;//; end=/$/
hi def link SSSComment Comment
syn region SSSParenGroup start=/(/ end=/)/ contains=@SSSAll
syn match SSSLinkerDirective ;^\s*!link.*$;
hi SSSLinkerDirective ctermbg=blue ctermfg=black
syn cluster SSSAll contains=SSSVar,SSSComment,SSSChar,SSSString,SSSDSL,SSSKeyword,SSSOperator,
\SSSConditional,SSSLoop,SSSFail,SSSStatement,SSSStructure,SSSTypedef,
\SSSNumber,SSSFnDecl,SSSBoolean,SSSNil,SSSTypeAnnotation,SSSAs,SSSParenGroup,SSSDocTest,SSSDocError
\SSSLinkerDirective
if !exists('b:current_syntax')
let b:current_syntax = 'bpeg'
endif