[Lazarus] SynEdit Syntax implementation help

Martin lazarus at mfriebe.de
Fri Jun 11 22:09:53 CEST 2010


On 11/06/2010 21:28, ik wrote:
> Hello List,
>
> Following old emails of mine, I've started first doing some very 
> simple syntax, and decided to create a BasicConfig syntax highlight 
> <http://github.com/ik5/SynEdit-syntaxes/blob/master/synhighlighterbasicconfig.pas> 
> (the link is to my code).
> I implemented everything I'm thinking that I understand in 
> implementing the highlight (it will be good to know that it's not the 
> case).
> So now I need to understand better what to do next, and what does it 
> mean each of the method that required to be implemented ?
I am writing this while away, and without full access to my usual work, 
so it will not be too detailed.

There are 2 places in synedit.pp you can look at to see, what is called.

TSynEdit.ScanRanges
TSynEdit.PaintLines (may be nested procedure)

They show you all the methods that get called on the highlighter/
On top of this SynExport, or HtmlExport or similar (and some pascal 
stuff in the IDE SourceEditorProcs) call SetLine/SetRange directly (so 
for now that may need to be supported too)

in the SynEdit folder docs dir is some xml/fpdoc stuff on 
CurrentLines/CurrentRanges ....

---
Highlighter.ScanRanges must ensure all lines are scanned (a proper range 
recored is stored for each line)

In PaintLines the individual tokens are requested by SynEdit. something 
similar to:
- StartAtLine
- GetToken(EX)
- GetAttribute

The tokens returned per line (GetEOL) must match the length of the 
actual line, otherwhise it will crash

Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100611/236033df/attachment-0004.html>


More information about the Lazarus mailing list