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