Table of Contents

Class BashSyntaxHighlighter

Namespace
SharpConsoleUI.Highlighting
Assembly
SharpConsoleUI.dll

Stateless syntax highlighter for Bash / POSIX shell scripts. Colors comments, single- and double-quoted strings, variable expansions, control keywords, common builtins, numbers, and operators. Strings are treated as line-local (no multi-line state), and a leading # only starts a comment when it is at the start of a token (index 0 or preceded by whitespace), so that parameter expansions such as ${VAR#prefix} are not mistaken for comments.

public class BashSyntaxHighlighter : ISyntaxHighlighter
Inheritance
BashSyntaxHighlighter
Implements
Inherited Members
Extension Methods

Methods

Tokenize(string, int, SyntaxLineState)

Tokenizes a single line of a Bash/shell script for syntax highlighting.

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

Parameters

line string

The line text to tokenize.

lineIndex int

The zero-based index of the line within the document.

startState SyntaxLineState

The incoming per-line state (unused; this highlighter is stateless).

Returns

(IReadOnlyList<SyntaxToken> Tokens, SyntaxLineState EndState)

The tokens for the line and the (unchanged) end state.