SynGen .msg Designer is a browser-based tool for creating and editing SynEdit .msg files used in Delphi syntax highlighters. It provides structured editors for KEYS, CHARS, TOKENS, and sample source sections, validates your grammar, and exports a fully compliant .msg file for use in custom syntax highlighters.
This tool is designed for Delphi developers working with SynEdit, SynHighlighter, and custom language grammars. It simplifies the creation of message files by providing a clean interface, live validation, and instant export.
A .msg file is a SynEdit Highlighter Descriptor — a plain-text specification that the SynEdit highlighter generator uses to create a complete Delphi syntax-highlighting unit. It defines the token types, keywords, character dispatch rules and enclosure pairs for any programming language or file format.
SynGen .msg Designer gives you a visual canvas for building these files without writing any descriptor syntax by hand.
| Section | Purpose |
|---|---|
| Header | Sets the generated class name (TSyn…Syn), the token-kind enum prefix, and the identifier character sets. One per document. |
| Token types | Each token type becomes a value in the TtkTokenKind enumeration and a TSynHighlighterAttributes instance with its own foreground, background and font style. Add as many as your language needs. |
| Key groups | A KEYS block maps a list of reserved words to one token type. The group name must exactly match a token type name. |
| Char rules | Auto-generated from the Header's Ident start chars. Defines which characters trigger the identifier scanner and provides the BeginProc/EndProc dispatch body. Read-only. |
| Enclosed by | Defines delimiter pairs (e.g. { }, /* */, " ") and whether they can span multiple lines. |
| Sample source | A block of representative code shown in the SynEdit highlighter preview dialog. One per document. |
The Common presets area in the palette provides one-click buttons for the token types found in almost every programming language. Clicking a preset:
| Preset | Auto-adds enclosure(s) |
|---|---|
| Identifier | — |
| Comment | Line comment ; and block comment {…} |
| String | Double-quote string "…" |
| Keyword | — |
| Number | — |
| Directive | Compiler directive {$…} |
| Space / Symbol / Attribute | — |
| DocComment | Block doc comment /**…*/ |
Each preset token type is created with sensible default colours and font styles. You can customise them in the Inspector after adding them.
Adding sections: drag a palette item onto a lane. Drop onto the lane header (← drop here hint) or the lane body. The lane highlights blue when the drop is valid, red when the type is wrong for that lane.
Reordering: drag a card onto another card within the same lane to swap their positions. Order matters — it controls the order in the generated file.
Selecting: click any card to open its properties in the Inspector. The selected card shows a blue outline.
Renaming: double-click any card title to edit it in place. Press Enter to confirm or Esc to cancel. Works on Token type names, Key group names, and Enclosure rule names.
Removing: click the icon on the top-right of any card. The Char rule card cannot be removed — it is managed automatically.
Resizing panels: drag the thin vertical handles between the palette, canvas and inspector to adjust panel widths.
Each token type has independent foreground and background colour controls. Enable a colour with the checkbox, then use the colour editor:
Swatch bar: the wide bar shows the current colour. Click anywhere on it to open the browser's native colour picker.
RGB sliders: drag the Red, Green and Blue sliders for precise channel control. The value updates live.
Output format: choose how the colour is written into the .msg file — Name (e.g. clNavy), $Hex (Delphi BGR format, e.g. $00800000) or RGB() (e.g. RGB(0,0,128)).
Click Validate in the toolbar to check the document for structural errors. Each problem is shown as a red highlight on the affected lane, with a badge showing the number of issues and a list of descriptions below the lane body.
Common issues:
| Issue | Fix |
|---|---|
| Key group has no matching token type | Ensure the group name exactly matches a token type name (case-sensitive). |
| Key group has no keywords | Add at least one keyword in the Inspector. |
| Enclosure references unknown token type | Set Token type to an existing token type name. |
| No Header section | Drag a Header card from the palette. |
Validation errors clear automatically as soon as you make any change to the document.
A .msg file saved from SynGen can be reopened at any time to continue editing. Click Open .msg in the toolbar or the start page, then select the file.
The loader restores all sections exactly as they were saved:
| Section | Restored from |
|---|---|
| Header | Class name, token prefix, ident chars (first 3 lines) |
| Token types | TOKENTYPES block — names and colour/style expressions |
| Key groups | Each KEYS block — group name and word list |
| Char rules | CHARS block is read then auto-regenerated from the header |
| Enclosures | ENCLOSEDBY block — token type, rule name, delimiters, multi-line flag |
| Sample source | SAMPLESOURCE block — verbatim text |
Click Generate .msg to open the output modal. The generated file is syntax-highlighted for readability. Use Copy to clipboard to paste it into your project, or Save .msg file to download it directly. The filename is derived from the class name in the Header card.
| Key | Action |
|---|---|
| Enter | Add a keyword in the keyword input field |
| Esc | Close the Generate modal or Help panel |
You can reverse-parse an existing SynEdit highlighter unit to populate the designer automatically. Click Open .pas in the toolbar or the Open .pas file button on the start page, then select a SynHighlighterXxx.pas file.
The parser extracts:
| Extracted from | Populated in |
|---|---|
| class TSynXxxSyn | Header — class name and token prefix |
| TtkTokenKind enum values | Token type cards (one per tk… value) |
| fXxxAttri.Style/Foreground/Background in constructor | Token type colour and font style |
| Keyword string constants + EnumerateKeywords calls | Key group cards with full word lists |
| Next procedure char dispatch (#34, #39, ';', '//', '{'…) | Enclosure cards |
| GetSampleSource function | Sample source card |
| IdentProc character ranges in Next | Header ident start chars + auto Char rule |
SynGen .msg Designer is copyright © 2026 Mark Stephen Day. All Rights Reserved.
Source code: github.com/GrooverMD/SynEditMsgDesigner
Built with assistance from Claude AI by Anthropic.
SynEdit: github.com/TurboPack/SynEdit