whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

52 Visitors Online


 
...use a Syntax Highlighter?
Autor: Thomas Stutz
[ Print tip ]  

Tip Rating (11):  
     




* 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

{*******************************************************}


* Frage:

Ich möchte einen eigenen Syntax Highligter schreiben, um bestimmte
Schlüsselwörter hervorzuheben (Z.B so wie in der Delphi-IDE)
Wie kann ich das realisieren?

* Antwort:

Es gibt eine Komponente TSynEdit um für einen Quelltext Syntaxhervorhebung
zu realisieren.
Die TSynEdit Komponente findet man hier: Synedit.Sourceforge und ist
sowohl für Delphi als auch für den C++Builder.

Das SynEdit Package enthält viele verschiedene Syntaxhighlighter. Z.B für C++, Fortran,
Java, Pascal, Visual Basic, Cascading Style Sheets, HTML, JavaScript, PHP (Apache),
VBScript, Perl, TCL/Tk, SQL, x86 Assembler, Inno Setup Scripts, Python usw.
(momentan über 30 Sprachen)

Es besteht auch die Möglichkeit für seine eigene Script-Sprache
Syntaxhervorhebung zu realisieren.

* Einige weitere Möglichkeiten des SynEdit Packages:

TSynExporterHTML: Damit kann man einen Quelltext in ein HTML Format exportieren
TSynExporterRTF: Damit kann man einen Quelltext in ein RTF Format exportieren
TSynCompletionProposal: Ermöglicht Code Vervollständigung
TSynMultiSyn: Damit kann man mehrere Sprachen in einem SynEdit highlighten.
(Z.B HTML Dokumente mit JavaScript usw.)
TSynMacroRecorder: Damit kann man Makros auzeichnen
TSynEditPrint: Drucker Kontrolle
TSynEditPrintPreview: Ermöglicht eine Druck-Vorschau

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners