1" Vim syntax file
2" Language:         calendar(1) input file
3" Maintainer:       Nikolai Weibull <now@bitwi.se>
4" Latest Revision:  2006-04-19
5
6if exists("b:current_syntax")
7  finish
8endif
9
10let s:cpo_save = &cpo
11set cpo&vim
12
13syn keyword calendarTodo          contained TODO FIXME XXX NOTE
14
15syn region  calendarComment       start='/\*' end='\*/'
16                                  \ contains=calendarTodo,@Spell
17
18syn region  calendarCppString     start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl
19                                  \ end=+"+ end='$' contains=calendarSpecial
20syn match   calendarSpecial       display contained '\\\%(x\x\+\|\o\{1,3}\|.\|$\)'
21syn match   calendarSpecial       display contained "\\\(u\x\{4}\|U\x\{8}\)"
22
23syn region  calendarPreCondit     start='^\s*#\s*\%(if\|ifdef\|ifndef\|elif\)\>'
24                                  \ skip='\\$' end='$'
25                                  \ contains=calendarComment,calendarCppString
26syn match   calendarPreCondit     display '^\s*#\s*\%(else\|endif\)\>'
27syn region  calendarCppOut        start='^\s*#\s*if\s\+0\+' end='.\@=\|$'
28                                  \ contains=calendarCppOut2
29syn region  calendarCppOut2       contained start='0'
30                                  \ end='^\s*#\s*\%(endif\|else\|elif\)\>'
31                                  \ contains=calendarSpaceError,calendarCppSkip
32syn region  calendarCppSkip       contained
33                                  \ start='^\s*#\s*\%(if\|ifdef\|ifndef\)\>'
34                                  \ skip='\\$' end='^\s*#\s*endif\>'
35                                  \ contains=calendarSpaceError,calendarCppSkip
36syn region  calendarIncluded      display contained start=+"+ skip=+\\\\\|\\"+
37                                  \ end=+"+
38syn match   calendarIncluded      display contained '<[^>]*>'
39syn match   calendarInclude       display '^\s*#\s*include\>\s*["<]'
40                                  \ contains=calendarIncluded
41syn cluster calendarPreProcGroup  contains=calendarPreCondit,calendarIncluded,
42                                  \ calendarInclude,calendarDefine,
43                                  \ calendarCppOut,calendarCppOut2,
44                                  \ calendarCppSkip,calendarString,
45                                  \ calendarSpecial,calendarTodo
46syn region  calendarDefine        start='^\s*#\s*\%(define\|undef\)\>'
47                                  \ skip='\\$' end='$'
48                                  \ contains=ALLBUT,@calendarPreProcGroup
49syn region  calendarPreProc       start='^\s*#\s*\%(pragma\|line\|warning\|warn\|error\)\>'
50                                  \ skip='\\$' end='$' keepend
51                                  \ contains=ALLBUT,@calendarPreProcGroup
52
53syn keyword calendarKeyword       CHARSET BODUN LANG
54syn case ignore
55syn keyword calendarKeyword       Easter Pashka
56syn case match
57
58syn case ignore
59syn match   calendarNumber        display '\<\d\+\>'
60syn keyword calendarMonth         Jan[uary] Feb[ruary] Mar[ch] Apr[il] May
61                                  \ Jun[e] Jul[y] Aug[ust] Sep[tember]
62                                  \ Oct[ober] Nov[ember] Dec[ember]
63syn match   calendarMonth         display '\<\%(Jan\|Feb\|Mar\|Apr\|May\|Jun\|Jul\|Aug\|Sep\|Oct\|Nov\|Dec\)\.'
64syn keyword calendarWeekday       Mon[day] Tue[sday] Wed[nesday] Thu[rsday]
65syn keyword calendarWeekday       Fri[day] Sat[urday] Sun[day]
66syn match   calendarWeekday       display '\<\%(Mon\|Tue\|Wed\|Thu\|Fri\|Sat\|Sun\)\.'
67                                  \ nextgroup=calendarWeekdayMod
68syn match   calendarWeekdayMod    display '[+-]\d\+\>'
69syn case match
70
71syn match   calendarTime          display '\<\%([01]\=\d\|2[0-3]\):[0-5]\d\%(:[0-5]\d\)\='
72syn match   calendarTime          display '\<\%(0\=[1-9]\|1[0-2]\):[0-5]\d\%(:[0-5]\d\)\=\s*[AaPp][Mm]'
73
74syn match calendarVariable        '\*'
75
76if exists("c_minlines")
77  let b:c_minlines = c_minlines
78else
79  if !exists("c_no_if0")
80    let b:c_minlines = 50       " #if 0 constructs can be long
81  else
82    let b:c_minlines = 15       " mostly for () constructs
83  endif
84endif
85exec "syn sync ccomment calendarComment minlines=" . b:c_minlines
86
87hi def link calendarTodo          Todo
88hi def link calendarComment       Comment
89hi def link calendarCppString     String
90hi def link calendarSpecial       SpecialChar
91hi def link calendarPreCondit     PreCondit
92hi def link calendarCppOut        Comment
93hi def link calendarCppOut2       calendarCppOut
94hi def link calendarCppSkip       calendarCppOut
95hi def link calendarIncluded      String
96hi def link calendarInclude       Include
97hi def link calendarDefine        Macro
98hi def link calendarPreProc       PreProc
99hi def link calendarKeyword       Keyword
100hi def link calendarNumber        Number
101hi def link calendarMonth         String
102hi def link calendarWeekday       String
103hi def link calendarWeekdayMod    Special
104hi def link calendarTime          Number
105hi def link calendarVariable      Identifier
106
107let b:current_syntax = "calendar"
108
109let &cpo = s:cpo_save
110unlet s:cpo_save
111