Complex condition on token sequence.
TTagBlockCondition = class(TRuleCollectionItem);
ecSyntAnal
TTagBlockCondition is a rule that tests conditions stored in ConditionList collection on token sequence (not on the text). Each item in the ConditionList is of TSingleTagCondition class. Block rules test token array each time new token is created.
Algorithm of conditions testing
Checks ConditionList[0] on last token (for example, with index N). (using CheckToken method)
Checks ConditionList[1] on token (with index N - 1).
...
Checks ConditionList[m] on token (with index N - m).
If there is condition (for example, with index m) that has CondType = tcSkip, testing will be:
If checking ConditionList[m+1] on token (with index N) is True, testing proceeds in ConditionList[m + 2], otherwise
if checking ConditionList[m] (tcSkip) on token (with index N) is True, returns to checking ConditionList[m+1] on token (with index N - 1).
Block rule's actions
If block rule's conditions testing succeeds, action depended on the BlockType value is performed.
Type |
Action |
btTagDetect |
Sets Rule of the identifying token to self, therefore Style will be taken from the block rule. |
btLineBreak |
Creates line separator. |
btRangeStart |
Creates text range and set its start token index. |
btRangeEnd |
Closes opened text range, i.e. sets its end token index. |
Understanding of indexing
Block rule operates with relative token indexes. All indexes are back offsets from the indexing reference point.
There are two cases of reference point:
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:
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.
Topic |
Description |
The methods of the TSyntCollectionItem class are listed here. | |
The properties of the TSyntCollectionItem class are listed here. |
Topic |
Description |
The properties of the TRuleCollectionItem class are listed here. |
Topic |
Description |
The methods of the TTagBlockCondition class are listed here. | |
The properties of the TTagBlockCondition class are listed here. | |
The events of the TTagBlockCondition class are listed here. |
|
Constructor |
|
virtual |
|
protected |
|
Property |
|
read only |
|
Event |
TTagBlockCondition Class |
Description |
Occurs after block rule is tested. |
TSyntCollectionItem Methods |
Description |
Creates and initializes a TSyntCollectionItem instance. | |
Indicates whether rule is invalid. | |
Returns initial name of the collection item. | |
Initializes the item after the lexer has been read into memory. |
TTagBlockCondition Class |
Description |
Tests token current sequence for satisfying this block rule. | |
Specifies offset of conditions testing from the end of tokens sequence. | |
Creates and initializes a TTagBlockCondition instance. | |
Destroys an instance of TTagBlockCondition. | |
Returns initial name of the collection item. | |
Initializes the item after the lexer has been read into memory. |
TSyntCollectionItem Properties |
Description |
Specifies the name of the collection item. | |
Controls whether the style or rule is used in syntactical analysis. | |
Indicates whether rule is invalid. |
TRuleCollectionItem Class |
Description |
Specifies whether rule is active in nested lexers. | |
Specifies a rule of parent text range to test. | |
Specifies a rule of parent text range to test. | |
Specifies whether parent text range condition must be inverted. | |
Specifies which state must be absent in current parser state. | |
Specifies which states should be added to current parser states. | |
Specifies which states must be present in current parser state. | |
Specifies which states should be removed from current parser states. | |
Specifies whether Block is rule of the immediate parent text range. | |
Specifies a style associated with the rule. | |
Specifies a style associated with the rule. | |
Returns owner of the rule. |
TTagBlockCondition Class |
Description |
Internal opened ranges are closed when closing the text range of this rule. | |
Specifies how to perform auto-closing opened text ranges. | |
Specifies text which is used to auto-close opened text ranges. | |
Specifies an associated block rule that closes (opens) text range. | |
Specifies an associated block rule that closes (opens) text range. | |
Specifies offset of text range bound from the indexing reference point. | |
Specifies action after successful conditions testing. | |
Breaks block rules test loop. | |
Specifies formatting string for the collapsed icon text. | |
Collection of conditions to test token sequence. | |
Specifies whether text range associated with this rule may be displayed in TSyntaxTreeView. | |
Specifies whether block staple may be displayed at the left side of the text range. | |
Specifies what parts of the text range may be highlighted. | |
Specifies whether only nearest text range of the rule may be highlighted. | |
Specifies whether opened text ranges must be closed when syntactical analysis reaches the end of text. | |
Specifies name of the grammar rule which is used instead of conditions. | |
Specifies formatting string for the group name. | |
Specifies group index that is used to filter ext ranges in the syntax tree view. | |
Specifies whether line highlighting mode is used. | |
Specifies caret position when text range is highlighted. | |
Specifies index of the identifying token relatively to the indexing reference point. | |
Ignores text ranges of this rule to be checked as parent range. | |
Specifies whether style of the marked block (selected block) will be formed from the text range's style with inverted colors. | |
Specifies position of the line separator. | |
Specifies formatting string for the text range name. | |
Specifies whether text range should be closed immediately after opening. | |
Specifies whether text range may be collapsed. | |
Specifies Pen object associated with rule. | |
Specifies position of indexing reference point. | |
Specifies whether ending block rule must compare identifying tokens to close text range. | |
Specifies whether rule should close previously opened text range before opening new text range. | |
Specifies token type to assigned in identifier token. | |
Specifies image index for the group tree nodes. | |
Specifies name of the style used to render group tree nodes. | |
Specifies style used to render group tree nodes. | |
Specifies image index for the tree nodes. | |
Specifies style used to render tree nodes. | |
Specifies name of the style used to render tree nodes. | |
Specifies whether Pen property may be used. |
Copyright (c) 2004-2011. All rights reserved.
|
What do you think about this topic? Send feedback!
|