Class KeywordRule
- Namespace
- BlazOrbit.SyntaxHighlight.Rules
- Assembly
- BlazOrbit.SyntaxHighlight.dll
Matches a fixed set of keywords with optional case-insensitive comparison.
public sealed class KeywordRule : ITokenRule
- Inheritance
-
objectKeywordRule
- Implements
Constructors
KeywordRule(TokenType, IEnumerable<string>, int)
Initializes a new instance of the KeywordRule class.
public KeywordRule(TokenType tokenType, IEnumerable<string> keywords, int priority = 0)
Parameters
tokenTypeTokenTypekeywordsIEnumerable<string>priorityint
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 keyword at the specified position.
public TokenMatch? TryMatch(string input, int position, TokenizerContext context)
Parameters
inputstringpositionintcontextTokenizerContext