Table of Contents

Class RegexRule

Namespace
BlazOrbit.SyntaxHighlight.Rules
Assembly
BlazOrbit.SyntaxHighlight.dll

Matches tokens using a regular expression pattern.

public sealed class RegexRule : ITokenRule
Inheritance
object
RegexRule
Implements

Constructors

RegexRule(TokenType, string, bool, int)

Initializes a new instance of the RegexRule class.

public RegexRule(TokenType tokenType, string pattern, bool requireWordBoundary = false, int priority = 0)

Parameters

tokenType TokenType
pattern string
requireWordBoundary bool
priority int

Properties

Priority

Gets the priority of this rule. Higher values are evaluated first.

public int Priority { get; }

Property Value

int

Methods

TryMatch(string, int, TokenizerContext)

Attempts to match a regex pattern at the specified position.

public TokenMatch? TryMatch(string input, int position, TokenizerContext context)

Parameters

input string
position int
context TokenizerContext

Returns

TokenMatch?