Creating a rule XML file

The rules that ChromaCode uses to decide what words, characters, groups etc are highlighted is contained within an XML file.

The following rules can be defined. Click on each one to find out more information abot that particular type of rule:
The following is an example of an XML file that contains all possible rule definitions showing how the file is constructed:

<?xml version="1.0" encoding="utf-8" ?>
  <!--These rules will be applied to key words. These rules are applied first-->
    <rule acitve="true" bold="false" underline="true" italic="true" color="blue">
        <!--space seperated list of words-->
        <![CDATA[the quick brown fox jumped over the lazy dog]]>

  <!--These rules will be applied to individual characters. These rules are applied second-->
    <rule active="true" color="red">
        <!--space seperated list of chars-->
        <![CDATA[+ - / * =]]>

    <rule active="true" color="lightblue">
        <!--space seperated list of chars-->
        <![CDATA[( ) [ ] { }]]>

  <!--These rules will be applied according to a regular expression search string. These rules will be applied thrid-->
  <!--Having too many regular expression rules may hurt perfomance in large documents-->
    <rule active="true" bold="true">
        <![CDATA[\b(0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9]{2}\b]]>

  <!--These rules are applied to all text between the start and ending strings, or the starting string and the end of a line
  if the end string is blank. These rules are applied last of all-->
    <rule active="true" color="green" startString="/*" endString="*/"/>
    <rule active="true" color="darkred" startString="'" endString="'" />
    <rule active="true" color="green" startString="--" />

Last edited May 3, 2011 at 9:44 PM by NybbleUK, version 1


No comments yet.