xref: /vim-8.2.3635/runtime/syntax/tpp.vim (revision 009b2592)
1" Vim syntax file
2" Language:	tpp - Text Presentation Program
3" Maintainer:	Gerfried Fuchs <[email protected]>
4" Filenames:	*.tpp
5" Last Change:	13. October 2004
6" URL:		http://alfie.ist.org/projects/vim/syntax/tpp.vim
7" License:	BSD
8"
9" Comments are very welcome - but please make sure that you are commenting on
10" the latest version of this file.
11" SPAM is _NOT_ welcome - be ready to be reported!
12
13" For version 5.x: Clear all syntax items
14" For version 6.x: Quit when a syntax file was already loaded
15if version < 600
16  syntax clear
17elseif exists("b:current_syntax")
18  finish
19endif
20
21if !exists("main_syntax")
22  let main_syntax = 'tpp'
23endif
24
25
26"" list of the legal switches/options
27syn match tppAbstractOptionKey contained "^--\%(author\|title\|date\) *" nextgroup=tppValue
28syn match tppPageLocalOptionKey contained "^--\%(heading\|center\|right\|sleep\|huge\|exec\) *" nextgroup=tppValue
29syn match tppPageLocalSwitchKey contained "^--\%(horline\|-\|\%(begin\|end\)\%(\%(shell\)\?output\|slide\%(left\|right\|top\|bottom\)\)\|\%(bold\|rev\|ul\)\%(on\|off\)\|withborder\)"
30syn match tppNewPageOptionKey contained "^--newpage *" nextgroup=tppValue
31syn match tppColorOptionKey contained "^--\%(\%(bg\|fg\)\?color\) *"
32syn match tppTimeOptionKey contained "^--sleep *"
33
34syn match tppValue contained ".*"
35syn match tppColor contained "\%(white\|yellow\|red\|green\|blue\|cyan\|magenta\|black\)"
36syn match tppTime contained "\d\+"
37
38syn region tppPageLocalSwitch start="^--" end="$" contains=tppPageLocalSwitchKey oneline
39syn region tppColorOption start="^--\%(\%(bg\|fg\)\?color\)" end="$" contains=tppColorOptionKey,tppColor oneline
40syn region tppTimeOption start="^--sleep" end="$" contains=tppTimeOptionKey,tppTime oneline
41syn region tppNewPageOption start="^--newpage" end="$" contains=tppNewPageOptionKey oneline
42syn region tppPageLocalOption start="^--\%(heading\|center\|right\|sleep\|huge\|exec\)" end="$" contains=tppPageLocalOptionKey oneline
43syn region tppAbstractOption start="^--\%(author\|title\|date\)" end="$" contains=tppAbstractOptionKey oneline
44
45if main_syntax != 'sh'
46  " shell command
47  if version < 600
48    syn include @tppShExec <sfile>:p:h/sh.vim
49  else
50    syn include @tppShExec syntax/sh.vim
51  endif
52  unlet b:current_syntax
53
54  syn region shExec matchgroup=tppPageLocalOptionKey start='^--exec *' keepend end='$' contains=@tppShExec
55
56endif
57
58
59" Define the default highlighting.
60" For version 5.7 and earlier: only when not done already
61" For version 5.8 and later: only when an item doesn't have highlighting yet
62if version >= 508 || !exists("did_tpp_syn_inits")
63  if version < 508
64    let did_tpp_syn_inits = 1
65    command -nargs=+ HiLink hi link <args>
66  else
67    command -nargs=+ HiLink hi def link <args>
68  endif
69
70  HiLink tppAbstractOptionKey		Special
71  HiLink tppPageLocalOptionKey		Keyword
72  HiLink tppPageLocalSwitchKey		Keyword
73  HiLink tppColorOptionKey		Keyword
74  HiLink tppTimeOptionKey		Comment
75  HiLink tppNewPageOptionKey		PreProc
76  HiLink tppValue			String
77  HiLink tppColor			String
78  HiLink tppTime			Number
79  HiLink tppAbstractOption		Error
80  HiLink tppPageLocalOption		Error
81  HiLink tppPageLocalSwitch		Error
82  HiLink tppColorOption			Error
83  HiLink tppNewPageOption		Error
84  HiLink tppTimeOption			Error
85
86  delcommand HiLink
87endif
88
89let b:current_syntax = "tpp"
90
91" vim: ts=8 sw=2
92