Configuration of Syntax Highlighting

Syntax:

        colorize Mode[:Parent] { Settings }

# Settings

- SyntaxParser

  Syntax:

          SyntaxParser = "Parser";

  Activates the specified syntax parser for highlighting mode. Value of `Parser` can be chosen from:

  PLAIN
    No syntax parser, only keyword highlighting is available.
  SIMPLE
    User configurable syntax parser will be defined.
  C
  REXX
  HTML
  PERL
  MAKE
  DIFF
    For viewing output of diff.
  MERGE
    For editing output of rcsmerge (RCS, CVS).
  IPF
  Ada
  MSG
    For editing E-Mail,
  SH
  PASCAL
  TEX
  FTE
  CATBS
    For VIEWING ONLY of nroff formatted man-pages (formatted with backspaces).

- Keywords

  Syntax:

          keyword "color_specification" {
              "keyword", ...
          };

  Multiple keyword sets with different colors can be defined.

- Colors

  Syntax:

          color {
              "color_name", "color_specification"
              ...
          };

  The following color-names are available, which ones will actually be used depends on the SyntaxParser setting used:

  - TODO: make color names dynamic at least for user defined parsers.

# Configurable Syntax Parser

This is not fully stabilized yet. Might change in the future.

When SyntaxParser is set to "SIMPLE", the following commands can be used to configure the state machine used for parsing the text.

h_state
  Defines a new state for the state machine

      h_state state_number {
          "default_color_name"
      }

  h_state command takes the following parameters:

  `state_number`
    States must be numbered sequentially from 0 without skipping any number.
  `default_color_name`
    Contains the name of default color used for characters that are not matched by any transition string or keyword.

h_wtype
  Specifies the keyword matching parameters for current state. There can be only one h_wtype keyword per state.

      h_wtype {
          next_state_if_matched,
          next_state_if_not_matched,
          next_state_if_no_keyword,
          "state_flags",
          "keyword_charset"
      }

  h_wtype takes the following arguments:

  `next_state_if_matched`
    The number of the next state if any keyword is matched. Can be -1 to keep current state.
  `next_state_if_not_matched`
    The number of the next state if no keyword is matched. Can be -1 to keep current state.
  `next_state_if_no_keyword`
    The number of next state if no keyword is found at all. Can be -1 to keep current state.
  `state_flags`
    String containing zero or more of the following characters:

    i
      Keyword matching is performed case-insensitively.

h_trans
  Defines a new state transition for current state.

      h_trans {
          next_state,
          trans_flags,
          trans_match,
          color_name
      }

  h_trans command takes the following parameters:

  `next_state`
    The number of next state to go if a match is successful.
  `trans_flags`
    Determines options for matching. Can contain zero or more of the following characters:

    ^
      Matches only at the beginning of the line.
    $
      Matches only at the end of the line.
    i
      Match is case-insensitive.
    s
      `trans_match` is a character set. Matches only if the next character is part of the set.
    S
      Same as 's' but next character must not be part of the set.
    x
      `trans_match` is a regular expression. If some part of expression is enclosed in parentheses, pointer is advanced up to the start of parenthesized match (WARNING: this can cause infinite loops).
    -
      After successfull match, the pointer is not advanced, matching will resume at the same position in next state. (WARNING: this can cause infinite loops).
    <
      The matched character(s) are tagged with current state number. This is important for proper operation of MatchBracket command. MatchBracket will only match braces tagged with same state number.
    >
      The matched character(s) are tagged with next state number.
    q
      On successful match quote the next character (the next character is not used for matching).
    Q
      On successful match quote the end of line (the end of line is not used for matching).
  `trans_match`
    When S or s option is used, a character set to be matched. When S or s options are not used, a string to be matched.

h_words
  Specifies the set of keywords to match in this state. All characters in keywords must be part of the `keyword_charset` in h_wtype command for this mode.

          h_words "color_specification" {
              "keyword", ...
          }

  Works the same way as the keyword but keywords are for current state only.

  Multiple keyword sets with different colors can be defined.

  '-' can be used for color specifier do use the default keyword color specified in global settings.