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