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