neovim

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

msmessages.vim (6318B)


      1 " Vim syntax file
      2 " Language:	MS Message Text files (*.mc)
      3 " Maintainer:	Kevin Locke <kwl7@cornell.edu>
      4 " Last Change:	2008 April 09
      5 " Location:	http://kevinlocke.name/programs/vim/syntax/msmessages.vim
      6 
      7 " See format description at <http://msdn2.microsoft.com/en-us/library/aa385646.aspx>
      8 " This file is based on the rc.vim and c.vim
      9 
     10 " quit when a syntax file was already loaded
     11 if exists("b:current_syntax")
     12  finish
     13 endif
     14 
     15 " Common MS Messages keywords
     16 syn case ignore
     17 syn keyword msmessagesIdentifier MessageIdTypedef
     18 syn keyword msmessagesIdentifier SeverityNames
     19 syn keyword msmessagesIdentifier FacilityNames
     20 syn keyword msmessagesIdentifier LanguageNames
     21 syn keyword msmessagesIdentifier OutputBase
     22 
     23 syn keyword msmessagesIdentifier MessageId
     24 syn keyword msmessagesIdentifier Severity
     25 syn keyword msmessagesIdentifier Facility
     26 syn keyword msmessagesIdentifier OutputBase
     27 
     28 syn match msmessagesIdentifier /\<SymbolicName\>/ nextgroup=msmessagesIdentEq skipwhite
     29 syn match msmessagesIdentEq transparent /=/ nextgroup=msmessagesIdentDef skipwhite contained
     30 syn match msmessagesIdentDef display /\w\+/ contained
     31 " Note:  The Language keyword is highlighted as part of an msmessagesLangEntry
     32 
     33 " Set value
     34 syn case match
     35 syn region msmessagesSet	start="(" end=")" transparent fold contains=msmessagesName keepend
     36 syn match msmessagesName /\w\+/ nextgroup=msmessagesSetEquals skipwhite contained
     37 syn match msmessagesSetEquals /=/ display transparent nextgroup=msmessagesNumVal skipwhite contained
     38 syn match msmessagesNumVal	display transparent "\<\d\|\.\d" contains=msmessagesNumber,msmessagesFloat,msmessagesOctalError,msmessagesOctal nextgroup=msmessagesValSep
     39 syn match msmessagesValSep /:/ display nextgroup=msmessagesNameDef contained
     40 syn match msmessagesNameDef /\w\+/ display contained
     41 
     42 
     43 " Comments are converted to C source (by removing leading ;)
     44 " So we highlight the comments as C
     45 syn include @msmessagesC syntax/c.vim
     46 unlet b:current_syntax
     47 syn region msmessagesCComment matchgroup=msmessagesComment start=/;/ end=/$/ contains=@msmessagesC keepend
     48 
     49 " String and Character constants
     50 " Highlight special characters (those which have a escape) differently
     51 syn case ignore
     52 syn region msmessagesLangEntry start=/\<Language\>\s*=\s*\S\+\s*$/hs=e+1 end=/^\./ contains=msmessagesFormat,msmessagesLangEntryEnd,msmessagesLanguage keepend
     53 syn match msmessagesLanguage /\<Language\(\s*=\)\@=/ contained
     54 syn match msmessagesLangEntryEnd display /^\./ contained
     55 syn case match
     56 syn match msmessagesFormat display	/%[1-9]\d\?\(![-+0 #]*\d*\(\.\d\+\)\?\(h\|l\|ll\|I\|I32\|I64\)\?[aAcCdeEfgGinopsSuxX]!\)\?/ contained
     57 syn match msmessagesFormat display	/%[0.%\\br]/ contained
     58 syn match msmessagesFormat display	/%!\(\s\)\@=/ contained
     59 
     60 " Integer number, or floating point number without a dot and with "f".
     61 " Copied from c.vim
     62 syn case ignore
     63 "(long) integer
     64 syn match msmessagesNumber	display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
     65 "hex number
     66 syn match msmessagesNumber	display contained "\<0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
     67 " Flag the first zero of an octal number as something special
     68 syn match msmessagesOctal	display contained "\<0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=msmessagesOctalZero
     69 syn match msmessagesOctalZero	display contained "\<0"
     70 " flag an octal number with wrong digits
     71 syn match msmessagesOctalError	display contained "\<0\o*[89]\d*"
     72 syn match msmessagesFloat	display contained "\d\+f"
     73 "floating point number, with dot, optional exponent
     74 syn match msmessagesFloat	display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
     75 "floating point number, starting with a dot, optional exponent
     76 syn match msmessagesFloat	display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
     77 "floating point number, without dot, with exponent
     78 syn match msmessagesFloat	display contained "\d\+e[-+]\=\d\+[fl]\=\>"
     79 "hexadecimal floating point number, optional leading digits, with dot, with exponent
     80 syn match msmessagesFloat	display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
     81 "hexadecimal floating point number, with leading digits, optional dot, with exponent
     82 syn match msmessagesFloat	display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
     83 
     84 " Types (used in MessageIdTypedef statement)
     85 syn case match
     86 syn keyword msmessagesType	int long short char
     87 syn keyword msmessagesType	signed unsigned
     88 syn keyword msmessagesType	size_t ssize_t sig_atomic_t
     89 syn keyword msmessagesType	int8_t int16_t int32_t int64_t
     90 syn keyword msmessagesType	uint8_t uint16_t uint32_t uint64_t
     91 syn keyword msmessagesType	int_least8_t int_least16_t int_least32_t int_least64_t
     92 syn keyword msmessagesType	uint_least8_t uint_least16_t uint_least32_t uint_least64_t
     93 syn keyword msmessagesType	int_fast8_t int_fast16_t int_fast32_t int_fast64_t
     94 syn keyword msmessagesType	uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
     95 syn keyword msmessagesType	intptr_t uintptr_t
     96 syn keyword msmessagesType	intmax_t uintmax_t
     97 " Add some Windows datatypes that will be common in msmessages files
     98 syn keyword msmessagesType	BYTE CHAR SHORT SIZE_T SSIZE_T TBYTE TCHAR UCHAR USHORT
     99 syn keyword msmessagesType	DWORD DWORDLONG DWORD32 DWORD64
    100 syn keyword msmessagesType	INT INT32 INT64 UINT UINT32 UINT64
    101 syn keyword msmessagesType	LONG LONGLONG LONG32 LONG64
    102 syn keyword msmessagesType	ULONG ULONGLONG ULONG32 ULONG64
    103 
    104 " Sync to language entries, since they should be most common
    105 syn sync match msmessagesLangSync grouphere msmessagesLangEntry "\<Language\s*="
    106 syn sync match msmessagesLangEndSync grouphere NONE "^\."
    107 
    108 " Define the default highlighting.
    109 hi def link msmessagesNumber		Number
    110 hi def link msmessagesOctal		Number
    111 hi def link msmessagesFloat		Float
    112 hi def link msmessagesOctalError	msmessagesError
    113 hi def link msmessagesSetError		msmessagesError
    114 hi def link msmessagesError		Error
    115 hi def link msmessagesLangEntry		String
    116 hi def link msmessagesLangEntryEnd	Special
    117 hi def link msmessagesComment		Comment
    118 hi def link msmessagesFormat		msmessagesSpecial
    119 hi def link msmessagesSpecial		SpecialChar
    120 
    121 hi def link msmessagesType		Type
    122 hi def link msmessagesIdentifier	Identifier
    123 hi def link msmessagesLanguage		msmessagesIdentifier
    124 hi def link msmessagesName		msmessagesIdentifier
    125 hi def link msmessagesNameDef		Macro
    126 hi def link msmessagesIdentDef		Macro
    127 hi def link msmessagesValSep		Special
    128 hi def link msmessagesNameErr		Error
    129 
    130 let b:current_syntax = "msmessages"
    131 
    132 " vim: ts=8