EControl Syntax Editor SDK
Example
Rule "class derived" of LexLib.Pascal:
0. EQUAL        <identifier>
1. EQUAL   )    <symbol>
2. SKIP         <symbol, identifier>
3. EQUAL   (    <symbol>
4. EQUAL class  <identifier>
5. EQUAL   =    <symbol>

                       TComponent = class ( TPersistent , IInterface , IInterfaceComponentReference )
Conditions start          9           8       7      6            5            4           3            2                                   1                      0
Conditions end           1           0       -1     -2           -3           -4          -5          -6                                   -7                     -8

 

Due to there is SKIP condition in this rule, we do not know length of token sequence that satisfies this rule. To specify indexing reference point use "Relative to end of condition" flag . If RefToCondEnd is True, indexing reference point - conditions end, otherwise indexing reference point - conditions start. In this example we must set this flag to True to get index of the class name token (1). 

 

Text ranges folding 

All closed text ranges support folding. To forbid folding for text ranges that is created by the particular block rule, set NotCollapsed property of this rule to True. 

 

Text ranges highlighting 

Highlighting Style is derived from TRuleCollectionItem. There are two cases of highlighting:

  1. Line highlighting, when only background and foreground colors are applied, but for the whole line (even for text that is not a part of the text range, but it is in the same line).
  2. Text highlighting, all style properties applied to the Canvas.

Highlighting mode is specified by the Highlight property. It it is True, text range has line highlighting mode (you also have to specify InvertColors property in this mode), otherwise - text highlighting mode. 

 

Parts of the text range that may be highlighted specified by the DynHighlight property. 

Highlighting of the text range may depend on caret position in the editor. To specify active highlighting use HighlightPos and DynSelectMin properties. 

 

Properties that are used by the TSyntaxTreeView control. 

To customize representation of the text range in syntax tree view specify next properties of starting block rule (btRangeStart): 

DisplayInTree specifies that text range must be displayed in syntax tree. 

NameFmt - formatting string to get name of the text range. 

GroupFmt - formatting string to get group name of the text range. If group name is not specified parent node will be associated with a parent text range, otherwise new node with group name caption will be created and the text range will be a child of this group node. 

See "Name formatting" to get more information about naming.

Copyright (c) 2004-2011. All rights reserved.