C# Class ICSharpCode.AvalonEdit.Highlighting.DocumentHighlighter

This class can syntax-highlight a document. It automatically manages invalidating the highlighting when the document changes.
Inheritance: ILineTracker, IHighlighter
ファイルを表示 Open project: kjk/kjkpub Class Usage Examples

Private Properties

Property Type Description
AllocateMatchArray System.Text.RegularExpressions.Match[]
CheckIsHighlighting void
HighlightLineAndUpdateTreeList void
HighlightLineInternal void
HighlightNonSpans void
HighlightUpTo void
ILineTracker void
ILineTracker void
ILineTracker void
ILineTracker void
Minimum System.Text.RegularExpressions.Match
PopAllColors void
PopColor void
PushColor void
ResetColorStack void

Public Methods

Method Description
DocumentHighlighter ( TextDocument document, ICSharpCode.AvalonEdit.Highlighting.HighlightingRuleSet baseRuleSet ) : System

Creates a new DocumentHighlighter instance.

GetSpanStack ( int lineNumber ) : ICSharpCode.AvalonEdit.Utils.ImmutableStack

Gets the span stack at the end of the specified line. -> GetSpanStack(1) returns the spans at the start of the second line.

GetSpanStack(0) is valid and will always return the empty stack.

HighlightLine ( DocumentLine line ) : HighlightedLine

Highlights the specified document line.

InvalidateHighlighting ( ) : void

Invalidates all stored highlighting info. When the document changes, the highlighting is invalidated automatically, this method needs to be called only when there are changes to the highlighting rule set.

Protected Methods

Method Description
OnHighlightStateChanged ( DocumentLine line, int lineNumber ) : void

Is called when the highlighting state at the end of the specified line has changed.

This callback must not call HighlightLine or InvalidateHighlighting. It may call GetSpanStack, but only for the changed line and lines above. This method must not modify the document.

Private Methods

Method Description
AllocateMatchArray ( int count ) : System.Text.RegularExpressions.Match[]
CheckIsHighlighting ( ) : void
HighlightLineAndUpdateTreeList ( DocumentLine line, int lineNumber ) : void
HighlightLineInternal ( DocumentLine line ) : void
HighlightNonSpans ( int until ) : void
HighlightUpTo ( int targetLineNumber ) : void
ILineTracker ( ) : void
ILineTracker ( DocumentLine line ) : void
ILineTracker ( DocumentLine insertionPos, DocumentLine newLine ) : void
ILineTracker ( DocumentLine line, int newTotalLength ) : void
Minimum ( Match arr, Match endSpanMatch ) : Match

Returns the first match from the array or endSpanMatch.

PopAllColors ( ) : void
PopColor ( ) : void
PushColor ( ICSharpCode.AvalonEdit.Highlighting.HighlightingColor color ) : void
ResetColorStack ( ) : void

Method Details

DocumentHighlighter() public method

Creates a new DocumentHighlighter instance.
public DocumentHighlighter ( TextDocument document, ICSharpCode.AvalonEdit.Highlighting.HighlightingRuleSet baseRuleSet ) : System
document ICSharpCode.AvalonEdit.Document.TextDocument
baseRuleSet ICSharpCode.AvalonEdit.Highlighting.HighlightingRuleSet
return System

GetSpanStack() public method

Gets the span stack at the end of the specified line. -> GetSpanStack(1) returns the spans at the start of the second line.
GetSpanStack(0) is valid and will always return the empty stack.
public GetSpanStack ( int lineNumber ) : ICSharpCode.AvalonEdit.Utils.ImmutableStack
lineNumber int
return ICSharpCode.AvalonEdit.Utils.ImmutableStack

HighlightLine() public method

Highlights the specified document line.
public HighlightLine ( DocumentLine line ) : HighlightedLine
line ICSharpCode.AvalonEdit.Document.DocumentLine The line to highlight.
return HighlightedLine

InvalidateHighlighting() public method

Invalidates all stored highlighting info. When the document changes, the highlighting is invalidated automatically, this method needs to be called only when there are changes to the highlighting rule set.
public InvalidateHighlighting ( ) : void
return void

OnHighlightStateChanged() protected method

Is called when the highlighting state at the end of the specified line has changed.
This callback must not call HighlightLine or InvalidateHighlighting. It may call GetSpanStack, but only for the changed line and lines above. This method must not modify the document.
protected OnHighlightStateChanged ( DocumentLine line, int lineNumber ) : void
line ICSharpCode.AvalonEdit.Document.DocumentLine
lineNumber int
return void