dylan.vim 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. " Vim syntax file
  2. " Language: Dylan
  3. " Authors: Justus Pendleton <justus@acm.org>
  4. " Brent A. Fulgham <bfulgham@debian.org>
  5. " Last Change: Fri Sep 29 13:45:55 PDT 2000
  6. "
  7. " This syntax file is based on the Haskell, Perl, Scheme, and C
  8. " syntax files.
  9. " Part 1: Syntax definition
  10. " quit when a syntax file was already loaded
  11. if exists("b:current_syntax")
  12. finish
  13. endif
  14. syn case ignore
  15. setlocal lisp
  16. " Highlight special characters (those that have backslashes) differently
  17. syn match dylanSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
  18. " Keywords
  19. syn keyword dylanBlock afterwards begin block cleanup end
  20. syn keyword dylanClassMods abstract concrete primary inherited virtual
  21. syn keyword dylanException exception handler signal
  22. syn keyword dylanParamDefs method class function library macro interface
  23. syn keyword dylanSimpleDefs constant variable generic primary
  24. syn keyword dylanOther above below from by in instance local slot subclass then to
  25. syn keyword dylanConditional if when select case else elseif unless finally otherwise then
  26. syn keyword dylanRepeat begin for until while from to
  27. syn keyword dylanStatement define let
  28. syn keyword dylanImport use import export exclude rename create
  29. syn keyword dylanMiscMods open sealed domain singleton sideways inline functional
  30. " Matching rules for special forms
  31. syn match dylanOperator "\s[-!%&\*\+/=\?@\\^|~:]\+[-#!>%&:\*\+/=\?@\\^|~]*"
  32. syn match dylanOperator "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./=\?@\\^|~:]*"
  33. " Numbers
  34. syn match dylanNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
  35. syn match dylanNumber "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
  36. " Booleans
  37. syn match dylanBoolean "#t\|#f"
  38. " Comments
  39. syn match dylanComment "//.*"
  40. syn region dylanComment start="/\*" end="\*/"
  41. " Strings
  42. syn region dylanString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=dySpecial
  43. syn match dylanCharacter "'[^\\]'"
  44. " Constants, classes, and variables
  45. syn match dylanConstant "$\<[a-zA-Z0-9\-]\+\>"
  46. syn match dylanClass "<\<[a-zA-Z0-9\-]\+\>>"
  47. syn match dylanVariable "\*\<[a-zA-Z0-9\-]\+\>\*"
  48. " Preconditions
  49. syn region dylanPrecondit start="^\s*#\s*\(if\>\|else\>\|endif\>\)" skip="\\$" end="$"
  50. " These appear at the top of files (usually). I like to highlight the whole line
  51. " so that the definition stands out. They should probably really be keywords, but they
  52. " don't generally appear in the middle of a line of code.
  53. syn region dylanHeader start="^[Mm]odule:" end="^$"
  54. " Define the default highlighting.
  55. " Only when an item doesn't have highlighting yet
  56. hi def link dylanBlock PreProc
  57. hi def link dylanBoolean Boolean
  58. hi def link dylanCharacter Character
  59. hi def link dylanClass Structure
  60. hi def link dylanClassMods StorageClass
  61. hi def link dylanComment Comment
  62. hi def link dylanConditional Conditional
  63. hi def link dylanConstant Constant
  64. hi def link dylanException Exception
  65. hi def link dylanHeader Macro
  66. hi def link dylanImport Include
  67. hi def link dylanLabel Label
  68. hi def link dylanMiscMods StorageClass
  69. hi def link dylanNumber Number
  70. hi def link dylanOther Keyword
  71. hi def link dylanOperator Operator
  72. hi def link dylanParamDefs Keyword
  73. hi def link dylanPrecondit PreCondit
  74. hi def link dylanRepeat Repeat
  75. hi def link dylanSimpleDefs Keyword
  76. hi def link dylanStatement Macro
  77. hi def link dylanString String
  78. hi def link dylanVariable Identifier
  79. let b:current_syntax = "dylan"
  80. " vim:ts=8