Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: tpp - Text Presentation Program |
| 3 | " Maintainer: Gerfried Fuchs <alfie@ist.org> |
| 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 |
| 15 | if version < 600 |
| 16 | syntax clear |
| 17 | elseif exists("b:current_syntax") |
| 18 | finish |
| 19 | endif |
| 20 | |
| 21 | if !exists("main_syntax") |
| 22 | let main_syntax = 'tpp' |
| 23 | endif |
| 24 | |
| 25 | |
| 26 | "" list of the legal switches/options |
| 27 | syn match tppAbstractOptionKey contained "^--\%(author\|title\|date\) *" nextgroup=tppValue |
| 28 | syn match tppPageLocalOptionKey contained "^--\%(heading\|center\|right\|sleep\|huge\|exec\) *" nextgroup=tppValue |
| 29 | syn match tppPageLocalSwitchKey contained "^--\%(horline\|-\|\%(begin\|end\)\%(\%(shell\)\?output\|slide\%(left\|right\|top\|bottom\)\)\|\%(bold\|rev\|ul\)\%(on\|off\)\|withborder\)" |
| 30 | syn match tppNewPageOptionKey contained "^--newpage *" nextgroup=tppValue |
| 31 | syn match tppColorOptionKey contained "^--\%(\%(bg\|fg\)\?color\) *" |
| 32 | syn match tppTimeOptionKey contained "^--sleep *" |
| 33 | |
| 34 | syn match tppValue contained ".*" |
| 35 | syn match tppColor contained "\%(white\|yellow\|red\|green\|blue\|cyan\|magenta\|black\)" |
| 36 | syn match tppTime contained "\d\+" |
| 37 | |
| 38 | syn region tppPageLocalSwitch start="^--" end="$" contains=tppPageLocalSwitchKey oneline |
| 39 | syn region tppColorOption start="^--\%(\%(bg\|fg\)\?color\)" end="$" contains=tppColorOptionKey,tppColor oneline |
| 40 | syn region tppTimeOption start="^--sleep" end="$" contains=tppTimeOptionKey,tppTime oneline |
| 41 | syn region tppNewPageOption start="^--newpage" end="$" contains=tppNewPageOptionKey oneline |
| 42 | syn region tppPageLocalOption start="^--\%(heading\|center\|right\|sleep\|huge\|exec\)" end="$" contains=tppPageLocalOptionKey oneline |
| 43 | syn region tppAbstractOption start="^--\%(author\|title\|date\)" end="$" contains=tppAbstractOptionKey oneline |
| 44 | |
| 45 | if 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 | |
| 56 | endif |
| 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 |
| 62 | if 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 |
| 87 | endif |
| 88 | |
| 89 | let b:current_syntax = "tpp" |
| 90 | |
| 91 | " vim: ts=8 sw=2 |