1<?php
2
3declare(strict_types=1);
4
5namespace Antlr\Antlr4\Runtime\Tree;
6
7/**
8 * This interface defines the basic notion of a parse tree visitor. Generated
9 * visitors implement this interface and the `XVisitor` interface for grammar `X`.
10 */
11interface ParseTreeVisitor
12{
13    /**
14     * Visit a parse tree, and return a user-defined result of the operation.
15     * Must return the result of visiting the parse tree.
16     *
17     * @param ParseTree $tree The {@see ParseTree} to visit.
18     */
19    public function visit(ParseTree $tree);
20
21    /**
22     * Visit the children of a node, and return a user-defined result of the
23     * operation. Must return the result of visiting the parse tree.
24     *
25     * @param RuleNode $node The {@see RuleNode} whose children should be visited.
26     */
27    public function visitChildren(RuleNode $node);
28
29    /**
30     * Visit a terminal node, and return a user-defined result of the operation.
31     * Must return the result of visiting the parse tree.
32     *
33     * @param TerminalNode $node The {@see TerminalNode} to visit.
34     */
35    public function visitTerminal(TerminalNode $node);
36
37    /**
38     * Visit an error node, and return a user-defined result of the operation.
39     * Must return the result of visiting the parse tree.
40     *
41     * @param ErrorNode $node The {@see ErrorNode} to visit.
42     */
43    public function visitErrorNode(ErrorNode $node);
44}
45