Prototypes

constructor Create(const aName, aPattern: string; aColor: TColor; aStyles: TFontStyles = []); overload;

constructor Create(const aPattern: string; aColor: TColor; aStyles: TFontStyles = []); overload;

Description

Constructor that allows all properties to be defined at once.

aPattern contains the regular expression to find the elements that will be highlighted using aColor and aStyles.

aName is optional. It may facilitate future modifications when the application theme is changed, especially for presets.

Example

procedure TDataModule1.MDStyle1SyntaxHighlighting(Sender: TObject; const aLanguage: string; var aStyles: TMDSyntaxStyles);
begin
  aStyles := [
    // Reserved words
    TMDSyntaxStyle.Create('\b(?>hello|world)\b', clNavy, [fsBold]),
    // IP addresses
    TMDSyntaxStyle.Create('\b(?>(25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}\g<1>\b', clGreen)
    // and so on!
  ];
end;

See also

TMDSyntax

TMDStyle.OnSyntaxHighlighting

TMDCustomControl.OnSyntaxHighlighting