oml.vim

Submitted by Phaul on Wed, 2007-03-07 11:45.
::

Here is my oml.vim, the rainbow effect is from the lisp.vim.

" Vim syntax file
" Language:     oml
" Filenames:    *.oml
" Author:       phaul@bsd.inf.elte.hu
" Version:      SECOND-2
" Copyright:    Copyright (c) 2007 Paul Sonkoly

if exists("b:current_syntax")
  finish
endif

syn case match

syn match OMLComment /;.*$/

syn region OMLString start=/"/ end=/"/ skip=/\\"/ contains=OMLEscaped

syn match OMLInt /-\?\d\+/
syn match OMLHexaerr /0x/
" TODO : doesn't work... :'( ??
syn match OMLEscaped display contained /\\[eabfnrtv]/
syn match OMLHexa /0x\([0-9a-fA-F]\)\{8}/

yn match OMLOp /\(+\|-\|\/\|*\|<\|<=\|>\|>=\|=\)\s/

" the following comes from the lisp syntax file.
" thank you for the author of that
syn region OMLParen0           matchgroup=hlLevel0 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen1
syn region OMLParen1 contained matchgroup=hlLevel1 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen2
syn region OMLParen2 contained matchgroup=hlLevel2 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen3
syn region OMLParen3 contained matchgroup=hlLevel3 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen4
syn region OMLParen4 contained matchgroup=hlLevel4 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen5
syn region OMLParen5 contained matchgroup=hlLevel5 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen6
syn region OMLParen6 contained matchgroup=hlLevel6 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen7
syn region OMLParen7 contained matchgroup=hlLevel7 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen8
syn region OMLParen8 contained matchgroup=hlLevel8 start="`\=(" end=")" skip="|.\{-}|" contains=@OMLListCluster,OMLParen9

syn cluster OMLListCluster contains=OMLComment,OMLString,OMLInt,OMLHexa,OMLHexaerr,OMLOp,OMLKey,OMLVar

syn keyword OMLKey include declare list join nth progn print set if while func not and or abort sleep length xdrawtext xdrawline xdrawarc date ascii xcleararea uptime strcat sin cos asin acos log sqrt floor meminfo cpuinfo procnum fsinfo apminfo fopen fread fwrite fgetpos fsetpos fclose xgetgc xsetgc strlen substr mkscope graphadd graphupd scopeflush rmscope pngopen pngdraw pngclose netloadopen netloadgetstat netloadclose netconopen netconread netconwrite netconclose execute random

syn match OMLVar /[_a-zA-Z]\+/

hi def link OMLComment          Comment
hi def link OMLString           String
hi def link OMLEscaped          SpecialChar
hi def link OMLInt              Number
hi def link OMLHexa             Number
hi def link OMLHexaerr          Error
hi def link OMLOp               Operator
 def link OMLVar              Identifier

" the following comes from the lisp syntax file.
" thank you for the author of that
if &bg == "dark"
hi def hlLevel0 ctermfg=red         guifg=red1
hi def hlLevel1 ctermfg=yellow      guifg=orange1
hi def hlLevel2 ctermfg=green       guifg=yellow1
hi def hlLevel3 ctermfg=cyan        guifg=greenyellow
hi def hlLevel4 ctermfg=magenta     guifg=green1
hi def hlLevel5 ctermfg=red         guifg=springgreen1
hi def hlLevel6 ctermfg=yellow      guifg=cyan1
hi def hlLevel7 ctermfg=green       guifg=slateblue1
hi def hlLevel8 ctermfg=cyan        guifg=magenta1
hi def hlLevel9 ctermfg=magenta     guifg=purple1
else
hi def hlLevel0 ctermfg=red         guifg=red3
hi def hlLevel1 ctermfg=darkyellow  guifg=orangered3
hi def hlLevel2 ctermfg=darkgreen   guifg=orange2
hi def hlLevel3 ctermfg=blue        guifg=yellow3
hi def hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
hi def hlLevel5 ctermfg=red         guifg=green4
hi def hlLevel6 ctermfg=darkyellow  guifg=paleturquoise3
hi def hlLevel7 ctermfg=darkgreen   guifg=deepskyblue4
hi def hlLevel8 ctermfg=blue        guifg=darkslateblue
hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet
endif

let b:current_syntax = "OML"