Line data Source code
1 : /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 2 : * Use of this file is governed by the BSD 3-clause license that 3 : * can be found in the LICENSE.txt file in the project root. 4 : */ 5 : 6 : #pragma once 7 : 8 : #include "antlr4-common.h" 9 : 10 : namespace antlr4 { 11 : namespace tree { 12 : 13 : /** This interface describes the minimal core of methods triggered 14 : * by {@link ParseTreeWalker}. E.g., 15 : * 16 : * ParseTreeWalker walker = new ParseTreeWalker(); 17 : * walker.walk(myParseTreeListener, myParseTree); <-- triggers events in your listener 18 : * 19 : * If you want to trigger events in multiple listeners during a single 20 : * tree walk, you can use the ParseTreeDispatcher object available at 21 : * 22 : * https://github.com/antlr/antlr4/issues/841 23 : */ 24 0 : class ANTLR4CPP_PUBLIC ParseTreeListener { 25 : public: 26 : virtual ~ParseTreeListener(); 27 : 28 : virtual void visitTerminal(TerminalNode *node) = 0; 29 : virtual void visitErrorNode(ErrorNode *node) = 0; 30 : virtual void enterEveryRule(ParserRuleContext *ctx) = 0; 31 : virtual void exitEveryRule(ParserRuleContext *ctx) = 0; 32 : 33 : bool operator == (const ParseTreeListener &other) { 34 : return this == &other; 35 : } 36 : }; 37 : 38 : } // namespace tree 39 : } // namespace antlr4