From 269a7832ece9c1997d0431c41d04e91d46813a96 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 30 Jun 2022 20:36:37 +0200 Subject: Very basic syntax highlighting --- editors/vim/syntax/bruijn.vim | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 editors/vim/syntax/bruijn.vim (limited to 'editors/vim/syntax') diff --git a/editors/vim/syntax/bruijn.vim b/editors/vim/syntax/bruijn.vim new file mode 100644 index 0000000..4782f1f --- /dev/null +++ b/editors/vim/syntax/bruijn.vim @@ -0,0 +1,42 @@ +" Vim syntax file +" Language: Bruijn + +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 + +let b:current_syntax = "bruijn" -- cgit v1.2.3