diff options
-rw-r--r-- | editors/vim/syntax/bruijn.vim | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/editors/vim/syntax/bruijn.vim b/editors/vim/syntax/bruijn.vim index 4782f1f..d11cccc 100644 --- a/editors/vim/syntax/bruijn.vim +++ b/editors/vim/syntax/bruijn.vim @@ -5,38 +5,25 @@ if exists("b:current_syntax") finish endif -let s:bruijn_syntax_keywords = { - \ 'bruijnInstruction' :[":test " - \ , ":import " - \ , ":print " - \ , ] - \ , } - -function! s:syntax_keyword(dict) - for key in keys(a:dict) - execute 'syntax keyword' key join(a:dict[key], ' ') - endfor -endfunction - -call s:syntax_keyword(s:bruijn_syntax_keywords) - -syntax match bruijnApplication /[()]/ -syntax match bruijnAbstraction /[[\]]/ -syntax match bruijnIndex display "\d" -syntax match bruijnDefinition /^\S\+/ - -syntax region bruijnCommentLine start="# " end="$" - -" this might be weird but because of bruijn's limited -" functionality it's okay to use the wrong constants -" for better looks -highlight default link bruijnIndex Special -highlight default link bruijnDefinition Function -highlight default link bruijnInstruction Keyword -highlight default link bruijnAbstraction Boolean -highlight default link bruijnApplication String -highlight default link bruijnCommentLine Comment - -delfunction s:syntax_keyword +syn match bruijnApplication /[()]/ +syn match bruijnAbstraction /[[\]]/ +syn match bruijnIndex display "\d" +syn match bruijnNumber /[+-]\d\+/ +syn match bruijnDefinition /^\t*\S\+/ +syn match bruijnKeyword /:test\|:import\|:print/ +syn match bruijnNamespace /[A-Z][a-z]*\(\.\)\@=/ +syn match bruijnNamespaceDelim /\([A-Z][a-z]*\)\@<=\./ + +syn region bruijnCommentLine start="^# " end="$" + +hi def link bruijnIndex Special +hi def link bruijnNumber Number +hi def link bruijnDefinition Define +hi def link bruijnKeyword Macro +hi def link bruijnNamespace Type +hi def link bruijnNamespaceDelim Special +hi def link bruijnAbstraction Function +hi def link bruijnApplication String +hi def link bruijnCommentLine Comment let b:current_syntax = "bruijn" |