<?xml version="1.0"?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
  "http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
<!--
    Windows REG files (REGEDIT4) format for Colorer4ever.
    Version 2.0, 02.02.2001
    Copyright (C) 2001 Roman Pekhov <pekhov@mail.ru>

    Reading REG files regedit does not report any errors. It messages
    "Information in <file> has been successfully entered into the registry"
    always even if has not accepted whole the data.

    So this HRC highlights everything unrecognizable by the regedit.
-->
   <type name="regedit" access="public">

      <import type="def"/>

      <region name="regKey" parent="default"/>
      <region name="regKeyDel" parent="ErrorText"/>
      <region name="regSymbolStrong" parent="SymbolStrong"/>
      <region name="regString" parent="String"/>
      <region name="regKeyword" parent="Keyword"/>
      <region name="regSymbol" parent="Symbol"/>
      <region name="regNumHex" parent="NumberHex"/>
      <region name="regSignature" parent="Label"/>
      <region name="regComment" parent="Comment"/>
      <region name="regFunction" parent="Function"/>
      <region name="regError" parent="Error"/>

      <entity name="regStrEl" value="([^&#34;\\]|(\\\\)|(\\[&#34;nr]))"/>

      <scheme name="regError">
<!-- Comment -->
         <regexp match="/^\s*(?{regComment};.*)?$/x" priority="low"/>
<!-- -->
         <regexp match="/^\s+/x" priority="low"/>
         <regexp match="/\s+$/x" priority="low"/>
<!-- The rest is error -->
         <regexp match="/(.+?)/x" priority="low" region="regError"/>
      </scheme>

      <scheme name="regHex">
         <regexp match="/([\da-fA-F]{1,2})\s*,\s*\M[^\s\\;]/x" region1="regNumHex"/>
         <regexp match="/([\da-fA-F]{1,2})\s*,\s*\\ \s*(;.*)?$/x" region1="regNumHex" region2="regComment"/>
         <regexp match="/^\s*(;.*)?$/x" region1="regComment"/>
         <regexp match="/^\s+/"/>
      </scheme>

      <scheme name="regedit">
<!-- ##### Valid data ##### -->
<!-- String -->
         <regexp match="/^\s*                    (?{regString}&#34;%regStrEl;{,254}&#34;) \s* =                    \s*(?{regString}&#34;%regStrEl;*?&#34;) \s*                    (?{regComment};.*)?/x"/>
<!-- Hex - dataless -->
         <regexp match="/^\s*(?{regString}&#34;%regStrEl;{,254}&#34;)\s* =                    \s*(?{regKeyword}hex) (\( (?{regNumHex}[\da-fA-F]{1,8}) \))? (?{regSymbol}:)                    \s*(?{regComment};.*)? (?{regError}\\ \s*([^\s;].*?)\s*)?$/x"/>
<!-- Hex -->
         <block start="/^\s*(?{regString}&#34;%regStrEl;{,254}&#34;)\s* =                    \s*(?{regKeyword}hex) (\( (?{regNumHex}[\da-fA-F]{1,8}) \))? (?{regSymbol}:)                    \s*(\\ \s* (?{regComment};.*)?)?/x" end="/((?{regNumHex}[\da-fA-F]{1,2}) \s* (,\s*(\\ \s*)?)? (?{regComment};.*)?) | (?{regError}.)/x" scheme="regHex"/>
<!-- Key -->
         <regexp match="/^\s* (?{regKey} (?{PairStart}\[)                    HKEY_ (LOCAL_MACHINE|CURRENT_USER|CLASSES_ROOT|USERS|CURRENT_CONFIG|DYN_DATA)                    (\\(?{regFunction}[^\\].{,259})?)?  (?{PairEnd}\]))                    (?{regComment}.*)$/x"/>
<!-- Default string -->
         <regexp match="/^\s*(?{regString}@)\s* = \s*                    (?{regString}&#34;(%regStrEl;)*?&#34;) \s*                    (?{regComment};.*)? /x"/>
<!-- Default hex - dataless -->
         <regexp match="/^\s*(?{regString}@)\s* =                    \s*(?{regKeyword}hex) (\( (?{regNumHex}[\da-fA-F]{1,8}) \))? (?{regSymbol}:)                    \s*(?{regComment};.*)? (?{regError}\\ \s*([^\s;].*?)\s*)?$/x"/>
<!-- Default hex -->
         <block start="/^\s*(?{regString}@)\s* =                    \s*(?{regKeyword}hex) (\( (?{regNumHex}[\da-fA-F]{1,8}) \))? (?{regSymbol}:)                    \s*(\\ \s* (?{regComment};.*)?)?/x" end="/((?{regNumHex}[\da-fA-F]{1,2}) \s* (,\s*(\\ \s*)?)? (?{regComment};.*)?) | (?{regError}.)/x" scheme="regHex"/>
