Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: ASN.1 |
| 3 | " Maintainer: Claudio Fleiner <claudio@fleiner.com> |
| 4 | " URL: http://www.fleiner.com/vim/syntax/asn.vim |
| 5 | " Last Change: 2001 Apr 26 |
| 6 | |
| 7 | " For version 5.x: Clear all syntax items |
| 8 | " For version 6.x: Quit when a syntax file was already loaded |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | " keyword definitions |
| 16 | syn keyword asnExternal DEFINITIONS BEGIN END IMPORTS EXPORTS FROM |
| 17 | syn match asnExternal "\<IMPLICIT\s\+TAGS\>" |
| 18 | syn match asnExternal "\<EXPLICIT\s\+TAGS\>" |
| 19 | syn keyword asnFieldOption DEFAULT OPTIONAL |
| 20 | syn keyword asnTagModifier IMPLICIT EXPLICIT |
| 21 | syn keyword asnTypeInfo ABSENT PRESENT SIZE UNIVERSAL APPLICATION PRIVATE |
| 22 | syn keyword asnBoolValue TRUE FALSE |
| 23 | syn keyword asnNumber MIN MAX |
| 24 | syn match asnNumber "\<PLUS-INFINITY\>" |
| 25 | syn match asnNumber "\<MINUS-INFINITY\>" |
| 26 | syn keyword asnType INTEGER REAL STRING BIT BOOLEAN OCTET NULL EMBEDDED PDV |
| 27 | syn keyword asnType BMPString IA5String TeletexString GeneralString GraphicString ISO646String NumericString PrintableString T61String UniversalString VideotexString VisibleString |
| 28 | syn keyword asnType ANY DEFINED |
| 29 | syn match asnType "\.\.\." |
| 30 | syn match asnType "OBJECT\s\+IDENTIFIER" |
| 31 | syn match asnType "TYPE-IDENTIFIER" |
| 32 | syn keyword asnType UTF8String |
| 33 | syn keyword asnStructure CHOICE SEQUENCE SET OF ENUMERATED CONSTRAINED BY WITH COMPONENTS CLASS |
| 34 | |
| 35 | " Strings and constants |
| 36 | syn match asnSpecial contained "\\\d\d\d\|\\." |
| 37 | syn region asnString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=asnSpecial |
| 38 | syn match asnCharacter "'[^\\]'" |
| 39 | syn match asnSpecialCharacter "'\\.'" |
| 40 | syn match asnNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>" |
| 41 | syn match asnLineComment "--.*" |
| 42 | syn match asnLineComment "--.*--" |
| 43 | |
| 44 | syn match asnDefinition "^\s*[a-zA-Z][-a-zA-Z0-9_.\[\] \t{}]* *::="me=e-3 contains=asnType |
| 45 | syn match asnBraces "[{}]" |
| 46 | |
| 47 | syn sync ccomment asnComment |
| 48 | |
| 49 | " Define the default highlighting. |
| 50 | " For version 5.7 and earlier: only when not done already |
| 51 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 52 | if version >= 508 || !exists("did_asn_syn_inits") |
| 53 | if version < 508 |
| 54 | let did_asn_syn_inits = 1 |
| 55 | command -nargs=+ HiLink hi link <args> |
| 56 | else |
| 57 | command -nargs=+ HiLink hi def link <args> |
| 58 | endif |
| 59 | HiLink asnDefinition Function |
| 60 | HiLink asnBraces Function |
| 61 | HiLink asnStructure Statement |
| 62 | HiLink asnBoolValue Boolean |
| 63 | HiLink asnSpecial Special |
| 64 | HiLink asnString String |
| 65 | HiLink asnCharacter Character |
| 66 | HiLink asnSpecialCharacter asnSpecial |
| 67 | HiLink asnNumber asnValue |
| 68 | HiLink asnComment Comment |
| 69 | HiLink asnLineComment asnComment |
| 70 | HiLink asnType Type |
| 71 | HiLink asnTypeInfo PreProc |
| 72 | HiLink asnValue Number |
| 73 | HiLink asnExternal Include |
| 74 | HiLink asnTagModifier Function |
| 75 | HiLink asnFieldOption Type |
| 76 | delcommand HiLink |
| 77 | endif |
| 78 | |
| 79 | let b:current_syntax = "asn" |
| 80 | |
| 81 | " vim: ts=8 |