/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
#pragma once
#include "support/Any.h"
namespace antlr4 {
namespace tree {
///
/// This interface defines the basic notion of a parse tree visitor. Generated
/// visitors implement this interface and the {@code XVisitor} interface for
/// grammar {@code X}.
///
/// @param The return type of the visit operation. Use for
/// operations with no return type.
// ml: no template parameter here, to avoid the need for virtual template functions. Instead we have our Any class.
class ANTLR4CPP_PUBLIC ParseTreeVisitor {
public:
virtual ~ParseTreeVisitor();
///
/// Visit a parse tree, and return a user-defined result of the operation.
///
/// The to visit.
/// The result of visiting the parse tree.
virtual antlrcpp::Any visit(ParseTree *tree) = 0;
///
/// Visit the children of a node, and return a user-defined result of the
/// operation.
///
/// The whose children should be visited.
/// The result of visiting the children of the node.
virtual antlrcpp::Any visitChildren(ParseTree *node) = 0;
///
/// Visit a terminal node, and return a user-defined result of the operation.
///
/// The to visit.
/// The result of visiting the node.
virtual antlrcpp::Any visitTerminal(TerminalNode *node) = 0;
///
/// Visit an error node, and return a user-defined result of the operation.
///
/// The to visit.
/// The result of visiting the node.
virtual antlrcpp::Any visitErrorNode(ErrorNode *node) = 0;
};
} // namespace tree
} // namespace antlr4