Table of Contents

Class RegexTokenDef

Namespace
InteractiveReadLine.Tokenizing
Assembly
InteractiveReadLine.dll

Defines a token type for a regular-expression parser. The definition contains a matching pattern, automatically anchored with ^ when necessary, and an optional type code for matching tokens.

public class RegexTokenDef
Inheritance
RegexTokenDef
Inherited Members

Constructors

RegexTokenDef(string, int)

Creates a token definition from a regular expression pattern.

public RegexTokenDef(string pattern, int typeCode = 0)

Parameters

pattern string

The pattern that identifies the token. The constructor adds a leading ^ when the pattern does not already have one.

typeCode int

A code that identifies this token type in the resulting tokens.

Properties

Pattern

Gets the string version of the regex pattern defined to match tokens of this type

public string Pattern { get; }

Property Value

string

Regex

Gets the regular expression created from the Pattern property.

public Regex Regex { get; }

Property Value

Regex

TypeCode

Gets the optional type code to assign to tokens matched by the Pattern property

public int TypeCode { get; }

Property Value

int