2 " Language: Virata Configuration Script
3 " Maintainer: Manuel M.H. Stol <mmh.stol@gmx.net>
4 " Last Change: 2001-05-07
5 " Vim URL: http://www.vim.org/lang.html
6 " Virata URL: http://www.virata.com/
9 " Virata Configuration Script syntax
10 " Might be detected by: 1) Extension .hw, .pkg and .module (and .cfg)
11 " 2) The word "Virata" in the first 5 lines
16 " Clear old syntax settings
18 elseif exists("b:current_syntax")
21 " Virata syntax is case insensetive (mostly)
27 " Virata comments start with %, but % is not a keyword character
28 syn region virataComment start="^\s*%" start="\s%" keepend end="$" contains=@virataGrpInComments
29 syn region virataSpclComment start="^\s*%%" start="\s%%" keepend end="$" contains=@virataGrpInComments
30 syn keyword virataInCommentTodo contained TODO FIXME XXX[XXXXX] REVIEW
31 syn cluster virataGrpInComments contains=virataInCommentTodo
32 syn cluster virataGrpComments contains=@virataGrpInComments,virataComment,virataSpclComment
36 syn match virataStringError +["]+
37 syn region virataString start=+"+ skip=+\(\\\\\|\\"\)+ end=+"+ oneline contains=virataSpclCharError,virataSpclChar,virataDefSubst
38 syn match virataCharacter +'[^']\{-}'+ contains=virataSpclCharError,virataSpclChar
39 syn match virataSpclChar contained +\\\(x\x\+\|\o\{1,3}\|['\"?\\abefnrtv]\)+
40 syn match virataNumberError "\<\d\d\{-}\D\w\{-}\>"
41 syn match virataNumberError "\<0x\x*\X\x*\>"
42 syn match virataNumberError "\<\d\+\.\d*\(e[+-]\=\d\+\)\=\>"
43 syn match virataDecNumber "\<\d\+U\=L\=\>"
44 syn match virataHexNumber "\<0x\x\+U\=L\=\>"
45 syn match virataSizeNumber "\<\d\+[KM]\>"he=e-1
46 syn cluster virataGrpNumbers contains=virataNumberError,virataDecNumber,virataHexNumber,virataSizeNumber
47 syn cluster virataGrpConstants contains=@virataGrpNumbers,virataStringError,virataString,virataCharacter,virataSpclChar
51 syn match virataFileName "\<\F\f\{-}\>"
53 syn match virataIdentifier contained "\<\I\i\{-}\(\-\i\{-1,}\)\{-}\>"
57 syn match virataStatement "^\s*Config\(\.hs\=\)\=\>"
58 syn match virataStatement "^\s*Undefine\>"
59 syn match virataStatement "^\s*Make\.\I\i\{-}\(\-\i\{-1}\)\{-}\>"
60 syn match virataStatement "^\s*Make\.c\(at\)\=++\s"me=e-1
61 syn match virataStatement "^\s*\(Architecture\|Colour\|DefaultPri\(ority\)\=\|Hardware\|ModuleSource\|NoInit\|Path\|Reserved\|SysLink\)\>"
63 " Import (Package <exec>|Module <name> from <dir>)
64 syn region virataImportDef transparent matchgroup=virataStatement start="^\s*Import\>" keepend end="$" contains=virataInImport,virataModuleDef,virataNumberError,virataStringError,virataDefSubst
65 syn match virataInImport contained "\<\(Module\|Package\|from\)\>"
66 " Export (Header <header file>|SLibrary <obj file>)
67 syn region virataExportDef transparent matchgroup=virataStatement start="^\s*Export\>" keepend end="$" contains=virataInExport,virataNumberError,virataStringError,virataDefSubst
68 syn match virataInExport contained "\<\(Header\|[SU]Library\)\>"
69 " Process <name> Is <dir/exec>
70 syn region virataProcessDef transparent matchgroup=virataStatement start="^\s*Process\>" keepend end="$" contains=virataInProcess,virataInExec,virataNumberError,virataStringError,virataDefSubst
71 syn match virataInProcess contained "\<is\>"
72 " Instance <name> from <module>
73 syn region virataInstanceDef transparent matchgroup=virataStatement start="^\s*Instance\>" keepend end="$" contains=virataInInstance,virataNumberError,virataStringError,virataDefSubst
74 syn match virataInInstance contained "\<of\>"
75 " Module <name> from <dir>
76 syn region virataModuleDef transparent matchgroup=virataStatement start="^\s*Module\>" start="^\s*Package" keepend end="$" contains=virataInModule,virataNumberError,virataStringError,virataDefSubst
77 syn match virataInModule contained "\<from\>"
79 " Object {Executable [<ExecOptions>]}
80 syn match virataStatement "^\s*\(Link\|Object\)"
81 " Executable <name> [<ExecOptions>]
82 syn region virataExecDef transparent matchgroup=virataStatement start="^\s*Executable\>" keepend end="$" contains=virataInExec,@virataGrpConstants,virataIdentifier,virataDefSubst
83 syn match virataInExec contained "\<\(epilogue\|pro\(logue\|cess\)\|qhandler\)\>" skipwhite nextgroup=virataIdentifier,virataDefSubst
84 syn match virataInExec contained "\<\(priority\|stack\)\>" skipwhite nextgroup=@virataGrpNumber,virataDefSubst
85 " Message <name> {<msg format>}
87 syn match virataStatement "^\s*Message\(Id\)\=\>"
88 " MakeRule <make suffix=file> {<make cmds>}
89 syn region virataMakeDef transparent matchgroup=virataStatement start="^\s*MakeRule\>" keepend end="$" contains=virataInMake,virataDefSubst
91 syn match virataInMake contained "\<N\>"
93 " (Append|Edit|Copy)Rule <make suffix=file> <subst cmd>
94 syn match virataStatement "^\s*\(Append\|Copy\|Edit\)Rule\>"
95 " AlterRules in <file> <subst cmd>
96 syn region virataAlterDef transparent matchgroup=virataStatement start="^\s*AlterRules\>" keepend end="$" contains=virataInAlter,virataDefSubst
97 syn match virataInAlter contained "\<in\>"
99 syn cluster virataGrpInStatmnts contains=virataInImport,virataInExport,virataInExec,virataInProcess,virataInAlter,virataInInstance,virataInModule
100 syn cluster virataGrpStatements contains=@virataGrpInStatmnts,virataStatement,virataImportDef,virataExportDef,virataExecDef,virataProcessDef,virataAlterDef,virataInstanceDef,virataModuleDef
102 " Cfg File Statements:
103 syn region virataCfgFileDef transparent matchgroup=virataCfgStatement start="^\s*\a\{-}File\>" start="^\s*OutputFile\d\d\=\>" start="^\s*\a\w\{-}[NP]PFile\>" keepend end="$" contains=NONE
104 syn region virataCfgSizeDef transparent matchgroup=virataCfgStatement start="^\s*\a\{-}Size\>" start="^\s*ConfigInfo\>" keepend end="$" contains=@virataGrpNumbers,virataDefSubst
105 syn region virataCfgNumberDef transparent matchgroup=virataCfgStatement start="^\s*FlashchipNum\(b\(er\=\)\=\)\=\>" start="^\s*Granularity\>" keepend end="$" contains=@virataGrpNumbers,virataDefSubst
106 syn region virataCfgMacAddrDef transparent matchgroup=virataCfgStatement start="^\s*MacAddress\>" keepend end="$" contains=virataNumberError,virataInMacAddr,virataDefSubst
107 syn match virataInMacAddr contained "[:]\x\{1,2}"lc=1
108 syn match virataInMacAddr contained "\s\x\{1,2}[:]"lc=1,me=e-1
109 syn match virataCfgStatement "^\s*Target\>"
110 syn cluster virataGrpCfgs contains=virataCfgStatement,virataCfgFileDef,virataCfgSizeDef,virataCfgNumberDef,virataCfgMacAddrDef,virataInMacAddr
114 " PreProcessor Instructions:
116 syn match virataDefine "^\s*\(Un\)\=Set\>"
118 syn match virataDefSubst "$\(\d\|[DINRS]\|{\I\i\{-}}\)"
121 syn cluster virataGrpCntnPreCon contains=ALLBUT,@virataGrpInComments,@virataGrpInStatmnts
122 syn region virataPreConDef transparent matchgroup=virataPreCondit start="^\s*If\>" end="\<Endif\>" contains=@virataGrpCntnPreCon
123 syn match virataPreCondit contained "\<Else\(\s\+If\)\=\>"
124 syn region virataPreConDef transparent matchgroup=virataPreCondit start="^\s*ForEach\>" end="\<Done\>" contains=@virataGrpCntnPreCon
126 syn region virataPreProc start="^\s*Error\>" oneline end="$" contains=@virataGrpConstants
127 syn cluster virataGrpPreProcs contains=virataDefine,virataDefSubst,virataPreConDef,virataPreCondit
130 " Synchronize Syntax:
132 syn sync minlines=50 "for multiple region nesting
136 " Define the default highlighting.
137 " For version 5.7 and earlier: only when not done already
138 " For version 5.8 and later : only when an item doesn't have highlighting yet
139 if version >= 508 || !exists("did_virata_syntax_inits")
141 let did_virata_syntax_inits = 1
142 command -nargs=+ HiLink hi link <args>
144 command -nargs=+ HiLink hi def link <args>
148 HiLink virataDefSubst virataPreProc
149 HiLink virataInAlter virataOperator
150 HiLink virataInExec virataOperator
151 HiLink virataInExport virataOperator
152 HiLink virataInImport virataOperator
153 HiLink virataInInstance virataOperator
154 HiLink virataInMake virataOperator
155 HiLink virataInModule virataOperator
156 HiLink virataInProcess virataOperator
157 HiLink virataInMacAddr virataHexNumber
160 HiLink virataComment Comment
161 HiLink virataSpclComment SpecialComment
162 HiLink virataInCommentTodo Todo
165 HiLink virataString String
166 HiLink virataStringError Error
167 HiLink virataCharacter Character
168 HiLink virataSpclChar Special
169 HiLink virataDecNumber Number
170 HiLink virataHexNumber Number
171 HiLink virataSizeNumber Number
172 HiLink virataNumberError Error
175 HiLink virataPreProc PreProc
176 HiLink virataDefine Define
177 HiLink virataInclude Include
178 HiLink virataPreCondit PreCondit
179 HiLink virataPreProcError Error
180 HiLink virataPreProcWarn Todo
183 HiLink virataStatement Statement
184 HiLink virataCfgStatement Statement
185 HiLink virataOperator Operator
186 HiLink virataDirective Keyword
191 let b:current_syntax = "virata"
193 " vim:ts=8:sw=2:noet: