1" Vim syntax file 2" Language: B (A Formal Method with refinement and mathematical proof) 3" Maintainer: Mathieu Clabaut <[email protected]> 4" Contributor: Csaba Hoch 5" LastChange: 8 Dec 2007 6 7 8" quit when a syntax file was already loaded 9if exists("b:current_syntax") 10 finish 11endif 12 13 14" A bunch of useful B keywords 15syn keyword bStatement MACHINE MODEL 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 XLS THEOREMS LOCAL_OPERATIONS 16syn keyword bLabel CASE IN EITHER OR CHOICE DO OF 17syn keyword bConditional IF ELSE SELECT ELSIF THEN WHEN 18syn keyword bRepeat WHILE FOR 19syn 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 20syn keyword bKeywords LET VAR BE IN BEGIN END POW POW1 FIN FIN1 PRE SIGMA STRING UNION IS ANY WHERE 21 22syn keyword bBoolean TRUE FALSE bfalse btrue 23syn keyword bConstant PI MAXINT MININT User_Pass PatchProver PatchProverH0 PatchProverB0 FLAT ARI DED SUB RES 24syn 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 25 26syn keyword bLogic or not 27syn match bLogic "\(!\|#\|%\|&\|+->>\|+->\|-->>\|->>\|-->\|->\|/:\|/<:\|/<<:\|/=\|/\\\|/|\\\|::\|:\|;:\|<+\|<->\|<--\|<-\|<:\|<<:\|<<|\|<=>\|<|\|==\|=>\|>+>>\|>->\|>+>\|||\||->\)" 28syn match bNothing /:=/ 29 30syn keyword cTodo contained TODO FIXME XXX 31 32" String and Character constants 33" Highlight special characters (those which have a backslash) differently 34syn match bSpecial contained "\\[0-7][0-7][0-7]\=\|\\." 35syn region bString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=bSpecial 36syn match bCharacter "'[^\\]'" 37syn match bSpecialCharacter "'\\.'" 38syn match bSpecialCharacter "'\\[0-7][0-7]'" 39syn match bSpecialCharacter "'\\[0-7][0-7][0-7]'" 40 41"catch errors caused by wrong parenthesis 42syn region bParen transparent start='(' end=')' contains=ALLBUT,bParenError,bIncluded,bSpecial,bTodo,bUserLabel,bBitField 43syn match bParenError ")" 44syn match bInParen contained "[{}]" 45 46"integer number, or floating point number without a dot and with "f". 47syn case ignore 48syn match bNumber "\<[0-9]\+\>" 49"syn match bIdentifier "\<[a-z_][a-z0-9_]*\>" 50syn case match 51 52 syn region bComment start="/\*" end="\*/" contains=bTodo 53 syn match bComment "//.*" contains=bTodo 54syntax match bCommentError "\*/" 55 56syn keyword bType INT INTEGER BOOL NAT NATURAL NAT1 NATURAL1 57 58syn region bPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=bComment,bString,bCharacter,bNumber,bCommentError 59syn region bIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ 60syn match bIncluded contained "<[^>]*>" 61syn match bInclude "^\s*#\s*include\>\s*["<]" contains=bIncluded 62 63syn region bDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,bPreCondit,bIncluded,bInclude,bDefine,bInParen 64syn region bPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,bPreCondit,bIncluded,bInclude,bDefine,bInParen 65 66syn sync ccomment bComment minlines=10 67 68" Define the default highlighting. 69" Only when an item doesn't have highlighting yet 70 71 72" The default methods for highlighting. Can be overridden later 73hi def link bLabel Label 74hi def link bUserLabel Label 75hi def link bConditional Conditional 76hi def link bRepeat Repeat 77hi def link bLogic Special 78hi def link bCharacter Character 79hi def link bSpecialCharacter bSpecial 80hi def link bNumber Number 81hi def link bFloat Float 82hi def link bOctalError bError 83hi def link bParenError bError 84" hi def link bInParen bError 85hi def link bCommentError bError 86hi def link bBoolean Identifier 87hi def link bConstant Identifier 88hi def link bGuard Identifier 89hi def link bOperator Operator 90hi def link bKeywords Operator 91hi def link bOps Identifier 92hi def link bStructure Structure 93hi def link bStorageClass StorageClass 94hi def link bInclude Include 95hi def link bPreProc PreProc 96hi def link bDefine Macro 97hi def link bIncluded bString 98hi def link bError Error 99hi def link bStatement Statement 100hi def link bPreCondit PreCondit 101hi def link bType Type 102hi def link bCommentError bError 103hi def link bCommentString bString 104hi def link bComment2String bString 105hi def link bCommentSkip bComment 106hi def link bString String 107hi def link bComment Comment 108hi def link bSpecial SpecialChar 109hi def link bTodo Todo 110"hi link bIdentifier Identifier 111 112let b:current_syntax = "b" 113 114" vim: ts=8 115