Mega Code Archive

 
Categories / Delphi / Examples
 

How to use a Syntax Highlighter

Title: How to use a Syntax Highlighter * Question: I want to create my own highlighter rising from Pascal (C++,...) How can I highlight keywords? * Answer: Have a look at the SynEdit component at Synedit.Sourceforge SynEdit is a multi-line edit control, for Borland Delphi and C++Builder. SynEdit is packaged together with highlighter classes which are used to syntax highlight many programming languages source code such as: C++, Fortran, Java, Pascal, Visual Basic, Cascading Style Sheets, HTML, JavaScript, PHP (Apache), VBScript, Perl, TCL/Tk, SQL, x86 Assembler, Inno Setup Scripts, Python etc. (currently over 30 languages) There's also a demo that shows you how to create your own highlighter using a grammar file and the SynGen utility. * Some further Features: TSynExporterHTML: Allows you to export a Code to HTML. TSynExporterRTF: Allows you to export a Code to RTF. TSynCompletionProposal: Code Completion TSynMultiSyn: Allows you to syntax highlight documents with many highlighters based on schemes that you define. (HTML documents with Cascading Style Sheets and JavaScript) TSynMacroRecorder: Record Macros TSynEditPrint: Print Control TSynEditPrintPreview: Print preview