summaryrefslogtreecommitdiff
path: root/Util/vim/syntax/boogie.vim
blob: 673f967e857df8b6d5588c873145f988f43ff842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
" Vim syntax file
" Language:	BoogiePL
" Maintainer:	Michal Moskal <Michal.Moskal@microsoft.com>
" Last Change:	Fri Mar 14 13:47:43 WEST 2008
" Filenames:	*.bpl

if exists("b:current_syntax")
    finish
endif

let s:bpl_cpo_save = &cpo
set cpo&vim


" type
syn keyword bplType			bool int
" repeat / condition / label
syn keyword bplExpr			forall exists cast returns lambda div mod
syn keyword bplStmt			goto return while call else if assert assume havoc then 
syn keyword bplDecl			axiom function procedure type requires ensures modifies unique const var free implementation invariant
" user labels
syn match   bplLabel			display +^\s*\I\i*\s*:\([^:=]\|$\)\@=+
syn keyword bplConstant			false null true

syn match   bplIdentifier		display "[A-Za-z0-9_.$#^]\+"


" Comments
"
" PROVIDES: @bplCommentHook
"
" TODO: include strings ?
"
syn keyword bplTodo		contained TODO FIXME XXX NOTE
syn region  bplComment		start="/\*"  end="\*/" contains=@bplCommentHook,bplTodo,@Spell
syn match   bplComment		"//.*$" contains=@bplCommentHook,bplTodo,@Spell

" [1] 9.5 Pre-processing directives
syn region	bplPreCondit
    \ start="^\s*#\s*\(define\|undef\|if\|elif\|else\|endif\|line\|error\|warning\)"
    \ skip="\\$" end="$" contains=bplComment keepend
syn region	bplRegion matchgroup=bplPreCondit start="^\s*#\s*region.*$"
    \ end="^\s*#\s*endregion" transparent fold contains=TOP


" Strings and constants
syn match   bplSpecialError	contained "\\."
syn match   bplSpecialCharError	contained "[^']"
" [1] 9.4.4.4 Character literals
syn match   bplSpecialChar	contained +\\["\\'0abfnrtvx]+
" unicode characters
syn match   bplUnicodeNumber	+\\\(u\x\{4}\|U\x\{8}\)+ contained contains=bplUnicodeSpecifier
syn match   bplUnicodeSpecifier	+\\[uU]+ contained
syn region  bplVerbatimString	start=+@"+ end=+"+ end=+$+ skip=+""+ contains=bplVerbatimSpec,@Spell
syn match   bplVerbatimSpec	+@"+he=s+1 contained
syn region  bplString		start=+"+  end=+"+ end=+$+ contains=bplSpecialChar,bplSpecialError,bplUnicodeNumber,@Spell
syn match   bplCharacter		"'[^']*'" contains=bplSpecialChar,bplSpecialCharError
syn match   bplCharacter		"'\\''" contains=bplSpecialChar
syn match   bplCharacter		"'[^\\]'"
syn match   bplNumber		"\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
syn match   bplNumber		"\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
syn match   bplNumber		"\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
syn match   bplNumber		"\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"

" The default highlighting.
hi def link bplType			Type
hi def link bplDecl			Conditional
hi def link bplStmt			Conditional
hi def link bplLabel			Label
hi def link bplExpr			StorageClass
hi def link bplConstant			Constant

hi def link bplTodo			Todo
hi def link bplComment			Comment

hi def link bplSpecialError		Error
hi def link bplSpecialCharError		Error
hi def link bplString			String
hi def link bplVerbatimString		String
hi def link bplVerbatimSpec		SpecialChar
hi def link bplPreCondit			PreCondit
hi def link bplCharacter			Character
hi def link bplSpecialChar		SpecialChar
hi def link bplNumber			Number
hi def link bplUnicodeNumber		SpecialChar
hi def link bplUnicodeSpecifier		SpecialChar

let b:current_syntax = "bpl"

let &cpo = s:bpl_cpo_save
unlet s:bpl_cpo_save

set efm+=%f(%l\\,%c):\ %m

" vim: ts=8