annotate runtime/syntax/b.vim @ 9:6a13985590e6

*** empty log message ***
author axmo
date Fri, 29 Aug 2008 15:41:29 +0900
parents 76efa0be13f1
children e170173ecb68
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
1 " Vim syntax file
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
2 " Language: B (A Formal Method with refinement and mathematical proof)
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
3 " Maintainer: Mathieu Clabaut <mathieu.clabaut@free.fr>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
4 " LastChange: 25 Apr 2001
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
5
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
6
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
7 " For version 5.x: Clear all syntax items
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
8 " For version 6.x: Quit when a syntax file was already loaded
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
9 if version < 600
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
10 syntax clear
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
11 elseif exists("b:current_syntax")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
12 finish
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
13 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
14
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
15
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
16 " A bunch of useful B keywords
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
17 syn keyword bStatement MACHINE SEES OPERATIONS INCLUDES DEFINITIONS CONSTRAINTS CONSTANTS VARIABLES CONCRETE_CONSTANTS CONCRETE_VARIABLES ABSTRACT_CONSTANTS ABSTRACT_VARIABLES HIDDEN_CONSTANTS HIDDEN_VARIABLES ASSERT ASSERTIONS EXTENDS IMPLEMENTATION REFINEMENT IMPORTS USES INITIALISATION INVARIANT PROMOTES PROPERTIES REFINES SETS VALUES VARIANT VISIBLE_CONSTANTS VISIBLE_VARIABLES THEORY
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
18 syn keyword bLabel CASE IN EITHER OR CHOICE DO OF
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
19 syn keyword bConditional IF ELSE SELECT ELSIF THEN WHEN
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
20 syn keyword bRepeat WHILE FOR
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
21 syn keyword bOps bool card conc closure closure1 dom first fnc front not or id inter iseq iseq1 iterate last max min mod perm pred prj1 prj2 ran rel rev seq seq1 size skip succ tail union
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
22 syn keyword bKeywords LET VAR BE IN BEGIN END POW POW1 FIN FIN1 PRE SIGMA STRING UNION IS ANY WHERE
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
23 syn match bKeywords "||"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
24
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
25 syn keyword bBoolean TRUE FALSE bfalse btrue
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
26 syn keyword bConstant PI MAXINT MININT User_Pass PatchProver PatchProverH0 PatchProverB0 FLAT ARI DED SUB RES
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
27 syn keyword bGuard binhyp band bnot bguard bsearch bflat bfresh bguardi bget bgethyp barith bgetresult bresult bgoal bmatch bmodr bnewv bnum btest bpattern bprintf bwritef bsubfrm bvrb blvar bcall bappend bclose
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
28
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
29 syn keyword bLogic or not
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
30 syn match bLogic "\&\|=>\|<=>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
31
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
32 syn keyword cTodo contained TODO FIXME XXX
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
33
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
34 " String and Character constants
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
35 " Highlight special characters (those which have a backslash) differently
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
36 syn match bSpecial contained "\\[0-7][0-7][0-7]\=\|\\."
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
37 syn region bString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=bSpecial
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
38 syn match bCharacter "'[^\\]'"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
39 syn match bSpecialCharacter "'\\.'"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
40 syn match bSpecialCharacter "'\\[0-7][0-7]'"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
41 syn match bSpecialCharacter "'\\[0-7][0-7][0-7]'"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
42
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
43 "catch errors caused by wrong parenthesis
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
44 syn region bParen transparent start='(' end=')' contains=ALLBUT,bParenError,bIncluded,bSpecial,bTodo,bUserLabel,bBitField
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
45 syn match bParenError ")"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
46 syn match bInParen contained "[{}]"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
47
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
48 "integer number, or floating point number without a dot and with "f".
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
49 syn case ignore
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
50 syn match bNumber "\<[0-9]\+\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
51 "syn match bIdentifier "\<[a-z_][a-z0-9_]*\>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
52 syn case match
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
53
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
54 if exists("b_comment_strings")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
55 " A comment can contain bString, bCharacter and bNumber.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
56 " But a "*/" inside a bString in a bComment DOES end the comment! So we
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
57 " need to use a special type of bString: bCommentString, which also ends on
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
58 " "*/", and sees a "*" at the start of the line as comment again.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
59 " Unfortunately this doesn't very well work for // type of comments :-(
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
60 syntax match bCommentSkip contained "^\s*\*\($\|\s\+\)"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
61 syntax region bCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=bSpecial,bCommentSkip
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
62 syntax region bComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=bSpecial
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
63 syntax region bComment start="/\*" end="\*/" contains=bTodo,bCommentString,bCharacter,bNumber,bFloat
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
64 syntax region bComment start="/\?\*" end="\*\?/" contains=bTodo,bCommentString,bCharacter,bNumber,bFloat
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
65 syntax match bComment "//.*" contains=bTodo,bComment2String,bCharacter,bNumber
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
66 else
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
67 syn region bComment start="/\*" end="\*/" contains=bTodo
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
68 syn region bComment start="/\?\*" end="\*\?/" contains=bTodo
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
69 syn match bComment "//.*" contains=bTodo
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
70 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
71 syntax match bCommentError "\*/"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
72
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
73 syn keyword bType INT INTEGER BOOL NAT NATURAL NAT1 NATURAL1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
74
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
75 syn region bPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=bComment,bString,bCharacter,bNumber,bCommentError
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
76 syn region bIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
77 syn match bIncluded contained "<[^>]*>"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
78 syn match bInclude "^\s*#\s*include\>\s*["<]" contains=bIncluded
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
79
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
80 syn region bDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,bPreCondit,bIncluded,bInclude,bDefine,bInParen
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
81 syn region bPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,bPreCondit,bIncluded,bInclude,bDefine,bInParen
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
82
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
83
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
84 syn sync ccomment bComment minlines=10
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
85
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
86 " Define the default highlighting.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
87 " For version 5.7 and earlier: only when not done already
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
88 " For version 5.8 and later: only when an item doesn't have highlighting yet
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
89
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
90 if version >= 508 || !exists("did_b_syntax_inits")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
91 if version < 508
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
92 let did_b_syntax_inits = 1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
93 command -nargs=+ HiLink hi link <args>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
94 else
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
95 command -nargs=+ HiLink hi def link <args>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
96 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
97
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
98 " The default methods for highlighting. Can be overridden later
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
99 HiLink bLabel Label
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
100 HiLink bUserLabel Label
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
101 HiLink bConditional Conditional
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
102 HiLink bRepeat Repeat
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
103 HiLink bLogic Special
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
104 HiLink bCharacter Character
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
105 HiLink bSpecialCharacter bSpecial
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
106 HiLink bNumber Number
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
107 HiLink bFloat Float
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
108 HiLink bOctalError bError
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
109 HiLink bParenError bError
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
110 " HiLink bInParen bError
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
111 HiLink bCommentError bError
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
112 HiLink bBoolean Identifier
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
113 HiLink bConstant Identifier
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
114 HiLink bGuard Identifier
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
115 HiLink bOperator Operator
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
116 HiLink bKeywords Operator
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
117 HiLink bOps Identifier
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
118 HiLink bStructure Structure
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
119 HiLink bStorageClass StorageClass
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
120 HiLink bInclude Include
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
121 HiLink bPreProc PreProc
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
122 HiLink bDefine Macro
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
123 HiLink bIncluded bString
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
124 HiLink bError Error
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
125 HiLink bStatement Statement
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
126 HiLink bPreCondit PreCondit
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
127 HiLink bType Type
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
128 HiLink bCommentError bError
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
129 HiLink bCommentString bString
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
130 HiLink bComment2String bString
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
131 HiLink bCommentSkip bComment
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
132 HiLink bString String
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
133 HiLink bComment Comment
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
134 HiLink bSpecial SpecialChar
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
135 HiLink bTodo Todo
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
136 "hi link bIdentifier Identifier
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
137 delcommand HiLink
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
138 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
139
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
140 let b:current_syntax = "b"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
141
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
142 " vim: ts=8