MrKWatkins.Ast Help

Listener<TContext, TNode> Class

Definition

A listener for a syntax tree. A listener walks the tree and gets notified when nodes are reached. An alternative to processing. Useful to build something completely new from the tree whereas processing is more useful to mutate the tree.

public abstract class Listener<TContext, TNode> where TNode : Node<TNode>

Type Parameters

Name

Description

TContext

The type of the context object.

TNode

The type of the nodes to listen to.

Constructors

Name

Description

Listener()

Methods

Name

Description

AfterListenToNode(TContext, TNode)

Called after a node and its descendents have been listened to.

BeforeListenToNode(TContext, TNode)

Called before a node and its descendents are listened to.

Listen(TContext, TNode)

Listen to the specified node and its descendents.

ListenToNode(TContext, TNode)

Called when the node is listened to.

ShouldListenToChildren(TContext, TNode)

Return a value indicating whether child nodes should be listened to or not. Defaults to true.

Last modified: 09 September 2024