asn.vim 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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: 2012 Oct 05
  6. " quit when a syntax file was already loaded
  7. if exists("b:current_syntax")
  8. finish
  9. endif
  10. let s:cpo_save = &cpo
  11. set cpo&vim
  12. " keyword definitions
  13. syn keyword asnExternal DEFINITIONS BEGIN END IMPORTS EXPORTS FROM
  14. syn match asnExternal "\<IMPLICIT\s\+TAGS\>"
  15. syn match asnExternal "\<EXPLICIT\s\+TAGS\>"
  16. syn keyword asnFieldOption DEFAULT OPTIONAL
  17. syn keyword asnTagModifier IMPLICIT EXPLICIT
  18. syn keyword asnTypeInfo ABSENT PRESENT SIZE UNIVERSAL APPLICATION PRIVATE
  19. syn keyword asnBoolValue TRUE FALSE
  20. syn keyword asnNumber MIN MAX
  21. syn match asnNumber "\<PLUS-INFINITY\>"
  22. syn match asnNumber "\<MINUS-INFINITY\>"
  23. syn keyword asnType INTEGER REAL STRING BIT BOOLEAN OCTET NULL EMBEDDED PDV
  24. syn keyword asnType BMPString IA5String TeletexString GeneralString GraphicString ISO646String NumericString PrintableString T61String UniversalString VideotexString VisibleString
  25. syn keyword asnType ANY DEFINED
  26. syn match asnType "\.\.\."
  27. syn match asnType "OBJECT\s\+IDENTIFIER"
  28. syn match asnType "TYPE-IDENTIFIER"
  29. syn keyword asnType UTF8String
  30. syn keyword asnStructure CHOICE SEQUENCE SET OF ENUMERATED CONSTRAINED BY WITH COMPONENTS CLASS
  31. " Strings and constants
  32. syn match asnSpecial contained "\\\d\d\d\|\\."
  33. syn region asnString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=asnSpecial
  34. syn match asnCharacter "'[^\\]'"
  35. syn match asnSpecialCharacter "'\\.'"
  36. syn match asnNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
  37. syn match asnLineComment "--.*"
  38. syn match asnLineComment "--.*--"
  39. syn match asnDefinition "^\s*[a-zA-Z][-a-zA-Z0-9_.\[\] \t{}]* *::="me=e-3 contains=asnType
  40. syn match asnBraces "[{}]"
  41. syn sync ccomment asnComment
  42. " Define the default highlighting.
  43. " Only when an item doesn't have highlighting yet
  44. hi def link asnDefinition Function
  45. hi def link asnBraces Function
  46. hi def link asnStructure Statement
  47. hi def link asnBoolValue Boolean
  48. hi def link asnSpecial Special
  49. hi def link asnString String
  50. hi def link asnCharacter Character
  51. hi def link asnSpecialCharacter asnSpecial
  52. hi def link asnNumber asnValue
  53. hi def link asnComment Comment
  54. hi def link asnLineComment asnComment
  55. hi def link asnType Type
  56. hi def link asnTypeInfo PreProc
  57. hi def link asnValue Number
  58. hi def link asnExternal Include
  59. hi def link asnTagModifier Function
  60. hi def link asnFieldOption Type
  61. let &cpo = s:cpo_save
  62. unlet s:cpo_save
  63. let b:current_syntax = "asn"
  64. " vim: ts=8