| 5 |
|
* Project led by Terence Parr at http://www.jGuru.com |
| 6 |
|
* Software rights: http://www.antlr.org/license.html |
| 7 |
|
* |
| 8 |
< |
* $Id: BaseAST.hpp,v 1.1 2005-12-02 15:38:02 tim Exp $ |
| 8 |
> |
* $Id$ |
| 9 |
|
*/ |
| 10 |
|
|
| 11 |
– |
#include <iostream> |
| 12 |
– |
|
| 11 |
|
#include <antlr/config.hpp> |
| 12 |
|
#include <antlr/AST.hpp> |
| 13 |
|
|
| 14 |
+ |
#include <iostream> |
| 15 |
+ |
|
| 16 |
|
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
| 17 |
|
namespace antlr { |
| 18 |
|
#endif |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
/// Return the class name |
| 37 |
< |
const char* typeName( void ) const |
| 38 |
< |
{ |
| 39 |
< |
return BaseAST::TYPE_NAME; |
| 40 |
< |
} |
| 37 |
> |
virtual const char* typeName( void ) const = 0; |
| 38 |
|
|
| 39 |
|
/// Clone this AST node. |
| 40 |
< |
RefAST clone( void ) const |
| 44 |
< |
{ |
| 45 |
< |
ANTLR_USE_NAMESPACE(std)cerr << "BaseAST::clone()" << ANTLR_USE_NAMESPACE(std)endl; |
| 46 |
< |
return nullAST; |
| 47 |
< |
} |
| 40 |
> |
virtual RefAST clone( void ) const = 0; |
| 41 |
|
|
| 42 |
|
/// Is node t equal to this in terms of token type and text? |
| 43 |
|
virtual bool equals(RefAST t) const; |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
/// Set the next sibling after this one. |
| 134 |
< |
void setNextSibling(RefAST n) |
| 134 |
> |
virtual void setNextSibling(RefAST n) |
| 135 |
|
{ |
| 136 |
|
right = static_cast<BaseAST*>(static_cast<AST*>(n)); |
| 137 |
|
} |
| 168 |
|
/// Print out a child sibling tree in LISP notation |
| 169 |
|
virtual ANTLR_USE_NAMESPACE(std)string toStringList() const; |
| 170 |
|
virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const; |
| 178 |
– |
|
| 179 |
– |
static const char* const TYPE_NAME; |
| 171 |
|
protected: |
| 172 |
|
RefBaseAST down; |
| 173 |
|
RefBaseAST right; |