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 |
Bram Moolenaar | 0c5fa7d | 2012-10-05 22:26:30 +0200 | [diff] [blame] | 5 | " Last Change: 2012 Oct 05 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 7 | " quit when a syntax file was already loaded |
| 8 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 9 | finish |
| 10 | endif |
| 11 | |
Bram Moolenaar | 0c5fa7d | 2012-10-05 22:26:30 +0200 | [diff] [blame] | 12 | let s:cpo_save = &cpo |
| 13 | set cpo&vim |
| 14 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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. |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 50 | " Only when an item doesn't have highlighting yet |
| 51 | command -nargs=+ HiLink hi def link <args> |
| 52 | HiLink asnDefinition Function |
| 53 | HiLink asnBraces Function |
| 54 | HiLink asnStructure Statement |
| 55 | HiLink asnBoolValue Boolean |
| 56 | HiLink asnSpecial Special |
| 57 | HiLink asnString String |
| 58 | HiLink asnCharacter Character |
| 59 | HiLink asnSpecialCharacter asnSpecial |
| 60 | HiLink asnNumber asnValue |
| 61 | HiLink asnComment Comment |
| 62 | HiLink asnLineComment asnComment |
| 63 | HiLink asnType Type |
| 64 | HiLink asnTypeInfo PreProc |
| 65 | HiLink asnValue Number |
| 66 | HiLink asnExternal Include |
| 67 | HiLink asnTagModifier Function |
| 68 | HiLink asnFieldOption Type |
| 69 | delcommand HiLink |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 70 | |
Bram Moolenaar | 0c5fa7d | 2012-10-05 22:26:30 +0200 | [diff] [blame] | 71 | let &cpo = s:cpo_save |
| 72 | unlet s:cpo_save |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 73 | let b:current_syntax = "asn" |
| 74 | |
| 75 | " vim: ts=8 |