<!-- Comment -->
         <regexp match="/^\s*(?{regComment};.*)?$/x"/>
<!-- Dword -->
         <regexp match="/^\s*(?{regString}&#34;%regStrEl;{,254}&#34;)\s* = \s*                    (?{regKeyword}dword) (?{regSymbol}:) \s*                    (?{regNumHex}[\da-fA-F]{1,8}) \s* (?{regComment};.*)?/x"/>
<!-- Default dword -->
         <regexp match="/^\s*(?{regString}@)\s* = \s*                    (?{regKeyword}dword) (?{regSymbol}:) \s*                    (?{regNumHex}[\da-fA-F]{1,8}) \s* (?{regComment};.*)?/x"/>
<!-- Key deleting -->
         <block start="/^\s* (?{regKeyDel} (?{regSymbolStrong}\[)                    - HKEY_ (LOCAL_MACHINE|CURRENT_USER|CLASSES_ROOT|USERS|CURRENT_CONFIG|DYN_DATA)                    (\\([^\\].{,259})?)?  (?{regSymbolStrong}\]))                    (?{regComment}.*)$/x" end="/^\M\s*\[/x" scheme="regError"/>
<!-- Deleting -->
         <regexp match="/^\s*(?{regString}&#34;%regStrEl;{,254}&#34;)\s* = \s*                    - \s* (?{regComment};.*)?/x"/>
<!-- Default deleting -->
         <regexp match="/^\s*(?{regString}@)\s* = \s*                    - \s* (?{regComment};.*)?/x"/>
<!-- Signature -->
         <regexp match="/^\s*(?{regSignature}REGEDIT4|FARREG\d\d|Windows Registry Editor Version \d\.\d\d)\s*/"/>
<!-- ##### Erroneous lines #####-->
<!-- Hex  -->
         <regexp match="/^\s*(?{regString}&#34;%regStrEl;{,254}&#34;)\s* = \s*                    (?{regKeyword}h(e(x(?{regSymbol}\(((?{regNumHex}[\da-fA-F]{1,8})\)?)?)?)?)?)                    (?{regError}\s*\S.*?) \s* (?{regComment};.*)?$/x"/>
<!-- Dword -->
         <regexp match="/^\s*(?{regString}&#34;%regStrEl;{,254}&#34;)\s* = \s*                    (?{regKeyword}d(w(o(r(d(?{regSymbol}:\s*)?)?)?)?)?)                    (?{regError}\s*\S.*?) \s* (?{regComment};.*)?$/x"/>
<!-- String -->
         <regexp match="/^\s*(?{regString}&#34;%regStrEl;{,254}) ((?{regString}&#34;) \s* (=\s*                    (?{regString}&#34;%regStrEl;*)?)?)?                    \M\s*\S/x"/>
<!-- Key deleting -->
         <block start="/^\s*(?{regKeyDel} (?{regSymbolStrong}\[) - (HKEY_                    ((LOCAL_MACHINE|CURRENT_USER|CLASSES_ROOT|USERS|CURRENT_CONFIG|DYN_DATA)                    (\\(?{regFunction}[^\\].{,259})?)?)?)? )\M\s*\S/x" end="/^\M\s*\[/x" scheme="regError"/>
<!-- Key -->
         <block start="/^\s*(?{regKey} (?{regSymbolStrong}\[) (HKEY_                    ((LOCAL_MACHINE|CURRENT_USER|CLASSES_ROOT|USERS|CURRENT_CONFIG|DYN_DATA)                    (\\(?{regFunction}[^\\].{,259})?)?)?)? )\M\s*\S/x" end="/^\M\s*\[/x" scheme="regError"/>
<!-- Default hex  -->
         <regexp match="/^\s*(?{regString}@)\s* = \s*                    (?{regKeyword}h(e(x(?{regSymbol}\(((?{regNumHex}[\da-fA-F]{1,8})\)?)?)?)?)?)                    (?{regError}\s*\S.*?) \s* (?{regComment};.*)?$/x"/>
<!-- Default dword -->
         <regexp match="/^\s*(?{regString}@)\s* = \s*                    (?{regKeyword}d(w(o(r(d(?{regSymbol}:\s*)?)?)?)?)?)                    (?{regError}\s*\S.*?) \s* (?{regComment};.*)?$/x"/>
<!-- Default string -->
         <regexp match="/^\s*(?{regString}@) ( \s* (=\s*                    (?{regString}&#34;%regStrEl;*)?)?)?                    \M\s*\S/x"/>
<!-- Leading and trailing spaces -->
         <regexp match="/^\s+/x"/>
         <regexp match="/\s+$/x"/>
<!-- The rest is errors -->
         <regexp match="/.+?/x" region="regError"/>
      </scheme>

   </type>
</hrc>
