2 " Language: Virata AConfig Configuration Script
3 " Maintainer: Manuel M.H. Stol <mmh.stol@gmx.net>
4 " Last Change: 2003 May 11
5 " Vim URL: http://www.vim.org/lang.html
6 " Virata URL: http://www.globespanvirata.com/
9 " Virata AConfig Configuration Script syntax
10 " Can be detected by: 1) Extension .hw, .sw, .pkg and .module
11 " 2) The file name pattern "mk.*\.cfg"
12 " 3) The string "Virata" in the first 5 lines
17 " Clear old syntax settings
19 elseif exists("b:current_syntax")
22 " Virata syntax is case insensitive (mostly)
28 " Virata comments start with %, but % is not a keyword character
29 syn region virataComment start="^%" start="\s%"lc=1 keepend end="$" contains=@virataGrpInComments
30 syn region virataSpclComment start="^%%" start="\s%%"lc=1 keepend end="$" contains=@virataGrpInComments
31 syn keyword virataInCommentTodo contained TODO FIXME XXX[XXXXX] REVIEW TBD
32 syn cluster virataGrpInComments contains=virataInCommentTodo
33 syn cluster virataGrpComments contains=@virataGrpInComments,virataComment,virataSpclComment
37 syn match virataStringError +["]+
38 syn region virataString start=+"+ skip=+\(\\\\\|\\"\)+ end=+"+ oneline contains=virataSpclCharError,virataSpclChar,@virataGrpDefSubsts
39 syn match virataCharacter +'[^']\{-}'+ contains=virataSpclCharError,virataSpclChar
40 syn match virataSpclChar contained +\\\(x\x\+\|\o\{1,3}\|['\"?\\abefnrtv]\)+
41 syn match virataNumberError "\<\d\{-1,}\I\{-1,}\>"
42 syn match virataNumberError "\<0x\x*\X\x*\>"
43 syn match virataNumberError "\<\d\+\.\d*\(e[+-]\=\d\+\)\=\>"
44 syn match virataDecNumber "\<\d\+U\=L\=\>"
45 syn match virataHexNumber "\<0x\x\+U\=L\=\>"
46 syn match virataSizeNumber "\<\d\+[BKM]\>"he=e-1
47 syn match virataSizeNumber "\<\d\+[KM]B\>"he=e-2
48 syn cluster virataGrpNumbers contains=virataNumberError,virataDecNumber,virataHexNumber,virataSizeNumber
49 syn cluster virataGrpConstants contains=@virataGrpNumbers,virataStringError,virataString,virataCharacter,virataSpclChar
53 syn match virataIdentError contained "\<\D\S*\>"
54 syn match virataIdentifier contained "\<\I\i\{-}\(\-\i\{-1,}\)*\>" contains=@virataGrpDefSubsts
55 syn match virataFileIdent contained "\F\f*" contains=@virataGrpDefSubsts
56 syn cluster virataGrpIdents contains=virataIdentifier,virataIdentError
57 syn cluster virataGrpFileIdents contains=virataFileIdent,virataIdentError
61 syn match virataStatement "^\s*Config\(\(/Kernel\)\=\.\(hs\=\|s\)\)\=\>"
62 syn match virataStatement "^\s*Config\s\+\I\i\{-}\(\-\i\{-1,}\)*\.\(hs\=\|s\)\>"
63 syn match virataStatement "^\s*Make\.\I\i\{-}\(\-\i\{-1}\)*\>" skipwhite nextgroup=@virataGrpIdents
64 syn match virataStatement "^\s*Make\.c\(at\)\=++\s"me=e-1 skipwhite nextgroup=@virataGrpIdents
65 syn match virataStatement "^\s*\(Architecture\|GetEnv\|Reserved\|\(Un\)\=Define\|Version\)\>" skipwhite nextgroup=@virataGrpIdents
66 syn match virataStatement "^\s*\(Hardware\|ModuleSource\|\(Release\)\=Path\|Software\)\>" skipwhite nextgroup=@virataGrpFileIdents
67 syn match virataStatement "^\s*\(DefaultPri\|Hydrogen\)\>" skipwhite nextgroup=virataDecNumber,virataNumberError
68 syn match virataStatement "^\s*\(NoInit\|PCI\|SysLink\)\>"
69 syn match virataStatement "^\s*Allow\s\+\(ModuleConfig\)\>"
70 syn match virataStatement "^\s*NoWarn\s\+\(Export\|Parse\=able\|Relative]\)\>"
71 syn match virataStatement "^\s*Debug\s\+O\(ff\|n\)\>"
73 " Import (Package <exec>|Module <name> from <dir>)
74 syn region virataImportDef transparent matchgroup=virataStatement start="^\s*Import\>" keepend end="$" contains=virataInImport,virataModuleDef,virataNumberError,virataStringError,@virataGrpDefSubsts
75 syn match virataInImport contained "\<\(Module\|Package\|from\)\>" skipwhite nextgroup=@virataGrpFileIdents
76 " Export (Header <header file>|SLibrary <obj file>)
77 syn region virataExportDef transparent matchgroup=virataStatement start="^\s*Export\>" keepend end="$" contains=virataInExport,virataNumberError,virataStringError,@virataGrpDefSubsts
78 syn match virataInExport contained "\<\(Header\|[SU]Library\)\>" skipwhite nextgroup=@virataGrpFileIdents
79 " Process <name> is <dir/exec>
80 syn region virataProcessDef transparent matchgroup=virataStatement start="^\s*Process\>" keepend end="$" contains=virataInProcess,virataInExec,virataNumberError,virataStringError,@virataGrpDefSubsts,@virataGrpIdents
81 syn match virataInProcess contained "\<is\>"
82 " Instance <name> of <module>
83 syn region virataInstanceDef transparent matchgroup=virataStatement start="^\s*Instance\>" keepend end="$" contains=virataInInstance,virataNumberError,virataStringError,@virataGrpDefSubsts,@virataGrpIdents
84 syn match virataInInstance contained "\<of\>"
85 " Module <name> from <dir>
86 syn region virataModuleDef transparent matchgroup=virataStatement start="^\s*\(Package\|Module\)\>" keepend end="$" contains=virataInModule,virataNumberError,virataStringError,@virataGrpDefSubsts
87 syn match virataInModule contained "^\s*Package\>"hs=e-7 skipwhite nextgroup=@virataGrpIdents
88 syn match virataInModule contained "^\s*Module\>"hs=e-6 skipwhite nextgroup=@virataGrpIdents
89 syn match virataInModule contained "\<from\>" skipwhite nextgroup=@virataGrpFileIdents
90 " Colour <name> from <dir>
91 syn region virataColourDef transparent matchgroup=virataStatement start="^\s*Colour\>" keepend end="$" contains=virataInColour,virataNumberError,virataStringError,@virataGrpDefSubsts
92 syn match virataInColour contained "^\s*Colour\>"hs=e-6 skipwhite nextgroup=@virataGrpIdents
93 syn match virataInColour contained "\<from\>" skipwhite nextgroup=@virataGrpFileIdents
95 " Object {Executable [<ExecOptions>]}
96 syn match virataStatement "^\s*\(Link\|Object\)"
97 " Executable <name> [<ExecOptions>]
98 syn region virataExecDef transparent matchgroup=virataStatement start="^\s*Executable\>" keepend end="$" contains=virataInExec,virataNumberError,virataStringError
99 syn match virataInExec contained "^\s*Executable\>" skipwhite nextgroup=@virataGrpDefSubsts,@virataGrpIdents
100 syn match virataInExec contained "\<\(epilogue\|pro\(logue\|cess\)\|qhandler\)\>" skipwhite nextgroup=@virataGrpDefSubsts,@virataGrpIdents
101 syn match virataInExec contained "\<\(priority\|stack\)\>" skipwhite nextgroup=@virataGrpDefSubsts,@virataGrpNumbers
102 " Message <name> {<msg format>}
104 syn match virataStatement "^\s*Message\(Id\)\=\>" skipwhite nextgroup=@virataGrpNumbers
105 " MakeRule <make suffix=file> {<make cmds>}
106 syn region virataMakeDef transparent matchgroup=virataStatement start="^\s*MakeRule\>" keepend end="$" contains=virataInMake,@virataGrpDefSubsts
108 syn match virataInMake contained "\<N\>"
110 " (Append|Edit|Copy)Rule <make suffix=file> <subst cmd>
111 syn match virataStatement "^\s*\(Append\|Copy\|Edit\)Rule\>"
112 " AlterRules in <file> <subst cmd>
113 syn region virataAlterDef transparent matchgroup=virataStatement start="^\s*AlterRules\>" keepend end="$" contains=virataInAlter,@virataGrpDefSubsts
114 syn match virataInAlter contained "\<in\>" skipwhite nextgroup=@virataGrpIdents
116 syn cluster virataGrpInStatmnts contains=virataInImport,virataInExport,virataInExec,virataInProcess,virataInAlter,virataInInstance,virataInModule,virataInColour
117 syn cluster virataGrpStatements contains=@virataGrpInStatmnts,virataStatement,virataImportDef,virataExportDef,virataExecDef,virataProcessDef,virataAlterDef,virataInstanceDef,virataModuleDef,virataColourDef
120 " MkFlash.Cfg File Statements:
121 syn region virataCfgFileDef transparent matchgroup=virataCfgStatement start="^\s*Dir\>" start="^\s*\a\{-}File\>" start="^\s*OutputFile\d\d\=\>" start="^\s*\a\w\{-}[NP]PFile\>" keepend end="$" contains=@virataGrpFileIdents
122 syn region virataCfgSizeDef transparent matchgroup=virataCfgStatement start="^\s*\a\{-}Size\>" start="^\s*ConfigInfo\>" keepend end="$" contains=@virataGrpNumbers,@virataGrpDefSubsts,virataIdentError
123 syn region virataCfgNumberDef transparent matchgroup=virataCfgStatement start="^\s*FlashchipNum\(b\(er\=\)\=\)\=\>" start="^\s*Granularity\>" keepend end="$" contains=@virataGrpNumbers,@virataGrpDefSubsts
124 syn region virataCfgMacAddrDef transparent matchgroup=virataCfgStatement start="^\s*MacAddress\>" keepend end="$" contains=virataNumberError,virataStringError,virataIdentError,virataInMacAddr,@virataGrpDefSubsts
125 syn match virataInMacAddr contained "\x[:]\x\{1,2}\>"lc=2
126 syn match virataInMacAddr contained "\s\x\{1,2}[:]\x"lc=1,me=e-1,he=e-2 nextgroup=virataInMacAddr
127 syn match virataCfgStatement "^\s*Target\>" skipwhite nextgroup=@virataGrpIdents
128 syn cluster virataGrpCfgs contains=virataCfgStatement,virataCfgFileDef,virataCfgSizeDef,virataCfgNumberDef,virataCfgMacAddrDef,virataInMacAddr
132 " PreProcessor Instructions:
134 syn match virataDefine "^\s*\(Un\)\=Set\>" skipwhite nextgroup=@virataGrpIdents
135 syn match virataInclude "^\s*Include\>" skipwhite nextgroup=@virataGrpFileIdents
136 syn match virataDefSubstError "[^$]\$"lc=1
137 syn match virataDefSubstError "\$\(\w\|{\(.\{-}}\)\=\)"
139 syn match virataDefSubst "\$\(\d\|[DINORS]\|{\I\i\{-}\(\-\i\{-1,}\)*}\)"
142 syn cluster virataGrpCntnPreCon contains=ALLBUT,@virataGrpInComments,@virataGrpFileIdents,@virataGrpInStatmnts
143 syn region virataPreConDef transparent matchgroup=virataPreCondit start="^\s*If\>" end="^\s*Endif\>" contains=@virataGrpCntnPreCon
144 syn match virataPreCondit contained "^\s*Else\(\s\+If\)\=\>"
145 syn region virataPreConDef transparent matchgroup=virataPreCondit start="^\s*ForEach\>" end="^\s*Done\>" contains=@virataGrpCntnPreCon
147 syn region virataPreProc start="^\s*Error\>" start="^\s*Warning\>" oneline end="$" contains=@virataGrpConstants,@virataGrpDefSubsts
148 syn cluster virataGrpDefSubsts contains=virataDefSubstError,virataDefSubst
149 syn cluster virataGrpPreProcs contains=@virataGrpDefSubsts,virataDefine,virataInclude,virataPreConDef,virataPreCondit,virataPreProc
152 " Synchronize Syntax:
154 syn sync minlines=50 "for multiple region nesting
158 " Define the default highlighting.
159 " For version 5.7 and earlier: only when not done already
160 " For version 5.8 and later : only when an item doesn't have highlighting yet
161 if version >= 508 || !exists("did_virata_syntax_inits")
163 let did_virata_syntax_inits = 1
164 command -nargs=+ HiLink hi link <args>
166 command -nargs=+ HiLink hi def link <args>
170 HiLink virataDefSubstError virataPreProcError
171 HiLink virataDefSubst virataPreProc
172 HiLink virataInAlter virataOperator
173 HiLink virataInExec virataOperator
174 HiLink virataInExport virataOperator
175 HiLink virataInImport virataOperator
176 HiLink virataInInstance virataOperator
177 HiLink virataInMake virataOperator
178 HiLink virataInModule virataOperator
179 HiLink virataInProcess virataOperator
180 HiLink virataInMacAddr virataHexNumber
183 HiLink virataComment Comment
184 HiLink virataSpclComment SpecialComment
185 HiLink virataInCommentTodo Todo
188 HiLink virataString String
189 HiLink virataStringError Error
190 HiLink virataCharacter Character
191 HiLink virataSpclChar Special
192 HiLink virataDecNumber Number
193 HiLink virataHexNumber Number
194 HiLink virataSizeNumber Number
195 HiLink virataNumberError Error
198 HiLink virataIdentError Error
201 HiLink virataPreProc PreProc
202 HiLink virataDefine Define
203 HiLink virataInclude Include
204 HiLink virataPreCondit PreCondit
205 HiLink virataPreProcError Error
206 HiLink virataPreProcWarn Todo
209 HiLink virataStatement Statement
210 HiLink virataCfgStatement Statement
211 HiLink virataOperator Operator
212 HiLink virataDirective Keyword
217 let b:current_syntax = "virata"
219 " vim:ts=8:sw=2:noet: