diff --git a/README.md b/README.md index a29473e..49fcd4f 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/ftdetect/blang.vim b/ftdetect/blang.vim deleted file mode 100644 index d28b3c6..0000000 --- a/ftdetect/blang.vim +++ /dev/null @@ -1,6 +0,0 @@ -" Language: Blang -" Maintainer: Bruce Hill -" License: WTFPL - -autocmd BufNewFile,BufRead *.blang set filetype=blang -autocmd BufNewFile,BufRead *.bl set filetype=blang diff --git a/ftdetect/sss.vim b/ftdetect/sss.vim new file mode 100644 index 0000000..389cfe0 --- /dev/null +++ b/ftdetect/sss.vim @@ -0,0 +1,5 @@ +" Language: SSS +" Maintainer: Bruce Hill +" License: WTFPL + +autocmd BufNewFile,BufRead *.sss set filetype=sss diff --git a/ftplugin/blang.vim b/ftplugin/sss.vim similarity index 92% rename from ftplugin/blang.vim rename to ftplugin/sss.vim index de9b1a2..dfd4016 100644 --- a/ftplugin/blang.vim +++ b/ftplugin/sss.vim @@ -1,4 +1,4 @@ -" Language: Blang +" Language: SSS " Maintainer: Bruce Hill " License: WTFPL diff --git a/indent/blang.vim b/indent/sss.vim similarity index 86% rename from indent/blang.vim rename to indent/sss.vim index 25b339f..928363b 100644 --- a/indent/blang.vim +++ b/indent/sss.vim @@ -1,4 +1,4 @@ -" Language: Blang +" Language: SSS " Maintainer: Bruce Hill " 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) diff --git a/syntax/blang.vim b/syntax/blang.vim deleted file mode 100644 index e13792d..0000000 --- a/syntax/blang.vim +++ /dev/null @@ -1,144 +0,0 @@ -" Language: Blang -" Maintainer: Bruce Hill -" 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_]\+\)\?%\?\|\.\@/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=/\/ 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 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 diff --git a/syntax/sss.vim b/syntax/sss.vim new file mode 100644 index 0000000..d6932d9 --- /dev/null +++ b/syntax/sss.vim @@ -0,0 +1,144 @@ +" Language: SSS +" Maintainer: Bruce Hill +" 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_]\+\)\?%\?\|\.\@/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=/\/ 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 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