blob: 14262d53d6f210df6d1c49db248699c765539245 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" 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
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
13if version < 600
14 syntax clear
15elseif exists("b:current_syntax")
16 finish
17endif
18
19syn case ignore
20
21if version < 600
22 set lisp
23else
24 setlocal lisp
25endif
26
27" Highlight special characters (those that have backslashes) differently
28syn match dylanSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
29
30" Keywords
31syn keyword dylanBlock afterwards begin block cleanup end
32syn keyword dylanClassMods abstract concrete primary inherited virtual
33syn keyword dylanException exception handler signal
34syn keyword dylanParamDefs method class function library macro interface
35syn keyword dylanSimpleDefs constant variable generic primary
36syn keyword dylanOther above below from by in instance local slot subclass then to
37syn keyword dylanConditional if when select case else elseif unless finally otherwise then
38syn keyword dylanRepeat begin for until while from to
39syn keyword dylanStatement define let
40syn keyword dylanImport use import export exclude rename create
41syn keyword dylanMiscMods open sealed domain singleton sideways inline functional
42
43" Matching rules for special forms
44syn match dylanOperator "\s[-!%&\*\+/=\?@\\^|~:]\+[-#!>%&:\*\+/=\?@\\^|~]*"
45syn match dylanOperator "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./=\?@\\^|~:]*"
46" Numbers
47syn match dylanNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
48syn match dylanNumber "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
49" Booleans
50syn match dylanBoolean "#t\|#f"
51" Comments
52syn match dylanComment "//.*"
53syn region dylanComment start="/\*" end="\*/"
54" Strings
55syn region dylanString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=dySpecial
56syn match dylanCharacter "'[^\\]'"
57" Constants, classes, and variables
58syn match dylanConstant "$\<[a-zA-Z0-9\-]\+\>"
59syn match dylanClass "<\<[a-zA-Z0-9\-]\+\>>"
60syn match dylanVariable "\*\<[a-zA-Z0-9\-]\+\>\*"
61" Preconditions
62syn region dylanPrecondit start="^\s*#\s*\(if\>\|else\>\|endif\>\)" skip="\\$" end="$"
63
64" These appear at the top of files (usually). I like to highlight the whole line
65" so that the definition stands out. They should probably really be keywords, but they
66" don't generally appear in the middle of a line of code.
67syn region dylanHeader start="^[Mm]odule:" end="^$"
68
69" Define the default highlighting.
70" For version 5.7 and earlier: only when not done already
71" For version 5.8 and later: only when an item doesn't have highlighting yet
72if version >= 508 || !exists("did_dylan_syntax_inits")
73 if version < 508
74 let did_dylan_syntax_inits = 1
75 command -nargs=+ HiLink hi link <args>
76 else
77 command -nargs=+ HiLink hi def link <args>
78 endif
79
80 HiLink dylanBlock PreProc
81 HiLink dylanBoolean Boolean
82 HiLink dylanCharacter Character
83 HiLink dylanClass Structure
84 HiLink dylanClassMods StorageClass
85 HiLink dylanComment Comment
86 HiLink dylanConditional Conditional
87 HiLink dylanConstant Constant
88 HiLink dylanException Exception
89 HiLink dylanHeader Macro
90 HiLink dylanImport Include
91 HiLink dylanLabel Label
92 HiLink dylanMiscMods StorageClass
93 HiLink dylanNumber Number
94 HiLink dylanOther Keyword
95 HiLink dylanOperator Operator
96 HiLink dylanParamDefs Keyword
97 HiLink dylanPrecondit PreCondit
98 HiLink dylanRepeat Repeat
99 HiLink dylanSimpleDefs Keyword
100 HiLink dylanStatement Macro
101 HiLink dylanString String
102 HiLink dylanVariable Identifier
103
104 delcommand HiLink
105endif
106
107let b:current_syntax = "dylan"
108
109" vim:ts=8