A vim syntax for my concatenative language, nimf
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

" Vim syntax file
" " Language: nimf
" " Maintainer: sloum < sloum AT rawtext.club >
" " Latest Revision: 26 July 2020
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
syn sync maxlines=200
" Characters allowed in keywords
if version >= 600
setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
" Handle comment blocks
syn region nimfComment start=/(/ end=/)/ transparent contains=nimfTodo,nimfComment
" Strings, needs work to require (^|\s) before, couldnt get it to work
syn match nimfStringLiteral /"\s\+.*\s\+"/
" Adds highlighting for integers
syn match nimfInt '\<-\=[0-9]*[0-9]\+\>'
" keywords for language keywords
syn keyword nimfConditional if then else
syn keyword nimfLoop do loop
syn keyword nimfStatement var svar
syn keyword nimfOperators + - / * % /% ++ -- +=
syn keyword nimfMemory @ ! +! ?
syn keyword nimComparrison > < = >= <= 0= != 0< !0
syn match nimfWordDef '\<:m\?\s*[^ \t]\+\>'
syn keyword nimfWordDef ;
syn keyword nimfInclude inline
syn match nimfInclude /module-end/
syn keyword nimfException error
syn keyword nimfTodo TODO XXX FIXME BUG contained
syn keyword nimfSub dup drop . .s print prints swap over roll pick bye !bye words depth clearstack page cr space input emit sleep allot see 2dup abs neg
" let b:current_syntax = "nimf"
highlight link nimfInclude Include
highlight link nimfWordDef Identifier
highlight link nimfStatement Identifier
highlight link nimfSub Function
highlight link nimfInt Constant
highlight link nimfComment Comment
highlight link nimfStringLiteral String
highlight link nimfOperators Operator
highlight link nimfConditional Conditional
highlight link nimfLoop Repeat
highlight link nimfException Exception
highlight link nimfTodo Todo
highlight link nimfMemory TypeDef