aboutsummaryrefslogtreecommitdiffhomepage
path: root/editors/vim/syntax/bruijn.vim
diff options
context:
space:
mode:
authorMarvin Borner2022-06-30 20:36:37 +0200
committerMarvin Borner2022-06-30 20:36:37 +0200
commit269a7832ece9c1997d0431c41d04e91d46813a96 (patch)
tree690f0c7a5441d02df4a0bebb040ed2a091c729dd /editors/vim/syntax/bruijn.vim
parent9d8efb7dfa56576c779244af633481ee7e986060 (diff)
Very basic syntax highlighting
Diffstat (limited to 'editors/vim/syntax/bruijn.vim')
-rw-r--r--editors/vim/syntax/bruijn.vim42
1 files changed, 42 insertions, 0 deletions
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"