C# 클래스 PowerArgs.Cli.SimpleSyntaxHighlighter

A utility that makes it easy to perform common types of syntax highlighting based on keywords, regular expressions, etc.
파일 보기 프로젝트 열기: adamabdelhamed/PowerArgs

Private Properties

프로퍼티 타입 설명
EnsureHighlighted bool

공개 메소드들

메소드 설명
AddConditionalKeyword ( string keyword, Func conditionEval, ConsoleColor fg = null, ConsoleColor bg = null, System.StringComparison comparison = StringComparison.InvariantCulture ) : void

Registers a keyword with the highlighter that should only be highlighted if some condition is true

AddKeyword ( string keyword, ConsoleColor fg = null, ConsoleColor bg = null, System.StringComparison comparison = StringComparison.InvariantCulture ) : void

Registers a keyword with the highlighter.

AddRegex ( string regex, ConsoleColor fg = null, ConsoleColor bg = null ) : void

Registers a regular expression with the highlighter. Tokens that exactly match the given regex will be highlighted.

AddTokenHighlighter ( ITokenHighlighter highlighter ) : void

Registers a custom token highlighter

SetNumericHighlight ( ConsoleColor fg = null, ConsoleColor bg = null ) : void

Lets you control how numeric values should be highlighted

SetQuotedStringLiteralHighlight ( ConsoleColor fg = null, ConsoleColor bg = null ) : void

Lets you control how quoted string literals should be highlighted

SimpleSyntaxHighlighter ( ) : System

Creates a new SimpleSyntaxHighlighter

TryHighlight ( RichCommandLineContext readerContext ) : bool

The implementation of ISyntaxHighlighter that uses the configuration you've created to perform syntax highlighting.

비공개 메소드들

메소드 설명
EnsureHighlighted ( Token token, RichCommandLineContext context, ConsoleColor fg, ConsoleColor bg ) : bool

메소드 상세

AddConditionalKeyword() 공개 메소드

Registers a keyword with the highlighter that should only be highlighted if some condition is true
public AddConditionalKeyword ( string keyword, Func conditionEval, ConsoleColor fg = null, ConsoleColor bg = null, System.StringComparison comparison = StringComparison.InvariantCulture ) : void
keyword string The keyword that will conditionally be highlighted when found on the command line
conditionEval Func the conditional evaluation function
fg ConsoleColor The foreground highlight color
bg ConsoleColor The background highlight color
comparison System.StringComparison Determines how strings are compared.
리턴 void

AddKeyword() 공개 메소드

Registers a keyword with the highlighter.
public AddKeyword ( string keyword, ConsoleColor fg = null, ConsoleColor bg = null, System.StringComparison comparison = StringComparison.InvariantCulture ) : void
keyword string The keyword that will be highlighted when found on the command line
fg ConsoleColor The foreground highlight color
bg ConsoleColor The background highlight color
comparison System.StringComparison Determines how strings are compared.
리턴 void

AddRegex() 공개 메소드

Registers a regular expression with the highlighter. Tokens that exactly match the given regex will be highlighted.
public AddRegex ( string regex, ConsoleColor fg = null, ConsoleColor bg = null ) : void
regex string the regular expression pattern to search for
fg ConsoleColor The foreground highlight color
bg ConsoleColor The background highlight color
리턴 void

AddTokenHighlighter() 공개 메소드

Registers a custom token highlighter
public AddTokenHighlighter ( ITokenHighlighter highlighter ) : void
highlighter ITokenHighlighter the custom highlighter
리턴 void

SetNumericHighlight() 공개 메소드

Lets you control how numeric values should be highlighted
public SetNumericHighlight ( ConsoleColor fg = null, ConsoleColor bg = null ) : void
fg ConsoleColor The foreground highlight color
bg ConsoleColor The background highlight color
리턴 void

SetQuotedStringLiteralHighlight() 공개 메소드

Lets you control how quoted string literals should be highlighted
public SetQuotedStringLiteralHighlight ( ConsoleColor fg = null, ConsoleColor bg = null ) : void
fg ConsoleColor The foreground highlight color
bg ConsoleColor The background highlight color
리턴 void

SimpleSyntaxHighlighter() 공개 메소드

Creates a new SimpleSyntaxHighlighter
public SimpleSyntaxHighlighter ( ) : System
리턴 System

TryHighlight() 공개 메소드

The implementation of ISyntaxHighlighter that uses the configuration you've created to perform syntax highlighting.
public TryHighlight ( RichCommandLineContext readerContext ) : bool
readerContext RichCommandLineContext Context that is used internally
리턴 bool