xref: /vim-8.2.3635/runtime/syntax/asn.vim (revision cb03397a)
1" Vim syntax file
2" Language:	ASN.1
3" Maintainer:	Claudio Fleiner <[email protected]>
4" URL:		http://www.fleiner.com/vim/syntax/asn.vim
5" Last Change:	2012 Oct 05
6
7" For version 5.x: Clear all syntax items
8" For version 6.x: Quit when a syntax file was already loaded
9if version < 600
10  syntax clear
11elseif exists("b:current_syntax")
12  finish
13endif
14
15let s:cpo_save = &cpo
16set cpo&vim
17
18" keyword definitions
19syn keyword asnExternal		DEFINITIONS BEGIN END IMPORTS EXPORTS FROM
20syn match   asnExternal		"\<IMPLICIT\s\+TAGS\>"
21syn match   asnExternal		"\<EXPLICIT\s\+TAGS\>"
22syn keyword asnFieldOption	DEFAULT OPTIONAL
23syn keyword asnTagModifier	IMPLICIT EXPLICIT
24syn keyword asnTypeInfo		ABSENT PRESENT SIZE UNIVERSAL APPLICATION PRIVATE
25syn keyword asnBoolValue	TRUE FALSE
26syn keyword asnNumber		MIN MAX
27syn match   asnNumber		"\<PLUS-INFINITY\>"
28syn match   asnNumber		"\<MINUS-INFINITY\>"
29syn keyword asnType		INTEGER REAL STRING BIT BOOLEAN OCTET NULL EMBEDDED PDV
30syn keyword asnType		BMPString IA5String TeletexString GeneralString GraphicString ISO646String NumericString PrintableString T61String UniversalString VideotexString VisibleString
31syn keyword asnType		ANY DEFINED
32syn match   asnType		"\.\.\."
33syn match   asnType		"OBJECT\s\+IDENTIFIER"
34syn match   asnType		"TYPE-IDENTIFIER"
35syn keyword asnType		UTF8String
36syn keyword asnStructure	CHOICE SEQUENCE SET OF ENUMERATED CONSTRAINED BY WITH COMPONENTS CLASS
37
38" Strings and constants
39syn match   asnSpecial		contained "\\\d\d\d\|\\."
40syn region  asnString		start=+"+  skip=+\\\\\|\\"+  end=+"+  contains=asnSpecial
41syn match   asnCharacter	"'[^\\]'"
42syn match   asnSpecialCharacter "'\\.'"
43syn match   asnNumber		"-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
44syn match   asnLineComment	"--.*"
45syn match   asnLineComment	"--.*--"
46
47syn match asnDefinition "^\s*[a-zA-Z][-a-zA-Z0-9_.\[\] \t{}]* *::="me=e-3 contains=asnType
48syn match asnBraces     "[{}]"
49
50syn 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
55if 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
80endif
81
82let &cpo = s:cpo_save
83unlet s:cpo_save
84let b:current_syntax = "asn"
85
86" vim: ts=8
87