The CodeXCavator application supports the following built-in syntax highlighters:
The RegexHighlighter highlights source code elements by using regular expression patterns. You can specify an arbitrary number of element types, which should be highlighted. For each element type a regular expression pattern must be provided and the text foreground color, which should be used for highlighting.
Example: Using and configuring the RegexHighlighter
<Highlighter Type="RegexHighlighter" FileExtensions=".xml">
<Configuration CaseSensitive="true">
<Patterns>
<Pattern Token="COMMENT_START" RegEx="<\!\-\-" Color="#ff808080"/>
<Pattern Token="COMMENT_END" RegEx="\-\->" Color="#ff808080"/>
<Pattern Token="XML_TAG_START" RegEx="</|<\?|<" Color="#ff0000ff"/>
<Pattern Token="XML_TAG_END" RegEx="/>|\?>|>" Color="#ff0000ff"/>
<Pattern Token="XML_ATTRIBUTE" RegEx="[a-zA-Z_0-9_-]+\s*\=" Color="#ffff0000"/>
<Pattern Token="XML_ATTRIBUTE_VALUE" RegEx="@\"(?:\"\"|[^\"\r\n])*\"|\"(?:\\.|[^\\\"\r\n])*\"" Color="#ffff00ff"/>
<Pattenr Token="XML_NAMESPACE_DECL" RegEx="xmlns:" Color="#ff0080ff"/>
<Pattern Token="TAG" RegEx="\+\#[_a-zA-Z][a-zA-Z_0-9\.]*\#\+" Color="#ffff8000"/>
</Patterns>
</Configuration>
</Highlighter>
The RegexHighlighter treats the following token types in a special manner
KEYWORD and IDENTIFIER:
Keyword and identifier tokens are treated specially. As patterns for identifiers are often more general than patterns for keywords, they might include keywords a substrings, which would lead to broken highlighting. In this case if a string simultanously matches a keyword and an identifier the keyword is only highlighted if it is not a part of the matched identifier.
COMMENT_START and COMMENT_END:
The comment start and comment end token types are used for highlighting multiline block comments. In this case the color specified with the COMMENT_START pattern is used for highlighting. While the highlighter is highlighting a block comment, all other highlighter patterns are ignored except for the tag pattern.
LINE_COMMENT:
The line comment token type is used for highlighting single line comments. While the highlighter is highlighting a line comment, all other highlighter patterns are ignored except for the tag pattern.
TAG:
The tag token type is used for highlighting tags contained in source code comments.