icon.vim 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. " Vim syntax file
  2. " Language: Icon
  3. " Maintainer: Wendell Turner <wendell@adsi-m4.com>
  4. " URL: ftp://ftp.halcyon.com/pub/users/wturner/icon.vim
  5. " Last Change: 2003 May 11
  6. " quit when a syntax file was already loaded
  7. if exists("b:current_syntax")
  8. finish
  9. endif
  10. syn keyword iconFunction abs acos any args asin atan bal
  11. syn keyword iconFunction callout center char chdir close collect copy
  12. syn keyword iconFunction cos cset delay delete detab display dtor
  13. syn keyword iconFunction entab errorclear exit exp find flush function
  14. syn keyword iconFunction get getch getche getenv iand icom image
  15. syn keyword iconFunction insert integer ior ishift ixor kbhit key
  16. syn keyword iconFunction left list loadfunc log many map match
  17. syn keyword iconFunction member move name numeric open ord pop
  18. syn keyword iconFunction pos proc pull push put read reads
  19. syn keyword iconFunction real remove rename repl reverse right rtod
  20. syn keyword iconFunction runerr save seek seq set sin sort
  21. syn keyword iconFunction sortf sqrt stop string system tab table
  22. syn keyword iconFunction tan trim type upto variable where write writes
  23. " Keywords
  24. syn match iconKeyword "&allocated"
  25. syn match iconKeyword "&ascii"
  26. syn match iconKeyword "&clock"
  27. syn match iconKeyword "&collections"
  28. syn match iconKeyword "&cset"
  29. syn match iconKeyword "&current"
  30. syn match iconKeyword "&date"
  31. syn match iconKeyword "&dateline"
  32. syn match iconKeyword "&digits"
  33. syn match iconKeyword "&dump"
  34. syn match iconKeyword "&e"
  35. syn match iconKeyword "&error"
  36. syn match iconKeyword "&errornumber"
  37. syn match iconKeyword "&errortext"
  38. syn match iconKeyword "&errorvalue"
  39. syn match iconKeyword "&errout"
  40. syn match iconKeyword "&fail"
  41. syn match iconKeyword "&features"
  42. syn match iconKeyword "&file"
  43. syn match iconKeyword "&host"
  44. syn match iconKeyword "&input"
  45. syn match iconKeyword "&lcase"
  46. syn match iconKeyword "&letters"
  47. syn match iconKeyword "&level"
  48. syn match iconKeyword "&line"
  49. syn match iconKeyword "&main"
  50. syn match iconKeyword "&null"
  51. syn match iconKeyword "&output"
  52. syn match iconKeyword "&phi"
  53. syn match iconKeyword "&pi"
  54. syn match iconKeyword "&pos"
  55. syn match iconKeyword "&progname"
  56. syn match iconKeyword "&random"
  57. syn match iconKeyword "&regions"
  58. syn match iconKeyword "&source"
  59. syn match iconKeyword "&storage"
  60. syn match iconKeyword "&subject"
  61. syn match iconKeyword "&time"
  62. syn match iconKeyword "&trace"
  63. syn match iconKeyword "&ucase"
  64. syn match iconKeyword "&version"
  65. " Reserved words
  66. syn keyword iconReserved break by case create default do
  67. syn keyword iconReserved else end every fail if
  68. syn keyword iconReserved initial link next not of
  69. syn keyword iconReserved procedure repeat return suspend
  70. syn keyword iconReserved then to until while
  71. " Storage class reserved words
  72. syn keyword iconStorageClass global static local record
  73. syn keyword iconTodo contained TODO FIXME XXX BUG
  74. " String and Character constants
  75. " Highlight special characters (those which have a backslash) differently
  76. syn match iconSpecial contained "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^c[a-zA-Z0-9]\|\\$"
  77. syn region iconString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconSpecial
  78. syn region iconCset start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconSpecial
  79. syn match iconCharacter "'[^\\]'"
  80. " not sure about these
  81. "syn match iconSpecialCharacter "'\\[bdeflnrtv]'"
  82. "syn match iconSpecialCharacter "'\\\o\{3\}'"
  83. "syn match iconSpecialCharacter "'\\x\x\{2}'"
  84. "syn match iconSpecialCharacter "'\\^c\[a-zA-Z0-9]'"
  85. "when wanted, highlight trailing white space
  86. if exists("icon_space_errors")
  87. syn match iconSpaceError "\s*$"
  88. syn match iconSpaceError " \+\t"me=e-1
  89. endif
  90. "catch errors caused by wrong parenthesis
  91. syn cluster iconParenGroup contains=iconParenError,iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
  92. syn region iconParen transparent start='(' end=')' contains=ALLBUT,@iconParenGroup
  93. syn match iconParenError ")"
  94. syn match iconInParen contained "[{}]"
  95. syn case ignore
  96. "integer number, or floating point number without a dot
  97. syn match iconNumber "\<\d\+\>"
  98. "floating point number, with dot, optional exponent
  99. syn match iconFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=\>"
  100. "floating point number, starting with a dot, optional exponent
  101. syn match iconFloat "\.\d\+\(e[-+]\=\d\+\)\=\>"
  102. "floating point number, without dot, with exponent
  103. syn match iconFloat "\<\d\+e[-+]\=\d\+\>"
  104. "radix number
  105. syn match iconRadix "\<\d\{1,2}[rR][a-zA-Z0-9]\+\>"
  106. " syn match iconIdentifier "\<[a-z_][a-z0-9_]*\>"
  107. syn case match
  108. " Comment
  109. syn match iconComment "#.*" contains=iconTodo,iconSpaceError
  110. syn region iconPreCondit start="^\s*$\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=iconComment,iconString,iconCharacter,iconNumber,iconCommentError,iconSpaceError
  111. syn region iconIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
  112. syn match iconIncluded contained "<[^>]*>"
  113. syn match iconInclude "^\s*$\s*include\>\s*["<]" contains=iconIncluded
  114. "syn match iconLineSkip "\\$"
  115. syn cluster iconPreProcGroup contains=iconPreCondit,iconIncluded,iconInclude,iconDefine,iconInParen,iconUserLabel
  116. syn region iconDefine start="^\s*$\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@iconPreProcGroup
  117. "wt:syn region iconPreProc "start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" "end="$" contains=ALLBUT,@iconPreProcGroup
  118. " Highlight User Labels
  119. " syn cluster iconMultiGroup contains=iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
  120. if !exists("icon_minlines")
  121. let icon_minlines = 15
  122. endif
  123. exec "syn sync ccomment iconComment minlines=" . icon_minlines
  124. " Define the default highlighting.
  125. " Only when an item doesn't have highlighting
  126. " The default methods for highlighting. Can be overridden later
  127. " hi def link iconSpecialCharacter iconSpecial
  128. hi def link iconOctalError iconError
  129. hi def link iconParenError iconError
  130. hi def link iconInParen iconError
  131. hi def link iconCommentError iconError
  132. hi def link iconSpaceError iconError
  133. hi def link iconCommentError iconError
  134. hi def link iconIncluded iconString
  135. hi def link iconCommentString iconString
  136. hi def link iconComment2String iconString
  137. hi def link iconCommentSkip iconComment
  138. hi def link iconUserLabel Label
  139. hi def link iconCharacter Character
  140. hi def link iconNumber Number
  141. hi def link iconRadix Number
  142. hi def link iconFloat Float
  143. hi def link iconInclude Include
  144. hi def link iconPreProc PreProc
  145. hi def link iconDefine Macro
  146. hi def link iconError Error
  147. hi def link iconStatement Statement
  148. hi def link iconPreCondit PreCondit
  149. hi def link iconString String
  150. hi def link iconCset String
  151. hi def link iconComment Comment
  152. hi def link iconSpecial SpecialChar
  153. hi def link iconTodo Todo
  154. hi def link iconStorageClass StorageClass
  155. hi def link iconFunction Statement
  156. hi def link iconReserved Label
  157. hi def link iconKeyword Operator
  158. "hi def link iconIdentifier Identifier
  159. let b:current_syntax = "icon"