/// <summary>Context for doing semantic colorizing.</summary>
struct
SemanticColorizeContext
:
ParsingTokenContext
{
/// <summary>Output semantic id that comes from one the argument in the @Semantic attribute.</summary>
vint
semanticId
;
};
private
:
collections
::
Dictionary
<
WString
,
ColorEntry
>
colorSettings
;
collections
::
Dictionary
<
vint
,
vint
>
semanticColorMap
;
SpinLock
contextLock
;
RepeatingParsingOutput
context
;
void
OnParsingFinishedAsync
(
const
RepeatingParsingOutput
&
output
)
override
;
protected
:
/// <summary>Called when the node is parsed successfully before restarting colorizing.</summary>
/// <param name="context">The result of the parsing.</param>
virtual
void
OnContextFinishedAsync
(
const
RepeatingParsingOutput
&
context
);
void
Attach
(
elements
::
GuiColorizedTextElement
*
_element
,
SpinLock
&
_elementModifyLock
,
compositions
::
GuiGraphicsComposition
*
_ownerComposition
,
vuint
editVersion
)
override
;
void
Detach
()
override
;
void
TextEditPreview
(
TextEditPreviewStruct
&
arguments
)
override
;
void
TextEditNotify
(
const
TextEditNotifyStruct
&
arguments
)
override
;
void
TextCaretChanged
(
const
TextCaretChangedStruct
&
arguments
)
override
;
void
TextEditFinished
(
vuint
editVersion
)
override
;
/// <summary>Called when a @SemanticColor attribute in a grammar is activated during colorizing to determine a color for the token. If there is an <see cref="RepeatingParsingExecutor::IParsingAnalyzer"/> binded to the <see cref="RepeatingParsingExecutor"/>, this function can be automatically done.</summary>
/// <param name="context">Context for doing semantic colorizing.</param>
/// <param name="input">The corressponding result from the <see cref="RepeatingParsingExecutor"/>.</param>
virtual
void
OnSemanticColorize
(
SemanticColorizeContext
&
context
,
const
RepeatingParsingOutput
&
input
);
/// <summary>Call this function in the derived class's destructor when it overrided <see cref="OnSemanticColorize"/>.</summary>
void
EnsureColorizerFinished
();
public
:
/// <summary>Create the colorizer with a created parsing executor.</summary>