Table of Contents

Interface ISyntaxHighlighter

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

Provides syntax highlighting by tokenizing source lines into colored spans. Implement this interface to provide custom syntax coloring for specific languages or formats.

public interface ISyntaxHighlighter
Extension Methods

Methods

Tokenize(string, int, SyntaxLineState)

Tokenizes a source line given the parse state at its start. Returns the token list and the parser state at the end of the line (to be passed as startState for the next line).

(IReadOnlyList<SyntaxToken> Tokens, SyntaxLineState EndState) Tokenize(string line, int lineIndex, SyntaxLineState startState)

Parameters

line string

The source line text to tokenize.

lineIndex int

The zero-based line index within the document.

startState SyntaxLineState

The parser state at the start of this line.

Returns

(IReadOnlyList<SyntaxToken> Tokens, SyntaxLineState EndState)