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
7 " This syntax file is based on the Haskell, Perl, Scheme, and C
10 " Part 1: Syntax definition
11 " For version 5.x: Clear all syntax items
12 " For version 6.x: Quit when a syntax file was already loaded
15 elseif exists("b:current_syntax")
27 " Highlight special characters (those that have backslashes) differently
28 syn match dylanSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
31 syn keyword dylanUnnamedDefs interface
32 syn keyword dylanNamedDefs library macro
33 syn keyword dylanParamDefs method class function
34 syn keyword dylanBlock cleanup block afterwards end
35 syn keyword dylanSimpleDefs constant variable generic primary
36 syn keyword dylanStatement begin method
37 syn keyword dylanOther above below from by in instance local
38 syn keyword dylanOther slot subclass then to virtual
39 syn keyword dylanConditional if when select case else elseif unless
40 syn keyword dylanConditional finally otherwise then
41 syn keyword dylanRepeat for until while from to
42 syn keyword dylanStatement define let
43 " how to match labels within select and case?
44 " finally is a label for for loops
45 syn keyword dylanLabel otherwise finally
46 " signal is a method, not really a keyword
47 syn keyword dylanException exception handler
48 syn keyword dylanException signal
49 syn keyword dylanImport import rename create
50 syn keyword dylanPreProc use export exclude
51 syn keyword dylanClassMods abstract concrete primary inherited
52 syn keyword dylanMethMods inline
53 syn keyword dylanMiscMods open sealed domain singleton
55 " Matching rules for special forms
56 syn match dylanOperator "\s[-!%&\*\+/=\?@\\^|~.]\=[-!%&\*\+=\?@\\^|~:.]\=[->!%&\*\+=\?@\\^|~:.]"
57 syn match dylanOperator "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./=\?@\\^|~:]*"
59 syn match dylanNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
60 syn match dylanNumber "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
62 syn match dylanBoolean "#t\|#f"
64 syn match dylanComment "//.*"
65 syn region dylanComment start="/\*" end="\*/"
67 syn region dylanString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=dySpecial
68 syn match dylanCharacter "'[^\\]'"
69 " Constants, classes, and variables
70 syn match dylanConstant "$\<[a-zA-Z0-9\-]\+\>"
71 syn match dylanClass "<\<[a-zA-Z0-9\-]\+\>>"
72 syn match dylanVariable "\*\<[a-zA-Z0-9\-]\+\>\*"
74 syn region dylanPrecondit start="^\s*#\s*\(if\>\|else\>\|endif\>\)" skip="\\$" end="$"
76 " These appear at the top of files (usually). I like to highlight the whole line
77 " so that the definition stands out. They should probably really be keywords, but they
78 " don't generally appear in the middle of a line of code.
79 syn match dylanHeader "^[Mm]odule:.*$"
80 syn match dylanHeader "^[Aa]uthor:.*$"
81 syn match dylanHeader "^[Cc]opyright:.*$"
82 syn match dylanHeader "^[Ss]ynopsis:.*$"
84 " Define the default highlighting.
85 " For version 5.7 and earlier: only when not done already
86 " For version 5.8 and later: only when an item doesn't have highlighting yet
87 if version >= 508 || !exists("did_dylan_syntax_inits")
89 let did_dylan_syntax_inits = 1
90 command -nargs=+ HiLink hi link <args>
92 command -nargs=+ HiLink hi def link <args>
95 HiLink dylanComment Comment
96 HiLink dylanConstant Constant
97 HiLink dylanString String
98 HiLink dylanCharacter Character
99 HiLink dylanNumber Number
100 HiLink dylanBoolean Boolean
101 HiLink dylanClass Structure
102 HiLink dylanVariable Identifier
103 HiLink dylanConditional Conditional
104 HiLink dylanRepeat Repeat
105 HiLink dylanLabel Label
106 HiLink dylanOperator Operator
107 HiLink dylanUnnamedDefs Keyword
108 HiLink dylanNamedDefs Keyword
109 HiLink dylanParamDefs Keyword
110 HiLink dylanBlock Structure
111 HiLink dylanSimpleDefs Keyword
112 HiLink dylanStatement Statement
113 HiLink dylanOther Keyword
114 HiLink dylanException Exception
115 HiLink dylanClassMods StorageClass
116 HiLink dylanMethMods StorageClass
117 HiLink dylanMiscMods StorageClass
118 HiLink dylanImport Include
119 HiLink dylanPreProc PreProc
120 HiLink dylanPrecondit PreCondit
121 HiLink dylanHeader Macro
126 let b:current_syntax = "dylan"