Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Hyper Builder |
| 3 | " Maintainer: Alejandro Forero Cuervo |
| 4 | " URL: http://bachue.com/hb/vim/syntax/hb.vim |
Bram Moolenaar | 6ee8d89 | 2012-01-10 14:55:01 +0100 | [diff] [blame] | 5 | " Last Change: 2012 Jan 08 by Thilo Six |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
| 7 | " For version 5.x: Clear all syntax items |
| 8 | " For version 6.x: Quit when a syntax file was already loaded |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
Bram Moolenaar | 6ee8d89 | 2012-01-10 14:55:01 +0100 | [diff] [blame] | 15 | let s:cpo_save = &cpo |
| 16 | set cpo&vim |
| 17 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 18 | " Read the HTML syntax to start with |
| 19 | "syn include @HTMLStuff <sfile>:p:h/htmlhb.vim |
| 20 | |
| 21 | "this would be nice but we are supposed not to do it |
| 22 | "set mps=<:> |
| 23 | |
| 24 | "syn region HBhtmlString contained start=+"+ end=+"+ contains=htmlSpecialChar |
| 25 | "syn region HBhtmlString contained start=+'+ end=+'+ contains=htmlSpecialChar |
| 26 | |
| 27 | "syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*" |
| 28 | |
| 29 | syn match htmlSpecialChar "&[^;]*;" contained |
| 30 | |
| 31 | syn match HBhtmlTagSk contained "[A-Za-z]*" |
| 32 | |
| 33 | syn match HBhtmlTagS contained "<\s*\(hb\s*\.\s*\(sec\|min\|hour\|day\|mon\|year\|input\|html\|time\|getcookie\|streql\|url-enc\)\|wall\s*\.\s*\(show\|info\|id\|new\|rm\|count\)\|auth\s*\.\s*\(chk\|add\|find\|user\)\|math\s*\.\s*exp\)\s*\([^.A-Za-z0-9]\|$\)" contains=HBhtmlTagSk transparent |
| 34 | |
| 35 | syn match HBhtmlTagN contained "[A-Za-z0-9\/\-]\+" |
| 36 | |
| 37 | syn match HBhtmlTagB contained "<\s*[A-Za-z0-9\/\-]\+\(\s*\.\s*[A-Za-z0-9\/\-]\+\)*" contains=HBhtmlTagS,HBhtmlTagN |
| 38 | |
| 39 | syn region HBhtmlTag contained start=+<+ end=+>+ contains=HBhtmlTagB,HBDirectiveError |
| 40 | |
| 41 | syn match HBFileName ".*" contained |
| 42 | |
| 43 | syn match HBDirectiveKeyword ":\s*\(include\|lib\|set\|out\)\s\+" contained |
| 44 | |
| 45 | syn match HBDirectiveError "^:.*$" contained |
| 46 | |
| 47 | "syn match HBDirectiveBlockEnd "^:\s*$" contained |
| 48 | |
| 49 | "syn match HBDirectiveOutHead "^:\s*out\s\+\S\+.*" contained contains=HBDirectiveKeyword,HBFileName |
| 50 | |
| 51 | "syn match HBDirectiveSetHead "^:\s*set\s\+\S\+.*" contained contains=HBDirectiveKeyword,HBFileName |
| 52 | |
| 53 | syn match HBInvalidLine "^.*$" |
| 54 | |
| 55 | syn match HBDirectiveInclude "^:\s*include\s\+\S\+.*$" contains=HBFileName,HBDirectiveKeyword |
| 56 | |
| 57 | syn match HBDirectiveLib "^:\s*lib\s\+\S\+.*$" contains=HBFileName,HBDirectiveKeyword |
| 58 | |
| 59 | syn region HBText matchgroup=HBDirectiveKeyword start=/^:\(set\|out\)\s*\S\+.*$/ end=/^:\s*$/ contains=HBDirectiveError,htmlSpecialChar,HBhtmlTag keepend |
| 60 | |
| 61 | "syn match HBLine "^:.*$" contains=HBDirectiveInclude,HBDirectiveLib,HBDirectiveError,HBDirectiveSet,HBDirectiveOut |
| 62 | |
| 63 | syn match HBComment "^#.*$" |
| 64 | |
| 65 | " Define the default highlighting. |
| 66 | " For version 5.7 and earlier: only when not done already |
| 67 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 68 | if version >= 508 || !exists("did_hb_syntax_inits") |
| 69 | if version < 508 |
| 70 | let did_hb_syntax_inits = 1 |
| 71 | command -nargs=+ HiLink hi link <args> |
| 72 | else |
| 73 | command -nargs=+ HiLink hi def link <args> |
| 74 | endif |
| 75 | |
| 76 | HiLink HBhtmlString String |
| 77 | HiLink HBhtmlTagN Function |
| 78 | HiLink htmlSpecialChar String |
| 79 | |
| 80 | HiLink HBInvalidLine Error |
| 81 | HiLink HBFoobar Comment |
| 82 | hi HBFileName guibg=lightgray guifg=black |
| 83 | HiLink HBDirectiveError Error |
| 84 | HiLink HBDirectiveBlockEnd HBDirectiveKeyword |
| 85 | hi HBDirectiveKeyword guibg=lightgray guifg=darkgreen |
| 86 | HiLink HBComment Comment |
| 87 | HiLink HBhtmlTagSk Statement |
| 88 | |
| 89 | delcommand HiLink |
| 90 | endif |
| 91 | |
| 92 | syn sync match Normal grouphere NONE "^:\s*$" |
| 93 | syn sync match Normal grouphere NONE "^:\s*lib\s\+[^ \t]\+$" |
| 94 | syn sync match Normal grouphere NONE "^:\s*include\s\+[^ \t]\+$" |
| 95 | "syn sync match Block grouphere HBDirectiveSet "^#:\s*set\s\+[^ \t]\+" |
| 96 | "syn sync match Block grouphere HBDirectiveOut "^#:\s*out\s\+[^ \t]\+" |
| 97 | |
| 98 | let b:current_syntax = "hb" |
| 99 | |
Bram Moolenaar | 6ee8d89 | 2012-01-10 14:55:01 +0100 | [diff] [blame] | 100 | let &cpo = s:cpo_save |
| 101 | unlet s:cpo_save |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 102 | " vim: ts=8 |