7
|
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
|
|
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
|
|
13 if version < 600
|
|
14 syntax clear
|
|
15 elseif exists("b:current_syntax")
|
|
16 finish
|
|
17 endif
|
|
18
|
|
19 syn case ignore
|
|
20
|
|
21 if version < 600
|
|
22 set lisp
|
|
23 else
|
|
24 setlocal lisp
|
|
25 endif
|
|
26
|
|
27 " Highlight special characters (those that have backslashes) differently
|
|
28 syn match dylanSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
|
|
29
|
|
30 " Keywords
|
|
31 syn keyword dylanBlock afterwards begin block cleanup end
|
|
32 syn keyword dylanClassMods abstract concrete primary inherited virtual
|
|
33 syn keyword dylanException exception handler signal
|
|
34 syn keyword dylanParamDefs method class function library macro interface
|
|
35 syn keyword dylanSimpleDefs constant variable generic primary
|
|
36 syn keyword dylanOther above below from by in instance local slot subclass then to
|
|
37 syn keyword dylanConditional if when select case else elseif unless finally otherwise then
|
|
38 syn keyword dylanRepeat begin for until while from to
|
|
39 syn keyword dylanStatement define let
|
|
40 syn keyword dylanImport use import export exclude rename create
|
|
41 syn keyword dylanMiscMods open sealed domain singleton sideways inline functional
|
|
42
|
|
43 " Matching rules for special forms
|
|
44 syn match dylanOperator "\s[-!%&\*\+/=\?@\\^|~:]\+[-#!>%&:\*\+/=\?@\\^|~]*"
|
|
45 syn match dylanOperator "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./=\?@\\^|~:]*"
|
|
46 " Numbers
|
|
47 syn match dylanNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
|
|
48 syn match dylanNumber "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
|
|
49 " Booleans
|
|
50 syn match dylanBoolean "#t\|#f"
|
|
51 " Comments
|
|
52 syn match dylanComment "//.*"
|
|
53 syn region dylanComment start="/\*" end="\*/"
|
|
54 " Strings
|
|
55 syn region dylanString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=dySpecial
|
|
56 syn match dylanCharacter "'[^\\]'"
|
|
57 " Constants, classes, and variables
|
|
58 syn match dylanConstant "$\<[a-zA-Z0-9\-]\+\>"
|
|
59 syn match dylanClass "<\<[a-zA-Z0-9\-]\+\>>"
|
|
60 syn match dylanVariable "\*\<[a-zA-Z0-9\-]\+\>\*"
|
|
61 " Preconditions
|
|
62 syn 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.
|
|
67 syn 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
|
|
72 if 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
|
|
105 endif
|
|
106
|
|
107 let b:current_syntax = "dylan"
|
|
108
|
|
109 " vim:ts=8
|