Highlighter Demo
Folder: Demos\HighlighterDemo. Project: HighlighterDemo.dproj.
Shows how to create your own highlighter using a grammar file and the SynGen utility: see Create your Highlighter.
| File | Content |
|---|---|
SynHighlighterSample.msg | The grammar file: the class TSynSampleSyn, its token types with the default attributes, and the keywords. |
SynHighlighterSample.pas | The unit generated by SynGen from the grammar. |
uMain.pas | The main form: an editor that uses the sample highlighter. |
The grammar
text
TSynSampleSyn
tk
IdentStart '_', 'a'..'z', 'A'..'Z':: '_', '0'..'9', 'a'..'z', 'A'..'Z'::
TOKENTYPES
Identifier
Comment Style=[fsItalic]|Foreground=clNavy
Space
String Foreground=clRed
Key Style=[fsBold]
Test Background=clSilver|Foreground=clBlue|Style=[fsUnderline, fsItalic]
|><|
KEYS
Hello
World
|><|
KEYS Test
SynEdit
|><|The words Hello and World are keywords, shown in bold, and SynEdit is of the type Test, shown in blue on a silver background.
