Skip to content
Scriptable Highlighter for the SynEdit Component of Lazarus
Pascal Shell
Branch: 1.21
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Docs Add files via upload Jan 15, 2018
Sample_Project Add files via upload Jun 18, 2017
Sample_lexer Add files via upload Jun 18, 2017
Speed_Test_Project Add files via upload Apr 24, 2017
synfacil_adapter_atsynedit Add files via upload May 1, 2019
CHANGES.txt Add files via upload Oct 22, 2018 No commit message Sep 9, 2015
LICENSE Initial commit May 29, 2014 Add files via upload Oct 22, 2018
SynFacilBasic.pas Add files via upload Oct 22, 2018
SynFacilHighlighter.pas Add files via upload Oct 22, 2018

SynFacilSyn 1.21

Scriptable Highlighter for SynEdit Component of Lazarus


This highlighter is similar to the SynAnySyn of Lazarus, but it's much more faster, efficient and more configurable.

It can be used too, like a full lexical analyzer that can be configured to handle a variety of programming languages.

The highlighter TSynFacilSyn can read a complete syntax from an external XML file.


• Configurable. Can highlight words of a SynEdit control, using an external XML file, or using code.

• It's fast and Light. It's optimized on speed to be comparable to a hard coded highlighter.

• It's easy to configure the more common elements of a language, like identifiers, strings, numbers, and comments.

• It's based on tokens and attributes. Each kind of token contains a single attribute.

• It's possible to define the characters that are valid for identifiers. So it can be adapted to the specific definition of each language.

• It can manage subsets of identifiers (keywords, variables, ..) and subsets of symbols (operators, separators, etc).

• It can define multiline elements like strings and comments.

• It can define new tokens using pre-defined tokens, like <<HEREDOC elements.

• Includes the property “CaseSensitive”, to compare the Case of chars.

• It can define blocks of code folding. Includes several options to suit most programming languages.

• It can define syntax blocks (with or without folding) and can paint the background of the blocks.

• The XML file admits complete and simplified forms of definitions.

• It includes several predefined attributes, but it can be defined more dynamically.

• It can use basic Regex for the token definition.

• Includes a script language to create complex definitions of tokens.

Using on a program.

This highlighter, is contained on two files: "SynFacilHighlighter.pas" and "SynFacilBasic.pas". You should copy them to the folder where the project is working, or on your personal units path.

Once copied, it must be included the unit "SynFacilHighlighter" in the USES statement of the units who are going to work with the highlighter.

Then it's necessary to create an object of the class TSynFacilSyn, and assign it to the SynEdit editor:

uses  ... , SynFacilHighlighter;

    hlt : TSynFacilSyn;

  hlt := TSynFacilSyn.Create(self); 
  editor.Highlighter := hlt;
  hlt.LoadFromFile('SynPHP.xml');   //load the syntax file

To use the highlighter, it's necessary first, to have the syntax configurated on the XML file or by code.

One simple XML syntax file could be:

<Language name=”simple”>
and echo else exit for if 

For more information, see the documentation.

You can’t perform that action at this time.