Skip to content

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.

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

View source

Type Parameters ​

NameDescription
TContextThe type of the context object.
TNodeThe type of the nodes to listen to.

Constructors ​

NameDescription
Listener()

Methods ​

NameDescription
AfterListenToNode(TContext, TNode)Called after a node and its descendants have been listened to.
BeforeListenToNode(TContext, TNode)Called before a node and its descendants are listened to.
Listen(TContext, TNode)Listen to the specified node and its descendants.
ListenToNode(TContext, TNode)Called when the node is listened to.
ShouldListenToDescendants(TContext, TNode)Return a value indicating whether child nodes should be listened to or not. Defaults to true.