3 " Maintainer: Dr. Charles E. Campbell, Jr. <Charles.E.Campbell.1@gsfc.nasa.gov>
4 " Last Change: October 27, 2000
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
15 syn match smComment "^#.*$"
17 " Definitions, Classes, Files, Options, Precedence, Trusted Users, Mailers
18 syn match smDefine "^[CDF]."
19 syn match smDefine "^O[AaBcdDeFfgHiLmNoQqrSsTtuvxXyYzZ]"
20 syn match smDefine "^O\s"he=e-1
21 syn match smDefine "^M[a-zA-Z0-9]\+,"he=e-1
22 syn match smDefine "^T" nextgroup=smTrusted
23 syn match smDefine "^P" nextgroup=smMesg
24 syn match smTrusted "\S\+$" contained
25 syn match smMesg "\S*="he=e-1 contained nextgroup=smPrecedence
26 syn match smPrecedence "-\=[0-9]\+" contained
28 " Header Format H?list-of-mailer-flags?name: format
29 syn match smHeaderSep contained "[?:]"
30 syn match smHeader "^H\(?[a-zA-Z]\+?\)\=[-a-zA-Z_]\+:" contains=smHeaderSep
33 syn match smVar "\$[a-z\.\|]"
36 syn match smRuleset "^S\d*"
39 syn match smRewrite "^R" skipwhite nextgroup=smRewriteLhsToken,smRewriteLhsUser
41 syn match smRewriteLhsUser contained "[^\t$]\+" skipwhite nextgroup=smRewriteLhsToken,smRewriteLhsSep
42 syn match smRewriteLhsToken contained "\(\$[-*+]\|\$[-=][A-Za-z]\|\$Y\)\+" skipwhite nextgroup=smRewriteLhsUser,smRewriteLhsSep
44 syn match smRewriteLhsSep contained "\t\+" skipwhite nextgroup=smRewriteRhsToken,smRewriteRhsUser
46 syn match smRewriteRhsUser contained "[^\t$]\+" skipwhite nextgroup=smRewriteRhsToken,smRewriteRhsSep
47 syn match smRewriteRhsToken contained "\(\$\d\|\$>\d\|\$#\|\$@\|\$:[-_a-zA-Z]\+\|\$[[\]]\|\$@\|\$:\|\$[A-Za-z]\)\+" skipwhite nextgroup=smRewriteRhsUser,smRewriteRhsSep
49 syn match smRewriteRhsSep contained "\t\+" skipwhite nextgroup=smRewriteComment,smRewriteRhsSep
50 syn match smRewriteRhsSep contained "$"
52 syn match smRewriteComment contained "[^\t$]*$"
55 syn match smClauseError "\$\."
56 syn match smElse contained "\$|"
57 syn match smClauseCont contained "^\t"
58 syn region smClause matchgroup=Delimiter start="\$?." matchgroup=Delimiter end="\$\." contains=smElse,smClause,smVar,smClauseCont
60 " Define the default highlighting.
61 " For version 5.7 and earlier: only when not done already
62 " For version 5.8 and later: only when an item doesn't have highlighting yet
63 if version >= 508 || !exists("did_smil_syntax_inits")
65 let did_smil_syntax_inits = 1
66 command -nargs=+ HiLink hi link <args>
68 command -nargs=+ HiLink hi def link <args>
71 HiLink smClause Special
72 HiLink smClauseError Error
73 HiLink smComment Comment
74 HiLink smDefine Statement
75 HiLink smElse Delimiter
76 HiLink smHeader Statement
77 HiLink smHeaderSep String
79 HiLink smPrecedence Number
80 HiLink smRewrite Statement
81 HiLink smRewriteComment Comment
82 HiLink smRewriteLhsToken String
83 HiLink smRewriteLhsUser Statement
84 HiLink smRewriteRhsToken String
85 HiLink smRuleset Preproc
86 HiLink smTrusted Special
92 let b:current_syntax = "sm"