probcomp / Venturecxx

Primary implementation of the Venture probabilistic programming system
http://probcomp.csail.mit.edu/venture/
GNU General Public License v3.0
28 stars 6 forks source link

Add vim syntax highlighting to tools #601

Open marcoct opened 8 years ago

marcoct commented 8 years ago

Not great version, but does something. Put it in ~/.vim/syntax/vnts.vim

" Vim syntax file
" " Language: VentureScript
" " Maintainer: Marco Cusumano-Towner
" " Latest Revision: 13 July 2016

if exists("b:current_syntax")
  finish
endif

" Keywords
syn keyword vsStatement define proc if else do run return pass let and or repeat action in_model
syn keyword directives define assume infer observe forget
syn keyword vsTodo contained TODO FIXME XXX NOTE
syn match vsComment "//.*$" contains=vsTodo
syn region vsBlock start="{" end="}" fold transparent
syn region vsString start='"' end='"'
syn region vsUnquote start='${' end='}' contained
syn region vsQuasiquote start='\[|' end='|\]' contains=vsUnquote

" Constants
" Regular int like number with - + or nothing in front
syn match vsNumber '\d\+' display
syn match vsNumber '[-+]\d\+' display

" " Floating point number with decimal no E or e (+,-)
syn match vsNumber '\d\+\.\d*' display
syn match vsNumber '[-+]\d\+\.\d*' display

" " Floating point like number with E and no decimal point (+,-)
syn match vsNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' display
syn match vsNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' display

" " Floating point like number with E and decimal point (+,-)
syn match vsNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' display
syn match vsNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' display

syn keyword vsBool true false

let b:current_syntax = "vs"
hi def link vsStatement Statement
hi def link vsTodo Todo
hi def link directives PreProc
hi def link vsComment Comment
hi def link vsString Constant
hi def link vsNumber Constant
hi def link vsBool Constant
hi def link vsQuasiquote Constant
hi def link vsUnquote Normal
axch commented 8 years ago

Any reason not to save this file as tool/vnts.vim?