Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Haste preprocessor files |
| 3 | " Maintainer: M. Tranchero - maurizio.tranchero@gmail.com |
| 4 | " Credits: some parts have been taken from vhdl, verilog, and C syntax |
| 5 | " files |
| 6 | " Version: 0.5 |
| 7 | |
| 8 | " HASTE |
| 9 | if exists("b:current_syntax") |
| 10 | finish |
| 11 | endif |
| 12 | " For version 5.x: Clear all syntax items |
| 13 | " For version 6.x: Quit when a syntax file was already loaded |
| 14 | if version < 600 |
| 15 | syntax clear |
| 16 | elseif exists("b:current_syntax") |
| 17 | finish |
| 18 | endif |
| 19 | " Read the C syntax to start with |
| 20 | if version < 600 |
| 21 | so <sfile>:p:h/haste.vim |
| 22 | else |
| 23 | runtime! syntax/haste.vim |
| 24 | unlet b:current_syntax |
| 25 | endif |
| 26 | |
| 27 | " case is significant |
| 28 | syn case match |
| 29 | |
| 30 | " C pre-processor directives |
| 31 | syn match hastepreprocVar display "\$[[:alnum:]_]*" |
| 32 | syn region hastepreprocVar start="\${" end="}" contains=hastepreprocVar |
| 33 | " |
| 34 | "syn region hastepreproc start="#\[\s*tg[:alnum:]*" end="]#" contains=hastepreprocVar,hastepreproc,hastepreprocError,@Spell |
| 35 | syn region hastepreproc start="#\[\s*\(\|tgfor\|tgif\)" end="$" contains=hastepreprocVar,hastepreproc,@Spell |
| 36 | syn region hastepreproc start="}\s\(else\)\s{" end="$" contains=hastepreprocVar,hastepreproc,@Spell |
| 37 | syn region hastepreproc start="^\s*#\s*\(ifndef\|ifdef\|else\|endif\)\>" end="$" contains=@hastepreprocGroup,@Spell |
| 38 | syn region hastepreproc start="\s*##\s*\(define\|undef\)\>" end="$" contains=@hastepreprocGroup,@Spell |
| 39 | syn match hastepreproc "}\{0,1}\s*]#" |
| 40 | |
| 41 | " Define the default highlighting. |
| 42 | " Only when an item doesn't have highlighting yet |
| 43 | hi def link hastepreproc Preproc |
| 44 | hi def link hastepreprocVar Special |
| 45 | hi def link hastepreprocError Error |
| 46 | |
| 47 | let b:current_syntax = "hastepreproc" |
| 48 | |
| 49 | " vim: ts=8 |