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