neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

b.vim (4902B)


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