RegexSyntaxNode Class

The base of every node in a regular-expression tree.

public abstract class RegexSyntaxNode : SyntaxNode
Inheritance
SyntaxNode RegexSyntaxNode

Properties

NameDescription
DialectGets the dialect the node was parsed as, or null when it is not part of a tree.
OptionsGets the options in effect at the first character of this node.
ParentGets the node this one is a child of, or null when it is the root of its tree.
SyntaxTreeGets the tree this node belongs to, or null when it was built rather than parsed.

Gets the dialect the node was parsed as, or null when it is not part of a tree.

public RegexDialect? Dialect { get; }

Property value

RegexDialect?

Gets the options in effect at the first character of this node.

public RegexPatternOptions Options { get; }

Property value

RegexPatternOptions

Remarks

Inline constructs such as (?i) change the options part-way through a pattern, so this is what was in effect where the node starts rather than what the whole pattern was parsed with. A node built by SyntaxFactory rather than parsed reports RegexPatternOptions.None.

Gets the node this one is a child of, or null when it is the root of its tree.

public RegexSyntaxNode? Parent { get; }

Property value

RegexSyntaxNode?

Gets the tree this node belongs to, or null when it was built rather than parsed.

public RegexSyntaxTree? SyntaxTree { get; }

Property value

RegexSyntaxTree?

Methods

NameDescription
Accept(RegexSyntaxVisitor)Calls the method of visitor that matches this node.
Accept<TResult>(RegexSyntaxVisitor<TResult>)Calls the method of visitor that matches this node.
DescendantComments()Gets every comment in this node, in source order.
Kind()Gets what kind of node this is.

Accept overloads

Accept(RegexSyntaxVisitor)

Calls the method of visitor that matches this node.

public abstract void Accept(RegexSyntaxVisitor visitor)
Parameters
visitor RegexSyntaxVisitor
Exceptions
ArgumentNullException
visitor is null.

Accept<TResult>(RegexSyntaxVisitor<TResult>)

Calls the method of visitor that matches this node.

public abstract TResult? Accept<TResult>(RegexSyntaxVisitor<TResult> visitor)
Type parameters
TResult
Parameters
visitor RegexSyntaxVisitor<TResult>
Returns

TResult?

Exceptions
ArgumentNullException
visitor is null.

DescendantComments()

RegexSyntaxNode.cs

Gets every comment in this node, in source order.

public IEnumerable<SyntaxTrivia> DescendantComments()

Gets what kind of node this is.

public SyntaxKind Kind()

Returns

SyntaxKind