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 0 : class ANTLR4CPP_PUBLIC ParseTreeWalker { 14 : public: 15 : static ParseTreeWalker &DEFAULT; 16 : 17 : virtual ~ParseTreeWalker(); 18 : 19 : virtual void walk(ParseTreeListener *listener, ParseTree *t) const; 20 : 21 : protected: 22 : /// The discovery of a rule node, involves sending two events: the generic 23 : /// <seealso cref="ParseTreeListener#enterEveryRule"/> and a 24 : /// <seealso cref="RuleContext"/>-specific event. First we trigger the generic and then 25 : /// the rule specific. We do them in reverse order upon finishing the node. 26 : virtual void enterRule(ParseTreeListener *listener, ParseTree *r) const; 27 : virtual void exitRule(ParseTreeListener *listener, ParseTree *r) const; 28 : }; 29 : 30 : } // namespace tree 31 : } // namespace antlr4